Commit 81b95a4f authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

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
parent a93d498c
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
......
......@@ -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]
......
......@@ -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>
......
......@@ -1777,11 +1777,94 @@ sheet_widget_slider_user_config (SheetObject *so, SheetControl *sc)
N_("Slider Properties"));
}
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment