[haiku-commits] r39139 - in haiku/trunk: headers/libs/print/libprint src/libs/print/libprint

  • From: michael.w.pfeiffer@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 25 Oct 2010 13:34:31 +0200 (CEST)

Author: laplace
Date: 2010-10-25 13:34:31 +0200 (Mon, 25 Oct 2010)
New Revision: 39139
Changeset: http://dev.haiku-os.org/changeset/39139

Modified:
   haiku/trunk/headers/libs/print/libprint/PrinterCap.h
   haiku/trunk/src/libs/print/libprint/AddPrinterDlg.cpp
   haiku/trunk/src/libs/print/libprint/JobData.cpp
   haiku/trunk/src/libs/print/libprint/JobSetupDlg.cpp
   haiku/trunk/src/libs/print/libprint/PageSetupDlg.cpp
   haiku/trunk/src/libs/print/libprint/PrinterCap.cpp
   haiku/trunk/src/libs/print/libprint/PrinterDriver.cpp
Log:
* Style changes.
* Unused code removed.


Modified: haiku/trunk/headers/libs/print/libprint/PrinterCap.h
===================================================================
--- haiku/trunk/headers/libs/print/libprint/PrinterCap.h        2010-10-25 
11:19:17 UTC (rev 39138)
+++ haiku/trunk/headers/libs/print/libprint/PrinterCap.h        2010-10-25 
11:34:31 UTC (rev 39139)
@@ -10,74 +10,80 @@
 #include <Rect.h>
 #include "JobData.h"
 
-#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
 using namespace std;
-#else 
-#define std
-#endif
 
 enum {
        kUnknownPrinter = 0
 };
 
 struct BaseCap {
-       string label;
-       bool is_default;
-       BaseCap(const string &n, bool d) : label(n), is_default(d) {}
+                                                       BaseCap(const string 
&label, bool isDefault);
+
+                       string                  fLabel;
+                       bool                    fIsDefault;
 };
 
 struct PaperCap : public BaseCap {
-       JobData::Paper paper;
-       BRect paper_rect;
-       BRect physical_rect;
-       PaperCap(const string &n, bool d, JobData::Paper p, const BRect &r1, 
const BRect &r2)
-               : BaseCap(n, d), paper(p), paper_rect(r1), physical_rect(r2) {}
+                                                       PaperCap(const string 
&label, bool isDefault,
+                                                               JobData::Paper 
paper, const BRect &paperRect,
+                                                               const BRect 
&physicalRect);
+
+                       JobData::Paper  fPaper;
+                       BRect                   fPaperRect;
+                       BRect                   fPhysicalRect;
 };
 
 struct PaperSourceCap : public BaseCap {
-       JobData::PaperSource paper_source;
-       PaperSourceCap(const string &n, bool d, JobData::PaperSource f)
-               : BaseCap(n, d), paper_source(f) {}
+                                                       PaperSourceCap(const 
string &label, bool isDefault,
+                                                               
JobData::PaperSource paperSource);
+
+                       JobData::PaperSource    fPaperSource;
 };
 
 struct ResolutionCap : public BaseCap {
-       int xres;
-       int yres;
-       ResolutionCap(const string &n, bool d, int x, int y)
-               : BaseCap(n, d), xres(x), yres(y) {}
+                                                       ResolutionCap(const 
string &label, bool isDefault,
+                                                               int 
xResolution, int yResolution);
+
+                       int                             fXResolution;
+                       int                             fYResolution;
 };
 
 struct OrientationCap : public BaseCap {
-       JobData::Orientation orientation;
-       OrientationCap(const string &n, bool d, JobData::Orientation o)
-               : BaseCap(n, d), orientation(o) {}
+                                                       OrientationCap(const 
string &label, bool isDefault,
+                                                                       
JobData::Orientation orientation);
+
+                       JobData::Orientation    fOrientation;
 };
 
 struct PrintStyleCap : public BaseCap {
-       JobData::PrintStyle print_style;
-       PrintStyleCap(const string &n, bool d, JobData::PrintStyle x)
-               : BaseCap(n, d), print_style(x) {}
+                                                       PrintStyleCap(const 
string &label, bool isDefault,
+                                                               
JobData::PrintStyle printStyle);
+
+                       JobData::PrintStyle             fPrintStyle;
 };
 
 struct BindingLocationCap : public BaseCap {
-       JobData::BindingLocation binding_location;
-       BindingLocationCap(const string &n, bool d, JobData::BindingLocation b)
-               : BaseCap(n, d), binding_location(b) {}
+                                                       
BindingLocationCap(const string &label,
+                                                               bool isDefault,
+                                                               
JobData::BindingLocation bindingLocation);
+
+                       JobData::BindingLocation        fBindingLocation;
 };
 
 struct ColorCap : public BaseCap {
-       JobData::Color color;
-       ColorCap(const string &n, bool d, JobData::Color c)
-               : BaseCap(n, d), color(c) {}
+                                                       ColorCap(const string 
&label, bool isDefault,
+                                                               JobData::Color 
color);
+
+                       JobData::Color  fColor;
 };
 
 struct ProtocolClassCap : public BaseCap {
-       int protocolClass;
-       string description;
-       ProtocolClassCap(const string &n, bool d, int p, const string &desc)
-               : BaseCap(n, d)
-               , protocolClass(p) 
-               , description(desc) {}
+                                                       ProtocolClassCap(const 
string &label,
+                                                               bool isDefault, 
int protocolClass,
+                                                               const string 
&description);
+
+                       int                     fProtocolClass;
+                       string          fDescription;
 };
 
 
@@ -85,8 +91,8 @@
 
 class PrinterCap {
 public:
-       PrinterCap(const PrinterData *printer_data);
-       virtual ~PrinterCap();
+                                                       PrinterCap(const 
PrinterData *printer_data);
+       virtual                                 ~PrinterCap();
 
        enum CapID {
                kPaper,
@@ -102,37 +108,24 @@
                kCopyCommand,       // supports printer page copy command?
        };
 
-       virtual int countCap(CapID) const = 0;
-       virtual bool isSupport(CapID) const = 0;
-       virtual const BaseCap **enumCap(CapID) const = 0;
-       const BaseCap *getDefaultCap(CapID) const;
-       int getPrinterId() const;
-       int getProtocolClass() const;
+       virtual int                             countCap(CapID) const = 0;
+       virtual bool                    isSupport(CapID) const = 0;
+       virtual const BaseCap** enumCap(CapID) const = 0;
+                       const BaseCap*  getDefaultCap(CapID) const;
+                       int                             getPrinterId() const;
+                       int                             getProtocolClass() 
const;
 
 protected:
-       PrinterCap(const PrinterCap &);
-       PrinterCap &operator = (const PrinterCap &);
-       const PrinterData *getPrinterData() const;
-       void setPrinterId(int id);
+                                                       PrinterCap(const 
PrinterCap &);
+                       PrinterCap&             operator=(const PrinterCap &);
 
+                       const PrinterData*      getPrinterData() const;
+                       void                            setPrinterId(int id);
+
 private:
-       const PrinterData *fPrinterData;
-       int fPrinterID;
+                       const PrinterData*      fPrinterData;
+                       int                                     fPrinterID;
 };
 
-inline const PrinterData *PrinterCap::getPrinterData() const
-{
-       return fPrinterData;
-}
 
-inline int PrinterCap::getPrinterId() const
-{
-       return fPrinterID;
-}
-
-inline void PrinterCap::setPrinterId(int id)
-{
-       fPrinterID = id;
-}
-
 #endif /* __PRINTERCAP_H */

Modified: haiku/trunk/src/libs/print/libprint/AddPrinterDlg.cpp
===================================================================
--- haiku/trunk/src/libs/print/libprint/AddPrinterDlg.cpp       2010-10-25 
11:19:17 UTC (rev 39138)
+++ haiku/trunk/src/libs/print/libprint/AddPrinterDlg.cpp       2010-10-25 
11:34:31 UTC (rev 39139)
@@ -87,7 +87,7 @@
 };
 
 ProtocolClassItem::ProtocolClassItem(const ProtocolClassCap* cap)
-       : BStringItem(cap->label.c_str())
+       : BStringItem(cap->fLabel.c_str())
        , fProtocolClassCap(cap)
 {
 }
@@ -95,13 +95,13 @@
 int 
 ProtocolClassItem::getProtocolClass()
 {
-       return fProtocolClassCap->protocolClass;
+       return fProtocolClassCap->fProtocolClass;
 }
 
 const char *
 ProtocolClassItem::getDescription()
 {
-       return fProtocolClassCap->description.c_str();
+       return fProtocolClassCap->fDescription.c_str();
 }
 
 
@@ -147,7 +147,7 @@
                
                BStringItem* item = new ProtocolClassItem(protocolClass);
                fProtocolClassList->AddItem(item);
-               if (protocolClass->is_default) {
+               if (protocolClass->fIsDefault) {
                        int index = fProtocolClassList->IndexOf(item);
                        fProtocolClassList->Select(index);
                }

Modified: haiku/trunk/src/libs/print/libprint/JobData.cpp
===================================================================
--- haiku/trunk/src/libs/print/libprint/JobData.cpp     2010-10-25 11:19:17 UTC 
(rev 39138)
+++ haiku/trunk/src/libs/print/libprint/JobData.cpp     2010-10-25 11:34:31 UTC 
(rev 39139)
@@ -133,7 +133,7 @@
                fPaper = (Paper)msg->FindInt32(kJDPaper);
        else if (cap->isSupport(PrinterCap::kPaper)) {
                paperCap = (const PaperCap 
*)cap->getDefaultCap(PrinterCap::kPaper);
-               fPaper = paperCap->paper;
+               fPaper = paperCap->fPaper;
        } else
                fPaper = kA4;
 
@@ -142,7 +142,8 @@
                msg->FindInt64(kJDXRes, &xres64);
                fXRes = xres64; 
        } else if (cap->isSupport(PrinterCap::kResolution)) {
-               fXRes = ((const ResolutionCap 
*)cap->getDefaultCap(PrinterCap::kResolution))->xres;
+               fXRes = ((const ResolutionCap *)cap->getDefaultCap(
+                       PrinterCap::kResolution))->fXResolution;
        } else {
                fXRes = 300; 
        }
@@ -152,7 +153,8 @@
                msg->FindInt64(kJDYRes, &yres64);
                fYRes = yres64;
        } else if (cap->isSupport(PrinterCap::kResolution)) {
-               fYRes = ((const ResolutionCap 
*)cap->getDefaultCap(PrinterCap::kResolution))->yres;
+               fYRes = ((const ResolutionCap *)cap->getDefaultCap(
+                       PrinterCap::kResolution))->fYResolution;
        } else {
                fYRes = 300;
        }
@@ -160,7 +162,8 @@
        if (msg->HasInt32(kJDOrientation))
                fOrientation = (Orientation)msg->FindInt32(kJDOrientation);
        else if (cap->isSupport(PrinterCap::kOrientation))
-               fOrientation = ((const OrientationCap 
*)cap->getDefaultCap(PrinterCap::kOrientation))->orientation;
+               fOrientation = ((const OrientationCap *)cap->getDefaultCap(
+                       PrinterCap::kOrientation))->fOrientation;
        else
                fOrientation = kPortrait;
 
@@ -172,7 +175,7 @@
        if (msg->HasRect(kJDPaperRect)) {
                fPaperRect = msg->FindRect(kJDPaperRect);
        } else if (paperCap != NULL) {
-               fPaperRect = paperCap->paper_rect;
+               fPaperRect = paperCap->fPaperRect;
        }
 
        if (msg->HasRect(kJDScaledPaperRect)) {
@@ -184,7 +187,7 @@
        if (msg->HasRect(kJDPrintableRect)) {
                fPrintableRect = msg->FindRect(kJDPrintableRect);
        } else if (paperCap != NULL) {
-               fPrintableRect = paperCap->physical_rect;
+               fPrintableRect = paperCap->fPhysicalRect;
        }
 
        if (msg->HasRect(kJDScaledPrintableRect)) {
@@ -196,7 +199,7 @@
        if (msg->HasRect(kJDPhysicalRect)) {
                fPhysicalRect = msg->FindRect(kJDPhysicalRect);
        } else if (paperCap != NULL) {
-               fPhysicalRect = paperCap->physical_rect;
+               fPhysicalRect = paperCap->fPhysicalRect;
        }
 
        if (msg->HasRect(kJDScaledPhysicalRect)) {
@@ -233,7 +236,8 @@
        if (msg->HasInt32(kJDPaperSource))
                fPaperSource = (PaperSource)fMsg->FindInt32(kJDPaperSource);
        else if (cap->isSupport(PrinterCap::kPaperSource))
-               fPaperSource = ((const PaperSourceCap 
*)cap->getDefaultCap(PrinterCap::kPaperSource))->paper_source;
+               fPaperSource = ((const PaperSourceCap *)cap->getDefaultCap(
+                       PrinterCap::kPaperSource))->fPaperSource;
        else
                fPaperSource = kAuto;
 
@@ -255,14 +259,16 @@
        if (msg->HasInt32(kJDPrintStyle))
                fPrintStyle = (PrintStyle)msg->FindInt32(kJDPrintStyle);
        else if (cap->isSupport(PrinterCap::kPrintStyle))
-               fPrintStyle = ((const PrintStyleCap 
*)cap->getDefaultCap(PrinterCap::kPrintStyle))->print_style;
+               fPrintStyle = ((const PrintStyleCap *)cap->getDefaultCap(
+                       PrinterCap::kPrintStyle))->fPrintStyle;
        else
                fPrintStyle = kSimplex;
 
        if (msg->HasInt32(kJDBindingLocation))
                fBindingLocation = 
(BindingLocation)msg->FindInt32(kJDBindingLocation);
        else if (cap->isSupport(PrinterCap::kBindingLocation))
-               fBindingLocation = ((const BindingLocationCap 
*)cap->getDefaultCap(PrinterCap::kBindingLocation))->binding_location;
+               fBindingLocation = ((const BindingLocationCap 
*)cap->getDefaultCap(
+                       PrinterCap::kBindingLocation))->fBindingLocation;
        else
                fBindingLocation = kLongEdgeLeft;
 
@@ -274,7 +280,8 @@
        if (msg->HasInt32(kJDColor))
                fColor = (Color)msg->FindInt32(kJDColor);
        else if (cap->isSupport(PrinterCap::kColor))
-               fColor = ((const ColorCap 
*)cap->getDefaultCap(PrinterCap::kColor))->color;
+               fColor = ((const ColorCap 
*)cap->getDefaultCap(PrinterCap::kColor))
+                       ->fColor;
        else
                fColor = kMonochrome;
        

Modified: haiku/trunk/src/libs/print/libprint/JobSetupDlg.cpp
===================================================================
--- haiku/trunk/src/libs/print/libprint/JobSetupDlg.cpp 2010-10-25 11:19:17 UTC 
(rev 39138)
+++ haiku/trunk/src/libs/print/libprint/JobSetupDlg.cpp 2010-10-25 11:34:31 UTC 
(rev 39139)
@@ -45,32 +45,32 @@
 #include "PrinterCap.h"
 #include "DbgMsg.h"
 
-#if (!__MWERKS__ || defined(MSIPL_USING_NAMESPACE))
+
 using namespace std;
-#else
-#define std
-#endif
 
 
-struct SurfaceCap : public BaseCap {
-       color_space surface_type;
-       SurfaceCap(const string &s, bool d, color_space cs) : BaseCap(s, d), 
surface_type(cs) {}
-};
-
 struct NupCap : public BaseCap {
-       int nup;
-       NupCap(const string &s, bool d, int n) : BaseCap(s, d), nup(n) {}
+       NupCap(const string &label, bool isDefault, int nup)
+               :
+               BaseCap(label, isDefault),
+               fNup(nup)
+       {}
+
+       int     fNup;
 };
 
+
 struct DitherCap : public BaseCap {
-       Halftone::DitherType dither_type;
-       DitherCap(const string &s, bool d, Halftone::DitherType type) : 
BaseCap(s, d), dither_type(type) {}
+       DitherCap(const string &label, bool isDefault,
+               Halftone::DitherType ditherType)
+               :
+               BaseCap(label, isDefault),
+               fDitherType(ditherType)
+       {}
+
+       Halftone::DitherType fDitherType;
 };
 
-static const SurfaceCap gRGB32("RGB32", false, B_RGB32);
-static const SurfaceCap gCMAP8("CMAP8", true,  B_CMAP8);
-static const SurfaceCap gGray8("GRAY8", false, B_GRAY8);
-static const SurfaceCap gGray1("GRAY1", false, B_GRAY1);
 
 static const NupCap gNup1("1", true,  1);
 static const NupCap gNup2("2",   false, 2);
@@ -82,17 +82,13 @@
 static const NupCap gNup32("32", false, 32);
 static const NupCap gNup36("36", false, 36);
 
+
 static const DitherCap gDitherType1("Crosshatch", false, Halftone::kType1);
 static const DitherCap gDitherType2("Grid", false, Halftone::kType2);
 static const DitherCap gDitherType3("Stipple", false, Halftone::kType3);
-static const DitherCap gDitherFloydSteinberg("Floyd-Steinberg", false, 
Halftone::kTypeFloydSteinberg);
+static const DitherCap gDitherFloydSteinberg("Floyd-Steinberg", false,
+       Halftone::kTypeFloydSteinberg);
 
-const SurfaceCap *gSurfaces[] = {
-       &gRGB32,
-       &gCMAP8,
-       &gGray8,
-       &gGray1
-};
 
 const NupCap *gNups[] = {
        &gNup1,
@@ -106,6 +102,7 @@
        &gNup36
 };
 
+
 const DitherCap *gDitherTypes[] = {
        &gDitherType1,
        &gDitherType2,
@@ -113,6 +110,7 @@
        &gDitherFloydSteinberg
 };
 
+
 enum {
        kMsgRangeAll = 'JSdl',
        kMsgRangeSelection,
@@ -125,16 +123,19 @@
        kMsgDuplexChanged,
 };
 
+
 JobSetupView::JobSetupView(JobData *job_data, PrinterData *printer_data,
        const PrinterCap *printer_cap)
-       : BView("jobSetup", B_WILL_DRAW)
-       , fJobData(job_data)
-       , fPrinterData(printer_data)
-       , fPrinterCap(printer_cap)
+       :
+       BView("jobSetup", B_WILL_DRAW),
+       fJobData(job_data),
+       fPrinterData(printer_data),
+       fPrinterCap(printer_cap)
 {
        SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
 }
 
+
 BRadioButton* 
 JobSetupView::CreatePageSelectionItem(const char* name, const char* label,
        JobData::PageSelection pageSelection)
@@ -146,6 +147,7 @@
        return button;
 }
 
+
 void
 JobSetupView::AllowOnlyDigits(BTextView* textView, int maxDigits)
 {
@@ -159,6 +161,7 @@
        textView->SetMaxBytes(maxDigits);
 }
 
+
 void 
 JobSetupView::AttachedToWindow()
 {
@@ -176,10 +179,10 @@
        bool marked = false;
        BMenuItem* item = NULL;
        while (count--) {
-               item = new BMenuItem((*color_cap)->label.c_str(),
+               item = new BMenuItem((*color_cap)->fLabel.c_str(),
                        new BMessage(kMsgQuality));
                fColorType->AddItem(item);
-               if ((*color_cap)->color == fJobData->getColor()) {
+               if ((*color_cap)->fColor == fJobData->getColor()) {
                        item->SetMarked(true);
                        marked = true;
                }
@@ -200,10 +203,10 @@
        marked = false;
        item = NULL;
        while (count--) {
-               item = new BMenuItem((*dither_cap)->label.c_str(),
+               item = new BMenuItem((*dither_cap)->fLabel.c_str(),
                        new BMessage(kMsgQuality));
                fDitherType->AddItem(item);
-               if ((*dither_cap)->dither_type == fJobData->getDitherType()) {
+               if ((*dither_cap)->fDitherType == fJobData->getDitherType()) {
                        item->SetMarked(true);
                        marked = true;
                }
@@ -300,9 +303,9 @@
        marked = false;
        item = NULL;
        while (count--) {
-               item = new BMenuItem((*paper_source_cap)->label.c_str(), NULL);
+               item = new BMenuItem((*paper_source_cap)->fLabel.c_str(), NULL);
                fPaperFeed->AddItem(item);
-               if ((*paper_source_cap)->paper_source == 
fJobData->getPaperSource()) {
+               if ((*paper_source_cap)->fPaperSource == 
fJobData->getPaperSource()) {
                        item->SetMarked(true);
                        marked = true;
                }
@@ -321,9 +324,9 @@
        marked = false;
        item = NULL;
        while (count--) {
-               item = new BMenuItem((*nup_cap)->label.c_str(), NULL);
+               item = new BMenuItem((*nup_cap)->fLabel.c_str(), NULL);
                fNup->AddItem(item);
-               if ((*nup_cap)->nup == fJobData->getNup()) {
+               if ((*nup_cap)->fNup == fJobData->getNup()) {
                        item->SetMarked(true);
                        marked = true;
                }
@@ -500,6 +503,7 @@
        UpdateButtonEnabledState();
 }
 
+
 void
 JobSetupView::UpdateButtonEnabledState()
 {
@@ -514,6 +518,7 @@
        fEvenNumberedPages->SetEnabled(pageSelectionEnabled);
 }
 
+
 void 
 JobSetupView::MessageReceived(BMessage *msg)
 {
@@ -538,6 +543,7 @@
        }
 }
 
+
 JobData::Color 
 JobSetupView::getColor()
 {
@@ -545,14 +551,15 @@
        const ColorCap **color_cap = (const 
ColorCap**)fPrinterCap->enumCap(PrinterCap::kColor);
        const char *color_label = fColorType->FindMarked()->Label();
        while (count--) {
-               if (!strcmp((*color_cap)->label.c_str(), color_label)) {
-                       return (*color_cap)->color;
+               if (!strcmp((*color_cap)->fLabel.c_str(), color_label)) {
+                       return (*color_cap)->fColor;
                }
                color_cap++;
        }
        return JobData::kMonochrome;
 }
 
+
 Halftone::DitherType 
 JobSetupView::getDitherType()
 {
@@ -560,8 +567,8 @@
        const DitherCap **dither_cap = gDitherTypes;
        const char *dithering_label = fDitherType->FindMarked()->Label();
        while (count --) {
-               if (strcmp((*dither_cap)->label.c_str(), dithering_label) == 0) 
{
-                       return (*dither_cap)->dither_type;
+               if (strcmp((*dither_cap)->fLabel.c_str(), dithering_label) == 
0) {
+                       return (*dither_cap)->fDitherType;
                }
                dither_cap ++;
        }
@@ -575,6 +582,7 @@
        return pow(2.0, value / 100.0);
 }
 
+
 float 
 JobSetupView::getInkDensity()
 {
@@ -582,23 +590,12 @@
        return value;
 }
 
+
 bool 
 JobSetupView::UpdateJobData(bool showPreview)
 {
        int count;
 
-/*
-       count = sizeof(gSurfaces) / sizeof(gSurfaces[0]);
-       const SurfaceCap **surface_cap = gSurfaces;
-       const char *surface_label = fSurfaceType->FindMarked()->Label();
-       while (count--) {
-               if (!strcmp((*surface_cap)->label.c_str(), surface_label)) {
-                       fJobData->setSurfaceType((*surface_cap)->surface_type);
-                       break;
-               }
-               surface_cap++;
-       }
-*/
        fJobData->setShowPreview(showPreview);
        fJobData->setColor(getColor()); 
        fJobData->setGamma(getGamma());
@@ -623,8 +620,8 @@
        const PaperSourceCap **paper_source_cap = (const PaperSourceCap 
**)fPrinterCap->enumCap(PrinterCap::kPaperSource);
        const char *paper_source_label = fPaperFeed->FindMarked()->Label();
        while (count--) {
-               if (!strcmp((*paper_source_cap)->label.c_str(), 
paper_source_label)) {
-                       
fJobData->setPaperSource((*paper_source_cap)->paper_source);
+               if (!strcmp((*paper_source_cap)->fLabel.c_str(), 
paper_source_label)) {
+                       
fJobData->setPaperSource((*paper_source_cap)->fPaperSource);
                        break;
                }
                paper_source_cap++;
@@ -634,8 +631,8 @@
        const NupCap **nup_cap = gNups;
        const char *nup_label = fNup->FindMarked()->Label();
        while (count--) {
-               if (!strcmp((*nup_cap)->label.c_str(), nup_label)) {
-                       fJobData->setNup((*nup_cap)->nup);
+               if (!strcmp((*nup_cap)->fLabel.c_str(), nup_label)) {
+                       fJobData->setNup((*nup_cap)->fNup);
                        break;
                }
                nup_cap++;
@@ -661,12 +658,12 @@
        return true;
 }
 
-//====================================================================
 
 JobSetupDlg::JobSetupDlg(JobData *job_data, PrinterData *printer_data,
        const PrinterCap *printer_cap)
-       : DialogWindow(BRect(100, 100, 200, 200),
-               "PrintJob Setup", B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
+       :
+       DialogWindow(BRect(100, 100, 200, 200), "PrintJob Setup",
+               B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL,
                B_NOT_RESIZABLE | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE
                        | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
 {
@@ -681,6 +678,7 @@
        );
 }
 
+
 void 
 JobSetupDlg::MessageReceived(BMessage *msg)
 {

Modified: haiku/trunk/src/libs/print/libprint/PageSetupDlg.cpp
===================================================================
--- haiku/trunk/src/libs/print/libprint/PageSetupDlg.cpp        2010-10-25 
11:19:17 UTC (rev 39138)
+++ haiku/trunk/src/libs/print/libprint/PageSetupDlg.cpp        2010-10-25 
11:34:31 UTC (rev 39139)
@@ -119,10 +119,10 @@
        while (count--) {
                BMessage *msg = new BMessage(kMsgPaperChanged);
                msg->AddPointer("paperCap", *paper_cap);
-               item = new BMenuItem((*paper_cap)->label.c_str(), msg);
+               item = new BMenuItem((*paper_cap)->fLabel.c_str(), msg);
                fPaper->AddItem(item);
                item->SetTarget(this);
-               if ((*paper_cap)->paper == fJobData->getPaper()) {
+               if ((*paper_cap)->fPaper == fJobData->getPaper()) {
                        item->SetMarked(true);
                        marked = true;
                }
@@ -145,8 +145,8 @@
        } else {
                OrientationCap **orientation_cap = (OrientationCap 
**)fPrinterCap->enumCap(PrinterCap::kOrientation);
                while (count--) {
-                       AddOrientationItem((*orientation_cap)->label.c_str(),
-                               (*orientation_cap)->orientation);
+                       AddOrientationItem((*orientation_cap)->fLabel.c_str(),
+                               (*orientation_cap)->fOrientation);
                        orientation_cap++;
                }
        }
@@ -158,10 +158,11 @@
        count = fPrinterCap->countCap(PrinterCap::kResolution);
        ResolutionCap **resolution_cap = (ResolutionCap 
**)fPrinterCap->enumCap(PrinterCap::kResolution);
        while (count--) {
-               item = new BMenuItem((*resolution_cap)->label.c_str(), NULL);
+               item = new BMenuItem((*resolution_cap)->fLabel.c_str(), NULL);
                fResolution->AddItem(item);
                item->SetTarget(this);
-               if (((*resolution_cap)->xres == fJobData->getXres()) && 
((*resolution_cap)->yres == fJobData->getYres())) {
+               if (((*resolution_cap)->fXResolution == fJobData->getXres()) &&
+                       ((*resolution_cap)->fYResolution == 
fJobData->getYres())) {
                        item->SetMarked(true);
                        marked = true;
                }
@@ -265,9 +266,9 @@
        fJobData->setOrientation(GetOrientation());
 
        PaperCap *paperCap = GetPaperCap();
-       BRect paper_rect = paperCap->paper_rect;
-       BRect physical_rect = paperCap->physical_rect;
-       fJobData->setPaper(paperCap->paper);
+       BRect paper_rect = paperCap->fPaperRect;
+       BRect physical_rect = paperCap->fPhysicalRect;
+       fJobData->setPaper(paperCap->fPaper);
 
        int count;
 
@@ -275,9 +276,9 @@
        ResolutionCap **resolution_cap = (ResolutionCap 
**)fPrinterCap->enumCap(PrinterCap::kResolution);
        const char *resolution_label = fResolution->FindMarked()->Label();
        while (count--) {
-               if (!strcmp((*resolution_cap)->label.c_str(), 
resolution_label)) {
-                       fJobData->setXres((*resolution_cap)->xres);
-                       fJobData->setYres((*resolution_cap)->yres);
+               if (!strcmp((*resolution_cap)->fLabel.c_str(), 
resolution_label)) {
+                       fJobData->setXres((*resolution_cap)->fXResolution);
+                       fJobData->setYres((*resolution_cap)->fYResolution);
                        break;
                }
                resolution_cap++;
@@ -336,8 +337,8 @@
                        {
                                JobData::Orientation orientation = 
GetOrientation();
                                PaperCap *paperCap = GetPaperCap();
-                               float width = paperCap->paper_rect.Width();
-                               float height = paperCap->paper_rect.Height();
+                               float width = paperCap->fPaperRect.Width();
+                               float height = paperCap->fPaperRect.Height();
                                if (orientation != JobData::kPortrait) {
                                        swap(&width, &height);
                                }

Modified: haiku/trunk/src/libs/print/libprint/PrinterCap.cpp
===================================================================
--- haiku/trunk/src/libs/print/libprint/PrinterCap.cpp  2010-10-25 11:19:17 UTC 
(rev 39138)
+++ haiku/trunk/src/libs/print/libprint/PrinterCap.cpp  2010-10-25 11:34:31 UTC 
(rev 39139)
@@ -6,23 +6,108 @@
 #include "PrinterCap.h"
 #include "PrinterData.h"
 
+BaseCap::BaseCap(const string &label, bool isDefault)
+       :
+       fLabel(label),
+       fIsDefault(isDefault)
+{
+}
+
+
+PaperCap::PaperCap(const string &label, bool isDefault, JobData::Paper paper,
+       const BRect &paperRect, const BRect &physicalRect)
+       :
+       BaseCap(label, isDefault),
+       fPaper(paper),
+       fPaperRect(paperRect),
+       fPhysicalRect(physicalRect)
+{
+}
+
+
+PaperSourceCap::PaperSourceCap(const string &label, bool isDefault,
+       JobData::PaperSource paperSource)
+       :
+       BaseCap(label, isDefault),
+       fPaperSource(paperSource)
+{
+}
+
+
+ResolutionCap::ResolutionCap(const string &label, bool isDefault,
+       int xResolution, int yResolution)
+       :
+       BaseCap(label, isDefault),
+       fXResolution(xResolution),
+       fYResolution(yResolution)
+{
+}
+
+
+OrientationCap::OrientationCap(const string &label, bool isDefault,
+       JobData::Orientation orientation)
+       :
+       BaseCap(label, isDefault),
+       fOrientation(orientation)
+{
+}
+
+
+PrintStyleCap::PrintStyleCap(const string &label, bool isDefault,
+       JobData::PrintStyle printStyle)
+       :
+       BaseCap(label, isDefault),
+       fPrintStyle(printStyle)
+{
+}
+
+
+BindingLocationCap::BindingLocationCap(const string &label, bool isDefault,
+       JobData::BindingLocation bindingLocation)
+       :
+       BaseCap(label, isDefault),
+       fBindingLocation(bindingLocation)
+{
+}
+
+
+ColorCap::ColorCap(const string &label, bool isDefault, JobData::Color color)
+       :
+       BaseCap(label, isDefault),
+       fColor(color)
+{
+}
+
+
+ProtocolClassCap::ProtocolClassCap(const string &label, bool isDefault,
+       int protocolClass, const string &description)
+       :
+       BaseCap(label, isDefault),
+       fProtocolClass(protocolClass),
+       fDescription(description)
+{
+}
+
+
 PrinterCap::PrinterCap(const PrinterData *printer_data)
        : fPrinterData(printer_data), 
        fPrinterID(kUnknownPrinter)
 {
 }
 
+
 PrinterCap::~PrinterCap()
 {
 }
 
+
 const BaseCap *PrinterCap::getDefaultCap(CapID id) const
 {
        int count = countCap(id);
        if (count > 0) {
                const BaseCap **base_cap = enumCap(id);
                while (count--) {
-                       if ((*base_cap)->is_default) {
+                       if ((*base_cap)->fIsDefault) {
                                return *base_cap;
                        }
                        base_cap++;
@@ -31,6 +116,30 @@
        return NULL;
 }
 
-int PrinterCap::getProtocolClass() const {
+
+int
+PrinterCap::getProtocolClass() const {
        return fPrinterData->getProtocolClass();
 }
+
+
+const
+PrinterData *PrinterCap::getPrinterData() const
+{
+       return fPrinterData;
+}
+
+
+int
+PrinterCap::getPrinterId() const
+{
+       return fPrinterID;
+}
+
+
+void
+PrinterCap::setPrinterId(int id)
+{
+       fPrinterID = id;
+}
+

Modified: haiku/trunk/src/libs/print/libprint/PrinterDriver.cpp
===================================================================
--- haiku/trunk/src/libs/print/libprint/PrinterDriver.cpp       2010-10-25 
11:19:17 UTC (rev 39138)
+++ haiku/trunk/src/libs/print/libprint/PrinterDriver.cpp       2010-10-25 
11:34:31 UTC (rev 39139)
@@ -100,7 +100,7 @@
                        const ProtocolClassCap* pcCap;
                        pcCap = (const 
ProtocolClassCap*)fPrinterCap->getDefaultCap(PrinterCap::kProtocolClass);
                        if (pcCap != NULL) {
-                               
fPrinterData->setProtocolClass(pcCap->protocolClass);
+                               
fPrinterData->setProtocolClass(pcCap->fProtocolClass);
                                fPrinterData->save();
                        }
                }


Other related posts:

  • » [haiku-commits] r39139 - in haiku/trunk: headers/libs/print/libprint src/libs/print/libprint - michael . w . pfeiffer