Commit 8a52f00a authored by Jan Djärv's avatar Jan Djärv
Browse files

Add tool bar style text-image-horiz (text to the left of the image).

* lisp/cus-start.el (tool-bar-style): Add text-image-horiz.

* src/gtkutil.c (xg_make_tool_item, xg_show_toolbar_item): Handle tool bar
style text_image_horiz.

* src/lisp.h (Qtext_image_horiz): Declare.

* src/xdisp.c (Qtext_image_horiz): Define.
(syms_of_xdisp): Initialize Qtext_image_horiz.  Add text-image-horiz
to ducumentation of tool-bar-style.

* src/xsettings.c (Ftool_bar_get_system_style): Also check for
Qtext_image_horiz.
parent 3f2afe32
2010-07-28 Jan Djärv <jan.h.d@swipnet.se>
* cus-start.el (tool-bar-style): Add text-image-horiz.
2010-07-28 Michael Albinus <michael.albinus@gmx.de>
 
* progmodes/gud.el (gud-common-init): Check for remoteness of
......
......@@ -345,6 +345,7 @@ since it could result in memory overflow and make Emacs crash."
(const :tag "Text" :value text)
(const :tag "Both" :value both)
(const :tag "Both-horiz" :value both-horiz)
(const :tag "Text-image-horiz" :value text-image-horiz)
(const :tag "System default" :value nil)) "23.3")
(tool-bar-max-label-size frames integer "23.3")
......
2010-07-28 Jan Djärv <jan.h.d@swipnet.se>
* xsettings.c (Ftool_bar_get_system_style): Also check for
Qtext_image_horiz.
* xdisp.c (Qtext_image_horiz): Define.
(syms_of_xdisp): Initialize Qtext_image_horiz. Add text-image-horiz
to ducumentation of tool-bar-style.
* lisp.h (Qtext_image_horiz): Declare.
* gtkutil.c (xg_make_tool_item, xg_show_toolbar_item): Handle tool bar
style text_image_horiz.
2010-07-27 Dan Nicolaescu <dann@ics.uci.edu>
 
* emacs.c (Fkill_emacs): Remove return statement.
......
......@@ -3703,8 +3703,7 @@ xg_create_tool_bar (FRAME_PTR f)
gtk_widget_set_name (x->toolbar_widget, "emacs-toolbar");
gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS);
toolbar_set_orientation (x->toolbar_widget,
GTK_ORIENTATION_HORIZONTAL);
toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL);
}
......@@ -3749,15 +3748,23 @@ xg_make_tool_item (FRAME_PTR f,
int i)
{
GtkToolItem *ti = gtk_tool_item_new ();
GtkWidget *vb = EQ (Vtool_bar_style, Qboth_horiz)
Lisp_Object style = Ftool_bar_get_system_style ();
int both_horiz = EQ (style, Qboth_horiz);
int text_image = EQ (style, Qtext_image_horiz);
GtkWidget *vb = both_horiz || text_image
? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0);
GtkWidget *wb = gtk_button_new ();
GtkWidget *weventbox = gtk_event_box_new ();
if (wimage)
if (wimage && ! text_image)
gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vb), gtk_label_new (label), TRUE, TRUE, 0);
if (wimage && text_image)
gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
gtk_button_set_focus_on_click (GTK_BUTTON (wb), FALSE);
gtk_button_set_relief (GTK_BUTTON (wb), GTK_RELIEF_NONE);
gtk_container_add (GTK_CONTAINER (wb), vb);
......@@ -3819,11 +3826,12 @@ static void
xg_show_toolbar_item (GtkToolItem *ti)
{
Lisp_Object style = Ftool_bar_get_system_style ();
int both_horiz = EQ (style, Qboth_horiz);
int text_image = EQ (style, Qtext_image_horiz);
int show_label = EQ (style, Qboth)
|| EQ (style, Qboth_horiz) || EQ (style, Qtext);
int horiz = both_horiz || text_image;
int show_label = ! EQ (style, Qimage);
int show_image = ! EQ (style, Qtext);
int horiz = EQ (style, Qboth_horiz);
GtkWidget *weventbox = gtk_bin_get_child (GTK_BIN (ti));
GtkWidget *wbutton = gtk_bin_get_child (GTK_BIN (weventbox));
......@@ -3836,15 +3844,21 @@ xg_show_toolbar_item (GtkToolItem *ti)
new_box = gtk_hbox_new (FALSE, 0);
else if (GTK_IS_HBOX (vb) && !horiz && show_label && show_image)
new_box = gtk_vbox_new (FALSE, 0);
if (new_box)
if (!new_box && horiz)
gtk_box_reorder_child (GTK_BOX (vb), wlbl, text_image ? 0 : 1);
else if (new_box)
{
g_object_ref (G_OBJECT (wimage));
g_object_ref (G_OBJECT (wlbl));
gtk_container_remove (GTK_CONTAINER (vb), wimage);
gtk_container_remove (GTK_CONTAINER (vb), wlbl);
gtk_widget_destroy (GTK_WIDGET (vb));
gtk_box_pack_start (GTK_BOX (new_box), wimage, TRUE, TRUE, 0);
if (! text_image)
gtk_box_pack_start (GTK_BOX (new_box), wimage, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (new_box), wlbl, TRUE, TRUE, 0);
if (text_image)
gtk_box_pack_start (GTK_BOX (new_box), wimage, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (wbutton), new_box);
g_object_unref (G_OBJECT (wimage));
g_object_unref (G_OBJECT (wlbl));
......
......@@ -2631,7 +2631,7 @@ extern Lisp_Object Qinhibit_point_motion_hooks;
extern Lisp_Object Qinhibit_redisplay, Qdisplay;
extern Lisp_Object Qinhibit_eval_during_redisplay;
extern Lisp_Object Qmessage_truncate_lines;
extern Lisp_Object Qimage, Qtext, Qboth, Qboth_horiz;
extern Lisp_Object Qimage, Qtext, Qboth, Qboth_horiz, Qtext_image_horiz;
extern Lisp_Object Qspace, Qcenter, QCalign_to;
extern Lisp_Object Vmessage_log_max;
extern Lisp_Object QCdata, QCfile;
......
......@@ -456,7 +456,7 @@ Lisp_Object QCmap, QCpointer;
Lisp_Object Qrect, Qcircle, Qpoly;
 
/* Tool bar styles */
Lisp_Object Qtext, Qboth, Qboth_horiz;
Lisp_Object Qtext, Qboth, Qboth_horiz, Qtext_image_horiz;
 
/* Non-zero means print newline to stdout before next mini-buffer
message. */
......@@ -25636,6 +25636,8 @@ syms_of_xdisp (void)
staticpro (&Qboth);
Qboth_horiz = intern_c_string ("both-horiz");
staticpro (&Qboth_horiz);
Qtext_image_horiz = intern_c_string ("text-image-horiz");
staticpro (&Qtext_image_horiz);
QCmap = intern_c_string (":map");
staticpro (&QCmap);
QCpointer = intern_c_string (":pointer");
......@@ -25979,11 +25981,12 @@ vertical margin. */);
DEFVAR_LISP ("tool-bar-style", &Vtool_bar_style,
doc: /* *Tool bar style to use.
It can be one of
image - show images only
text - show text only
both - show both, text under image
both-horiz - show text to the right of the image
any other - use system default or image if no system default. */);
image - show images only
text - show text only
both - show both, text below image
both-horiz - show text to the right of the image
text-image-horiz - show text to the left of the image
any other - use system default or image if no system default. */);
Vtool_bar_style = Qnil;
 
DEFVAR_INT ("tool-bar-max-label-size", &tool_bar_max_label_size,
......
......@@ -730,7 +730,8 @@ known style. Otherwise return image. */)
if (EQ (Vtool_bar_style, Qimage)
|| EQ (Vtool_bar_style, Qtext)
|| EQ (Vtool_bar_style, Qboth)
|| EQ (Vtool_bar_style, Qboth_horiz))
|| EQ (Vtool_bar_style, Qboth_horiz)
|| EQ (Vtool_bar_style, Qtext_image_horiz))
return Vtool_bar_style;
if (!NILP (current_tool_bar_style))
return current_tool_bar_style;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment