summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 22bcb20)
raw | patch | inline | side by side (parent: 22bcb20)
author | tavmjong-free <tavmjong@free.fr> | |
Tue, 18 May 2010 11:54:03 +0000 (13:54 +0200) | ||
committer | tavmjong-free <tavmjong@free.fr> | |
Tue, 18 May 2010 11:54:03 +0000 (13:54 +0200) |
Include units in tooltips.
src/ege-adjustment-action.cpp | patch | blob | history | |
src/widgets/toolbox.cpp | patch | blob | history |
index e6ec392adaf1c0c5e4991d68694549326f070f8a..17e11db2d5c5e30f44cb0c54b4dfc52091d852ed 100644 (file)
#include <gtk/gtktooltips.h>
#include <gtk/gtkradiomenuitem.h>
+#include "widgets/icon.h"
+#include "icon-size.h"
#include "ege-adjustment-action.h"
gboolean transferFocus;
GList* descriptions;
gchar* appearance;
+ gchar* iconId;
+ Inkscape::IconSize iconSize;
};
#define EGE_ADJUSTMENT_ACTION_GET_PRIVATE( o ) ( G_TYPE_INSTANCE_GET_PRIVATE( (o), EGE_ADJUSTMENT_ACTION_TYPE, EgeAdjustmentActionPrivate ) )
PROP_DIGITS,
PROP_SELFID,
PROP_TOOL_POST,
- PROP_APPEARANCE
+ PROP_APPEARANCE,
+ PROP_ICON_ID,
+ PROP_ICON_SIZE
};
enum {
@@ -253,6 +259,24 @@ static void ege_adjustment_action_class_init( EgeAdjustmentActionClass* klass )
"",
(GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
+ g_object_class_install_property( objClass,
+ PROP_ICON_ID,
+ g_param_spec_string( "iconId",
+ "Icon ID",
+ "The id for the icon",
+ "",
+ (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
+
+ g_object_class_install_property( objClass,
+ PROP_ICON_SIZE,
+ g_param_spec_int( "iconSize",
+ "Icon Size",
+ "The size the icon",
+ (int)Inkscape::ICON_SIZE_MENU,
+ (int)Inkscape::ICON_SIZE_DECORATION,
+ (int)Inkscape::ICON_SIZE_SMALL_TOOLBAR,
+ (GParamFlags)(G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT) ) );
+
g_type_class_add_private( klass, sizeof(EgeAdjustmentActionClass) );
}
}
action->private_data->transferFocus = FALSE;
action->private_data->descriptions = 0;
action->private_data->appearance = 0;
+ action->private_data->iconId = 0;
+ action->private_data->iconSize = Inkscape::ICON_SIZE_SMALL_TOOLBAR;
}
static void ege_adjustment_action_finalize( GObject* object )
@@ -353,6 +379,14 @@ static void ege_adjustment_action_get_property( GObject* obj, guint propId, GVal
g_value_set_string( value, action->private_data->appearance );
break;
+ case PROP_ICON_ID:
+ g_value_set_string( value, action->private_data->iconId );
+ break;
+
+ case PROP_ICON_SIZE:
+ g_value_set_int( value, action->private_data->iconSize );
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID( obj, propId, pspec );
}
@@ -440,6 +474,20 @@ void ege_adjustment_action_set_property( GObject* obj, guint propId, const GValu
}
break;
+ case PROP_ICON_ID:
+ {
+ gchar* tmp = action->private_data->iconId;
+ action->private_data->iconId = g_value_dup_string( value );
+ g_free( tmp );
+ }
+ break;
+
+ case PROP_ICON_SIZE:
+ {
+ action->private_data->iconSize = (Inkscape::IconSize)g_value_get_int( value );
+ }
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID( obj, propId, pspec );
}
const gchar* sss = g_value_get_string( &value );
if ( act->private_data->appearanceMode == APPEARANCE_FULL ) {
- spinbutton = gtk_hscale_new( act->private_data->adj);
+ // Slider
+ spinbutton = gtk_hscale_new( act->private_data->adj);
gtk_widget_set_size_request(spinbutton, 100, -1);
gtk_scale_set_digits (GTK_SCALE(spinbutton), 0);
gtk_signal_connect(GTK_OBJECT(spinbutton), "format-value", GTK_SIGNAL_FUNC(slider_format_falue), (void *) sss);
}
if ( act->private_data->appearanceMode != APPEARANCE_FULL ) {
- GtkWidget* lbl = gtk_label_new( sss ? sss : "wwww" );
- GtkWidget* filler1 = gtk_label_new(" ");
- gtk_misc_set_alignment( GTK_MISC(lbl), 1.0, 0.5 );
- gtk_box_pack_start( GTK_BOX(hb), filler1, FALSE, FALSE, 0 );
- gtk_box_pack_start( GTK_BOX(hb), lbl, FALSE, FALSE, 0 );
+ GtkWidget* filler1 = gtk_label_new(" ");
+ gtk_box_pack_start( GTK_BOX(hb), filler1, FALSE, FALSE, 0 );
+
+ // Use an icon if available or use short-label
+ if ( act->private_data->iconId && strcmp( act->private_data->iconId, "" ) != 0 ) {
+ GtkWidget* icon = sp_icon_new( act->private_data->iconSize, act->private_data->iconId );
+ gtk_box_pack_start( GTK_BOX(hb), icon, FALSE, FALSE, 0 );
+ } else {
+ GtkWidget* lbl = gtk_label_new( sss ? sss : "wwww" );
+ gtk_misc_set_alignment( GTK_MISC(lbl), 1.0, 0.5 );
+ gtk_box_pack_start( GTK_BOX(hb), lbl, FALSE, FALSE, 0 );
+ }
}
if ( act->private_data->appearanceMode == APPEARANCE_FULL ) {
index 2c129f02cdc43855164e427d7ea77886d2b36d5e..e505412d08db5a757a87bc94c89f2685f8b4e2fb 100644 (file)
--- a/src/widgets/toolbox.cpp
+++ b/src/widgets/toolbox.cpp
@@ -7381,7 +7381,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
Ink_ComboBoxEntry_Action* act = ink_comboboxentry_action_new( "TextFontSizeAction",
_("Font Size"),
- _("Select Font Size"),
+ _("Select Font Size (px)"),
NULL,
GTK_TREE_MODEL(model_size),
4 ); // Width in characters
@@ -7527,7 +7527,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
"TextLineHeightAction", /* name */
_("Line Height"), /* label */
_("Line:"), /* short label */
- _("Spacing between lines."), /* tooltip */
+ _("Spacing between lines (%)."), /* tooltip */
"/tools/text/lineheight", /* path? */
0.0, /* default */
GTK_WIDGET(desktop->canvas), /* focusTarget */
@@ -7545,6 +7545,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
g_object_set_data( holder, "TextLineHeightAction", eact );
+ g_object_set( G_OBJECT(eact), "iconId", "text_line_spacing", NULL );
}
/* Word spacing */
@@ -7557,7 +7558,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
"TextWordSpacingAction", /* name */
_("Word spacing"), /* label */
_("Word:"), /* short label */
- _("Spacing between words."), /* tooltip */
+ _("Spacing between words (px)."), /* tooltip */
"/tools/text/wordspacing", /* path? */
0.0, /* default */
GTK_WIDGET(desktop->canvas), /* focusTarget */
@@ -7575,6 +7576,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
g_object_set_data( holder, "TextWordSpacingAction", eact );
+ g_object_set( G_OBJECT(eact), "iconId", "text_word_spacing", NULL );
}
/* Letter spacing */
@@ -7587,7 +7589,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
"TextLetterSpacingAction", /* name */
_("Letter spacing"), /* label */
_("Letter:"), /* short label */
- _("Spacing between letters."), /* tooltip */
+ _("Spacing between letters (px)."), /* tooltip */
"/tools/text/letterspacing", /* path? */
0.0, /* default */
GTK_WIDGET(desktop->canvas), /* focusTarget */
@@ -7605,6 +7607,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
g_object_set_data( holder, "TextLetterSpacingAction", eact );
+ g_object_set( G_OBJECT(eact), "iconId", "text_letter_spacing", NULL );
}
/* Character kerning (horizontal shift) */
@@ -7617,7 +7620,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
"TextDxAction", /* name */
_("Kerning"), /* label */
_("Kern:"), /* short label */
- _("Kerning (horizontal shift of characters)."), /* tooltip */
+ _("Kerning (horizontal shift of characters) (px)."), /* tooltip */
"/tools/text/dx", /* path? */
0.0, /* default */
GTK_WIDGET(desktop->canvas), /* focusTarget */
@@ -7635,6 +7638,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
g_object_set_data( holder, "TextDxAction", eact );
+ g_object_set( G_OBJECT(eact), "iconId", "text_horz_kern", NULL );
}
/* Character vertical shift */
@@ -7647,7 +7651,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
"TextDyAction", /* name */
_("Vertical Shift"), /* label */
_("Vert:"), /* short label */
- _("Vertical shift of characters."), /* tooltip */
+ _("Vertical shift of characters (px)."), /* tooltip */
"/tools/text/dy", /* path? */
0.0, /* default */
GTK_WIDGET(desktop->canvas), /* focusTarget */
@@ -7665,6 +7669,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
g_object_set_data( holder, "TextDyAction", eact );
+ g_object_set( G_OBJECT(eact), "iconId", "text_vert_kern", NULL );
}
/* Character rotation */
@@ -7695,6 +7700,7 @@ static void sp_text_toolbox_prep(SPDesktop *desktop, GtkActionGroup* mainActions
gtk_action_group_add_action( mainActions, GTK_ACTION(eact) );
gtk_action_set_sensitive( GTK_ACTION(eact), TRUE );
g_object_set_data( holder, "TextRotationAction", eact );
+ g_object_set( G_OBJECT(eact), "iconId", "text_rotation", NULL );
}
// Is this necessary to call? Shouldn't hurt.