mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add a second "red" divider line to the register to denote the read-only section for older transactions.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22108 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -518,6 +518,7 @@ void gnc_entry_ledger_load (GncEntryLedger *ledger, GList *entry_list)
|
||||
|
||||
/* get the current time and reset the dividing row */
|
||||
present = gnc_timet_get_today_end ();
|
||||
table->model->dividing_row_upper = -1;
|
||||
table->model->dividing_row = -1;
|
||||
cursor = gnc_table_layout_get_cursor (table->layout, "cursor");
|
||||
|
||||
|
||||
@@ -262,11 +262,14 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
|
||||
|
||||
gboolean start_primary_color = TRUE;
|
||||
gboolean found_pending = FALSE;
|
||||
gboolean need_divider_upper = FALSE;
|
||||
gboolean found_divider_upper = FALSE;
|
||||
gboolean found_divider = FALSE;
|
||||
gboolean has_last_num = FALSE;
|
||||
gboolean multi_line;
|
||||
gboolean dynamic;
|
||||
gboolean we_own_slist = FALSE;
|
||||
gboolean use_autofreeze = qof_book_uses_autofreeze(gnc_get_current_book());
|
||||
|
||||
VirtualCellLocation vcell_loc;
|
||||
VirtualLocation save_loc;
|
||||
@@ -274,7 +277,7 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
|
||||
int new_trans_split_row = -1;
|
||||
int new_trans_row = -1;
|
||||
int new_split_row = -1;
|
||||
time_t present;
|
||||
time_t present, autofreeze_time;
|
||||
|
||||
g_return_if_fail(reg);
|
||||
table = reg->table;
|
||||
@@ -431,6 +434,11 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
|
||||
|
||||
/* get the current time and reset the dividing row */
|
||||
present = gnc_timet_get_today_end ();
|
||||
{
|
||||
GDate *d = qof_book_get_autofreeze_gdate(gnc_get_current_book());
|
||||
autofreeze_time = timespecToTime_t(gdate_to_timespec(*d));
|
||||
g_date_free(d);
|
||||
}
|
||||
|
||||
if (info->first_pass)
|
||||
{
|
||||
@@ -473,6 +481,7 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
|
||||
gnc_split_register_recn_cell_confirm, reg);
|
||||
}
|
||||
|
||||
table->model->dividing_row_upper = -1;
|
||||
table->model->dividing_row = -1;
|
||||
|
||||
// Ensure that the transaction and splits being edited are in the split
|
||||
@@ -528,9 +537,24 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
|
||||
g_hash_table_insert (trans_table, trans, trans);
|
||||
}
|
||||
|
||||
if (info->show_present_divider &&
|
||||
use_autofreeze &&
|
||||
!found_divider_upper)
|
||||
{
|
||||
if (xaccTransGetDate (trans) > autofreeze_time)
|
||||
{
|
||||
table->model->dividing_row_upper = vcell_loc.virt_row;
|
||||
found_divider_upper = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
need_divider_upper = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (info->show_present_divider &&
|
||||
!found_divider &&
|
||||
(present < xaccTransGetDate (trans)))
|
||||
(xaccTransGetDate (trans) > present))
|
||||
{
|
||||
table->model->dividing_row = vcell_loc.virt_row;
|
||||
found_divider = TRUE;
|
||||
@@ -565,6 +589,15 @@ gnc_split_register_load (SplitRegister *reg, GList * slist,
|
||||
if (pending_trans == blank_trans)
|
||||
found_pending = TRUE;
|
||||
|
||||
/* No upper divider yet? Store it now */
|
||||
if (info->show_present_divider &&
|
||||
use_autofreeze &&
|
||||
!found_divider_upper && need_divider_upper)
|
||||
{
|
||||
table->model->dividing_row_upper = vcell_loc.virt_row;
|
||||
found_divider_upper = TRUE;
|
||||
}
|
||||
|
||||
if (blank_trans == find_trans)
|
||||
new_trans_row = vcell_loc.virt_row;
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ gnc_table_model_new (void)
|
||||
model->save_handlers = gnc_table_model_handler_hash_new ();
|
||||
|
||||
model->read_only = FALSE;
|
||||
model->dividing_row_upper = -1;
|
||||
model->dividing_row = -1;
|
||||
|
||||
return model;
|
||||
|
||||
@@ -121,6 +121,9 @@ typedef struct
|
||||
/* If positive, denotes a row that marks a boundary that should
|
||||
* be visually distinguished. */
|
||||
int dividing_row;
|
||||
/* If positive, denotes a row that marks a boundary that should
|
||||
* be visually distinguished, but different from the other. */
|
||||
int dividing_row_upper;
|
||||
|
||||
VirtCellDataAllocator cell_data_allocator;
|
||||
VirtCellDataDeallocator cell_data_deallocator;
|
||||
|
||||
@@ -449,7 +449,36 @@ draw_cell (GnucashGrid *grid,
|
||||
gnucash_draw_hatching (drawable, grid->gc,
|
||||
x, y, width, height);
|
||||
|
||||
/* dividing line */
|
||||
/* dividing line upper (red) */
|
||||
if ((virt_loc.phys_row_offset == 0) &&
|
||||
(table->model->dividing_row_upper >= 0))
|
||||
{
|
||||
if (virt_loc.vcell_loc.virt_row == table->model->dividing_row_upper)
|
||||
{
|
||||
gdk_gc_set_foreground (grid->gc, &gn_red);
|
||||
gdk_draw_line (drawable, grid->gc, x, y - 1, x + width, y - 1);
|
||||
gdk_draw_line (drawable, grid->gc, x, y, x + width, y);
|
||||
gdk_draw_line (drawable, grid->gc, x, y + 1, x + width, y + 1);
|
||||
}
|
||||
}
|
||||
|
||||
if ((virt_loc.phys_row_offset == (block->style->nrows - 1)) &&
|
||||
(table->model->dividing_row_upper >= 0))
|
||||
{
|
||||
if (virt_loc.vcell_loc.virt_row ==
|
||||
(table->model->dividing_row_upper - 1))
|
||||
{
|
||||
gdk_gc_set_foreground (grid->gc, &gn_red);
|
||||
gdk_draw_line (drawable, grid->gc, x, y + height - 1,
|
||||
x + width, y + height - 1);
|
||||
gdk_draw_line (drawable, grid->gc, x, y + height,
|
||||
x + width, y + height);
|
||||
gdk_draw_line (drawable, grid->gc, x, y + height + 1,
|
||||
x + width, y + height + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/* dividing line lower (blue) */
|
||||
if ((virt_loc.phys_row_offset == 0) &&
|
||||
(table->model->dividing_row >= 0))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user