*** empty log message ***

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2153 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas 2000-04-04 09:48:22 +00:00
parent 05cfcc2f19
commit f3d6d364e8
4 changed files with 185 additions and 156 deletions

View File

@ -1,3 +1,14 @@
2000-04-04 Dave Peticolas <peticola@cs.ucdavis.edu>
* src/register/gnome/gnucash-style.c: update the styles
appropriately for the changes below.
* src/register/splitreg.c: configure the ledger style register
with a xfer to field in all modes.
* src/SplitLedger.c (xaccSRLoadRegister): remove stock price hack.
many code cleanups throughout file.
2000-04-03 Dave Peticolas <peticola@cs.ucdavis.edu> 2000-04-03 Dave Peticolas <peticola@cs.ucdavis.edu>
* src/gnome/window-register.c: changed menu definitions to be * src/gnome/window-register.c: changed menu definitions to be

View File

@ -117,9 +117,12 @@ struct _SRInfo
/* The currently open transaction, if any */ /* The currently open transaction, if any */
Transaction *pending_trans; Transaction *pending_trans;
/* A transaction used to remember where to expand the cursor */ /* A transaction used to remember where to put the cursor */
Transaction *cursor_hint_trans; Transaction *cursor_hint_trans;
/* A split used to remember where to put the cursor */
Split *cursor_hint_split;
/* The default account where new splits are added */ /* The default account where new splits are added */
Account *default_source_account; Account *default_source_account;
@ -462,16 +465,18 @@ LedgerMoveCursor (Table *table,
reg->cursor_virt_row = locator->virt_row; reg->cursor_virt_row = locator->virt_row;
/* if auto-expansion is enabled, we need to redraw the register /* if auto-expansion is enabled, we need to redraw the register
* to expand out the splits at the new location. We do some * to expand out the splits at the new location. We use the
* tomfoolery here to trick the code into expanding the new location. * cursor_hint data members to tell the refresh routine where
* This little futz is sleazy, but it does succeed in getting the * to go. */
* LoadRegister code into expanding the appropriate split. */
style = ((reg->type) & REG_STYLE_MASK); style = ((reg->type) & REG_STYLE_MASK);
if ((REG_SINGLE_DYNAMIC == style) || if ((REG_SINGLE_DYNAMIC == style) ||
(REG_DOUBLE_DYNAMIC == style)) (REG_DOUBLE_DYNAMIC == style))
{ {
new_trans = xaccSRGetTrans(reg, new_phys_row, new_phys_col);
info->cursor_hint_trans = new_trans;
new_split = xaccGetUserData (reg->table, new_phys_row, new_phys_col); new_split = xaccGetUserData (reg->table, new_phys_row, new_phys_col);
reg->table->current_cursor->user_data = (void *) new_split; info->cursor_hint_split = new_split;
xaccRegisterRefresh (reg); xaccRegisterRefresh (reg);
@ -588,6 +593,7 @@ LedgerDestroy (SplitRegister *reg)
xaccTransBeginEdit (trans, 1); xaccTransBeginEdit (trans, 1);
xaccTransDestroy (trans); xaccTransDestroy (trans);
xaccTransCommitEdit (trans); xaccTransCommitEdit (trans);
info->blank_split = NULL; info->blank_split = NULL;
} }
@ -1836,24 +1842,26 @@ xaccSRLoadRegEntry (SplitRegister *reg, Split *split)
/* ======================================================== */ /* ======================================================== */
static gncBoolean static gncBoolean
xaccSRCountRows (SplitRegister *reg, Split **slist) xaccSRCountRows (SplitRegister *reg, Split **slist,
Transaction *find_trans, Split *find_split)
{ {
SRInfo *info = xaccSRGetInfo(reg); SRInfo *info = xaccSRGetInfo(reg);
int i; CellBlock *lead_cursor;
Split *split = NULL; Split *split = NULL;
Split *save_current_split = NULL; Locator *locator;
Transaction *save_current_trans = NULL; Table *table;
gncBoolean found_split = GNC_F;
gncBoolean multi_line;
gncBoolean dynamic;
int save_cursor_phys_row; int save_cursor_phys_row;
int save_cursor_virt_row; int save_cursor_virt_row;
int save_cell_row; int save_cell_row;
Locator *locator;
Table *table;
int num_phys_rows; int num_phys_rows;
int num_virt_rows; int num_virt_rows;
int style; int style;
int multi_line, dynamic; int i;
CellBlock *lead_cursor;
gncBoolean found_split = GNC_F;
table = reg->table; table = reg->table;
style = (reg->type) & REG_STYLE_MASK; style = (reg->type) & REG_STYLE_MASK;
@ -1866,11 +1874,9 @@ xaccSRCountRows (SplitRegister *reg, Split **slist)
lead_cursor = reg->double_cursor; lead_cursor = reg->double_cursor;
} }
/* save the current cursor location; we do this by saving /* save the current cursor location; if we can't find the
* a pointer to the currently edited split; we restore the * requested transaction/split pair, we restore the
* cursor to this location when we are done. */ * cursor to this location when we are done. */
save_current_split = xaccSRGetCurrentSplit (reg);
save_current_trans = xaccSRGetCurrentTrans (reg);
save_cursor_phys_row = reg->cursor_phys_row; save_cursor_phys_row = reg->cursor_phys_row;
save_cursor_virt_row = reg->cursor_virt_row; save_cursor_virt_row = reg->cursor_virt_row;
@ -1909,14 +1915,14 @@ xaccSRCountRows (SplitRegister *reg, Split **slist)
/* lets determine where to locate the cursor ... */ /* lets determine where to locate the cursor ... */
if (!found_split) { if (!found_split) {
/* Check to see if we find a perfect match */ /* Check to see if we find a perfect match */
if (split == save_current_split) { if (split == find_split) {
save_cursor_phys_row = num_phys_rows; save_cursor_phys_row = num_phys_rows;
save_cursor_virt_row = num_virt_rows; save_cursor_virt_row = num_virt_rows;
found_split = GNC_T; found_split = GNC_T;
} }
/* Otherwise, check for a close match. This could happen if /* Otherwise, check for a close match. This could happen
we are collapsing from multi-line to single, e.g. */ * if we are collapsing from multi-line to single, e.g. */
else if (xaccSplitGetParent(split) == save_current_trans) { else if (xaccSplitGetParent(split) == find_trans) {
save_cursor_phys_row = num_phys_rows; save_cursor_phys_row = num_phys_rows;
save_cursor_virt_row = num_virt_rows; save_cursor_virt_row = num_virt_rows;
} }
@ -1925,11 +1931,11 @@ xaccSRCountRows (SplitRegister *reg, Split **slist)
/* if multi-line, then show all splits. If dynamic then /* if multi-line, then show all splits. If dynamic then
* show all splits only if this is the hot split. */ * show all splits only if this is the hot split. */
do_expand = multi_line; do_expand = multi_line;
do_expand = do_expand || do_expand = do_expand ||
(dynamic && xaccIsPeerSplit(split,save_current_split)); (dynamic && xaccIsPeerSplit(split, find_split));
if (dynamic && (NULL == save_current_split)) { if (dynamic && (NULL == find_split)) {
trans = xaccSplitGetParent (split); trans = xaccSplitGetParent (split);
do_expand = do_expand || (trans == info->cursor_hint_trans); do_expand = do_expand || (trans == find_trans);
} }
if (do_expand) if (do_expand)
@ -1962,8 +1968,8 @@ xaccSRCountRows (SplitRegister *reg, Split **slist)
/* Check to see if we find a perfect match. We have to /* Check to see if we find a perfect match. We have to
* check the transaction in case the split is NULL (blank). * check the transaction in case the split is NULL (blank).
*/ */
if ((secondary == save_current_split) && if ((secondary == find_split) &&
(trans == save_current_trans)) { (trans == find_trans)) {
save_cursor_phys_row = num_phys_rows; save_cursor_phys_row = num_phys_rows;
save_cursor_virt_row = num_virt_rows; save_cursor_virt_row = num_virt_rows;
found_split = GNC_T; found_split = GNC_T;
@ -1977,7 +1983,7 @@ xaccSRCountRows (SplitRegister *reg, Split **slist)
} while (secondary); } while (secondary);
} else { } else {
/* Try to get as close as possible to the original cell row. */ /* Try to get as close as possible to the original cell row. */
if (found_split && (split == save_current_split) && if (found_split && (split == find_split) &&
(save_cell_row < lead_cursor->numRows)) (save_cell_row < lead_cursor->numRows))
save_cursor_phys_row += save_cell_row; save_cursor_phys_row += save_cell_row;
@ -1994,7 +2000,7 @@ xaccSRCountRows (SplitRegister *reg, Split **slist)
/* the "blank split", if it exists, is at the end */ /* the "blank split", if it exists, is at the end */
if (info->blank_split != NULL) { if (info->blank_split != NULL) {
/* lets determine where to locate the cursor ... */ /* lets determine where to locate the cursor ... */
if (!found_split && info->blank_split == save_current_split) { if (!found_split && info->blank_split == find_split) {
save_cursor_phys_row = num_phys_rows; save_cursor_phys_row = num_phys_rows;
save_cursor_virt_row = num_virt_rows; save_cursor_virt_row = num_virt_rows;
found_split = GNC_T; found_split = GNC_T;
@ -2002,8 +2008,8 @@ xaccSRCountRows (SplitRegister *reg, Split **slist)
} }
if (multi_line) { if (multi_line) {
if (!found_split && (save_current_split == NULL) && if (!found_split && (find_split == NULL) &&
(xaccSplitGetParent(info->blank_split) == save_current_trans)) { (xaccSplitGetParent(info->blank_split) == find_trans)) {
save_cursor_phys_row = num_phys_rows + 1; save_cursor_phys_row = num_phys_rows + 1;
save_cursor_virt_row = num_virt_rows + 1; save_cursor_virt_row = num_virt_rows + 1;
found_split = GNC_T; found_split = GNC_T;
@ -2045,21 +2051,25 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
Account *default_source_acc) Account *default_source_acc)
{ {
SRInfo *info = xaccSRGetInfo(reg); SRInfo *info = xaccSRGetInfo(reg);
int i = 0; SplitRegisterBuffer *reg_buffer;
Split *split = NULL; CellBlock *lead_cursor;
Transaction *find_trans;
Split *last_split = NULL; Split *last_split = NULL;
Split *save_current_split = NULL; Split *find_split;
Split *split;
Table *table; Table *table;
gncBoolean found_pending = GNC_F;
gncBoolean found_split;
gncBoolean multi_line;
gncBoolean dynamic;
unsigned int changed;
int phys_row; int phys_row;
int vrow; int vrow;
int type, style; int type, style;
int save_phys_col; int save_phys_col;
int multi_line, dynamic; int i;
CellBlock *lead_cursor;
gncBoolean found_pending = GNC_F;
gncBoolean found_current = GNC_F;
SplitRegisterBuffer *reg_buffer;
unsigned int changed;
xaccSplitRegisterConfigColors (reg); xaccSplitRegisterConfigColors (reg);
@ -2077,30 +2087,30 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
lead_cursor = reg->double_cursor; lead_cursor = reg->double_cursor;
} }
/* save the current cursor location; we do this by saving a pointer /* figure out the transaction we are going to. */
* to the currently edited split and physical column; we restore if (info->cursor_hint_trans != NULL) {
* the cursor to this location when we are done. */ find_trans = info->cursor_hint_trans;
save_current_split = xaccSRGetCurrentSplit (reg); find_split = info->cursor_hint_split;
}
else {
find_trans = xaccSRGetCurrentTrans (reg);
find_split = xaccSRGetCurrentSplit (reg);
}
/* save the current physical column; we'll try to get /* save the current physical column; we'll
* back here after the refresh. */ * try to get back here after the refresh. */
save_phys_col = reg->table->current_cursor_phys_col; save_phys_col = table->current_cursor_phys_col;
if (save_phys_col < 0) if (save_phys_col < 0)
save_phys_col = 0; save_phys_col = 0;
/* If we are in dynamic mode on a blank split, remember /* count the number of rows, looking for the place we want to go. */
* the current transaction for determining expansion. */ found_split = xaccSRCountRows (reg, slist, find_trans, find_split);
if (dynamic && (save_current_split == NULL))
info->cursor_hint_trans = xaccSRGetCurrentTrans(reg);
/* count the number of rows */
found_current = xaccSRCountRows (reg, slist);
/* If the current cursor has changed, and the 'current split' /* If the current cursor has changed, and the 'current split'
* is still among the living, we save the values for later * is still among the living, we save the values for later
* restoration. */ * restoration. */
changed = xaccSplitRegisterGetChangeFlag(reg); changed = xaccSplitRegisterGetChangeFlag(reg);
if (found_current && changed) if (found_split && changed && (find_split == xaccSRGetCurrentSplit(reg)))
{ {
reg_buffer = xaccMallocSplitRegisterBuffer(); reg_buffer = xaccMallocSplitRegisterBuffer();
xaccSplitRegisterSaveCursor(reg, reg_buffer); xaccSplitRegisterSaveCursor(reg, reg_buffer);
@ -2146,15 +2156,14 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
PINFO ("xaccSRLoadRegister(): " PINFO ("xaccSRLoadRegister(): "
"load trans %d at phys row %d \n", i, phys_row); "load trans %d at phys row %d \n", i, phys_row);
/* if multi-line, then show all splits. If dynamic then /* if multi-line, then show all splits. If dynamic then
* show all splits only if this is the hot split. * show all splits only if this is the hot split. */
*/
do_expand = multi_line; do_expand = multi_line;
do_expand = do_expand || do_expand = do_expand ||
(dynamic && xaccIsPeerSplit(split,save_current_split)); (dynamic && xaccIsPeerSplit(split, find_split));
if (dynamic && (NULL == save_current_split)) { if (dynamic && (NULL == find_split)) {
trans = xaccSplitGetParent (split); trans = xaccSplitGetParent (split);
do_expand = do_expand || (trans == info->cursor_hint_trans); do_expand = do_expand || (trans == find_trans);
} }
if (do_expand) if (do_expand)
@ -2209,7 +2218,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
split = slist[i]; split = slist[i];
} }
/* add the "blank split" at the end. We use either the blank /* add the "blank split" at the end. We use either the blank
* split or we create a new one, as needed. */ * split or we create a new one, as needed. */
if (info->blank_split != NULL) { if (info->blank_split != NULL) {
split = info->blank_split; split = info->blank_split;
@ -2220,23 +2229,15 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
double last_price = 0.0; double last_price = 0.0;
trans = xaccMallocTransaction (); trans = xaccMallocTransaction ();
xaccTransBeginEdit (trans, 1); xaccTransBeginEdit (trans, 1);
xaccTransSetDateSecs(trans, info->last_date_entered); xaccTransSetDateSecs(trans, info->last_date_entered);
xaccTransCommitEdit (trans); xaccTransCommitEdit (trans);
split = xaccTransGetSplit (trans, 0); split = xaccTransGetSplit (trans, 0);
info->blank_split = split; info->blank_split = split;
reg->destroy = LedgerDestroy;
/* kind of a cheesy hack to get the price on the last split right reg->destroy = LedgerDestroy;
* when doing stock accounts. This will guess incorrectly for a
* ledger showing multiple stocks, but seems cool for a single stock.
*/
if ((STOCK_REGISTER == type) ||
(PORTFOLIO_LEDGER == type))
{
last_price = xaccSplitGetSharePrice (last_split);
xaccSplitSetSharePrice (split, last_price);
}
} }
/* do the split row of the blank split */ /* do the split row of the blank split */
@ -2278,7 +2279,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
if (reg_buffer != NULL) if (reg_buffer != NULL)
{ {
xaccSplitRegisterRestoreCursorChanged(reg, reg_buffer); xaccSplitRegisterRestoreCursorChanged(reg, reg_buffer);
xaccCommitCursor (reg->table); xaccCommitCursor (table);
} }
} }
@ -2295,6 +2296,11 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
if (!found_pending) if (!found_pending)
info->pending_trans = NULL; info->pending_trans = NULL;
/* clear out the hint transaction and split. We want
* to know if it has been set from the move callback. */
info->cursor_hint_trans = NULL;
info->cursor_hint_split = NULL;
xaccRefreshTableGUI (table); xaccRefreshTableGUI (table);
/* set the completion character for the xfer cells */ /* set the completion character for the xfer cells */

View File

@ -62,7 +62,7 @@ struct _CellLayoutInfo
{ {
unsigned int **flags; unsigned int **flags;
unsigned int **user_flags; /* For user mutable flags */ unsigned int **user_flags; /* For user mutable flags */
int **chars_width; int **chars_width;
int **pixels_width; int **pixels_width;
int **chars_min; int **chars_min;
@ -89,7 +89,7 @@ typedef struct
{ {
unsigned int flags; unsigned int flags;
unsigned int user_flags; /* For user mutable flags */ unsigned int user_flags; /* For user mutable flags */
int chars_width; int chars_width;
int pixels_width; int pixels_width;
int chars_min; int chars_min;
@ -292,16 +292,17 @@ layout_init_ledger(GnucashSheet *sheet, SheetBlockStyle *style)
char date_str[128]; char date_str[128];
int i, j; int i, j;
double perc[1][7] = {{0.10, 0.07, 0.32, 0.25, 0.02, 0.12, 0.12}}; double perc[1][8] = {{0.10, 0.07, 0.21, 0.18, 0.18, 0.02, 0.12, 0.12}};
CellLayoutData ld[1][7] = CellLayoutData ld[1][8] =
{{{STRING_FIXED,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,date_str}, {{{STRING_FIXED,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,date_str},
{CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,3,0,5,0,0,0,0,0,0,0,NULL}, {CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,3,0,5,0,0,0,0,0,0,0,NULL},
{CHARS_MIN | FILL,RESIZABLE,0,0,20,0,0,0,0,0,0,0,0,0,NULL}, {CHARS_MIN | FILL,RESIZABLE,0,0,20,0,0,0,0,0,0,0,0,0,NULL},
{STRING_MIN,RESIZABLE,0,0,0,0,10,0,0,0,0,0,0,0,XFTO_STR},
{STRING_MIN,RESIZABLE,0,0,0,0,10,0,0,0,0,0,0,0,XFRM_STR}, {STRING_MIN,RESIZABLE,0,0,0,0,10,0,0,0,0,0,0,0,XFRM_STR},
{STRING_FIXED,0,1,0,0,0,0,0,0,0,0,0,0,0,"R"}, {STRING_FIXED,0,1,0,0,0,0,0,0,0,0,0,0,0,"R"},
{CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,9,0,10,0,0,0,0,0,0,0,NULL}, {CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,9,0,10,0,0,0,0,0,0,0,NULL},
{SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,5,NULL}, {SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,6,NULL},
}}; }};
printDate(date_str, 29, 12, 2000); printDate(date_str, 29, 12, 2000);
@ -309,7 +310,7 @@ layout_init_ledger(GnucashSheet *sheet, SheetBlockStyle *style)
layout_info = style_layout_info_new (style); layout_info = style_layout_info_new (style);
SET_CELL_LAYOUT_DATA (1, 7); SET_CELL_LAYOUT_DATA (1, 8);
g_hash_table_insert (sheet->layout_info_hash_table, g_hash_table_insert (sheet->layout_info_hash_table,
style_get_key (style), layout_info); style_get_key (style), layout_info);
@ -326,7 +327,7 @@ layout_init_double(GnucashSheet *sheet, SheetBlockStyle *style)
int i, j; int i, j;
double perc[2][8] = {{0.10, 0.07, 0.25, 0.20, 0.02, 0.12, 0.12, 0.12}, double perc[2][8] = {{0.10, 0.07, 0.25, 0.20, 0.02, 0.12, 0.12, 0.12},
{0.10, 0.07, 0.83, 0.0, 0.0, 0.0, 0.0, 0.0}}; {0.10, 0.07, 0.83, 0.00, 0.00, 0.00, 0.00, 0.00}};
CellLayoutData ld[2][8] = CellLayoutData ld[2][8] =
{{{STRING_FIXED,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,date_str}, {{{STRING_FIXED,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,date_str},
@ -368,17 +369,18 @@ layout_init_ledger_double(GnucashSheet *sheet, SheetBlockStyle *style)
char date_str[128]; char date_str[128];
int i, j; int i, j;
double perc[2][7] = {{0.10, 0.07, 0.32, 0.25, 0.02, 0.12, 0.12}, double perc[2][8] = {{0.10, 0.07, 0.21, 0.18, 0.18, 0.02, 0.12, 0.12},
{0.10, 0.07, 0.83, 0.0, 0.0, 0.0, 0.0}}; {0.10, 0.07, 0.83, 0.00, 0.00, 0.00, 0.00, 0.00}};
CellLayoutData ld[2][7] = CellLayoutData ld[2][8] =
{{{STRING_FIXED,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,date_str}, {{{STRING_FIXED,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,date_str},
{CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,3,0,5,0,0,0,0,0,0,0,NULL}, {CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,3,0,5,0,0,0,0,0,0,0,NULL},
{CHARS_MIN | FILL,RESIZABLE,0,0,20,0,0,0,0,0,0,0,0,0,NULL}, {CHARS_MIN | FILL,RESIZABLE,0,0,20,0,0,0,0,0,0,0,0,0,NULL},
{STRING_MIN,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,XFTO_STR},
{STRING_MIN,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,XFRM_STR}, {STRING_MIN,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,XFRM_STR},
{STRING_FIXED,0,1,0,0,0,0,0,0,0,0,0,0,0,"R"}, {STRING_FIXED,0,1,0,0,0,0,0,0,0,0,0,0,0,"R"},
{CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,9,0,10,0,0,0,0,0,0,0,NULL}, {CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,9,0,10,0,0,0,0,0,0,0,NULL},
{SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,5,NULL}}, {SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,6,NULL}},
{{LEFT_ALIGNED|RIGHT_ALIGNED,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,NULL}, {{LEFT_ALIGNED|RIGHT_ALIGNED,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,NULL},
{LEFT_ALIGNED|RIGHT_ALIGNED,RESIZABLE,0,0,0,0,0,0,0,1,0,1,0,0,NULL}, {LEFT_ALIGNED|RIGHT_ALIGNED,RESIZABLE,0,0,0,0,0,0,0,1,0,1,0,0,NULL},
{LEFT_ALIGNED|RIGHT_ALIGNED,RESIZABLE,0,0,0,0,0,0,0,2,0,7,0,0,NULL}, {LEFT_ALIGNED|RIGHT_ALIGNED,RESIZABLE,0,0,0,0,0,0,0,2,0,7,0,0,NULL},
@ -386,6 +388,7 @@ layout_init_ledger_double(GnucashSheet *sheet, SheetBlockStyle *style)
{PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL}, {PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL},
{PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL}, {PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL},
{PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL}, {PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL},
{PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL},
}}; }};
printDate(date_str, 29, 12, 2000); printDate(date_str, 29, 12, 2000);
@ -393,7 +396,7 @@ layout_init_ledger_double(GnucashSheet *sheet, SheetBlockStyle *style)
layout_info = style_layout_info_new (style); layout_info = style_layout_info_new (style);
SET_CELL_LAYOUT_DATA (2, 7); SET_CELL_LAYOUT_DATA (2, 8);
g_hash_table_insert (sheet->layout_info_hash_table, g_hash_table_insert (sheet->layout_info_hash_table,
style_get_key (style), layout_info); style_get_key (style), layout_info);
@ -447,20 +450,21 @@ layout_init_stock_ledger(GnucashSheet *sheet, SheetBlockStyle *style)
char date_str[128]; char date_str[128];
int i, j; int i, j;
double perc[1][10] = {{0.09, 0.06, 0.24, 0.19, 0.01, 0.10, double perc[1][11] = {{0.09, 0.05, 0.18, 0.14, 0.14, 0.01,
0.10, 0.07, 0.07, 0.07}}; 0.09, 0.09, 0.07, 0.07, 0.07}};
CellLayoutData ld[1][10] = CellLayoutData ld[1][11] =
{{{STRING_FIXED,RESIZABLE, 0,0,0,0,0,0,0,0,0,0,0,0,date_str}, {{{STRING_FIXED,RESIZABLE, 0,0,0,0,0,0,0,0,0,0,0,0,date_str},
{CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,3,0,5,0,0,0,0,0,0,0,NULL}, {CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,3,0,5,0,0,0,0,0,0,0,NULL},
{CHARS_MIN | FILL,RESIZABLE,0,0,20,0,0,0,0,0,0,0,0,0,NULL}, {CHARS_MIN | FILL,RESIZABLE,0,0,20,0,0,0,0,0,0,0,0,0,NULL},
{STRING_MIN,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,XFTO_STR},
{STRING_MIN,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,XFRM_STR}, {STRING_MIN,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,XFRM_STR},
{STRING_FIXED,0,1,0,0,0,0,0,0,0,0,0,0,0,"R"}, {STRING_FIXED,0,1,0,0,0,0,0,0,0,0,0,0,0,"R"},
{CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,9,0,10,0,0,0,0,0,0,0,NULL}, {CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,9,0,10,0,0,0,0,0,0,0,NULL},
{SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,5,NULL}, {SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,6,NULL},
{SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,5,NULL}, {SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,6,NULL},
{SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,5,NULL}, {SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,6,NULL},
{SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,5,NULL}, {SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,6,NULL},
}}; }};
printDate(date_str, 29, 12, 2000); printDate(date_str, 29, 12, 2000);
@ -468,7 +472,7 @@ layout_init_stock_ledger(GnucashSheet *sheet, SheetBlockStyle *style)
layout_info = style_layout_info_new (style); layout_info = style_layout_info_new (style);
SET_CELL_LAYOUT_DATA (1, 10); SET_CELL_LAYOUT_DATA (1, 11);
g_hash_table_insert (sheet->layout_info_hash_table, g_hash_table_insert (sheet->layout_info_hash_table,
style_get_key (style), layout_info); style_get_key (style), layout_info);
@ -486,8 +490,8 @@ layout_init_stock_double(GnucashSheet *sheet, SheetBlockStyle *style)
double perc[2][11] = {{0.09, 0.06, 0.20, 0.14, 0.01, double perc[2][11] = {{0.09, 0.06, 0.20, 0.14, 0.01,
0.10, 0.10, 0.07, 0.07, 0.07, 0.09}, 0.10, 0.10, 0.07, 0.07, 0.07, 0.09},
{0.0, 0.15, 0.11, 0.74, 0.0, {0.00, 0.15, 0.11, 0.74, 0.00,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}; 0.00, 0.00, 0.00, 0.00, 0.00, 0.0}};
CellLayoutData ld[2][11] = CellLayoutData ld[2][11] =
{{{STRING_FIXED, RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,date_str}, {{{STRING_FIXED, RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,date_str},
@ -535,22 +539,23 @@ layout_init_stock_ledger_double(GnucashSheet *sheet, SheetBlockStyle *style)
char date_str[128]; char date_str[128];
int i, j; int i, j;
double perc[2][10] = {{0.09, 0.06, 0.24, 0.19, 0.01, double perc[2][11] = {{0.09, 0.05, 0.18, 0.14, 0.14,
0.10, 0.10, 0.07, 0.07, 0.07}, 0.01, 0.09, 0.09, 0.07, 0.07, 0.07},
{0.0, 0.15, 0.11, 0.74, 0.0, {0.00, 0.15, 0.11, 0.74, 0.00,
0.0, 0.0, 0.0, 0.0, 0.0}}; 0.00, 0.00, 0.00, 0.00, 0.00, 0.0}};
CellLayoutData ld[2][10] = CellLayoutData ld[2][11] =
{{{STRING_FIXED, RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,date_str}, {{{STRING_FIXED, RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,date_str},
{CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,3,0,5,0,0,0,0,0,0,0,NULL}, {CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,3,0,5,0,0,0,0,0,0,0,NULL},
{CHARS_MIN,RESIZABLE,0,0,20,0,0,0,0,0,0,0,0,0,NULL}, {CHARS_MIN,RESIZABLE,0,0,20,0,0,0,0,0,0,0,0,0,NULL},
{STRING_MIN | FILL,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,XFTO_STR},
{STRING_MIN | FILL,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,XFRM_STR}, {STRING_MIN | FILL,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,XFRM_STR},
{STRING_FIXED, 0,1,0,0,0,0,0,0,0,0,0,0,0,"R"}, {STRING_FIXED, 0,1,0,0,0,0,0,0,0,0,0,0,0,"R"},
{CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,9,0,10,0,0,0,0,0,0,0,NULL}, {CHARS_MIN | CHARS_MAX,RESIZABLE,0,0,9,0,10,0,0,0,0,0,0,0,NULL},
{SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,5,NULL}, {SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,6,NULL},
{SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,5,NULL}, {SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,6,NULL},
{SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,5,NULL}, {SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,6,NULL},
{SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,5,NULL}}, {SAME_SIZE,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,6,NULL}},
{{LEFT_ALIGNED|RIGHT_ALIGNED,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,NULL}, {{LEFT_ALIGNED|RIGHT_ALIGNED,RESIZABLE,0,0,0,0,0,0,0,0,0,0,0,0,NULL},
{LEFT_ALIGNED|RIGHT_ALIGNED,RESIZABLE,0,0,0,0,0,0,0,1,0,1,0,0,NULL}, {LEFT_ALIGNED|RIGHT_ALIGNED,RESIZABLE,0,0,0,0,0,0,0,1,0,1,0,0,NULL},
{LEFT_ALIGNED|RIGHT_ALIGNED,RESIZABLE,0,0,0,0,0,0,0,2,0,10,0,0,NULL}, {LEFT_ALIGNED|RIGHT_ALIGNED,RESIZABLE,0,0,0,0,0,0,0,2,0,10,0,0,NULL},
@ -561,6 +566,7 @@ layout_init_stock_ledger_double(GnucashSheet *sheet, SheetBlockStyle *style)
{PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL}, {PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL},
{PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL}, {PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL},
{PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL}, {PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL},
{PIXELS_FIXED,0,0,0,0,0,0,0,0,0,0,0,0,0,NULL},
}}; }};
printDate(date_str, 29, 12, 2000); printDate(date_str, 29, 12, 2000);
@ -568,7 +574,7 @@ layout_init_stock_ledger_double(GnucashSheet *sheet, SheetBlockStyle *style)
layout_info = style_layout_info_new (style); layout_info = style_layout_info_new (style);
SET_CELL_LAYOUT_DATA (2, 10); SET_CELL_LAYOUT_DATA (2, 11);
g_hash_table_insert (sheet->layout_info_hash_table, g_hash_table_insert (sheet->layout_info_hash_table,
style_get_key (style), layout_info); style_get_key (style), layout_info);

View File

@ -220,17 +220,14 @@ configLabels (SplitRegister *reg)
LABEL (DEBT, REBATE_STR); LABEL (DEBT, REBATE_STR);
LABEL (CRED, EXPENSE_STR); LABEL (CRED, EXPENSE_STR);
break; break;
case GENERAL_LEDGER:
case EQUITY_REGISTER:
LABEL (DEBT, SURPLUS_STR);
LABEL (CRED, DEFICIT_STR);
break;
case STOCK_REGISTER: case STOCK_REGISTER:
case PORTFOLIO_LEDGER: case PORTFOLIO_LEDGER:
case CURRENCY_REGISTER: case CURRENCY_REGISTER:
LABEL (DEBT, SOLD_STR); LABEL (DEBT, SOLD_STR);
LABEL (CRED, BOUGHT_STR); LABEL (CRED, BOUGHT_STR);
break; break;
case GENERAL_LEDGER:
case EQUITY_REGISTER:
case SEARCH_LEDGER: case SEARCH_LEDGER:
LABEL (DEBT, DEBIT_STR); LABEL (DEBT, DEBIT_STR);
LABEL (CRED, CREDIT_STR); LABEL (CRED, CREDIT_STR);
@ -294,7 +291,7 @@ configAction (SplitRegister *reg)
xaccAddComboCellMenuItem ( reg->actionCell, INT_STR); xaccAddComboCellMenuItem ( reg->actionCell, INT_STR);
xaccAddComboCellMenuItem ( reg->actionCell, PAYMENT_STR); xaccAddComboCellMenuItem ( reg->actionCell, PAYMENT_STR);
break; break;
case INCOME_LEDGER: case INCOME_LEDGER:
case INCOME_REGISTER: case INCOME_REGISTER:
xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR);
xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR);
@ -306,7 +303,7 @@ configAction (SplitRegister *reg)
xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR);
xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR);
break; break;
case GENERAL_LEDGER: case GENERAL_LEDGER:
case EQUITY_REGISTER: case EQUITY_REGISTER:
xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR);
xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR);
@ -450,10 +447,11 @@ configLayout (SplitRegister *reg)
FANCY (DATE, date, 0, 0); FANCY (DATE, date, 0, 0);
FANCY (NUM, num, 1, 0); FANCY (NUM, num, 1, 0);
FANCY (DESC, desc, 2, 0); FANCY (DESC, desc, 2, 0);
FANCY (MXFRM, mxfrm, 3, 0); FANCY (XTO, xto, 3, 0);
BASIC (RECN, recn, 4, 0); FANCY (MXFRM, mxfrm, 4, 0);
FANCY (DEBT, debit, 5, 0); BASIC (RECN, recn, 5, 0);
FANCY (CRED, credit, 6, 0); FANCY (DEBT, debit, 6, 0);
FANCY (CRED, credit, 7, 0);
FANCY (ACTN, action, 1, 1); FANCY (ACTN, action, 1, 1);
FANCY (MEMO, memo, 2, 1); FANCY (MEMO, memo, 2, 1);
@ -463,25 +461,27 @@ configLayout (SplitRegister *reg)
FANCY (NUM, num, 1, 0); FANCY (NUM, num, 1, 0);
FANCY (DESC, desc, 2, 0); FANCY (DESC, desc, 2, 0);
FANCY (XTO, xto, 3, 0); FANCY (XTO, xto, 3, 0);
BASIC (RECN, recn, 4, 0); FANCY (XFRM, mxfrm, 4, 0);
FANCY (DEBT, debit, 5, 0); BASIC (RECN, recn, 5, 0);
FANCY (CRED, credit, 6, 0); FANCY (DEBT, debit, 6, 0);
FANCY (CRED, credit, 7, 0);
curs = reg->split_cursor; curs = reg->split_cursor;
FANCY (ACTN, action, 1, 0); FANCY (ACTN, action, 1, 0);
FANCY (MEMO, memo, 2, 0); FANCY (MEMO, memo, 2, 0);
FANCY (XFRM, xfrm, 3, 0); FANCY (XFRM, xfrm, 4, 0);
FANCY (NDEBT, ndebit, 5, 0); FANCY (NDEBT, ndebit, 6, 0);
FANCY (NCRED, ncredit, 6, 0); FANCY (NCRED, ncredit, 7, 0);
curs = reg->single_cursor; curs = reg->single_cursor;
FANCY (DATE, date, 0, 0); FANCY (DATE, date, 0, 0);
FANCY (NUM, num, 1, 0); FANCY (NUM, num, 1, 0);
FANCY (DESC, desc, 2, 0); FANCY (DESC, desc, 2, 0);
FANCY (MXFRM, mxfrm, 3, 0); FANCY (XTO, xto, 3, 0);
BASIC (RECN, recn, 4, 0); FANCY (MXFRM, mxfrm, 4, 0);
FANCY (DEBT, debit, 5, 0); BASIC (RECN, recn, 5, 0);
FANCY (CRED, credit, 6, 0); FANCY (DEBT, debit, 6, 0);
FANCY (CRED, credit, 7, 0);
break; break;
} }
@ -501,7 +501,7 @@ configLayout (SplitRegister *reg)
FANCY (PRIC, price, 7, 0); FANCY (PRIC, price, 7, 0);
FANCY (VALU, value, 8, 0); FANCY (VALU, value, 8, 0);
FANCY (SHRS, shrs, 9, 0); FANCY (SHRS, shrs, 9, 0);
FANCY (BALN, balance, 10, 0); FANCY (BALN, balance, 10, 0);
FANCY (ACTN, action, 1, 1); FANCY (ACTN, action, 1, 1);
FANCY (MEMO, memo, 2, 1); FANCY (MEMO, memo, 2, 1);
@ -537,7 +537,7 @@ configLayout (SplitRegister *reg)
FANCY (PRIC, price, 7, 0); FANCY (PRIC, price, 7, 0);
FANCY (VALU, value, 8, 0); FANCY (VALU, value, 8, 0);
FANCY (SHRS, shrs, 9, 0); FANCY (SHRS, shrs, 9, 0);
FANCY (BALN, balance, 10, 0); FANCY (BALN, balance, 10, 0);
break; break;
} }
@ -549,13 +549,14 @@ configLayout (SplitRegister *reg)
FANCY (DATE, date, 0, 0); FANCY (DATE, date, 0, 0);
FANCY (NUM, num, 1, 0); FANCY (NUM, num, 1, 0);
FANCY (DESC, desc, 2, 0); FANCY (DESC, desc, 2, 0);
FANCY (MXFRM, mxfrm, 3, 0); FANCY (XTO, xto, 3, 0);
BASIC (RECN, recn, 4, 0); FANCY (MXFRM, mxfrm, 4, 0);
FANCY (DEBT, debit, 5, 0); BASIC (RECN, recn, 5, 0);
FANCY (CRED, credit, 6, 0); FANCY (DEBT, debit, 6, 0);
FANCY (PRIC, price, 7, 0); FANCY (CRED, credit, 7, 0);
FANCY (VALU, value, 8, 0); FANCY (PRIC, price, 8, 0);
FANCY (SHRS, shrs, 9, 0); FANCY (VALU, value, 9, 0);
FANCY (SHRS, shrs, 10, 0);
FANCY (ACTN, action, 1, 1); FANCY (ACTN, action, 1, 1);
FANCY (MEMO, memo, 2, 1); FANCY (MEMO, memo, 2, 1);
@ -565,31 +566,33 @@ configLayout (SplitRegister *reg)
FANCY (NUM, num, 1, 0); FANCY (NUM, num, 1, 0);
FANCY (DESC, desc, 2, 0); FANCY (DESC, desc, 2, 0);
FANCY (XTO, xto, 3, 0); FANCY (XTO, xto, 3, 0);
BASIC (RECN, recn, 4, 0); FANCY (XFRM, mxfrm, 4, 0);
FANCY (DEBT, debit, 5, 0); BASIC (RECN, recn, 5, 0);
FANCY (CRED, credit, 6, 0); FANCY (DEBT, debit, 6, 0);
FANCY (PRIC, price, 7, 0); FANCY (CRED, credit, 7, 0);
FANCY (VALU, value, 8, 0); FANCY (PRIC, price, 8, 0);
FANCY (SHRS, shrs, 9, 0); FANCY (VALU, value, 9, 0);
FANCY (SHRS, shrs, 10, 0);
curs = reg->split_cursor; curs = reg->split_cursor;
FANCY (ACTN, action, 1, 0); FANCY (ACTN, action, 1, 0);
FANCY (MEMO, memo, 2, 0); FANCY (MEMO, memo, 2, 0);
FANCY (XFRM, xfrm, 3, 0); FANCY (XFRM, xfrm, 4, 0);
FANCY (NDEBT, ndebit, 5, 0); FANCY (NDEBT, ndebit, 6, 0);
FANCY (NCRED, ncredit, 6, 0); FANCY (NCRED, ncredit, 7, 0);
curs = reg->single_cursor; curs = reg->single_cursor;
FANCY (DATE, date, 0, 0); FANCY (DATE, date, 0, 0);
FANCY (NUM, num, 1, 0); FANCY (NUM, num, 1, 0);
FANCY (DESC, desc, 2, 0); FANCY (DESC, desc, 2, 0);
FANCY (MXFRM, mxfrm, 3, 0); FANCY (XTO, xto, 3, 0);
BASIC (RECN, recn, 4, 0); FANCY (MXFRM, mxfrm, 4, 0);
FANCY (DEBT, debit, 5, 0); BASIC (RECN, recn, 5, 0);
FANCY (CRED, credit, 6, 0); FANCY (DEBT, debit, 6, 0);
FANCY (PRIC, price, 7, 0); FANCY (CRED, credit, 7, 0);
FANCY (VALU, value, 8, 0); FANCY (PRIC, price, 8, 0);
FANCY (SHRS, shrs, 9, 0); FANCY (VALU, value, 9, 0);
FANCY (SHRS, shrs, 10, 0);
break; break;
} }
@ -947,15 +950,18 @@ mallocCursors (SplitRegister *reg)
case INCOME_LEDGER: case INCOME_LEDGER:
case GENERAL_LEDGER: case GENERAL_LEDGER:
case SEARCH_LEDGER: case SEARCH_LEDGER:
reg->num_cols = 7; reg->num_cols = 8;
break; break;
case STOCK_REGISTER: case STOCK_REGISTER:
case CURRENCY_REGISTER: case CURRENCY_REGISTER:
reg->num_cols = 11; reg->num_cols = 11;
break; break;
case PORTFOLIO_LEDGER: case PORTFOLIO_LEDGER:
reg->num_cols = 10; reg->num_cols = 11;
break;
default: default:
break; break;
} }