From ae83b2f10afce1b76e6b5d5ad5e3594cc443c04e Mon Sep 17 00:00:00 2001 From: Michael Pfeiffer Date: Sat, 30 Oct 2010 07:06:55 +0000 Subject: [PATCH] * Use check box to enable "Print preview" instead of a button. The button did make sense in BeOS where there was no printer selection dialog. The dialog is enabled in Haiku per default and clicking the "Preview" button closes the job setup dialog and returns to the printer selection dialog. The preview is shown after the printer selection dialog is closed clicking on the "OK" button. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39192 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/libs/print/libprint/JobSetupDlg.h | 3 ++- src/libs/print/libprint/JobSetupDlg.cpp | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/headers/libs/print/libprint/JobSetupDlg.h b/headers/libs/print/libprint/JobSetupDlg.h index f848afc7c8..561245100b 100644 --- a/headers/libs/print/libprint/JobSetupDlg.h +++ b/headers/libs/print/libprint/JobSetupDlg.h @@ -34,7 +34,7 @@ public: const PrinterCap* printerCap); virtual void AttachedToWindow(); virtual void MessageReceived(BMessage* message); - bool UpdateJobData(bool showPreview); + bool UpdateJobData(); private: void UpdateButtonEnabledState(); @@ -89,6 +89,7 @@ private: BRadioButton* fOddNumberedPages; BRadioButton* fEvenNumberedPages; std::map fDriverSpecificLists; + BCheckBox* fPreview; }; class JobSetupDlg : public DialogWindow { diff --git a/src/libs/print/libprint/JobSetupDlg.cpp b/src/libs/print/libprint/JobSetupDlg.cpp index 827dd9da61..b8806275c4 100644 --- a/src/libs/print/libprint/JobSetupDlg.cpp +++ b/src/libs/print/libprint/JobSetupDlg.cpp @@ -119,7 +119,6 @@ const BaseCap *gDitherTypes[] = { enum { kMsgRangeAll = 'JSdl', kMsgRangeSelection, - kMsgPreview, kMsgCancel, kMsgOK, kMsgQuality, @@ -318,13 +317,15 @@ JobSetupView::AttachedToWindow() fEvenNumberedPages = CreatePageSelectionItem("evenPages", "Even-Numbered Pages", JobData::kEvenNumberedPages); + fPreview = new BCheckBox("preview", "Show preview before printing", NULL); + if (fJobData->getShowPreview()) + fPreview->SetValue(B_CONTROL_ON); + // separator line BBox *separator = new BBox("separator"); separator->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1)); // buttons - BButton* preview = new BButton("preview", "Preview" B_UTF8_ELLIPSIS, - new BMessage(kMsgPreview)); BButton* cancel = new BButton("cancel", "Cancel", new BMessage(kMsgCancel)); BButton* ok = new BButton("ok", "OK", new BMessage(kMsgOK)); @@ -418,12 +419,12 @@ JobSetupView::AttachedToWindow() .AddGlue() .End() .End() + .Add(fPreview) .AddGlue() .Add(separator) .AddGroup(B_HORIZONTAL, 10, 1.0f) .AddGlue() .Add(cancel) - .Add(preview) .Add(ok) .End() .SetInsets(0, 0, 0, 0) @@ -732,9 +733,9 @@ JobSetupView::PaperSource() } bool -JobSetupView::UpdateJobData(bool showPreview) +JobSetupView::UpdateJobData() { - fJobData->setShowPreview(showPreview); + fJobData->setShowPreview(fPreview->Value() == B_CONTROL_ON); fJobData->setColor(Color()); if (IsHalftoneConfigurationNeeded()) { fJobData->setGamma(Gamma()); @@ -820,8 +821,7 @@ JobSetupDlg::MessageReceived(BMessage* message) { switch (message->what) { case kMsgOK: - case kMsgPreview: - fJobSetup->UpdateJobData(message->what == kMsgPreview); + fJobSetup->UpdateJobData(); SetResult(B_NO_ERROR); PostMessage(B_QUIT_REQUESTED); break;