emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r100924: Add tool bar style text-imag


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r100924: Add tool bar style text-image-horiz (text to the left of the image).
Date: Wed, 28 Jul 2010 19:34:51 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100924
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Wed 2010-07-28 19:34:51 +0200
message:
  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.
modified:
  lisp/ChangeLog
  lisp/cus-start.el
  src/ChangeLog
  src/gtkutil.c
  src/lisp.h
  src/xdisp.c
  src/xsettings.c
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-07-28 10:08:16 +0000
+++ b/lisp/ChangeLog    2010-07-28 17:34:51 +0000
@@ -1,3 +1,7 @@
+2010-07-28  Jan Djärv  <address@hidden>
+
+       * cus-start.el (tool-bar-style): Add text-image-horiz.
+
 2010-07-28  Michael Albinus  <address@hidden>
 
        * progmodes/gud.el (gud-common-init): Check for remoteness of

=== modified file 'lisp/cus-start.el'
--- a/lisp/cus-start.el 2010-05-07 13:52:25 +0000
+++ b/lisp/cus-start.el 2010-07-28 17:34:51 +0000
@@ -345,6 +345,7 @@
                      (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")
 

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-07-27 08:02:44 +0000
+++ b/src/ChangeLog     2010-07-28 17:34:51 +0000
@@ -1,3 +1,17 @@
+2010-07-28  Jan Djärv  <address@hidden>
+
+       * 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  <address@hidden>
 
        * emacs.c (Fkill_emacs): Remove return statement.

=== modified file 'src/gtkutil.c'
--- a/src/gtkutil.c     2010-07-17 16:03:16 +0000
+++ b/src/gtkutil.c     2010-07-28 17:34:51 +0000
@@ -3703,8 +3703,7 @@
   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 @@
                    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 @@
 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 @@
     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));

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2010-07-27 02:45:53 +0000
+++ b/src/lisp.h        2010-07-28 17:34:51 +0000
@@ -2631,7 +2631,7 @@
 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;

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2010-07-27 03:52:35 +0000
+++ b/src/xdisp.c       2010-07-28 17:34:51 +0000
@@ -456,7 +456,7 @@
 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 @@
   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 @@
   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,

=== modified file 'src/xsettings.c'
--- a/src/xsettings.c   2010-07-08 21:25:08 +0000
+++ b/src/xsettings.c   2010-07-28 17:34:51 +0000
@@ -730,7 +730,8 @@
   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;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]