Commit b83b3724 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg
Browse files

move to new sheet widget layout.

2002-01-29  Jody Goldberg <jody@gnome.org>

	* ms-excel-read.c (ms_sheet_create_obj) : move to new sheet widget
	  layout.

2002-01-29  Jody Goldberg <jody@gnome.org>

	* src/workbook-control-gui.c (cb_notebook_switch_page) : fix changing
	  sheets.
parent 35bab0d6
2002-01-29 Jody Goldberg <jody@gnome.org>
* src/workbook-control-gui.c (cb_notebook_switch_page) : fix changing
sheets.
2002-01-29 Jody Goldberg <jody@gnome.org>
* src/workbook-format-toolbar.c (workbook_create_format_toolbar) :
hard code relief.
* src/workbook-control-gui.c (workbook_create_standard_toolbar) :
ditto.
2002-01-29 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/workbook-control-gui.c (sheet_action_rename_sheet) : move most
......
2002-01-29 Jody Goldberg <jody@gnome.org>
* src/workbook-control-gui.c (cb_notebook_switch_page) : fix changing
sheets.
2002-01-29 Jody Goldberg <jody@gnome.org>
* src/workbook-format-toolbar.c (workbook_create_format_toolbar) :
hard code relief.
* src/workbook-control-gui.c (workbook_create_standard_toolbar) :
ditto.
2002-01-29 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/workbook-control-gui.c (sheet_action_rename_sheet) : move most
......
2002-01-29 Jody Goldberg <jody@gnome.org>
* src/workbook-control-gui.c (cb_notebook_switch_page) : fix changing
sheets.
2002-01-29 Jody Goldberg <jody@gnome.org>
* src/workbook-format-toolbar.c (workbook_create_format_toolbar) :
hard code relief.
* src/workbook-control-gui.c (workbook_create_standard_toolbar) :
ditto.
2002-01-29 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/workbook-control-gui.c (sheet_action_rename_sheet) : move most
......
2002-01-29 Jody Goldberg <jody@gnome.org>
* ms-excel-read.c (ms_sheet_create_obj) : move to new sheet widget
layout.
2002-01-23 Jody Goldberg <jody@gnome.org>
* ms-summary.c (EXCEL_TO_GNUM_MAPPING_COUNT) : use G_N_ELEMENTS.
......
......@@ -2165,7 +2165,7 @@ static GtkObject *
ms_sheet_create_obj (MSContainer *container, MSObj *obj)
{
SheetObject *so = NULL;
Sheet *sheet;
Workbook *wb;
ExcelSheet const *esheet;
if (obj == NULL)
......@@ -2174,7 +2174,7 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
g_return_val_if_fail (container != NULL, NULL);
esheet = (ExcelSheet const *)container;
sheet = esheet->gnum_sheet;
wb = esheet->wb->gnum_wb;
switch (obj->excel_type) {
case 0x01: { /* Line */
......@@ -2196,7 +2196,7 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
case 0x05: { /* Chart */
#ifdef ENABLE_BONOBO
so = SHEET_OBJECT (gnm_graph_new (sheet->workbook));
so = SHEET_OBJECT (gnm_graph_new (wb));
#else
so = sheet_object_box_new (FALSE); /* placeholder */
if (esheet->wb->warn_unsupported_graphs) {
......@@ -2207,8 +2207,13 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
#endif
break;
}
case 0x06: so = sheet_widget_label_new (sheet); break; /* TextBox */
case 0x07: so = sheet_widget_button_new (sheet); break; /* Button */
/* TextBox */
case 0x06: so = g_object_new (sheet_widget_label_get_type (), NULL);
break;
/* Button */
case 0x07: so = g_object_new (sheet_widget_button_get_type (), NULL);
break;
case 0x08: { /* Picture */
#ifdef ENABLE_BONOBO
MSObjAttr *blip_id = ms_object_attr_bag_lookup (obj->attrs,
......@@ -2221,7 +2226,7 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
if (blip != NULL) {
SheetObjectBonobo *sob;
so = sheet_object_container_new (sheet->workbook);
so = sheet_object_container_new (wb);
sob = SHEET_OBJECT_BONOBO (so);
if (sheet_object_bonobo_set_object_iid (sob, blip->obj_id)) {
......@@ -2258,13 +2263,19 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
so = sheet_object_box_new (FALSE); /* placeholder */
break;
}
case 0x0B: so = sheet_widget_checkbox_new (sheet); break;
case 0x0C: so = sheet_widget_radio_button_new (sheet); break;
case 0x0E: so = sheet_widget_label_new (sheet); break;
case 0x0B: so = g_object_new (sheet_widget_checkbox_get_type (), NULL);
break;
case 0x0C: so = g_object_new (sheet_widget_radio_button_get_type (), NULL);
break;
case 0x0E: so = g_object_new (sheet_widget_label_get_type (), NULL);
break;
case 0x10: so = sheet_object_box_new (FALSE); break; /* Spinner */
case 0x11: so = sheet_widget_scrollbar_new (sheet); break;
case 0x12: so = sheet_widget_list_new (sheet); break;
case 0x14: so = sheet_widget_combo_new (sheet); break;
case 0x11: so = g_object_new (sheet_widget_scrollbar_get_type (), NULL);
break;
case 0x12: so = g_object_new (sheet_widget_list_get_type (), NULL);
break;
case 0x14: so = g_object_new (sheet_widget_combo_get_type (), NULL);
break;
case 0x19: /* Comment */
/* TODO: we'll need a special widget for this */
......
......@@ -215,7 +215,7 @@
_tip="Rename the current sheet"/>
<menuitem name="SheetReorder" verb=""
_label="Re-_Order..."
_label="Re-_Order Sheets..."
_tip="Change the order the sheets are displayed" />
<menuitem name="SheetRemove" verb=""
......@@ -436,8 +436,8 @@
<submenu _label="_Sheet">
<menuitem name="SheetChangeName" verb=""
_label="_Change Name..."
_tip="Edit the name of the current sheet" />
_label="Re_name..."
_tip="Rename the current sheet"/>
<menuitem name="SheetReorder" verb=""
_label="Re-_Order Sheets..."
......
......@@ -83,6 +83,25 @@ cb_selection_changed (GtkTreeSelection *ignored, SheetManager *state)
}
}
static void
cb_row_inserted (GtkTreeModel *tree_model,
GtkTreePath *path,
GtkTreeIter *iter,
SheetManager *state)
{
GValue value = {0, };
Sheet *sheet;
gtk_tree_model_get_value (GTK_TREE_MODEL (state->model),
iter, SHEET_POINTER, &value);
sheet = g_value_get_pointer (&value);
g_value_unset (&value);
if (sheet != NULL) {
puts (sheet->name_unquoted);
}
}
/* Add all of the sheets to the sheet_list */
static void
populate_sheet_list (SheetManager *state)
......@@ -123,6 +142,9 @@ populate_sheet_list (SheetManager *state)
g_signal_connect (selection,
"changed",
G_CALLBACK (cb_selection_changed), state);
g_signal_connect (selection,
"row_inserted",
G_CALLBACK (cb_row_inserted), state);
gtk_container_add (GTK_CONTAINER (scrolled), GTK_WIDGET (state->sheet_list));
}
......@@ -209,10 +231,11 @@ dialog_sheet_order (WorkbookControlGUI *wbcg)
gtk_signal_connect (GTK_OBJECT (state->close_btn),
"clicked",
GTK_SIGNAL_FUNC (close_clicked_cb), state);
/* a candidate for merging into attach guru */
gtk_signal_connect (GTK_OBJECT (state->dialog),
"destroy",
GTK_SIGNAL_FUNC (cb_sheet_order_destroy), state);
gnumeric_non_modal_dialog (state->wbcg, GTK_WINDOW (state->dialog));
wbcg_edit_attach_guru (state->wbcg, GTK_WIDGET (state->dialog));
gtk_widget_show_all (GTK_WIDGET (state->dialog));
......
......@@ -818,7 +818,7 @@ item_grid_button_1 (SheetControlGUI *scg, GdkEventButton *event,
if (!wbcg_edit_has_guru (scg->wbcg))
scg_mode_edit (sc);
} else
wbcg_focus_cur_sheet (scg->wbcg);
wbcg_focus_cur_scg (scg->wbcg);
/* If we were already selecting a range of cells for a formula,
* reset the location to a new place, or extend the selection.
......
......@@ -5,10 +5,39 @@
#include <gtk/gtkobject.h>
struct _SheetView {
GtkObject gtk_object;
GtkObject base;
Sheet *s;
GPtrArray *s_controls;
GPtrArray *controls;
CellPos edit_pos; /* Cell that would be edited */
CellPos edit_pos_real; /* Even in the middle of a merged cell */
struct {
/* Static corner to rubber band the selection range around */
CellPos base_corner;
/* Corner that is moved when the selection range is extended */
CellPos move_corner;
} cursor;
GList *selections; /* The set of selected ranges in LIFO order */
GList *ants; /* set of animated cursors */
CellPos initial_top_left;
CellPos frozen_top_left;
CellPos unfrozen_top_left;
/* preferences */
gboolean display_formulas;
gboolean hide_zero;
gboolean hide_grid;
gboolean hide_col_header;
gboolean hide_row_header;
gboolean display_outlines;
gboolean outline_symbols_below;
gboolean outline_symbols_right;
};
typedef struct {
......
......@@ -135,7 +135,7 @@ wbcg_toplevel (WorkbookControlGUI *wbcg)
}
/**
* wbcg_focus_cur_sheet :
* wbcg_focus_cur_scg :
* @wbcg : The workbook control to operate on.
*
* A utility routine to safely ensure that the keyboard focus
......@@ -144,12 +144,13 @@ wbcg_toplevel (WorkbookControlGUI *wbcg)
*
* It is called for zoom, font name/size, and accept/cancel for the editline.
*/
void
wbcg_focus_cur_sheet (WorkbookControlGUI *wbcg)
Sheet *
wbcg_focus_cur_scg (WorkbookControlGUI *wbcg)
{
GtkWidget *table;
GtkObject *obj;
SheetControlGUI *scg;
Sheet *sheet;
g_return_if_fail (IS_WORKBOOK_CONTROL_GUI (wbcg));
......@@ -161,6 +162,7 @@ wbcg_focus_cur_sheet (WorkbookControlGUI *wbcg)
g_return_if_fail (scg != NULL);
scg_take_focus (scg);
return sc_sheet (SHEET_CONTROL (scg));
}
SheetControlGUI *
......@@ -372,14 +374,14 @@ cb_sheet_label_changed (EditableLabel *el,
{
gboolean ans = !cmd_rename_sheet (WORKBOOK_CONTROL (wbcg),
editable_label_get_text (el), new_name);
wbcg_focus_cur_sheet (wbcg);
wbcg_focus_cur_scg (wbcg);
return ans;
}
static void
cb_sheet_label_edit_stopped (EditableLabel *el, WorkbookControlGUI *wbcg)
{
wbcg_focus_cur_sheet (wbcg);
wbcg_focus_cur_scg (wbcg);
}
static void
......@@ -388,7 +390,7 @@ sheet_action_add_sheet (GtkWidget *widget, SheetControlGUI *scg)
SheetControl *sc = (SheetControl *) scg;
workbook_sheet_add (wb_control_workbook (sc->wbc), sc->sheet, TRUE);
wbcg_focus_cur_sheet (scg->wbcg);
wbcg_focus_cur_scg (scg->wbcg);
}
static void
......@@ -442,7 +444,7 @@ sheet_action_clone_sheet (GtkWidget *widget, SheetControlGUI *scg)
workbook_sheet_attach (sc->sheet->workbook, new_sheet, sc->sheet);
sheet_set_dirty (new_sheet, TRUE);
wbcg_focus_cur_sheet (scg->wbcg);
wbcg_focus_cur_scg (scg->wbcg);
}
static void
......@@ -714,7 +716,7 @@ cb_change_zoom (GtkWidget *caller, char *new_zoom, WorkbookControlGUI *wbcg)
else
zoom_changed (wbcg, sheet);
wbcg_focus_cur_sheet (wbcg);
wbcg_focus_cur_scg (wbcg);
/* because we are updating it there is no need to apply it now */
return FALSE;
......@@ -2860,8 +2862,8 @@ static GnomeUIInfo workbook_menu_format_row [] = {
};
static GnomeUIInfo workbook_menu_format_sheet [] = {
GNOMEUIINFO_ITEM_NONE (N_("_Change name"),
N_("Edit the name of the current sheet"),
GNOMEUIINFO_ITEM_NONE (N_("Re_name..."),
N_("Rename the current sheet"),
cb_sheet_name),
GNOMEUIINFO_ITEM_NONE (N_("Re-_Order Sheets..."),
N_("Change the order the sheets are displayed"),
......@@ -3359,12 +3361,14 @@ workbook_create_standard_toolbar (WorkbookControlGUI *wbcg)
/* Undo dropdown list */
undo = wbcg->undo_combo = gtk_combo_stack_new (GTK_STOCK_UNDO, TRUE);
gtk_combo_box_set_arrow_relief (GTK_COMBO_BOX (undo), GTK_RELIEF_NONE);
gtk_combo_box_set_title (GTK_COMBO_BOX (undo), _("Undo"));
gtk_signal_connect (GTK_OBJECT (undo), "pop",
(GtkSignalFunc) cb_undo_combo, wbcg);
/* Redo dropdown list */
redo = wbcg->redo_combo = gtk_combo_stack_new (GTK_STOCK_REDO, TRUE);
gtk_combo_box_set_arrow_relief (GTK_COMBO_BOX (redo), GTK_RELIEF_NONE);
gtk_combo_box_set_title (GTK_COMBO_BOX (redo), _("Redo"));
gtk_signal_connect (GTK_OBJECT (redo), "pop",
(GtkSignalFunc) cb_redo_combo, wbcg);
......@@ -3419,7 +3423,7 @@ static void
wb_jump_to_cell (GtkEntry *entry, WorkbookControlGUI *wbcg)
{
wb_control_parse_and_jump (WORKBOOK_CONTROL (wbcg), gtk_entry_get_text (entry));
wbcg_focus_cur_sheet (wbcg);
wbcg_focus_cur_scg (wbcg);
}
static void
......@@ -3556,7 +3560,7 @@ static void
wbcg_set_focus (GtkWindow *window, GtkWidget *focus, WorkbookControlGUI *wbcg)
{
if (focus && !window->focus_widget)
wbcg_focus_cur_sheet (wbcg);
wbcg_focus_cur_scg (wbcg);
}
static void
......@@ -3614,9 +3618,8 @@ cb_notebook_switch_page (GtkNotebook *notebook, GtkNotebookPage *page,
GINT_TO_POINTER (gtk_notebook_get_current_page (notebook)));
/* if we are not selecting a range for an expression update */
wbcg_focus_cur_sheet (wbcg);
sheet = wb_control_cur_sheet (WORKBOOK_CONTROL (wbcg));
if (sheet != NULL) {
sheet = wbcg_focus_cur_scg (wbcg);
if (sheet != wb_control_cur_sheet (WORKBOOK_CONTROL (wbcg))) {
sheet_flag_status_update_range (sheet, NULL);
sheet_update (sheet);
wb_view_sheet_focus (wb_control_view (WORKBOOK_CONTROL (wbcg)), sheet);
......
......@@ -18,7 +18,7 @@ void workbook_control_gui_init (WorkbookControlGUI *wbcg,
GtkWindow *wbcg_toplevel (WorkbookControlGUI *wbcg);
SheetControlGUI *wbcg_cur_scg (WorkbookControlGUI *wbcg);
void wbcg_focus_cur_sheet (WorkbookControlGUI *wbcg);
Sheet *wbcg_focus_cur_scg (WorkbookControlGUI *wbcg);
gboolean wbcg_ui_update_begin (WorkbookControlGUI *wbcg);
void wbcg_ui_update_end (WorkbookControlGUI *wbcg);
......
......@@ -134,7 +134,7 @@ wbcg_edit_finish (WorkbookControlGUI *wbcg, gboolean accept)
wbc = WORKBOOK_CONTROL (wbcg);
wbv = wb_control_view (wbc);
wbcg_focus_cur_sheet (wbcg);
wbcg_focus_cur_scg (wbcg);
/* Remove the range selection cursor if it exists */
if (NULL != wbcg->rangesel)
......
......@@ -250,7 +250,7 @@ change_font_in_selection_cmd (GtkWidget *caller, WorkbookControlGUI *wbcg)
_("Set Font"));
/* Restore the focus to the sheet */
wbcg_focus_cur_sheet (wbcg);
wbcg_focus_cur_scg (wbcg);
}
}
......@@ -283,7 +283,7 @@ change_font_size_in_selection_cmd (GtkEntry *entry, WorkbookControlGUI *wbcg)
_("Set Font Size"));
/* Restore the focus to the sheet */
wbcg_focus_cur_sheet (wbcg);
wbcg_focus_cur_scg (wbcg);
}
static void
......@@ -748,6 +748,7 @@ workbook_create_format_toolbar (WorkbookControlGUI *wbcg)
/* font name selector */
fontsel = wbcg->font_name_selector = gtk_combo_text_new (TRUE);
gtk_combo_box_set_arrow_relief (GTK_COMBO_BOX (fontsel), GTK_RELIEF_NONE);
entry = GTK_COMBO_TEXT (fontsel)->entry;
gtk_signal_connect (GTK_OBJECT (entry), "activate",
GTK_SIGNAL_FUNC (change_font_in_selection_cmd), wbcg);
......@@ -769,6 +770,7 @@ workbook_create_format_toolbar (WorkbookControlGUI *wbcg)
/* font size selector */
fontsize = wbcg->font_size_selector = gtk_combo_text_new (TRUE);
gtk_combo_box_set_arrow_relief (GTK_COMBO_BOX (fontsize), GTK_RELIEF_NONE);
entry = GTK_COMBO_TEXT (fontsize)->entry;
gtk_signal_connect (GTK_OBJECT (entry), "activate",
GTK_SIGNAL_FUNC (change_font_size_in_selection_cmd), wbcg);
......
......@@ -14,7 +14,7 @@
typedef struct _WorkbookPrivate WorkbookPrivate;
struct _Workbook {
GObject gtk_object;
GObject base;
GPtrArray *wb_views;
......
......@@ -6,7 +6,7 @@
#include <glib-object.h>
struct _WorkbookView {
GObject gtk_object;
GObject base;
Workbook *wb;
GPtrArray *wb_controls;
......
......@@ -14,7 +14,7 @@
typedef struct _WorkbookPrivate WorkbookPrivate;
struct _Workbook {
GObject gtk_object;
GObject base;
GPtrArray *wb_views;
......
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