* Style changes.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39196 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -13,31 +13,31 @@
|
|||||||
|
|
||||||
class StatusWindow : public BWindow
|
class StatusWindow : public BWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StatusWindow(bool oddPages, bool evenPages,
|
StatusWindow(bool oddPages, bool evenPages,
|
||||||
uint32 firstPage, uint32 numPages,
|
uint32 firstPage, uint32 numPages,
|
||||||
uint32 docCopies, uint32 nup);
|
uint32 docCopies, uint32 nup);
|
||||||
~StatusWindow(void);
|
~StatusWindow(void);
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage *message);
|
||||||
|
|
||||||
void ResetStatusBar(void);
|
void ResetStatusBar(void);
|
||||||
bool UpdateStatusBar(uint32 page, uint32 copy);
|
bool UpdateStatusBar(uint32 page, uint32 copy);
|
||||||
void SetPageCopies(uint32 copies);
|
void SetPageCopies(uint32 copies);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BView *fStatusView;
|
BView* fStatusView;
|
||||||
BStatusBar *fStatusBar;
|
BStatusBar* fStatusBar;
|
||||||
BButton *fCancelButton;
|
BButton* fCancelButton;
|
||||||
BButton *fHideButton;
|
BButton* fHideButton;
|
||||||
bool fCancelBar;
|
bool fCancelled;
|
||||||
bool fDocumentCopy;
|
bool fDocumentCopy;
|
||||||
uint32 fNops;
|
uint32 fNops;
|
||||||
uint32 fFirstPage;
|
uint32 fFirstPage;
|
||||||
uint32 fCopies;
|
uint32 fCopies;
|
||||||
uint32 fDocCopies;
|
uint32 fDocCopies;
|
||||||
float fStatusDelta;
|
float fStatusDelta;
|
||||||
float fDelta;
|
float fDelta;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -19,38 +19,45 @@
|
|||||||
#define HIDE_MSG 'hidM'
|
#define HIDE_MSG 'hidM'
|
||||||
|
|
||||||
|
|
||||||
StatusWindow::StatusWindow(bool oddPages, bool evenPages, uint32 firstPage, uint32 numPages, uint32 numCopies, uint32 nup)
|
StatusWindow::StatusWindow(bool oddPages, bool evenPages, uint32 firstPage,
|
||||||
: BWindow (BRect(200, 200, 650, 270), "Print Status", B_DOCUMENT_WINDOW, B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE)
|
uint32 numPages, uint32 numCopies, uint32 nup)
|
||||||
|
:
|
||||||
|
BWindow(BRect(200, 200, 650, 270),
|
||||||
|
"Print Status",
|
||||||
|
B_DOCUMENT_WINDOW, B_NOT_RESIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE)
|
||||||
{
|
{
|
||||||
// oddPages - if true, only print odd numbered pages
|
// oddPages - if true, only print odd numbered pages
|
||||||
// evenPages - if true, only print even numbered pages
|
// evenPages - if true, only print even numbered pages
|
||||||
// firstPage - number of first page
|
// firstPage - number of first page
|
||||||
// numPages - total number of pages (must be recalculate if odd/even is used)
|
// numPages - total number of pages (must be recalculate if odd/even is
|
||||||
// numCopies - total number of document copies
|
// used)
|
||||||
|
// numCopies - total number of document copies
|
||||||
|
|
||||||
BRect frame = Frame();
|
BRect frame = Frame();
|
||||||
// the status view
|
// the status view
|
||||||
frame.OffsetTo(B_ORIGIN);
|
frame.OffsetTo(B_ORIGIN);
|
||||||
fStatusView = new BView(frame,"Status View",B_FOLLOW_ALL, B_WILL_DRAW);
|
fStatusView = new BView(frame, "Status View", B_FOLLOW_ALL, B_WILL_DRAW);
|
||||||
fStatusView->SetViewColor(216,216,216);
|
fStatusView->SetViewColor(216, 216, 216);
|
||||||
AddChild(fStatusView);
|
AddChild(fStatusView);
|
||||||
|
|
||||||
// the status bar
|
// the status bar
|
||||||
fStatusBar = new BStatusBar(BRect(10, 15, 245, 50),"Status Bar","Page: ");
|
fStatusBar = new BStatusBar(BRect(10, 15, 245, 50), "Status Bar", "Page: ");
|
||||||
fStatusView->AddChild(fStatusBar);
|
fStatusView->AddChild(fStatusBar);
|
||||||
|
|
||||||
// the cancel button
|
// the cancel button
|
||||||
fHideButton = new BButton(BRect(260, 25, 330,50),"Hide Button","Hide Status", new BMessage(HIDE_MSG));
|
fHideButton = new BButton(BRect(260, 25, 330, 50), "Hide Button",
|
||||||
|
"Hide Status", new BMessage(HIDE_MSG));
|
||||||
fHideButton->ResizeToPreferred();
|
fHideButton->ResizeToPreferred();
|
||||||
fStatusView->AddChild(fHideButton);
|
fStatusView->AddChild(fHideButton);
|
||||||
|
|
||||||
fCancelButton = new BButton(BRect(260, 25, 330,50),"Cancel Button","Cancel", new BMessage(CANCEL_MSG));
|
fCancelButton = new BButton(BRect(260, 25, 330,50), "Cancel Button",
|
||||||
|
"Cancel", new BMessage(CANCEL_MSG));
|
||||||
fCancelButton->ResizeToPreferred();
|
fCancelButton->ResizeToPreferred();
|
||||||
fCancelButton->MoveBy(90,0);
|
fCancelButton->MoveBy(90,0);
|
||||||
|
|
||||||
fStatusView->AddChild(fCancelButton);
|
fStatusView->AddChild(fCancelButton);
|
||||||
|
|
||||||
fCancelBar = false;
|
fCancelled = false;
|
||||||
|
|
||||||
// calculate the real number of pages
|
// calculate the real number of pages
|
||||||
fNops = numPages;
|
fNops = numPages;
|
||||||
@@ -78,10 +85,10 @@ StatusWindow::StatusWindow(bool oddPages, bool evenPages, uint32 firstPage, uint
|
|||||||
uint32 addPage = 0;
|
uint32 addPage = 0;
|
||||||
if (fNops % nup > 0)
|
if (fNops % nup > 0)
|
||||||
addPage = 1;
|
addPage = 1;
|
||||||
fNops = (uint32) ( fNops/(float)nup ) + addPage;
|
fNops = (uint32)(fNops / (float)nup) + addPage;
|
||||||
// recalculate page numbers nup-pages-up
|
// recalculate page numbers nup-pages-up
|
||||||
|
|
||||||
fStatusBar->SetMaxValue ((float)fNops);
|
fStatusBar->SetMaxValue((float)fNops);
|
||||||
// max value of status bar = real number of pages
|
// max value of status bar = real number of pages
|
||||||
fDelta = 1.0/numCopies;
|
fDelta = 1.0/numCopies;
|
||||||
// reduce step width of status bar
|
// reduce step width of status bar
|
||||||
@@ -140,11 +147,12 @@ StatusWindow::UpdateStatusBar(uint32 page, uint32 copy)
|
|||||||
string3.Append(string4);
|
string3.Append(string4);
|
||||||
}
|
}
|
||||||
|
|
||||||
fStatusBar->Update(fStatusDelta*100.0/fNops, string1.String(), string3.String());
|
fStatusBar->Update(fStatusDelta * 100.0 / fNops,
|
||||||
if ( (fStatusBar->MaxValue()) == (fStatusBar->CurrentValue()) )
|
string1.String(), string3.String());
|
||||||
|
if (fStatusBar->MaxValue() == fStatusBar->CurrentValue())
|
||||||
fCancelButton->SetEnabled(false);
|
fCancelButton->SetEnabled(false);
|
||||||
Unlock();
|
Unlock();
|
||||||
return fCancelBar;
|
return fCancelled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -152,7 +160,7 @@ void
|
|||||||
StatusWindow::SetPageCopies(uint32 copies)
|
StatusWindow::SetPageCopies(uint32 copies)
|
||||||
{
|
{
|
||||||
fCopies = copies;
|
fCopies = copies;
|
||||||
fStatusDelta = fDelta/(float)fCopies;
|
fStatusDelta = fDelta / (float)fCopies;
|
||||||
fDocCopies--;
|
fDocCopies--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,17 +172,13 @@ StatusWindow::MessageReceived(BMessage *message)
|
|||||||
|
|
||||||
switch(message->what) {
|
switch(message->what) {
|
||||||
case CANCEL_MSG: // 'CancelButton' is pressed...
|
case CANCEL_MSG: // 'CancelButton' is pressed...
|
||||||
{
|
fCancelled = true;
|
||||||
fCancelBar = true;
|
fCancelButton->SetEnabled(false);
|
||||||
fCancelButton->SetEnabled(false);
|
fCancelButton->SetLabel("Job cancelled");
|
||||||
fCancelButton->SetLabel("Job cancelled");
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HIDE_MSG: // 'HideButton' is pressed...
|
case HIDE_MSG: // 'HideButton' is pressed...
|
||||||
{
|
Hide();
|
||||||
Hide();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user