[gnumeric] Add autofit actions to cell context menu.



commit 139df3e43e3f95b71666262bb1a46b61df42a140
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Thu Jul 8 23:40:01 2010 -0600

    Add autofit actions to cell context menu.
    
    2010-07-08  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/sheet-control-gui.c (context_menu_handler): add autofit actions
    	(scg_context_menu): add autofit items
    	* src/wbc-gtk-actions.c: add some icons to actions

 ChangeLog               |    6 ++++++
 NEWS                    |    1 +
 src/sheet-control-gui.c |   28 ++++++++++++++++++++++++++++
 src/wbc-gtk-actions.c   |   28 +++++++++++++++-------------
 4 files changed, 50 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e895191..f763391 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-07-08  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* src/sheet-control-gui.c (context_menu_handler): add autofit actions
+	(scg_context_menu): add autofit items
+	* src/wbc-gtk-actions.c: add some icons to actions
+
+2010-07-08  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* component/Gnumeric-embed.xml.in: add menu items to Format->Cells
 	* src/GNOME_Gnumeric-gtk.xml.in: ditto
 	* src/HILDON_Gnumeric-gtk.xml.in: ditto
diff --git a/NEWS b/NEWS
index fa70668..c489f93 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,7 @@ Andreas:
 	* Add merge and unmerge menu items.
 	* Add menu item to autofit column width or row height based on the 
 	  selection only. [#125595]
+	* Add autofit actions to cell context menu.
 
 Jean:
 	* Fix strong/weak cursor display. [#623241]
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index aa8110b..3567475 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -1773,12 +1773,16 @@ enum {
 	CONTEXT_DELETE,
 	CONTEXT_CLEAR_CONTENT,
 	CONTEXT_FORMAT_CELL,
+	CONTEXT_CELL_AUTOFIT_WIDTH,
+	CONTEXT_CELL_AUTOFIT_HEIGHT,
 	CONTEXT_COL_WIDTH,
 	CONTEXT_COL_HIDE,
 	CONTEXT_COL_UNHIDE,
+	CONTEXT_COL_AUTOFIT,
 	CONTEXT_ROW_HEIGHT,
 	CONTEXT_ROW_HIDE,
 	CONTEXT_ROW_UNHIDE,
+	CONTEXT_ROW_AUTOFIT,
 	CONTEXT_COMMENT_EDIT,
 	CONTEXT_COMMENT_ADD,
 	CONTEXT_COMMENT_REMOVE,
@@ -1827,9 +1831,22 @@ context_menu_handler (GnumericPopupMenuElement const *element,
 	case CONTEXT_FORMAT_CELL :
 		dialog_cell_format (wbcg, FD_CURRENT);
 		break;
+	case CONTEXT_CELL_AUTOFIT_HEIGHT :
+		workbook_cmd_autofit_selection 
+			(wbc, wb_control_cur_sheet (wbc), FALSE);
+		break;
+	case CONTEXT_CELL_AUTOFIT_WIDTH :
+		workbook_cmd_autofit_selection 
+			(wbc, wb_control_cur_sheet (wbc), TRUE);
+		break;
+		break;
 	case CONTEXT_COL_WIDTH :
 		dialog_col_width (wbcg, FALSE);
 		break;
+	case CONTEXT_COL_AUTOFIT :
+		workbook_cmd_resize_selected_colrow 
+			(wbc, wb_control_cur_sheet (wbc), TRUE, -1);
+		break;
 	case CONTEXT_COL_HIDE :
 		cmd_selection_colrow_hide (wbc, TRUE, FALSE);
 		break;
@@ -1839,6 +1856,10 @@ context_menu_handler (GnumericPopupMenuElement const *element,
 	case CONTEXT_ROW_HEIGHT :
 		dialog_row_height (wbcg, FALSE);
 		break;
+	case CONTEXT_ROW_AUTOFIT :
+		workbook_cmd_resize_selected_colrow 
+			(wbc, wb_control_cur_sheet (wbc), FALSE, -1);
+		break;
 	case CONTEXT_ROW_HIDE :
 		cmd_selection_colrow_hide (wbc, FALSE, FALSE);
 		break;
@@ -2043,10 +2064,16 @@ scg_context_menu (SheetControlGUI *scg, GdkEventButton *event,
 
 		{ N_("_Format All Cells..."), GTK_STOCK_PROPERTIES,
 		    0, 0, CONTEXT_FORMAT_CELL },
+		{ N_("Cell"), NULL, 0, 0, -1},/* start sub menu */
+		{ N_("Auto Fit _Width"), "Gnumeric_ColumnSize",   0, 0, CONTEXT_CELL_AUTOFIT_WIDTH },
+		{ N_("Auto Fit _Height"), "Gnumeric_RowSize",   0, 0, CONTEXT_CELL_AUTOFIT_HEIGHT },
+		{ N_(""), NULL, 0, 0, -1},/* end sub menu */
+
 
 		/* Column specific (Note some labels duplicate row labels) */
 		{ N_("Column"), NULL, 0, 0, -1},/* start sub menu */
 		{ N_("_Width..."), "Gnumeric_ColumnSize",   0, 0, CONTEXT_COL_WIDTH },
+		{ N_("_Auto Fit Width"), "Gnumeric_ColumnSize",   0, 0, CONTEXT_COL_AUTOFIT },
 		{ N_("_Hide"),	   "Gnumeric_ColumnHide",   0, CONTEXT_DISABLE_FOR_ALL_COLS, CONTEXT_COL_HIDE },
 		{ N_("_Unhide"),   "Gnumeric_ColumnUnhide", 0, 0, CONTEXT_COL_UNHIDE },
 		{ N_(""), NULL, 0, 0, -1},/* end sub menu */
@@ -2054,6 +2081,7 @@ scg_context_menu (SheetControlGUI *scg, GdkEventButton *event,
 		/* Row specific (Note some labels duplicate col labels) */
 		{ N_("Row"), NULL, 0, 0, -1},/* start sub menu */
 		{ N_("Hei_ght..."), "Gnumeric_RowSize",   0, 0, CONTEXT_ROW_HEIGHT },
+		{ N_("_Auto Fit Height"), "Gnumeric_RowSize",   0, 0, CONTEXT_ROW_AUTOFIT },
 		{ N_("_Hide"),	    "Gnumeric_RowHide",   0, CONTEXT_DISABLE_FOR_ALL_ROWS, CONTEXT_ROW_HIDE },
 		{ N_("_Unhide"),    "Gnumeric_RowUnhide", 0, 0, CONTEXT_ROW_UNHIDE },
 		{ N_(""), NULL, 0, 0, -1},/* end sub menu */
diff --git a/src/wbc-gtk-actions.c b/src/wbc-gtk-actions.c
index 4219492..7084fd7 100644
--- a/src/wbc-gtk-actions.c
+++ b/src/wbc-gtk-actions.c
@@ -1781,7 +1781,7 @@ static GtkActionEntry const permanent_actions[] = {
 	{ "MenuEdit",		NULL, N_("_Edit") },
 		{ "MenuEditClear",	GTK_STOCK_CLEAR, N_("C_lear") },
 		{ "MenuEditDelete",	GTK_STOCK_DELETE, N_("_Delete") },
-		{ "MenuEditItems",	NULL, N_("_Modify") },
+		{ "MenuEditItems",	GTK_STOCK_EDIT, N_("_Modify") },
 		{ "MenuEditSheet",	NULL, N_("S_heet") },
 		{ "MenuEditSelect",	NULL, N_("_Select") },
 	{ "MenuView",		NULL, N_("_View") },
@@ -1883,7 +1883,7 @@ static GtkActionEntry const permanent_actions[] = {
 	{ "HelpDocs", GTK_STOCK_HELP, N_("_Contents"),
 		"F1", N_("Open a viewer for Gnumeric's documentation"),
 		G_CALLBACK (cb_help_docs) },
-	{ "HelpFunctions", NULL, N_("_Functions"),
+	{ "HelpFunctions", "Gnumeric_FormulaGuru", N_("_Functions"),
 		NULL, N_("Functions help"),
 		G_CALLBACK (cb_help_function) },
 	{ "HelpWeb", NULL, N_("Gnumeric on the _Web"),
@@ -2079,7 +2079,7 @@ static GtkActionEntry const actions[] = {
 	{ "ViewFreezeThawPanes", NULL, N_("_Freeze Panes"),
 		NULL, N_("Freeze the top left of the sheet"),
 		G_CALLBACK (cb_view_freeze_panes) },
-	{ "ViewZoom", NULL, N_("_Zoom..."),
+	{ "ViewZoom", GTK_STOCK_ZOOM_FIT, N_("_Zoom..."),
 		NULL, N_("Zoom the spreadsheet in or out"),
 		G_CALLBACK (cb_view_zoom) },
 	{ "ViewZoomIn", GTK_STOCK_ZOOM_IN, N_("Zoom _In"),
@@ -2136,7 +2136,7 @@ static GtkActionEntry const actions[] = {
 		G_CALLBACK (cb_define_name) },
 
 /* Format */
-	{ "FormatWorkbook", NULL, N_("View _Properties..."),
+	{ "FormatWorkbook", GTK_STOCK_PROPERTIES, N_("View _Properties..."),
 		NULL, N_("Modify the view properties"),
 		G_CALLBACK (cb_workbook_attr) },
 	{ "FormatAuto", NULL, N_("_Autoformat..."),
@@ -2150,10 +2150,10 @@ static GtkActionEntry const actions[] = {
 	{ "FormatCells", NULL, N_("_Format..."),
 		"<control>1", N_("Modify the formatting of the selected cells"),
 		G_CALLBACK (cb_format_cells) },
-	{ "FormatCellsFitHeight", NULL, N_("Auto Fit _Height"), NULL, 
+	{ "FormatCellsFitHeight", "Gnumeric_RowSize", N_("Auto Fit _Height"), NULL, 
 	  N_("Ensure rows are just tall enough to display content of selection"),
 	  G_CALLBACK (cb_format_cells_auto_fit_height) },
-	{ "FormatCellsFitWidth", NULL, N_("Auto Fit _Width"), NULL, 
+	{ "FormatCellsFitWidth", "Gnumeric_ColumnSize", N_("Auto Fit _Width"), NULL, 
 	  N_("Ensure columns are just wide enough to display content of selection"),
 	  G_CALLBACK (cb_format_cells_auto_fit_width) },
 	
@@ -2162,7 +2162,7 @@ static GtkActionEntry const actions[] = {
 	{ "ColumnSize", "Gnumeric_ColumnSize", N_("_Width..."),
 		NULL, N_("Change width of the selected columns"),
 		G_CALLBACK (cb_set_column_width) },
-	{ "ColumnAutoSize", NULL, N_("_Auto Fit Width"),
+	{ "ColumnAutoSize", "Gnumeric_ColumnSize", N_("_Auto Fit Width"),
 		NULL, N_("Ensure columns are just wide enough to display their content"),
 		G_CALLBACK (cb_format_column_auto_fit) },
 	{ "ColumnHide", "Gnumeric_ColumnHide", N_("_Hide"),
@@ -2171,7 +2171,7 @@ static GtkActionEntry const actions[] = {
 	{ "ColumnUnhide", "Gnumeric_ColumnUnhide", N_("_Unhide"),
 		"<control>parenright", N_("Make any hidden columns in the selection visible"),
 		G_CALLBACK (cb_format_column_unhide) },
-	{ "ColumnDefaultSize", NULL, N_("_Standard Width"),
+	{ "ColumnDefaultSize", "Gnumeric_ColumnSize", N_("_Standard Width"),
 		NULL, N_("Change the default column width"),
 		G_CALLBACK (cb_format_column_std_width) },
 
@@ -2179,7 +2179,7 @@ static GtkActionEntry const actions[] = {
 	{ "RowSize", "Gnumeric_RowSize", N_("H_eight..."),
 		NULL, N_("Change height of the selected rows"),
 		G_CALLBACK (cb_set_row_height) },
-	{ "RowAutoSize", NULL, N_("_Auto Fit Height"),
+	{ "RowAutoSize", "Gnumeric_RowSize", N_("_Auto Fit Height"),
 		NULL, N_("Ensure rows are just tall enough to display their content"),
 		G_CALLBACK (cb_format_row_auto_fit) },
 	{ "RowHide", "Gnumeric_RowHide", N_("_Hide"),
@@ -2188,7 +2188,7 @@ static GtkActionEntry const actions[] = {
 	{ "RowUnhide", "Gnumeric_RowUnhide", N_("_Unhide"),
 		"<control>parenleft", N_("Make any hidden rows in the selection visible"),
 		G_CALLBACK (cb_format_row_unhide) },
-	{ "RowDefaultSize", NULL, N_("_Standard Height"),
+	{ "RowDefaultSize", "Gnumeric_RowSize", N_("_Standard Height"),
 		NULL, N_("Change the default row height"),
 		G_CALLBACK (cb_format_row_std_height) },
 
@@ -2579,8 +2579,10 @@ static GtkToggleActionEntry const toggle_actions[] = {
 	{ "SheetOutlineRight", NULL, N_("Outlines _Right"),
 		NULL, N_("Toggle whether to display column outlines on the left or right"),
 		G_CALLBACK (cb_sheet_pref_outline_symbols_right) },
-	{ "SheetDisplayFormulas", NULL, N_("Display _Formulas"),
-		"<control>quoteleft", N_("Display the value of a formula or the formula itself"),
+	{ "SheetDisplayFormulas", "Gnumeric_FormulaGuru", 
+	  N_("Display _Formulas"),
+	  "<control>quoteleft", 
+	  N_("Display the value of a formula or the formula itself"),
 		G_CALLBACK (cb_sheet_pref_display_formulas) },
 	{ "SheetHideZeros", NULL, N_("_Hide Zeros"),
 		NULL, N_("Toggle whether or not to display zeros as blanks"),
@@ -2636,7 +2638,7 @@ static GtkToggleActionEntry const toggle_actions[] = {
 		N_("Toggle visibility of statusbar"),
 		G_CALLBACK (cb_view_statusbar), TRUE },
 
-	{ "ViewFullScreen", GTK_STOCK_ZOOM_FIT,
+	{ "ViewFullScreen", GTK_STOCK_FULLSCREEN,
 		N_("F_ull Screen"), FULLSCREEN_ACCEL,
 		N_("Switch to or from full screen mode"),
 		G_CALLBACK (cb_view_fullscreen), FALSE }



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