summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2009-11-29 19:01:07 +0000
committerTed Gould <ted@gould.cx>2009-11-29 19:01:07 +0000
commit29d3c0b15028e61f176df3a75189bf0959d0d03e (patch)
tree727afe596c693a9bdd098d72618abd9ceb0d1969 /src/widgets
parentAdd the build dir dbus directory to grab some headerfiles for distcheck. (diff)
parenthopefully fix build on linux (diff)
downloadinkscape-29d3c0b15028e61f176df3a75189bf0959d0d03e.tar.gz
inkscape-29d3c0b15028e61f176df3a75189bf0959d0d03e.zip
Merging in from trunk
(bzr r8254.1.37)
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/desktop-widget.cpp42
-rw-r--r--src/widgets/gradient-vector.cpp44
-rw-r--r--src/widgets/icon.cpp2
-rw-r--r--src/widgets/mappings.xml2
-rw-r--r--src/widgets/sp-color-icc-selector.cpp35
-rw-r--r--src/widgets/toolbox.cpp65
6 files changed, 128 insertions, 62 deletions
diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp
index f5e153a8e..e3bf1ae9c 100644
--- a/src/widgets/desktop-widget.cpp
+++ b/src/widgets/desktop-widget.cpp
@@ -112,6 +112,7 @@ static void sp_dtw_zoom_200 (GtkMenuItem *item, gpointer data);
static void sp_dtw_zoom_page (GtkMenuItem *item, gpointer data);
static void sp_dtw_zoom_drawing (GtkMenuItem *item, gpointer data);
static void sp_dtw_zoom_selection (GtkMenuItem *item, gpointer data);
+static void sp_dtw_sticky_zoom_toggled (GtkMenuItem *item, gpointer data);
SPViewWidgetClass *dtw_parent_class;
@@ -379,6 +380,7 @@ sp_desktop_widget_init (SPDesktopWidget *dtw)
dtw->tt);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dtw->sticky_zoom), prefs->getBool("/options/stickyzoom/value"));
gtk_box_pack_start (GTK_BOX (dtw->vscrollbar_box), dtw->sticky_zoom, FALSE, FALSE, 0);
+ g_signal_connect (G_OBJECT (dtw->sticky_zoom), "toggled", G_CALLBACK (sp_dtw_sticky_zoom_toggled), dtw);
dtw->vadj = (GtkAdjustment *) gtk_adjustment_new (0.0, -4000.0, 4000.0, 10.0, 100.0, 4.0);
dtw->vscrollbar = gtk_vscrollbar_new (GTK_ADJUSTMENT (dtw->vadj));
gtk_box_pack_start (GTK_BOX (dtw->vscrollbar_box), dtw->vscrollbar, TRUE, TRUE, 0);
@@ -499,10 +501,10 @@ sp_desktop_widget_init (SPDesktopWidget *dtw)
eventbox = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (eventbox), dtw->coord_status);
gtk_tooltips_set_tip (dtw->tt, eventbox, _("Cursor coordinates"), NULL);
- GtkWidget *label_x = gtk_label_new("X:");
+ GtkWidget *label_x = gtk_label_new(_("X:"));
gtk_misc_set_alignment (GTK_MISC(label_x), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(dtw->coord_status), label_x, 1,2, 0,1, GTK_FILL, GTK_FILL, 0, 0);
- GtkWidget *label_y = gtk_label_new("Y:");
+ GtkWidget *label_y = gtk_label_new(_("Y:"));
gtk_misc_set_alignment (GTK_MISC(label_y), 0.0, 0.5);
gtk_table_attach(GTK_TABLE(dtw->coord_status), label_y, 1,2, 1,2, GTK_FILL, GTK_FILL, 0, 0);
dtw->coord_status_x = gtk_label_new(NULL);
@@ -513,7 +515,7 @@ sp_desktop_widget_init (SPDesktopWidget *dtw)
gtk_misc_set_alignment (GTK_MISC(dtw->coord_status_y), 1.0, 0.5);
gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->coord_status_x, 2,3, 0,1, GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->coord_status_y, 2,3, 1,2, GTK_FILL, GTK_FILL, 0, 0);
- gtk_table_attach(GTK_TABLE(dtw->coord_status), gtk_label_new("Z:"), 3,4, 0,2, GTK_FILL, GTK_FILL, 0, 0);
+ gtk_table_attach(GTK_TABLE(dtw->coord_status), gtk_label_new(_("Z:")), 3,4, 0,2, GTK_FILL, GTK_FILL, 0, 0);
gtk_table_attach(GTK_TABLE(dtw->coord_status), dtw->zoom_status, 4,5, 0,2, GTK_FILL, GTK_FILL, 0, 0);
sp_set_font_size_smaller (dtw->coord_status);
gtk_box_pack_end (GTK_BOX (statusbar_tail), eventbox, FALSE, FALSE, 1);
@@ -553,6 +555,8 @@ sp_desktop_widget_init (SPDesktopWidget *dtw)
gtk_box_pack_start (GTK_BOX (dtw->statusbar), dtw->select_status_eventbox, TRUE, TRUE, 0);
gtk_widget_show_all (dtw->vbox);
+
+ gtk_widget_grab_focus (GTK_WIDGET(dtw->canvas));
}
/**
@@ -659,7 +663,9 @@ sp_desktop_widget_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
/* Find new visible area */
Geom::Rect newarea = dtw->desktop->get_display_area();
/* Calculate adjusted zoom */
- zoom *= sqrt(newarea.area() / area.area());
+ double oldshortside = MIN( area.width(), area.height());
+ double newshortside = MIN(newarea.width(), newarea.height());
+ zoom *= newshortside / oldshortside;
}
dtw->desktop->zoom_absolute(area.midpoint()[Geom::X], area.midpoint()[Geom::Y], zoom);
@@ -888,7 +894,7 @@ SPDesktopWidget::shutdown()
_("<span weight=\"bold\" size=\"larger\">The file \"%s\" was saved with a format (%s) that may cause data loss!</span>\n\n"
"Do you want to save this file as an Inkscape SVG?"),
SP_DOCUMENT_NAME(doc),
- Inkscape::Extension::db.get(sp_document_repr_root(doc)->attribute("inkscape:output_extension"))->get_name());
+ SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE);
// fix for bug 1767940:
GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(GTK_MESSAGE_DIALOG(dialog)->label), GTK_CAN_FOCUS);
@@ -915,7 +921,7 @@ SPDesktopWidget::shutdown()
Gtk::Window *window = (Gtk::Window*)gtk_object_get_data (GTK_OBJECT(this), "window");
- if (sp_file_save_dialog(*window, doc)) {
+ if (sp_file_save_dialog(*window, doc, Inkscape::Extension::FILE_SAVE_METHOD_INKSCAPE_SVG)) {
sp_document_unref(doc);
} else { // save dialog cancelled or save failed
sp_document_unref(doc);
@@ -1277,11 +1283,19 @@ SPDesktopWidget::setToolboxFocusTo (const gchar* label)
void
SPDesktopWidget::setToolboxAdjustmentValue (gchar const *id, double value)
{
+ GtkAdjustment *a = NULL;
gpointer hb = sp_search_by_data_recursive (aux_toolbox, (gpointer) id);
- if (hb && GTK_IS_WIDGET(hb) && GTK_IS_SPIN_BUTTON(hb)) {
- GtkAdjustment *a = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON(hb));
- gtk_adjustment_set_value (a, value);
+ if (hb && GTK_IS_WIDGET(hb)) {
+ if (GTK_IS_SPIN_BUTTON(hb))
+ a = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON(hb));
+ else if (GTK_IS_RANGE(hb))
+ a = gtk_range_get_adjustment (GTK_RANGE(hb));
}
+
+ if (a)
+ gtk_adjustment_set_value (a, value);
+ else
+ g_warning ("Could not find GtkAdjustment for %s\n", id);
}
void
@@ -1325,8 +1339,7 @@ sp_desktop_widget_new (SPNamedView *namedview)
dtw->desktop = new SPDesktop();
dtw->stub = new SPDesktopWidget::WidgetStub (dtw);
- dtw->desktop->registerEditWidget (dtw->stub);
- dtw->desktop->init (namedview, dtw->canvas);
+ dtw->desktop->init (namedview, dtw->canvas, dtw->stub);
inkscape_add_desktop (dtw->desktop);
// Add the shape geometry to libavoid for autorouting connectors.
@@ -1613,6 +1626,13 @@ sp_dtw_zoom_selection (GtkMenuItem */*item*/, gpointer data)
static_cast<SPDesktop*>(data)->zoom_selection();
}
+static void
+sp_dtw_sticky_zoom_toggled (GtkMenuItem *, gpointer data)
+{
+ SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(data);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setBool("/options/stickyzoom/value", SP_BUTTON_IS_DOWN(dtw->sticky_zoom));
+}
void
diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp
index 1f0c07754..c884604a2 100644
--- a/src/widgets/gradient-vector.cpp
+++ b/src/widgets/gradient-vector.cpp
@@ -793,7 +793,6 @@ sp_gradient_vector_widget_new (SPGradient *gradient, SPStop *select_stop)
gtk_widget_show (w);
gtk_box_pack_start (GTK_BOX (vb), w, TRUE, TRUE, PAD);
- gtk_object_set_data (GTK_OBJECT (vb), "gradient", gradient);
sp_repr_add_listener (SP_OBJECT_REPR(gradient), &grad_edit_dia_repr_events, vb);
GtkTooltips *tt = gtk_tooltips_new ();
@@ -1013,6 +1012,8 @@ sp_gradient_vector_widget_load_gradient (GtkWidget *widget, SPGradient *gradient
g_object_set_data (G_OBJECT (widget), "gradient", gradient);
if (gradient) {
+ gtk_widget_set_sensitive (widget, TRUE);
+
sp_gradient_ensure_vector (gradient);
GtkOptionMenu *mnu = (GtkOptionMenu *)g_object_get_data (G_OBJECT(widget), "stopmenu");
@@ -1026,22 +1027,23 @@ sp_gradient_vector_widget_load_gradient (GtkWidget *widget, SPGradient *gradient
SPColor color( SP_RGBA32_R_F (c), SP_RGBA32_G_F (c), SP_RGBA32_B_F (c) );
// set color
csel->base->setColor( color );
- }
- /* Fill preview */
- GtkWidget *w = static_cast<GtkWidget *>(g_object_get_data(G_OBJECT(widget), "preview"));
- sp_gradient_image_set_gradient (SP_GRADIENT_IMAGE (w), gradient);
+ /* Fill preview */
+ GtkWidget *w = static_cast<GtkWidget *>(g_object_get_data(G_OBJECT(widget), "preview"));
+ sp_gradient_image_set_gradient (SP_GRADIENT_IMAGE (w), gradient);
- GtkWidget *mnu = static_cast<GtkWidget *>(g_object_get_data(G_OBJECT(widget), "stopmenu"));
- update_stop_list (GTK_WIDGET(mnu), gradient, NULL);
+ update_stop_list (GTK_WIDGET(mnu), gradient, NULL);
- // Once the user edits a gradient, it stops being auto-collectable
- if (SP_OBJECT_REPR(gradient)->attribute("inkscape:collect")) {
- SPDocument *document = SP_OBJECT_DOCUMENT (gradient);
- bool saved = sp_document_get_undo_sensitive(document);
- sp_document_set_undo_sensitive (document, false);
- SP_OBJECT_REPR(gradient)->setAttribute("inkscape:collect", NULL);
- sp_document_set_undo_sensitive (document, saved);
+ // Once the user edits a gradient, it stops being auto-collectable
+ if (SP_OBJECT_REPR(gradient)->attribute("inkscape:collect")) {
+ SPDocument *document = SP_OBJECT_DOCUMENT (gradient);
+ bool saved = sp_document_get_undo_sensitive(document);
+ sp_document_set_undo_sensitive (document, false);
+ SP_OBJECT_REPR(gradient)->setAttribute("inkscape:collect", NULL);
+ sp_document_set_undo_sensitive (document, saved);
+ }
+ } else { // no gradient, disable everything
+ gtk_widget_set_sensitive (widget, FALSE);
}
blocked = FALSE;
@@ -1082,10 +1084,18 @@ sp_gradient_vector_widget_destroy (GtkObject *object, gpointer /*data*/)
gradient = (GObject*)g_object_get_data (G_OBJECT (object), "gradient");
- if (gradient && SP_OBJECT_REPR(gradient)) {
- /* Remove signals connected to us */
- /* fixme: may use _connect_while_alive as well */
+ sigc::connection *release_connection = (sigc::connection *)g_object_get_data(G_OBJECT(object), "gradient_release_connection");
+ sigc::connection *modified_connection = (sigc::connection *)g_object_get_data(G_OBJECT(object), "gradient_modified_connection");
+
+ if (gradient) {
+ g_assert( release_connection != NULL );
+ g_assert( modified_connection != NULL );
+ release_connection->disconnect();
+ modified_connection->disconnect();
sp_signal_disconnect_by_data (gradient, object);
+ }
+
+ if (gradient && SP_OBJECT_REPR(gradient)) {
sp_repr_remove_listener_by_data (SP_OBJECT_REPR(gradient), object);
}
}
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index 6be4b49b3..5824b102c 100644
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
@@ -381,7 +381,7 @@ static void setupLegacyNaming() {
legacyNames["text-unkern"] ="remove_manual_kerns";
legacyNames["help-keyboard-shortcuts"] ="help_keys";
legacyNames["help-contents"] ="help_tutorials";
- legacyNames["inkscape"] ="inkscape_options";
+ legacyNames["inkscape-logo"] ="inkscape_options";
legacyNames["dialog-memory"] ="about_memory";
legacyNames["tool-pointer"] ="draw_select";
legacyNames["tool-node-editor"] ="draw_node";
diff --git a/src/widgets/mappings.xml b/src/widgets/mappings.xml
index f142c450c..2de3ff545 100644
--- a/src/widgets/mappings.xml
+++ b/src/widgets/mappings.xml
@@ -113,7 +113,7 @@
<!-- help menu -->
<remap id='help_keys' newid='help-keyboard-shortcuts'/>
<remap id='help_tutorials' newid='help-contents'/>
- <remap id='inkscape_options' newid='inkscape'/>
+ <remap id='inkscape_options' newid='inkscape-logo'/>
<remap id='about_memory' newid='dialog-memory'/>
<!-- tools -->
diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp
index b18290923..a10d2380c 100644
--- a/src/widgets/sp-color-icc-selector.cpp
+++ b/src/widgets/sp-color-icc-selector.cpp
@@ -3,7 +3,7 @@
#endif
#include <math.h>
#include <gtk/gtkbutton.h>
-#include <gtk/gtkcombobox.h>
+#include <gtk/gtk.h>
#include <gtk/gtksignal.h>
#include <gtk/gtklabel.h>
#include <gtk/gtktable.h>
@@ -303,7 +303,7 @@ void ColorICCSelector::init()
_profileSel = gtk_combo_box_new_text();
- gtk_combo_box_append_text( GTK_COMBO_BOX(_profileSel), "<none>" );
+ gtk_combo_box_append_text( GTK_COMBO_BOX(_profileSel), _("<none>") );
gtk_widget_show( _profileSel );
gtk_combo_box_set_active( GTK_COMBO_BOX(_profileSel), 0 );
gtk_table_attach( GTK_TABLE(t), _profileSel, 1, 2, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD );
@@ -576,7 +576,7 @@ void ColorICCSelector::_profilesChanged( std::string const & name )
gtk_combo_box_remove_text( combo, 0 );
}
- gtk_combo_box_append_text( combo, "<none>");
+ gtk_combo_box_append_text( combo, _("<none>"));
gtk_combo_box_set_active( combo, 0 );
@@ -637,14 +637,17 @@ void ColorICCSelector::_colorChanged()
tmp[i] = val * 0x0ffff;
}
guchar post[4] = {0,0,0,0};
- cmsDoTransform( _prof->getTransfToSRGB8(), tmp, post, 1 );
- guint32 other = SP_RGBA32_U_COMPOSE(post[0], post[1], post[2], 255 );
- if ( other != _color.toRGBA32(255) ) {
- _fixupNeeded = other;
- gtk_widget_set_sensitive( _fixupBtn, TRUE );
+ cmsHTRANSFORM trans = _prof->getTransfToSRGB8();
+ if ( trans ) {
+ cmsDoTransform( trans, tmp, post, 1 );
+ guint32 other = SP_RGBA32_U_COMPOSE(post[0], post[1], post[2], 255 );
+ if ( other != _color.toRGBA32(255) ) {
+ _fixupNeeded = other;
+ gtk_widget_set_sensitive( _fixupBtn, TRUE );
#ifdef DEBUG_LCMS
- g_message("Color needs to change 0x%06x to 0x%06x", _color.toRGBA32(255) >> 8, other >> 8 );
+ g_message("Color needs to change 0x%06x to 0x%06x", _color.toRGBA32(255) >> 8, other >> 8 );
#endif // DEBUG_LCMS
+ }
}
}
#else
@@ -753,7 +756,7 @@ void ColorICCSelector::_updateSliders( gint ignore )
gtk_adjustment_set_value( _fooAdj[i], val );
}
- if ( _prof->getTransfToSRGB8() ) {
+ if ( _prof && _prof->getTransfToSRGB8() ) {
for ( guint i = 0; i < _profChannelCount; i++ ) {
if ( static_cast<gint>(i) != ignore ) {
icUInt16Number* scratch = getScratch();
@@ -773,8 +776,11 @@ void ColorICCSelector::_updateSliders( gint ignore )
}
}
- cmsDoTransform( _prof->getTransfToSRGB8(), scratch, _fooMap[i], 1024 );
- sp_color_slider_set_map( SP_COLOR_SLIDER(_fooSlider[i]), _fooMap[i] );
+ cmsHTRANSFORM trans = _prof->getTransfToSRGB8();
+ if ( trans ) {
+ cmsDoTransform( trans, scratch, _fooMap[i], 1024 );
+ sp_color_slider_set_map( SP_COLOR_SLIDER(_fooSlider[i]), _fooMap[i] );
+ }
}
}
}
@@ -840,7 +846,10 @@ void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICC
}
guchar post[4] = {0,0,0,0};
- cmsDoTransform( iccSelector->_prof->getTransfToSRGB8(), tmp, post, 1 );
+ cmsHTRANSFORM trans = iccSelector->_prof->getTransfToSRGB8();
+ if ( trans ) {
+ cmsDoTransform( trans, tmp, post, 1 );
+ }
SPColor other( SP_RGBA32_U_COMPOSE(post[0], post[1], post[2], 255) );
other.icc = new SVGICCColor();
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 9ac009a84..e0fe9bfd1 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -2384,8 +2384,10 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl
SPDesktop *desktop = (SPDesktop *) g_object_get_data( dataKludge, "desktop" );
if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setDouble("/tools/shapes/star/proportion", adj->value);
+ if (!IS_NAN(adj->value)) {
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->setDouble("/tools/shapes/star/proportion", adj->value);
+ }
}
// quit if run by the attr_changed listener
@@ -4927,7 +4929,7 @@ sp_arctb_startend_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *v
if (sp_document_get_undo_sensitive(sp_desktop_document(desktop))) {
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setDouble(Glib::ustring("/tools/shapes/arc") + value_name, (adj->value * M_PI)/ 180);
+ prefs->setDouble(Glib::ustring("/tools/shapes/arc/") + value_name, adj->value);
}
// quit if run by the attr_changed listener
@@ -5571,7 +5573,7 @@ static void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActi
gtk_list_store_set( model, &iter,
0, _("All inactive"),
1, _("No geometric tool is active"),
- 2, _("draw-geometry-inactive"),
+ 2, "draw-geometry-inactive",
-1 );
Inkscape::LivePathEffect::EffectType type;
@@ -5695,7 +5697,7 @@ static void sp_lpetool_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActi
static void sp_erc_width_value_changed( GtkAdjustment *adj, GObject *tbl )
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setDouble( "/tools/eraser/width", adj->value * 0.01 );
+ prefs->setDouble( "/tools/eraser/width", adj->value );
update_presets_list(tbl);
}
@@ -5735,7 +5737,7 @@ static void sp_eraser_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActio
GTK_WIDGET(desktop->canvas), NULL, holder, TRUE, "altx-eraser",
1, 100, 1.0, 10.0,
labels, values, G_N_ELEMENTS(labels),
- sp_erc_width_value_changed, 0.01, 0, 100 );
+ sp_erc_width_value_changed, 1, 0);
ege_adjustment_action_set_appearance( eact, TOOLBAR_SLIDER_HINT );
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
@@ -5939,7 +5941,7 @@ sp_text_toolbox_selection_changed (Inkscape::Selection */*selection*/, GObject *
GtkToggleButton *button = GTK_TOGGLE_BUTTON (g_object_get_data (G_OBJECT (tbl), "style-bold"));
gboolean active = gtk_toggle_button_get_active (button);
- gboolean check = (query->font_weight.computed >= SP_CSS_FONT_WEIGHT_700);
+ gboolean check = ((query->font_weight.computed >= SP_CSS_FONT_WEIGHT_700) && (query->font_weight.computed != SP_CSS_FONT_WEIGHT_NORMAL) && (query->font_weight.computed != SP_CSS_FONT_WEIGHT_LIGHTER));
if (active != check)
{
@@ -6087,8 +6089,8 @@ sp_text_toolbox_family_changed (GtkComboBoxEntry *,
// If querying returned nothing, set the default style of the tool (for new texts)
if (result_fontspec == QUERY_STYLE_NOTHING)
{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setStyle("/tools/text/style", css);
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ prefs->mergeStyle("/tools/text/style", css);
sp_text_edit_dialog_default_set_insensitive (); //FIXME: Replace trough a verb
}
else
@@ -6162,7 +6164,7 @@ sp_text_toolbox_anchoring_toggled (GtkRadioButton *button,
if (result_numbers == QUERY_STYLE_NOTHING)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setStyle("/tools/text/style", css);
+ prefs->mergeStyle("/tools/text/style", css);
}
sp_style_unref(query);
@@ -6206,17 +6208,31 @@ sp_text_toolbox_style_toggled (GtkToggleButton *button,
fontFromStyle->Unref();
}
+ bool nochange = true;
switch (prop)
{
case 0:
{
if (!fontSpec.empty()) {
newFontSpec = font_factory::Default()->FontSpecificationSetBold(fontSpec, active);
+ if (!newFontSpec.empty()) {
+ // Don't even set the bold if the font didn't exist on the system
+ sp_repr_css_set_property (css, "font-weight", active ? "bold" : "normal" );
+ nochange = false;
+ }
}
- if (fontSpec != newFontSpec) {
- // Don't even set the bold if the font didn't exist on the system
- sp_repr_css_set_property (css, "font-weight", active ? "bold" : "normal" );
+ // set or reset the button according
+ if(nochange) {
+ gboolean check = gtk_toggle_button_get_active (button);
+
+ if (active != check)
+ {
+ g_object_set_data (G_OBJECT (button), "block", gpointer(1));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), active);
+ g_object_set_data (G_OBJECT (button), "block", gpointer(0));
+ }
}
+
break;
}
@@ -6224,10 +6240,21 @@ sp_text_toolbox_style_toggled (GtkToggleButton *button,
{
if (!fontSpec.empty()) {
newFontSpec = font_factory::Default()->FontSpecificationSetItalic(fontSpec, active);
+ if (!newFontSpec.empty()) {
+ // Don't even set the italic if the font didn't exist on the system
+ sp_repr_css_set_property (css, "font-style", active ? "italic" : "normal");
+ nochange = false;
+ }
}
- if (fontSpec != newFontSpec) {
- // Don't even set the italic if the font didn't exist on the system
- sp_repr_css_set_property (css, "font-style", active ? "italic" : "normal");
+ if(nochange) {
+ gboolean check = gtk_toggle_button_get_active (button);
+
+ if (active != check)
+ {
+ g_object_set_data (G_OBJECT (button), "block", gpointer(1));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), active);
+ g_object_set_data (G_OBJECT (button), "block", gpointer(0));
+ }
}
break;
}
@@ -6241,7 +6268,7 @@ sp_text_toolbox_style_toggled (GtkToggleButton *button,
if (result_fontspec == QUERY_STYLE_NOTHING)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setStyle("/tools/text/style", css);
+ prefs->mergeStyle("/tools/text/style", css);
}
sp_style_unref(query);
@@ -6290,7 +6317,7 @@ sp_text_toolbox_orientation_toggled (GtkRadioButton *button,
if (result_numbers == QUERY_STYLE_NOTHING)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setStyle("/tools/text/style", css);
+ prefs->mergeStyle("/tools/text/style", css);
}
sp_desktop_set_style (desktop, css, true, true);
@@ -6402,7 +6429,7 @@ sp_text_toolbox_size_changed (GtkComboBox *cbox,
if (result_numbers == QUERY_STYLE_NOTHING)
{
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
- prefs->setStyle("/tools/text/style", css);
+ prefs->mergeStyle("/tools/text/style", css);
}
sp_style_unref(query);