Пример #1
0
PageSetupWindow::PageSetupWindow(BMessage *msg, const char *printerName)
    : BlockingWindow(BRect(0, 0, 100, 100), "Page setup",
                     B_TITLED_WINDOW_LOOK,
                     B_MODAL_APP_WINDOW_FEEL,
                     B_NOT_RESIZABLE | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE
                     | B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE),
      fSetupMsg(msg),
      fPrinterDirName(printerName)
{
    if (printerName)
        SetTitle(BString(printerName).Append(" Page setup").String());

    // load orientation
    if (fSetupMsg->FindInt32("orientation", &fCurrentOrientation) != B_OK)
        fCurrentOrientation = PrinterDriver::PORTRAIT_ORIENTATION;

    // load page rect
    BRect page;
    float width = letter_width;
    float height = letter_height;
    if (fSetupMsg->FindRect("preview:paper_rect", &page) == B_OK) {
        width = page.Width();
        height = page.Height();
    } else {
        page.Set(0, 0, width, height);
    }

    BString label;
    if (fSetupMsg->FindString("preview:paper_size", &label) != B_OK)
        label = "Letter";

    // Load units
    int32 units;
    if (fSetupMsg->FindInt32("units", &units) != B_OK)
        units = kUnitInch;

    // re-calculate the margin from the printable rect in points
    BRect margin = page;
    if (fSetupMsg->FindRect("preview:printable_rect", &margin) == B_OK) {
        margin.top -= page.top;
        margin.left -= page.left;
        margin.right = page.right - margin.right;
        margin.bottom = page.bottom - margin.bottom;
    } else {
        margin.Set(28.34, 28.34, 28.34, 28.34);		// 28.34 dots = 1cm
    }


    fMarginView = new MarginView(int32(width), int32(height), margin,
                                 MarginUnit(units));

    BPopUpMenu* pageSizePopUpMenu = new BPopUpMenu("Page size");
    pageSizePopUpMenu->SetRadioMode(true);

    fPageSizeMenu = new BMenuField("page_size", "Page size:", pageSizePopUpMenu);
    fPageSizeMenu->Menu()->SetLabelFromMarked(true);

    for (int32 i = 0; pageFormat[i].label != NULL; i++) {
        BMessage* message = new BMessage(PAGE_SIZE_CHANGED);
        message->AddFloat("width", pageFormat[i].width);
        message->AddFloat("height", pageFormat[i].height);
        BMenuItem* item = new BMenuItem(pageFormat[i].label, message);
        pageSizePopUpMenu->AddItem(item);

        if (label.Compare(pageFormat[i].label) == 0)
            item->SetMarked(true);
    }

    BPopUpMenu* orientationPopUpMenu = new BPopUpMenu("Orientation");
    orientationPopUpMenu->SetRadioMode(true);

    fOrientationMenu = new BMenuField("orientation", "Orientation:",
                                      orientationPopUpMenu);
    fOrientationMenu->Menu()->SetLabelFromMarked(true);

    for (int32 i = 0; orientation[i].label != NULL; i++) {
        BMessage* message = new BMessage(ORIENTATION_CHANGED);
        message->AddInt32("orientation", orientation[i].orientation);
        BMenuItem* item = new BMenuItem(orientation[i].label, message);
        orientationPopUpMenu->AddItem(item);

        if (fCurrentOrientation == orientation[i].orientation)
            item->SetMarked(true);
    }

    float scale0;
    BString scale;
    if (fSetupMsg->FindFloat("scale", &scale0) == B_OK)
        scale << (int)scale0;
    else
        scale = "100";

    fScaleControl = new BTextControl("scale", "Scale [%]:",
                                     scale.String(), NULL);

    for (uint32 i = 0; i < '0'; i++)
        fScaleControl->TextView()->DisallowChar(i);

    for (uint32 i = '9' + 1; i < 255; i++)
        fScaleControl->TextView()->DisallowChar(i);

    fScaleControl->TextView()->SetMaxBytes(3);

    BBox *separator = new BBox("separator");
    separator->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1));

    BButton *cancel = new BButton("cancel", "Cancel", new BMessage(CANCEL_MSG));

    BButton *ok = new BButton("ok", "OK", new BMessage(OK_MSG));
    ok->MakeDefault(true);

    BGridView* settings = new BGridView();
    BGridLayout* settingsLayout = settings->GridLayout();
    settingsLayout->AddItem(fPageSizeMenu->CreateLabelLayoutItem(), 0, 0);
    settingsLayout->AddItem(fPageSizeMenu->CreateMenuBarLayoutItem(), 1, 0);
    settingsLayout->AddItem(fOrientationMenu->CreateLabelLayoutItem(), 0, 1);
    settingsLayout->AddItem(fOrientationMenu->CreateMenuBarLayoutItem(), 1, 1);
    settingsLayout->AddItem(fScaleControl->CreateLabelLayoutItem(), 0, 2);
    settingsLayout->AddItem(fScaleControl->CreateTextViewLayoutItem(), 1, 2);
    settingsLayout->SetSpacing(0, 0);

    SetLayout(new BGroupLayout(B_VERTICAL));
    AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
             .AddGroup(B_HORIZONTAL, 5, 1)
             .AddGroup(B_VERTICAL, 0, 1.0f)
             .Add(fMarginView)
             .AddGlue()
             .End()
             .AddGroup(B_VERTICAL, 0, 1.0f)
             .Add(settings)
             .AddGlue()
             .End()
             .End()
             .Add(separator)
             .AddGroup(B_HORIZONTAL, 10, 1.0f)
             .AddGlue()
             .Add(cancel)
             .Add(ok)
             .End()
             .SetInsets(10, 10, 10, 10)
            );

    BRect winFrame(Frame());
    BRect screenFrame(BScreen().Frame());
    MoveTo((screenFrame.right - winFrame.right) / 2,
           (screenFrame.bottom - winFrame.bottom) / 2);
}
Пример #2
0
PageSetupWindow::PageSetupWindow(BMessage *msg, const char *printerName)
	: HWindow(BRect(0, 0, 200, 100), "Page setup", B_TITLED_WINDOW_LOOK,
 		B_MODAL_APP_WINDOW_FEEL,
 		B_NOT_RESIZABLE | B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE
			| B_AUTO_UPDATE_SIZE_LIMITS | B_CLOSE_ON_ESCAPE),
	 fResult(B_ERROR),
	 fSetupMsg(msg),
	 fAdvancedSettings(*msg),
	 fPrinterDirName(printerName)
{
	fExitSem = create_sem(0, "PageSetup");

	if (printerName)
		SetTitle(BString(printerName).Append(" page setup").String());

	if (fSetupMsg->FindInt32("orientation", &fCurrentOrientation) != B_OK)
		fCurrentOrientation = PrinterDriver::PORTRAIT_ORIENTATION;

	BRect page;
	float width = letter_width;
	float height = letter_height;
	if (fSetupMsg->FindRect("paper_rect", &page) == B_OK) {
		width = page.Width();
		height = page.Height();
	} else {
		page.Set(0, 0, width, height);
	}

	BString label;
	if (fSetupMsg->FindString("pdf_paper_size", &label) != B_OK)
		label = "Letter";

	int32 compression;
	fSetupMsg->FindInt32("pdf_compression", &compression);

	int32 units;
	if (fSetupMsg->FindInt32("units", &units) != B_OK)
		units = kUnitInch;

	// re-calculate the margin from the printable rect in points
	BRect margin = page;
	if (fSetupMsg->FindRect("printable_rect", &margin) == B_OK) {
		margin.top -= page.top;
		margin.left -= page.left;
		margin.right = page.right - margin.right;
		margin.bottom = page.bottom - margin.bottom;
	} else {
		margin.Set(28.34, 28.34, 28.34, 28.34);		// 28.34 dots = 1cm
	}

	BString setting_value;
	if (fSetupMsg->FindString("pdf_compatibility", &setting_value) != B_OK)
		setting_value = "1.3";

	// Load font settings
	fFonts = new Fonts();
	fFonts->CollectFonts();
	BMessage fonts;
	if (fSetupMsg->FindMessage("fonts", &fonts) == B_OK)
		fFonts->SetTo(&fonts);

	fMarginView = new MarginView(int32(width), int32(height), margin,
		MarginUnit(units));

	BPopUpMenu* pageSize = new BPopUpMenu("Page size");
	pageSize->SetRadioMode(true);

	fPageSizeMenu = new BMenuField("page_size", "Page size:", pageSize);
	fPageSizeMenu->Menu()->SetLabelFromMarked(true);

	for (int32 i = 0; pageFormat[i].label != NULL; i++) {
		BMessage* message = new BMessage(PAGE_SIZE_CHANGED);
		message->AddFloat("width", pageFormat[i].width);
		message->AddFloat("height", pageFormat[i].height);
		BMenuItem* item = new BMenuItem(pageFormat[i].label, message);
		pageSize->AddItem(item);

		if (label.Compare(pageFormat[i].label) == 0)
			item->SetMarked(true);
	}

	BPopUpMenu* orientationPopUpMenu = new BPopUpMenu("Orientation");
	orientationPopUpMenu->SetRadioMode(true);

	fOrientationMenu = new BMenuField("orientation", "Orientation:",
		orientationPopUpMenu);
	fOrientationMenu->Menu()->SetLabelFromMarked(true);

	for (int32 i = 0; orientation[i].label != NULL; i++) {
	 	BMessage* message = new BMessage(ORIENTATION_CHANGED);
		message->AddInt32("orientation", orientation[i].orientation);
		BMenuItem* item = new BMenuItem(orientation[i].label, message);
		orientationPopUpMenu->AddItem(item);

		if (fCurrentOrientation == orientation[i].orientation)
			item->SetMarked(true);
	}

	BPopUpMenu* compatibility = new BPopUpMenu("PDF compatibility");
	compatibility->SetRadioMode(true);

	fPDFCompatibilityMenu = new BMenuField("pdf_compatibility",
		"PDF compatibility:", compatibility);
	fPDFCompatibilityMenu->Menu()->SetLabelFromMarked(true);

	for (int32 i = 0; pdf_compatibility[i] != NULL; i++) {
		BMenuItem* item = new BMenuItem(pdf_compatibility[i], NULL);
		compatibility->AddItem(item);
		if (setting_value == pdf_compatibility[i])
			item->SetMarked(true);
	}

	fPDFCompressionSlider = new BSlider("pdf_compression",
		"Compression:", NULL, 0, 9, B_HORIZONTAL);
	fPDFCompressionSlider->SetLimitLabels("None", "Best");
	fPDFCompressionSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fPDFCompressionSlider->SetValue(compression);

	BBox *separator = new BBox("separator");
	separator->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1));

	BButton *cancel = new BButton("cancel", "Cancel", new BMessage(CANCEL_MSG));

	BButton *ok = new BButton("ok", "OK", new BMessage(OK_MSG));
	ok->MakeDefault(true);

	BButton *fontsButton = new BButton("fonts", "Fonts" B_UTF8_ELLIPSIS,
		new BMessage(FONTS_MSG));

	BButton* advancedButton = new BButton("advanced",
		"Advanced" B_UTF8_ELLIPSIS,
		new BMessage(ADVANCED_MSG));

	BGridView* settings = new BGridView();
	BGridLayout* settingsLayout = settings->GridLayout();
	settingsLayout->AddItem(fPageSizeMenu->CreateLabelLayoutItem(), 0, 0);
	settingsLayout->AddItem(fPageSizeMenu->CreateMenuBarLayoutItem(), 1, 0);
	settingsLayout->AddItem(fOrientationMenu->CreateLabelLayoutItem(), 0, 1);
	settingsLayout->AddItem(fOrientationMenu->CreateMenuBarLayoutItem(), 1, 1);
	settingsLayout->AddItem(fPDFCompatibilityMenu->CreateLabelLayoutItem(), 0, 2);
	settingsLayout->AddItem(fPDFCompatibilityMenu->CreateMenuBarLayoutItem(), 1, 2);
	settingsLayout->AddView(fPDFCompressionSlider, 0, 3, 2);
	settingsLayout->SetSpacing(0, 0);

	SetLayout(new BGroupLayout(B_VERTICAL));
	AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
		.AddGroup(B_HORIZONTAL, 5, 1)
			.AddGroup(B_VERTICAL, 0, 1.0f)
				.Add(fMarginView)
				.AddGlue()
			.End()
			.AddGroup(B_VERTICAL, 0, 1.0f)
				.Add(settings)
				.AddGlue()
			.End()
		.End()
		.Add(separator)
		.AddGroup(B_HORIZONTAL, 10, 1.0f)
			.Add(fontsButton)
			.Add(advancedButton)
			.AddGlue()
			.Add(cancel)
			.Add(ok)
		.End()
		.SetInsets(10, 10, 10, 10)
	);

	BRect winFrame(Frame());
	BRect screenFrame(BScreen().Frame());
	MoveTo((screenFrame.right - winFrame.right) / 2,
		(screenFrame.bottom - winFrame.bottom) / 2);
}
Пример #3
0
PageSetupWindow::PageSetupWindow(BMessage *msg, const char *printerName)
	:	BlockingWindow(BRect(0,0,400,220), "Page setup", B_TITLED_WINDOW_LOOK,
 			B_MODAL_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_MINIMIZABLE |
 			B_NOT_ZOOMABLE),
	fSetupMsg(msg),
	fPrinterDirName(printerName)
{
	if (printerName)
		SetTitle(BString(printerName).Append(" Page setup").String());

	// load orientation
	if (fSetupMsg->FindInt32("orientation", &fCurrentOrientation) != B_OK)
		fCurrentOrientation = PrinterDriver::PORTRAIT_ORIENTATION;

	// load page rect
	BRect page;
	float width = letter_width;
	float height = letter_height;
	if (fSetupMsg->FindRect("preview:paper_rect", &page) == B_OK) {
		width = page.Width();
		height = page.Height();
	} else {
		page.Set(0, 0, width, height);
	}

	BString label;
	if (fSetupMsg->FindString("preview:paper_size", &label) != B_OK)
		label = "Letter";

	// Load units
	int32 units;
	if (fSetupMsg->FindInt32("units", &units) != B_OK)
		units = kUnitInch;

	// re-calculate the margin from the printable rect in points
	BRect margin = page;
	if (fSetupMsg->FindRect("preview:printable_rect", &margin) == B_OK) {
		margin.top -= page.top;
		margin.left -= page.left;
		margin.right = page.right - margin.right;
		margin.bottom = page.bottom - margin.bottom;
	} else {
		margin.Set(28.34, 28.34, 28.34, 28.34);		// 28.34 dots = 1cm
	}

	BRect bounds(Bounds());
	BBox *panel = new BBox(bounds, "background", B_FOLLOW_ALL,
		B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER);
	AddChild(panel);

	bounds.InsetBy(10.0, 10.0);
	bounds.right = 230.0;
	bounds.bottom = 160.0;
	fMarginView = new MarginView(bounds, int32(width), int32(height), margin,
		MarginUnit(units));
	panel->AddChild(fMarginView);
	fMarginView->SetResizingMode(B_FOLLOW_NONE);

	BPopUpMenu* m = new BPopUpMenu("Page size");
	m->SetRadioMode(true);

	bounds.OffsetBy(bounds.Width() + 10.0, 5.0);
	float divider = be_plain_font->StringWidth("Orientation: ");
	fPageSizeMenu = new BMenuField(bounds, "page_size", "Page size:", m);
	panel->AddChild(fPageSizeMenu);
	fPageSizeMenu->ResizeToPreferred();
	fPageSizeMenu->SetDivider(divider);
	fPageSizeMenu->Menu()->SetLabelFromMarked(true);

	for (int32 i = 0; pageFormat[i].label != NULL; i++) {
		BMessage* message = new BMessage(PAGE_SIZE_CHANGED);
		message->AddFloat("width", pageFormat[i].width);
		message->AddFloat("height", pageFormat[i].height);
		BMenuItem* item = new BMenuItem(pageFormat[i].label, message);
		m->AddItem(item);

		if (label.Compare(pageFormat[i].label) == 0)
			item->SetMarked(true);
	}

	m = new BPopUpMenu("Orientation");
	m->SetRadioMode(true);

	bounds.OffsetBy(0.0, fPageSizeMenu->Bounds().Height() + 10.0);
	fOrientationMenu = new BMenuField(bounds, "orientation", "Orientation:", m);
	panel->AddChild(fOrientationMenu);
	fOrientationMenu->ResizeToPreferred();
	fOrientationMenu->SetDivider(divider);
	fOrientationMenu->Menu()->SetLabelFromMarked(true);

	for (int32 i = 0; orientation[i].label != NULL; i++) {
	 	BMessage* message = new BMessage(ORIENTATION_CHANGED);
		message->AddInt32("orientation", orientation[i].orientation);
		BMenuItem* item = new BMenuItem(orientation[i].label, message);
		m->AddItem(item);

		if (fCurrentOrientation == orientation[i].orientation)
			item->SetMarked(true);
	}

	float scale0;
	BString scale;
	if (fSetupMsg->FindFloat("scale", &scale0) == B_OK)
		scale << (int)scale0;
	else
		scale = "100";

	bounds.OffsetBy(0.0, fOrientationMenu->Bounds().Height() + 10.0);
	bounds.right -= 30.0;
	fScaleControl = new BTextControl(bounds, "scale", "Scale [%]:",
		scale.String(), NULL);
	panel->AddChild(fScaleControl);
	fScaleControl->ResizeToPreferred();
	fScaleControl->SetDivider(divider);

	for (uint32 i = 0; i < '0'; i++)
		fScaleControl->TextView()->DisallowChar(i);

	for (uint32 i = '9' + 1; i < 255; i++)
		fScaleControl->TextView()->DisallowChar(i);

	fScaleControl->TextView()->SetMaxBytes(3);

	bounds = Bounds();
	bounds.InsetBy(5.0, 0.0);
	bounds.top =
		MAX(fScaleControl->Frame().bottom, fMarginView->Frame().bottom) + 10.0;
	BBox *line = new BBox(BRect(bounds.left, bounds.top, bounds.right,
		bounds.top + 1.0), NULL, B_FOLLOW_LEFT_RIGHT);
	panel->AddChild(line);

	bounds.InsetBy(5.0, 0.0);
	bounds.OffsetBy(0.0, 11.0);
	BButton *cancel = new BButton(bounds, NULL, "Cancel", new BMessage(CANCEL_MSG));
	panel->AddChild(cancel);
	cancel->ResizeToPreferred();

	BButton *ok = new BButton(bounds, NULL, "OK", new BMessage(OK_MSG));
	panel->AddChild(ok, cancel);
	ok->ResizeToPreferred();

	bounds.right = fScaleControl->Frame().right;
	ok->MoveTo(bounds.right - ok->Bounds().Width(), ok->Frame().top);

	bounds = ok->Frame();
	cancel->MoveTo(bounds.left - cancel->Bounds().Width() - 10.0, bounds.top);

	ok->MakeDefault(true);
	ResizeTo(bounds.right + 10.0, bounds.bottom + 10.0);

	BRect winFrame(Frame());
	BRect screenFrame(BScreen().Frame());
	MoveTo((screenFrame.right - winFrame.right) / 2,
		(screenFrame.bottom - winFrame.bottom) / 2);
}
Пример #4
0
PageSetupWindow::PageSetupWindow(BMessage *msg, const char *printerName)
	: HWindow(BRect(0,0,400,220), "Page setup", B_TITLED_WINDOW_LOOK,
 		B_MODAL_APP_WINDOW_FEEL, B_NOT_RESIZABLE | B_NOT_MINIMIZABLE |
 		B_NOT_ZOOMABLE),
	 fResult(B_ERROR),
	 fSetupMsg(msg),
	 fAdvancedSettings(*msg),
	 fPrinterDirName(printerName)
{
	fExitSem 	= create_sem(0, "PageSetup");

	if (printerName)
		SetTitle(BString(printerName).Append(" page setup").String());

	if (fSetupMsg->FindInt32("orientation", &fCurrentOrientation) != B_OK)
		fCurrentOrientation = PrinterDriver::PORTRAIT_ORIENTATION;

	BRect page;
	float width = letter_width;
	float height = letter_height;
	if (fSetupMsg->FindRect("paper_rect", &page) == B_OK) {
		width = page.Width();
		height = page.Height();
	} else {
		page.Set(0, 0, width, height);
	}

	BString label;
	if (fSetupMsg->FindString("pdf_paper_size", &label) != B_OK)
		label = "Letter";

	int32 compression;
	fSetupMsg->FindInt32("pdf_compression", &compression);

	int32 units;
	if (fSetupMsg->FindInt32("units", &units) != B_OK)
		units = kUnitInch;

	// re-calculate the margin from the printable rect in points
	BRect margin = page;
	if (fSetupMsg->FindRect("printable_rect", &margin) == B_OK) {
		margin.top -= page.top;
		margin.left -= page.left;
		margin.right = page.right - margin.right;
		margin.bottom = page.bottom - margin.bottom;
	} else {
		margin.Set(28.34, 28.34, 28.34, 28.34);		// 28.34 dots = 1cm
	}

	BString setting_value;
	if (fSetupMsg->FindString("pdf_compatibility", &setting_value) != B_OK)
		setting_value = "1.3";

	// Load font settings
	fFonts = new Fonts();
	fFonts->CollectFonts();
	BMessage fonts;
	if (fSetupMsg->FindMessage("fonts", &fonts) == B_OK)
		fFonts->SetTo(&fonts);

	// add a *dialog* background
	BRect bounds(Bounds());
	BBox *panel = new BBox(bounds, "background", B_FOLLOW_ALL,
		B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER);
	AddChild(panel);

	bounds.InsetBy(10.0, 10.0);
	bounds.right = 230.0;
	bounds.bottom = 160.0;
	fMarginView = new MarginView(bounds, int32(width), int32(height), margin,
		MarginUnit(units));
	panel->AddChild(fMarginView);
	fMarginView->SetResizingMode(B_FOLLOW_NONE);

	BPopUpMenu* m = new BPopUpMenu("Page size");
	m->SetRadioMode(true);

	bounds.OffsetBy(bounds.Width() + 10.0, 5.0);
	float divider = be_plain_font->StringWidth("PDF compatibility: ");
	fPageSizeMenu = new BMenuField(bounds, "page_size", "Page size:", m);
	panel->AddChild(fPageSizeMenu);
	fPageSizeMenu->ResizeToPreferred();
	fPageSizeMenu->SetDivider(divider);
	fPageSizeMenu->Menu()->SetLabelFromMarked(true);

	for (int32 i = 0; pageFormat[i].label != NULL; i++) {
		BMessage* message = new BMessage(PAGE_SIZE_CHANGED);
		message->AddFloat("width", pageFormat[i].width);
		message->AddFloat("height", pageFormat[i].height);
		BMenuItem* item = new BMenuItem(pageFormat[i].label, message);
		m->AddItem(item);

		if (label.Compare(pageFormat[i].label) == 0)
			item->SetMarked(true);
	}

	m = new BPopUpMenu("Orientation");
	m->SetRadioMode(true);

	bounds.OffsetBy(0.0, fPageSizeMenu->Bounds().Height() + 10.0);
	fOrientationMenu = new BMenuField(bounds, "orientation", "Orientation:", m);
	panel->AddChild(fOrientationMenu);
	fOrientationMenu->ResizeToPreferred();
	fOrientationMenu->SetDivider(divider);
	fOrientationMenu->Menu()->SetLabelFromMarked(true);

	for (int32 i = 0; orientation[i].label != NULL; i++) {
	 	BMessage* message = new BMessage(ORIENTATION_CHANGED);
		message->AddInt32("orientation", orientation[i].orientation);
		BMenuItem* item = new BMenuItem(orientation[i].label, message);
		m->AddItem(item);

		if (fCurrentOrientation == orientation[i].orientation)
			item->SetMarked(true);
	}

	m = new BPopUpMenu("PDF compatibility");
	m->SetRadioMode(true);

	bounds.OffsetBy(0.0, fOrientationMenu->Bounds().Height() + 10.0);
	fPDFCompatibilityMenu = new BMenuField(bounds, "pdf_compatibility",
		"PDF compatibility:", m);
	panel->AddChild(fPDFCompatibilityMenu);
	fPDFCompatibilityMenu->ResizeToPreferred();
	fPDFCompatibilityMenu->SetDivider(divider);
	fPDFCompatibilityMenu->Menu()->SetLabelFromMarked(true);

	for (int32 i = 0; pdf_compatibility[i] != NULL; i++) {
		BMenuItem* item = new BMenuItem(pdf_compatibility[i], NULL);
		m->AddItem(item);
		if (setting_value == pdf_compatibility[i])
			item->SetMarked(true);
	}

	bounds.OffsetBy(0.0, fPDFCompatibilityMenu->Bounds().Height() + 10.0);
	fPDFCompressionSlider = new BSlider(bounds, "pdf_compression",
		"Compression:", NULL, 0, 9);
	panel->AddChild(fPDFCompressionSlider);
	fPDFCompressionSlider->SetLimitLabels("None", "Best");
	fPDFCompressionSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fPDFCompressionSlider->SetValue(compression);
	fPDFCompressionSlider->ResizeToPreferred();

	bounds = Bounds();
	bounds.InsetBy(5.0, 0.0);
	bounds.top = MAX(fPDFCompressionSlider->Frame().bottom,
		fMarginView->Frame().bottom) + 10.0;
	BBox *line = new BBox(BRect(bounds.left, bounds.top, bounds.right,
		bounds.top + 1.0), NULL, B_FOLLOW_LEFT_RIGHT);
	panel->AddChild(line);

	bounds.InsetBy(5.0, 0.0);
	bounds.OffsetBy(0.0, 11.0);
	BButton *cancel = new BButton(bounds, NULL, "Cancel", new BMessage(CANCEL_MSG));
	panel->AddChild(cancel);
	cancel->ResizeToPreferred();

	BButton *ok = new BButton(bounds, NULL, "OK", new BMessage(OK_MSG));
	panel->AddChild(ok, cancel);
	ok->ResizeToPreferred();

	bounds.right = fPDFCompressionSlider->Frame().right;
	ok->MoveTo(bounds.right - ok->Bounds().Width(), ok->Frame().top);

	bounds = ok->Frame();
	cancel->MoveTo(bounds.left - cancel->Bounds().Width() - 10.0, bounds.top);

	ok->MakeDefault(true);
	ResizeTo(bounds.right + 10.0, bounds.bottom + 10.0);

	BButton *button = new BButton(bounds, NULL, "Fonts" B_UTF8_ELLIPSIS,
		new BMessage(FONTS_MSG));
	panel->AddChild(button);
	button->ResizeToPreferred();
	button->MoveTo(fMarginView->Frame().left, bounds.top);

	bounds = button->Frame();
	button = new BButton(bounds, NULL, "Advanced" B_UTF8_ELLIPSIS,
		new BMessage(ADVANCED_MSG));
	panel->AddChild(button);
	button->ResizeToPreferred();
	button->MoveTo(bounds.right + 10, bounds.top);

	BRect winFrame(Frame());
	BRect screenFrame(BScreen().Frame());
	MoveTo((screenFrame.right - winFrame.right) / 2,
		(screenFrame.bottom - winFrame.bottom) / 2);
}