*** empty log message ***

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2049 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2000-03-02 10:05:15 +00:00
parent 7c236888f1
commit 14e55303e1
5 changed files with 80 additions and 25 deletions

View File

@@ -1,5 +1,18 @@
2000-03-02 Dave Peticolas <peticola@cs.ucdavis.edu>
* src/gnome/reconcile-list.c (gnc_reconcile_list_init): print
selected 'y' reconcile flags in yellow for better contrast.
(gnc_reconcile_list_unselect_row): don't unselect the row if we
are toggling the current row.
* src/gnome/window-reconcile.c (recnRecalculateBalance): reverse the
balance if appropriate.
2000-03-01 Dave Peticolas <peticola@cs.ucdavis.edu>
* src/gnome/window-adjust.c (gnc_ui_AdjBWindow_ok_cb): reverse the
balance if appropriate.
* src/scm/extensions.scm: add the extensions menu if debugging.
* src/scm/bootstrap.scm: new function to check debugging status.

View File

@@ -2,7 +2,7 @@
* reconcile-list.c -- A list of accounts to be reconciled for *
* GnuCash. *
* Copyright (C) 1998,1999 Jeremy Collins *
* Copyright (C) 1998,1999 Linas Vepstas *
* Copyright (C) 1998-2000 Linas Vepstas *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -105,6 +105,7 @@ gnc_reconcile_list_init(GNCReconcileList *list)
list->current_row = -1;
list->current_split = NULL;
list->no_toggle = FALSE;
list->always_unselect = FALSE;
while (titles[list->num_columns] != NULL)
list->num_columns++;
@@ -150,7 +151,12 @@ gnc_reconcile_list_init(GNCReconcileList *list)
gdk_colormap_alloc_color(cm, &style->fg[GTK_STATE_NORMAL], FALSE, TRUE);
style->fg[GTK_STATE_SELECTED] = style->fg[GTK_STATE_NORMAL];
/* A nice yellow */
style->fg[GTK_STATE_SELECTED].red = 65280;
style->fg[GTK_STATE_SELECTED].green = 62976;
style->fg[GTK_STATE_SELECTED].blue = 36608;
gdk_colormap_alloc_color(cm, &style->fg[GTK_STATE_SELECTED], FALSE, TRUE);
#endif
}
}
@@ -212,7 +218,7 @@ gnc_reconcile_list_toggle(GNCReconcileList *list)
char recn;
gint row;
assert(GTK_IS_GNC_RECONCILE_LIST(list));
assert(IS_GNC_RECONCILE_LIST(list));
assert(list->reconciled != NULL);
if (list->no_toggle)
@@ -222,10 +228,7 @@ gnc_reconcile_list_toggle(GNCReconcileList *list)
split = gtk_clist_get_row_data(GTK_CLIST(list), row);
current = g_hash_table_lookup(list->reconciled, split);
if (list->current_split != split)
list->current_split = split;
else
list->current_split = NULL;
list->current_split = split;
if (current == NULL)
{
@@ -268,7 +271,11 @@ gnc_reconcile_list_unselect_row(GtkCList *clist, gint row, gint column,
GNCReconcileList *list = GNC_RECONCILE_LIST(clist);
if (row == list->current_row)
{
gnc_reconcile_list_toggle(list);
if (!list->always_unselect)
return;
}
GTK_CLIST_CLASS(parent_class)->unselect_row(clist, row, column, event);
}
@@ -297,7 +304,8 @@ gnc_reconcile_list_destroy(GtkObject *object)
gint
gnc_reconcile_list_get_row_height(GNCReconcileList *list)
{
assert(GTK_IS_GNC_RECONCILE_LIST(list));
g_return_val_if_fail(list != NULL, 0);
g_return_val_if_fail(IS_GNC_RECONCILE_LIST(list), 0);
if (!GTK_WIDGET_REALIZED(list))
return 0;
@@ -310,7 +318,8 @@ gnc_reconcile_list_get_row_height(GNCReconcileList *list)
gint
gnc_reconcile_list_get_num_splits(GNCReconcileList *list)
{
assert(GTK_IS_GNC_RECONCILE_LIST(list));
g_return_val_if_fail(list != NULL, 0);
g_return_val_if_fail(IS_GNC_RECONCILE_LIST(list), 0);
return list->num_splits;
}
@@ -318,7 +327,8 @@ gnc_reconcile_list_get_num_splits(GNCReconcileList *list)
Split *
gnc_reconcile_list_get_current_split(GNCReconcileList *list)
{
assert(GTK_IS_GNC_RECONCILE_LIST(list));
g_return_val_if_fail(list != NULL, NULL);
g_return_val_if_fail(IS_GNC_RECONCILE_LIST(list), NULL);
return list->current_split;
}
@@ -339,7 +349,8 @@ gnc_reconcile_list_refresh(GNCReconcileList *list)
Split *old_split;
gint new_row;
assert(GTK_IS_GNC_RECONCILE_LIST(list));
g_return_if_fail(list != NULL);
g_return_if_fail(IS_GNC_RECONCILE_LIST(list));
adjustment = gtk_clist_get_vadjustment(GTK_CLIST(list));
if (adjustment != NULL)
@@ -396,7 +407,8 @@ gnc_reconcile_list_reconciled_balance(GNCReconcileList *list)
int account_type;
int i;
assert(GTK_IS_GNC_RECONCILE_LIST(list));
g_return_val_if_fail(list != NULL, 0.0);
g_return_val_if_fail(IS_GNC_RECONCILE_LIST(list), 0.0);
if (list->reconciled == NULL)
return 0.0;
@@ -434,7 +446,8 @@ gnc_reconcile_list_commit(GNCReconcileList *list)
Split *split;
int i;
assert(GTK_IS_GNC_RECONCILE_LIST(list));
g_return_if_fail(list != NULL);
g_return_if_fail(IS_GNC_RECONCILE_LIST(list));
if (list->reconciled == NULL)
return;
@@ -459,10 +472,15 @@ gnc_reconcile_list_commit(GNCReconcileList *list)
void
gnc_reconcile_list_unselect_all(GNCReconcileList *list)
{
GtkCList *clist = GTK_CLIST(list);
g_return_if_fail(list != NULL);
g_return_if_fail(IS_GNC_RECONCILE_LIST(list));
list->no_toggle = TRUE;
gtk_clist_unselect_all(clist);
list->always_unselect = TRUE;
gtk_clist_unselect_all(GTK_CLIST(list));
list->always_unselect = FALSE;
list->no_toggle = FALSE;
list->current_split = NULL;
@@ -480,7 +498,7 @@ gboolean
gnc_reconcile_list_changed(GNCReconcileList *list)
{
g_return_val_if_fail(list != NULL, FALSE);
g_return_val_if_fail(GTK_IS_GNC_RECONCILE_LIST(list), FALSE);
g_return_val_if_fail(IS_GNC_RECONCILE_LIST(list), FALSE);
return g_hash_table_size(list->reconciled) != 0;
}

View File

@@ -29,8 +29,8 @@ extern "C" {
#define GTK_TYPE_GNC_RECONCILE_LIST (gnc_reconcile_list_get_type ())
#define GNC_RECONCILE_LIST(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_GNC_RECONCILE_LIST, GNCReconcileList))
#define GNC_RECONCILE_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_GNC_RECONCILE_LIST, GNCReconcileListClass))
#define GTK_IS_GNC_RECONCILE_LIST(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_GNC_RECONCILE_LIST))
#define GTK_IS_GNC_RECONCILE_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_GNC_RECONCILE_LIST))
#define IS_GNC_RECONCILE_LIST(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_GNC_RECONCILE_LIST))
#define IS_GNC_RECONCILE_LIST_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_GNC_RECONCILE_LIST))
typedef struct _GNCReconcileList GNCReconcileList;
typedef struct _GNCReconcileListClass GNCReconcileListClass;
@@ -45,7 +45,7 @@ struct _GNCReconcileList
{
GtkCList clist;
gint list_type; /* DEBIT or CREDIT */
GNCReconcileListType list_type;
gint num_splits;
gint num_columns;
@@ -54,6 +54,7 @@ struct _GNCReconcileList
Split *current_split;
gboolean no_toggle;
gboolean always_unselect;
GHashTable *reconciled;
@@ -95,6 +96,9 @@ void gnc_reconcile_list_unselect_all(GNCReconcileList *list);
gboolean gnc_reconcile_list_changed(GNCReconcileList *list);
void gnc_reconcile_list_set_selection_mode(GNCReconcileList *list,
GtkSelectionMode mode);
#ifdef __cplusplus
}

View File

@@ -1,7 +1,7 @@
/********************************************************************\
* window-adjust.c -- the adjust balance window *
* Copyright (C) 1997 Robin D. Clark *
* Copyright (C) 1998 Linas Vepstas *
* Copyright (C) 1998-2000 Linas Vepstas *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -28,6 +28,7 @@
#include <gnome.h>
#include <time.h>
#include "gnome-top-level.h"
#include "ui-callbacks.h"
#include "MultiLedger.h"
#include "AdjBWindow.h"
@@ -93,6 +94,8 @@ gnc_ui_AdjBWindow_ok_cb(GtkWidget * widget, gpointer data)
string = gtk_entry_get_text(GTK_ENTRY(adjBData->balance_entry));
new_balance = xaccParseAmount(string, GNC_T);
if (gnc_reverse_balance(adjBData->account))
new_balance = -new_balance;
time = gnome_date_edit_get_date(GNOME_DATE_EDIT(adjBData->date_entry));

View File

@@ -1,6 +1,7 @@
/********************************************************************\
* window-reconcile.c -- the reconcile window *
* Copyright (C) 1997 Robin D. Clark *
* Copyright (C) 1998-2000 Linas Vepstas *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
@@ -29,7 +30,7 @@
#include <stdio.h>
#include <gnome.h>
#include "date.h"
#include "gnome-top-level.h"
#include "MultiLedger.h"
#include "MainWindow.h"
#include "RegWindow.h"
@@ -47,6 +48,7 @@
#include "AdjBWindow.h"
#include "Scrub.h"
#include "util.h"
#include "date.h"
/** STRUCTS *********************************************************/
@@ -148,14 +150,20 @@ recnRecalculateBalance(RecnWindow *recnData)
double dcredit = 0.0;
double ddiff = 0.0;
short shares = PRTSYM | PRTSEP;
gboolean reverse_balance;
int account_type;
reverse_balance = gnc_reverse_balance(recnData->account);
account_type = xaccAccountGetType(recnData->account);
if ((account_type == STOCK ) || (account_type == MUTUAL) ||
(account_type == CURRENCY))
shares |= PRTSHR;
value = xaccAccountGetReconciledBalance(recnData->account);
if (reverse_balance)
value = -value;
amount = xaccPrintAmount(value, shares);
gnc_set_label_color(recnData->starting, value);
gtk_label_set_text(GTK_LABEL(recnData->starting), amount);
@@ -167,8 +175,13 @@ recnRecalculateBalance(RecnWindow *recnData)
ddebit = gnc_reconcile_list_reconciled_balance
(GNC_RECONCILE_LIST(recnData->debit));
if (reverse_balance)
ddebit = -ddebit;
dcredit = gnc_reconcile_list_reconciled_balance
(GNC_RECONCILE_LIST(recnData->credit));
if (reverse_balance)
dcredit = -dcredit;
/* Update the difference field, and the total fields */
amount = xaccPrintAmount(DABS(ddebit), shares);
@@ -237,6 +250,8 @@ startRecnWindow(GtkWidget *parent, Account *account, double *diff)
* may have to be adjusted for stock price fluctuations.
*/
dendBalance = xaccAccountGetReconciledBalance(account);
if (gnc_reverse_balance(account))
dendBalance = -dendBalance;
account_type = xaccAccountGetType(account);
if ((account_type == STOCK) || (account_type == MUTUAL) ||
@@ -368,15 +383,18 @@ gnc_reconcile_window_focus_cb(GtkWidget *widget, GdkEventFocus *event,
gpointer data)
{
RecnWindow *recnData = (RecnWindow *) data;
GNCReconcileList *this_list, *debit, *credit;
GNCReconcileList *this_list, *other_list;
GNCReconcileList *debit, *credit;
this_list = GNC_RECONCILE_LIST(widget);
debit = GNC_RECONCILE_LIST(recnData->debit);
credit = GNC_RECONCILE_LIST(recnData->credit);
other_list = GNC_RECONCILE_LIST(this_list == debit ? credit : debit);
/* clear the *other* list so we always have no more than one selection */
gnc_reconcile_list_unselect_all((this_list == debit) ? credit : debit);
gnc_reconcile_list_unselect_all(other_list);
}
static GtkWidget *
@@ -520,8 +538,7 @@ gnc_ui_reconcile_window_delete_cb(GtkButton *button, gpointer data)
/* make a copy of all of the accounts that will be
* affected by this deletion, so that we can update
* their register windows after the deletion.
*/
* their register windows after the deletion. */
trans = xaccSplitGetParent(split);
num_splits = xaccTransCountSplits(trans);
affected_accounts = (Account **) malloc((num_splits + 1) *