void XAP_UnixDialog_Image::runModal(XAP_Frame * pFrame) { // build the dialog GtkWidget * cf = _constructWindow(); UT_return_if_fail(cf); setHeightEntry(); setWidthEntry(); double height = UT_convertToInches(getHeightString()); double width = UT_convertToInches(getWidthString()); if((height > 0.0001) && (width > 0.0001)) m_dHeightWidth = height/width; else { m_dHeightWidth = 0.0; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (m_wAspectCheck), FALSE); } setWrappingGUI(); setPositionToGUI(); wrappingChanged(); switch ( abiRunModalDialog ( GTK_DIALOG(cf), pFrame, this, BUTTON_CANCEL, false ) ) { case GTK_RESPONSE_OK: event_Ok (); break; default: event_Cancel (); break; } abiDestroyWidget (cf); }
/*! * Run dialog. */ void AP_UnixDialog_Spell::runModal (XAP_Frame * pFrame) { // class the base class method to initialize some basic xp stuff AP_Dialog_Spell::runModal(pFrame); bool bRes = nextMisspelledWord(); if (bRes) { // we need to prepare the dialog GtkWidget * mainWindow = _constructWindow(); UT_ASSERT(mainWindow); // Populate the window's data items _populateWindowData(); abiSetupModalDialog(GTK_DIALOG(mainWindow), pFrame, this, GTK_RESPONSE_CLOSE); // now loop while there are still misspelled words while (bRes) { // show word in main window makeWordVisible(); gpointer inst = gtk_tree_view_get_selection (GTK_TREE_VIEW (m_lvSuggestions)); g_signal_handler_block (inst, m_listHandlerID); // update dialog with new misspelled word info/suggestions _updateWindow(); g_signal_handler_unblock (inst, m_listHandlerID); // run into the GTK event loop for this window gint response = abiRunModalDialog (GTK_DIALOG(mainWindow), false); UT_DEBUGMSG (("ROB: response='%d'\n", response)); switch(response) { case SPELL_RESPONSE_CHANGE: onChangeClicked (); break; case SPELL_RESPONSE_CHANGE_ALL: onChangeAllClicked (); break; case SPELL_RESPONSE_IGNORE: onIgnoreClicked (); break; case SPELL_RESPONSE_IGNORE_ALL: onIgnoreAllClicked (); break; case SPELL_RESPONSE_ADD: onAddClicked (); break; default: m_bCancelled = TRUE; _purgeSuggestions(); gtk_widget_destroy (m_wDialog); return; } _purgeSuggestions(); // get the next unknown word bRes = nextMisspelledWord(); } abiDestroyWidget(mainWindow); } }
void AP_UnixDialog_Break::runModal(XAP_Frame * pFrame) { UT_return_if_fail(pFrame); // Build the dialog's window m_windowMain = _constructWindow(); UT_return_if_fail(m_windowMain); _populateWindowData(); switch ( abiRunModalDialog ( GTK_DIALOG(m_windowMain), pFrame, this, CUSTOM_RESPONSE_INSERT, false ) ) { case CUSTOM_RESPONSE_INSERT: m_answer = AP_Dialog_Break::a_OK; break; default: m_answer = AP_Dialog_Break::a_CANCEL; break; } _storeWindowData(); abiDestroyWidget ( m_windowMain ) ; }
void AP_UnixDialog_Annotation::runModal(XAP_Frame * pFrame) { UT_return_if_fail(pFrame); // Build the window's widgets and arrange them m_windowMain = _constructWindow(); UT_return_if_fail(m_windowMain); switch(abiRunModalDialog(GTK_DIALOG(m_windowMain), pFrame, this, GTK_RESPONSE_CANCEL, false)) { case GTK_RESPONSE_APPLY: eventApply(); break; case GTK_RESPONSE_OK: eventOK(); break; default: eventCancel(); break ; } abiDestroyWidget(m_windowMain); }
void AP_UnixDialog_CollaborationShare::runModal(XAP_Frame * pFrame) { UT_return_if_fail(pFrame); // Build the dialog's window m_wWindowMain = _constructWindow(); UT_return_if_fail(m_wWindowMain); _populateWindowData(); switch ( abiRunModalDialog ( GTK_DIALOG(m_wWindowMain), pFrame, this, GTK_RESPONSE_CANCEL, false ) ) { case GTK_RESPONSE_CANCEL: m_answer = AP_UnixDialog_CollaborationShare::a_CANCEL; break; case GTK_RESPONSE_OK: m_answer = AP_UnixDialog_CollaborationShare::a_OK; break; default: m_answer = AP_UnixDialog_CollaborationShare::a_CANCEL; break; } _freeBuddyList(); abiDestroyWidget(m_wWindowMain); }
void AP_UnixDialog_Stylist::runModal(XAP_Frame * pFrame) { // Build the window's widgets and arrange them m_bIsModal = true; GtkWidget * mainWindow = _constructWindow(); UT_return_if_fail(mainWindow); // Populate the window's data items _populateWindowData(); _connectSignals(); switch (abiRunModalDialog ( GTK_DIALOG(mainWindow), pFrame, this, GTK_RESPONSE_CLOSE,false )) { case GTK_RESPONSE_CLOSE: setStyleValid(false); break; case GTK_RESPONSE_OK: setStyleValid(true); break; default: setStyleValid(false); break; } abiDestroyWidget(mainWindow); }
static void s_response_triggered(GtkWidget * widget, gint resp, AP_UnixDialog_Stylist * dlg) { UT_return_if_fail(widget && dlg); if ( resp == GTK_RESPONSE_APPLY ) dlg->event_Apply(); else if ( resp == GTK_RESPONSE_CLOSE ) abiDestroyWidget(widget); }
gint abiRunModalDialog(GtkDialog * me, bool destroyDialog, AtkRole role) { atk_object_set_role (gtk_widget_get_accessible (GTK_WIDGET (me)), role); // now run the dialog gint result = gtk_dialog_run ( me ) ; // destroy the dialog if ( destroyDialog ) abiDestroyWidget ( GTK_WIDGET ( me ) ); return result ; }
void AP_UnixDialog_Lists::runModal( XAP_Frame * pFrame) { FL_ListType savedListType; setModal(); GtkWidget * mainWindow = _constructWindow(); UT_return_if_fail(mainWindow); clearDirty(); // Populate the dialog m_bDontUpdate = false; loadXPDataIntoLocal(); // Need this to stop this being stomped during the contruction of preview widget savedListType = getNewListType(); // *** this is how we add the gc for Lists Preview *** // attach a new graphics context to the drawing area XAP_UnixApp * unixapp = static_cast<XAP_UnixApp *> (m_pApp); UT_ASSERT(unixapp); // Now Display the dialog, so m_wPreviewArea->window exists gtk_widget_show(m_wMainWindow); UT_ASSERT(m_wPreviewArea && m_wPreviewArea->window); // make a new Unix GC GR_UnixCairoAllocInfo ai(m_wPreviewArea); m_pPreviewWidget = (GR_CairoGraphics*) XAP_App::getApp()->newGraphics(ai); // let the widget materialize _createPreviewFromGC(m_pPreviewWidget, static_cast<UT_uint32>(m_wPreviewArea->allocation.width), static_cast<UT_uint32>(m_wPreviewArea->allocation.height)); // Restore our value setNewListType(savedListType); gint response; do { response = abiRunModalDialog (GTK_DIALOG(mainWindow), pFrame, this, BUTTON_CANCEL, false); } while (response == BUTTON_RESET); AP_Dialog_Lists::tAnswer res = getAnswer(); m_glFonts.clear(); abiDestroyWidget ( mainWindow ) ; setAnswer(res); DELETEP (m_pPreviewWidget); }
void AP_UnixDialog_ListRevisions::runModal(XAP_Frame * pFrame) { m_mainWindow = constructWindow(); UT_return_if_fail(m_mainWindow); switch ( abiRunModalDialog ( GTK_DIALOG(m_mainWindow), pFrame, this, BUTTON_OK, false ) ) { case BUTTON_OK: event_OK () ; break ; default: event_Cancel () ; break ; } abiDestroyWidget ( m_mainWindow ) ; }
void XAP_UnixDialog_Password::runModal(XAP_Frame * pFrame) { GtkWidget * cf = _constructWindow(); UT_return_if_fail(cf); switch ( abiRunModalDialog ( GTK_DIALOG(cf), pFrame, this, GTK_RESPONSE_OK, false ) ) { case GTK_RESPONSE_OK: event_OK(); break; default: event_Cancel(); break; } XAP_gdk_keyboard_ungrab(GDK_CURRENT_TIME); abiDestroyWidget(cf); }
void XAP_UnixDialog_Encoding::runModal(XAP_Frame * pFrame) { // Build the window's widgets and arrange them GtkWidget * mainWindow = _constructWindow(); UT_return_if_fail(mainWindow); // Populate the window's data items _populateWindowData(); switch ( abiRunModalDialog ( GTK_DIALOG(mainWindow), pFrame, this, GTK_RESPONSE_CANCEL, false ) ) { case GTK_RESPONSE_OK: event_Ok (); break; default: event_Cancel (); break; } abiDestroyWidget ( mainWindow ) ; }
void XAP_UnixDialog_Language::runModal(XAP_Frame * pFrame) { // build the dialog GtkWidget * cf = constructWindow(); UT_return_if_fail(cf); _populateWindowData(); // connect a dbl-clicked signal to the column g_signal_connect_after(G_OBJECT(m_pLanguageList), "row-activated", G_CALLBACK(s_lang_dblclicked), static_cast<gpointer>(this)); abiRunModalDialog ( GTK_DIALOG(cf), pFrame, this, GTK_RESPONSE_CLOSE, false ); event_setLang(); abiDestroyWidget(cf); }
void XAP_UnixDialog_History::runModal(XAP_Frame * pFrame) { UT_ASSERT(pFrame); // build the dialog GtkWidget * cf = _constructWindow(); UT_return_if_fail(cf); switch (abiRunModalDialog ( GTK_DIALOG(cf), pFrame, this, GTK_RESPONSE_CLOSE,false )) { case GTK_RESPONSE_CLOSE: m_answer = a_CANCEL; break; case GTK_RESPONSE_OK: m_answer = a_OK; break; default: m_answer = a_CANCEL; break; } abiDestroyWidget(cf); }
void AP_UnixDialog_InsertHyperlink::runModal(XAP_Frame * pFrame) { UT_ASSERT(pFrame); // Build the window's widgets and arrange them GtkWidget * mainWindow = _constructWindow(); UT_ASSERT(mainWindow); // select the first row of the list (this must come after the // call to _connectSignals) // gtk_clist_unselect_row(GTK_CLIST(m_clist),0,0); switch(abiRunModalDialog(GTK_DIALOG(mainWindow), pFrame, this, BUTTON_CANCEL, false)) { case BUTTON_OK: event_OK (); break; default: event_Cancel(); break ; } abiDestroyWidget(mainWindow); }
void AP_UnixDialog_Lists::destroy(void) { UT_ASSERT (m_wMainWindow); if(isModal()) { setAnswer(AP_Dialog_Lists::a_QUIT); } else { m_bDestroy_says_stopupdating = true; m_pAutoUpdateLists->stop(); setAnswer(AP_Dialog_Lists::a_CLOSE); m_glFonts.clear(); modeless_cleanup(); abiDestroyWidget(m_wMainWindow); m_wMainWindow = NULL; DELETEP(m_pAutoUpdateLists); DELETEP (m_pPreviewWidget); } }
void AP_UnixDialog_CollaborationAccounts::runModal(XAP_Frame * pFrame) { UT_return_if_fail(pFrame); // Build the dialog's window m_wWindowMain = _constructWindow(); UT_return_if_fail(m_wWindowMain); _populateWindowData(); switch ( abiRunModalDialog ( GTK_DIALOG(m_wWindowMain), pFrame, this, GTK_RESPONSE_CLOSE, false ) ) { case GTK_RESPONSE_CLOSE: m_answer = AP_Dialog_CollaborationAccounts::a_CLOSE; break; default: m_answer = AP_Dialog_CollaborationAccounts::a_CLOSE; break; } abiDestroyWidget(m_wWindowMain); }
void XAP_UnixDialog_WindowMore::runModal(XAP_Frame * pFrame) { // Initialize member so we know where we are now m_ndxSelFrame = m_pApp->findFrame(pFrame); UT_ASSERT_HARMLESS(m_ndxSelFrame >= 0); // Build the window's widgets and arrange them GtkWidget * mainWindow = _constructWindow(); UT_return_if_fail(mainWindow); // Populate the window's data items _populateWindowData(); switch ( abiRunModalDialog ( GTK_DIALOG(mainWindow), pFrame, this, CUSTOM_RESPONSE_VIEW, false ) ) { case CUSTOM_RESPONSE_VIEW: event_View () ; break ; default: event_Cancel (); break ; } abiDestroyWidget ( mainWindow ) ; }
void AP_UnixDialog_MarkRevisions::runModal(XAP_Frame * pFrame) { GtkWidget * mainWindow = constructWindow(); UT_return_if_fail(mainWindow); // toggle what should be grayed and what shouldn't be event_FocusToggled () ; gint rc = abiRunModalDialog ( GTK_DIALOG(mainWindow), pFrame, this, BUTTON_CANCEL, false ); UT_DEBUGMSG(("AP_UnixDialog_MarkRevisions::runModal() rc:%d\n", rc )); switch ( rc ) { case BUTTON_OK: event_OK () ; break ; default: event_Cancel () ; break ; } /*if(mainWindow && GTK_IS_WIDGET(mainWindow)) gtk_widget_destroy(mainWindow);*/ abiDestroyWidget ( mainWindow ) ; }
void AP_UnixDialog_Field::runModal(XAP_Frame * pFrame) { UT_return_if_fail(pFrame); // Build the window's widgets and arrange them m_windowMain = _constructWindow(); UT_return_if_fail(m_windowMain); // Populate the window's data items _populateCatogries(); switch ( abiRunModalDialog ( GTK_DIALOG(m_windowMain), pFrame, this, CUSTOM_RESPONSE_INSERT, false ) ) { case CUSTOM_RESPONSE_INSERT: event_Insert(); break; default: m_answer = AP_Dialog_Field::a_CANCEL; break; } abiDestroyWidget ( m_windowMain ) ; }
void AP_UnixDialog_GenericInput::runModal(XAP_Frame * pFrame) { // Build the dialog's window m_wWindowMain = _constructWindow(); UT_return_if_fail(m_wWindowMain); _populateWindowData(); switch ( abiRunModalDialog ( GTK_DIALOG(m_wWindowMain), pFrame, this, GTK_RESPONSE_OK, false ) ) { case GTK_RESPONSE_CANCEL: m_answer = AP_UnixDialog_GenericInput::a_CANCEL; break; case GTK_RESPONSE_OK: m_answer = AP_UnixDialog_GenericInput::a_OK; break; default: m_answer = AP_UnixDialog_GenericInput::a_CANCEL; break; } abiDestroyWidget(m_wWindowMain); }
void AP_UnixDialog_PageSetup::runModal (XAP_Frame *pFrame) { UT_return_if_fail(pFrame); // snarf the parent pagesize. m_PageSize = getPageSize(); m_pFrame = pFrame; // Build the window's widgets and arrange them GtkWidget * mainWindow = _constructWindow(); UT_return_if_fail(mainWindow); m_PageSize = getPageSize(); _updatePageSizeList(); switch(abiRunModalDialog(GTK_DIALOG(mainWindow), pFrame, this, BUTTON_CANCEL, false)) { case BUTTON_OK: event_OK() ; break; default: event_Cancel() ; break ; } abiDestroyWidget ( mainWindow ) ; }
void AP_UnixDialog_Styles::modifyRunModal(void) { // // OK Construct the new dialog and make it modal. // // // pointer to the widget is stored in m_wModifyDialog // // Center our new dialog in its parent and make it a transient _constructModifyDialog(); // // populate the dialog with useful info // if(!_populateModify()) { abiDestroyWidget(m_wModifyDialog); return; } abiSetupModalDialog(GTK_DIALOG(m_wModifyDialog), getFrame(), this, BUTTON_MODIFY_CANCEL); // make a new Unix GC DELETEP (m_pAbiPreviewWidget); GR_UnixCairoAllocInfo ai(gtk_widget_get_window(m_wModifyDrawingArea)); m_pAbiPreviewWidget = (GR_CairoGraphics*) XAP_App::getApp()->newGraphics(ai); // let the widget materialize GtkAllocation allocation; gtk_widget_get_allocation(m_wModifyDrawingArea, &allocation); _createAbiPreviewFromGC(m_pAbiPreviewWidget, static_cast<UT_uint32>(allocation.width), static_cast<UT_uint32>(allocation.height)); _populateAbiPreview(isNew()); bool inputValid; do { switch(abiRunModalDialog(GTK_DIALOG(m_wModifyDialog), false)) { case BUTTON_MODIFY_OK: inputValid = event_Modify_OK(); break; default: event_Modify_Cancel(); inputValid = true; break ; } } while (!inputValid); if(m_wModifyDialog && GTK_IS_WIDGET(m_wModifyDialog)) { // // Free the old glists // m_gbasedOnStyles.clear(); m_gfollowedByStyles.clear(); m_gStyleType.clear(); gtk_widget_destroy(m_wModifyDialog); } // // Have to delete this now since the destructor is not run till later // destroyAbiPreview(); DELETEP(m_pAbiPreviewWidget); }
static void s_delete_clicked(GtkWidget * widget, gpointer, gpointer * /*dlg*/) { abiDestroyWidget(widget); // will emit the proper signals for us }
void AP_UnixDialog_Lists::closeClicked(void) { setAnswer(AP_Dialog_Lists::a_QUIT); abiDestroyWidget(m_wMainWindow); // emit the correct signals }
void AP_UnixDialog_Styles::runModal(XAP_Frame * pFrame) { // // Get View and Document pointers. Place them in member variables // setFrame(pFrame); setView(static_cast<FV_View *>(pFrame->getCurrentView())); UT_ASSERT(getView()); setDoc(getView()->getLayout()->getDocument()); UT_ASSERT(getDoc()); // Build the window's widgets and arrange them m_windowMain = _constructWindow(); UT_ASSERT(m_windowMain); abiSetupModalDialog(GTK_DIALOG(m_windowMain), pFrame, this, GTK_RESPONSE_CLOSE); // *** this is how we add the gc for the para and char Preview's *** // attach a new graphics context to the drawing area UT_ASSERT(m_wParaPreviewArea && gtk_widget_get_window(m_wParaPreviewArea)); // make a new Unix GC DELETEP (m_pParaPreviewWidget); { GR_UnixCairoAllocInfo ai(m_wParaPreviewArea); m_pParaPreviewWidget = (GR_CairoGraphics*) XAP_App::getApp()->newGraphics(ai); } // let the widget materialize GtkAllocation allocation; gtk_widget_get_allocation(m_wParaPreviewArea, &allocation); _createParaPreviewFromGC(m_pParaPreviewWidget, static_cast<UT_uint32>(allocation.width), static_cast<UT_uint32>(allocation.height)); UT_ASSERT(m_wCharPreviewArea && gtk_widget_get_window(m_wCharPreviewArea)); // make a new Unix GC DELETEP (m_pCharPreviewWidget); { GR_UnixCairoAllocInfo ai(m_wCharPreviewArea); m_pCharPreviewWidget = (GR_CairoGraphics*) XAP_App::getApp()->newGraphics(ai); } // let the widget materialize gtk_widget_get_allocation(m_wCharPreviewArea, &allocation); _createCharPreviewFromGC(m_pCharPreviewWidget, static_cast<UT_uint32>(allocation.width), static_cast<UT_uint32>(allocation.height)); // Populate the window's data items _populateWindowData(); // the expose event of the preview g_signal_connect(G_OBJECT(m_wParaPreviewArea), #if GTK_CHECK_VERSION(3,0,0) "draw", #else "expose_event", #endif G_CALLBACK(s_paraPreview_draw), reinterpret_cast<gpointer>(this)); g_signal_connect(G_OBJECT(m_wCharPreviewArea), #if GTK_CHECK_VERSION(3,0,0) "draw", #else "expose_event", #endif G_CALLBACK(s_charPreview_draw), reinterpret_cast<gpointer>(this)); // connect the select_row signal to the clist g_signal_connect (G_OBJECT (gtk_tree_view_get_selection(GTK_TREE_VIEW(m_tvStyles))), "changed", G_CALLBACK (s_tvStyles_selection_changed), reinterpret_cast<gpointer>(this)); // main loop for the dialog gint response; while(true) { response = abiRunModalDialog(GTK_DIALOG(m_windowMain), false); if (response == GTK_RESPONSE_APPLY) event_Apply(); else { event_Close(); break; // exit the loop } } DELETEP (m_pParaPreviewWidget); DELETEP (m_pCharPreviewWidget); abiDestroyWidget(m_windowMain); }
void AP_UnixDialog_Paragraph::runModal(XAP_Frame * pFrame) { m_pFrame = pFrame; // Build the window's widgets and arrange them GtkWidget * mainWindow = _constructWindow(); UT_ASSERT(mainWindow); // Populate the window's data items _populateWindowData(); // Attach signals (after data settings, so we don't trigger // updates yet) _connectCallbackSignals(); // Show the top level dialog, gtk_widget_show(mainWindow); #if defined(EMBEDDED_TARGET) && EMBEDDED_TARGET == EMBEDDED_TARGET_HILDON #else // *** this is how we add the gc *** { // attach a new graphics context to the drawing area UT_ASSERT(m_drawingareaPreview && gtk_widget_get_window(m_drawingareaPreview)); // make a new Unix GC GR_UnixCairoAllocInfo ai(m_drawingareaPreview); m_unixGraphics = (GR_CairoGraphics*) XAP_App::getApp()->newGraphics(ai); // let the widget materialize GtkAllocation allocation; gtk_widget_get_allocation(m_drawingareaPreview, &allocation); _createPreviewFromGC(m_unixGraphics, (UT_uint32) allocation.width, (UT_uint32) allocation.height); } // sync all controls once to get started // HACK: the first arg gets ignored _syncControls(id_MENU_ALIGNMENT, true); #endif bool tabs; do { switch(abiRunModalDialog(GTK_DIALOG(mainWindow), pFrame, this, BUTTON_CANCEL, false)) { case BUTTON_OK: event_OK(); tabs = false; break; case BUTTON_TABS: event_Tabs (); tabs = true; break; default: event_Cancel(); tabs = false; break; } } while (tabs); abiDestroyWidget(mainWindow); }
static void s_response(GtkWidget * wid, gint /*id*/, AP_UnixDialog_SplitCells * /*me*/ ) { abiDestroyWidget( wid ) ;// will emit signals for us }
static void s_delete_clicked(GtkWidget * widget, gpointer, gpointer * /*dlg*/) { abiDestroyWidget(widget); }
static void s_delete_clicked(GtkWidget * wid, AP_UnixDialog_Stylist * /*me*/ ) { abiDestroyWidget( wid ) ;// will emit signals for us }