*** empty log message ***

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2118 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2000-03-26 10:38:39 +00:00
parent ec0e4e0012
commit ee8c3d7718
9 changed files with 371 additions and 110 deletions
+16
View File
@@ -1,5 +1,21 @@
2000-03-26 Dave Peticolas <peticola@cs.ucdavis.edu>
* src/register/splitreg.c: several new functions for saving and
restore the contents of the cursor.
* src/SplitLedger.c (xaccSRRedrawRegEntry): always redraw, caller
knows best!
(LedgerMoveCursor): if we are leaving the pending transaction,
commit it.
(xaccSRLoadRegister): save and restore changed cursor values.
(xaccSRSaveRegEntry): clear the register change flags.
2000-03-24 Dave Peticolas <peticola@cs.ucdavis.edu>
* src/register/gnome/quickfillcell-gnome.c (QuickFillDirect): if
the cursor is in the selection, move it to the start of the
selection.
* Makefile.common: add the value of DEFS to the compile flags
* Makefile.init.in: get the value for DEFS.
+42 -15
View File
@@ -17,14 +17,14 @@ d'actions.
Gnucash est convenablement configur&eacute;, et l'ordinateur h&ocirc;te
est connect&eacute; sur internet, le programme <tt>gnc-prices</tt> peut
&ecirc;tre utilis&eacute; pour r&eacute;cup&eacute;rer&nbsp; les cotations
des cours d'actions ou FCP et SICAV &agrave; partir de divers sites web
directement dans GnuCash.
des cours d'actions et de fonds communs (pas de FCP et de SICAV pour la
france) &agrave; partir de divers sites web directement dans GnuCash.
<p>Pour utiliser cette fonctionnalit&eacute;, ce qui suit doit &ecirc;tre
fait:
<ul>
<li>
Cr&eacute;er un compte et marquer le comme &eacute;tant du type "FCP/SICAV"
ou "Actions".</li>
Cr&eacute;er un compte et marquer le comme &eacute;tant du type "Fonds
communs" ou "Actions".</li>
<li>
Entrer un code de titre valide (ndt : code SICOVAM en france) dans le champ
@@ -33,16 +33,43 @@ marqu&eacute; "Valeur:"</li>
<li>
S&eacute;lectionner une source de cotations depuis le menu d&eacute;roulant.
Actuellement les sources de cotations support&eacute;s incluent <b>Yahoo</b>,
<b>Fidelity
Investments</b>, <b>T. Rowe Price</b> et le <b>Vanguard Group</b>. Noter
que Yahoo fournira le cours des valeurs pour la plupart des fonds communs
, <i>incluant</i> Fidelity, T.Rowe Price and Vanguard, et que les valeurs
cot&eacute;es &agrave; Yahoo devrait &ecirc;tre identique &agrave; ceux
qui sont sur les sites sources.(Autrement, quelqu'un rapportera une mauvaise
information!)</li>
<b>Yahoo
Europe</b> , <b>Fidelity Investments</b>, <b>T. Rowe Price</b> et le <b>Vanguard
Group</b>. Noter que Yahoo fournira le cours des valeurs pour la plupart
des fonds communs , <i>incluant</i> Fidelity, T.Rowe Price and Vanguard,
et que les cours des valeurs cot&eacute;es &agrave; Yahoo devrait &ecirc;tre
identique &agrave; ceux qui sont sur les sites sources.(Autrement, quelqu'un
rapportera une mauvaise information!).Si vous choisissez Yahoo Europe,
vous devrez accoller le code du march&eacute; pour la valeur, tel que PA
pour Paris, BE pour Berlin, etc. Example: 12150.PA (la valeur Peugot au
march&eacute; de Paris).</li>
<li>
Liste des codes de march&eacute;s europ&eacute;ens:</li>
</ul>
Un exemple d'image est montr&eacute; ci-dessous:
<p><img SRC="Ticker-a.gif" NOSAVE height=347 width=405>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=PA>Paris
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=BC>Barcelone
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=BE>Berlin
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=BI>Bilbao
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=BM>Br&ecirc;me
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=CO>Copenhague
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=D>Dusseldorf
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=F>Francfort
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=H>Hambourg
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=HA>Hanovre
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=L>London
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=MA>Madrid
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=MC>Madrid
(M.C.)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=MI>Milan
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=MU>Munich
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=O>Oslo
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=ST>Stockholm
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=SG>Stuttgart
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=VA>Valence
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; value=FX>Xetra
<p>Un exemple d'image est montr&eacute; ci-dessous:
<p><img SRC="pix/TICKER-A.GIF" NOSAVE height=347 width=405>
<p>Pour mettre &agrave; jour les cours stock&eacute;s dans un fichier de
compte de gnucash, lancez en ligne de commande <tt>gnc-price</tt>, en specifiant
le nom du fichier; par exemple:
@@ -52,7 +79,7 @@ vers l'&eacute;cran tandis qu'elle chargera les donn&eacute;es. Elle fonctionner
seulement quand l'ordinateur h&ocirc;te est connect&eacute; &agrave; internet.
Elle <i>peut</i> fonctionner ensemble avec un parefeu/firewall de style
masqu&eacute;. Elle ne fonctionne pas actuellement depuis derri&egrave;re
un proxy ou des parefeu de style socks.
des parefeu de style socks.
<p>La commande peut &ecirc;tre lanc&eacute;e plusieurs fois dans une journ&eacute;e;&nbsp;
pourtant, elle mettra les comptes &agrave; jour au maximum une fois avec
les plus r&eacute;centes donn&eacute;es du cours des &eacute;changes de
@@ -68,7 +95,7 @@ marquez simplement les donn&eacute;es source pour ce compte comme "(aucun)".
Vous pouvez le faire depuis la fen&ecirc;tre "<tt>Afficher un compte</tt>".
<p>Apr&egrave;s avoir lanc&eacute; gnc-prices pendant quelques jours, vos
comptes commenceront &agrave; ressembler&nbsp; &agrave; ce qui suit:
<p><img SRC="Ticker-b.gif" NOSAVE height=372 width=881>
<p><img SRC="pix/TICKER-B.GIF" NOSAVE height=372 width=881>
<hr>
<br>Retour &agrave; la <a href="xacc-main.html">Page principale de la documentation.</a>
</body>
+12 -18
View File
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: gnucash 1.3.3\n"
"POT-Creation-Date: 2000-03-24 14:08-0800\n"
"PO-Revision-Date: 2000-03-23 22:24+0200\n"
"PO-Revision-Date: 2000-03-25 10:05+0200\n"
"Last-Translator: Yannick LE NY <y-le-ny@ifrance.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
@@ -2005,7 +2005,7 @@ msgstr "Affichage du format de date"
#: po/guile_strings.txt:114
msgid "Ending"
msgstr "Final"
msgstr "Fin"
#: po/guile_strings.txt:115
msgid "Reversed-balance account types"
@@ -2799,49 +2799,43 @@ msgstr "Fonds communs"
#: src/gnome/glade-gnc-dialogs.c:786
msgid "Print Dialog"
msgstr ""
msgstr "Dialogue d'impression"
#: src/gnome/glade-gnc-dialogs.c:794
#, fuzzy
msgid "Print Setup"
msgstr "Imprimer chèque"
msgstr "Configuration imprimante"
#: src/gnome/glade-gnc-dialogs.c:815
#, fuzzy
msgid "Printer:"
msgstr "Imprimer"
msgstr "Imprimante:"
#: src/gnome/glade-gnc-dialogs.c:823
msgid "Paper size:"
msgstr ""
msgstr "Taille papier:"
#: src/gnome/glade-gnc-dialogs.c:831
msgid "Pages to print:"
msgstr ""
msgstr "Pages à imprimer:"
#: src/gnome/glade-gnc-dialogs.c:876
msgid "All"
msgstr ""
msgstr "Tous"
#: src/gnome/glade-gnc-dialogs.c:884
#, fuzzy
msgid "Selected"
msgstr "Sélectionner un fichier"
msgstr "Sélectionné"
#: src/gnome/glade-gnc-dialogs.c:906
#, fuzzy
msgid "From:"
msgstr "Depuis"
msgstr "Depuis:"
#: src/gnome/glade-gnc-dialogs.c:921
#, fuzzy
msgid "To:"
msgstr "Vers"
msgstr "Vers:"
#: src/gnome/glade-gnc-dialogs.c:943 src/gnome/glade-gnc-dialogs.c:950
#, fuzzy
msgid "Select..."
msgstr "Tout sélectionner"
msgstr "Sélectionner..."
#: src/gnome/glade-gnc-dialogs.c:986
msgid "Preview"
+107 -71
View File
@@ -218,14 +218,14 @@ xaccSRGetInfo(SplitRegister *reg)
static gncUIWidget
xaccSRGetParent(SplitRegister *reg)
{
SRInfo *info = xaccSRGetInfo(reg);
SRInfo *info = xaccSRGetInfo(reg);
assert(reg != NULL);
assert(reg != NULL);
if (info->get_parent == NULL)
return NULL;
if (info->get_parent == NULL)
return NULL;
return (info->get_parent)(info->user_data);
return (info->get_parent)(info->user_data);
}
void
@@ -233,13 +233,13 @@ xaccSRSetData(SplitRegister *reg, void *user_data,
SRGetParentCallback get_parent,
SRSetHelpCallback set_help)
{
SRInfo *info = xaccSRGetInfo(reg);
SRInfo *info = xaccSRGetInfo(reg);
assert(reg != NULL);
assert(reg != NULL);
info->user_data = user_data;
info->get_parent = get_parent;
info->set_help = set_help;
info->user_data = user_data;
info->get_parent = get_parent;
info->set_help = set_help;
}
void
@@ -339,62 +339,78 @@ gnc_copy_trans(Transaction *from, Transaction *to)
*/
static void
LedgerMoveCursor (Table *table,
int *p_new_phys_row,
int *p_new_phys_col,
void * client_data)
LedgerMoveCursor (Table *table,
int *p_new_phys_row,
int *p_new_phys_col,
void * client_data)
{
int new_phys_row = *p_new_phys_row;
int new_phys_col = *p_new_phys_col;
SplitRegister *reg = (SplitRegister *) client_data;
Transaction *newtrans = NULL;
Locator *locator;
int style;
int new_phys_row = *p_new_phys_row;
int new_phys_col = *p_new_phys_col;
SplitRegister *reg = (SplitRegister *) client_data;
SRInfo *info = xaccSRGetInfo(reg);
Transaction *newtrans;
Transaction *trans;
gncBoolean saved;
Locator *locator;
int style;
PINFO ("LedgerMoveCursor(): start callback %d %d \n",
new_phys_row, new_phys_col);
PINFO ("LedgerMoveCursor(): start callback %d %d \n",
new_phys_row, new_phys_col);
/* The transaction where we are moving to */
newtrans = xaccSRGetTrans(reg, new_phys_row, new_phys_col);
/* The transaction we are coming from */
trans = xaccSRGetCurrentTrans(reg);
/* commit the contents of the cursor into the database */
xaccSRSaveRegEntry (reg, newtrans);
xaccSRRedrawRegEntry (reg);
/* The transaction where we are moving to */
newtrans = xaccSRGetTrans(reg, new_phys_row, new_phys_col);
PINFO ("LedgerMoveCursor(): after redraw %d %d \n",
new_phys_row, new_phys_col);
/* commit the contents of the cursor into the database */
saved = xaccSRSaveRegEntry (reg, newtrans);
if ((info->pending_trans != NULL) &&
(info->pending_trans == trans) &&
(trans != newtrans))
{
xaccTransCommitEdit (trans);
info->pending_trans = NULL;
saved = GNC_T;
}
reg->cursor_phys_row = new_phys_row;
reg->cursor_phys_col = new_phys_col;
if (saved)
xaccSRRedrawRegEntry (reg);
locator = table->locators[new_phys_row][new_phys_col];
reg->cursor_virt_row = locator->virt_row;
PINFO ("LedgerMoveCursor(): after redraw %d %d \n",
new_phys_row, new_phys_col);
/* 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.
*/
style = ((reg->type) & REG_STYLE_MASK);
if ((REG_SINGLE_DYNAMIC == style) ||
(REG_DOUBLE_DYNAMIC == style))
{
Split *split;
reg->cursor_phys_row = new_phys_row;
reg->cursor_phys_col = new_phys_col;
split = xaccGetUserData (reg->table, new_phys_row, new_phys_col);
reg->table->current_cursor->user_data = (void *) split;
locator = table->locators[new_phys_row][new_phys_col];
reg->cursor_virt_row = locator->virt_row;
xaccRegisterRefresh (reg);
gnc_refresh_main_window();
/* 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.
*/
style = ((reg->type) & REG_STYLE_MASK);
if ((REG_SINGLE_DYNAMIC == style) ||
(REG_DOUBLE_DYNAMIC == style))
{
Split *split;
/* indicate what row we *should* have gone to */
*p_new_phys_row = table->current_cursor_phys_row;
*p_new_phys_col = table->current_cursor_phys_col;
split = xaccGetUserData (reg->table, new_phys_row, new_phys_col);
reg->table->current_cursor->user_data = (void *) split;
PINFO ("LedgerMoveCursor(): after dynamic %d %d stored val %d\n",
*p_new_phys_row, *p_new_phys_col, reg->cursor_phys_row);
}
xaccRegisterRefresh (reg);
gnc_refresh_main_window();
/* indicate what row we *should* have gone to */
*p_new_phys_row = table->current_cursor_phys_row;
*p_new_phys_col = table->current_cursor_phys_col;
PINFO ("LedgerMoveCursor(): after dynamic %d %d stored val %d\n",
*p_new_phys_row, *p_new_phys_col, reg->cursor_phys_row);
}
}
/* ======================================================== */
@@ -1076,22 +1092,15 @@ void
xaccSRRedrawRegEntry (SplitRegister *reg)
{
Transaction *trans;
unsigned int changed;
/* use the changed flag to avoid heavy-weight redraws
* This will help cut down on uneccessary register redraws. */
changed = xaccSplitRegisterGetChangeFlag (reg);
if (!changed) return;
trans = xaccSRGetCurrentTrans (reg);
/* refresh the register windows */
/* This split belongs to a transaction that might be displayed
* in any number of windows. Changing any one split is likely
* in any number of windows. Changing any one split is likely
* to affect any account windows associated with the other splits
* in this transaction. So basically, send redraw events to all
* of the splits.
*/
* in this transaction. So basically, send redraw events to all
* of the splits. */
gnc_transaction_ui_refresh(trans);
gnc_refresh_main_window();
}
@@ -1112,7 +1121,8 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
* of the split & transaction fields. This will help
* cut down on uneccessary register redraws. */
changed = xaccSplitRegisterGetChangeFlag (reg);
if (!changed) return GNC_F;
if (!changed)
return GNC_F;
style = (reg->type) & REG_STYLE_MASK;
@@ -1426,6 +1436,8 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
info->pending_trans = NULL;
}
xaccSplitRegisterClearChangeFlag(reg);
return GNC_T;
}
@@ -1581,7 +1593,7 @@ xaccSRLoadRegEntry (SplitRegister *reg, Split *split)
/* ======================================================== */
static void
static gncBoolean
xaccSRCountRows (SplitRegister *reg, Split **slist)
{
SRInfo *info = xaccSRGetInfo(reg);
@@ -1659,9 +1671,8 @@ 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.
*/
/* 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));
@@ -1762,6 +1773,8 @@ xaccSRCountRows (SplitRegister *reg, Split **slist)
reg->num_virt_rows = num_virt_rows;
reg->cursor_phys_row = save_cursor_phys_row;
reg->cursor_virt_row = save_cursor_virt_row;
return found_split;
}
/* ======================================================== */
@@ -1782,6 +1795,9 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
int multi_line, dynamic;
CellBlock *lead_cursor;
gncBoolean found_pending = GNC_F;
gncBoolean found_current = GNC_F;
SplitRegisterBuffer *reg_buffer;
unsigned int changed;
xaccSplitRegisterConfigColors (reg);
@@ -1810,7 +1826,19 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
info->cursor_hint_trans = xaccSRGetCurrentTrans(reg);
/* count the number of rows */
xaccSRCountRows (reg, slist);
found_current = xaccSRCountRows (reg, slist);
/* 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)
{
reg_buffer = xaccMallocSplitRegisterBuffer();
xaccSplitRegisterSaveCursor(reg, reg_buffer);
}
else
reg_buffer = NULL;
/* disable move callback -- we con't want the cascade of
* callbacks while we are fiddling with loading the register */
@@ -1873,7 +1901,7 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
phys_row += reg->trans_cursor->numRows;
/* loop over all of the splits in the transaction. The
* do..while will automaticaly put a blank (null) split
* do..while will automatically put a blank (null) split
* at the end. */
trans = xaccSplitGetParent (split);
j = 0;
@@ -1979,6 +2007,14 @@ xaccSRLoadRegister (SplitRegister *reg, Split **slist,
xaccMoveCursorGUI(table, row, col);
reg->cursor_phys_row = row;
reg->cursor_phys_col = col;
if (reg_buffer != NULL)
{
xaccSplitRegisterRestoreCursorChanged(reg, reg_buffer);
xaccCommitCursor (reg->table);
xaccDestroySplitRegisterBuffer(reg_buffer);
reg_buffer = NULL;
}
}
}
+1 -1
View File
@@ -60,7 +60,7 @@
* XACC_CELL_ALLOW_SHADOW copy ("shadow") the contents
* of register cells.
*
* If ALLOW_INPUT is not set, the cell is supposed to
* If ALLOW_INPUT is not set, the cell is supposed to
* to only display values, but not accept user input. If
* set, then the callbacks below are used to when the
* cell is entered.
+10 -1
View File
@@ -16,7 +16,9 @@
/* quickfillcell-gnome.c
*
* Implements gnome dependant quickfill cell functions.
* Implements gnome dependent quickfill cell functions.
*
* Copyright (C) 2000 Dave Peticolas <peticola@cs.ucdavis.edu>
*/
#include "config.h"
@@ -58,6 +60,13 @@ QuickFillDirect (BasicCell *bcell,
return GNC_F;
}
if ((*start_selection <= *cursor_position) &&
(*end_selection >= *cursor_position))
*cursor_position = *start_selection;
else if ((*end_selection <= *cursor_position) &&
(*start_selection >= *cursor_position))
*cursor_position = *end_selection;
match = xaccGetQuickFillStrLen(cell->qfRoot, oldval, *cursor_position);
if (match == NULL)
return GNC_T;
+171
View File
@@ -43,6 +43,34 @@
/* This static indicates the debugging module that this .o belongs to. */
static short module = MOD_REGISTER;
typedef struct _CellBuffer CellBuffer;
struct _CellBuffer
{
char * value;
unsigned int changed;
};
struct _SplitRegisterBuffer
{
CellBuffer dateCell;
CellBuffer numCell;
CellBuffer descCell;
CellBuffer recnCell;
CellBuffer shrsCell;
CellBuffer balanceCell;
CellBuffer actionCell;
CellBuffer xfrmCell;
CellBuffer mxfrmCell;
CellBuffer xtoCell;
CellBuffer memoCell;
CellBuffer creditCell;
CellBuffer debitCell;
CellBuffer priceCell;
CellBuffer valueCell;
CellBuffer ncreditCell;
CellBuffer ndebitCell;
};
static SplitRegisterColors reg_colors = {
0xffdddd, /* pale red, single cursor active */
0xccccff, /* pale blue, single cursor passive */
@@ -1227,4 +1255,147 @@ xaccSplitRegisterGetCursorType (SplitRegister *reg)
return CURSOR_NONE;
}
/* ============================================== */
SplitRegisterBuffer *
xaccMallocSplitRegisterBuffer ()
{
SplitRegisterBuffer *srb;
srb = calloc(1, sizeof(SplitRegisterBuffer));
assert(srb != NULL);
return srb;
}
/* ============================================== */
static void
destroyCellBuffer(CellBuffer *cb)
{
if (cb == NULL)
return;
if (cb->value != NULL)
free(cb->value);
cb->value = NULL;
}
void
xaccDestroySplitRegisterBuffer (SplitRegisterBuffer *srb)
{
if (srb == NULL)
return;
destroyCellBuffer(&srb->dateCell);
destroyCellBuffer(&srb->numCell);
destroyCellBuffer(&srb->descCell);
destroyCellBuffer(&srb->recnCell);
destroyCellBuffer(&srb->shrsCell);
destroyCellBuffer(&srb->balanceCell);
destroyCellBuffer(&srb->actionCell);
destroyCellBuffer(&srb->xfrmCell);
destroyCellBuffer(&srb->mxfrmCell);
destroyCellBuffer(&srb->xtoCell);
destroyCellBuffer(&srb->memoCell);
destroyCellBuffer(&srb->creditCell);
destroyCellBuffer(&srb->debitCell);
destroyCellBuffer(&srb->priceCell);
destroyCellBuffer(&srb->valueCell);
destroyCellBuffer(&srb->ncreditCell);
destroyCellBuffer(&srb->ndebitCell);
free(srb);
}
/* ============================================== */
static void
saveCell(BasicCell *bcell, CellBuffer *cb)
{
if ((bcell == NULL) || (cb == NULL))
return;
if (cb->value != NULL)
free(cb->value);
cb->value = bcell->value;
if (cb->value != NULL)
{
cb->value = strdup(cb->value);
assert(cb->value != NULL);
}
cb->changed = bcell->changed;
}
void
xaccSplitRegisterSaveCursor(SplitRegister *sr, SplitRegisterBuffer *srb)
{
if ((sr == NULL) || (srb == NULL))
return;
saveCell(&sr->dateCell->cell, &srb->dateCell);
saveCell(&sr->numCell->cell, &srb->numCell);
saveCell(&sr->descCell->cell, &srb->descCell);
saveCell(sr->recnCell, &srb->recnCell);
saveCell(&sr->shrsCell->cell, &srb->shrsCell);
saveCell(&sr->balanceCell->cell, &srb->balanceCell);
saveCell(&sr->actionCell->cell, &srb->actionCell);
saveCell(&sr->xfrmCell->cell, &srb->xfrmCell);
saveCell(&sr->mxfrmCell->cell, &srb->mxfrmCell);
saveCell(&sr->xtoCell->cell, &srb->xtoCell);
saveCell(&sr->memoCell->cell, &srb->memoCell);
saveCell(&sr->creditCell->cell, &srb->creditCell);
saveCell(&sr->debitCell->cell, &srb->debitCell);
saveCell(&sr->priceCell->cell, &srb->priceCell);
saveCell(&sr->valueCell->cell, &srb->valueCell);
saveCell(&sr->ncreditCell->cell, &srb->ncreditCell);
saveCell(&sr->ndebitCell->cell, &srb->ndebitCell);
}
/* ============================================== */
static void
restoreCellChanged(BasicCell *bcell, CellBuffer *cb)
{
if ((bcell == NULL) || (cb == NULL))
return;
if (cb->changed)
{
xaccSetBasicCellValue(bcell, cb->value);
bcell->changed = cb->changed;
}
}
void
xaccSplitRegisterRestoreCursorChanged(SplitRegister *sr,
SplitRegisterBuffer *srb)
{
if ((sr == NULL) || (srb == NULL))
return;
restoreCellChanged(&sr->dateCell->cell, &srb->dateCell);
restoreCellChanged(&sr->numCell->cell, &srb->numCell);
restoreCellChanged(&sr->descCell->cell, &srb->descCell);
restoreCellChanged(sr->recnCell, &srb->recnCell);
restoreCellChanged(&sr->shrsCell->cell, &srb->shrsCell);
restoreCellChanged(&sr->balanceCell->cell, &srb->balanceCell);
restoreCellChanged(&sr->actionCell->cell, &srb->actionCell);
restoreCellChanged(&sr->xfrmCell->cell, &srb->xfrmCell);
restoreCellChanged(&sr->mxfrmCell->cell, &srb->mxfrmCell);
restoreCellChanged(&sr->xtoCell->cell, &srb->xtoCell);
restoreCellChanged(&sr->memoCell->cell, &srb->memoCell);
restoreCellChanged(&sr->creditCell->cell, &srb->creditCell);
restoreCellChanged(&sr->debitCell->cell, &srb->debitCell);
restoreCellChanged(&sr->priceCell->cell, &srb->priceCell);
restoreCellChanged(&sr->valueCell->cell, &srb->valueCell);
restoreCellChanged(&sr->ncreditCell->cell, &srb->ncreditCell);
restoreCellChanged(&sr->ndebitCell->cell, &srb->ndebitCell);
}
/* ============ END OF FILE ===================== */
+11 -2
View File
@@ -22,7 +22,7 @@
* Implements a basic display register/ledger.
* This object makes specific cell have specific properties
* (price, text, date, etc). and specific names that correspond.
* it also determines the actual phyisical layout, arrengement
* it also determines the actual physical layout, arrangement
* of columns, etc.
*
* Handles splits
@@ -79,7 +79,7 @@
* REG_MULTI_LINE -- show multiple lines per transaction
* REG_DYNAMIC -- dynamically expand edited transaction
*/
#define REG_SINGLE_LINE (1 << 8)
#define REG_DOUBLE_LINE (2 << 8)
#define REG_MULTI_LINE (3 << 8)
@@ -119,6 +119,7 @@ typedef enum
*/
#define NUM_CELLS 25
typedef struct _SplitRegisterBuffer SplitRegisterBuffer;
typedef struct _SplitRegister SplitRegister;
struct _SplitRegister {
@@ -222,6 +223,14 @@ void xaccSplitRegisterClearChangeFlag (SplitRegister *reg);
/* Returns the type of the current cursor */
CursorType xaccSplitRegisterGetCursorType (SplitRegister *reg);
/* Functions for working with split register buffers */
SplitRegisterBuffer * xaccMallocSplitRegisterBuffer ();
void xaccDestroySplitRegisterBuffer (SplitRegisterBuffer *srb);
void xaccSplitRegisterSaveCursor(SplitRegister *sr, SplitRegisterBuffer *srb);
void xaccSplitRegisterRestoreCursorChanged(SplitRegister *sr,
SplitRegisterBuffer *srb);
#endif /* __XACC_SPLITREG_H__ */
+1 -2
View File
@@ -353,10 +353,9 @@ xaccSetCursor (Table *table, CellBlock *curs,
table->rev_locators[virt_row][virt_col]->phys_row = phys_row_origin;
table->rev_locators[virt_row][virt_col]->phys_col = phys_col_origin;
/* intialize the mapping so that we will be able to find
* the handler, given this range of physical cell addressses */
* the handler, given this range of physical cell addresses */
for (i=0; i<curs->numRows; i++) {
for (j=0; j<curs->numCols; j++) {
Locator *loc;