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 * AP_UnixDialog_GenericInput::_constructWindow(void) { GtkWidget* window; // load the dialog from the UI file #if GTK_CHECK_VERSION(3,0,0) GtkBuilder* builder = newDialogBuilder("ap_UnixDialog_GenericInput.ui"); #else GtkBuilder* builder = newDialogBuilder("ap_UnixDialog_GenericInput-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_GenericInput")); m_wOk = GTK_WIDGET(gtk_builder_get_object(builder, "btOK")); m_wInput = GTK_WIDGET(gtk_builder_get_object(builder, "edInput")); // set the dialog title abiDialogSetTitle(window, "%s", getTitle().utf8_str()); // set the question gtk_label_set_text(GTK_LABEL(GTK_WIDGET(gtk_builder_get_object(builder, "lbQuestion"))), getQuestion().utf8_str()); gtk_label_set_text(GTK_LABEL(GTK_WIDGET(gtk_builder_get_object(builder, "lbLabel"))), getLabel().utf8_str()); // "enter" in the edit box should trigger the default action gtk_entry_set_activates_default(GTK_ENTRY(m_wInput), true); // connect our signals g_signal_connect(G_OBJECT(m_wInput), "changed", G_CALLBACK(s_text_changed), static_cast<gpointer>(this)); g_signal_connect(G_OBJECT(m_wOk), "clicked", G_CALLBACK(s_ok_clicked), static_cast<gpointer>(this)); g_object_unref(G_OBJECT(builder)); return window; }
GtkWidget * AP_UnixDialog_GenericInput::_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_GenericInput.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_GenericInput")); m_wOk = GTK_WIDGET(gtk_builder_get_object(builder, "btOK")); m_wInput = GTK_WIDGET(gtk_builder_get_object(builder, "edInput")); // set the dialog title abiDialogSetTitle(window, getTitle().utf8_str()); // set the question gtk_label_set_text(GTK_LABEL(GTK_WIDGET(gtk_builder_get_object(builder, "lbQuestion"))), getQuestion().utf8_str()); gtk_label_set_text(GTK_LABEL(GTK_WIDGET(gtk_builder_get_object(builder, "lbLabel"))), getLabel().utf8_str()); // "enter" in the edit box should trigger the default action gtk_entry_set_activates_default(GTK_ENTRY(m_wInput), true); // connect our signals g_signal_connect(G_OBJECT(m_wInput), "changed", G_CALLBACK(s_text_changed), static_cast<gpointer>(this)); g_signal_connect(G_OBJECT(m_wOk), "clicked", G_CALLBACK(s_ok_clicked), static_cast<gpointer>(this)); g_object_unref(G_OBJECT(builder)); return window; }
GtkWidget * AP_UnixDialog_Stylist::_constructWindow(void) { // get the path where our UI file is located std::string ui_path; if(m_bIsModal) { ui_path = static_cast<XAP_UnixApp*>(XAP_App::getApp())->getAbiSuiteAppUIDir() + "/ap_UnixDialog_Stylist_modal.xml"; } else { ui_path = static_cast<XAP_UnixApp*>(XAP_App::getApp())->getAbiSuiteAppUIDir() + "/ap_UnixDialog_Stylist.xml"; } // load the dialog from the UI file GtkBuilder* builder = gtk_builder_new(); gtk_builder_add_from_file(builder, ui_path.c_str(), NULL); const XAP_StringSet * pSS = m_pApp->getStringSet (); m_windowMain = GTK_WIDGET(gtk_builder_get_object(builder, "ap_UnixDialog_Stylist")); m_wStyleListContainer = GTK_WIDGET(gtk_builder_get_object(builder, "TreeViewContainer")); if(m_bIsModal) { m_wApply = GTK_WIDGET(gtk_builder_get_object(builder, "btApply")); } else { m_wOK = GTK_WIDGET(gtk_builder_get_object(builder, "btOK")); } m_wClose = GTK_WIDGET(gtk_builder_get_object(builder, "btClose")); // set the dialog title UT_UTF8String s; pSS->getValueUTF8(AP_STRING_ID_DLG_Stylist_Title,s); abiDialogSetTitle(m_windowMain, s.utf8_str()); g_object_unref(G_OBJECT(builder)); return m_windowMain; }
GtkWidget * AP_UnixDialog_GenericProgress::_constructWindow(void) { GtkWidget* window; //const XAP_StringSet * pSS = XAP_App::getApp()->getStringSet(); GtkBuilder* builder = newDialogBuilder("ap_UnixDialog_GenericProgress.ui"); // 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_GenericProgress")); m_wCancel = GTK_WIDGET(gtk_builder_get_object(builder, "btCancel")); m_wProgress = GTK_WIDGET(gtk_builder_get_object(builder, "pbProgress")); // set the dialog title abiDialogSetTitle(window, "%s", getTitle().utf8_str()); // set the informative label gtk_label_set_text(GTK_LABEL(GTK_WIDGET(gtk_builder_get_object(builder, "lbInformation"))), getInformation().utf8_str()); //gtk_label_set_text(GTK_LABEL(GTK_WIDGET(gtk_builder_get_object(builder, "lbLabel"))), getLabel().utf8_str()); g_object_unref(G_OBJECT(builder)); return window; }
/*! * 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_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; }
GtkWidget * AP_UnixDialog_Annotation::_constructWindow () { GtkWidget * window; 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_Annotation.ui"); #else GtkBuilder* builder = newDialogBuilder("ap_UnixDialog_Annotation-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_Annotation")); m_entryTitle = GTK_WIDGET(gtk_builder_get_object(builder, "enTitle")); m_entryAuthor = GTK_WIDGET(gtk_builder_get_object(builder, "enAuthor")); m_textDescription = GTK_WIDGET(gtk_builder_get_object(builder, "tvDescription")); // set the dialog title std::string s; pSS->getValueUTF8(AP_STRING_ID_DLG_Annotation_Title,s); abiDialogSetTitle(window, "%s", s.c_str()); // localize the strings in our dialog, and set some userdata for some widgets localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbTitle")), pSS, AP_STRING_ID_DLG_Annotation_Title_LBL); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbAuthor")), pSS, AP_STRING_ID_DLG_Annotation_Author_LBL); localizeLabel(GTK_WIDGET(gtk_builder_get_object(builder, "lbDescription")), pSS, AP_STRING_ID_DLG_Annotation_Description_LBL); // signals g_signal_connect(G_OBJECT(m_entryTitle), "focus-out-event", G_CALLBACK(s_focus_out), static_cast<gpointer>(this)); g_signal_connect(G_OBJECT(m_entryAuthor), "focus-out-event", G_CALLBACK(s_focus_out), static_cast<gpointer>(this)); // now set the text in all the fields std::string prop; #define SET_ENTRY_TXT(name) \ prop = get##name () ; \ if ( !prop.empty() ) { \ gtk_entry_set_text (GTK_ENTRY(m_entry##name), prop.c_str() ) ; \ } GtkWidget * wReplace = GTK_WIDGET(gtk_builder_get_object(builder, "btReplace")); pSS->getValueUTF8(AP_STRING_ID_DLG_Annotation_Replace_LBL,s); gtk_button_set_label(GTK_BUTTON(wReplace),s.c_str()); GtkWidget * wOK = GTK_WIDGET(gtk_builder_get_object(builder, "btOK")); pSS->getValueUTF8(AP_STRING_ID_DLG_Annotation_OK_tooltip,s); gtk_widget_set_tooltip_text (wOK,s.c_str()); pSS->getValueUTF8(AP_STRING_ID_DLG_Annotation_Replace_tooltip,s); gtk_widget_set_tooltip_text (wReplace,s.c_str()); SET_ENTRY_TXT(Title) SET_ENTRY_TXT(Author) #undef SET_ENTRY_TXT prop = getDescription (); if ( !prop.empty() ) { GtkTextBuffer * buffer = gtk_text_view_get_buffer ( GTK_TEXT_VIEW(m_textDescription) ) ; gtk_text_buffer_set_text ( buffer, prop.c_str(), -1 ) ; } g_object_unref(G_OBJECT(builder)); return window; }