wbc-gtk-impl.h 4.87 KB
Newer Older
1 2 3
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef _GNM_WBC_GTK_IMPL_H_
# define _GNM_WBC_GTK_IMPL_H_
4 5

#include "gnumeric.h"
6
#include "wbc-gtk.h"
7
#include "workbook-control-priv.h"
8
#include "style.h"
9
#include "widgets/gnumeric-expr-entry.h"
10
#include "widgets/gnm-notebook.h"
11

12
#include <goffice/goffice.h>
13
#include <gtk/gtk.h>
14

15 16
G_BEGIN_DECLS

17
struct _WBCGtk {
18
	WorkbookControl	base;
19

20
	GtkWidget   *toplevel;
21

22 23
	GtkBuilder  *gui;

24 25 26 27 28 29 30 31 32 33 34 35
	/* The area that contains the sheet and the sheet tabs.  */
	GtkWidget   *notebook_area;

	/* The notebook that contains the sheets.  */
	GtkNotebook *snotebook;

	/* The notebook that contains the sheet tabs.  */
	GnmNotebook *bnotebook;

	/* The GtkPaned that contains the sheet tabs and the status area.  */
	GtkPaned    *tabs_paned;

36
	GtkWidget   *progress_bar;
37

38
	struct {
39 40
		GnmExprEntry *entry; /* The real edit line */
		GnmExprEntry *temp_entry; /* A tmp overlay eg from a guru */
41
		GtkWidget *guru;
42 43
		gulong         signal_changed, signal_insert, signal_delete;
		gulong         signal_cursor_pos, signal_selection_bound;
44 45 46
		PangoAttrList *cell_attrs;   /* Attrs from cell format. */
		PangoAttrList *markup;	     /* just the markup */
		PangoAttrList *full_content; /* cell_attrs+markup */
Jody Goldberg's avatar
Jody Goldberg committed
47
		PangoAttrList *cur_fmt;	/* attrs for new text (depends on position) */
48
	} edit_line;
49

50 51 52 53 54 55
	/* While editing these should be visible */
	GtkWidget *ok_button, *cancel_button;

	/* While not editing these should be visible */
	GtkWidget *func_button;

Jody Goldberg's avatar
Jody Goldberg committed
56
	gboolean    updating_ui;
57
	gboolean    inside_editing;
58 59

	/* Auto completion */
Morten Welinder's avatar
Morten Welinder committed
60
	GnmComplete	*auto_complete;
61 62
	gboolean	 auto_completing;
	char		*auto_complete_text;
63

64 65 66
	/* Used to detect if the user has backspaced, so we turn off auto-complete */
	int              auto_max_size;

67 68 69
	/* Keep track of whether the last key pressed was END, so end-mode works */
	gboolean last_key_was_end;

70
	SheetControlGUI *rangesel;
71 72

	GtkWidget  *table;
73 74
	GtkWidget  *auto_expr_label;
	GtkWidget  *status_text;
75 76

	/* Widgets whose visibility should be copied.  */
77 78
	GHashTable *visibility_widgets;

79
	gboolean is_fullscreen;
80 81
	GOUndo *undo_for_fullscreen;
	GSList *hide_for_fullscreen;
82 83 84

	/* Edit area */
	GtkWidget *selection_descriptor;	/* A GtkEntry */
85 86 87

	/* Autosave */
        gboolean   autosave_prompt;
88
        gint       autosave_time;
89
        guint      autosave_timer;
90

91 92
	PangoFontDescription *font_desc;

93
	SheetControlGUI *active_scg;
94
	gulong sig_view_changed;
95
	gulong sig_auto_expr_text, sig_auto_expr_attrs;
96
	gulong sig_show_horizontal_scrollbar, sig_show_vertical_scrollbar;
97
	gulong sig_show_notebook_tabs;
98
	gulong sig_sheet_order, sig_notify_uri, sig_notify_dirty;
99
	gpointer sig_wbv;
100 101 102 103

/**********************************************/
	GtkWidget	 *status_area;
	GtkUIManager     *ui;
104
	GtkActionGroup   *permanent_actions, *actions, *font_actions,
105
			 *data_only_actions, *semi_permanent_actions;
106 107 108
	struct {
		GtkActionGroup   *actions;
		guint		  merge_id;
109
	} file_history, toolbar, windows, templates;
110

111 112
	guint template_loader_handler;

113 114 115
	GOActionComboStack	*undo_haction, *redo_haction;
	GtkAction		*undo_vaction, *redo_vaction;
	GOActionComboColor	*fore_color, *back_color;
116
	GtkAction               *font_name_haction, *font_name_vaction;
117
	GOActionComboText	*zoom_haction;
118
	GtkAction               *zoom_vaction;
119 120
	GOActionComboPixmaps	*borders, *halignment, *valignment;
	struct {
121 122
		GtkToggleAction	 *bold, *italic, *underline, *d_underline,
			*sl_underline, *dl_underline;
123 124 125 126 127 128 129 130 131
		GtkToggleAction	 *superscript, *subscript, *strikethrough;
	} font;
	struct {
		GtkToggleAction	 *left, *center, *right, *center_across_selection;
	} h_align;
	struct {
		GtkToggleAction	 *top, *center, *bottom;
	} v_align;

132
	GtkWidget *menu_zone, *toolbar_zones[4];
133 134 135
	GHashTable *custom_uis;

	guint idle_update_style_feedback;
136 137 138 139 140

	/* When editing a cell: the cell (may be NULL) */
	GnmCell     *editing_cell;
	Sheet       *editing_sheet;
	gboolean     editing;
141

142 143
	SheetObject	 *new_object;	/* A newly created object that has yet to be realized */

144
	char *preferred_geometry;
145 146 147
};

typedef struct {
148 149
	WorkbookControlClass base;

Jody Goldberg's avatar
Jody Goldberg committed
150
	/* signals */
151 152
	void (*markup_changed)		(WBCGtk const *wbcg);
} WBCGtkClass;
153

154 155 156
#define GNM_RESPONSE_SAVE_ALL -1000
#define GNM_RESPONSE_DISCARD_ALL -1001

157
/* Protected functions */
158 159 160 161
gboolean wbc_gtk_close		(WBCGtk *wbcg);
void	 wbcg_insert_sheet	(GtkWidget *ignored, WBCGtk *wbcg);
void	 wbcg_append_sheet	(GtkWidget *ignored, WBCGtk *wbcg);
void	 wbcg_clone_sheet	(GtkWidget *ignored, WBCGtk *wbcg);
162 163

void	 wbc_gtk_init_editline	(WBCGtk *wbcg);
164 165
void	 wbc_gtk_init_actions	(WBCGtk *wbcg);
void	 wbc_gtk_markup_changer	(WBCGtk *wbcg);
Jody Goldberg's avatar
Jody Goldberg committed
166

167 168
void     wbcg_font_action_set_font_desc (GtkAction *act, PangoFontDescription *desc);

169 170
gboolean wbc_gtk_load_templates (WBCGtk *gtk);

171 172
GtkAction *wbcg_find_action (WBCGtk *wbcg, const char *name);

Morten Welinder's avatar
Morten Welinder committed
173
G_MODULE_EXPORT void set_uifilename (char const *name, GtkActionEntry const *actions, int nb);
174

175 176 177
G_END_DECLS

#endif /* _GNM_WBC_GTK_IMPL_H_ */