summaryrefslogtreecommitdiffstats
path: root/src/widgets/toolbox.cpp
diff options
context:
space:
mode:
authorJosh Andler <scislac@gmail.com>2009-09-23 20:27:22 +0000
committerscislac <scislac@users.sourceforge.net>2009-09-23 20:27:22 +0000
commit8ead1fdd38578da4c61ab5295883073f4548c998 (patch)
tree81458cf10aed0f8071447758a88c4c6db37e0307 /src/widgets/toolbox.cpp
parentTutorials update. Fixes NaN and overlapping bugs (Bug #409230). (diff)
downloadinkscape-8ead1fdd38578da4c61ab5295883073f4548c998.tar.gz
inkscape-8ead1fdd38578da4c61ab5295883073f4548c998.zip
Fix for 181663 by The Adib. Yay for working Italics button on the toolbar!
(bzr r8641)
Diffstat (limited to 'src/widgets/toolbox.cpp')
-rw-r--r--src/widgets/toolbox.cpp39
1 files changed, 32 insertions, 7 deletions
diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp
index 25b6e5b94..46ad08262 100644
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -5941,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)
{
@@ -6208,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;
}
@@ -6226,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;
}