[gnumeric] Improve printing of scrollbars
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Improve printing of scrollbars
- Date: Tue, 28 Sep 2010 18:08:30 +0000 (UTC)
commit d83685b5ec97b5b997fd9f71a8d109c802ca9108
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Tue Sep 28 12:08:10 2010 -0600
Improve printing of scrollbars
2010-09-28 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/sheet-object-widget.c
(sheet_widget_scrollbar_*_draw_cairo): new
(sheet_widget_scrollbar_draw_cairo): new
(sheet_widget_scrollbar_class_init): connect
sheet_widget_slider_draw_cairo
(sheet_widget_slider_vertical_draw_cairo): use
sheet_widget_slider_horizontal_draw_cairo
ChangeLog | 20 ++++++++--
NEWS | 2 +-
src/sheet-object-widget.c | 85 ++++++++++++++++++++++++++++++--------------
3 files changed, 75 insertions(+), 32 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1fa75e2..7b8286d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,22 @@
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
+ * src/sheet-object-widget.c
+ (sheet_widget_scrollbar_*_draw_cairo): new
+ (sheet_widget_scrollbar_draw_cairo): new
+ (sheet_widget_scrollbar_class_init): connect
+ sheet_widget_slider_draw_cairo
+ (sheet_widget_slider_vertical_draw_cairo): use
+ sheet_widget_slider_horizontal_draw_cairo
+
+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
+ (sheet_widget_slider_class_init): connect
+ sheet_widget_slider_draw_cairo
2010-09-28 Morten Welinder <terra gnome org>
diff --git a/NEWS b/NEWS
index 7d027ae..03c4c24 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, radio buttons and sliders.
+ * Improve printing of the form controls.
Jean:
* Export/import tick label rotation angle. [#629675]
diff --git a/src/sheet-object-widget.c b/src/sheet-object-widget.c
index 3fdb7a5..263ae67 100644
--- a/src/sheet-object-widget.c
+++ b/src/sheet-object-widget.c
@@ -1677,11 +1677,66 @@ sheet_widget_scrollbar_user_config (SheetObject *so, SheetControl *sc)
N_("Scrollbar Properties"));
}
+static void sheet_widget_slider_horizontal_draw_cairo
+(SheetObject const *so, cairo_t *cr, double width, double height);
+
+static void
+sheet_widget_scrollbar_horizontal_draw_cairo (SheetObject const *so, cairo_t *cr,
+ double width, double height)
+{
+ cairo_save (cr);
+ cairo_set_source_rgb(cr, 0.5, 0.5, 0.5);
+
+ cairo_new_path (cr);
+ cairo_move_to (cr, 0., height/2);
+ cairo_rel_line_to (cr, 15., 7.5);
+ cairo_rel_line_to (cr, 0, -15);
+ cairo_close_path (cr);
+ cairo_fill (cr);
+
+ cairo_new_path (cr);
+ cairo_move_to (cr, width, height/2);
+ cairo_rel_line_to (cr, -15., 7.5);
+ cairo_rel_line_to (cr, 0, -15);
+ cairo_close_path (cr);
+ cairo_fill (cr);
+
+ cairo_new_path (cr);
+ cairo_translate (cr, 20., 0.);
+ sheet_widget_slider_horizontal_draw_cairo (so, cr, width - 30, height);
+ cairo_restore (cr);
+}
+
+static void
+sheet_widget_scrollbar_vertical_draw_cairo (SheetObject const *so, cairo_t *cr,
+ double width, double height)
+{
+ cairo_save (cr);
+ cairo_rotate (cr, M_PI/2);
+ cairo_translate (cr, 0., -width);
+ sheet_widget_scrollbar_horizontal_draw_cairo (so, cr, height, width);
+ cairo_restore (cr);
+}
+
+static void
+sheet_widget_scrollbar_draw_cairo (SheetObject const *so, cairo_t *cr,
+ double width, double height)
+{
+ SheetWidgetAdjustment *swa = SHEET_WIDGET_ADJUSTMENT (so);
+ if (swa->horizontal)
+ sheet_widget_scrollbar_horizontal_draw_cairo
+ (so, cr, width, height);
+ else
+ sheet_widget_scrollbar_vertical_draw_cairo
+ (so, cr, width, height);
+}
static void
sheet_widget_scrollbar_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_scrollbar_draw_cairo;
sow_class->create_widget = &sheet_widget_scrollbar_create_widget;
SHEET_OBJECT_CLASS (sow_class)->user_config = &sheet_widget_scrollbar_user_config;
swa_class->htype = GTK_TYPE_HSCROLLBAR;
@@ -1816,34 +1871,10 @@ 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_rotate (cr, M_PI/2);
+ cairo_translate (cr, 0., -width);
+ sheet_widget_slider_horizontal_draw_cairo (so, cr, height, width);
cairo_restore (cr);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]