[gnumeric] Improve the looks of the resize dialog.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] Improve the looks of the resize dialog.
- Date: Wed, 22 Apr 2009 21:57:53 -0400 (EDT)
commit e3a1596ebfb75359106d96b4102dd3821e4f1109
Author: Morten Welinder <terra gnome org>
Date: Wed Apr 22 21:58:22 2009 -0400
Improve the looks of the resize dialog.
---
src/dialogs/ChangeLog | 5 +++++
src/dialogs/dialog-sheet-resize.c | 24 +++++++++++++++++++-----
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 78dfd43..13718d2 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-22 Morten Welinder <terra gnome org>
+
+ * dialog-sheet-resize.c (dialog_sheet_resize): Apply a minimum
+ width to sliders.
+
2009-04-22 Andreas J. Guelzow <aguelzow pyrshep ca>
* dialog-so-styled.c (DialogSOStyled): add button field
diff --git a/src/dialogs/dialog-sheet-resize.c b/src/dialogs/dialog-sheet-resize.c
index e8d5c49..a1d6c52 100644
--- a/src/dialogs/dialog-sheet-resize.c
+++ b/src/dialogs/dialog-sheet-resize.c
@@ -83,16 +83,20 @@ cb_scale_changed (ResizeState *state)
gnm_sheet_valid_size (cols, rows));
}
-static void
-init_scale (GtkWidget *scale, int N)
+static int
+mylog2 (int N)
{
- GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (scale));
int l2 = 0;
-
while (N > 1)
N >>= 1, l2++;
+ return l2;
+}
- g_object_set (G_OBJECT (adj), "value", (double)l2, NULL);
+static void
+init_scale (GtkWidget *scale, int N)
+{
+ GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (scale));
+ g_object_set (G_OBJECT (adj), "value", (double)mylog2 (N), NULL);
}
static void
@@ -147,6 +151,7 @@ dialog_sheet_resize (WBCGtk *wbcg)
{
GladeXML *gui;
ResizeState *state;
+ int slider_width;
if (gnumeric_dialog_raise_if_exists (wbcg, RESIZE_DIALOG_KEY))
return;
@@ -162,9 +167,18 @@ dialog_sheet_resize (WBCGtk *wbcg)
state->sheet = wbcg_cur_sheet (wbcg);
g_return_if_fail (state->dialog != NULL);
+ gtk_widget_ensure_style (state->dialog);
+ slider_width = mylog2 (MAX (GNM_MAX_ROWS / GNM_MIN_ROWS,
+ GNM_MAX_COLS / GNM_MIN_COLS)) *
+ go_pango_measure_string
+ (gtk_widget_get_pango_context (GTK_WIDGET (wbcg_toplevel (wbcg))),
+ state->dialog->style->font_desc, "00");
+
state->columns_scale = glade_xml_get_widget (state->gui, "columns_scale");
+ gtk_widget_set_size_request (state->columns_scale, slider_width, -1);
state->columns_label = glade_xml_get_widget (state->gui, "columns_label");
state->rows_scale = glade_xml_get_widget (state->gui, "rows_scale");
+ gtk_widget_set_size_request (state->rows_scale, slider_width, -1);
state->rows_label = glade_xml_get_widget (state->gui, "rows_label");
state->all_sheets_button = glade_xml_get_widget (state->gui, "all_sheets_button");
state->ok_button = glade_xml_get_widget (state->gui, "ok_button");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]