Commit 9db88417 authored by Andreas J. Guelzow's avatar Andreas J. Guelzow Committed by Andreas J. Guelzow

renamed to editable_label_start_editing and made non-static

2002-03-15  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* widget-editable-label.[ch] (el_start_editing) : renamed to
	  editable_label_start_editing and made non-static
	(editable_label_set_color) : added third argument
	(editable_label_new) : ditto

2002-03-15  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* dialog-sheet-order.c : support changes to tab colors.
	* sheet-order.glade : rearrange to allow for color pickers

2002-03-15  Andreas J. Guelzow <aguelzow@taliesin.ca>

	* src/commands.c : support tab color changes in cmd_reorganize_sheets
	* src/commands.h (cmd_reorganize_sheets) : add arguments
	* src/sheet.c (sheet_set_tab_color) : add third argument
	(sheet_new) : initialize tab_text_color
	(sheet_destroy) : free tab_text_color
	* src/sheet.h : add tab_text_color to _Sheet
	(sheet_set_tab_color) : add third argument
	* src/workbook-control-gui.c (wbcg_sheet_add) : also set tab_text_color
	(wbcg_sheet_rename) : add arguments to call of cmd_reorganize_sheets
	(cb_insert_sheet) : ditto
	* src/workbook.c (workbook_sheet_reorganize) : support changing of tab
	  colors
	* src/workbook.h (workbook_sheet_reorganize) : add arguments
	* src/xml-io.c : read and write TabTextColor

2002-03-15  Andreas J. Guelzow <aguelzow@taiesin.ca>

	* ms-excel-read.c : calculate desired tab_text_color upon reading of
	  tab_color
parent 2c9e0473
2002-03-15 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/commands.c : support tab color changes in cmd_reorganize_sheets
* src/commands.h (cmd_reorganize_sheets) : add arguments
* src/sheet.c (sheet_set_tab_color) : add third argument
(sheet_new) : initialize tab_text_color
(sheet_destroy) : free tab_text_color
* src/sheet.h : add tab_text_color to _Sheet
(sheet_set_tab_color) : add third argument
* src/workbook-control-gui.c (wbcg_sheet_add) : also set tab_text_color
(wbcg_sheet_rename) : add arguments to call of cmd_reorganize_sheets
(cb_insert_sheet) : ditto
* src/workbook.c (workbook_sheet_reorganize) : support changing of tab
colors
* src/workbook.h (workbook_sheet_reorganize) : add arguments
* src/xml-io.c : read and write TabTextColor
2002-03-14 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/commands.c (cmd_merge_data_redo) : don't create unnecessary cells
......
......@@ -4,6 +4,7 @@ Andreas:
* Make Single-Factor ANOVA undoable.
* Port search dialog.
* Add merge tool.
* Implement setting and changing of tab colors.
Jody:
* Fix XL import of external function names.
......
2002-03-15 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/commands.c : support tab color changes in cmd_reorganize_sheets
* src/commands.h (cmd_reorganize_sheets) : add arguments
* src/sheet.c (sheet_set_tab_color) : add third argument
(sheet_new) : initialize tab_text_color
(sheet_destroy) : free tab_text_color
* src/sheet.h : add tab_text_color to _Sheet
(sheet_set_tab_color) : add third argument
* src/workbook-control-gui.c (wbcg_sheet_add) : also set tab_text_color
(wbcg_sheet_rename) : add arguments to call of cmd_reorganize_sheets
(cb_insert_sheet) : ditto
* src/workbook.c (workbook_sheet_reorganize) : support changing of tab
colors
* src/workbook.h (workbook_sheet_reorganize) : add arguments
* src/xml-io.c : read and write TabTextColor
2002-03-14 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/commands.c (cmd_merge_data_redo) : don't create unnecessary cells
......
2002-03-15 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/commands.c : support tab color changes in cmd_reorganize_sheets
* src/commands.h (cmd_reorganize_sheets) : add arguments
* src/sheet.c (sheet_set_tab_color) : add third argument
(sheet_new) : initialize tab_text_color
(sheet_destroy) : free tab_text_color
* src/sheet.h : add tab_text_color to _Sheet
(sheet_set_tab_color) : add third argument
* src/workbook-control-gui.c (wbcg_sheet_add) : also set tab_text_color
(wbcg_sheet_rename) : add arguments to call of cmd_reorganize_sheets
(cb_insert_sheet) : ditto
* src/workbook.c (workbook_sheet_reorganize) : support changing of tab
colors
* src/workbook.h (workbook_sheet_reorganize) : add arguments
* src/xml-io.c : read and write TabTextColor
2002-03-14 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/commands.c (cmd_merge_data_redo) : don't create unnecessary cells
......
2002-03-15 Andreas J. Guelzow <aguelzow@taiesin.ca>
* ms-excel-read.c : calculate desired tab_text_color upon reading of
tab_color
2002-03-14 Jody Goldberg <jody@gnome.org>
* ms-obj.c (ms_obj_read_pre_biff8_obj) : doh! Fix sense of result so
......
......@@ -2832,6 +2832,8 @@ ms_excel_read_tab_color (BiffQuery *q, ExcelSheet *esheet)
#endif
guint8 color_index;
StyleColor *color;
StyleColor *text_color;
int contrast;
g_return_if_fail (q->length == 20);
......@@ -2840,8 +2842,12 @@ ms_excel_read_tab_color (BiffQuery *q, ExcelSheet *esheet)
*/
color_index = MS_OLE_GET_GUINT8 (q->data + 16);
color = ms_excel_palette_get (esheet->wb->palette, color_index);
sheet_set_tab_color (esheet->gnum_sheet, color);
contrast = color->color.red + color->color.green + color->color.blue;
if (contrast >= 0x18000)
text_color = style_color_black ();
else
text_color = style_color_white ();
sheet_set_tab_color (esheet->gnum_sheet, color, text_color);
if (color != NULL) {
d (1, printf ("%s tab colour = %04hx:%04hx:%04hx\n",
esheet->gnum_sheet->name_unquoted,
......
......@@ -58,6 +58,7 @@
#include "sheet-object-widget.h"
#include "sheet-object.h"
#include "sheet-control.h"
#include "style-color.h"
#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
......@@ -3971,6 +3972,11 @@ typedef struct
GSList *new_names;
GSList *old_names;
GSList *new_sheets;
GSList *color_changed;
GSList *new_colors_fore;
GSList *new_colors_back;
GSList *old_colors_fore;
GSList *old_colors_back;
} CmdReorganizeSheets;
GNUMERIC_MAKE_COMMAND (CmdReorganizeSheets, cmd_reorganize_sheets);
......@@ -3995,7 +4001,9 @@ cmd_reorganize_sheets_undo (GnumericCommand *cmd, WorkbookControl *wbc)
me->new_sheets = NULL;
return workbook_sheet_reorganize (me->wbc, me->changed_names, me->old_order,
me->old_names, me->new_names, NULL);
me->old_names, me->new_names, NULL,
me->color_changed,
me->old_colors_fore, me->old_colors_back);
}
static gboolean
......@@ -4007,9 +4015,19 @@ cmd_reorganize_sheets_redo (GnumericCommand *cmd, WorkbookControl *wbc)
return workbook_sheet_reorganize (me->wbc, me->changed_names, me->new_order,
me->new_names, me->old_names,
&me->new_sheets);
&me->new_sheets, me->color_changed,
me->new_colors_fore, me->new_colors_back);
}
static void
cb_slist_gdk_color_free (gpointer data, gpointer user_data)
{
if (data)
gdk_color_free (data);
}
static void
cmd_reorganize_sheets_finalize (GObject *cmd)
{
......@@ -4033,17 +4051,38 @@ cmd_reorganize_sheets_finalize (GObject *cmd)
e_free_string_slist (me->new_names);
me->new_names = NULL;
g_slist_free (me->color_changed);
me->color_changed = NULL;
g_slist_foreach (me->new_colors_fore, cb_slist_gdk_color_free, NULL);
g_slist_free (me->new_colors_fore);
me->new_colors_fore = NULL;
g_slist_foreach (me->new_colors_back, cb_slist_gdk_color_free, NULL);
g_slist_free (me->new_colors_back);
me->new_colors_back = NULL;
g_slist_foreach (me->old_colors_fore, cb_slist_gdk_color_free, NULL);
g_slist_free (me->old_colors_fore);
me->old_colors_fore = NULL;
g_slist_foreach (me->old_colors_back, cb_slist_gdk_color_free, NULL);
g_slist_free (me->old_colors_back);
me->old_colors_back = NULL;
gnumeric_command_finalize (cmd);
}
gboolean
cmd_reorganize_sheets (WorkbookControl *wbc, GSList *old_order, GSList *new_order,
GSList *changed_names, GSList *new_names, GSList *deleted_sheets)
GSList *changed_names, GSList *new_names, GSList *deleted_sheets,
GSList *color_changed, GSList *new_colors_back,
GSList *new_colors_fore)
{
GObject *obj;
CmdReorganizeSheets *me;
Workbook *wb = wb_control_workbook (wbc);
GSList *the_names;
GSList *the_sheets;
int selector = 0;
if (deleted_sheets) {
......@@ -4065,39 +4104,67 @@ cmd_reorganize_sheets (WorkbookControl *wbc, GSList *old_order, GSList *new_orde
me->new_names = new_names;
me->new_sheets = NULL;
me->old_names = NULL;
the_names = changed_names;
while (the_names) {
Sheet *sheet = the_names->data;
me->color_changed = color_changed;
me->new_colors_fore = new_colors_fore;
me->new_colors_back = new_colors_back;
me->old_colors_fore = NULL;
me->old_colors_back = NULL;
the_sheets = changed_names;
while (the_sheets) {
Sheet *sheet = the_sheets->data;
if (sheet == NULL)
me->old_names = g_slist_prepend (me->old_names, NULL);
else
me->old_names = g_slist_prepend
(me->old_names, g_strdup (sheet->name_unquoted));
the_names = the_names->next;
the_sheets = the_sheets->next;
}
the_sheets = color_changed;
while (the_sheets) {
Sheet *sheet = the_sheets->data;
if (sheet == NULL) {
me->old_colors_fore = g_slist_prepend (me->old_colors_fore, NULL);
me->old_colors_back = g_slist_prepend (me->old_colors_back, NULL);
} else {
me->old_colors_fore = g_slist_prepend (me->old_colors_fore,
sheet->tab_text_color ?
gdk_color_copy (&sheet->tab_text_color->color) : NULL);
me->old_colors_back = g_slist_prepend (me->old_colors_back,
sheet->tab_color ?
gdk_color_copy (&sheet->tab_color->color) : NULL);
}
the_sheets = the_sheets->next;
}
me->old_colors_fore = g_slist_reverse (me->old_colors_fore);
me->old_colors_back = g_slist_reverse (me->old_colors_back);
me->old_names = g_slist_reverse (me->old_names);
me->parent.sheet = NULL;
me->parent.size = 1;
me->parent.size = 1 + g_slist_length (color_changed) + g_slist_length (changed_names);
if (new_order == NULL)
if (new_order != NULL)
selector += (1 << 0);
if (new_names == NULL)
if (new_names != NULL) {
selector += (1 << 1);
else if (new_names->next == NULL)
if (new_names->next == NULL)
selector += (1 << 2);
}
if (color_changed != NULL)
selector += (1 << 3);
switch (selector) {
case 1:
case 0:
me->parent.cmd_descriptor = g_strdup ("Nothing to do?");
break;
case (1 << 1):
me->parent.cmd_descriptor = g_strdup (_("Renaming Sheets"));
break;
case 2:
case (1 << 0):
me->parent.cmd_descriptor = g_strdup (_("Reordering Sheets"));
break;
case 3:
me->parent.cmd_descriptor = g_strdup ("Nothing to do?");
break;
case 5:
case ((1 << 1) + (1 << 2)):
if (changed_names->data == NULL) {
if (new_names->data == NULL)
me->parent.cmd_descriptor = g_strdup (_("Adding a sheet"));
......@@ -4111,6 +4178,9 @@ cmd_reorganize_sheets (WorkbookControl *wbc, GSList *old_order, GSList *new_orde
((Sheet *)changed_names->data)->name_unquoted,
(const char *)new_names->data);
break;
case (1 << 3):
me->parent.cmd_descriptor = g_strdup (_("Changing Tab Colors"));
break;
default:
me->parent.cmd_descriptor = g_strdup (_("Reorganizing Sheets"));
break;
......@@ -4143,7 +4213,8 @@ cmd_rename_sheet (WorkbookControl *wbc, Sheet *sheet, char const *old_name, char
changed_names = g_slist_prepend (changed_names, sheet);
new_names = g_slist_prepend (new_names, g_strdup (new_name));
return cmd_reorganize_sheets (wbc, NULL, NULL, changed_names, new_names, NULL);
return cmd_reorganize_sheets (wbc, NULL, NULL, changed_names, new_names,
NULL, NULL, NULL, NULL);
}
/******************************************************************/
......
......@@ -86,7 +86,9 @@ gboolean cmd_object_move (WorkbookControl *wbc, SheetObject *so,
gboolean resize);
gboolean cmd_reorganize_sheets (WorkbookControl *wbc, GSList *old_order, GSList *new_order,
GSList *changed_names, GSList *new_names, GSList *deleted_sheets);
GSList *changed_names, GSList *new_names, GSList *deleted_sheets,
GSList *color_changed, GSList *new_colors_back,
GSList *new_colors_fore);
gboolean cmd_rename_sheet (WorkbookControl *wbc, Sheet *sheet,
char const *old_name, char const *new_name);
......
2002-03-15 Andreas J. Guelzow <aguelzow@taliesin.ca>
* dialog-sheet-order.c : support changes to tab colors.
* sheet-order.glade : rearrange to allow for color pickers
2002-03-15 Jukka-Pekka Iivonen <jiivonen@hutcs.cs.hut.fi>
* dialog-solver.c (cb_dialog_solve_clicked): Changes related to
......
......@@ -37,9 +37,11 @@
#include <style-color.h>
#include <commands.h>
#include <widgets/gnumeric-cell-renderer-text.h>
#include "pixmaps/gnumeric-stock-pixbufs.h"
#include <libgnome/gnome-i18n.h>
#include <glade/glade.h>
#include <gal/widgets/widget-color-combo.h>
typedef struct {
WorkbookControlGUI *wbcg;
......@@ -56,6 +58,8 @@ typedef struct {
GtkWidget *ok_btn;
GtkWidget *cancel_btn;
GdkPixbuf *sheet_image;
GtkWidget *ccombo_back;
GtkWidget *ccombo_fore;
GSList *old_order;
} SheetManager;
......@@ -96,7 +100,6 @@ location_of_iter (GtkTreeIter *iter, GtkListStore *model)
GtkTreeIter this_iter;
gint n = 0;
gtk_tree_model_get (GTK_TREE_MODEL (model), iter, SHEET_POINTER, &sheet, -1);
while (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (model),
......@@ -112,6 +115,34 @@ location_of_iter (GtkTreeIter *iter, GtkListStore *model)
return -1;
}
static void
cb_color_changed_fore (ColorCombo *color_combo, GdkColor *color, gboolean custom,
gboolean by_user, gboolean is_default, SheetManager *state)
{
GtkTreeIter sel_iter;
GtkTreeSelection *selection = gtk_tree_view_get_selection (state->sheet_list);
if (gtk_tree_selection_get_selected (selection, NULL, &sel_iter)) {
gtk_list_store_set (state->model, &sel_iter,
FOREGROUND_COLOUR_POINTER, color,
-1);
}
}
static void
cb_color_changed_back (ColorCombo *color_combo, GdkColor *color, gboolean custom,
gboolean by_user, gboolean is_default, SheetManager *state)
{
GtkTreeIter sel_iter;
GtkTreeSelection *selection = gtk_tree_view_get_selection (state->sheet_list);
if (gtk_tree_selection_get_selected (selection, NULL, &sel_iter)) {
gtk_list_store_set (state->model, &sel_iter,
BACKGROUND_COLOUR_POINTER, color,
-1);
}
}
/**
* Refreshes the buttons on a row (un)selection and selects the chosen sheet
* for this view.
......@@ -124,6 +155,7 @@ cb_selection_changed (GtkTreeSelection *ignored, SheetManager *state)
gint row;
Sheet *sheet;
gboolean is_deleted;
GdkColor *fore, *back;
GtkTreeSelection *selection = gtk_tree_view_get_selection (state->sheet_list);
gtk_widget_set_sensitive (state->add_btn, TRUE);
......@@ -133,13 +165,25 @@ cb_selection_changed (GtkTreeSelection *ignored, SheetManager *state)
gtk_widget_set_sensitive (state->up_btn, FALSE);
gtk_widget_set_sensitive (state->down_btn, FALSE);
gtk_widget_set_sensitive (state->delete_btn, FALSE);
gtk_widget_set_sensitive (state->ccombo_back, FALSE);
gtk_widget_set_sensitive (state->ccombo_fore, FALSE);
return;
}
gtk_tree_model_get (GTK_TREE_MODEL (state->model), &iter,
IS_DELETED, &is_deleted,
SHEET_POINTER, &sheet,
BACKGROUND_COLOUR_POINTER, &back,
FOREGROUND_COLOUR_POINTER, &fore,
-1);
color_combo_set_color (COLOR_COMBO (state->ccombo_back), back);
if (back)
gdk_color_free (back);
color_combo_set_color (COLOR_COMBO (state->ccombo_fore), fore);
if (fore)
gdk_color_free (fore);
gtk_widget_set_sensitive (state->ccombo_back, TRUE);
gtk_widget_set_sensitive (state->ccombo_fore, TRUE);
gtk_widget_set_sensitive (state->delete_btn, TRUE);
gtk_button_set_label (GTK_BUTTON (state->delete_btn),
is_deleted ? GTK_STOCK_UNDELETE : GTK_STOCK_DELETE);
......@@ -187,14 +231,13 @@ populate_sheet_list (SheetManager *state)
for (i = 0 ; i < n ; i++) {
Sheet *sheet = workbook_sheet_by_index (
wb_control_workbook (WORKBOOK_CONTROL (state->wbcg)), i);
GdkColor *color = &sheet->tab_color->color;
int contrast;
GdkColor text_color;
GdkColor *color = NULL;
GdkColor *text_color = NULL;
if (color == NULL)
color = &gs_white;
contrast = color->red + color->green + color->blue;
text_color = (contrast >= 0x18000) ? gs_black : gs_white;
if (sheet->tab_color)
color = &sheet->tab_color->color;
if (sheet->tab_text_color)
text_color = &sheet->tab_text_color->color;
gtk_list_store_append (state->model, &iter);
gtk_list_store_set (state->model, &iter,
......@@ -205,7 +248,7 @@ populate_sheet_list (SheetManager *state)
IS_EDITABLE_COLUMN, TRUE,
IS_DELETED, FALSE,
BACKGROUND_COLOUR_POINTER, color,
FOREGROUND_COLOUR_POINTER, &text_color,
FOREGROUND_COLOUR_POINTER, text_color,
-1);
if (sheet == cur_sheet)
gtk_tree_selection_select_iter (selection, &iter);
......@@ -262,7 +305,7 @@ cb_item_move (SheetManager *state, gint direction)
gint row;
gboolean is_deleted;
gboolean is_editable;
GdkColor *back, *front;
GdkColor *back, *fore;
GtkTreeSelection *selection = gtk_tree_view_get_selection (state->sheet_list);
if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
......@@ -275,7 +318,7 @@ cb_item_move (SheetManager *state, gint direction)
SHEET_POINTER, &sheet,
IS_DELETED, &is_deleted,
BACKGROUND_COLOUR_POINTER, &back,
FOREGROUND_COLOUR_POINTER, &front,
FOREGROUND_COLOUR_POINTER, &fore,
-1);
row = location_of_iter (&iter, state->model);
if (row + direction < 0)
......@@ -290,8 +333,12 @@ cb_item_move (SheetManager *state, gint direction)
SHEET_POINTER, sheet,
IS_DELETED, is_deleted,
BACKGROUND_COLOUR_POINTER, back,
FOREGROUND_COLOUR_POINTER, front,
FOREGROUND_COLOUR_POINTER, fore,
-1);
if (back)
gdk_color_free (back);
if (fore)
gdk_color_free (fore);
g_free (name);
g_free (new_name);
gtk_tree_selection_select_iter (selection, &iter);
......@@ -348,8 +395,8 @@ cb_add_clicked (GtkWidget *ignore, SheetManager *state)
SHEET_POINTER, NULL,
IS_EDITABLE_COLUMN, TRUE,
IS_DELETED, FALSE,
BACKGROUND_COLOUR_POINTER, &gs_white,
FOREGROUND_COLOUR_POINTER, &gs_black,
BACKGROUND_COLOUR_POINTER, NULL,
FOREGROUND_COLOUR_POINTER, NULL,
-1);
gtk_tree_selection_select_iter (selection, &iter);
g_free (name);
......@@ -408,6 +455,15 @@ cb_delete_sheets (gpointer data, gpointer dummy)
workbook_sheet_delete (sheet);
}
static gboolean
sheet_order_gdk_color_equal (GdkColor *color_a, GdkColor *color_b)
{
if (color_a == NULL && color_b == NULL)
return TRUE;
if (color_a != NULL && color_b != NULL)
return gdk_color_equal (color_a, color_b);
return FALSE;
}
static void
cb_ok_clicked (GtkWidget *ignore, SheetManager *state)
......@@ -415,7 +471,10 @@ cb_ok_clicked (GtkWidget *ignore, SheetManager *state)
GSList *new_order = NULL;
GSList *changed_names = NULL;
GSList *new_names = NULL;
GSList * deleted_sheets = NULL;
GSList *deleted_sheets = NULL;
GSList *color_changed = NULL;
GSList *new_colors_back = NULL;
GSList *new_colors_fore = NULL;
GSList * old_order;
Sheet *this_sheet;
char *old_name, *new_name;
......@@ -424,6 +483,8 @@ cb_ok_clicked (GtkWidget *ignore, SheetManager *state)
GSList *this_new, *this_old;
gboolean order_has_changed = FALSE;
gboolean is_deleted;
GdkColor *back, *fore;
gboolean fore_changed, back_changed;
while (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (state->model),
&this_iter, NULL, n)) {
......@@ -432,6 +493,8 @@ cb_ok_clicked (GtkWidget *ignore, SheetManager *state)
SHEET_NAME, &old_name,
SHEET_NEW_NAME, &new_name,
IS_DELETED, &is_deleted,
BACKGROUND_COLOUR_POINTER, &back,
FOREGROUND_COLOUR_POINTER, &fore,
-1);
if (!is_deleted) {
new_order = g_slist_prepend (new_order, this_sheet);
......@@ -446,11 +509,36 @@ cb_ok_clicked (GtkWidget *ignore, SheetManager *state)
g_free (new_name);
}
g_free (old_name);
back_changed = (this_sheet == NULL) ||
!sheet_order_gdk_color_equal (back,
this_sheet->tab_color ?
&this_sheet->tab_color->color : NULL);
fore_changed = (this_sheet == NULL) ||
!sheet_order_gdk_color_equal (fore,
this_sheet->tab_text_color ?
&this_sheet->tab_text_color->color : NULL);
if (fore_changed || back_changed) {
color_changed = g_slist_prepend (color_changed, this_sheet);
new_colors_back = g_slist_prepend (new_colors_back, back);
new_colors_fore = g_slist_prepend (new_colors_fore, fore);
} else {
if (back)
gdk_color_free (back);
if (fore)
gdk_color_free (fore);
}
} else
deleted_sheets = g_slist_prepend (deleted_sheets, this_sheet);
n++;
}
color_changed= g_slist_reverse (color_changed);
new_colors_back= g_slist_reverse (new_colors_back);
new_colors_fore= g_slist_reverse (new_colors_fore);
new_order = g_slist_reverse (new_order);
new_names = g_slist_reverse (new_names);
changed_names = g_slist_reverse (changed_names);
......@@ -492,10 +580,12 @@ cb_ok_clicked (GtkWidget *ignore, SheetManager *state)
old_order = NULL;
}
if ((new_order == NULL && changed_names == NULL)
if ((new_order == NULL && changed_names == NULL && color_changed == NULL)
|| !cmd_reorganize_sheets (WORKBOOK_CONTROL (state->wbcg),
old_order, new_order,
changed_names, new_names, NULL)) {
changed_names, new_names, NULL,
color_changed, new_colors_back,
new_colors_fore)) {
gtk_widget_destroy (GTK_WIDGET (state->dialog));
}
if (deleted_sheets) {
......@@ -525,6 +615,8 @@ dialog_sheet_order (WorkbookControlGUI *wbcg)
{
SheetManager *state;
GladeXML *gui;
GtkTable *table;
ColorGroup *cg;
g_return_if_fail (wbcg != NULL);
......@@ -556,6 +648,28 @@ dialog_sheet_order (WorkbookControlGUI *wbcg)
gtk_button_stock_alignment_set (GTK_BUTTON (state->add_btn), 0., .5, 0., 0.);
gtk_button_stock_alignment_set (GTK_BUTTON (state->delete_btn), 0., .5, 0., 0.);
table = GTK_TABLE (glade_xml_get_widget (gui, "sheet_order_buttons_table"));
cg = color_group_fetch ("back_color_group", wb_control_view (WORKBOOK_CONTROL (wbcg)));
state->ccombo_back = color_combo_new (gdk_pixbuf_new_from_inline (-1, gnm_bucket,
FALSE, NULL),
_("Default"), NULL, cg);
gtk_table_attach (table, state->ccombo_back,
0, 1, 1, 2,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
gtk_widget_set_sensitive (state->ccombo_back, FALSE);
cg = color_group_fetch ("fore_color_group", wb_control_view (WORKBOOK_CONTROL (wbcg)));
state->ccombo_fore = color_combo_new (gdk_pixbuf_new_from_inline (-1, gnm_font,
FALSE, NULL),
_("Default"), NULL, cg);
gtk_table_attach (table, state->ccombo_fore,
0, 1, 0, 1,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
gtk_widget_set_sensitive (state->ccombo_fore, FALSE);
populate_sheet_list (state);
g_signal_connect (G_OBJECT (state->up_btn),
......@@ -579,6 +693,12 @@ dialog_sheet_order (WorkbookControlGUI *wbcg)
g_signal_connect (G_OBJECT (state->cancel_btn),
"clicked",
G_CALLBACK (cb_cancel_clicked), state);
g_signal_connect (G_OBJECT (state->ccombo_back),
"color_changed",
G_CALLBACK (cb_color_changed_back), state);
g_signal_connect (G_OBJECT (state->ccombo_fore),
"color_changed",
G_CALLBACK (cb_color_changed_fore), state);
/* FIXME: Add correct helpfile address */
gnumeric_init_help_button (
......
......@@ -123,8 +123,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">expand|fill</property>
......@@ -143,8 +143,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">expand|fill</property>
......@@ -163,8 +163,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">expand|fill</property>
......@@ -182,8 +182,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">fill</property>
......@@ -202,8 +202,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_padding">0</property>
<property name="y_padding">0</property>
<property name="x_options">expand|fill</property>
......
......@@ -262,6 +262,7 @@ sheet_new (Workbook *wb, char const *name)
sheet->unfrozen_top_left.col = sheet->unfrozen_top_left.row = -1;
sheet->initial_top_left.col = sheet->initial_top_left.row = 0;
sheet->tab_color = NULL;
sheet->tab_text_color = NULL;
/* Init menu states */
sheet->priv->enable_insert_rows = TRUE;
......@@ -2910,6 +2911,8 @@ sheet_destroy (Sheet *sheet)
if (sheet->tab_color != NULL)
style_color_unref (sheet->tab_color);
if (sheet->tab_text_color != NULL)
style_color_unref (sheet->tab_text_color);
sheet->signature = 0;
(void) g_idle_remove_by_data (sheet);
......@@ -4502,18 +4505,22 @@ sheet_is_frozen (Sheet const *sheet)
/**
* sheet_set_tab_color :
* @sheet :
* @color :
* @tab_color :
* @text_color :
*
* absorb the reference to the style color
*/
void
sheet_set_tab_color (Sheet *sheet, StyleColor *color)
sheet_set_tab_color (Sheet *sheet, StyleColor *tab_color, StyleColor *text_color)
{
g_return_if_fail (IS_SHEET (sheet));
if (sheet->tab_color != NULL)
style_color_unref (sheet->tab_color);
sheet->tab_color = color;
if (sheet->tab_text_color != NULL)
style_colo