[gnumeric] Provide for conditional borders



commit 7ecfb47698ca6d815d42403e51916bb4be77dde2
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Fri Jul 8 00:27:13 2011 -0600

    Provide for conditional borders
    
    2011-07-08  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* cell-format-cond-def.ui: enable border checkbox
    	* dialog-cell-format-cond.c (cb_c_fmt_dialog_chooser_buttons): handle
    	border items
    	* dialog-cell-format.c (cb_fmt_dialog_dialog_buttons): store border
    	info in style for style selection
    	(dialog_cell_format_select_style): set selection mask to 1

 src/dialogs/ChangeLog                 |    9 +++++++++
 src/dialogs/cell-format-cond-def.ui   |    1 -
 src/dialogs/dialog-cell-format-cond.c |   13 ++++++++++++-
 src/dialogs/dialog-cell-format.c      |   21 ++++++++++++++++-----
 4 files changed, 37 insertions(+), 7 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 91ba852..e33e7f1 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,12 @@
+2011-07-08  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* cell-format-cond-def.ui: enable border checkbox
+	* dialog-cell-format-cond.c (cb_c_fmt_dialog_chooser_buttons): handle
+	border items
+	* dialog-cell-format.c (cb_fmt_dialog_dialog_buttons): store border
+	info in style for style selection
+	(dialog_cell_format_select_style): set selection mask to 1
+
 2011-07-07  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* cell-format-cond-def.ui: enable number and alignment checkboxes
diff --git a/src/dialogs/cell-format-cond-def.ui b/src/dialogs/cell-format-cond-def.ui
index a022db2..2455d69 100644
--- a/src/dialogs/cell-format-cond-def.ui
+++ b/src/dialogs/cell-format-cond-def.ui
@@ -218,7 +218,6 @@
               <object class="GtkCheckButton" id="check-border">
                 <property name="label" translatable="yes">Border</property>
                 <property name="visible">True</property>
-                <property name="sensitive">False</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">False</property>
                 <property name="use_action_appearance">False</property>
diff --git a/src/dialogs/dialog-cell-format-cond.c b/src/dialogs/dialog-cell-format-cond.c
index d5dd1a4..c3a5bcd 100644
--- a/src/dialogs/dialog-cell-format-cond.c
+++ b/src/dialogs/dialog-cell-format-cond.c
@@ -307,7 +307,18 @@ cb_c_fmt_dialog_chooser_buttons (GtkWidget *btn, CFormatChooseState *state)
 			}
 			if (cb_c_fmt_dialog_chooser_check_page 
 			     (state, "check-border", FD_BORDER)) {
-
+				gnm_style_merge_element (cond->overlay, state->style, 
+							 MSTYLE_BORDER_TOP);
+				gnm_style_merge_element (cond->overlay, state->style, 
+							 MSTYLE_BORDER_BOTTOM);
+				gnm_style_merge_element (cond->overlay, state->style, 
+							 MSTYLE_BORDER_LEFT);
+				gnm_style_merge_element (cond->overlay, state->style, 
+							 MSTYLE_BORDER_RIGHT);
+				gnm_style_merge_element (cond->overlay, state->style, 
+							 MSTYLE_BORDER_REV_DIAGONAL);
+				gnm_style_merge_element (cond->overlay, state->style, 
+							 MSTYLE_BORDER_DIAGONAL);
 			}
 			if (cb_c_fmt_dialog_chooser_check_page 
 			    (state, "check-protection", FD_PROTECTION)) {
diff --git a/src/dialogs/dialog-cell-format.c b/src/dialogs/dialog-cell-format.c
index 7b92df4..f11a281 100644
--- a/src/dialogs/dialog-cell-format.c
+++ b/src/dialogs/dialog-cell-format.c
@@ -1982,7 +1982,6 @@ cb_fmt_dialog_dialog_buttons (GtkWidget *btn, FormatState *state)
 #endif
 
 	if (btn == state->apply_button || btn == state->ok_button) {
-		GnmBorder *borders[GNM_STYLE_BORDER_EDGE_MAX];
 		int i;
 
 		/* We need to make sure the right sheet is active */
@@ -2019,16 +2018,27 @@ cb_fmt_dialog_dialog_buttons (GtkWidget *btn, FormatState *state)
 			state->protection.sheet_protected_changed = FALSE;
 		}
 
-		for (i = GNM_STYLE_BORDER_TOP; i < GNM_STYLE_BORDER_EDGE_MAX; i++)
-			borders[i] = border_get_mstyle (state, i);
 
-		if (state->style_selector.is_selector)
+		if (state->style_selector.is_selector) {
+			for (i = GNM_STYLE_BORDER_TOP; i <= GNM_STYLE_BORDER_DIAG; i++) {
+				GnmBorder *b = border_get_mstyle (state, i);
+				if (b)
+					gnm_style_set_border 
+						(state->result, 
+						 MSTYLE_BORDER_TOP + 
+						 (int)(i - GNM_STYLE_BORDER_TOP),
+						 b);
+			}
 			dialog_cell_format_style_added 
 				(state->style_selector.closure,
 				 state->result);
-		else
+		} else {
+			GnmBorder *borders[GNM_STYLE_BORDER_EDGE_MAX];
+			for (i = GNM_STYLE_BORDER_TOP; i < GNM_STYLE_BORDER_EDGE_MAX; i++)
+				borders[i] = border_get_mstyle (state, i);
 			cmd_selection_format (WORKBOOK_CONTROL (state->wbcg),
 					      state->result, borders, NULL);
+		}
 		/* state->result got absorbed.  */
 		/* Get a fresh style to accumulate results in */
 		state->result = gnm_style_new ();
@@ -2529,6 +2539,7 @@ dialog_cell_format_select_style (WBCGtk *wbcg, gint pages,
 	state->style_selector.is_selector = TRUE;
 	state->style_selector.w = w;
 	state->style_selector.closure = closure;
+	state->selection_mask	= 1;
 
 	fmt_dialog_impl (state, FD_BACKGROUND);
 



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