From f3d6d364e8fa26f31064e4c96e4272e7f4f71821 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Tue, 4 Apr 2000 09:48:22 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2153 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 11 ++ src/SplitLedger.c | 158 +++++++++++++++-------------- src/register/gnome/gnucash-style.c | 70 +++++++------ src/register/splitreg.c | 102 ++++++++++--------- 4 files changed, 185 insertions(+), 156 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae60eff835..08ab8e487b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2000-04-04 Dave Peticolas + + * 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 * src/gnome/window-register.c: changed menu definitions to be diff --git a/src/SplitLedger.c b/src/SplitLedger.c index cb5d53dcfa..0c90aebbcb 100644 --- a/src/SplitLedger.c +++ b/src/SplitLedger.c @@ -117,9 +117,12 @@ struct _SRInfo /* The currently open transaction, if any */ 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; + /* A split used to remember where to put the cursor */ + Split *cursor_hint_split; + /* The default account where new splits are added */ Account *default_source_account; @@ -462,16 +465,18 @@ LedgerMoveCursor (Table *table, reg->cursor_virt_row = locator->virt_row; /* if auto-expansion is enabled, we need to redraw the register - * to expand out the splits at the new location. We do some - * tomfoolery here to trick the code into expanding the new location. - * This little futz is sleazy, but it does succeed in getting the - * LoadRegister code into expanding the appropriate split. */ + * to expand out the splits at the new location. We use the + * cursor_hint data members to tell the refresh routine where + * to go. */ style = ((reg->type) & REG_STYLE_MASK); if ((REG_SINGLE_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); - reg->table->current_cursor->user_data = (void *) new_split; + info->cursor_hint_split = new_split; xaccRegisterRefresh (reg); @@ -588,6 +593,7 @@ LedgerDestroy (SplitRegister *reg) xaccTransBeginEdit (trans, 1); xaccTransDestroy (trans); xaccTransCommitEdit (trans); + info->blank_split = NULL; } @@ -1836,24 +1842,26 @@ xaccSRLoadRegEntry (SplitRegister *reg, Split *split) /* ======================================================== */ static gncBoolean -xaccSRCountRows (SplitRegister *reg, Split **slist) +xaccSRCountRows (SplitRegister *reg, Split **slist, + Transaction *find_trans, Split *find_split) { SRInfo *info = xaccSRGetInfo(reg); - int i; + CellBlock *lead_cursor; Split *split = NULL; - Split *save_current_split = NULL; - Transaction *save_current_trans = NULL; + Locator *locator; + Table *table; + + gncBoolean found_split = GNC_F; + gncBoolean multi_line; + gncBoolean dynamic; + int save_cursor_phys_row; int save_cursor_virt_row; int save_cell_row; - Locator *locator; - Table *table; int num_phys_rows; int num_virt_rows; int style; - int multi_line, dynamic; - CellBlock *lead_cursor; - gncBoolean found_split = GNC_F; + int i; table = reg->table; style = (reg->type) & REG_STYLE_MASK; @@ -1866,11 +1874,9 @@ xaccSRCountRows (SplitRegister *reg, Split **slist) lead_cursor = reg->double_cursor; } - /* save the current cursor location; we do this by saving - * a pointer to the currently edited split; we restore the + /* save the current cursor location; if we can't find the + * requested transaction/split pair, we restore the * 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_virt_row = reg->cursor_virt_row; @@ -1909,14 +1915,14 @@ xaccSRCountRows (SplitRegister *reg, Split **slist) /* lets determine where to locate the cursor ... */ if (!found_split) { /* 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_virt_row = num_virt_rows; found_split = GNC_T; } - /* Otherwise, check for a close match. This could happen if - we are collapsing from multi-line to single, e.g. */ - else if (xaccSplitGetParent(split) == save_current_trans) { + /* Otherwise, check for a close match. This could happen + * if we are collapsing from multi-line to single, e.g. */ + else if (xaccSplitGetParent(split) == find_trans) { save_cursor_phys_row = num_phys_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 * show all splits only if this is the hot split. */ do_expand = multi_line; - do_expand = do_expand || - (dynamic && xaccIsPeerSplit(split,save_current_split)); - if (dynamic && (NULL == save_current_split)) { + do_expand = do_expand || + (dynamic && xaccIsPeerSplit(split, find_split)); + if (dynamic && (NULL == find_split)) { trans = xaccSplitGetParent (split); - do_expand = do_expand || (trans == info->cursor_hint_trans); + do_expand = do_expand || (trans == find_trans); } 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 the transaction in case the split is NULL (blank). */ - if ((secondary == save_current_split) && - (trans == save_current_trans)) { + if ((secondary == find_split) && + (trans == find_trans)) { save_cursor_phys_row = num_phys_rows; save_cursor_virt_row = num_virt_rows; found_split = GNC_T; @@ -1977,7 +1983,7 @@ xaccSRCountRows (SplitRegister *reg, Split **slist) } while (secondary); } else { /* 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_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 */ if (info->blank_split != NULL) { /* 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_virt_row = num_virt_rows; found_split = GNC_T; @@ -2002,8 +2008,8 @@ xaccSRCountRows (SplitRegister *reg, Split **slist) } if (multi_line) { - if (!found_split && (save_current_split == NULL) && - (xaccSplitGetParent(info->blank_split) == save_current_trans)) { + if (!found_split && (find_split == NULL) && + (xaccSplitGetParent(info->blank_split) == find_trans)) { save_cursor_phys_row = num_phys_rows + 1; save_cursor_virt_row = num_virt_rows + 1; found_split = GNC_T; @@ -2045,21 +2051,25 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, Account *default_source_acc) { SRInfo *info = xaccSRGetInfo(reg); - int i = 0; - Split *split = NULL; + SplitRegisterBuffer *reg_buffer; + CellBlock *lead_cursor; + Transaction *find_trans; Split *last_split = NULL; - Split *save_current_split = NULL; + Split *find_split; + Split *split; Table *table; + + gncBoolean found_pending = GNC_F; + gncBoolean found_split; + gncBoolean multi_line; + gncBoolean dynamic; + + unsigned int changed; int phys_row; int vrow; int type, style; int save_phys_col; - int multi_line, dynamic; - CellBlock *lead_cursor; - gncBoolean found_pending = GNC_F; - gncBoolean found_current = GNC_F; - SplitRegisterBuffer *reg_buffer; - unsigned int changed; + int i; xaccSplitRegisterConfigColors (reg); @@ -2077,30 +2087,30 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, lead_cursor = reg->double_cursor; } - /* save the current cursor location; we do this by saving a pointer - * to the currently edited split and physical column; we restore - * the cursor to this location when we are done. */ - save_current_split = xaccSRGetCurrentSplit (reg); + /* figure out the transaction we are going to. */ + if (info->cursor_hint_trans != NULL) { + find_trans = info->cursor_hint_trans; + 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 - * back here after the refresh. */ - save_phys_col = reg->table->current_cursor_phys_col; + /* save the current physical column; we'll + * try to get back here after the refresh. */ + save_phys_col = table->current_cursor_phys_col; if (save_phys_col < 0) save_phys_col = 0; - /* If we are in dynamic mode on a blank split, remember - * the current transaction for determining expansion. */ - if (dynamic && (save_current_split == NULL)) - info->cursor_hint_trans = xaccSRGetCurrentTrans(reg); - - /* count the number of rows */ - found_current = xaccSRCountRows (reg, slist); + /* count the number of rows, looking for the place we want to go. */ + found_split = xaccSRCountRows (reg, slist, find_trans, find_split); /* If the current cursor has changed, and the 'current split' * is still among the living, we save the values for later * restoration. */ changed = xaccSplitRegisterGetChangeFlag(reg); - if (found_current && changed) + if (found_split && changed && (find_split == xaccSRGetCurrentSplit(reg))) { reg_buffer = xaccMallocSplitRegisterBuffer(); xaccSplitRegisterSaveCursor(reg, reg_buffer); @@ -2146,15 +2156,14 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, PINFO ("xaccSRLoadRegister(): " "load trans %d at phys row %d \n", i, phys_row); - /* if multi-line, then show all splits. If dynamic then - * show all splits only if this is the hot split. - */ + /* if multi-line, then show all splits. If dynamic then + * show all splits only if this is the hot split. */ do_expand = multi_line; do_expand = do_expand || - (dynamic && xaccIsPeerSplit(split,save_current_split)); - if (dynamic && (NULL == save_current_split)) { + (dynamic && xaccIsPeerSplit(split, find_split)); + if (dynamic && (NULL == find_split)) { trans = xaccSplitGetParent (split); - do_expand = do_expand || (trans == info->cursor_hint_trans); + do_expand = do_expand || (trans == find_trans); } if (do_expand) @@ -2209,7 +2218,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, 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. */ if (info->blank_split != NULL) { split = info->blank_split; @@ -2220,23 +2229,15 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, double last_price = 0.0; trans = xaccMallocTransaction (); + xaccTransBeginEdit (trans, 1); xaccTransSetDateSecs(trans, info->last_date_entered); xaccTransCommitEdit (trans); + split = xaccTransGetSplit (trans, 0); info->blank_split = split; - reg->destroy = LedgerDestroy; - /* kind of a cheesy hack to get the price on the last split right - * 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); - } + reg->destroy = LedgerDestroy; } /* do the split row of the blank split */ @@ -2278,7 +2279,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, if (reg_buffer != NULL) { xaccSplitRegisterRestoreCursorChanged(reg, reg_buffer); - xaccCommitCursor (reg->table); + xaccCommitCursor (table); } } @@ -2295,6 +2296,11 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist, if (!found_pending) 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); /* set the completion character for the xfer cells */ diff --git a/src/register/gnome/gnucash-style.c b/src/register/gnome/gnucash-style.c index 4f66aa4aff..cbf21dc8c7 100644 --- a/src/register/gnome/gnucash-style.c +++ b/src/register/gnome/gnucash-style.c @@ -62,7 +62,7 @@ struct _CellLayoutInfo { unsigned int **flags; unsigned int **user_flags; /* For user mutable flags */ - + int **chars_width; int **pixels_width; int **chars_min; @@ -89,7 +89,7 @@ typedef struct { unsigned int flags; unsigned int user_flags; /* For user mutable flags */ - + int chars_width; int pixels_width; int chars_min; @@ -292,16 +292,17 @@ layout_init_ledger(GnucashSheet *sheet, SheetBlockStyle *style) char date_str[128]; 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}, {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}, + {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_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}, - {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); @@ -309,7 +310,7 @@ layout_init_ledger(GnucashSheet *sheet, SheetBlockStyle *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, style_get_key (style), layout_info); @@ -326,7 +327,7 @@ layout_init_double(GnucashSheet *sheet, SheetBlockStyle *style) int i, j; 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] = {{{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]; int i, j; - double perc[2][7] = {{0.10, 0.07, 0.32, 0.25, 0.02, 0.12, 0.12}, - {0.10, 0.07, 0.83, 0.0, 0.0, 0.0, 0.0}}; + 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.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}, {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}, + {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_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}, - {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,1,0,1,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}, }}; 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); - SET_CELL_LAYOUT_DATA (2, 7); + SET_CELL_LAYOUT_DATA (2, 8); g_hash_table_insert (sheet->layout_info_hash_table, style_get_key (style), layout_info); @@ -447,20 +450,21 @@ layout_init_stock_ledger(GnucashSheet *sheet, SheetBlockStyle *style) char date_str[128]; int i, j; - double perc[1][10] = {{0.09, 0.06, 0.24, 0.19, 0.01, 0.10, - 0.10, 0.07, 0.07, 0.07}}; + double perc[1][11] = {{0.09, 0.05, 0.18, 0.14, 0.14, 0.01, + 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}, {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}, + {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_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}, - {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,5,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,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,6,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,6,NULL}, }}; 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); - SET_CELL_LAYOUT_DATA (1, 10); + SET_CELL_LAYOUT_DATA (1, 11); g_hash_table_insert (sheet->layout_info_hash_table, 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, 0.10, 0.10, 0.07, 0.07, 0.07, 0.09}, - {0.0, 0.15, 0.11, 0.74, 0.0, - 0.0, 0.0, 0.0, 0.0, 0.0, 0.0}}; + {0.00, 0.15, 0.11, 0.74, 0.00, + 0.00, 0.00, 0.00, 0.00, 0.00, 0.0}}; CellLayoutData ld[2][11] = {{{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]; int i, j; - double perc[2][10] = {{0.09, 0.06, 0.24, 0.19, 0.01, - 0.10, 0.10, 0.07, 0.07, 0.07}, - {0.0, 0.15, 0.11, 0.74, 0.0, - 0.0, 0.0, 0.0, 0.0, 0.0}}; + double perc[2][11] = {{0.09, 0.05, 0.18, 0.14, 0.14, + 0.01, 0.09, 0.09, 0.07, 0.07, 0.07}, + {0.00, 0.15, 0.11, 0.74, 0.00, + 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}, {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}, + {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_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}, - {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,5,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,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,6,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,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,1,0,1,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}, }}; 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); - SET_CELL_LAYOUT_DATA (2, 10); + SET_CELL_LAYOUT_DATA (2, 11); g_hash_table_insert (sheet->layout_info_hash_table, style_get_key (style), layout_info); diff --git a/src/register/splitreg.c b/src/register/splitreg.c index 448a8f0569..a0d7f07ebb 100644 --- a/src/register/splitreg.c +++ b/src/register/splitreg.c @@ -220,17 +220,14 @@ configLabels (SplitRegister *reg) LABEL (DEBT, REBATE_STR); LABEL (CRED, EXPENSE_STR); break; - case GENERAL_LEDGER: - case EQUITY_REGISTER: - LABEL (DEBT, SURPLUS_STR); - LABEL (CRED, DEFICIT_STR); - break; case STOCK_REGISTER: case PORTFOLIO_LEDGER: case CURRENCY_REGISTER: LABEL (DEBT, SOLD_STR); LABEL (CRED, BOUGHT_STR); break; + case GENERAL_LEDGER: + case EQUITY_REGISTER: case SEARCH_LEDGER: LABEL (DEBT, DEBIT_STR); LABEL (CRED, CREDIT_STR); @@ -294,7 +291,7 @@ configAction (SplitRegister *reg) xaccAddComboCellMenuItem ( reg->actionCell, INT_STR); xaccAddComboCellMenuItem ( reg->actionCell, PAYMENT_STR); break; - case INCOME_LEDGER: + case INCOME_LEDGER: case INCOME_REGISTER: xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); @@ -306,7 +303,7 @@ configAction (SplitRegister *reg) xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); break; - case GENERAL_LEDGER: + case GENERAL_LEDGER: case EQUITY_REGISTER: xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); @@ -450,10 +447,11 @@ configLayout (SplitRegister *reg) FANCY (DATE, date, 0, 0); FANCY (NUM, num, 1, 0); FANCY (DESC, desc, 2, 0); - FANCY (MXFRM, mxfrm, 3, 0); - BASIC (RECN, recn, 4, 0); - FANCY (DEBT, debit, 5, 0); - FANCY (CRED, credit, 6, 0); + FANCY (XTO, xto, 3, 0); + FANCY (MXFRM, mxfrm, 4, 0); + BASIC (RECN, recn, 5, 0); + FANCY (DEBT, debit, 6, 0); + FANCY (CRED, credit, 7, 0); FANCY (ACTN, action, 1, 1); FANCY (MEMO, memo, 2, 1); @@ -463,25 +461,27 @@ configLayout (SplitRegister *reg) FANCY (NUM, num, 1, 0); FANCY (DESC, desc, 2, 0); FANCY (XTO, xto, 3, 0); - BASIC (RECN, recn, 4, 0); - FANCY (DEBT, debit, 5, 0); - FANCY (CRED, credit, 6, 0); + FANCY (XFRM, mxfrm, 4, 0); + BASIC (RECN, recn, 5, 0); + FANCY (DEBT, debit, 6, 0); + FANCY (CRED, credit, 7, 0); curs = reg->split_cursor; FANCY (ACTN, action, 1, 0); FANCY (MEMO, memo, 2, 0); - FANCY (XFRM, xfrm, 3, 0); - FANCY (NDEBT, ndebit, 5, 0); - FANCY (NCRED, ncredit, 6, 0); + FANCY (XFRM, xfrm, 4, 0); + FANCY (NDEBT, ndebit, 6, 0); + FANCY (NCRED, ncredit, 7, 0); curs = reg->single_cursor; FANCY (DATE, date, 0, 0); FANCY (NUM, num, 1, 0); FANCY (DESC, desc, 2, 0); - FANCY (MXFRM, mxfrm, 3, 0); - BASIC (RECN, recn, 4, 0); - FANCY (DEBT, debit, 5, 0); - FANCY (CRED, credit, 6, 0); + FANCY (XTO, xto, 3, 0); + FANCY (MXFRM, mxfrm, 4, 0); + BASIC (RECN, recn, 5, 0); + FANCY (DEBT, debit, 6, 0); + FANCY (CRED, credit, 7, 0); break; } @@ -501,7 +501,7 @@ configLayout (SplitRegister *reg) FANCY (PRIC, price, 7, 0); FANCY (VALU, value, 8, 0); FANCY (SHRS, shrs, 9, 0); - FANCY (BALN, balance, 10, 0); + FANCY (BALN, balance, 10, 0); FANCY (ACTN, action, 1, 1); FANCY (MEMO, memo, 2, 1); @@ -537,7 +537,7 @@ configLayout (SplitRegister *reg) FANCY (PRIC, price, 7, 0); FANCY (VALU, value, 8, 0); FANCY (SHRS, shrs, 9, 0); - FANCY (BALN, balance, 10, 0); + FANCY (BALN, balance, 10, 0); break; } @@ -549,13 +549,14 @@ configLayout (SplitRegister *reg) FANCY (DATE, date, 0, 0); FANCY (NUM, num, 1, 0); FANCY (DESC, desc, 2, 0); - FANCY (MXFRM, mxfrm, 3, 0); - BASIC (RECN, recn, 4, 0); - FANCY (DEBT, debit, 5, 0); - FANCY (CRED, credit, 6, 0); - FANCY (PRIC, price, 7, 0); - FANCY (VALU, value, 8, 0); - FANCY (SHRS, shrs, 9, 0); + FANCY (XTO, xto, 3, 0); + FANCY (MXFRM, mxfrm, 4, 0); + BASIC (RECN, recn, 5, 0); + FANCY (DEBT, debit, 6, 0); + FANCY (CRED, credit, 7, 0); + FANCY (PRIC, price, 8, 0); + FANCY (VALU, value, 9, 0); + FANCY (SHRS, shrs, 10, 0); FANCY (ACTN, action, 1, 1); FANCY (MEMO, memo, 2, 1); @@ -565,31 +566,33 @@ configLayout (SplitRegister *reg) FANCY (NUM, num, 1, 0); FANCY (DESC, desc, 2, 0); FANCY (XTO, xto, 3, 0); - BASIC (RECN, recn, 4, 0); - FANCY (DEBT, debit, 5, 0); - FANCY (CRED, credit, 6, 0); - FANCY (PRIC, price, 7, 0); - FANCY (VALU, value, 8, 0); - FANCY (SHRS, shrs, 9, 0); + FANCY (XFRM, mxfrm, 4, 0); + BASIC (RECN, recn, 5, 0); + FANCY (DEBT, debit, 6, 0); + FANCY (CRED, credit, 7, 0); + FANCY (PRIC, price, 8, 0); + FANCY (VALU, value, 9, 0); + FANCY (SHRS, shrs, 10, 0); curs = reg->split_cursor; FANCY (ACTN, action, 1, 0); FANCY (MEMO, memo, 2, 0); - FANCY (XFRM, xfrm, 3, 0); - FANCY (NDEBT, ndebit, 5, 0); - FANCY (NCRED, ncredit, 6, 0); + FANCY (XFRM, xfrm, 4, 0); + FANCY (NDEBT, ndebit, 6, 0); + FANCY (NCRED, ncredit, 7, 0); curs = reg->single_cursor; FANCY (DATE, date, 0, 0); FANCY (NUM, num, 1, 0); FANCY (DESC, desc, 2, 0); - FANCY (MXFRM, mxfrm, 3, 0); - BASIC (RECN, recn, 4, 0); - FANCY (DEBT, debit, 5, 0); - FANCY (CRED, credit, 6, 0); - FANCY (PRIC, price, 7, 0); - FANCY (VALU, value, 8, 0); - FANCY (SHRS, shrs, 9, 0); + FANCY (XTO, xto, 3, 0); + FANCY (MXFRM, mxfrm, 4, 0); + BASIC (RECN, recn, 5, 0); + FANCY (DEBT, debit, 6, 0); + FANCY (CRED, credit, 7, 0); + FANCY (PRIC, price, 8, 0); + FANCY (VALU, value, 9, 0); + FANCY (SHRS, shrs, 10, 0); break; } @@ -947,15 +950,18 @@ mallocCursors (SplitRegister *reg) case INCOME_LEDGER: case GENERAL_LEDGER: case SEARCH_LEDGER: - reg->num_cols = 7; + reg->num_cols = 8; break; case STOCK_REGISTER: case CURRENCY_REGISTER: reg->num_cols = 11; break; + case PORTFOLIO_LEDGER: - reg->num_cols = 10; + reg->num_cols = 11; + break; + default: break; }