[gnumeric] Add optional marker to indicate that a cell contains an expression. [#55124]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Add optional marker to indicate that a cell contains an expression. [#55124]
- Date: Thu, 15 Jul 2010 19:34:06 +0000 (UTC)
commit d2d3973ef7e5b8354d9acec8eafee5191de0d85e
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Thu Jul 15 11:08:06 2010 -0600
Add optional marker to indicate that a cell contains an expression. [#55124]
2010-07-15 Andreas J. Guelzow <aguelzow pyrshep ca>
* dialog-workbook-attr.c (attr_dialog_init_cell_marker_page): new
(page_info): add new page
* workbook-attr.glade: add cell marker pane
2010-07-15 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/item-grid.c (draw_function_marker): new
(item_grid_draw_region): call draw_function_marker when appropriate
(item_grid_draw_merged_range): ditto
* src/workbook-view.c (wb_view_set_attribute): handle new attribute
(wb_view_set_property): ditto
(workbook_view_class_init): ditto
(workbook_view_new): ditto
(wb_view_get_property): ditto
* src/workbook-view.h (_WorkbookView): new field
ChangeLog | 12 +++++++
NEWS | 1 +
src/dialogs/ChangeLog | 6 +++
src/dialogs/dialog-workbook-attr.c | 9 +++++
src/dialogs/workbook-attr.glade | 39 ++++++++++++++++++++-
src/item-grid.c | 65 ++++++++++++++++++++++++++++++++---
src/workbook-view.c | 23 ++++++++++++-
src/workbook-view.h | 1 +
8 files changed, 147 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6e8c16a..5681ccc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-07-15 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/item-grid.c (draw_function_marker): new
+ (item_grid_draw_region): call draw_function_marker when appropriate
+ (item_grid_draw_merged_range): ditto
+ * src/workbook-view.c (wb_view_set_attribute): handle new attribute
+ (wb_view_set_property): ditto
+ (workbook_view_class_init): ditto
+ (workbook_view_new): ditto
+ (wb_view_get_property): ditto
+ * src/workbook-view.h (_WorkbookView): new field
+
2010-07-14 Andreas J. Guelzow <aguelzow pyrshep ca>
* schemas/gnumeric-general.schemas.in
diff --git a/NEWS b/NEWS
index ad2f236..0d0e201 100644
--- a/NEWS
+++ b/NEWS
@@ -32,6 +32,7 @@ Andreas:
* Improve expression entry range selection. [#80725][#624288][#624289]
* Add preference setting to disable the extension check for the
configurable text exporter. [#594151]
+ * Add optional marker to indicate that a cell contains an expression. [#55124]
Jean:
* Fix strong/weak cursor display. [#623241]
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index be44f4d..cdaf55c 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,9 @@
+2010-07-15 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * dialog-workbook-attr.c (attr_dialog_init_cell_marker_page): new
+ (page_info): add new page
+ * workbook-attr.glade: add cell marker pane
+
2010-07-14 Andreas J. Guelzow <aguelzow pyrshep ca>
* dialog-preferences.c (custom_pref_conf_to_widget_ecd): new
diff --git a/src/dialogs/dialog-workbook-attr.c b/src/dialogs/dialog-workbook-attr.c
index 858b0a8..0ad7106 100644
--- a/src/dialogs/dialog-workbook-attr.c
+++ b/src/dialogs/dialog-workbook-attr.c
@@ -138,6 +138,14 @@ attr_dialog_init_autocompletion_page (AttrState *state)
}
static void
+attr_dialog_init_cell_marker_page (AttrState *state)
+{
+ attr_dialog_init_toggle
+ (state,
+ "WorkbookView::show_function_cell_markers", "show_function_cell_markers");
+}
+
+static void
attr_dialog_init_protection_page (AttrState *state)
{
attr_dialog_init_toggle
@@ -186,6 +194,7 @@ static page_info_t const page_info[] = {
{N_("Widgets"), "Gnumeric_ObjectScrollbar", NULL, 0, &attr_dialog_init_widget_page },
{N_("Protection"), GTK_STOCK_DIALOG_AUTHENTICATION, NULL, 1 ,&attr_dialog_init_protection_page },
{N_("Auto Completion"), NULL, NULL, 2 ,&attr_dialog_init_autocompletion_page },
+ {N_("Cell Markers"), NULL, NULL, 3 ,&attr_dialog_init_cell_marker_page },
{NULL, NULL, NULL, -1, NULL},
};
diff --git a/src/dialogs/workbook-attr.glade b/src/dialogs/workbook-attr.glade
index 3b23cfe..75bb412 100644
--- a/src/dialogs/workbook-attr.glade
+++ b/src/dialogs/workbook-attr.glade
@@ -16,6 +16,7 @@
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="width_request">160</property>
+ <property name="height_request">120</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">never</property>
@@ -161,7 +162,7 @@
<child>
<widget class="GtkLabel" id="label2">
<property name="visible">True</property>
- <property name="label" translatable="yes">Protection</property>
+ <property name="label" translatable="no">Protection</property>
<property name="justify">center</property>
</widget>
<packing>
@@ -195,7 +196,7 @@
<child>
<widget class="GtkLabel" id="label3">
<property name="visible">True</property>
- <property name="label" translatable="yes">page 3</property>
+ <property name="label" translatable="no">page 3</property>
</widget>
<packing>
<property name="position">2</property>
@@ -203,6 +204,40 @@
<property name="type">tab</property>
</packing>
</child>
+ <child>
+ <widget class="GtkVBox" id="vbox-f-marker">
+ <property name="visible">True</property>
+ <child>
+ <widget class="GtkCheckButton"
+ id="WorkbookView::show_function_cell_markers">
+ <property name="label" translatable="yes">Show _Formula Cell Markers</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="no">page 4</property>
+ </widget>
+ <packing>
+ <property name="position">3</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="pack_type">end</property>
diff --git a/src/item-grid.c b/src/item-grid.c
index a45066e..ab43ffe 100644
--- a/src/item-grid.c
+++ b/src/item-grid.c
@@ -205,6 +205,36 @@ item_grid_update_bounds (GocItem *item)
}
static void
+draw_function_marker (GnmCell const *cell, cairo_t *cr,
+ double x, double y, double w, double h, int const dir)
+{
+ if (cell == NULL || !gnm_cell_has_expr (cell))
+ return;
+
+ cairo_save (cr);
+ cairo_new_path (cr);
+ cairo_rectangle (cr, x, y, w+1, h+1);
+ cairo_clip (cr);
+ cairo_new_path (cr);
+ if (dir > 0) {
+ cairo_move_to (cr, x, y);
+ cairo_line_to (cr, x + 10., y);
+ cairo_arc (cr, x, y, 10., 0., M_PI / 2.);
+ } else {
+ cairo_move_to (cr, x + w, y);
+ cairo_line_to (cr, x + w, y + 10.);
+ cairo_arc (cr, x + w, y, 10., M_PI/2., M_PI);
+ }
+ cairo_close_path (cr);
+ cairo_set_source_rgb(cr, 0.0, 1.0, 0.0);
+ cairo_fill_preserve (cr);
+ cairo_set_source_rgb(cr, 0.3, 0.3, 0.3);
+ cairo_set_line_width (cr, 0.5);
+ cairo_stroke (cr);
+ cairo_restore (cr);
+}
+
+static void
item_grid_draw_merged_range (cairo_t *cr, ItemGrid *ig,
int start_x, int start_y,
GnmRange const *view, GnmRange const *range,
@@ -212,6 +242,8 @@ item_grid_draw_merged_range (cairo_t *cr, ItemGrid *ig,
{
int l, r, t, b, last;
SheetView const *sv = scg_view (ig->scg);
+ WorkbookView *wbv = sv_wbv (sv);
+ gboolean show_function_cell_markers = wbv->show_function_cell_markers;
Sheet const *sheet = sv->sheet;
GnmCell const *cell = sheet_cell_get (sheet, range->start.col, range->start.row);
int const dir = sheet->text_is_rtl ? -1 : 1;
@@ -283,12 +315,19 @@ item_grid_draw_merged_range (cairo_t *cr, ItemGrid *ig,
if (ri->needs_respan)
row_calc_spans ((ColRowInfo *)ri, cell->pos.row, sheet);
- if (dir > 0)
+ if (dir > 0) {
+ if (show_function_cell_markers)
+ draw_function_marker (cell, cr, l, t,
+ r - l, b - t, dir);
cell_draw (cell, cr,
- l, t, r - l, b - t, -1);
- else
+ l, t, r - l, b - t, -1);
+ } else {
+ if (show_function_cell_markers)
+ draw_function_marker (cell, cr, r, t,
+ l - r, b - t, dir);
cell_draw (cell, cr,
- r, t, l - r, b - t, -1);
+ r, t, l - r, b - t, -1);
+ }
}
if (dir > 0)
gnm_style_border_draw_diag (style, cr, l, t, r, b);
@@ -358,6 +397,9 @@ item_grid_draw_region (GocItem const *item, cairo_t *cr, double x_0, double y_0,
ItemGrid *ig = ITEM_GRID (item);
ColRowInfo const *ri = NULL, *next_ri = NULL;
int const dir = sheet->text_is_rtl ? -1 : 1;
+ SheetView const *sv = scg_view (ig->scg);
+ WorkbookView *wbv = sv_wbv (sv);
+ gboolean show_function_cell_markers = wbv->show_function_cell_markers;
/* To ensure that far and near borders get drawn we pretend to draw +-2
* pixels around the target area which would include the surrounding
@@ -628,6 +670,7 @@ plain_draw : /* a quick hack to deal with 142267 */
ci->size_pixels, ri->size_pixels,
draw_selection);
+
/* Is this part of a span?
* 1) There are cells allocated in the row
* (indicated by ri->spans != NULL)
@@ -642,11 +685,16 @@ plain_draw : /* a quick hack to deal with 142267 */
* box. Ignore blanks too.
*/
GnmCell const *cell = sheet_cell_get (sheet, col, row);
- if (!gnm_cell_is_empty (cell) && cell != edit_cell)
+ if (!gnm_cell_is_empty (cell) && cell != edit_cell) {
+ if (show_function_cell_markers)
+ draw_function_marker (cell, cr, x, y,
+ ci->size_pixels,
+ ri->size_pixels,
+ dir);
cell_draw (cell, cr,
x, y, ci->size_pixels,
ri->size_pixels, -1);
-
+ }
/* Only draw spaning cells after all the backgrounds
* that we are going to draw have been drawn. No need
* to draw the edit cell, or blanks. */
@@ -695,9 +743,14 @@ plain_draw : /* a quick hack to deal with 142267 */
real_x -= offset;
}
+ if (show_function_cell_markers)
+ draw_function_marker (cell, cr, real_x, y,
+ tmp_width,
+ ri->size_pixels, dir);
cell_draw (cell, cr,
real_x, y, tmp_width,
ri->size_pixels, center_offset);
+
} else if (col != span->left)
sr.vertical [col] = NULL;
diff --git a/src/workbook-view.c b/src/workbook-view.c
index fbd78b0..54a0257 100644
--- a/src/workbook-view.c
+++ b/src/workbook-view.c
@@ -1,4 +1,4 @@
-/* vim: set sw=8: */
+/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* workbook-view.c: View functions for the workbook
*
@@ -79,6 +79,7 @@ enum {
PROP_SHOW_HORIZONTAL_SCROLLBAR,
PROP_SHOW_VERTICAL_SCROLLBAR,
PROP_SHOW_NOTEBOOK_TABS,
+ PROP_SHOW_FUNCTION_CELL_MARKERS,
PROP_DO_AUTO_COMPLETION,
PROP_PROTECTED,
PROP_PREFERRED_WIDTH,
@@ -229,6 +230,8 @@ wb_view_set_attribute (WorkbookView *wbv, char const *name, char const *value)
g_object_set (obj, "show_vertical_scrollbar", res, NULL);
else if (!strcmp (tname , "show_notebook_tabs"))
g_object_set (obj, "show_notebook_tabs", res, NULL);
+ else if (!strcmp (tname , "show_function_cell_markers"))
+ g_object_set (obj, "show_function_cell_markers", res, NULL);
else if (!strcmp (tname , "do_auto_completion"))
g_object_set (obj, "do_auto_completion", res, NULL);
else if (!strcmp (tname , "is_protected"))
@@ -701,6 +704,11 @@ wb_view_set_property (GObject *object, guint property_id,
case PROP_SHOW_NOTEBOOK_TABS:
wbv->show_notebook_tabs = !!g_value_get_boolean (value);
break;
+ case PROP_SHOW_FUNCTION_CELL_MARKERS:
+ wbv->show_function_cell_markers = !!g_value_get_boolean (value);
+ if (wbv->current_sheet)
+ sheet_redraw_all (wbv->current_sheet, FALSE);
+ break;
case PROP_DO_AUTO_COMPLETION:
wbv->do_auto_completion = !!g_value_get_boolean (value);
break;
@@ -750,6 +758,9 @@ wb_view_get_property (GObject *object, guint property_id,
case PROP_SHOW_NOTEBOOK_TABS:
g_value_set_boolean (value, wbv->show_notebook_tabs);
break;
+ case PROP_SHOW_FUNCTION_CELL_MARKERS:
+ g_value_set_boolean (value, wbv->show_function_cell_markers);
+ break;
case PROP_DO_AUTO_COMPLETION:
g_value_set_boolean (value, wbv->do_auto_completion);
break;
@@ -918,6 +929,15 @@ workbook_view_class_init (GObjectClass *gobject_class)
G_PARAM_READWRITE));
g_object_class_install_property
(gobject_class,
+ PROP_SHOW_FUNCTION_CELL_MARKERS,
+ g_param_spec_boolean ("show-function-cell-markers",
+ _("Show formula cell markers"),
+ _("Mark each cell containing a formula"),
+ FALSE,
+ GSF_PARAM_STATIC |
+ G_PARAM_READWRITE));
+ g_object_class_install_property
+ (gobject_class,
PROP_DO_AUTO_COMPLETION,
g_param_spec_boolean ("do-auto-completion",
_("Do auto completion"),
@@ -976,6 +996,7 @@ workbook_view_new (Workbook *wb)
wbv->show_horizontal_scrollbar = TRUE;
wbv->show_vertical_scrollbar = TRUE;
wbv->show_notebook_tabs = TRUE;
+ wbv->show_function_cell_markers = FALSE;
wbv->do_auto_completion = gnm_conf_get_core_gui_editing_autocomplete ();
wbv->is_protected = FALSE;
diff --git a/src/workbook-view.h b/src/workbook-view.h
index f85aac3..0c3e786 100644
--- a/src/workbook-view.h
+++ b/src/workbook-view.h
@@ -21,6 +21,7 @@ struct _WorkbookView {
gboolean show_horizontal_scrollbar;
gboolean show_vertical_scrollbar;
gboolean show_notebook_tabs;
+ gboolean show_function_cell_markers;
gboolean do_auto_completion;
gboolean is_protected;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]