Hi there!
I hacked a little bit on the dia source code to add a small detail that
I think will help new users to get used to accelerator keys much faster
and also avoid potential confusion.
Currently accelerator keys for the tools are only listed in the menu. I
think users would expect to see these accelerator keys also mentioned in
the tooltip that is associated with the tool in the toolbox. Otherwise
one could get the impression, that there is no accelerator key at all
and it's also much easier to look up the accelerator key if you don't
yet memorized them.
Looking at the source, I noticed that the list of tool descriptions is
duplicated in app/menus.c and app/interface.c. Following that structure,
I unfortunately had to duplicate the accelerator key information as
well. Maybe one would want to restructure this part, but I didn't feel
familiar enough with the dia source to attempt that.
Attached is the patch against current cvs. I hope you consider
integrating it.
Best regards,
Jan
Index: app/interface.c
===================================================================
RCS file: /cvs/gnome/dia/app/interface.c,v
retrieving revision 1.139
diff -u -r1.139 interface.c
--- app/interface.c 14 Aug 2006 16:49:59 -0000 1.139
+++ app/interface.c 23 Oct 2006 18:20:43 -0000
@@ -55,71 +55,85 @@
{
{ (char **) dia_modify_tool_icon,
N_("Modify object(s)"),
+ NULL,
"ToolsModify",
{ MODIFY_TOOL, NULL, NULL}
},
{ (char **) dia_zoom_tool_icon,
N_("Magnify"),
+ "<alt>M",
"ToolsMagnify",
{ MAGNIFY_TOOL, NULL, NULL}
},
{ (char **) dia_scroll_tool_icon,
N_("Scroll around the diagram"),
+ "<alt>S",
"ToolsScroll",
{ SCROLL_TOOL, NULL, NULL}
},
{ NULL,
N_("Text"),
+ "<alt>T",
"ToolsText",
{ CREATE_OBJECT_TOOL, "Standard - Text", NULL }
},
{ NULL,
N_("Box"),
+ "<alt>R",
"ToolsBox",
{ CREATE_OBJECT_TOOL, "Standard - Box", NULL }
},
{ NULL,
N_("Ellipse"),
+ "<alt>E",
"ToolsEllipse",
{ CREATE_OBJECT_TOOL, "Standard - Ellipse", NULL }
},
{ NULL,
N_("Polygon"),
+ "<alt>P",
"ToolsPolygon",
{ CREATE_OBJECT_TOOL, "Standard - Polygon", NULL }
},
{ NULL,
N_("Beziergon"),
+ "<alt>B",
"ToolsBeziergon",
{ CREATE_OBJECT_TOOL, "Standard - Beziergon", NULL }
},
{ NULL,
N_("Line"),
+ "<alt>L",
"ToolsLine",
{ CREATE_OBJECT_TOOL, "Standard - Line", NULL }
},
{ NULL,
N_("Arc"),
+ "<alt>A",
"ToolsArc",
{ CREATE_OBJECT_TOOL, "Standard - Arc", NULL }
},
{ NULL,
N_("Zigzagline"),
+ "<alt>Z",
"ToolsZigzagline",
{ CREATE_OBJECT_TOOL, "Standard - ZigZagLine", NULL }
},
{ NULL,
N_("Polyline"),
+ NULL,
"ToolsPolyline",
{ CREATE_OBJECT_TOOL, "Standard - PolyLine", NULL }
},
{ NULL,
N_("Bezierline"),
+ "<alt>C",
"ToolsBezierline",
{ CREATE_OBJECT_TOOL, "Standard - BezierLine", NULL }
},
{ NULL,
N_("Image"),
+ "<alt>I",
"ToolsImage",
{ CREATE_OBJECT_TOOL, "Standard - Image", NULL }
}
@@ -759,8 +773,20 @@
tool_data[i].callback_data.widget = button;
- gtk_tooltips_set_tip (tool_tips, button,
- gettext(tool_data[i].tool_desc), NULL);
+ if (tool_data[i].tool_accelerator) {
+ guint key;
+ GdkModifierType mods;
+
+ gtk_accelerator_parse (tool_data[i].tool_accelerator, &key, &mods);
+
+ gtk_tooltips_set_tip (tool_tips, button,
+ g_strconcat(gettext(tool_data[i].tool_desc),
+ " (", gtk_accelerator_get_label(key,
mods), ")"),
+ NULL);
+ } else {
+ gtk_tooltips_set_tip (tool_tips, button,
+ gettext(tool_data[i].tool_desc), NULL);
+ }
gtk_widget_show (pixmapwidget);
gtk_widget_show (button);
Index: app/interface.h
===================================================================
RCS file: /cvs/gnome/dia/app/interface.h,v
retrieving revision 1.16
diff -u -r1.16 interface.h
--- app/interface.h 25 May 2006 20:08:00 -0000 1.16
+++ app/interface.h 23 Oct 2006 18:20:44 -0000
@@ -69,6 +69,7 @@
{
gchar **icon_data;
char *tool_desc;
+ char *tool_accelerator;
char *action_name;
ToolButtonData callback_data;
};
_______________________________________________
Dia-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://www.gnome.org/projects/dia/faq.html
Main page at http://www.gnome.org/projects/dia