void AP_UnixDialog_PageSetup::doWidthEntry(void) { UT_UTF8String sAfter = gtk_entry_get_text(GTK_ENTRY(m_entryPageWidth)); m_PageSize.Set(fp_PageSize::psCustom , getPageUnits()); _setWidth(sAfter.utf8_str()); { XAP_GtkSignalBlocker b(G_OBJECT(m_entryPageWidth), m_iEntryPageWidthID); int pos = gtk_editable_get_position(GTK_EDITABLE(m_entryPageWidth)); gtk_entry_set_text( GTK_ENTRY(m_entryPageWidth),sAfter.utf8_str() ); gtk_editable_set_position(GTK_EDITABLE(m_entryPageWidth), pos); } m_PageSize.Set(fp_PageSize::psCustom , getPageUnits()); _updatePageSizeList(); }
void CStandardApertureDialog::setApertureType(StandardApertureTypeTag apertureType) { m_parameters.setDescriptorPrefix(standardApertureTypeTagToDescriptorPrefix(apertureType)); PageUnitsTag pageUnits = getPageUnits(); int exponent = CStandardApertureShape::getDefaultDescriptorDimensionFactorExponent(pageUnits); setStandardApertureShape(CStandardApertureShape::create(apertureType,pageUnits,exponent)); setGenericStandardApertureShape(CStandardApertureShape::create(apertureType,pageUnits,exponent)); }
void AP_UnixDialog_PageSetup::_setHeight(const char * buf) { double height = static_cast<double>(atof(buf)); if(m_PageSize.match(height,10.0)) { return; } double width = static_cast<double>(m_PageSize.Width(getPageUnits())); if( height >= 0.00001) { if(m_PageSize.isPortrait()) { m_PageSize.Set( width, height, getPageUnits() ); } else { m_PageSize.Set( height, width, getPageUnits() ); } } }
GtkWidget * AP_UnixDialog_PageSetup::_constructWindow (void) { // get the path where our UI file is located std::string ui_path = static_cast<XAP_UnixApp*>(XAP_App::getApp())->getAbiSuiteAppUIDir() + "/ap_UnixDialog_PageSetup.xml"; // load the dialog from the UI file m_pBuilder = gtk_builder_new(); gtk_builder_add_from_file(m_pBuilder, ui_path.c_str(), NULL); const XAP_StringSet * pSS = m_pApp->getStringSet (); GList *glist; GtkLabel *orientation; m_window = _getWidget("ap_UnixDialog_PageSetup"); m_wHelp = _getWidget("wHelp"); m_comboPageSize = _getWidget("comboPageSize"); m_entryPageWidth = _getWidget("wWidthSpin"); m_entryPageHeight = _getWidget("wHeightSpin"); m_optionPageUnits = _getWidget("optionPageUnits"); m_radioPagePortrait = _getWidget("rbPortrait"); m_radioPageLandscape = _getWidget("rbLandscape"); m_spinPageScale = _getWidget("wPageScale"); m_optionMarginUnits = _getWidget("optionMarginUnits"); m_spinMarginTop = _getWidget("wTopSpin"); m_spinMarginBottom = _getWidget("wBottomSpin"); m_spinMarginLeft = _getWidget("wLeftSpin"); m_spinMarginRight = _getWidget("wRightSpin"); m_spinMarginHeader = _getWidget("wHeaderSpin"); m_spinMarginFooter = _getWidget("wFooterSpin"); m_MarginHbox = _getWidget("hbox15"); m_PageHbox = _getWidget("hbox16"); /* required for translations */ gtk_label_set_text (GTK_LABEL (_getWidget("lbPage")), _(AP, DLG_PageSetup_Page)); gtk_label_set_text (GTK_LABEL (_getWidget("lbMargin")), _(AP, DLG_PageSetup_Margin)); Markup (_getWidget("lbPaper"), pSS, _(AP, DLG_PageSetup_Paper)); gtk_label_set_text (GTK_LABEL (_getWidget("lbPaperSize")), _(AP, DLG_PageSetup_Paper_Size)); gtk_label_set_text (GTK_LABEL (_getWidget("lbPageUnits")), _(AP, DLG_PageSetup_Units)); gtk_label_set_text (GTK_LABEL (_getWidget("lbWidth")), _(AP, DLG_PageSetup_Width)); gtk_label_set_text (GTK_LABEL (_getWidget("lbHeight")), _(AP, DLG_PageSetup_Height)); Markup (_getWidget("lbOrientation"), pSS, _(AP, DLG_PageSetup_Orient)); /* radio button labels */ glist = gtk_container_get_children (GTK_CONTAINER (m_radioPagePortrait)); orientation = GTK_LABEL (g_list_nth_data (glist, 0)); gtk_label_set_text (GTK_LABEL (orientation), _(AP, DLG_PageSetup_Portrait)); glist = gtk_container_get_children (GTK_CONTAINER (m_radioPageLandscape)); orientation = GTK_LABEL (g_list_nth_data (glist, 0)); gtk_label_set_text (GTK_LABEL (orientation), _(AP, DLG_PageSetup_Landscape)); Markup (_getWidget("lbScale"), pSS, _(AP, DLG_PageSetup_Scale)); gtk_label_set_text (GTK_LABEL (_getWidget("lbAdjust")), _(AP, DLG_PageSetup_Adjust)); gtk_label_set_text (GTK_LABEL (_getWidget("lbPercentNormalSize")), _(AP, DLG_PageSetup_Percent)); gtk_label_set_text (GTK_LABEL (_getWidget("lbMarginUnits")), _(AP, DLG_PageSetup_Units)); gtk_label_set_text (GTK_LABEL (_getWidget("lbTop")), _(AP, DLG_PageSetup_Top)); gtk_label_set_text (GTK_LABEL (_getWidget("lbRight")), _(AP, DLG_PageSetup_Right)); gtk_label_set_text (GTK_LABEL (_getWidget("lbLeft")), _(AP, DLG_PageSetup_Left)); gtk_label_set_text (GTK_LABEL (_getWidget("lbBottom")), _(AP, DLG_PageSetup_Bottom)); gtk_label_set_text (GTK_LABEL (_getWidget("lbHeader")), _(AP, DLG_PageSetup_Header)); gtk_label_set_text (GTK_LABEL (_getWidget("lbFooter")), _(AP, DLG_PageSetup_Footer)); /* end translation req */ /* setup page width and height */ if (!getPageOrientation () == PORTRAIT) { m_PageSize.setLandscape(); } gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_entryPageWidth), m_PageSize.Width (getPageUnits ())); gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_entryPageHeight), m_PageSize.Height (getPageUnits ())); /* setup margin numbers */ gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_spinMarginTop), getMarginTop ()); gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_spinMarginBottom), getMarginBottom ()); gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_spinMarginLeft), getMarginLeft ()); gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_spinMarginRight), getMarginRight ()); gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_spinMarginHeader), getMarginHeader ()); gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_spinMarginFooter), getMarginFooter ()); /* setup scale number */ gtk_spin_button_set_value (GTK_SPIN_BUTTON (m_spinPageScale), static_cast<float>(getPageScale ())); // fill the combobox all of our supported page sizes GtkListStore* pagesize_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); GtkTreeIter pagesize_iter; for (UT_uint32 i = fp_PageSize::_first_predefined_pagesize_; i < fp_PageSize::_last_predefined_pagesize_dont_use_; i++) { gtk_list_store_append(pagesize_store, &pagesize_iter); gtk_list_store_set(pagesize_store, &pagesize_iter, 0, fp_PageSize::PredefinedToName ((fp_PageSize::Predefined)i), 1, this, -1); } gtk_combo_box_set_model(GTK_COMBO_BOX(m_comboPageSize), GTK_TREE_MODEL(pagesize_store)); m_iComboPageSizeListID = g_signal_connect(G_OBJECT(m_comboPageSize), "changed", G_CALLBACK(s_page_size_changed), static_cast<gpointer>(this)); /* setup page units menu */ GtkComboBox *combo = GTK_COMBO_BOX(m_optionPageUnits); XAP_makeGtkComboBoxText(combo, G_TYPE_INT); XAP_appendComboBoxTextAndInt(combo, _(XAP, DLG_Unit_inch), DIM_IN); XAP_appendComboBoxTextAndInt(combo, _(XAP, DLG_Unit_cm), DIM_CM); XAP_appendComboBoxTextAndInt(combo, _(XAP, DLG_Unit_mm), DIM_MM); XAP_comboBoxSetActiveFromIntCol(combo, 1, getPageUnits ()); /* setup margin units menu */ combo = GTK_COMBO_BOX(m_optionMarginUnits); XAP_makeGtkComboBoxText(combo, G_TYPE_INT); XAP_appendComboBoxTextAndInt(combo, _(XAP, DLG_Unit_inch), DIM_IN); XAP_appendComboBoxTextAndInt(combo, _(XAP, DLG_Unit_cm), DIM_CM); XAP_appendComboBoxTextAndInt(combo, _(XAP, DLG_Unit_mm), DIM_MM); last_margin_unit = getMarginUnits (); XAP_comboBoxSetActiveFromIntCol(combo, 1, last_margin_unit); /* add margin XPM image to the margin window */ customPreview = create_pixmap (m_MarginHbox, margin_xpm); gtk_widget_show (customPreview); gtk_box_pack_start (GTK_BOX (m_MarginHbox), customPreview, FALSE, FALSE, 0); /* add correct page XPM image to the page window */ if (getPageOrientation () == PORTRAIT) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_radioPagePortrait), TRUE); customPreview = create_pixmap (m_PageHbox, orient_vertical_xpm); gtk_widget_show (customPreview); gtk_box_pack_start (GTK_BOX (m_PageHbox), customPreview, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (m_PageHbox), customPreview, 0); } else { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_radioPageLandscape), TRUE); customPreview = create_pixmap (m_PageHbox, orient_horizontal_xpm); gtk_widget_show (customPreview); gtk_box_pack_start (GTK_BOX (m_PageHbox), customPreview, FALSE, FALSE, 0); gtk_box_reorder_child (GTK_BOX (m_PageHbox), customPreview, 0); } abiAddStockButton(GTK_DIALOG(m_window), GTK_STOCK_CANCEL, BUTTON_CANCEL); abiAddStockButton(GTK_DIALOG(m_window), GTK_STOCK_OK, BUTTON_OK); _connectSignals (); return m_window; }