mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Register: Add debugging code for the copy and cut operations.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17938 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
97ae5d8224
commit
6d1e0b75e1
@ -584,6 +584,10 @@ gnc_split_register_copy_current_internal (SplitRegister *reg,
|
|||||||
Split *split;
|
Split *split;
|
||||||
SCM new_item;
|
SCM new_item;
|
||||||
|
|
||||||
|
g_return_if_fail(reg);
|
||||||
|
ENTER("reg=%p, use_cut_semantics=%s", reg,
|
||||||
|
use_cut_semantics? "TRUE" : "FALSE");
|
||||||
|
|
||||||
blank_split = xaccSplitLookup(&info->blank_split_guid,
|
blank_split = xaccSplitLookup(&info->blank_split_guid,
|
||||||
gnc_get_current_book ());
|
gnc_get_current_book ());
|
||||||
split = gnc_split_register_get_current_split (reg);
|
split = gnc_split_register_get_current_split (reg);
|
||||||
@ -591,23 +595,43 @@ gnc_split_register_copy_current_internal (SplitRegister *reg,
|
|||||||
|
|
||||||
/* This shouldn't happen, but be paranoid. */
|
/* This shouldn't happen, but be paranoid. */
|
||||||
if (trans == NULL)
|
if (trans == NULL)
|
||||||
|
{
|
||||||
|
LEAVE("no trans");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
cursor_class = gnc_split_register_get_current_cursor_class (reg);
|
cursor_class = gnc_split_register_get_current_cursor_class (reg);
|
||||||
|
|
||||||
/* Can't do anything with this. */
|
/* Can't do anything with this. */
|
||||||
if (cursor_class == CURSOR_CLASS_NONE)
|
if (cursor_class == CURSOR_CLASS_NONE)
|
||||||
|
{
|
||||||
|
LEAVE("no cursor class");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* This shouldn't happen, but be paranoid. */
|
/* This shouldn't happen, but be paranoid. */
|
||||||
if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
|
if ((split == NULL) && (cursor_class == CURSOR_CLASS_TRANS))
|
||||||
|
{
|
||||||
|
g_warning("BUG DETECTED: transaction cursor with no anchoring split!");
|
||||||
|
LEAVE("transaction cursor with no anchoring split");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
changed = gnc_table_current_cursor_changed (reg->table, FALSE);
|
changed = gnc_table_current_cursor_changed (reg->table, FALSE);
|
||||||
|
|
||||||
/* See if we were asked to copy an unchanged blank split. Don't. */
|
/* See if we were asked to copy an unchanged blank split. Don't. */
|
||||||
if (!changed && ((split == NULL) || (split == blank_split)))
|
if (!changed && ((split == NULL) || (split == blank_split)))
|
||||||
|
{
|
||||||
|
/* We're either on an unedited, brand-new split or an unedited, brand-new
|
||||||
|
* transaction (the transaction anchored by the blank split.) */
|
||||||
|
/* FIXME: This doesn't work exactly right. When entering a new transaction,
|
||||||
|
* you can edit the description, move to a split row, then move
|
||||||
|
* back to the description, then ask for a copy, and this code will
|
||||||
|
* be reached. It forgets that you changed the row the first time
|
||||||
|
* you were there. -Charles */
|
||||||
|
LEAVE("nothing to copy/cut");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Ok, we are now ready to make the copy. */
|
/* Ok, we are now ready to make the copy. */
|
||||||
|
|
||||||
@ -652,7 +676,11 @@ gnc_split_register_copy_current_internal (SplitRegister *reg,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (new_item == SCM_UNDEFINED)
|
if (new_item == SCM_UNDEFINED)
|
||||||
|
{
|
||||||
|
g_warning("BUG DETECTED: copy failed");
|
||||||
|
LEAVE("copy failed");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* unprotect the old object, if any */
|
/* unprotect the old object, if any */
|
||||||
if (copied_item != SCM_UNDEFINED)
|
if (copied_item != SCM_UNDEFINED)
|
||||||
@ -662,6 +690,7 @@ gnc_split_register_copy_current_internal (SplitRegister *reg,
|
|||||||
scm_gc_protect_object(copied_item);
|
scm_gc_protect_object(copied_item);
|
||||||
|
|
||||||
copied_class = cursor_class;
|
copied_class = cursor_class;
|
||||||
|
LEAVE("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user