GtkWidget * AP_UnixDialog_FormatTOC::_constructWindow(void) { #if GTK_CHECK_VERSION(3,0,0) m_pBuilder = newDialogBuilder("ap_UnixDialog_FormatTOC.ui"); #else m_pBuilder = newDialogBuilder("ap_UnixDialog_FormatTOC-2.ui"); #endif const XAP_StringSet * pSS = m_pApp->getStringSet (); m_windowMain = _getWidget("ap_UnixDialog_FormatTOC"); m_wApply = _getWidget("wApply"); m_wClose = _getWidget("wClose"); // set the dialog title UT_UTF8String s; pSS->getValueUTF8(AP_STRING_ID_DLG_FormatTOC_Title,s); abiDialogSetTitle(m_windowMain, "%s", s.utf8_str()); // localize notebook tabs localizeLabel(_getWidget( "lbGeneral"), pSS, AP_STRING_ID_DLG_FormatTOC_General); localizeLabel(_getWidget( "lbLayoutDetails"), pSS, AP_STRING_ID_DLG_FormatTOC_LayoutDetails); // Heading settings localizeButtonMarkup(_getWidget( "cbHasHeading"), pSS, AP_STRING_ID_DLG_FormatTOC_HasHeading); localizeLabelUnderline(_getWidget( "lbHeadingText"), pSS, AP_STRING_ID_DLG_FormatTOC_HeadingText); localizeLabel(_getWidget( "lbHeadingStyle"), pSS, AP_STRING_ID_DLG_FormatTOC_HeadingStyle); localizeButton(_getWidget( "lbChangeHeadingStyle"), pSS, AP_STRING_ID_DLG_FormatTOC_ChangeStyle); // Main level definitions localizeLabelMarkup(_getWidget( "lbMainLevelDefs"), pSS, AP_STRING_ID_DLG_FormatTOC_LevelDefs); localizeButtonUnderline(_getWidget( "wHasLabel"), pSS, AP_STRING_ID_DLG_FormatTOC_HasLabel); localizeLabel(_getWidget( "lbFillStyle"), pSS, AP_STRING_ID_DLG_FormatTOC_FillStyle); localizeLabel(_getWidget( "lbDispStyle"), pSS, AP_STRING_ID_DLG_FormatTOC_DispStyle); localizeButton(_getWidget( "wChangeFill"), pSS, AP_STRING_ID_DLG_FormatTOC_ChangeStyle); localizeButton(_getWidget( "wChangeDisp"), pSS, AP_STRING_ID_DLG_FormatTOC_ChangeStyle); // Details top localizeLabelMarkup(_getWidget( "lbDetails"), pSS, AP_STRING_ID_DLG_FormatTOC_DetailsTop); localizeLabelUnderline(_getWidget( "lbStartAt"), pSS, AP_STRING_ID_DLG_FormatTOC_StartAt); localizeLabelUnderline(_getWidget( "lbTextBefore"), pSS, AP_STRING_ID_DLG_FormatTOC_TextBefore); localizeLabelUnderline(_getWidget( "lbNumberingType"), pSS, AP_STRING_ID_DLG_FormatTOC_NumberingType); localizeLabelUnderline(_getWidget( "lbTextAfter"), pSS, AP_STRING_ID_DLG_FormatTOC_TextAfter); localizeButtonUnderline(_getWidget( "cbInherit"), pSS, AP_STRING_ID_DLG_FormatTOC_InheritLabel); // Tabs and numbering localizeLabelMarkup(_getWidget( "lbTabPage"), pSS, AP_STRING_ID_DLG_FormatTOC_DetailsTabPage); localizeLabelUnderline(_getWidget( "lbTabLeader"), pSS, AP_STRING_ID_DLG_FormatTOC_TabLeader); localizeLabelUnderline(_getWidget( "lbPageNumbering"), pSS, AP_STRING_ID_DLG_FormatTOC_PageNumbering); localizeLabelUnderline(_getWidget( "lbIndent"), pSS, AP_STRING_ID_DLG_FormatTOC_Indent); // Create the itemlists _createLabelTypeItems(); _createTABTypeItems(); _createLevelItems(); return m_windowMain; }
GtkWidget * AP_UnixDialog_InsertTable::_constructWindow(void) { GtkWidget * window; const XAP_StringSet * pSS = m_pApp->getStringSet(); #if GTK_CHECK_VERSION(3,0,0) GtkBuilder * builder = newDialogBuilder("ap_UnixDialog_InsertTable.ui"); #else GtkBuilder * builder = newDialogBuilder("ap_UnixDialog_InsertTable-2.ui"); #endif // Update our member variables with the important widgets that // might need to be queried or altered later window = GTK_WIDGET(gtk_builder_get_object(builder, "ap_UnixDialog_InsertTable")); GtkWidget * widget = GTK_WIDGET(gtk_builder_get_object(builder, "rbAutoColSize")); UT_ASSERT(widget); // it shouldn't happen if things are propoerly installed. m_radioGroup = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); m_pColSpin = GTK_WIDGET(gtk_builder_get_object(builder, "sbNumCols")); m_pRowSpin = GTK_WIDGET(gtk_builder_get_object(builder, "sbNumRows")); m_pColWidthSpin = GTK_WIDGET(gtk_builder_get_object(builder, "sbColSize")); gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_pColSpin), getNumCols()); gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_pRowSpin), getNumRows()); GtkWidget *rbAutoColSize = GTK_WIDGET(gtk_builder_get_object(builder, "rbAutoColSize")); UT_ASSERT(rbAutoColSize); s_auto_colsize_toggled (GTK_TOGGLE_BUTTON (rbAutoColSize), m_pColWidthSpin); g_signal_connect (G_OBJECT (rbAutoColSize), "toggled", G_CALLBACK (s_auto_colsize_toggled), m_pColWidthSpin); // set the dialog title std::string s; pSS->getValueUTF8(AP_STRING_ID_DLG_InsertTable_TableTitle,s); abiDialogSetTitle(window, "%s", s.c_str()); // Units gtk_label_set_text (GTK_LABEL (GTK_WIDGET(gtk_builder_get_object(builder, "lbInch"))), UT_dimensionName(m_dim)); double spinstep = getSpinIncr (); gtk_spin_button_set_increments (GTK_SPIN_BUTTON(m_pColWidthSpin), spinstep, spinstep * 5); double spinmin = getSpinMin (); gtk_spin_button_set_range (GTK_SPIN_BUTTON(m_pColWidthSpin), spinmin, spinmin * 1000); gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_pColWidthSpin), m_columnWidth); // localize the strings in our dialog, and set tags for some widgets localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbTableSize")), pSS, AP_STRING_ID_DLG_InsertTable_TableSize); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbNumCols")), pSS, AP_STRING_ID_DLG_InsertTable_NumCols); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbNumRows")), pSS, AP_STRING_ID_DLG_InsertTable_NumRows); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbAutoFit")), pSS, AP_STRING_ID_DLG_InsertTable_AutoFit); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbAutoColSize")), pSS, AP_STRING_ID_DLG_InsertTable_AutoColSize); g_object_set_data (G_OBJECT (GTK_WIDGET(gtk_builder_get_object(builder, "rbAutoColSize"))), WIDGET_ID_TAG_KEY, GINT_TO_POINTER(b_AUTOSIZE)); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbFixedColSize")), pSS, AP_STRING_ID_DLG_InsertTable_FixedColSize); g_object_set_data (G_OBJECT (GTK_WIDGET(gtk_builder_get_object(builder, "rbFixedColSize"))), WIDGET_ID_TAG_KEY, GINT_TO_POINTER(b_FIXEDSIZE)); localizeButtonUnderline(GTK_WIDGET(gtk_builder_get_object(builder, "btInsert")), pSS, AP_STRING_ID_DLG_InsertButton); g_object_unref(G_OBJECT(builder)); return window; }
GtkWidget * AP_UnixDialog_Break::_constructWindow(void) { GtkWidget * window; const XAP_StringSet * pSS = m_pApp->getStringSet(); GtkBuilder * builder = newDialogBuilder("ap_UnixDialog_Break.xml"); // Update our member variables with the important widgets that // might need to be queried or altered later window = GTK_WIDGET(gtk_builder_get_object(builder, "ap_UnixDialog_Break")); m_radioGroup = gtk_radio_button_get_group (GTK_RADIO_BUTTON ( GTK_WIDGET(gtk_builder_get_object(builder, "rbPageBreak")) )); // set the dialog title UT_UTF8String s; pSS->getValueUTF8(AP_STRING_ID_DLG_Break_BreakTitle_Capital,s); abiDialogSetTitle(window, s.utf8_str()); // localize the strings in our dialog, and set tags for some widgets localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbInsertBreak")), pSS, AP_STRING_ID_DLG_Break_Insert); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbPageBreak")), pSS, AP_STRING_ID_DLG_Break_PageBreak); g_object_set_data (G_OBJECT (GTK_WIDGET(gtk_builder_get_object(builder, "rbPageBreak"))), WIDGET_ID_TAG_KEY, GINT_TO_POINTER(b_PAGE)); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbColumnBreak")), pSS, AP_STRING_ID_DLG_Break_ColumnBreak); g_object_set_data (G_OBJECT (GTK_WIDGET(gtk_builder_get_object(builder, "rbColumnBreak"))), WIDGET_ID_TAG_KEY, GINT_TO_POINTER(b_COLUMN)); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbInsertSectionBreak")), pSS, AP_STRING_ID_DLG_Break_SectionBreaks_Capital); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbNextPage")), pSS, AP_STRING_ID_DLG_Break_NextPage); g_object_set_data (G_OBJECT (GTK_WIDGET(gtk_builder_get_object(builder, "rbNextPage"))), WIDGET_ID_TAG_KEY, GINT_TO_POINTER(b_NEXTPAGE)); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbContinuous")), pSS, AP_STRING_ID_DLG_Break_Continuous); g_object_set_data (G_OBJECT (GTK_WIDGET(gtk_builder_get_object(builder, "rbContinuous"))), WIDGET_ID_TAG_KEY, GINT_TO_POINTER(b_CONTINUOUS)); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbEvenPage")), pSS, AP_STRING_ID_DLG_Break_EvenPage); g_object_set_data (G_OBJECT (GTK_WIDGET(gtk_builder_get_object(builder, "rbEvenPage"))), WIDGET_ID_TAG_KEY, GINT_TO_POINTER(b_EVENPAGE)); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbOddPage")), pSS, AP_STRING_ID_DLG_Break_OddPage); g_object_set_data (G_OBJECT (GTK_WIDGET(gtk_builder_get_object(builder, "rbOddPage"))), WIDGET_ID_TAG_KEY, GINT_TO_POINTER(b_ODDPAGE)); localizeButtonUnderline(GTK_WIDGET(gtk_builder_get_object(builder, "btInsert")), pSS, AP_STRING_ID_DLG_InsertButton); g_object_unref(G_OBJECT(builder)); return window; }
GtkWidget * XAP_UnixDialog_WindowMore::_constructWindow(void) { const XAP_StringSet * pSS = m_pApp->getStringSet(); GtkCellRenderer *renderer; GtkTreeViewColumn *column; // load the dialog from the UI file #if GTK_CHECK_VERSION(3,0,0) GtkBuilder* builder = newDialogBuilder("xap_UnixDlg_WindowMore.ui"); #else GtkBuilder* builder = newDialogBuilder("xap_UnixDlg_WindowMore-2.ui"); #endif // Update our member variables with the important widgets that // might need to be queried or altered later m_windowMain = GTK_WIDGET(gtk_builder_get_object(builder, "xap_UnixDlg_WindowMore")); m_listWindows = GTK_WIDGET(gtk_builder_get_object(builder, "tvAvailableDocuments")); UT_UTF8String s; pSS->getValueUTF8(XAP_STRING_ID_DLG_MW_MoreWindows,s); gtk_window_set_title (GTK_WINDOW(m_windowMain), s.utf8_str()); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbAvailableDocuments")), pSS, XAP_STRING_ID_DLG_MW_AvailableDocuments); localizeButtonUnderline(GTK_WIDGET(gtk_builder_get_object(builder, "btView")), pSS, XAP_STRING_ID_DLG_MW_ViewButton); // add a column to our TreeViews renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Format", renderer, "text", 0, NULL); gtk_tree_view_append_column( GTK_TREE_VIEW(m_listWindows), column); // connect a dbl-clicked signal to the column g_signal_connect_after(G_OBJECT(m_listWindows), "row-activated", G_CALLBACK(s_list_dblclicked), static_cast<gpointer>(this)); g_object_unref(G_OBJECT(builder)); return m_windowMain; }
GtkWidget * XAP_UnixDialog_Encoding::_constructWindow(void) { const XAP_StringSet * pSS = m_pApp->getStringSet(); GtkCellRenderer *renderer; GtkTreeViewColumn *column; // get the path where our UI file is located std::string ui_path = static_cast<XAP_UnixApp*>(XAP_App::getApp())->getAbiSuiteAppUIDir() + "/xap_UnixDlg_Encoding.xml"; // load the dialog from the UI file GtkBuilder* builder = gtk_builder_new(); gtk_builder_add_from_file(builder, ui_path.c_str(), NULL); // Update our member variables with the important widgets that // might need to be queried or altered later m_windowMain = GTK_WIDGET(gtk_builder_get_object(builder, "xap_UnixDlg_Encoding")); m_listEncodings = GTK_WIDGET(gtk_builder_get_object(builder, "encodingList")); UT_UTF8String s; pSS->getValueUTF8(XAP_STRING_ID_DLG_UENC_EncTitle,s); gtk_window_set_title (GTK_WINDOW(m_windowMain), s.utf8_str()); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lblEncoding")), pSS, XAP_STRING_ID_DLG_UENC_EncLabel); // add a column to our TreeViews renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Format", renderer, "text", 0, NULL); gtk_tree_view_append_column( GTK_TREE_VIEW(m_listEncodings), column); // connect a dbl-clicked signal to the column g_signal_connect_after(G_OBJECT(m_listEncodings), "row-activated", G_CALLBACK(s_encoding_dblclicked), static_cast<gpointer>(this)); g_object_unref(G_OBJECT(builder)); return m_windowMain; }
void XAP_UnixDialog_History::_populateWindowData(GtkBuilder* builder) { const XAP_StringSet * pSS = m_pApp->getStringSet(); localizeLabelMarkup (GTK_WIDGET(gtk_builder_get_object(builder, "lbDocumentDetails")), pSS, XAP_STRING_ID_DLG_History_DocumentDetails); gtk_label_set_text (GTK_LABEL(gtk_builder_get_object(builder, "lbDocumentName")), getHeaderLabel(0)); gtk_label_set_text (GTK_LABEL(gtk_builder_get_object(builder, "lbDocNameVal")), getHeaderValue(0)); gtk_label_set_text (GTK_LABEL(gtk_builder_get_object(builder, "lbVersion")), getHeaderLabel(1)); gtk_label_set_text (GTK_LABEL(gtk_builder_get_object(builder, "lbVersionVal")), getHeaderValue(1)); gtk_label_set_text (GTK_LABEL(gtk_builder_get_object(builder, "lbCreated")), getHeaderLabel(2)); gtk_label_set_text (GTK_LABEL(gtk_builder_get_object(builder, "lbCreatedVal")), getHeaderValue(2)); gtk_label_set_text (GTK_LABEL(gtk_builder_get_object(builder, "lbSaved")), getHeaderLabel(3)); gtk_label_set_text (GTK_LABEL(gtk_builder_get_object(builder, "lbSavedVal")), getHeaderValue(3)); gtk_label_set_text (GTK_LABEL(gtk_builder_get_object(builder, "lbEditTime")), getHeaderLabel(4)); gtk_label_set_text (GTK_LABEL(gtk_builder_get_object(builder, "lbEditTimeVal")), getHeaderValue(4)); gtk_label_set_text (GTK_LABEL(gtk_builder_get_object(builder, "lbIdentifier")), getHeaderLabel(5)); gtk_label_set_text (GTK_LABEL(gtk_builder_get_object(builder, "lbIdentifierVal")), getHeaderValue(5)); setLabelMarkup (GTK_WIDGET(gtk_builder_get_object(builder, "lbVersionHistory")), getListTitle()); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "okbutton1")), pSS, XAP_STRING_ID_DLG_History_Restore); }
GtkWidget * XAP_UnixDialog_Language::constructWindow(void) { const XAP_StringSet * pSS = m_pApp->getStringSet(); GtkCellRenderer *renderer; GtkTreeViewColumn *column; #if GTK_CHECK_VERSION(3,0,0) GtkBuilder * builder = newDialogBuilder("xap_UnixDlg_Language.ui"); #else GtkBuilder * builder = newDialogBuilder("xap_UnixDlg_Language-2.ui"); #endif // Update our member variables with the important widgets that // might need to be queried or altered later m_windowMain = GTK_WIDGET(gtk_builder_get_object(builder, "xap_UnixDlg_Language")); m_pLanguageList = GTK_WIDGET(gtk_builder_get_object(builder, "tvAvailableLanguages")); m_lbDefaultLanguage = GTK_WIDGET(gtk_builder_get_object(builder, "lbDefaultLanguage")); m_cbDefaultLanguage = GTK_WIDGET(gtk_builder_get_object(builder, "cbDefaultLanguage")); UT_UTF8String s; pSS->getValueUTF8(XAP_STRING_ID_DLG_ULANG_LangTitle,s); gtk_window_set_title (GTK_WINDOW(m_windowMain), s.utf8_str()); localizeLabelMarkup (GTK_WIDGET(gtk_builder_get_object(builder, "lbAvailableLanguages")), pSS, XAP_STRING_ID_DLG_ULANG_AvailableLanguages); getDocDefaultLangDescription(s); gtk_label_set_text (GTK_LABEL(m_lbDefaultLanguage), s.utf8_str()); getDocDefaultLangCheckboxLabel(s); gtk_button_set_label (GTK_BUTTON(m_cbDefaultLanguage), s.utf8_str()); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(m_cbDefaultLanguage), isMakeDocumentDefault()); // add a column to our TreeViews renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Format", renderer, "text", 0, NULL); gtk_tree_view_append_column( GTK_TREE_VIEW(m_pLanguageList), column); g_object_unref(G_OBJECT(builder)); return m_windowMain; }
GtkWidget *AP_UnixDialog_Lists::_constructWindowContents (void) { GtkWidget *vbox2; GtkWidget *hbox2; GtkWidget *vbox4; GtkWidget *table1; GtkWidget *style_om; GtkWidget *type_om; GtkWidget *type_lb; GtkWidget *style_lb; GtkWidget *customized_cb; GtkWidget *frame1; GtkWidget *table2; GtkComboBox *font_om; GtkListStore *font_om_menu; GtkWidget *format_en; GtkWidget *decimal_en; GtkAdjustment *start_sb_adj; GtkWidget *start_sb; GtkAdjustment *text_align_sb_adj; GtkWidget *text_align_sb; GtkAdjustment *label_align_sb_adj; GtkWidget *label_align_sb; GtkWidget *format_lb; GtkWidget *font_lb; GtkWidget *delimiter_lb; GtkWidget *start_at_lb; GtkWidget *text_align_lb; GtkWidget *label_align_lb; GtkWidget *vbox3; GtkWidget *preview_lb; GtkWidget *hbox1; GSList *action_group = NULL; GtkWidget *start_list_rb; GtkWidget *apply_list_rb; GtkWidget *resume_list_rb; GtkWidget *preview_area; GtkWidget *preview_frame; const XAP_StringSet * pSS = m_pApp->getStringSet(); UT_UTF8String s; GtkWidget * wNoteBook = NULL; vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show (vbox2); if(!isModal()) { // Note Book creation wNoteBook = gtk_notebook_new (); gtk_widget_show(wNoteBook); // Container for the lists pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_PageProperties,s); GtkWidget * lbPageLists = gtk_label_new(s.utf8_str()); gtk_widget_show(lbPageLists); gtk_notebook_append_page(GTK_NOTEBOOK(wNoteBook),vbox2,lbPageLists); m_iPageLists = gtk_notebook_page_num(GTK_NOTEBOOK(wNoteBook),vbox2); // Container for Text Folding pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_PageFolding,s); GtkWidget * lbPageFolding = gtk_label_new(s.utf8_str()); GtkWidget * wFoldingTable = gtk_table_new(6,3,FALSE); gtk_widget_show(lbPageFolding); gtk_widget_show(wFoldingTable); gtk_notebook_append_page(GTK_NOTEBOOK(wNoteBook),wFoldingTable,lbPageFolding); m_iPageFold = gtk_notebook_page_num(GTK_NOTEBOOK(wNoteBook),wFoldingTable); // Left Spacing Here GtkWidget * lbLeftSpacer = gtk_label_new(""); gtk_misc_set_padding(GTK_MISC(lbLeftSpacer),8,0); gtk_table_attach(GTK_TABLE(wFoldingTable),lbLeftSpacer,0,1,0,6,GTK_SHRINK,GTK_FILL,0,0); gtk_widget_show(lbLeftSpacer); // Bold markup GtkWidget * lbFoldHeading = gtk_label_new("<b>%s</b>"); gtk_label_set_use_markup(GTK_LABEL(lbFoldHeading),TRUE); localizeLabelMarkup(lbFoldHeading,pSS,AP_STRING_ID_DLG_Lists_FoldingLevelexp); gtk_table_attach(GTK_TABLE(wFoldingTable),lbFoldHeading,1,3,0,1,GTK_FILL,GTK_EXPAND,0,0); gtk_widget_show(lbFoldHeading); // Mid Left Spacing Here GtkWidget * lbMidLeftSpacer = gtk_label_new(""); gtk_misc_set_padding(GTK_MISC(lbMidLeftSpacer),8,0); gtk_table_attach(GTK_TABLE(wFoldingTable),lbMidLeftSpacer,1,2,1,6,GTK_SHRINK,GTK_FILL,0,0); gtk_widget_show(lbMidLeftSpacer); m_vecFoldCheck.clear(); m_vecFoldID.clear(); UT_uint32 ID =0; // RadioButtons pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_FoldingLevel0,s); GtkWidget * wF = gtk_radio_button_new_with_label(NULL, s.utf8_str()); GSList *wG = gtk_radio_button_get_group(GTK_RADIO_BUTTON(wF)); g_object_set_data(G_OBJECT(wF),"level",(gpointer)"0"); ID = g_signal_connect(G_OBJECT(wF), "toggled", G_CALLBACK(s_FoldCheck_changed), (gpointer) this); gtk_table_attach(GTK_TABLE(wFoldingTable),wF,2,3,1,2,GTK_FILL,GTK_EXPAND,0,0); gtk_widget_show(wF); m_vecFoldCheck.addItem(wF); m_vecFoldID.addItem(ID); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_FoldingLevel1,s); wF = gtk_radio_button_new_with_label(wG, s.utf8_str()); wG = gtk_radio_button_get_group(GTK_RADIO_BUTTON(wF)); g_object_set_data(G_OBJECT(wF),"level",(gpointer)"1"); ID = g_signal_connect(G_OBJECT(wF), "toggled", G_CALLBACK(s_FoldCheck_changed), (gpointer) this); gtk_table_attach(GTK_TABLE(wFoldingTable),wF,2,3,2,3,GTK_FILL,GTK_EXPAND,0,0); gtk_widget_show(wF); m_vecFoldCheck.addItem(wF); m_vecFoldID.addItem(ID); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_FoldingLevel2,s); wF = gtk_radio_button_new_with_label(wG, s.utf8_str()); wG = gtk_radio_button_get_group(GTK_RADIO_BUTTON(wF)); g_object_set_data(G_OBJECT(wF),"level",(gpointer)"2"); ID = g_signal_connect(G_OBJECT(wF), "toggled", G_CALLBACK(s_FoldCheck_changed), (gpointer) this); gtk_table_attach(GTK_TABLE(wFoldingTable),wF,2,3,3,4,GTK_FILL,GTK_EXPAND,0,0); gtk_widget_show(wF); m_vecFoldCheck.addItem(wF); m_vecFoldID.addItem(ID); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_FoldingLevel3,s); wF = gtk_radio_button_new_with_label(wG, s.utf8_str()); wG = gtk_radio_button_get_group(GTK_RADIO_BUTTON(wF)); g_object_set_data(G_OBJECT(wF),"level",(gpointer)"3"); ID = g_signal_connect(G_OBJECT(wF), "toggled", G_CALLBACK(s_FoldCheck_changed), (gpointer) this); gtk_table_attach(GTK_TABLE(wFoldingTable),wF,2,3,4,5,GTK_FILL,GTK_EXPAND,0,0); gtk_widget_show(wF); m_vecFoldCheck.addItem(wF); m_vecFoldID.addItem(ID); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_FoldingLevel4,s); wF = gtk_radio_button_new_with_label(wG, s.utf8_str()); g_object_set_data(G_OBJECT(wF),"level",(gpointer)"4"); ID = g_signal_connect(G_OBJECT(wF), "toggled", G_CALLBACK(s_FoldCheck_changed), (gpointer) this); gtk_table_attach(GTK_TABLE(wFoldingTable),wF,2,3,5,6,GTK_FILL,GTK_EXPAND,0,0); gtk_widget_show(wF); m_vecFoldCheck.addItem(wF); m_vecFoldID.addItem(ID); gtk_widget_show(wFoldingTable); gtk_notebook_set_current_page(GTK_NOTEBOOK(wNoteBook),m_iPageLists); } // List Page gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0); vbox4 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); gtk_widget_show (vbox4); gtk_box_pack_start (GTK_BOX (hbox2), vbox4, FALSE, TRUE, 0); table1 = gtk_table_new (3, 2, FALSE); gtk_widget_show (table1); gtk_box_pack_start (GTK_BOX (vbox4), table1, FALSE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table1), 4); style_om = gtk_combo_box_text_new(); gtk_widget_show (style_om); gtk_table_attach (GTK_TABLE (table1), style_om, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); m_wListStyleNone_menu = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); _fillNoneStyleMenu(m_wListStyleNone_menu.obj()); m_wListStyleNumbered_menu = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT); _fillNumberedStyleMenu(m_wListStyleNumbered_menu.obj()); m_wListStyleBulleted_menu = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); _fillBulletedStyleMenu(m_wListStyleBulleted_menu.obj()); // This is the default list. Change if the list style changes // m_wListStyle_menu = m_wListStyleNumbered_menu; gtk_combo_box_set_model(GTK_COMBO_BOX (style_om), GTK_TREE_MODEL(m_wListStyleNumbered_menu.obj())); type_om = gtk_combo_box_text_new(); gtk_widget_show (type_om); gtk_table_attach (GTK_TABLE (table1), type_om, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Type_none,s); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_om), s.utf8_str()); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Type_bullet,s); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_om), s.utf8_str()); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Type_numbered,s); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_om), s.utf8_str()); gtk_combo_box_set_active(GTK_COMBO_BOX(type_om), 0); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Type,s); type_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (type_lb); gtk_table_attach (GTK_TABLE (table1), type_lb, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (type_lb), 0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Style,s); style_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (style_lb); gtk_table_attach (GTK_TABLE (table1), style_lb, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (style_lb), 0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_SetDefault,s); customized_cb = gtk_dialog_add_button (GTK_DIALOG(m_wMainWindow), s.utf8_str(), BUTTON_RESET); gtk_widget_show (customized_cb); /* todo gtk_table_attach (GTK_TABLE (table1), customized_cb, 0, 2, 2, 3, (GtkAttachOptions) (GTK_SHRINK), (GtkAttachOptions) (0), 0, 0); */ frame1 = gtk_frame_new (NULL); gtk_frame_set_shadow_type(GTK_FRAME(frame1), GTK_SHADOW_NONE); //gtk_widget_show (frame1); gtk_box_pack_start (GTK_BOX (vbox4), frame1, TRUE, TRUE, 0); table2 = gtk_table_new (6, 2, FALSE); gtk_widget_show (table2); gtk_container_add (GTK_CONTAINER (frame1), table2); gtk_container_set_border_width (GTK_CONTAINER (table2), 4); gtk_widget_set_sensitive (table2, TRUE); gtk_table_set_row_spacings (GTK_TABLE (table2), 4); gtk_table_set_col_spacings (GTK_TABLE (table2), 4); font_om_menu = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT); _fillFontMenu(font_om_menu); font_om = GTK_COMBO_BOX(gtk_combo_box_new()); gtk_combo_box_set_model(font_om, GTK_TREE_MODEL(font_om_menu)); gtk_widget_show (GTK_WIDGET(font_om)); gtk_table_attach (GTK_TABLE (table2), GTK_WIDGET(font_om), 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); format_en = gtk_entry_new (); gtk_entry_set_max_length(GTK_ENTRY(format_en), 20); gtk_widget_show (format_en); gtk_table_attach (GTK_TABLE (table2), format_en, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_entry_set_text (GTK_ENTRY (format_en), "%L"); decimal_en = gtk_entry_new (); gtk_widget_show (decimal_en); gtk_table_attach (GTK_TABLE (table2), decimal_en, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_entry_set_text (GTK_ENTRY (format_en), ""); start_sb_adj = (GtkAdjustment*)gtk_adjustment_new (1, 0, G_MAXINT32, 1, 10, 10); start_sb = gtk_spin_button_new (GTK_ADJUSTMENT (start_sb_adj), 1, 0); gtk_widget_show (start_sb); gtk_table_attach (GTK_TABLE (table2), start_sb, 1, 2, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); text_align_sb_adj = (GtkAdjustment*)gtk_adjustment_new (0.25, 0, 10, 0.01, 0.2, 1); text_align_sb = gtk_spin_button_new (GTK_ADJUSTMENT (text_align_sb_adj), 0.05, 2); gtk_widget_show (text_align_sb); gtk_table_attach (GTK_TABLE (table2), text_align_sb, 1, 2, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (text_align_sb), TRUE); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (text_align_sb), TRUE); label_align_sb_adj = (GtkAdjustment*)gtk_adjustment_new (0, 0, 10, 0.01, 0.2, 1); label_align_sb = gtk_spin_button_new (GTK_ADJUSTMENT (label_align_sb_adj), 0.05, 2); gtk_widget_show (label_align_sb); gtk_table_attach (GTK_TABLE (table2), label_align_sb, 1, 2, 5, 6, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (label_align_sb), TRUE); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (label_align_sb), TRUE); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Format,s); format_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (format_lb); gtk_table_attach (GTK_TABLE (table2), format_lb, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (format_lb), 0.0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Font,s); font_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (font_lb); gtk_table_attach (GTK_TABLE (table2), font_lb, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (font_lb), 0.0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_DelimiterString,s); delimiter_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (delimiter_lb); gtk_table_attach (GTK_TABLE (table2), delimiter_lb, 0, 1, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (delimiter_lb), 0.0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Start,s); start_at_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (start_at_lb); gtk_table_attach (GTK_TABLE (table2), start_at_lb, 0, 1, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (start_at_lb), 0.0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Align,s); text_align_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (text_align_lb); gtk_table_attach (GTK_TABLE (table2), text_align_lb, 0, 1, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (text_align_lb), 0.0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Indent,s); label_align_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (label_align_lb); gtk_table_attach (GTK_TABLE (table2), label_align_lb, 0, 1, 5, 6, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label_align_lb), 0.0, 0.5); vbox3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show (vbox3); gtk_box_pack_start (GTK_BOX (hbox2), vbox3, TRUE, TRUE, 0); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Preview,s); preview_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (preview_lb); gtk_box_pack_start (GTK_BOX (vbox3), preview_lb, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (preview_lb), 0.0, 0.5); preview_frame = gtk_frame_new (NULL); gtk_widget_show (preview_frame); gtk_box_pack_start (GTK_BOX (vbox3), preview_frame, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (preview_frame), 3); gtk_frame_set_shadow_type (GTK_FRAME (preview_frame), GTK_SHADOW_NONE); preview_area = createDrawingArea (); gtk_widget_set_size_request (preview_area,180,225); gtk_widget_show (preview_area); gtk_container_add (GTK_CONTAINER (preview_frame), preview_area); hbox1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); if(!isModal()) gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Start_New,s); start_list_rb = gtk_radio_button_new_with_label (action_group, s.utf8_str()); action_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (start_list_rb)); if(!isModal()) gtk_widget_show (start_list_rb); gtk_box_pack_start (GTK_BOX (hbox1), start_list_rb, FALSE, FALSE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (start_list_rb), TRUE); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Apply_Current,s); apply_list_rb = gtk_radio_button_new_with_label (action_group, s.utf8_str()); action_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (apply_list_rb)); if(!isModal()) gtk_widget_show (apply_list_rb); gtk_box_pack_start (GTK_BOX (hbox1), apply_list_rb, FALSE, FALSE, 0); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Resume,s); resume_list_rb = gtk_radio_button_new_with_label (action_group, s.utf8_str()); action_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (resume_list_rb)); if(!isModal()) gtk_widget_show (resume_list_rb); gtk_box_pack_start (GTK_BOX (hbox1), resume_list_rb, FALSE, FALSE, 0); // Save useful widgets in member variables if(isModal()) { m_wContents = vbox2; } else { m_wContents = wNoteBook; } m_wStartNewList = start_list_rb; m_wStartNew_label = gtk_bin_get_child(GTK_BIN(start_list_rb)); m_wApplyCurrent = apply_list_rb; m_wStartSubList = resume_list_rb; m_wStartSub_label = gtk_bin_get_child(GTK_BIN(resume_list_rb)); m_wRadioGroup = action_group; m_wPreviewArea = preview_area; m_wDelimEntry = format_en; m_oAlignList_adj = text_align_sb_adj; m_wAlignListSpin = text_align_sb; m_oIndentAlign_adj = label_align_sb_adj; m_wIndentAlignSpin = label_align_sb; m_wDecimalEntry = decimal_en; m_oStartSpin_adj = start_sb_adj; m_wStartSpin = start_sb; m_wFontOptions = font_om; m_wFontOptions_menu = font_om_menu; m_wCustomFrame = frame1; m_wCustomLabel = customized_cb; m_wCustomTable = table2; m_wListStyleBox = GTK_COMBO_BOX(style_om); m_wListTypeBox = GTK_COMBO_BOX(type_om); m_wListType_menu = m_wListStyleNumbered_menu; // Start by hiding the Custom frame // // gtk_widget_hide(m_wCustomFrame); gtk_widget_show(m_wCustomFrame); setbisCustomized(false); return m_wContents; }
/*! * construct the dialog window. */ GtkWidget * AP_UnixDialog_HdrFtr::_constructWindow (void) { GtkWidget * window; const XAP_StringSet * pSS = m_pApp->getStringSet(); const char * uiFileName; #if defined(EMBEDDED_TARGET) && EMBEDDED_TARGET == EMBEDDED_TARGET_HILDON uiFileName = "ap_UnixHildonDialog_HdrFtr.ui"; #else #if GTK_CHECK_VERSION(3,0,0) uiFileName = "ap_UnixDialog_HdrFtr.ui"; #else uiFileName = "ap_UnixDialog_HdrFtr-2.ui"; #endif #endif GtkBuilder * builder = newDialogBuilder(uiFileName); // Update our member variables with the important widgets that // might need to be queried or altered later window = GTK_WIDGET(gtk_builder_get_object(builder, "ap_UnixDialog_HdrFtr")); m_wHdrFtrCheck[HdrEven] = GTK_WIDGET(gtk_builder_get_object(builder, "cbHeaderFacingPages")); m_wHdrFtrCheck[HdrFirst] = GTK_WIDGET(gtk_builder_get_object(builder, "cbHeaderFirstPage")); m_wHdrFtrCheck[HdrLast] = GTK_WIDGET(gtk_builder_get_object(builder, "cbHeaderLastPage")); m_wHdrFtrCheck[FtrEven] = GTK_WIDGET(gtk_builder_get_object(builder, "cbFooterFacingPages")); m_wHdrFtrCheck[FtrFirst] = GTK_WIDGET(gtk_builder_get_object(builder, "cbFooterFirstPage")); m_wHdrFtrCheck[FtrLast] = GTK_WIDGET(gtk_builder_get_object(builder, "cbFooterLastPage")); m_wRestartLabel = GTK_WIDGET(gtk_builder_get_object(builder, "lbRestartNumbering")); m_wRestartButton = GTK_WIDGET(gtk_builder_get_object(builder, "lbRestartPageNumbers")); m_wSpin = GTK_WIDGET(gtk_builder_get_object(builder, "sbRestartNumberingAt")); m_spinAdj = gtk_spin_button_get_adjustment( GTK_SPIN_BUTTON(m_wSpin) ); // set the dialog title std::string s; pSS->getValueUTF8(AP_STRING_ID_DLG_HdrFtr_Title,s); abiDialogSetTitle(window, "%s", s.c_str()); // localize the strings in our dialog localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbHeaderProperties")), pSS, AP_STRING_ID_DLG_HdrFtr_HeaderFrame); localizeButton(m_wHdrFtrCheck[HdrEven], pSS, AP_STRING_ID_DLG_HdrFtr_HeaderEven); localizeButton(m_wHdrFtrCheck[HdrFirst], pSS, AP_STRING_ID_DLG_HdrFtr_HeaderFirst); localizeButton(m_wHdrFtrCheck[HdrLast], pSS, AP_STRING_ID_DLG_HdrFtr_HeaderLast); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbFooterProperties")), pSS, AP_STRING_ID_DLG_HdrFtr_FooterFrame); localizeButton(m_wHdrFtrCheck[FtrEven], pSS, AP_STRING_ID_DLG_HdrFtr_FooterEven); localizeButton(m_wHdrFtrCheck[FtrFirst], pSS, AP_STRING_ID_DLG_HdrFtr_FooterFirst); localizeButton(m_wHdrFtrCheck[FtrLast], pSS, AP_STRING_ID_DLG_HdrFtr_FooterLast); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbPageNumberProperties")), pSS, AP_STRING_ID_DLG_HdrFtr_PageNumberProperties); localizeButton(m_wRestartButton, pSS, AP_STRING_ID_DLG_HdrFtr_RestartCheck); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbRestartNumbering")), pSS, AP_STRING_ID_DLG_HdrFtr_RestartNumbers); // Now set initial state of the dialog gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_wSpin),static_cast<gfloat>(getRestartValue())); if(isRestart()) { gtk_widget_set_sensitive(m_wSpin,TRUE); gtk_widget_set_sensitive(m_wRestartLabel,TRUE); gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(m_wRestartButton),TRUE); } else { gtk_widget_set_sensitive(m_wSpin,FALSE); gtk_widget_set_sensitive(m_wRestartLabel,FALSE); } UT_sint32 j = static_cast<UT_sint32>(HdrEven); for(j = static_cast<UT_sint32>(HdrEven) ; j<= static_cast<UT_sint32>(FtrLast); j++) { bool value = getValue( static_cast<HdrFtr_Control>(j)); if(value) { gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(m_wHdrFtrCheck[j]),TRUE); } else { gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(m_wHdrFtrCheck[j]),FALSE); } } _connectSignals(); g_object_unref(G_OBJECT(builder)); return window; }
GtkWidget * AP_UnixDialog_Field::_constructWindow(void) { GtkWidget * window; const XAP_StringSet * pSS = m_pApp->getStringSet(); GtkCellRenderer *renderer; GtkTreeViewColumn *column; #if GTK_CHECK_VERSION(3,0,0) GtkBuilder * builder = newDialogBuilder("ap_UnixDialog_Field.ui"); #else GtkBuilder * builder = newDialogBuilder("ap_UnixDialog_Field-2.ui"); #endif // Update our member variables with the important widgets that // might need to be queried or altered later window = GTK_WIDGET(gtk_builder_get_object(builder, "ap_UnixDialog_Field")); m_listTypes = GTK_WIDGET(gtk_builder_get_object(builder, "tvTypes")); m_listFields = GTK_WIDGET(gtk_builder_get_object(builder, "tvFields")); m_entryParam = GTK_WIDGET(gtk_builder_get_object(builder, "edExtraParameters")); // set the single selection mode for the TreeViews gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (m_listTypes)), GTK_SELECTION_SINGLE); gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (m_listFields)), GTK_SELECTION_SINGLE); // set the dialog title UT_UTF8String s; pSS->getValueUTF8(AP_STRING_ID_DLG_Field_FieldTitle_Capital,s); abiDialogSetTitle(window, "%s", s.utf8_str()); // localize the strings in our dialog, and set some userdata for some widg localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbTypes")), pSS, AP_STRING_ID_DLG_Field_Types_No_Colon); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbFields")), pSS, AP_STRING_ID_DLG_Field_Fields_No_Colon); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbExtraParameters")), pSS, AP_STRING_ID_DLG_Field_Parameters_Capital); localizeButtonUnderline(GTK_WIDGET(gtk_builder_get_object(builder, "btInsert")), pSS, AP_STRING_ID_DLG_InsertButton); // add a column to our TreeViews renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Format", renderer, "text", 0, NULL); gtk_tree_view_append_column( GTK_TREE_VIEW(m_listTypes), column); renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Format", renderer, "text", 0, NULL); gtk_tree_view_append_column( GTK_TREE_VIEW(m_listFields), column); // connect a clicked signal to the column g_signal_connect_after(G_OBJECT(m_listTypes), "cursor-changed", G_CALLBACK(s_types_clicked), static_cast<gpointer>(this)); g_signal_connect_after(G_OBJECT(m_listFields), "row-activated", G_CALLBACK(s_field_dblclicked), static_cast<gpointer>(this)); g_object_unref(G_OBJECT(builder)); return window; }
GtkWidget * XAP_UnixDialog_Image::_constructWindow () { const XAP_StringSet * pSS = m_pApp->getStringSet(); const char * ui_file; #if defined(EMBEDDED_TARGET) && EMBEDDED_TARGET == EMBEDDED_TARGET_HILDON ui_file = "xap_UnixHildonDlg_Image.ui"; #else #if GTK_CHECK_VERSION(3,0,0) ui_file = "xap_UnixDlg_Image.ui"; #else ui_file = "xap_UnixDlg_Image-2.ui"; #endif #endif GtkBuilder * builder = newDialogBuilder(ui_file); mMainWindow = GTK_WIDGET(gtk_builder_get_object(builder, "xap_UnixDlg_Image")); m_wHeightSpin = GTK_WIDGET(gtk_builder_get_object(builder, "sbHeight")); m_wHeightEntry = GTK_WIDGET(gtk_builder_get_object(builder, "edHeight")); m_wWidthSpin = GTK_WIDGET(gtk_builder_get_object(builder, "sbWidth")); m_wWidthEntry = GTK_WIDGET(gtk_builder_get_object(builder, "edWidth")); m_wAspectCheck = GTK_WIDGET(gtk_builder_get_object(builder, "cbAspect")); m_wTitleEntry = GTK_WIDGET(gtk_builder_get_object(builder, "edTitle")); m_wDescriptionEntry = GTK_WIDGET(gtk_builder_get_object(builder, "edDescription")); m_bAspect = getPreserveAspect(); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_wAspectCheck), m_bAspect); m_oHeightSpin_adj = (GtkAdjustment*)gtk_adjustment_new( 1,-2000, 2000, 1, 1, 10); gtk_widget_set_size_request(m_wHeightSpin,14,-1); gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON(m_wHeightSpin), GTK_ADJUSTMENT(m_oHeightSpin_adj)); m_oWidthSpin_adj = (GtkAdjustment*)gtk_adjustment_new( 1,-2000, 2000, 1, 1, 10); gtk_widget_set_size_request(m_wWidthSpin,14,-1); gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON(m_wWidthSpin), GTK_ADJUSTMENT(m_oWidthSpin_adj)); std::string s; pSS->getValueUTF8(XAP_STRING_ID_DLG_Image_Title,s); abiDialogSetTitle(mMainWindow, "%s", s.c_str()); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbDescTab")), pSS, XAP_STRING_ID_DLG_Image_DescTabLabel); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbWrapTab")), pSS, XAP_STRING_ID_DLG_Image_WrapTabLabel); #if defined(EMBEDDED_TARGET) && EMBEDDED_TARGET == EMBEDDED_TARGET_HILDON localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbPlacementTab")), pSS, XAP_STRING_ID_DLG_Image_PlacementTabLabel); #endif localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbSize")), pSS, XAP_STRING_ID_DLG_Image_ImageSize); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbImageDescription")), pSS, XAP_STRING_ID_DLG_Image_ImageDesc); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbTextWrapping")), pSS, XAP_STRING_ID_DLG_Image_TextWrapping); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbImagePlacement")), pSS, XAP_STRING_ID_DLG_Image_Placement); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbWrapType")), pSS, XAP_STRING_ID_DLG_Image_WrapType); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbHeight")), pSS, XAP_STRING_ID_DLG_Image_Height); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbWidth")), pSS, XAP_STRING_ID_DLG_Image_Width); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbTitle")), pSS, XAP_STRING_ID_DLG_Image_LblTitle); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbDescription")), pSS, XAP_STRING_ID_DLG_Image_LblDescription); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbInLine")), pSS, XAP_STRING_ID_DLG_Image_InLine); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbNone")), pSS, XAP_STRING_ID_DLG_Image_WrappedNone); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbWrappedRight")), pSS, XAP_STRING_ID_DLG_Image_WrappedRight); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbWrappedLeft")), pSS, XAP_STRING_ID_DLG_Image_WrappedLeft); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbWrappedBoth")), pSS, XAP_STRING_ID_DLG_Image_WrappedBoth); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbPlaceParagraph")), pSS, XAP_STRING_ID_DLG_Image_PlaceParagraph); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbPlaceColumn")), pSS, XAP_STRING_ID_DLG_Image_PlaceColumn); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbPlacePage")), pSS, XAP_STRING_ID_DLG_Image_PlacePage); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbSquareWrap")), pSS, XAP_STRING_ID_DLG_Image_SquareWrap); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbTightWrap")), pSS, XAP_STRING_ID_DLG_Image_TightWrap); m_wPlaceTable = GTK_WIDGET(gtk_builder_get_object(builder, "tbPlacement")); m_wrbInLine = GTK_WIDGET(gtk_builder_get_object(builder, "rbInLine")); m_wrbNone = GTK_WIDGET(gtk_builder_get_object(builder, "rbNone")); m_wrbWrappedRight = GTK_WIDGET(gtk_builder_get_object(builder, "rbWrappedRight")); m_wrbWrappedLeft = GTK_WIDGET(gtk_builder_get_object(builder, "rbWrappedLeft")); m_wrbWrappedBoth = GTK_WIDGET(gtk_builder_get_object(builder, "rbWrappedBoth")); m_wrbPlaceParagraph = GTK_WIDGET(gtk_builder_get_object(builder, "rbPlaceParagraph")); m_wrbPlaceColumn = GTK_WIDGET(gtk_builder_get_object(builder, "rbPlaceColumn")); m_wrbPlacePage = GTK_WIDGET(gtk_builder_get_object(builder, "rbPlacePage")); m_wWrapTable = GTK_WIDGET(gtk_builder_get_object(builder, "tbWrapTable")); m_wrbSquareWrap = GTK_WIDGET(gtk_builder_get_object(builder, "rbSquareWrap")); m_wrbTightWrap = GTK_WIDGET(gtk_builder_get_object(builder, "rbTightWrap")); pSS->getValueUTF8 (XAP_STRING_ID_DLG_Image_Aspect,s); gtk_button_set_label(GTK_BUTTON(m_wAspectCheck), s.c_str()); m_iWidth = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(m_wWidthSpin)); m_iHeight = gtk_spin_button_get_value_as_int( GTK_SPIN_BUTTON(m_wHeightSpin)); gtk_entry_set_text (GTK_ENTRY(m_wTitleEntry), getTitle().utf8_str()); gtk_entry_set_text (GTK_ENTRY(m_wDescriptionEntry), getDescription().utf8_str()); _connectSignals (); g_object_unref(G_OBJECT(builder)); return mMainWindow; }
GtkWidget * AP_UnixDialog_Styles::_constructWindow(void) { const XAP_StringSet * pSS = m_pApp->getStringSet(); // load the dialog from the UI file #if GTK_CHECK_VERSION(3,0,0) GtkBuilder* builder = newDialogBuilder("ap_UnixDialog_Styles.ui"); #else GtkBuilder* builder = newDialogBuilder("ap_UnixDialog_Styles-2.ui"); #endif GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder, "ap_UnixDialog_Styles")); UT_UTF8String s; pSS->getValueUTF8(AP_STRING_ID_DLG_Styles_StylesTitle, s); gtk_window_set_title (GTK_WINDOW (window), s.utf8_str()); // list of styles goes in the top left localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbStyles")), pSS, AP_STRING_ID_DLG_Styles_Available); // treeview m_tvStyles = GTK_WIDGET(gtk_builder_get_object(builder, "tvStyles")); gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (m_tvStyles)), GTK_SELECTION_SINGLE); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbList")), pSS, AP_STRING_ID_DLG_Styles_List); m_rbList1 = GTK_WIDGET(gtk_builder_get_object(builder, "rbList1")); localizeButton(m_rbList1, pSS, AP_STRING_ID_DLG_Styles_LBL_InUse); m_rbList2 = GTK_WIDGET(gtk_builder_get_object(builder, "rbList2")); localizeButton(m_rbList2, pSS, AP_STRING_ID_DLG_Styles_LBL_All); m_rbList3 = GTK_WIDGET(gtk_builder_get_object(builder, "rbList3")); localizeButton(m_rbList3, pSS, AP_STRING_ID_DLG_Styles_LBL_UserDefined); // previewing and description goes in the top right localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbParagraph")), pSS, AP_STRING_ID_DLG_Styles_ParaPrev); GtkWidget *frameParaPrev = GTK_WIDGET(gtk_builder_get_object(builder, "frameParagraph")); m_wParaPreviewArea = createDrawingArea(); gtk_widget_set_size_request(m_wParaPreviewArea, 300, 70); gtk_container_add(GTK_CONTAINER(frameParaPrev), m_wParaPreviewArea); gtk_widget_show(m_wParaPreviewArea); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbCharacter")), pSS, AP_STRING_ID_DLG_Styles_CharPrev); GtkWidget *frameCharPrev = GTK_WIDGET(gtk_builder_get_object(builder, "frameCharacter")); m_wCharPreviewArea = createDrawingArea(); gtk_widget_set_size_request(m_wCharPreviewArea, 300, 50); gtk_container_add(GTK_CONTAINER(frameCharPrev), m_wCharPreviewArea); gtk_widget_show(m_wCharPreviewArea); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbDescription")), pSS, AP_STRING_ID_DLG_Styles_Description); m_lbAttributes = GTK_WIDGET(gtk_builder_get_object(builder, "lbAttributes")); // Pack buttons at the bottom of the dialog m_btNew = GTK_WIDGET(gtk_builder_get_object(builder, "btNew")); m_btDelete = GTK_WIDGET(gtk_builder_get_object(builder, "btDelete")); m_btModify = GTK_WIDGET(gtk_builder_get_object(builder, "btModify")); localizeButton(m_btModify, pSS, AP_STRING_ID_DLG_Styles_Modify); m_btApply = GTK_WIDGET(gtk_builder_get_object(builder, "btApply")); m_btClose = GTK_WIDGET(gtk_builder_get_object(builder, "btClose")); _connectSignals(); g_object_unref(G_OBJECT(builder)); return window; }
GtkWidget * AP_UnixDialog_FormatFrame::_constructWindow(void) { GtkWidget * window; const XAP_StringSet * pSS = XAP_App::getApp()->getStringSet(); // get the path where our UI file is located std::string ui_path = static_cast<XAP_UnixApp*>(XAP_App::getApp())->getAbiSuiteAppUIDir() + "/ap_UnixDialog_FormatFrame.xml"; // load the dialog from the UI file GtkBuilder* builder = gtk_builder_new(); gtk_builder_add_from_file(builder, ui_path.c_str(), NULL); // Update our member variables with the important widgets that // might need to be queried or altered later window = GTK_WIDGET(gtk_builder_get_object(builder, "ap_UnixDialog_FormatFrame")); m_wLineTop = GTK_WIDGET(gtk_builder_get_object(builder, "tbBorderTop")); m_wLineLeft = GTK_WIDGET(gtk_builder_get_object(builder, "tbBorderLeft")); m_wLineRight = GTK_WIDGET(gtk_builder_get_object(builder, "tbBorderRight")); m_wLineBottom = GTK_WIDGET(gtk_builder_get_object(builder, "tbBorderBottom")); // place some nice pixmaps on our border toggle buttons label_button_with_abi_pixmap(m_wLineTop, "tb_LineTop_xpm"); label_button_with_abi_pixmap(m_wLineLeft, "tb_LineLeft_xpm"); label_button_with_abi_pixmap(m_wLineRight, "tb_LineRight_xpm"); label_button_with_abi_pixmap(m_wLineBottom, "tb_LineBottom_xpm"); m_wPreviewArea = GTK_WIDGET(gtk_builder_get_object(builder, "daPreview")); // set the dialog title ConstructWindowName(); abiDialogSetTitle(window, m_WindowName); // disable double buffering on our preview gtk_widget_set_double_buffered(m_wPreviewArea, FALSE); // localize the strings in our dialog, and set tags for some widgets localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbBorder")), pSS, AP_STRING_ID_DLG_FormatFrame_Borders); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbBorderColor")), pSS, AP_STRING_ID_DLG_FormatFrame_Color); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbBorderThickness")), pSS, AP_STRING_ID_DLG_FormatTable_Thickness); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbBackground")), pSS, AP_STRING_ID_DLG_FormatFrame_Background); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbBackgroundColor")), pSS, AP_STRING_ID_DLG_FormatFrame_Color); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbSetImageBackground")), pSS, AP_STRING_ID_DLG_FormatFrame_SetImageBackground); // Radio buttons to position type of the Frame localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbPositionTo")), pSS, AP_STRING_ID_DLG_FormatFrame_PositionTo); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbSetToParagraph")), pSS, AP_STRING_ID_DLG_FormatFrame_SetToParagraph); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbSetToColumn")), pSS, AP_STRING_ID_DLG_FormatFrame_SetToColumn); localizeButton(GTK_WIDGET(gtk_builder_get_object(builder, "rbSetToPage")), pSS, AP_STRING_ID_DLG_FormatFrame_SetToPage); m_wPosParagraph = GTK_WIDGET(gtk_builder_get_object(builder, "rbSetToParagraph")); m_wPosColumn = GTK_WIDGET(gtk_builder_get_object(builder, "rbSetToColumn")); m_wPosPage = GTK_WIDGET(gtk_builder_get_object(builder, "rbSetToPage")); // Button and label for text wrapping m_wWrapButton = GTK_WIDGET(gtk_builder_get_object(builder, "btTextWrapState")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(m_wWrapButton),TRUE); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbTextWrapState")), pSS, AP_STRING_ID_DLG_FormatFrame_TextWrapping); // add the buttons for background image to the dialog. m_wSelectImageButton = GTK_WIDGET(gtk_builder_get_object(builder, "btSelectImage")); m_wNoImageButton = GTK_WIDGET(gtk_builder_get_object(builder, "btSetNoImage")); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbSelectImage")), pSS, AP_STRING_ID_DLG_FormatFrame_SelectImage); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbSetNoImage")), pSS, AP_STRING_ID_DLG_FormatFrame_NoImageBackground); localizeLabelMarkup(GTK_WIDGET(gtk_builder_get_object(builder, "lbPreview")), pSS, AP_STRING_ID_DLG_FormatFrame_Preview); m_wBorderColorButton = GTK_WIDGET(gtk_builder_get_object(builder, "cbtBorderColorButton")); m_wBackgroundColorButton = GTK_WIDGET(gtk_builder_get_object(builder, "cbtBackgroundColorButton")); // // Now the Border Thickness Option menu // m_wBorderThickness = GTK_WIDGET(gtk_builder_get_object(builder, "omBorderThickness")); GtkComboBox *combo = GTK_COMBO_BOX(m_wBorderThickness); XAP_makeGtkComboBoxText(combo, G_TYPE_NONE); // TODO WTF is this hardcoded. gtk_combo_box_append_text(combo, "1/2 pt"); gtk_combo_box_append_text(combo, "3/4 pt"); gtk_combo_box_append_text(combo, "1 pt"); gtk_combo_box_append_text(combo, "1 1/2 pt"); gtk_combo_box_append_text(combo, "2 1/4 pt"); gtk_combo_box_append_text(combo, "3 pt"); gtk_combo_box_append_text(combo, "4 1/2 pt"); gtk_combo_box_append_text(combo, "6 pt"); gtk_combo_box_set_active(combo, 0); // add the apply and ok buttons to the dialog m_wCloseButton = GTK_WIDGET(gtk_builder_get_object(builder, "btClose")); m_wApplyButton = GTK_WIDGET(gtk_builder_get_object(builder, "btApply")); g_object_unref(G_OBJECT(builder)); return window; }