* Added driver specific settings to job data and job
setup dialog. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39191 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -10,6 +10,9 @@
|
||||
#include <GraphicsDefs.h>
|
||||
#include <Rect.h>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "Halftone.h"
|
||||
#include "MarginView.h" // for MarginUnit
|
||||
|
||||
@@ -255,6 +258,7 @@ private:
|
||||
Halftone::DitherType fDitherType;
|
||||
PageSelection fPageSelection;
|
||||
MarginUnit fMarginUnit;
|
||||
map<string, string> fDriverSpecificSettings;
|
||||
|
||||
public:
|
||||
JobData(BMessage *msg, const PrinterCap *cap, Settings settings);
|
||||
@@ -355,6 +359,14 @@ public:
|
||||
|
||||
MarginUnit getMarginUnit() const { return fMarginUnit; }
|
||||
void setMarginUnit(MarginUnit marginUnit) { fMarginUnit = marginUnit; }
|
||||
|
||||
bool HasDriverSpecificSetting(const string& category) const;
|
||||
const string& DriverSpecificSetting(const string& category) const;
|
||||
void SetDriverSpecificSetting(const string& category, const string& value);
|
||||
|
||||
private:
|
||||
void SerializePrinterSpecificSettings(BString& serializedSettings);
|
||||
void DeserializePrinterSpecificSettings(BString& serializedSettings);
|
||||
};
|
||||
|
||||
#endif /* __JOBDATA_H */
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
#define __JOBSETUPDLG_H
|
||||
|
||||
#include <View.h>
|
||||
#include <map>
|
||||
|
||||
#include "DialogWindow.h"
|
||||
|
||||
#include "JobData.h"
|
||||
@@ -14,16 +16,17 @@
|
||||
#include "JSDSlider.h"
|
||||
#include "PrinterCap.h"
|
||||
|
||||
class BCheckBox;
|
||||
class BGridLayout;
|
||||
class BPopUpMenu;
|
||||
class BRadioButton;
|
||||
class BTextControl;
|
||||
class BTextView;
|
||||
class BRadioButton;
|
||||
class BCheckBox;
|
||||
class BPopUpMenu;
|
||||
class JobData;
|
||||
class PrinterData;
|
||||
class PrinterCap;
|
||||
class HalftoneView;
|
||||
class JobData;
|
||||
class PagesView;
|
||||
class PrinterCap;
|
||||
class PrinterData;
|
||||
|
||||
class JobSetupView : public BView {
|
||||
public:
|
||||
@@ -37,6 +40,13 @@ private:
|
||||
void UpdateButtonEnabledState();
|
||||
bool IsHalftoneConfigurationNeeded();
|
||||
void CreateHalftoneConfigurationUI();
|
||||
void AddDriverSpecificSettings(BGridLayout* gridLayout, int row);
|
||||
string GetDriverSpecificValue(PrinterCap::CapID category,
|
||||
const char* key);
|
||||
template<typename Predicate>
|
||||
void FillCapabilityMenu(BPopUpMenu* menu, uint32 message,
|
||||
const BaseCap** capabilities, int count,
|
||||
Predicate& predicate);
|
||||
void FillCapabilityMenu(BPopUpMenu* menu, uint32 message,
|
||||
PrinterCap::CapID category, int id);
|
||||
void FillCapabilityMenu(BPopUpMenu* menu, uint32 message,
|
||||
@@ -78,6 +88,7 @@ private:
|
||||
BRadioButton* fAllPages;
|
||||
BRadioButton* fOddNumberedPages;
|
||||
BRadioButton* fEvenNumberedPages;
|
||||
std::map<PrinterCap::CapID, BPopUpMenu*> fDriverSpecificLists;
|
||||
};
|
||||
|
||||
class JobSetupDlg : public DialogWindow {
|
||||
|
||||
@@ -117,7 +117,7 @@ struct DriverSpecificCap : public BaseCap {
|
||||
};
|
||||
|
||||
DriverSpecificCap(const string& label,
|
||||
bool isDefault, int32 category, Type type);
|
||||
int32 category, Type type);
|
||||
|
||||
int32 ID() const;
|
||||
|
||||
@@ -125,6 +125,13 @@ struct DriverSpecificCap : public BaseCap {
|
||||
Type fType;
|
||||
};
|
||||
|
||||
struct ListItemCap : public BaseCap {
|
||||
ListItemCap(const string& label,
|
||||
bool isDefault, int32 id);
|
||||
|
||||
int32 ID() const;
|
||||
int32 fID;
|
||||
};
|
||||
|
||||
class PrinterData;
|
||||
|
||||
@@ -142,7 +149,7 @@ public:
|
||||
kBindingLocation,
|
||||
kColor,
|
||||
kProtocolClass,
|
||||
kDriverSpecifcCapababilities,
|
||||
kDriverSpecificCapabilities,
|
||||
|
||||
// Static boolean settings follow.
|
||||
// For them isSupport() has to be implemented only.
|
||||
@@ -151,7 +158,54 @@ public:
|
||||
// for class Halftone?
|
||||
|
||||
// The driver specific generic capabilities start here
|
||||
kDriverSpecificCapabablitiesBegin = 100
|
||||
kDriverSpecificCapabilitiesBegin = 100
|
||||
};
|
||||
|
||||
struct IDPredicate
|
||||
{
|
||||
IDPredicate(int id)
|
||||
: fID(id)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool operator()(const BaseCap* baseCap) {
|
||||
return baseCap->ID() == fID;
|
||||
}
|
||||
|
||||
int fID;
|
||||
};
|
||||
|
||||
struct LabelPredicate
|
||||
{
|
||||
LabelPredicate(const char* label)
|
||||
: fLabel(label)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool operator()(const BaseCap* baseCap) {
|
||||
return baseCap->fLabel == fLabel;
|
||||
}
|
||||
|
||||
const char* fLabel;
|
||||
|
||||
};
|
||||
|
||||
struct KeyPredicate
|
||||
{
|
||||
KeyPredicate(const char* key)
|
||||
: fKey(key)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool operator()(const BaseCap* baseCap) {
|
||||
return baseCap->fKey == fKey;
|
||||
}
|
||||
|
||||
const char* fKey;
|
||||
|
||||
};
|
||||
|
||||
virtual int countCap(CapID category) const = 0;
|
||||
@@ -160,12 +214,16 @@ public:
|
||||
const BaseCap* getDefaultCap(CapID category) const;
|
||||
const BaseCap* findCap(CapID category, int id) const;
|
||||
const BaseCap* findCap(CapID category, const char* label) const;
|
||||
const BaseCap* findCapWithKey(CapID category, const char* key)
|
||||
const;
|
||||
|
||||
int getProtocolClass() const;
|
||||
|
||||
protected:
|
||||
PrinterCap(const PrinterCap& printerCap);
|
||||
PrinterCap& operator=(const PrinterCap& printerCap);
|
||||
template<typename Predicate>
|
||||
const BaseCap* findCap(CapID category, Predicate& predicate) const;
|
||||
|
||||
const PrinterData* getPrinterData() const;
|
||||
|
||||
@@ -174,4 +232,6 @@ private:
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __PRINTERCAP_H */
|
||||
|
||||
Reference in New Issue
Block a user