2002-11-27 02:03:14 +03:00
|
|
|
/*
|
|
|
|
* JobSetupDlg.cpp
|
|
|
|
* Copyright 1999-2000 Y.Takagi. All Rights Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __JOBSETUPDLG_H
|
|
|
|
#define __JOBSETUPDLG_H
|
|
|
|
|
|
|
|
#include <View.h>
|
2010-10-30 10:54:16 +04:00
|
|
|
#include <map>
|
|
|
|
|
2004-11-28 22:05:01 +03:00
|
|
|
#include "DialogWindow.h"
|
2002-11-27 02:03:14 +03:00
|
|
|
|
2004-02-14 02:56:14 +03:00
|
|
|
#include "JobData.h"
|
|
|
|
#include "Halftone.h"
|
2004-11-28 22:05:01 +03:00
|
|
|
#include "JSDSlider.h"
|
2010-10-25 18:21:09 +04:00
|
|
|
#include "PrinterCap.h"
|
2004-02-14 02:56:14 +03:00
|
|
|
|
2002-11-27 02:03:14 +03:00
|
|
|
class BCheckBox;
|
2010-10-30 10:54:16 +04:00
|
|
|
class BGridLayout;
|
2002-11-27 02:03:14 +03:00
|
|
|
class BPopUpMenu;
|
2010-10-30 10:54:16 +04:00
|
|
|
class BRadioButton;
|
2010-11-14 13:58:10 +03:00
|
|
|
class BSlider;
|
2010-10-30 10:54:16 +04:00
|
|
|
class BTextControl;
|
|
|
|
class BTextView;
|
2004-02-14 02:56:14 +03:00
|
|
|
class HalftoneView;
|
2010-10-30 10:54:16 +04:00
|
|
|
class JobData;
|
2005-01-09 20:39:30 +03:00
|
|
|
class PagesView;
|
2010-10-30 10:54:16 +04:00
|
|
|
class PrinterCap;
|
|
|
|
class PrinterData;
|
2002-11-27 02:03:14 +03:00
|
|
|
|
2010-11-14 13:58:10 +03:00
|
|
|
|
|
|
|
template<typename T, typename R>
|
|
|
|
class Range
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Range();
|
|
|
|
Range(const char* label, const char* key, const R* range, BSlider* slider);
|
|
|
|
const char* Key() const;
|
|
|
|
T Value();
|
|
|
|
void UpdateLabel();
|
|
|
|
|
|
|
|
private:
|
|
|
|
const char* fLabel;
|
|
|
|
const char* fKey;
|
|
|
|
const R* fRange;
|
|
|
|
BSlider* fSlider;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T, typename R>
|
|
|
|
Range<T, R>::Range()
|
|
|
|
:
|
|
|
|
fKey(NULL),
|
|
|
|
fRange(NULL),
|
|
|
|
fSlider(NULL)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T, typename R>
|
|
|
|
Range<T, R>::Range(const char* label, const char* key, const R* range,
|
|
|
|
BSlider* slider)
|
|
|
|
:
|
|
|
|
fLabel(label),
|
|
|
|
fKey(key),
|
|
|
|
fRange(range),
|
|
|
|
fSlider(slider)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T, typename R>
|
|
|
|
const char*
|
|
|
|
Range<T, R>::Key() const
|
|
|
|
{
|
|
|
|
return fKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T, typename R>
|
|
|
|
T
|
|
|
|
Range<T, R>::Value()
|
|
|
|
{
|
|
|
|
return static_cast<T>(fRange->Lower() +
|
|
|
|
(fRange->Upper() - fRange->Lower()) * fSlider->Position());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template<typename T, typename R>
|
|
|
|
void
|
|
|
|
Range<T, R>::UpdateLabel()
|
|
|
|
{
|
|
|
|
BString label = fLabel;
|
|
|
|
label << " (" << Value() << ")";
|
|
|
|
fSlider->SetLabel(label.String());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
typedef Range<int32, IntRangeCap> IntRange;
|
|
|
|
typedef Range<double, DoubleRangeCap> DoubleRange;
|
|
|
|
|
2002-11-27 02:03:14 +03:00
|
|
|
class JobSetupView : public BView {
|
|
|
|
public:
|
2010-10-26 13:56:56 +04:00
|
|
|
JobSetupView(JobData* jobData, PrinterData* printerData,
|
|
|
|
const PrinterCap* printerCap);
|
|
|
|
virtual void AttachedToWindow();
|
|
|
|
virtual void MessageReceived(BMessage* message);
|
2010-10-30 11:06:55 +04:00
|
|
|
bool UpdateJobData();
|
2002-11-27 02:03:14 +03:00
|
|
|
|
|
|
|
private:
|
2010-10-26 13:56:56 +04:00
|
|
|
void UpdateButtonEnabledState();
|
|
|
|
bool IsHalftoneConfigurationNeeded();
|
|
|
|
void CreateHalftoneConfigurationUI();
|
2010-10-30 10:54:16 +04:00
|
|
|
void AddDriverSpecificSettings(BGridLayout* gridLayout, int row);
|
2010-11-14 13:58:10 +03:00
|
|
|
void AddPopUpMenu(const DriverSpecificCap* capability,
|
|
|
|
BGridLayout* gridLayout, int& row);
|
|
|
|
void AddCheckBox(const DriverSpecificCap* capability,
|
|
|
|
BGridLayout* gridLayout, int& row);
|
|
|
|
void AddIntSlider(const DriverSpecificCap* capability,
|
|
|
|
BGridLayout* gridLayout, int& row);
|
|
|
|
void AddDoubleSlider(const DriverSpecificCap* capability,
|
|
|
|
BGridLayout* gridLayout, int& row);
|
2010-10-30 10:54:16 +04:00
|
|
|
string GetDriverSpecificValue(PrinterCap::CapID category,
|
|
|
|
const char* key);
|
|
|
|
template<typename Predicate>
|
|
|
|
void FillCapabilityMenu(BPopUpMenu* menu, uint32 message,
|
|
|
|
const BaseCap** capabilities, int count,
|
|
|
|
Predicate& predicate);
|
2010-10-26 13:56:56 +04:00
|
|
|
void FillCapabilityMenu(BPopUpMenu* menu, uint32 message,
|
|
|
|
PrinterCap::CapID category, int id);
|
|
|
|
void FillCapabilityMenu(BPopUpMenu* menu, uint32 message,
|
|
|
|
const BaseCap** capabilities, int count, int id);
|
|
|
|
int GetID(const BaseCap** capabilities, int count,
|
|
|
|
const char* label, int defaultValue);
|
|
|
|
BRadioButton* CreatePageSelectionItem(const char* name,
|
|
|
|
const char* label,
|
|
|
|
JobData::PageSelection pageSelection);
|
|
|
|
void AllowOnlyDigits(BTextView* textView, int maxDigits);
|
|
|
|
void UpdateHalftonePreview();
|
2010-11-14 13:58:10 +03:00
|
|
|
void UpdateIntSlider(BMessage* message);
|
|
|
|
void UpdateDoubleSlider(BMessage* message);
|
2004-02-14 02:56:14 +03:00
|
|
|
|
2010-10-26 13:56:56 +04:00
|
|
|
JobData::Color Color();
|
|
|
|
Halftone::DitherType DitherType();
|
|
|
|
float Gamma();
|
|
|
|
float InkDensity();
|
|
|
|
JobData::PaperSource PaperSource();
|
|
|
|
|
2010-11-14 13:58:10 +03:00
|
|
|
|
2010-10-26 13:56:56 +04:00
|
|
|
BTextControl* fCopies;
|
|
|
|
BTextControl* fFromPage;
|
|
|
|
BTextControl* fToPage;
|
|
|
|
JobData* fJobData;
|
|
|
|
PrinterData* fPrinterData;
|
|
|
|
const PrinterCap* fPrinterCap;
|
|
|
|
BPopUpMenu* fColorType;
|
|
|
|
BPopUpMenu* fDitherType;
|
|
|
|
BMenuField* fDitherMenuField;
|
|
|
|
JSDSlider* fGamma;
|
|
|
|
JSDSlider* fInkDensity;
|
|
|
|
HalftoneView* fHalftone;
|
|
|
|
BBox* fHalftoneBox;
|
|
|
|
BRadioButton* fAll;
|
|
|
|
BCheckBox* fCollate;
|
|
|
|
BCheckBox* fReverse;
|
|
|
|
PagesView* fPages;
|
|
|
|
BPopUpMenu* fPaperFeed;
|
|
|
|
BCheckBox* fDuplex;
|
|
|
|
BPopUpMenu* fNup;
|
|
|
|
BRadioButton* fAllPages;
|
|
|
|
BRadioButton* fOddNumberedPages;
|
|
|
|
BRadioButton* fEvenNumberedPages;
|
2010-11-14 13:58:10 +03:00
|
|
|
std::map<PrinterCap::CapID, BPopUpMenu*> fDriverSpecificPopUpMenus;
|
|
|
|
std::map<string, BCheckBox*> fDriverSpecificCheckBoxes;
|
|
|
|
std::map<PrinterCap::CapID, IntRange> fDriverSpecificIntSliders;
|
|
|
|
std::map<PrinterCap::CapID, DoubleRange> fDriverSpecificDoubleSliders;
|
2010-10-30 11:06:55 +04:00
|
|
|
BCheckBox* fPreview;
|
2002-11-27 02:03:14 +03:00
|
|
|
};
|
|
|
|
|
2004-11-28 22:05:01 +03:00
|
|
|
class JobSetupDlg : public DialogWindow {
|
2002-11-27 02:03:14 +03:00
|
|
|
public:
|
2010-10-26 13:56:56 +04:00
|
|
|
JobSetupDlg(JobData* jobData, PrinterData* printerData,
|
|
|
|
const PrinterCap* printerCap);
|
|
|
|
virtual void MessageReceived(BMessage* message);
|
2002-11-27 02:03:14 +03:00
|
|
|
|
|
|
|
private:
|
2010-10-26 13:56:56 +04:00
|
|
|
JobSetupView* fJobSetup;
|
2002-11-27 02:03:14 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __JOBSETUPDLG_H */
|