From d45a5894bd57c8b03125ad39b7ccca7faed0cc38 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Wed, 7 Oct 1998 05:51:02 +0000 Subject: [PATCH] action cell contents depend on register type git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@1279 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/register/splitreg.c | 104 ++++++++++++++++++++++++++++++++-------- 1 file changed, 83 insertions(+), 21 deletions(-) diff --git a/src/register/splitreg.c b/src/register/splitreg.c index 995b6caae8..362c00cee1 100644 --- a/src/register/splitreg.c +++ b/src/register/splitreg.c @@ -173,6 +173,88 @@ configLabels (SplitRegister *reg) LABEL (NCRED, hc->value); } +/* ============================================== */ +/* configAction strings into the action cell */ +/* hack alert -- this stuf really, really should be in a config file ... */ + +static void +configAction (SplitRegister *reg) +{ + BasicCell *hc; + int type = (reg->type) & REG_TYPE_MASK; + + /* setup custom labels for the debit/credit columns */ + switch (type) { + case BANK_REGISTER: + xaccAddComboCellMenuItem ( reg->actionCell, DEPOSIT_STR); + xaccAddComboCellMenuItem ( reg->actionCell, WITHDRAW_STR); + xaccAddComboCellMenuItem ( reg->actionCell, CHECK_STR); + xaccAddComboCellMenuItem ( reg->actionCell, INT_STR); + xaccAddComboCellMenuItem ( reg->actionCell, ATM_STR); + xaccAddComboCellMenuItem ( reg->actionCell, TELLER_STR); + xaccAddComboCellMenuItem ( reg->actionCell, POS_STR); + xaccAddComboCellMenuItem ( reg->actionCell, ARU_STR); + xaccAddComboCellMenuItem ( reg->actionCell, ONLINE_STR); + xaccAddComboCellMenuItem ( reg->actionCell, ACH_STR); + xaccAddComboCellMenuItem ( reg->actionCell, WIRE_STR); + break; + case CASH_REGISTER: + xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); + xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); + break; + case ASSET_REGISTER: + xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); + xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); + break; + case CREDIT_REGISTER: + xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); + xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); + break; + case LIABILITY_REGISTER: + xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); + xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); + xaccAddComboCellMenuItem ( reg->actionCell, LOAN_STR); + xaccAddComboCellMenuItem ( reg->actionCell, INT_STR); + xaccAddComboCellMenuItem ( reg->actionCell, PAYMENT_STR); + break; + case INCOME_LEDGER: + case INCOME_REGISTER: + xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); + xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); + xaccAddComboCellMenuItem ( reg->actionCell, INT_STR); + xaccAddComboCellMenuItem ( reg->actionCell, PAYMENT_STR); + xaccAddComboCellMenuItem ( reg->actionCell, REBATE_STR); + break; + case EXPENSE_REGISTER: + xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); + xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); + break; + case GENERAL_LEDGER: + case EQUITY_REGISTER: + xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); + xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); + xaccAddComboCellMenuItem ( reg->actionCell, EQUITY_STR); + break; + case STOCK_REGISTER: + case PORTFOLIO: + case CURRENCY_REGISTER: + xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); + xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); + xaccAddComboCellMenuItem ( reg->actionCell, PRICE_STR); + xaccAddComboCellMenuItem ( reg->actionCell, DIV_STR); + xaccAddComboCellMenuItem ( reg->actionCell, INT_STR); + xaccAddComboCellMenuItem ( reg->actionCell, LTCG_STR); + xaccAddComboCellMenuItem ( reg->actionCell, STCG_STR); + xaccAddComboCellMenuItem ( reg->actionCell, DIST_STR); + xaccAddComboCellMenuItem ( reg->actionCell, SPLIT_STR); + break; + default: + xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); + xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); + break; + } +} + /* ============================================== */ #define SET(NAME,col,row,handler) \ @@ -688,28 +770,8 @@ xaccInitSplitRegister (SplitRegister *reg, int type) */ configTraverse (reg); - /* -------------------------------- */ /* add menu items for the action cell */ - - xaccAddComboCellMenuItem ( reg->actionCell, ATM_STR); - xaccAddComboCellMenuItem ( reg->actionCell, TELLER_STR); - xaccAddComboCellMenuItem ( reg->actionCell, CHECK_STR); - xaccAddComboCellMenuItem ( reg->actionCell, POS_STR); - xaccAddComboCellMenuItem ( reg->actionCell, ARU_STR); - xaccAddComboCellMenuItem ( reg->actionCell, ONLINE_STR); - xaccAddComboCellMenuItem ( reg->actionCell, ACH_STR); - xaccAddComboCellMenuItem ( reg->actionCell, WIRE_STR); - xaccAddComboCellMenuItem ( reg->actionCell, BUY_STR); - xaccAddComboCellMenuItem ( reg->actionCell, SELL_STR); - xaccAddComboCellMenuItem ( reg->actionCell, PRICE_STR); - xaccAddComboCellMenuItem ( reg->actionCell, DIV_STR); - xaccAddComboCellMenuItem ( reg->actionCell, INT_STR); - xaccAddComboCellMenuItem ( reg->actionCell, LTCG_STR); - xaccAddComboCellMenuItem ( reg->actionCell, STCG_STR); - xaccAddComboCellMenuItem ( reg->actionCell, DIST_STR); - xaccAddComboCellMenuItem ( reg->actionCell, SPLIT_STR); - xaccAddComboCellMenuItem ( reg->actionCell, DEPOSIT_STR); - xaccAddComboCellMenuItem ( reg->actionCell, WITHDRAW_STR); + configAction (reg); /* -------------------------------- */ phys_r = header->numRows;