GnuCash c935c2f+
Loading...
Searching...
No Matches
Files | Data Structures | Macros | Typedefs | Enumerations | Enumerator | Functions | Variables

Files

file  gnc-ledger-display.h
 Public declarations for GncLedgerDisplay class.
 
file  formulacell-gnome.h
 Implements gnome dependent formula cell functions.
 
file  gnucash-color.h
 Convenience wrapper around GdkRGBA for use in Register Gnome classes.
 
file  gnucash-cursor.h
 Public declarations for GnucashCursor class.
 
file  gnucash-date-picker.h
 Public declarations for GncDatePicker class.
 
file  gnucash-header.h
 Public declarations for GnucashHeader class.
 
file  gnucash-item-edit.h
 Public declarations for GncItemEdit class.
 
file  gnucash-item-list.h
 Public Declarations for GncItemList class.
 
file  gnucash-sheet.h
 Public declarations of GnucashRegister class.
 
file  gnucash-sheetP.h
 Private declarations for GnucashSheet class.
 
file  gnucash-style.h
 Styling functions for RegisterGnome.
 

Data Structures

struct  GnucashCursorCell
 
struct  GnucashCursor
 
struct  GnucashCursorClass
 
struct  GNCDatePicker
 
struct  GNCDatePickerClass
 
struct  GncHeader
 
struct  GncHeaderClass
 
struct  PopupToggle
 
struct  GncItemEdit
 
struct  GncItemEditClass
 
struct  GncItemEditTb
 
struct  GncItemEditTbClass
 
struct  GncItemList
 
struct  GncItemListClass
 
struct  SheetBlock
 
struct  GnucashSheet
 
struct  GnucashSheetClass
 
struct  CellDimensions
 
struct  BlockDimensions
 
struct  SheetBlockStyle
 

Macros

#define GNUCASH_TYPE_CURSOR   (gnucash_cursor_get_type ())
 
#define GNUCASH_CURSOR(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNUCASH_TYPE_CURSOR, GnucashCursor))
 
#define GNUCASH_CURSOR_CLASS(k)   (G_TYPE_CHECK_CLASS_CAST ((k), GNUCASH_TYPE_CURSOR, GnucashCursorClass))
 
#define GNUCASH_IS_CURSOR(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNUCASH_TYPE_CURSOR))
 
#define GNC_TYPE_DATE_PICKER   (gnc_date_picker_get_type ())
 
#define GNC_DATE_PICKER(obj)   G_TYPE_CHECK_INSTANCE_CAST((obj), gnc_date_picker_get_type (), GNCDatePicker)
 
#define GNC_DATE_PICKER_CLASS(k)   G_TYPE_CHECK_CLASS_CAST((k), gnc_date_picker_get_type (), GNCDatePickerClass)
 
#define IS_GNC_DATE_PICKER(o)   G_TYPE_CHECK_INSTANCE_TYPE((o), gnc_date_picker_get_type ())
 
#define GNC_TYPE_HEADER   (gnc_header_get_type ())
 
#define GNC_HEADER(o)   (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_HEADER, GncHeader))
 
#define GNC_HEADER_CLASS(k)   (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_HEADER, GncHeaderClass))
 
#define GNC_IS_HEADER(o)   (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_HEADER))
 
#define GNC_TYPE_ITEM_EDIT   (gnc_item_edit_get_type ())
 
#define GNC_ITEM_EDIT(o)   (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_ITEM_EDIT, GncItemEdit))
 
#define GNC_ITEM_EDIT_CLASS(k)   (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_ITEM_EDIT, GncItemEditClass))
 
#define GNC_IS_ITEM_EDIT(o)   (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_ITEM_EDIT))
 
#define GNC_TYPE_ITEM_EDIT_TB   (gnc_item_edit_tb_get_type ())
 
#define GNC_ITEM_EDIT_TB(o)   (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_ITEM_EDIT_TB, GncItemEditTb))
 
#define GNC_ITEM_EDIT_TB_CLASS(k)   (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_ITEM_EDIT_TB, GncItemEditTbClass))
 
#define GNC_IS_ITEM_EDIT_TB(o)   (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_ITEM_EDIT_TB))
 
#define GNC_TYPE_ITEM_LIST   (gnc_item_list_get_type ())
 
#define GNC_ITEM_LIST(o)   (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_ITEM_LIST, GncItemList))
 
#define GNC_ITEM_LIST_CLASS(k)   (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_ITEM_LIST, GncItemListClass))
 
#define IS_GNC_ITEM_LIST(o)   (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_ITEM_LIST))
 
#define GNUCASH_TYPE_REGISTER   (gnucash_register_get_type ())
 
#define GNUCASH_REGISTER(obj)   (G_TYPE_CHECK_INSTANCE_CAST((obj), GNUCASH_TYPE_REGISTER, GnucashRegister))
 
#define GNUCASH_REGISTER_CLASS(k)   (G_TYPE_CHECK_CLASS_CAST ((k), GNUCASH_TYPE_REGISTER))
 
#define GNUCASH_IS_REGISTER(o)   (G_TYPE_CHECK_INSTANCE_TYPE((o), GNUCASH_TYPE_REGISTER))
 
#define GNUCASH_TYPE_SHEET   (gnucash_sheet_get_type ())
 
#define GNUCASH_SHEET(obj)   (G_TYPE_CHECK_INSTANCE_CAST((obj), GNUCASH_TYPE_SHEET, GnucashSheet))
 
#define GNUCASH_SHEET_CLASS(k)   (G_TYPE_CHECK_CLASS_CAST ((k), GNUCASH_TYPE_SHEET))
 
#define GNUCASH_IS_SHEET(o)   (G_TYPE_CHECK_INSTANCE_TYPE((o), GNUCASH_TYPE_SHEET))
 

Typedefs

typedef void(* GNCLedgerDisplayDestroy) (GNCLedgerDisplay *ld)
 
typedef GtkWidget *(* GNCLedgerDisplayGetParent) (GNCLedgerDisplay *ld)
 
typedef void(* GNCLedgerDisplaySetHelp) (GNCLedgerDisplay *ld, const char *help_str)
 
typedef int(* PopupGetHeight) (GtkWidget *item, int space_available, int row_height, gpointer user_data)
 
typedef int(* PopupAutosize) (GtkWidget *item, int max_width, gpointer user_data)
 
typedef void(* PopupSetFocus) (GtkWidget *item, gpointer user_data)
 
typedef void(* PopupPostShow) (GtkWidget *item, gpointer user_data)
 
typedef int(* PopupGetWidth) (GtkWidget *item, gpointer user_data)
 
typedef gboolean(* VirtualLocationMatchFunc) (VirtualLocation virt_loc, gpointer user_data)
 
typedef GHashTable * GNCHeaderWidths
 

Enumerations

enum  GNCLedgerDisplayType { LD_SINGLE , LD_SUBACCOUNT , LD_GL }
 
enum  { GNUCASH_CURSOR_CELL , GNUCASH_CURSOR_BLOCK , GNUCASH_CURSOR_NUM }
 
enum  Sides {
  left , right , top , bottom ,
  left_right , top_bottom
}
 

Functions

Accountgnc_ledger_display_leader (GNCLedgerDisplay *ld)
 returns the 'lead' account of a ledger display, or NULL if none.
 
GNCLedgerDisplayType gnc_ledger_display_type (GNCLedgerDisplay *ld)
 
void gnc_ledger_display_set_user_data (GNCLedgerDisplay *ld, gpointer user_data)
 get and set the user data associated with the ledger
 
gpointer gnc_ledger_display_get_user_data (GNCLedgerDisplay *ld)
 
void gnc_ledger_display_set_handlers (GNCLedgerDisplay *ld, GNCLedgerDisplayDestroy destroy, GNCLedgerDisplayGetParent get_parent)
 set the handlers used by the ledger display
 
GtkWidget * gnc_ledger_display_get_parent (GNCLedgerDisplay *ld)
 Returns the parent of a given ledger display.
 
SplitRegister * gnc_ledger_display_get_split_register (GNCLedgerDisplay *ld)
 return the split register associated with a ledger display
 
GNCLedgerDisplay * gnc_ledger_display_simple (Account *account)
 opens up a register window to display a single account
 
GNCLedgerDisplay * gnc_ledger_display_subaccounts (Account *account, gboolean mismatched_commodities)
 opens up a register window to display the parent account and all of its children.
 
GNCLedgerDisplay * gnc_ledger_display_gl (void)
 opens up a general ledger window
 
GNCLedgerDisplay * gnc_ledger_display_template_gl (char *id)
 Displays a template ledger.
 
GNCLedgerDisplay * gnc_ledger_display_query (Query *query, SplitRegisterType type, SplitRegisterStyle style)
 display a general ledger for an arbitrary query
 
void gnc_ledger_display_set_query (GNCLedgerDisplay *ledger_display, Query *q)
 Set the query used for a register.
 
Querygnc_ledger_display_get_query (GNCLedgerDisplay *ld)
 return the query associated with a ledger
 
GNCLedgerDisplay * gnc_ledger_display_find_by_query (Query *q)
 If the given ledger display still exists, return it.
 
void gnc_ledger_display_refresh (GNCLedgerDisplay *ledger_display)
 redisplay/redraw only the indicated window.
 
void gnc_ledger_display_refresh_by_split_register (SplitRegister *reg)
 
void gnc_ledger_display_set_focus (GNCLedgerDisplay *ld, gboolean focus)
 Mark the ledger as being in focus (refresh immediately) or not.
 
void gnc_ledger_display_close (GNCLedgerDisplay *ledger_display)
 close the window
 
gboolean gnc_ledger_display_default_double_line (GNCLedgerDisplay *gld)
 Returns a boolean of whether this display should be single or double lined mode by default.
 
void gnucash_color_init (void)
 
GdkRGBA * gnucash_color_argb_to_gdk (guint32 argb)
 Return the pixel value for the given red, green and blue.
 
GType gnucash_cursor_get_type (void)
 
GnucashCursorgnucash_cursor_new (GnucashSheet *sheet)
 
void gnucash_cursor_get_virt (GnucashCursor *cursor, VirtualLocation *virt_loc)
 
void gnucash_cursor_set (GnucashCursor *cursor, VirtualLocation virt_loc)
 
void gnucash_cursor_set_style (GnucashCursor *cursor, SheetBlockStyle *style)
 
void gnucash_cursor_configure (GnucashCursor *cursor)
 
GType gnc_date_picker_get_type (void)
 
GtkWidget * gnc_date_picker_new (void)
 
void gnc_date_picker_set_date (GNCDatePicker *date_picker, guint day, guint mon, guint year)
 
void gnc_date_picker_get_date (GNCDatePicker *date_picker, guint *day, guint *mon, guint *year)
 
GType gnc_header_get_type (void)
 
GtkWidget * gnc_header_new (GnucashSheet *sheet)
 
void gnc_header_reconfigure (GncHeader *header)
 
void gnc_header_request_redraw (GncHeader *header)
 
void gnc_header_set_header_rows (GncHeader *header, int num_phys_rows)
 
gint gnc_header_get_cell_offset (GncHeader *header, gint col, gint *cell_width)
 
GType gnc_item_edit_get_type (void)
 
void gnc_item_edit_configure (GncItemEdit *item_edit)
 
void gnc_item_edit_get_pixel_coords (GncItemEdit *item_edit, int *x, int *y, int *w, int *h)
 
GtkWidget * gnc_item_edit_new (GnucashSheet *sheet)
 
void gnc_item_edit_set_popup (GncItemEdit *item_edit, GtkWidget *popup_item, PopupGetHeight popup_get_height, PopupAutosize popup_autosize, PopupSetFocus popup_set_focus, PopupPostShow popup_post_show, PopupGetWidth popup_get_width, gpointer popup_user_data)
 
void gnc_item_edit_show_popup (GncItemEdit *item_edit)
 
void gnc_item_edit_hide_popup (GncItemEdit *item_edit)
 
void gnc_item_edit_cut_clipboard (GncItemEdit *item_edit)
 
void gnc_item_edit_copy_clipboard (GncItemEdit *item_edit)
 
void gnc_item_edit_paste_clipboard (GncItemEdit *item_edit)
 
gboolean gnc_item_edit_get_has_selection (GncItemEdit *item_edit)
 
void gnc_item_edit_focus_in (GncItemEdit *item_edit)
 
void gnc_item_edit_focus_out (GncItemEdit *item_edit)
 
gint gnc_item_edit_get_margin (GncItemEdit *item_edit, Sides side)
 
gint gnc_item_edit_get_padding_border (GncItemEdit *item_edit, Sides side)
 
gint gnc_item_edit_get_button_width (GncItemEdit *item_edit)
 
GType gnc_item_edit_tb_get_type (void)
 
GtkWidget * gnc_item_edit_tb_new (GnucashSheet *sheet)
 
GType gnc_item_list_get_type (void)
 
GtkWidget * gnc_item_list_new (GtkListStore *shared_store)
 
gint gnc_item_list_num_entries (GncItemList *item_list)
 
gint gnc_item_list_get_popup_height (GncItemList *item_list)
 
void gnc_item_list_clear (GncItemList *item_list)
 
void gnc_item_list_append (GncItemList *item_list, const char *string)
 
void gnc_item_list_set_sort_column (GncItemList *item_list, gint column_id)
 
gboolean gnc_item_in_list (GncItemList *item_list, const char *string)
 
void gnc_item_list_select (GncItemList *item_list, const char *string)
 
void gnc_item_list_show_selected (GncItemList *item_list)
 
char * gnc_item_list_get_selection (GncItemList *item_list)
 Retrieve the selected string from the item_list's active GtkListStore.
 
int gnc_item_list_autosize (GncItemList *item_list)
 
void gnc_item_list_set_temp_store (GncItemList *item_list, GtkListStore *store)
 
gboolean gnc_item_list_using_temp (GncItemList *item_list)
 
GtkListStore * gnc_item_list_disconnect_store (GncItemList *item_list)
 
void gnc_item_list_connect_store (GncItemList *item_list, GtkListStore *store)
 
GType gnucash_register_get_type (void)
 
void gnucash_register_add_cell_types (void)
 Add cell types defined by gnucash_register to gnc_register.
 
GtkWidget * gnucash_register_new (Table *table, const gchar *state_section)
 this already has scrollbars attached
 
void gnucash_register_goto_virt_cell (GnucashRegister *reg, VirtualCellLocation vcell_loc)
 
void gnucash_register_goto_virt_loc (GnucashRegister *reg, VirtualLocation virt_loc)
 
void gnucash_register_goto_next_virt_row (GnucashRegister *reg)
 
void gnucash_register_goto_next_matching_row (GnucashRegister *reg, VirtualLocationMatchFunc match, gpointer user_data)
 
void gnucash_register_attach_popup (GnucashRegister *reg, GtkWidget *popup, gpointer data)
 
gboolean gnucash_register_has_selection (GnucashRegister *reg)
 
void gnucash_register_cut_clipboard (GnucashRegister *reg)
 
void gnucash_register_copy_clipboard (GnucashRegister *reg)
 
void gnucash_register_paste_clipboard (GnucashRegister *reg)
 
void gnucash_register_refresh_from_prefs (GnucashRegister *reg)
 
void gnucash_register_set_moved_cb (GnucashRegister *reg, GFunc cb, gpointer cb_data)
 
void gnucash_register_set_open_doclink_cb (GnucashRegister *reg, GFunc cb, gpointer cb_data)
 
GnucashSheet * gnucash_register_get_sheet (GnucashRegister *reg)
 
void gnucash_register_reset_sheet_layout (GnucashRegister *reg)
 
GType gnucash_sheet_get_type (void)
 
GtkWidget * gnucash_sheet_new (Table *table)
 
void gnucash_sheet_table_load (GnucashSheet *sheet, gboolean do_scroll)
 
void gnucash_sheet_recompute_block_offsets (GnucashSheet *sheet)
 
SheetBlockgnucash_sheet_get_block (GnucashSheet *sheet, VirtualCellLocation vcell_loc)
 
gint gnucash_sheet_col_max_width (GnucashSheet *sheet, gint virt_col, gint cell_col)
 
void gnucash_sheet_redraw_all (GnucashSheet *sheet)
 
void gnucash_sheet_redraw_help (GnucashSheet *sheet)
 
void gnucash_sheet_redraw_block (GnucashSheet *sheet, VirtualCellLocation vcell_loc)
 
const char * gnucash_sheet_modify_current_cell (GnucashSheet *sheet, const gchar *new_text)
 
gboolean gnucash_sheet_block_set_from_table (GnucashSheet *sheet, VirtualCellLocation vcell_loc)
 
void gnucash_sheet_set_scroll_region (GnucashSheet *sheet)
 
void gnucash_sheet_cursor_set_from_table (GnucashSheet *sheet, gboolean do_scroll)
 
void gnucash_sheet_compute_visible_range (GnucashSheet *sheet)
 
void gnucash_sheet_make_cell_visible (GnucashSheet *sheet, VirtualLocation virt_loc)
 
void gnucash_sheet_show_range (GnucashSheet *sheet, VirtualCellLocation start_loc, VirtualCellLocation end_loc)
 
void gnucash_sheet_update_adjustments (GnucashSheet *sheet)
 
void gnucash_sheet_set_window (GnucashSheet *sheet, GtkWidget *window)
 
void gnucash_get_style_classes (GnucashSheet *sheet, GtkStyleContext *stylectxt, RegisterColor field_type, gboolean use_neg_class)
 Map a cell color type to a css style class.
 
void gnucash_sheet_set_text_bounds (GnucashSheet *sheet, GdkRectangle *rect, gint x, gint y, gint width, gint height)
 
gint gnucash_sheet_get_text_offset (GnucashSheet *sheet, const VirtualLocation virt_loc, gint rect_width, gint logical_width)
 
gboolean gnucash_sheet_is_read_only (GnucashSheet *sheet)
 
void gnucash_sheet_set_has_focus (GnucashSheet *sheet, gboolean has_focus)
 
GncItemEditgnucash_sheet_get_item_edit (GnucashSheet *sheet)
 
void gnucash_sheet_set_popup (GnucashSheet *sheet, GtkWidget *popup, gpointer data)
 
void gnucash_sheet_goto_virt_loc (GnucashSheet *sheet, VirtualLocation virt_loc)
 
void gnucash_sheet_refresh_from_prefs (GnucashSheet *sheet)
 
gboolean gnucash_sheet_find_loc_by_pixel (GnucashSheet *sheet, gint x, gint y, VirtualLocation *vcell_loc)
 
gboolean gnucash_sheet_draw_internal (GnucashSheet *sheet, cairo_t *cr, GtkAllocation *alloc)
 
void gnucash_sheet_draw_cursor (GnucashCursor *cursor, cairo_t *cr)
 
gboolean gnucash_style_init (void)
 
void gnucash_sheet_style_init (void)
 
gint gnucash_style_col_is_resizable (SheetBlockStyle *style, int col)
 
CellDimensionsgnucash_style_get_cell_dimensions (SheetBlockStyle *style, int row, int col)
 
void gnucash_sheet_set_col_width (GnucashSheet *sheet, int col, int width)
 
gint gnucash_style_row_width (SheetBlockStyle *style, int row)
 
void gnucash_sheet_styles_set_dimensions (GnucashSheet *sheet, int width)
 
void gnucash_sheet_style_destroy (GnucashSheet *sheet, SheetBlockStyle *style)
 
void gnucash_sheet_clear_styles (GnucashSheet *sheet)
 
void gnucash_sheet_create_styles (GnucashSheet *sheet)
 
void gnucash_sheet_compile_styles (GnucashSheet *sheet)
 
void gnucash_sheet_styles_recompile (GnucashSheet *sheet)
 
SheetBlockStyle * gnucash_sheet_get_style (GnucashSheet *sheet, VirtualCellLocation vcell_loc)
 
SheetBlockStyle * gnucash_sheet_get_style_from_table (GnucashSheet *sheet, VirtualCellLocation vcell_loc)
 
SheetBlockStyle * gnucash_sheet_get_style_from_cursor (GnucashSheet *sheet, const char *cursor_name)
 
void gnucash_sheet_style_get_cell_pixel_rel_coords (SheetBlockStyle *style, gint cell_row, gint cell_col, gint *x, gint *y, gint *w, gint *h)
 
void gnucash_sheet_style_ref (GnucashSheet *sheet, SheetBlockStyle *style)
 
void gnucash_sheet_style_unref (GnucashSheet *sheet, SheetBlockStyle *style)
 
void gnucash_sheet_get_borders (GnucashSheet *sheet, VirtualLocation virt_loc, PhysicalCellBorders *borders)
 
GNCHeaderWidths gnc_header_widths_new (void)
 
void gnc_header_widths_destroy (GNCHeaderWidths widths)
 
void gnc_header_widths_set_width (GNCHeaderWidths widths, const char *cell_name, int width)
 
int gnc_header_widths_get_width (GNCHeaderWidths widths, const char *cell_name)
 
void gnucash_sheet_get_header_widths (GnucashSheet *sheet, GNCHeaderWidths widths)
 
void gnucash_sheet_set_header_widths (GnucashSheet *sheet, GNCHeaderWidths widths)
 

Variables

GdkRGBA gn_white
 
GdkRGBA gn_light_gray
 
GdkRGBA gn_dark_gray
 
GdkRGBA gn_black
 
GdkRGBA gn_blue
 
GdkRGBA gn_red
 
GdkRGBA gn_yellow
 
BasicCell * gnc_formula_cell_gnome_new (void)
 

Detailed Description

Macro Definition Documentation

◆ GNC_DATE_PICKER

#define GNC_DATE_PICKER (   obj)    G_TYPE_CHECK_INSTANCE_CAST((obj), gnc_date_picker_get_type (), GNCDatePicker)

Definition at line 36 of file gnucash-date-picker.h.

◆ GNC_DATE_PICKER_CLASS

#define GNC_DATE_PICKER_CLASS (   k)    G_TYPE_CHECK_CLASS_CAST((k), gnc_date_picker_get_type (), GNCDatePickerClass)

Definition at line 37 of file gnucash-date-picker.h.

◆ GNC_HEADER

#define GNC_HEADER (   o)    (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_HEADER, GncHeader))

Definition at line 34 of file gnucash-header.h.

◆ GNC_HEADER_CLASS

#define GNC_HEADER_CLASS (   k)    (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_HEADER, GncHeaderClass))

Definition at line 35 of file gnucash-header.h.

◆ GNC_IS_HEADER

#define GNC_IS_HEADER (   o)    (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_HEADER))

Definition at line 36 of file gnucash-header.h.

◆ GNC_IS_ITEM_EDIT

#define GNC_IS_ITEM_EDIT (   o)    (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_ITEM_EDIT))

Definition at line 38 of file gnucash-item-edit.h.

◆ GNC_IS_ITEM_EDIT_TB

#define GNC_IS_ITEM_EDIT_TB (   o)    (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_ITEM_EDIT_TB))

Definition at line 43 of file gnucash-item-edit.h.

◆ GNC_ITEM_EDIT

#define GNC_ITEM_EDIT (   o)    (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_ITEM_EDIT, GncItemEdit))

Definition at line 36 of file gnucash-item-edit.h.

◆ GNC_ITEM_EDIT_CLASS

#define GNC_ITEM_EDIT_CLASS (   k)    (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_ITEM_EDIT, GncItemEditClass))

Definition at line 37 of file gnucash-item-edit.h.

◆ GNC_ITEM_EDIT_TB

#define GNC_ITEM_EDIT_TB (   o)    (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_ITEM_EDIT_TB, GncItemEditTb))

Definition at line 41 of file gnucash-item-edit.h.

◆ GNC_ITEM_EDIT_TB_CLASS

#define GNC_ITEM_EDIT_TB_CLASS (   k)    (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_ITEM_EDIT_TB, GncItemEditTbClass))

Definition at line 42 of file gnucash-item-edit.h.

◆ GNC_ITEM_LIST

#define GNC_ITEM_LIST (   o)    (G_TYPE_CHECK_INSTANCE_CAST((o), GNC_TYPE_ITEM_LIST, GncItemList))

Definition at line 36 of file gnucash-item-list.h.

◆ GNC_ITEM_LIST_CLASS

#define GNC_ITEM_LIST_CLASS (   k)    (G_TYPE_CHECK_CLASS_CAST ((k), GNC_TYPE_ITEM_LIST, GncItemListClass))

Definition at line 37 of file gnucash-item-list.h.

◆ GNC_TYPE_DATE_PICKER

#define GNC_TYPE_DATE_PICKER   (gnc_date_picker_get_type ())

Definition at line 35 of file gnucash-date-picker.h.

◆ GNC_TYPE_HEADER

#define GNC_TYPE_HEADER   (gnc_header_get_type ())

Definition at line 33 of file gnucash-header.h.

◆ GNC_TYPE_ITEM_EDIT

#define GNC_TYPE_ITEM_EDIT   (gnc_item_edit_get_type ())

Definition at line 35 of file gnucash-item-edit.h.

◆ GNC_TYPE_ITEM_EDIT_TB

#define GNC_TYPE_ITEM_EDIT_TB   (gnc_item_edit_tb_get_type ())

Definition at line 40 of file gnucash-item-edit.h.

◆ GNC_TYPE_ITEM_LIST

#define GNC_TYPE_ITEM_LIST   (gnc_item_list_get_type ())

Definition at line 35 of file gnucash-item-list.h.

◆ GNUCASH_CURSOR

#define GNUCASH_CURSOR (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNUCASH_TYPE_CURSOR, GnucashCursor))

Definition at line 35 of file gnucash-cursor.h.

◆ GNUCASH_CURSOR_CLASS

#define GNUCASH_CURSOR_CLASS (   k)    (G_TYPE_CHECK_CLASS_CAST ((k), GNUCASH_TYPE_CURSOR, GnucashCursorClass))

Definition at line 36 of file gnucash-cursor.h.

◆ GNUCASH_IS_CURSOR

#define GNUCASH_IS_CURSOR (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GNUCASH_TYPE_CURSOR))

Definition at line 37 of file gnucash-cursor.h.

◆ GNUCASH_IS_REGISTER

#define GNUCASH_IS_REGISTER (   o)    (G_TYPE_CHECK_INSTANCE_TYPE((o), GNUCASH_TYPE_REGISTER))

Definition at line 45 of file gnucash-register.h.

◆ GNUCASH_IS_SHEET

#define GNUCASH_IS_SHEET (   o)    (G_TYPE_CHECK_INSTANCE_TYPE((o), GNUCASH_TYPE_SHEET))

Definition at line 43 of file gnucash-sheet.h.

◆ GNUCASH_REGISTER

#define GNUCASH_REGISTER (   obj)    (G_TYPE_CHECK_INSTANCE_CAST((obj), GNUCASH_TYPE_REGISTER, GnucashRegister))

Definition at line 43 of file gnucash-register.h.

◆ GNUCASH_REGISTER_CLASS

#define GNUCASH_REGISTER_CLASS (   k)    (G_TYPE_CHECK_CLASS_CAST ((k), GNUCASH_TYPE_REGISTER))

Definition at line 44 of file gnucash-register.h.

◆ GNUCASH_SHEET

#define GNUCASH_SHEET (   obj)    (G_TYPE_CHECK_INSTANCE_CAST((obj), GNUCASH_TYPE_SHEET, GnucashSheet))

Definition at line 41 of file gnucash-sheet.h.

◆ GNUCASH_SHEET_CLASS

#define GNUCASH_SHEET_CLASS (   k)    (G_TYPE_CHECK_CLASS_CAST ((k), GNUCASH_TYPE_SHEET))

Definition at line 42 of file gnucash-sheet.h.

◆ GNUCASH_TYPE_CURSOR

#define GNUCASH_TYPE_CURSOR   (gnucash_cursor_get_type ())

Definition at line 34 of file gnucash-cursor.h.

◆ GNUCASH_TYPE_REGISTER

#define GNUCASH_TYPE_REGISTER   (gnucash_register_get_type ())

Definition at line 42 of file gnucash-register.h.

◆ GNUCASH_TYPE_SHEET

#define GNUCASH_TYPE_SHEET   (gnucash_sheet_get_type ())

Definition at line 40 of file gnucash-sheet.h.

◆ IS_GNC_DATE_PICKER

#define IS_GNC_DATE_PICKER (   o)    G_TYPE_CHECK_INSTANCE_TYPE((o), gnc_date_picker_get_type ())

Definition at line 38 of file gnucash-date-picker.h.

◆ IS_GNC_ITEM_LIST

#define IS_GNC_ITEM_LIST (   o)    (G_TYPE_CHECK_INSTANCE_TYPE((o), GNC_TYPE_ITEM_LIST))

Definition at line 38 of file gnucash-item-list.h.

Typedef Documentation

◆ GNCHeaderWidths

typedef GHashTable* GNCHeaderWidths

Definition at line 118 of file gnucash-style.h.

◆ GNCLedgerDisplayDestroy

typedef void(* GNCLedgerDisplayDestroy) (GNCLedgerDisplay *ld)

Definition at line 54 of file gnc-ledger-display.h.

◆ GNCLedgerDisplayGetParent

typedef GtkWidget *(* GNCLedgerDisplayGetParent) (GNCLedgerDisplay *ld)

Definition at line 55 of file gnc-ledger-display.h.

◆ GNCLedgerDisplaySetHelp

typedef void(* GNCLedgerDisplaySetHelp) (GNCLedgerDisplay *ld, const char *help_str)

Definition at line 56 of file gnc-ledger-display.h.

◆ PopupAutosize

typedef int(* PopupAutosize) (GtkWidget *item, int max_width, gpointer user_data)

Definition at line 50 of file gnucash-item-edit.h.

◆ PopupGetHeight

typedef int(* PopupGetHeight) (GtkWidget *item, int space_available, int row_height, gpointer user_data)

Definition at line 45 of file gnucash-item-edit.h.

◆ PopupGetWidth

typedef int(* PopupGetWidth) (GtkWidget *item, gpointer user_data)

Definition at line 60 of file gnucash-item-edit.h.

◆ PopupPostShow

typedef void(* PopupPostShow) (GtkWidget *item, gpointer user_data)

Definition at line 57 of file gnucash-item-edit.h.

◆ PopupSetFocus

typedef void(* PopupSetFocus) (GtkWidget *item, gpointer user_data)

Definition at line 54 of file gnucash-item-edit.h.

◆ VirtualLocationMatchFunc

typedef gboolean(* VirtualLocationMatchFunc) (VirtualLocation virt_loc, gpointer user_data)

Definition at line 71 of file gnucash-register.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Definition at line 42 of file gnucash-cursor.h.

43{
44 GNUCASH_CURSOR_CELL,
45 GNUCASH_CURSOR_BLOCK,
46 GNUCASH_CURSOR_NUM
47};

◆ GNCLedgerDisplayType

enum GNCLedgerDisplayType

Definition at line 59 of file gnc-ledger-display.h.

60{
61 LD_SINGLE,
62 LD_SUBACCOUNT,
63 LD_GL,
64} GNCLedgerDisplayType;

◆ Sides

enum Sides

Definition at line 126 of file gnucash-item-edit.h.

127{
128 left,
129 right,
130 top,
131 bottom,
132 left_right,
133 top_bottom,
134} Sides;

Function Documentation

◆ gnc_date_picker_get_date()

void gnc_date_picker_get_date ( GNCDatePicker date_picker,
guint *  day,
guint *  mon,
guint *  year 
)

Definition at line 56 of file gnucash-date-picker.c.

58{
59 g_return_if_fail (IS_GNC_DATE_PICKER (date_picker));
60 g_return_if_fail (date_picker->calendar != NULL);
61
62 gtk_calendar_get_date (date_picker->calendar, year, mon, day);
63}

◆ gnc_date_picker_new()

GtkWidget * gnc_date_picker_new ( void  )

Definition at line 161 of file gnucash-date-picker.c.

162{
163 GtkWidget *calendar;
164 GNCDatePicker *date_picker;
165 GtkAllocation allocation;
166 GtkRequisition requisition;
167
168 date_picker = g_object_new (GNC_TYPE_DATE_PICKER,
169 "homogeneous", FALSE,
170 NULL);
171
172 calendar = gtk_calendar_new ();
173 date_picker->calendar = GTK_CALENDAR (calendar);
174
175 gtk_box_pack_start (GTK_BOX(date_picker), calendar, TRUE, TRUE, 0);
176
177 gtk_widget_get_preferred_size (calendar, &requisition, NULL);
178 allocation.x = 0;
179 allocation.y = 0;
180 allocation.width = requisition.width;
181 allocation.height = requisition.height;
182 gtk_widget_size_allocate (calendar, &allocation);
183
184 g_signal_connect_after (calendar, "button_press_event",
185 G_CALLBACK (gnc_date_picker_button_event),
186 date_picker);
187
188 g_signal_connect (calendar, "key_press_event",
189 G_CALLBACK (gnc_date_picker_key_event),
190 date_picker);
191
192 g_signal_connect (calendar, "day_selected",
193 G_CALLBACK (day_selected),
194 date_picker);
195
196 g_signal_connect (calendar, "day_selected_double_click",
197 G_CALLBACK (day_selected_double_click),
198 date_picker);
199
200 return GTK_WIDGET(date_picker);
201}

◆ gnc_date_picker_set_date()

void gnc_date_picker_set_date ( GNCDatePicker date_picker,
guint  day,
guint  mon,
guint  year 
)

Definition at line 44 of file gnucash-date-picker.c.

46{
47 g_return_if_fail (IS_GNC_DATE_PICKER (date_picker));
48 g_return_if_fail (date_picker->calendar != NULL);
49
50 gtk_calendar_select_day (date_picker->calendar, 1);
51 gtk_calendar_select_month (date_picker->calendar, mon, year);
52 gtk_calendar_select_day (date_picker->calendar, day);
53}

◆ gnc_formula_cell_gnome_new()

BasicCell * gnc_formula_cell_gnome_new ( void  )

Definition at line 131 of file formulacell-gnome.c.

132{
133 BasicCell *cell;
134
135 cell = gnc_formula_cell_new ();
136 cell->direct_update = gnc_formula_cell_direct_update;
137 return cell;
138}

◆ gnc_header_get_cell_offset()

gint gnc_header_get_cell_offset ( GncHeader header,
gint  col,
gint *  cell_width 
)

Definition at line 201 of file gnucash-header.c.

202{
203 SheetBlockStyle *style = header->style;
204 gint j;
205 gint offset = 0;
206
207 for (j = 0; j < style->ncols; j++)
208 {
209 CellDimensions *cd;
210
211 cd = gnucash_style_get_cell_dimensions (style, 0, j);
212 if (!cd) continue;
213
214 if (j == col)
215 {
216 *cell_width = cd->pixel_width;
217 break;
218 }
219 offset = offset + cd->pixel_width;
220 }
221 return offset;
222}

◆ gnc_header_new()

GtkWidget * gnc_header_new ( GnucashSheet *  sheet)

Definition at line 684 of file gnucash-header.c.

685{
686 GtkWidget *layout;
687
688 layout = g_object_new (GNC_TYPE_HEADER,
689 "sheet", sheet,
690 "cursor_name", CURSOR_HEADER,
691 NULL);
692
693 sheet->header_item = layout;
694 return layout;
695}
#define CURSOR_HEADER
Standard Cursor Names.

◆ gnc_header_reconfigure()

void gnc_header_reconfigure ( GncHeader header)

Definition at line 294 of file gnucash-header.c.

295{
296 GnucashSheet *sheet;
297 SheetBlockStyle *old_style;
298 int w, h;
299
300 g_return_if_fail (header != NULL);
301 g_return_if_fail (GNC_IS_HEADER(header));
302
303 sheet = GNUCASH_SHEET(header->sheet);
304 old_style = header->style;
305
306 header->style = gnucash_sheet_get_style_from_cursor
307 (sheet, header->cursor_name);
308
309 if (header->style == NULL)
310 return;
311
312 sheet->width = header->style->dimensions->width;
313
314 w = header->style->dimensions->width;
315 h = header->style->dimensions->height;
316 h *= header->num_phys_rows;
317 h /= header->style->nrows;
318 h += 2;
319
320 if (header->height != h ||
321 header->width != w ||
322 header->style != old_style)
323 {
324 header->height = h;
325 header->width = w;
326 gtk_layout_set_size (GTK_LAYOUT(header), w, h);
327 gtk_widget_set_size_request (GTK_WIDGET(header), -1, h);
328 gnc_header_request_redraw (header);
329 }
330}

◆ gnc_header_request_redraw()

void gnc_header_request_redraw ( GncHeader header)

Definition at line 248 of file gnucash-header.c.

249{
250 if (!header->style)
251 return;
252
253 gnc_header_draw_offscreen (header);
254 gtk_widget_queue_draw (GTK_WIDGET(header));
255}

◆ gnc_header_set_header_rows()

void gnc_header_set_header_rows ( GncHeader header,
int  num_phys_rows 
)

Definition at line 333 of file gnucash-header.c.

335{
336 g_return_if_fail (header != NULL);
337 g_return_if_fail (GNC_IS_HEADER(header));
338
339 header->num_phys_rows = num_phys_rows;
340}

◆ gnc_header_widths_destroy()

void gnc_header_widths_destroy ( GNCHeaderWidths  widths)

Definition at line 881 of file gnucash-style.c.

882{
883 if (!widths) return;
884 g_hash_table_foreach (widths, header_width_destroy_helper, NULL);
885 g_hash_table_destroy (widths);
886}

◆ gnc_header_widths_get_width()

int gnc_header_widths_get_width ( GNCHeaderWidths  widths,
const char *  cell_name 
)

Definition at line 912 of file gnucash-style.c.

914{
915 WidthNode *wn;
916
917 g_return_val_if_fail (widths != NULL, 0);
918
919 wn = g_hash_table_lookup (widths, cell_name);
920 if (!wn)
921 return 0;
922
923 return wn->width;
924}

◆ gnc_header_widths_new()

GNCHeaderWidths gnc_header_widths_new ( void  )

Definition at line 864 of file gnucash-style.c.

865{
866 return g_hash_table_new (g_str_hash, g_str_equal);
867}

◆ gnc_header_widths_set_width()

void gnc_header_widths_set_width ( GNCHeaderWidths  widths,
const char *  cell_name,
int  width 
)

Definition at line 889 of file gnucash-style.c.

892{
893 WidthNode *wn;
894
895 g_return_if_fail (widths != NULL);
896 g_return_if_fail (cell_name != NULL);
897
898 wn = g_hash_table_lookup (widths, cell_name);
899 if (!wn)
900 {
901 wn = g_new0 (WidthNode, 1);
902
903 wn->cell_name = g_strdup (cell_name);
904
905 g_hash_table_insert (widths, wn->cell_name, wn);
906 }
907
908 wn->width = width;
909}

◆ gnc_item_edit_configure()

void gnc_item_edit_configure ( GncItemEdit item_edit)

Definition at line 331 of file gnucash-item-edit.c.

332{
333 GnucashSheet *sheet = item_edit->sheet;
334 GnucashCursor *cursor;
335 gfloat xalign;
336
337 cursor = GNUCASH_CURSOR(sheet->cursor);
338
339 item_edit->virt_loc.vcell_loc.virt_row = cursor->row;
340 item_edit->virt_loc.vcell_loc.virt_col = cursor->col;
341
342 item_edit->style = gnucash_sheet_get_style (sheet,
343 item_edit->virt_loc.vcell_loc);
344
345 item_edit->virt_loc.phys_row_offset = cursor->cell.row;
346 item_edit->virt_loc.phys_col_offset = cursor->cell.col;
347
348 switch (gnc_table_get_align (sheet->table, item_edit->virt_loc))
349 {
350 default:
351 case CELL_ALIGN_LEFT:
352 xalign = 0;
353 break;
354
355 case CELL_ALIGN_RIGHT:
356 xalign = 1;
357 break;
358
359 case CELL_ALIGN_CENTER:
360 xalign = 0.5;
361 break;
362 }
363 gtk_entry_set_alignment (GTK_ENTRY(item_edit->editor), xalign);
364
365 if (!gnc_table_is_popup (sheet->table, item_edit->virt_loc))
366 gnc_item_edit_set_popup (item_edit, NULL, NULL, NULL,
367 NULL, NULL, NULL, NULL);
368
369 g_idle_add_full (G_PRIORITY_HIGH_IDLE,
370 (GSourceFunc)gnc_item_edit_update, item_edit, NULL);
371}

◆ gnc_item_edit_copy_clipboard()

void gnc_item_edit_copy_clipboard ( GncItemEdit item_edit)

Definition at line 381 of file gnucash-item-edit.c.

382{
383 gtk_editable_copy_clipboard (GTK_EDITABLE(item_edit->editor));
384}

◆ gnc_item_edit_cut_clipboard()

void gnc_item_edit_cut_clipboard ( GncItemEdit item_edit)

Definition at line 375 of file gnucash-item-edit.c.

376{
377 gtk_editable_cut_clipboard (GTK_EDITABLE(item_edit->editor));
378}

◆ gnc_item_edit_focus_in()

void gnc_item_edit_focus_in ( GncItemEdit item_edit)

Definition at line 261 of file gnucash-item-edit.c.

262{
263 GdkEventFocus ev;
264
265 g_return_if_fail (item_edit != NULL);
266 g_return_if_fail (GNC_IS_ITEM_EDIT(item_edit));
267
268 ev.type = GDK_FOCUS_CHANGE;
269 ev.window = gtk_widget_get_window (GTK_WIDGET(item_edit->sheet));
270 ev.in = TRUE;
271 gtk_widget_event (item_edit->editor, (GdkEvent*) &ev);
272}

◆ gnc_item_edit_focus_out()

void gnc_item_edit_focus_out ( GncItemEdit item_edit)

Definition at line 275 of file gnucash-item-edit.c.

276{
277 GdkEventFocus ev;
278
279 g_return_if_fail (item_edit != NULL);
280 g_return_if_fail (GNC_IS_ITEM_EDIT(item_edit));
281
282 if (item_edit->show_popup)
283 return; // Prevent recursion
284
285 ev.type = GDK_FOCUS_CHANGE;
286 ev.window = gtk_widget_get_window (GTK_WIDGET(item_edit->sheet));
287 ev.in = FALSE;
288 gtk_widget_event (item_edit->editor, (GdkEvent*) &ev);
289}

◆ gnc_item_edit_get_button_width()

gint gnc_item_edit_get_button_width ( GncItemEdit item_edit)

Definition at line 818 of file gnucash-item-edit.c.

819{
820 if (item_edit)
821 {
822 if (gtk_widget_is_visible (GTK_WIDGET(item_edit->popup_toggle.tbutton)))
823 return item_edit->button_width;
824 else
825 {
826 GtkStyleContext *context = gtk_widget_get_style_context (
827 GTK_WIDGET(item_edit->popup_toggle.tbutton));
828 GtkBorder border;
829
830 gtk_style_context_get_border (context, GTK_STATE_FLAG_NORMAL, &border);
831 return MIN_BUTT_WIDTH + border.left + border.right;
832 }
833 }
834 return MIN_BUTT_WIDTH + 2; // add the default border
835}

◆ gnc_item_edit_get_has_selection()

gboolean gnc_item_edit_get_has_selection ( GncItemEdit item_edit)

Definition at line 1174 of file gnucash-item-edit.c.

1175{
1176 GtkEditable *editable;
1177
1178 g_return_val_if_fail ((item_edit != NULL), FALSE);
1179 g_return_val_if_fail (GNC_IS_ITEM_EDIT(item_edit), FALSE);
1180
1181 editable = GTK_EDITABLE(item_edit->editor);
1182 return gtk_editable_get_selection_bounds (editable, NULL, NULL);
1183}

◆ gnc_item_edit_get_margin()

gint gnc_item_edit_get_margin ( GncItemEdit item_edit,
Sides  side 
)

Definition at line 772 of file gnucash-item-edit.c.

773{
774 switch (side)
775 {
776 case left:
777 return item_edit->margin.left;
778 case right:
779 return item_edit->margin.right;
780 case top:
781 return item_edit->margin.top;
782 case bottom:
783 return item_edit->margin.bottom;
784 case left_right:
785 return item_edit->margin.left + item_edit->margin.right;
786 case top_bottom:
787 return item_edit->margin.top + item_edit->margin.bottom;
788 default:
789 return 2;
790 }
791}

◆ gnc_item_edit_get_padding_border()

gint gnc_item_edit_get_padding_border ( GncItemEdit item_edit,
Sides  side 
)

Definition at line 794 of file gnucash-item-edit.c.

795{
796 switch (side)
797 {
798 case left:
799 return item_edit->padding.left + item_edit->border.left;
800 case right:
801 return item_edit->padding.right + item_edit->border.right;
802 case top:
803 return item_edit->padding.top + item_edit->border.top;
804 case bottom:
805 return item_edit->padding.bottom + item_edit->border.bottom;
806 case left_right:
807 return item_edit->padding.left + item_edit->border.left +
808 item_edit->padding.right + item_edit->border.right;
809 case top_bottom:
810 return item_edit->padding.top + item_edit->border.top +
811 item_edit->padding.bottom + item_edit->border.bottom;
812 default:
813 return 2;
814 }
815}

◆ gnc_item_edit_get_pixel_coords()

void gnc_item_edit_get_pixel_coords ( GncItemEdit item_edit,
int *  x,
int *  y,
int *  w,
int *  h 
)

Definition at line 207 of file gnucash-item-edit.c.

210{
211 GnucashSheet *sheet = item_edit->sheet;
212 SheetBlock *block;
213 int xd, yd;
214
215 if (sheet == NULL)
216 return;
217
218 block = gnucash_sheet_get_block (sheet, item_edit->virt_loc.vcell_loc);
219 if (block == NULL)
220 return;
221
222 xd = block->origin_x;
223 yd = block->origin_y;
224
225 gnucash_sheet_style_get_cell_pixel_rel_coords (item_edit->style,
226 item_edit->virt_loc.phys_row_offset,
227 item_edit->virt_loc.phys_col_offset,
228 x, y, w, h);
229
230 // alter cell size of first column
231 if (item_edit->virt_loc.phys_col_offset == 0)
232 {
233 *x = *x + 1;
234 *w = *w - 1;
235 }
236 *x += xd;
237 *y += yd;
238}
gint origin_y
x origin of block

◆ gnc_item_edit_hide_popup()

void gnc_item_edit_hide_popup ( GncItemEdit item_edit)

Definition at line 1094 of file gnucash-item-edit.c.

1095{
1096 g_return_if_fail (item_edit != NULL);
1097 g_return_if_fail (GNC_IS_ITEM_EDIT(item_edit));
1098
1099 if (!item_edit->is_popup)
1100 return;
1101
1102 if (gtk_widget_get_parent (GTK_WIDGET(item_edit->popup_item)) != GTK_WIDGET(item_edit->sheet))
1103 return;
1104
1105 gtk_container_remove (GTK_CONTAINER(item_edit->sheet), item_edit->popup_item);
1106
1107 // set the popup arrow direction down
1108 item_edit->popup_toggle.arrow_down = TRUE;
1109
1110 gtk_toggle_button_set_active
1111 (GTK_TOGGLE_BUTTON(item_edit->popup_toggle.tbutton), FALSE);
1112
1113 item_edit->popup_allocation_height = -1;
1114
1115 gtk_widget_grab_focus (GTK_WIDGET(item_edit->sheet));
1116}

◆ gnc_item_edit_new()

GtkWidget * gnc_item_edit_new ( GnucashSheet *  sheet)

Definition at line 863 of file gnucash-item-edit.c.

864{
865 GtkStyleContext *stylectxt;
866 GtkBorder padding;
867 GtkBorder margin;
868 GtkBorder border;
869 GncItemEdit *item_edit = g_object_new (GNC_TYPE_ITEM_EDIT,
870 "sheet", sheet,
871 "spacing", 0,
872 "homogeneous", FALSE,
873 NULL);
874 gtk_layout_put (GTK_LAYOUT(sheet), GTK_WIDGET(item_edit), 0, 0);
875
876 /* Create the text entry */
877 item_edit->editor = gtk_entry_new ();
878 sheet->entry = item_edit->editor;
879 gtk_entry_set_width_chars (GTK_ENTRY(item_edit->editor), 1);
880 gtk_box_pack_start (GTK_BOX(item_edit), item_edit->editor, TRUE, TRUE, 0);
881
882 // Get the CSS space settings for the entry
883 stylectxt = gtk_widget_get_style_context (GTK_WIDGET(item_edit->editor));
884 gtk_style_context_add_class (stylectxt, "gnc-class-register-foreground");
885 gtk_style_context_get_padding (stylectxt, GTK_STATE_FLAG_NORMAL, &padding);
886 gtk_style_context_get_margin (stylectxt, GTK_STATE_FLAG_NORMAL, &margin);
887 gtk_style_context_get_border (stylectxt, GTK_STATE_FLAG_NORMAL, &border);
888
889 item_edit->padding = padding;
890 item_edit->margin = margin;
891 item_edit->border = border;
892
893 // Make sure the Entry can not have focus and no frame
894 gtk_widget_set_can_focus (GTK_WIDGET(item_edit->editor), FALSE);
895 gtk_entry_set_has_frame (GTK_ENTRY(item_edit->editor), FALSE);
896
897 // Connect to the draw signal so we can draw a cursor
898 g_signal_connect_after (item_edit->editor, "draw",
899 G_CALLBACK(draw_text_cursor_cb), item_edit);
900
901 g_signal_connect (item_edit->editor, "preedit-changed",
902 G_CALLBACK(preedit_changed_cb), item_edit);
903
904 // Fill in the background so the underlying sheet cell can not be seen
905 g_signal_connect (item_edit, "draw",
906 G_CALLBACK(draw_background_cb), item_edit);
907
908 // This call back intercepts the mouse button event so the main
909 // register popup menu can be displayed instead of the entry one.
910 g_signal_connect (item_edit->editor, "button-press-event",
911 G_CALLBACK(button_press_cb), item_edit);
912
913 /* Create the popup button
914 It will only be displayed when the cell being edited provides
915 a popup item (like a calendar or account list) */
916 item_edit->popup_toggle.tbutton = gnc_item_edit_tb_new (sheet);
917 gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON(item_edit->popup_toggle.tbutton), FALSE);
918
919 /* Wrap the popup button in an event box to give it its own gdkwindow.
920 * Without one the button would disappear behind the grid object. */
921 item_edit->popup_toggle.ebox = gtk_event_box_new ();
922 g_object_ref (item_edit->popup_toggle.ebox);
923 gtk_container_add (GTK_CONTAINER(item_edit->popup_toggle.ebox),
924 item_edit->popup_toggle.tbutton);
925
926 // This call back intercepts the right mouse button event to stop the
927 // gnucash_sheet_button_press_event from running.
928 g_signal_connect (item_edit->popup_toggle.ebox, "button-press-event",
929 G_CALLBACK(tb_button_press_cb), NULL);
930
931 gtk_box_pack_start (GTK_BOX(item_edit), item_edit->popup_toggle.ebox, FALSE, FALSE, 0);
932 gtk_widget_show_all (GTK_WIDGET(item_edit));
933 g_signal_connect (G_OBJECT(item_edit), "destroy",
934 G_CALLBACK(gnc_item_edit_destroying), NULL);
935 return GTK_WIDGET(item_edit);
936}

◆ gnc_item_edit_paste_clipboard()

void gnc_item_edit_paste_clipboard ( GncItemEdit item_edit)

Definition at line 387 of file gnucash-item-edit.c.

388{
389 GtkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET(item_edit->editor),
390 GDK_SELECTION_CLIPBOARD);
391 gchar *text = gtk_clipboard_wait_for_text (clipboard);
392 gchar *filtered_text;
393 gint start_pos, end_pos;
394 gint position;
395
396 if (!text)
397 return;
398
399 filtered_text = gnc_filter_text_for_control_chars (text);
400
401 if (!filtered_text)
402 {
403 g_free (text);
404 return;
405 }
406
407 position = gtk_editable_get_position (GTK_EDITABLE(item_edit->editor));
408
409 if (gtk_editable_get_selection_bounds (GTK_EDITABLE(item_edit->editor),
410 &start_pos, &end_pos))
411 {
412 position = start_pos;
413
414 gtk_editable_delete_selection (GTK_EDITABLE(item_edit->editor));
415 gtk_editable_insert_text (GTK_EDITABLE(item_edit->editor),
416 filtered_text, -1, &position);
417 }
418 else
419 gtk_editable_insert_text (GTK_EDITABLE(item_edit->editor),
420 filtered_text, -1, &position);
421
422 gtk_editable_set_position (GTK_EDITABLE(item_edit->editor), position);
423
424 g_free (text);
425 g_free (filtered_text);
426}
char * gnc_filter_text_for_control_chars(const char *text)
Returns the incoming text removed of control characters.

◆ gnc_item_edit_set_popup()

void gnc_item_edit_set_popup ( GncItemEdit item_edit,
GtkWidget *  popup_item,
PopupGetHeight  popup_get_height,
PopupAutosize  popup_autosize,
PopupSetFocus  popup_set_focus,
PopupPostShow  popup_post_show,
PopupGetWidth  popup_get_width,
gpointer  popup_user_data 
)

Definition at line 1120 of file gnucash-item-edit.c.

1128{
1129 g_return_if_fail (GNC_IS_ITEM_EDIT(item_edit));
1130
1131 if (item_edit->is_popup)
1132 gnc_item_edit_hide_popup (item_edit);
1133
1134 /* setup size-allocate callback for popup_item height, done here as
1135 item_edit is constant and popup_item changes per cell */
1136 if (popup_item)
1137 {
1138 item_edit->popup_height_signal_id = g_signal_connect_after (
1139 popup_item, "size-allocate",
1140 G_CALLBACK(check_popup_height_is_true),
1141 item_edit);
1142 }
1143 else
1144 {
1145 if (GNC_ITEM_EDIT(item_edit)->popup_height_signal_id > 0)
1146 {
1147 g_signal_handler_disconnect (item_edit->popup_item, item_edit->popup_height_signal_id);
1148 item_edit->popup_height_signal_id = 0;
1149 }
1150 }
1151
1152 item_edit->is_popup = popup_item != NULL;
1153
1154 item_edit->popup_item = popup_item;
1155 item_edit->popup_get_height = popup_get_height;
1156 item_edit->popup_autosize = popup_autosize;
1157 item_edit->popup_set_focus = popup_set_focus;
1158 item_edit->popup_post_show = popup_post_show;
1159 item_edit->popup_get_width = popup_get_width;
1160 item_edit->popup_user_data = popup_user_data;
1161
1162 if (item_edit->is_popup)
1163 connect_popup_toggle_signals (item_edit);
1164 else
1165 {
1166 disconnect_popup_toggle_signals (item_edit);
1167
1168 gnc_item_edit_hide_popup (item_edit);
1169 gtk_widget_hide (item_edit->popup_toggle.ebox);
1170 }
1171}

◆ gnc_item_edit_show_popup()

void gnc_item_edit_show_popup ( GncItemEdit item_edit)

Definition at line 969 of file gnucash-item-edit.c.

970{
971 GtkToggleButton *toggle;
972 GtkAdjustment *vadj, *hadj;
973 GtkAllocation alloc;
974 GnucashSheet *sheet;
975 gint x = 0, y = 0, w = 0, h = 0;
976 gint y_offset, x_offset;
977 gint popup_x, popup_y;
978 gint popup_w = -1, popup_h = -1;
979 gint popup_max_width, popup_max_height;
980 gint view_height;
981 gint down_height, up_height;
982 gint sheet_width;
983
984 g_return_if_fail (item_edit != NULL);
985 g_return_if_fail (GNC_IS_ITEM_EDIT(item_edit));
986
987 if (!item_edit->is_popup)
988 return;
989
990 sheet = item_edit->sheet;
991
992 sheet_width = sheet->width;
993
994 gtk_widget_get_allocation (GTK_WIDGET(sheet), &alloc);
995 view_height = alloc.height;
996
997 vadj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE(sheet));
998 hadj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE(sheet));
999
1000 y_offset = gtk_adjustment_get_value (vadj);
1001 x_offset = gtk_adjustment_get_value (hadj);
1002 gnc_item_edit_get_pixel_coords (item_edit, &x, &y, &w, &h);
1003
1004 popup_x = x;
1005
1006 up_height = y - y_offset;
1007 down_height = view_height - (up_height + h);
1008
1009 popup_max_height = MAX(up_height, down_height);
1010 popup_max_width = sheet_width - popup_x + x_offset; // always pops to the right
1011
1012 if (item_edit->popup_get_height)
1013 popup_h = item_edit->popup_get_height
1014 (item_edit->popup_item, popup_max_height, h,
1015 item_edit->popup_user_data);
1016
1017 if (item_edit->popup_autosize)
1018 popup_w =
1019 item_edit->popup_autosize (item_edit->popup_item,
1020 popup_max_width,
1021 item_edit->popup_user_data);
1022 else
1023 popup_w = 0;
1024
1025 // Adjust the popup_y point based on popping above or below
1026 if (up_height > down_height)
1027 popup_y = y - popup_h - 1;
1028 else
1029 popup_y = y + h;
1030
1031 if (!gtk_widget_get_parent (item_edit->popup_item))
1032 gtk_layout_put (GTK_LAYOUT(sheet), item_edit->popup_item, popup_x, popup_y);
1033
1034 // Lets check popup height is the true height
1035 item_edit->popup_returned_height = popup_h;
1036
1037 gtk_widget_get_allocation (GTK_WIDGET(item_edit), &alloc);
1038
1039 // the calendar will be 0
1040 if ((popup_w != 0) && (popup_w < alloc.width))
1041 popup_w = alloc.width;
1042
1043 if (popup_h == popup_max_height)
1044 gtk_widget_set_size_request (item_edit->popup_item, popup_w - 1, popup_h);
1045 else
1046 gtk_widget_set_size_request (item_edit->popup_item, popup_w - 1, -1);
1047
1048 toggle = GTK_TOGGLE_BUTTON(item_edit->popup_toggle.tbutton);
1049
1050 if (!gtk_toggle_button_get_active (toggle))
1051 {
1052 block_toggle_signals (item_edit);
1053 gtk_toggle_button_set_active (toggle, TRUE);
1054 unblock_toggle_signals (item_edit);
1055 }
1056
1057 // set the popup arrow direction up
1058 item_edit->popup_toggle.arrow_down = FALSE;
1059 item_edit->show_popup = TRUE;
1060
1061 if (item_edit->popup_set_focus)
1062 item_edit->popup_set_focus (item_edit->popup_item,
1063 item_edit->popup_user_data);
1064
1065 if (item_edit->popup_post_show)
1066 item_edit->popup_post_show (item_edit->popup_item,
1067 item_edit->popup_user_data);
1068
1069 if (item_edit->popup_get_width)
1070 {
1071 int popup_width;
1072
1073 popup_width = item_edit->popup_get_width
1074 (item_edit->popup_item,
1075 item_edit->popup_user_data);
1076
1077 if (popup_width > popup_w)
1078 popup_width = popup_w;
1079
1080 if (popup_width > popup_max_width)
1081 {
1082 popup_x -= popup_width - popup_max_width;
1083 popup_x = MAX(0, popup_x);
1084 }
1085 else
1086 popup_x = x;
1087
1088 gtk_layout_move (GTK_LAYOUT(sheet), item_edit->popup_item, popup_x, popup_y);
1089 }
1090}

◆ gnc_item_edit_tb_new()

GtkWidget * gnc_item_edit_tb_new ( GnucashSheet *  sheet)

Definition at line 177 of file gnucash-item-edit.c.

178{
179 GtkStyleContext *context;
180 GncItemEditTb *item_edit_tb = g_object_new (GNC_TYPE_ITEM_EDIT_TB,
181 "sheet", sheet,
182 NULL);
183
184 context = gtk_widget_get_style_context (GTK_WIDGET(item_edit_tb));
185 gtk_style_context_add_class (context, GTK_STYLE_CLASS_BUTTON);
186
187 return GTK_WIDGET(item_edit_tb);
188}

◆ gnc_item_in_list()

gboolean gnc_item_in_list ( GncItemList item_list,
const char *  string 
)

Definition at line 139 of file gnucash-item-list.c.

140{
141 FindSelectionData* to_find_data;
142 gboolean result;
143
144 g_return_val_if_fail (item_list != NULL, FALSE);
145 g_return_val_if_fail (IS_GNC_ITEM_LIST (item_list), FALSE);
146
147 to_find_data = (FindSelectionData*)g_new0 (FindSelectionData, 1);
148 to_find_data->item_list = item_list;
149 to_find_data->string_to_find = string;
150
151 gtk_tree_model_foreach (GTK_TREE_MODEL (item_list->list_store),
152 _gnc_item_find_selection,
153 to_find_data);
154
155 result = (to_find_data->found_path != NULL);
156 g_free (to_find_data);
157 return result;
158}

◆ gnc_item_list_append()

void gnc_item_list_append ( GncItemList item_list,
const char *  string 
)

Definition at line 88 of file gnucash-item-list.c.

89{
90 GtkTreeIter iter;
91
92 g_return_if_fail (IS_GNC_ITEM_LIST (item_list));
93 g_return_if_fail (item_list->list_store != NULL);
94 g_return_if_fail (string != NULL);
95 gtk_list_store_append (item_list->list_store, &iter);
96 gtk_list_store_set (item_list->list_store, &iter, 0, string, -1);
97}

◆ gnc_item_list_autosize()

int gnc_item_list_autosize ( GncItemList item_list)

Definition at line 239 of file gnucash-item-list.c.

240{
241 g_return_val_if_fail (item_list != NULL, 0);
242 g_return_val_if_fail (IS_GNC_ITEM_LIST (item_list), 0);
243
244 return 150;
245}

◆ gnc_item_list_clear()

void gnc_item_list_clear ( GncItemList item_list)

Definition at line 70 of file gnucash-item-list.c.

71{
72 GtkTreeSelection* selection;
73
74 g_return_if_fail (IS_GNC_ITEM_LIST (item_list));
75 g_return_if_fail (item_list->list_store != NULL);
76
77 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (item_list->tree_view));
78
79 g_signal_handlers_block_matched (G_OBJECT (selection), G_SIGNAL_MATCH_DATA,
80 0, 0, NULL, NULL, item_list);
81 gtk_list_store_clear (item_list->list_store);
82 g_signal_handlers_unblock_matched (G_OBJECT (selection), G_SIGNAL_MATCH_DATA,
83 0, 0, NULL, NULL, item_list);
84}

◆ gnc_item_list_connect_store()

void gnc_item_list_connect_store ( GncItemList item_list,
GtkListStore *  store 
)

Definition at line 288 of file gnucash-item-list.c.

289{
290 g_return_if_fail (item_list != 0);
291
292 gtk_tree_view_set_model (item_list->tree_view,
293 GTK_TREE_MODEL (list_store));
294}

◆ gnc_item_list_disconnect_store()

GtkListStore * gnc_item_list_disconnect_store ( GncItemList item_list)

Definition at line 274 of file gnucash-item-list.c.

275{
276 GtkListStore *store;
277
278 g_return_val_if_fail (item_list != NULL, NULL);
279
280 store = GTK_LIST_STORE(gtk_tree_view_get_model (item_list->tree_view));
281
282 gtk_tree_view_set_model (item_list->tree_view, NULL);
283
284 return store;
285}

◆ gnc_item_list_get_popup_height()

gint gnc_item_list_get_popup_height ( GncItemList item_list)

Definition at line 485 of file gnucash-item-list.c.

486{
487 GtkWidget *hsbar = gtk_scrolled_window_get_hscrollbar (GTK_SCROLLED_WINDOW(item_list->scrollwin));
488 GtkStyleContext *context = gtk_widget_get_style_context (hsbar);
489 /* Note: gtk_scrolled_window_get_overlay_scrolling (scrollwin) always returns
490 TRUE so look for style class "overlay-indicator" on the scrollbar. */
491 gboolean overlay = gtk_style_context_has_class (context, "overlay-indicator");
492 int count = gnc_item_list_num_entries (item_list);
493 int height = count * (gnc_item_list_get_cell_height (item_list) + 2);
494
495 if (!overlay)
496 {
497 gint minh, nath;
498 gtk_widget_get_preferred_height (hsbar, &minh, &nath);
499 height = height + minh;
500 }
501 return height;
502}

◆ gnc_item_list_get_selection()

char * gnc_item_list_get_selection ( GncItemList item_list)

Retrieve the selected string from the item_list's active GtkListStore.

Parameters
item_listthe GncItemList
Returns
the string value. It must be freed with g_free().

Definition at line 200 of file gnucash-item-list.c.

201{
202 GtkTreeIter iter;
203 GtkTreeModel* model;
204 gchar* string;
205
206 GtkTreeSelection *selection =
207 gtk_tree_view_get_selection (item_list->tree_view);
208 if (!gtk_tree_selection_get_selected (selection, &model, &iter))
209 return NULL;
210
211 gtk_tree_model_get (model, &iter, 0, &string, -1);
212 return string;
213}

◆ gnc_item_list_new()

GtkWidget * gnc_item_list_new ( GtkListStore *  shared_store)

Definition at line 506 of file gnucash-item-list.c.

507{
508 GtkWidget* tree_view;
509 GtkTreeViewColumn* column;
510
511 GncItemList* item_list =
512 GNC_ITEM_LIST (g_object_new (GNC_TYPE_ITEM_LIST,
513 NULL));
514
515 item_list->scrollwin =
516 GTK_SCROLLED_WINDOW (gtk_scrolled_window_new(NULL, NULL));
517 gtk_container_add (GTK_CONTAINER (item_list),
518 GTK_WIDGET (item_list->scrollwin));
519
520 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (item_list->scrollwin),
521 GTK_POLICY_AUTOMATIC,
522 GTK_POLICY_AUTOMATIC);
523
524 if (NULL == list_store)
525 list_store = gtk_list_store_new (1, G_TYPE_STRING);
526 else
527 g_object_ref (list_store);
528 tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (list_store));
529 g_object_unref (list_store);
530
531 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_view), FALSE);
532 gtk_tree_selection_set_mode (
533 gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view)),
534 GTK_SELECTION_BROWSE);
535 gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store),
536 0, GTK_SORT_ASCENDING);
537
538 item_list->renderer = gtk_cell_renderer_text_new();
539 column = gtk_tree_view_column_new_with_attributes (_ ("List"),
540 item_list->renderer,
541 "text", 0,
542 NULL);
543 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
544
545 gtk_container_add (GTK_CONTAINER (item_list->scrollwin), tree_view);
546
547 item_list->tree_view = GTK_TREE_VIEW (tree_view);
548 item_list->list_store = list_store;
549
550 g_signal_connect (G_OBJECT (tree_view), "button_press_event",
551 G_CALLBACK (gnc_item_list_button_event), item_list);
552
553 g_signal_connect (G_OBJECT (tree_view), "key_press_event",
554 G_CALLBACK (gnc_item_list_key_event), item_list);
555
556 g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (
557 GTK_TREE_VIEW (tree_view))), "changed",
558 G_CALLBACK (tree_view_selection_changed), item_list);
559
560 return GTK_WIDGET (item_list);
561}

◆ gnc_item_list_num_entries()

gint gnc_item_list_num_entries ( GncItemList item_list)

Definition at line 55 of file gnucash-item-list.c.

56{
57 GtkTreeModel* model;
58
59 g_return_val_if_fail (item_list != NULL, 0);
60 g_return_val_if_fail (IS_GNC_ITEM_LIST (item_list), 0);
61
62 model = gnc_item_list_using_temp (item_list) ?
63 GTK_TREE_MODEL (item_list->temp_store) :
64 GTK_TREE_MODEL (item_list->list_store);
65 return gtk_tree_model_iter_n_children (model, NULL);
66}

◆ gnc_item_list_select()

void gnc_item_list_select ( GncItemList item_list,
const char *  string 
)

Definition at line 162 of file gnucash-item-list.c.

163{
164 GtkTreeSelection* tree_sel = NULL;
165 FindSelectionData* to_find_data;
166
167 g_return_if_fail (item_list != NULL);
168 g_return_if_fail (IS_GNC_ITEM_LIST (item_list));
169
170 tree_sel = gtk_tree_view_get_selection (item_list->tree_view);
171
172 if (string == NULL)
173 {
174 gtk_tree_selection_unselect_all (tree_sel);
175 return;
176 }
177
178 to_find_data = (FindSelectionData*)g_new0 (FindSelectionData, 1);
179 to_find_data->item_list = item_list;
180 to_find_data->string_to_find = string;
181
182 gtk_tree_model_foreach (GTK_TREE_MODEL (item_list->list_store),
183 _gnc_item_find_selection,
184 to_find_data);
185
186 if (to_find_data->found_path != NULL)
187 {
188 gtk_tree_view_set_cursor (item_list->tree_view, to_find_data->found_path, NULL,
189 FALSE);
190 gtk_tree_path_free (to_find_data->found_path);
191
192 gnc_item_list_show_selected (item_list);
193 }
194
195 g_free (to_find_data);
196}

◆ gnc_item_list_set_sort_column()

void gnc_item_list_set_sort_column ( GncItemList item_list,
gint  column_id 
)

Definition at line 101 of file gnucash-item-list.c.

102{
103 g_return_if_fail (IS_GNC_ITEM_LIST (item_list));
104
105 gtk_tree_sortable_set_sort_column_id
106 (GTK_TREE_SORTABLE (item_list->list_store),
107 column_id,
108 GTK_SORT_ASCENDING);
109}

◆ gnc_item_list_set_temp_store()

void gnc_item_list_set_temp_store ( GncItemList item_list,
GtkListStore *  store 
)

Definition at line 248 of file gnucash-item-list.c.

249{
250
251 g_return_if_fail (item_list != 0);
252
253 item_list->temp_store = store;
254 if (store)
255 {
256 gtk_tree_view_set_model (item_list->tree_view,
257 GTK_TREE_MODEL (item_list->temp_store));
258 }
259 else
260 {
261 gtk_tree_view_set_model (item_list->tree_view,
262 GTK_TREE_MODEL (item_list->list_store));
263 item_list->temp_store = NULL;
264 }
265}

◆ gnc_item_list_show_selected()

void gnc_item_list_show_selected ( GncItemList item_list)

Definition at line 217 of file gnucash-item-list.c.

218{
219 GtkTreeSelection* selection;
220 GtkTreeIter iter;
221 GtkTreeModel* model;
222
223 g_return_if_fail (item_list != NULL);
224 g_return_if_fail (IS_GNC_ITEM_LIST (item_list));
225
226 selection = gtk_tree_view_get_selection (item_list->tree_view);
227
228 if (gtk_tree_selection_get_selected (selection, &model, &iter))
229 {
230 GtkTreePath* path = gtk_tree_model_get_path (model, &iter);
231
232 gtk_tree_view_scroll_to_cell (item_list->tree_view,
233 path, NULL, TRUE, 0.5, 0.0);
234 gtk_tree_path_free (path);
235 }
236}

◆ gnc_item_list_using_temp()

gboolean gnc_item_list_using_temp ( GncItemList item_list)

Definition at line 268 of file gnucash-item-list.c.

269{
270 return item_list && item_list->temp_store;
271}

◆ gnc_ledger_display_close()

void gnc_ledger_display_close ( GNCLedgerDisplay *  ledger_display)

close the window

Definition at line 1051 of file gnc-ledger-display.c.

1052{
1053 if (!ld)
1054 return;
1055
1056 gnc_close_gui_component (ld->component_id);
1057}

◆ gnc_ledger_display_default_double_line()

gboolean gnc_ledger_display_default_double_line ( GNCLedgerDisplay *  gld)

Returns a boolean of whether this display should be single or double lined mode by default.

Definition at line 384 of file gnc-ledger-display.c.

385{
386 return (gld->use_double_line_default ||
387 gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
388 GNC_PREF_DOUBLE_LINE_MODE));
389}
gboolean gnc_prefs_get_bool(const gchar *group, const gchar *pref_name)
Get a boolean value from the preferences backend.

◆ gnc_ledger_display_find_by_query()

GNCLedgerDisplay * gnc_ledger_display_find_by_query ( Query q)

If the given ledger display still exists, return it.

Otherwise, return NULL

Definition at line 881 of file gnc-ledger-display.c.

882{
883 if (!q)
884 return NULL;
885
886 return gnc_find_first_gui_component (REGISTER_GL_CM_CLASS, find_by_query, q);
887}

◆ gnc_ledger_display_get_parent()

GtkWidget * gnc_ledger_display_get_parent ( GNCLedgerDisplay *  ld)

Returns the parent of a given ledger display.

Definition at line 543 of file gnc-ledger-display.c.

544{
545 if (ld == NULL)
546 return NULL;
547
548 if (ld->get_parent == NULL)
549 return NULL;
550
551 return ld->get_parent (ld);
552}

◆ gnc_ledger_display_get_query()

Query * gnc_ledger_display_get_query ( GNCLedgerDisplay *  ld)

return the query associated with a ledger

Definition at line 167 of file gnc-ledger-display.c.

168{
169 if (!ld)
170 return NULL;
171
172 return ld->query;
173}

◆ gnc_ledger_display_get_split_register()

SplitRegister * gnc_ledger_display_get_split_register ( GNCLedgerDisplay *  ld)

return the split register associated with a ledger display

Definition at line 158 of file gnc-ledger-display.c.

159{
160 if (!ld)
161 return NULL;
162
163 return ld->reg;
164}

◆ gnc_ledger_display_get_user_data()

gpointer gnc_ledger_display_get_user_data ( GNCLedgerDisplay *  ld)

Definition at line 137 of file gnc-ledger-display.c.

138{
139 if (!ld)
140 return NULL;
141
142 return ld->user_data;
143}

◆ gnc_ledger_display_gl()

GNCLedgerDisplay * gnc_ledger_display_gl ( void  )

opens up a general ledger window

Definition at line 444 of file gnc-ledger-display.c.

445{
446 Query* query;
447 time64 start;
448 GNCLedgerDisplay* ld;
449 GHashTable *exclude_template_accounts_hash;
450
451 ENTER (" ");
452
453 query = qof_query_create_for (GNC_ID_SPLIT);
454
455 qof_query_set_book (query, gnc_get_current_book());
456
457 exclude_template_accounts_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
458
459 /* In lieu of not "mis-using" some portion of the infrastructure by writing
460 * a bunch of new code, we just filter out the accounts of the template
461 * transactions. While these are in a separate Account trees just for this
462 * reason, the query engine makes no distinction between Account trees.
463 * See Gnome Bug 86302.
464 * -- jsled */
465 // Exclude any template accounts for search register and gl
466 exclude_template_accounts (query, exclude_template_accounts_hash);
467
468 // the default is to show last 30 days
469 static const time64 secs_per_thirty_days = 2592000;
470 start = gnc_time64_get_today_start () - secs_per_thirty_days;
471
472 xaccQueryAddDateMatchTT (query,
473 TRUE, start,
474 FALSE, 0,
475 QOF_QUERY_AND);
476
477 ld = gnc_ledger_display_internal (NULL, query, LD_GL, GENERAL_JOURNAL,
478 REG_STYLE_JOURNAL, FALSE, FALSE, FALSE);
479
480 ld->excluded_template_acc_hash = exclude_template_accounts_hash;
481 LEAVE ("%p", ld);
482
483 qof_query_destroy (query);
484 return ld;
485}
gint64 time64
Most systems that are currently maintained, including Microsoft Windows, BSD-derived Unixes and Linux...
Definition gnc-date.h:87
time64 gnc_time64_get_today_start(void)
The gnc_time64_get_today_start() routine returns a time64 value corresponding to the first second of ...
#define LEAVE(format, args...)
Print a function exit debugging message.
Definition qoflog.h:282
#define ENTER(format, args...)
Print a function entry debugging message.
Definition qoflog.h:272
void qof_query_set_book(QofQuery *query, QofBook *book)
Set the book to be searched.
void qof_query_destroy(QofQuery *query)
Frees the resources associate with a Query object.
A Query.
Definition qofquery.cpp:75

◆ gnc_ledger_display_leader()

Account * gnc_ledger_display_leader ( GNCLedgerDisplay *  ld)

returns the 'lead' account of a ledger display, or NULL if none.

returns the 'lead' account of a ledger display, or NULL if none.

Definition at line 110 of file gnc-ledger-display.c.

111{
112 if (!ld)
113 return NULL;
114
115 return xaccAccountLookup (&ld->leader, gnc_get_current_book());
116}
Account * xaccAccountLookup(const GncGUID *guid, QofBook *book)
The xaccAccountLookup() subroutine will return the account associated with the given id,...
Definition Account.cpp:2050

◆ gnc_ledger_display_query()

GNCLedgerDisplay * gnc_ledger_display_query ( Query query,
SplitRegisterType  type,
SplitRegisterStyle  style 
)

display a general ledger for an arbitrary query

Definition at line 725 of file gnc-ledger-display.c.

727{
728 GNCLedgerDisplay* ld;
729
730 ENTER ("query=%p", query);
731
732 ld = gnc_ledger_display_internal (NULL, query, LD_GL, type, style,
733 FALSE, FALSE, FALSE);
734
735 ld->excluded_template_acc_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
736 LEAVE ("%p", ld);
737 return ld;
738}

◆ gnc_ledger_display_refresh()

void gnc_ledger_display_refresh ( GNCLedgerDisplay *  ledger_display)

redisplay/redraw only the indicated window.

Both routines do same thing, they differ only by the argument they take.

Definition at line 927 of file gnc-ledger-display.c.

928{
929 ENTER ("ld=%p", ld);
930
931 if (!ld)
932 {
933 LEAVE ("no display");
934 return;
935 }
936
937 if (ld->loading)
938 {
939 LEAVE ("already loading");
940 return;
941 }
942
943 /* if subaccount ledger, check to see if still the same number
944 * of subaccounts, if not recreate the query. */
945 if (ld->ld_type == LD_SUBACCOUNT)
946 {
947 Account* leader = gnc_ledger_display_leader (ld);
948 GList* accounts = gnc_account_get_descendants (leader);
949
950 if (g_list_length (accounts) != ld->number_of_subaccounts)
951 {
952 time64 start_time, end_time;
953 xaccQueryGetDateMatchTT (ld->query, &start_time, &end_time);
954
955 cleared_match_t cleared_match = xaccQueryGetClearedMatch (ld->query);
956
957 gnc_ledger_display_make_query (ld,
958 gnc_prefs_get_float (GNC_PREFS_GROUP_GENERAL_REGISTER, GNC_PREF_MAX_TRANS),
959 gnc_get_reg_type (leader, ld->ld_type));
960
961 qof_query_destroy (ld->pre_filter_query);
962 ld->pre_filter_query = qof_query_copy (ld->query);
963
964 if (cleared_match != CLEARED_ALL)
965 xaccQueryAddClearedMatch (ld->query, cleared_match, QOF_QUERY_AND);
966
967 if (start_time || end_time)
968 {
969 xaccQueryAddDateMatchTT (ld->query,
970 start_time != 0, start_time,
971 end_time != 0, end_time,
972 QOF_QUERY_AND);
973 }
974 }
975 g_list_free (accounts);
976 }
977
978 /* In lieu of not "mis-using" some portion of the infrastructure by writing
979 * a bunch of new code, we just filter out the accounts of the template
980 * transactions. While these are in a separate Account trees just for this
981 * reason, the query engine makes no distinction between Account trees.
982 * See Gnome Bug 86302.
983 * -- jsled */
984 // Exclude any template accounts for search register and gl
985 if (!ld->reg->is_template && (ld->reg->type == SEARCH_LEDGER || ld->ld_type == LD_GL))
986 {
987 exclude_template_accounts (ld->query, ld->excluded_template_acc_hash);
988
989 qof_query_destroy (ld->pre_filter_query);
990 ld->pre_filter_query = qof_query_copy (ld->query);
991 }
992 gnc_ledger_display_refresh_internal (ld);
993 LEAVE (" ");
994}
GList * gnc_account_get_descendants(const Account *account)
This routine returns a flat list of all of the accounts that are descendants of the specified account...
Definition Account.cpp:3044
Account * gnc_ledger_display_leader(GNCLedgerDisplay *ld)
Implementations.
gdouble gnc_prefs_get_float(const gchar *group, const gchar *pref_name)
Get an float value from the preferences backend.
QofQuery * qof_query_copy(QofQuery *q)
Make a copy of the indicated query.
STRUCTS.

◆ gnc_ledger_display_refresh_by_split_register()

void gnc_ledger_display_refresh_by_split_register ( SplitRegister *  reg)

Definition at line 1011 of file gnc-ledger-display.c.

1012{
1013 GNCLedgerDisplay* ld;
1014
1015 if (!reg)
1016 return;
1017
1018 ld = gnc_find_first_gui_component (REGISTER_SINGLE_CM_CLASS,
1019 find_by_reg, reg);
1020 if (ld)
1021 {
1023 return;
1024 }
1025
1026 ld = gnc_find_first_gui_component (REGISTER_SUBACCOUNT_CM_CLASS,
1027 find_by_reg, reg);
1028 if (ld)
1029 {
1031 return;
1032 }
1033
1034 ld = gnc_find_first_gui_component (REGISTER_GL_CM_CLASS,
1035 find_by_reg, reg);
1036 if (ld)
1037 {
1039 return;
1040 }
1041
1042 ld = gnc_find_first_gui_component (REGISTER_TEMPLATE_CM_CLASS,
1043 find_by_reg, reg);
1044 if (ld)
1045 {
1047 }
1048}
void gnc_ledger_display_refresh(GNCLedgerDisplay *ld)
redisplay/redraw only the indicated window.

◆ gnc_ledger_display_set_focus()

void gnc_ledger_display_set_focus ( GNCLedgerDisplay *  ld,
gboolean  focus 
)

Mark the ledger as being in focus (refresh immediately) or not.

Definition at line 996 of file gnc-ledger-display.c.

997{
998 if (!ld)
999 return;
1000
1001 ld->visible = focus;
1002
1003 if (ld->visible && ld->needs_refresh)
1004 {
1005 DEBUG ("deferred refresh because ledger is now visible");
1007 }
1008}
#define DEBUG(format, args...)
Print a debugging message.
Definition qoflog.h:264

◆ gnc_ledger_display_set_handlers()

void gnc_ledger_display_set_handlers ( GNCLedgerDisplay *  ld,
GNCLedgerDisplayDestroy  destroy,
GNCLedgerDisplayGetParent  get_parent 
)

set the handlers used by the ledger display

Definition at line 146 of file gnc-ledger-display.c.

149{
150 if (!ld)
151 return;
152
153 ld->destroy = destroy;
154 ld->get_parent = get_parent;
155}

◆ gnc_ledger_display_set_query()

void gnc_ledger_display_set_query ( GNCLedgerDisplay *  ledger_display,
Query q 
)

Set the query used for a register.

Definition at line 869 of file gnc-ledger-display.c.

870{
871 if (!ledger_display || !q)
872 return;
873
874 g_return_if_fail (ledger_display->ld_type == LD_GL);
875
876 qof_query_destroy (ledger_display->query);
877 ledger_display->query = qof_query_copy (q);
878}

◆ gnc_ledger_display_set_user_data()

void gnc_ledger_display_set_user_data ( GNCLedgerDisplay *  ld,
gpointer  user_data 
)

get and set the user data associated with the ledger

Definition at line 128 of file gnc-ledger-display.c.

129{
130 if (!ld)
131 return;
132
133 ld->user_data = user_data;
134}

◆ gnc_ledger_display_simple()

GNCLedgerDisplay * gnc_ledger_display_simple ( Account account)

opens up a register window to display a single account

Definition at line 393 of file gnc-ledger-display.c.

394{
395 SplitRegisterType reg_type;
396 GNCAccountType acc_type = xaccAccountGetType (account);
397 gboolean use_double_line;
398 GNCLedgerDisplay* ld;
399
400 ENTER ("account=%p", account);
401
402 switch (acc_type)
403 {
406 use_double_line = TRUE;
407 break;
408 default:
409 use_double_line = FALSE;
410 break;
411 }
412
413 reg_type = gnc_get_reg_type (account, LD_SINGLE);
414
415 ld = gnc_ledger_display_internal (account, NULL, LD_SINGLE, reg_type,
416 gnc_get_default_register_style (acc_type),
417 use_double_line, FALSE, FALSE);
418 LEAVE ("%p", ld);
419 return ld;
420}
GNCAccountType
The account types are used to determine how the transaction data in the account is displayed.
Definition Account.h:103
GNCAccountType xaccAccountGetType(const Account *acc)
Returns the account's account type.
Definition Account.cpp:3267
@ ACCT_TYPE_PAYABLE
A/P account type.
Definition Account.h:151
@ ACCT_TYPE_RECEIVABLE
A/R account type.
Definition Account.h:149
SplitRegisterType
Register types.

◆ gnc_ledger_display_subaccounts()

GNCLedgerDisplay * gnc_ledger_display_subaccounts ( Account account,
gboolean  mismatched_commodities 
)

opens up a register window to display the parent account and all of its children.

Definition at line 425 of file gnc-ledger-display.c.

427{
428 SplitRegisterType reg_type;
429 GNCLedgerDisplay* ld;
430
431 ENTER ("account=%p", account);
432
433 reg_type = gnc_get_reg_type (account, LD_SUBACCOUNT);
434
435 ld = gnc_ledger_display_internal (account, NULL, LD_SUBACCOUNT,
436 reg_type, REG_STYLE_JOURNAL, FALSE,
437 FALSE, mismatched_commodities);
438 LEAVE ("%p", ld);
439 return ld;
440}

◆ gnc_ledger_display_template_gl()

GNCLedgerDisplay * gnc_ledger_display_template_gl ( char *  id)

Displays a template ledger.

This lists template Splits from the given ScheduledTransaction.

Really, requires a GList of scheduled transactions and kvp-frame data.

Parameters
idThe string version of the GncGUID of the context of template transaction being edited in this template GL. As used by scheduled transactions, this is the GncGUID of the SX itself which is magically the name of the (template) account which contains the transactions for this scheduled transaction. That's right. The stringified GncGUID of the SX is the name of the SX'es template account.

Definition at line 496 of file gnc-ledger-display.c.

497{
498 QofBook* book;
499 Query* q;
500 GNCLedgerDisplay* ld;
501 SplitRegister* sr;
502 Account* root, *acct;
503 gboolean isTemplateModeTrue;
504
505 ENTER ("id=%s", id ? id : "(null)");
506
507 acct = NULL;
508 isTemplateModeTrue = TRUE;
509
510 q = qof_query_create_for (GNC_ID_SPLIT);
511
512 book = gnc_get_current_book();
513 qof_query_set_book (q, book);
514
515 if (id != NULL)
516 {
517 root = gnc_book_get_template_root (book);
518 acct = gnc_account_lookup_by_name (root, id);
519 g_assert (acct);
520 xaccQueryAddSingleAccountMatch (q, acct, QOF_QUERY_AND);
521 }
522
523 ld = gnc_ledger_display_internal (NULL, q, LD_GL,
524 SEARCH_LEDGER,
525 REG_STYLE_JOURNAL,
526 FALSE,
527 isTemplateModeTrue,
528 FALSE);
529
531 if (acct)
532 {
534 }
535
537
538 LEAVE ("%p", ld);
539 return ld;
540}
Account * gnc_account_lookup_by_name(const Account *parent, const char *name)
The gnc_account_lookup_by_name() subroutine fetches the account by name from the descendants of the s...
Definition Account.cpp:3093
SplitRegister * gnc_ledger_display_get_split_register(GNCLedgerDisplay *ld)
return the split register associated with a ledger display
Account * gnc_book_get_template_root(const QofBook *book)
Returns the template group from the book.
Definition SX-book.cpp:65
void gnc_split_register_set_template_account(SplitRegister *reg, Account *template_account)
Set the template account for use in a template register.
QofBook reference.
Definition qofbook-p.hpp:47

◆ gnc_ledger_display_type()

GNCLedgerDisplayType gnc_ledger_display_type ( GNCLedgerDisplay *  ld)

Definition at line 119 of file gnc-ledger-display.c.

120{
121 if (!ld)
122 return -1;
123
124 return ld->ld_type;
125}

◆ gnucash_color_argb_to_gdk()

GdkRGBA * gnucash_color_argb_to_gdk ( guint32  argb)

Return the pixel value for the given red, green and blue.

Definition at line 76 of file gnucash-color.c.

77{
78 GdkRGBA *color;
79 const guint32 key = argb;
80 guint32 *newkey;
81
82 color = g_hash_table_lookup (color_hash_table, &key);
83
84 if (color)
85 return color;
86
87 color = g_new0(GdkRGBA, 1);
88 newkey = g_new0(guint32, 1);
89
90 *newkey = key;
91
92 color->red = ((argb & 0xff0000) >> 8)/ 65535.0;
93 color->green = (argb & 0xff00) / 65535.0;
94 color->blue = ((argb & 0xff) << 8) / 65535.0;
95 color->alpha = 1.0;
96
97 g_hash_table_insert (color_hash_table, newkey, color);
98
99 return color;
100}

◆ gnucash_color_init()

void gnucash_color_init ( void  )

Definition at line 104 of file gnucash-color.c.

105{
106 /* Allocate the default colors */
107 gdk_rgba_parse (&gn_white, "white");
108 gdk_rgba_parse (&gn_black, "black");
109
110 gdk_rgba_parse (&gn_light_gray, "gray60");
111 gdk_rgba_parse (&gn_dark_gray, "gray40");
112 gdk_rgba_parse (&gn_blue, "blue");
113 gdk_rgba_parse (&gn_red, "red");
114 gdk_rgba_parse (&gn_yellow, "yellow");
115
116 if (!color_hash_table)
117 color_hash_table = g_hash_table_new (color_hash, color_equal);
118
119 color_inited = 1;
120}

◆ gnucash_cursor_configure()

void gnucash_cursor_configure ( GnucashCursor cursor)

Definition at line 133 of file gnucash-cursor.c.

134{
135 gint x = 0, y = 0, w = 0, h = 0;
136
137 g_return_if_fail (cursor != NULL);
138 g_return_if_fail (GNUCASH_IS_CURSOR (cursor));
139
140 if (!cursor->sheet)
141 return;
142
143 g_return_if_fail (GTK_IS_LAYOUT (cursor->sheet));
144
145 gnucash_cursor_get_pixel_coords (cursor, &x, &y, &w, &h);
146 cursor->x = x;
147 cursor->y = y;
148 cursor->w = w;
149 cursor->h = h + 2;
150
151 gnucash_sheet_style_get_cell_pixel_rel_coords (cursor->style,
152 cursor->cell.row, cursor->cell.col,
153 &x, &y, &w, &h);
154 cursor->cell.x = x;
155 cursor->cell.y = y;
156 cursor->cell.w = w;
157 cursor->cell.h = h;
158}

◆ gnucash_cursor_get_virt()

void gnucash_cursor_get_virt ( GnucashCursor cursor,
VirtualLocation *  virt_loc 
)

Definition at line 119 of file gnucash-cursor.c.

120{
121 g_return_if_fail (cursor != NULL);
122 g_return_if_fail (GNUCASH_IS_CURSOR (cursor));
123
124 virt_loc->vcell_loc.virt_row = cursor->row;
125 virt_loc->vcell_loc.virt_col = cursor->col;
126
127 virt_loc->phys_row_offset = cursor->cell.row;
128 virt_loc->phys_col_offset = cursor->cell.col;
129}

◆ gnucash_cursor_new()

GnucashCursor * gnucash_cursor_new ( GnucashSheet *  sheet)

Definition at line 302 of file gnucash-cursor.c.

303{
304 return GNUCASH_CURSOR(
305 g_object_new (gnucash_cursor_get_type(),
306 "sheet", sheet,
307 NULL));
308}

◆ gnucash_cursor_set()

void gnucash_cursor_set ( GnucashCursor cursor,
VirtualLocation  virt_loc 
)

Definition at line 202 of file gnucash-cursor.c.

203{
204 GnucashSheet *sheet;
205
206 g_return_if_fail (cursor != NULL);
207 g_return_if_fail (GNUCASH_IS_CURSOR (cursor));
208
209 sheet = cursor->sheet;
210
211 gnucash_cursor_set_block (cursor, virt_loc.vcell_loc);
212 gnucash_cursor_set_cell (cursor,
213 virt_loc.phys_row_offset,
214 virt_loc.phys_col_offset);
215
216 gnucash_cursor_configure (cursor);
217
218 g_object_set (G_OBJECT(sheet->header_item),
219 "cursor_name",
220 cursor->style->cursor->cursor_name,
221 NULL);
222}

◆ gnucash_cursor_set_style()

void gnucash_cursor_set_style ( GnucashCursor cursor,
SheetBlockStyle *  style 
)

Definition at line 109 of file gnucash-cursor.c.

110{
111 g_return_if_fail (cursor != NULL);
112 g_return_if_fail (GNUCASH_IS_CURSOR(cursor));
113
114 cursor->style = style;
115}

◆ gnucash_get_style_classes()

void gnucash_get_style_classes ( GnucashSheet *  sheet,
GtkStyleContext *  stylectxt,
RegisterColor  field_type,
gboolean  use_neg_class 
)

Map a cell color type to a css style class.

Definition at line 2210 of file gnucash-sheet.c.

2212{
2213 gchar *full_class, *style_class = NULL;
2214
2215 if (field_type >= COLOR_NEGATIVE) // Require a Negative fg color
2216 {
2217 if (use_neg_class)
2218 gtk_style_context_add_class (stylectxt, "gnc-class-negative-numbers");
2219 field_type -= COLOR_NEGATIVE;
2220 }
2221 else
2222 {
2223 if (sheet->use_gnc_color_theme) // only add this class if builtin colors used
2224 gtk_style_context_add_class (stylectxt, "gnc-class-register-foreground");
2225 }
2226
2227 switch (field_type)
2228 {
2229 default:
2230 case COLOR_UNDEFINED:
2231 gtk_style_context_add_class (stylectxt, GTK_STYLE_CLASS_BACKGROUND);
2232 return;
2233
2234 case COLOR_HEADER:
2235 style_class = "header";
2236 break;
2237
2238 case COLOR_PRIMARY:
2239 style_class = "primary";
2240 break;
2241
2242 case COLOR_PRIMARY_ACTIVE:
2243 case COLOR_SECONDARY_ACTIVE:
2244 case COLOR_SPLIT_ACTIVE:
2245 gtk_style_context_set_state (stylectxt, GTK_STATE_FLAG_SELECTED);
2246 style_class = "cursor";
2247 break;
2248
2249 case COLOR_SECONDARY:
2250 style_class = "secondary";
2251 break;
2252
2253 case COLOR_SPLIT:
2254 style_class = "split";
2255 break;
2256 }
2257
2258 if (sheet->use_gnc_color_theme)
2259 full_class = g_strconcat ("gnc-class-register-", style_class, NULL);
2260 else
2261 {
2262 gtk_style_context_add_class (stylectxt, GTK_STYLE_CLASS_VIEW);
2263 full_class = g_strconcat ("gnc-class-user-register-", style_class, NULL);
2264 }
2265
2266 gtk_style_context_add_class (stylectxt, full_class);
2267
2268 g_free (full_class);
2269}

◆ gnucash_register_add_cell_types()

void gnucash_register_add_cell_types ( void  )

Add cell types defined by gnucash_register to gnc_register.

Should be called before any table layout is created using these new types

Add cell types defined by gnucash_register to gnc_register.

Definition at line 101 of file gnucash-register.c.

102{
103 gnc_register_add_cell_type (COMBO_CELL_TYPE_NAME, gnc_combo_cell_new);
104 gnc_register_add_cell_type (COMPLETION_CELL_TYPE_NAME, gnc_completion_cell_new);
105 gnc_register_add_cell_type (DATE_CELL_TYPE_NAME, gnc_date_cell_new);
106 gnc_register_add_cell_type (PRICE_CELL_TYPE_NAME,
107 gnc_price_cell_gnome_new);
108 gnc_register_add_cell_type (QUICKFILL_CELL_TYPE_NAME,
109 gnc_quickfill_cell_gnome_new);
110 gnc_register_add_cell_type( FORMULA_CELL_TYPE_NAME,
111 gnc_formula_cell_gnome_new );
112 gnc_table_gnome_init ();
113}
BasicCell * gnc_date_cell_new(void)
installs a callback to handle date recording

◆ gnucash_register_attach_popup()

void gnucash_register_attach_popup ( GnucashRegister *  reg,
GtkWidget *  popup,
gpointer  data 
)

Definition at line 433 of file gnucash-register.c.

436{
437 g_return_if_fail (GNUCASH_IS_REGISTER(reg));
438 g_return_if_fail (reg->sheet != NULL);
439 if (popup)
440 g_return_if_fail (GTK_IS_WIDGET(popup));
441
442 gnucash_sheet_set_popup (GNUCASH_SHEET (reg->sheet), popup, data);
443}

◆ gnucash_register_copy_clipboard()

void gnucash_register_copy_clipboard ( GnucashRegister *  reg)

Definition at line 146 of file gnucash-register.c.

147{
148 GnucashSheet *sheet;
149 GncItemEdit *item_edit;
150
151 g_return_if_fail(reg != NULL);
152 g_return_if_fail(GNUCASH_IS_REGISTER(reg));
153
154 sheet = GNUCASH_SHEET(reg->sheet);
155 item_edit = GNC_ITEM_EDIT(sheet->item_editor);
156
157 gnc_item_edit_copy_clipboard(item_edit);
158}

◆ gnucash_register_cut_clipboard()

void gnucash_register_cut_clipboard ( GnucashRegister *  reg)

Definition at line 131 of file gnucash-register.c.

132{
133 GnucashSheet *sheet;
134 GncItemEdit *item_edit;
135
136 g_return_if_fail(reg != NULL);
137 g_return_if_fail(GNUCASH_IS_REGISTER(reg));
138
139 sheet = GNUCASH_SHEET(reg->sheet);
140 item_edit = GNC_ITEM_EDIT(sheet->item_editor);
141
142 gnc_item_edit_cut_clipboard(item_edit);
143}

◆ gnucash_register_get_sheet()

GnucashSheet * gnucash_register_get_sheet ( GnucashRegister *  reg)

Definition at line 608 of file gnucash-register.c.

609{
610 g_return_val_if_fail (reg != NULL, NULL);
611 g_return_val_if_fail (GNUCASH_IS_REGISTER(reg), NULL);
612
613 return GNUCASH_SHEET(reg->sheet);
614}

◆ gnucash_register_goto_next_matching_row()

void gnucash_register_goto_next_matching_row ( GnucashRegister *  reg,
VirtualLocationMatchFunc  match,
gpointer  user_data 
)

Definition at line 283 of file gnucash-register.c.

286{
287 GnucashSheet *sheet;
288 SheetBlockStyle *style;
289 VirtualLocation virt_loc;
290
291 g_return_if_fail (reg != NULL);
292 g_return_if_fail (GNUCASH_IS_REGISTER(reg));
293 g_return_if_fail (match != NULL);
294
295 sheet = GNUCASH_SHEET (reg->sheet);
296
297 gnucash_cursor_get_virt (GNUCASH_CURSOR(sheet->cursor), &virt_loc);
298
299 do
300 {
301 if (!gnc_table_move_vertical_position (sheet->table,
302 &virt_loc, 1))
303 return;
304
305 if (virt_loc.vcell_loc.virt_row >= sheet->num_virt_rows)
306 return;
307
308 style = gnucash_sheet_get_style (sheet, virt_loc.vcell_loc);
309 if (!style || !style->cursor)
310 return;
311 }
312 while (!match (virt_loc, user_data));
313
314 virt_loc.phys_row_offset = 0;
315 virt_loc.phys_col_offset = 0;
316
317 gnucash_sheet_goto_virt_loc (sheet, virt_loc);
318}
gboolean gnc_table_move_vertical_position(Table *table, VirtualLocation *virt_loc, int phys_row_offset)
Moves away from virtual location virt_loc by phys_row_offset physical rows.

◆ gnucash_register_goto_next_virt_row()

void gnucash_register_goto_next_virt_row ( GnucashRegister *  reg)

Definition at line 250 of file gnucash-register.c.

251{
252 GnucashSheet *sheet;
253 VirtualLocation virt_loc;
254 int start_virt_row;
255
256 g_return_if_fail (reg != NULL);
257 g_return_if_fail (GNUCASH_IS_REGISTER(reg));
258
259 sheet = GNUCASH_SHEET(reg->sheet);
260
261 gnucash_cursor_get_virt (GNUCASH_CURSOR(sheet->cursor), &virt_loc);
262
263 /* Move down one physical row at a time until we
264 * reach the next visible virtual cell. */
265 start_virt_row = virt_loc.vcell_loc.virt_row;
266 do
267 {
268 if (!gnc_table_move_vertical_position (sheet->table, &virt_loc, 1))
269 return;
270 }
271 while (start_virt_row == virt_loc.vcell_loc.virt_row);
272
273 if (virt_loc.vcell_loc.virt_row >= sheet->num_virt_rows)
274 return;
275
276 virt_loc.phys_row_offset = 0;
277 virt_loc.phys_col_offset = 0;
278
279 gnucash_sheet_goto_virt_loc (sheet, virt_loc);
280}

◆ gnucash_register_goto_virt_cell()

void gnucash_register_goto_virt_cell ( GnucashRegister *  reg,
VirtualCellLocation  vcell_loc 
)

Definition at line 217 of file gnucash-register.c.

219{
220 GnucashSheet *sheet;
221 VirtualLocation virt_loc;
222
223 g_return_if_fail(reg != NULL);
224 g_return_if_fail(GNUCASH_IS_REGISTER(reg));
225
226 sheet = GNUCASH_SHEET(reg->sheet);
227
228 virt_loc.vcell_loc = vcell_loc;
229 virt_loc.phys_row_offset = 0;
230 virt_loc.phys_col_offset = 0;
231
232 gnucash_sheet_goto_virt_loc(sheet, virt_loc);
233}

◆ gnucash_register_goto_virt_loc()

void gnucash_register_goto_virt_loc ( GnucashRegister *  reg,
VirtualLocation  virt_loc 
)

Definition at line 236 of file gnucash-register.c.

238{
239 GnucashSheet *sheet;
240
241 g_return_if_fail(reg != NULL);
242 g_return_if_fail(GNUCASH_IS_REGISTER(reg));
243
244 sheet = GNUCASH_SHEET(reg->sheet);
245
246 gnucash_sheet_goto_virt_loc(sheet, virt_loc);
247}

◆ gnucash_register_has_selection()

gboolean gnucash_register_has_selection ( GnucashRegister *  reg)

Definition at line 116 of file gnucash-register.c.

117{
118 GnucashSheet *sheet;
119 GncItemEdit *item_edit;
120
121 g_return_val_if_fail((reg != NULL), FALSE);
122 g_return_val_if_fail(GNUCASH_IS_REGISTER(reg), FALSE);
123
124 sheet = GNUCASH_SHEET(reg->sheet);
125 item_edit = GNC_ITEM_EDIT(sheet->item_editor);
126
127 return gnc_item_edit_get_has_selection(item_edit);
128}

◆ gnucash_register_new()

GtkWidget * gnucash_register_new ( Table *  table,
const gchar *  state_section 
)

this already has scrollbars attached

Definition at line 581 of file gnucash-register.c.

582{
583 GnucashRegister *reg;
584 GtkWidget *widget;
585
586 widget = gnucash_register_create_widget(table);
587 reg = GNUCASH_REGISTER(widget);
588
589 gnucash_register_configure (GNUCASH_SHEET(reg->sheet), state_section);
590
591 return widget;
592}

◆ gnucash_register_paste_clipboard()

void gnucash_register_paste_clipboard ( GnucashRegister *  reg)

Definition at line 161 of file gnucash-register.c.

162{
163 GnucashSheet *sheet;
164 GncItemEdit *item_edit;
165
166 g_return_if_fail(reg != NULL);
167 g_return_if_fail(GNUCASH_IS_REGISTER(reg));
168
169 sheet = GNUCASH_SHEET(reg->sheet);
170 item_edit = GNC_ITEM_EDIT(sheet->item_editor);
171
172 gnc_item_edit_paste_clipboard (item_edit);
173}

◆ gnucash_register_refresh_from_prefs()

void gnucash_register_refresh_from_prefs ( GnucashRegister *  reg)

Definition at line 176 of file gnucash-register.c.

177{
178 GnucashSheet *sheet;
179
180 g_return_if_fail(reg != NULL);
181 g_return_if_fail(GNUCASH_IS_REGISTER(reg));
182
183 sheet = GNUCASH_SHEET(reg->sheet);
184 gnucash_sheet_refresh_from_prefs(sheet);
185 gnc_header_request_redraw (GNC_HEADER(sheet->header_item));
186}

◆ gnucash_register_reset_sheet_layout()

void gnucash_register_reset_sheet_layout ( GnucashRegister *  reg)

Definition at line 189 of file gnucash-register.c.

190{
191 GNCHeaderWidths widths;
192 GnucashSheet *sheet;
193 gint current_width;
194
195 g_return_if_fail (reg != NULL);
196
197 sheet = GNUCASH_SHEET(reg->sheet);
198
199 g_return_if_fail (sheet != NULL);
200 g_return_if_fail (GNUCASH_IS_SHEET (sheet));
201
202 current_width = sheet->window_width - 1;
203
204 widths = gnc_header_widths_new ();
205 gnucash_sheet_set_header_widths (sheet, widths);
206
207 gnucash_sheet_styles_set_dimensions (sheet, current_width);
208
209 gnucash_sheet_compile_styles (sheet);
210 gnucash_sheet_table_load (sheet, TRUE);
211 gnucash_sheet_cursor_set_from_table (sheet, TRUE);
212 gnucash_sheet_redraw_all (sheet);
213 gnc_header_widths_destroy (widths);
214}

◆ gnucash_register_set_moved_cb()

void gnucash_register_set_moved_cb ( GnucashRegister *  reg,
GFunc  cb,
gpointer  cb_data 
)

Definition at line 595 of file gnucash-register.c.

597{
598 GnucashSheet *sheet;
599
600 if (!reg || !reg->sheet)
601 return;
602 sheet = GNUCASH_SHEET(reg->sheet);
603 sheet->moved_cb = cb;
604 sheet->moved_cb_data = cb_data;
605}

◆ gnucash_register_set_open_doclink_cb()

void gnucash_register_set_open_doclink_cb ( GnucashRegister *  reg,
GFunc  cb,
gpointer  cb_data 
)

Definition at line 618 of file gnucash-register.c.

620{
621 GnucashSheet *sheet;
622
623 if (!reg || !reg->sheet)
624 return;
625 sheet = GNUCASH_SHEET(reg->sheet);
626 sheet->open_doclink_cb = cb;
627 sheet->open_doclink_cb_data = cb_data;
628}

◆ gnucash_sheet_block_set_from_table()

gboolean gnucash_sheet_block_set_from_table ( GnucashSheet *  sheet,
VirtualCellLocation  vcell_loc 
)

Definition at line 1925 of file gnucash-sheet.c.

1927{
1928 Table *table;
1929 SheetBlock *block;
1930 SheetBlockStyle *style;
1931 VirtualCell *vcell;
1932
1933 block = gnucash_sheet_get_block (sheet, vcell_loc);
1934 style = gnucash_sheet_get_style_from_table (sheet, vcell_loc);
1935
1936 if (!block)
1937 return FALSE;
1938
1939 table = sheet->table;
1940
1941 vcell = gnc_table_get_virtual_cell (table, vcell_loc);
1942
1943 if (block->style && (block->style != style))
1944 {
1945 gnucash_sheet_style_unref (sheet, block->style);
1946 block->style = NULL;
1947 }
1948
1949 block->visible = (vcell) ? vcell->visible : TRUE;
1950
1951 if (block->style == NULL)
1952 {
1953 block->style = style;
1954 gnucash_sheet_style_ref (sheet, block->style);
1955 return TRUE;
1956 }
1957 return FALSE;
1958}
VirtualCell * gnc_table_get_virtual_cell(Table *table, VirtualCellLocation vcell_loc)
returns the virtual cell associated with a particular virtual location.
SheetBlockStyle * style
The style for this block.
gboolean visible
y origin of block
holds information about each virtual cell.
unsigned int visible
Used by higher-level code.

◆ gnucash_sheet_clear_styles()

void gnucash_sheet_clear_styles ( GnucashSheet *  sheet)

Definition at line 683 of file gnucash-style.c.

684{
685 g_return_if_fail (sheet != NULL);
686 g_return_if_fail (GNUCASH_IS_SHEET (sheet));
687
688 g_hash_table_foreach (sheet->cursor_styles,
689 destroy_style_helper, sheet);
690}

◆ gnucash_sheet_col_max_width()

gint gnucash_sheet_col_max_width ( GnucashSheet *  sheet,
gint  virt_col,
gint  cell_col 
)

Definition at line 1962 of file gnucash-sheet.c.

1963{
1964 int virt_row;
1965 int cell_row;
1966 int max = 0;
1967 int width;
1968 SheetBlock *block;
1969 SheetBlockStyle *style;
1970 PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET (sheet), "");
1971 GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
1972 const gchar *type_name;
1973
1974 g_return_val_if_fail (virt_col >= 0, 0);
1975 g_return_val_if_fail (virt_col < sheet->num_virt_cols, 0);
1976 g_return_val_if_fail (cell_col >= 0, 0);
1977
1978 for (virt_row = 0; virt_row < sheet->num_virt_rows ; virt_row++)
1979 {
1980 VirtualCellLocation vcell_loc = { virt_row, virt_col };
1981
1982 block = gnucash_sheet_get_block (sheet, vcell_loc);
1983 if (!block)
1984 continue;
1985
1986 style = block->style;
1987
1988 if (!style)
1989 continue;
1990
1991 if (cell_col < style->ncols)
1992 {
1993 for (cell_row = 0; cell_row < style->nrows; cell_row++)
1994 {
1995 VirtualLocation virt_loc;
1996 const char *text;
1997
1998 if (virt_row == 0)
1999 virt_loc.vcell_loc = sheet->table->current_cursor_loc.vcell_loc;
2000 else
2001 virt_loc.vcell_loc = vcell_loc;
2002
2003 virt_loc.phys_row_offset = cell_row;
2004 virt_loc.phys_col_offset = cell_col;
2005
2006 if (virt_row == 0)
2007 {
2008 text = gnc_table_get_label
2009 (sheet->table, virt_loc);
2010 }
2011 else
2012 {
2013 text = gnc_table_get_entry
2014 (sheet->table, virt_loc);
2015 }
2016
2017 pango_layout_set_text (layout, text, strlen (text));
2018 pango_layout_get_pixel_size (layout, &width, NULL);
2019
2020 width += (gnc_item_edit_get_margin (item_edit, left_right) +
2021 gnc_item_edit_get_padding_border (item_edit, left_right));
2022
2023 // get the cell type so we can add the button width to the
2024 // text width if required.
2025 type_name = gnc_table_get_cell_type_name (sheet->table, virt_loc);
2026 if ((g_strcmp0 (type_name, DATE_CELL_TYPE_NAME) == 0)
2027 || (g_strcmp0 (type_name, COMBO_CELL_TYPE_NAME) == 0))
2028 {
2029 width += gnc_item_edit_get_button_width (item_edit) + 2; // add 2 for the button margin
2030 }
2031 max = MAX(max, width);
2032 }
2033 }
2034 }
2035
2036 g_object_unref (layout);
2037
2038 return max;
2039}

◆ gnucash_sheet_compile_styles()

void gnucash_sheet_compile_styles ( GnucashSheet *  sheet)

Definition at line 718 of file gnucash-style.c.

719{
720 g_return_if_fail (sheet != NULL);
721 g_return_if_fail (GNUCASH_IS_SHEET (sheet));
722
723 ENTER("sheet=%p", sheet);
724
725 gnucash_sheet_styles_set_dimensions (sheet, DEFAULT_STYLE_WIDTH);
726
727 LEAVE(" ");
728}

◆ gnucash_sheet_compute_visible_range()

void gnucash_sheet_compute_visible_range ( GnucashSheet *  sheet)

Definition at line 511 of file gnucash-sheet.c.

512{
513 VirtualCellLocation vcell_loc;
514 GtkAllocation alloc;
515 GtkAdjustment *adj;
516 gint height;
517 gint cy;
518 gint top_block;
519
520 g_return_if_fail (sheet != NULL);
521 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
522
523 gtk_widget_get_allocation (GTK_WIDGET(sheet), &alloc);
524 height = alloc.height;
525
526 adj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE(sheet));
527 cy = gtk_adjustment_get_value (adj);
528
529 top_block = gnucash_sheet_y_pixel_to_block (sheet, cy);
530
531 sheet->num_visible_blocks = 0;
532 sheet->num_visible_phys_rows = 0;
533
534 for (vcell_loc.virt_row = top_block, vcell_loc.virt_col = 0;
535 vcell_loc.virt_row < sheet->num_virt_rows;
536 vcell_loc.virt_row++)
537 {
538 SheetBlock *block;
539
540 block = gnucash_sheet_get_block (sheet, vcell_loc);
541 if (!block->visible)
542 continue;
543
544 sheet->num_visible_blocks++;
545 sheet->num_visible_phys_rows += block->style->nrows;
546
547 if (block->origin_y - cy + block->style->dimensions->height
548 >= height)
549 break;
550 }
551}

◆ gnucash_sheet_create_styles()

void gnucash_sheet_create_styles ( GnucashSheet *  sheet)

Definition at line 693 of file gnucash-style.c.

694{
695 GList *cursors;
696 GList *node;
697
698 g_return_if_fail (sheet != NULL);
699 g_return_if_fail (GNUCASH_IS_SHEET (sheet));
700
701 gnucash_sheet_clear_styles (sheet);
702
703 cursors = gnc_table_layout_get_cursors (sheet->table->layout);
704
705 for (node = cursors; node; node = node->next)
706 {
707 CellBlock *cursor = node->data;
708 SheetBlockStyle *style = gnucash_sheet_style_new (sheet, cursor);
709
710 gnucash_sheet_style_ref (sheet, style);
711 g_hash_table_insert (sheet->cursor_styles,
712 g_strdup (cursor->cursor_name),
713 style);
714 }
715}

◆ gnucash_sheet_cursor_set_from_table()

void gnucash_sheet_cursor_set_from_table ( GnucashSheet *  sheet,
gboolean  do_scroll 
)

Definition at line 218 of file gnucash-sheet.c.

219{
220 Table *table;
221 VirtualLocation v_loc;
222
223 g_return_if_fail (sheet != NULL);
224 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
225
226 table = sheet->table;
227 v_loc = table->current_cursor_loc;
228
229 g_return_if_fail (gnucash_sheet_cell_valid (sheet, v_loc));
230
231 gnucash_sheet_cursor_set (sheet, v_loc);
232
233 if (do_scroll)
234 gnucash_sheet_make_cell_visible (sheet, v_loc);
235}

◆ gnucash_sheet_draw_cursor()

void gnucash_sheet_draw_cursor ( GnucashCursor cursor,
cairo_t *  cr 
)

Definition at line 686 of file gnucash-sheet-private.c.

687{
688 GnucashCursorCell *cc = &(cursor->cell);
689 GdkRGBA *fg_color;
690 int x = 0;
691 int y = 0;
692 GtkAdjustment * adj;
693
694 adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE(cursor->sheet));
695 x = (gint) gtk_adjustment_get_value (adj);
696 adj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE(cursor->sheet));
697 y = (gint) gtk_adjustment_get_value (adj);
698
699 fg_color = &gn_black;
700
701 /* draw the rectangle around the entire active virtual row - transaction rows only - double line */
702 cairo_set_source_rgb (cr, fg_color->red, fg_color->green, fg_color->blue);
703 if (cursor->x == 0)
704 cairo_rectangle (cr, cursor->x - x + 0.5, cursor->y - y - 0.5, cursor->w - 1.0, cursor->h - 2.0);
705 else
706 cairo_rectangle (cr, cursor->x - x - 0.5, cursor->y - y - 0.5, cursor->w, cursor->h - 2.0);
707
708 cairo_set_line_width (cr, 1.0);
709 cairo_stroke (cr);
710
711 // make the bottom line thicker
712 cairo_move_to (cr, cursor->x - x + 0.5, cursor->y - y + cursor->h - 3.5);
713 cairo_rel_line_to (cr, cursor->w, 0);
714 cairo_set_line_width (cr, 1.0);
715 cairo_stroke (cr);
716
717 /* draw rectangle around the active cell */
718 cairo_set_source_rgb (cr, fg_color->red, fg_color->green, fg_color->blue);
719 if (cc->x != 0)
720 cairo_rectangle (cr, cc->x - x - 0.5, cursor->y + cc->y - y - 0.5, cc->w, cc->h);
721 else
722 cairo_rectangle (cr, cc->x - x + 0.5, cursor->y + cc->y - y - 0.5, cc->w - 1.0, cc->h);
723
724 cairo_set_line_width (cr, 1.0);
725 cairo_stroke (cr);
726}

◆ gnucash_sheet_draw_internal()

gboolean gnucash_sheet_draw_internal ( GnucashSheet *  sheet,
cairo_t *  cr,
GtkAllocation *  alloc 
)

Definition at line 633 of file gnucash-sheet-private.c.

635{
636 VirtualLocation virt_loc = {{0, 0}, 0, 0};
637 SheetBlock *sheet_block;
638 int x = 0;
639 int y = 0;
640 int width = alloc->width;
641 int height = alloc->height;
642 GtkAdjustment * adj;
643
644 adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE(sheet));
645 x = (gint) gtk_adjustment_get_value (adj);
646 adj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE(sheet));
647 y = (gint) gtk_adjustment_get_value (adj);
648
649 if (x < 0 || y < 0)
650 return FALSE;
651
652 /* compute our initial values where we start drawing */
653 sheet_block = find_block_by_pixel (sheet, x, y, &virt_loc.vcell_loc);
654 if (!sheet_block || !sheet_block->style)
655 return FALSE;
656
657 sheet->read_only = gnc_table_model_read_only (sheet->table->model);
658
659 for ( ; virt_loc.vcell_loc.virt_row < sheet->num_virt_rows;
660 virt_loc.vcell_loc.virt_row++ )
661 {
662 while (TRUE)
663 {
664 sheet_block = gnucash_sheet_get_block (sheet, virt_loc.vcell_loc);
665
666 if (!sheet_block || !sheet_block->style)
667 return TRUE;
668
669 if (sheet_block->visible)
670 break;
671
672 virt_loc.vcell_loc.virt_row++;
673 }
674
675 if (y + height < sheet_block->origin_y)
676 return TRUE;
677
678 draw_block (sheet, sheet_block, virt_loc, cr,
679 x, y, width, height);
680 }
681 return TRUE;
682}

◆ gnucash_sheet_find_loc_by_pixel()

gboolean gnucash_sheet_find_loc_by_pixel ( GnucashSheet *  sheet,
gint  x,
gint  y,
VirtualLocation *  vcell_loc 
)

Definition at line 172 of file gnucash-sheet-private.c.

174{
175 SheetBlock *block;
176
177 if (virt_loc == NULL)
178 return FALSE;
179
180 block = find_block_by_pixel (sheet, x, y,
181 &virt_loc->vcell_loc);
182 if (block == NULL)
183 return FALSE;
184
185 return find_cell_by_pixel (sheet, x, y, virt_loc);
186}

◆ gnucash_sheet_get_block()

SheetBlock * gnucash_sheet_get_block ( GnucashSheet *  sheet,
VirtualCellLocation  vcell_loc 
)

Definition at line 1888 of file gnucash-sheet.c.

1889{
1890 g_return_val_if_fail (sheet != NULL, NULL);
1891 g_return_val_if_fail (GNUCASH_IS_SHEET(sheet), NULL);
1892
1893 return g_table_index (sheet->blocks,
1894 vcell_loc.virt_row,
1895 vcell_loc.virt_col);
1896}
gpointer g_table_index(GTable *gtable, int row, int col)
Return the element at the given row and column.
Definition gtable.c:84

◆ gnucash_sheet_get_borders()

void gnucash_sheet_get_borders ( GnucashSheet *  sheet,
VirtualLocation  virt_loc,
PhysicalCellBorders borders 
)

Definition at line 613 of file gnucash-style.c.

615{
616 SheetBlockStyle *style;
617 PhysicalCellBorderLineStyle line_style;
618
619 g_return_if_fail (sheet != NULL);
620 g_return_if_fail (GNUCASH_IS_SHEET (sheet));
621
622 line_style = sheet->use_horizontal_lines ?
623 CELL_BORDER_LINE_NORMAL : CELL_BORDER_LINE_NONE;
624
625 borders->top = line_style;
626 borders->bottom = line_style;
627
628 line_style = sheet->use_vertical_lines ?
629 CELL_BORDER_LINE_NORMAL : CELL_BORDER_LINE_NONE;
630
631 borders->left = line_style;
632 borders->right = line_style;
633
634 style = gnucash_sheet_get_style_from_cursor (sheet, CURSOR_HEADER);
635 if (style)
636 if (virt_loc.phys_col_offset == (style->ncols - 1))
637 borders->right = CELL_BORDER_LINE_NORMAL;
638
639 if (virt_cell_loc_equal (virt_loc.vcell_loc,
640 sheet->table->current_cursor_loc.vcell_loc))
641 {
642 borders->top = CELL_BORDER_LINE_NORMAL;
643 borders->bottom = CELL_BORDER_LINE_NORMAL;
644 }
645
646 gnc_table_get_borders (sheet->table, virt_loc, borders);
647}

◆ gnucash_sheet_get_header_widths()

void gnucash_sheet_get_header_widths ( GnucashSheet *  sheet,
GNCHeaderWidths  widths 
)

Definition at line 927 of file gnucash-style.c.

929{
930 SheetBlockStyle *style;
931 CellBlock *header;
932 int row, col;
933
934 g_return_if_fail (sheet != NULL);
935 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
936
937 style = gnucash_sheet_get_style_from_cursor (sheet, CURSOR_HEADER);
938 g_return_if_fail (style != NULL);
939
940 header = style->cursor;
941 g_return_if_fail (header != NULL);
942
943 for (row = 0; row < style->nrows; row++)
944 for (col = 0; col < style->ncols; col++)
945 {
946 CellDimensions *cd;
947 BasicCell *cell;
948
949 cd = gnucash_style_get_cell_dimensions (style,
950 row, col);
951 if (cd == NULL)
952 continue;
953
954 cell = gnc_cellblock_get_cell (header, row, col);
955 if (!cell || !cell->cell_name)
956 continue;
957
958 gnc_header_widths_set_width (widths,
959 cell->cell_name,
960 cd->pixel_width);
961 }
962}
BasicCell * gnc_cellblock_get_cell(CellBlock *cellblock, int row, int col)
Retrieve the Cell at the specified coordinates.
Definition cellblock.c:109

◆ gnucash_sheet_get_item_edit()

GncItemEdit * gnucash_sheet_get_item_edit ( GnucashSheet *  sheet)

Definition at line 1898 of file gnucash-sheet.c.

1899{
1900 g_return_val_if_fail (sheet != NULL, NULL);
1901 g_return_val_if_fail (GNUCASH_IS_SHEET(sheet), NULL);
1902
1903 if (sheet->item_editor == NULL)
1904 return NULL;
1905 else
1906 return GNC_ITEM_EDIT(sheet->item_editor);
1907}

◆ gnucash_sheet_get_style()

SheetBlockStyle * gnucash_sheet_get_style ( GnucashSheet *  sheet,
VirtualCellLocation  vcell_loc 
)

Definition at line 774 of file gnucash-style.c.

775{
776 SheetBlock *block;
777
778 g_return_val_if_fail (sheet != NULL, NULL);
779 g_return_val_if_fail (GNUCASH_IS_SHEET(sheet), NULL);
780
781 block = gnucash_sheet_get_block (sheet, vcell_loc);
782
783 if (block)
784 return block->style;
785 else
786 return NULL;
787}

◆ gnucash_sheet_get_style_from_cursor()

SheetBlockStyle * gnucash_sheet_get_style_from_cursor ( GnucashSheet *  sheet,
const char *  cursor_name 
)

Definition at line 820 of file gnucash-style.c.

822{
823 g_return_val_if_fail (sheet != NULL, NULL);
824 g_return_val_if_fail (GNUCASH_IS_SHEET (sheet), NULL);
825
826 if (!cursor_name)
827 return NULL;
828
829 return g_hash_table_lookup (sheet->cursor_styles, cursor_name);
830}

◆ gnucash_sheet_get_style_from_table()

SheetBlockStyle * gnucash_sheet_get_style_from_table ( GnucashSheet *  sheet,
VirtualCellLocation  vcell_loc 
)

Definition at line 791 of file gnucash-style.c.

793{
794 Table *table;
795 VirtualCell *vcell;
796 CellBlock *cursor;
797 SheetBlockStyle *style;
798
799 g_return_val_if_fail (sheet != NULL, NULL);
800 g_return_val_if_fail (GNUCASH_IS_SHEET(sheet), NULL);
801
802 table = sheet->table;
803
804 vcell = gnc_table_get_virtual_cell (table, vcell_loc);
805
806 if (!vcell)
807 return NULL;
808
809 cursor = vcell->cellblock;
810
811 style = gnucash_sheet_get_style_from_cursor (sheet,
812 cursor->cursor_name);
813 if (style)
814 return style;
815
816 return gnucash_sheet_get_style_from_cursor (sheet, CURSOR_HEADER);
817}

◆ gnucash_sheet_get_text_offset()

gint gnucash_sheet_get_text_offset ( GnucashSheet *  sheet,
const VirtualLocation  virt_loc,
gint  rect_width,
gint  logical_width 
)

Definition at line 312 of file gnucash-sheet.c.

314{
315 GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
316 Table *table = sheet->table;
317 gint x_offset = 0;
318
319 // Get the alignment of the cell
320 switch (gnc_table_get_align (table, virt_loc))
321 {
322 default:
323 case CELL_ALIGN_LEFT:
324 x_offset = gnc_item_edit_get_padding_border (item_edit, left);
325 break;
326
327 case CELL_ALIGN_RIGHT:
328 x_offset = rect_width - gnc_item_edit_get_padding_border (item_edit, right) - logical_width - 1;
329 break;
330
331 case CELL_ALIGN_CENTER:
332 if (logical_width > rect_width)
333 x_offset = 0;
334 else
335 x_offset = (rect_width - logical_width) / 2;
336 break;
337 }
338 return x_offset;
339}

◆ gnucash_sheet_goto_virt_loc()

void gnucash_sheet_goto_virt_loc ( GnucashSheet *  sheet,
VirtualLocation  virt_loc 
)

Definition at line 1860 of file gnucash-sheet.c.

1861{
1862 Table *table;
1863 gboolean abort_move;
1864 VirtualLocation cur_virt_loc;
1865
1866 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
1867
1868 table = sheet->table;
1869
1870 gnucash_cursor_get_virt (GNUCASH_CURSOR(sheet->cursor), &cur_virt_loc);
1871
1872 /* It's not really a pointer traverse, but it seems the most
1873 * appropriate here. */
1874 abort_move = gnc_table_traverse_update (table, cur_virt_loc,
1875 GNC_TABLE_TRAVERSE_POINTER,
1876 &virt_loc);
1877
1878 if (abort_move)
1879 return;
1880
1881 // does the sheet need horizontal scrolling
1882 gnucash_sheet_need_horizontal_scroll (sheet, &virt_loc);
1883
1884 gnucash_sheet_cursor_move (sheet, virt_loc);
1885}

◆ gnucash_sheet_is_read_only()

gboolean gnucash_sheet_is_read_only ( GnucashSheet *  sheet)

Definition at line 769 of file gnucash-sheet.c.

770{
771 g_return_val_if_fail (sheet != NULL, TRUE);
772 g_return_val_if_fail (GNUCASH_IS_SHEET(sheet), TRUE);
773 return gnc_table_model_read_only (sheet->table->model);
774}

◆ gnucash_sheet_make_cell_visible()

void gnucash_sheet_make_cell_visible ( GnucashSheet *  sheet,
VirtualLocation  virt_loc 
)

Definition at line 615 of file gnucash-sheet.c.

616{
617 g_return_if_fail (sheet != NULL);
618 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
619
620 if (!gnucash_sheet_cell_valid (sheet, virt_loc))
621 return;
622
623 gnucash_sheet_show_row (sheet, virt_loc.vcell_loc.virt_row);
624
625 gnucash_sheet_update_adjustments (sheet);
626}

◆ gnucash_sheet_modify_current_cell()

const char * gnucash_sheet_modify_current_cell ( GnucashSheet *  sheet,
const gchar *  new_text 
)

Definition at line 865 of file gnucash-sheet.c.

866{
867 GtkEditable *editable;
868 Table *table = sheet->table;
869 VirtualLocation virt_loc;
870 int new_text_len = 0;
871 const char *retval;
872 int cursor_position, start_sel, end_sel;
873
874 gnucash_cursor_get_virt (GNUCASH_CURSOR(sheet->cursor), &virt_loc);
875
876 if (!gnc_table_virtual_loc_valid (table, virt_loc, TRUE))
877 return NULL;
878
879 if (gnc_table_model_read_only (table->model))
880 return NULL;
881
882 editable = GTK_EDITABLE(sheet->entry);
883
884 cursor_position = gtk_editable_get_position (editable);
885 gtk_editable_get_selection_bounds (editable, &start_sel, &end_sel);
886
887 if (new_text)
888 new_text_len = strlen (new_text);
889
890 retval = gnc_table_modify_update (table, virt_loc,
891 new_text, new_text_len,
892 new_text, new_text_len,
893 &cursor_position,
894 &start_sel, &end_sel,
895 NULL);
896
897
898 if (retval)
899 {
900 DEBUG("%s", retval ? retval : "nothing");
901 gnucash_sheet_set_entry_value (sheet, retval);
902 gnucash_sheet_set_position_and_selection (sheet, cursor_position,
903 start_sel, end_sel);
904 }
905 return retval;
906}

◆ gnucash_sheet_new()

GtkWidget * gnucash_sheet_new ( Table *  table)

Definition at line 2414 of file gnucash-sheet.c.

2415{
2416 GnucashSheet *sheet;
2417
2418 g_return_val_if_fail (table != NULL, NULL);
2419
2420 sheet = gnucash_sheet_create (table);
2421
2422 /* on create, the sheet can grab the focus */
2423 sheet->sheet_has_focus = TRUE;
2424
2425 /* The cursor */
2426 sheet->cursor = gnucash_cursor_new (sheet);
2427
2428 /* set up the editor */
2429 sheet->item_editor = gnc_item_edit_new (sheet);
2430
2431 /* some register data */
2432 sheet->dimensions_hash_table = g_hash_table_new_full (g_int_hash,
2433 g_int_equal,
2434 g_free, (GDestroyNotify)dimensions_destroy);
2435
2436 /* add tooltips to sheet */
2437 gtk_widget_set_has_tooltip (GTK_WIDGET(sheet), TRUE);
2438 g_signal_connect (G_OBJECT(sheet), "query-tooltip",
2439 G_CALLBACK(gnucash_sheet_tooltip), NULL);
2440
2441 gnucash_sheet_refresh_from_prefs (sheet);
2442
2443 return GTK_WIDGET(sheet);
2444}

◆ gnucash_sheet_recompute_block_offsets()

void gnucash_sheet_recompute_block_offsets ( GnucashSheet *  sheet)

Definition at line 2106 of file gnucash-sheet.c.

2107{
2108 Table *table;
2109 SheetBlock *block;
2110 gint i, j;
2111 gint height;
2112 gint width;
2113
2114 g_return_if_fail (sheet != NULL);
2115 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
2116 g_return_if_fail (sheet->table != NULL);
2117
2118 table = sheet->table;
2119
2120 height = 0;
2121 block = NULL;
2122 for (i = 0; i < table->num_virt_rows; i++)
2123 {
2124 width = 0;
2125
2126 for (j = 0; j < table->num_virt_cols; j++)
2127 {
2128 VirtualCellLocation vcell_loc = { i, j };
2129
2130 block = gnucash_sheet_get_block (sheet, vcell_loc);
2131
2132 if (!block)
2133 continue;
2134
2135 block->origin_x = width;
2136 block->origin_y = height;
2137
2138 if (block->visible)
2139 width += block->style->dimensions->width;
2140 }
2141
2142 if (i > 0 && block && block->visible)
2143 height += block->style->dimensions->height;
2144 }
2145 sheet->height = height;
2146}

◆ gnucash_sheet_redraw_all()

void gnucash_sheet_redraw_all ( GnucashSheet *  sheet)

Definition at line 725 of file gnucash-sheet.c.

726{
727 g_return_if_fail (sheet != NULL);
728 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
729
730 gtk_widget_queue_draw (GTK_WIDGET(sheet));
731
732 g_signal_emit_by_name (sheet->reg, "redraw_all");
733}

◆ gnucash_sheet_redraw_block()

void gnucash_sheet_redraw_block ( GnucashSheet *  sheet,
VirtualCellLocation  vcell_loc 
)

Definition at line 745 of file gnucash-sheet.c.

746{
747 gint x, y, w, h;
748 SheetBlock *block;
749 GtkAllocation alloc;
750
751 g_return_if_fail (sheet != NULL);
752 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
753
754 block = gnucash_sheet_get_block (sheet, vcell_loc);
755 if (!block || !block->style)
756 return;
757
758 x = block->origin_x;
759 y = block->origin_y;
760
761 gtk_widget_get_allocation (GTK_WIDGET(sheet), &alloc);
762 h = block->style->dimensions->height;
763 w = MIN(block->style->dimensions->width, alloc.width);
764
765 gtk_widget_queue_draw_area (GTK_WIDGET(sheet), x, y, w + 1, h + 1);
766}

◆ gnucash_sheet_redraw_help()

void gnucash_sheet_redraw_help ( GnucashSheet *  sheet)

Definition at line 736 of file gnucash-sheet.c.

737{
738 g_return_if_fail (sheet != NULL);
739 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
740
741 g_signal_emit_by_name (sheet->reg, "redraw_help");
742}

◆ gnucash_sheet_refresh_from_prefs()

void gnucash_sheet_refresh_from_prefs ( GnucashSheet *  sheet)

Definition at line 1532 of file gnucash-sheet.c.

1533{
1534 GtkStyleContext *stylectxt;
1535 GncItemEdit *item_edit;
1536 GList *classes = NULL;
1537
1538 g_return_if_fail (sheet != NULL);
1539 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
1540
1541 sheet->use_gnc_color_theme = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
1542 GNC_PREF_USE_GNUCASH_COLOR_THEME);
1543 sheet->use_horizontal_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
1544 GNC_PREF_DRAW_HOR_LINES);
1545 sheet->use_vertical_lines = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL_REGISTER,
1546 GNC_PREF_DRAW_VERT_LINES);
1547
1548 item_edit = GNC_ITEM_EDIT(sheet->item_editor);
1549
1550 stylectxt = gtk_widget_get_style_context (GTK_WIDGET(item_edit->editor));
1551
1552 // Get the CSS classes for the editor
1553 classes = gtk_style_context_list_classes (stylectxt);
1554
1555 for (GList *l = classes; l; l = l->next)
1556 {
1557 if (g_str_has_prefix (l->data, "gnc-class-"))
1558 gtk_style_context_remove_class (stylectxt, l->data);
1559 }
1560 g_list_free (classes);
1561
1562 gtk_style_context_remove_class (stylectxt, GTK_STYLE_CLASS_VIEW);
1563
1564 // Note: COLOR_PRIMARY_ACTIVE, COLOR_SECONDARY_ACTIVE, COLOR_SPLIT_ACTIVE
1565 // all equate to *-cursor style class used for the editor
1566 gnucash_get_style_classes (sheet, stylectxt, COLOR_PRIMARY_ACTIVE, FALSE);
1567}
void gnucash_get_style_classes(GnucashSheet *sheet, GtkStyleContext *stylectxt, RegisterColor field_type, gboolean use_neg_class)
Map a cell color type to a css style class.

◆ gnucash_sheet_set_col_width()

void gnucash_sheet_set_col_width ( GnucashSheet *  sheet,
int  col,
int  width 
)

Definition at line 574 of file gnucash-style.c.

575{
576 CellDimensions *cd;
577 SheetBlockStyle *style;
578 int total;
579 int diff;
580
581 g_return_if_fail (sheet != NULL);
582 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
583 g_return_if_fail (col >= 0);
584
585 if (width < 0)
586 return;
587
588 style = gnucash_sheet_get_style_from_cursor (sheet, CURSOR_HEADER);
589
590 g_return_if_fail (col < style->ncols);
591
592 cd = gnucash_style_get_cell_dimensions (style, 0, col);
593 if (!cd) return;
594
595 /* adjust the overall width of this style */
596 diff = cd->pixel_width - width;
597 cd->pixel_width = width;
598
599 total = MAX (sheet->window_width, sheet->width - diff);
600
601 set_dimensions_pass_two (sheet, total);
602 set_dimensions_pass_three (sheet);
603}

◆ gnucash_sheet_set_has_focus()

void gnucash_sheet_set_has_focus ( GnucashSheet *  sheet,
gboolean  has_focus 
)

Definition at line 777 of file gnucash-sheet.c.

778{
779 sheet->sheet_has_focus = has_focus;
780}

◆ gnucash_sheet_set_header_widths()

void gnucash_sheet_set_header_widths ( GnucashSheet *  sheet,
GNCHeaderWidths  widths 
)

Definition at line 965 of file gnucash-style.c.

967{
968 SheetBlockStyle *style;
969 CellBlock *header;
970 int row, col;
971
972 g_return_if_fail (sheet != NULL);
973 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
974
975 style = gnucash_sheet_get_style_from_cursor (sheet, CURSOR_HEADER);
976 g_return_if_fail (style != NULL);
977
978 header = style->cursor;
979 g_return_if_fail (header != NULL);
980
981 for (row = 0; row < style->nrows; row++)
982 for (col = 0; col < style->ncols; col++)
983 {
984 CellDimensions *cd;
985 BasicCell *cell;
986
987 cd = gnucash_style_get_cell_dimensions (style,
988 row, col);
989
990 cell = gnc_cellblock_get_cell (header, row, col);
991 if (!cell || !cell->cell_name || !cd)
992 continue;
993
994 cd->pixel_width = gnc_header_widths_get_width
995 (widths, cell->cell_name);
996 }
997}

◆ gnucash_sheet_set_popup()

void gnucash_sheet_set_popup ( GnucashSheet *  sheet,
GtkWidget *  popup,
gpointer  data 
)

Definition at line 239 of file gnucash-sheet.c.

240{
241 if (popup)
242 g_object_ref (popup);
243
244 if (sheet->popup)
245 g_object_unref (sheet->popup);
246
247 sheet->popup = popup;
248 sheet->popup_data = data;
249}

◆ gnucash_sheet_set_scroll_region()

void gnucash_sheet_set_scroll_region ( GnucashSheet *  sheet)

Definition at line 2042 of file gnucash-sheet.c.

2043{
2044 guint new_h, new_w;
2045 GtkAllocation alloc;
2046 guint old_h, old_w;
2047
2048 if (!sheet)
2049 return;
2050
2051 if (!sheet->header_item || !GNC_HEADER(sheet->header_item)->style)
2052 return;
2053
2054 gtk_layout_get_size (GTK_LAYOUT(sheet), &old_w, &old_h);
2055
2056 gtk_widget_get_allocation (GTK_WIDGET(sheet), &alloc);
2057 new_h = MAX(sheet->height, alloc.height);
2058 new_w = MAX(sheet->width, alloc.width);
2059
2060 if (new_w != old_w || new_h != old_h)
2061 gtk_layout_set_size (GTK_LAYOUT(sheet), new_w, new_h);
2062}

◆ gnucash_sheet_set_text_bounds()

void gnucash_sheet_set_text_bounds ( GnucashSheet *  sheet,
GdkRectangle *  rect,
gint  x,
gint  y,
gint  width,
gint  height 
)

Definition at line 300 of file gnucash-sheet.c.

302{
303 GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
304
305 rect->x = x + gnc_item_edit_get_margin (item_edit, left);
306 rect->y = y + gnc_item_edit_get_margin (item_edit, top);
307 rect->width = MAX (0, width - gnc_item_edit_get_margin (item_edit, left_right));
308 rect->height = height - gnc_item_edit_get_margin (item_edit, top_bottom);
309}

◆ gnucash_sheet_set_window()

void gnucash_sheet_set_window ( GnucashSheet *  sheet,
GtkWidget *  window 
)

Definition at line 1910 of file gnucash-sheet.c.

1911{
1912 g_return_if_fail (sheet != NULL);
1913 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
1914
1915 if (window)
1916 g_return_if_fail (GTK_IS_WIDGET(window));
1917
1918 sheet->window = window;
1919}

◆ gnucash_sheet_show_range()

void gnucash_sheet_show_range ( GnucashSheet *  sheet,
VirtualCellLocation  start_loc,
VirtualCellLocation  end_loc 
)

Definition at line 630 of file gnucash-sheet.c.

633{
634 SheetBlock *start_block;
635 SheetBlock *end_block;
636 GtkAllocation alloc;
637 GtkAdjustment *adj;
638 gint block_height;
639 gint height;
640 gint cx, cy;
641 gint x, y;
642
643 g_return_if_fail (sheet != NULL);
644 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
645
646 start_loc.virt_row = MAX(start_loc.virt_row, 1);
647 start_loc.virt_row = MIN(start_loc.virt_row,
648 sheet->num_virt_rows - 1);
649
650 end_loc.virt_row = MAX(end_loc.virt_row, 1);
651 end_loc.virt_row = MIN(end_loc.virt_row,
652 sheet->num_virt_rows - 1);
653
654 adj = gtk_scrollable_get_hadjustment (GTK_SCROLLABLE(sheet));
655 cx = gtk_adjustment_get_value (adj);
656 adj = gtk_scrollable_get_vadjustment (GTK_SCROLLABLE(sheet));
657 cy = gtk_adjustment_get_value (adj);
658 x = cx;
659
660 gtk_widget_get_allocation (GTK_WIDGET(sheet), &alloc);
661 height = alloc.height;
662
663 start_block = gnucash_sheet_get_block (sheet, start_loc);
664 end_block = gnucash_sheet_get_block (sheet, end_loc);
665 if (!(start_block && end_block))
666 return;
667
668 y = start_block->origin_y;
669 block_height = (end_block->origin_y +
670 end_block->style->dimensions->height) - y;
671
672 if ((cy <= y) && (cy + height >= y + block_height))
673 {
674 gnucash_sheet_compute_visible_range (sheet);
675 return;
676 }
677
678 if (y > cy)
679 y -= height - MIN(block_height, height);
680
681 if ((sheet->height - y) < height)
682 y = sheet->height - height;
683
684 if (y < 0)
685 y = 0;
686
687 if (y != cy)
688 gtk_adjustment_set_value (sheet->vadj, y);
689 if (x != cx)
690 gtk_adjustment_set_value (sheet->hadj, x);
691
692 gnucash_sheet_compute_visible_range (sheet);
693 gnucash_sheet_update_adjustments (sheet);
694}

◆ gnucash_sheet_style_destroy()

void gnucash_sheet_style_destroy ( GnucashSheet *  sheet,
SheetBlockStyle *  style 
)

Definition at line 731 of file gnucash-style.c.

732{
733 if (sheet == NULL)
734 return;
735 if (style == NULL)
736 return;
737
738 style->dimensions->refcount--;
739
740 if (style->dimensions->refcount == 0)
741 {
742 style_dimensions_destroy (style->dimensions);
743 g_hash_table_remove (sheet->dimensions_hash_table,
744 style_get_key (style));
745 }
746
747 g_free (style);
748}

◆ gnucash_sheet_style_get_cell_pixel_rel_coords()

void gnucash_sheet_style_get_cell_pixel_rel_coords ( SheetBlockStyle *  style,
gint  cell_row,
gint  cell_col,
gint *  x,
gint *  y,
gint *  w,
gint *  h 
)

Definition at line 752 of file gnucash-style.c.

756{
757 CellDimensions *cd;
758
759 g_return_if_fail (style != NULL);
760 g_return_if_fail (cell_row >= 0 && cell_row <= style->nrows);
761 g_return_if_fail (cell_col >= 0 && cell_col <= style->ncols);
762
763 cd = gnucash_style_get_cell_dimensions (style, cell_row, cell_col);
764 if (!cd) return;
765
766 *x = cd->origin_x;
767 *y = cd->origin_y;
768 *h = cd->pixel_height;
769 *w = cd->pixel_width;
770}

◆ gnucash_sheet_style_ref()

void gnucash_sheet_style_ref ( GnucashSheet *  sheet,
SheetBlockStyle *  style 
)

Definition at line 838 of file gnucash-style.c.

839{
840 g_return_if_fail (style != NULL);
841
842 style->refcount++;
843}

◆ gnucash_sheet_style_unref()

void gnucash_sheet_style_unref ( GnucashSheet *  sheet,
SheetBlockStyle *  style 
)

Definition at line 847 of file gnucash-style.c.

848{
849 g_return_if_fail (style != NULL);
850
851 style->refcount--;
852
853 if (style->refcount == 0)
854 gnucash_sheet_style_destroy (sheet, style);
855}

◆ gnucash_sheet_styles_recompile()

void gnucash_sheet_styles_recompile ( GnucashSheet *  sheet)

Definition at line 607 of file gnucash-style.c.

608{
609}

◆ gnucash_sheet_styles_set_dimensions()

void gnucash_sheet_styles_set_dimensions ( GnucashSheet *  sheet,
int  width 
)

Definition at line 556 of file gnucash-style.c.

557{
558 g_return_if_fail (sheet != NULL);
559 g_return_if_fail (GNUCASH_IS_SHEET (sheet));
560
561 styles_recompute_layout_dimensions (sheet, default_width);
562}

◆ gnucash_sheet_table_load()

void gnucash_sheet_table_load ( GnucashSheet *  sheet,
gboolean  do_scroll 
)

Definition at line 2149 of file gnucash-sheet.c.

2150{
2151 Table *table;
2152 gint num_header_phys_rows;
2153 gint i, j;
2154
2155 g_return_if_fail (sheet != NULL);
2156 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
2157 g_return_if_fail (sheet->table != NULL);
2158
2159 table = sheet->table;
2160
2161 gnucash_sheet_stop_editing (sheet);
2162
2163 gnucash_sheet_resize (sheet);
2164
2165 num_header_phys_rows = 0;
2166
2167 /* fill it up */
2168 for (i = 0; i < table->num_virt_rows; i++)
2169 for (j = 0; j < table->num_virt_cols; j++)
2170 {
2171 VirtualCellLocation vcell_loc = { i, j };
2172 VirtualCell *vcell;
2173
2174 gnucash_sheet_block_set_from_table (sheet, vcell_loc);
2175
2176 vcell = gnc_table_get_virtual_cell (table, vcell_loc);
2177
2178 num_header_phys_rows =
2179 MAX (num_header_phys_rows,
2180 vcell->cellblock->num_rows);
2181 }
2182
2183 gnc_header_set_header_rows (GNC_HEADER(sheet->header_item),
2184 num_header_phys_rows);
2185 gnc_header_reconfigure (GNC_HEADER(sheet->header_item));
2186
2187 gnucash_sheet_recompute_block_offsets (sheet);
2188
2189 gnucash_sheet_set_scroll_region (sheet);
2190
2191 if (do_scroll)
2192 {
2193 VirtualLocation virt_loc;
2194
2195 virt_loc = table->current_cursor_loc;
2196
2197 if (gnucash_sheet_cell_valid (sheet, virt_loc))
2198 gnucash_sheet_show_row (sheet,
2199 virt_loc.vcell_loc.virt_row);
2200 }
2201
2202 gnucash_sheet_cursor_set_from_table (sheet, do_scroll);
2203 gnucash_sheet_activate_cursor_cell (sheet, TRUE);
2204}

◆ gnucash_sheet_update_adjustments()

void gnucash_sheet_update_adjustments ( GnucashSheet *  sheet)

Definition at line 698 of file gnucash-sheet.c.

699{
700 GtkAdjustment *vadj;
701
702 g_return_if_fail (sheet != NULL);
703 g_return_if_fail (GNUCASH_IS_SHEET(sheet));
704 g_return_if_fail (sheet->vadj != NULL);
705
706 vadj = sheet->vadj;
707
708 if (sheet->num_visible_blocks > 0)
709 gtk_adjustment_set_step_increment (vadj,
710 gtk_adjustment_get_page_size (vadj) / sheet->num_visible_blocks);
711 else
712 gtk_adjustment_set_step_increment (vadj, 0);
713}

◆ gnucash_style_col_is_resizable()

gint gnucash_style_col_is_resizable ( SheetBlockStyle *  style,
int  col 
)

Definition at line 565 of file gnucash-style.c.

566{
567 if (col < 0 || col >= style->ncols)
568 return FALSE;
569
570 return TRUE;
571}

◆ gnucash_style_get_cell_dimensions()

CellDimensions * gnucash_style_get_cell_dimensions ( SheetBlockStyle *  style,
int  row,
int  col 
)

Definition at line 137 of file gnucash-style.c.

138{
139 if (style == NULL)
140 return NULL;
141 if (style->dimensions == NULL)
142 return NULL;
143 if (style->dimensions->cell_dimensions == NULL)
144 return NULL;
145
146 return g_table_index (style->dimensions->cell_dimensions, row, col);
147}

◆ gnucash_style_init()

gboolean gnucash_style_init ( void  )

Definition at line 1000 of file gnucash-style.c.

1001{
1002 return TRUE;
1003}

◆ gnucash_style_row_width()

gint gnucash_style_row_width ( SheetBlockStyle *  style,
int  row 
)

Definition at line 436 of file gnucash-style.c.

437{
438 BlockDimensions *dimensions;
439
440 dimensions = style->dimensions;
441
442 return compute_row_width(dimensions, row, 0, dimensions->ncols - 1);
443}

Variable Documentation

◆ gn_black

GdkRGBA gn_black
extern

Definition at line 47 of file gnucash-color.c.

◆ gn_blue

GdkRGBA gn_blue

Definition at line 41 of file gnucash-color.h.

◆ gn_dark_gray

GdkRGBA gn_dark_gray

Definition at line 40 of file gnucash-color.h.

◆ gn_light_gray

GdkRGBA gn_light_gray

Definition at line 40 of file gnucash-color.h.

◆ gn_red

GdkRGBA gn_red

Definition at line 41 of file gnucash-color.h.

◆ gn_white

GdkRGBA gn_white
extern

Definition at line 47 of file gnucash-color.c.

◆ gn_yellow

GdkRGBA gn_yellow

Definition at line 41 of file gnucash-color.h.