* build fix and some more debug output

* fix broken ui look in Job Setup on R5
* fix initialized page size msg field only seen on R5
* remember orientation setting to avoid always swapping it 

thanks Michael for pointing this out  :)



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24598 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Karsten Heimrich 2008-03-26 23:39:34 +00:00
parent 395880e0a9
commit 5226ccb689
5 changed files with 35 additions and 32 deletions

View File

@ -70,10 +70,10 @@ JobSetupWindow::JobSetupWindow(BMessage *msg, const char * printerName)
fFrom->SetDivider(be_plain_font->StringWidth("From: "));
fFrom->SetEnabled(!allPages);
rect = fFrom->Frame();
fTo = new BTextControl(rect, "to", "To:", "SomeSpaceHere", NULL);
panel->AddChild(fTo);
fTo->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
fTo->ResizeToPreferred();
fTo->SetDivider(be_plain_font->StringWidth("To: "));
fTo->MoveTo(fFrom->Frame().right + 10.0, fTo->Frame().top);
fTo->SetEnabled(!allPages);

View File

@ -101,20 +101,23 @@ PageSetupWindow::PageSetupWindow(BMessage *msg, const char *printerName)
SetTitle(BString(printerName).Append(" Page Setup").String());
// load orientation
int32 orient = 0;
fSetupMsg->FindInt32("orientation", &orient);
if (fSetupMsg->FindInt32("orientation", &fCurrentOrientation) != B_OK)
fCurrentOrientation = 0;
// load page rect
BRect page;
float width = letter_width;
float height = letter_height;
BRect page(0, 0, width, height);
if (fSetupMsg->FindRect("preview:paper_rect", &page) == B_OK) {
width = page.Width();
height = page.Height();
} else {
page.Set(0, 0, width, height);
}
BString label("Letter");
fSetupMsg->FindString("preview:paper_size", &label);
BString label;
if (fSetupMsg->FindString("preview:paper_size", &label) != B_OK)
label = "Letter";
// Load units
int32 units;
@ -183,7 +186,7 @@ PageSetupWindow::PageSetupWindow(BMessage *msg, const char *printerName)
BMenuItem* item = new BMenuItem(orientation[i].label, message);
m->AddItem(item);
if (orient == orientation[i].orientation)
if (fCurrentOrientation == orientation[i].orientation)
item->SetMarked(true);
}
@ -247,13 +250,9 @@ PageSetupWindow::PageSetupWindow(BMessage *msg, const char *printerName)
void
PageSetupWindow::UpdateSetupMessage()
{
int32 orientation = 0;
BMenuItem *item = fOrientationMenu->Menu()->FindMarked();
if (item) {
BMessage *msg = item->Message();
msg->FindInt32("orientation", &orientation);
SetInt32(fSetupMsg, "orientation", orientation);
}
SetInt32(fSetupMsg, "xres", 300);
SetInt32(fSetupMsg, "yres", 300);
SetInt32(fSetupMsg, "orientation", fCurrentOrientation);
// Save scaling factor
float scale = atoi(fScaleControl->Text());
@ -262,14 +261,14 @@ PageSetupWindow::UpdateSetupMessage()
SetFloat(fSetupMsg, "scale", scale);
float scaleR = 100.0 / scale;
item = fPageSizeMenu->Menu()->FindMarked();
BMenuItem *item = fPageSizeMenu->Menu()->FindMarked();
if (item) {
float w, h;
BMessage *msg = item->Message();
msg->FindFloat("width", &w);
msg->FindFloat("height", &h);
BRect r(0, 0, w, h);
if (orientation != 0)
if (fCurrentOrientation != 0)
r.Set(0, 0, h, w);
SetRect(fSetupMsg, "preview:paper_rect", r);
@ -290,9 +289,6 @@ PageSetupWindow::UpdateSetupMessage()
SetInt32(fSetupMsg, "units", fMarginView->GetMarginUnit());
}
SetInt32(fSetupMsg, "xres", 300);
SetInt32(fSetupMsg, "yres", 300);
}
@ -313,23 +309,22 @@ PageSetupWindow::MessageReceived(BMessage *msg)
float w, h;
msg->FindFloat("width", &w);
msg->FindFloat("height", &h);
BMenuItem *item = fOrientationMenu->Menu()->FindMarked();
if (item) {
int32 orientation = 0;
item->Message()->FindInt32("orientation", &orientation);
if (orientation == PrinterDriver::PORTRAIT_ORIENTATION) {
fMarginView->SetPageSize(w, h);
} else {
fMarginView->SetPageSize(h, w);
}
fMarginView->UpdateView(MARGIN_CHANGED);
if (fCurrentOrientation == PrinterDriver::PORTRAIT_ORIENTATION) {
fMarginView->SetPageSize(w, h);
} else {
fMarginView->SetPageSize(h, w);
}
fMarginView->UpdateView(MARGIN_CHANGED);
} break;
case ORIENTATION_CHANGED: {
int32 orientation;
msg->FindInt32("orientation", &orientation);
if (fCurrentOrientation == orientation)
break;
fCurrentOrientation = orientation;
BPoint p = fMarginView->GetPageSize();
if (orientation == PrinterDriver::LANDSCAPE_ORIENTATION) {
fMarginView->SetPageSize(p.y, p.x);

View File

@ -49,6 +49,7 @@ private:
BTextControl * fScaleControl;
MarginView * fMarginView;
BString fPrinterDirName;
int32 fCurrentOrientation;
};
#endif

View File

@ -27,7 +27,7 @@ status_t
PreviewDriver::PrintJob(BFile *jobFile, BMessage *jobMsg)
{
#if PREVIEW_DRIVER_DEBUG
return PrinterDriver::PrintJob(jobFile, jobMsg)
return PrinterDriver::PrintJob(jobFile, jobMsg);
#else
PreviewWindow* w = new PreviewWindow(jobFile);
return w->Go();

View File

@ -70,8 +70,15 @@ PrinterDriver::PrintJob(BFile *spoolFile, BMessage *jobMsg)
BeginJob();
fPrinting = true;
printf("PrinterDriver::PrintJob, print massage read from spool file\n");
jobMsg->PrintToStream();
printf("\nPrinterDriver::PrintJob, print massage passed to print job\n");
msg.PrintToStream();
printf("\n");
for (int32 page = 1; page <= pfh.page_count; ++page) {
printf("PrinterDriver::PrintPage(): Faking print of page %ld/ %ld",
printf("PrinterDriver::PrintPage(): Faking print of page %ld/ %ld\n",
page, pfh.page_count);
}
@ -79,7 +86,7 @@ PrinterDriver::PrintJob(BFile *spoolFile, BMessage *jobMsg)
PrintJobReader reader(fJobFile);
status_t status = reader.InitCheck();
printf("PrintJobReader::InitCheck(): %s\n", status == B_OK ? "B_OK" : "B_ERROR");
printf("\nPrintJobReader::InitCheck(): %s\n", status == B_OK ? "B_OK" : "B_ERROR");
printf("PrintJobReader::NumberOfPages(): %ld\n", reader.NumberOfPages());
printf("PrintJobReader::FirstPage(): %ld\n", reader.FirstPage());
printf("PrintJobReader::LastPage(): %ld\n", reader.LastPage());