From 97ef01fe17c522cbe313add9f7136aa09ad0350d Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Mon, 26 Nov 2012 08:04:44 +0100 Subject: i18n. Fix for Bug #1083043 (Symbols dialog isn't translatable). (bzr r11904) --- src/ui/dialog/symbols.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 8cf48f827..4c3a406f0 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -15,6 +15,8 @@ #include #include +#include + #include #include #include @@ -97,16 +99,16 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : guint row = 0; /******************** Symbol Sets *************************/ - Gtk::Label* labelSet = new Gtk::Label("Symbol set: "); + Gtk::Label* labelSet = new Gtk::Label(_("Symbol set: ")); table->attach(*Gtk::manage(labelSet),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); symbolSet = new Gtk::ComboBoxText(); // Fill in later #if WITH_GTKMM_2_24 - symbolSet->append("Current Document"); + symbolSet->append(_("Current Document")); #else - symbolSet->append_text("Current Document"); + symbolSet->append_text(_("Current Document")); #endif - symbolSet->set_active_text("Current Document"); + symbolSet->set_active_text(_("Current Document")); table->attach(*Gtk::manage(symbolSet),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); sigc::connection connSet = @@ -142,12 +144,12 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : ++row; /******************** Preview Scale ***********************/ - Gtk::Label* labelScale = new Gtk::Label("Preview scale: "); + Gtk::Label* labelScale = new Gtk::Label(_("Preview scale: ")); table->attach(*Gtk::manage(labelScale),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); previewScale = new Gtk::ComboBoxText(); const gchar *scales[] = - {"Fit", "Fit to width", "Fit to height", "0.1", "0.2", "0.5", "1.0", "2.0", "5.0", NULL}; + {_("Fit"), _("Fit to width"), _("Fit to height"), "0.1", "0.2", "0.5", "1.0", "2.0", "5.0", NULL}; for( int i = 0; scales[i]; ++i ) { #if WITH_GTKMM_2_24 previewScale->append(scales[i]); @@ -165,7 +167,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : ++row; /******************** Preview Size ************************/ - Gtk::Label* labelSize = new Gtk::Label("Preview size: "); + Gtk::Label* labelSize = new Gtk::Label(_("Preview size: ")); table->attach(*Gtk::manage(labelSize),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); previewSize = new Gtk::ComboBoxText(); -- cgit v1.2.3 From 4af19c56cf90e31a0d800821e8daf7fb08108e94 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Mon, 26 Nov 2012 10:33:19 +0000 Subject: Drop support for GTK+ < 2.24 Fixed bugs: - https://launchpad.net/bugs/1069024 (bzr r11907) --- src/ui/dialog/align-and-distribute.cpp | 19 ------------------- src/ui/dialog/document-properties.cpp | 12 ------------ src/ui/dialog/filedialogimpl-gtkmm.cpp | 12 ------------ src/ui/dialog/filter-effects-dialog.cpp | 23 +---------------------- src/ui/dialog/glyphs.cpp | 8 -------- src/ui/dialog/inkscape-preferences.cpp | 12 ------------ src/ui/dialog/input.cpp | 21 --------------------- src/ui/dialog/ocaldialogs.cpp | 4 ---- src/ui/dialog/spellcheck.cpp | 14 -------------- src/ui/dialog/svg-fonts-dialog.cpp | 11 +---------- src/ui/dialog/symbols.cpp | 17 ----------------- src/ui/dialog/text-edit.cpp | 27 --------------------------- src/ui/widget/frame.cpp | 2 -- src/ui/widget/gimpspinscale.c | 10 ---------- src/ui/widget/preferences-widget.cpp | 13 ------------- src/ui/widget/unit-menu.cpp | 14 +------------- 16 files changed, 3 insertions(+), 216 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/align-and-distribute.cpp b/src/ui/dialog/align-and-distribute.cpp index cd1ce1471..dbd06d9e8 100644 --- a/src/ui/dialog/align-and-distribute.cpp +++ b/src/ui/dialog/align-and-distribute.cpp @@ -1040,7 +1040,6 @@ AlignAndDistribute::AlignAndDistribute() //Rest of the widgetry -#if WITH_GTKMM_2_24 _combo.append(_("Last selected")); _combo.append(_("First selected")); _combo.append(_("Biggest object")); @@ -1048,15 +1047,6 @@ AlignAndDistribute::AlignAndDistribute() _combo.append(_("Page")); _combo.append(_("Drawing")); _combo.append(_("Selection")); -#else - _combo.append_text(_("Last selected")); - _combo.append_text(_("First selected")); - _combo.append_text(_("Biggest object")); - _combo.append_text(_("Smallest object")); - _combo.append_text(_("Page")); - _combo.append_text(_("Drawing")); - _combo.append_text(_("Selection")); -#endif _combo.set_active(prefs->getInt("/dialogs/align/align-to", 6)); _combo.signal_changed().connect(sigc::mem_fun(*this, &AlignAndDistribute::on_ref_change)); @@ -1154,21 +1144,12 @@ void AlignAndDistribute::on_selgrp_toggled(){ void AlignAndDistribute::setMode(bool nodeEdit) { //Act on widgets used in node mode -#if WITH_GTKMM_2_24 void ( Gtk::Widget::*mNode) () = nodeEdit ? &Gtk::Widget::show_all : &Gtk::Widget::hide; //Act on widgets used in selection mode void ( Gtk::Widget::*mSel) () = nodeEdit ? &Gtk::Widget::hide : &Gtk::Widget::show_all; -#else - void ( Gtk::Widget::*mNode) () = nodeEdit ? - &Gtk::Widget::show_all : &Gtk::Widget::hide_all; - - //Act on widgets used in selection mode - void ( Gtk::Widget::*mSel) () = nodeEdit ? - &Gtk::Widget::hide_all : &Gtk::Widget::show_all; -#endif ((_alignFrame).*(mSel))(); ((_distributeFrame).*(mSel))(); diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index e681147aa..ab1e8fbd8 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -333,21 +333,13 @@ void DocumentProperties::build_snap() #if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /// Populates the available color profiles combo box void DocumentProperties::populate_available_profiles(){ -#if WITH_GTKMM_2_24 _combo_avail.remove_all(); // Clear any existing items in the combo box -#else - _combo_avail.clear_items(); // Clear any existing items in the combo box -#endif // Iterate through the list of profiles and add the name to the combo box. std::vector > pairs = ColorProfile::getProfileFilesWithNames(); for ( std::vector >::const_iterator it = pairs.begin(); it != pairs.end(); ++it ) { Glib::ustring name = it->second; -#if WITH_GTKMM_2_24 _combo_avail.append(name); -#else - _combo_avail.append_text(name); -#endif } } @@ -1160,11 +1152,7 @@ void DocumentProperties::build_gridspage() _grids_hbox_crea.pack_start(_grids_button_new, true, true); for (gint t = 0; t <= GRID_MAXTYPENR; t++) { -#if WITH_GTKMM_2_24 _grids_combo_gridtype.append( CanvasGrid::getName( (GridType) t ) ); -#else - _grids_combo_gridtype.append_text( CanvasGrid::getName( (GridType) t ) ); -#endif } _grids_combo_gridtype.set_active_text( CanvasGrid::getName(GRID_RECTANGULAR) ); diff --git a/src/ui/dialog/filedialogimpl-gtkmm.cpp b/src/ui/dialog/filedialogimpl-gtkmm.cpp index 90d9855ec..553acac84 100644 --- a/src/ui/dialog/filedialogimpl-gtkmm.cpp +++ b/src/ui/dialog/filedialogimpl-gtkmm.cpp @@ -1183,11 +1183,7 @@ void FileSaveDialogImplGtk::addFileType(Glib::ustring name, Glib::ustring patter guessType.name = name; guessType.pattern = pattern; guessType.extension = NULL; - #if WITH_GTKMM_2_24 fileTypeComboBox.append(guessType.name); - #else - fileTypeComboBox.append_text(guessType.name); - #endif fileTypes.push_back(guessType); @@ -1216,11 +1212,7 @@ void FileSaveDialogImplGtk::createFileTypeMenu() knownExtensions.insert( extension.casefold() ); fileDialogExtensionToPattern (type.pattern, extension); type.extension= omod; -#if WITH_GTKMM_2_24 fileTypeComboBox.append(type.name); -#else - fileTypeComboBox.append_text(type.name); -#endif fileTypes.push_back(type); } @@ -1229,11 +1221,7 @@ void FileSaveDialogImplGtk::createFileTypeMenu() guessType.name = _("Guess from extension"); guessType.pattern = "*"; guessType.extension = NULL; -#if WITH_GTKMM_2_24 fileTypeComboBox.append(guessType.name); -#else - fileTypeComboBox.append_text(guessType.name); -#endif fileTypes.push_back(guessType); diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index b00dd042f..9a430114d 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1058,11 +1058,7 @@ private: void update() { -#if WITH_GTKMM_2_24 - _box.hide(); -#else - _box.hide_all(); -#endif + _box.hide(); _box.show(); _light_box.show_all(); @@ -1128,13 +1124,8 @@ FilterEffectsDialog::FilterModifier::FilterModifier(FilterEffectsDialog& d) if(col) col->add_attribute(_cell_toggle.property_active(), _columns.sel); _list.append_column_editable(_("_Filter"), _columns.label); -#if WITH_GTKMM_2_24 ((Gtk::CellRendererText*)_list.get_column(1)->get_first_cell())-> signal_edited().connect(sigc::mem_fun(*this, &FilterEffectsDialog::FilterModifier::on_name_edited)); -#else - ((Gtk::CellRendererText*)_list.get_column(1)->get_first_cell_renderer())-> - signal_edited().connect(sigc::mem_fun(*this, &FilterEffectsDialog::FilterModifier::on_name_edited)); -#endif sw->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_AUTOMATIC); sw->set_shadow_type(Gtk::SHADOW_IN); @@ -2648,11 +2639,7 @@ void FilterEffectsDialog::update_filter_general_settings_view() } else { std::vector vect = _settings_tab2.get_children(); -#if WITH_GTKMM_2_24 vect[0]->hide(); -#else - vect[0]->hide_all(); -#endif _no_filter_selected.show(); } @@ -2671,11 +2658,7 @@ void FilterEffectsDialog::update_settings_view() std::vector vect1 = _settings_tab1.get_children(); for(unsigned int i=0; ihide(); -#else - vect1[i]->hide_all(); -#endif _empty_settings.show(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -2699,11 +2682,7 @@ void FilterEffectsDialog::update_settings_view() //Second Tab std::vector vect2 = _settings_tab2.get_children(); -#if WITH_GTKMM_2_24 vect2[0]->hide(); -#else - vect2[0]->hide_all(); -#endif _no_filter_selected.show(); SPFilter* filter = _filter_modifier.get_selected_filter(); diff --git a/src/ui/dialog/glyphs.cpp b/src/ui/dialog/glyphs.cpp index 1eed8d804..eec904ee4 100644 --- a/src/ui/dialog/glyphs.cpp +++ b/src/ui/dialog/glyphs.cpp @@ -364,11 +364,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : scriptCombo = new Gtk::ComboBoxText(); for (std::map::iterator it = getScriptToName().begin(); it != getScriptToName().end(); ++it) { -#if WITH_GTKMM_2_24 scriptCombo->append(it->second); -#else - scriptCombo->append_text(it->second); -#endif } scriptCombo->set_active_text(getScriptToName()[G_UNICODE_SCRIPT_INVALID_CODE]); @@ -393,11 +389,7 @@ GlyphsPanel::GlyphsPanel(gchar const *prefsPath) : rangeCombo = new Gtk::ComboBoxText(); for ( std::vector::iterator it = getRanges().begin(); it != getRanges().end(); ++it ) { -#if WITH_GTKMM_2_24 rangeCombo->append(it->second); -#else - rangeCombo->append_text(it->second); -#endif } rangeCombo->set_active_text(getRanges()[1].second); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 03366a0c3..291059999 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -986,18 +986,10 @@ void InkscapePreferences::initPageIO() Glib::ustring current = prefs->getString( "/options/displayprofile/uri" ); gint index = 0; -#if WITH_GTKMM_2_24 _cms_display_profile.append(_("")); -#else - _cms_display_profile.append_text(_("")); -#endif index++; for ( std::vector::iterator it = names.begin(); it != names.end(); ++it ) { -#if WITH_GTKMM_2_24 _cms_display_profile.append( *it ); -#else - _cms_display_profile.append_text( *it ); -#endif Glib::ustring path = CMSSystem::getPathForProfile(*it); if ( !path.empty() && path == current ) { _cms_display_profile.set_active(index); @@ -1012,11 +1004,7 @@ void InkscapePreferences::initPageIO() current = prefs->getString("/options/softproof/uri"); index = 0; for ( std::vector::iterator it = names.begin(); it != names.end(); ++it ) { -#if WITH_GTKMM_2_24 _cms_proof_profile.append( *it ); -#else - _cms_proof_profile.append_text( *it ); -#endif Glib::ustring path = CMSSystem::getPathForProfile(*it); if ( !path.empty() && path == current ) { _cms_proof_profile.set_active(index); diff --git a/src/ui/dialog/input.cpp b/src/ui/dialog/input.cpp index b3c1bddfd..7e2b0a1e1 100644 --- a/src/ui/dialog/input.cpp +++ b/src/ui/dialog/input.cpp @@ -609,11 +609,7 @@ InputDialogImpl::InputDialogImpl() : ::Gtk::FILL, ::Gtk::SHRINK); -#if WITH_GTKMM_2_24 linkCombo.append(_("None")); -#else - linkCombo.append_text(_("None")); -#endif linkCombo.set_active_text(_("None")); linkCombo.set_sensitive(false); linkConnection = linkCombo.signal_changed().connect(sigc::mem_fun(*this, &InputDialogImpl::linkComboChanged)); @@ -1282,24 +1278,15 @@ void InputDialogImpl::resyncToSelection() { devDetails.set_sensitive(true); linkConnection.block(); -#if WITH_GTKMM_2_24 linkCombo.remove_all(); linkCombo.append(_("None")); -#else - linkCombo.clear_items(); - linkCombo.append_text(_("None")); -#endif linkCombo.set_active(0); if ( dev->getSource() != Gdk::SOURCE_MOUSE ) { Glib::ustring linked = dev->getLink(); std::list > devList = Inkscape::DeviceManager::getManager().getDevices(); for ( std::list >::const_iterator it = devList.begin(); it != devList.end(); ++it ) { if ( ((*it)->getSource() != Gdk::SOURCE_MOUSE) && ((*it) != dev) ) { -#if WITH_GTKMM_2_24 linkCombo.append((*it)->getName().c_str()); -#else - linkCombo.append_text((*it)->getName().c_str()); -#endif if ( (linked.length() > 0) && (linked == (*it)->getId()) ) { linkCombo.set_active_text((*it)->getName().c_str()); } @@ -1334,18 +1321,10 @@ void InputDialogImpl::setupValueAndCombo( gint reported, gint actual, Gtk::Label label.set_label(tmp); g_free(tmp); -#if WITH_GTKMM_2_24 combo.remove_all(); -#else - combo.clear_items(); -#endif for ( gint i = 1; i <= reported; ++i ) { tmp = g_strdup_printf("%d", i); -#if WITH_GTKMM_2_24 combo.append(tmp); -#else - combo.append_text(tmp); -#endif g_free(tmp); } diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index bb06e3e79..174f361fd 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -963,11 +963,7 @@ void SearchResultList::populate_from_xml(xmlNode * a_node) { if (!strcmp((const char*)cur_node->name, "title")) { -#if WITH_GTKMM_2_24 row_num = append(""); -#else - row_num = append_text(""); -#endif xmlChar *xml_title = xmlNodeGetContent(cur_node); char* title = (char*) xml_title; diff --git a/src/ui/dialog/spellcheck.cpp b/src/ui/dialog/spellcheck.cpp index 0f2c53f99..9cc18c02c 100644 --- a/src/ui/dialog/spellcheck.cpp +++ b/src/ui/dialog/spellcheck.cpp @@ -109,10 +109,6 @@ SpellCheck::SpellCheck (void) : tree_view.append_column(_("Suggestions:"), tree_columns.suggestions); { -// Backward compatibility fix: The GtkComboBoxText API was introduced with -// GTK+ 2.24. This check should eventually be dropped when we bump our -// GTK dependency. -#if GTK_CHECK_VERSION(2, 24, 0) dictionary_combo = gtk_combo_box_text_new(); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dictionary_combo), _lang.c_str()); if (_lang2 != "") { @@ -121,16 +117,6 @@ SpellCheck::SpellCheck (void) : if (_lang3 != "") { gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (dictionary_combo), _lang3.c_str()); } -#else - dictionary_combo = gtk_combo_box_new_text(); - gtk_combo_box_append_text (GTK_COMBO_BOX (dictionary_combo), _lang.c_str()); - if (_lang2 != "") { - gtk_combo_box_append_text (GTK_COMBO_BOX (dictionary_combo), _lang2.c_str()); - } - if (_lang3 != "") { - gtk_combo_box_append_text (GTK_COMBO_BOX (dictionary_combo), _lang3.c_str()); - } -#endif gtk_combo_box_set_active (GTK_COMBO_BOX (dictionary_combo), 0); gtk_widget_show_all (dictionary_combo); } diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index f296ad030..be69635e8 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -163,23 +163,14 @@ GlyphComboBox::GlyphComboBox(){ void GlyphComboBox::update(SPFont* spfont){ if (!spfont) return -//TODO: figure out why do we need to append_text("") before clearing items properly... +//TODO: figure out why do we need to append("") before clearing items properly... -#if WITH_GTKMM_2_24 this->append(""); //Gtk is refusing to clear the combobox when I comment out this line this->remove_all(); -#else - this->append_text(""); //Gtk is refusing to clear the combobox when I comment out this line - this->clear_items(); -#endif for(SPObject* node = spfont->children; node; node=node->next){ if (SP_IS_GLYPH(node)){ -#if WITH_GTKMM_2_24 this->append((static_cast(node))->unicode); -#else - this->append_text((static_cast(node))->unicode); -#endif } } } diff --git a/src/ui/dialog/symbols.cpp b/src/ui/dialog/symbols.cpp index 4c3a406f0..9d4ab5d8a 100644 --- a/src/ui/dialog/symbols.cpp +++ b/src/ui/dialog/symbols.cpp @@ -103,11 +103,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : table->attach(*Gtk::manage(labelSet),0,1,row,row+1,Gtk::SHRINK,Gtk::SHRINK); symbolSet = new Gtk::ComboBoxText(); // Fill in later -#if WITH_GTKMM_2_24 symbolSet->append(_("Current Document")); -#else - symbolSet->append_text(_("Current Document")); -#endif symbolSet->set_active_text(_("Current Document")); table->attach(*Gtk::manage(symbolSet),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); @@ -151,11 +147,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : const gchar *scales[] = {_("Fit"), _("Fit to width"), _("Fit to height"), "0.1", "0.2", "0.5", "1.0", "2.0", "5.0", NULL}; for( int i = 0; scales[i]; ++i ) { -#if WITH_GTKMM_2_24 previewScale->append(scales[i]); -#else - previewScale->append_text(scales[i]); -#endif } previewScale->set_active_text(scales[0]); table->attach(*Gtk::manage(previewScale),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); @@ -173,12 +165,7 @@ SymbolsDialog::SymbolsDialog( gchar const* prefsPath ) : previewSize = new Gtk::ComboBoxText(); const gchar *sizes[] = {"16", "24", "32", "48", "64", NULL}; for( int i = 0; sizes[i]; ++i ) { -#if WITH_GTKMM_2_24 previewSize->append(sizes[i]); -#else - previewSize->append_text(sizes[i]); -#endif - } previewSize->set_active_text(sizes[2]); table->attach(*Gtk::manage(previewSize),1,2,row,row+1,Gtk::FILL|Gtk::EXPAND,Gtk::SHRINK); @@ -333,11 +320,7 @@ void SymbolsDialog::get_symbols() { SPDocument* symbol_doc = SPDocument::createNewDoc( fullname, FALSE ); if( symbol_doc ) { symbolSets[Glib::ustring(filename)]= symbol_doc; -#if WITH_GTKMM_2_24 symbolSet->append(filename); -#else - symbolSet->append_text(filename); -#endif } } g_free( fullname ); diff --git a/src/ui/dialog/text-edit.cpp b/src/ui/dialog/text-edit.cpp index 033571bb4..6696db083 100644 --- a/src/ui/dialog/text-edit.cpp +++ b/src/ui/dialog/text-edit.cpp @@ -106,30 +106,12 @@ TextEdit::TextEdit() GtkWidget *px = sp_icon_new( Inkscape::ICON_SIZE_SMALL_TOOLBAR, INKSCAPE_ICON("text_line_spacing") ); layout_hbox.pack_start(*Gtk::manage(Glib::wrap(px)), false, false); -/* -This would introduce dependency on gtk version 2.24 which is currently not available in -Trisquel GNU/Linux 4.5.1 (released on May 25th, 2011) -This conditional and its #else block can be deleted in the future. -*/ -#if GTK_CHECK_VERSION(2, 24,0) spacing_combo = gtk_combo_box_text_new_with_entry (); -#else - spacing_combo = gtk_combo_box_entry_new_text (); -#endif gtk_widget_set_size_request (spacing_combo, 90, -1); const gchar *spacings[] = {"50%", "80%", "90%", "100%", "110%", "120%", "130%", "140%", "150%", "200%", "300%", NULL}; for (int i = 0; spacings[i]; i++) { -/* -This would introduce dependency on gtk version 2.24 which is currently not available in -Trisquel GNU/Linux 4.5.1 (released on May 25th, 2011) -This conditional and its #else block can be deleted in the future. -*/ -#if GTK_CHECK_VERSION(2, 24,0) gtk_combo_box_text_append_text((GtkComboBoxText *) spacing_combo, spacings[i]); -#else - gtk_combo_box_append_text((GtkComboBox *) spacing_combo, spacings[i]); -#endif } gtk_widget_set_tooltip_text (px, _("Spacing between lines (percent of font size)")); @@ -505,16 +487,7 @@ SPCSSAttr *TextEdit::getTextStyle () // Note that CSS 1.1 does not support line-height; we set it for consistency, but also set // sodipodi:linespacing for backwards compatibility; in 1.2 we use line-height for flowtext -/* -This would introduce dependency on gtk version 2.24 which is currently not available in -Trisquel GNU/Linux 4.5.1 (released on May 25th, 2011) -This conditional and its #else block can be deleted in the future. -*/ -#if GTK_CHECK_VERSION(2, 24,0) const gchar *sstr = gtk_combo_box_text_get_active_text ((GtkComboBoxText *) spacing_combo); -#else - const gchar *sstr = gtk_entry_get_text ((GtkEntry *) (gtk_bin_get_child (GTK_BIN (spacing_combo)))); -#endif sp_repr_css_set_property (css, "line-height", sstr); return css; diff --git a/src/ui/widget/frame.cpp b/src/ui/widget/frame.cpp index b2968f806..eaa4336bb 100644 --- a/src/ui/widget/frame.cpp +++ b/src/ui/widget/frame.cpp @@ -56,9 +56,7 @@ Frame::set_label(const Glib::ustring &label_text, gboolean label_bold /*= TRUE*/ void Frame::set_padding (guint padding_top, guint padding_bottom, guint padding_left, guint padding_right) { -#if WITH_GTKMM_2_24 _alignment.set_padding(padding_top, padding_bottom, padding_left, padding_right); -#endif } Gtk::Label const * diff --git a/src/ui/widget/gimpspinscale.c b/src/ui/widget/gimpspinscale.c index df39b9644..222a8aa1d 100644 --- a/src/ui/widget/gimpspinscale.c +++ b/src/ui/widget/gimpspinscale.c @@ -432,12 +432,7 @@ static gboolean gdk_cairo_region (cr, event->region); cairo_clip (cr); -#if GTK_CHECK_VERSION(2, 24,0) w = gdk_window_get_width (event->window); -#else - gdk_drawable_get_size (event->window, &w, NULL); -#endif - #endif cairo_set_line_width (cr, 1.0); @@ -687,12 +682,7 @@ gimp_spin_scale_change_value (GtkWidget *widget, gimp_spin_scale_get_limits (GIMP_SPIN_SCALE (widget), &lower, &upper); -#if GTK_CHECK_VERSION(2, 24,0) width = gdk_window_get_width (text_window); -#else - gdk_drawable_get_size (text_window, &width, NULL); -#endif - #endif diff --git a/src/ui/widget/preferences-widget.cpp b/src/ui/widget/preferences-widget.cpp index b793893c7..e7e317d11 100644 --- a/src/ui/widget/preferences-widget.cpp +++ b/src/ui/widget/preferences-widget.cpp @@ -378,12 +378,7 @@ ZoomCorrRuler::redraw() { Glib::RefPtr window = get_window(); Cairo::RefPtr cr = window->create_cairo_context(); -#if WITH_GTKMM_2_24 int w = window->get_width(); -#else - int w, h; - window->get_size(w, h); -#endif _drawing_width = w - _border * 2; cr->set_source_rgb(1.0, 1.0, 1.0); @@ -597,11 +592,7 @@ void PrefCombo::init(Glib::ustring const &prefs_path, for (int i = 0 ; i < num_items; ++i) { -#if WITH_GTKMM_2_24 this->append(labels[i]); -#else - this->append_text(labels[i]); -#endif _values.push_back(values[i]); if (value == values[i]) row = i; @@ -623,11 +614,7 @@ void PrefCombo::init(Glib::ustring const &prefs_path, for (int i = 0 ; i < num_items; ++i) { -#if WITH_GTKMM_2_24 this->append(labels[i]); -#else - this->append_text(labels[i]); -#endif _ustr_values.push_back(values[i]); if (value == values[i]) row = i; diff --git a/src/ui/widget/unit-menu.cpp b/src/ui/widget/unit-menu.cpp index 86e8c9e58..18b7bcab9 100644 --- a/src/ui/widget/unit-menu.cpp +++ b/src/ui/widget/unit-menu.cpp @@ -34,11 +34,7 @@ bool UnitMenu::setUnitType(UnitType unit_type) UnitTable::UnitMap::iterator iter = m.begin(); while(iter != m.end()) { Glib::ustring text = (*iter).first; -#if WITH_GTKMM_2_24 append(text); -#else - append_text(text); -#endif ++iter; } _type = unit_type; @@ -49,11 +45,7 @@ bool UnitMenu::setUnitType(UnitType unit_type) bool UnitMenu::resetUnitType(UnitType unit_type) { -#if WITH_GTKMM_2_24 - remove_all(); -#else - clear_items(); -#endif + remove_all(); return setUnitType(unit_type); } @@ -61,11 +53,7 @@ bool UnitMenu::resetUnitType(UnitType unit_type) void UnitMenu::addUnit(Unit const& u) { _unit_table.addUnit(u, false); -#if WITH_GTKMM_2_24 append(u.abbr); -#else - append_text(u.abbr); -#endif } Unit UnitMenu::getUnit() const -- cgit v1.2.3 From 083e48b0f1e09b0f9056c6cda5a6f344a457583b Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Tue, 27 Nov 2012 23:31:10 +0000 Subject: GTK+ 3: Migrate to GdkRGBA (bzr r11910) --- src/ui/dialog/filter-effects-dialog.cpp | 94 ++++++++++++++++++++++++++++++++- src/ui/widget/gimpspinscale.c | 18 ++++--- 2 files changed, 103 insertions(+), 9 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 9a430114d..ddafcd481 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1660,8 +1660,30 @@ bool FilterEffectsDialog::PrimitiveList::on_draw(const Cairo::RefPtrset_line_width(1.0); - // TODO: Use Gtk::StyleContext instead +#if GTK_CHECK_VERSION(3,0,0) + GtkStyleContext *sc = gtk_widget_get_style_context(GTK_WIDGET(gobj())); + GdkRGBA bg_color, fg_color; + gtk_style_context_get_background_color(sc, GTK_STATE_FLAG_NORMAL, &bg_color); + gtk_style_context_get_color(sc, GTK_STATE_FLAG_NORMAL, &fg_color); + + GdkRGBA mid_color = {(bg_color.red + fg_color.red)/2.0, + (bg_color.green + fg_color.green)/2.0, + (bg_color.blue + fg_color.blue)/2.0, + (bg_color.alpha + fg_color.alpha)/2.0}; + + GdkRGBA bg_color_active, fg_color_active; + gtk_style_context_get_background_color(sc, GTK_STATE_FLAG_ACTIVE, &bg_color_active); + gtk_style_context_get_color(sc, GTK_STATE_FLAG_ACTIVE, &fg_color_active); + + GdkRGBA mid_color_active = {(bg_color_active.red + fg_color_active.red)/2.0, + (bg_color_active.green + fg_color_active.green)/2.0, + (bg_color_active.blue + fg_color_active.blue)/2.0, + (bg_color_active.alpha + fg_color_active.alpha)/2.0}; + + GdkRGBA black = {0,0,0,1}; +#else GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(gobj())); +#endif SPFilterPrimitive* prim = get_selected(); int row_count = get_model()->children().size(); @@ -1680,13 +1702,25 @@ bool FilterEffectsDialog::PrimitiveList::on_draw(const Cairo::RefPtrsave(); cr->rectangle(x, 0, get_input_type_width(), vis.get_height()); +#if GTK_CHECK_VERSION(3,0,0) + gdk_cairo_set_source_rgba(cr->cobj(), &bg_color); + cr->fill_preserve(); + + gdk_cairo_set_source_rgba(cr->cobj(), &fg_color); +#else gdk_cairo_set_source_color(cr->cobj(), &(style->bg[GTK_STATE_NORMAL])); cr->fill_preserve(); gdk_cairo_set_source_color(cr->cobj(), &(style->text[GTK_STATE_NORMAL])); +#endif cr->move_to(x+get_input_type_width(), 0); cr->rotate_degrees(90); _vertical_layout->show_in_cairo_context(cr); + +#if GTK_CHECK_VERSION(3,0,0) + gdk_cairo_set_source_rgba(cr->cobj(), &mid_color); +#else gdk_cairo_set_source_color(cr->cobj(), &(style->dark[GTK_STATE_NORMAL])); +#endif cr->move_to(x, 0); cr->line_to(x, vis.get_height()); cr->stroke(); @@ -1707,7 +1741,13 @@ bool FilterEffectsDialog::PrimitiveList::on_draw(const Cairo::RefPtrsave(); + +#if GTK_CHECK_VERSION(3,0,0) + gdk_cairo_set_source_rgba(cr->cobj(), &mid_color); +#else gdk_cairo_set_source_color(cr->cobj(), &(style->dark[GTK_STATE_NORMAL])); +#endif + cr->move_to(x, y + h); cr->line_to(outline_x, y + h); // Side outline @@ -1728,10 +1768,17 @@ bool FilterEffectsDialog::PrimitiveList::on_draw(const Cairo::RefPtrsave(); +#if GTK_CHECK_VERSION(3,0,0) + gdk_cairo_set_source_rgba(cr->cobj(), + inside && mask & GDK_BUTTON1_MASK ? + &mid_color : + &mid_color_active); +#else gdk_cairo_set_source_color(cr->cobj(), inside && mask & GDK_BUTTON1_MASK ? &(style->dark[GTK_STATE_NORMAL]) : &(style->dark[GTK_STATE_ACTIVE])); +#endif draw_connection_node(cr, con_poly, inside); @@ -1751,10 +1798,17 @@ bool FilterEffectsDialog::PrimitiveList::on_draw(const Cairo::RefPtrsave(); +#if GTK_CHECK_VERSION(3,0,0) + gdk_cairo_set_source_rgba(cr->cobj(), + inside && mask & GDK_BUTTON1_MASK ? + &mid_color : + &mid_color_active); +#else gdk_cairo_set_source_color(cr->cobj(), inside && mask & GDK_BUTTON1_MASK ? &(style->dark[GTK_STATE_NORMAL]) : &(style->dark[GTK_STATE_ACTIVE])); +#endif draw_connection_node(cr, con_poly, inside); @@ -1772,10 +1826,17 @@ bool FilterEffectsDialog::PrimitiveList::on_draw(const Cairo::RefPtrsave(); +#if GTK_CHECK_VERSION(3,0,0) + gdk_cairo_set_source_rgba(cr->cobj(), + inside && mask & GDK_BUTTON1_MASK ? + &mid_color : + &mid_color_active); +#else gdk_cairo_set_source_color(cr->cobj(), inside && mask & GDK_BUTTON1_MASK ? &(style->dark[GTK_STATE_NORMAL]) : &(style->dark[GTK_STATE_ACTIVE])); +#endif draw_connection_node(cr, con_poly, inside); @@ -1790,7 +1851,11 @@ bool FilterEffectsDialog::PrimitiveList::on_draw(const Cairo::RefPtrsave(); +#if GTK_CHECK_VERSION(3,0,0) + gdk_cairo_set_source_rgba(cr->cobj(), &black); +#else gdk_cairo_set_source_color(cr->cobj(), &(style->black)); +#endif cr->move_to(outline_x, con_drag_y); cr->line_to(mx, con_drag_y); cr->line_to(mx, my); @@ -1809,8 +1874,22 @@ void FilterEffectsDialog::PrimitiveList::draw_connection(const Cairo::RefPtrsave(); - // TODO: Use Gtk::StyleContext instead +#if GTK_CHECK_VERSION(3,0,0) + GtkStyleContext *sc = gtk_widget_get_style_context(GTK_WIDGET(gobj())); + + GdkRGBA bg_color, fg_color; + gtk_style_context_get_background_color(sc, GTK_STATE_FLAG_NORMAL, &bg_color); + gtk_style_context_get_color(sc, GTK_STATE_FLAG_NORMAL, &fg_color); + + GdkRGBA mid_color = {(bg_color.red + fg_color.red)/2.0, + (bg_color.green + fg_color.green)/2.0, + (bg_color.blue + fg_color.blue)/2.0, + (bg_color.alpha + fg_color.alpha)/2.0}; + + GdkRGBA black = {0,0,0,1}; +#else GtkStyle *style = gtk_widget_get_style(GTK_WIDGET(gobj())); +#endif int src_id = 0; Gtk::TreeIter res = find_result(input, attr, src_id); @@ -1825,10 +1904,17 @@ void FilterEffectsDialog::PrimitiveList::draw_connection(const Cairo::RefPtrcobj(), &mid_color); + else + gdk_cairo_set_source_rgba(cr->cobj(), &black); +#else if(use_default && is_first) gdk_cairo_set_source_color(cr->cobj(), &(style->dark[GTK_STATE_NORMAL])); else gdk_cairo_set_source_color(cr->cobj(), &(style->black)); +#endif cr->rectangle(end_x-2, y1-2, 5, 5); cr->fill_preserve(); @@ -1856,7 +1942,11 @@ void FilterEffectsDialog::PrimitiveList::draw_connection(const Cairo::RefPtrcobj(), &black); +#else gdk_cairo_set_source_color(cr->cobj(), &(style->black)); +#endif cr->move_to(x1, y1); cr->line_to(x2-fheight/4, y1); cr->line_to(x2, y1-fheight/4); diff --git a/src/ui/widget/gimpspinscale.c b/src/ui/widget/gimpspinscale.c index 222a8aa1d..f9f9a3807 100644 --- a/src/ui/widget/gimpspinscale.c +++ b/src/ui/widget/gimpspinscale.c @@ -408,21 +408,20 @@ static gboolean gimp_spin_scale_expose (GtkWidget *widget, GdkEventExpose *event) #endif { - GimpSpinScalePrivate *private = GET_PRIVATE (widget); - GtkStyle *style = gtk_widget_get_style (widget); - + GimpSpinScalePrivate *private = GET_PRIVATE (widget); #if WITH_GTKMM_3_0 + GtkStyleContext *style = gtk_widget_get_style_context(widget); GtkAllocation allocation; + GdkRGBA color; cairo_save (cr); GTK_WIDGET_CLASS (parent_class)->draw (widget, cr); cairo_restore (cr); gtk_widget_get_allocation (widget, &allocation); - - #else + GtkStyle *style = gtk_widget_get_style (widget); cairo_t *cr; gint w; @@ -499,12 +498,17 @@ static gboolean #if WITH_GTKMM_3_0 cairo_move_to (cr, layout_offset_x, text_area.y + layout_offset_y-3); + + gtk_style_context_get_color (style, gtk_widget_get_state_flags (widget), + &color); + + gdk_cairo_set_source_rgba (cr, &color); #else cairo_move_to (cr, layout_offset_x, layout_offset_y-3); -#endif - + gdk_cairo_set_source_color (cr, &style->text[gtk_widget_get_state (widget)]); +#endif pango_cairo_show_layout (cr, private->layout); } -- cgit v1.2.3 From c31f12ada683e302beb99dbc6eaea5d6d1205ab2 Mon Sep 17 00:00:00 2001 From: John Smith Date: Wed, 28 Nov 2012 09:44:24 +0900 Subject: Fix for 1071421 : Setting swatch as fill/stroke creates new swatches which never go away (bzr r11911) --- src/ui/dialog/swatches.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 9d5a2ac28..43b88e5c6 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -54,6 +54,8 @@ #include "dialog-manager.h" #include "selection.h" #include "verbs.h" +#include "gradient-chemistry.h" +#include "helper/action.h" namespace Inkscape { namespace UI { @@ -142,8 +144,21 @@ static void editGradientImpl( SPDesktop* desktop, SPGradient* gr ) } if (!shown) { - GtkWidget *dialog = sp_gradient_vector_editor_new( gr ); - gtk_widget_show( dialog ); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + if (prefs->getBool("/dialogs/gradienteditor/showlegacy", false)) { + // Legacy gradient dialog + GtkWidget *dialog = sp_gradient_vector_editor_new( gr ); + gtk_widget_show( dialog ); + } else { + // Invoke the gradient tool + Inkscape::Verb *verb = Inkscape::Verb::get( SP_VERB_CONTEXT_GRADIENT ); + if ( verb ) { + SPAction *action = verb->get_action( ( Inkscape::UI::View::View * ) SP_ACTIVE_DESKTOP); + if ( action ) { + sp_action_perform( action, NULL ); + } + } + } } } } @@ -197,20 +212,7 @@ void SwatchesPanelHook::deleteGradient( GtkMenuItem */*menuitem*/, gpointer /*us if ( bounceTarget ) { SwatchesPanel* swp = bouncePanel; SPDesktop* desktop = swp ? swp->getDesktop() : 0; - SPDocument *doc = desktop ? desktop->doc() : 0; - if (doc) { - std::string targetName(bounceTarget->def.descr); - const GSList *gradients = doc->getResourceList("gradient"); - for (const GSList *item = gradients; item; item = item->next) { - SPGradient* grad = SP_GRADIENT(item->data); - if ( targetName == grad->getId() ) { - grad->setSwatch(false); - DocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT, - _("Delete")); - break; - } - } - } + sp_gradient_unset_swatch(desktop, bounceTarget->def.descr); } } -- cgit v1.2.3 From b2b5252360d16fa3a1dd8cc172a2b7a09ba716e4 Mon Sep 17 00:00:00 2001 From: John Smith Date: Fri, 30 Nov 2012 21:11:42 +0900 Subject: Fix for 255792 : Calligraphy tool presets management (bzr r11916) --- src/ui/dialog/calligraphic-profile-rename.cpp | 39 ++++++++++++++++++++++++--- src/ui/dialog/calligraphic-profile-rename.h | 8 +++++- 2 files changed, 43 insertions(+), 4 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/calligraphic-profile-rename.cpp b/src/ui/dialog/calligraphic-profile-rename.cpp index c6633df0b..77a4f4f03 100644 --- a/src/ui/dialog/calligraphic-profile-rename.cpp +++ b/src/ui/dialog/calligraphic-profile-rename.cpp @@ -30,6 +30,8 @@ namespace Dialog { CalligraphicProfileRename::CalligraphicProfileRename() : _applied(false) { + set_title(_("Edit profile")); + Gtk::Box *mainVBox = get_vbox(); _layout_table.set_spacings(4); _layout_table.resize (1, 2); @@ -49,19 +51,27 @@ CalligraphicProfileRename::CalligraphicProfileRename() : _close_button.set_label(Gtk::Stock::CANCEL.id); _close_button.set_can_default(); + _delete_button.set_use_underline(true); + _delete_button.set_label(_("Delete")); + _delete_button.set_can_default(); + _delete_button.set_visible(false); + _apply_button.set_use_underline(true); _apply_button.set_label(_("Save")); _apply_button.set_can_default(); _close_button.signal_clicked() - .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_close)); + .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_close)); + _delete_button.signal_clicked() + .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_delete)); _apply_button.signal_clicked() - .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_apply)); + .connect(sigc::mem_fun(*this, &CalligraphicProfileRename::_apply)); signal_delete_event().connect( sigc::bind_return( sigc::hide(sigc::mem_fun(*this, &CalligraphicProfileRename::_close)), true ) ); add_action_widget(_close_button, Gtk::RESPONSE_CLOSE); + add_action_widget(_delete_button, Gtk::RESPONSE_DELETE_EVENT); add_action_widget(_apply_button, Gtk::RESPONSE_APPLY); _apply_button.grab_default(); @@ -73,6 +83,15 @@ void CalligraphicProfileRename::_apply() { _profile_name = _profile_name_entry.get_text(); _applied = true; + _deleted = false; + _close(); +} + +void CalligraphicProfileRename::_delete() +{ + _profile_name = _profile_name_entry.get_text(); + _applied = true; + _deleted = true; _close(); } @@ -81,11 +100,25 @@ void CalligraphicProfileRename::_close() this->Gtk::Dialog::hide(); } -void CalligraphicProfileRename::show(SPDesktop *desktop) +void CalligraphicProfileRename::show(SPDesktop *desktop, const Glib::ustring profile_name) { CalligraphicProfileRename &dial = instance(); dial._applied=false; + dial._deleted=false; dial.set_modal(true); + + dial._profile_name = profile_name; + dial._profile_name_entry.set_text(profile_name); + + if (profile_name.empty()) { + dial.set_title(_("Add profile")); + dial._delete_button.set_visible(false); + + } else { + dial.set_title(_("Edit profile")); + dial._delete_button.set_visible(true); + } + desktop->setWindowTransient (dial.gobj()); dial.property_destroy_with_parent() = true; // dial.Gtk::Dialog::show(); diff --git a/src/ui/dialog/calligraphic-profile-rename.h b/src/ui/dialog/calligraphic-profile-rename.h index f0eb0b491..8fe82d7bb 100644 --- a/src/ui/dialog/calligraphic-profile-rename.h +++ b/src/ui/dialog/calligraphic-profile-rename.h @@ -29,10 +29,13 @@ public: return "CalligraphicProfileRename"; } - static void show(SPDesktop *desktop); + static void show(SPDesktop *desktop, const Glib::ustring profile_name); static bool applied() { return instance()._applied; } + static bool deleted() { + return instance()._deleted; + } static Glib::ustring getProfileName() { return instance()._profile_name; } @@ -40,14 +43,17 @@ public: protected: void _close(); void _apply(); + void _delete(); Gtk::Label _profile_name_label; Gtk::Entry _profile_name_entry; Gtk::Table _layout_table; Gtk::Button _close_button; + Gtk::Button _delete_button; Gtk::Button _apply_button; Glib::ustring _profile_name; bool _applied; + bool _deleted; private: static CalligraphicProfileRename &instance() { static CalligraphicProfileRename instance_; -- cgit v1.2.3