* Added bool and double BString::operator<<() versions.
* Removed the clashing operator in JobSetupDlg. Automatic whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42387 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -29,7 +29,6 @@ class PagesView;
|
|||||||
class PrinterCap;
|
class PrinterCap;
|
||||||
class PrinterData;
|
class PrinterData;
|
||||||
|
|
||||||
extern BString& operator<<(BString& text, double value);
|
|
||||||
|
|
||||||
template<typename T, typename R>
|
template<typename T, typename R>
|
||||||
class Range
|
class Range
|
||||||
|
|||||||
@@ -307,14 +307,16 @@ public:
|
|||||||
BString& operator<<(const char* string);
|
BString& operator<<(const char* string);
|
||||||
BString& operator<<(const BString& string);
|
BString& operator<<(const BString& string);
|
||||||
BString& operator<<(char c);
|
BString& operator<<(char c);
|
||||||
|
BString& operator<<(bool value);
|
||||||
BString& operator<<(int value);
|
BString& operator<<(int value);
|
||||||
BString& operator<<(unsigned int value);
|
BString& operator<<(unsigned int value);
|
||||||
BString& operator<<(unsigned long value);
|
BString& operator<<(unsigned long value);
|
||||||
BString& operator<<(long value);
|
BString& operator<<(long value);
|
||||||
BString& operator<<(unsigned long long value);
|
BString& operator<<(unsigned long long value);
|
||||||
BString& operator<<(long long value);
|
BString& operator<<(long long value);
|
||||||
// float output hardcodes %.2f style formatting
|
// float/double output hardcodes %.2f style formatting
|
||||||
BString& operator<<(float value);
|
BString& operator<<(float value);
|
||||||
|
BString& operator<<(double value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class PosVect;
|
class PosVect;
|
||||||
|
|||||||
@@ -2028,6 +2028,18 @@ BString::operator<<(char c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BString&
|
||||||
|
BString::operator<<(bool value)
|
||||||
|
{
|
||||||
|
if (value)
|
||||||
|
_DoAppend("true", 4);
|
||||||
|
else
|
||||||
|
_DoAppend("false", 5);
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BString&
|
BString&
|
||||||
BString::operator<<(int i)
|
BString::operator<<(int i)
|
||||||
{
|
{
|
||||||
@@ -2105,6 +2117,17 @@ BString::operator<<(float f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BString&
|
||||||
|
BString::operator<<(double value)
|
||||||
|
{
|
||||||
|
char num[64];
|
||||||
|
int32 length = snprintf(num, sizeof(num), "%.2f", value);
|
||||||
|
|
||||||
|
_DoAppend(num, length);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - Private or reserved
|
// #pragma mark - Private or reserved
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
@@ -134,12 +134,6 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
BString& operator<<(BString& text, double value)
|
|
||||||
{
|
|
||||||
text << (float)value;
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
JobSetupView::JobSetupView(JobData* jobData, PrinterData* printerData,
|
JobSetupView::JobSetupView(JobData* jobData, PrinterData* printerData,
|
||||||
const PrinterCap *printerCap)
|
const PrinterCap *printerCap)
|
||||||
:
|
:
|
||||||
@@ -170,7 +164,7 @@ JobSetupView::JobSetupView(JobData* jobData, PrinterData* printerData,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BRadioButton*
|
BRadioButton*
|
||||||
JobSetupView::CreatePageSelectionItem(const char* name, const char* label,
|
JobSetupView::CreatePageSelectionItem(const char* name, const char* label,
|
||||||
JobData::PageSelection pageSelection)
|
JobData::PageSelection pageSelection)
|
||||||
{
|
{
|
||||||
@@ -196,7 +190,7 @@ JobSetupView::AllowOnlyDigits(BTextView* textView, int maxDigits)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JobSetupView::AttachedToWindow()
|
JobSetupView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
// quality
|
// quality
|
||||||
@@ -210,7 +204,7 @@ JobSetupView::AttachedToWindow()
|
|||||||
fJobData->GetColor());
|
fJobData->GetColor());
|
||||||
BMenuField* colorMenuField = new BMenuField("color", "Color:", fColorType);
|
BMenuField* colorMenuField = new BMenuField("color", "Color:", fColorType);
|
||||||
fColorType->SetTargetForItems(this);
|
fColorType->SetTargetForItems(this);
|
||||||
|
|
||||||
if (IsHalftoneConfigurationNeeded())
|
if (IsHalftoneConfigurationNeeded())
|
||||||
CreateHalftoneConfigurationUI();
|
CreateHalftoneConfigurationUI();
|
||||||
|
|
||||||
@@ -316,11 +310,11 @@ JobSetupView::AttachedToWindow()
|
|||||||
fPages->SetReverse(fJobData->GetReverse());
|
fPages->SetReverse(fJobData->GetReverse());
|
||||||
fPages->SetExplicitMinSize(BSize(150, 40));
|
fPages->SetExplicitMinSize(BSize(150, 40));
|
||||||
fPages->SetExplicitMaxSize(BSize(150, 40));
|
fPages->SetExplicitMaxSize(BSize(150, 40));
|
||||||
|
|
||||||
// page selection
|
// page selection
|
||||||
BBox* pageSelectionBox = new BBox("pageSelection");
|
BBox* pageSelectionBox = new BBox("pageSelection");
|
||||||
pageSelectionBox->SetLabel("Page Selection");
|
pageSelectionBox->SetLabel("Page Selection");
|
||||||
|
|
||||||
fAllPages = CreatePageSelectionItem("allPages", "All Pages",
|
fAllPages = CreatePageSelectionItem("allPages", "All Pages",
|
||||||
JobData::kAllPages);
|
JobData::kAllPages);
|
||||||
fOddNumberedPages = CreatePageSelectionItem("oddPages",
|
fOddNumberedPages = CreatePageSelectionItem("oddPages",
|
||||||
@@ -341,7 +335,7 @@ JobSetupView::AttachedToWindow()
|
|||||||
new BMessage(kMsgCancel));
|
new BMessage(kMsgCancel));
|
||||||
BButton* ok = new BButton("ok", "OK", new BMessage(kMsgOK));
|
BButton* ok = new BButton("ok", "OK", new BMessage(kMsgOK));
|
||||||
ok->MakeDefault(true);
|
ok->MakeDefault(true);
|
||||||
|
|
||||||
if (IsHalftoneConfigurationNeeded()) {
|
if (IsHalftoneConfigurationNeeded()) {
|
||||||
BGroupView* halftoneGroup = new BGroupView(B_VERTICAL, 0);
|
BGroupView* halftoneGroup = new BGroupView(B_VERTICAL, 0);
|
||||||
BGroupLayout* halftoneLayout = halftoneGroup->GroupLayout();
|
BGroupLayout* halftoneLayout = halftoneGroup->GroupLayout();
|
||||||
@@ -794,8 +788,8 @@ JobSetupView::UpdateButtonEnabledState()
|
|||||||
bool pageRangeEnabled = fAll->Value() != B_CONTROL_ON;
|
bool pageRangeEnabled = fAll->Value() != B_CONTROL_ON;
|
||||||
fFromPage->SetEnabled(pageRangeEnabled);
|
fFromPage->SetEnabled(pageRangeEnabled);
|
||||||
fToPage->SetEnabled(pageRangeEnabled);
|
fToPage->SetEnabled(pageRangeEnabled);
|
||||||
|
|
||||||
bool pageSelectionEnabled = fDuplex == NULL ||
|
bool pageSelectionEnabled = fDuplex == NULL ||
|
||||||
fDuplex->Value() != B_CONTROL_ON;
|
fDuplex->Value() != B_CONTROL_ON;
|
||||||
fAllPages->SetEnabled(pageSelectionEnabled);
|
fAllPages->SetEnabled(pageSelectionEnabled);
|
||||||
fOddNumberedPages->SetEnabled(pageSelectionEnabled);
|
fOddNumberedPages->SetEnabled(pageSelectionEnabled);
|
||||||
@@ -803,7 +797,7 @@ JobSetupView::UpdateButtonEnabledState()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JobSetupView::MessageReceived(BMessage* message)
|
JobSetupView::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
@@ -820,7 +814,7 @@ JobSetupView::MessageReceived(BMessage* message)
|
|||||||
case kMsgCollateChanged:
|
case kMsgCollateChanged:
|
||||||
fPages->SetCollate(fCollate->Value() == B_CONTROL_ON);
|
fPages->SetCollate(fCollate->Value() == B_CONTROL_ON);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgReverseChanged:
|
case kMsgReverseChanged:
|
||||||
fPages->SetReverse(fReverse->Value() == B_CONTROL_ON);
|
fPages->SetReverse(fReverse->Value() == B_CONTROL_ON);
|
||||||
break;
|
break;
|
||||||
@@ -869,7 +863,7 @@ JobSetupView::UpdateDoubleSlider(BMessage* message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JobData::Color
|
JobData::Color
|
||||||
JobSetupView::Color()
|
JobSetupView::Color()
|
||||||
{
|
{
|
||||||
const char *label = fColorType->FindMarked()->Label();
|
const char *label = fColorType->FindMarked()->Label();
|
||||||
@@ -882,7 +876,7 @@ JobSetupView::Color()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Halftone::DitherType
|
Halftone::DitherType
|
||||||
JobSetupView::DitherType()
|
JobSetupView::DitherType()
|
||||||
{
|
{
|
||||||
const char *label = fDitherType->FindMarked()->Label();
|
const char *label = fDitherType->FindMarked()->Label();
|
||||||
@@ -891,7 +885,7 @@ JobSetupView::DitherType()
|
|||||||
return static_cast<Halftone::DitherType>(id);
|
return static_cast<Halftone::DitherType>(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
JobSetupView::Gamma()
|
JobSetupView::Gamma()
|
||||||
{
|
{
|
||||||
const float value = (float)fGamma->Value();
|
const float value = (float)fGamma->Value();
|
||||||
@@ -899,7 +893,7 @@ JobSetupView::Gamma()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float
|
float
|
||||||
JobSetupView::InkDensity()
|
JobSetupView::InkDensity()
|
||||||
{
|
{
|
||||||
const float value = (float)(127 - fInkDensity->Value());
|
const float value = (float)(127 - fInkDensity->Value());
|
||||||
@@ -920,7 +914,7 @@ JobSetupView::PaperSource()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
JobSetupView::UpdateJobData()
|
JobSetupView::UpdateJobData()
|
||||||
{
|
{
|
||||||
fJobData->SetShowPreview(fPreview->Value() == B_CONTROL_ON);
|
fJobData->SetShowPreview(fPreview->Value() == B_CONTROL_ON);
|
||||||
@@ -966,7 +960,7 @@ JobSetupView::UpdateJobData()
|
|||||||
if (fEvenNumberedPages->Value() == B_CONTROL_ON)
|
if (fEvenNumberedPages->Value() == B_CONTROL_ON)
|
||||||
pageSelection = JobData::kEvenNumberedPages;
|
pageSelection = JobData::kEvenNumberedPages;
|
||||||
fJobData->SetPageSelection(pageSelection);
|
fJobData->SetPageSelection(pageSelection);
|
||||||
|
|
||||||
{
|
{
|
||||||
std::map<PrinterCap::CapID, BPopUpMenu*>::iterator it =
|
std::map<PrinterCap::CapID, BPopUpMenu*>::iterator it =
|
||||||
fDriverSpecificPopUpMenus.begin();
|
fDriverSpecificPopUpMenus.begin();
|
||||||
@@ -1027,7 +1021,7 @@ JobSetupDlg::JobSetupDlg(JobData* jobData, PrinterData* printerData,
|
|||||||
{
|
{
|
||||||
SetResult(B_ERROR);
|
SetResult(B_ERROR);
|
||||||
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
||||||
|
|
||||||
fJobSetup = new JobSetupView(jobData, printerData, printerCap);
|
fJobSetup = new JobSetupView(jobData, printerData, printerCap);
|
||||||
SetLayout(new BGroupLayout(B_VERTICAL));
|
SetLayout(new BGroupLayout(B_VERTICAL));
|
||||||
AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
|
AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
|
||||||
@@ -1037,7 +1031,7 @@ JobSetupDlg::JobSetupDlg(JobData* jobData, PrinterData* printerData,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
JobSetupDlg::MessageReceived(BMessage* message)
|
JobSetupDlg::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
@@ -1050,7 +1044,7 @@ JobSetupDlg::MessageReceived(BMessage* message)
|
|||||||
case kMsgCancel:
|
case kMsgCancel:
|
||||||
PostMessage(B_QUIT_REQUESTED);
|
PostMessage(B_QUIT_REQUESTED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
DialogWindow::MessageReceived(message);
|
DialogWindow::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user