void AP_UnixDialog_Lists::updateFromDocument(void) { PopulateDialogData(); _setRadioButtonLabels(); setNewListType(getDocListType()); loadXPDataIntoLocal(); }
/*! * This method just sets the value of m_newListType. This is needed to * make fillUncustomizedValues work. */ void AP_UnixDialog_Lists::setListTypeFromWidget(void) { GtkTreeIter iter; GtkTreeModel *model; gtk_combo_box_get_active_iter(m_wListStyleBox, &iter); model = gtk_combo_box_get_model(m_wListStyleBox); gint type; gtk_tree_model_get(model, &iter, 1, &type, -1); setNewListType((FL_ListType)type); }
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_Lists::styleChanged(gint type) { // // code to change list list // if(type == 0) { m_wListStyle_menu = m_wListStyleNone_menu; gtk_combo_box_set_model(m_wListStyleBox, GTK_TREE_MODEL(m_wListStyleNone_menu.obj())); gtk_combo_box_set_active(m_wListTypeBox, 0); setNewListType(NOT_A_LIST); gtk_widget_set_sensitive(GTK_WIDGET(m_wFontOptions), false); gtk_widget_set_sensitive(m_wStartSpin, false); gtk_widget_set_sensitive(m_wDelimEntry, false); gtk_widget_set_sensitive(m_wDecimalEntry, false); } else if(type == 1) { m_wListStyle_menu = m_wListStyleBulleted_menu; gtk_combo_box_set_model(m_wListStyleBox, GTK_TREE_MODEL(m_wListStyleBulleted_menu.obj())); gtk_combo_box_set_active(m_wListTypeBox, 1); setNewListType(BULLETED_LIST); gtk_widget_set_sensitive(GTK_WIDGET(m_wFontOptions), false); gtk_widget_set_sensitive(m_wStartSpin, false); gtk_widget_set_sensitive(m_wDelimEntry, false); gtk_widget_set_sensitive(m_wDecimalEntry, false); } else if(type == 2) { // gtk_widget_destroy(GTK_WIDGET(m_wListStyleNumbered_menu)); // m_wListStyleNumbered_menu = gtk_menu_new(); m_wListStyle_menu = m_wListStyleNumbered_menu; // _fillNumberedStyleMenu(m_wListStyleNumbered_menu); // Block events during this manual change gtk_combo_box_set_model (m_wListStyleBox, GTK_TREE_MODEL(m_wListStyleNumbered_menu.obj())); gtk_combo_box_set_active(m_wListTypeBox, 2); setNewListType(NUMBERED_LIST); gtk_widget_set_sensitive(GTK_WIDGET(m_wFontOptions), true); gtk_widget_set_sensitive(m_wStartSpin, true); gtk_widget_set_sensitive(m_wDelimEntry, true); gtk_widget_set_sensitive(m_wDecimalEntry, true); } // // This methods needs to be called from loadXPDataIntoLocal to set the correct // list style. However if we are doing this we definately don't want to call // loadXPDataIntoLocal again! Luckily we can just check this to make sure this is // not happenning. // if(!dontUpdate()) { fillUncustomizedValues(); // Set defaults loadXPDataIntoLocal(); // load them into the widget previewExposed(); // Show current setting } }
void AP_UnixDialog_Lists::loadXPDataIntoLocal(void) { // // This function reads the various memeber variables and loads them into // into the dialog variables. // // // Block all signals while setting these things // XAP_GtkSignalBlocker b1( G_OBJECT(m_oAlignList_adj), m_iAlignListSpinID); XAP_GtkSignalBlocker b2( G_OBJECT(m_oIndentAlign_adj), m_iIndentAlignSpinID); XAP_GtkSignalBlocker b3( G_OBJECT(m_wDecimalEntry), m_iDecimalEntryID); XAP_GtkSignalBlocker b4( G_OBJECT(m_wDelimEntry), m_iDelimEntryID ); // // HACK to effectively block an update during this method // m_bDontUpdate = true; UT_DEBUGMSG(("loadXP newListType = %d \n",getNewListType())); gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_wAlignListSpin),getfAlign()); float indent = getfAlign() + getfIndent(); gtk_spin_button_set_value(GTK_SPIN_BUTTON( m_wIndentAlignSpin),indent); if( (getfIndent() + getfAlign()) < 0.0) { setfIndent( - getfAlign()); gtk_spin_button_set_value(GTK_SPIN_BUTTON( m_wIndentAlignSpin), 0.0); } // // Code to work out which is active Font // if(getFont() == "NULL") { gtk_combo_box_set_active(m_wFontOptions, 0 ); } else { size_t i = 0; for(std::vector<std::string>::const_iterator iter = m_glFonts.begin(); iter != m_glFonts.end(); ++iter, ++i) { if(*iter == getFont()) break; } if(i < m_glFonts.size()) { gtk_combo_box_set_active(m_wFontOptions, i + 1 ); } else { gtk_combo_box_set_active(m_wFontOptions, 0 ); } } gtk_spin_button_set_value(GTK_SPIN_BUTTON(m_wStartSpin),static_cast<float>(getiStartValue())); gtk_entry_set_text( GTK_ENTRY(m_wDecimalEntry), getDecimal().c_str()); gtk_entry_set_text( GTK_ENTRY(m_wDelimEntry), getDelim().c_str()); // // Now set the list type and style FL_ListType save = getNewListType(); if(getNewListType() == NOT_A_LIST) { styleChanged(0); setNewListType(save); gtk_combo_box_set_active(m_wListTypeBox, 0); gtk_combo_box_set_active(m_wListStyleBox, 0); } else if(IS_BULLETED_LIST_TYPE(getNewListType()) ) { styleChanged(1); setNewListType(save); gtk_combo_box_set_active(m_wListTypeBox, 1); gtk_combo_box_set_active(m_wListStyleBox, (gint) (getNewListType() - BULLETED_LIST)); } else { styleChanged(2); setNewListType(save); gtk_combo_box_set_active(m_wListTypeBox, 2); if(getNewListType() < OTHER_NUMBERED_LISTS) { gtk_combo_box_set_active(m_wListStyleBox, getNewListType()); } else { gint iMenu = static_cast<gint>(getNewListType()) - OTHER_NUMBERED_LISTS + BULLETED_LIST -1 ; gtk_combo_box_set_active(m_wListStyleBox,iMenu); } } // // HACK to allow an update during this method // m_bDontUpdate = false; }