Commit 05b7b6ac authored by Jody Goldberg's avatar Jody Goldberg

More of the protection support.

parent 73a18b0f
2002-03-08 Jody Goldberg <jody@gnome.org>
* src/GNOME_Gnumeric.xml : switch Format->Workbook with
Format->AutoFormat
* src/workbook-control-gui.c (workbook_menu_format) : ditto.
* src/workbook-view.c (wb_view_is_protected) : new.
* src/workbook-edit.c (wbcg_edit_start) : load style directly
don't use cell_get_style. This enables support for protection of
blank cells. Use wb_view_is_protected, and command_context_invalid.
2002-03-08 C. Scott Ananian <cananian@lesser-magoo.lcs.mit.edu>
* src/gnumeric-canvas.c (gnm_canvas_key_mode_sheet): don't put us in
edit mode if wbcg_edit_start indicates the cell is locked.
* src/workbook-control-gui.c (cb_autosum, cb_autofunction): handle
case where wbcg_edit_start returns FALSE indicating that cell is
locked.
* src/workbook-edit.c (wbcg_edit_start): this function now returns a
boolean which indicates whether the 'edit_start' attempt succeeded.
Check cell properties to return FALSE if the cell is locked.
* src/workbook-edit.h (wbcg_edit_start): modify the prototype as per above.
* src/workbook-view.c (wb_view_set_attribute, workbook_view_init):
Remove ARG_VIEW_* enumeration, which isn't used after Gnome2 port.
Add WorkbookView::is_protected attribute, and initialize it to
FALSE. The update to wb_view_set_attribute is enough to get
xml_sax import working properly (yay, modular code!).
* src/workbook-view.h: add 'is_protected' field to WorkbookView struct.
This is TRUE iff the workbook is locked.
* src/xml-io.c (xml_write_wbv_attributes):
Write the new 'protected' workbook view attribute. Two lines are
enough to get read/write from xml_io working. Score one for
xml_sax: zero should have been sufficient.
* src/dialogs/cell-format.glade: The 'worksheet protected' checkbox
shouldn't be greyed-out anymore.
* src/dialogs/dialog-cell-format.c (cb_protection_sheet_protected_toggle,
fmt_dialog_init_protection_page, cb_fmt_dialog_dialog_buttons):
connect up the 'worksheet protected' button in the
Format->Cells->Protection dialog. Update worksheet object when
toggled and mark that the dialog's changed.
* src/dialogs/dialog-workbook-attr.c src/dialogs/workbook-attr.glade:
Add Format->Worksheet->Protection dialog.
2002-03-08 Jon K Hellan <hellan@acm.org>
* src/command-context-stderr.c (ccs_class_init): Make gmorten happy.
......
2002-03-08 Jody Goldberg <jody@gnome.org>
* src/GNOME_Gnumeric.xml : switch Format->Workbook with
Format->AutoFormat
* src/workbook-control-gui.c (workbook_menu_format) : ditto.
* src/workbook-view.c (wb_view_is_protected) : new.
* src/workbook-edit.c (wbcg_edit_start) : load style directly
don't use cell_get_style. This enables support for protection of
blank cells. Use wb_view_is_protected, and command_context_invalid.
2002-03-08 C. Scott Ananian <cananian@lesser-magoo.lcs.mit.edu>
* src/gnumeric-canvas.c (gnm_canvas_key_mode_sheet): don't put us in
edit mode if wbcg_edit_start indicates the cell is locked.
* src/workbook-control-gui.c (cb_autosum, cb_autofunction): handle
case where wbcg_edit_start returns FALSE indicating that cell is
locked.
* src/workbook-edit.c (wbcg_edit_start): this function now returns a
boolean which indicates whether the 'edit_start' attempt succeeded.
Check cell properties to return FALSE if the cell is locked.
* src/workbook-edit.h (wbcg_edit_start): modify the prototype as per above.
* src/workbook-view.c (wb_view_set_attribute, workbook_view_init):
Remove ARG_VIEW_* enumeration, which isn't used after Gnome2 port.
Add WorkbookView::is_protected attribute, and initialize it to
FALSE. The update to wb_view_set_attribute is enough to get
xml_sax import working properly (yay, modular code!).
* src/workbook-view.h: add 'is_protected' field to WorkbookView struct.
This is TRUE iff the workbook is locked.
* src/xml-io.c (xml_write_wbv_attributes):
Write the new 'protected' workbook view attribute. Two lines are
enough to get read/write from xml_io working. Score one for
xml_sax: zero should have been sufficient.
* src/dialogs/cell-format.glade: The 'worksheet protected' checkbox
shouldn't be greyed-out anymore.
* src/dialogs/dialog-cell-format.c (cb_protection_sheet_protected_toggle,
fmt_dialog_init_protection_page, cb_fmt_dialog_dialog_buttons):
connect up the 'worksheet protected' button in the
Format->Cells->Protection dialog. Update worksheet object when
toggled and mark that the dialog's changed.
* src/dialogs/dialog-workbook-attr.c src/dialogs/workbook-attr.glade:
Add Format->Worksheet->Protection dialog.
2002-03-08 Jon K Hellan <hellan@acm.org>
* src/command-context-stderr.c (ccs_class_init): Make gmorten happy.
......
2002-03-08 Jody Goldberg <jody@gnome.org>
* src/GNOME_Gnumeric.xml : switch Format->Workbook with
Format->AutoFormat
* src/workbook-control-gui.c (workbook_menu_format) : ditto.
* src/workbook-view.c (wb_view_is_protected) : new.
* src/workbook-edit.c (wbcg_edit_start) : load style directly
don't use cell_get_style. This enables support for protection of
blank cells. Use wb_view_is_protected, and command_context_invalid.
2002-03-08 C. Scott Ananian <cananian@lesser-magoo.lcs.mit.edu>
* src/gnumeric-canvas.c (gnm_canvas_key_mode_sheet): don't put us in
edit mode if wbcg_edit_start indicates the cell is locked.
* src/workbook-control-gui.c (cb_autosum, cb_autofunction): handle
case where wbcg_edit_start returns FALSE indicating that cell is
locked.
* src/workbook-edit.c (wbcg_edit_start): this function now returns a
boolean which indicates whether the 'edit_start' attempt succeeded.
Check cell properties to return FALSE if the cell is locked.
* src/workbook-edit.h (wbcg_edit_start): modify the prototype as per above.
* src/workbook-view.c (wb_view_set_attribute, workbook_view_init):
Remove ARG_VIEW_* enumeration, which isn't used after Gnome2 port.
Add WorkbookView::is_protected attribute, and initialize it to
FALSE. The update to wb_view_set_attribute is enough to get
xml_sax import working properly (yay, modular code!).
* src/workbook-view.h: add 'is_protected' field to WorkbookView struct.
This is TRUE iff the workbook is locked.
* src/xml-io.c (xml_write_wbv_attributes):
Write the new 'protected' workbook view attribute. Two lines are
enough to get read/write from xml_io working. Score one for
xml_sax: zero should have been sufficient.
* src/dialogs/cell-format.glade: The 'worksheet protected' checkbox
shouldn't be greyed-out anymore.
* src/dialogs/dialog-cell-format.c (cb_protection_sheet_protected_toggle,
fmt_dialog_init_protection_page, cb_fmt_dialog_dialog_buttons):
connect up the 'worksheet protected' button in the
Format->Cells->Protection dialog. Update worksheet object when
toggled and mark that the dialog's changed.
* src/dialogs/dialog-workbook-attr.c src/dialogs/workbook-attr.glade:
Add Format->Worksheet->Protection dialog.
2002-03-08 Jon K Hellan <hellan@acm.org>
* src/command-context-stderr.c (ccs_class_init): Make gmorten happy.
......
......@@ -449,14 +449,14 @@
<menuitem name="SheetHideRowHeader" verb="" />
</submenu>
<menuitem name="FormatAuto" verb=""
_label="_Autoformat..."
_tip="Format a region of cells according to a pre-defined template"/>
<menuitem name="FormatWorkbook" verb=""
_label="_Workbook..."
_tip="Modify the workbook attributes"/>
<menuitem name="FormatAuto" verb=""
_label="_Autoformat..."
_tip="Format a region of cells according to a pre-defined template"/>
</submenu>
<submenu name="Tools" _label="_Tools">
......
......@@ -9,7 +9,7 @@
#define COMMAND_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), COMMAND_CONTEXT_TYPE, CommandContext))
#define IS_COMMAND_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), COMMAND_CONTEXT_TYPE))
GType command_context_get_type (void);
GType command_context_get_type (void);
/*
* These are the exceptions that can arise.
......@@ -24,14 +24,14 @@ void gnumeric_error_invalid (CommandContext *context,
char const *msg, char const *val);
void gnumeric_error_splits_array (CommandContext *context,
char const *cmd, Range const *array);
void gnumeric_error_error_info (CommandContext *context, ErrorInfo *error);
void gnumeric_progress_set (CommandContext *context, gfloat f);
void gnumeric_error_error_info (CommandContext *context, ErrorInfo *error);
void gnumeric_progress_set (CommandContext *context, gfloat f);
void gnumeric_progress_message_set (CommandContext *context, gchar const *msg);
/* Push a printf template to the list. The template is used to provide
* context for error messages. E.g.: "Could not read file: %s". */
void command_context_pop_err_template (CommandContext *context);
void command_context_pop_err_template (CommandContext *context);
void command_context_push_err_template (CommandContext *context,
const char *template_str);
char const *template_str);
#endif /* GNUMERIC_COMMAND_CONTEXT_H */
......@@ -302,7 +302,8 @@ gnm_canvas_key_mode_sheet (GnumericCanvas *gcanvas, GdkEventKey *event)
if (gnm_canvas_guru_key (wbcg, event))
break;
wbcg_edit_start (wbcg, FALSE, FALSE);
if (!wbcg_edit_start (wbcg, FALSE, FALSE))
return FALSE; /* attempt to edit failed */
/* fall down */
case GDK_BackSpace:
......@@ -322,7 +323,8 @@ gnm_canvas_key_mode_sheet (GnumericCanvas *gcanvas, GdkEventKey *event)
if (event->length == 0)
return FALSE;
wbcg_edit_start (wbcg, TRUE, TRUE);
if (!wbcg_edit_start (wbcg, TRUE, TRUE))
return FALSE; /* attempt to edit failed */
}
scg_rangesel_stop (gcanvas->simple.scg, FALSE);
......
......@@ -254,6 +254,7 @@ sheet_new (Workbook *wb, char const *name)
sheet->hide_grid = FALSE;
sheet->hide_col_header = FALSE;
sheet->hide_row_header = FALSE;
sheet->is_protected = FALSE;
sheet->display_outlines = TRUE;
sheet->outline_symbols_below = TRUE;
sheet->outline_symbols_right = TRUE;
......
......@@ -63,6 +63,7 @@ struct _Sheet {
gboolean hide_grid;
gboolean hide_col_header;
gboolean hide_row_header;
gboolean is_protected;
gboolean display_outlines;
gboolean outline_symbols_below;
......
......@@ -125,7 +125,7 @@ validation_eval (WorkbookControl *wbc, MStyle const *mstyle,
return VALIDATION_STATUS_VALID;
v = mstyle_get_validation (mstyle);
g_return_val_if_fail (v != NULL, 1);
g_return_val_if_fail (v != NULL, VALIDATION_STATUS_VALID);
if (v->style == VALIDATION_TYPE_ANY)
return VALIDATION_STATUS_VALID;
......
......@@ -867,6 +867,8 @@ xml_write_wbv_attributes (XmlParseContext *ctxt, WorkbookView *wbv)
wbv->show_notebook_tabs ? "TRUE" : "FALSE");
xml_write_attribute (attributes, "WorkbookView::do_auto_completion",
wbv->do_auto_completion ? "TRUE" : "FALSE");
xml_write_attribute (attributes, "WorkbookView::is_protected",
wbv->is_protected ? "TRUE" : "FALSE");
return attributes;
}
......
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