[gnumeric] Improve printing of sliders.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Improve printing of sliders.
- Date: Tue, 28 Sep 2010 17:23:02 +0000 (UTC)
commit 81b95a4f6faa5c6b3cb6030a8e832e69ab890b6c
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Tue Sep 28 11:18:54 2010 -0600
Improve printing of sliders.
2010-09-28 Andreas J. Guelzow <aguelzow pyrshep ca>
* schemas/gnumeric-general.schemas.in: fix tooltip for column and row
numbers
* src/sheet-object-widget.c (sheet_widget_slider_*_draw_cairo): new
(sheet_widget_slider_draw_cairo): new
(sheet_widget_slider_class_init): connect sheet_widget_slider_draw_cairo
ChangeLog | 8 +++
NEWS | 2 +-
schemas/gnumeric-general.schemas.in | 4 +-
src/sheet-object-widget.c | 83 +++++++++++++++++++++++++++++++++++
4 files changed, 94 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 84ad62b..1fa75e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-09-28 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * schemas/gnumeric-general.schemas.in: fix tooltip for column and row
+ numbers
+ * src/sheet-object-widget.c (sheet_widget_slider_*_draw_cairo): new
+ (sheet_widget_slider_draw_cairo): new
+ (sheet_widget_slider_class_init): connect sheet_widget_slider_draw_cairo
+
2010-09-28 Morten Welinder <terra gnome org>
* src/sheet.c (struct cb_sheet_resize): Eliminate. This was the
diff --git a/NEWS b/NEWS
index 11c43b9..7d027ae 100644
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,7 @@ Andreas:
* Permit ctrl-click specification of sort columns.
* Set ODF files to save by default as ODF files. [#629962]
* Fix ssconvert crash on form controls. [#630335]
- * Improve printing of checkboxes and radio buttons.
+ * Improve printing of checkboxes, radio buttons and sliders.
Jean:
* Export/import tick label rotation angle. [#629675]
diff --git a/schemas/gnumeric-general.schemas.in b/schemas/gnumeric-general.schemas.in
index 7a7785f..986e76e 100644
--- a/schemas/gnumeric-general.schemas.in
+++ b/schemas/gnumeric-general.schemas.in
@@ -120,7 +120,7 @@
<default>65536</default>
<locale name="C">
<short>Default Number of rows in a sheet</short>
- <long>The number of rows in each sheet. This setting will be used only in a new gnumeric session. Whatever value is given here, the real number of rows will be a power of 2 between 65539 and 16777216.</long>
+ <long>The number of rows in each sheet. This setting will be used only in a new gnumeric session.</long>
</locale>
</schema>
<schema>
@@ -131,7 +131,7 @@
<default>256</default>
<locale name="C">
<short>Default Number of columns in a sheet</short>
- <long>The number of columns in each sheet. This setting will be used only in a new gnumeric session. Whatever value is given here, the real number of columns will be a power of 2 between 256 and 4096.</long>
+ <long>The number of columns in each sheet. This setting will be used only in a new gnumeric session.</long>
</locale>
</schema>
<schema>
diff --git a/src/sheet-object-widget.c b/src/sheet-object-widget.c
index 23c4418..3fdb7a5 100644
--- a/src/sheet-object-widget.c
+++ b/src/sheet-object-widget.c
@@ -1778,10 +1778,93 @@ sheet_widget_slider_user_config (SheetObject *so, SheetControl *sc)
}
static void
+sheet_widget_slider_horizontal_draw_cairo (SheetObject const *so, cairo_t *cr,
+ double width, double height)
+{
+ SheetWidgetAdjustment *swa = SHEET_WIDGET_ADJUSTMENT (so);
+ GtkAdjustment *adjustment = swa->adjustment;
+ double value = gtk_adjustment_get_value (adjustment);
+ double upper = gtk_adjustment_get_upper (adjustment);
+ double lower = gtk_adjustment_get_lower (adjustment);
+ double fraction = (upper == lower) ? 0.0 : (value - lower)/(upper- lower);
+
+ cairo_save (cr);
+ cairo_set_line_width (cr, 5);
+ cairo_set_source_rgb(cr, 0.8, 0.8, 0.8);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+
+ cairo_new_path (cr);
+ cairo_move_to (cr, 4, height/2);
+ cairo_rel_line_to (cr, width - 8., 0);
+ cairo_stroke (cr);
+
+ cairo_set_line_width (cr, 15);
+ cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+
+ cairo_new_path (cr);
+ cairo_move_to (cr, fraction * (width - 8. - 20. - 5. - 5. + 2.5 + 2.5)
+ - 10. + 10. + 4. + 5. - 2.5, height/2);
+ cairo_rel_line_to (cr, 20, 0);
+ cairo_stroke (cr);
+
+ cairo_new_path (cr);
+ cairo_restore (cr);
+}
+
+static void
+sheet_widget_slider_vertical_draw_cairo (SheetObject const *so, cairo_t *cr,
+ double width, double height)
+{
+ SheetWidgetAdjustment *swa = SHEET_WIDGET_ADJUSTMENT (so);
+ GtkAdjustment *adjustment = swa->adjustment;
+ double value = gtk_adjustment_get_value (adjustment);
+ double upper = gtk_adjustment_get_upper (adjustment);
+ double lower = gtk_adjustment_get_lower (adjustment);
+ double fraction = (upper == lower) ? 0.0 : (value - lower)/(upper- lower);
+
+ cairo_save (cr);
+ cairo_set_line_width (cr, 5);
+ cairo_set_source_rgb(cr, 0.8, 0.8, 0.8);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+
+ cairo_new_path (cr);
+ cairo_move_to (cr, width/2, 4.);
+ cairo_rel_line_to (cr, 0, height - 8.);
+ cairo_stroke (cr);
+
+ cairo_set_line_width (cr, 15);
+ cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
+
+ cairo_new_path (cr);
+ cairo_move_to (cr, width/2, fraction * (height - 8. - 20. - 5. - 5. + 2.5 + 2.5)
+ - 10. + 10. + 4. + 5. - 2.5);
+ cairo_rel_line_to (cr, 0, 20);
+ cairo_stroke (cr);
+
+ cairo_new_path (cr);
+ cairo_restore (cr);
+}
+
+static void
+sheet_widget_slider_draw_cairo (SheetObject const *so, cairo_t *cr,
+ double width, double height)
+{
+ SheetWidgetAdjustment *swa = SHEET_WIDGET_ADJUSTMENT (so);
+ if (swa->horizontal)
+ sheet_widget_slider_horizontal_draw_cairo (so, cr, width, height);
+ else
+ sheet_widget_slider_vertical_draw_cairo (so, cr, width, height);
+}
+
+static void
sheet_widget_slider_class_init (SheetObjectWidgetClass *sow_class)
{
SheetWidgetAdjustmentClass *swa_class = (SheetWidgetAdjustmentClass *)sow_class;
+ SheetObjectClass *so_class = SHEET_OBJECT_CLASS (sow_class);
+ so_class->draw_cairo = &sheet_widget_slider_draw_cairo;
sow_class->create_widget = &sheet_widget_slider_create_widget;
SHEET_OBJECT_CLASS (sow_class)->user_config = &sheet_widget_slider_user_config;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]