[PATCH] implementation of cell 'locked' property. (take 2)



Here's the cell 'locked' patch, take 2.  This is for 1.1.x only and has
some fixes/improvements/clean-up suggested by Jody.  File-by-file summary
below, for the changelog, although most of this is the same as before.

* plugins/excel/ms-excel-write.c (build_xf_data): change a comment to
   indicate that we do, now, implement locked cells.
* 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/wookbook-control-gui.c (delete_sheet_if_possible, wbcg_validation_msg):
   Cleaned up some gtk_dialog_run's while I was at it.  Changed to
   gnumeric_dialog_run, which sets the transient property and closes the
   dialog when everything's done.  It's not really related to locked
   cells, sorry.
* src/workbook-control-gui.c (wbcg_locked_msg, workbook_control_gui_ctor_class):
* src/workbook-control-priv.h:
* src/workbook-control.c (wb_control_locked_msg):
* src/workbook-control.h:
   virtual method to put up error dialog when we attempt to edit a locked
   cell.  Based on wb_control_validation_msg.
* 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::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 '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.

Enjoy!
  --scott

immediate Bush COBRA JANE domestic disruption supercomputer early warning 
Nader RUCKUS Soviet  nuclear D5 SLBM Moscow assassination EZLN Boston 
              ( http://lesser-magoo.lcs.mit.edu/~cananian )

Attachment: patch-HEAD-cvs.locked2
Description: Implementation of locked cells for 1.1.x. No grey-out.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]