gimp r25169 - in trunk: . app/widgets etc themes/Default



Author: neo
Date: Sat Mar 22 01:10:51 2008
New Revision: 25169
URL: http://svn.gnome.org/viewvc/gimp?rev=25169&view=rev

Log:
2008-03-22  Sven Neumann  <sven gimp org>

	* themes/Default/gtkrc
	* app/widgets/gimpmenudock.c: reduced minimum dock width to 200
	pixels.

	* etc/sessionrc: use -0 instead of -1, just like in X geometry
	strings. Changed default dock sizes to be taller but less wide.

	* app/widgets/gimpsessioninfo.c: changed code to parse -0 from 
the
	sessionrc file and to deal more correctly with negative offsets.



Modified:
   trunk/ChangeLog
   trunk/app/widgets/gimpmenudock.c
   trunk/app/widgets/gimpsessioninfo.c
   trunk/app/widgets/gimpsessioninfo.h
   trunk/etc/sessionrc
   trunk/themes/Default/gtkrc

Modified: trunk/app/widgets/gimpmenudock.c
==============================================================================
--- trunk/app/widgets/gimpmenudock.c	(original)
+++ trunk/app/widgets/gimpmenudock.c	Sat Mar 22 01:10:51 2008
@@ -47,7 +47,7 @@
 #include "gimp-intl.h"
 
 
-#define DEFAULT_MINIMAL_WIDTH  250
+#define DEFAULT_MINIMAL_WIDTH  200
 #define DEFAULT_MENU_VIEW_SIZE GTK_ICON_SIZE_SMALL_TOOLBAR
 
 

Modified: trunk/app/widgets/gimpsessioninfo.c
==============================================================================
--- trunk/app/widgets/gimpsessioninfo.c	(original)
+++ trunk/app/widgets/gimpsessioninfo.c	Sat Mar 22 01:10:51 2008
@@ -134,6 +134,38 @@
   gimp_config_writer_close (writer);  /* session-info */
 }
 
+/*
+ * This function is just like gimp_scanner_parse_int(), but it is allows
+ * to detect the special value '-0'. This is used as in X geometry strings.
+ */
+static gboolean
+gimp_session_info_parse_offset (GScanner *scanner,
+                                gint     *dest,
+                                gboolean *negative)
+{
+  if (g_scanner_peek_next_token (scanner) == '-')
+    {
+      *negative = TRUE;
+      g_scanner_get_next_token (scanner);
+    }
+  else
+    {
+      *negative = FALSE;
+    }
+
+  if (g_scanner_peek_next_token (scanner) != G_TOKEN_INT)
+    return FALSE;
+
+  g_scanner_get_next_token (scanner);
+
+  if (*negative)
+    *dest = -scanner->value.v_int64;
+  else
+    *dest = scanner->value.v_int64;
+
+  return TRUE;
+}
+
 GTokenType
 gimp_session_info_deserialize (GScanner *scanner,
                                gint      scope)
@@ -202,9 +234,13 @@
             {
             case SESSION_INFO_POSITION:
               token = G_TOKEN_INT;
-              if (! gimp_scanner_parse_int (scanner, &info->x))
+              if (! gimp_session_info_parse_offset (scanner,
+                                                    &info->x,
+                                                    &info->right_align))
                 goto error;
-              if (! gimp_scanner_parse_int (scanner, &info->y))
+              if (! gimp_session_info_parse_offset (scanner,
+                                                    &info->y,
+                                                    &info->bottom_align))
                 goto error;
               break;
 
@@ -386,8 +422,6 @@
   GdkRectangle rect;
   gchar        geom[32];
   gint         monitor;
-  gboolean     right_aligned  = FALSE;
-  gboolean     bottom_aligned = FALSE;
   gboolean     use_size;
 
   g_return_if_fail (info != NULL);
@@ -398,18 +432,6 @@
   use_size = ((! info->toplevel_entry || info->toplevel_entry->remember_size) &&
               (info->width > 0 && info->height > 0));
 
-  if (info->x < 0)
-    {
-      right_aligned = TRUE;
-      info->x = 0;
-    }
-
-  if (info->y < 0)
-    {
-      bottom_aligned = TRUE;
-      info->y = 0;
-    }
-
   if (use_size)
     {
       monitor = gimp_session_info_get_appropriate_monitor (screen,
@@ -425,23 +447,33 @@
 
   gdk_screen_get_monitor_geometry (screen, monitor, &rect);
 
-  if (! right_aligned)
-    {
-      gint max = rect.x + rect.width - (info->width > 0 ? info->width : 128);
+  info->x = CLAMP (info->x,
+                   rect.x,
+                   rect.x + rect.width - (info->width > 0 ?
+                                          info->width : 128));
+  info->y = CLAMP (info->y,
+                   rect.y,
+                   rect.y + rect.height - (info->height > 0 ?
+                                           info->height : 128));
 
-      info->x = CLAMP (info->x, rect.x, max);
+  if (info->right_align && info->bottom_align)
+    {
+      g_strlcpy (geom, "-0-0", sizeof (geom));
     }
-
-  if (! bottom_aligned)
+  else if (info->right_align)
     {
-      gint max = rect.y + rect.height - (info->height > 0 ? info->height : 128);
-
-      info->y = CLAMP (info->y, rect.y, max);
+      g_snprintf (geom, sizeof (geom), "-0%+d", info->y);
+    }
+  else if (info->bottom_align)
+    {
+      g_snprintf (geom, sizeof (geom), "%+d-0", info->x);
+    }
+  else
+    {
+      g_snprintf (geom, sizeof (geom), "%+d%+d", info->x, info->y);
     }
 
-  g_snprintf (geom, sizeof (geom), "%c%d%c%d",
-              right_aligned  ? '-' : '+', info->x,
-              bottom_aligned ? '-' : '+', info->y);
+  g_printerr ("%s\n", geom);
 
   gtk_window_parse_geometry (GTK_WINDOW (info->widget), geom);
 

Modified: trunk/app/widgets/gimpsessioninfo.h
==============================================================================
--- trunk/app/widgets/gimpsessioninfo.h	(original)
+++ trunk/app/widgets/gimpsessioninfo.h	Sat Mar 22 01:10:51 2008
@@ -29,6 +29,8 @@
   gint                    y;
   gint                    width;
   gint                    height;
+  gboolean                right_align;
+  gboolean                bottom_align;
 
   /*  only valid while restoring and saving the session  */
   gboolean                open;

Modified: trunk/etc/sessionrc
==============================================================================
--- trunk/etc/sessionrc	(original)
+++ trunk/etc/sessionrc	Sat Mar 22 01:10:51 2008
@@ -7,14 +7,14 @@
 
 (session-info "toolbox" "dock"
     (position 0 0)
-    (size 204 720)
+    (size 170 820)
     (open-on-exit)
     (dock
         (book
             (dockable "gimp-tool-options"))))
 (session-info "dock" "dock"
-    (position -1 0)
-    (size 240 720)
+    (position -0 0)
+    (size 210 820)
     (open-on-exit)
     (aux-info
         (show-image-menu "true")
@@ -30,9 +30,7 @@
             (dockable "gimp-undo-history"
 	        (tab-style icon)))
         (book
-            (position 360)
-            (dockable "gimp-color-editor"
-	        (tab-style preview))
+            (position 420)
             (dockable "gimp-brush-grid"
 	        (tab-style preview))
             (dockable "gimp-pattern-grid"

Modified: trunk/themes/Default/gtkrc
==============================================================================
--- trunk/themes/Default/gtkrc	(original)
+++ trunk/themes/Default/gtkrc	Sat Mar 22 01:10:51 2008
@@ -39,7 +39,7 @@
   GtkPaned::handle_size             = 6
   GimpDock::default_height          = 300
   GimpDockSeparator::height         = 6
-  GimpMenuDock::minimal_width       = 250
+  GimpMenuDock::minimal_width       = 200
   GimpMenuDock::menu_preview_size   = button
   GimpToolbox::tool_icon_size       = button
   GimpToolbox::button_relief        = none



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