51 #include "table-gnome.h" 62 #define UNUSED_VAR __attribute__ ((unused)) 65 static QofLogModule UNUSED_VAR log_module = GNC_MOD_REGISTER;
74 GNCHeaderWidths widths;
82 if (
table->ui_data == NULL)
87 sheet = GNUCASH_SHEET (
table->ui_data);
89 widths = gnc_header_widths_new ();
91 gnucash_sheet_get_header_widths (sheet, widths);
93 node = gnc_table_layout_get_cells (
table->layout);
94 for (; node; node = node->next)
96 BasicCell *cell = node->data;
99 width = gnc_header_widths_get_width (widths, cell->cell_name);
102 key = g_strdup_printf(
"%s_width", cell->cell_name);
103 if ((width > 0) && (!cell->expandable))
105 g_key_file_set_integer (state_file, state_section, key, width);
107 else if (g_key_file_has_key (state_file, state_section, key, NULL))
108 g_key_file_remove_key (state_file, state_section, key, NULL);
111 gnc_header_widths_destroy (widths);
115 table_ui_redraw_cb (Table *
table)
122 if (
table->ui_data == NULL)
125 sheet = GNUCASH_SHEET (
table->ui_data);
127 gnucash_sheet_redraw_help (sheet);
131 table_destroy_cb (Table *
table)
138 if (
table->ui_data == NULL)
141 sheet = GNUCASH_SHEET (
table->ui_data);
143 g_object_unref (sheet);
145 table->ui_data = NULL;
149 table_default_direct_update (BasicCell *bcell,
150 int *cursor_position,
151 int *start_selection,
155 GdkEventKey *
event = gui_data;
157 if (event->keyval == GDK_KEY_Escape && bcell->changed)
159 GnucashSheet *sheet = (GnucashSheet *) bcell->gui_private;
160 const char *value = gnc_table_get_model_entry (sheet->table, bcell->cell_name);
162 gnc_basic_cell_set_value_internal (bcell, value);
163 bcell->changed = FALSE;
164 *cursor_position = 0;
165 *start_selection = 0;
175 table->gui_handlers.redraw_help = table_ui_redraw_cb;
176 table->gui_handlers.destroy = table_destroy_cb;
177 table->gui_handlers.default_direct_update = table_default_direct_update;
190 g_return_if_fail (GNUCASH_IS_SHEET (
table->ui_data));
192 sheet = GNUCASH_SHEET(
table->ui_data);
194 gnucash_sheet_styles_recompile (sheet);
195 gnucash_sheet_table_load (sheet, do_scroll);
196 gnucash_sheet_redraw_all (sheet);
201 gnc_table_refresh_cursor_gnome (Table *
table,
202 VirtualCellLocation vcell_loc,
210 g_return_if_fail (GNUCASH_IS_SHEET (
table->ui_data));
215 sheet = GNUCASH_SHEET (
table->ui_data);
217 gnucash_sheet_cursor_set_from_table (sheet, do_scroll);
219 if (gnucash_sheet_block_set_from_table (sheet, vcell_loc))
221 gnucash_sheet_recompute_block_offsets (sheet);
222 gnucash_sheet_set_scroll_region (sheet);
223 gnucash_sheet_compute_visible_range (sheet);
224 gnucash_sheet_redraw_all (sheet);
227 gnucash_sheet_redraw_block (sheet, vcell_loc);
232 VirtualCellLocation start_loc,
233 VirtualCellLocation end_loc)
240 g_return_if_fail (GNUCASH_IS_SHEET (
table->ui_data));
248 sheet = GNUCASH_SHEET (
table->ui_data);
250 gnucash_sheet_show_range (sheet, start_loc, end_loc);
254 gnc_table_gnome_init (
void)
258 gui_handlers.cursor_refresh = gnc_table_refresh_cursor_gnome;
Public declarations for GncLedgerDisplay class.
Functions to load, save and get gui state.
GKeyFile * gnc_state_get_current(void)
Returns a pointer to the most recently loaded state.
void gnc_table_init_gui(Table *table)
UI-specific functions.
void gnc_table_refresh_gui(Table *table, gboolean do_scroll)
Refresh the whole GUI from the table.
void gnc_table_show_range(Table *table, VirtualCellLocation start_loc, VirtualCellLocation end_loc)
Try to show the whole range in the register.
void gnc_table_set_default_gui_handlers(TableGUIHandlers *gui_handlers)
Implementation.
Public declarations of GnucashRegister class.
Private declarations for GnucashSheet class.
All type declarations for the whole Gnucash engine.
Generic api to store and retrieve preferences.
gboolean gnc_table_virtual_cell_out_of_bounds(Table *table, VirtualCellLocation vcell_loc)
checks the given location and returns true if it is out of bounds of the table.
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Get a boolean value from the preferences backend.
Declarations for the Table object.
Styling functions for RegisterGnome.
void gnc_table_save_state(Table *table, const gchar *state_section)
Implementation.