changeset 1170:159f225985c5

Use common code for layout_image_setup_split_none() too.
author zas_
date Sat, 22 Nov 2008 22:04:21 +0000
parents cb699bd2742d
children 8721675f80ce
files src/layout_image.c
diffstat 1 files changed, 15 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/src/layout_image.c	Sat Nov 22 21:58:07 2008 +0000
+++ b/src/layout_image.c	Sat Nov 22 22:04:21 2008 +0000
@@ -1588,55 +1588,16 @@
 }
 
 
-GtkWidget *layout_image_setup_split_none(LayoutWindow *lw)
-{
-	gint i;
-
-	lw->split_mode = SPLIT_NONE;
-
-	if (!lw->split_images[0])
-		{
-		layout_image_new(lw, 0);
-		image_set_frame(lw->split_images[0], (!lw->tools_float && !lw->tools_hidden));
-		image_set_selectable(lw->split_images[0], 0);
-		layout_image_activate(lw, 0);
-		}
-	else
-		{
-		image_set_frame(lw->split_images[0], (!lw->tools_float && !lw->tools_hidden));
-		image_set_selectable(lw->split_images[0], 0);
-		}
-
-	for (i = 1; i < MAX_SPLIT_IMAGES; i++)
-		{
-		if (lw->split_images[i])
-			{
-#if GTK_CHECK_VERSION(2,12,0)
-			g_object_unref(lw->split_images[i]->widget);
-#else
-			gtk_widget_unref(lw->split_images[i]->widget);
-#endif
-			lw->split_images[i] = NULL;
-			}
-		}
-
-
-	layout_image_activate(lw, 0);
-
-	lw->split_image_widget = lw->split_images[0]->widget;
-
-	return lw->split_image_widget;
-}
-
 static void layout_image_setup_split_common(LayoutWindow *lw, gint n)
 {
+	gboolean frame = (n == 1) ? (!lw->tools_float && !lw->tools_hidden) : 1;
 	gint i;
 
 	for (i = 0; i < n; i++)
 		if (!lw->split_images[i])
 			{
 			layout_image_new(lw, i);
-			image_set_frame(lw->split_images[i], 1);
+			image_set_frame(lw->split_images[i], frame);
 			image_set_selectable(lw->split_images[i], 1);
 			if (lw->image)
 				{
@@ -1650,7 +1611,7 @@
 			}
 		else
 			{
-			image_set_frame(lw->split_images[i], 1);
+			image_set_frame(lw->split_images[i], frame);
 			image_set_selectable(lw->split_images[i], 1);
 			}
 
@@ -1674,6 +1635,18 @@
 
 }
 
+GtkWidget *layout_image_setup_split_none(LayoutWindow *lw)
+{
+	lw->split_mode = SPLIT_NONE;
+	
+	layout_image_setup_split_common(lw, 1);
+
+	lw->split_image_widget = lw->split_images[0]->widget;
+
+	return lw->split_image_widget;
+}
+
+
 GtkWidget *layout_image_setup_split_hv(LayoutWindow *lw, gboolean horizontal)
 {
 	GtkWidget *paned;