Register rewrite Update, adds print check, find, schedule and reconcile. This update changes adds the print check, find transactions, schedule transactions and reconcile options to the new register. This was done by copying the existing files and changing them to work with the new register so both new and old could work at the same time. The new find option on the accounts page has been commented out so the old one would work but has been proved to work the same as on the new registers. Also have the refresh option working which involves reloading the register by re-running the query which is also used for the search register updates. Author: Robert Fewell

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@22885 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2013-04-07 22:14:31 +00:00
parent a83aec6fbe
commit e6f6bcd87c
17 changed files with 6017 additions and 531 deletions

View File

@ -180,11 +180,13 @@ src/gnome/assistant-stock-split.c
src/gnome/dialog-commodities.c
src/gnome/dialog-fincalc.c
src/gnome/dialog-find-transactions.c
src/gnome/dialog-find-transactions2.c
src/gnome/dialog-lot-viewer.c
src/gnome/dialog-new-user.c
src/gnome/dialog-price-edit-db.c
src/gnome/dialog-price-editor.c
src/gnome/dialog-print-check.c
src/gnome/dialog-print-check2.c
src/gnome/dialog-progress.c
src/gnome/dialog-sx-editor.c
src/gnome/dialog-sx-from-trans.c
@ -350,6 +352,7 @@ src/gnome-utils/search-param.c
src/gnome-utils/window-main-summarybar.c
src/gnome/window-autoclear.c
src/gnome/window-reconcile.c
src/gnome/window-reconcile2.c
src/html/gnc-html.c
src/html/gnc-html-factory.c
src/html/gnc-html-history.c

View File

@ -159,8 +159,9 @@ gtc_is_trans_readonly_and_warn (GncTreeViewSplitReg *view, Transaction *trans)
/* Transaction is being edited dialog */
static gboolean
gtc_trans_open_and_warn (GncTreeViewSplitReg *view, Transaction *trans)
#define gtc_trans_open_and_warn gnc_tree_control_split_reg_trans_open_and_warn
gboolean
gnc_tree_control_split_reg_trans_open_and_warn (GncTreeViewSplitReg *view, Transaction *trans)
{
Transaction *dirty_trans;
GtkWidget *window;
@ -201,7 +202,8 @@ gtc_trans_open_and_warn (GncTreeViewSplitReg *view, Transaction *trans)
}
static gboolean
#define gtc_trans_test_for_edit gnc_tree_control_split_reg_trans_test_for_edit
gboolean
gtc_trans_test_for_edit (GncTreeViewSplitReg *view, Transaction *trans)
{
GtkWidget *window;
@ -503,6 +505,85 @@ gnc_tree_control_split_reg_exchange_rate (GncTreeViewSplitReg *view)
}
#ifdef skip
/**
* Schedules the current transaction for recurring-entry.
* If the selected transaction was created from a scheduled transaction,
* opens the editor for that Scheduled Transaction.
**/
void
gnc_tree_control_split_reg_schedule_current_trans (GncTreeViewSplitReg *view)
{
Transaction *trans;
trans = gnc_tree_view_split_reg_get_current_trans (view);
if (trans == NULL)
return;
/* See if we were asked to schedule a blank trans. */
if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
return;
/* Test for read only */
if (gtc_is_trans_readonly_and_warn (view, trans))
return;
/* See if we are being edited in another register */
if (gtc_trans_test_for_edit (view, trans))
return;
/* Make sure we ask to commit any changes before we procede */
if (gtc_trans_open_and_warn (view, trans))
return;
/* If the transaction has a sched-xact KVP frame, then go to the editor
* for the existing SX; otherwise, do the sx-from-trans dialog. */
{
kvp_frame *txn_frame;
kvp_value *kvp_val;
/* set a kvp-frame element in the transaction indicating and
* pointing-to the SX this was created from. */
txn_frame = xaccTransGetSlots (trans);
if ( txn_frame != NULL )
{
kvp_val = kvp_frame_get_slot (txn_frame, "from-sched-xaction");
if (kvp_val)
{
GncGUID *fromSXId = kvp_value_get_guid (kvp_val);
SchedXaction *theSX = NULL;
GList *sxElts;
/* Get the correct SX */
for ( sxElts = gnc_book_get_schedxactions (gnc_get_current_book())->sx_list;
(!theSX) && sxElts;
sxElts = sxElts->next )
{
SchedXaction *sx = (SchedXaction*)sxElts->data;
theSX =
( ( guid_equal (xaccSchedXactionGetGUID (sx), fromSXId))
? sx : NULL );
}
if (theSX)
{
gnc_ui_scheduled_xaction_editor_dialog_create (theSX, FALSE);
return;
}
}
}
}
gnc_sx_create_from_trans(pending_trans);
}
#endif
/* Void current transaction */
void
gnc_tree_control_split_reg_void_current_trans (GncTreeViewSplitReg *view, const char *reason)
@ -632,7 +713,7 @@ gnc_tree_control_split_reg_jump_to_blank (GncTreeViewSplitReg *view)
/* Jump to split */
void
gnc_tree_control_split_reg_jump_to_split (GncTreeViewSplitReg *view, Split *split)
gnc_tree_control_split_reg_jump_to_split (GncTreeViewSplitReg *view, Split *split, gboolean amount)
{
GncTreeModelSplitReg *model;
GtkTreePath *mpath, *spath;
@ -643,20 +724,50 @@ gnc_tree_control_split_reg_jump_to_split (GncTreeViewSplitReg *view, Split *spli
spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
gnc_tree_view_split_reg_expand_trans (view, xaccSplitGetParent (split));
// gnc_tree_view_split_reg_set_current_path (view, spath);
gnc_tree_view_split_reg_set_current_path (view, spath);
gnc_tree_view_split_reg_expand_trans (view, xaccSplitGetParent (split));
gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), spath);
/* Set cursor to new spath */
gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, NULL, FALSE);
/* Set cursor to new spath, if amount, cursor is set to correct column ready for editing */
if (amount)
{
GtkCellRenderer *cr0;
GList *renderers;
GList *columns;
GList *column;
gint i;
columns = gtk_tree_view_get_columns (GTK_TREE_VIEW (view));
for (column = columns, i = 1; column; column = g_list_next (column), i++)
{
GtkTreeViewColumn *tvc;
ViewCol viewcol;
tvc = column->data;
// Get the first renderer, it has the view-column value.
renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tvc));
cr0 = g_list_nth_data (renderers, 0);
g_list_free (renderers);
viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr0), "view_column"));
if (viewcol == COL_DEBIT && gnc_numeric_positive_p (xaccSplitGetAmount (split)))
gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, tvc, TRUE);
if (viewcol == COL_CREDIT && gnc_numeric_negative_p (xaccSplitGetAmount (split)))
gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, tvc, TRUE);
}
g_list_free (columns);
}
else
gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), spath, NULL, FALSE);
gtk_tree_path_free (spath);
gtk_tree_path_free (mpath);
/* scroll when view idle */
g_idle_add ((GSourceFunc)gnc_tree_view_split_reg_scroll_to_cell, view );
}
@ -738,7 +849,7 @@ gnc_tree_control_split_reg_goto_rel_trans_row (GncTreeViewSplitReg *view, gint r
new_spath = gtk_tree_path_new_from_indices (indices[0] + (relative * view->sort_direction), -1);
gnc_tree_view_split_reg_set_current_path (view, new_spath);
// gnc_tree_view_split_reg_set_current_path (view, new_spath);
gnc_tree_view_split_reg_block_selection (view, TRUE);
gtk_tree_selection_unselect_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), spath);
@ -1129,7 +1240,7 @@ gnc_tree_control_split_reg_reverse_current (GncTreeViewSplitReg *view)
gtk_main_iteration ();
/* Now jump to new trans */
gnc_tree_control_split_reg_jump_to_split (view, xaccTransGetSplit (new_trans, 0));
gnc_tree_control_split_reg_jump_to_split (view, xaccTransGetSplit (new_trans, 0), FALSE);
LEAVE("Reverse transaction created");
}
@ -1993,6 +2104,8 @@ gnc_tree_control_split_reg_sort_by_numact (GtkTreeModel *fm, GtkTreeIter *fa, Gt
gtk_tree_iter_free (ma);
gtk_tree_iter_free (mb);
//FIXME this may be needed for this one (!qof_book_use_split_action_for_num_field (gnc_get_current_book()))
switch (depth) {
case 1: // Number
@ -2004,7 +2117,6 @@ gnc_tree_control_split_reg_sort_by_numact (GtkTreeModel *fm, GtkTreeIter *fa, Gt
break;
case 2: // Action
//FIXME this may be needed for this one (!qof_book_use_split_action_for_num_field (gnc_get_current_book()))
anchor = gnc_tree_model_split_reg_get_anchor (model);

View File

@ -35,15 +35,23 @@ G_BEGIN_DECLS
/*****************************************************************************/
gboolean gnc_tree_control_split_reg_trans_open_and_warn (GncTreeViewSplitReg *view, Transaction *trans);
gboolean gnc_tree_control_split_reg_trans_test_for_edit (GncTreeViewSplitReg *view, Transaction *trans);
/*****************************************************************************/
void gnc_tree_control_split_reg_exchange_rate (GncTreeViewSplitReg *view);
void gnc_tree_control_split_reg_schedule_current_trans (GncTreeViewSplitReg *view);
void gnc_tree_control_split_reg_void_current_trans (GncTreeViewSplitReg *view, const char *reason);
void gnc_tree_control_split_reg_unvoid_current_trans (GncTreeViewSplitReg *view);
void gnc_tree_control_split_reg_jump_to_blank (GncTreeViewSplitReg *view);
void gnc_tree_control_split_reg_jump_to_split (GncTreeViewSplitReg *view, Split *split);
void gnc_tree_control_split_reg_jump_to_split (GncTreeViewSplitReg *view, Split *split, gboolean amount);
void gnc_tree_control_split_reg_cancel_edit (GncTreeViewSplitReg *view, gboolean reg_closing);

View File

@ -113,32 +113,8 @@ static void gtv_split_reg_double_click_cb (GtkTreeView *treeview,
GtkTreeViewColumn *column,
gpointer user_data);
static gboolean transaction_changed_confirm (GncTreeViewSplitReg *view, Transaction *new_trans);
typedef enum {
COL_DATE, //0
COL_DUEDATE, //1
COL_NUMACT, //2
COL_DESCNOTES, //3
COL_TRANSVOID, //4
COL_RECN, //5
COL_TYPE, //6
COL_VALUE, //7
COL_AMOUNT, //8
COL_AMTVAL, //9
COL_RATE, //10
COL_PRICE, //11
COL_DEBIT, //12
COL_CREDIT, //13
COL_BALANCE, //14
COL_STATUS, //15
COL_COMM, //16
} ViewCol;
typedef struct {
ViewCol viewcol;
gint modelcol;
@ -628,13 +604,20 @@ gnc_tree_view_split_reg_get_colummn_list (GncTreeModelSplitReg *model)
return col_list;
}
case SEARCH_LEDGER2: //FIXME Not Setup yet
case SEARCH_LEDGER2:
{
static ViewCol col_list[] = {
COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSVOID, COL_RECN,
COL_STATUS, COL_RATE, COL_DEBIT, COL_CREDIT, -1};
return col_list;
}
break;
default:
{
static ViewCol col_list[] = {
COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSVOID, COL_RECN, COL_STATUS,
COL_TYPE, COL_VALUE, COL_AMOUNT, COL_RATE, COL_PRICE, COL_DEBIT, COL_CREDIT,
COL_VALUE, COL_AMOUNT, COL_RATE, COL_PRICE, COL_DEBIT, COL_CREDIT,
COL_BALANCE, -1};
return col_list;
}
@ -950,8 +933,6 @@ gnc_tree_view_split_reg_new_with_model (GncTreeModelSplitReg *model)
{
GtkTreeModel *s_model, *f_model;
GncTreeViewSplitReg *view;
GtkCellRenderer *cr;
GtkTreeViewColumn *col;
GtkTreeSelection *selection;
gtk_rc_parse_string (rc_string);
@ -965,7 +946,7 @@ gnc_tree_view_split_reg_new_with_model (GncTreeModelSplitReg *model)
// Setup the sort model
s_model = gtk_tree_model_sort_new_with_model (f_model);
g_object_unref(G_OBJECT(f_model));
g_object_unref(G_OBJECT (f_model));
// Connect model to tree view
gnc_tree_view_set_model (GNC_TREE_VIEW (view), s_model);
@ -1077,18 +1058,14 @@ gnc_tree_view_split_reg_default_selection (GncTreeViewSplitReg *view)
gtk_tree_path_free (spath);
gtk_tree_path_free (new_mpath);
/* give gtk+ a chance to handle pending events */
// while (gtk_events_pending ())
// gtk_main_iteration ();
/* Refilter the tree view register */
gnc_tree_view_split_reg_refilter (view);
/* Set the view format */
g_idle_add ((GSourceFunc)gnc_tree_view_split_reg_set_format, view);
g_idle_add ((GSourceFunc) gnc_tree_view_split_reg_set_format, view);
/* scroll window to show selection when view is idle */
g_idle_add ((GSourceFunc)gnc_tree_view_split_reg_scroll_to_cell, view );
g_idle_add ((GSourceFunc) gnc_tree_view_split_reg_scroll_to_cell, view );
LEAVE(" ");
}
@ -2235,7 +2212,7 @@ cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
{
Account *acct = xaccSplitGetAccount (split);
if ((xaccTransCountSplits (trans) == 0) && (model->type != GENERAL_LEDGER2)) // First split on blank transaction
if ((xaccTransCountSplits (trans) == 0) && model->type != GENERAL_LEDGER2 && model->type != SEARCH_LEDGER2) // First split on blank transaction
acct = anchor;
if (acct != NULL)
@ -2248,7 +2225,7 @@ cdf0 (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
else
s = "";
if (anchor == acct && model->type != GENERAL_LEDGER2)
if (anchor == acct && model->type != GENERAL_LEDGER2 && model->type != SEARCH_LEDGER2)
editable = FALSE;
else
editable = TRUE;
@ -3271,6 +3248,7 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
GList *columns;
GList *column;
gint i;
RowDepth temp_depth;
ENTER("title depth is %d and sort_depth %d, sort_col is %d", depth, view->sort_depth, view->sort_col);
@ -3289,42 +3267,53 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
cr0 = g_list_nth_data (renderers, 0);
g_list_free (renderers);
viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(cr0), "view_column"));
viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr0), "view_column"));
DEBUG("viewcol is %d", viewcol);
switch(viewcol)
switch (viewcol)
{
case COL_DATE:
switch(model->type)
switch (model->type)
{
default: //FIXME These if statements may not be required
/* Display arrows if we are sorting on this row */
if (view->sort_depth == depth && view->sort_col == viewcol)
gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
else
gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
if ((depth == TRANS1 || depth == SPLIT3) && view->sort_col == viewcol)
{
if (view->sort_depth == TRANS1 || view->sort_depth == SPLIT3)
gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
else
gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
}
if(depth == TRANS1 || depth == SPLIT3)
if (depth == TRANS2 && view->sort_col == viewcol)
{
if (view->sort_depth == TRANS2)
gtk_tree_view_column_set_sort_indicator (tvc, TRUE);
else
gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
}
if (depth == TRANS1 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Date Posted"));
else if(depth == TRANS2)
else if (depth == TRANS2)
gtk_tree_view_column_set_title (tvc, _("Date Entered"));
break;
}
break;
case COL_DUEDATE:
switch(model->type)
switch (model->type)
{
default: //FIXME These if statements may not be required
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Due Date"));
break;
}
break;
case COL_NUMACT:
switch(model->type)
switch (model->type)
{
case RECEIVABLE_REGISTER2:
case PAYABLE_REGISTER2:
@ -3361,10 +3350,10 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
break;
case COL_DESCNOTES:
switch(model->type)
switch (model->type)
{
case RECEIVABLE_REGISTER2:
if(depth == TRANS1)
if (depth == TRANS1)
gtk_tree_view_column_set_title (tvc, _("Customer"));
else if (depth == TRANS2)
gtk_tree_view_column_set_title (tvc, _("Memo"));
@ -3375,7 +3364,7 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
break;
case PAYABLE_REGISTER2:
if(depth == TRANS1)
if (depth == TRANS1)
gtk_tree_view_column_set_title (tvc, _("Vendor"));
else if (depth == TRANS2)
gtk_tree_view_column_set_title (tvc, _("Memo"));
@ -3393,7 +3382,7 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
else
gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
if(depth == TRANS1)
if (depth == TRANS1)
gtk_tree_view_column_set_title (tvc, _("Description"));
else if (depth == TRANS2)
gtk_tree_view_column_set_title (tvc, _("Notes"));
@ -3406,11 +3395,11 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
break;
case COL_TRANSVOID:
switch(model->type)
switch (model->type)
{
case RECEIVABLE_REGISTER2:
case PAYABLE_REGISTER2:
if(depth == TRANS1)
if (depth == TRANS1)
gtk_tree_view_column_set_title (tvc, _("Accounts"));
else if (depth == TRANS2)
gtk_tree_view_column_set_title (tvc, _("Accounts"));
@ -3427,7 +3416,7 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
else
gtk_tree_view_column_set_sort_indicator (tvc, FALSE);
if(depth == TRANS1)
if (depth == TRANS1)
gtk_tree_view_column_set_title (tvc, _("Accounts"));
else if (depth == TRANS2)
gtk_tree_view_column_set_title (tvc, _("Void Reason"));
@ -3440,50 +3429,50 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
break;
case COL_RECN:
switch(model->type)
switch (model->type)
{
default: //FIXME These if statements may not be required
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("R"));
break;
}
break;
case COL_TYPE:
switch(model->type)
switch (model->type)
{
default: //FIXME These if statements may not be required
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Type"));
break;
}
break;
case COL_VALUE:
switch(model->type)
switch (model->type)
{
default: //FIXME These if statements may not be required
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Value"));
break;
}
break;
case COL_AMOUNT:
switch(model->type)
switch (model->type)
{
default: //FIXME These if statements may not be required
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Amount"));
break;
}
break;
case COL_AMTVAL:
switch(model->type)
switch (model->type)
{
default:
if((depth == TRANS1) || (depth == TRANS2))
if (depth == TRANS1 || depth == TRANS2)
gtk_tree_view_column_set_title (tvc, _("Value"));
else if (depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Amount"));
@ -3494,30 +3483,30 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
break;
case COL_COMM:
switch(model->type)
switch (model->type)
{
default: //FIXME These if statements may not be required
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Commodity"));
break;
}
break;
case COL_RATE:
switch(model->type)
switch (model->type)
{
default: //FIXME These if statements may not be required
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Rate"));
break;
}
break;
case COL_PRICE:
switch(model->type)
switch (model->type)
{
default: //FIXME These if statements may not be required
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Price"));
break;
}
@ -3526,70 +3515,70 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
case COL_CREDIT:
if(!(model->use_accounting_labels))
{
switch(model->type)
switch (model->type)
{
case BANK_REGISTER2: //FIXME These if statements may not be required
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Withdrawl"));
break;
case CASH_REGISTER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Spend"));
break;
case ASSET_REGISTER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Decrease"));
break;
case LIABILITY_REGISTER2:
case EQUITY_REGISTER2:
case TRADING_REGISTER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Increase"));
break;
case CREDIT_REGISTER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Charge"));
break;
case INCOME_REGISTER2:
case INCOME_LEDGER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Income"));
break;
case EXPENSE_REGISTER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Rebate"));
break;
case STOCK_REGISTER2:
case CURRENCY_REGISTER2:
case PORTFOLIO_LEDGER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Sell"));
break;
case RECEIVABLE_REGISTER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Payment"));
break;
case PAYABLE_REGISTER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Bill"));
break;
case GENERAL_LEDGER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Funds Out"));
break;
default:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Credit"));
break;
}
@ -3601,66 +3590,66 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
case COL_DEBIT:
if(!(model->use_accounting_labels))
{
switch(model->type)
switch (model->type)
{
case BANK_REGISTER2: //FIXME These if statements may not be required
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Deposit"));
break;
case CASH_REGISTER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Receive"));
break;
case ASSET_REGISTER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Increase"));
break;
case LIABILITY_REGISTER2:
case EQUITY_REGISTER2:
case TRADING_REGISTER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Decrease"));
break;
case INCOME_REGISTER2:
case INCOME_LEDGER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Charge"));
break;
case EXPENSE_REGISTER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Expense"));
break;
case STOCK_REGISTER2:
case CURRENCY_REGISTER2:
case PORTFOLIO_LEDGER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Buy"));
break;
case RECEIVABLE_REGISTER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Invoice"));
break;
case CREDIT_REGISTER2:
case PAYABLE_REGISTER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Payment"));
break;
case GENERAL_LEDGER2:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Funds In"));
break;
default:
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Debit"));
break;
}
@ -3670,10 +3659,10 @@ gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
break;
case COL_BALANCE:
switch(model->type)
switch (model->type)
{
default: //FIXME These if statements may not be required
if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
if (depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
gtk_tree_view_column_set_title (tvc, _("Balance"));
break;
}
@ -3975,7 +3964,6 @@ gtv_split_reg_double_click_cb (GtkTreeView *treeview, GtkTreePath *path,
}
/* Call back for when a change to a filter requires the selection to get out of the way */
static void
gtv_split_reg_selection_move_filter_cb (GncTreeModelSplitReg *model, gpointer item, gpointer user_data)
@ -4185,7 +4173,7 @@ gtv_split_reg_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user
view->priv->current_ref = gtk_tree_row_reference_copy (view->priv->edit_ref);
// Jump to the first split of dirty_trans.
gnc_tree_control_split_reg_jump_to_split (view, xaccTransGetSplit (view->priv->dirty_trans, 0));
gnc_tree_control_split_reg_jump_to_split (view, xaccTransGetSplit (view->priv->dirty_trans, 0), FALSE);
/* Remove the blank split and re-add - done so we keep it last in list */
gnc_tree_model_split_reg_set_blank_split_parent (model, view->priv->dirty_trans, TRUE);
@ -4233,7 +4221,6 @@ gtv_split_reg_motion_cb (GtkTreeSelection *sel, gpointer user_data)
RowDepth depth = 0;
GtkTreeIter m_iter;
//g_print ("\n** gtv_split_reg_motion_cb start\n");
model = gnc_tree_view_split_reg_get_model_from_view (view);
@ -4302,7 +4289,7 @@ gtv_split_reg_motion_cb (GtkTreeSelection *sel, gpointer user_data)
view->priv->current_ref = gtk_tree_row_reference_copy (view->priv->edit_ref);
// Jump to the first split of dirty_trans.
gnc_tree_control_split_reg_jump_to_split (view, xaccTransGetSplit (view->priv->dirty_trans, 0));
gnc_tree_control_split_reg_jump_to_split (view, xaccTransGetSplit (view->priv->dirty_trans, 0), FALSE);
/* Remove the blank split and re-add - done so we keep it last in list */
gnc_tree_model_split_reg_set_blank_split_parent (model, view->priv->dirty_trans, TRUE);
@ -4316,7 +4303,6 @@ gtv_split_reg_motion_cb (GtkTreeSelection *sel, gpointer user_data)
gnc_tree_view_split_reg_expand_trans (view, NULL);
// }
return;
}
else
@ -4333,7 +4319,6 @@ gtv_split_reg_motion_cb (GtkTreeSelection *sel, gpointer user_data)
view->priv->current_depth = depth;
//g_print("Motion - ** view->priv-> c_trans is %p c_split is %p depth %d **\n\n", view->priv->current_trans, view->priv->current_split, view->priv->current_depth);
/* Auto expand transaction and collapse previous transaction */
if (old_trans != trans)
{
@ -4359,6 +4344,12 @@ gtv_split_reg_motion_cb (GtkTreeSelection *sel, gpointer user_data)
}
}
gtk_tree_path_free (spath);
// Check to see if current trans is expanded and set appropiately
if (gnc_tree_view_split_reg_trans_expanded (view, trans))
view->priv->expanded = TRUE;
else
view->priv->expanded = FALSE;
}
else
{
@ -4372,7 +4363,6 @@ gtv_split_reg_motion_cb (GtkTreeSelection *sel, gpointer user_data)
/* Set the default selection start position */
gnc_tree_view_split_reg_default_selection (view);
}
/* This updates the plugin page gui */
if (view->moved_cb)
(view->moved_cb)(view, view->moved_cb_data);
@ -4666,7 +4656,10 @@ gtv_split_reg_edited_cb (GtkCellRendererText *cell, const gchar *path_string,
if (is_blank)
{
/*FIXME May be this should be a signal - Promote the blank split to a real split */
g_idle_add ((GSourceFunc)gnc_tree_model_split_reg_commit_blank_split, gnc_tree_view_split_reg_get_model_from_view (view));
g_idle_add ((GSourceFunc) gnc_tree_model_split_reg_commit_blank_split, gnc_tree_view_split_reg_get_model_from_view (view));
/* scroll when view idle */
g_idle_add ((GSourceFunc) gnc_tree_view_split_reg_scroll_to_cell, view);
}
// In transaction mode, two splits only, set up the other split.
@ -5276,22 +5269,26 @@ gnc_tree_view_split_reg_scroll_to_cell (GncTreeViewSplitReg *view)
GtkTreePath *mpath, *spath;
model = gnc_tree_view_split_reg_get_model_from_view (view);
//FIXME needs more work...
//FIXME This may all reduce to a single scroll_to_cell...
mpath = gnc_tree_view_split_reg_get_current_path (view);
spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
if (view->sort_direction == 1)
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 0.0, 0.0);
{
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 0.5, 0.0); //0.0
}
else
{
if (model->use_double_line)
{
gtk_tree_path_down (spath); // move to the second row of transaction
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 1.0, 0.0);
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 0.5, 0.0); //1.0
gtk_tree_path_up (spath); // back to first row of transaction
}
else
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 1.0, 0.0);
{
gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), spath, NULL, TRUE, 0.5, 0.0); //1.0
}
}
gtk_tree_path_free (mpath);
gtk_tree_path_free (spath);
@ -5383,16 +5380,20 @@ gnc_tree_view_split_reg_set_current_path (GncTreeViewSplitReg *view, GtkTreePath
model = gnc_tree_view_split_reg_get_model_from_view (view);
if(view->priv->current_ref != NULL)
//FIXME I am not sure this function is needed, it is usualy followed by set selection which
// will do this any way ?????
if (view->priv->current_ref != NULL)
{
gtk_tree_row_reference_free (view->priv->current_ref);
view->priv->current_ref = NULL;
}
view->priv->current_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (model), path);
view->priv->current_trans = gnc_tree_view_split_reg_get_current_trans (view);
view->priv->current_split = gnc_tree_view_split_reg_get_current_split (view);
view->priv->current_depth = gnc_tree_view_reg_get_selected_row_depth (view);
//FIXME this is crap - not needed...
// view->priv->current_trans = gnc_tree_view_split_reg_get_current_trans (view);
// view->priv->current_split = gnc_tree_view_split_reg_get_current_split (view);
// view->priv->current_depth = gnc_tree_view_reg_get_selected_row_depth (view);
}
@ -5505,7 +5506,7 @@ gnc_tree_view_split_reg_enter (GncTreeViewSplitReg *view)
if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) && transaction_changed_confirm (view, NULL))
{
// Jump to the first split of dirty_trans.
gnc_tree_control_split_reg_jump_to_split (view, xaccTransGetSplit (view->priv->dirty_trans, 0));
gnc_tree_control_split_reg_jump_to_split (view, xaccTransGetSplit (view->priv->dirty_trans, 0), FALSE);
/* Remove the blank split and re-add - done so we keep it last in list */
gnc_tree_model_split_reg_set_blank_split_parent (model, view->priv->dirty_trans, TRUE);
@ -5606,6 +5607,7 @@ gnc_tree_view_split_reg_trans_expanded (GncTreeViewSplitReg *view, Transaction *
spath = gnc_tree_view_split_reg_get_sort_path_from_model_path (view, mpath);
gtk_tree_path_down (spath); /* Move the path down to trow2 */
expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), spath);
gtk_tree_path_free (mpath);
@ -5737,6 +5739,9 @@ gnc_tree_view_split_reg_expand_trans (GncTreeViewSplitReg *view, Transaction *tr
if (view->moved_cb)
(view->moved_cb)(view, view->moved_cb_data);
/* scroll when view idle */
g_idle_add ((GSourceFunc) gnc_tree_view_split_reg_scroll_to_cell, view);
LEAVE(" ");
}

View File

@ -86,6 +86,25 @@ typedef enum {
SPLIT3, //3
}RowDepth;
typedef enum {
COL_DATE, //0
COL_DUEDATE, //1
COL_NUMACT, //2
COL_DESCNOTES, //3
COL_TRANSVOID, //4
COL_RECN, //5
COL_TYPE, //6
COL_VALUE, //7
COL_AMOUNT, //8
COL_AMTVAL, //9
COL_RATE, //10
COL_PRICE, //11
COL_DEBIT, //12
COL_CREDIT, //13
COL_BALANCE, //14
COL_STATUS, //15
COL_COMM, //16
} ViewCol;
/* Standard g_object type */
GType gnc_tree_view_split_reg_get_type (void);

View File

@ -32,11 +32,13 @@ libgnc_gnome_la_SOURCES = \
dialog-commodities.c \
dialog-fincalc.c \
dialog-find-transactions.c \
dialog-find-transactions2.c \
dialog-lot-viewer.c \
dialog-new-user.c \
dialog-price-editor.c \
dialog-price-edit-db.c \
dialog-print-check.c \
dialog-print-check2.c \
dialog-progress.c \
dialog-sx-editor.c \
dialog-sx-from-trans.c \
@ -58,6 +60,7 @@ libgnc_gnome_la_SOURCES = \
reconcile-view.c \
top-level.c \
window-reconcile.c \
window-reconcile2.c \
window-autoclear.c
gnomeappdir = ${datadir}/applications
@ -75,9 +78,11 @@ noinst_HEADERS = \
assistant-stock-split.h \
dialog-fincalc.h \
dialog-find-transactions.h \
dialog-find-transactions2.h \
dialog-lot-viewer.h \
dialog-new-user.h \
dialog-print-check.h \
dialog-print-check2.h \
dialog-progress.h \
dialog-sx-editor.h \
dialog-sx-from-trans.h \
@ -98,6 +103,7 @@ noinst_HEADERS = \
reconcile-view.h \
top-level.h \
window-reconcile.h \
window-reconcile2.h \
window-autoclear.h
if BUILDING_FROM_SCM

View File

@ -0,0 +1,216 @@
/********************************************************************\
* dialog-find-transactions2.c : locate transactions and show them *
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
\********************************************************************/
#include "config.h"
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <stdio.h>
#include "gnc-ui-util.h"
#include "Query.h"
#include "qof.h"
#include "SX-book.h"
#include "Transaction.h"
#include "dialog-find-transactions2.h"
#include "gnc-main-window.h"
#include "gnc-plugin-page-register2.h"
#include "search-param.h"
#define GCONF_SECTION "dialogs/find"
struct _ftd_data
{
QofQuery * q;
QofQuery * ledger_q;
GNCSearchWindow * sw;
};
static void
do_find_cb (QofQuery *query, gpointer user_data, gpointer *result)
{
struct _ftd_data *ftd = user_data;
GNCLedgerDisplay2 *ledger;
gboolean new_ledger = FALSE;
GncPluginPage *page;
ledger = gnc_ledger_display2_find_by_query (ftd->ledger_q);
if (!ledger)
{
new_ledger = TRUE;
ledger = gnc_ledger_display2_query (query, SEARCH_LEDGER2,
REG2_STYLE_JOURNAL);
}
else
gnc_ledger_display2_set_query (ledger, query);
gnc_ledger_display2_refresh (ledger);
if (new_ledger)
{
page = gnc_plugin_page_register2_new_ledger (ledger);
gnc_main_window_open_page (NULL, page);
}
qof_query_destroy (ftd->q);
gnc_search_dialog_destroy (ftd->sw);
}
static void
free_ftd_cb (gpointer user_data)
{
struct _ftd_data *ftd = user_data;
if (!ftd)
return;
g_free (ftd);
}
GNCSearchWindow *
gnc_ui_find_transactions_dialog_create2 (GNCLedgerDisplay2 * orig_ledg)
{
QofIdType type = GNC_ID_SPLIT;
struct _ftd_data *ftd;
static GList *params = NULL;
QofQuery *start_q, *show_q = NULL;
gboolean num_action =
qof_book_use_split_action_for_num_field(gnc_get_current_book());
/* Build parameter list in reverse order */
if (params == NULL)
{
params = gnc_search_param_prepend (params, N_("All Accounts"),
ACCOUNT_MATCH_ALL_TYPE,
type, SPLIT_TRANS, TRANS_SPLITLIST,
SPLIT_ACCOUNT_GUID, NULL);
params = gnc_search_param_prepend (params, N_("Account"), GNC_ID_ACCOUNT,
type, SPLIT_ACCOUNT, QOF_PARAM_GUID,
NULL);
params = gnc_search_param_prepend (params, N_("Balanced"), NULL,
type, SPLIT_TRANS, TRANS_IS_BALANCED,
NULL);
params = gnc_search_param_prepend (params, N_("Reconcile"), RECONCILED_MATCH_TYPE,
type, SPLIT_RECONCILE, NULL);
params = gnc_search_param_prepend (params, N_("Share Price"), NULL,
type, SPLIT_SHARE_PRICE, NULL);
params = gnc_search_param_prepend (params, N_("Shares"), NULL,
type, SPLIT_AMOUNT, NULL);
params = gnc_search_param_prepend (params, N_("Value"), NULL,
type, SPLIT_VALUE, NULL);
params = gnc_search_param_prepend (params, N_("Date Posted"), NULL,
type, SPLIT_TRANS, TRANS_DATE_POSTED,
NULL);
params = gnc_search_param_prepend (params, N_("Notes"), NULL,
type, SPLIT_TRANS, TRANS_NOTES, NULL);
params = gnc_search_param_prepend (params, (num_action
? N_("Number/Action")
: N_("Action")), NULL,
type, SPLIT_ACTION, NULL);
params = gnc_search_param_prepend (params, (num_action
? N_("Transaction Number")
: N_("Number")), NULL,
type, SPLIT_TRANS, TRANS_NUM, NULL);
params = gnc_search_param_prepend (params, N_("Memo"), NULL,
type, SPLIT_MEMO, NULL);
params = gnc_search_param_prepend (params, N_("Description"), NULL,
type, SPLIT_TRANS, TRANS_DESCRIPTION,
NULL);
}
else
{
GList *l;
for (l = params; l; l = l->next)
{
GNCSearchParam *param = l->data;
if (num_action)
{
if (strcmp (param->title, N_("Action")) == 0)
gnc_search_param_set_title (param, N_("Number/Action"));
if (strcmp (param->title, N_("Number")) == 0)
gnc_search_param_set_title (param, N_("Transaction Number"));
}
else
{
if (strcmp (param->title, N_("Number/Action")) == 0)
gnc_search_param_set_title (param, N_("Action"));
if (strcmp (param->title, N_("Transaction Number")) == 0)
gnc_search_param_set_title (param, N_("Number"));
}
}
}
ftd = g_new0 (struct _ftd_data, 1);
if (orig_ledg)
{
ftd->ledger_q = gnc_ledger_display2_get_query (orig_ledg);
start_q = show_q = qof_query_copy (ftd->ledger_q);
}
else
{
start_q = qof_query_create ();
qof_query_set_book (start_q, gnc_get_current_book ());
/* In lieu of not "mis-using" some portion of the infrastructure by writing
* a bunch of new code, we just filter out the accounts of the template
* transactions. While these are in a seperate Account trees just for this
* reason, the query engine makes no distinction between Account trees.
* See Gnome Bug 86302.
* -- jsled
*
* copied from gnc-ledger-display2.c:gnc_ledger_display2_gl() -- warlord
*
* <jsled> Alternatively, you could look for a GNC_SX_ACCOUNT [SchedAction.h]
* key in the KVP frame of the split.
*/
{
Account *tRoot;
GList *al;
tRoot = gnc_book_get_template_root( gnc_get_current_book() );
al = gnc_account_get_descendants( tRoot );
xaccQueryAddAccountMatch( start_q, al, QOF_GUID_MATCH_NONE, QOF_QUERY_AND );
g_list_free (al);
al = NULL;
tRoot = NULL;
}
ftd->q = start_q; /* save this to destroy it later */
}
ftd->sw = gnc_search_dialog_create (type, _("Find Transaction"),
params, NULL, start_q, show_q,
NULL, do_find_cb, NULL,
ftd, free_ftd_cb, GCONF_SECTION, NULL);
if (!ftd->sw)
{
free_ftd_cb (ftd);
return NULL;
}
return ftd->sw;
}

View File

@ -0,0 +1,33 @@
/********************************************************************\
* dialog-find-transactions2.h : locate transactions/splits matching *
* criteria. *
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
\********************************************************************/
#ifndef DIALOG_FIND_TRANSACTIONS2_H
#define DIALOG_FIND_TRANSACTIONS2_H
#include "gnc-ledger-display2.h"
#include "dialog-search.h"
GNCSearchWindow *
gnc_ui_find_transactions_dialog_create2 (GNCLedgerDisplay2 * ledger);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,34 @@
/********************************************************************\
* dialog-print-check2.h : dialog to control check printing *
* Copyright (C) 2000 Bill Gribble <grib@billgribble.com> *
* Copyright (C) 2006 David Hampton <hampton@employees.org> *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
\********************************************************************/
#ifndef DIALOG_PRINT_CHECK2_H
#define DIALOG_PRINT_CHECK2_H
#include "print-session.h"
typedef struct _print_check_dialog PrintCheckDialog;
void gnc_ui_print_check_dialog_create2 (GncPluginPageRegister2 *plugin_page,
GList *splits);
#endif

View File

@ -43,6 +43,7 @@
#include "dialog-file-access.h"
#include "dialog-fincalc.h"
#include "dialog-find-transactions.h"
#include "dialog-find-transactions2.h"
#include "dialog-sx-since-last-run.h"
#include "dialog-totd.h"
#include "assistant-acct-period.h"
@ -624,6 +625,9 @@ static void
gnc_main_window_cmd_tools_find_transactions (GtkAction *action, GncMainWindowActionData *data)
{
gnc_ui_find_transactions_dialog_create (NULL);
/*################## Added for Reg2 #################*/
// gnc_ui_find_transactions_dialog_create2 (NULL);
/*################## Added for Reg2 #################*/
}
static void

View File

@ -52,10 +52,13 @@
#include "gnc-tree-control-split-reg.h"
#include "dialog-account.h"
#include "dialog-find-transactions.h"
//#include "dialog-print-check.h"
#include "dialog-find-transactions2.h"
#include "dialog-print-check2.h"
#include "dialog-transfer.h"
#include "dialog-utils.h"
#include "SX-book.h"
#include "dialog-sx-editor.h"
#include "dialog-sx-from-trans.h"
#include "assistant-stock-split.h"
#include "gnc-gconf-utils.h"
#include "gnc-component-manager.h"
@ -77,7 +80,7 @@
#include "dialog-lot-viewer.h"
#include "Scrub.h"
#include "qof.h"
#include "window-reconcile.h"
#include "window-reconcile2.h"
#include "window-autoclear.h"
#include "window-report.h"
@ -137,6 +140,7 @@ static void gnc_plugin_page_register2_cmd_void_transaction (GtkAction *action, G
static void gnc_plugin_page_register2_cmd_unvoid_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
static void gnc_plugin_page_register2_cmd_reverse_transaction (GtkAction *action, GncPluginPageRegister2 *plugin_page);
static void gnc_plugin_page_register2_cmd_shift_transaction_forward (GtkAction *action, GncPluginPageRegister2 *plugin_page);
static void gnc_plugin_page_register2_cmd_reload (GtkAction *action, GncPluginPageRegister2 *plugin_page);
static void gnc_plugin_page_register2_cmd_view_filter_by (GtkAction *action, GncPluginPageRegister2 *plugin_page);
static void gnc_plugin_page_register2_cmd_style_changed (GtkAction *action, GtkRadioAction *current, GncPluginPageRegister2 *plugin_page);
static void gnc_plugin_page_register2_cmd_style_double_line (GtkToggleAction *action, GncPluginPageRegister2 *plugin_page);
@ -278,6 +282,11 @@ static GtkActionEntry gnc_plugin_page_register2_actions [] =
"ViewFilterByAction", NULL, N_("_Filter By..."), NULL, NULL,
G_CALLBACK (gnc_plugin_page_register2_cmd_view_filter_by)
},
{
"ViewRefreshAction", GTK_STOCK_REFRESH, N_("_Refresh"), "<control>r",
N_("Refresh this window"),
G_CALLBACK (gnc_plugin_page_register2_cmd_reload)
},
/* Actions menu */
@ -555,13 +564,13 @@ gnc_plugin_page_register2_new_common (GNCLedgerDisplay2 *ledger)
gsr = gnc_ledger_display2_get_user_data (ledger);
if (gsr)
{
item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_REGISTER2_NAME);
for ( ; item; item = g_list_next(item))
item = gnc_gobject_tracking_get_list (GNC_PLUGIN_PAGE_REGISTER2_NAME);
for ( ; item; item = g_list_next (item))
{
register_page = (GncPluginPageRegister2 *)item->data;
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(register_page);
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (register_page);
if (priv->gsr == gsr)
return GNC_PLUGIN_PAGE(register_page);
return GNC_PLUGIN_PAGE (register_page);
}
}
@ -570,9 +579,9 @@ gnc_plugin_page_register2_new_common (GNCLedgerDisplay2 *ledger)
priv->ledger = ledger;
priv->key = *guid_null();
plugin_page = GNC_PLUGIN_PAGE(register_page);
label = gnc_plugin_page_register2_get_tab_name(plugin_page);
gnc_plugin_page_set_page_name(plugin_page, label);
plugin_page = GNC_PLUGIN_PAGE (register_page);
label = gnc_plugin_page_register2_get_tab_name (plugin_page);
gnc_plugin_page_set_page_name (plugin_page, label);
g_free(label);
label_color = gnc_plugin_page_register2_get_tab_color(plugin_page);
@ -610,9 +619,9 @@ gnc_plugin_page_register2_new (Account *account, gboolean subaccounts)
else
ledger = gnc_ledger_display2_simple (account);
page = gnc_plugin_page_register2_new_common(ledger);
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
priv->key = *xaccAccountGetGUID(account);
page = gnc_plugin_page_register2_new_common (ledger);
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
priv->key = *xaccAccountGetGUID (account);
LEAVE("%p", page);
return page;
@ -624,13 +633,13 @@ gnc_plugin_page_register2_new_gl (void)
GNCLedgerDisplay2 *ledger;
ledger = gnc_ledger_display2_gl ();
return gnc_plugin_page_register2_new_common(ledger);
return gnc_plugin_page_register2_new_common (ledger);
}
GncPluginPage *
gnc_plugin_page_register2_new_ledger (GNCLedgerDisplay2 *ledger)
{
return gnc_plugin_page_register2_new_common(ledger);
return gnc_plugin_page_register2_new_common (ledger);
}
static void
@ -774,13 +783,12 @@ gnc_plugin_page_register2_ui_update (gpointer various, GncPluginPageRegister2 *p
view = gnc_ledger_display2_get_split_view_register (priv->ledger);
expanded = gnc_tree_view_split_reg_trans_expanded (view, NULL);
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page),
"SplitTransactionAction");
gtk_action_set_sensitive (action, model->style == REG2_STYLE_LEDGER);
g_signal_handlers_block_by_func
(action, gnc_plugin_page_register2_cmd_expand_transaction, page);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(action), expanded);
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), expanded);
g_signal_handlers_unblock_by_func
(action, gnc_plugin_page_register2_cmd_expand_transaction, page);
@ -788,25 +796,24 @@ gnc_plugin_page_register2_ui_update (gpointer various, GncPluginPageRegister2 *p
trans = gnc_tree_view_split_reg_get_current_trans (view);
voided = xaccTransHasSplitsInState (trans, VREC);
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page),
"VoidTransactionAction");
gtk_action_set_sensitive (GTK_ACTION(action), !voided);
gtk_action_set_sensitive (GTK_ACTION (action), !voided);
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page),
"UnvoidTransactionAction");
gtk_action_set_sensitive (GTK_ACTION(action), voided);
gtk_action_set_sensitive (GTK_ACTION (action), voided);
/* If we are in a readonly book, make any modifying action inactive */
if (qof_book_is_readonly(gnc_get_current_book()))
if (qof_book_is_readonly(gnc_get_current_book ()))
{
const char **iter;
for (iter = readonly_inactive_actions; *iter; ++iter)
{
/* Set the action's sensitivity */
GtkAction *action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page), *iter);
gtk_action_set_sensitive(action, FALSE);
GtkAction *action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE (page), *iter);
gtk_action_set_sensitive (action, FALSE);
}
}
}
@ -883,7 +890,7 @@ gnc_plugin_page_register2_create_widget (GncPluginPage *plugin_page)
ENTER("page %p", plugin_page);
page = GNC_PLUGIN_PAGE_REGISTER2 (plugin_page);
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
if (priv->widget != NULL)
{
LEAVE("existing widget %p", priv->widget);
@ -894,12 +901,12 @@ gnc_plugin_page_register2_create_widget (GncPluginPage *plugin_page)
gtk_widget_show (priv->widget);
numRows = priv->lines_default;
numRows = MIN(numRows, DEFAULT_LINES_AMOUNT);
numRows = MIN (numRows, DEFAULT_LINES_AMOUNT);
gnc_window = GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window);
gnc_window = GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window);
gsr = gnc_split_reg2_new(priv->ledger,
gnc_window_get_gtk_window(gnc_window),
gsr = gnc_split_reg2_new (priv->ledger,
gnc_window_get_gtk_window (gnc_window),
numRows, priv->read_only);
priv->gsr = (GNCSplitReg2 *)gsr;
gtk_widget_show (gsr);
@ -907,7 +914,7 @@ gnc_plugin_page_register2_create_widget (GncPluginPage *plugin_page)
gtk_box_pack_start (GTK_BOX (priv->widget), gsr, TRUE, TRUE, 0);
g_signal_connect (G_OBJECT (gsr), "help-changed",
G_CALLBACK ( gnc_plugin_page_help_changed_cb ),
G_CALLBACK (gnc_plugin_page_help_changed_cb),
page );
view = gnc_split_reg2_get_register (priv->gsr);
@ -1130,7 +1137,7 @@ static const gchar *style_names[] =
* @param plugin_page The page to save.
*
* @param key_file A pointer to the GKeyFile data structure where the
* page information should be written.gnc_plugin_page_register2_save_page
* page information should be written. gnc_plugin_page_register2_save_page
*
* @param group_name The group name to use when saving data. */
static void
@ -2267,7 +2274,7 @@ report_helper (GNCLedgerDisplay2 *ledger, Split *split, Query *query) //this wor
static void
gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
GncPluginPageRegister2 *plugin_page) //FIXME Should work but not tested
GncPluginPageRegister2 *plugin_page) // this works
{
GncPluginPageRegister2Private *priv;
GncTreeViewSplitReg *view;
@ -2286,19 +2293,42 @@ gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
model = gnc_ledger_display2_get_split_model_register (priv->ledger);
ledger_type = gnc_ledger_display2_type (priv->ledger);
//FIXME 'gnc_ui_print_check_dialog_create' uses 'GncPluginPageRegister' so this will need to wait
// for when we change the type back or I add a new function to dialog-print-check using
// 'GncPluginPageRegister2'
#ifdef skip
if (ledger_type == LD2_SINGLE || ledger_type == LD2_SUBACCOUNT)
{
split = gnc_tree_view_split_reg_get_current_split (view);
trans = xaccSplitGetParent (split);
if (trans == NULL)
{
LEAVE("trans is NULL");
return;
}
/* See if we were asked to print a blank trans. */
if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
{
LEAVE("Asked to print a blank trans");
return;
}
/* See if we are being edited in another register */
if (gnc_tree_control_split_reg_trans_test_for_edit (view, trans))
{
LEAVE("trans being edited in another register");
return;
}
/* Make sure we ask to commit any changes before we procede */
if (gnc_tree_control_split_reg_trans_open_and_warn (view, trans))
{
LEAVE("trans being edited");
return;
}
if (split && trans)
{
splits = g_list_append (splits, split);
gnc_ui_print_check_dialog_create (plugin_page, splits);
gnc_ui_print_check_dialog_create2 (plugin_page, splits);
g_list_free (splits);
}
}
@ -2346,7 +2376,7 @@ gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
}
}
}
gnc_ui_print_check_dialog_create (plugin_page, splits);
gnc_ui_print_check_dialog_create2 (plugin_page, splits);
}
else
{
@ -2355,7 +2385,6 @@ gnc_plugin_page_register2_cmd_print_check (GtkAction *action,
LEAVE("Unsupported ledger type");
return;
}
#endif
LEAVE(" ");
}
@ -2451,7 +2480,7 @@ gnc_plugin_page_register2_cmd_edit_account (GtkAction *action,
static void
gnc_plugin_page_register2_cmd_find_transactions (GtkAction *action,
GncPluginPageRegister2 *page) //FIXME see below
GncPluginPageRegister2 *page) // this works
{
GncPluginPageRegister2Private *priv;
@ -2459,8 +2488,8 @@ gnc_plugin_page_register2_cmd_find_transactions (GtkAction *action,
ENTER("(action %p, page %p)", action, page);
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
/*FIXME This function has the original ledger type */
/* gnc_ui_find_transactions_dialog_create(priv->ledger); */
gnc_ui_find_transactions_dialog_create2 (priv->ledger);
LEAVE(" ");
}
@ -2811,6 +2840,41 @@ gnc_plugin_page_register2_cmd_view_filter_by (GtkAction *action,
LEAVE(" ");
}
static void
gnc_plugin_page_register2_cmd_reload (GtkAction *action, GncPluginPageRegister2 *plugin_page) //this works
{
GncPluginPageRegister2Private *priv;
GncTreeViewSplitReg *view;
Transaction *trans;
ENTER("(action %p, page %p)", action, plugin_page);
g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
view = gnc_ledger_display2_get_split_view_register (priv->ledger);
trans = gnc_tree_view_split_reg_get_current_trans (view);
/* Make sure we ask to commit any changes before we procede */
if (gnc_tree_control_split_reg_trans_open_and_warn (view, trans))
{
LEAVE("trans being edited");
return;
}
/* give gtk+ a chance to handle pending events */
while (gtk_events_pending ())
gtk_main_iteration ();
gnc_ledger_display2_refresh (priv->ledger);
LEAVE(" ");
}
/*#################################################################################*/
/*#################################################################################*/
@ -2825,15 +2889,15 @@ gnc_plugin_page_register2_cmd_style_changed (GtkAction *action,
ENTER("(action %p, radio action %p, plugin_page %p)",
action, current, plugin_page);
g_return_if_fail(GTK_IS_ACTION(action));
g_return_if_fail(GTK_IS_RADIO_ACTION(current));
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
g_return_if_fail (GTK_IS_ACTION (action));
g_return_if_fail (GTK_IS_RADIO_ACTION (current));
g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
value = gtk_radio_action_get_current_value(current);
gnc_split_reg2_change_style(priv->gsr, value);
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
value = gtk_radio_action_get_current_value (current);
gnc_split_reg2_change_style (priv->gsr, value);
gtk_tree_view_collapse_all (GTK_TREE_VIEW( gnc_ledger_display2_get_split_view_register (priv->ledger)));
gtk_tree_view_collapse_all (GTK_TREE_VIEW (gnc_ledger_display2_get_split_view_register (priv->ledger)));
gnc_plugin_page_register2_ui_update (NULL, plugin_page);
LEAVE(" ");
@ -2891,25 +2955,40 @@ static void
gnc_plugin_page_register2_cmd_reconcile (GtkAction *action,
GncPluginPageRegister2 *page) // this works
{
GncPluginPageRegister2Private *priv;
GncTreeViewSplitReg *view;
Account *account;
Transaction *trans;
GtkWindow *window;
RecnWindow * recnData;
RecnWindow2 * recnData;
ENTER("(action %p, plugin_page %p)", action, page);
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
view = gnc_ledger_display2_get_split_view_register (priv->ledger);
account = gnc_plugin_page_register2_get_account (page);
window = gnc_window_get_gtk_window(GNC_WINDOW(GNC_PLUGIN_PAGE (page)->window));
recnData = recnWindow (GTK_WIDGET(window), account);
gnc_ui_reconcile_window_raise (recnData);
trans = gnc_tree_view_split_reg_get_current_trans (view);
/* Make sure we ask to commit any changes before we procede */
if (gnc_tree_control_split_reg_trans_open_and_warn (view, trans))
{
LEAVE("trans being edited");
return;
}
window = gnc_window_get_gtk_window (GNC_WINDOW (GNC_PLUGIN_PAGE (page)->window));
recnData = recnWindow2 (GTK_WIDGET (window), account);
gnc_ui_reconcile_window2_raise (recnData);
LEAVE(" ");
}
static void
gnc_plugin_page_register2_cmd_autoclear (GtkAction *action,
GncPluginPageRegister2 *page) //FIXME What is this?
GncPluginPageRegister2 *page)
{
Account *account;
GtkWindow *window;
@ -3197,22 +3276,98 @@ gnc_plugin_page_register2_cmd_jump (GtkAction *action,
ld = gnc_plugin_page_register2_get_ledger (new_page);
new_view = gnc_ledger_display2_get_split_view_register (ld);
gnc_tree_control_split_reg_jump_to_split (new_view, split);
gnc_tree_control_split_reg_jump_to_split (new_view, split, FALSE);
LEAVE(" ");
}
/**
* Schedules the current transaction for recurring-entry.
* If the selected transaction was created from a scheduled transaction,
* opens the editor for that Scheduled Transaction.
**/
static void
gnc_plugin_page_register2_cmd_schedule (GtkAction *action,
GncPluginPageRegister2 *plugin_page) //FIXME Not setup
GncPluginPageRegister2 *plugin_page) // this works
{
GncPluginPageRegister2Private *priv;
GncTreeViewSplitReg *view;
Transaction *trans;
ENTER("(action %p, plugin_page %p)", action, plugin_page);
g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
// gsr2_default_schedule_handler(priv->gsr, NULL);
view = gnc_ledger_display2_get_split_view_register (priv->ledger);
trans = gnc_tree_view_split_reg_get_current_trans (view);
if (trans == NULL)
{
LEAVE("trans is NULL");
return;
}
/* See if we were asked to schedule a blank trans. */
if (trans == gnc_tree_control_split_reg_get_blank_trans (view))
{
LEAVE("Asked to schedule a blank trans");
return;
}
/* See if we are being edited in another register */
if (gnc_tree_control_split_reg_trans_test_for_edit (view, trans))
{
LEAVE("trans being edited in another register");
return;
}
/* Make sure we ask to commit any changes before we procede */
if (gnc_tree_control_split_reg_trans_open_and_warn (view, trans))
{
LEAVE("trans being edited");
return;
}
/* If the transaction has a sched-xact KVP frame, then go to the editor
* for the existing SX; otherwise, do the sx-from-trans dialog. */
{
kvp_frame *txn_frame;
kvp_value *kvp_val;
/* set a kvp-frame element in the transaction indicating and
* pointing-to the SX this was created from. */
txn_frame = xaccTransGetSlots (trans);
if ( txn_frame != NULL )
{
kvp_val = kvp_frame_get_slot (txn_frame, "from-sched-xaction");
if (kvp_val)
{
GncGUID *fromSXId = kvp_value_get_guid (kvp_val);
SchedXaction *theSX = NULL;
GList *sxElts;
/* Get the correct SX */
for ( sxElts = gnc_book_get_schedxactions (gnc_get_current_book())->sx_list;
(!theSX) && sxElts;
sxElts = sxElts->next )
{
SchedXaction *sx = (SchedXaction*)sxElts->data;
theSX =
((guid_equal (xaccSchedXactionGetGUID (sx), fromSXId))
? sx : NULL);
}
if (theSX)
{
gnc_ui_scheduled_xaction_editor_dialog_create (theSX, FALSE);
LEAVE(" ");
return;
}
}
}
}
gnc_sx_create_from_trans (trans);
LEAVE(" ");
}
@ -3429,12 +3584,14 @@ gnc_plugin_page_help_changed_cb (GNCSplitReg2 *gsr, GncPluginPageRegister2 *regi
}
static void
gnc_plugin_page_register2_refresh_cb (GHashTable *changes, gpointer user_data) //FIXME does not work ?
gnc_plugin_page_register2_refresh_cb (GHashTable *changes, gpointer user_data)
{
GncPluginPageRegister2 *page = user_data;
GncPluginPageRegister2Private *priv;
GncTreeViewSplitReg *view;
// Not sure what this really is but it gets fired from preference changes.
//g_print("gnc_plugin_page_register2_refresh_cb\n");
g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (page));
priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);

View File

@ -30,33 +30,14 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <time.h>
#include "gnc-split-reg2.h"
#include "Account.h"
#include "qof.h"
#include "SX-book.h"
#include "dialog-account.h"
#include "dialog-sx-editor.h"
#include "dialog-sx-from-trans.h"
#include "gnc-component-manager.h"
#include "gnc-date-edit.h"
#include "gnc-engine.h"
#include "gnc-euro.h"
#include "gnc-gconf-utils.h"
#include "gnc-gui-query.h"
#include "gnc-ledger-display2.h"
#include "gnc-pricedb.h"
#include "gnc-ui-util.h"
#include "gnc-ui.h"
#include "gnucash-sheet.h"
#include "table-allgui.h"
#include "gnc-tree-view-split-reg.h"
#include "gnc-tree-control-split-reg.h"
#include "gnc-ledger-display2.h"
#include "gnc-euro.h"
#include "gnc-gconf-utils.h"
#include "dialog-utils.h"
#define GCONF_SECTION "window/pages/register2"
@ -64,24 +45,22 @@
static QofLogModule log_module = GNC_MOD_GUI;
/***** PROTOTYPES ***************************************************/
void gnc_split_reg2_raise( GNCSplitReg2 *gsr ); /*FIXME What this for */
void gnc_split_reg2_raise (GNCSplitReg2 *gsr);
static GtkWidget* add_summary_label( GtkWidget *summarybar,
const char *label_str );
static GtkWidget* add_summary_label (GtkWidget *summarybar,
const char *label_str);
static void gnc_split_reg2_determine_read_only( GNCSplitReg2 *gsr );
static void gnc_split_reg2_determine_read_only (GNCSplitReg2 *gsr);
static GNCPlaceholderType gnc_split_reg2_get_placeholder( GNCSplitReg2 *gsr );
static GtkWidget *gnc_split_reg2_get_parent( GNCLedgerDisplay2 *ledger );
static GNCPlaceholderType gnc_split_reg2_get_placeholder (GNCSplitReg2 *gsr);
static GtkWidget *gnc_split_reg2_get_parent (GNCLedgerDisplay2 *ledger);
static void gsr2_create_table (GNCSplitReg2 *gsr);
static void gsr2_setup_table (GNCSplitReg2 *gsr);
static void gsr2_create_table( GNCSplitReg2 *gsr );
static void gsr2_setup_table( GNCSplitReg2 *gsr );
static void gsr2_setup_status_widgets (GNCSplitReg2 *gsr);
static void gsr2_setup_status_widgets( GNCSplitReg2 *gsr );
static void gsr2_update_summary_label( GtkWidget *label,
static void gsr2_update_summary_label (GtkWidget *label,
xaccGetBalanceFn getter,
Account *leader,
GNCPrintAmountInfo print_info,
@ -91,34 +70,21 @@ static void gsr2_update_summary_label( GtkWidget *label,
static void gsr2_redraw_all_cb (GncTreeViewSplitReg *view, gpointer data);
static void gnc_split_reg2_refresh_toolbar( GNCSplitReg2 *gsr );
static void gnc_split_reg2_refresh_toolbar (GNCSplitReg2 *gsr);
static void gnc_split_reg2_ld_destroy( GNCLedgerDisplay2 *ledger );
static void gnc_split_reg2_ld_destroy (GNCLedgerDisplay2 *ledger);
static Transaction* create_balancing_transaction(QofBook *book, Account *account,
static Transaction* create_balancing_transaction (QofBook *book, Account *account,
time64 statement_date, gnc_numeric balancing_amount);
void gsr2_default_schedule_handler ( GNCSplitReg2 *w, gpointer ud );
static void gsr2_emit_simple_signal( GNCSplitReg2 *gsr, const char *sigName );
static void gsr2_emit_simple_signal (GNCSplitReg2 *gsr, const char *sigName);
static void gsr2_emit_help_changed (GncTreeViewSplitReg *view, gpointer user_data);
static void gsr2_emit_include_date_signal( GNCSplitReg2 *gsr, time64 date );
/*FIXME void gnc_split_reg2_record_cb (GncTreeViewSplitReg *view, gpointer data); */
void gnc_split_reg2_recur_cb(GtkWidget *w, gpointer data);
void gnc_split_reg2_record_trans_cb(GtkWidget *w, gpointer data);
void gnc_split_reg2_style_ledger_cb (GtkWidget *w, gpointer data);
void gnc_split_reg2_style_auto_ledger_cb (GtkWidget *w, gpointer data);
void gnc_split_reg2_style_journal_cb (GtkWidget *w, gpointer data);
void gnc_split_reg2_double_line_cb (GtkWidget *w, gpointer data);
void gnc_split_reg2_destroy_cb (GtkWidget *widget, gpointer data);
static void gnc_split_reg2_class_init (GNCSplitReg2Class *class);
@ -127,7 +93,7 @@ static void gnc_split_reg2_init2 (GNCSplitReg2 *gsr);
GType
gnc_split_reg2_get_type( void )
gnc_split_reg2_get_type (void)
{
static GType gnc_split_reg2_type = 0;
@ -155,74 +121,37 @@ gnc_split_reg2_get_type( void )
}
/* SIGNALS */
enum gnc_split_reg2_signal_enum
enum
{
SCHEDULE_ENT_SIGNAL,
HELP_CHANGED_SIGNAL,
INCLUDE_DATE_SIGNAL,
HELP_CHANGED,
LAST_SIGNAL
};
static guint gnc_split_reg2_signals[LAST_SIGNAL] = { 0 };
static void
gnc_split_reg2_class_init( GNCSplitReg2Class *class )
gnc_split_reg2_class_init (GNCSplitReg2Class *class)
{
int i;
GtkObjectClass *object_class;
static struct similar_signal_info
{
enum gnc_split_reg2_signal_enum s;
const char *signal_name;
guint defaultOffset;
} signals[] =
{
{ SCHEDULE_ENT_SIGNAL, "schedule_ent", G_STRUCT_OFFSET( GNCSplitReg2Class, schedule_ent_cb ) },
{ HELP_CHANGED_SIGNAL, "help-changed", G_STRUCT_OFFSET( GNCSplitReg2Class, help_changed_cb ) },
{ INCLUDE_DATE_SIGNAL, "include-date", G_STRUCT_OFFSET( GNCSplitReg2Class, include_date_cb ) },
{ LAST_SIGNAL, NULL, 0 }
};
object_class = (GtkObjectClass*) class;
for ( i = 0; signals[i].s != INCLUDE_DATE_SIGNAL; i++ )
{
gnc_split_reg2_signals[ signals[i].s ] =
g_signal_new( signals[i].signal_name,
G_TYPE_FROM_CLASS(object_class),
G_SIGNAL_RUN_LAST,
signals[i].defaultOffset,
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0 );
}
/* Setup the non-default-marshalled signals; 'i' is still valid, here. */
/* "include-date" */
gnc_split_reg2_signals[ INCLUDE_DATE_SIGNAL ] =
g_signal_new( "include-date",
G_TYPE_FROM_CLASS(object_class),
G_SIGNAL_RUN_LAST,
signals[i++].defaultOffset,
NULL, NULL,
g_cclosure_marshal_VOID__INT, /* time64 == int */
G_TYPE_NONE, 1, G_TYPE_INT );
g_assert( i == LAST_SIGNAL );
gnc_split_reg2_signals[HELP_CHANGED] =
g_signal_new("help-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GNCSplitReg2Class, help_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/* Setup the default handlers. */
class->schedule_ent_cb = gsr2_default_schedule_handler;
class->help_changed = NULL;
class->help_changed_cb = NULL;
class->include_date_cb = NULL;
}
GtkWidget*
gnc_split_reg2_new( GNCLedgerDisplay2 *ld,
gnc_split_reg2_new (GNCLedgerDisplay2 *ld,
GtkWindow *parent,
gint numberOfLines,
gboolean read_only )
@ -232,38 +161,36 @@ gnc_split_reg2_new( GNCLedgerDisplay2 *ld,
ENTER("ld=%p, parent=%p, numberOfLines=%d, read_only=%s",
ld, parent, numberOfLines, read_only ? "TRUE" : "FALSE");
gsrToRet = g_object_new( gnc_split_reg2_get_type(), NULL );
gsrToRet = g_object_new (gnc_split_reg2_get_type(), NULL);
gsrToRet->numRows = numberOfLines;
gsrToRet->read_only = read_only;
gsrToRet->numRows = numberOfLines;
gsrToRet->read_only = read_only;
gsrToRet->ledger = ld;
gsrToRet->window = GTK_WIDGET(parent);
gsrToRet->window = GTK_WIDGET (parent);
gnc_split_reg2_init2( gsrToRet );
gnc_split_reg2_init2 (gsrToRet);
LEAVE("%p", gsrToRet);
return GTK_WIDGET( gsrToRet );
return GTK_WIDGET (gsrToRet);
}
static void
gnc_split_reg2_init( GNCSplitReg2 *gsr )
gnc_split_reg2_init (GNCSplitReg2 *gsr)
{
gsr->width = -1;
gsr->height = -1;
gsr->numRows = 10;
gsr->read_only = FALSE;
g_signal_connect( gsr, "destroy",
g_signal_connect (gsr, "destroy",
G_CALLBACK (gnc_split_reg2_destroy_cb), gsr );
}
static void
gnc_split_reg2_init2( GNCSplitReg2 *gsr )
gnc_split_reg2_init2 (GNCSplitReg2 *gsr)
{
if ( !gsr ) return;
if (!gsr) return;
gnc_split_reg2_determine_read_only( gsr );
gnc_split_reg2_determine_read_only (gsr);
gsr2_setup_status_widgets( gsr );
/* ordering is important here... setup_status before create_table */
@ -275,16 +202,14 @@ gnc_split_reg2_init2( GNCSplitReg2 *gsr )
static
void
gsr2_setup_table( GNCSplitReg2 *gsr )
gsr2_setup_table (GNCSplitReg2 *gsr)
{
GncTreeModelSplitReg *model;
ENTER("gsr=%p", gsr);
model = gnc_ledger_display2_get_split_model_register( gsr->ledger );
model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
/* events should be sufficient to redraw this */
/* gnc_ledger_display2_refresh (gsr->ledger); */
gnc_split_reg2_refresh_toolbar (gsr);
LEAVE(" ");
@ -292,7 +217,7 @@ gsr2_setup_table( GNCSplitReg2 *gsr )
static
void
gsr2_create_table( GNCSplitReg2 *gsr )
gsr2_create_table (GNCSplitReg2 *gsr)
{
GtkWidget *register_widget;
GncTreeViewSplitReg *view;
@ -324,10 +249,14 @@ gsr2_create_table( GNCSplitReg2 *gsr )
model = gnc_ledger_display2_get_split_model_register (gsr->ledger );
view = gnc_tree_view_split_reg_new_with_model (model);
g_object_unref(G_OBJECT(model));
g_object_unref (G_OBJECT (model));
gnc_tree_model_split_reg_set_display (model, ((ledger_type == LD2_SUBACCOUNT)?TRUE:FALSE), ((ledger_type == LD2_GL)?TRUE:FALSE));
// We need to give the General Ledger a Key other than all zeros which the search register gets.
if (model->type == GENERAL_LEDGER2)
gconf_key = g_strconcat (GCONF_SECTION,"/", "00000000000000000000000000000001", NULL);
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
@ -360,15 +289,6 @@ gsr2_create_table( GNCSplitReg2 *gsr )
/* This column gets all the free space */
gnc_tree_view_expand_columns (GNC_TREE_VIEW (view), "descnotes", NULL);
/*FIXME is this OK ? - Set the Reconcile column width */
// col = gnc_tree_view_find_column_by_name (GNC_TREE_VIEW (view), "recn");
// if (col != NULL)
// g_object_set (G_OBJECT(col),
// "resizable", FALSE,
// "sizing", GTK_TREE_VIEW_COLUMN_FIXED,
// "fixed-width", 15,
// NULL);
/* This sets the status color column, 4 is the minimum */
col = gnc_tree_view_find_column_by_name (GNC_TREE_VIEW (view), "status");
if (col != NULL)
@ -420,11 +340,52 @@ gnc_split_reg2_destroy_cb (GtkWidget *widget, gpointer data)
{
}
/**
* Jump to split.
**/
void
gnc_split_reg2_jump_to_split (GNCSplitReg2 *gsr, Split *split)
{
GncTreeViewSplitReg *view;
if (gsr == NULL)
return;
if (split == NULL)
return;
view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
gnc_tree_control_split_reg_jump_to_split (view, split, FALSE);
}
/**
* Move the cursor to the split in the non-blank amount column.
**/
void
gnc_split_reg2_jump_to_split_amount (GNCSplitReg2 *gsr, Split *split)
{
GncTreeViewSplitReg *view;
if (gsr == NULL)
return;
if (split == NULL)
return;
view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
gnc_tree_control_split_reg_jump_to_split (view, split, TRUE);
//FIXME this needs more
}
/**
* Raise an existing register window to the front.
**/
void
gnc_split_reg2_raise( GNCSplitReg2 *gsr )
gnc_split_reg2_raise (GNCSplitReg2 *gsr)
{
if (gsr == NULL)
return;
@ -432,7 +393,7 @@ gnc_split_reg2_raise( GNCSplitReg2 *gsr )
if (gsr->window == NULL)
return;
gtk_window_present( GTK_WINDOW(gsr->window) );
gtk_window_present (GTK_WINDOW (gsr->window));
}
@ -665,11 +626,10 @@ gsr2_redraw_all_cb (GncTreeViewSplitReg *view, gpointer user_data)
gnc_price_unref (price);
}
}
}
static void
gnc_split_reg2_refresh_toolbar( GNCSplitReg2 *gsr )
gnc_split_reg2_refresh_toolbar (GNCSplitReg2 *gsr)
{
GtkToolbarStyle tbstyle;
@ -677,23 +637,22 @@ gnc_split_reg2_refresh_toolbar( GNCSplitReg2 *gsr )
return;
tbstyle = gnc_get_toolbar_style ();
gtk_toolbar_set_style( GTK_TOOLBAR(gsr->toolbar), tbstyle );
gtk_toolbar_set_style (GTK_TOOLBAR (gsr->toolbar), tbstyle );
}
static void
gnc_split_reg2_ld_destroy (GNCLedgerDisplay2 *ledger)
{
GNCSplitReg2 *gsr = gnc_ledger_display2_get_user_data( ledger );
GNCSplitReg2 *gsr = gnc_ledger_display2_get_user_data (ledger);
gchar *gconf_key;
const GncGUID * guid;
Account * account;
account = gnc_ledger_display2_leader(ledger);
guid = xaccAccountGetGUID(account);
account = gnc_ledger_display2_leader (ledger);
guid = xaccAccountGetGUID (account);
gconf_key = (gchar*)guid_to_string (guid);
if (gsr)
{
GncTreeModelSplitReg *model;
@ -715,88 +674,16 @@ gnc_split_reg2_ld_destroy (GNCLedgerDisplay2 *ledger)
/* ########################### Handlers ############################### */
/**
* Schedules the current transaction for recurring-entry.
* If the selected transaction was created from a scheduled transaction,
* opens the editor for that Scheduled Transaction.
**/
void
gsr2_default_schedule_handler( GNCSplitReg2 *gsr, gpointer data )
gnc_split_reg2_balancing_entry (GNCSplitReg2 *gsr, Account *account,
time64 statement_date, gnc_numeric balancing_amount) // this works
{
/*FIXME*/
#ifdef skip
SplitRegister *reg = gnc_ledger_display2_get_split_register( gsr->ledger );
Transaction *pending_trans = gnc_split_register_get_current_trans (reg);
/* If the transaction has a sched-xact KVP frame, then go to the editor
* for the existing SX; otherwise, do the sx-from-trans dialog. */
{
kvp_frame *txn_frame;
kvp_value *kvp_val;
/* set a kvp-frame element in the transaction indicating and
* pointing-to the SX this was created from. */
txn_frame = xaccTransGetSlots( pending_trans );
if ( txn_frame != NULL )
{
kvp_val = kvp_frame_get_slot( txn_frame, "from-sched-xaction" );
if ( kvp_val )
{
GncGUID *fromSXId = kvp_value_get_guid( kvp_val );
SchedXaction *theSX = NULL;
GList *sxElts;
/* Get the correct SX */
for ( sxElts = gnc_book_get_schedxactions(gnc_get_current_book())->sx_list;
(!theSX) && sxElts;
sxElts = sxElts->next )
{
SchedXaction *sx = (SchedXaction*)sxElts->data;
theSX =
( ( guid_equal( xaccSchedXactionGetGUID( sx ), fromSXId ) )
? sx : NULL );
}
if ( theSX )
{
gnc_ui_scheduled_xaction_editor_dialog_create(theSX, FALSE);
return;
}
}
}
}
gnc_sx_create_from_trans(pending_trans);
#endif
}
void
gnc_split_reg2_recur_cb(GtkWidget *w, gpointer data)
{
/*FIXME GNCSplitReg2 *gsr = data;
gsr2_emit_simple_signal( gsr, "schedule_ent" );*/
}
/**
* Records into the books the currently-selected transaction.
**/
void
gnc_split_reg2_record_trans_cb (GtkWidget *w, gpointer data)
{
/*FIXME GNCSplitReg2 *gsr = data;
gsr2_emit_simple_signal( gsr, "enter_ent" );*/
}
void
gnc_split_reg2_balancing_entry(GNCSplitReg2 *gsr, Account *account,
time64 statement_date, gnc_numeric balancing_amount)
{
/*FIXME*/
#ifdef skip
GncTreeViewSplitReg *view;
Transaction *transaction;
Split *split;
view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
// create transaction
transaction = create_balancing_transaction (gnc_get_current_book(),
account, statement_date, balancing_amount);
@ -807,14 +694,13 @@ gnc_split_reg2_balancing_entry(GNCSplitReg2 *gsr, Account *account,
{
// default behaviour: jump to blank split
g_warning("create_balancing_transaction failed");
gnc_split_reg2_jump_to_blank (gsr);
gnc_tree_control_split_reg_jump_to_blank (view);
}
else
{
// goto balancing transaction
gnc_split_reg2_jump_to_split (gsr, split );
gnc_tree_control_split_reg_jump_to_split (view, split, FALSE);
}
#endif
}
static Transaction*
@ -860,10 +746,8 @@ create_balancing_transaction (QofBook *book, Account *account,
return trans;
}
/* ############################## End Handlers ############################ */
void
gnc_split_reg2_change_style (GNCSplitReg2 *gsr, SplitRegisterStyle2 style)
{
@ -924,74 +808,6 @@ gnc_split_reg2_double_line_cb (GtkWidget *w, gpointer data)
gnc_ledger_display2_refresh (gsr->ledger);
}
static void
gnc_split_reg2_record (GNCSplitReg2 *gsr)
{
/*FIXME*/
#ifdef skip
SplitRegister *reg;
Transaction *trans;
ENTER("gsr=%p", gsr);
reg = gnc_ledger_display2_get_split_register (gsr->ledger);
trans = gnc_split_register_get_current_trans (reg);
if (!gnc_split_register_save (reg, TRUE))
{
LEAVE("no save");
return;
}
gsr2_emit_include_date_signal( gsr, xaccTransGetDate(trans) );
/* Explicit redraw shouldn't be needed,
* since gui_refresh events should handle this. */
/* gnc_split_register_redraw (reg); */
LEAVE(" ");
#endif
}
static gboolean
gnc_split_reg2_match_trans_row( VirtualLocation virt_loc,
gpointer user_data )
{
/*FIXME*/
#ifdef skip
GNCSplitReg2 *gsr = user_data;
CursorClass cursor_class;
SplitRegister *sr;
sr = gnc_ledger_display2_get_split_register (gsr->ledger);
cursor_class = gnc_split_register_get_cursor_class (sr, virt_loc.vcell_loc);
return (cursor_class == CURSOR_CLASS_TRANS);
#endif
return FALSE;
}
static void
gnc_split_reg2_goto_next_trans_row (GNCSplitReg2 *gsr)
{
/*FIXME*/
#ifdef skip
ENTER("gsr=%p", gsr);
gnucash_register_goto_next_matching_row( gsr->reg,
gnc_split_reg2_match_trans_row,
gsr );
LEAVE(" ");
#endif
}
#ifdef skip
void
gnc_split_reg2_record_cb (GnucashRegister *reg, gpointer data)
{
/*FIXME gsr2_emit_simple_signal( (GNCSplitReg2*)data, "enter_ent" );*/
}
#endif
static
GtkWidget*
add_summary_label (GtkWidget *summarybar, const char *label_str)
@ -1204,13 +1020,6 @@ gsr2_emit_help_changed (GncTreeViewSplitReg *view, gpointer user_data) //this wo
gsr2_emit_simple_signal ((GNCSplitReg2*)user_data, "help-changed" );
}
static
void
gsr2_emit_include_date_signal( GNCSplitReg2 *gsr, time64 date )
{
g_signal_emit_by_name( gsr, "include-date", date, NULL );
}
static
void
gsr2_emit_simple_signal (GNCSplitReg2 *gsr, const char *sigName) //this works
@ -1244,5 +1053,5 @@ gnc_split_reg2_get_read_only (GNCSplitReg2 *gsr)
void
gnc_split_reg2_set_moved_cb (GNCSplitReg2 *gsr, GFunc cb, gpointer cb_data ) //this works
{
gnc_tree_view_split_reg_moved_cb (gnc_ledger_display2_get_split_view_register(gsr->ledger), cb, cb_data);
gnc_tree_view_split_reg_moved_cb (gnc_ledger_display2_get_split_view_register (gsr->ledger), cb, cb_data);
}

View File

@ -1,5 +1,5 @@
/********************************************************************\
* gnc-split-reg2.h -- A widget for the common register look-n-feel. *
* gnc-split-reg2.h -- A widget for the common register look-n-feel.*
* Copyright (C) 1997 Robin D. Clark *
* Copyright (C) 1997-1998 Linas Vepstas <linas@linas.org> *
* Copyright (C) 1998 Rob Browning <rlb@cs.utexas.edu> *
@ -31,7 +31,6 @@
#define GNC_SPLIT_REG2_H
#include "gnc-ledger-display2.h"
#include "gnucash-sheet.h"
#include "gnc-split-reg.h"
#include "gnc-tree-view-split-reg.h"
@ -49,25 +48,10 @@ struct _GNCSplitReg2
/* The containing window. */
GtkWidget *window;
gint width;
gint height;
GtkWidget *toolbar;
GtkWidget *summarybar;
GtkWidget *popup_menu;
GtkWidget *edit_menu;
GtkWidget *view_menu;
GtkWidget *style_submenu;
GtkWidget *action_menu;
GtkWidget *double_line_check;
GtkWidget *split_button;
GtkWidget *split_menu_check;
GtkWidget *split_popup_check;
/* Summary Bar Labels */
GtkWidget *balance_label;
GtkWidget *cleared_label;
@ -80,9 +64,6 @@ struct _GNCSplitReg2
/** The current ledger display. **/
GNCLedgerDisplay2 *ledger;
/** The actual sheet widget. **/
GnucashRegister *reg;
gint numRows;
gboolean read_only;
@ -93,26 +74,12 @@ struct _GNCSplitReg2Class
GtkVBoxClass parent_class;
/* Signal defaults */
void (*schedule_ent_cb) ( GNCSplitReg2 *w, gpointer user_data );
void (*help_changed_cb) ( GNCSplitReg2 *w, gpointer user_data );
void (*include_date_cb) ( GNCSplitReg2 *w, time64 date, gpointer user_data );
void (*help_changed) ( GNCSplitReg2 *w, gpointer user_data );
};
#ifdef skip // Coming from original gnc-split-reg.h
typedef enum
{
SCHEDULE,
SPLIT,
STYLE_SUBMENU,
} GNC_SPLIT_REG2_ITEM;
#endif
/*FIXME Note sure about this == Coming from original gnc-split-reg.h */
typedef GNC_SPLIT_REG_ITEM GNC_SPLIT_REG2_ITEM;
/**
* GTK-related; gets an identifier for the class of GNCSplitRegs.
**/
@ -150,7 +117,21 @@ void gnc_split_reg2_change_style (GNCSplitReg2 *gsr, SplitRegisterStyle2 style);
**/
GtkWidget *gnc_split_reg2_get_summarybar (GNCSplitReg2 *gsr );
void gnc_split_reg2_raise (GNCSplitReg2 *gsr );
/**
* Jump to split.
**/
void gnc_split_reg2_jump_to_split (GNCSplitReg2 *gsr, Split *split);
/**
* Move the cursor to the split in the non-blank amount column.
**/
void gnc_split_reg2_jump_to_split_amount (GNCSplitReg2 *gsr, Split *split);
/**
* Raise an existing register window to the front.
**/
void gnc_split_reg2_raise (GNCSplitReg2 *gsr);
/**
* Callers can use this to determine if they need to reflect some "read-only"
@ -169,7 +150,6 @@ gboolean gnc_split_reg2_get_read_only (GNCSplitReg2 *gsr );
void gnc_split_reg2_balancing_entry (GNCSplitReg2 *gsr, Account *account,
time64 statement_date, gnc_numeric balancing_amount);
void gsr2_default_schedule_handler (GNCSplitReg2 *gsr, gpointer data );
void gnc_split_reg2_set_moved_cb (GNCSplitReg2 *gsr, GFunc cb, gpointer cb_data );

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
/********************************************************************\
* window-reconcile2.h -- 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 *
* published by the Free Software Foundation; either version 2 of *
* the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License*
* along with this program; if not, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652 *
* Boston, MA 02110-1301, USA gnu@gnu.org *
\********************************************************************/
#ifndef WINDOW_RECONCILE2_H
#define WINDOW_RECONCILE2_H
#include "Account.h"
#include <gtk/gtk.h>
/** STRUCTS *********************************************************/
typedef struct _RecnWindow2 RecnWindow2;
/** PROTOTYPES ******************************************************/
/********************************************************************\
* recnWindow2 *
* opens up the window to reconcile an account *
* *
* Args: parent - the parent of this window *
* account - the account to reconcile *
*
* Return: recnData - the instance of this RecnWindow2, or NULL if the
* user pressed Cancel in the initial date query.
\********************************************************************/
RecnWindow2 *recnWindow2 (GtkWidget *parent, Account *account);
/********************************************************************\
* recnWindow2WithBalance
*
* Opens up the window to reconcile an account, but with ending
* balance and statement date already given.
*
* Args: parent - The parent widget of the new window
* account - The account to reconcile
* new_ending - The amount for ending balance
* statement_date - The date of the statement
* Return: recnData - the instance of this RecnWindow2
\********************************************************************/
RecnWindow2 *recnWindow2WithBalance (GtkWidget *parent,
Account *account,
gnc_numeric new_ending,
time64 statement_date);
void gnc_ui_reconcile_window2_raise (RecnWindow2 * recnData);
#endif /* WINDOW_RECONCILE2_H */

View File

@ -437,7 +437,7 @@ gnc_ledger_display2_gl (void)
ENTER(" ");
query = qof_query_create_for(GNC_ID_SPLIT);
query = qof_query_create_for (GNC_ID_SPLIT);
qof_query_set_book (query, gnc_get_current_book());
@ -826,8 +826,9 @@ gnc_ledger_display2_internal (Account *lead_account, Query *q,
gnc_tree_model_split_reg_set_data (ld->model, ld, gnc_ledger_display2_parent);
//FIXME Not Needed ? g_signal_connect (G_OBJECT (ld->model), "refresh_signal",
// G_CALLBACK ( gnc_ledger_display2_refresh_cb ), ld );
// This sets up a call back for the search_ledger2 to reload after changes
g_signal_connect (G_OBJECT (ld->model), "refresh_view",
G_CALLBACK (gnc_ledger_display2_refresh_cb), ld );
splits = qof_query_run (ld->query);
@ -868,6 +869,28 @@ gnc_ledger_display2_set_query (GNCLedgerDisplay2 *ledger_display, Query *q)
ledger_display->query = qof_query_copy (q);
}
GNCLedgerDisplay2 *
gnc_ledger_display2_find_by_query (Query *q)
{
GNCLedgerDisplay2 *ledger_display;
GncTreeModelSplitReg *model;
if (!q)
return NULL;
ledger_display = gnc_find_first_gui_component (REGISTER_GL_CM_CLASS, find_by_query, q);
if (ledger_display)
{
model = ledger_display->model;
// To get a new search page from a general ledger, search register is a LD2_GL also.
if (model->type == GENERAL_LEDGER2)
ledger_display = NULL;
}
return ledger_display;
}
#ifdef skip
GNCLedgerDisplay2 *
gnc_ledger_display2_find_by_query (Query *q)
{
@ -876,6 +899,8 @@ gnc_ledger_display2_find_by_query (Query *q)
return gnc_find_first_gui_component (REGISTER_GL_CM_CLASS, find_by_query, q);
}
#endif
/********************************************************************\
* refresh only the indicated register window *
@ -884,6 +909,8 @@ gnc_ledger_display2_find_by_query (Query *q)
static void
gnc_ledger_display2_refresh_internal (GNCLedgerDisplay2 *ld, GList *splits)
{
GtkTreeModel *s_model, *f_model, *model;
if (!ld || ld->loading)
return;
@ -895,11 +922,33 @@ gnc_ledger_display2_refresh_internal (GNCLedgerDisplay2 *ld, GList *splits)
}
else
{
/* This is used for the reloading of registers to refresh them and to update the search_ledger */
ld->loading = TRUE;
s_model = gtk_tree_view_get_model (GTK_TREE_VIEW (ld->view)); // this is the sort model
f_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (s_model)); // this is the filter model
model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (f_model)); // our model
g_object_ref (s_model);
g_object_ref (f_model);
g_object_ref (model);
gnc_tree_view_split_reg_block_selection (ld->view, TRUE); // This blocks the tree selection
gtk_tree_view_set_model (GTK_TREE_VIEW (ld->view), NULL); // Detach sort model from view
gnc_tree_model_split_reg_load (ld->model, splits, gnc_ledger_display2_leader (ld)); //reload splits
gtk_tree_view_set_model (GTK_TREE_VIEW (ld->view), GTK_TREE_MODEL (s_model)); // Re-attach sort model to view
gnc_tree_view_split_reg_block_selection (ld->view, FALSE); // This unblocks the tree selection
/* Set the default selection start position */
gnc_tree_view_split_reg_default_selection (ld->view);
g_object_unref (model);
g_object_unref (f_model);
g_object_unref (s_model);
ld->loading = FALSE;
}
}
@ -985,13 +1034,15 @@ gnc_ledger_display2_set_split_view_refresh (GNCLedgerDisplay2 *ld, gboolean ok)
ld->refresh_ok = ok;
}
/* This is used for the search_ledger2 reload after any changes made */
static void
gnc_ledger_display2_refresh_cb (GncTreeModelSplitReg *model, gpointer user_data)
{
GNCLedgerDisplay2 *ld = user_data;
/* Refresh the view when idle */
g_idle_add ((GSourceFunc)gnc_ledger_display2_refresh, ld);
if (model->type == SEARCH_LEDGER2)
/* Refresh the view when idle */
g_idle_add ((GSourceFunc)gnc_ledger_display2_refresh, ld);
}
void