* some more cleanup

* remove doubled code, MarginView should have OrientationChanged(...) or something
 


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24631 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Karsten Heimrich 2008-03-28 18:56:26 +00:00
parent 89755088d7
commit b4bacb2a8a

View File

@ -102,7 +102,7 @@ PageSetupWindow::PageSetupWindow(BMessage *msg, const char *printerName)
// load orientation
if (fSetupMsg->FindInt32("orientation", &fCurrentOrientation) != B_OK)
fCurrentOrientation = 0;
fCurrentOrientation = PrinterDriver::PORTRAIT_ORIENTATION;
// load page rect
BRect page;
@ -268,7 +268,7 @@ PageSetupWindow::UpdateSetupMessage()
msg->FindFloat("width", &w);
msg->FindFloat("height", &h);
BRect r(0, 0, w, h);
if (fCurrentOrientation != 0)
if (fCurrentOrientation == PrinterDriver::LANDSCAPE_ORIENTATION)
r.Set(0, 0, h, w);
SetRect(fSetupMsg, "preview:paper_rect", r);
@ -277,7 +277,7 @@ PageSetupWindow::UpdateSetupMessage()
// Save the printable_rect
BRect margin = fMarginView->GetMargin();
if (orientation == 0) {
if (fCurrentOrientation == PrinterDriver::PORTRAIT_ORIENTATION) {
margin.right = w - margin.right;
margin.bottom = h - margin.bottom;
} else {
@ -321,17 +321,9 @@ PageSetupWindow::MessageReceived(BMessage *msg)
int32 orientation;
msg->FindInt32("orientation", &orientation);
if (fCurrentOrientation == orientation)
break;
if (fCurrentOrientation != orientation) {
fCurrentOrientation = orientation;
BPoint p = fMarginView->GetPageSize();
if (orientation == PrinterDriver::LANDSCAPE_ORIENTATION) {
fMarginView->SetPageSize(p.y, p.x);
fMarginView->UpdateView(MARGIN_CHANGED);
}
if (orientation == PrinterDriver::PORTRAIT_ORIENTATION) {
fMarginView->SetPageSize(p.y, p.x);
fMarginView->UpdateView(MARGIN_CHANGED);
}