gnumeric r16783 - in trunk: . src/dialogs



Author: guelzow
Date: Thu Sep 11 20:05:41 2008
New Revision: 16783
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16783&view=rev

Log:
2008-09-11  Andreas J. Guelzow <aguelzow pyrshep ca>

	Fix for #360873
	* col-width.glade: use points and pixels
	* row-height.glade: ditto
	* dialog-col-width.c (ColWidthState): new fields
	(dialog_col_width_update_points): new
	(dialog_col_width_button_sensitivity): use int and call 
	  dialog_col_width_update_points
	(dialog_col_width_set_value): adjust for zoom factor and return
	  adjusted value.
	(dialog_col_width_load_value): use pixels
	(cb_dialog_col_width_value_changed): ditto
	(cb_dialog_col_width_apply_clicked): ditto
	* dialog-row-height.c: corresponding changes to dialog-col-width.c




Modified:
   trunk/NEWS
   trunk/src/dialogs/ChangeLog
   trunk/src/dialogs/col-width.glade
   trunk/src/dialogs/dialog-col-width.c
   trunk/src/dialogs/dialog-row-height.c
   trunk/src/dialogs/row-height.glade

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Thu Sep 11 20:05:41 2008
@@ -7,6 +7,7 @@
 	* Make the paired t-test analysis tool use only 
 	  complete pairs. [# 531852]
 	* Improve regression tool
+	* Fix row height and column width dialogs [#360873]
 
 Jean:
 	* Fix printing of rotated text. [#539734]

Modified: trunk/src/dialogs/col-width.glade
==============================================================================
--- trunk/src/dialogs/col-width.glade	(original)
+++ trunk/src/dialogs/col-width.glade	Thu Sep 11 20:05:41 2008
@@ -1,193 +1,189 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
-
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--*- mode: xml -*-->
 <glade-interface>
-
-<widget class="GtkDialog" id="dialog">
-  <property name="border_width">6</property>
-  <property name="title" translatable="yes">Column Width</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="has_separator">False</property>
-
-  <child internal-child="vbox">
-    <widget class="GtkVBox" id="dialog-vbox1">
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">6</property>
-
-      <child internal-child="action_area">
-	<widget class="GtkHButtonBox" id="dialog-action_area1">
-	  <property name="visible">True</property>
-	  <property name="layout_style">GTK_BUTTONBOX_END</property>
-
-	  <child>
-	    <widget class="GtkButton" id="help_button">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-help</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">0</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="apply_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-apply</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">0</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="cancel_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-close</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">0</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="ok_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="has_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-ok</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">0</property>
-	    </widget>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">True</property>
-	  <property name="pack_type">GTK_PACK_END</property>
-	</packing>
-      </child>
-
-      <child>
-	<widget class="GtkTable" id="main_table">
-	  <property name="border_width">8</property>
-	  <property name="visible">True</property>
-	  <property name="n_rows">2</property>
-	  <property name="n_columns">3</property>
-	  <property name="homogeneous">False</property>
-	  <property name="row_spacing">12</property>
-	  <property name="column_spacing">12</property>
-
-	  <child>
-	    <widget class="GtkLabel" id="description">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes"></property>
-	      <property name="use_underline">False</property>
-	      <property name="use_markup">False</property>
-	      <property name="justify">GTK_JUSTIFY_LEFT</property>
-	      <property name="wrap">True</property>
-	      <property name="selectable">False</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">0</property>
-	      <property name="right_attach">3</property>
-	      <property name="top_attach">0</property>
-	      <property name="bottom_attach">1</property>
-	      <property name="x_options">fill</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkLabel" id="label">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">_Column width (pt.):</property>
-	      <property name="use_underline">True</property>
-	      <property name="use_markup">False</property>
-	      <property name="justify">GTK_JUSTIFY_LEFT</property>
-	      <property name="wrap">False</property>
-	      <property name="selectable">False</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">0</property>
-	      <property name="right_attach">1</property>
-	      <property name="top_attach">1</property>
-	      <property name="bottom_attach">2</property>
-	      <property name="x_options">fill</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkSpinButton" id="spin">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="climb_rate">1</property>
-	      <property name="digits">3</property>
-	      <property name="numeric">True</property>
-	      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
-	      <property name="snap_to_ticks">False</property>
-	      <property name="wrap">False</property>
-	      <property name="adjustment">5 5 1000 1 5 5</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">1</property>
-	      <property name="right_attach">2</property>
-	      <property name="top_attach">1</property>
-	      <property name="bottom_attach">2</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkCheckButton" id="default_check">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label" translatable="yes">_Use Default</property>
-	      <property name="use_underline">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="active">False</property>
-	      <property name="inconsistent">False</property>
-	      <property name="draw_indicator">True</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">2</property>
-	      <property name="right_attach">3</property>
-	      <property name="top_attach">1</property>
-	      <property name="bottom_attach">2</property>
-	      <property name="x_options">fill</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
-	</packing>
-      </child>
-    </widget>
-  </child>
-</widget>
-
+  <widget class="GtkDialog" id="dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Column Width</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="spacing">6</property>
+        <child>
+          <widget class="GtkTable" id="main_table">
+            <property name="visible">True</property>
+            <property name="border_width">8</property>
+            <property name="n_rows">4</property>
+            <property name="n_columns">3</property>
+            <property name="column_spacing">12</property>
+            <property name="row_spacing">12</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="pts-label">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="xpad">3</property>
+                <property name="label" translatable="yes">x</property>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Column width in points:</property>
+              </widget>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkCheckButton" id="default_check">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label" translatable="yes">_Use Default</property>
+                <property name="use_underline">True</property>
+                <property name="response_id">0</property>
+                <property name="draw_indicator">True</property>
+              </widget>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="right_attach">3</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkSpinButton" id="spin">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="adjustment">5 5 1000 1 5 5</property>
+                <property name="climb_rate">1</property>
+                <property name="numeric">True</property>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">_Column width in pixels:</property>
+                <property name="use_underline">True</property>
+              </widget>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="description">
+                <property name="visible">True</property>
+                <property name="wrap">True</property>
+              </widget>
+              <packing>
+                <property name="right_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <widget class="GtkButton" id="help_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label">gtk-help</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="apply_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-apply</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="cancel_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-close</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="ok_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="label">gtk-ok</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>

Modified: trunk/src/dialogs/dialog-col-width.c
==============================================================================
--- trunk/src/dialogs/dialog-col-width.c	(original)
+++ trunk/src/dialogs/dialog-col-width.c	Thu Sep 11 20:05:41 2008
@@ -55,11 +55,12 @@
 	GtkWidget          *cancel_button;
 	GtkWidget          *default_check;
 	GtkWidget          *description;
+	GtkWidget          *points;
 	GtkSpinButton      *spin;
 
 	gboolean           set_default_value;
 
-	gnm_float         orig_value;
+	gint               orig_value;
 	gboolean           orig_is_default;
 	gboolean           orig_some_default;
 	gboolean           orig_all_equal;
@@ -67,9 +68,21 @@
 } ColWidthState;
 
 static void
+dialog_col_width_update_points (ColWidthState *state)
+{
+	gint value = gtk_spin_button_get_value_as_int (state->spin);
+	double size_points = value *  72./gnm_app_display_dpi_get (FALSE);
+	gchar *pts;
+
+	pts = g_strdup_printf ("%.2f",size_points);
+	gtk_label_set_text (GTK_LABEL (state->points), pts);
+	g_free (pts);
+}
+
+static void
 dialog_col_width_button_sensitivity (ColWidthState *state)
 {
-	gnm_float value = gtk_spin_button_get_value (state->spin);
+	gint value = gtk_spin_button_get_value_as_int (state->spin);
 	gboolean use_default = gtk_toggle_button_get_active
 		(GTK_TOGGLE_BUTTON (state->default_check));
 	gboolean changed_info;
@@ -84,6 +97,8 @@
 	}
 	gtk_widget_set_sensitive (state->ok_button, changed_info);
 	gtk_widget_set_sensitive (state->apply_button, changed_info);
+
+	dialog_col_width_update_points (state);
 }
 
 static void
@@ -103,24 +118,26 @@
 }
 
 
-static void
-dialog_col_width_set_value (gnm_float value, ColWidthState *state)
+static gint
+dialog_col_width_set_value (gint value, ColWidthState *state)
 {
-	gtk_spin_button_set_value (state->spin, value);
+	gint adj_value = value/state->sheet->last_zoom_factor_used + 0.5;
+	gtk_spin_button_set_value (state->spin, adj_value);
+	return adj_value;
 }
 
 static void
 dialog_col_width_load_value (ColWidthState *state)
 {
 	GSList *l;
-	gnm_float value = 0.0;
+	gint value = 0;
 	state->orig_is_default = TRUE;
 	state->orig_some_default = FALSE;
 	state->orig_all_equal = TRUE;
 
 	state->adjusting = TRUE;
 	if (state->set_default_value) {
-		value = sheet_col_get_default_size_pts (state->sheet);
+		value = sheet_col_get_default_size_pixels (state->sheet);
 	} else {
 		for (l = state->sv->selections; l; l = l->next){
 			GnmRange *ss = l->data;
@@ -132,9 +149,9 @@
 					state->orig_is_default = FALSE;
 				else
 					state->orig_some_default = TRUE;
-				if (value == 0.0)
-					value = ri->size_pts;
-				else if (value != ri->size_pts){
+				if (value == 0)
+					value = ri->size_pixels;
+				else if (value != ri->size_pixels){
 					/* Values differ, so let the user enter the data */
 					state->orig_all_equal = FALSE;
 				}
@@ -143,12 +160,12 @@
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state->default_check),
 					      state->orig_is_default);
 	}
-	state->orig_value = value;
-	dialog_col_width_set_value (value, state);
+	state->orig_value =  dialog_col_width_set_value (value, state);
 	dialog_col_width_button_sensitivity (state);
 	state->adjusting = FALSE;
 }
 
+
 static void
 cb_dialog_col_width_value_changed (G_GNUC_UNUSED GtkSpinButton *spinbutton,
 				   ColWidthState *state)
@@ -165,7 +182,7 @@
 	if (!state->adjusting) {
 		if (gtk_toggle_button_get_active (togglebutton)) {
 			state->adjusting = TRUE;
-			dialog_col_width_set_value (sheet_col_get_default_size_pts (state->sheet),
+			dialog_col_width_set_value (sheet_col_get_default_size_pixels (state->sheet),
 						     state);
 			state->adjusting = FALSE;
 		}
@@ -177,17 +194,15 @@
 cb_dialog_col_width_apply_clicked (G_GNUC_UNUSED GtkWidget *button,
 				   ColWidthState *state)
 {
-	gnm_float value = gtk_spin_button_get_value (state->spin);
-	double const scale =
-		state->sheet->last_zoom_factor_used *
-		gnm_app_display_dpi_get (FALSE) / 72.;
-	int size_pixels = (int)(value * scale + 0.5);
+	gint value = gtk_spin_button_get_value_as_int (state->spin);
+	int size_pixels = (int)(value * state->sheet->last_zoom_factor_used + 0.5);
 	gboolean use_default = gtk_toggle_button_get_active
 		(GTK_TOGGLE_BUTTON (state->default_check));
 
 	if (state->set_default_value) {
+		float points = value * 72./gnm_app_display_dpi_get (FALSE);
 		cmd_colrow_std_size (WORKBOOK_CONTROL (state->wbcg),
-				     state->sheet, TRUE, value);
+				     state->sheet, TRUE, points);
 		dialog_col_width_load_value (state);
 	} else {
 		if (use_default)
@@ -257,6 +272,7 @@
 	state->dialog = glade_xml_get_widget (state->gui, "dialog");
 
 	state->description = GTK_WIDGET (glade_xml_get_widget (state->gui, "description"));
+	state->points = GTK_WIDGET (glade_xml_get_widget (state->gui, "pts-label"));
 
 	state->spin  = GTK_SPIN_BUTTON (glade_xml_get_widget (state->gui, "spin"));
 	gtk_spin_button_get_adjustment (state->spin)->lower =

Modified: trunk/src/dialogs/dialog-row-height.c
==============================================================================
--- trunk/src/dialogs/dialog-row-height.c	(original)
+++ trunk/src/dialogs/dialog-row-height.c	Thu Sep 11 20:05:41 2008
@@ -55,11 +55,12 @@
 	GtkWidget          *cancel_button;
 	GtkWidget          *default_check;
 	GtkWidget          *description;
+	GtkWidget          *points;
 	GtkSpinButton      *spin;
 
 	gboolean           set_default_value;
 
-	gnm_float         orig_value;
+	gint               orig_value;
 	gboolean           orig_is_default;
 	gboolean           orig_some_default;
 	gboolean           orig_all_equal;
@@ -67,9 +68,21 @@
 } RowHeightState;
 
 static void
+dialog_row_height_update_points (RowHeightState *state)
+{
+	gint value = gtk_spin_button_get_value_as_int (state->spin);
+	double size_points = value *  72./gnm_app_display_dpi_get (TRUE);
+	gchar *pts;
+
+	pts = g_strdup_printf ("%.2f",size_points);
+	gtk_label_set_text (GTK_LABEL (state->points), pts);
+	g_free (pts);
+}
+
+static void
 dialog_row_height_button_sensitivity (RowHeightState *state)
 {
-	gnm_float value = gtk_spin_button_get_value (state->spin);
+	gint value = gtk_spin_button_get_value_as_int  (state->spin);
 	gboolean use_default = gtk_toggle_button_get_active
 		(GTK_TOGGLE_BUTTON (state->default_check));
 	gboolean changed_info;
@@ -84,6 +97,8 @@
 	}
 	gtk_widget_set_sensitive (state->ok_button, changed_info);
 	gtk_widget_set_sensitive (state->apply_button, changed_info);
+
+	dialog_row_height_update_points (state);
 }
 
 static void
@@ -102,24 +117,26 @@
 }
 
 
-static void
-dialog_row_height_set_value (gnm_float value, RowHeightState *state)
+static gint
+dialog_row_height_set_value (gint value, RowHeightState *state)
 {
-	gtk_spin_button_set_value (state->spin, value);
+	gint adj_value = value/state->sheet->last_zoom_factor_used + 0.5;
+	gtk_spin_button_set_value (state->spin, adj_value);
+	return adj_value;
 }
 
 static void
 dialog_row_height_load_value (RowHeightState *state)
 {
 	GSList *l;
-	gnm_float value = 0.0;
+	gint value = 0;
 	state->orig_is_default = TRUE;
 	state->orig_some_default = FALSE;
 	state->orig_all_equal = TRUE;
 
 	state->adjusting = TRUE;
 	if (state->set_default_value) {
-		value = sheet_row_get_default_size_pts (state->sheet);
+		value = sheet_row_get_default_size_pixels (state->sheet);
 	} else {
 		for (l = state->sv->selections; l; l = l->next){
 			GnmRange *ss = l->data;
@@ -131,9 +148,9 @@
 					state->orig_is_default = FALSE;
 				else
 					state->orig_some_default = TRUE;
-				if (value == 0.0)
-					value = ri->size_pts;
-				else if (value != ri->size_pts){
+				if (value == 0)
+					value = ri->size_pixels;
+				else if (value != ri->size_pixels){
 					/* Values differ, so let the user enter the data */
 					state->orig_all_equal = FALSE;
 				}
@@ -142,8 +159,7 @@
 		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (state->default_check),
 					      state->orig_is_default);
 	}
-	state->orig_value = value;
-	dialog_row_height_set_value (value, state);
+	state->orig_value = dialog_row_height_set_value (value, state);
 	dialog_row_height_button_sensitivity (state);
 	state->adjusting = FALSE;
 }
@@ -164,7 +180,7 @@
 	if (!state->adjusting) {
 		if (gtk_toggle_button_get_active (togglebutton)) {
 			state->adjusting = TRUE;
-			dialog_row_height_set_value (sheet_row_get_default_size_pts (state->sheet),
+			dialog_row_height_set_value (sheet_row_get_default_size_pixels (state->sheet),
 						     state);
 			state->adjusting = FALSE;
 		}
@@ -176,17 +192,15 @@
 cb_dialog_row_height_apply_clicked (G_GNUC_UNUSED GtkWidget *button,
 				    RowHeightState *state)
 {
-	gnm_float value = gtk_spin_button_get_value (state->spin);
-	double const scale =
-		state->sheet->last_zoom_factor_used *
-		gnm_app_display_dpi_get (FALSE) / 72.;
-	int size_pixels = (int)(value * scale + 0.5);
+	gint value = gtk_spin_button_get_value_as_int (state->spin);
+	int size_pixels = (int)(value * state->sheet->last_zoom_factor_used + 0.5);
 	gboolean use_default = gtk_toggle_button_get_active
 		(GTK_TOGGLE_BUTTON (state->default_check));
 
 	if (state->set_default_value) {
+		float points = value * 72./gnm_app_display_dpi_get (TRUE);
 		cmd_colrow_std_size (WORKBOOK_CONTROL (state->wbcg),
-				     state->sheet, FALSE, value);
+				     state->sheet, FALSE, points);
 		dialog_row_height_load_value (state);
 	} else {
 		if (use_default)
@@ -251,6 +265,7 @@
 	state->dialog = glade_xml_get_widget (state->gui, "dialog");
 
 	state->description = GTK_WIDGET (glade_xml_get_widget (state->gui, "description"));
+	state->points = GTK_WIDGET (glade_xml_get_widget (state->gui, "pts-label"));
 
 	state->spin  = GTK_SPIN_BUTTON (glade_xml_get_widget (state->gui, "spin"));
 	gtk_spin_button_get_adjustment (state->spin)->lower =

Modified: trunk/src/dialogs/row-height.glade
==============================================================================
--- trunk/src/dialogs/row-height.glade	(original)
+++ trunk/src/dialogs/row-height.glade	Thu Sep 11 20:05:41 2008
@@ -1,194 +1,189 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
-
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--*- mode: xml -*-->
 <glade-interface>
-
-<widget class="GtkDialog" id="dialog">
-  <property name="border_width">6</property>
-  <property name="title" translatable="yes">Row Height</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="has_separator">False</property>
-
-  <child internal-child="vbox">
-    <widget class="GtkVBox" id="dialog-vbox1">
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">6</property>
-
-      <child internal-child="action_area">
-	<widget class="GtkHButtonBox" id="dialog-action_area1">
-	  <property name="visible">True</property>
-	  <property name="layout_style">GTK_BUTTONBOX_END</property>
-
-	  <child>
-	    <widget class="GtkButton" id="help_button">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-help</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">0</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="apply_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-apply</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">0</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="cancel_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-close</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">0</property>
-	    </widget>
-	  </child>
-
-	  <child>
-	    <widget class="GtkButton" id="ok_button">
-	      <property name="visible">True</property>
-	      <property name="can_default">True</property>
-	      <property name="has_default">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label">gtk-ok</property>
-	      <property name="use_stock">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="response_id">0</property>
-	    </widget>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">True</property>
-	  <property name="pack_type">GTK_PACK_END</property>
-	</packing>
-      </child>
-
-      <child>
-	<widget class="GtkTable" id="main_table">
-	  <property name="border_width">8</property>
-	  <property name="visible">True</property>
-	  <property name="n_rows">2</property>
-	  <property name="n_columns">3</property>
-	  <property name="homogeneous">False</property>
-	  <property name="row_spacing">12</property>
-	  <property name="column_spacing">12</property>
-
-	  <child>
-	    <widget class="GtkLabel" id="description">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes"></property>
-	      <property name="use_underline">False</property>
-	      <property name="use_markup">False</property>
-	      <property name="justify">GTK_JUSTIFY_LEFT</property>
-	      <property name="wrap">True</property>
-	      <property name="selectable">False</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">0</property>
-	      <property name="right_attach">3</property>
-	      <property name="top_attach">0</property>
-	      <property name="bottom_attach">1</property>
-	      <property name="x_options">fill</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkLabel" id="label">
-	      <property name="visible">True</property>
-	      <property name="label" translatable="yes">_Row height (pt.):</property>
-	      <property name="use_underline">True</property>
-	      <property name="use_markup">False</property>
-	      <property name="justify">GTK_JUSTIFY_LEFT</property>
-	      <property name="wrap">False</property>
-	      <property name="selectable">False</property>
-	      <property name="xalign">0.5</property>
-	      <property name="yalign">0.5</property>
-	      <property name="xpad">0</property>
-	      <property name="ypad">0</property>
-	      <property name="mnemonic_widget">spin</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">0</property>
-	      <property name="right_attach">1</property>
-	      <property name="top_attach">1</property>
-	      <property name="bottom_attach">2</property>
-	      <property name="x_options">fill</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkSpinButton" id="spin">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="climb_rate">1</property>
-	      <property name="digits">3</property>
-	      <property name="numeric">True</property>
-	      <property name="update_policy">GTK_UPDATE_ALWAYS</property>
-	      <property name="snap_to_ticks">False</property>
-	      <property name="wrap">False</property>
-	      <property name="adjustment">5 5 1000 1 5 5</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">1</property>
-	      <property name="right_attach">2</property>
-	      <property name="top_attach">1</property>
-	      <property name="bottom_attach">2</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-
-	  <child>
-	    <widget class="GtkCheckButton" id="default_check">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="label" translatable="yes">_Use Default</property>
-	      <property name="use_underline">True</property>
-	      <property name="relief">GTK_RELIEF_NORMAL</property>
-	      <property name="active">False</property>
-	      <property name="inconsistent">False</property>
-	      <property name="draw_indicator">True</property>
-	    </widget>
-	    <packing>
-	      <property name="left_attach">2</property>
-	      <property name="right_attach">3</property>
-	      <property name="top_attach">1</property>
-	      <property name="bottom_attach">2</property>
-	      <property name="x_options">fill</property>
-	      <property name="y_options"></property>
-	    </packing>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">False</property>
-	  <property name="fill">False</property>
-	</packing>
-      </child>
-    </widget>
-  </child>
-</widget>
-
+  <widget class="GtkDialog" id="dialog">
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Row Height</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="spacing">6</property>
+        <child>
+          <widget class="GtkTable" id="main_table">
+            <property name="visible">True</property>
+            <property name="border_width">8</property>
+            <property name="n_rows">4</property>
+            <property name="n_columns">3</property>
+            <property name="column_spacing">12</property>
+            <property name="row_spacing">12</property>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="description">
+                <property name="visible">True</property>
+                <property name="wrap">True</property>
+              </widget>
+              <packing>
+                <property name="right_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">_Row height in pixels:</property>
+                <property name="use_underline">True</property>
+              </widget>
+              <packing>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkSpinButton" id="spin">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="adjustment">5 5 1000 1 5 5</property>
+                <property name="climb_rate">1</property>
+                <property name="numeric">True</property>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkCheckButton" id="default_check">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label" translatable="yes">_Use Default</property>
+                <property name="use_underline">True</property>
+                <property name="response_id">0</property>
+                <property name="draw_indicator">True</property>
+              </widget>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="right_attach">3</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">Row height in points:</property>
+              </widget>
+              <packing>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="pts-label">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="xpad">3</property>
+                <property name="label" translatable="yes">x</property>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <widget class="GtkButton" id="help_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="label">gtk-help</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="apply_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-apply</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="cancel_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-close</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkButton" id="ok_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="label">gtk-ok</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>



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