* 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->SetDivider(be_plain_font->StringWidth("From: "));
fFrom->SetEnabled(!allPages); fFrom->SetEnabled(!allPages);
rect = fFrom->Frame();
fTo = new BTextControl(rect, "to", "To:", "SomeSpaceHere", NULL); fTo = new BTextControl(rect, "to", "To:", "SomeSpaceHere", NULL);
panel->AddChild(fTo); panel->AddChild(fTo);
fTo->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT); fTo->SetAlignment(B_ALIGN_LEFT, B_ALIGN_RIGHT);
fTo->ResizeToPreferred();
fTo->SetDivider(be_plain_font->StringWidth("To: ")); fTo->SetDivider(be_plain_font->StringWidth("To: "));
fTo->MoveTo(fFrom->Frame().right + 10.0, fTo->Frame().top); fTo->MoveTo(fFrom->Frame().right + 10.0, fTo->Frame().top);
fTo->SetEnabled(!allPages); fTo->SetEnabled(!allPages);

View File

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

View File

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

View File

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

View File

@ -70,8 +70,15 @@ PrinterDriver::PrintJob(BFile *spoolFile, BMessage *jobMsg)
BeginJob(); BeginJob();
fPrinting = true; 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) { 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); page, pfh.page_count);
} }
@ -79,7 +86,7 @@ PrinterDriver::PrintJob(BFile *spoolFile, BMessage *jobMsg)
PrintJobReader reader(fJobFile); PrintJobReader reader(fJobFile);
status_t status = reader.InitCheck(); 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::NumberOfPages(): %ld\n", reader.NumberOfPages());
printf("PrintJobReader::FirstPage(): %ld\n", reader.FirstPage()); printf("PrintJobReader::FirstPage(): %ld\n", reader.FirstPage());
printf("PrintJobReader::LastPage(): %ld\n", reader.LastPage()); printf("PrintJobReader::LastPage(): %ld\n", reader.LastPage());