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); }
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); }
void AP_UnixPreview_Annotation::runModeless(XAP_Frame * pFrame) { UT_DEBUGMSG(("Preview Annotation runModeless %p \n",this)); setActiveFrame(pFrame); if(m_pPreviewWindow) { DELETEP(m_gc); gtk_widget_destroy(m_pDrawingArea); gtk_widget_destroy(m_pPreviewWindow); m_pPreviewWindow = NULL; m_pDrawingArea = NULL; } setSizeFromAnnotation(); _constructWindow(); gtk_window_set_modal ( GTK_WINDOW(m_pPreviewWindow), FALSE ) ; gtk_widget_show(m_pPreviewWindow); // make a new Unix GC DELETEP(m_gc); XAP_App *pApp = XAP_App::getApp(); GR_UnixCairoAllocInfo ai(GTK_WIDGET(m_pDrawingArea)); m_gc = (GR_CairoGraphics*) pApp->newGraphics(ai); GtkAllocation allocation; gtk_widget_get_allocation(m_pPreviewWindow, &allocation); _createAnnotationPreviewFromGC(m_gc, allocation.width, allocation.height); m_gc->setZoomPercentage(100); gtk_widget_show(m_pDrawingArea); }
/*! * 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_FormatFrame::runModeless(XAP_Frame * pFrame) { // Build the window's widgets and arrange them m_windowMain = _constructWindow(); UT_return_if_fail(m_windowMain); // Populate the window's data items _populateWindowData(); _connectSignals(); abiSetupModelessDialog(GTK_DIALOG(m_windowMain), pFrame, this, BUTTON_CLOSE); // *** this is how we add the gc for Column Preview *** // attach a new graphics context to the drawing area UT_return_if_fail(m_wPreviewArea && m_wPreviewArea->window); // make a new Unix GC DELETEP (m_pPreviewWidget); GR_UnixCairoAllocInfo ai(m_wPreviewArea); m_pPreviewWidget = (GR_UnixCairoGraphics*) XAP_App::getApp()->newGraphics(ai); // Todo: we need a good widget to query with a probable // Todo: non-white (i.e. gray, or a similar bgcolor as our parent widget) // Todo: background. This should be fine m_pPreviewWidget->init3dColors(m_wPreviewArea->style); // let the widget materialize _createPreviewFromGC(m_pPreviewWidget, static_cast<UT_uint32>(m_wPreviewArea->allocation.width), static_cast<UT_uint32>(m_wPreviewArea->allocation.height)); m_pFormatFramePreview->draw(); startUpdater(); }
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_SplitCells::runModeless(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(); _connectSignals(); abiSetupModelessDialog(GTK_DIALOG(mainWindow),pFrame,this,BUTTON_CLOSE); startUpdater(); }
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 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 AP_UnixDialog_ToggleCase::runModal(XAP_Frame * pFrame) { UT_return_if_fail(pFrame); // Build the window's widgets and arrange them GtkWidget * mainWindow = _constructWindow(); UT_return_if_fail(mainWindow); switch(abiRunModalDialog(GTK_DIALOG(mainWindow), pFrame, this, BUTTON_CANCEL, true)) { case BUTTON_OK: setAnswer(AP_Dialog_ToggleCase::a_OK); break ; default: setAnswer(AP_Dialog_ToggleCase::a_CANCEL); break ; } }
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 AP_UnixDialog_HdrFtr::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_OK, true )) { case GTK_RESPONSE_OK: setAnswer(a_OK); break; default: setAnswer(a_CANCEL); break; } }
void AP_UnixDialog_Lists::runModeless (XAP_Frame * pFrame) { static std::pointer_to_unary_function<int, gboolean> s_update_fun = std::ptr_fun(s_update); _constructWindow (); UT_ASSERT (m_wMainWindow); clearDirty(); abiSetupModelessDialog(GTK_DIALOG(m_wMainWindow), pFrame, this, BUTTON_APPLY); connectFocusModelessOther (GTK_WIDGET (m_wMainWindow), m_pApp, &s_update_fun); // Populate the dialog updateDialog(); m_bDontUpdate = false; // Now Display the dialog gtk_widget_show(m_wMainWindow); // *** 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); UT_ASSERT(m_wPreviewArea && m_wPreviewArea->window); // make a new Unix GC GR_UnixCairoAllocInfo ai(m_wPreviewArea->window); 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)); // Next construct a timer for auto-updating the dialog m_pAutoUpdateLists = UT_Timer::static_constructor(autoupdateLists,this); m_bDestroy_says_stopupdating = false; // OK fire up the auto-updater for 0.5 secs m_pAutoUpdateLists->set(500); }
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 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 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_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 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::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); }