* 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
This commit is contained in:
Michael Pfeiffer 2010-10-30 07:06:55 +00:00
parent de18d919e7
commit ae83b2f10a
2 changed files with 10 additions and 9 deletions

View File

@ -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<PrinterCap::CapID, BPopUpMenu*> fDriverSpecificLists;
BCheckBox* fPreview;
};
class JobSetupDlg : public DialogWindow {

View File

@ -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;