Index: src/register/ledger-core/gnc-ledger-display2.h
===================================================================
--- src/register/ledger-core/gnc-ledger-display2.h	(revision 0)
+++ src/register/ledger-core/gnc-ledger-display2.h	(revision 0)
@@ -0,0 +1,141 @@
+/********************************************************************\
+ * gnc-ledger-display.h -- utilities for dealing with multiple      *
+ *                         register/ledger windows in GnuCash       *
+ *                                                                  *
+ * Copyright (C) 1997 Robin D. Clark                                *
+ * Copyright (C) 1997, 1998 Linas Vepstas                           *
+ * Copyright (C) 2001 Linux Developers Group                        *
+ *                                                                  *
+ * 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, write to the Free Software      *
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.        *
+ *                                                                  *
+\********************************************************************/
+
+#ifndef GNC_LEDGER_DISPLAY2_H
+#define GNC_LEDGER_DISPLAY2_H
+
+#include <glib.h>
+
+#include "Account.h"
+#include "Query.h"
+
+#include "split-register.h" 
+
+#include "SchedXaction.h"
+#include "Transaction.h"
+#include "gnc-tree-model-split-reg.h"
+#include "gnc-tree-view-split-reg.h"
+
+/** Definitions *****************************************************/
+
+/* The GNCLedgerDisplay2 struct describes a single register/ledger
+ * instance.  It has a SplitRegister specially configured for
+ * displaying the results of a Query.  It also stores the Query.  */
+typedef struct gnc_ledger_display2 GNCLedgerDisplay2;
+
+typedef void (*GNCLedgerDisplay2Destroy) (GNCLedgerDisplay2 *ld);
+typedef GtkWidget *(*GNCLedgerDisplay2GetParent) (GNCLedgerDisplay2 *ld);
+typedef void (*GNCLedgerDisplay2SetHelp) (GNCLedgerDisplay2 *ld,
+        const char *help_str);
+
+
+typedef enum
+{
+    LD2_SINGLE,
+    LD2_SUBACCOUNT,
+    LD2_GL,
+} GNCLedgerDisplay2Type;
+
+
+/** Prototypes ******************************************************/
+
+/* returns the 'lead' account of a ledger display, or NULL if none. */
+Account * gnc_ledger_display2_leader (GNCLedgerDisplay2 *ld);
+
+GNCLedgerDisplay2Type gnc_ledger_display2_type (GNCLedgerDisplay2 *ld);
+
+/* get and set the user data associated with the ledger */
+void gnc_ledger_display2_set_user_data (GNCLedgerDisplay2 *ld,
+                                       gpointer user_data);
+gpointer gnc_ledger_display2_get_user_data (GNCLedgerDisplay2 *ld);
+
+/* set the handlers used by the ledger display */
+void gnc_ledger_display2_set_handlers (GNCLedgerDisplay2 *ld,
+                                      GNCLedgerDisplay2Destroy destroy,
+                                      GNCLedgerDisplay2GetParent get_parent);
+
+/* Set and Get the tree view used by the ledger display */
+void gnc_ledger_display2_set_split_view_register (GNCLedgerDisplay2 *ld, GncTreeViewSplitReg *view);
+GncTreeViewSplitReg * gnc_ledger_display2_get_split_view_register (GNCLedgerDisplay2 *ld);
+
+void gnc_ledger_display2_set_split_view_refresh (GNCLedgerDisplay2 *ld, gboolean ok);
+
+/** Returns the parent of a given ledger display */
+GtkWidget *gnc_ledger_display2_get_parent( GNCLedgerDisplay2 *ld );
+
+/* return the split register associated with a ledger display */
+SplitRegister * gnc_ledger_display2_get_split_register (GNCLedgerDisplay2 *ld);
+
+/* return the split register associated with a ledger display */
+GncTreeModelSplitReg * gnc_ledger_display2_get_split_model_register (GNCLedgerDisplay2 *ld);
+
+
+/* opens up a register window to display a single account */
+GNCLedgerDisplay2 * gnc_ledger_display2_simple (Account *account);
+
+/* opens up a register window to display the parent account and all of
+ * its children. */
+GNCLedgerDisplay2 * gnc_ledger_display2_subaccounts (Account *account);
+
+/* opens up a general ledger window */
+GNCLedgerDisplay2 * gnc_ledger_display2_gl (void);
+
+/**
+ * Displays a template ledger.
+ * This lists template Splits from the given ScheduledTransaction.
+ *
+ * Really, requires a GList of scheduled transactions and kvp-frame
+ * data.
+ **/
+GNCLedgerDisplay2 * gnc_ledger_display2_template_gl (char *id);
+
+/* display a general ledger for an arbitrary query */
+GNCLedgerDisplay2 * gnc_ledger_display2_query (Query *query,
+        SplitRegisterType2 type,
+        SplitRegisterStyle2 style);
+
+/* Set the query used for a register. */
+void gnc_ledger_display2_set_query (GNCLedgerDisplay2 *ledger_display,
+                                   Query *q);
+
+/* return the query associated with a ledger */
+Query * gnc_ledger_display2_get_query (GNCLedgerDisplay2 *ld);
+
+/* If the given ledger display still exists, return it. Otherwise,
+ * return NULL */
+GNCLedgerDisplay2 * gnc_ledger_display2_find_by_query (Query *q);
+
+/* redisplay/redraw only the indicated window. Both routines do same
+ * thing, they differ only by the argument they take. */
+void gnc_ledger_display2_refresh (GNCLedgerDisplay2 * ledger_display);
+void gnc_ledger_display2_refresh_by_split_register (GncTreeModelSplitReg *model);
+
+/* close the window */
+void gnc_ledger_display2_close (GNCLedgerDisplay2 * ledger_display);
+
+/* Returns a boolean of whether this display should be single or double lined
+ * mode by default */
+gboolean gnc_ledger_display2_default_double_line (GNCLedgerDisplay2 *gld);
+
+#endif
Index: src/register/ledger-core/Makefile.am
===================================================================
--- src/register/ledger-core/Makefile.am	(revision 22433)
+++ src/register/ledger-core/Makefile.am	(working copy)
@@ -4,6 +4,7 @@
 
 libgncmod_ledger_core_la_SOURCES = \
   gnc-ledger-display.c \
+  gnc-ledger-display2.c \
   gncmod-ledger-core.c \
   split-register.c \
   split-register-control.c \
@@ -15,6 +16,7 @@
 
 noinst_HEADERS = \
   gnc-ledger-display.h \
+  gnc-ledger-display2.h \
   split-register.h \
   split-register-control.h \
   split-register-layout.h \
Index: src/register/ledger-core/gnc-ledger-display2.c
===================================================================
--- src/register/ledger-core/gnc-ledger-display2.c	(revision 0)
+++ src/register/ledger-core/gnc-ledger-display2.c	(revision 0)
@@ -0,0 +1,1000 @@
+/********************************************************************\
+ * gnc-ledger-display.c -- utilities for dealing with multiple      *
+ *                         register/ledger windows in GnuCash       *
+ *                                                                  *
+ * Copyright (C) 1997 Robin D. Clark                                *
+ * Copyright (C) 1997, 1998 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, write to the Free Software      *
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.        *
+ *                                                                  *
+\********************************************************************/
+
+#include "config.h"
+
+#include <time.h>
+
+#include "Account.h"
+#include "Query.h"
+#include "qof.h"
+#include "SX-book.h"
+#include "Transaction.h"
+#include "gnc-component-manager.h"
+#include "gnc-date.h"
+#include "gnc-engine.h"
+#include "gnc-event.h"
+#include "gnc-gconf-utils.h"
+#include "gnc-ledger-display2.h"
+#include "gnc-ui-util.h"
+
+#include "split-register-control.h"
+#include "split-register-model.h"
+
+#include "gnc-tree-model-split-reg.h"
+
+
+#define REGISTER_SINGLE_CM_CLASS     "register-single"
+#define REGISTER_SUBACCOUNT_CM_CLASS "register-subaccount"
+#define REGISTER_GL_CM_CLASS         "register-gl"
+#define REGISTER_TEMPLATE_CM_CLASS   "register-template"
+
+
+struct gnc_ledger_display2
+{
+    GncGUID leader;
+
+    Query *query;
+
+    GNCLedgerDisplay2Type ld_type;
+
+    /* Needs to be removed at some point */
+    SplitRegister *reg;
+
+    GncTreeModelSplitReg *model; //FIXME Might get rid of this and use function to find.
+    GncTreeViewSplitReg *view;
+
+    gboolean refresh_ok;
+
+    gboolean loading;
+    gboolean use_double_line_default;
+
+    GNCLedgerDisplay2Destroy destroy;
+    GNCLedgerDisplay2GetParent get_parent;
+
+    gpointer user_data;
+
+    gint component_id;
+};
+
+
+/** GLOBALS *********************************************************/
+static QofLogModule log_module = GNC_MOD_LEDGER;
+
+
+/** Declarations ****************************************************/
+static GNCLedgerDisplay2 *
+gnc_ledger_display2_internal (Account *lead_account, Query *q,
+                             GNCLedgerDisplay2Type ld_type,
+                             SplitRegisterType2 reg_type,
+                             SplitRegisterStyle2 style,
+                             gboolean use_double_line,
+                             gboolean is_template);
+
+static void gnc_ledger_display2_refresh_internal (GNCLedgerDisplay2 *ld, GList *splits);
+
+
+/** Implementations *************************************************/
+
+Account *
+gnc_ledger_display2_leader (GNCLedgerDisplay2 *ld)
+{
+    if (!ld)
+        return NULL;
+
+    return xaccAccountLookup (&ld->leader, gnc_get_current_book ());
+}
+
+GNCLedgerDisplay2Type
+gnc_ledger_display2_type (GNCLedgerDisplay2 *ld)
+{
+    if (!ld)
+        return -1;
+
+    return ld->ld_type;
+}
+
+void
+gnc_ledger_display2_set_user_data (GNCLedgerDisplay2 *ld, gpointer user_data)
+{
+    if (!ld)
+        return;
+
+    ld->user_data = user_data;
+}
+
+gpointer
+gnc_ledger_display2_get_user_data (GNCLedgerDisplay2 *ld)
+{
+    if (!ld)
+        return NULL;
+
+    return ld->user_data;
+}
+
+void
+gnc_ledger_display2_set_handlers (GNCLedgerDisplay2 *ld,
+                                 GNCLedgerDisplay2Destroy destroy,
+                                 GNCLedgerDisplay2GetParent get_parent)
+{
+    if (!ld)
+        return;
+
+    ld->destroy = destroy;
+    ld->get_parent = get_parent;
+}
+
+/*FIXME */
+SplitRegister *
+gnc_ledger_display2_get_split_register (GNCLedgerDisplay2 *ld)
+{
+    if (!ld)
+        return NULL;
+
+    return ld->reg;
+}
+
+
+GncTreeModelSplitReg *
+gnc_ledger_display2_get_split_model_register (GNCLedgerDisplay2 *ld)
+{
+    if (!ld)
+        return NULL;
+
+    return ld->model;
+}
+
+Query *
+gnc_ledger_display2_get_query (GNCLedgerDisplay2 *ld)
+{
+    if (!ld)
+        return NULL;
+
+    return ld->query;
+}
+
+static gboolean
+find_by_leader (gpointer find_data, gpointer user_data)
+{
+    Account *account = find_data;
+    GNCLedgerDisplay2 *ld = user_data;
+
+    if (!account || !ld)
+        return FALSE;
+
+    return (account == gnc_ledger_display2_leader (ld));
+}
+
+static gboolean
+find_by_query (gpointer find_data, gpointer user_data)
+{
+    Query *q = find_data;
+    GNCLedgerDisplay2 *ld = user_data;
+
+    if (!q || !ld)
+        return FALSE;
+
+    return ld->query == q;
+}
+
+
+static gboolean
+find_by_reg (gpointer find_data, gpointer user_data)
+{
+    GncTreeModelSplitReg *model = find_data;
+    GNCLedgerDisplay2 *ld = user_data;
+
+    if (!model || !ld)
+        return FALSE;
+
+    return ld->model == model;
+}
+
+
+static SplitRegisterStyle2
+gnc_get_default_register_style (GNCAccountType type)
+{
+    SplitRegisterStyle2 new_style = REG2_STYLE_LEDGER;
+    gchar *style_string;
+
+    switch (type)
+    {
+#if 0
+    case ACCT_TYPE_PAYABLE:
+    case ACCT_TYPE_RECEIVABLE:
+        new_style = REG_STYLE_LEDGER;
+        break;
+#endif
+
+    default:
+        style_string = gnc_gconf_get_string(GCONF_GENERAL_REGISTER,
+                                            "default_style", NULL);
+        if (g_strcmp0(style_string, "journal") == 0)
+            new_style = REG2_STYLE_JOURNAL;
+        else if (g_strcmp0(style_string, "auto_ledger") == 0)
+            new_style = REG2_STYLE_AUTO_LEDGER;
+        else
+            new_style = REG2_STYLE_LEDGER;
+
+        if (style_string != NULL)
+            g_free(style_string);
+
+        break;
+    }
+
+    return new_style;
+}
+
+static gpointer
+look_for_portfolio_cb (Account *account, gpointer data)
+{
+    return xaccAccountIsPriced(account) ? (gpointer) PORTFOLIO_LEDGER2 : NULL;
+}
+
+static SplitRegisterType2
+gnc_get_reg_type (Account *leader, GNCLedgerDisplay2Type ld_type)
+{
+    GNCAccountType account_type;
+    SplitRegisterType2 reg_type;
+
+    if (ld_type == LD2_GL)
+        return GENERAL_LEDGER2;
+
+    account_type = xaccAccountGetType (leader);
+
+    if (ld_type == LD2_SINGLE)
+    {
+        switch (account_type)
+        {
+        case ACCT_TYPE_BANK:
+            return BANK_REGISTER2;
+
+        case ACCT_TYPE_CASH:
+            return CASH_REGISTER2;
+
+        case ACCT_TYPE_ASSET:
+            return ASSET_REGISTER2;
+
+        case ACCT_TYPE_CREDIT:
+            return CREDIT_REGISTER2;
+
+        case ACCT_TYPE_LIABILITY:
+            return LIABILITY_REGISTER2;
+
+        case ACCT_TYPE_PAYABLE:
+            return PAYABLE_REGISTER2;
+
+        case ACCT_TYPE_RECEIVABLE:
+            return RECEIVABLE_REGISTER2;
+
+        case ACCT_TYPE_STOCK:
+        case ACCT_TYPE_MUTUAL:
+            return STOCK_REGISTER2;
+
+        case ACCT_TYPE_INCOME:
+            return INCOME_REGISTER2;
+
+        case ACCT_TYPE_EXPENSE:
+            return EXPENSE_REGISTER2;
+
+        case ACCT_TYPE_EQUITY:
+            return EQUITY_REGISTER2;
+
+        case ACCT_TYPE_CURRENCY:
+            return CURRENCY_REGISTER2;
+
+        case ACCT_TYPE_TRADING:
+            return TRADING_REGISTER2;
+
+        default:
+            PERR ("unknown account type %d\n", account_type);
+            return BANK_REGISTER2;
+        }
+    }
+
+    if (ld_type != LD2_SUBACCOUNT)
+    {
+        PERR ("unknown ledger type %d\n", ld_type);
+        return BANK_REGISTER2;
+    }
+
+    switch (account_type)
+    {
+    case ACCT_TYPE_BANK:
+    case ACCT_TYPE_CASH:
+    case ACCT_TYPE_ASSET:
+    case ACCT_TYPE_CREDIT:
+    case ACCT_TYPE_LIABILITY:
+    case ACCT_TYPE_RECEIVABLE:
+    case ACCT_TYPE_PAYABLE:
+    {
+        /* If any of the sub-accounts have ACCT_TYPE_STOCK or
+         * ACCT_TYPE_MUTUAL types, then we must use the PORTFOLIO_LEDGER
+         * ledger. Otherwise, a plain old GENERAL_LEDGER will do. */
+        gpointer ret;
+        reg_type = GENERAL_LEDGER2;
+
+        ret = gnc_account_foreach_descendant_until(leader, look_for_portfolio_cb, NULL);
+        if (ret) reg_type = PORTFOLIO_LEDGER2;
+        break;
+    }
+
+    case ACCT_TYPE_STOCK:
+    case ACCT_TYPE_MUTUAL:
+    case ACCT_TYPE_CURRENCY:
+        reg_type = PORTFOLIO_LEDGER2;
+        break;
+
+    case ACCT_TYPE_INCOME:
+    case ACCT_TYPE_EXPENSE:
+        reg_type = INCOME_LEDGER2;
+        break;
+
+    case ACCT_TYPE_EQUITY:
+    case ACCT_TYPE_TRADING:
+        reg_type = GENERAL_LEDGER2;
+        break;
+
+    default:
+        PERR ("unknown account type:%d", account_type);
+        reg_type = GENERAL_LEDGER2;
+        break;
+    }
+
+    return reg_type;
+}
+
+/* Returns a boolean of whether this display should be single or double lined
+ * mode by default */
+gboolean
+gnc_ledger_display2_default_double_line (GNCLedgerDisplay2 *gld)
+{
+    return (gld->use_double_line_default ||
+            gnc_gconf_get_bool(GCONF_GENERAL_REGISTER, "double_line_mode", NULL));
+}
+
+/* Opens up a register window to display a single account */
+GNCLedgerDisplay2 *
+gnc_ledger_display2_simple (Account *account)
+{
+    SplitRegisterType2 reg_type;
+    GNCAccountType acc_type = xaccAccountGetType (account);
+    gboolean use_double_line;
+    GNCLedgerDisplay2 *ld;
+
+    ENTER("account=%p", account);
+
+    switch (acc_type)
+    {
+    case ACCT_TYPE_PAYABLE:
+    case ACCT_TYPE_RECEIVABLE:
+        use_double_line = TRUE;
+        break;
+    default:
+        use_double_line = FALSE;
+        break;
+    }
+
+    reg_type = gnc_get_reg_type (account, LD2_SINGLE);
+
+    ld = gnc_ledger_display2_internal (account, NULL, LD2_SINGLE, reg_type,
+                                      gnc_get_default_register_style(acc_type),
+                                      use_double_line, FALSE);
+    LEAVE("%p", ld);
+    return ld;
+}
+
+/* Opens up a register window to display an account, and all of its
+ *   children, in the same window */
+GNCLedgerDisplay2 *
+gnc_ledger_display2_subaccounts (Account *account)
+{
+    SplitRegisterType2 reg_type;
+    GNCLedgerDisplay2 *ld;
+
+    ENTER("account=%p", account);
+
+    reg_type = gnc_get_reg_type (account, LD2_SUBACCOUNT);
+
+    ld = gnc_ledger_display2_internal (account, NULL, LD2_SUBACCOUNT,
+                                      reg_type, REG2_STYLE_JOURNAL, FALSE,
+                                      FALSE);
+    LEAVE("%p", ld);
+    return ld;
+}
+
+/* Opens up a general ledger window. */
+GNCLedgerDisplay2 *
+gnc_ledger_display2_gl (void)
+{
+    Query *query;
+    time_t start;
+    struct tm tm;
+    GNCLedgerDisplay2 *ld;
+
+    ENTER(" ");
+
+    query = qof_query_create_for(GNC_ID_SPLIT);
+
+    qof_query_set_book (query, 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 */
+    {
+        Account *tRoot;
+        GList *al;
+
+        tRoot = gnc_book_get_template_root( gnc_get_current_book() );
+        al = gnc_account_get_descendants( tRoot );
+        xaccQueryAddAccountMatch( query, al, QOF_GUID_MATCH_NONE, QOF_QUERY_AND );
+        g_list_free (al);
+        al = NULL;
+        tRoot = NULL;
+    }
+
+    gnc_tm_get_today_start(&tm);
+    tm.tm_mon--; /* Default the register to the last month's worth of transactions. */
+    start = mktime (&tm);
+    xaccQueryAddDateMatchTT (query,
+                             TRUE, start,
+                             FALSE, 0,
+                             QOF_QUERY_AND);
+
+    ld = gnc_ledger_display2_internal (NULL, query, LD2_GL, GENERAL_LEDGER2,
+                                      REG2_STYLE_JOURNAL, FALSE, FALSE);
+    LEAVE("%p", ld);
+    return ld;
+}
+
+/**
+ * @param id: The string version of the GncGUID of the context of template
+ * transaction being edited in this template GL.  As used by scheduled
+ * transactions, this is the GncGUID of the SX itself which is magically the
+ * *name* of the (template) account which contains the transactions for this
+ * scheduled transaction.  That's right.  The stringified GncGUID of the SX is
+ * the name of the SX'es template account.
+ **/
+GNCLedgerDisplay2 *
+gnc_ledger_display2_template_gl (char *id)
+{
+    QofBook *book;
+    Query *q;
+    GNCLedgerDisplay2 *ld;
+    GncTreeModelSplitReg *model;
+    Account *root, *acct;
+    gboolean isTemplateModeTrue;
+
+    ENTER("id=%s", id ? id : "(null)");
+
+    acct = NULL;
+    isTemplateModeTrue = TRUE;
+
+    q = qof_query_create_for(GNC_ID_SPLIT);
+
+    book = gnc_get_current_book ();
+    qof_query_set_book (q, book);
+
+    if ( id != NULL )
+    {
+        root = gnc_book_get_template_root (book);
+        acct = gnc_account_lookup_by_name(root, id);
+        g_assert( acct );
+        xaccQueryAddSingleAccountMatch (q, acct, QOF_QUERY_AND);
+    }
+
+    ld = gnc_ledger_display2_internal (NULL, q, LD2_GL,
+                                      SEARCH_LEDGER2,
+                                      REG2_STYLE_JOURNAL,
+                                      FALSE,
+                                      isTemplateModeTrue);
+
+
+    model = gnc_ledger_display2_get_split_model_register (ld);
+    if ( acct )
+    {
+        gnc_tree_model_split_reg_set_template_account (model, acct);
+    }
+
+    LEAVE("%p", ld);
+    return ld;
+}
+
+GtkWidget *
+gnc_ledger_display2_get_parent( GNCLedgerDisplay2 *ld )
+{
+    if ( ld == NULL )
+        return NULL;
+
+    if ( ld->get_parent == NULL )
+        return NULL;
+
+    return ld->get_parent( ld );
+}
+
+static GtkWidget *
+gnc_ledger_display2_parent (void *user_data)
+{
+    GNCLedgerDisplay2 *ld = user_data;
+    return gnc_ledger_display2_get_parent( ld );
+}
+
+static void
+gnc_ledger_display2_set_watches (GNCLedgerDisplay2 *ld, GList *splits)
+{
+    GList *node;
+
+    gnc_gui_component_clear_watches (ld->component_id);
+
+    gnc_gui_component_watch_entity_type (ld->component_id,
+                                         GNC_ID_ACCOUNT,
+                                         QOF_EVENT_MODIFY | QOF_EVENT_DESTROY
+                                         | GNC_EVENT_ITEM_CHANGED);
+
+    for (node = splits; node; node = node->next)
+    {
+        Split *split = node->data;
+        Transaction *trans = xaccSplitGetParent (split);
+
+        gnc_gui_component_watch_entity (ld->component_id,
+                                        xaccTransGetGUID (trans),
+                                        QOF_EVENT_MODIFY);
+    }
+}
+
+static void
+refresh_handler (GHashTable *changes, gpointer user_data)
+{
+    GNCLedgerDisplay2 *ld = user_data;
+    const EventInfo *info;
+    gboolean has_leader;
+    GList *splits;
+
+    ENTER("changes=%p, user_data=%p", changes, user_data);
+
+    if (ld->loading)
+    {
+        LEAVE("already loading");
+        return;
+    }
+
+    has_leader = (ld->ld_type == LD2_SINGLE || ld->ld_type == LD2_SUBACCOUNT);
+
+    if (has_leader)
+    {
+        Account *leader = gnc_ledger_display2_leader (ld);
+        if (!leader)
+        {
+            gnc_close_gui_component (ld->component_id);
+            LEAVE("no leader");
+            return;
+        }
+    }
+
+    if (changes && has_leader)
+    {
+        info = gnc_gui_get_entity_events (changes, &ld->leader);
+        if (info && (info->event_mask & QOF_EVENT_DESTROY))
+        {
+            gnc_close_gui_component (ld->component_id);
+            LEAVE("destroy");
+            return;
+        }
+    }
+
+    /* Its not clear if we should re-run the query, or if we should
+     * just use qof_query_last_run().  Its possible that the dates
+     * changed, requiring a full new query.  Similar considerations
+     * needed for multi-user mode.
+     */
+    splits = qof_query_run (ld->query);
+
+//    gnc_ledger_display2_set_watches (ld, splits);
+
+    gnc_ledger_display2_refresh_internal (ld, splits);
+    LEAVE(" ");
+}
+
+static void
+close_handler (gpointer user_data)
+{
+    GNCLedgerDisplay2 *ld = user_data;
+
+    if (!ld)
+        return;
+
+    gnc_unregister_gui_component (ld->component_id);
+
+    if (ld->destroy)
+        ld->destroy (ld);
+
+    gnc_tree_model_split_reg_destroy (ld->model);
+    ld->model = NULL;
+
+    qof_query_destroy (ld->query);
+    ld->query = NULL;
+
+    g_free (ld);
+}
+
+static void
+gnc_ledger_display2_make_query (GNCLedgerDisplay2 *ld,
+                               gint limit,
+                               SplitRegisterType2 type)
+{
+    Account *leader;
+    GList *accounts;
+
+    if (!ld)
+        return;
+
+    switch (ld->ld_type)
+    {
+    case LD2_SINGLE:
+    case LD2_SUBACCOUNT:
+        break;
+
+    case LD2_GL:
+        return;
+
+    default:
+        PERR ("unknown ledger type: %d", ld->ld_type);
+        return;
+    }
+
+    qof_query_destroy (ld->query);
+    ld->query = qof_query_create_for(GNC_ID_SPLIT);
+
+    /* This is a bit of a hack. The number of splits should be
+     * configurable, or maybe we should go back a time range instead
+     * of picking a number, or maybe we should be able to exclude
+     * based on reconciled status. Anyway, this works for now. */
+    if ((limit != 0) && (type != SEARCH_LEDGER2))
+        qof_query_set_max_results (ld->query, limit);
+
+    qof_query_set_book (ld->query, gnc_get_current_book());
+
+    leader = gnc_ledger_display2_leader (ld);
+
+    if (ld->ld_type == LD2_SUBACCOUNT)
+        accounts = gnc_account_get_descendants (leader);
+    else
+        accounts = NULL;
+
+    accounts = g_list_prepend (accounts, leader);
+
+    xaccQueryAddAccountMatch (ld->query, accounts,
+                              QOF_GUID_MATCH_ANY, QOF_QUERY_AND);
+
+    g_list_free (accounts);
+}
+
+/* Opens up a ledger window for an arbitrary query. */
+GNCLedgerDisplay2 *
+gnc_ledger_display2_query (Query *query, SplitRegisterType2 type,
+                          SplitRegisterStyle2 style)
+{
+    GNCLedgerDisplay2 *ld;
+
+    ENTER("query=%p", query);
+
+    ld = gnc_ledger_display2_internal (NULL, query, LD2_GL, type, style,
+                                      FALSE, FALSE);
+    LEAVE("%p", ld);
+    return ld;
+}
+
+static GNCLedgerDisplay2 *
+gnc_ledger_display2_internal (Account *lead_account, Query *q,
+                             GNCLedgerDisplay2Type ld_type,
+                             SplitRegisterType2 reg_type,
+                             SplitRegisterStyle2 style,
+                             gboolean use_double_line,
+                             gboolean is_template )
+{
+    GNCLedgerDisplay2 *ld;
+    gint limit;
+    const char *class;
+    GList *splits;
+
+    switch (ld_type)
+    {
+    case LD2_SINGLE:
+        class = REGISTER_SINGLE_CM_CLASS;
+
+        if (reg_type >= NUM_SINGLE_REGISTER_TYPES2)
+        {
+            PERR ("single-account register with wrong split register type");
+            return NULL;
+        }
+
+        if (!lead_account)
+        {
+            PERR ("single-account register with no account specified");
+            return NULL;
+        }
+
+        if (q)
+        {
+            PWARN ("single-account register with external query");
+            q = NULL;
+        }
+
+        ld = gnc_find_first_gui_component (class, find_by_leader, lead_account);
+        if (ld)
+            return ld;
+
+        break;
+
+    case LD2_SUBACCOUNT:
+        class = REGISTER_SUBACCOUNT_CM_CLASS;
+
+        if (!lead_account)
+        {
+            PERR ("sub-account register with no lead account");
+            return NULL;
+        }
+
+        if (q)
+        {
+            PWARN ("account register with external query");
+            q = NULL;
+        }
+
+        ld = gnc_find_first_gui_component (class, find_by_leader, lead_account);
+        if (ld)
+            return ld;
+
+        break;
+
+    case LD2_GL:
+        class = REGISTER_GL_CM_CLASS;
+
+        if (!q)
+        {
+            PWARN ("general ledger with no query");
+        }
+
+        break;
+
+    default:
+        PERR ("bad ledger type: %d", ld_type);
+        return NULL;
+
+    }
+
+    ld = g_new (GNCLedgerDisplay2, 1);
+
+    ld->leader = *xaccAccountGetGUID (lead_account);
+    ld->query = NULL;
+    ld->ld_type = ld_type;
+    ld->loading = FALSE;
+    ld->refresh_ok = FALSE;
+    ld->destroy = NULL;
+    ld->get_parent = NULL;
+    ld->user_data = NULL;
+
+    limit = gnc_gconf_get_float(GCONF_GENERAL_REGISTER, "max_transactions", NULL);
+
+    /* set up the query filter */
+    if (q)
+        ld->query = qof_query_copy (q);
+    else
+        gnc_ledger_display2_make_query (ld, limit, reg_type);
+
+    ld->component_id = gnc_register_gui_component (class,
+                       refresh_handler,
+                       close_handler, ld);
+
+    /******************************************************************\
+     * The main register window itself                                *
+    \******************************************************************/
+
+    ld->use_double_line_default = use_double_line;
+
+    ld->model = gnc_tree_model_split_reg_new (reg_type, style, use_double_line, is_template);
+
+    gnc_tree_model_split_reg_set_data (ld->model, ld, gnc_ledger_display2_parent);
+
+    splits = qof_query_run (ld->query);
+
+//    gnc_ledger_display2_set_watches (ld, splits);
+
+    gnc_ledger_display2_refresh_internal (ld, splits);
+
+    return ld;
+}
+
+void
+gnc_ledger_display2_set_split_view_register (GNCLedgerDisplay2 *ledger_display, GncTreeViewSplitReg *view)
+{
+    if (!ledger_display)
+        return;
+
+    ledger_display->view = view;
+}
+
+GncTreeViewSplitReg *
+gnc_ledger_display2_get_split_view_register (GNCLedgerDisplay2 *ledger_display)
+{
+    if (!ledger_display)
+        return NULL;
+
+    return ledger_display->view;
+}
+
+void
+gnc_ledger_display2_set_query (GNCLedgerDisplay2 *ledger_display, Query *q)
+{
+    if (!ledger_display || !q)
+        return;
+
+    g_return_if_fail (ledger_display->ld_type == LD2_GL);
+
+    qof_query_destroy (ledger_display->query);
+    ledger_display->query = qof_query_copy (q);
+}
+
+GNCLedgerDisplay2 *
+gnc_ledger_display2_find_by_query (Query *q)
+{
+    if (!q)
+        return NULL;
+
+    return gnc_find_first_gui_component (REGISTER_GL_CM_CLASS, find_by_query, q);
+}
+
+/********************************************************************\
+ * refresh only the indicated register window                       *
+\********************************************************************/
+
+static void
+gnc_ledger_display2_refresh_internal (GNCLedgerDisplay2 *ld, GList *splits)
+{
+    GtkTreeModel *smodel, *model;
+
+g_print("gnc_ledger_display2_refresh_internal\n");
+
+    if (!ld || ld->loading)
+        return;
+
+    if (!(ld->refresh_ok)) // We use this to test for the view available
+    {
+        ld->loading = TRUE;
+        gnc_tree_model_split_reg_load (ld->model, splits, gnc_ledger_display2_leader (ld));
+        ld->loading = FALSE;
+    }
+    else
+    {
+        ld->loading = TRUE;
+
+        smodel =  gtk_tree_view_get_model (GTK_TREE_VIEW (ld->view)); // this is the sort model
+
+        model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (smodel)); // our model
+
+        g_object_ref (smodel);
+        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
+
+//        smodel = gtk_tree_model_sort_new_with_model (model); // create new sort model
+
+        gtk_tree_view_set_model (GTK_TREE_VIEW(ld->view), GTK_TREE_MODEL (smodel)); // 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 (smodel);
+
+        ld->loading = FALSE;
+    }
+}
+
+void
+gnc_ledger_display2_refresh (GNCLedgerDisplay2 *ld)
+{
+    ENTER("ld=%p", ld);
+
+    if (!ld)
+    {
+        LEAVE("no display");
+        return;
+    }
+
+    if (ld->loading)
+    {
+        LEAVE("already loading");
+        return;
+    }
+
+    gnc_ledger_display2_refresh_internal (ld, qof_query_run (ld->query));
+    LEAVE(" ");
+}
+
+void
+gnc_ledger_display2_refresh_by_split_register (GncTreeModelSplitReg *model)
+{
+    GNCLedgerDisplay2 *ld;
+
+    if (!model)
+        return;
+
+    ld = gnc_find_first_gui_component (REGISTER_SINGLE_CM_CLASS,
+                                       find_by_reg, model);
+    if (ld)
+    {
+        gnc_ledger_display2_refresh (ld);
+        return;
+    }
+
+    ld = gnc_find_first_gui_component (REGISTER_SUBACCOUNT_CM_CLASS,
+                                       find_by_reg, model);
+    if (ld)
+    {
+        gnc_ledger_display2_refresh (ld);
+        return;
+    }
+
+    ld = gnc_find_first_gui_component (REGISTER_GL_CM_CLASS,
+                                       find_by_reg, model);
+    if (ld)
+    {
+        gnc_ledger_display2_refresh (ld);
+        return;
+    }
+
+    ld = gnc_find_first_gui_component (REGISTER_TEMPLATE_CM_CLASS,
+                                       find_by_reg, model);
+    if (ld)
+    {
+        gnc_ledger_display2_refresh (ld);
+    }
+}
+
+
+void
+gnc_ledger_display2_set_split_view_refresh (GNCLedgerDisplay2 *ld, gboolean ok)
+{
+    if (!ld)
+        return;
+
+    ld->refresh_ok = ok;
+}
+void
+gnc_ledger_display2_close (GNCLedgerDisplay2 *ld)
+{
+    if (!ld)
+        return;
+
+    gnc_close_gui_component (ld->component_id);
+}
Index: src/gnome-utils/gnc-tree-view-split-reg.c
===================================================================
--- src/gnome-utils/gnc-tree-view-split-reg.c	(revision 22433)
+++ src/gnome-utils/gnc-tree-view-split-reg.c	(working copy)
@@ -29,23 +29,28 @@
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 #include <string.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "gnc-tree-view.h"
 #include "gnc-tree-view-split-reg.h"
 #include "gnc-tree-model-split-reg.h"
+#include "dialog-utils.h"
 #include "gnc-gconf-utils.h"
 #include "Transaction.h"
+#include "Scrub.h"
+#include "gnc-exp-parser.h"
+#include "dialog-transfer.h"
 
 /** Static Globals *******************************************************/
 static QofLogModule log_module = GNC_MOD_GUI;
 
-static void gnc_tree_view_split_reg_class_init(GncTreeViewSplitRegClass *klass);
-static void gnc_tree_view_split_reg_init(GncTreeViewSplitReg *view);
-static void gnc_tree_view_split_reg_dispose(GObject *object);
-static void gnc_tree_view_split_reg_finalize(GObject *object);
+static void gnc_tree_view_split_reg_class_init (GncTreeViewSplitRegClass *klass);
+static void gnc_tree_view_split_reg_init (GncTreeViewSplitReg *view);
+static void gnc_tree_view_split_reg_dispose (GObject *object);
+static void gnc_tree_view_split_reg_finalize (GObject *object);
 
 static void cdf (GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model,
-                		GtkTreeIter  *iter, gpointer view);
+                		GtkTreeIter  *iter, gpointer user_data);
 
 static void gtv_split_reg_edited_cb (GtkCellRendererText *cell, const gchar *path_string,
                           	const gchar *new_text, gpointer _model);
@@ -53,40 +58,55 @@
 static void start_edit (GtkCellRenderer *cr, GtkCellEditable *editable,
                        		const gchar *path, gpointer user_data);
 
-static void begin_edit(GncTreeViewSplitReg *tv, Split *split, Transaction *trans);
+static void begin_edit (GncTreeViewSplitReg *view, Split *split, Transaction *trans);
 
 static void get_editable_start_editing_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
    				const gchar *path, gpointer user_data);
 
+static void get_editable_start_editing_recn_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
+   				const gchar *path, gpointer user_data);
+
 static void gtv_split_reg_editing_canceled_cb (GtkCellRenderer *cr, gpointer user_data);
 
-static void gtv_split_reg_match_selected_cb(GtkEntryCompletion *widget, GtkTreeModel *model,
+static void gtv_split_reg_match_selected_cb (GtkEntryCompletion *widget, GtkTreeModel *model,
                         GtkTreeIter *iter, gpointer user_data);
 
-static void gtv_split_reg_changed_cb(GtkCellRendererCombo *widget, gchar *path_string,
+static void gtv_split_reg_changed_cb (GtkCellRendererCombo *widget, gchar *path_string,
                         GtkTreeIter *iter, gpointer user_data);
 
-static gboolean gtv_split_reg_key_press_cb (GtkWidget *treeview, GdkEventKey *event, gpointer userdata);
-static void gtv_split_reg_motion_cb(GtkTreeSelection *sel, gpointer data);
+static gboolean gtv_split_reg_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data);
 
+static void gtv_split_reg_motion_cb (GtkTreeSelection *sel, gpointer user_data);
 
+static gboolean gtv_scroll_to_cell (GncTreeViewSplitReg *view);
+
+static void gtv_split_reg_double_click_cb (GtkTreeView *treeview,
+                                             GtkTreePath       *path,
+                                             GtkTreeViewColumn *column,
+                                             gpointer           user_data);
+
+static gboolean transaction_changed_confirm (GncTreeViewSplitReg *view, Transaction *new_trans);
+
+
 typedef enum {
-    COL_DATE,
-    COL_NUMACT,
-    COL_DESCNOTES,
-    COL_TRANSVOID,
-    COL_RECN,
-    COL_TYPE,
-    COL_VALUE,
-    COL_AMOUNT,
-    COL_RATE,
-    COL_PRICE,
-    COL_DEBIT,
-    COL_CREDIT,
-    COL_BALANCE,
+    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
 } ViewCol;
 
-
 typedef struct {
     ViewCol viewcol;
     gint modelcol;
@@ -108,6 +128,11 @@
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
      gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
 
+    {COL_DUEDATE, GNC_TREE_MODEL_SPLIT_REG_COL_DUEDATE,
+     "Due Date", "duedate", "00/00/0000xxx",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
+     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+
     {COL_NUMACT, GNC_TREE_MODEL_SPLIT_REG_COL_NUMACT,
      "Num / Act", "numact", "0000xxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
@@ -126,23 +151,28 @@
     {COL_RECN, -1,
      "R", "recn", "x",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     gtv_split_reg_edited_cb, NULL, NULL},
+     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
 
     {COL_TYPE, -1,
      "Type", "type", "x",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     NULL, NULL, NULL},
+     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
 
     {COL_VALUE, -1,
-     "Val", "value", "xxxxxxxx",
+     "Value", "value", "xxxxxxxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
-     NULL, NULL, NULL},
+     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
 
     {COL_AMOUNT, -1,
-     "Amt", "amount", "xxxxxxxx",
+     "Amount", "amount", "xxxxxxxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
      gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
 
+    {COL_AMTVAL, -1,
+     "Amount / Value", "amtval", "xxxxxxxx",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
+     gtv_split_reg_edited_cb, get_editable_start_editing_cb, NULL},
+
     {COL_RATE, -1,
      "Rate", "rate", "xxxxxxxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
@@ -167,33 +197,55 @@
      "Balance", "balance", "xxxxxxxx",
      GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
      NULL, NULL, NULL},
+
+    {COL_STATUS, -1,
+     " ", "status", "x",
+     GNC_TREE_VIEW_COLUMN_VISIBLE_ALWAYS,
+     NULL, NULL, NULL},
 };
 
 
 struct GncTreeViewSplitRegPrivate
 {
-    GtkTreeModel *tree_model;
-    gboolean disposed;
+    gboolean         disposed;
+  
+    Account         *anchor;
+    gnc_commodity   *reg_comm;
 
-    Account *anchor;
-    gnc_commodity *reg_comm;
+    Split           *dirty_split;
+    Transaction     *dirty_trans;
 
-    Split *dirty_split;
-    Transaction *dirty_trans;
+    Split           *btrans_split;
 
-    gchar *acct_edit_path;    // remember which row's account we're editing
-    GtkCellRenderer *temp_cr; // Temp Cell Renderer reference
+    GtkTreePath     *acct_edit_path;      // remember which row's account we're editing
 
-    gboolean has_rate;  /* if set, the transfer dialog will never automatically pop-up */
+    GtkTreePath     *current_path;        // remember what the current path is.
 
-    gboolean acct_short_names;
-    gboolean double_line;
+    GtkCellRenderer *temp_cr;         // Temp Cell Renderer reference
+
+    gboolean         has_rate;          /* if set, the transfer dialog will never automatically pop-up */
+
+    gboolean         full_refresh;
+
+    gboolean         acct_short_names;
+    gboolean         double_line;
+
+
+    gboolean         default_set;
+    gint             row_old;
+    gint             row_now;
+
 };
 
 
 #define SPLIT_TRANS_STR _("-- Split Transaction --")
 
-/* This could be a preference setting, The minimum length of the key in order to start completing */
+#define PINKCELL "#F8BEC6"
+#define REDCELL "#F34943"
+#define BLUECELL "#1D80DF"
+#define BLACKCELL "#CBCBD2"
+
+/* This could be a preference setting, The minimum length of characters in order to start completing */
 #define KEY_LENGTH 2
 
 #define GNC_TREE_VIEW_SPLIT_REG_GET_PRIVATE(o)  \
@@ -230,7 +282,6 @@
 }
 
 
-
 static void
 gnc_tree_view_split_reg_class_init(GncTreeViewSplitRegClass *klass)
 {
@@ -247,19 +298,24 @@
 }
 
 
-
 static void
 gnc_tree_view_split_reg_init (GncTreeViewSplitReg *view)
 {
     view->priv = g_new0 (GncTreeViewSplitRegPrivate, 1);
-    view->priv->double_line = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER, "double_line_mode", NULL);
-    view->priv->acct_short_names = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER, "show_leaf_account_names", NULL);
+
+    view->priv->current_path = gtk_tree_path_new_from_string ("99999");
+    view->priv->full_refresh = TRUE;
+
+    /* Setup the blank transaction split */
+    view->priv->btrans_split = xaccMallocSplit (gnc_get_current_book());
+
+
+    view->priv->acct_short_names = gnc_gconf_get_bool (GCONF_GENERAL_REGISTER, "show_leaf_account_names", NULL);
 }
 
 
-
 static void
-gnc_tree_view_split_reg_dispose(GObject *object)
+gnc_tree_view_split_reg_dispose (GObject *object)
 {
     GncTreeViewSplitReg *view;
     GncTreeViewSplitRegPrivate *priv;
@@ -268,47 +324,41 @@
     gnc_leave_return_if_fail (GNC_IS_TREE_VIEW_SPLIT_REG (object));
 
     view = GNC_TREE_VIEW_SPLIT_REG (object);
-    priv = GNC_TREE_VIEW_SPLIT_REG_GET_PRIVATE(view);
+    priv = GNC_TREE_VIEW_SPLIT_REG_GET_PRIVATE (view);
 
     if (priv->disposed)
         return;
     priv->disposed = TRUE;
 
-    g_object_unref(G_OBJECT(priv->tree_model));
-    priv->tree_model = NULL;
-
     if (G_OBJECT_CLASS (parent_class)->dispose)
         (* G_OBJECT_CLASS (parent_class)->dispose) (object);
 }
 
 
-
 static void
-gnc_tree_view_split_reg_finalize(GObject *object)
+gnc_tree_view_split_reg_finalize (GObject *object)
 {
     GncTreeViewSplitReg *view;
 
     gnc_leave_return_if_fail(object != NULL);
     gnc_leave_return_if_fail(GNC_IS_TREE_VIEW_SPLIT_REG (object));
 
-    view = GNC_TREE_VIEW_SPLIT_REG(object);
+    view = GNC_TREE_VIEW_SPLIT_REG (object);
 
     if (G_OBJECT_CLASS(parent_class)->finalize)
         (* G_OBJECT_CLASS(parent_class)->finalize) (object);
 }
 
 
-
 static GncTreeModelSplitReg *
-get_split_reg_model_from_view(GncTreeViewSplitReg *tv)
+get_split_reg_model_from_view (GncTreeViewSplitReg *view)
 {
     GtkTreeModelSort *s_model = GTK_TREE_MODEL_SORT(
-        gtk_tree_view_get_model(GTK_TREE_VIEW(tv)));
-    return GNC_TREE_MODEL_SPLIT_REG(gtk_tree_model_sort_get_model(s_model));
+        gtk_tree_view_get_model (GTK_TREE_VIEW (view)));
+    return GNC_TREE_MODEL_SPLIT_REG (gtk_tree_model_sort_get_model (s_model));
 }
 
 
-
 /* Set the grid lines to be solid */
 static const gchar *rc_string =
 {
@@ -321,27 +371,91 @@
 "class \"GtkTreeView\" style \"solidTreeLines\"\n"
 };
 
-static ViewCol col_list[] = {
-    COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSVOID, COL_RECN,
-    COL_TYPE, COL_VALUE, COL_AMOUNT, COL_RATE, COL_PRICE, COL_DEBIT, COL_CREDIT,
-    COL_BALANCE, -1};
 
+static ViewCol *
+gnc_tree_view_split_reg_get_colummn_list (GncTreeModelSplitReg *model)
+{
+g_print("Model-type is %d\n", model->type);
+    switch (model->type)
+    {
+    case BANK_REGISTER2:
+    case CASH_REGISTER2:
+    case ASSET_REGISTER2:
+    case CREDIT_REGISTER2:
+    case LIABILITY_REGISTER2:
+    case INCOME_REGISTER2:
+    case EXPENSE_REGISTER2:
+    case EQUITY_REGISTER2:
+    case TRADING_REGISTER2:
+    case INCOME_LEDGER2:
+    case GENERAL_LEDGER2:
+        {
+        static ViewCol col_list[] = {
+        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSVOID, COL_RECN,
+        COL_STATUS, COL_DEBIT, COL_CREDIT, COL_BALANCE, -1};
+        return col_list;
+        }
+        break;
+
+    case STOCK_REGISTER2:
+    case CURRENCY_REGISTER2:
+        {
+        static ViewCol col_list[] = {
+        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSVOID, COL_RECN,
+        COL_STATUS, COL_AMTVAL, COL_PRICE, COL_DEBIT, COL_CREDIT, COL_BALANCE, -1};
+        return col_list;
+        }
+        break;
+
+    case RECEIVABLE_REGISTER2:
+    case PAYABLE_REGISTER2:
+        {
+        static ViewCol col_list[] = {
+        COL_DATE, COL_TYPE, COL_DUEDATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSVOID,
+        COL_STATUS, COL_DEBIT, COL_CREDIT, COL_BALANCE, -1};
+        return col_list;
+        }
+
+     case PORTFOLIO_LEDGER2:
+        {
+        static ViewCol col_list[] = {
+        COL_DATE, COL_NUMACT, COL_DESCNOTES, COL_TRANSVOID, COL_RECN,
+        COL_STATUS, COL_AMTVAL, COL_PRICE, COL_DEBIT, COL_CREDIT, -1};
+        return col_list;
+        }
+
+    case SEARCH_LEDGER2: //FIXME Not Setup yet
+
+    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_BALANCE, -1};
+        return col_list;
+        }
+    }
+}
+
+
 /* Creates a treeview with the list of fields */
 static GncTreeViewSplitReg *
-gnc_tree_view_split_reg_set_cols(GncTreeViewSplitReg *tv,
-                                   const ViewCol col_list[])
+gnc_tree_view_split_reg_set_cols (GncTreeViewSplitReg *view,
+                                    const ViewCol col_list[])
 {
     int i = 0;
 
     GncTreeModelSplitReg *model;
-    model = get_split_reg_model_from_view(tv);
+    model = get_split_reg_model_from_view (view);
 
     while (col_list && col_list[i] != -1) {
+        GList *renderers;
         GtkCellRenderer *cr;
         GtkTreeViewColumn *col;
         ColDef def;
-        int j, ncol = G_N_ELEMENTS(all_tree_view_split_reg_columns);
 
+        int j, ncol = G_N_ELEMENTS (all_tree_view_split_reg_columns);
+
         for (j = 0; j < ncol; j++) {
             if (col_list[i] == all_tree_view_split_reg_columns[j].viewcol) {
                 def = all_tree_view_split_reg_columns[j];
@@ -353,165 +467,490 @@
             i++;
             continue;
         }
-
         if (col_list[i] == COL_TRANSVOID) {
 
             col = gnc_tree_view_add_combo_column (
-                GNC_TREE_VIEW(tv), def.title, def.pref_name, def.sizer,
+                GNC_TREE_VIEW (view), def.title, def.pref_name, def.sizer,
                 def.modelcol, def.visibility_model_col,
                 GTK_TREE_MODEL( gnc_tree_model_split_reg_get_acct_list(model)), 0, def.sort_fn);
 
         } else if (col_list[i] == COL_DATE) {
             col = gnc_tree_view_add_date_column (
-                GNC_TREE_VIEW(tv), def.title, def.pref_name, NULL, def.sizer,
+                GNC_TREE_VIEW (view), def.title, def.pref_name, NULL, def.sizer,
                 def.modelcol, def.visibility_model_col, def.sort_fn);
 
         } else if (col_list[i] == COL_NUMACT){ 
             col = gnc_tree_view_add_combo_column (
-                GNC_TREE_VIEW(tv), def.title, def.pref_name, def.sizer,
+                GNC_TREE_VIEW (view), def.title, def.pref_name, def.sizer,
                 def.modelcol, def.visibility_model_col,
                 GTK_TREE_MODEL( gnc_tree_model_split_reg_get_numact_list(model)), 0, def.sort_fn);
 
         } else { 
             col = gnc_tree_view_add_text_column (
-                GNC_TREE_VIEW(tv), def.title, def.pref_name, NULL, def.sizer,
+                GNC_TREE_VIEW (view), def.title, def.pref_name, NULL, def.sizer,
                 def.modelcol, def.visibility_model_col, def.sort_fn);
         } 
 
-        g_object_set_data(G_OBJECT(col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
-        cr = gnc_tree_view_column_get_renderer(col);
+        g_object_set_data (G_OBJECT (col), DEFAULT_VISIBLE, GINT_TO_POINTER(1));
 
+        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col)); //FIXME I am only looking at one renderer per cell.
+        g_assert (g_list_length (renderers) == 1);
+        cr = g_list_nth_data (renderers, 0);
+        g_list_free (renderers);
 
         /* Setup cell background color and default alignment */
-        g_object_set( cr, "xalign", 1.0, NULL );
-        gtk_tree_view_column_add_attribute(col, cr, "cell-background", GNC_TREE_MODEL_SPLIT_REG_COL_COLOR);
+        g_object_set (cr, "xalign", 1.0, NULL);
+        gtk_tree_view_column_add_attribute (col, cr, "cell-background", GNC_TREE_MODEL_SPLIT_REG_COL_COLOR);
 
         if (def.editing_started_cb) {
             //Store the position of the column in the model
-            g_object_set_data(G_OBJECT(cr), "model_column", GINT_TO_POINTER(def.modelcol));
-            g_signal_connect(G_OBJECT(cr), "editing-started", (GCallback) def.editing_started_cb, tv);
+            g_object_set_data (G_OBJECT(cr), "model_column", GINT_TO_POINTER (def.modelcol));
+            g_object_set_data (G_OBJECT(cr), "column_name", GINT_TO_POINTER (def.pref_name));
+            g_signal_connect (G_OBJECT(cr), "editing-started", (GCallback) def.editing_started_cb, view);
         }
 
         //Connect editing-canceled signal so that edit-cancelled can be set appropriately
-        g_signal_connect(G_OBJECT(cr), "editing-canceled", G_CALLBACK(gtv_split_reg_editing_canceled_cb), tv);
+        g_signal_connect (G_OBJECT(cr), "editing-canceled", G_CALLBACK (gtv_split_reg_editing_canceled_cb), view);
 
-        // This can die when prefs are used.
-        g_object_set(G_OBJECT(col), "resizable", TRUE, NULL);
+        // Set Columns to be resizable default.
+        g_object_set (G_OBJECT(col), "resizable", TRUE, NULL);
 
+        // We do not want columns to be reorderable.
+        g_object_set(G_OBJECT(col), "reorderable", FALSE, NULL);
+
         if (def.edited_cb) {
-            g_object_set(G_OBJECT(cr), "editable", TRUE, NULL);
-            g_signal_connect(G_OBJECT(cr), "edited", (GCallback) def.edited_cb, tv);
+            g_object_set (G_OBJECT (cr), "editable", TRUE, NULL);
+            g_signal_connect (G_OBJECT (cr), "edited", (GCallback) def.edited_cb, view);
         }
-        g_object_set_data(G_OBJECT(cr), "view_column", GINT_TO_POINTER(def.viewcol));
-        gtk_tree_view_column_set_cell_data_func( col, cr, cdf, tv, NULL);
+        g_object_set_data (G_OBJECT (cr), "view_column", GINT_TO_POINTER (def.viewcol));
+        gtk_tree_view_column_set_cell_data_func ( col, cr, cdf, view, NULL);
         i++;
     }
+    gtk_tree_selection_set_mode(gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), GTK_SELECTION_BROWSE);
 
-    gnc_tree_view_configure_columns(GNC_TREE_VIEW(tv));
+    /* This will expand to splits on double clicking at current position */
+    g_signal_connect (GTK_TREE_VIEW (view), "row-activated", G_CALLBACK (gtv_split_reg_double_click_cb), NULL);
 
-    g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW(tv)), "changed", G_CALLBACK(gtv_split_reg_motion_cb), tv);
+    g_signal_connect(gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), "changed", G_CALLBACK (gtv_split_reg_motion_cb), view);
 
     //Add a data-edited property to keep track of transaction edits
-    g_object_set_data(G_OBJECT(tv), "data-edited", FALSE);
+    g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
 
-    //???? gtk_tree_selection_set_mode(gtk_tree_view_get_selection(tv), GTK_SELECTION_BROWSE);
+    g_signal_connect_after (G_OBJECT (view), "key-press-event", G_CALLBACK (gtv_split_reg_key_press_cb), NULL);
+    return view;
+}
 
-/*    g_signal_connect_after(G_OBJECT(tv), "key-press-event", G_CALLBACK(gtv_split_reg_key_press_cb), NULL); */
-    return tv;
+
+static gboolean
+gnc_tree_view_split_reg_set_format (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *path;
+    RowDepth depth;
+    gint index = 0;
+    gint total_num = 0;
+    gint *indices;
+    gint row_now;
+    gint row_old;
+
+    model = get_split_reg_model_from_view (view);
+
+    row_now = view->priv->row_now;
+    row_old = view->priv->row_old;
+    total_num = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL);
+    depth = gnc_tree_view_reg_get_selected_row_depth (view);
+
+g_print("gnc_tree_view_split_reg_set_format row_now is %d, row_old is %d, total is %d\n", row_now, row_old, total_num);
+
+    /* scroll the view */
+    if (row_now == total_num -1)
+        gtv_scroll_to_cell (view);
+
+if ((row_now != row_old) || (view->priv->default_set == TRUE))
+{
+view->priv->default_set = FALSE;
+
+    if (model->style == REG2_STYLE_JOURNAL)
+    {
+g_print("gnc_tree_view_split_reg_set_format journal\n");
+        path = gtk_tree_path_new_first ();
+        indices = gtk_tree_path_get_indices (view->priv->current_path);
+
+        /* we need do this when we remove the blank split from the last transaction */
+        if (indices[0] != total_num -1)
+            total_num = total_num -1;
+
+        while (index < total_num)
+        {
+            gtk_tree_path_down (path); //TROW2
+            gtk_tree_view_expand_to_path (GTK_TREE_VIEW (view), path);
+            gtk_tree_path_up (path);   //TROW1
+
+            index = index + 1;
+            if (index == total_num)
+                break;
+
+            gtk_tree_path_next (path); //Next Transaction
+        }
+        gtk_tree_path_free (path);
+        return (FALSE);
+    }
+
+    if (!model->use_double_line)
+    {
+g_print("gnc_tree_view_split_reg_set_format single\n");
+        path = gtk_tree_path_new_first ();
+        while (index < gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL))
+        {
+            gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), path);
+            gtk_tree_path_next (path); //Next Transaction
+            index = index + 1;
+        }
+        gtk_tree_path_free (path);
+    }
+
+    if (model->use_double_line)
+    {
+g_print("gnc_tree_view_split_reg_set_format double\n");
+        path = gtk_tree_path_new_first ();
+        while (index < gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL))
+        {
+            gtk_tree_view_expand_to_path (GTK_TREE_VIEW (view), path);
+            gtk_tree_path_down (path);
+            gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), path);
+            gtk_tree_path_up (path);
+            gtk_tree_path_next (path); //Next Transaction
+            index = index + 1;
+        }
+        gtk_tree_path_free (path);
+    }
+
+    /* This expands to split from top level auto.. */
+    if ((model->style == REG2_STYLE_AUTO_LEDGER) || (model->style == REG2_STYLE_JOURNAL))
+    {
+        GtkTreePath *expand_path;
+g_print("gnc_tree_view_split_reg_set_format auto\n");
+        expand_path = gtk_tree_path_new_from_indices (row_now, -1);
+        gtk_tree_view_expand_row (GTK_TREE_VIEW (view), expand_path, TRUE);
+        gtk_tree_path_free (expand_path);
+    }
 }
+    return (FALSE);
+}
 
 
-
 GncTreeViewSplitReg*
-gnc_tree_view_split_reg_new_with_model(GncTreeModelSplitReg *model)
+gnc_tree_view_split_reg_new_with_model (GncTreeModelSplitReg *model)
 {
     GtkTreeModel *s_model;
-    GncTreeViewSplitReg *tv;
+    GncTreeViewSplitReg *view;
     GtkCellRenderer *cr;
     GtkTreeViewColumn *col;
     GtkTreeSelection    *selection;
 
-    gtk_rc_parse_string ( rc_string );
+    gtk_rc_parse_string (rc_string);
 
-    tv = g_object_new(gnc_tree_view_split_reg_get_type(), NULL);
-    g_object_set(tv, "name", "split_reg_tree", NULL);
+    view = g_object_new (gnc_tree_view_split_reg_get_type(), NULL);
+    g_object_set (view, "name", "split_reg_tree", NULL);
 
-    s_model = gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(model));
-/*FIXME  should we  g_object_unref(G_OBJECT(model)); */
-    gnc_tree_view_set_model(GNC_TREE_VIEW(tv), s_model);
-    g_object_unref(G_OBJECT(s_model));
+    s_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (model));
+    // do not do this - g_object_unref (G_OBJECT (model));
 
-    tv->priv->anchor = gnc_tree_model_split_reg_get_anchor(model);
-    tv->priv->reg_comm = xaccAccountGetCommodity(tv->priv->anchor);
-    tv->priv->has_rate = TRUE;  /*FIXME Not sure what this ????? */
+    gnc_tree_view_set_model (GNC_TREE_VIEW (view), s_model);
+    g_object_unref (G_OBJECT (s_model));
 
-    gnc_tree_view_split_reg_set_cols(tv, col_list);
+    view->priv->anchor = gnc_tree_model_split_reg_get_anchor (model);
+    view->priv->reg_comm = xaccAccountGetCommodity (view->priv->anchor);
+    view->priv->has_rate = TRUE;
 
+    gnc_tree_view_split_reg_set_cols (view, gnc_tree_view_split_reg_get_colummn_list (model));
+
     /* Set default visibilities */
-    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(tv), TRUE);
+    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), TRUE);
 
     /* TreeView Grid lines */
-    if(gnc_gconf_get_bool(GCONF_GENERAL_REGISTER, "draw_horizontal_lines", NULL))
+    if (gnc_gconf_get_bool (GCONF_GENERAL_REGISTER, "draw_horizontal_lines", NULL))
     {
-        if(gnc_gconf_get_bool(GCONF_GENERAL_REGISTER, "draw_vertical_lines", NULL))
-            gtk_tree_view_set_grid_lines( GTK_TREE_VIEW(tv), GTK_TREE_VIEW_GRID_LINES_BOTH);
+        if (gnc_gconf_get_bool (GCONF_GENERAL_REGISTER, "draw_vertical_lines", NULL))
+            gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), GTK_TREE_VIEW_GRID_LINES_BOTH);
         else
-            gtk_tree_view_set_grid_lines( GTK_TREE_VIEW(tv), GTK_TREE_VIEW_GRID_LINES_HORIZONTAL);
+            gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), GTK_TREE_VIEW_GRID_LINES_HORIZONTAL);
     }
-    else if(gnc_gconf_get_bool(GCONF_GENERAL_REGISTER, "draw_vertical_lines", NULL))
-            gtk_tree_view_set_grid_lines( GTK_TREE_VIEW(tv), GTK_TREE_VIEW_GRID_LINES_VERTICAL);
+    else if (gnc_gconf_get_bool (GCONF_GENERAL_REGISTER, "draw_vertical_lines", NULL))
+            gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), GTK_TREE_VIEW_GRID_LINES_VERTICAL);
     else
-        gtk_tree_view_set_grid_lines( GTK_TREE_VIEW(tv), GTK_TREE_VIEW_GRID_LINES_NONE);
+        gtk_tree_view_set_grid_lines (GTK_TREE_VIEW(view), GTK_TREE_VIEW_GRID_LINES_NONE);
 
-
     /* Expanders off */
-    /* gtk_tree_view_set_show_expanders (GTK_TREE_VIEW(view), FALSE); */
+    /* gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (view), FALSE); */
 
     /* Tree Selection */
-    selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv));
+    selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
 
-    gtk_tree_selection_unselect_all( selection );
+    gtk_tree_selection_unselect_all (selection);
 
-/*
+    return view;
+}
 
-    gnc_tree_view_configure_columns(view);
 
-    gtk_widget_show(GTK_WIDGET(view)); */
-    return tv;
+/* This allows the blocking / unblocking of selection */
+void
+gnc_tree_view_split_reg_block_selection (GncTreeViewSplitReg *view, gboolean block)
+{
+    if (block)
+        g_signal_handlers_block_by_func (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), gtv_split_reg_motion_cb, view);
+    else
+        g_signal_handlers_unblock_by_func (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), gtv_split_reg_motion_cb, view);
 }
 
 
+/* Set the default selection path */
+void
+gnc_tree_view_split_reg_default_selection (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreeIter iter;
+    GtkTreePath *path;
+    gint *indices;
 
+    model = get_split_reg_model_from_view (view);
+
+    view->priv->default_set = TRUE;
+
+    /* Set the default start position to end of list */
+    if (gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path))
+        indices = gtk_tree_path_get_indices (view->priv->current_path);
+    else
+        /* both values NULL will return last in list */
+        indices = gtk_tree_path_get_indices (gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, NULL));
+
+    path = gtk_tree_path_new_from_indices (indices[0], -1);
+
+g_print(" gnc_tree_view_split_reg_default_selection current_path is %s, new path is %s\n", gtk_tree_path_to_string (view->priv->current_path),
+        gtk_tree_path_to_string (path));
+
+    gtk_tree_path_free (view->priv->current_path);
+    view->priv->current_path = gtk_tree_path_copy (path);
+
+    gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), path);
+
+    gtk_tree_path_free (path);
+
+    /* scroll when view is idle */
+    g_idle_add ((GSourceFunc)gtv_scroll_to_cell, view );
+}
+
+
+/* Sets read only flag */
+void
+gnc_tree_view_split_reg_set_read_only (GncTreeViewSplitReg *view, gboolean read_only)
+{
+    GncTreeModelSplitReg *model;
+
+    model = get_split_reg_model_from_view (view);
+
+    model->read_only = read_only;
+}
+
+
+/* Do we need an exchange rate */
+static gboolean
+needs_exchange_rate (GncTreeViewSplitReg *view, Transaction *trans, Split *split)
+{
+    gnc_commodity *split_com, *txn_curr, *reg_com;
+g_print("needs_exchange_rate trans %p and split %p\n", trans, split);
+    if (view->priv->has_rate) return FALSE;
+
+    txn_curr = xaccTransGetCurrency (trans);
+    split_com = xaccAccountGetCommodity (xaccSplitGetAccount (split));
+    if (split_com && txn_curr && !gnc_commodity_equiv (split_com, txn_curr))
+        return TRUE;
+
+    reg_com = view->priv->reg_comm;
+    if (reg_com && split_com && !gnc_commodity_equiv (reg_com, split_com))
+        return TRUE;
+
+    return FALSE;
+}
+
+
+/* Either sets the value and amount for split and returns TRUE, or
+   does nothing and returns FALSE. */
+static gboolean
+handle_exchange_rate (GncTreeViewSplitReg *view, gnc_numeric amount, Transaction *trans, Split *split)
+{
+    XferDialog *xfer;
+    gboolean rate_split_ok, rate_reg_ok;
+    gnc_numeric rate_split, rate_reg, value;
+    gnc_commodity *xfer_comm = xaccAccountGetCommodity (xaccSplitGetAccount (split));
+    gnc_commodity *reg_comm = view->priv->reg_comm;
+    gnc_commodity *trans_curr = xaccTransGetCurrency (trans);
+
+g_print("handle_exchange_rate trans %p and split %p\n", trans, split);
+
+    /* Rate from trans-curr to split-comm */
+    rate_split_ok = xaccTransGetRateForCommodity (trans, xfer_comm, split, &rate_split);
+
+    /* Rate from trans-curr to reg-comm */
+    rate_reg_ok = xaccTransGetRateForCommodity(trans, reg_comm, split, &rate_reg);
+
+    if (rate_reg_ok && rate_split_ok)
+    {
+        value = gnc_numeric_div (amount, rate_reg, gnc_commodity_get_fraction (trans_curr), GNC_HOW_DENOM_REDUCE);
+        amount = gnc_numeric_mul (value, rate_split, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
+    }
+    else
+    {
+        rate_split = gnc_numeric_create (1, 1);
+
+        //g_message("reg amt: %s", gnc_numeric_to_string(amount));
+        /* create the exchange-rate dialog */
+        xfer = gnc_xfer_dialog (NULL, NULL); //FIXME: get parent window
+        gnc_xfer_dialog_is_exchange_dialog (xfer, &rate_split);
+
+        /* fill in the dialog entries */
+        gnc_xfer_dialog_set_description (xfer, xaccTransGetDescription (trans));
+        gnc_xfer_dialog_set_memo (xfer, xaccSplitGetMemo (split));
+        gnc_xfer_dialog_set_num (xfer, xaccTransGetNum (trans));
+        gnc_xfer_dialog_set_date (xfer, timespecToTime_t (xaccTransRetDatePostedTS (trans)));
+
+        value = amount;
+/*FIXME        if (gnc_xfer_dialog_run_exchange_dialog(
+                xfer, &rate_split, &value, reg_comm, trans, xfer_comm))
+            return FALSE; */
+        amount = gnc_numeric_mul (value, rate_split, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
+    }
+    xaccSplitSetAmount (split, amount);
+    xaccSplitSetValue (split, value);
+    g_message ("split amt=%s; split val=%s", gnc_numeric_to_string (amount), gnc_numeric_to_string (value));
+    return TRUE;
+}
+
+
+
+
+static void
+set_value_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gnc_numeric input)
+{
+    Account *anchor = view->priv->anchor;
+    Account *acct = xaccSplitGetAccount (split);
+    gnc_commodity *currency = xaccTransGetCurrency (trans);
+    gnc_numeric value, amount, rate;
+
+g_print("set_value_for trans %p and split %p\n", trans, split);
+
+//    if (xaccSplitGetAccount (split) == NULL) //FIXME this would make sure we have an account, not sure its valid.
+//        xaccTransScrubOrphans (trans);
+
+    if (gnc_numeric_zero_p (input))
+    {
+        xaccSplitSetValue (split, input);
+        xaccSplitSetAmount (split, input);
+        return;
+    }
+
+    if (needs_exchange_rate (view, trans, split))
+    {
+        if (handle_exchange_rate (view, input, trans, split))
+        {
+            ; //FIXME ??????
+        }
+        return;
+    }
+
+    /* Context determines the interpretation of the input.  If the
+       treeview is anchored to an account then the input is
+       interpreted as being in the Account's commodity.  Otherwise,
+       it's interpreted as being in the Transaction's currency. */
+    if (anchor)
+    {
+        gnc_commodity *reg_com = view->priv->reg_comm;
+        gnc_commodity *split_com = xaccAccountGetCommodity (acct);
+        /* Convert from the anchor account's commodity to
+           trans currency */
+        //xaccSplitSetAmount (split, input);
+        if (gnc_commodity_equiv (currency, reg_com))
+            value = input;
+        else 
+       {
+            if (!xaccTransGetRateForCommodity (trans, reg_com, NULL, &rate))
+                return;
+            //rate = xaccTransGetAccountConvRate(trans, anchor);
+            if (gnc_numeric_zero_p (rate))
+            {
+                // FIXME: probably wrong.
+                xaccTransSetCurrency (trans, reg_com);
+                value = input;
+            }
+            else
+                value = gnc_numeric_div (
+                    input, rate,
+                    GNC_DENOM_AUTO, //?
+                    //gnc_commodity_get_fraction(currency),
+                    GNC_HOW_RND_ROUND);
+        }
+        xaccSplitSetValue (split, value);
+        //return;
+        if (gnc_commodity_equiv (split_com, reg_com))
+            amount = input;
+        else
+        {
+            rate = xaccTransGetAccountConvRate (trans, acct);
+            amount = gnc_numeric_mul (value, rate, xaccAccountGetCommoditySCU (acct), GNC_HOW_RND_ROUND);
+        }
+        xaccSplitSetAmount (split, amount);
+    }
+    else
+    {
+        //FIXME: untested; assumes entry in the trans currency
+        //gnc_commodity *split_com = xaccAccountGetCommodity(acct);
+        value = input;
+        xaccSplitSetValue (split, value);
+        //g_assert (split_com == currency);
+        //FIXME: obsolete
+        /* For a split belonging to another account */
+        rate = xaccTransGetAccountConvRate (trans, acct);
+        amount = gnc_numeric_mul (value, rate, xaccAccountGetCommoditySCU (acct), GNC_HOW_RND_ROUND);
+        if (gnc_numeric_check (amount) == GNC_ERROR_OK)
+        {
+            xaccSplitSetAmount (split, amount);
+        }
+    }
+}
+
+
 /* Returns a value for display. */
 static gnc_numeric
-get_value_for(GncTreeViewSplitReg *tv, Transaction *trans,
+get_value_for (GncTreeViewSplitReg *view, Transaction *trans,
               Split *split, gboolean is_blank)
 {
     gnc_commodity *currency = xaccTransGetCurrency(trans);
     gnc_numeric total;
 
-    total = xaccSplitGetValue(split);
+//g_print("get_value_for trans %p and split %p is_blank %d\n", trans, split, is_blank);
 
-    if (is_blank && gnc_numeric_zero_p(total)) {
+
+    total = xaccSplitGetValue (split);
+
+    if (is_blank && gnc_numeric_zero_p (total)) {
         gnc_numeric rate;
-        total = gnc_numeric_neg(xaccTransGetImbalanceValue(trans));
-        if (!gnc_numeric_zero_p(total)) {
+        total = gnc_numeric_neg (xaccTransGetImbalanceValue (trans));
+        if (!gnc_numeric_zero_p (total)) {
 
-            if (!xaccTransGetRateForCommodity(
-                    trans, tv->priv->reg_comm, NULL, &rate))
+            if (!xaccTransGetRateForCommodity (trans, view->priv->reg_comm, NULL, &rate))
                 return gnc_numeric_zero();
 
-            total = gnc_numeric_mul(
+            total = gnc_numeric_mul (
                 total, rate,
                 gnc_commodity_get_fraction (currency),
                 GNC_HOW_RND_ROUND);
         }
     } else {
-        if (!gnc_numeric_zero_p(total) &&
-            gnc_numeric_check(total) == GNC_ERROR_OK) {
+        if (!gnc_numeric_zero_p (total) &&
+            gnc_numeric_check (total) == GNC_ERROR_OK) {
 
             /* fixme: if needs conversion? */
-            gnc_commodity *commodity = tv->priv->reg_comm;
+            gnc_commodity *commodity = view->priv->reg_comm;
 /*FIXME  ??          if (commodity && !gnc_commodity_equiv(commodity, currency))
                 total = xaccSplitConvertAmount(split, commodity); */
         }
@@ -520,29 +959,94 @@
 }
 
 
+static void
+set_amount_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gnc_numeric input)
+{
+    Account *acct = xaccSplitGetAccount (split);
+    gnc_commodity *split_com = xaccAccountGetCommodity (acct);
+    gnc_commodity *currency = xaccTransGetCurrency (trans);
 
+g_print("set_amount_for trans %p and split %p\n", trans, split);
+
+    xaccSplitSetAmount (split, input);
+    if (gnc_commodity_equiv (currency, split_com))
+        xaccSplitSetValue (split, input);
+
+    return;
+}
+
+
 static gnc_numeric
-get_rate_for(GncTreeViewSplitReg *tv, Transaction *trans,
-              Split *split, gboolean is_blank)
+get_rate_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gboolean is_blank)
 {
     gnc_numeric num;
 
-    num = get_value_for(tv, trans, split, is_blank);
-    num = gnc_numeric_div(
-        xaccSplitGetAmount(split), num,
-        GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
+g_print("get_rate_for trans %p and split %p is_blank %d\n", trans, split, is_blank);
+
+    num = get_value_for (view, trans, split, is_blank);
+    num = gnc_numeric_div ( xaccSplitGetAmount (split), num, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
     return num;
 }
 
 
+static void
+set_rate_for (GncTreeViewSplitReg *view, Transaction *trans, Split *split, gnc_numeric input, gboolean is_blank)
+{
+    gnc_commodity *split_comm;
 
-/* Returns the other Split based on the current Account */
+    gnc_numeric old_rate = get_rate_for (view, trans, split, is_blank);
+    gnc_numeric factor = gnc_numeric_div (input, old_rate, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
+    split_comm = xaccAccountGetCommodity (xaccSplitGetAccount (split));
+/*FIXME     xaccTransAdjustRateForCommodity(trans, split_comm, factor); */
+
+g_print("set_rate_for trans %p and split %p is_blank %d\n", trans, split, is_blank);
+
+#if JUNK
+    reg_comm = view->priv->reg_comm;
+    if (xaccTransGetRateForCommodity (trans, reg_comm, split, &reg_rate))
+    {
+        input = gnc_numeric_div (input, reg_rate, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
+        /* input is now the rate from the transaction currency to the
+           split_com */
+    }
+
+    if (gnc_numeric_zero_p (val) && gnc_numeric_zero_p (amt))
+    {
+        gnc_numeric one = gnc_numeric_create (1, 1);
+        xaccSplitSetAmount (split, one);
+        amt = one;
+    }
+
+    if (gnc_numeric_zero_p (val))
+    {
+        val = gnc_numeric_div (input, amt, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
+    }
+    else
+    {
+        amt = gnc_numeric_mul (input, val, GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
+    }
+
+    amt = gnc_numeric_mul (get_value_for(view, trans, split, FALSE /*FIXME*/),
+                          input,
+                          GNC_DENOM_AUTO, GNC_HOW_RND_ROUND);
+    set_amount_for (view, trans, split, amt);
+
+    //xaccSplitSetValue (split, val);
+    //xaccSplitSetAmount (split, amt);
+
+#endif
+}
+
+
+
+/*FIXME This could be a list...... Returns the other Split based on the current Account */
+/*FIXME Check, This might only be used with two splits */
 static Split *
-get_other_split(GncTreeViewSplitReg *tv, Transaction *trans)
+get_other_split (GncTreeViewSplitReg *view, Transaction *trans)
 {
     int i;
     Split *split = NULL;
-    Account *anchor = tv->priv->anchor;
+    Account *anchor = view->priv->anchor;
 
     for (i = 0; (split = xaccTransGetSplit(trans, i)); i++) {
         if (anchor == xaccSplitGetAccount(split))
@@ -552,96 +1056,240 @@
 }
 
 
-
 /* Returns a Split that matches the current Account */
 static Split *
-get_this_split(GncTreeViewSplitReg *tv, Transaction *trans)
+get_this_split (GncTreeViewSplitReg *view, Transaction *trans)
 {
     int i;
     Split *split = NULL;
-    Account *anchor = tv->priv->anchor;
+    Account *anchor = view->priv->anchor;
 
-    for (i = 0; (split = xaccTransGetSplit(trans, i)); i++) {
-        if (anchor == xaccSplitGetAccount(split))
+    for (i = 0; (split = xaccTransGetSplit (trans, i)); i++) {
+        if (anchor == xaccSplitGetAccount (split))
             return split;
     }
     return NULL;
 }
 
 
+/* The returned Splits may be newly created and not yet belong to trans. */
+static gboolean
+get_split_pair (GncTreeViewSplitReg *view, Transaction *trans, Split **osplit, Split **split)
+{
+    QofBook       *book; //do we have this
 
+    gint count = xaccTransCountSplits (trans);
+    Account *anchor = view->priv->anchor;
+
+//FIXME Probably needs more work 
+
+    book = gnc_get_current_book();
+
+g_print("get_split_pair trans is %p, osplit is %p and split is %p\n", trans, *osplit, *split);
+
+    if (count == 0)
+    {
+        *split = xaccMallocSplit (book);
+        xaccSplitSetAccount (*split, anchor);
+        xaccSplitSetParent (*split, trans);
+        *osplit = view->priv->btrans_split;
+    }
+    else if (count == 1)
+    {
+        *split = xaccTransGetSplit (trans, 0);
+        *osplit = view->priv->btrans_split;
+    }
+    else if (count == 2)
+    {
+        int i;
+        Split *s;
+
+        for (i = 0; (s = xaccTransGetSplit (trans, i)); i++)
+        {
+            if (anchor == xaccSplitGetAccount (s))
+            {
+                *split = s;
+                break;
+            }
+        }
+        //*split = get_this_split (view, trans);
+        g_assert (*split);
+        *osplit = get_other_split (view, trans);
+        g_assert (*osplit);
+    }
+    else
+        return FALSE;
+g_print("get_split_pair return - trans is %p, count is %d, osplit is %p and split %p is set to anchor %p\n", trans, count, *osplit, *split, anchor);
+    return TRUE;
+}
+
+
+
+/* poor name: really means: If this is the blank split, it may now
+   eventually graduate to a real split. The trans must already be
+   opened for editing because the split will be added to the
+   transaction if hasn't been already. */
+static void
+mark_split_dirty (GncTreeViewSplitReg *view, Transaction *trans, Split *split)
+{
+g_print("mark_split_dirty trans %p and split %p\n", trans, split);
+//    if (split != view->priv->dirty_split && view->priv->dirty_split)
+  
+
+    if (split != view->priv->dirty_split)
+    {
+g_print("commiting dirty split1\n");
+        if (view->priv->dirty_split)
+        {
+g_print("commiting dirty split2\n");
+        gnc_tree_model_split_reg_commit_split (get_split_reg_model_from_view (view), view->priv->dirty_split);
+        }
+    }
+
+    if (split && trans && xaccSplitGetParent (split) != trans)
+    {
+g_print("commiting dirty split3\n");
+
+        if (xaccTransCountSplits (trans) == 0)
+        {
+g_print("commiting dirty split4\n");
+            xaccSplitSetAccount (split, view->priv->anchor);
+        }
+        xaccSplitSetParent (split, trans);
+    }
+
+    view->priv->dirty_split = split;
+}
+
+
+
+/* Does this transaction have any Imbalance splits */
 static gboolean
-get_model_iter_from_selection(GncTreeViewSplitReg *tv,
+get_imbalance (Transaction *trans)
+{
+    int i;
+    Split *split = NULL;
+    const gchar *acc_name;
+    const gchar *prefix = _("Imbalance"); 
+
+    for (i = 0; (split = xaccTransGetSplit (trans, i)); i++)
+    {
+        if (xaccSplitGetAccount (split) != NULL)
+        {
+            acc_name = xaccAccountGetName (xaccSplitGetAccount (split));
+
+            if (g_str_has_prefix (acc_name, prefix))
+                return TRUE;
+        }
+    }
+    return FALSE;
+
+}
+
+
+static gboolean
+get_model_iter_from_view_string(GncTreeViewSplitReg *view,
+                                const gchar *path_string, GtkTreeIter *iter)
+{
+    GtkTreeModelSort *s_model;
+    GtkTreeIter s_iter;
+
+    s_model = GTK_TREE_MODEL_SORT (gtk_tree_view_get_model (GTK_TREE_VIEW (view)));
+    if (!gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (s_model), &s_iter, path_string))
+    {
+        iter = NULL;
+        return FALSE;
+    }
+
+    gtk_tree_model_sort_convert_iter_to_child_iter (s_model, iter, &s_iter);
+    return TRUE;
+}
+
+static gboolean
+get_model_iter_from_selection (GncTreeViewSplitReg *view,
                               GtkTreeSelection *sel, GtkTreeIter *iter)
 {
     GtkTreeModel *s_model;
     GtkTreeIter s_iter;
 
-    if (gtk_tree_selection_get_selected(sel, &s_model, &s_iter)) {
-        gtk_tree_model_sort_convert_iter_to_child_iter(
-            GTK_TREE_MODEL_SORT(s_model), iter, &s_iter);
+    if (gtk_tree_selection_get_selected (sel, &s_model, &s_iter))
+    {
+//g_print("s_iter is '%s'\n", gtk_tree_model_get_string_from_iter ( s_model, &s_iter));
+        gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model), iter, &s_iter);
+//g_print("iter is '%s'\n", gtk_tree_model_get_string_from_iter (gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT (s_model)), iter));
         return TRUE;
     }
     return FALSE;
-
 }
 
 
 
+
+
 /* Instead of setting a different cellDataFunc for each column, we just
    collect everything here and use this one func. */
 static void
-cdf(GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
-    GtkTreeIter *s_iter, gpointer data)
+cdf (GtkTreeViewColumn *col, GtkCellRenderer *cell, GtkTreeModel *s_model,
+    GtkTreeIter *s_iter, gpointer user_data)
 {
-    GncTreeViewSplitReg *tv = GNC_TREE_VIEW_SPLIT_REG(data);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
     GncTreeModelSplitReg *model;
     GtkTreeIter iter;
     GtkTreePath *path;
     ViewCol viewcol;
+    Transaction *trans;
+    Split *split;
     gboolean is_split, is_blank, is_trow1, is_trow2;
     gboolean editable = FALSE, expanded = FALSE;
+    gboolean read_only = FALSE;
+    gint num_of_splits = 0;
+    gnc_numeric num;
+    const gchar *s = "";
 
-    gchar *cell_color;
-    gint depth, *indices;
+    RowDepth depth;
 
-    Account *anchor = tv->priv->anchor;
-    Split *split;
-    Transaction *trans;
+    gint *indices;
 
-    gnc_numeric num;
-    const gchar *s = "";
+    Account *anchor = view->priv->anchor;
 
     ENTER("");
 
-    model = get_split_reg_model_from_view(tv);
+    model = get_split_reg_model_from_view (view);
 
-    gtk_tree_model_sort_convert_iter_to_child_iter(GTK_TREE_MODEL_SORT(s_model), &iter, s_iter);
+    gtk_tree_model_sort_convert_iter_to_child_iter (GTK_TREE_MODEL_SORT (s_model), &iter, s_iter);
 
-    viewcol = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cell), "view_column"));
+    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "view_column"));
 
-    g_return_if_fail(gnc_tree_model_split_reg_get_split_and_trans(
+    g_return_if_fail (gnc_tree_model_split_reg_get_split_and_trans(
                          GNC_TREE_MODEL_SPLIT_REG(model), &iter,
                           &is_trow1, &is_trow2, &is_split, &is_blank,
                           &split, &trans));
 
-    depth = gtk_tree_path_get_depth (gtk_tree_model_get_path (GTK_TREE_MODEL(model), &iter));
+    depth = gtk_tree_path_get_depth (gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter));
 
-/* g_print(" cdf depth is %d\n", depth); */
+// g_print("cdf split %p, trans %p, is_trow1 = %d, is_trow2 = %d, is_split = %d, is_blank = %d\n",
+//                                        split, trans, is_trow1, is_trow2, is_split, is_blank);
 
-    /* This expands to split from top level and you cannot collapse split, may be needed
-    if (depth == 2)
-        gtk_tree_view_expand_to_path (GTK_TREE_VIEW(tv), gtk_tree_model_get_path (GTK_TREE_MODEL(model), &iter));
-    */
+//g_print(" cdf depth is %d\n", depth);
 
-    /* This gives me double lines, you can not collapse them */
-    if ((tv->priv->double_line) && (depth == 1))
-        gtk_tree_view_expand_to_path (GTK_TREE_VIEW(tv), gtk_tree_model_get_path (GTK_TREE_MODEL(model), &iter));
+    /* Get the read only model setting */
+    gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, GNC_TREE_MODEL_SPLIT_REG_COL_RO, &read_only, -1);
 
-    indices = gtk_tree_path_get_indices (gtk_tree_model_get_path (GTK_TREE_MODEL(model), &iter));
+    indices = gtk_tree_path_get_indices (gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter));
 
-/* g_print(" cdf path is %s\n", gtk_tree_path_to_string (gtk_tree_model_get_path (GTK_TREE_MODEL(model), &iter))); */
+//g_print(" cdf path is %s\n", gtk_tree_path_to_string (gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter)));
 
+    /* Lets see if the splits are expanded and count them */
+    if (is_trow1 || is_trow2)
+    {
+        num_of_splits = xaccTransCountSplits (trans);
+        path = gtk_tree_model_get_path (s_model, s_iter);
+        if (is_trow1)
+            gtk_tree_path_down (path); /* Move the path down to trow2 */
+        expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), path);
+        gtk_tree_path_free (path);
+    }
+
     switch (viewcol) {
     case COL_DATE:
         /* Column is DATE */
@@ -656,7 +1304,7 @@
             //date on new transactions
             if (ts.tv_sec == 0)
             {
-                ts.tv_sec = time(NULL);
+                ts.tv_sec = time (NULL);
                 //xaccTransSetDatePostedSecs(trans, ts.tv_sec);
             }//if
             s = gnc_print_date(ts);
@@ -666,24 +1314,64 @@
             s = "";
             editable = FALSE;
         }
-        /* This will remove the calander buttons if FALSE, preference may be ? */
-        g_object_set(cell, "use_buttons", TRUE, NULL ); 
-        g_object_set(cell, "text", s, "editable", editable, NULL);
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        /*FIXME This will remove the calander buttons if FALSE, preference may be ? */
+        g_object_set (cell, "use_buttons", TRUE, NULL ); 
+        g_object_set (cell, "text", s, "editable", editable, NULL);
         break;
 
+    case COL_DUEDATE:
+        /* Column is DUE DATE */
+        if (is_split)
+            g_object_set (cell, "cell-background", "white", (gchar*)NULL);
+
+        if (is_trow1) {
+            Timespec ts = {0,0};
+            char type;
+
+            type = xaccTransGetTxnType (trans);
+
+            /* Only print the due date for invoice transactions */
+            if (type == TXN_TYPE_INVOICE)
+            {
+                xaccTransGetDateDueTS (trans, &ts);
+                s = gnc_print_date (ts);
+                editable = FALSE;
+            }
+            else {
+                s = "";
+                editable = FALSE;
+            }
+        }
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
     case COL_NUMACT:
-        /* Column is NUM/ACT */
+        /* Column is NUM / ACT */
         /* Override default alignment */
-        g_object_set( cell, "xalign", 0.0, NULL );
+        g_object_set (cell, "xalign", 0.0, NULL );
 
+        editable = TRUE;
+
         if (is_trow1)
-           s = xaccTransGetNum(trans);
-        else if (is_trow2)
-           s = xaccSplitGetAction(get_this_split(tv, trans));
+            s = xaccTransGetNum (trans);
+        else if (is_trow2 && !expanded)
+            s = xaccSplitGetAction (get_this_split (view, trans));
         else if (is_split)
-           s = xaccSplitGetAction(split);
+            s = xaccSplitGetAction (split);
+        else
+        {
+            s = "";
+            editable = FALSE;
+        }
 
-        g_object_set(cell, "text", s, "editable", TRUE, NULL);
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
         break;
 
     case COL_DESCNOTES:
@@ -693,140 +1381,176 @@
         if (is_trow1)
             s =  xaccTransGetDescription (trans);
         else if (is_trow2)
-            s =  xaccTransGetNotes(trans);
+            s =  xaccTransGetNotes (trans);
         else if (is_split)
-            s = xaccSplitGetMemo(split);
+            s = xaccSplitGetMemo (split);
+        editable = TRUE;
 
-        g_object_set(cell, "text", s, NULL);
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
         break;
 
     case COL_TRANSVOID:
         /* Column is TRANSFER / VOID */
-
         /* Not sure if this will stay here, this sets the combo column
            0 for short account names, 1 for long */
-        if (tv->priv->acct_short_names)
-            g_object_set(G_OBJECT(cell), "text-column", 0, NULL );
+        if (view->priv->acct_short_names)
+            g_object_set (G_OBJECT (cell), "text-column", 0, NULL );
         else
-            g_object_set(G_OBJECT(cell), "text-column", 1, NULL );
+            g_object_set (G_OBJECT (cell), "text-column", 1, NULL );
 
-        if (is_trow1) {
-            gint count = xaccTransCountSplits(trans);
-            path = gtk_tree_model_get_path(s_model, s_iter);
-            gtk_tree_path_down (path); /* Move the path down to trow2 */
-            expanded = gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path);
-            if (count == 0 || expanded) {
+        if (is_trow1)
+        {
+            if (expanded)
                 s = ""; /* blank-out if splits are visible */
-            } else if (2 == count) {
+            else if (num_of_splits == 2)
+            {
                 Account *acct;
                 Split *osplit;
-                osplit = get_other_split(tv, trans);
-                acct = xaccSplitGetAccount(osplit);
-                if(tv->priv->acct_short_names)
-                    s = xaccAccountGetName(acct);
+                osplit = get_other_split (view, trans);
+                acct = xaccSplitGetAccount (osplit);
+                if (view->priv->acct_short_names)
+                    s = xaccAccountGetName (acct);
                 else
-                    s = gnc_account_get_full_name(acct);
-            } else {
+                    s = gnc_account_get_full_name (acct);
+            }
+            else if (num_of_splits == 0 || num_of_splits == 1)
+            {
+                Account *acct;
+                acct = xaccSplitGetAccount (view->priv->btrans_split);
+                if (acct != NULL)
+                {
+                    if (view->priv->acct_short_names)
+                        s = xaccAccountGetName (acct);
+                    else
+                        s = gnc_account_get_full_name (acct);
+                }
+                else
+                    s = "";
+            }
+                    
+            if (num_of_splits > 2)
+            {
                 s = SPLIT_TRANS_STR;
             }
-            editable = anchor && !expanded && ((2 == count) || (0 == count));
-            gtk_tree_path_free(path);
+            editable = anchor && !expanded && (num_of_splits < 3);
         }
-        if (is_trow2) {
-            s = xaccTransGetVoidReason(trans); /* This is the Void Reason */
+        if (is_trow2)
+        {
+            s = xaccTransGetVoidReason (trans); // This is the Void Reason
             editable = FALSE;
         }
-        if (is_split) {
-            Account *acct = xaccSplitGetAccount(split);
-            if(anchor == acct)
+        if (is_split)
+        {
+            Account *acct = xaccSplitGetAccount (split);
+
+            if (xaccTransCountSplits (trans) == 0) // First split on blank transaction 
+                acct = anchor;
+
+            if (acct != NULL)
+            {
+                if (view->priv->acct_short_names)
+                    s = xaccAccountGetName (acct);
+                else
+                    s = gnc_account_get_full_name (acct);
+            }
+            else
+                s = "";
+
+            if (anchor == acct)
                 editable = FALSE;
             else
                 editable = TRUE;
-            if(tv->priv->acct_short_names)
-                s = xaccAccountGetName(acct);
-            else
-                s = gnc_account_get_full_name(acct);
         }
-        g_object_set(cell, "text", s, "editable", editable, NULL);
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
         break;
 
     case COL_RECN:
         /* Column is RECN */
-        if (is_trow1) {
-            static char ss[2];
-            char rec = xaccSplitGetReconcile(get_this_split(tv, trans));
+        if (is_trow1 && !expanded) {
+            char rec = xaccSplitGetReconcile (get_this_split (view, trans));
             if (rec == VREC || rec == FREC || rec == YREC)
                 editable = FALSE;
             else
                 editable = TRUE;
 
-            ss[0] = rec;
-            ss[1] = '\0';
-            g_object_set(cell, "text", ss, "editable", editable, NULL);
+            if (rec != ' ')
+                s = gnc_get_reconcile_str (rec);
+            else
+                s = gnc_get_reconcile_str (NREC);
 
+            g_object_set (cell, "text", s, NULL);
+
         } else {
             s = "";
             editable = FALSE;
-            g_object_set(cell, "text", s, "editable", editable, NULL);
+            g_object_set (cell, "text", s, NULL);
         }
 
         if (is_split) {
-            static char ss[2];
-            char rec = xaccSplitGetReconcile(split);
+            char rec = xaccSplitGetReconcile (split);
             if (rec == VREC || rec == FREC || rec == YREC)
                 editable = FALSE;
             else
                 editable = TRUE;
 
-            ss[0] = rec;
-            ss[1] = '\0';
-            g_object_set(cell, "text", ss, "editable", editable, NULL);
+            if (rec != ' ')
+                s = gnc_get_reconcile_str (rec);
+            else
+                s = gnc_get_reconcile_str (NREC);
+
+            g_object_set (cell, "text", s, NULL);
         }
 
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "editable", editable, NULL);
         break;
 
     case COL_TYPE:
         /* Column is TYPE */
+        if (is_split)
+            g_object_set (cell, "cell-background", "white", (gchar*)NULL);
+
         if (is_trow1) {
             static char ss[2];
-            char type = xaccTransGetTxnType(trans);
+            char type = xaccTransGetTxnType (trans);
             if (type == TXN_TYPE_NONE)
                 type = '?';
 
             ss[0] = type;
             ss[1] = '\0';
-            g_object_set(cell, "text", ss, NULL);
+            g_object_set (cell, "text", ss, NULL);
         }
         else
         {
             s = "";
-            g_object_set(cell, "text", s, NULL);
+            g_object_set (cell, "text", s, NULL);
         }
-        break;
 
-    case COL_AMOUNT:
-        /* Column is AMOUNT */
-       if (is_split) {
-            gnc_numeric amt = xaccSplitGetAmount(split);
-            s = xaccPrintAmount(amt, gnc_account_print_info( xaccSplitGetAccount(split), TRUE));
-            editable = TRUE;
-        } else {
-            s = "";
-            editable = FALSE;
-        }
-        g_object_set(cell, "text", s, "editable", editable, NULL);
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "editable", editable, NULL);
         break;
 
     case COL_VALUE:
         /* Column is VALUE */
         if (is_split) {
-            gnc_numeric amt = xaccSplitGetValue(split);
-            s = xaccPrintAmount(amt, gnc_commodity_print_info( xaccTransGetCurrency(trans), TRUE));
+            gnc_numeric amt = xaccSplitGetValue (split);
+            s = xaccPrintAmount (amt, gnc_commodity_print_info (xaccTransGetCurrency (trans), FALSE));
+            editable = TRUE;
         } else {
             s = "";
             editable = FALSE;
         }
-        g_object_set(cell, "text", s, NULL);
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
         break;
 
     case COL_RATE:
@@ -835,93 +1559,225 @@
             s = "";
             editable = FALSE;
         } else {
-            gnc_commodity *split_com = xaccAccountGetCommodity( xaccSplitGetAccount(split));
-            num = get_rate_for(tv, trans, split, is_blank);
+            gnc_commodity *split_com = xaccAccountGetCommodity (xaccSplitGetAccount (split));
+            num = get_rate_for (view, trans, split, is_blank);
             if (gnc_numeric_check(num) == GNC_ERROR_OK) {
-                s = xaccPrintAmount(num, gnc_split_amount_print_info(split, FALSE));
+                s = xaccPrintAmount (num, gnc_split_amount_print_info (split, FALSE));
                 editable = !gnc_numeric_zero_p(num) &&
-                    !gnc_commodity_equiv(split_com, tv->priv->reg_comm);
+                    !gnc_commodity_equiv(split_com, view->priv->reg_comm);
             } else {
                 s = "";
                 editable = FALSE;
             }
         }
-        g_object_set(cell, "text", s, "editable", editable, NULL);
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
         break;
 
+    case COL_AMOUNT:
+        /* Column is AMOUNT */
+       if (is_split) {
+            gnc_numeric amt = xaccSplitGetAmount (split);
+            s = xaccPrintAmount (amt, gnc_account_print_info (xaccSplitGetAccount (split), FALSE));
+            editable = TRUE;
+        } else {
+            s = "";
+            editable = FALSE;
+        }
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
+    case COL_AMTVAL:
+        /* Column is AMOUNT / VALUE */
+        if (is_trow2) {
+            s = "";
+            editable = FALSE;
+        } else if (is_trow1) {
+            if (anchor) {
+                gnc_numeric amt = xaccSplitGetValue (get_this_split (view, trans));
+                editable = !expanded && (num_of_splits < 3);
+                if(expanded)
+                    s = "";
+                else
+                    s = xaccPrintAmount (amt, gnc_commodity_print_info( xaccTransGetCurrency (trans), FALSE));
+            } else {
+                s = "";
+                editable = FALSE;
+            }
+        }
+
+        if (is_split) {
+            if (split == get_this_split(view, trans)) {
+                gnc_numeric amt = xaccSplitGetAmount (split);
+                s = xaccPrintAmount (amt, gnc_account_print_info (xaccSplitGetAccount (split), FALSE));
+                editable = TRUE;
+            } else {
+                s = "";
+                editable = FALSE;
+            }
+            if (get_imbalance (trans))
+                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
+        }
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
+        break;
+
     case COL_PRICE:
         /* Column is PRICE */
-        if ((is_trow1)||(is_trow2)) {
+        if (is_trow2) {
             s = "";
             editable = FALSE;
-        } else {
-            num = xaccSplitGetSharePrice(split);
+        } else if (is_trow1) {
+            if (anchor) {
+                num = xaccSplitGetSharePrice (get_this_split (view, trans));
+                editable = !expanded && (num_of_splits < 3);
+                if (expanded)
+                    s = "";
+                else {
+                    if (gnc_numeric_check (num) == GNC_ERROR_OK) {
+                        s = xaccPrintAmount (num, gnc_split_amount_print_info (split, FALSE));
+                    } else {
+                        s = "";
+                        editable = FALSE;
+                    }
+                }
+            } else {
+                s = "";
+                editable = FALSE;
+            }
+        }
 
-            if (gnc_numeric_check(num) == GNC_ERROR_OK) {
-                s = xaccPrintAmount(num, gnc_split_amount_print_info(split, FALSE));
-                editable = FALSE;
+        if(is_split) {
+            if(split == get_this_split (view, trans)) {
+                num = xaccSplitGetSharePrice (split);
+
+                if (gnc_numeric_check (num) == GNC_ERROR_OK) {
+                    s = xaccPrintAmount (num, gnc_split_amount_print_info (split, FALSE));
+                    editable = TRUE;
+                } else {
+                    s = "";
+                    editable = FALSE;
+                }
             } else {
                 s = "";
                 editable = FALSE;
             }
+            if (get_imbalance (trans))
+                g_object_set(cell, "cell-background", PINKCELL, (gchar*)NULL);
         }
-        g_object_set(cell, "text", s, "editable", editable, NULL);
+
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
         break;
 
     case COL_DEBIT:
     case COL_CREDIT:
         /* Column is CREDIT and DEBIT */
-        if (is_split) {
-            num = get_value_for(tv, trans, split, is_blank);
+        if (is_split)
+        {
+            num = get_value_for (view, trans, split, is_blank);
             editable = TRUE;
-        } else if (is_trow1) {
-            //comm = xaccTransGetCurrency(trans);
-            if (anchor) {
-                gint count = xaccTransCountSplits(trans);
-                path = gtk_tree_model_get_path(s_model, s_iter);
-                expanded = gtk_tree_view_row_expanded(GTK_TREE_VIEW(tv), path);
-                editable = !expanded && ((2 == count) || (0 == count));
-                num = xaccTransGetAccountAmount(trans, anchor);
-            } else {
+            if (get_imbalance (trans))
+                g_object_set (cell, "cell-background", PINKCELL, (gchar*)NULL);
+        }
+        else if (is_trow1)
+        {
+            if (anchor)
+            {
+                editable = !expanded && (num_of_splits < 3 );
+                num = xaccTransGetAccountAmount (trans, anchor);
+            }
+            else
+            {
                 editable = FALSE;
                 num = gnc_numeric_zero();
-                /* CHECKME: Should trans cred/debit fields in unanchored reg
-                   show imbalances? I don't think so. */
             }
-        } else if (is_trow2) {
+        }
+        else if (is_trow2)
+        {
             editable = FALSE;
             num = gnc_numeric_zero();
         }
 
-        if ((gnc_numeric_check(num) != GNC_ERROR_OK) || gnc_numeric_zero_p(num) ||
-            (gnc_numeric_negative_p(num) && viewcol == COL_CREDIT) ||
-            (gnc_numeric_positive_p(num) && viewcol == COL_DEBIT)) {
+        if ((gnc_numeric_check(num) != GNC_ERROR_OK) ||
+             gnc_numeric_zero_p(num) ||
+            (gnc_numeric_negative_p(num) && viewcol == COL_DEBIT) ||
+            (gnc_numeric_positive_p(num) && viewcol == COL_CREDIT))
+        {
             s = "";
-        } else {
-            s = xaccPrintAmount(gnc_numeric_abs(num),
-                                gnc_account_print_info(anchor, TRUE)); //FIXME: TRUE just for debugging maybe
         }
-        g_object_set(cell, "text", s, "editable", editable, NULL);
+        else
+        {
+            if (expanded)
+                s = "";
+            else
+                s = xaccPrintAmount (gnc_numeric_abs (num),
+                                gnc_account_print_info (anchor, FALSE));
+        }
+#ifdef skip
+        //FIXME may be use a function for these three if's
+        /* Only allow changes to values if we have a valid split accounts */
+        if (is_trow1 && !expanded && (xaccTransCountSplits (trans) == 2))
+        {
+            if (xaccSplitGetAccount (get_other_split (view, trans)) == NULL)
+                editable = FALSE;
+        }
+
+        if (is_trow1 && !expanded && (xaccTransCountSplits (trans) == 0 || xaccTransCountSplits (trans) == 1))
+        {
+            if (xaccSplitGetAccount (view->priv->btrans_split) == NULL)
+                editable = FALSE;
+        }
+
+        if (is_split && (xaccTransCountSplits (trans) != 0))
+        {
+            if (xaccSplitGetAccount (split) == NULL)
+                editable = FALSE;
+        }
+#endif
+        editable = (read_only == TRUE) ? FALSE : editable;
+
+        g_object_set (cell, "text", s, "editable", editable, NULL);
         break;
 
     case COL_BALANCE:
         /* Column is BALANCE */
+        if (is_split)
+            g_object_set(cell, "cell-background", "white", (gchar*)NULL);
+
         if (is_trow1 && anchor) {
-            num = xaccTransGetAccountBalance(trans, anchor);
-            if (gnc_reverse_balance(anchor))
-                num = gnc_numeric_neg(num);
-            s = xaccPrintAmount(num, gnc_account_print_info(anchor, TRUE));
-            if (gnc_numeric_negative_p(num)
-                && gnc_gconf_get_bool(GCONF_GENERAL, KEY_NEGATIVE_IN_RED, NULL))
-                g_object_set(cell, "foreground", "red", (gchar*)NULL);
+            num = xaccTransGetAccountBalance (trans, anchor);
+            if (gnc_reverse_balance (anchor))
+                num = gnc_numeric_neg (num);
+            s = xaccPrintAmount (num, gnc_account_print_info(anchor, FALSE));
+            if (gnc_numeric_negative_p (num)
+                && gnc_gconf_get_bool (GCONF_GENERAL, KEY_NEGATIVE_IN_RED, NULL))
+                g_object_set (cell, "foreground", "red", (gchar*)NULL);
             else
-                g_object_set(cell, "foreground", NULL, (gchar*)NULL);
+                g_object_set (cell, "foreground", NULL, (gchar*)NULL);
         } else {
             s = "";
         }
-        g_object_set(cell, "text", s, NULL);
+        g_object_set (cell, "text", s, "editable", FALSE, NULL);
         break;
 
+    case COL_STATUS:
+        /* Column is STATUS */
+        if (read_only)
+            g_object_set(cell, "cell-background", REDCELL, (gchar*)NULL);
+        else if (xaccTransInFutureByPostedDate (trans))
+            g_object_set(cell, "cell-background", BLUECELL, (gchar*)NULL);
+        else
+            g_object_set(cell, "cell-background", BLACKCELL, (gchar*)NULL);
+
     default:
         break;
     }
@@ -934,15 +1790,15 @@
           vvvvv    edit function call backs      vvvvvv
 #####################################################################*/
 static void
-start_edit(GtkCellRenderer *cr, GtkCellEditable *editable,
+start_edit (GtkCellRenderer *cr, GtkCellEditable *editable,
            const gchar *path_string, gpointer user_data)
 {
-    GncTreeViewSplitReg *tv = GNC_TREE_VIEW_SPLIT_REG(user_data);
-g_print("start_edit\n");
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+g_print("\n\nstart_edit\n");
 /*FIXME Not sure if this is required, leave for now ? */
-    get_editable_start_editing_cb(cr, editable, path_string, user_data);
-/*    g_signal_connect(G_OBJECT(editable), "editing-done", (GCallback) editing_done_cb, tv); */
-    tv->priv->acct_edit_path = g_strdup(path_string);
+    get_editable_start_editing_cb (cr, editable, path_string, user_data);
+/*    g_signal_connect(G_OBJECT(editable), "editing-done", (GCallback) editing_done_cb, view); */
+    view->priv->acct_edit_path = gtk_tree_path_new_from_string (path_string);
 
     return;
 }
@@ -952,124 +1808,140 @@
    != NULL) AND split doesn't belong to the trans (because it is the
    blank split) */
 static void
-begin_edit(GncTreeViewSplitReg *tv, Split *split, Transaction *trans)
+begin_edit (GncTreeViewSplitReg *view, Split *split, Transaction *trans)
 {
-g_print("begin edit\n");
+g_print("\n\nbegin_edit split %p and trans %p\n", split, trans);
     /* explain me -- this may need changing */
-    if (split && trans != xaccSplitGetParent(split))
+
+
+    if (split && trans != xaccSplitGetParent (split))
+    {
+g_print("begin_edit - blank split, return\n");
+        mark_split_dirty (view, trans, split);
         return;
-    if (trans != tv->priv->dirty_trans) {
-        xaccTransBeginEdit(trans);
-        tv->priv->dirty_trans = trans;
-        if (!xaccTransGetCurrency(trans)) {
-            xaccTransSetCurrency(trans, tv->priv->reg_comm);
+    }
+
+    if (trans != view->priv->dirty_trans)
+    {
+        Timespec ts = {0,0};
+        xaccTransGetDatePostedTS (trans, &ts);
+
+        xaccTransBeginEdit (trans);
+        view->priv->dirty_trans = trans;
+
+g_print("begin_edit - xaccTransBeginEdit trans %p\n", trans);
+
+        if (!xaccTransGetCurrency (trans))
+        {
+            xaccTransSetCurrency (trans, view->priv->reg_comm);
         }
+
+        if (ts.tv_sec == 0)
+        {
+            //If the time returned by xaccTransGetDatePostedTS is 0 then assume it
+            //is a new transaction and set the time to current time to show current
+            //date on new transactions
+
+            ts.tv_sec = time (NULL);
+            xaccTransSetDatePostedSecs(trans, ts.tv_sec);
+        }
     }
 }
 
 
-
 static void
-remove_edit_date(GtkCellEditable *ce, gpointer user_data)
+remove_edit_date (GtkCellEditable *ce, gpointer user_data)
 {
-    GncTreeViewSplitReg *tv = GNC_TREE_VIEW_SPLIT_REG(user_data);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
     GncPopupEntry *popup_entry;
     const gchar *new_string; 
     const gchar *current_string;
 
     //These strings are used to determine if cell data was altered so
     //that keynav works better
-g_print("remove edit date\n");
+//g_print("\n\nremove edit date\n");
 
-    popup_entry = GNC_POPUP_ENTRY(g_object_get_data( G_OBJECT(tv->priv->temp_cr), "cell-editable"));
+    popup_entry = GNC_POPUP_ENTRY (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable"));
 
-    new_string = g_strdup(gtk_entry_get_text(GTK_ENTRY(popup_entry->entry)));
-g_print("New String is '%s'\n", new_string);	
+    new_string = g_strdup (gtk_entry_get_text (GTK_ENTRY (popup_entry->entry)));
+//g_print("New String is '%s'\n", new_string);	
 
-    current_string = g_object_get_data(G_OBJECT( tv->priv->temp_cr), "current-string");
-g_print("Current String is '%s'\n\n", current_string);
+    current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
+//g_print("Current String is '%s'\n", current_string);
 
     //If editing wasn't canceled and strings don't match then
     //cell data was edited
-    if (!g_object_get_data(G_OBJECT(tv->priv->temp_cr), "edit-canceled") 
-             && g_ascii_strcasecmp(new_string, current_string))
+    if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled")) 
+             && g_ascii_strcasecmp (new_string, current_string))
     {
-        g_object_set_data(G_OBJECT(tv), "data-edited", (gpointer)TRUE);
+        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
     }
 
-    g_object_set_data(G_OBJECT(tv->priv->temp_cr), "cell-editable", NULL);
-    tv->priv->temp_cr = NULL;
-    g_free(tv->priv->acct_edit_path);
-    tv->priv->acct_edit_path = NULL;
+    g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
+    view->priv->temp_cr = NULL;
 }
 
 
-
 static void
-remove_edit_combo(GtkCellEditable *ce, gpointer user_data)
+remove_edit_combo (GtkCellEditable *ce, gpointer user_data)
 {
-    GncTreeViewSplitReg *tv = GNC_TREE_VIEW_SPLIT_REG(user_data);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
     GtkEntry *entry; 
     const gchar *new_string; 
     const gchar *current_string;
 
     //These strings are used to determine if cell data was altered so
     //that keynav works better
-g_print("remove edit combo\n");
+//g_print("\n\nremove edit combo\n");
 
-    entry = GTK_ENTRY (gtk_bin_get_child(GTK_BIN ( g_object_get_data( G_OBJECT(tv->priv->temp_cr), "cell-editable"))));
+    entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable"))));
 
-    new_string = gtk_entry_get_text(GTK_ENTRY(entry));
-g_print("New String is '%s'\n", new_string);	
+    new_string = gtk_entry_get_text (GTK_ENTRY (entry));
+//g_print("New String is '%s'\n", new_string);	
 
-    current_string = g_object_get_data(G_OBJECT( tv->priv->temp_cr), "current-string");
-g_print("Current String is '%s'\n\n", current_string);
+    current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
+//g_print("Current String is '%s'\n", current_string);
 
     //If editing wasn't canceled and strings don't match then
     //cell data was edited
-    if (!g_object_get_data(G_OBJECT(tv->priv->temp_cr), "edit-canceled") 
-             && g_ascii_strcasecmp(new_string, current_string))
+    if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled"))
+             && g_ascii_strcasecmp (new_string, current_string))
     {
-        g_object_set_data(G_OBJECT(tv), "data-edited", (gpointer)TRUE);
+        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
     }
 
-    g_object_set_data(G_OBJECT(tv->priv->temp_cr), "cell-editable", NULL);
-    tv->priv->temp_cr = NULL;
-    g_free(tv->priv->acct_edit_path);
-    tv->priv->acct_edit_path = NULL;
+    g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
+    view->priv->temp_cr = NULL;
 }
 
 
-
 static void
-remove_edit_completion(GtkCellEditable *ce, gpointer user_data)
+remove_edit_entry (GtkCellEditable *ce, gpointer user_data)
 {
-    GncTreeViewSplitReg *tv = GNC_TREE_VIEW_SPLIT_REG(user_data);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
     const gchar *new_string; 
     const gchar *current_string; 
 
-g_print("remove edit completion\n");
+//g_print("\n\nremove edit completion\n");
 
     //These strings are used to determine if cell data was altered so
     //that keynav works better
-    new_string = gtk_entry_get_text(GTK_ENTRY(g_object_get_data( G_OBJECT(tv->priv->temp_cr), "cell-editable")));
-g_print("New String is '%s'\n", new_string);
+    new_string = gtk_entry_get_text (GTK_ENTRY (g_object_get_data (G_OBJECT (view->priv->temp_cr), "cell-editable")));
+//g_print("New String is '%s'\n", new_string);
 
-    current_string = g_object_get_data(G_OBJECT( tv->priv->temp_cr), "current-string");
-g_print("Current String is '%s'\n\n", current_string);
+    current_string = g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-string");
+//g_print("Current String is '%s'\n", current_string);
 
     //If editing wasn't canceled and strings don't match then
     //cell data was edited
-    if (!g_object_get_data(G_OBJECT(tv->priv->temp_cr), "edit-canceled") 
-             && g_ascii_strcasecmp(new_string, current_string))
+    if (!GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "edit-canceled")) 
+             && g_ascii_strcasecmp (new_string, current_string))
     {
-        g_object_set_data(G_OBJECT(tv), "data-edited", (gpointer)TRUE);
+        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
     }
 
-    g_object_set_data(G_OBJECT(tv->priv->temp_cr), "cell-editable", NULL);
-    tv->priv->temp_cr = NULL;
-    g_free(tv->priv->acct_edit_path);
-    tv->priv->acct_edit_path = NULL;
+    g_object_set_data (G_OBJECT (view->priv->temp_cr), "cell-editable", NULL);
+    view->priv->temp_cr = NULL;
 }
 
 
@@ -1081,16 +1953,24 @@
    finished before raising the dialog.  That finalizes the
    gtkcelleditable. */
 static void
-finish_edit(GtkTreeViewColumn *col)
+finish_edit (GtkTreeViewColumn *col)
 {
+    GList *renderers;
     GtkCellRenderer *cr;
     GtkCellEditable *ce;
-g_print("finish_edit\n");
+g_print("\n\nfinish_edit\n");
 /*FIXME Not used yet, leave for now */
-    if (!col) return;
-    cr = gnc_tree_view_column_get_renderer(col);
-    if ((ce = GTK_CELL_EDITABLE(g_object_get_data(G_OBJECT(cr), "cell-editable")))) {
-        gtk_cell_editable_editing_done(ce);
+    if (!col)
+        return;
+
+    renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col)); //FIXME I am only looking at one renderer per cell.
+    g_assert (g_list_length (renderers) == 1);
+    cr = g_list_nth_data (renderers, 0);
+    g_list_free (renderers);
+
+    if ((ce = GTK_CELL_EDITABLE (g_object_get_data (G_OBJECT (cr), "cell-editable"))))
+    {
+        gtk_cell_editable_editing_done (ce);
     }
 }
 
@@ -1101,174 +1981,959 @@
           vvvvvv   gtv function call backs       vvvvv
 #####################################################################*/
 static void
-gtv_split_reg_motion_cb(GtkTreeSelection *sel, gpointer data)
+gtv_split_reg_titles (GncTreeViewSplitReg *view, RowDepth depth)
 {
+    GncTreeModelSplitReg *model;
+    GtkCellRenderer *cr;
+    GList *renderers;
+    GList *columns;
+    GList  *column;
+    gint i;
 
+//g_print("title depth is %d\n", depth);
+
+    model = get_split_reg_model_from_view (view);
+    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;
+
+        /*FIXME ## Do we need to look for multiple renderers ?
+          We only have one renderer per cell now */
+        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (tvc)); //FIXME I am only looking at one renderer per cell.
+        g_assert (g_list_length (renderers) == 1);
+        cr = g_list_nth_data (renderers, 0);
+        g_list_free (renderers);
+
+        viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(cr), "view_column"));
+
+        switch(viewcol)
+        {
+        case COL_DATE:
+            switch(model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Date"));
+                break;
+            }
+            break;
+
+        case COL_DUEDATE:
+            switch(model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Due Date"));
+                break;
+            }
+            break;
+
+        case COL_NUMACT:
+            switch(model->type)
+            {
+            case RECEIVABLE_REGISTER2:
+            case PAYABLE_REGISTER2:
+                if(depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Reference"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Action"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Action"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Reference / Action"));
+                break;
+
+
+            default:
+                if(depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Number"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Action"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Action"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Number / Action"));
+                break;
+            }
+            break;
+
+        case COL_DESCNOTES:
+            switch(model->type)
+            {
+            case RECEIVABLE_REGISTER2:
+                if(depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Customer"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Memo"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Memo"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Customer / Memo "));
+                break;
+
+            case PAYABLE_REGISTER2:
+                if(depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Vendor"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Memo"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Memo"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Vendor / Memo "));
+                break;
+
+
+            default:
+                if(depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Description"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Notes"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Memo"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Description / Notes / Memo"));
+                break;
+            }
+            break;
+
+        case COL_TRANSVOID:
+            switch(model->type)
+            {
+            case RECEIVABLE_REGISTER2:
+            case PAYABLE_REGISTER2:
+                if(depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
+                break;
+
+            default:
+                if(depth == TRANS1)
+                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
+                else if (depth == TRANS2)
+                    gtk_tree_view_column_set_title (tvc, _("Void Reason"));
+                else if (depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Accounts"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Accounts / Void Reason"));
+                break;
+            }
+            break;
+
+        case COL_RECN:
+            switch(model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("R"));
+                break;
+            }
+            break;
+
+        case COL_TYPE:
+            switch(model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Type"));
+                break;
+            }
+            break;
+
+        case COL_VALUE:
+            switch(model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Value"));
+                break;
+            }
+            break;
+
+        case COL_AMOUNT:
+            switch(model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Amount"));
+                break;
+            }
+            break;
+
+        case COL_AMTVAL:
+            switch(model->type)
+            {
+            default:
+                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"));
+                else
+                    gtk_tree_view_column_set_title (tvc, _("Amount / Value"));
+                break;
+            }
+            break;
+
+        case COL_RATE:
+            switch(model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Rate"));
+                break;
+            }
+            break;
+
+        case COL_PRICE:
+            switch(model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Price"));
+                break;
+            }
+            break;
+
+        case COL_CREDIT:
+            if(!(model->use_accounting_labels))
+            {
+                switch(model->type)
+                {
+                case BANK_REGISTER2: //FIXME These if statements may not be required
+                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)
+                        gtk_tree_view_column_set_title (tvc, _("Spend"));
+                    break;
+
+                case ASSET_REGISTER2:
+                case LIABILITY_REGISTER2:
+                case EQUITY_REGISTER2:
+                case TRADING_REGISTER2:
+                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)
+                        gtk_tree_view_column_set_title (tvc, _("Charge"));
+                    break;
+
+                case INCOME_REGISTER2:
+                case INCOME_LEDGER2:
+                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)
+                        gtk_tree_view_column_set_title (tvc, _("Rebate"));
+                    break;
+
+                case STOCK_REGISTER2:
+                case PORTFOLIO_LEDGER2:
+                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)
+                        gtk_tree_view_column_set_title (tvc, _("Payment"));
+                    break;
+
+                case PAYABLE_REGISTER2:
+                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)
+                        gtk_tree_view_column_set_title (tvc, _("Funds Out"));
+                    break;
+
+                default:
+                    if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Credit"));
+                    break;
+                }
+            }
+            else
+                gtk_tree_view_column_set_title (tvc, _("Credit"));
+            break;
+
+        case COL_DEBIT:
+            if(!(model->use_accounting_labels))
+            {
+                switch(model->type)
+                {
+                case BANK_REGISTER2: //FIXME These if statements may not be required
+                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)
+                        gtk_tree_view_column_set_title (tvc, _("Recieve"));
+                    break;
+
+                case ASSET_REGISTER2:
+                case LIABILITY_REGISTER2:
+                case EQUITY_REGISTER2:
+                case TRADING_REGISTER2:
+                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Decrease"));
+                    break;
+
+                case CREDIT_REGISTER2:
+                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Payment"));
+                    break;
+
+                case INCOME_REGISTER2:
+                case INCOME_LEDGER2:
+                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)
+                        gtk_tree_view_column_set_title (tvc, _("Expense"));
+                    break;
+
+                case STOCK_REGISTER2:
+                case PORTFOLIO_LEDGER2:
+                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)
+                        gtk_tree_view_column_set_title (tvc, _("Invoice"));
+                    break;
+
+                case PAYABLE_REGISTER2:
+                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)
+                        gtk_tree_view_column_set_title (tvc, _("Funds In"));
+                    break;
+
+                default:
+                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                        gtk_tree_view_column_set_title (tvc, _("Debit"));
+                    break;
+                }
+            }
+            else
+                gtk_tree_view_column_set_title (tvc, _("Debit"));
+            break;
+
+        case COL_BALANCE:
+            switch(model->type)
+            {
+            default: //FIXME These if statements may not be required
+                if(depth == TRANS1 || depth == TRANS2 || depth == SPLIT3)
+                    gtk_tree_view_column_set_title (tvc, _("Balance"));
+                break;
+            }
+            break;
+
+        default:
+            break;
+        }
+    }
+g_list_free (columns);
+}
+
+
+/* Callback for double click */
+void
+gtv_split_reg_double_click_cb (GtkTreeView *treeview, GtkTreePath *path,
+                               GtkTreeViewColumn *column, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (treeview);
+    GncTreeModelSplitReg *model;
+
+    model = get_split_reg_model_from_view (view);
+
+//g_print("gtv_split_reg_double_click_cb\n\n");
+
+    /* this does work on non editable cells like void, balance */
+
+    if (model->style != REG2_STYLE_JOURNAL)
+    {
+        if (gnc_tree_view_split_reg_current_trans_expanded (view))
+            gnc_tree_view_split_reg_expand_current_trans (view, FALSE);
+        else
+            gnc_tree_view_split_reg_expand_current_trans (view, TRUE);
+
+        /* This updates the plugin page gui */
+        if (view->moved_cb)
+            (view->moved_cb)(view, view->moved_cb_data);
+    }
+}
+
+
+/* For handling keynav */
+static gboolean
+gtv_split_reg_key_press_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
+{
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (widget);
+    GtkTreeViewColumn *col;
+    ViewCol viewcol;
+    GtkCellRenderer *cell;
+    GList *renderers;
+    GtkTreePath *path = NULL;
+    gint *indices_ed, *indices_now;
+
+    gboolean tabbed = FALSE;
+
+    gint editable = 0;
+
+g_print("\ngtvt_key_press_cb\n");
+
+    if (event->type != GDK_KEY_PRESS)
+        return TRUE;
+
+    switch (event->keyval)
+    {
+    case GDK_Tab:
+    case GDK_ISO_Left_Tab:
+    case GDK_KP_Tab:
+        tabbed = TRUE;
+        break;
+
+    case GDK_Return:
+    case GDK_KP_Enter:
+        break;
+    default: 
+	return TRUE;
+    }
+
+
+    gtk_tree_view_get_cursor (GTK_TREE_VIEW (view), &path, &col);
+
+    if (!path)
+        return TRUE;
+
+    finish_edit (col);
+
+
+
+if (tabbed == TRUE)
+{
+
+
+/*FIXME This does not work, editable does not reflect status, why ????? */
+
+//    while (editable == 0) // lets step over non editable columns
+//    {
+
+        /* Step to the next column, we may wrap */
+        gnc_tree_view_keynav (GNC_TREE_VIEW (view), &col, path, event); // returns path and column
+
+//        if (!path || !gnc_tree_view_path_is_valid (GNC_TREE_VIEW (view), path)) // We have stepped off the end
+//             break;
+
+        renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (col)); //FIXME I am only looking at one renderer per cell.
+        g_assert (g_list_length (renderers) == 1);
+        cell = g_list_nth_data (renderers, 0);
+        g_list_free (renderers);
+
+        viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "view_column"));
+
+        g_object_get (G_OBJECT (cell), "editable", &editable, NULL);
+
+g_print("key nav - Path is '%s' edit path is '%s' and viewcol is %d and editable is %d and cell pointer is %p\n", gtk_tree_path_to_string (path),
+                  (view->priv->acct_edit_path == NULL) ? "NULL" : gtk_tree_path_to_string (view->priv->acct_edit_path), viewcol, editable, cell);
+
+
+
+//    }
+}
+
+
+    if (!path || !gnc_tree_view_path_is_valid (GNC_TREE_VIEW (view), path)) // We have stepped off the end
+    {
+        /* no need to restore cursor because we won't move. */
+        //Only ask for confirmation if data was edited
+        if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT(view), "data-edited")))
+        {
+       	    transaction_changed_confirm (GNC_TREE_VIEW_SPLIT_REG (view), NULL);
+            g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
+        }
+    }
+    else
+        /* Set cursor to new column, open for editing */
+        gtk_tree_view_set_cursor (GTK_TREE_VIEW (view), path, col, TRUE);
+
+g_print( "end of key nav\n");
+
+    gtk_tree_path_free (path);
+
+    return TRUE;
+}
+
+
+void
+gnc_tree_view_split_reg_cancel_edit (GncTreeViewSplitReg *view)
+{
+    Transaction *trans = view->priv->dirty_trans;
+
+    if (trans && xaccTransIsOpen (trans))
+    {
+        view->priv->acct_edit_path = NULL;
+        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
+        xaccTransRollbackEdit (view->priv->dirty_trans);
+        view->priv->dirty_trans = NULL;
+        xaccSplitReinit (view->priv->btrans_split);
+    }
+}
+
+
+/* Returns TRUE if dialog was canceled. Does nothing if 'new_trans'
+   is the dirty trans. */
+static gboolean
+transaction_changed_confirm (GncTreeViewSplitReg *view,
+                            Transaction *new_trans)
+{
+    GtkWidget *dialog;
+    gint response;
+    const char *title = _("Save the changed transaction?");
+    const char *message = _(
+        "The current transaction has changed.  Would you like to "
+        "record the changes, or discard the changes?");
+
+    if (!view->priv->dirty_trans || view->priv->dirty_trans == new_trans)
+        return FALSE;
+
+g_print(" ** transaction_changed_confirm **\n");
+    dialog = gtk_message_dialog_new(NULL,
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_QUESTION,
+                                    GTK_BUTTONS_NONE,
+                                    "%s", title);
+    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+                                             "%s", message);
+    gtk_dialog_add_buttons(
+        GTK_DIALOG(dialog),_("_Discard Changes"), GTK_RESPONSE_REJECT,
+        GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+        _("_Record Changes"), GTK_RESPONSE_ACCEPT, NULL);
+    response = gnc_dialog_run (GTK_DIALOG (dialog), "transaction_changed");
+    gtk_widget_destroy (dialog);
+
+    switch (response)
+    {
+    case GTK_RESPONSE_ACCEPT:
+        g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (FALSE));
+        xaccTransCommitEdit (view->priv->dirty_trans);
+        view->priv->acct_edit_path = NULL;
+        view->priv->dirty_trans = NULL;
+        view->priv->btrans_split = xaccMallocSplit (gnc_get_current_book());
+        break;
+
+    case GTK_RESPONSE_REJECT:
+        gnc_tree_view_split_reg_cancel_edit (view);
+        break;
+    case GTK_RESPONSE_CANCEL:
+    default:
+        return TRUE;
+    }
+
+    return FALSE;
+}
+
+
+
+/* Callback for selection move */
+static void
+gtv_split_reg_motion_cb (GtkTreeSelection *sel, gpointer user_data)
+{
+
     GtkTreeIter iter;
-    GncTreeViewSplitReg *tv = GNC_TREE_VIEW_SPLIT_REG(data);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
     GncTreeModelSplitReg *model; 
     Split *split = NULL;
     Transaction *trans = NULL;
     gboolean is_trow1, is_trow2, is_split, is_blank;
-    GtkTreeViewColumn *numact, *descnotes, *transvoid;
-    gint depth;
+    RowDepth depth = 0;
     const gchar *path_string;
+    GtkTreePath *path;
+    gint *indices_old, *indices_now;
+    gint row_old, row_now;
 
-    model = get_split_reg_model_from_view(tv);
+    model = get_split_reg_model_from_view (view);
 
-g_print("gtv_split_reg_motion_cb\n\n");
+g_print ("\ngtv_split_reg_motion_cb\n");
 
-    numact = gtk_tree_view_get_column(GTK_TREE_VIEW(tv), 1);
-    descnotes = gtk_tree_view_get_column(GTK_TREE_VIEW(tv), 2);
-    transvoid = gtk_tree_view_get_column(GTK_TREE_VIEW(tv), 3);
+    mark_split_dirty (view, NULL, NULL);
 
-    if (get_model_iter_from_selection(tv, sel, &iter))
+    if (get_model_iter_from_selection (view, sel, &iter))
     {
+
+        path = gtk_tree_model_get_path (GTK_TREE_MODEL (model), &iter);
+
+g_print("Motion - Current Path is '%s' and edit path is '%s'\n", gtk_tree_path_to_string (view->priv->current_path),
+                                                                 (view->priv->acct_edit_path == NULL) ? "NULL" :
+                                                                  gtk_tree_path_to_string (view->priv->acct_edit_path));
+
+        indices_old = gtk_tree_path_get_indices (view->priv->current_path);
+        indices_now = gtk_tree_path_get_indices (path);
+
+        row_old = indices_old[0];
+        row_now = indices_now[0];
+
+g_print ("Motion - row old is %d and now %d\n", row_old, row_now);
+
+        view->priv->row_old = row_old;
+        view->priv->row_now = row_now;
+
+        /* save the current path */
+        gtk_tree_path_free (view->priv->current_path);
+        view->priv->current_path = gtk_tree_path_copy (path);
+
+        /* Use depth to determine if it is a split or transaction */
+        depth = gtk_tree_path_get_depth (path);
+
+        /* Update the tree view titles */
+        gtv_split_reg_titles (view, depth);
+
+        gtk_tree_path_free (path);
+
+g_print("Motion - New Current Path is '%s' and edit path is '%s'\n", gtk_tree_path_to_string (view->priv->current_path),
+                                                                 (view->priv->acct_edit_path == NULL) ? "NULL" :
+                                                                  gtk_tree_path_to_string (view->priv->acct_edit_path));
+
+
+        /*FIXME Not sure if will need this here, leave till end */
         gnc_tree_model_split_reg_get_split_and_trans (
-            GNC_TREE_MODEL_SPLIT_REG(model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+                GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
 
-        path_string = gtk_tree_path_to_string (gtk_tree_model_get_path (GTK_TREE_MODEL(model), &iter));
+g_print("Motion - row_now is %d, split %p, trans %p, is_split %d, is_blank %d\n", row_now, split, trans, is_split, is_blank);
 
-g_print("Path is '%s'\n", path_string);
+        //Ask for confirmation if data has been edited, transaction_changed_confirm return TRUE if canceled
+        if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) && transaction_changed_confirm (view, trans))
+        {
+            /* Restore position - Cancel */
+            gtk_tree_path_free (view->priv->current_path);
+            view->priv->current_path = gtk_tree_path_copy (view->priv->acct_edit_path);
 
-       /* Use depth to determine if it is a split or parent transaction */
-       depth = gtk_tree_path_get_depth(gtk_tree_path_new_from_string(path_string));
+            gnc_tree_view_split_reg_default_selection (view);
+        }
+        else
+        {
+            /* Discard, commit and skip */
 
-       if (depth == 1)
-       {
-           gtk_tree_view_column_set_title(numact, _("Number"));
-           gtk_tree_view_column_set_title(descnotes, _("Description"));
-           gtk_tree_view_column_set_title(transvoid, _("Accounts"));
-       }
-       else if (depth == 2)
-       {
-           gtk_tree_view_column_set_title(numact, _("Action"));
-           gtk_tree_view_column_set_title(descnotes, _("Notes"));
-           gtk_tree_view_column_set_title(transvoid, _("Void"));
-       }     
-       else if (depth == 3)
-       {
-           gtk_tree_view_column_set_title(numact, _("Action"));
-           gtk_tree_view_column_set_title(descnotes, _("Memo"));
-           gtk_tree_view_column_set_title(transvoid, _("Accounts"));
-       }
+            /* Move the blank split */ 
+            gnc_tree_model_split_reg_set_blank_split_parent (model, trans);
+        }
+
+g_print ("Motion - depth is %d row old is %d and now %d\n", depth, row_old, row_now);
+
+        /* Set the view format */
+        g_idle_add ((GSourceFunc)gnc_tree_view_split_reg_set_format, view);
+
+        /* scroll when view is idle */
+//        g_idle_add ((GSourceFunc)gtv_scroll_to_cell, view );
+
     }
     else
     {
-        /* We end up here if tree collapse and no row selected */
-        gtk_tree_view_column_set_title(numact, _("Num / Act"));
-        gtk_tree_view_column_set_title(descnotes, _("Description / Notes / Memo"));
-        gtk_tree_view_column_set_title(transvoid, _("Transfer / Void"));
+g_print("Not valid selection\n");
+        /* We do not have a valid iter */
+        gtv_split_reg_titles (view, 0);
+
+        /* Move the blank split to the last transaction */ 
+        gnc_tree_model_split_reg_set_blank_split_parent (model, NULL);
+
+        /* 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);
 }
 
 
-
 /* Connected to "edited" from cellrenderer. For reference, see
    split-register-model-save.c */
 static void
-gtv_split_reg_edited_cb(GtkCellRendererText *cell, const gchar *path_string,
-               const gchar *new_text, gpointer data)
+gtv_split_reg_edited_cb (GtkCellRendererText *cell, const gchar *path_string,
+               const gchar *new_text, gpointer user_data)
 {
-    GtkTreeIter iter;
-    GtkTreeIter copy_iter;
-    GtkEntryCompletion *completion;
-    Split *split;
-    Transaction *trans;
-    GncTreeViewSplitReg *tv = GNC_TREE_VIEW_SPLIT_REG(data);
-    ViewCol viewcol;
-    gboolean is_trow1, is_trow2, is_split, is_blank;
+    GncTreeViewSplitReg  *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
     GncTreeModelSplitReg *model;
-    char *error_loc = NULL;
-    Account *anchor = tv->priv->anchor;
+    GtkTreeIter           iter;
+    Split                *split;
+    Transaction          *trans;
+    gboolean              is_trow1, is_trow2, is_split, is_blank;
+    ViewCol               viewcol;
+    char                 *error_loc = NULL;
+    Account              *anchor = view->priv->anchor;
 
-g_print("gtv_split_reg_edited_cb\n\n");
+g_print("\ngtv_split_reg_edited_cb\n");
 
-/*    g_return_if_fail(get_model_iter_from_view_string(tv, path_string, &iter)); */
+    if (g_strcmp0 (g_object_get_data (G_OBJECT (cell), "current-string"), new_text) == 0) // No change, return
+        return;
 
-    viewcol = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cell), "view_column"));
+    g_return_if_fail (get_model_iter_from_view_string (view, path_string, &iter));
 
-    model = get_split_reg_model_from_view(tv);
-    g_return_if_fail(model);
+    viewcol = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cell), "view_column"));
 
+    model = get_split_reg_model_from_view (view);
+    g_return_if_fail (model);
+
     gnc_tree_model_split_reg_get_split_and_trans (
         model, &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
 
-g_print("New text is '%s'\n", new_text);
+g_print("gtv_split_reg_edited_cb New Text is '%s'\n", new_text);
 
     switch (viewcol) {
     case COL_DATE:
         /* Column is DATE */
-/*FIXME        begin_edit(tv, split, trans); */
         if (is_trow1)
         {
-/* New_text would need to be converted to time_t */
-/*            xaccTransSetDatePostedSecs (trans, time); */
-
+            GDate date;
+            g_date_set_parse (&date, new_text);
+            if (g_date_valid (&date))
+            {
+                begin_edit (view, split, trans);
+                xaccTransSetDate (trans, g_date_get_day (&date), g_date_get_month (&date), g_date_get_year (&date));
+            }
+            else
+            {
+                PERR("invalid date `%s`", new_text);
+            }
         }
         break;
 
     case COL_NUMACT:
         /* Column is NUM / ACT */
-/*FIXME        begin_edit(tv, split, trans); */
-
+        begin_edit (view, split, trans);
         if (is_trow1)
         {
-/*            xaccTransSetNum(trans, new_text); */
-
+            xaccTransSetNum (trans, new_text);
         }
         if (is_trow2)
         {
-           /*FIXME Not sure if this will need to be changed */
-/*            xaccSplitSetAction(split, new_text); */
-
+            xaccSplitSetAction (get_this_split (view, trans), new_text);
         }
-
         if (is_split)
         {
-/*            xaccSplitSetAction(split, new_text); */
-
+            xaccSplitSetAction (split, new_text);
         }
         break;
 
     case COL_DESCNOTES:
         /* Column is DESCRIPTION / NOTES */
-/*FIXME        begin_edit(tv, split, trans); */
+        begin_edit (view, split, trans);
         if (is_trow1)
         {
-/*            xaccTransSetDescription(trans, new_text); */
-/*FIXME May need to add new entries to list **
-            gtk_list_store_append(GTK_LIST_STORE(g_object_get_data(G_OBJECT(tv), "desc_copy")), &copy_iter);
-            gtk_list_store_set(GTK_LIST_STORE(g_object_get_data(G_OBJECT(tv), "desc_copy")), &copy_iter, 0, new_text, -1);
-*/
+            xaccTransSetDescription (trans, new_text);
         }
         if (is_trow2)
         {
-/*            xaccTransSetNotes(trans, new_text); */
-/*FIXME May need to add new entries to list **
-            gtk_list_store_append(GTK_LIST_STORE(g_object_get_data(G_OBJECT(tv), "notes_copy")), &copy_iter);
-            gtk_list_store_set(GTK_LIST_STORE(g_object_get_data(G_OBJECT(tv), "notes_copy")), &copy_iter, 0, new_text, -1); 
-*/
+            xaccTransSetNotes (trans, new_text);
         }
         if (is_split)
         {
-/*            xaccSplitSetMemo(split, new_text); */
-/*FIXME May need to add new entries to list **
-            gtk_list_store_append(GTK_LIST_STORE(g_object_get_data(G_OBJECT(tv), "memo_copy")), &copy_iter);
-            gtk_list_store_set(GTK_LIST_STORE(g_object_get_data(G_OBJECT(tv), "memo_copy")), &copy_iter, 0, new_text, -1); 
-*/
+            xaccSplitSetMemo (split, new_text);
         }
         break;
 
     case COL_TRANSVOID:
+        /* Column is TRANSFER / VOID (Only updated from menu.) */
+{
+        Split *osplit = NULL;
+
+        begin_edit (view, split, trans);
+
+        if (!is_split && anchor)
+        {
+            if (!get_split_pair (view, trans, &osplit, &split))
+            {
+                PERR("couldn't get split pair");
+                break;
+            }
+        }
+
+
+        if (is_trow1)
+        {
+            QofBook       *book; //do we have this
+            Account        *root; // do we have this
+//FIXME Probably needs more work 
+
+            Account *new_acct;
+            gint num_of_splits;
+
+            book = gnc_get_current_book();
+            root = gnc_book_get_root_account(book);
+
+            num_of_splits = xaccTransCountSplits (trans);
+
+g_print("trans split and num_of_splits is %d\n", num_of_splits);
+
+            if (view->priv->acct_short_names)
+                new_acct = gnc_account_lookup_by_name (root, new_text);
+            else
+                new_acct = gnc_account_lookup_by_full_name (root, new_text);
+
+            if (new_acct != NULL)
+                xaccAccountInsertSplit (new_acct, osplit);
+
+        }
+
+
+        if (is_split)
+        {
+            QofBook       *book; //do we have this
+            Account        *root; // do we have this
+//FIXME Probably needs more work 
+
+            Account *new_acct;
+            gint     num_of_splits;
+
+            book = gnc_get_current_book();
+            root = gnc_book_get_root_account(book);
+
+            num_of_splits = xaccTransCountSplits (trans);
+
+g_print("split and num_of_splits is %d\n", num_of_splits);
+
+            if (view->priv->acct_short_names)
+                new_acct = gnc_account_lookup_by_name (root, new_text);
+            else
+                new_acct = gnc_account_lookup_by_full_name (root, new_text);
+
+            if (new_acct != NULL)
+                    xaccAccountInsertSplit (new_acct, split);
+          }
+
+
+
+
+
+}
+        break;
+
     case COL_RECN:
+        /* Column is RECONCILE */
+        begin_edit (view, split, trans);
+
+        if (new_text != NULL)
+        {
+            char rec = 'n';
+            rec = new_text[0];
+
+            if (is_trow1) 
+                xaccSplitSetReconcile (get_this_split (view, trans), rec);
+            if (is_split)
+                xaccSplitSetReconcile (split, rec);
+        }
+        else
+        {
+            char rec = 'n';
+
+            if (is_trow1) 
+                xaccSplitSetReconcile (get_this_split (view, trans), rec);
+            if (is_split)
+                xaccSplitSetReconcile (split, rec);
+        }
+
+        break;
+
     case COL_TYPE:
     case COL_VALUE:
     case COL_AMOUNT:
+    case COL_AMTVAL:
     case COL_RATE:
     case COL_PRICE:
+        break;
+
     case COL_DEBIT:
     case COL_CREDIT:
+        {
+
+            Account *acct;
+            gnc_numeric input;
+            Split *split2 = NULL;
+
+g_print("rest\n");
+
+            if (!gnc_exp_parser_parse (new_text, &input, &error_loc))
+                break;
+
+            if (!is_split && anchor)
+            {
+g_print("rest1\n");
+                if (!get_split_pair (view, trans, &split2, &split))
+                {
+                    PERR("couldn't get split pair");
+                    break;
+                }
+            }
+
+            begin_edit (view, NULL, trans); // open trans even if split not a child
+            mark_split_dirty (view, trans, split);
+
+            acct = xaccSplitGetAccount (split);
+            if (!acct)
+            {
+g_print("rest2\n");
+                if (anchor)
+                {
+g_print("rest3\n");
+                    xaccSplitSetAccount (split, anchor);
+                    acct = xaccSplitGetAccount (split);
+                }
+                else
+                {
+                    break; //Well, what else is there to do?
+                }
+            }
+
+            if (viewcol == COL_CREDIT)
+                input = gnc_numeric_neg (input);
+
+//            if (viewcol == COL_AMOUNT)
+//            {
+//                set_amount_for (view, trans, split, input);
+//                break;
+//            }
+
+//            if (viewcol == COL_RATE) // Not sure why this is here
+//            {
+//                set_rate_for (view, trans, split, input, is_blank);
+//                break;
+//            }
+
+            set_value_for (view, trans, split, input);
+
+            if (split2)
+            {
+g_print("rest4\n");
+                xaccSplitSetParent (split2, trans);
+                set_value_for (view, trans, split2, gnc_numeric_neg (input));
+            }
+        }
         break;
 
     default:
@@ -1278,14 +2943,87 @@
 }
 
 
+static void
+gtv_split_reg_recn_cb (GtkEntry    *entry,
+                          const gchar *text,
+                          gint         length,
+                          gint        *position,
+                          gpointer     user_data)
+{
+    GtkEditable *editable = GTK_EDITABLE (entry);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
+    const gchar *flags = gnc_get_reconcile_flag_order();
+    gchar *this_flag;
+    const char *result;
+    static char ss[2];
 
+    gint index = 0;
+
+/*FIXME this works, but is there a simpler way ? */
+
+//g_print("gtv_split_reg_recn_cb '%s'\n", text);
+
+    result = g_ascii_strdown (text, length);
+
+    if (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-flag") != NULL)
+        index = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view->priv->temp_cr), "current-flag"));
+
+    /* So we can test for space */
+    ss[0] = ' ';
+    ss[1] = '\0';
+
+    /* Find the current flag in the list of flags */
+    this_flag = strstr (flags, text);
+
+    if (this_flag == NULL || *this_flag == '\0')
+    {
+        if (g_strcmp0 (text, ss) == 0)  // test for space
+        {
+            /* In the list, choose the next item in the list
+               (wrapping around as necessary). */
+
+            flags = flags + index;
+            if (*flags != '\0')
+            {
+                index = index + 1;
+                result = flags;
+            }
+            else
+            {
+                flags = flags - index;
+                index = 1;
+                result = flags;
+            }
+        }
+        else
+            /* If it's not there (or the list is empty) use default_flag */
+            result  = gnc_get_reconcile_str (NREC);
+    }
+    else
+        result = text;
+
+    /* save the index in the cellrenderer */
+    g_object_set_data (G_OBJECT (view->priv->temp_cr), "current-flag", GINT_TO_POINTER (index));
+
+    g_signal_handlers_block_by_func (editable, (gpointer) gtv_split_reg_recn_cb, user_data);
+
+    gtk_editable_delete_text (editable, 0, -1);
+    gtk_editable_insert_text (editable, result, length, position);
+
+    g_signal_handlers_unblock_by_func (editable, (gpointer) gtv_split_reg_recn_cb, user_data);
+
+    g_signal_stop_emission_by_name (editable, "insert_text");
+}
+
+
 /* The main Start Editing Call back for the TEXT columns */
 static void
-get_editable_start_editing_cb(GtkCellRenderer *cr, GtkCellEditable *editable,
+get_editable_start_editing_cb (GtkCellRenderer *cr, GtkCellEditable *editable,
                               const gchar *path_string, gpointer user_data)
 {
-    GncTreeViewSplitReg *tv = GNC_TREE_VIEW_SPLIT_REG(user_data);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
     GncTreeModelSplitReg *model;
+    GtkTreePath *path;
 
     GtkListStore *description_list;
     GtkListStore *memo_list;
@@ -1293,52 +3031,55 @@
     GtkListStore *acct_list;
 
     GtkEntryCompletion *completion = gtk_entry_completion_new();
-    gint depth;
+    RowDepth depth;
 
     ENTER(" ");
-g_print("get_editable_start_editing_cb\n\n");
+g_print("\nget_editable_start_editing_cb\n\n");
 
-    model = get_split_reg_model_from_view(tv);
+    model = get_split_reg_model_from_view (view);
 
-    description_list = gnc_tree_model_split_reg_get_description_list(model);
-    notes_list = gnc_tree_model_split_reg_get_notes_list(model);
-    memo_list = gnc_tree_model_split_reg_get_memo_list(model);
-    acct_list = gnc_tree_model_split_reg_get_acct_list(model);
+    /* Description / Notes / Memo / Accounts Completion Lists */
+    description_list = gnc_tree_model_split_reg_get_description_list (model);
+    notes_list = gnc_tree_model_split_reg_get_notes_list (model);
+    memo_list = gnc_tree_model_split_reg_get_memo_list (model);
+    acct_list = gnc_tree_model_split_reg_get_acct_list (model);
 
-g_print("editable Path string is '%s'\n", path_string);
+//g_print("editable Path string is '%s'\n", path_string);
 
     //Use depth to determine if it is a split or transaction
-    depth = gtk_tree_path_get_depth(gtk_tree_path_new_from_string(path_string));
+    path = gtk_tree_path_new_from_string (path_string);
+    depth = gtk_tree_path_get_depth (path);
 
-g_print("editable Depth is %u\n", depth);
+//g_print("editable Depth is %u\n", depth);
 
     /* DATE COLUMN */
     if (GNC_TREE_MODEL_SPLIT_REG_COL_DATE 
-        == GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cr), "model_column")))
+        == GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr), "model_column")))
     {
-        g_object_set_data(G_OBJECT(cr), "cell-editable", editable);
+        g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
         //Copy the string in the GtkEntry for later comparison
-        g_object_set_data(G_OBJECT(cr), "current-string", g_strdup(gtk_entry_get_text(GTK_ENTRY(GNC_POPUP_ENTRY(editable)->entry))));
+        g_object_set_data (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (GTK_ENTRY (GNC_POPUP_ENTRY (editable)->entry))));
 
-        g_signal_connect(G_OBJECT(editable), "remove-widget", (GCallback) remove_edit_date, tv);
+        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) remove_edit_date, view);
 
-g_print("Current String is '%s'\n", g_strdup(gtk_entry_get_text(GTK_ENTRY(GNC_POPUP_ENTRY(editable)->entry))));
+//g_print("Current String date is '%s'\n", g_strdup (gtk_entry_get_text (GTK_ENTRY (GNC_POPUP_ENTRY (editable)->entry))));
 
     }
 
+
     /* TRANSFER / VOID COLUMN */
-    if (GNC_TREE_MODEL_SPLIT_REG_COL_TRANSVOID 
-        == GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cr), "model_column")))
+    else if (GNC_TREE_MODEL_SPLIT_REG_COL_TRANSVOID 
+        == GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr), "model_column")))
     {
         GtkEntry *entry;
 
-        entry = GTK_ENTRY (gtk_bin_get_child(GTK_BIN (editable)));
+        entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (editable)));
 
         gtk_entry_set_completion (GTK_ENTRY (entry), completion);
         gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (acct_list));
 
         /* This sets which text column to use, 0 for short names, 1 for long */
-        if (tv->priv->acct_short_names)
+        if (view->priv->acct_short_names)
             gtk_entry_completion_set_text_column (completion, 0);
         else
             gtk_entry_completion_set_text_column (completion, 1);
@@ -1347,64 +3088,68 @@
         gtk_entry_completion_set_inline_selection (completion, TRUE);
         gtk_entry_completion_set_popup_set_width (completion, FALSE);
         gtk_entry_completion_set_minimum_key_length (completion, KEY_LENGTH);
-/*??        g_signal_connect(G_OBJECT(completion), "match-selected", (GCallback)gtv_split_reg_match_selected_cb, tv); */
+/*??        g_signal_connect(G_OBJECT(completion), "match-selected", (GCallback)gtv_split_reg_match_selected_cb, view); */
         g_object_unref (completion);
 
-        g_object_set_data(G_OBJECT(cr), "cell-editable", editable);
+        g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
         //Copy the string in the GtkEntry for later comparison
-        g_object_set_data(G_OBJECT(cr), "current-string", g_strdup(gtk_entry_get_text (entry)));
+        g_object_set_data(G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)));
 
-        g_signal_connect(G_OBJECT(cr), "changed", (GCallback)gtv_split_reg_changed_cb, tv);
-        g_signal_connect(G_OBJECT(editable), "remove-widget", (GCallback) remove_edit_combo, tv);
-g_print("Current String is '%s'\n", g_strdup(gtk_entry_get_text(entry)));
+        g_signal_connect (G_OBJECT (cr), "changed", (GCallback)gtv_split_reg_changed_cb, view);
+        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) remove_edit_combo, view);
 
+//g_print("Current String tv is '%s'\n", g_strdup(gtk_entry_get_text (entry)));
     }
 
+
     /* NUMBER / ACTION COLUMN */
-    if (GNC_TREE_MODEL_SPLIT_REG_COL_NUMACT 
-        == GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cr), "model_column")))
+    else if (GNC_TREE_MODEL_SPLIT_REG_COL_NUMACT 
+        == GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr), "model_column")))
     {
         GtkEntry *entry;
+        GtkTreeModel *listmodel;
+        GtkTreeIter iter;
 
-        if (depth == 1)
-            gnc_tree_model_split_reg_get_num_list(model);
+        if (depth == TRANS1)
+            gnc_tree_model_split_reg_get_num_list (model);
 
-        else if (depth == 2)
-            gnc_tree_model_split_reg_get_action_list(model);
+        else if (depth == TRANS2)
+            gnc_tree_model_split_reg_get_action_list (model);
 
-        else if (depth == 3)
-            gnc_tree_model_split_reg_get_action_list(model);
+        else if (depth == SPLIT3)
+            gnc_tree_model_split_reg_get_action_list (model);
 
-        entry = GTK_ENTRY (gtk_bin_get_child(GTK_BIN (editable)));
+        entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (editable)));
 
-        g_object_set_data(G_OBJECT(cr), "cell-editable", editable);
+        g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
         //Copy the string in the GtkEntry for later comparison
-        g_object_set_data(G_OBJECT(cr), "current-string", g_strdup(gtk_entry_get_text (entry)));
+        g_object_set_data (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)));
 
-/*??        g_signal_connect(G_OBJECT(cr), "changed", (GCallback)gtv_split_reg_changed_cb, tv); */
-        g_signal_connect(G_OBJECT(editable), "remove-widget", (GCallback) remove_edit_combo, tv);
-g_print("Current String is '%s'\n", g_strdup(gtk_entry_get_text(entry)));
+/*??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback)gtv_split_reg_changed_cb, view); */
+        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) remove_edit_combo, view);
 
+//g_print("Current String na is '%s'\n", g_strdup (gtk_entry_get_text (entry)));
     }
 
+
     /* DESCRIPTION / NOTES / MEMO COLUMN */
-    if (GNC_TREE_MODEL_SPLIT_REG_COL_DESCNOTES 
-        == GPOINTER_TO_INT(g_object_get_data(G_OBJECT(cr), "model_column")))
+    else if (GNC_TREE_MODEL_SPLIT_REG_COL_DESCNOTES 
+        == GPOINTER_TO_INT (g_object_get_data (G_OBJECT (cr), "model_column")))
     {
         //Data used for completion is set based on if editing split or not
-        if (depth == 1)
+        if (depth == TRANS1)
         {
             gtk_entry_set_completion (GTK_ENTRY (editable), completion);
             gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (description_list));
             gtk_entry_completion_set_text_column (completion, 0);
         }
-        else if (depth == 2)
+        else if (depth == TRANS2)
         {
             gtk_entry_set_completion (GTK_ENTRY (editable), completion);
             gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (notes_list));
             gtk_entry_completion_set_text_column (completion, 0);
         }
-        else if (depth == 3)
+        else if (depth == SPLIT3)
         {
             gtk_entry_set_completion (GTK_ENTRY (editable), completion);
             gtk_entry_completion_set_model (completion, GTK_TREE_MODEL (memo_list));
@@ -1416,34 +3161,74 @@
         gtk_entry_completion_set_popup_completion (completion, TRUE);
         gtk_entry_completion_set_inline_selection (completion, TRUE);
         gtk_entry_completion_set_minimum_key_length (completion, KEY_LENGTH);
-/*??        g_signal_connect(G_OBJECT(completion), "match-selected", (GCallback)gtv_split_reg_match_selected_cb, tv); */
+/*??        g_signal_connect (G_OBJECT (completion), "match-selected", (GCallback)gtv_split_reg_match_selected_cb, view); */
 
         g_object_unref (completion);
 
-        g_object_set_data(G_OBJECT(cr), "cell-editable", editable);
+        g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
         //Copy the string in the GtkEntry for later comparison
-        g_object_set_data(G_OBJECT(cr), "current-string", g_strdup(gtk_entry_get_text(GTK_ENTRY(editable))));
-        g_signal_connect(G_OBJECT(editable), "remove-widget", (GCallback) remove_edit_completion, tv);
-g_print("Current String is '%s'\n", g_strdup(gtk_entry_get_text(GTK_ENTRY(editable))));
+        g_object_set_data (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (GTK_ENTRY(editable))));
+        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) remove_edit_entry, view);
 
+//g_print("Current String dnm is '%s'\n", g_strdup (gtk_entry_get_text (GTK_ENTRY(editable))));
     }
 
-    tv->priv->temp_cr = cr;
+
+    /* RECN COLUMN - We do it this way as we do not want sort arrows */
+    else if ( g_strcmp0 (g_object_get_data (G_OBJECT (cr), "column_name"), "recn") == 0)
+    {
+        GtkEntry *entry;
+
+        entry = GTK_ENTRY (editable);
+
+        g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
+        //Copy the string in the GtkEntry for later comparison
+        g_object_set_data (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)));
+        g_signal_connect (G_OBJECT (GTK_ENTRY (editable)), "insert_text", (GCallback)gtv_split_reg_recn_cb, view);
+        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) remove_edit_entry, view);
+
+/*??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback)gtv_split_reg_changed_cb, view); */
+//g_print("Current String recn is '%s'\n", g_strdup (gtk_entry_get_text (entry)));
+    }
+
+
+    /* REST OF THE COLUMNS */
+    else
+    {
+        GtkEntry *entry;
+
+        entry = GTK_ENTRY (editable);
+
+        g_object_set_data (G_OBJECT (cr), "cell-editable", editable);
+        //Copy the string in the GtkEntry for later comparison
+        g_object_set_data (G_OBJECT (cr), "current-string", g_strdup (gtk_entry_get_text (entry)));
+//        g_signal_connect (G_OBJECT (GTK_ENTRY (editable)), "insert_text", (GCallback)gtv_split_reg_recn_cb, view);
+        g_signal_connect (G_OBJECT (editable), "remove-widget", (GCallback) remove_edit_entry, view);
+
+/*??        g_signal_connect (G_OBJECT (cr), "changed", (GCallback)gtv_split_reg_changed_cb, view); */
+//g_print("Current String rest is '%s'\n", g_strdup (gtk_entry_get_text (entry)));
+    }
+
+
+    gtk_tree_path_free (view->priv->acct_edit_path);
+    view->priv->acct_edit_path = gtk_tree_path_copy (path);
+//g_print("edit_path is %s\n", gtk_tree_path_to_string (view->priv->acct_edit_path));
+    gtk_tree_path_free (path);
+    view->priv->temp_cr = cr;
     //Add edit-canceled property to cr so we can distinguish between
     //cancelled and actual changes
-    g_object_set_data(G_OBJECT(cr), "edit-canceled", FALSE);
+    g_object_set_data (G_OBJECT (cr), "edit-canceled", GINT_TO_POINTER (FALSE));
 
     LEAVE(" ");
 }
 
 
-
 //Handle the "match-selected" signal
 static void
-gtv_split_reg_match_selected_cb(GtkEntryCompletion *widget, GtkTreeModel *model,
+gtv_split_reg_match_selected_cb (GtkEntryCompletion *widget, GtkTreeModel *model,
                         GtkTreeIter *iter, gpointer user_data)
 {
-    GncTreeViewSplitReg *tv = GNC_TREE_VIEW_SPLIT_REG(user_data);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
 
     gboolean is_trow1, is_trow2, is_split, is_blank;
 
@@ -1456,16 +3241,16 @@
 
 //Handle the "changed" signal
 static void
-gtv_split_reg_changed_cb(GtkCellRendererCombo *widget, gchar *path_string,
+gtv_split_reg_changed_cb (GtkCellRendererCombo *widget, gchar *path_string,
                         GtkTreeIter *iter, gpointer user_data)
 {
-    GncTreeViewSplitReg *tv = GNC_TREE_VIEW_SPLIT_REG(user_data);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
 
     gboolean is_trow1, is_trow2, is_split, is_blank;
 
-g_print("gtv_split_reg_changed_cb\n\n");
-g_print("Path String is '%s'\n", path_string);
+g_print("gtv_split_reg_changed_cb path string is '%s'\n\n", path_string);
 
+
 /* Not sure what I am going to put in here yet */
 
 }
@@ -1473,16 +3258,437 @@
 
 //Handle the "editing-canceled" signal
 static void
-gtv_split_reg_editing_canceled_cb(GtkCellRenderer *cr, gpointer user_data)
+gtv_split_reg_editing_canceled_cb (GtkCellRenderer *cr, gpointer user_data)
 {
-    GncTreeViewSplitReg *tv = GNC_TREE_VIEW_SPLIT_REG(user_data);
+    GncTreeViewSplitReg *view = GNC_TREE_VIEW_SPLIT_REG (user_data);
 g_print("gtv_split_reg_editing_canceled_cb\n\n");
 
+    if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) == FALSE) // None edited, reset edit path
+        view->priv->acct_edit_path = NULL;
+
     //Set edit-canceled property
-    g_object_set_data(G_OBJECT(cr), "edit-canceled", (gpointer)TRUE);	
+    g_object_set_data (G_OBJECT (cr), "edit-canceled", GINT_TO_POINTER (TRUE));	
 }
 
 /*####################################################################
           ^^^^   gtv function call backs    ^^^^
 #####################################################################*/
 
+
+
+/* Reinit transaction / delete the splits */
+void
+gnc_tree_view_split_reg_reinit_trans (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreeIter iter;
+    Split *split = NULL;
+    Transaction *trans = NULL;
+    gboolean is_trow1, is_trow2, is_split, is_blank;
+
+g_print("gnc_tree_view_split_reg_reinit_trans\n");
+    model = get_split_reg_model_from_view (view);
+
+    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path);
+
+    gnc_tree_model_split_reg_get_split_and_trans (
+            GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+    if (trans && (is_trow1 || is_trow2))
+    {
+        Split *s;
+        int i = 0;
+        
+        begin_edit (view, NULL, trans);        
+        while ((s = xaccTransGetSplit(trans, i)) != NULL)
+        {
+            if (xaccTransGetRateForCommodity (trans, view->priv->reg_comm, s, NULL))
+                xaccSplitDestroy(s);
+            else i++;
+        }
+    g_object_set_data (G_OBJECT (view), "data-edited", GINT_TO_POINTER (TRUE));
+    view->priv->dirty_trans = trans;
+    }
+}
+
+
+/* Jump to the Blank transaction, i.e. last in list */
+void
+gnc_tree_view_split_reg_jump_to_blank (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *path;
+
+//g_print("gnc_tree_view_split_reg_jump_to_blank\n");
+    model = get_split_reg_model_from_view (view);
+
+    path = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, NULL, NULL);
+
+    gtk_tree_path_free (view->priv->current_path);
+    view->priv->current_path = gtk_tree_path_copy (path);
+
+    gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), path);
+
+    /* Scroll the window to show selection */
+    if (model->use_double_line)
+       gtk_tree_path_down (path); // show the second row of transaction
+
+    /* scroll when view idle */
+    g_idle_add ((GSourceFunc)gtv_scroll_to_cell, view );
+
+    gtk_tree_path_free (path);
+}
+
+
+static gboolean
+gtv_scroll_to_cell (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *path;
+
+    model = get_split_reg_model_from_view (view);
+
+    path = view->priv->current_path;
+   
+    /* Scroll the window to show selection */
+//    if (model->use_double_line)
+//       gtk_tree_path_down (path); // show the second row of transaction
+//FIXME we can not move path like this, copy it or use indices ????
+// can this be combined with set_view_format
+
+    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), path, NULL, TRUE, 0.5, 0.0);
+
+   return (FALSE);
+}
+
+
+/* Jump to split */
+void
+gnc_tree_view_split_reg_jump_to_split (GncTreeViewSplitReg *view, Split *split)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *path;
+
+//g_print("gnc_tree_view_split_reg_jump_to_split and split is %p\n", split);
+
+    model = get_split_reg_model_from_view (view);
+
+    path = gnc_tree_model_split_reg_get_path_to_split_and_trans (model, split, NULL);
+
+//g_print("Path is '%s'\n", gtk_tree_path_to_string (path));
+
+    gtk_tree_path_free (view->priv->current_path);
+
+    view->priv->current_path = gtk_tree_path_copy (path);
+
+    gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), path);
+
+    gtk_tree_path_free (path);
+
+    /* scroll when view is idle */
+    g_idle_add ((GSourceFunc)gtv_scroll_to_cell, view );
+}
+
+
+/* Move to the relative transaction */
+void
+gnc_tree_view_split_reg_goto_rel_trans_row (GncTreeViewSplitReg *view, gint relative)
+{
+
+    GncTreeModelSplitReg *model;
+    GtkTreePath *path;
+    gint *indices;
+
+g_print("gnc_tree_view_split_reg_goto_rel_trans_row\n");
+
+//FIXME Need to do some checks on relative -1,0,1
+    model = get_split_reg_model_from_view (view);
+
+    indices = gtk_tree_path_get_indices (view->priv->current_path);
+
+    path = gtk_tree_path_new_from_indices (indices[0] + relative, -1);
+
+    gtk_tree_path_free (view->priv->current_path);
+
+    view->priv->current_path = gtk_tree_path_copy (path);
+
+    gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), path);
+
+    gtk_tree_path_free (path);
+}
+
+
+/* Delete the current split */
+void
+gnc_tree_view_split_reg_delete_current_split (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreeIter iter;
+    Split *split = NULL;
+    Transaction *trans = NULL;
+    gboolean is_trow1, is_trow2, is_split, is_blank;
+
+g_print("gnc_tree_view_split_reg_delete_current_split\n");
+    model = get_split_reg_model_from_view (view);
+
+    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path);
+
+    gnc_tree_model_split_reg_get_split_and_trans (
+            GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+    /* Lets get out of the way, move the selection to the transaction */
+    gnc_tree_view_split_reg_goto_rel_trans_row (view, 0);
+
+    begin_edit (view, split, trans);
+
+//FIXME Do we need other stuff here
+    if (is_split)
+    {
+        xaccSplitDestroy (split);
+        xaccTransCommitEdit (trans);
+    }
+}
+
+
+/* Delete the current transaction */
+void
+gnc_tree_view_split_reg_delete_current_trans (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreeIter iter;
+    Split *split = NULL;
+    Transaction *trans = NULL;
+    gboolean is_trow1, is_trow2, is_split, is_blank;
+    gboolean was_open;
+
+g_print("gnc_tree_view_split_reg_delete_current_trans\n");
+    model = get_split_reg_model_from_view (view);
+
+    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path);
+
+    gnc_tree_model_split_reg_get_split_and_trans (
+            GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+    begin_edit (view, split, trans);
+
+    /* Lets get out of the way, move the selection to the previous transaction */
+    gnc_tree_view_split_reg_goto_rel_trans_row (view, -1);
+
+//FIXME Do we need other stuff here
+
+    was_open = xaccTransIsOpen (trans);
+
+    xaccTransDestroy (trans);
+    if (was_open)
+    {
+        DEBUG("committing");
+        xaccTransCommitEdit (trans);
+    }
+
+    view->priv->dirty_trans = NULL;
+
+
+}
+
+/* Returns whether the splits are revealed at the current position */ 
+gboolean
+gnc_tree_view_split_reg_current_trans_expanded (GncTreeViewSplitReg *view)
+{
+    GtkTreePath *path;
+    gint *indices;
+    gboolean expanded = FALSE;
+
+    indices = gtk_tree_path_get_indices (view->priv->current_path);
+
+    path = gtk_tree_path_new_from_indices (indices[0], 0, -1);
+
+    expanded = gtk_tree_view_row_expanded (GTK_TREE_VIEW (view), path);
+
+//g_print("Expanded indices are %d %d %d and return is %d\n", indices[0], indices[1], indices[2], expanded);
+    gtk_tree_path_free(path);
+    return expanded;
+}
+
+
+/* Returns the depth of the selected row */
+RowDepth
+gnc_tree_view_reg_get_selected_row_depth (GncTreeViewSplitReg *view)
+{
+    gint depth;
+
+    depth = gtk_tree_path_get_depth (view->priv->current_path);
+
+    return depth;
+}
+
+
+/* Returns the Blank Split */
+Split * 
+gnc_tree_view_split_reg_get_blank_split (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+
+//g_print("gnc_tree_view_split_reg_get_blank_split\n");
+    model = get_split_reg_model_from_view (view);
+
+    return gnc_tree_model_split_get_blank_split (model);
+}
+
+
+/* Return the Split for the current Transaction */
+Split *
+gnc_tree_view_reg_get_current_trans_split (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreeIter iter;
+    Split *split = NULL;
+    Transaction *trans = NULL;
+    gboolean is_trow1, is_trow2, is_split, is_blank;
+
+//g_print("gnc_tree_view_reg_get_current_trans_split\n");
+    model = get_split_reg_model_from_view (view);
+
+    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path);
+
+//g_print("gnc_tree_view_reg_get_current_trans_split %p and %s\n", model,  gtk_tree_path_to_string (view->priv->current_path));
+
+    gnc_tree_model_split_reg_get_split_and_trans (
+            GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+    split = get_this_split (view, trans);
+
+//g_print("gnc_tree_view_reg_get_current_trans_split %p\n", split);
+
+    return split;
+}
+
+
+/* Returns the Split at the current selected position */
+Split * 
+gnc_tree_view_split_reg_get_current_split (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreeIter iter;
+    Split *split = NULL;
+    Transaction *trans = NULL;
+    gboolean is_trow1, is_trow2, is_split, is_blank;
+
+//g_print("gnc_tree_view_split_reg_get_current_split\n");
+    model = get_split_reg_model_from_view (view);
+
+    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path);
+
+//g_print("gnc_tree_view_split_reg_get_current_split %p and %s\n", model,  gtk_tree_path_to_string (view->priv->current_path));
+
+    gnc_tree_model_split_reg_get_split_and_trans (
+            GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+//g_print("gnc_tree_view_split_reg_get_current_split %p\n", split);
+    return split;
+}
+
+
+/* Returns the Transaction at the current selected position */
+Transaction * 
+gnc_tree_view_split_reg_get_current_trans (GncTreeViewSplitReg *view)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreeIter iter;
+    Split *split = NULL;
+    Transaction *trans = NULL;
+    gboolean is_trow1, is_trow2, is_split, is_blank;
+
+//g_print("gnc_tree_view_split_reg_get_current_trans\n");
+    model = get_split_reg_model_from_view (view);
+
+    gtk_tree_model_get_iter (GTK_TREE_MODEL (model), &iter, view->priv->current_path);
+
+//g_print("gnc_tree_view_split_reg_get_current_trans %p and %s\n", model,  gtk_tree_path_to_string (view->priv->current_path));
+
+    gnc_tree_model_split_reg_get_split_and_trans (
+            GNC_TREE_MODEL_SPLIT_REG (model), &iter, &is_trow1, &is_trow2, &is_split, &is_blank, &split, &trans);
+
+//g_print("gnc_tree_view_split_reg_get_current_trans %p\n", trans);
+
+    return trans;
+}
+
+
+/* Record changes */
+gboolean
+gnc_tree_view_split_reg_enter (GncTreeViewSplitReg *view)
+{
+g_print("gnc_tree_view_split_reg_enter\n");
+
+    //Ask for confirmation if data has been edited, transaction_changed_confirm return TRUE if canceled
+    if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (view), "data-edited")) && transaction_changed_confirm (view, NULL))
+    {
+        return FALSE;
+    }
+    return TRUE;
+}
+
+
+/* Expands the current transaction to reveal splits */
+void
+gnc_tree_view_split_reg_expand_current_trans (GncTreeViewSplitReg *view, gboolean expand)
+{
+    GncTreeModelSplitReg *model;
+    GtkTreePath *path;
+    gint *indices;
+    RowDepth depth;
+
+g_print("\ngnc_tree_view_split_reg_expand_current_trans and expand is %d\n", expand);
+
+    model = get_split_reg_model_from_view (view);
+
+    if (expand)
+        gtk_tree_view_expand_row (GTK_TREE_VIEW (view), view->priv->current_path, TRUE);
+    else
+    {
+        /* Colapse the view back to the transaction */
+        indices = gtk_tree_path_get_indices (view->priv->current_path);
+        depth = gtk_tree_path_get_depth (view->priv->current_path);
+
+        gnc_tree_view_split_reg_block_selection (view, TRUE);
+
+//g_print("indices1 %d %d %d expand is %d\n", indices[0], indices[1], indices[2], expand);
+
+        if (model->use_double_line)
+            path =  gtk_tree_path_new_from_indices (indices[0], 0, -1);
+        else
+            path = gtk_tree_path_new_from_indices (indices[0], -1);
+
+        gtk_tree_view_collapse_row (GTK_TREE_VIEW (view), path);
+
+        gtk_tree_path_free (path);
+
+        gnc_tree_view_split_reg_block_selection (view, FALSE);
+
+        /* Change the selection to last available row of transaction */
+        if ((model->use_double_line) && (depth != TRANS1))
+            path =  gtk_tree_path_new_from_indices (indices[0], 0, -1);
+        else
+            path = gtk_tree_path_new_from_indices (indices[0], -1);
+
+        gtk_tree_path_free (view->priv->current_path);
+        view->priv->current_path = gtk_tree_path_copy (path);
+
+//g_print("Expanded Path is '%s'\n", gtk_tree_path_to_string (path));
+
+        gtk_tree_selection_select_path (gtk_tree_view_get_selection (GTK_TREE_VIEW (view)), path);
+
+        gtk_tree_path_free (path);
+    }
+    /* Scroll the window to show selection */
+//    gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (view), view->priv->current_path, NULL, TRUE, 0.5, 0.0);
+}
+
+
+/* This sets up the page gui update from the tree view motion callback */
+void gnc_tree_view_split_reg_moved_cb (GncTreeViewSplitReg *view, GFunc cb, gpointer cb_data)
+{
+    view->moved_cb = cb;
+    view->moved_cb_data = cb_data;
+}
+
Index: src/gnome-utils/gnc-tree-view-split-reg.h
===================================================================
--- src/gnome-utils/gnc-tree-view-split-reg.h	(revision 22433)
+++ src/gnome-utils/gnc-tree-view-split-reg.h	(working copy)
@@ -1,5 +1,5 @@
 /********************************************************************\
- * gnc-tree-view-split-reg.c -- GtkTreeView implementation to       *
+ * gnc-tree-view-split-reg.h -- GtkTreeView implementation to       *
  *                     display registers   in a GtkTreeView.        *
  *                                                                  *
  * Copyright (C) 2012 Robert Fewell                                 *
@@ -52,6 +52,9 @@
     GncTreeViewSplitRegPrivate *priv;
     int stamp;
 
+    GFunc moved_cb;
+    gpointer moved_cb_data;
+
 } GncTreeViewSplitReg;
 
 typedef struct
@@ -59,11 +62,58 @@
     GncTreeViewClass gnc_tree_view;
 } GncTreeViewSplitRegClass;
 
+typedef enum {
+    TOP,    //0
+    TRANS1, //1
+    TRANS2, //2
+    SPLIT3, //3
+}RowDepth;
+
 /* Standard g_object type */
-GType gnc_tree_view_split_reg_get_type(void);
+GType gnc_tree_view_split_reg_get_type (void);
 
-GncTreeViewSplitReg *gnc_tree_view_split_reg_new_with_model(GncTreeModelSplitReg *model);
+GncTreeViewSplitReg *gnc_tree_view_split_reg_new_with_model (GncTreeModelSplitReg *model);
 
+void gnc_tree_view_split_reg_block_selection (GncTreeViewSplitReg *view, gboolean block);
+
+void gnc_tree_view_split_reg_default_selection (GncTreeViewSplitReg *view);
+
+void gnc_tree_view_split_reg_set_read_only (GncTreeViewSplitReg *view, gboolean read_only);
+
+/*************************************************************************************/
+
+Split * gnc_tree_view_split_reg_get_current_split (GncTreeViewSplitReg *view);
+
+Split * gnc_tree_view_split_reg_get_blank_split (GncTreeViewSplitReg *view);
+
+Split * gnc_tree_view_reg_get_current_trans_split (GncTreeViewSplitReg *view);
+
+RowDepth gnc_tree_view_reg_get_selected_row_depth (GncTreeViewSplitReg *view);
+
+void gnc_tree_view_split_reg_delete_current_split (GncTreeViewSplitReg *view);
+
+void gnc_tree_view_split_reg_delete_current_trans (GncTreeViewSplitReg *view);
+
+void gnc_tree_view_split_reg_jump_to_blank (GncTreeViewSplitReg *view);
+
+void gnc_tree_view_split_reg_jump_to_split (GncTreeViewSplitReg *view, Split *split);
+
+void gnc_tree_view_split_reg_reinit_trans (GncTreeViewSplitReg *view);
+
+void gnc_tree_view_split_reg_goto_rel_trans_row (GncTreeViewSplitReg *view, gint relative);
+
+gboolean gnc_tree_view_split_reg_enter (GncTreeViewSplitReg *view);
+
+gboolean gnc_tree_view_split_reg_current_trans_expanded (GncTreeViewSplitReg *view);
+
+Transaction * gnc_tree_view_split_reg_get_current_trans (GncTreeViewSplitReg *view);
+
+void gnc_tree_view_split_reg_cancel_edit (GncTreeViewSplitReg *view);
+
+void gnc_tree_view_split_reg_expand_current_trans (GncTreeViewSplitReg *view, gboolean expand);
+
+void gnc_tree_view_split_reg_moved_cb (GncTreeViewSplitReg *view, GFunc cb, gpointer cb_data);
+
 G_END_DECLS
 
 #endif /* __GNC_TREE_VIEW_SPLIT_REG_H */
Index: src/gnome-utils/gnc-tree-model-split-reg.c
===================================================================
--- src/gnome-utils/gnc-tree-model-split-reg.c	(revision 22433)
+++ src/gnome-utils/gnc-tree-model-split-reg.c	(working copy)
@@ -39,6 +39,7 @@
 #include "gnc-gobject-utils.h"
 #include "Query.h"
 #include "Transaction.h"
+#include "Scrub.h"
 
 #include "gnc-ui-util.h"
 
@@ -72,29 +73,46 @@
 /** Component Manager Callback ******************************************/
 static void gnc_tree_model_split_reg_event_handler (QofInstance *entity, QofEventId event_type, GncTreeModelSplitReg *model, GncEventData *ed);
 
-static void create_completion_models(GncTreeModelSplitReg *model);
+static void update_completion_models (GncTreeModelSplitReg *model);
 
 /** The instance private data for the split register tree model. */
 struct GncTreeModelSplitRegPrivate
 {
-    QofBook *book;
-    Account *anchor;
-    Query   *query;
+    QofBook *book;              // GNC Book
+    Account *anchor;            // Account of register
 
-    GList *tlist;
-    GList *slist;
+    GList *tlist;               // List of unique transactions derived from the query slist in same order
 
-    gboolean use_colors;
-    gboolean double_line;
-    gboolean alt_colors_by_txn;
+    Transaction *btrans;        // The Blank transaction
 
+    Split *bsplit;              // The Blank split
+    GList *bsplit_node;         // never added to any list, just for representation of the iter
+    GList *bsplit_parent_node;  // this equals the tnode of the transaction with the blank split
 
-    GtkListStore *description_list;
-    GtkListStore *notes_list;
-    GtkListStore *memo_list;
-    GtkListStore *num_list;
-    GtkListStore *numact_list;
 
+    gboolean include_subacc;    //FIXME this is just placed here as the QOF Event is testing for it
+
+
+
+/* vvvv ### This is stuff I have dumped here from old reg #### vvvv */
+
+    /* The template account which template transaction should belong to */
+    GncGUID template_account;
+
+    /* User data for users of SplitRegisters */
+    gpointer user_data;
+
+    /* hook to get parent widget */
+    SRGetParentCallback2 get_parent;
+
+/* ^^^^ #### This is stuff I have dumped here from old reg #### ^^^^ */
+
+    GtkListStore *description_list;  // description field autocomplete list
+    GtkListStore *notes_list;        // notes field autocomplete list
+    GtkListStore *memo_list;         // memo field autocomplete list
+    GtkListStore *num_list;          // number list combo list
+    GtkListStore *numact_list;       // number / action combo list
+
     gint event_handler_id;
 };
 
@@ -199,7 +217,6 @@
 }
 
 
-
 static void
 gnc_tree_model_split_reg_class_init (GncTreeModelSplitRegClass *klass)
 {
@@ -215,7 +232,35 @@
 }
 
 
+static void
+gnc_tree_model_split_reg_gconf_changed (GConfEntry *entry, gpointer user_data)
+{
+    GncTreeModelSplitReg *model = user_data;
 
+    g_return_if_fail(entry && entry->key);
+
+    if (model == NULL)
+        return;
+//g_print("gnc_tree_model_split_reg_gconf_changed\n");
+
+    if (g_str_has_suffix(entry->key, KEY_ACCOUNTING_LABELS))
+    {
+        // FIXME This only works on create, dynamic ? 
+        model->use_accounting_labels = gnc_gconf_get_bool(GCONF_GENERAL, KEY_ACCOUNTING_LABELS, NULL);
+
+//g_print("model->use_accounting_labels changed %d\n", model->use_accounting_labels);
+    }
+    else if (g_str_has_suffix(entry->key, KEY_ACCOUNT_SEPARATOR))
+    {
+        model->separator_changed = TRUE; // FIXME Not dealt with this
+    }
+    else
+    {
+        g_warning("gnc_tree_model_split_reg_gconf_changed: Unknown gconf key %s", entry->key);
+    }
+}
+
+
 static void
 gnc_tree_model_split_reg_init (GncTreeModelSplitReg *model)
 {
@@ -228,11 +273,17 @@
     }
 
     model->priv = g_new0 (GncTreeModelSplitRegPrivate, 1);
+
+    gnc_gconf_general_register_cb(KEY_ACCOUNTING_LABELS,
+                                  gnc_tree_model_split_reg_gconf_changed,
+                                  model);
+    gnc_gconf_general_register_cb(KEY_ACCOUNT_SEPARATOR,
+                                  gnc_tree_model_split_reg_gconf_changed,
+                                  model);
     LEAVE(" ");
 }
 
 
-
 static void
 gnc_tree_model_split_reg_finalize (GObject *object)
 {
@@ -242,11 +293,12 @@
     ENTER("model %p", object);
     g_return_if_fail (object != NULL);
     g_return_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (object));
-
+g_print("gnc_tree_model_split_reg_finalize\n");
     model = GNC_TREE_MODEL_SPLIT_REG (object);
     priv = model->priv;
 
-    if (priv->event_handler_id) {
+    if (priv->event_handler_id)
+    {
         qof_event_unregister_handler(priv->event_handler_id);
         priv->event_handler_id = 0;
     }
@@ -254,11 +306,18 @@
     priv->book = NULL;
     g_list_free(priv->tlist);
     priv->tlist = NULL;
-    g_list_free(priv->slist);
-    priv->slist = NULL;
-    qof_query_destroy(priv->query);
-    priv->query = NULL;
 
+    /* Free the blank split */
+//FIXME do we need to free xaccFreeSplit (priv->bsplit);
+    priv->bsplit = NULL;
+    priv->bsplit_node = NULL;
+
+    /* Free the blank transaction */
+//FIXME do we need to free xaccFreeTransaction (priv->btrans);
+    priv->btrans = NULL;
+
+
+
 /*FIXME Other stuff here */
 
     g_free(priv);
@@ -269,15 +328,14 @@
 }
 
 
-
 static void
 gnc_tree_model_split_reg_dispose (GObject *object)
 {
     GncTreeModelSplitRegPrivate *priv;
     GncTreeModelSplitReg *model;
 
-/* Nor sure about this */
-
+/*FIXME Not sure about this */
+g_print("gnc_tree_model_split_reg_dispose\n");
     ENTER("model %p", object);
     g_return_if_fail (object != NULL);
     g_return_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (object));
@@ -297,56 +355,54 @@
 }
 
 
-
 /************************************************************/
 /*                   New Model Creation                     */
 /************************************************************/
-static GncTreeModelSplitReg *
-gnc_tree_model_split_reg_new (GList *slist)
+GncTreeModelSplitReg *
+gnc_tree_model_split_reg_new (SplitRegisterType2 reg_type, SplitRegisterStyle2 style,
+                        gboolean use_double_line, gboolean is_template)
 {
     GncTreeModelSplitReg *model;
     GncTreeModelSplitRegPrivate *priv;
-    GList *tlist;
     const GList *item;
 
     ENTER("Create Model");
 
-/* This needs fixing 
-    item = gnc_gobject_tracking_get_list(GNC_TREE_MODEL_SPLIT_REG_NAME);
-    for ( ; item; item = g_list_next(item))
-    {
-        model = (GncTreeModelSplitReg *)item->data;
-        priv = GNC_TREE_MODEL_SPLIT_REG_GET_PRIVATE(model);
-        if (priv->anchor == anchor)
-        {
-            g_object_ref(G_OBJECT(model));
-            LEAVE("returning existing model %p", model);
-            return model;
-        }
-    }
-*/
-
-
     model = g_object_new (GNC_TYPE_TREE_MODEL_SPLIT_REG, NULL);
 
-    /* Get a list of Unique Transactions, upsets the list order !! */
-    tlist = xaccSplitListGetUniqueTransactions(slist);
+g_print("gnc_tree_model_split_reg_new and Model pointer is %p\n", model);
 
-    /* Default Sort Transactions by date */
-    tlist = g_list_sort (tlist, (GCompareFunc) xaccTransOrder );
-
     priv = model->priv;
     priv->book = gnc_get_current_book();
-    priv->tlist = tlist;
 
-    priv->use_colors = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER, "use_theme_colors", NULL);
-    priv->double_line = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER, "double_line_mode", NULL);
-    priv->alt_colors_by_txn = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER, "alternate_color_by_transaction", NULL);
+    model->type = reg_type;
+    model->style = style;
+    model->use_double_line = use_double_line;
+    model->is_template = is_template;
 
-    create_completion_models(model);
+    /* Setup the blank transaction */
+    priv->btrans = xaccMallocTransaction (priv->book);
 
-/* More stuff here ? */
+    /* Setup the blank split */
+    priv->bsplit = xaccMallocSplit (priv->book);
+    priv->bsplit_node = g_list_append (NULL, priv->bsplit);
 
+    /* Setup some config entries */
+    model->use_accounting_labels = gnc_gconf_get_bool (GCONF_GENERAL, KEY_ACCOUNTING_LABELS, NULL);
+    model->use_colors = gnc_gconf_get_bool (GCONF_GENERAL_REGISTER, "use_theme_colors", NULL);
+/*    model->use_double_line = gnc_gconf_get_bool (GCONF_GENERAL_REGISTER, "double_line_mode", NULL); */
+    model->alt_colors_by_txn = gnc_gconf_get_bool (GCONF_GENERAL_REGISTER, "alternate_color_by_transaction", NULL);
+    model->read_only = FALSE;
+
+    /* Create the ListStores for the auto completion / combo's */
+    priv->description_list = gtk_list_store_new (1, G_TYPE_STRING);
+    priv->notes_list = gtk_list_store_new (1, G_TYPE_STRING);
+    priv->memo_list = gtk_list_store_new (1, G_TYPE_STRING);
+    priv->num_list = gtk_list_store_new (1, G_TYPE_STRING);
+    priv->numact_list = gtk_list_store_new (1, G_TYPE_STRING);
+
+
+
     priv->event_handler_id = qof_event_register_handler
                              ((QofEventHandler)gnc_tree_model_split_reg_event_handler, model);
 
@@ -355,59 +411,104 @@
 }
 
 
-
-GncTreeModelSplitReg *
-gnc_tree_model_split_reg_new_from_query(Query *query)
+void
+gnc_tree_model_split_reg_load (GncTreeModelSplitReg *model, GList *slist, Account *default_account)
 {
-    GncTreeModelSplitReg *model;
-    GList *slist;
-/*
+    GncTreeModelSplitRegPrivate *priv;
+    GList *tlist;
 
-Not sure if required or what to put in here
-    slist = 
-    model = gnc_tree_model_split_reg_new(slist);
-    model->priv->query = query;
-*/
-    model = gnc_tree_model_split_reg_new(NULL);
-    return model;
+    ENTER("Load Model");
+//g_print("gnc_tree_model_split_reg_load\n");
 
+g_print("Model load pointer is %p and slist length is %d\n", model, g_list_length (slist));
+
+    /* Get a list of Unique Transactions from an slist */
+    tlist = xaccSplitListGetUniqueTransactions (slist);
+
+    priv = model->priv;
+    priv->book = gnc_get_current_book();
+    priv->tlist = tlist;
+    priv->anchor = default_account;
+
+    priv->bsplit_parent_node = NULL;
+
+    /* Update the completion model liststores */
+    gnc_tree_model_split_reg_update_completion (model);
+
+    /* Add the blank transaction to the tlist */
+    priv->tlist = g_list_append (priv->tlist, priv->btrans);
+
+    LEAVE("Leave Model Load");
 }
 
 
+void
+gnc_tree_model_split_reg_set_template_account (GncTreeModelSplitReg *model, Account *template_account)
+{
+    GncTreeModelSplitRegPrivate *priv;
 
-GncTreeModelSplitReg *
-gnc_tree_model_split_reg_new_from_account(Account *acc)
+g_print("gnc_tree_model_split_reg_set_template_account\n");
+    priv = model->priv;
+    priv->template_account = *xaccAccountGetGUID (template_account);
+}
+
+
+void
+gnc_tree_model_split_reg_destroy (GncTreeModelSplitReg *model)
 {
-    GncTreeModelSplitReg *model;
-    Query *q;
-    GSList  *p1, *p2;
-    QofBook *book;
 
-    GList *slist;
+    ENTER("reg=%p", model);
+g_print("gnc_tree_model_split_reg_destroy\n");
 
-    q = qof_query_create_for(GNC_ID_SPLIT);
-    book = gnc_get_current_book();
-    qof_query_set_book (q, book);
+    gnc_gconf_general_remove_cb(KEY_ACCOUNTING_LABELS,
+                                gnc_tree_model_split_reg_gconf_changed,
+                                model);
+    gnc_gconf_general_remove_cb(KEY_ACCOUNT_SEPARATOR,
+                                gnc_tree_model_split_reg_gconf_changed,
+                                model);
 
-    /* Sort by transaction date */
-    p1 = g_slist_prepend (NULL, TRANS_DATE_POSTED);
-    p1 = g_slist_prepend (p1, SPLIT_TRANS);
-    p2 = g_slist_prepend (NULL, QUERY_DEFAULT_SORT);
-    qof_query_set_sort_order (q, p1, p2, NULL);
 
-    xaccQueryAddSingleAccountMatch (q, acc, QOF_QUERY_AND);
+/*FIXME this needs changing ->    gnc_split_register_cleanup (reg); */
 
-    /* Run the query */
-    slist = qof_query_run(q);
+    LEAVE(" ");
+}
 
-    model = gnc_tree_model_split_reg_new(slist);
-    model->priv->anchor = acc;
-    model->priv->query = q;
-    return model;
+
+void
+gnc_tree_model_split_reg_set_data (GncTreeModelSplitReg *model, gpointer user_data,
+                                  SRGetParentCallback2 get_parent)
+{
+    GncTreeModelSplitRegPrivate *priv;
+g_print("gnc_tree_model_split_reg_set_data\n");
+/*FIXME Not sure if this is needed or what it is for */
+    priv = model->priv;
+
+    priv->user_data = user_data;
+    priv->get_parent = get_parent;
 }
 
 
+void
+gnc_tree_model_split_reg_config (GncTreeModelSplitReg *model, SplitRegisterType2 newtype,
+                                 SplitRegisterStyle2 newstyle, gboolean use_double_line)
+{
+g_print("gnc_tree_model_split_reg_config\n");
 
+    model->type = newtype;
+
+    if (model->type >= NUM_SINGLE_REGISTER_TYPES2)
+        newstyle = REG2_STYLE_JOURNAL;
+
+    model->style = newstyle;
+    model->use_double_line = use_double_line;
+
+/*FIXME This might be treeview    gnc_table_realize_gui (reg->table); */
+}
+
+
+
+
+
 /************************************************************/
 /*        Gnc Tree Model Debugging Utility Function         */
 /************************************************************/
@@ -449,7 +550,6 @@
 }
 
 
-
 /************************************************************/
 /*       Gtk Tree Model Required Interface Functions        */
 /************************************************************/
@@ -471,7 +571,6 @@
 }
 
 
-
 static GtkTreeModelFlags
 gnc_tree_model_split_reg_get_flags (GtkTreeModel *tree_model)
 {
@@ -482,7 +581,6 @@
 }
 
 
-
 static int
 gnc_tree_model_split_reg_get_n_columns (GtkTreeModel *tree_model)
 {
@@ -493,10 +591,8 @@
 }
 
 
-
 static GType
-gnc_tree_model_split_reg_get_column_type (GtkTreeModel *tree_model,
-                                        int index)
+gnc_tree_model_split_reg_get_column_type (GtkTreeModel *tree_model, int index)
 {
     /* Returns the type of the column. */
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (tree_model), G_TYPE_INVALID);
@@ -508,13 +604,18 @@
         return G_TYPE_POINTER;
 
     case GNC_TREE_MODEL_SPLIT_REG_COL_DATE:
+    case GNC_TREE_MODEL_SPLIT_REG_COL_DUEDATE:
     case GNC_TREE_MODEL_SPLIT_REG_COL_NUMACT:
     case GNC_TREE_MODEL_SPLIT_REG_COL_DESCNOTES:
     case GNC_TREE_MODEL_SPLIT_REG_COL_TRANSVOID:
+    case GNC_TREE_MODEL_SPLIT_REG_COL_RECN:
 
     case GNC_TREE_MODEL_SPLIT_REG_COL_COLOR:
         return G_TYPE_STRING;
 
+    case GNC_TREE_MODEL_SPLIT_REG_COL_RO:
+        return G_TYPE_BOOLEAN;
+
     default:
         g_assert_not_reached ();
         return G_TYPE_INVALID;
@@ -522,7 +623,6 @@
 }
 
 
-
 static gboolean
 gnc_tree_model_split_reg_get_iter (GtkTreeModel *tree_model,
                                  GtkTreeIter *iter,
@@ -533,7 +633,7 @@
     GList *tnode;
     SplitList *slist;
     GList *snode;
-    gint depth, *indices, flags;
+    gint depth, *indices, flags = 0;
 
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (tree_model), FALSE);
 
@@ -543,10 +643,8 @@
         g_free(path_string);
     }
 
-/* g_print("gnc_tree_model_split_reg_get_iter\n"); */
+    depth = gtk_tree_path_get_depth (path);
 
-    depth = gtk_tree_path_get_depth (path);
-/* g_print("Depth is %u\n", depth); */
     indices = gtk_tree_path_get_indices (path);
 
     tnode = g_list_nth(model->priv->tlist, indices[0]);
@@ -556,29 +654,47 @@
         goto fail;
     }
 
-    slist = xaccTransGetSplitList(tnode->data);
+    slist = xaccTransGetSplitList (tnode->data);
 
-/* g_print("Num of Splits is %d\n\n", xaccTransCountSplits(tnode->data)); */
-
-    if(depth != 3 )
-        snode = g_list_nth(slist, 0);
-    else
-        snode = g_list_nth(slist, indices[2]);
-
-    if (!snode) {
-        DEBUG("path index off end of slist");
-        goto fail;
+    if (depth == 1) {      /* Trans Row 1 */
+        flags = TROW1;
+        /* Check if this is the blank trans */
+        if (tnode->data == model->priv->btrans) {
+            flags |= BLANK;
+            snode = NULL;
+        }
+        else
+            snode = g_list_nth (slist, 0); //FIXME is this always the case or do we need to find it - account split
     }
+    else if (depth == 2) { /* Trans Row 2 */
+        flags = TROW2;
+        /* Check if this is the blank trans */
+        if (tnode->data == model->priv->btrans) {
+            flags |= BLANK;
+            snode = NULL;
+        }
+        else
+            snode = g_list_nth (slist, 0); //FIXME is this always the case or do we need to find it - account split
+    }
+    else if (depth == 3) /* Split */
+         {        
+             flags = SPLIT;
 
-    if (depth == 1)       /* Trans Row 1 */
-        flags = TROW1;
+             /* Check if this is the blank split */
+             if ((tnode == model->priv->bsplit_parent_node) && (xaccTransCountSplits (tnode->data) == indices[2]))
+             {
+                 flags |= BLANK;
+                 snode = model->priv->bsplit_node;
+             }
+             else
+                 snode = g_list_nth (slist, indices[2]);
 
-    else if (depth == 2)  /* Trans Row 2 */
-        flags = TROW2;
+             if (!snode) {
+                 DEBUG("path index off end of slist");
+                 goto fail;
+             }
+         }
 
-    else if (depth == 3)  /* Split */
-        flags = SPLIT;
-
     else {
         DEBUG("Invalid path depth");
         goto fail;
@@ -595,10 +711,8 @@
 }
 
 
-
 static GtkTreePath *
-gnc_tree_model_split_reg_get_path (GtkTreeModel *tree_model,
-                                 GtkTreeIter *iter)
+gnc_tree_model_split_reg_get_path (GtkTreeModel *tree_model, GtkTreeIter *iter)
 {
     /* Returns a newly-created GtkTreePath referenced by iter. 
        This path should be freed with gtk_tree_path_free(). */
@@ -610,43 +724,47 @@
 
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (model), NULL);
 
-/* g_print("gnc_tree_model_split_reg_get_path\n"); */
-    ENTER("model %p, iter %s", model, iter_to_string(iter));
+    ENTER("model %p, iter %s", model, iter_to_string (iter));
 /*    g_assert(VALID_ITER(model, iter)); */
 
     path = gtk_tree_path_new();
 
     tnode = iter->user_data2;
 
-    slist = xaccTransGetSplitList(tnode->data);
+    slist = xaccTransGetSplitList (tnode->data);
     snode = iter->user_data3;
 
     /* Level 1 */
-    tpos = g_list_position(model->priv->tlist, tnode);
+    tpos = g_list_position (model->priv->tlist, tnode);
     if (tpos == -1)
         goto fail;
     gtk_tree_path_append_index(path, tpos);
 
     /* Level 2 - All ways 0 */
-    if(IS_TROW2(iter))
+    if (IS_TROW2 (iter))
         gtk_tree_path_append_index(path, 0);
 
     /* Level 3 */
-    if(IS_SPLIT(iter))
+    if (IS_SPLIT (iter))
     {
-        spos = g_list_position(slist, snode);
+        /* Check if this is the blank split */
+        if ((tnode == model->priv->bsplit_parent_node) && (IS_BLANK (iter)))
+        {
+            spos = xaccTransCountSplits (tnode->data);
+        }
+        else
+            spos = g_list_position (slist, snode);
 
         if (spos == -1)
             goto fail;
-        gtk_tree_path_append_index(path, 0); /* Add the Level 2 part */
-        gtk_tree_path_append_index(path, spos);
+        gtk_tree_path_append_index (path, 0); /* Add the Level 2 part */
+        gtk_tree_path_append_index (path, spos);
     }
 
     {
-        gchar *path_string = gtk_tree_path_to_string(path);
-/* g_print("Returned get path is %s\n", gtk_tree_path_to_string(path)); */
+        gchar *path_string = gtk_tree_path_to_string (path);
         LEAVE("get path  %s", path_string);
-        g_free(path_string);
+        g_free (path_string);
     }
     return path;
 
@@ -657,17 +775,47 @@
 
 
 
+/* Return TRUE if this row should be marked read only */
+static gboolean
+gtm_get_read_only (GncTreeModelSplitReg *model, Transaction *trans)
+{
+    QofBook *book;
+    GList *tnode, *tnode_last = NULL;
+
+    book = gnc_get_current_book ();
+
+    tnode = g_list_find (model->priv->tlist, trans);
+    tnode_last = g_list_last (model->priv->tlist);
+
+    if (qof_book_is_readonly (book)) // book is read only
+        return TRUE;
+
+    if (model->read_only) // register is read only
+        return TRUE;
+
+    if (qof_book_uses_autoreadonly (book)) // use auto read only
+    {
+        if (tnode == tnode_last) // blank transaction
+            return FALSE;
+        else
+            return xaccTransIsReadonlyByPostedDate (trans);
+    }
+
+    return FALSE;
+}
+
+/* Returns the row color */
 static gchar*
-get_row_color(GncTreeModelSplitReg *model, gboolean is_trow1, gboolean is_trow2, gboolean is_split, gint num)
+gtm_get_row_color(GncTreeModelSplitReg *model, gboolean is_trow1, gboolean is_trow2, gboolean is_split, gint num)
 {
 
     gchar *cell_color = NULL;
 
-    if(!model->priv->use_colors)
+    if(!model->use_colors)
     {
-        if(model->priv->double_line)
+        if(model->use_double_line)
         {
-            if(model->priv->alt_colors_by_txn)
+            if(model->alt_colors_by_txn)
             {
                 if(num % 2 == 0)
                 {
@@ -715,7 +863,6 @@
 }
 
 
-
 static void
 gnc_tree_model_split_reg_get_value (GtkTreeModel *tree_model,
                                   GtkTreeIter *iter,
@@ -733,7 +880,7 @@
     gint depth, *indices;
 
     g_return_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (model));
-/* g_print("gnc_tree_model_split_reg_get_value\n"); */
+
     ENTER("model %p, iter %s, col %d", tree_model, iter_to_string(iter), column);
 
     account = model->priv->anchor;
@@ -758,8 +905,11 @@
     case GNC_TREE_MODEL_SPLIT_REG_COL_DATE:
         break;
 
+    case GNC_TREE_MODEL_SPLIT_REG_COL_DUEDATE:
+        break;
+
     case GNC_TREE_MODEL_SPLIT_REG_COL_COLOR:
-            g_value_set_string (value, get_row_color(model, IS_TROW1(iter), IS_TROW2(iter), IS_SPLIT(iter), indices[0]));
+            g_value_set_string (value, gtm_get_row_color (model, IS_TROW1 (iter), IS_TROW2 (iter), IS_SPLIT (iter), indices[0]));
         break;
 
     case GNC_TREE_MODEL_SPLIT_REG_COL_NUMACT:
@@ -771,6 +921,13 @@
     case GNC_TREE_MODEL_SPLIT_REG_COL_TRANSVOID:
         break;
 
+    case GNC_TREE_MODEL_SPLIT_REG_COL_RECN:
+        break;
+
+    case GNC_TREE_MODEL_SPLIT_REG_COL_RO:
+            g_value_set_boolean (value, gtm_get_read_only (model, trans));
+        break;
+
     default:
         g_assert_not_reached ();
     }
@@ -779,10 +936,8 @@
 }
 
 
-
 static gboolean
-gnc_tree_model_split_reg_iter_next (GtkTreeModel *tree_model,
-                                  GtkTreeIter *iter)
+gnc_tree_model_split_reg_iter_next (GtkTreeModel *tree_model, GtkTreeIter *iter)
 {
     /* Sets iter to point to the node following it at the current level.
        If there is no next iter, FALSE is returned and iter is set to be
@@ -791,51 +946,64 @@
     Transaction *trans;
     SplitList *slist;
     GList *tnode = NULL, *snode = NULL;
-    gint flags = TROW1;
+    gint flags = 0;
 
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (model), FALSE);
-/* g_print("gnc_tree_model_split_reg_iter_next\n"); */
+
     ENTER("model %p, iter %s", tree_model, iter_to_string(iter));
 
-    if (IS_TROW2(iter)) {
+    if (IS_BLANK (iter)) {
+        LEAVE("Blanks never have a next");
+        goto fail;
+    }
+
+    if (IS_TROW2 (iter)) {
         LEAVE("Transaction row 2 never has a next");
         goto fail;
     }
 
-    if (IS_TROW1(iter)) {
-
+    if (IS_TROW1 (iter)) {
+        flags = TROW1;
         tnode = iter->user_data2;
-        tnode = g_list_next(tnode);
+        tnode = g_list_next (tnode);
 
         if (!tnode) {
            LEAVE("last trans has no next");
            goto fail;
         }
 
-        trans = tnode->data;
-
-        slist = xaccTransGetSplitList(trans);
-        snode = g_list_nth(slist, 0);
-
-        flags = TROW1;
+        /* Check if this is the blank trans */
+        if (tnode->data == model->priv->btrans) {
+            flags |= BLANK;
+            snode = NULL;
+        }
+        else {
+            trans = tnode->data;
+            slist = xaccTransGetSplitList (trans);
+            snode = g_list_nth(slist, 0);
+        }
     }
 
     if (IS_SPLIT(iter)) {
 
+        flags = SPLIT;
         tnode = iter->user_data2;
         snode = iter->user_data3;
-        snode = g_list_next(snode);
+        snode = g_list_next (snode);
 
         if (!snode) {
-           LEAVE("last split has no next");
-           goto fail;
+            if (tnode == model->priv->bsplit_parent_node) {
+                snode = model->priv->bsplit_node;
+                flags |= BLANK;
+            } else {
+                LEAVE("Last non-blank split has no next");
+                goto fail;
+            }
         }
-
-        flags = SPLIT;
     }
 
-    *iter = make_iter(model, flags, tnode, snode);
-    LEAVE("iter %s", iter_to_string(iter));
+    *iter = make_iter (model, flags, tnode, snode);
+    LEAVE("iter %s", iter_to_string (iter));
     return TRUE;
  fail:
     iter->stamp = 0;
@@ -850,11 +1018,11 @@
                                       GtkTreeIter *parent_iter)
 {
     /* Sets iter to point to the first child of parent. If parent has no children,
-       FALSE is returned and iter is set to be invalid. parent will remain a valid
+       FALSE is returned and iter is set to be invalid. Parent will remain a valid
        node after this function has been called. */
     GncTreeModelSplitReg *model = GNC_TREE_MODEL_SPLIT_REG (tree_model);
     GList *tnode = NULL, *snode = NULL;
-    gint flags = TROW1;
+    gint flags = 0;
     Transaction *trans;
     SplitList *slist;
 
@@ -862,18 +1030,23 @@
     ENTER("model %p, iter %p (to be filed in), parent %s",
           tree_model, iter, (parent_iter ? iter_to_string(parent_iter) : "(null)"));
 
-/* g_print("gnc_tree_model_split_reg_iter_children\n"); */
-
     if (!parent_iter) {
         /* Get the very first iter */
         tnode = model->priv->tlist;
         if (tnode) {
+            flags = TROW1;
+            if (tnode->data == model->priv->btrans) {
+                flags |= BLANK;
+                snode = NULL;
+            }
+            else
+            {
+                slist = xaccTransGetSplitList (tnode->data);
+                snode = g_list_nth (slist, 0);
+            }
 
-            slist = xaccTransGetSplitList(tnode->data);
-            snode = g_list_nth(slist, 0);
-        
-            *iter = make_iter(model, flags, tnode, snode);
-            LEAVE("iter (2) %s", iter_to_string(iter));
+            *iter = make_iter (model, flags, tnode, snode);
+            LEAVE("iter (2) %s", iter_to_string (iter));
             return TRUE;
         } else {
             PERR("We should never have a NULL trans list.");
@@ -883,27 +1056,40 @@
 
 /*    g_assert(VALID_ITER(model, parent_iter)); */
 
-    if(IS_TROW1(parent_iter))
+    if (IS_TROW1 (parent_iter))
     {
+        flags = TROW2;
         tnode = parent_iter->user_data2;
-        snode = parent_iter->user_data3;
-        flags = TROW2;
+        if (tnode->data == model->priv->btrans) {
+            flags |= BLANK;
+            snode = NULL;
+        }
+        else
+        {
+            slist = xaccTransGetSplitList (tnode->data);
+            snode = g_list_nth (slist, 0); //FIXME is this always the case or do we need to find it - account split
+        }
     }
 
-    if(IS_TROW2(parent_iter))
+    if (IS_TROW2 (parent_iter))
     {
+        flags = SPLIT;
         tnode = parent_iter->user_data2;
 
-        slist = xaccTransGetSplitList(tnode->data);
-        snode = g_list_nth(slist, 0);
-        flags = SPLIT;
+        if (tnode->data == model->priv->btrans)
+            snode = NULL;
+        else
+        {
+            slist = xaccTransGetSplitList (tnode->data);
+            snode = g_list_nth (slist, 0); //FIXME is this always the case or do we need to find it - account split
+        }
     }
 
-    if(IS_SPLIT(parent_iter))
+    if (IS_SPLIT (parent_iter)) // Splits do not have children
         goto fail;
 
-    *iter = make_iter(model, flags, tnode, snode);
-    LEAVE("iter %s", iter_to_string(iter));
+    *iter = make_iter (model, flags, tnode, snode);
+    LEAVE("iter %s", iter_to_string (iter));
     return TRUE;
  fail:
     LEAVE("iter has no children");
@@ -912,10 +1098,8 @@
 }
 
 
-
 static gboolean
-gnc_tree_model_split_reg_iter_has_child (GtkTreeModel *tree_model,
-                                       GtkTreeIter *iter)
+gnc_tree_model_split_reg_iter_has_child (GtkTreeModel *tree_model, GtkTreeIter *iter)
 {
     /* Returns TRUE if iter has children, FALSE otherwise. */
     GncTreeModelSplitReg *model = GNC_TREE_MODEL_SPLIT_REG (tree_model);
@@ -924,33 +1108,30 @@
 
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (tree_model), FALSE);
 
-    ENTER("model %p, iter %s", tree_model, iter_to_string(iter));
-/* g_print("gnc_tree_model_split_reg_iter_has_child\n"); */
+    ENTER("model %p, iter %s", tree_model, iter_to_string (iter));
 
     tnode = iter->user_data2;
     trans = tnode->data;
 
-    if (IS_TROW1(iter))
+    if (IS_TROW1 (iter))
     {
-        LEAVE("Transaction Row 1 is yes");
+        LEAVE ("Transaction Row 1 is yes");
         return TRUE;
     }
 
-    if (IS_TROW2(iter))
+    if (IS_TROW2 (iter))
     {
-        LEAVE("Transaction Row 2 is yes");
+        LEAVE ("Transaction Row 2 is yes");
         return TRUE;
     }
 
-    LEAVE("We have no child");
+    LEAVE ("We have no child");
     return FALSE;
 }
 
 
-
 static int
-gnc_tree_model_split_reg_iter_n_children (GtkTreeModel *tree_model,
-                                        GtkTreeIter *iter)
+gnc_tree_model_split_reg_iter_n_children (GtkTreeModel *tree_model, GtkTreeIter *iter)
 {
     /* Returns the number of children that iter has. As a special case,
        if iter is NULL, then the number of toplevel nodes is returned.  */
@@ -960,96 +1141,123 @@
     int i;
 
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (tree_model), FALSE);
-    ENTER("model %p, iter %s", tree_model, iter_to_string(iter));
-/* g_print("gnc_tree_model_split_reg_iter_n_children\n"); */
+    ENTER("model %p, iter %s", tree_model, iter_to_string (iter));
 
     if (iter == NULL) {
-        i = g_list_length(model->priv->tlist);
-        LEAVE("toplevel count is %d", i);
+        i = g_list_length (model->priv->tlist);
+        LEAVE ("toplevel count is %d", i);
         return i;
     }
 
-    if(IS_SPLIT(iter))
+    if (IS_SPLIT (iter))
         i = 0;
 
-    if(IS_TROW1(iter))
+    if (IS_TROW1 (iter))
         i = 1;
 
-    if(IS_TROW2(iter))
+    if (IS_TROW2 (iter))
     {
         tnode = iter->user_data2;
         trans = tnode->data;
-        i = xaccTransCountSplits(trans);
+        i = xaccTransCountSplits (trans);
+        if (tnode == model->priv->bsplit_parent_node)
+            i++;
     }
 
-    LEAVE("The number of children iter has is %d", i);
+    LEAVE ("The number of children iter has is %d", i);
     return i;
 }
 
 
-
 static gboolean
 gnc_tree_model_split_reg_iter_nth_child (GtkTreeModel *tree_model,
                                        GtkTreeIter *iter,
                                        GtkTreeIter *parent_iter,
                                        int n)
 {
-    /* Sets iter to be the child of parent, using the given index. */
+    /* Sets iter to be the n'th child of parent, using the given index. 0 > */
     GncTreeModelSplitReg *model = GNC_TREE_MODEL_SPLIT_REG (tree_model);
     Transaction *trans;
     SplitList *slist;
     GList *tnode, *snode;
-    gint flags = TROW1;
+    gint flags = 0;
 
-    ENTER("model %p, iter %s, n %d", tree_model, iter_to_string(parent_iter), n);
+    ENTER("model %p, iter %s, n %d", tree_model, iter_to_string (parent_iter), n);
     g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (tree_model), FALSE);
 
-/* g_print("gnc_tree_model_split_reg_iter_nth_child %d\n", n); */
-
     if (parent_iter == NULL) {  /* Top-level */
+        flags = TROW1;
         tnode = g_list_nth(model->priv->tlist, n);
 
         if (!tnode) {
             PERR("Trans list should never be NULL.");
             goto fail;
         }
-        trans = tnode->data;
 
-        slist = xaccTransGetSplitList(trans);
-        snode = g_list_nth(slist, 0);
+        /* Check if this is the blank trans */
+        if (tnode->data == model->priv->btrans) {
+            flags |= BLANK;
+            snode = NULL;
+        }
+        else
+        {
+            trans = tnode->data;
 
-        *iter = make_iter(model, flags, tnode, snode);
-        LEAVE("iter (2) %s", iter_to_string(iter));
+            slist = xaccTransGetSplitList (trans);
+            snode = g_list_nth (slist, 0); //FIXME is this always the case or do we need to find it - account split
+        }
+
+        *iter = make_iter (model, flags, tnode, snode);
+        LEAVE ("iter (2) %s", iter_to_string (iter));
         return TRUE;
     }
 
-    DEBUG("parent iter %s", iter_to_string(parent_iter));
+    DEBUG("parent iter %s", iter_to_string (parent_iter));
 /*    g_assert(VALID_ITER(model, parent_iter)); */
 
-    if (IS_SPLIT(parent_iter))
+    if (IS_SPLIT (parent_iter))
         goto fail;  /* Splits have no children */
 
+    if (IS_TROW1 (parent_iter) && (n != 0))
+        goto fail; /* TROW1 has only one child */
 
-    if(IS_TROW1(parent_iter) && (n != 0))
-        goto fail;
+    flags = TROW2;
+    snode = NULL;
 
     tnode = parent_iter->user_data2;
     trans = tnode->data;
-    snode = parent_iter->user_data3;
-    flags = TROW2;
 
-    if(IS_TROW2(parent_iter) && (n > xaccTransCountSplits(trans)))
+    if (IS_TROW1 (parent_iter) && IS_BLANK (parent_iter))
+    {
+        flags |= BLANK;
+    }
+
+    if (IS_TROW2 (parent_iter) && (n > xaccTransCountSplits (trans)))
+    {
         goto fail;
+    }
     else
     {
+        flags = SPLIT;
 
-        slist = xaccTransGetSplitList(trans);
-        snode = g_list_nth(slist, n);
-        flags = SPLIT;
+        if (tnode->data == model->priv->btrans)
+        {
+            snode = NULL;
+        }
+        else if ((tnode == model->priv->bsplit_parent_node) && (xaccTransCountSplits(trans) == n))
+        {
+            flags |= BLANK;
+            snode = model->priv->bsplit_node;
+        }
+        else
+        {
+            slist = xaccTransGetSplitList (trans);
+            snode = g_list_nth (slist, n);
+        }
     }
 
-    *iter = make_iter(model, flags, tnode, snode);
-    LEAVE("iter of child with index %u is %s", n, iter_to_string(iter));
+    *iter = make_iter (model, flags, tnode, snode);
+    LEAVE("iter of child with index %u is %s", n, iter_to_string (iter));
     return TRUE;
  fail:
     LEAVE("iter has no child with index %u", n);
@@ -1058,7 +1266,6 @@
 }
 
 
-
 static gboolean
 gnc_tree_model_split_reg_iter_parent (GtkTreeModel *tree_model,
                                     GtkTreeIter *iter,
@@ -1066,32 +1273,33 @@
 {
     /* Sets iter to be the parent of child. If child is at the toplevel,
        and doesn't have a parent, then iter is set to an invalid iterator
-       and FALSE is returned. child will remain a valid node after this 
+       and FALSE is returned. Child will remain a valid node after this 
        function has been called. */
     GncTreeModelSplitReg *model = GNC_TREE_MODEL_SPLIT_REG (tree_model);
     GList *tnode, *snode;
     gint flags = TROW1;
 
-    ENTER("model %p, child %s", tree_model, iter_to_string(child));
+    ENTER("model %p, child %s", tree_model, iter_to_string (child));
 
-/* g_print("gnc_tree_model_split_reg_iter_parent\n"); */
-
 /*    g_assert(VALID_ITER(model, child)); */
 
     tnode = child->user_data2;
     snode = child->user_data3;
 
-    if(IS_TROW1(child))
+    if (IS_TROW1 (child))
         goto fail;
 
-    if(IS_TROW2(child))
+    if (IS_TROW2 (child))
         flags = TROW1;
 
-    if(IS_SPLIT(child))
+    if (IS_SPLIT (child))
         flags = TROW2;
 
-    *iter = make_iter(model, flags, tnode, snode);
-    LEAVE("parent iter is %s", iter_to_string(iter));
+    if (tnode->data == model->priv->btrans)
+        flags |= BLANK;
+
+    *iter = make_iter (model, flags, tnode, snode);
+    LEAVE("parent iter is %s", iter_to_string (iter));
     return TRUE;
  fail:
     LEAVE("we have no parent");
@@ -1100,10 +1308,15 @@
 }
 
 
+/*###################################################################*/
 
+static void
+increment_stamp (GncTreeModelSplitReg *model)
+{
+    do model->stamp++;
+    while (model->stamp == 0);
+}
 
-/*###################################################################*/
-
 gboolean
 gnc_tree_model_split_reg_get_split_and_trans (
     GncTreeModelSplitReg *model, GtkTreeIter *iter,
@@ -1113,7 +1326,7 @@
     GList *node;
 
 /*    g_return_val_if_fail(VALID_ITER(model, iter), FALSE); */
-    ENTER("");
+    ENTER("model pointer is %p", model);
     if (is_trow1)
         *is_trow1 = !!IS_TROW1(iter);
     if (is_trow2)
@@ -1136,10 +1349,515 @@
 }
 
 
+/* Return the tree path of trans and split
+   if trans and split NULL, return last in list */
+GtkTreePath *
+gnc_tree_model_split_reg_get_path_to_split_and_trans (GncTreeModelSplitReg *model, Split *split, Transaction *trans)
+{
+    GtkTreePath *path;
+    GList *slist;
+    gint tpos, spos, number;
+
+//g_print("gnc_tree_model_split_reg_get_path_to_split_and_trans\n");
+
+    path = gtk_tree_path_new();
+
+    number = gnc_tree_model_split_reg_iter_n_children (GTK_TREE_MODEL (model), NULL) - 1;
+
+    if (trans == NULL && split == NULL)
+    {
+        gtk_tree_path_append_index (path, number);
+        return path;
+    }
+
+    if (trans == NULL && split != NULL)
+        trans = xaccSplitGetParent (split);
+
+    if (trans != NULL)
+    {
+        /* Level 1 */
+        tpos = g_list_index (model->priv->tlist, trans);
+        if (tpos == -1)
+            tpos = number;
+        gtk_tree_path_append_index (path, tpos);
+    }
+
+    if (trans == NULL && split != NULL)
+    {
+        slist = xaccTransGetSplitList (trans);
+        /* Level 3 */
+        spos = g_list_index (slist, split);
+        if (spos == -1)
+        {
+            if (model->priv->bsplit == split) // test for blank split
+                spos = g_list_length (slist);
+            else
+                spos = 0;
+        }
+        gtk_tree_path_append_index (path, 0); /* Level 2 */
+        gtk_tree_path_append_index (path, spos);
+    }
+    return path;
+}
+
+
+
+#define get_iter gnc_tree_model_split_reg_get_iter_from_trans_and_split
+gboolean
+gnc_tree_model_split_reg_get_iter_from_trans_and_split (
+    GncTreeModelSplitReg *model, Transaction *trans, Split *split, 
+    GtkTreeIter *iter1, GtkTreeIter *iter2)
+{
+    GncTreeModelSplitRegPrivate *priv;
+    GList *tnode, *snode = NULL;
+    gint flags1 = TROW1;
+    gint flags2 = TROW2;
+
+    g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (model), FALSE);
+    g_return_val_if_fail (iter1, FALSE);
+    g_return_val_if_fail (iter2, FALSE);
+
+g_print("get_iter model %p, trans %p, split %p\n", model, trans, split);
+
+    priv = model->priv;
+    if (split && !trans)
+        trans = xaccSplitGetParent (split);
+
+    if (trans && priv->book != xaccTransGetBook (trans)) return FALSE;
+    if (split && priv->book != xaccSplitGetBook (split)) return FALSE;    
+    if (split && !xaccTransStillHasSplit(trans, split)) return FALSE;
+
+    tnode = g_list_find (priv->tlist, trans);
+    if (!tnode) return FALSE;
+
+    if (trans == priv->btrans)
+    {
+        flags1 |= BLANK;
+        flags2 |= BLANK;
+    }
+
+    if (split)
+    {
+        GList *slist = xaccTransGetSplitList (trans);
+        snode = g_list_find (slist, split);
+        flags1 = SPLIT;
+        if (!snode && split == (Split *) ((GList *)priv->bsplit_node)->data)
+        {
+            snode = priv->bsplit_node;
+            flags1 |= BLANK;
+        }
+        if (!snode) return FALSE;
+    }
+
+
+    *iter1 = make_iter (model, flags1, tnode, snode);
+
+//g_print("iter1 is %s\n", gtk_tree_model_get_string_from_iter (GTK_TREE_MODEL(model), iter1));
+
+    *iter2 = make_iter (model, flags2, tnode, snode);
+
+//g_print("iter2 is %s\n", gtk_tree_model_get_string_from_iter (GTK_TREE_MODEL(model), iter2));
+    return TRUE;
+}
+
+
+Split *
+gnc_tree_model_split_get_blank_split (GncTreeModelSplitReg *model)
+{
+    return model->priv->bsplit;
+}
+
 /*###################################################################*/
 
+static void
+update_parent (GncTreeModelSplitReg *model, GtkTreePath *path)
+{
+    GList *tnode;
+    GtkTreeIter iter;
+
+//g_print("update_parent 0 - '%s'\n", gtk_tree_path_to_string (path));
+
+    if (gtk_tree_path_up (path) && gnc_tree_model_split_reg_get_iter (GTK_TREE_MODEL (model), &iter, path))
+    {
+//g_print("update_parent 1 -  '%s'\n", gtk_tree_path_to_string (path));
+
+        gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, &iter);
+
+        tnode = iter.user_data2;
+
+        /* If this is the blank transaction, the only split will be deleteted, hence toggle has child */ 
+        if (IS_BLANK_TRANS (&iter) && (tnode->data == model->priv->btrans) && (xaccTransCountSplits (model->priv->btrans) == 0))
+        {
+            increment_stamp (model);
+            
+            PINFO("toggling has_child at row %s\n", gtk_tree_path_to_string (path));
+
+//g_print("update_parent - toggle Path is '%s'\n", gtk_tree_path_to_string (path));
+            
+            gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (model), path, &iter);
+        }
+    }
+}
+
+
+
+
+static void
+insert_row_at (GncTreeModelSplitReg *model, GtkTreeIter *iter)
+{
+    GtkTreePath *path;
+g_print("insert_row_at\n");
+//    g_assert (VALID_ITER (model, iter));
+    path = gnc_tree_model_split_reg_get_path (GTK_TREE_MODEL (model), iter);
+//g_print("insert_row_at - Path is '%s'\n", gtk_tree_path_to_string (path));
+    if (!path)
+        PERR("Null path");
+
+    increment_stamp (model);
+    if (gnc_tree_model_split_reg_get_iter (GTK_TREE_MODEL (model), iter, path))
+    {
+//g_print("insert_row_at - Path is '%s' valid iter\n", gtk_tree_path_to_string (path));
+        gtk_tree_model_row_inserted (GTK_TREE_MODEL (model), path, iter);
+    }
+    else
+        PERR("Tried to insert with invalid iter.");
+
+    update_parent (model, path);
+    gtk_tree_path_free (path);
+}
+
+static void
+delete_row_at_path (GncTreeModelSplitReg *model, GtkTreePath *path)
+{
+    gint depth;
+
+    if (!path)
+        PERR("Null path");
+    increment_stamp (model);
+    gtk_tree_model_row_deleted (GTK_TREE_MODEL (model), path);
+
+    depth = gtk_tree_path_get_depth (path);
+//g_print("delete_row_at_path %s and depth %d\n", gtk_tree_path_to_string (path), depth);
+    if (depth == 2)
+    {
+        update_parent (model, path);
+    }
+    else if (depth == 3)
+    {
+        update_parent (model, path);
+    }
+    else
+    {
+        GtkTreeIter iter;
+        if (gnc_tree_model_split_reg_get_iter (GTK_TREE_MODEL (model), &iter, path))
+        { 
+            GList *tnode = iter.user_data2;
+            GncTreeModelSplitRegPrivate *priv = model->priv;
+//g_print("delete_row_at_path bsplit - Path is '%s'\n", gtk_tree_path_to_string (path));
+            if (tnode == priv->bsplit_parent_node)
+                priv->bsplit_parent_node = NULL;
+
+//            priv->tlist = g_list_delete_link(priv->tlist, tnode);
+        }
+    }
+}
+
+
+static void
+delete_row_at (GncTreeModelSplitReg *model, GtkTreeIter *iter)
+{
+    GtkTreePath *path;
+//    g_assert(VALID_ITER (model, iter));
+
+//g_print("delete_row_at\n");
+    path = gnc_tree_model_split_reg_get_path (GTK_TREE_MODEL (model), iter);
+//g_print("delete_row_at - Path is '%s'\n", gtk_tree_path_to_string (path));
+    delete_row_at_path (model, path);
+    gtk_tree_path_free (path);
+}
+
+
+static void
+changed_row_at (GncTreeModelSplitReg *model, GtkTreeIter *iter)
+{
+    GtkTreePath *path;
+//    g_assert(VALID_ITER (model, iter));
+//g_print("changed_row_at\n");
+    path = gnc_tree_model_split_reg_get_path (GTK_TREE_MODEL (model), iter);
+    if (!path)
+        PERR ("Null path");
+//g_print("changed_row_at - Path is '%s'\n", gtk_tree_path_to_string (path));
+    increment_stamp (model);
+    if (gnc_tree_model_split_reg_get_iter (GTK_TREE_MODEL (model), iter, path))
+    {
+//g_print("changed_row_at - Path is '%s' valid iter\n", gtk_tree_path_to_string (path));
+        gtk_tree_model_row_changed (GTK_TREE_MODEL (model), path, iter);
+    }
+    else 
+        PERR ("Tried to change with invalid iter.");
+
+    gtk_tree_path_free (path);
+}
+
+
+static void
+insert_trans (GncTreeModelSplitReg *model, Transaction *trans)
+{
+    GtkTreeIter iter;
+    GtkTreePath *path;
+    GList *tnode = NULL, *snode = NULL;
+//g_print("insert_trans %p\n", trans);
+    model->priv->tlist = g_list_prepend (model->priv->tlist, trans);
+    tnode = g_list_find (model->priv->tlist, trans);
+    iter = make_iter (model, TROW1, tnode, NULL);
+    insert_row_at (model, &iter);
+
+    path = gnc_tree_model_split_reg_get_path (GTK_TREE_MODEL (model), &iter);
+    gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (model), path, &iter);
+
+    iter = make_iter (model, TROW2, tnode, NULL);
+    insert_row_at (model, &iter);
+
+    path = gnc_tree_model_split_reg_get_path (GTK_TREE_MODEL (model), &iter);
+    gtk_tree_model_row_has_child_toggled (GTK_TREE_MODEL (model), path, &iter);
+
+//g_print("insert count splits %p %d\n", trans, xaccTransCountSplits (trans));
+
+    for (snode = xaccTransGetSplitList (trans); snode; snode = snode->next)
+    {
+        if (xaccTransStillHasSplit (trans, snode->data))
+        {
+            iter = make_iter (model, SPLIT, tnode, snode);
+            insert_row_at (model, &iter);
+        }
+    }
+}
+
+static void
+delete_trans (GncTreeModelSplitReg *model, Transaction *trans)
+{
+    GtkTreeIter iter;
+    GList *tnode = NULL, *snode = NULL;
+//g_print("delete_trans %p\n", trans);
+
+    tnode = g_list_find (model->priv->tlist, trans);
+//g_print("tlist length is %d\n", g_list_length (model->priv->tlist));
+
+//g_print("delete count splits %p %d\n", trans, xaccTransCountSplits (trans));
+
+    if (tnode == model->priv->bsplit_parent_node)
+    {
+//g_print("a delete blank split\n");
+        /* Delete the row where the blank split is. */
+        iter = make_iter (model, SPLIT | BLANK, tnode, model->priv->bsplit_node);
+        delete_row_at (model, &iter);
+        model->priv->bsplit_parent_node = NULL;
+    }
+
+    for (snode = xaccTransGetSplitList (trans); snode; snode = snode->next)
+    {
+        if (xaccTransStillHasSplit (trans, snode->data))
+        {
+            iter = make_iter (model, SPLIT, tnode, snode);
+            delete_row_at (model, &iter);
+        }
+    }
+
+    iter = make_iter (model, TROW2, tnode, NULL);
+    delete_row_at (model, &iter);
+
+    iter = make_iter (model, TROW1, tnode, NULL);
+    delete_row_at (model, &iter);
+
+    model->priv->tlist = g_list_delete_link (model->priv->tlist, tnode);
+}
+
+
+/* Moves the blank split to 'trans' and remove old one. */
+gboolean
+gnc_tree_model_split_reg_set_blank_split_parent (GncTreeModelSplitReg *model, Transaction *trans)
+{
+    GList *tnode, *bs_parent_node;
+    GncTreeModelSplitRegPrivate *priv;
+    GtkTreeIter iter;
+    gboolean moved;
+
+    priv = model->priv;
+
+    if (trans == NULL)
+        tnode = g_list_last (priv->tlist);
+    else
+        tnode = g_list_find (priv->tlist, trans);
+
+g_print("gnc_tree_model_split_reg_set_blank_split_parent bsplit %p and trans %p\n", priv->bsplit, trans);
+
+//g_print("tnode pointer is %p\n", tnode);
+
+    bs_parent_node = priv->bsplit_parent_node;
+
+//g_print("bs_parent_node pointer is %p\n", bs_parent_node);
+
+    if (tnode != bs_parent_node)
+    {
+        moved = (bs_parent_node != NULL);
+        if (moved)
+        {
+            /* Delete the row where the blank split used to be. */
+            iter = make_iter (model, SPLIT | BLANK, bs_parent_node, priv->bsplit_node);
+            delete_row_at (model, &iter);
+            priv->bsplit_parent_node = NULL;
+        }
+        priv->bsplit_parent_node = tnode;
+        iter = make_iter (model, SPLIT | BLANK, tnode, priv->bsplit_node);
+        insert_row_at (model, &iter);
+        xaccSplitReinit (priv->bsplit); // set split back to default entries
+    } else
+        moved = FALSE;
+
+    return moved;
+}
+
+
+static void
+make_new_blank_split (GncTreeModelSplitReg *model)
+{
+    GtkTreeIter iter;
+    Split *split;
+    GList *tnode = model->priv->bsplit_parent_node;
+
+//g_print("make_new_blank_split");
+
+    split = xaccMallocSplit (model->priv->book);
+    model->priv->bsplit = split;
+    model->priv->bsplit_node->data = model->priv->bsplit;
+
+//g_print(" new bsplit is %p\n", split);
+
+
+    /* Insert the new row */
+    iter = make_iter (model, BLANK|SPLIT, tnode, model->priv->bsplit_node);
+    insert_row_at (model, &iter);
+}
+
+
+/* Turn the current blank split into a real split.  This function is
+ * never called in response to an engine event.  Instead, this
+ * function is called from the treeview to tell the model to commit
+ * the blank split.
+ */
+static void
+gnc_tree_model_split_reg_commit_blank_split (GncTreeModelSplitReg *model)
+{
+    Split *bsplit;
+    Transaction *trans;
+    GList *tnode, *snode;
+    GtkTreeIter iter;
+
+g_print("gnc_tree_model_split_reg_commit_blank_split\n");
+
+    tnode = model->priv->bsplit_parent_node;
+    bsplit = model->priv->bsplit;
+
+    if (!tnode || !tnode->data) {
+        PERR("blank split has no trans");
+        return;
+    }
+    trans = tnode->data;
+    if (xaccTransGetSplitIndex (trans, bsplit) == -1) {
+        PINFO("blank split has been removed from this trans");
+        return;
+    }
+    snode = g_list_find (xaccTransGetSplitList (trans), bsplit);
+    if (!snode) {
+        PERR("Failed to turn blank split into real split");
+        return;
+    }
+
+//    if (xaccSplitGetAccount (bsplit) == NULL) //FIXME this would make sure we have an account, not sure its valid.
+//        xaccTransScrubOrphans (trans);
+
+    /* If we haven't set an amount yet, and there's an imbalance, use that. */
+    if (gnc_numeric_zero_p (xaccSplitGetAmount (bsplit)))
+    {
+        gnc_numeric imbal = gnc_numeric_neg (xaccTransGetImbalanceValue (trans));
+        if (!gnc_numeric_zero_p (imbal))
+        {
+            gnc_numeric amount, rate;
+            Account *acct = xaccSplitGetAccount (bsplit);
+            xaccSplitSetValue (bsplit, imbal);
+            if (gnc_commodity_equal (xaccAccountGetCommodity (acct), xaccTransGetCurrency (trans)))
+                amount = imbal;
+            else
+           {
+                rate = xaccTransGetAccountConvRate (trans, acct);
+                amount = gnc_numeric_mul (imbal, rate, xaccAccountGetCommoditySCU (acct), GNC_HOW_RND_ROUND);
+            }
+            if (gnc_numeric_check (amount) == GNC_ERROR_OK)
+                xaccSplitSetAmount (bsplit, amount);
+        }
+    }
+    /* Mark the old blank split as changed */
+    iter = make_iter (model, SPLIT, tnode, snode);
+    changed_row_at (model, &iter);
+    make_new_blank_split (model);
+}
+
+
+void
+gnc_tree_model_split_reg_commit_split (GncTreeModelSplitReg *model, Split *split)
+{
+g_print("gnc_tree_model_split_reg_commit_split %p\n", split);
+    if (split == model->priv->bsplit)
+        gnc_tree_model_split_reg_commit_blank_split (model);
+}
+
+
+/* Returns just the path to the transaction if idx_of_split is -1. */
+static GtkTreePath *
+get_removal_path (GncTreeModelSplitReg *model, Transaction *trans,
+                 gint idx_of_split)
+{
+    GncTreeModelSplitRegPrivate *priv;
+    GList *tnode = NULL;
+    GtkTreeIter iter;
+    GtkTreePath *path;
+
+//g_print("get_removal_path trans is %p idx of split is %d\n", trans, idx_of_split);
+
+    g_return_val_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (model), NULL);
+    g_return_val_if_fail (trans, NULL);
+
+    priv = model->priv;
+    if (priv->book != xaccTransGetBook (trans)) return FALSE;
+
+    tnode = g_list_find (priv->tlist, trans);
+    if (!tnode) return FALSE;
+
+    iter = make_iter (model, TROW1, tnode, NULL); // TROW1
+    path = gnc_tree_model_split_reg_get_path (GTK_TREE_MODEL (model), &iter);
+
+    if (idx_of_split >= 0)
+    {
+        gtk_tree_path_append_index (path, 0); // TROW2
+        gtk_tree_path_append_index (path, idx_of_split); //SPLIT
+    }
+    else if (idx_of_split != -1)
+        PERR("Invalid idx_of_split");
+
+//g_print("get_removal_path - Return Path is '%s'\n", gtk_tree_path_to_string (path));
+
+    return path;
+}
+
+
+
+
+/*###################################################################*/
+/* Combo and Autocompletion ListStore functions */
+
+
 Account *
-gnc_tree_model_split_reg_get_anchor(GncTreeModelSplitReg *model)
+gnc_tree_model_split_reg_get_anchor (GncTreeModelSplitReg *model)
 {
     g_return_val_if_fail(GNC_IS_TREE_MODEL_SPLIT_REG(model), NULL);
     return model->priv->anchor;
@@ -1147,7 +1865,7 @@
 
 
 GtkListStore *
-gnc_tree_model_split_reg_get_description_list(GncTreeModelSplitReg *model)
+gnc_tree_model_split_reg_get_description_list (GncTreeModelSplitReg *model)
 {
     g_return_val_if_fail(GNC_IS_TREE_MODEL_SPLIT_REG(model), NULL);
     return model->priv->description_list;
@@ -1155,7 +1873,7 @@
 
 
 GtkListStore *
-gnc_tree_model_split_reg_get_notes_list(GncTreeModelSplitReg *model)
+gnc_tree_model_split_reg_get_notes_list (GncTreeModelSplitReg *model)
 {
     g_return_val_if_fail(GNC_IS_TREE_MODEL_SPLIT_REG(model), NULL);
     return model->priv->notes_list;
@@ -1163,7 +1881,7 @@
 
 
 GtkListStore *
-gnc_tree_model_split_reg_get_memo_list(GncTreeModelSplitReg *model)
+gnc_tree_model_split_reg_get_memo_list (GncTreeModelSplitReg *model)
 {
     g_return_val_if_fail(GNC_IS_TREE_MODEL_SPLIT_REG(model), NULL);
     return model->priv->memo_list;
@@ -1171,7 +1889,7 @@
 
 
 GtkListStore *
-gnc_tree_model_split_reg_get_numact_list(GncTreeModelSplitReg *model)
+gnc_tree_model_split_reg_get_numact_list (GncTreeModelSplitReg *model)
 {
     g_return_val_if_fail(GNC_IS_TREE_MODEL_SPLIT_REG(model), NULL);
     return model->priv->numact_list;
@@ -1180,7 +1898,7 @@
 
 /* Return TRUE if string all ready exists in the list */
 static gboolean
-check_for_duplicates(GtkListStore *liststore, const gchar *string)
+gtm_check_for_duplicates (GtkListStore *liststore, const gchar *string)
 {
     GtkTreeIter iter;
     gboolean valid;
@@ -1192,7 +1910,7 @@
         // Walk through the list, reading each row
         gtk_tree_model_get (GTK_TREE_MODEL (liststore), &iter, 0, &text, -1);
 
-        if(!(g_strcmp0(text, string)))
+        if(!(g_strcmp0 (text, string)))
         {
             g_free(text);
             return TRUE;
@@ -1205,14 +1923,11 @@
 }
 
 
-
 /* Create the Auto Complete List Stores.... */
-static void
-create_completion_models(GncTreeModelSplitReg *model)
+void
+gnc_tree_model_split_reg_update_completion (GncTreeModelSplitReg *model)
 {
-
     GncTreeModelSplitRegPrivate *priv;
-    GtkListStore *description_list, *notes_list, *memo_list, *num_list;
     GtkTreeIter d_iter, n_iter, m_iter, num_iter;
     GList *tlist, *tnode, *slist, *snode;
     int cnt, nSplits;
@@ -1220,10 +1935,11 @@
     priv = model->priv;
     tlist = priv->tlist;
 
-    description_list = gtk_list_store_new(1, G_TYPE_STRING);
-    notes_list = gtk_list_store_new(1, G_TYPE_STRING);
-    memo_list = gtk_list_store_new(1, G_TYPE_STRING);
-    num_list = gtk_list_store_new(1, G_TYPE_STRING);
+    /* Clear the liststores */
+    gtk_list_store_clear (priv->description_list);
+    gtk_list_store_clear (priv->notes_list);
+    gtk_list_store_clear (priv->num_list);
+    gtk_list_store_clear (priv->memo_list);
 
     for (tnode = tlist; tnode; tnode = tnode->next)
     {
@@ -1233,39 +1949,39 @@
 
         trans = tnode->data;
 
-        nSplits = xaccTransCountSplits(trans);
-        slist = xaccTransGetSplitList(trans);
+        nSplits = xaccTransCountSplits (trans);
+        slist = xaccTransGetSplitList (trans);
     
         /* Add to the Description list */
-        string = xaccTransGetDescription(trans);
-        if(g_strcmp0(string, ""))
+        string = xaccTransGetDescription (trans);
+        if(g_strcmp0 (string, ""))
         {
-            if(check_for_duplicates(description_list, string) == FALSE)
+            if(gtm_check_for_duplicates (priv->description_list, string) == FALSE)
             {
-                gtk_list_store_append(description_list, &d_iter);
-                gtk_list_store_set(description_list, &d_iter, 0, string , -1);
+                gtk_list_store_append (priv->description_list, &d_iter);
+                gtk_list_store_set (priv->description_list, &d_iter, 0, string , -1);
             }
         }
 
         /* Add to the Notes list */
-        string = xaccTransGetNotes(trans);
-        if(g_strcmp0(string, ""))
+        string = xaccTransGetNotes (trans);
+        if(g_strcmp0 (string, ""))
         {
-            if(check_for_duplicates(notes_list, string) == FALSE)
+            if(gtm_check_for_duplicates (priv->notes_list, string) == FALSE)
             {
-                gtk_list_store_append(notes_list, &n_iter);
-                gtk_list_store_set(notes_list, &n_iter, 0, string, -1);
+                gtk_list_store_append (priv->notes_list, &n_iter);
+                gtk_list_store_set (priv->notes_list, &n_iter, 0, string, -1);
             }
         }
 
         /* Add to the Num list */
-        string = xaccTransGetNum(trans);
-        if(g_strcmp0(string, ""))
+        string = xaccTransGetNum (trans);
+        if(g_strcmp0 (string, ""))
         {
-            if(check_for_duplicates(num_list, string) == FALSE)
+            if(gtm_check_for_duplicates (priv->num_list, string) == FALSE)
             {
-                gtk_list_store_prepend(num_list, &num_iter);
-                gtk_list_store_set(num_list, &num_iter, 0, string, -1);
+                gtk_list_store_prepend (priv->num_list, &num_iter);
+                gtk_list_store_set (priv->num_list, &num_iter, 0, string, -1);
             }
         }
 
@@ -1277,85 +1993,43 @@
             split = snode->data;
 
             /* Add to the Memo list */
-            string = xaccSplitGetMemo(split);
-            if(g_strcmp0(string, ""))
+            string = xaccSplitGetMemo (split);
+            if(g_strcmp0 (string, ""))
             {
-                if(check_for_duplicates(memo_list, string) == FALSE)
+                if(gtm_check_for_duplicates (priv->memo_list, string) == FALSE)
                 {
-                    gtk_list_store_append(memo_list, &m_iter);
-                    gtk_list_store_set(memo_list, &m_iter, 0, string, -1);
+                    gtk_list_store_append (priv->memo_list, &m_iter);
+                    gtk_list_store_set (priv->memo_list, &m_iter, 0, string, -1);
                 }
             }
             cnt++;
             snode = snode->next;
          }
     }
-
-    priv->description_list = description_list;
-    priv->notes_list = notes_list;
-    priv->memo_list = memo_list;
-    priv->num_list = num_list;
-    priv->numact_list = gtk_list_store_new(1, G_TYPE_STRING);
 }
 
 
-/* Update the model with entries for the Number field ... */
+/* Update the model with entries for the Action field */
 void
-gnc_tree_model_split_reg_get_num_list(GncTreeModelSplitReg *model)
+gnc_tree_model_split_reg_get_action_list (GncTreeModelSplitReg *model)
 {
     GncTreeModelSplitRegPrivate *priv;
-    GtkListStore *store, *num_list;
-    GtkTreeIter iter, num_iter;
-    gboolean valid;
-
-    priv = model->priv;
-
-    store = priv->numact_list;
-    num_list = priv->num_list;
-
-    /* Clear the liststore */
-    gtk_list_store_clear (store);
-
-    valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (num_list), &num_iter);
-    while (valid)
-    {
-        gchar *text;
-
-        // Walk through the list, reading each row
-        gtk_tree_model_get (GTK_TREE_MODEL (num_list), &num_iter, 0, &text, -1);
-
-        gtk_list_store_append (store, &iter);
-        gtk_list_store_set (store, &iter, 0, text, -1);
-        g_free(text);
-
-        valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (num_list), &num_iter);
-    }
-    priv->numact_list = store;
-}
-
-
-/* Update the model with entries for the Action field ... */
-void
-gnc_tree_model_split_reg_get_action_list(GncTreeModelSplitReg *model)
-{
-    GncTreeModelSplitRegPrivate *priv;
     GtkListStore *store;
     GtkTreeIter iter;
 
     priv = model->priv;
     store = priv->numact_list;
 
+//FIXME This may need more thought ???
+
     /* Clear the liststore */
     gtk_list_store_clear (store);
 
-/*FIXME This is a temp hack to give a value, this would come from ledger ? */
-    model->type = CREDIT_REGISTER2;
-
     /* setup strings in the action pull-down */
     switch (model->type)
     {
     case BANK_REGISTER2:
-        /* broken ! FIXME bg */
+        /* broken ! FIXME bg ????????? What is broken */
     case SEARCH_LEDGER2:
 
         /* Translators: This string has a context prefix; the translation
@@ -1376,7 +2050,7 @@
         gtk_list_store_insert_with_values (store, &iter, 100, 0, _("POS"), -1);
         gtk_list_store_insert_with_values (store, &iter, 100, 0, _("Phone"), -1);
         gtk_list_store_insert_with_values (store, &iter, 100, 0, _("Online"), -1);
-        /* Action: Automatic Deposit ?!? */
+        /* Action: Automatic Deposit */
         gtk_list_store_insert_with_values (store, &iter, 100, 0, _("AutoDep"), -1);
         gtk_list_store_insert_with_values (store, &iter, 100, 0, _("Wire"), -1);
         gtk_list_store_insert_with_values (store, &iter, 100, 0, _("Credit"), -1);
@@ -1474,9 +2148,39 @@
 }
 
 
+/* Update the model with entries for the Number field ... */
+void
+gnc_tree_model_split_reg_get_num_list (GncTreeModelSplitReg *model)
+{
+    GncTreeModelSplitRegPrivate *priv;
+    GtkTreeIter iter, num_iter;
+    gboolean valid;
+
+    priv = model->priv;
+
+    /* Clear the liststore */
+    gtk_list_store_clear (priv->numact_list);
+
+    /* Here we copy the num_list to the numact_list */
+    valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->num_list), &num_iter);
+    while (valid)
+    {
+        gchar *text;
+
+        // Walk through the list, reading each row
+        gtk_tree_model_get (GTK_TREE_MODEL (priv->num_list), &num_iter, 0, &text, -1);
+        gtk_list_store_append (priv->numact_list, &iter);
+        gtk_list_store_set (priv->numact_list, &iter, 0, text, -1);
+        g_free (text);
+
+        valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->num_list), &num_iter);
+    }
+}
+
+
 /* Return the GtkListstore of Accounts */
 GtkListStore *
-gnc_tree_model_split_reg_get_acct_list(GncTreeModelSplitReg *model)
+gnc_tree_model_split_reg_get_acct_list (GncTreeModelSplitReg *model)
 {
     GncTreeModelSplitRegPrivate *priv;
     Account *root;
@@ -1491,26 +2195,26 @@
     priv = model->priv;
 
     /* Store is short name, full name and account pointer */
-    store = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER );
+    store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER );
 
-    root = gnc_book_get_root_account( gnc_get_current_book());
+    root = gnc_book_get_root_account (gnc_get_current_book());
 /*FIXME This does not look sorted to me, need to look at this */
-    accts = gnc_account_get_descendants_sorted( root );
+    accts = gnc_account_get_descendants_sorted (root);
 
-    for (ptr = accts, i = 0; ptr; ptr = g_list_next(ptr), i++)
+    for (ptr = accts, i = 0; ptr; ptr = g_list_next (ptr), i++)
     {
         acc = ptr->data;
 
         if(!(acc == model->priv->anchor))
         {
-            fname = gnc_account_get_full_name(acc);
-            name = xaccAccountGetName(acc);
-            gtk_list_store_append(store, &iter);
-            gtk_list_store_set(store, &iter, 0, name, 1, fname, 2, acc, -1);
+            fname = gnc_account_get_full_name (acc);
+            name = xaccAccountGetName (acc);
+            gtk_list_store_append (store, &iter);
+            gtk_list_store_set (store, &iter, 0, name, 1, fname, 2, acc, -1);
         }
     }
 
-    g_list_free( accts );
+    g_list_free (accts);
 
     return store;
 }
@@ -1556,7 +2260,7 @@
 {
     GncTreeModelSplitRegPrivate *priv = model->priv;
     GncEventData *ed = event_data;
-    GtkTreeIter iter;
+    GtkTreeIter iter1, iter2;
     GtkTreePath *path;
     Transaction *trans;
     Split *split = NULL;
@@ -1564,55 +2268,147 @@
     const gchar *name = NULL;
     GList *tnode;
 
-    g_return_if_fail(GNC_IS_TREE_MODEL_SPLIT_REG(model));
+    g_return_if_fail (GNC_IS_TREE_MODEL_SPLIT_REG (model));
 
-    if (qof_instance_get_book(entity) != priv->book)
+g_print("\n\n--gnc_tree_model_split_reg_event_handler\n");
+
+    if (qof_instance_get_book (entity) != priv->book)
         return;
     type = entity->e_type;
 
-    if (g_strcmp0(type, GNC_ID_SPLIT) == 0) {
+    if (g_strcmp0 (type, GNC_ID_SPLIT) == 0)
+    {
         /* Get the split.*/
         split = (Split *) entity;
+        name = xaccSplitGetMemo (split);
 
-        switch (event_type) {
+        switch (event_type)
+        {
         case QOF_EVENT_MODIFY:
-
+g_print("--gnc_tree_model_split_reg_event_handler - Modify Split\n");
+            if (get_iter (model, NULL, split, &iter1, &iter2))
+            {
+//g_print("--Change model %p split %p\n", model, split); //works
+                DEBUG ("change split %p (%s)", split, name);
+                changed_row_at (model, &iter1);
+            }
             break;
         default:
-            DEBUG("ignored event for %p (%s)", split, name);
+            DEBUG ("ignored event for %p (%s)", split, name);
         }
-    } else if (g_strcmp0(type, GNC_ID_TRANS) == 0) {
+    }
+    else if (g_strcmp0(type, GNC_ID_TRANS) == 0)
+    {
         /* Get the trans.*/
         trans = (Transaction *) entity;
+        name = xaccTransGetDescription (trans);
 
-        switch (event_type) {
+        switch (event_type)
+        {
         case GNC_EVENT_ITEM_ADDED:
+g_print("--gnc_tree_model_split_reg_event_handler - Add Split\n");
             split = (Split *) ed->node;
+            /* The blank split will be added to the transaction when
+               it's first edited.  That will generate an event, but
+               we don't want to emit row_inserted because we were
+               already showing the blank split. */
+            if (split == priv->bsplit) break;
 
+            if (xaccTransCountSplits (trans) < 2) break;
 
+            /* Tell the filters/views where the new row was added. */
+            if (get_iter (model, trans, split, &iter1, &iter2))
+            {
+//g_print("--Insert model %p split %p\n", model, split); //works
+                DEBUG ("add split %p (%s)", split, name);
+                insert_row_at (model, &iter1);
+            }
             break;
         case GNC_EVENT_ITEM_REMOVED:
+g_print("--gnc_tree_model_split_reg_event_handler - Remove Split\n");
             split = (Split *) ed->node;
 
-
+            path = get_removal_path (model, trans, ed->idx);
+            if (path)
+            {
+//g_print("--Delete model %p split %p\n", model, split); //works
+                DEBUG ("remove split %p from trans %p (%s)", split, trans, name);
+                if (ed->idx == -1)
+                    delete_trans (model, trans); //Not sure when this would be so
+                else
+                    delete_row_at_path (model, path);
+                gtk_tree_path_free (path);
+            }
+            if (split == priv->bsplit)
+                make_new_blank_split (model);
             break;
         case QOF_EVENT_MODIFY:
+g_print("--gnc_tree_model_split_reg_event_handler - Modify Trans\n");
+            /* The blank trans won't emit MODIFY until it's committed */
+            if (priv->btrans == trans)
+            {
+                priv->btrans = xaccMallocTransaction (priv->book);
+                priv->tlist = g_list_append (priv->tlist, priv->btrans);
 
+                tnode = g_list_find (priv->tlist, priv->btrans);
+//g_print("--Insert model %p Blank trans %p\n", model, priv->btrans); //works
+                /* Insert a new blank trans */
+                iter1 = make_iter (model, TROW1 | BLANK, tnode, NULL);
+                insert_row_at (model, &iter1);
+                iter2 = make_iter (model, TROW2 | BLANK, tnode, NULL);
+                insert_row_at (model, &iter2);
+            }
 
+            if (get_iter (model, trans, NULL, &iter1, &iter2))
+            {
+//g_print("--Change model %p trans %p\n", model, trans); //works
+                DEBUG ("change trans %p (%s)", trans, name);
+                changed_row_at (model, &iter1);
+                changed_row_at (model, &iter2);
+            }
+
             break;
         case QOF_EVENT_DESTROY:
-
-
+g_print("--gnc_tree_model_split_reg_event_handler - Destroy Trans\n");
+            if (priv->btrans == trans)
+            {
+                tnode = g_list_find (priv->tlist, priv->btrans);
+                priv->btrans = xaccMallocTransaction (priv->book);
+                tnode->data = priv->btrans;
+g_print("--Change blank trans %p\n",priv->btrans); // Not sure this is ever used
+                iter1 = make_iter (model, TROW1 | BLANK, tnode, NULL);
+                changed_row_at (model, &iter1);
+                iter2 = make_iter (model, TROW2 | BLANK, tnode, NULL);
+                changed_row_at (model, &iter2);
+            }
+            else if (get_iter (model, trans, NULL, &iter1, &iter2))
+            {
+//g_print("--Delete model %p trans %p\n", model, trans); //works
+                delete_trans (model, trans);
+                DEBUG("destroy trans %p (%s)", trans, name);
+            }
             break;
         default:
             DEBUG("ignored event for %p (%s)", trans, name);
         }
-    } else if (g_strcmp0(type, GNC_ID_ACCOUNT) == 0) {
-        switch (event_type) {
+    }
+    else if (g_strcmp0 (type, GNC_ID_ACCOUNT) == 0)
+    {
+        switch (event_type)
+        {
             Account *acc;
         case GNC_EVENT_ITEM_ADDED:
+g_print("--gnc_tree_model_split_reg_event_handler - Add Account\n");
             split = (Split *) ed;
-
+            acc = xaccSplitGetAccount (split);
+            trans = xaccSplitGetParent (split);
+            if (!g_list_find (priv->tlist, trans) &&
+                ((xaccAccountHasAncestor (acc, priv->anchor) &&
+                  priv->include_subacc) || acc == priv->anchor))
+            {
+//g_print("--Insert model %p trans %p\n", model, trans); //works
+                insert_trans (model, trans);
+            }
             break;
         default:
             ;
Index: src/gnome-utils/gnc-tree-model-split-reg.h
===================================================================
--- src/gnome-utils/gnc-tree-model-split-reg.h	(revision 22433)
+++ src/gnome-utils/gnc-tree-model-split-reg.h	(working copy)
@@ -30,9 +30,10 @@
 
 #include <gtk/gtk.h>
 #include "gnc-tree-model.h"
-
 #include "Query.h"
 
+
+
 G_BEGIN_DECLS
 
 /* type macros */
@@ -51,80 +52,97 @@
  * "ledgers" are multiple-account display windows */
 typedef enum
 {
-    BANK_REGISTER2,
-    CASH_REGISTER2,
-    ASSET_REGISTER2,
-    CREDIT_REGISTER2,
-    LIABILITY_REGISTER2,
-    INCOME_REGISTER2,
-    EXPENSE_REGISTER2,
-    EQUITY_REGISTER2,
-    STOCK_REGISTER2,
-    CURRENCY_REGISTER2,
-    RECEIVABLE_REGISTER2,
-    PAYABLE_REGISTER2,
-    TRADING_REGISTER2,
-    NUM_SINGLE_REGISTER_TYPES2,
+    BANK_REGISTER2,             //0
+    CASH_REGISTER2,             //1
+    ASSET_REGISTER2,            //2
+    CREDIT_REGISTER2,           //3
+    LIABILITY_REGISTER2,        //4
+    INCOME_REGISTER2,           //5
+    EXPENSE_REGISTER2,          //6
+    EQUITY_REGISTER2,           //7
+    STOCK_REGISTER2,            //8
+    CURRENCY_REGISTER2,         //9
+    RECEIVABLE_REGISTER2,       //10
+    PAYABLE_REGISTER2,          //11
+    TRADING_REGISTER2,          //12
+    NUM_SINGLE_REGISTER_TYPES2, //13
 
-    GENERAL_LEDGER2 = NUM_SINGLE_REGISTER_TYPES2,
-    INCOME_LEDGER2,
-    PORTFOLIO_LEDGER2,
-    SEARCH_LEDGER2,
+    GENERAL_LEDGER2 = NUM_SINGLE_REGISTER_TYPES2, //13
+    INCOME_LEDGER2,             //14
+    PORTFOLIO_LEDGER2,          //15
+    SEARCH_LEDGER2,             //16
 
-    NUM_REGISTER_TYPES2
+    NUM_REGISTER_TYPES2         //17
 } SplitRegisterType2;
 
+
 /** Register styles */
 typedef enum
 {
-    REG_STYLE_LEDGER2,
-    REG_STYLE_AUTO_LEDGER2,
-    REG_STYLE_JOURNAL2
+    REG2_STYLE_LEDGER,      //0
+    REG2_STYLE_AUTO_LEDGER, //1
+    REG2_STYLE_JOURNAL      //2
 } SplitRegisterStyle2;
 
 
 typedef enum
 {
-    GNC_TREE_MODEL_SPLIT_REG_COL_GUID,
-    GNC_TREE_MODEL_SPLIT_REG_COL_DATE,
-    GNC_TREE_MODEL_SPLIT_REG_COL_NUMACT,
-    GNC_TREE_MODEL_SPLIT_REG_COL_DESCNOTES,
-    GNC_TREE_MODEL_SPLIT_REG_COL_TRANSVOID,
+    GNC_TREE_MODEL_SPLIT_REG_COL_GUID,      //0
+    GNC_TREE_MODEL_SPLIT_REG_COL_DATE,      //1
+    GNC_TREE_MODEL_SPLIT_REG_COL_DUEDATE,   //2
+    GNC_TREE_MODEL_SPLIT_REG_COL_NUMACT,    //3
+    GNC_TREE_MODEL_SPLIT_REG_COL_DESCNOTES, //4
+    GNC_TREE_MODEL_SPLIT_REG_COL_TRANSVOID, //5
+    GNC_TREE_MODEL_SPLIT_REG_COL_RECN,      //6
 
-    GNC_TREE_MODEL_SPLIT_REG_COL_LAST_VISIBLE = GNC_TREE_MODEL_SPLIT_REG_COL_TRANSVOID,
+    GNC_TREE_MODEL_SPLIT_REG_COL_LAST_VISIBLE = GNC_TREE_MODEL_SPLIT_REG_COL_RECN, //6
 
     /* internal hidden columns */
-    GNC_TREE_MODEL_SPLIT_REG_COL_COLOR,
+    GNC_TREE_MODEL_SPLIT_REG_COL_COLOR,     //7
+    GNC_TREE_MODEL_SPLIT_REG_COL_RO,        //8
 
-    GNC_TREE_MODEL_SPLIT_REG_NUM_COLUMNS
+    GNC_TREE_MODEL_SPLIT_REG_NUM_COLUMNS    //9
 } GncTreeModelSplitRegColumn;
 
 /* typedefs & structures */
 typedef struct GncTreeModelSplitRegPrivate GncTreeModelSplitRegPrivate;
 
 /** The instance data structure for an account tree model. */
-typedef struct
+typedef struct 
 {
-    GncTreeModel gnc_tree_model;    /**< The parent object data. */
+    GncTreeModel                 gnc_tree_model;        /**< The parent object data. */
     GncTreeModelSplitRegPrivate *priv;
-    int stamp;                      /**< The state of the model. Any state
-                                     *   change increments this number. */
+    int                          stamp;                 /**< The state of the model. Any state change increments this number. */
 
-    SplitRegisterType2 type;       /* This may be the wrong place for these, may be the view ? */
-    SplitRegisterStyle2 style;
+    SplitRegisterType2           type;                  /**<FIXME ? This may be the wrong place for these, may be the view ? */
+    SplitRegisterStyle2          style;                 /**<FIXME ? This may be the wrong place for these, may be the view ? */
+    gboolean                     use_double_line;       /**<FIXME ? As above, whether to use two lines per transaction */
 
+    gboolean                     is_template;
 
-} GncTreeModelSplitReg;
+    gboolean                     do_auto_complete;      /**< whether to use auto-competion */
+    gboolean                     use_accounting_labels; /**< whether to use accounting Labels */
+    gboolean                     separator_changed;     /**< whether the separator has changed */ 
+    gboolean                     alt_colors_by_txn;     /**< whether to use alternative colors by transaction */ 
+    gboolean                     use_colors;            /**< whether to use theme colors */
 
+    gboolean                     read_only;             /**< register is read only */
 
+
+
+}GncTreeModelSplitReg;
+
+
 /** The class data structure for an account tree model. */
 typedef struct
 {
     GncTreeModelClass gnc_tree_model;   /**< The parent object data. */
 } GncTreeModelSplitRegClass;
 
+/** Callback function type */
+/*FIXME Not sure if this is needed or what it is for yet*/
+typedef GtkWidget *(*SRGetParentCallback2) (gpointer user_data);
 
-
 /** Get the type of split register tree plugin.
  *
  *  @return A GType.
@@ -132,65 +150,83 @@
 GType gnc_tree_model_split_reg_get_type (void);
 
 
-/** @name Split Register Tree Model Constructors
- @{ */
+GncTreeModelSplitReg *
+gnc_tree_model_split_reg_new (SplitRegisterType2 reg_type, SplitRegisterStyle2 style,
+                        gboolean use_double_line, gboolean is_template);
 
-/** Create a new GtkTreeModel for manipulating gnucash splits.
- *
- *  @param The Query
- */
-GncTreeModelSplitReg *gnc_tree_model_split_reg_new_from_account (Account *acc);
-/** @} */
 
-/** @name Split Register Tree Model Constructors
- @{ */
+void gnc_tree_model_split_reg_load (GncTreeModelSplitReg *model, GList * slist, Account *default_account);
 
-/** Create a new GtkTreeModel for manipulating gnucash splits.
- *
- *  @param The Query
- */
-GncTreeModelSplitReg *gnc_tree_model_split_reg_new_from_query (Query *query);
-/** @} */
+void gnc_tree_model_split_reg_set_template_account (GncTreeModelSplitReg *model, Account *template_account);
 
-/** Get the Account of GtkTreeModel.
- *
- *  @param The model
- */
-Account * gnc_tree_model_split_reg_get_anchor(GncTreeModelSplitReg *model);
-/** @} */
+void gnc_tree_model_split_reg_destroy (GncTreeModelSplitReg *model);
 
+/** Sets the user data and callback hooks for the register. */
+void gnc_tree_model_split_reg_set_data (GncTreeModelSplitReg *model, gpointer user_data,
+                                  SRGetParentCallback2 get_parent);
+
+void gnc_tree_model_split_reg_config (GncTreeModelSplitReg *model, SplitRegisterType2 newtype,
+                                      SplitRegisterStyle2 newstyle, gboolean use_double_line);
+
+Account * gnc_tree_model_split_reg_get_anchor (GncTreeModelSplitReg *model);
+
+void gnc_tree_model_split_reg_commit_split (GncTreeModelSplitReg *model, Split *split);
+
+/* These are to do with autocompletion */
 GtkListStore *
-gnc_tree_model_split_reg_get_description_list(GncTreeModelSplitReg *model);
+gnc_tree_model_split_reg_get_description_list (GncTreeModelSplitReg *model);
 
 GtkListStore *
-gnc_tree_model_split_reg_get_notes_list(GncTreeModelSplitReg *model);
+gnc_tree_model_split_reg_get_notes_list (GncTreeModelSplitReg *model);
 
 GtkListStore *
-gnc_tree_model_split_reg_get_memo_list(GncTreeModelSplitReg *model);
+gnc_tree_model_split_reg_get_memo_list (GncTreeModelSplitReg *model);
 
 GtkListStore *
-gnc_tree_model_split_reg_get_numact_list(GncTreeModelSplitReg *model);
+gnc_tree_model_split_reg_get_numact_list (GncTreeModelSplitReg *model);
 
 GtkListStore *
-gnc_tree_model_split_reg_get_acct_list(GncTreeModelSplitReg *model);
+gnc_tree_model_split_reg_get_acct_list (GncTreeModelSplitReg *model);
 
 void
-gnc_tree_model_split_reg_get_num_list(GncTreeModelSplitReg *model);
+gnc_tree_model_split_reg_get_num_list (GncTreeModelSplitReg *model);
 
 void
-gnc_tree_model_split_reg_get_action_list(GncTreeModelSplitReg *model);
+gnc_tree_model_split_reg_get_action_list (GncTreeModelSplitReg *model);
 
+void
+gnc_tree_model_split_reg_update_completion (GncTreeModelSplitReg *model);
 
+
+/* Get the split and transaction */
 gboolean
 gnc_tree_model_split_reg_get_split_and_trans (
     GncTreeModelSplitReg *model, GtkTreeIter *iter,
     gboolean *is_trow1, gboolean *is_trow2, gboolean *is_split,
     gboolean *is_blank, Split **split, Transaction **trans);
 
+/* Return FALSE if failure */
+gboolean 
+gnc_tree_model_split_reg_set_blank_split_parent (
+    GncTreeModelSplitReg *model, Transaction *trans);
 
+/* Return the blank split */
+Split *
+gnc_tree_model_split_get_blank_split (GncTreeModelSplitReg *model);
+
+
+/* If 'trans' is NULL, use split's parent.  If 'split' is NULL, just
+   get the transaction iter. */
+gboolean
+gnc_tree_model_split_reg_get_iter_from_trans_and_split (
+    GncTreeModelSplitReg *model, Transaction *trans, Split *split, 
+    GtkTreeIter *iter1, GtkTreeIter *iter2);
+
+
+/* Return the tree path, if split and trans are null, last in list returned */
+GtkTreePath *
+gnc_tree_model_split_reg_get_path_to_split_and_trans (GncTreeModelSplitReg *model, Split *split, Transaction *trans);
+
 G_END_DECLS
 
 #endif /* __GNC_TREE_MODEL_SPLIT_REG_H */
-
-/** @} */
-/** @} */
Index: src/gnome-utils/Makefile.am
===================================================================
--- src/gnome-utils/Makefile.am	(revision 22433)
+++ src/gnome-utils/Makefile.am	(working copy)
@@ -89,8 +89,8 @@
   gnc-tree-model-budget.c \
   gnc-tree-model-owner.c \
   gnc-tree-model-commodity.c \
+  gnc-tree-model-price.c \
   gnc-tree-model-split-reg.c \
-  gnc-tree-model-price.c \
   gnc-tree-view-account.c \
   gnc-tree-view-commodity.c \
   gnc-tree-view-owner.c \
Index: src/engine/Split.h
===================================================================
--- src/engine/Split.h	(revision 22433)
+++ src/engine/Split.h	(working copy)
@@ -342,9 +342,10 @@
 Split      * xaccSplitLookup (const GncGUID *guid, QofBook *book);
 #define      xaccSplitLookupDirect(g,b) xaccSplitLookup(&(g),b)
 
-
+/*################## Added for Reg2 #################*/
 /* Get a GList of unique transactions containing the given list of Splits. */
 GList *xaccSplitListGetUniqueTransactions(const GList *splits);
+/*################## Added for Reg2 #################*/
 
 /**
  * The xaccSplitGetOtherSplit() is a convenience routine that returns
Index: src/engine/Transaction.c
===================================================================
--- src/engine/Transaction.c	(revision 22433)
+++ src/engine/Transaction.c	(working copy)
@@ -990,6 +990,7 @@
     return total;
 }
 
+/*################## Added for Reg2 #################*/
 gboolean
 xaccTransGetRateForCommodity(const Transaction *trans,
                              const gnc_commodity *split_com,
@@ -1028,6 +1029,7 @@
     }
     return FALSE;
 }
+/*################## Added for Reg2 #################*/
 
 gnc_numeric
 xaccTransGetAccountConvRate(const Transaction *txn, const Account *acc)
@@ -2068,7 +2070,29 @@
     return result;
 }
 
+/*################## Added for Reg2 #################*/
 
+gboolean xaccTransInFutureByPostedDate (const Transaction *trans)
+{
+    GDate date_now;
+    GDate trans_date;
+    gboolean result;
+    g_assert(trans);
+
+    trans_date = xaccTransGetDatePostedGDate (trans);
+
+    g_date_set_time_t (&date_now, time(NULL));
+
+    if (g_date_compare (&trans_date, &date_now) > 0)
+        result = TRUE;
+    else
+        result = FALSE;
+
+    return result;
+}
+
+/*################## Added for Reg2 #################*/
+
 gboolean
 xaccTransHasReconciledSplitsByAccount (const Transaction *trans,
                                        const Account *account)
Index: src/engine/Transaction.h
===================================================================
--- src/engine/Transaction.h	(revision 22433)
+++ src/engine/Transaction.h	(working copy)
@@ -338,6 +338,13 @@
  * qof_book_uses_autofreeze() and qof_book_get_autofreeze_gdate(). */
 gboolean xaccTransIsReadonlyByPostedDate(const Transaction *trans);
 
+/*################## Added for Reg2 #################*/
+
+/** Returns TRUE if this Transaction's posted-date is in the future */
+gboolean xaccTransInFutureByPostedDate (const Transaction *trans);
+
+/*################## Added for Reg2 #################*/
+
 /** Returns the number of splits in this transaction. */
 int           xaccTransCountSplits (const Transaction *trans);
 
@@ -410,12 +417,14 @@
 gnc_numeric xaccTransGetAccountAmount (const Transaction *trans,
                                        const Account *account);
 
+/*################## Added for Reg2 #################*/
 /* Gets the amt/val rate, i.e. rate from the transaction currency to
    the 'split_com' */
 gboolean
 xaccTransGetRateForCommodity(const Transaction *trans,
                              const gnc_commodity *split_com,
                              const Split *split_to_exclude, gnc_numeric *rate);
+/*################## Added for Reg2 #################*/
 
 /* Compute the conversion rate for the transaction to this account.
  * Any "split value" (which is in the transaction currency),
Index: src/engine/Split.c
===================================================================
--- src/engine/Split.c	(revision 22433)
+++ src/engine/Split.c	(working copy)
@@ -660,30 +660,27 @@
 }
 
 
+/*################## Added for Reg2 #################*/
 /********************************************************************
  * xaccSplitListGetUniqueTransactions
  ********************************************************************/
-static void
-add_keys_to_list(gpointer key, gpointer val, gpointer list)
-{
-    *(GList **)list = g_list_prepend(*(GList **)list, key);
-}
-
 GList *
 xaccSplitListGetUniqueTransactions(const GList *splits)
 {
-    const GList *node;
+    const GList *snode;
     GList *transList = NULL;
-    GHashTable *transHash = g_hash_table_new(g_direct_hash, g_direct_equal);
 
-    for(node = splits; node; node = node->next) {
-        Transaction *trans = xaccSplitGetParent((Split *)(node->data));
-        g_hash_table_insert(transHash, trans, trans);
+    for(snode = splits; snode; snode = snode->next)
+    {
+        Transaction *trans = xaccSplitGetParent((Split *)(snode->data));
+
+        GList *item = g_list_find (transList, trans);
+        if (item == NULL)
+            transList = g_list_append (transList, trans);
     }
-    g_hash_table_foreach(transHash, add_keys_to_list, &transList);
-    g_hash_table_destroy(transHash);
     return transList;
 }
+/*################## Added for Reg2 #################*/
 
 
 /********************************************************************
Index: src/gnome/gnc-plugin-page-account-tree.c
===================================================================
--- src/gnome/gnc-plugin-page-account-tree.c	(revision 22433)
+++ src/gnome/gnc-plugin-page-account-tree.c	(working copy)
@@ -152,6 +152,7 @@
 
 /* Command callback for new Register Test */
 static void gnc_plugin_page_account_tree_cmd_open2_account (GtkAction *action, GncPluginPageAccountTree *page);
+static void gnc_plugin_page_account_tree_cmd_open2_subaccounts (GtkAction *action, GncPluginPageAccountTree *page);
 
 static guint plugin_page_signals[LAST_SIGNAL] = { 0 };
 
@@ -183,6 +184,11 @@
         N_("Open the New Register2 selected account"),
         G_CALLBACK (gnc_plugin_page_account_tree_cmd_open2_account)
     },
+    {
+        "FileOpenSubaccounts2Action", GNC_STOCK_OPEN_ACCOUNT, N_("Open New Register2 _SubAccount"), NULL,
+        N_("Open the New Register2 selected subaccounts"),
+        G_CALLBACK (gnc_plugin_page_account_tree_cmd_open2_subaccounts)
+    },
 #endif
     {
         "FileOpenSubaccountsAction", GNC_STOCK_OPEN_ACCOUNT, N_("Open _Subaccounts"), NULL,
@@ -800,26 +806,24 @@
 
 
 #ifdef REG2ENABLE
-/*#####################################################################*/
-/*                    New Register Common                              */
+/*################## Added for Reg2 #################*/
+/*        New Register Common                        */
 static void
 gppat_open2_account_common (GncPluginPageAccountTree *page,
                            Account *account,
                            gboolean include_subs)
 {
-    GncPluginPageAccountTreePrivate *priv;
     GtkWidget *window;
     GncPluginPage *new_page;
 
     if (account == NULL)
         return;
 
-    priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
     window = GNC_PLUGIN_PAGE (page)->window;
     new_page = gnc_plugin_page_register2_new (account, include_subs);
     gnc_main_window_open_page (GNC_MAIN_WINDOW(window), new_page);
 }
-/*######################################################################*/
+/*################## Added for Reg2 #################*/
 #endif
 
 static void
@@ -929,10 +933,21 @@
     gppat_open_account_common (page, account, FALSE);
 }
 
+static void
+gnc_plugin_page_account_tree_cmd_open_subaccounts (GtkAction *action,
+        GncPluginPageAccountTree *page)
+{
+    Account *account;
 
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE (page));
+    account = gnc_plugin_page_account_tree_get_current_account (page);
+    gppat_open_account_common (page, account, TRUE);
+}
+
+
 #ifdef REG2ENABLE
-/*#####################################################################*/
-/*          Register Firing - Single Account to start with             */
+/*################## Added for Reg2 #################*/
+/* Register Firing - Single Account to start with    */
 static void
 gnc_plugin_page_account_tree_cmd_open2_account (GtkAction *action,
         GncPluginPageAccountTree *page)
@@ -943,20 +958,21 @@
     account = gnc_plugin_page_account_tree_get_current_account (page);
     gppat_open2_account_common (page, account, FALSE);
 }
-/*#####################################################################*/
-#endif
 
 static void
-gnc_plugin_page_account_tree_cmd_open_subaccounts (GtkAction *action,
+gnc_plugin_page_account_tree_cmd_open2_subaccounts (GtkAction *action,
         GncPluginPageAccountTree *page)
 {
     Account *account;
 
     g_return_if_fail (GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE (page));
     account = gnc_plugin_page_account_tree_get_current_account (page);
-    gppat_open_account_common (page, account, TRUE);
+    gppat_open2_account_common (page, account, TRUE);
 }
+/*################## Added for Reg2 #################*/
+#endif
 
+
 static void
 gnc_plugin_page_account_tree_cmd_edit_account (GtkAction *action, GncPluginPageAccountTree *page)
 {
Index: src/gnome/gnc-split-reg2.c
===================================================================
--- src/gnome/gnc-split-reg2.c	(revision 0)
+++ src/gnome/gnc-split-reg2.c	(revision 0)
@@ -0,0 +1,2226 @@
+/********************************************************************\
+ * gnc-split-reg2.c -- 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>              *
+ * Copyright (C) 1999-2000 Dave Peticolas <dave@krondo.com>         *
+ * Copyright (C) 2001 Gnumatic, Inc.                                *
+ * Copyright (C) 2002,2006 Joshua Sled <jsled@asynchronous.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                   *
+\********************************************************************/
+
+#include "config.h"
+
+#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 <libguile.h>
+#include "dialog-utils.h"
+
+#define GCONF_SECTION "window/pages/register2"
+
+// static QofLogModule log_module = GNC_MOD_SX;
+static QofLogModule log_module = GNC_MOD_GUI;
+
+/***** PROTOTYPES ***************************************************/
+void gnc_split_reg2_raise( GNCSplitReg2 *gsr ); /*FIXME What this for */
+
+static GtkWidget* add_summary_label( GtkWidget *summarybar,
+                                     const char *label_str );
+
+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 void gsr2_create_table( GNCSplitReg2 *gsr );
+static void gsr2_setup_table( GNCSplitReg2 *gsr );
+
+
+
+static void gsr2_setup_status_widgets( GNCSplitReg2 *gsr );
+
+static void gsr2_update_summary_label( GtkWidget *label,
+                                      xaccGetBalanceFn getter,
+                                      Account *leader,
+                                      GNCPrintAmountInfo print_info,
+                                      gnc_commodity *cmdty,
+                                      gboolean reverse,
+                                      gboolean euroFlag );
+
+static void gsr2_redraw_all_cb (GncTreeViewSplitReg *view, gpointer data);
+
+static void gnc_split_reg2_refresh_toolbar( GNCSplitReg2 *gsr );
+
+static void gnc_split_reg2_ld_destroy( GNCLedgerDisplay2 *ledger );
+
+static Transaction* create_balancing_transaction(QofBook *book, Account *account,
+        time_t statement_date, gnc_numeric balancing_amount);
+
+void gsr2_default_enter_handler    ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_cancel_handler   ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_delete_handler   ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_reinit_handler   ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_dup_handler      ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_schedule_handler ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_expand_handler   ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_blank_handler    ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_jump_handler     ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_cut_handler      ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_cut_txn_handler  ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_copy_handler     ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_copy_txn_handler ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_paste_handler    ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_paste_txn_handler( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_void_txn_handler ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_unvoid_txn_handler  ( GNCSplitReg2 *w, gpointer ud );
+void gsr2_default_reverse_txn_handler ( GNCSplitReg2 *w, gpointer ud );
+
+static void gsr2_emit_simple_signal( GNCSplitReg2 *gsr, const char *sigName );
+/*FIXME static void gsr2_emit_help_changed( GncTreeViewSplitReg *view, gpointer user_data ); */
+static void gsr2_emit_include_date_signal( GNCSplitReg2 *gsr, time_t date );
+
+void gnc_split_reg2_cut_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg2_copy_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg2_paste_cb(GtkWidget *w, gpointer data);
+
+void gnc_split_reg2_cut_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg2_copy_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg2_paste_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg2_void_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg2_unvoid_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg2_reverse_trans_cb(GtkWidget *w, gpointer data);
+
+/*FIXME void gnc_split_reg2_record_cb (GncTreeViewSplitReg *view, gpointer data); */
+void gnc_split_reg2_reinitialize_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg2_delete_trans_cb(GtkWidget *w, gpointer data);
+void gnc_split_reg2_duplicate_trans_cb(GtkWidget *w, 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_cancel_trans_cb(GtkWidget *w, gpointer data);
+
+void gnc_split_reg2_expand_trans_menu_cb(GtkWidget *widget, gpointer data);
+void gnc_split_reg2_expand_trans_toolbar_cb(GtkWidget *widget, gpointer data);
+void gnc_split_reg2_new_trans_cb(GtkWidget *widget, gpointer data);
+void gnc_split_reg2_jump_cb(GtkWidget *widget, 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_sort_standard_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg2_sort_date_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg2_sort_date_entered_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg2_sort_date_reconciled_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg2_sort_num_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg2_sort_amount_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg2_sort_memo_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg2_sort_desc_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg2_sort_action_cb (GtkWidget *w, gpointer data);
+void gnc_split_reg2_sort_notes_cb (GtkWidget *w, gpointer data);
+
+void gnc_split_reg2_destroy_cb(GtkWidget *widget, gpointer data);
+void gnc_split_reg2_size_allocate( GtkWidget *widget,
+                                  GtkAllocation *allocation,
+                                  gpointer user_data );
+
+
+void gnc_split_reg2_handle_exchange_cb (GtkWidget *w, gpointer data);
+
+static void gnc_split_reg2_class_init( GNCSplitReg2Class *class );
+static void gnc_split_reg2_init( GNCSplitReg2 *gsr );
+static void gnc_split_reg2_init2( GNCSplitReg2 *gsr );
+
+void gnc_split_register_size_allocate (GtkWidget *widget,
+                                       GtkAllocation *allocation,
+                                       gpointer user_data);
+
+#ifdef SKIP
+FROM_STRING_FUNC(SortType, ENUM_LIST_SORTTYPE)
+AS_STRING_FUNC(SortType, ENUM_LIST_SORTTYPE)
+#endif
+
+GType
+gnc_split_reg2_get_type( void )
+{
+    static GType gnc_split_reg2_type = 0;
+
+    if (!gnc_split_reg2_type)
+    {
+        GTypeInfo type_info =
+        {
+            sizeof(GNCSplitReg2Class),      /* class_size */
+            NULL,   			/* base_init */
+            NULL,				/* base_finalize */
+            (GClassInitFunc)gnc_split_reg2_class_init,
+            NULL,				/* class_finalize */
+            NULL,				/* class_data */
+            sizeof(GNCSplitReg2),		/* */
+            0,				/* n_preallocs */
+            (GInstanceInitFunc)gnc_split_reg2_init,
+        };
+
+        gnc_split_reg2_type = g_type_register_static( GTK_TYPE_VBOX,
+                             "GNCSplitReg2",
+                             &type_info, 0 );
+    }
+
+    return gnc_split_reg2_type;
+}
+
+/* SIGNALS */
+enum gnc_split_reg2_signal_enum
+{
+    ENTER_ENT_SIGNAL,
+    CANCEL_ENT_SIGNAL,
+    DELETE_ENT_SIGNAL,
+    REINIT_ENT_SIGNAL,
+    DUP_ENT_SIGNAL,
+    SCHEDULE_ENT_SIGNAL,
+    EXPAND_ENT_SIGNAL,
+    BLANK_SIGNAL,
+    JUMP_SIGNAL,
+    CUT_SIGNAL,
+    CUT_TXN_SIGNAL,
+    COPY_SIGNAL,
+    COPY_TXN_SIGNAL,
+    PASTE_SIGNAL,
+    PASTE_TXN_SIGNAL,
+    VOID_TXN_SIGNAL,
+    UNVOID_TXN_SIGNAL,
+    REVERSE_TXN_SIGNAL,
+    HELP_CHANGED_SIGNAL,
+    INCLUDE_DATE_SIGNAL,
+    LAST_SIGNAL
+};
+
+static guint gnc_split_reg2_signals[LAST_SIGNAL] = { 0 };
+
+static void
+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[] =
+    {
+        { ENTER_ENT_SIGNAL,    "enter_ent",    G_STRUCT_OFFSET( GNCSplitReg2Class, enter_ent_cb ) },
+        { CANCEL_ENT_SIGNAL,   "cancel_ent",   G_STRUCT_OFFSET( GNCSplitReg2Class, cancel_ent_cb ) },
+        { DELETE_ENT_SIGNAL,   "delete_ent",   G_STRUCT_OFFSET( GNCSplitReg2Class, delete_ent_cb ) },
+        { REINIT_ENT_SIGNAL,   "reinit_ent",   G_STRUCT_OFFSET( GNCSplitReg2Class, reinit_ent_cb ) },
+        { DUP_ENT_SIGNAL,      "dup_ent",      G_STRUCT_OFFSET( GNCSplitReg2Class, dup_ent_cb ) },
+        { SCHEDULE_ENT_SIGNAL, "schedule_ent", G_STRUCT_OFFSET( GNCSplitReg2Class, schedule_ent_cb ) },
+        { EXPAND_ENT_SIGNAL,   "expand_ent",   G_STRUCT_OFFSET( GNCSplitReg2Class, expand_ent_cb ) },
+        { BLANK_SIGNAL,        "blank",        G_STRUCT_OFFSET( GNCSplitReg2Class, blank_cb ) },
+        { JUMP_SIGNAL,         "jump",         G_STRUCT_OFFSET( GNCSplitReg2Class, jump_cb ) },
+        { CUT_SIGNAL,          "cut",          G_STRUCT_OFFSET( GNCSplitReg2Class, cut_cb ) },
+        { CUT_TXN_SIGNAL,      "cut_txn",      G_STRUCT_OFFSET( GNCSplitReg2Class, cut_txn_cb ) },
+        { COPY_SIGNAL,         "copy",         G_STRUCT_OFFSET( GNCSplitReg2Class, copy_cb ) },
+        { COPY_TXN_SIGNAL,     "copy_txn",     G_STRUCT_OFFSET( GNCSplitReg2Class, copy_txn_cb ) },
+        { PASTE_SIGNAL,        "paste",        G_STRUCT_OFFSET( GNCSplitReg2Class, paste_cb ) },
+        { PASTE_TXN_SIGNAL,    "paste_txn",    G_STRUCT_OFFSET( GNCSplitReg2Class, paste_txn_cb ) },
+        { VOID_TXN_SIGNAL,     "void_txn",     G_STRUCT_OFFSET( GNCSplitReg2Class, void_txn_cb ) },
+        { UNVOID_TXN_SIGNAL,   "unvoid_txn",   G_STRUCT_OFFSET( GNCSplitReg2Class, unvoid_txn_cb ) },
+        { REVERSE_TXN_SIGNAL,  "reverse_txn",  G_STRUCT_OFFSET( GNCSplitReg2Class, reverse_txn_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, /* time_t == int */
+                      G_TYPE_NONE, 1, G_TYPE_INT );
+
+    g_assert( i == LAST_SIGNAL );
+
+    /* Setup the default handlers. */
+    class->enter_ent_cb    = gsr2_default_enter_handler;
+    class->cancel_ent_cb   = gsr2_default_cancel_handler;
+    class->delete_ent_cb   = gsr2_default_delete_handler;
+    class->reinit_ent_cb   = gsr2_default_reinit_handler;
+    class->dup_ent_cb      = gsr2_default_dup_handler;
+    class->schedule_ent_cb = gsr2_default_schedule_handler;
+    class->expand_ent_cb   = gsr2_default_expand_handler;
+    class->blank_cb        = gsr2_default_blank_handler;
+    class->jump_cb         = gsr2_default_jump_handler;
+    class->cut_cb          = gsr2_default_cut_handler;
+    class->cut_txn_cb      = gsr2_default_cut_txn_handler;
+    class->copy_cb         = gsr2_default_copy_handler;
+    class->copy_txn_cb     = gsr2_default_copy_txn_handler;
+    class->paste_cb        = gsr2_default_paste_handler;
+    class->paste_txn_cb    = gsr2_default_paste_txn_handler;
+    class->void_txn_cb     = gsr2_default_void_txn_handler;
+    class->unvoid_txn_cb   = gsr2_default_unvoid_txn_handler;
+    class->reverse_txn_cb  = gsr2_default_reverse_txn_handler;
+
+    class->help_changed_cb = NULL;
+    class->include_date_cb = NULL;
+}
+
+GtkWidget*
+gnc_split_reg2_new( GNCLedgerDisplay2 *ld,
+                   GtkWindow *parent,
+                   gint numberOfLines,
+                   gboolean read_only )
+{
+    GNCSplitReg2 *gsrToRet;
+
+    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->numRows        = numberOfLines;
+    gsrToRet->read_only      = read_only;
+
+    gsrToRet->ledger = ld;
+    gsrToRet->window = GTK_WIDGET(parent);
+
+    gnc_split_reg2_init2( gsrToRet );
+
+    LEAVE("%p", gsrToRet);
+    return GTK_WIDGET( gsrToRet );
+}
+
+static void
+gnc_split_reg2_init( GNCSplitReg2 *gsr )
+{
+    gsr->sort_type = BY_STANDARD;
+    gsr->width = -1;
+    gsr->height = -1;
+    gsr->numRows = 10;
+    gsr->read_only = FALSE;
+
+    g_signal_connect( gsr, "destroy",
+                      G_CALLBACK (gnc_split_reg2_destroy_cb), gsr );
+}
+
+static void
+gnc_split_reg2_init2( GNCSplitReg2 *gsr )
+{
+    if ( !gsr ) return;
+
+    gnc_split_reg2_determine_read_only( gsr );
+
+    gsr2_setup_status_widgets( gsr );
+    /* ordering is important here... setup_status before create_table */
+
+    gsr2_create_table( gsr );
+    gsr2_setup_table( gsr );
+
+}
+
+static
+void
+gsr2_setup_table( GNCSplitReg2 *gsr )
+{
+    GncTreeModelSplitReg *model;
+
+    ENTER("gsr=%p", gsr);
+
+    model = gnc_ledger_display2_get_split_model_register( gsr->ledger );
+
+/*FIXME    gnc_split_register_show_present_divider( model, TRUE ); */
+
+    /* events should be sufficient to redraw this */
+    /* gnc_ledger_display2_refresh( gsr->ledger ); */
+    gnc_split_reg2_refresh_toolbar( gsr );
+
+    LEAVE(" ");
+}
+
+static
+void
+gsr2_create_table( GNCSplitReg2 *gsr )
+{
+    GtkWidget *register_widget;
+    GncTreeViewSplitReg *view;
+    GncTreeModelSplitReg *model;
+    GtkWidget *scrolled_window;
+    GtkTreeViewColumn *col;
+
+    gchar *gconf_key;
+    const GncGUID * guid;
+    Account * account;
+    
+    account = gnc_ledger_display2_leader (gsr->ledger);
+    guid = xaccAccountGetGUID (account);
+    /* Used for saving different register column widths under seperate keys */
+    gconf_key = g_strconcat (GCONF_SECTION,"/", (gchar*)guid_to_string (guid), NULL); 
+
+    ENTER("gsr=%p", gsr);
+g_print("gsr2_create_table\n");
+    gnc_ledger_display2_set_user_data (gsr->ledger, (gpointer)gsr );
+    gnc_ledger_display2_set_handlers (gsr->ledger,
+                                     gnc_split_reg2_ld_destroy,
+                                     gnc_split_reg2_get_parent );
+
+    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));
+
+    scrolled_window = gtk_scrolled_window_new (NULL, NULL);
+    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
+                                   GTK_POLICY_AUTOMATIC,
+                                   GTK_POLICY_AUTOMATIC);
+    gtk_widget_show (scrolled_window);
+    gtk_box_pack_start (GTK_BOX (gsr), scrolled_window, TRUE, TRUE, 0);
+
+    gnc_ledger_display2_set_split_view_register (gsr->ledger, view);
+
+    g_object_set (G_OBJECT (view), "gconf-section", gconf_key, 
+                 "show-column-menu", TRUE, NULL);
+
+    gnc_tree_view_configure_columns (GNC_TREE_VIEW (view));
+
+    gnc_tree_view_set_show_column_menu (GNC_TREE_VIEW (view), FALSE);
+
+    /* 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 right color column, 4 is the minimum */
+    col = gnc_tree_view_find_column_by_name (GNC_TREE_VIEW (view), "status");
+    if (col != NULL)
+        g_object_set (G_OBJECT(col),
+                     "resizable", FALSE,
+                     "sizing",      GTK_TREE_VIEW_COLUMN_FIXED,
+                     "fixed-width", 4,
+                     NULL);
+
+    gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), TRUE);
+    gtk_widget_show (GTK_WIDGET (view));
+    gtk_container_add (GTK_CONTAINER (scrolled_window), GTK_WIDGET (view));
+    gtk_widget_show (GTK_WIDGET (gsr));
+
+    /* Should this be read only */
+    gnc_tree_view_split_reg_set_read_only (view, gsr->read_only);
+
+    /* This tells the ledger that we have a valid tree view */
+    gnc_ledger_display2_set_split_view_refresh (gsr->ledger, TRUE);
+
+/*
+    g_signal_connect (gsr->reg, "activate_cursor",
+                      G_CALLBACK(gnc_split_reg2_record_cb), gsr); */
+
+/*FIXME This triggers the update of the summary bar, we need to connect this to some thing
+
+    g_signal_connect (gsr->reg, "redraw_all",
+                      G_CALLBACK(gsr2_redraw_all_cb), gsr); */
+
+/*FIXME I think this is to do with the help text at the bottom, we need to connect this to some thing
+    g_signal_connect (gsr->reg, "redraw_help",
+                      G_CALLBACK(gsr2_emit_help_changed), gsr); */
+    LEAVE(" ");
+}
+
+static
+void
+gsr2_setup_status_widgets( GNCSplitReg2 *gsr )
+{
+    GncTreeModelSplitReg *model;
+    gboolean use_double_line;
+
+    model = gnc_ledger_display2_get_split_model_register( gsr->ledger );
+    use_double_line = gnc_ledger_display2_default_double_line( gsr->ledger );
+
+    /* be sure to initialize the gui elements */
+    gnc_tree_model_split_reg_config( model, model->type, model->style, use_double_line );
+}
+
+void
+gnc_split_reg2_destroy_cb(GtkWidget *widget, gpointer data)
+{
+}
+
+/**
+ * Raise an existing register window to the front.
+ **/
+void
+gnc_split_reg2_raise( GNCSplitReg2 *gsr )
+{
+    if (gsr == NULL)
+        return;
+
+    if (gsr->window == NULL)
+        return;
+
+    gtk_window_present( GTK_WINDOW(gsr->window) );
+}
+
+
+/**
+ * Duplicate-code reduction function; retreives, formats and updates the
+ * GtkLabel with the given amount.
+ **/
+static
+void
+gsr2_update_summary_label( GtkWidget *label,
+                          xaccGetBalanceFn getter,
+                          Account *leader,
+                          GNCPrintAmountInfo print_info,
+                          gnc_commodity *cmdty,
+                          gboolean reverse,
+                          gboolean euroFlag )
+{
+    gnc_numeric amount;
+    char string[256];
+
+    if ( label == NULL )
+        return;
+
+    amount = (*getter)( leader );
+
+    if ( reverse )
+    {
+        amount = gnc_numeric_neg( amount );
+    }
+
+    xaccSPrintAmount( string, amount, print_info );
+
+    if ( euroFlag )
+    {
+        strcat( string, " / " );
+        xaccSPrintAmount( string + strlen( string ),
+                          gnc_convert_to_euro( cmdty, amount ),
+                          gnc_commodity_print_info( gnc_get_euro(), TRUE ) );
+    }
+
+    gnc_set_label_color( label, amount );
+    gtk_label_set_text( GTK_LABEL(label), string );
+}
+
+static GNCPrice *
+account_latest_price (Account *account)
+{
+    QofBook *book;
+    GNCPriceDB *pdb;
+    gnc_commodity *commodity;
+    gnc_commodity *currency;
+
+    if (!account) return NULL;
+    commodity = xaccAccountGetCommodity (account);
+    currency = gnc_default_currency ();
+
+    book = gnc_account_get_book (account);
+    pdb = gnc_pricedb_get_db (book);
+
+    return gnc_pricedb_lookup_latest (pdb, commodity, currency);
+}
+
+static GNCPrice *
+account_latest_price_any_currency (Account *account)
+{
+    QofBook *book;
+    GNCPriceDB *pdb;
+    gnc_commodity *commodity;
+    GList *price_list;
+    GNCPrice *result;
+
+    if (!account) return NULL;
+    commodity = xaccAccountGetCommodity (account);
+
+    book = gnc_account_get_book (account);
+    pdb = gnc_pricedb_get_db (book);
+
+    price_list = gnc_pricedb_lookup_latest_any_currency (pdb, commodity);
+    if (!price_list) return NULL;
+
+    result = gnc_price_clone((GNCPrice *)(price_list->data), book);
+
+    gnc_price_list_destroy(price_list);
+
+    return result;
+}
+
+static
+void
+gsr2_redraw_all_cb (GncTreeViewSplitReg *view, gpointer user_data)
+{
+    GNCSplitReg2 *gsr = user_data;
+    gnc_commodity * commodity;
+    GNCPrintAmountInfo print_info;
+    gnc_numeric amount;
+    char string[256];
+    Account *leader;
+    gboolean reverse;
+    gboolean euro;
+
+    if ( gsr->summarybar == NULL )
+        return;
+
+    leader = gnc_ledger_display2_leader( gsr->ledger );
+
+    commodity = xaccAccountGetCommodity( leader );
+
+    /* no EURO converson, if account is already EURO or no EURO currency */
+    if (commodity != NULL)
+        euro = (gnc_is_euro_currency( commodity ) &&
+                (strncasecmp(gnc_commodity_get_mnemonic(commodity), "EUR", 3)));
+    else
+        euro = FALSE;
+
+    print_info = gnc_account_print_info( leader, TRUE );
+    reverse = gnc_reverse_balance( leader );
+
+    gsr2_update_summary_label( gsr->balance_label,
+                              xaccAccountGetPresentBalance,
+                              leader, print_info, commodity, reverse, euro );
+    gsr2_update_summary_label( gsr->cleared_label,
+                              xaccAccountGetClearedBalance,
+                              leader, print_info, commodity, reverse, euro );
+    gsr2_update_summary_label( gsr->reconciled_label,
+                              xaccAccountGetReconciledBalance,
+                              leader, print_info, commodity, reverse, euro );
+    gsr2_update_summary_label( gsr->future_label,
+                              xaccAccountGetBalance,
+                              leader, print_info, commodity, reverse, euro );
+    gsr2_update_summary_label( gsr->projectedminimum_label,
+                              xaccAccountGetProjectedMinimumBalance,
+                              leader, print_info, commodity, reverse, euro );
+
+    /* Print the summary share amount */
+    if (gsr->shares_label != NULL)
+    {
+        print_info = gnc_account_print_info( leader, TRUE );
+
+        amount = xaccAccountGetBalance( leader );
+        if (reverse)
+            amount = gnc_numeric_neg( amount );
+
+        xaccSPrintAmount( string, amount, print_info );
+
+        gnc_set_label_color( gsr->shares_label, amount );
+        gtk_label_set_text( GTK_LABEL(gsr->shares_label), string );
+    }
+
+    /* Print the summary share value */
+    if (gsr->value_label != NULL)
+    {
+        GNCPrice *price;
+
+        amount = xaccAccountGetBalance (leader);
+        if (reverse) amount = gnc_numeric_neg (amount);
+
+        price = account_latest_price (leader);
+        if (!price)
+        {
+            /* If the balance is zero, then print zero. */
+            if (gnc_numeric_equal(amount, gnc_numeric_zero()))
+            {
+                gnc_commodity *currency = gnc_default_currency ();
+                print_info = gnc_commodity_print_info (currency, TRUE);
+                amount = gnc_numeric_zero ();
+
+                xaccSPrintAmount (string, amount, print_info);
+
+                gnc_set_label_color (gsr->value_label, amount);
+                gtk_label_set_text (GTK_LABEL (gsr->value_label), string);
+            }
+            else
+            {
+                /* else try to do a double-price-conversion :-( */
+                price = account_latest_price_any_currency (leader);
+                if (!price)
+                {
+                    gnc_set_label_color (gsr->value_label, gnc_numeric_zero ());
+                    gtk_label_set_text (GTK_LABEL (gsr->value_label),
+                                        _("<No information>"));
+                }
+                else
+                {
+                    gnc_commodity *currency = gnc_price_get_currency (price);
+                    gnc_commodity *default_currency = gnc_default_currency ();
+                    gnc_numeric currency_amount;
+                    gnc_numeric default_currency_amount;
+
+                    print_info = gnc_commodity_print_info (currency, TRUE);
+
+                    currency_amount =
+                        xaccAccountConvertBalanceToCurrency(leader, amount,
+                                                            commodity, currency);
+                    xaccSPrintAmount (string, currency_amount, print_info);
+
+                    default_currency_amount =
+                        xaccAccountConvertBalanceToCurrency(leader, amount,
+                                                            commodity,
+                                                            default_currency);
+                    if (!gnc_numeric_zero_p(default_currency_amount))
+                    {
+                        strcat( string, " / " );
+                        print_info = gnc_commodity_print_info (default_currency, TRUE);
+                        xaccSPrintAmount( string + strlen( string ), default_currency_amount,
+                                          print_info);
+                    }
+
+                    gnc_set_label_color (gsr->value_label, amount);
+                    gtk_label_set_text (GTK_LABEL (gsr->value_label), string);
+
+                    gnc_price_unref (price);
+                }
+            }
+        }
+        else
+        {
+            gnc_commodity *currency = gnc_price_get_currency (price);
+
+            print_info = gnc_commodity_print_info (currency, TRUE);
+
+            amount = gnc_numeric_mul (amount, gnc_price_get_value (price),
+                                      gnc_commodity_get_fraction (currency),
+                                      GNC_HOW_RND_ROUND_HALF_UP);
+
+            xaccSPrintAmount (string, amount, print_info);
+
+            gnc_set_label_color (gsr->value_label, amount);
+            gtk_label_set_text (GTK_LABEL (gsr->value_label), string);
+
+            gnc_price_unref (price);
+        }
+    }
+
+}
+
+static void
+gnc_split_reg2_refresh_toolbar( GNCSplitReg2 *gsr )
+{
+    GtkToolbarStyle tbstyle;
+
+    if ((gsr == NULL) || (gsr->toolbar == NULL))
+        return;
+
+    tbstyle = gnc_get_toolbar_style ();
+    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 );
+    
+    gchar *gconf_key;
+    const GncGUID * guid;
+    Account * account;
+    
+    account = gnc_ledger_display2_leader(ledger);
+    guid = xaccAccountGetGUID(account);
+    gconf_key = (gchar*)guid_to_string (guid);
+    
+    
+    if (gsr)
+    {
+        GncTreeModelSplitReg *model;
+
+        model = gnc_ledger_display2_get_split_model_register (ledger);
+
+/*FIXME        if (model && model->table)
+            gnc_table_save_state (model->table, gconf_key);
+*/
+        /*
+         * Don't destroy the window here any more.  The register no longer
+         * owns it.
+         */
+    }
+    gnc_ledger_display2_set_user_data (ledger, NULL);
+}
+
+
+/* ######## Handlers ############ */
+
+
+void
+gsr2_default_cut_handler( GNCSplitReg2 *gsr, gpointer data )
+{
+/*FIXME    gnucash_register_cut_clipboard( gsr->reg );*/
+}
+
+/**
+ * Cut the selection to the clipboard.  This refers to the Split.
+ **/
+void
+gnc_split_reg2_cut_cb (GtkWidget *w, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "cut" );*/
+}
+
+void
+gsr2_default_copy_handler( GNCSplitReg2 *gsr, gpointer data )
+{
+/*FIXME    gnucash_register_copy_clipboard( gsr->reg );*/
+}
+
+/**
+ * Copy the selection to the clipboard.  This refers to the Split.
+ **/
+void
+gnc_split_reg2_copy_cb (GtkWidget *w, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "copy" );*/
+}
+
+void
+gsr2_default_paste_handler( GNCSplitReg2 *gsr, gpointer data )
+{
+/*FIXME    gnucash_register_paste_clipboard( gsr->reg );*/
+}
+
+/**
+ * Paste the clipboard to the selection.  This refers to the Split.
+ **/
+void
+gnc_split_reg2_paste_cb (GtkWidget *w, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "paste" );*/
+}
+
+void
+gsr2_default_cut_txn_handler( GNCSplitReg2 *gsr, gpointer data )
+{
+/*FIXME    gnc_split_register_cut_current
+    (gnc_ledger_display2_get_split_register( gsr->ledger ));*/
+}
+
+/**
+ * Cut the current transaction  to the clipboard.
+ **/
+void
+gnc_split_reg2_cut_trans_cb (GtkWidget *w, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "cut_txn" );*/
+}
+
+void
+gsr2_default_copy_txn_handler( GNCSplitReg2 *gsr, gpointer data )
+{
+/*FIXME    gnc_split_register_copy_current
+    (gnc_ledger_display2_get_split_register( gsr->ledger ));*/
+}
+
+/**
+ * Copy the current transaction to the clipboard.
+ **/
+void
+gnc_split_reg2_copy_trans_cb(GtkWidget *w, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "copy_txn" );*/
+}
+
+void
+gsr2_default_paste_txn_handler( GNCSplitReg2 *gsr, gpointer data )
+{
+/*FIXME    gnc_split_register_paste_current
+    (gnc_ledger_display2_get_split_register( gsr->ledger ));*/
+}
+
+/**
+ * Paste the transaction clipboard to the selection.
+ **/
+void
+gnc_split_reg2_paste_trans_cb (GtkWidget *w, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "paste_txn" );*/
+}
+
+/********************************************************************\
+ * gnc_split_reg2_void_trans_cb                                      *
+ *                                                                  *
+ * Args:   widget - the widget that called us                       *
+ *         data   - the data struct for this register               *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gsr2_default_void_txn_handler (GNCSplitReg2 *gsr, gpointer data)
+{
+    // Override this function.
+}
+
+void
+gnc_split_reg2_void_trans_cb (GtkWidget *w, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "void_txn" );*/
+}
+
+/********************************************************************\
+ * gnc_split_reg2_unvoid_trans_cb                                      *
+ *                                                                  *
+ * Args:   widget - the widget that called us                       *
+ *         data   - the data struct for this register               *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gsr2_default_unvoid_txn_handler (GNCSplitReg2 *gsr, gpointer data)
+{
+    // Override this function.
+}
+
+void
+gnc_split_reg2_unvoid_trans_cb (GtkWidget *w, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "unvoid_txn" );*/
+}
+
+/********************************************************************\
+ * gnc_split_reg2_reverse_trans_cb                                   *
+ *                                                                  *
+ * Args:   widget - the widget that called us                       *
+ *         data   - the data struct for this register               *
+ * Return: none                                                     *
+\********************************************************************/
+void
+gsr2_default_reverse_txn_handler (GNCSplitReg2 *gsr, gpointer data)
+{
+/*FIXME*/
+#ifdef skip
+    SplitRegister *reg;
+    Transaction *trans, *new_trans;
+
+    reg = gnc_ledger_display2_get_split_register( gsr->ledger );
+    trans = gnc_split_register_get_current_trans (reg);
+    if (trans == NULL)
+        return;
+
+    if (xaccTransGetReversedBy(trans))
+    {
+        gnc_error_dialog(gsr->window, "%s",
+                         _("A reversing entry has already been created for this transaction."));
+        return;
+    }
+
+    new_trans = xaccTransReverse(trans);
+
+    /* Clear transaction level info */
+    xaccTransSetDatePostedSecs(new_trans, time(NULL));
+    xaccTransSetDateEnteredSecs(new_trans, time(NULL));
+
+    /* Now jump to new trans */
+    gnc_split_reg2_jump_to_split(gsr, xaccTransGetSplit(new_trans, 0));
+#endif
+}
+
+void
+gnc_split_reg2_reverse_trans_cb (GtkWidget *w, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "reverse_txn" ); */
+}
+
+
+static gboolean
+is_trans_readonly_and_warn (const Transaction *trans) //this works
+{
+    GtkWidget *dialog;
+    const gchar *reason;
+    const gchar *title = _("Cannot modify or delete this transaction.");
+    const gchar *message =
+        _("This transaction is marked read-only with the comment: '%s'");
+
+    if (!trans) return FALSE;
+
+    if (xaccTransIsReadonlyByPostedDate (trans))
+    {
+        dialog = gtk_message_dialog_new (NULL,
+                                        0,
+                                        GTK_MESSAGE_ERROR,
+                                        GTK_BUTTONS_OK,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                "%s", _("The date of this transaction is older than the \"Read-Only Threshold\" set for this book.  "
+                        "This setting can be changed in File -> Properties -> Accounts."));
+        gtk_dialog_run (GTK_DIALOG (dialog));
+        gtk_widget_destroy (dialog);
+        return TRUE;
+    }
+
+    reason = xaccTransGetReadOnly (trans);
+    if (reason)
+    {
+        dialog = gtk_message_dialog_new (NULL,
+                                        0,
+                                        GTK_MESSAGE_ERROR,
+                                        GTK_BUTTONS_OK,
+                                        "%s", title);
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                message, reason);
+        gtk_dialog_run (GTK_DIALOG (dialog));
+        gtk_widget_destroy (dialog);
+        return TRUE;
+    }
+    return FALSE;
+}
+
+
+void
+gsr2_default_reinit_handler ( GNCSplitReg2 *gsr, gpointer data ) //this works
+{
+    GncTreeViewSplitReg *view;
+    Transaction *trans;
+    Split *split;
+    GtkWidget *dialog;
+    gint response;
+    const gchar *warning;
+
+    const char *title = _("Remove the splits from this transaction?");
+    const char *recn_warn = _("This transaction contains reconciled splits. "
+                              "Modifying it is not a good idea because that will "
+                              "cause your reconciled balance to be off.");
+
+    view = gnc_ledger_display2_get_split_view_register ( gsr->ledger );
+
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+    if (is_trans_readonly_and_warn (trans))
+        return;
+    dialog = gtk_message_dialog_new (GTK_WINDOW (gsr->window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_WARNING,
+                                    GTK_BUTTONS_NONE,
+                                    "%s", title);
+    if (xaccTransHasReconciledSplits (trans))
+    {
+        gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                "%s", recn_warn);
+        warning = "register_remove_all_splits2";
+    }
+    else
+    {
+        warning = "register_remove_all_splits";
+    }
+
+    gtk_dialog_add_button (GTK_DIALOG (dialog),
+                          GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+    gnc_gtk_dialog_add_button(dialog, _("_Remove Splits"),
+                              GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
+    response = gnc_dialog_run (GTK_DIALOG(dialog), warning);
+    gtk_widget_destroy (dialog);
+    if (response != GTK_RESPONSE_ACCEPT)
+        return;
+
+    gnc_tree_view_split_reg_reinit_trans (view);
+}
+
+/**
+ * "Reinitializes" the current transaction.
+ **/
+void
+gnc_split_reg2_reinitialize_trans_cb(GtkWidget *widget, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "reinit_ent" ); */
+}
+
+void
+gsr2_default_delete_handler (GNCSplitReg2 *gsr, gpointer data) //this works
+{
+    GncTreeViewSplitReg *view;
+    RowDepth depth;
+    Transaction *trans;
+    Split *split;
+    GtkWidget *dialog;
+    gint response;
+    const gchar *warning;
+
+    view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
+
+    /* get the current split based on cursor position */
+    split = gnc_tree_view_split_reg_get_current_split (view);
+    if (split == NULL)
+    {
+        return;
+    }
+
+    trans = xaccSplitGetParent (split);
+    depth = gnc_tree_view_reg_get_selected_row_depth (view);
+
+    /* Deleting the blank split just cancels */
+    {
+        Split *blank_split = gnc_tree_view_split_reg_get_blank_split (view);
+
+        if (split == blank_split)
+        {
+            return;
+        }
+    }
+
+    if (is_trans_readonly_and_warn (trans))
+        return;
+
+    /* On a split cursor, just delete the one split. */
+    if (depth == SPLIT3)
+    {
+        const char *format = _("Delete the split '%s' from the transaction '%s'?");
+        const char *recn_warn = _("You would be deleting a reconciled split! "
+                                  "This is not a good idea as it will cause your "
+                                  "reconciled balance to be off.");
+        const char *anchor_error = _("You cannot delete this split.");
+        const char *anchor_split = _("This is the split anchoring this transaction "
+                                     "to the register. You may not delete it from "
+                                     "this register window.  You may delete the "
+                                     "entire transaction from this window, or you "
+                                     "may navigate to a register that shows "
+                                     "another side of this same transaction and "
+                                     "delete the split from that register.");
+        char *buf = NULL;
+        const char *memo;
+        const char *desc;
+        char recn;
+
+        if (split == gnc_tree_view_reg_get_current_trans_split (view))
+        {
+            dialog = gtk_message_dialog_new (GTK_WINDOW (gsr->window),
+                                            GTK_DIALOG_MODAL
+                                            | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                            GTK_MESSAGE_ERROR,
+                                            GTK_BUTTONS_OK,
+                                            "%s", anchor_error);
+            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                    "%s", anchor_split);
+            gtk_dialog_run (GTK_DIALOG (dialog));
+            gtk_widget_destroy (dialog);
+            return;
+        }
+
+        memo = xaccSplitGetMemo (split);
+        memo = (memo && *memo) ? memo : _("(no memo)");
+
+        desc = xaccTransGetDescription (trans);
+        desc = (desc && *desc) ? desc : _("(no description)");
+
+        /* ask for user confirmation before performing permanent damage */
+        buf = g_strdup_printf (format, memo, desc);
+        dialog = gtk_message_dialog_new (GTK_WINDOW (gsr->window),
+                                        GTK_DIALOG_MODAL
+                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_QUESTION,
+                                        GTK_BUTTONS_NONE,
+                                        "%s", buf);
+        g_free(buf);
+        recn = xaccSplitGetReconcile (split);
+        if (recn == YREC || recn == FREC)
+        {
+            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                    "%s", recn_warn);
+            warning = "register_delete_split2";
+        }
+        else
+        {
+            warning = "register_delete_split";
+        }
+
+        gtk_dialog_add_button (GTK_DIALOG (dialog),
+                              GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+        gnc_gtk_dialog_add_button (dialog, _("_Delete Split"),
+                                  GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
+        response = gnc_dialog_run (GTK_DIALOG (dialog), warning);
+        gtk_widget_destroy (dialog);
+        if (response != GTK_RESPONSE_ACCEPT)
+            return;
+
+        gnc_tree_view_split_reg_delete_current_split (view);
+        return;
+    }
+
+    g_return_if_fail (depth == TRANS1 || depth == TRANS2);
+
+    /* On a transaction cursor with 2 or fewer splits in single or double
+     * mode, we just delete the whole transaction, kerblooie */
+    {
+        const char *title = _("Delete the current transaction?");
+        const char *recn_warn = _("You would be deleting a transaction "
+                                  "with reconciled splits! "
+                                  "This is not a good idea as it will cause your "
+                                  "reconciled balance to be off.");
+
+        dialog = gtk_message_dialog_new (GTK_WINDOW (gsr->window),
+                                        GTK_DIALOG_MODAL
+                                        | GTK_DIALOG_DESTROY_WITH_PARENT,
+                                        GTK_MESSAGE_WARNING,
+                                        GTK_BUTTONS_NONE,
+                                        "%s", title);
+        if (xaccTransHasReconciledSplits (trans))
+        {
+            gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+                    "%s", recn_warn);
+            warning = "register_delete_trans2";
+        }
+        else
+        {
+            warning = "register_delete_trans";
+        }
+        gtk_dialog_add_button (GTK_DIALOG (dialog),
+                              GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+        gnc_gtk_dialog_add_button (dialog, _("_Delete Transaction"),
+                                  GTK_STOCK_DELETE, GTK_RESPONSE_ACCEPT);
+        response =  gnc_dialog_run (GTK_DIALOG (dialog), warning);
+        gtk_widget_destroy (dialog);
+        if (response != GTK_RESPONSE_ACCEPT)
+            return;
+
+        gnc_tree_view_split_reg_delete_current_trans (view);
+        return;
+    }
+}
+
+/**
+ * Deletes the current transaction.
+ **/
+void
+gnc_split_reg2_delete_trans_cb(GtkWidget *widget, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "delete_ent" );*/
+}
+
+
+void
+gsr2_default_dup_handler( GNCSplitReg2 *gsr, gpointer data )
+{
+/*FIXME    gnc_split_register_duplicate_current
+    (gnc_ledger_display2_get_split_register( gsr->ledger ));*/
+}
+
+
+/**
+ * Duplicates the current transaction in the register.
+ **/
+void
+gnc_split_reg2_duplicate_trans_cb(GtkWidget *w, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "dup_ent" );*/
+}
+
+/**
+ * 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 )
+{
+/*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
+gsr2_default_cancel_handler( GNCSplitReg2 *gsr, gpointer data )
+{
+/*FIXME    gnc_split_register_cancel_cursor_trans_changes
+    (gnc_ledger_display2_get_split_register( gsr->ledger ));*/
+}
+
+/**
+ * Cancels the edits of the currently-selected transaction.
+ **/
+void
+gnc_split_reg2_cancel_trans_cb(GtkWidget *w, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "cancel_ent" );*/
+}
+
+void
+gsr2_default_expand_handler( GNCSplitReg2 *gsr, gpointer data )
+{
+/*FIXME*/
+#ifdef skip
+    gint activeCount;
+    gboolean expand;
+    SplitRegister *reg;
+
+    if (!gsr)
+        return;
+
+    reg = gnc_ledger_display2_get_split_register (gsr->ledger);
+
+    /* These should all be in agreement. */
+    activeCount =
+        ( ( GTK_CHECK_MENU_ITEM(gsr->split_menu_check)->active ? 1 : -1 )
+          + ( GTK_CHECK_MENU_ITEM(gsr->split_popup_check)->active ? 1 : -1 )
+          + ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(gsr->split_button) )
+              ? 1 : -1 ) );
+
+    /* If activeCount > 0, then there's more active than inactive; otherwise,
+     * more inactive than active.  Both determine which state the user is
+     * attempting to get to. */
+    expand = ( activeCount < 0 );
+
+    /* The ledger's invocation of 'redraw_all' will force the agreement in the
+     * other split state widgets, so we neglect doing it here.  */
+    gnc_split_register_expand_current_trans (reg, expand);
+#endif
+}
+
+void
+gnc_split_reg2_expand_trans_menu_cb (GtkWidget *widget, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "expand_ent" );*/
+}
+
+void
+gnc_split_reg2_expand_trans_toolbar_cb (GtkWidget *widget, gpointer data)
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "expand_ent" );*/
+}
+
+/**
+ * move the cursor to the split, if present in register
+**/
+void
+gnc_split_reg2_jump_to_split (GNCSplitReg2 *gsr, Split *split) //this works
+{
+    GncTreeViewSplitReg *view;
+
+//FIXME maybe collapse this back to plugin-page-register
+
+    view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
+
+    gnc_tree_view_split_reg_jump_to_split (view, 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)
+{
+/*FIXME*/
+#ifdef skip
+    VirtualLocation virt_loc;
+    SplitRegister *reg;
+    Transaction *trans;
+
+    if (!gsr) return;
+
+    trans = xaccSplitGetParent(split);
+    gsr2_emit_include_date_signal( gsr, xaccTransGetDate(trans) );
+
+    reg = gnc_ledger_display2_get_split_register (gsr->ledger);
+
+    if (gnc_split_register_get_split_amount_virt_loc (reg, split, &virt_loc))
+        gnucash_register_goto_virt_loc (gsr->reg, virt_loc);
+
+    gnc_ledger_display2_refresh (gsr->ledger);
+#endif
+}
+
+void
+gnc_split_reg2_jump_to_blank (GNCSplitReg2 *gsr)
+{
+/*FIXME*/
+#ifdef skip
+    SplitRegister *reg = gnc_ledger_display2_get_split_register (gsr->ledger);
+    VirtualCellLocation vcell_loc;
+    Split *blank;
+
+    ENTER("gsr=%p", gsr);
+
+    blank = gnc_split_register_get_blank_split (reg);
+    if (blank == NULL)
+    {
+        LEAVE("no blank split");
+        return;
+    }
+
+    if (gnc_split_register_get_split_virt_loc (reg, blank, &vcell_loc))
+        gnucash_register_goto_virt_cell (gsr->reg, vcell_loc);
+
+    gnc_ledger_display2_refresh (gsr->ledger);
+    LEAVE(" ");
+#endif
+}
+
+void
+gnc_split_reg2_balancing_entry(GNCSplitReg2 *gsr, Account *account,
+                              time_t statement_date, gnc_numeric balancing_amount)
+{
+/*FIXME*/
+#ifdef skip
+    Transaction *transaction;
+    Split *split;
+
+    // create transaction
+    transaction = create_balancing_transaction(gnc_get_current_book(),
+                  account, statement_date, balancing_amount);
+
+    // jump to transaction
+    split = xaccTransFindSplitByAccount(transaction, account);
+    if (split == NULL)
+    {
+        // default behaviour: jump to blank split
+        g_warning("create_balancing_transaction failed");
+        gnc_split_reg2_jump_to_blank(gsr);
+    }
+    else
+    {
+        // goto balancing transaction
+        gnc_split_reg2_jump_to_split(gsr, split );
+    }
+#endif
+}
+
+static Transaction*
+create_balancing_transaction(QofBook *book, Account *account,
+                             time_t statement_date, gnc_numeric balancing_amount)
+{
+/*FIXME*/
+#ifdef skip
+    Transaction *trans;
+    Split *split;
+
+    if (!account)
+        return NULL;
+    if (gnc_numeric_zero_p(balancing_amount))
+        return NULL;
+
+    xaccAccountBeginEdit(account);
+
+    trans = xaccMallocTransaction(book);
+
+    xaccTransBeginEdit(trans);
+
+    // fill Transaction
+    xaccTransSetCurrency(trans, xaccAccountGetCommodity(account));
+    xaccTransSetDatePostedSecs(trans, statement_date);
+    xaccTransSetDescription(trans, _("Balancing entry from reconcilation"));
+
+    // 1. Split
+    split = xaccMallocSplit(book);
+    xaccTransAppendSplit(trans, split);
+    xaccAccountInsertSplit(account, split);
+    xaccSplitSetAmount(split, balancing_amount);
+    xaccSplitSetValue(split, balancing_amount);
+
+    // 2. Split (no account is defined: split goes to orphan account)
+    split = xaccMallocSplit(book);
+    xaccTransAppendSplit(trans, split);
+
+    balancing_amount = gnc_numeric_neg(balancing_amount);
+    xaccSplitSetAmount(split, balancing_amount);
+    xaccSplitSetValue(split, balancing_amount);
+
+    xaccTransCommitEdit(trans);
+    xaccAccountCommitEdit(account);
+    return trans;
+#endif
+return NULL;
+}
+
+void
+gsr2_default_blank_handler( GNCSplitReg2 *gsr, gpointer data )
+{
+/*FIXME*/
+#ifdef skip
+    SplitRegister *reg;
+
+    ENTER("gsr=%p, gpointer=%p", gsr, data);
+
+    reg = gnc_ledger_display2_get_split_register (gsr->ledger);
+
+    if (gnc_split_register_save (reg, TRUE))
+        gnc_split_register_redraw (reg);
+
+    gnc_split_reg2_jump_to_blank (gsr);
+    LEAVE(" ");
+#endif
+}
+
+void
+gnc_split_reg2_new_trans_cb (GtkWidget *widget, gpointer data)
+{
+/*FIXME   GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "blank" );*/
+}
+
+void
+gsr2_default_jump_handler( GNCSplitReg2 *gsr, gpointer data )
+{
+ /*FIXME   g_assert_not_reached();*/
+}
+
+void
+gnc_split_reg2_jump_cb( GtkWidget *widget, gpointer data )
+{
+/*FIXME    GNCSplitReg2 *gsr = data;
+    gsr2_emit_simple_signal( gsr, "jump" ); */
+}
+
+/* ###### End Handlers ##### */
+
+
+
+
+
+void
+gnc_split_reg2_change_style (GNCSplitReg2 *gsr, SplitRegisterStyle2 style)
+{
+    GncTreeModelSplitReg *model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
+
+    if (style == model->style)
+        return;
+
+    gnc_tree_model_split_reg_config (model, model->type, style, model->use_double_line);
+    gnc_ledger_display2_refresh (gsr->ledger);
+}
+
+void
+gnc_split_reg2_style_ledger_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+
+    if (!GTK_CHECK_MENU_ITEM(w)->active)
+        return;
+
+    gnc_split_reg2_change_style (gsr, REG2_STYLE_LEDGER);
+}
+
+void
+gnc_split_reg2_style_auto_ledger_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+
+    if (!GTK_CHECK_MENU_ITEM(w)->active)
+        return;
+
+    gnc_split_reg2_change_style (gsr, REG2_STYLE_AUTO_LEDGER);
+}
+
+void
+gnc_split_reg2_style_journal_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+
+    if (!GTK_CHECK_MENU_ITEM(w)->active)
+        return;
+
+    gnc_split_reg2_change_style (gsr, REG2_STYLE_JOURNAL);
+}
+
+void
+gnc_split_reg2_double_line_cb (GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+    GncTreeModelSplitReg *model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
+    gboolean use_double_line;
+
+    use_double_line = GTK_CHECK_MENU_ITEM(w)->active;
+    if ( use_double_line == model->use_double_line )
+        return;
+
+    gnc_tree_model_split_reg_config( model, model->type, model->style, use_double_line );
+    gnc_ledger_display2_refresh( gsr->ledger );
+}
+
+static void
+gnc_split_reg2_sort( GNCSplitReg2 *gsr, SortType sort_code )
+{
+    Query *query = gnc_ledger_display2_get_query( gsr->ledger );
+    gboolean show_present_divider = FALSE;
+    GSList *p1 = NULL, *p2 = NULL, *p3 = NULL, *standard;
+    GncTreeModelSplitReg *model;
+
+    if (gsr->sort_type == sort_code)
+        return;
+
+    standard = g_slist_prepend( NULL, QUERY_DEFAULT_SORT );
+
+    switch (sort_code)
+    {
+    case BY_STANDARD:
+        p1 = standard;
+        show_present_divider = TRUE;
+        break;
+    case BY_DATE:
+        p1 = g_slist_prepend (p1, TRANS_DATE_POSTED);
+        p1 = g_slist_prepend (p1, SPLIT_TRANS);
+        p2 = standard;
+        show_present_divider = TRUE;
+        break;
+    case BY_DATE_ENTERED:
+        p1 = g_slist_prepend (p1, TRANS_DATE_ENTERED);
+        p1 = g_slist_prepend (p1, SPLIT_TRANS);
+        p2 = standard;
+        break;
+    case BY_DATE_RECONCILED:
+        p1 = g_slist_prepend (p1, SPLIT_RECONCILE);
+        p2 = g_slist_prepend (p2, SPLIT_DATE_RECONCILED);
+        p3 = standard;
+        break;
+    case BY_NUM:
+        p1 = g_slist_prepend (p1, TRANS_NUM);
+        p1 = g_slist_prepend (p1, SPLIT_TRANS);
+        p2 = standard;
+        break;
+    case BY_AMOUNT:
+        p1 = g_slist_prepend (p1, SPLIT_VALUE);
+        p2 = standard;
+        break;
+    case BY_MEMO:
+        p1 = g_slist_prepend (p1, SPLIT_MEMO);
+        p2 = standard;
+        break;
+    case BY_DESC:
+        p1 = g_slist_prepend (p1, TRANS_DESCRIPTION);
+        p1 = g_slist_prepend (p1, SPLIT_TRANS);
+        p2 = standard;
+        break;
+    case BY_ACTION:
+        p1 = g_slist_prepend (p1, SPLIT_ACTION);
+        p2 = standard;
+        break;
+    case BY_NOTES:
+        p1 = g_slist_prepend (p1, TRANS_NOTES);
+        p1 = g_slist_prepend (p1, SPLIT_TRANS);
+        p2 = standard;
+        break;
+    default:
+        g_slist_free (standard);
+        g_return_if_fail (FALSE);
+    }
+
+    qof_query_set_sort_order( query, p1, p2, p3 );
+    model = gnc_ledger_display2_get_split_model_register( gsr->ledger );
+/*FIXME    gnc_split_register_show_present_divider( model, show_present_divider ); */
+    gsr->sort_type = sort_code;
+    gnc_ledger_display2_refresh( gsr->ledger );
+}
+
+void
+gnc_split_reg2_sort_standard_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+    gnc_split_reg2_sort(gsr, BY_STANDARD);
+}
+
+void
+gnc_split_reg2_sort_date_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+    gnc_split_reg2_sort(gsr, BY_DATE);
+}
+
+void
+gnc_split_reg2_sort_date_entered_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+    gnc_split_reg2_sort(gsr, BY_DATE_ENTERED);
+}
+
+void
+gnc_split_reg2_sort_date_reconciled_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+    gnc_split_reg2_sort(gsr, BY_DATE_RECONCILED);
+}
+
+void
+gnc_split_reg2_sort_num_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+    gnc_split_reg2_sort(gsr, BY_NUM);
+}
+
+void
+gnc_split_reg2_sort_amount_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+    gnc_split_reg2_sort(gsr, BY_AMOUNT);
+}
+
+void
+gnc_split_reg2_sort_memo_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+    gnc_split_reg2_sort(gsr, BY_MEMO);
+}
+
+void
+gnc_split_reg2_sort_desc_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+    gnc_split_reg2_sort(gsr, BY_DESC);
+}
+
+void
+gnc_split_reg2_sort_action_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+    gnc_split_reg2_sort(gsr, BY_ACTION);
+}
+
+void
+gnc_split_reg2_sort_notes_cb(GtkWidget *w, gpointer data)
+{
+    GNCSplitReg2 *gsr = data;
+    gnc_split_reg2_sort(gsr, BY_NOTES);
+}
+
+
+
+void
+gnc_split_reg2_handle_exchange_cb (GtkWidget *w, gpointer data)
+{
+/*FIXME*/
+#ifdef skip
+    GNCSplitReg2 *gsr = data;
+    SplitRegister *reg = gnc_ledger_display2_get_split_register (gsr->ledger);
+
+    /* XXX Ignore the return value -- we don't care if this succeeds */
+    (void)gnc_split_register_handle_exchange (reg, TRUE);
+#endif
+}
+
+
+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
+}
+
+void
+gnc_split_reg2_enter (GNCSplitReg2 *gsr, gboolean next_transaction) //this works
+{
+    GncTreeViewSplitReg *view = gnc_ledger_display2_get_split_view_register (gsr->ledger);
+    GncTreeModelSplitReg *model;
+    gboolean goto_blank;
+
+    ENTER("gsr=%p, next_transaction=%s", gsr, next_transaction ? "TRUE" : "FALSE");
+
+    model = gnc_ledger_display2_get_split_model_register (gsr->ledger);
+
+    goto_blank = gnc_gconf_get_bool (GCONF_GENERAL_REGISTER,
+                                    "enter_moves_to_end", NULL);
+
+    /* If we are in single or double line mode and we hit enter
+     * on the blank split, go to the blank split instead of the
+     * next row. This prevents the cursor from jumping around
+     * when you are entering transactions. */
+    if ( !goto_blank && !next_transaction )
+    {
+        SplitRegisterStyle2 style = model->style;
+
+        if (style == REG2_STYLE_LEDGER)
+        {
+            Split *blank_split;
+
+            blank_split = gnc_tree_view_split_reg_get_blank_split (view);
+            if (blank_split != NULL)
+            {
+                Split *current_split;
+
+                current_split = gnc_tree_view_split_reg_get_current_split (view);
+
+                if (blank_split == current_split)
+                    goto_blank = TRUE;
+            }
+        }
+    }
+
+    /* First record the transaction */
+    if (gnc_tree_view_split_reg_enter (view));
+    {
+        if (!goto_blank && next_transaction)
+            gnc_tree_view_split_reg_expand_current_trans (view, FALSE);
+
+        /* Now move. */
+        if (goto_blank)
+            gnc_tree_view_split_reg_jump_to_blank (view);
+        else if (next_transaction)
+            gnc_tree_view_split_reg_goto_rel_trans_row (view, 1);
+    }
+    LEAVE(" ");
+}
+
+void
+gsr2_default_enter_handler( GNCSplitReg2 *gsr, gpointer data )
+{
+/*FIXME    gnc_split_reg2_enter( gsr, FALSE );*/
+}
+
+
+#ifdef skip
+void
+gnc_split_reg2_record_cb (GnucashRegister *reg, gpointer data)
+{
+/*FIXME    gsr2_emit_simple_signal( (GNCSplitReg2*)data, "enter_ent" );*/
+}
+#endif
+
+
+void
+gnc_split_reg2_size_allocate (GtkWidget *widget,
+                             GtkAllocation *allocation,
+                             gpointer user_data)
+{
+    GNCSplitReg2 *gsr = user_data;
+    gsr->width = allocation->width;
+    gtk_window_set_default_size( GTK_WINDOW(gsr->window), gsr->width, 0 );
+}
+
+static
+GtkWidget*
+add_summary_label (GtkWidget *summarybar, const char *label_str)
+{
+    GtkWidget *hbox;
+    GtkWidget *label;
+
+    hbox = gtk_hbox_new(FALSE, 2);
+    gtk_box_pack_start( GTK_BOX(summarybar), hbox, FALSE, FALSE, 5 );
+
+    label = gtk_label_new( label_str );
+    gtk_misc_set_alignment( GTK_MISC(label), 1.0, 0.5 );
+    gtk_box_pack_start( GTK_BOX(hbox), label, FALSE, FALSE, 0 );
+
+    label = gtk_label_new( "" );
+    gtk_misc_set_alignment( GTK_MISC(label), 1.0, 0.5 );
+    gtk_box_pack_start( GTK_BOX(hbox), label, FALSE, FALSE, 0 );
+
+    return label;
+}
+
+GtkWidget *
+gsr2_create_summary_bar( GNCSplitReg2 *gsr )
+{
+    GtkWidget *summarybar;
+
+    gsr->cleared_label    = NULL;
+    gsr->balance_label    = NULL;
+    gsr->reconciled_label = NULL;
+    gsr->future_label     = NULL;
+    gsr->projectedminimum_label  = NULL;
+    gsr->shares_label     = NULL;
+    gsr->value_label      = NULL;
+
+    if ( gnc_ledger_display2_type(gsr->ledger) >= LD2_SUBACCOUNT )
+    {
+        gsr->summarybar = NULL;
+        return NULL;
+    }
+
+    summarybar = gtk_hbox_new (FALSE, 4);
+
+    if (!xaccAccountIsPriced(gnc_ledger_display2_leader(gsr->ledger)))
+    {
+        gsr->balance_label    = add_summary_label (summarybar, _("Present:"));
+        gsr->future_label     = add_summary_label (summarybar, _("Future:"));
+        gsr->cleared_label    = add_summary_label (summarybar, _("Cleared:"));
+        gsr->reconciled_label = add_summary_label (summarybar, _("Reconciled:"));
+        gsr->projectedminimum_label  = add_summary_label (summarybar, _("Projected Minimum:"));
+    }
+    else
+    {
+        gsr->shares_label     = add_summary_label (summarybar, _("Shares:"));
+        gsr->value_label      = add_summary_label (summarybar, _("Current Value:"));
+    }
+
+    gsr->summarybar = summarybar;
+
+    /* Force the first update */
+    gsr2_redraw_all_cb(NULL, gsr);
+    return gsr->summarybar;
+}
+
+/**
+ * Opens up a register window for a group of Accounts.
+ * @param gsr the register window instance
+ * @return A GNCPlaceholderType indicating presence and type of placeholder
+ * accounts
+ **/
+static
+GNCPlaceholderType
+gnc_split_reg2_get_placeholder( GNCSplitReg2 *gsr )
+{
+    Account *leader;
+    GncTreeModelSplitReg *model;
+    gboolean single_account;
+
+    if (gsr == NULL)
+        return PLACEHOLDER_NONE;
+
+    model = gnc_ledger_display2_get_split_model_register( gsr->ledger );
+
+    switch (model->type)
+    {
+    case GENERAL_LEDGER2:
+    case INCOME_LEDGER2:
+    case PORTFOLIO_LEDGER2:
+    case SEARCH_LEDGER2:
+        single_account = FALSE;
+        break;
+    default:
+        single_account = TRUE;
+        break;
+    }
+
+    leader = gnc_ledger_display2_leader( gsr->ledger );
+
+    if (leader == NULL)
+        return PLACEHOLDER_NONE;
+    if (single_account)
+    {
+        if (xaccAccountGetPlaceholder( leader ))
+            return PLACEHOLDER_THIS;
+        return PLACEHOLDER_NONE;
+    }
+    return xaccAccountGetDescendantPlaceholder( leader );
+}
+
+/**
+ * @see gtk_callback_bug_workaround
+ **/
+typedef struct dialog_args
+{
+    GNCSplitReg2 *gsr;
+    gchar *string;
+} dialog_args;
+
+/**
+ * Gtk has occasional problems with performing function as part of a
+ * callback.  This routine gets called via a timer callback to get it out of
+ * the data path with the problem.
+ **/
+static
+gboolean
+gtk_callback_bug_workaround (gpointer argp)
+{
+    dialog_args *args = argp;
+    const gchar *read_only = _("This account register is read-only.");
+    GtkWidget *dialog;
+
+    dialog = gtk_message_dialog_new(GTK_WINDOW(args->gsr->window),
+                                    GTK_DIALOG_DESTROY_WITH_PARENT,
+                                    GTK_MESSAGE_WARNING,
+                                    GTK_BUTTONS_CLOSE,
+                                    "%s", read_only);
+    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
+            "%s", args->string);
+    gnc_dialog_run(GTK_DIALOG(dialog), "register_read_only");
+    gtk_widget_destroy(dialog);
+    g_free(args);
+    return FALSE;
+}
+
+/**
+ * Determines whether this register window should be read-only.
+ **/
+static
+void
+gnc_split_reg2_determine_read_only( GNCSplitReg2 *gsr )
+{
+    dialog_args *args = g_malloc(sizeof(dialog_args));
+    GncTreeViewSplitReg *view;
+
+    if (qof_book_is_readonly (gnc_get_current_book()))
+    {
+        /* Is the book read-only? Then for sure also make this register
+        read-only. */
+        gsr->read_only = TRUE;
+    }
+
+    if ( !gsr->read_only )
+    {
+
+        switch (gnc_split_reg2_get_placeholder(gsr))
+        {
+        case PLACEHOLDER_NONE:
+            /* stay as false. */
+            return;
+
+        case PLACEHOLDER_THIS:
+            args->string = _("This account may not be edited.  If you want "
+                             "to edit transactions in this register, please "
+                             "open the account options and turn off the "
+                             "placeholder checkbox.");
+            break;
+
+        default:
+            args->string = _("One of the sub-accounts selected may not be "
+                             "edited.  If you want to edit transactions in "
+                             "this register, please open the sub-account "
+                             "options and turn off the placeholder checkbox. "
+                             "You may also open an individual account instead "
+                             "of a set of accounts.");
+            break;
+        }
+        gsr->read_only = TRUE;
+        /* Put up a warning dialog */
+        args->gsr = gsr;
+        g_timeout_add (250, gtk_callback_bug_workaround, args); /* 0.25 seconds */
+    }
+}
+
+static
+GtkWidget *
+gnc_split_reg2_get_parent( GNCLedgerDisplay2 *ledger )
+{
+    GNCSplitReg2 *gsr =
+        GNC_SPLIT_REG2(gnc_ledger_display2_get_user_data( ledger ));
+
+    if (gsr == NULL)
+        return NULL;
+
+    return gsr->window;
+}
+
+static
+void
+gsr2_emit_help_changed (GncTreeViewSplitReg *view, gpointer user_data )
+{
+    gsr2_emit_simple_signal ((GNCSplitReg2*)user_data, "help-changed" );
+}
+
+static
+void
+gsr2_emit_include_date_signal( GNCSplitReg2 *gsr, time_t date )
+{
+    g_signal_emit_by_name( gsr, "include-date", date, NULL );
+}
+
+static
+void
+gsr2_emit_simple_signal( GNCSplitReg2 *gsr, const char *sigName )
+{
+    g_signal_emit_by_name( gsr, sigName, NULL );
+}
+
+GncTreeViewSplitReg *
+gnc_split_reg2_get_register (GNCSplitReg2 *gsr )
+{
+    if ( !gsr )
+        return NULL;
+
+    return gnc_ledger_display2_get_split_view_register (gsr->ledger);
+}
+
+SortType
+gnc_split_reg2_get_sort_type( GNCSplitReg2 *gsr )
+{
+    g_assert( gsr );
+    return gsr->sort_type;
+}
+
+void
+gnc_split_reg2_set_sort_type( GNCSplitReg2 *gsr, SortType t )
+{
+    gnc_split_reg2_sort( gsr, t );
+}
+
+GtkWidget*
+gnc_split_reg2_get_summarybar( GNCSplitReg2 *gsr )
+{
+    if ( !gsr ) return NULL;
+    return gsr->summarybar;
+}
+
+gboolean
+gnc_split_reg2_get_read_only( GNCSplitReg2 *gsr )
+{
+    g_assert( gsr );
+    return gsr->read_only;
+}
+
+void
+gnc_split_reg2_set_moved_cb( GNCSplitReg2 *gsr, GFunc cb, gpointer cb_data )
+{
+g_print("gnc_split_reg2_set_moved_cb\n");
+    gnc_tree_view_split_reg_moved_cb (gnc_ledger_display2_get_split_view_register(gsr->ledger), cb, cb_data);
+}
Index: src/gnome/gnc-split-reg2.h
===================================================================
--- src/gnome/gnc-split-reg2.h	(revision 0)
+++ src/gnome/gnc-split-reg2.h	(revision 0)
@@ -0,0 +1,257 @@
+/********************************************************************\
+ * 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>              *
+ * Copyright (C) 1999-2000 Dave Peticolas <dave@krondo.com>         *
+ * Copyright (C) 2001 Gnumatic, Inc.                                *
+ * Copyright (C) 2002,2006 Joshua Sled <jsled@asynchronous.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 GNC_SPLIT_REG2_H
+#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"
+
+#define GNC_SPLIT_REG2(obj)         G_TYPE_CHECK_INSTANCE_CAST( obj, gnc_split_reg2_get_type(), GNCSplitReg2 )
+#define GNC_SPLIT_REG2_CLASS(klass) G_TYPE_CHECK_CLASS_CAST( klass, gnc_split_reg2_get_type(), GNCSplitReg2Class )
+#define IS_GNC_SPLIT_REG2(obj)      G_TYPE_CHECK_INSTANCE_TYPE( obj, gnc_split_reg2_get_type() )
+
+typedef struct _GNCSplitReg2 GNCSplitReg2;
+typedef struct _GNCSplitReg2Class GNCSplitReg2Class;
+
+struct _GNCSplitReg2
+{
+    /* The "parent" widget. */
+    GtkVBox vbox;
+
+    /* 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 *sort_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;
+    GtkWidget *reconciled_label;
+    GtkWidget *future_label;
+    GtkWidget *projectedminimum_label;
+    GtkWidget *shares_label;
+    GtkWidget *value_label;
+
+    /** The current ledger display. **/
+    GNCLedgerDisplay2 *ledger;
+
+    /** The actual sheet widget. **/
+    GnucashRegister *reg;
+
+    gint numRows;
+
+    guint sort_type;
+
+    gboolean read_only;
+};
+
+struct _GNCSplitReg2Class
+{
+    GtkVBoxClass parent_class;
+
+    /* Signal defaults */
+    void (*enter_ent_cb)    ( GNCSplitReg2 *w, gpointer user_data );
+    void (*cancel_ent_cb)   ( GNCSplitReg2 *w, gpointer user_data );
+    void (*delete_ent_cb)   ( GNCSplitReg2 *w, gpointer user_data );
+    void (*reinit_ent_cb)   ( GNCSplitReg2 *w, gpointer user_data );
+    void (*dup_ent_cb)      ( GNCSplitReg2 *w, gpointer user_data );
+    void (*schedule_ent_cb) ( GNCSplitReg2 *w, gpointer user_data );
+    void (*expand_ent_cb)   ( GNCSplitReg2 *w, gpointer user_data );
+    void (*blank_cb)        ( GNCSplitReg2 *w, gpointer user_data );
+    void (*jump_cb)         ( GNCSplitReg2 *w, gpointer user_data );
+    void (*cut_cb)          ( GNCSplitReg2 *w, gpointer user_data );
+    void (*cut_txn_cb)      ( GNCSplitReg2 *w, gpointer user_data );
+    void (*copy_cb)         ( GNCSplitReg2 *w, gpointer user_data );
+    void (*copy_txn_cb)     ( GNCSplitReg2 *w, gpointer user_data );
+    void (*paste_cb)        ( GNCSplitReg2 *w, gpointer user_data );
+    void (*paste_txn_cb)    ( GNCSplitReg2 *w, gpointer user_data );
+    void (*void_txn_cb)     ( GNCSplitReg2 *w, gpointer user_data );
+    void (*unvoid_txn_cb)   ( GNCSplitReg2 *w, gpointer user_data );
+    void (*reverse_txn_cb)  ( GNCSplitReg2 *w, gpointer user_data );
+    void (*help_changed_cb) ( GNCSplitReg2 *w, gpointer user_data );
+    void (*include_date_cb) ( GNCSplitReg2 *w, time_t date, gpointer user_data );
+};
+
+#ifdef skip // Coming from original gnc-split-reg.h
+typedef enum
+{
+    ENTER,
+    CANCEL,
+    DELETE,
+    REINIT,
+    DUPLICATE,
+    SCHEDULE,
+    SPLIT,
+    BLANK,
+    JUMP,
+    CUT,
+    CUT_TXN,
+    COPY,
+    COPY_TXN,
+    PASTE,
+    PASTE_TXN,
+    SORT_ORDER_SUBMENU,
+    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;
+
+/*FIXME Note sure about this == Coming from original gnc-split-reg.h */
+#ifdef skip
+/* Easy way to pass the sort-type
+ * Note that this is STUPID -- we should be using parameter lists,
+ * but this provides a simple case statement internally.  This should
+ * probably not actually be exposed in the external interface....
+ */
+#define ENUM_LIST_SORTTYPE(_) \
+  _(BY_NONE,) \
+  _(BY_STANDARD,) \
+  _(BY_DATE,) \
+  _(BY_DATE_ENTERED,) \
+  _(BY_DATE_RECONCILED,) \
+  _(BY_NUM,) \
+  _(BY_AMOUNT,) \
+  _(BY_MEMO,) \
+  _(BY_DESC,) \
+  _(BY_ACTION,) \
+  _(BY_NOTES,)
+
+DEFINE_ENUM(SortType, ENUM_LIST_SORTTYPE)
+AS_STRING_DEC(SortType, ENUM_LIST_SORTTYPE)
+FROM_STRING_DEC(SortType, ENUM_LIST_SORTTYPE)
+#endif
+
+
+/**
+ * GTK-related; gets an identifier for the class of GNCSplitRegs.
+ **/
+GType gnc_split_reg2_get_type (void);
+
+/**
+ * Creates and returns a GNCSplitReg.
+ * @param ld            The GNCLedgerDisplay to use for display.
+ * @param parent        The containing window.
+ * @param numberOfLines The initial number of lines for the register.
+ * @param read_only      If the contained register should be setup read-only.
+ **/
+GtkWidget* gnc_split_reg2_new (GNCLedgerDisplay2 *ld,
+                              GtkWindow *parent,
+                              gint numberOfLines,
+                              gboolean read_only );
+
+/**
+ * Returns the GncTreeView Split Register in effect for this GNCSplitReg.
+ **/
+GncTreeViewSplitReg *gnc_split_reg2_get_register (GNCSplitReg2 *gsr );
+
+/**
+ * Create and returns a summarybar for this GNCSplitReg.
+ **/
+GtkWidget *gsr2_create_summary_bar (GNCSplitReg2 *gsr );
+
+/**
+ * Gets/sets the sort-type of the GNCSplitReg.
+ **/
+SortType gnc_split_reg2_get_sort_type (GNCSplitReg2 *gsr );
+void gnc_split_reg2_set_sort_type (GNCSplitReg2 *gsr, SortType t );
+
+/**
+ * Gets/sets the style of the GNCSplitReg.
+ **/
+void gnc_split_reg2_change_style (GNCSplitReg2 *gsr, SplitRegisterStyle2 style);
+
+/**
+ * Can return NULL if the indicated subwidget was not created.
+ **/
+GtkWidget *gnc_split_reg2_get_summarybar (GNCSplitReg2 *gsr );
+
+/**
+ * These will manipulate the in-GNCSplitReg state-reflecting widgets as
+ * appropriate.
+ **/
+void gnc_split_reg2_set_split_state (GNCSplitReg2 *gsr, gboolean split );
+void gnc_split_reg2_set_double_line (GNCSplitReg2 *gsr, gboolean doubleLine );
+
+void gnc_split_reg2_raise (GNCSplitReg2 *gsr );
+
+/**
+ * Callers can use this to determine if they need to reflect some "read-only"
+ * status in the window which contains the GNCSplitReg.
+ * @return TRUE if the register is read-only, FALSE if not.
+ **/
+gboolean gnc_split_reg2_get_read_only (GNCSplitReg2 *gsr );
+
+/*
+ * Function to jump to various places in the register
+ */
+void gnc_split_reg2_jump_to_blank (GNCSplitReg2 *gsr);
+void gnc_split_reg2_jump_to_split (GNCSplitReg2 *gsr, Split *split);
+void gnc_split_reg2_jump_to_split_amount (GNCSplitReg2 *gsr, Split *split);
+
+/*
+ * Create a transaction entry with given amount and date. One account is
+ * specified, the other is undefined i.e. it defaults to orphan account.
+ * Jump to the transaction entry in the register.
+ * The purpose of this function to create an adjustment entry from the reconcile
+ * window.
+ */
+void gnc_split_reg2_balancing_entry (GNCSplitReg2 *gsr, Account *account,
+                                    time_t statement_date, gnc_numeric balancing_amount);
+
+void gsr2_default_delete_handler (GNCSplitReg2 *gsr, gpointer data );
+void gnc_split_reg2_enter (GNCSplitReg2 *gsr, gboolean next_transaction );
+void gsr2_default_delete_handler (GNCSplitReg2 *gsr, gpointer data );
+void gsr2_default_reinit_handler (GNCSplitReg2 *gsr, gpointer data );
+void gsr2_default_expand_handler (GNCSplitReg2 *gsr, gpointer data );
+void gsr2_default_schedule_handler (GNCSplitReg2 *gsr, gpointer data );
+
+void gnc_split_reg2_set_moved_cb (GNCSplitReg2 *gsr, GFunc cb, gpointer cb_data );
+
+#endif /* GNC_SPLIT_REG2_H */
Index: src/gnome/gnc-plugin-page-register2.c
===================================================================
--- src/gnome/gnc-plugin-page-register2.c	(revision 22433)
+++ src/gnome/gnc-plugin-page-register2.c	(working copy)
@@ -67,7 +67,7 @@
 #include "gnc-gobject-utils.h"
 #include "gnc-gui-query.h"
 #include "gnc-icons.h"
-#include "gnc-split-reg.h"
+#include "gnc-split-reg2.h"
 #include "gnc-ui-util.h"
 #include "gnc-window.h"
 #include "gnc-main-window.h"
@@ -84,14 +84,11 @@
 static QofLogModule log_module = GNC_MOD_GUI;
 
 #define DEFAULT_LINES_AMOUNT         50
-#define GCONF_SECTION "window/pages/register2"
 
 static void gnc_plugin_page_register2_class_init (GncPluginPageRegister2Class *klass);
 static void gnc_plugin_page_register2_init (GncPluginPageRegister2 *plugin_page);
 static void gnc_plugin_page_register2_finalize (GObject *object);
 
-/* static Account *gnc_plugin_page_register2_get_current_account (GncPluginPageRegister2 *page); */
-
 static GtkWidget *gnc_plugin_page_register2_create_widget (GncPluginPage *plugin_page);
 static void gnc_plugin_page_register2_destroy_widget (GncPluginPage *plugin_page);
 static void gnc_plugin_page_register2_window_changed (GncPluginPage *plugin_page, GtkWidget *window);
@@ -128,8 +125,8 @@
 static gchar *gnc_plugin_page_register2_get_filter (GncPluginPage *plugin_page);
 void gnc_plugin_page_register2_set_filter (GncPluginPage *plugin_page, const gchar *filter);
 
-static void gnc_ppr_update_status_query (GncPluginPageRegister2 *page);
-static void gnc_ppr_update_date_query (GncPluginPageRegister2 *page);
+static void gnc_ppr_update_status_query (GncPluginPageRegister2 *page, gboolean refresh_page);
+static void gnc_ppr_update_date_query (GncPluginPageRegister2 *page, gboolean refresh_page);
 
 /* Command callbacks */
 static void gnc_plugin_page_register2_cmd_print_check (GtkAction *action, GncPluginPageRegister2 *plugin_page);
@@ -170,7 +167,7 @@
 static void gnc_plugin_page_register2_cmd_account_report (GtkAction *action, GncPluginPageRegister2 *plugin_page);
 static void gnc_plugin_page_register2_cmd_transaction_report (GtkAction *action, GncPluginPageRegister2 *plugin_page);
 
-static void gnc_plugin_page_help_changed_cb( GNCSplitReg *gsr, GncPluginPageRegister2 *register_page );
+static void gnc_plugin_page_help_changed_cb( GNCSplitReg2 *gsr, GncPluginPageRegister2 *register_page );
 static void gnc_plugin_page_register2_refresh_cb (GHashTable *changes, gpointer user_data);
 static void gnc_plugin_page_register2_close_cb (gpointer user_data);
 
@@ -245,8 +242,8 @@
         G_CALLBACK (gnc_plugin_page_register2_cmd_duplicate_transaction)
     },
     {
-        "DeleteTransactionAction", GTK_STOCK_DELETE, N_("_Delete Transaction"), NULL,
-        N_("Delete the current transaction"),
+        "DeleteTransactionAction", GTK_STOCK_DELETE, N_("_Delete Selection"), NULL,
+        N_("Delete the current selection"),
         G_CALLBACK (gnc_plugin_page_register2_cmd_delete_transaction)
     },
     {
@@ -386,17 +383,17 @@
     /* Translators: This is a menu item in the View menu */
     {
         "ViewStyleBasicAction", NULL, N_("_Basic Ledger"), NULL,
-        N_("Show transactions on one or two lines"), REG_STYLE_LEDGER
+        N_("Show transactions on one or two lines"), REG2_STYLE_LEDGER
     },
     /* Translators: This is a menu item in the View menu */
     {
         "ViewStyleAutoSplitAction", NULL, N_("_Auto-Split Ledger"), NULL,
-        N_("Show transactions on one or two lines and expand the current transaction"), REG_STYLE_AUTO_LEDGER
+        N_("Show transactions on one or two lines and expand the current transaction"), REG2_STYLE_AUTO_LEDGER
     },
     /* Translators: This is a menu item in the View menu */
     {
         "ViewStyleJournalAction", NULL, N_("Transaction _Journal"), NULL,
-        N_("Show expanded transactions with all splits"), REG_STYLE_JOURNAL
+        N_("Show expanded transactions with all splits"), REG2_STYLE_JOURNAL
     }
 };
 
@@ -474,14 +471,11 @@
 
 typedef struct GncPluginPageRegister2Private
 {
-    GNCLedgerDisplay *ledger;
-    GNCSplitReg *gsr;
-
     GtkWidget *widget;
 
+    GNCLedgerDisplay2 *ledger;
+    GNCSplitReg2 *gsr;
 
-    GncTreeViewSplitReg *tv;
-
     gint event_handler_id;
     gint component_manager_id;
     GncGUID key;  /* The guid of the Account we're watching */
@@ -558,7 +552,7 @@
 /*#################################################################################*/
 /*#################################################################################*/
 static GncPluginPage *
-gnc_plugin_page_register2_new_common (GNCLedgerDisplay *ledger)
+gnc_plugin_page_register2_new_common (GNCLedgerDisplay2 *ledger)
 {
     GncPluginPageRegister2 *register_page;
     GncPluginPageRegister2Private *priv;
@@ -567,8 +561,8 @@
     GncTreeModelSplitReg *model; 
     GtkTreeView *tv; 
 
-    GNCSplitReg *gsr;
-    SplitRegister *reg;
+    GNCSplitReg2 *gsr;
+
     const GList *item;
     GList *book_list;
     gchar *label;
@@ -576,10 +570,10 @@
     QofQuery *q;
     Account *account;
 
-g_print("Register New Common\n");
+//g_print("Register New Common\n");
 
     /* Is there an existing page? */
-    gsr = gnc_ledger_display_get_user_data (ledger);
+    gsr = gnc_ledger_display2_get_user_data (ledger);
     if (gsr)
     {
         item = gnc_gobject_tracking_get_list(GNC_PLUGIN_PAGE_REGISTER2_NAME);
@@ -592,7 +586,6 @@
         }
     }
 
-
     register_page = g_object_new (GNC_TYPE_PLUGIN_PAGE_REGISTER2, NULL);
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(register_page);
     priv->ledger = ledger;
@@ -611,33 +604,12 @@
     gnc_plugin_page_set_page_long_name(plugin_page, label);
     g_free(label);
 
-/*FIXME New Stuff here */
-
-    q = gnc_ledger_display_get_query (ledger);
+    q = gnc_ledger_display2_get_query (ledger);
     book_list = qof_query_get_books (q);
     for (item = book_list; item; item = g_list_next(item))
         gnc_plugin_page_add_book (plugin_page, (QofBook *)item->data);
     // Do not free the list. It is owned by the query.
 
-
-/*
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-*/
-
-    account = gnc_plugin_page_register2_get_account (register_page);
-
-    model = gnc_tree_model_split_reg_new_from_account(account);
-    priv->tv = gnc_tree_view_split_reg_new_with_model(model);
-
-
-
-/*    g_object_unref(G_OBJECT(model)); */
-
-
-
-
-
-
     priv->component_manager_id = 0;
     return plugin_page;
 }
@@ -648,7 +620,7 @@
 GncPluginPage *
 gnc_plugin_page_register2_new (Account *account, gboolean subaccounts)
 {
-    GNCLedgerDisplay *ledger;
+    GNCLedgerDisplay2 *ledger;
     GncPluginPage *page;
     GncPluginPageRegister2Private *priv;
 
@@ -656,9 +628,9 @@
           subaccounts ? "TRUE" : "FALSE");
 
     if (subaccounts)
-        ledger = gnc_ledger_display_subaccounts (account);
+        ledger = gnc_ledger_display2_subaccounts (account);
     else
-        ledger = gnc_ledger_display_simple (account);
+        ledger = gnc_ledger_display2_simple (account);
 
     page = gnc_plugin_page_register2_new_common(ledger);
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
@@ -671,14 +643,14 @@
 GncPluginPage *
 gnc_plugin_page_register2_new_gl (void)
 {
-    GNCLedgerDisplay *ledger;
+    GNCLedgerDisplay2 *ledger;
 
-    ledger = gnc_ledger_display_gl ();
+    ledger = gnc_ledger_display2_gl ();
     return gnc_plugin_page_register2_new_common(ledger);
 }
 
 GncPluginPage *
-gnc_plugin_page_register2_new_ledger (GNCLedgerDisplay *ledger)
+gnc_plugin_page_register2_new_ledger (GNCLedgerDisplay2 *ledger)
 {
     return gnc_plugin_page_register2_new_common(ledger);
 }
@@ -722,7 +694,7 @@
     parent = GNC_PLUGIN_PAGE(plugin_page);
     use_new = gnc_gconf_get_bool(GCONF_GENERAL_REGISTER, KEY_USE_NEW, NULL);
     g_object_set(G_OBJECT(plugin_page),
-                 "page-name",      _("General Ledger"),
+                 "page-name",      _("General Ledger2"),
                  "page-uri",       "default:",
                  "ui-description", "gnc-plugin-page-register2-ui.xml",
                  "use-new-window", use_new,
@@ -739,7 +711,7 @@
                                          plugin_page);
     gtk_action_group_add_radio_actions (action_group,
                                         radio_entries_2, n_radio_entries_2,
-                                        REG_STYLE_LEDGER,
+                                        REG2_STYLE_LEDGER,
                                         G_CALLBACK(gnc_plugin_page_register2_cmd_style_changed),
                                         plugin_page);
 
@@ -771,14 +743,14 @@
 gnc_plugin_page_register2_get_account (GncPluginPageRegister2 *page)
 {
     GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplayType ledger_type;
+    GNCLedgerDisplay2Type ledger_type;
     Account *leader;
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    ledger_type = gnc_ledger_display_type (priv->ledger);
-    leader = gnc_ledger_display_leader (priv->ledger);
+    ledger_type = gnc_ledger_display2_type (priv->ledger);
+    leader = gnc_ledger_display2_leader (priv->ledger);
 
-    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
+    if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
         return leader;
     return NULL;
 }
@@ -809,21 +781,27 @@
 };
 
 static void
-gnc_plugin_page_register2_ui_update (gpointer various, GncPluginPageRegister2 *page)
+gnc_plugin_page_register2_ui_update (gpointer various, GncPluginPageRegister2 *page) /* Working */
 {
     GncPluginPageRegister2Private *priv;
-    SplitRegister *reg;
+    GncTreeViewSplitReg *view;
+    GncTreeModelSplitReg *model;
     GtkAction *action;
     gboolean expanded, voided;
     Transaction *trans;
 
+//g_print("gnc_plugin_page_register2_ui_update\n");
+
     /* Set 'Split Transaction' */
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    expanded = gnc_split_register_current_trans_expanded(reg);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (page);
+    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+    expanded = gnc_tree_view_split_reg_current_trans_expanded (view);
+
     action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
                                          "SplitTransactionAction");
-    gtk_action_set_sensitive (action, reg->style == REG_STYLE_LEDGER);
+    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);
@@ -831,8 +809,9 @@
     (action, gnc_plugin_page_register2_cmd_expand_transaction, page);
 
     /* Set 'Void' and 'Unvoid' */
-    trans = gnc_split_register_get_current_trans(reg);
-    voided = xaccTransHasSplitsInState(trans, VREC);
+    trans = gnc_tree_view_split_reg_get_current_trans (view);
+    voided = xaccTransHasSplitsInState (trans, VREC); 
+
     action = gnc_plugin_page_get_action (GNC_PLUGIN_PAGE(page),
                                          "VoidTransactionAction");
     gtk_action_set_sensitive (GTK_ACTION(action), !voided);
@@ -862,8 +841,8 @@
     GtkActionGroup *action_group;
     GtkAction *action;
     Account *account;
-    SplitRegister *reg;
-    GNCLedgerDisplayType ledger_type;
+    GncTreeModelSplitReg *model;
+    GNCLedgerDisplay2Type ledger_type;
     int i;
     gboolean is_readwrite = !qof_book_is_readonly(gnc_get_current_book());
 
@@ -874,16 +853,16 @@
                               "sensitive", is_readwrite && account != NULL);
 
     /* Set "style" radio button */
-    ledger_type = gnc_ledger_display_type(priv->ledger);
+    ledger_type = gnc_ledger_display2_type(priv->ledger);
     gnc_plugin_update_actions(action_group, view_style_actions,
-                              "sensitive", ledger_type == LD_SINGLE);
+                              "sensitive", ledger_type == LD2_SINGLE);
 
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    model = gnc_ledger_display2_get_split_model_register(priv->ledger);
     for (i = n_radio_entries_2 - 1; i > 0; i--)
     {
         DEBUG(" index %d: comparing %x to %x", i, radio_entries_2[i].value,
-              reg->style);
-        if (radio_entries_2[i].value == reg->style)
+              model->style);
+        if (radio_entries_2[i].value == model->style)
         {
             DEBUG("match");
             break;
@@ -900,7 +879,7 @@
     action = gtk_action_group_get_action (action_group,
                                           "ViewStyleDoubleLineAction");
     g_signal_handlers_block_by_func(action, gnc_plugin_page_register2_cmd_style_double_line, page);
-    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(action), reg->use_double_line);
+    gtk_toggle_action_set_active (GTK_TOGGLE_ACTION(action), model->use_double_line);
     g_signal_handlers_unblock_by_func(action, gnc_plugin_page_register2_cmd_style_double_line, page);
 }
 
@@ -914,15 +893,12 @@
 {
     GncPluginPageRegister2 *page;
     GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplayType ledger_type;
+    GNCLedgerDisplay2Type ledger_type;
     GncWindow *gnc_window;
     guint numRows;
     GtkWidget *gsr;
 
-    GncTreeViewSplitReg *tree_view;
-    GtkWidget *scrolled_window;
-
-    SplitRegister *reg;
+    GncTreeModelSplitReg *model;
     Account *acct;
     gchar **filter;
     gchar *order;
@@ -946,57 +922,30 @@
     numRows = MIN(numRows, DEFAULT_LINES_AMOUNT);
 
     gnc_window = GNC_WINDOW(GNC_PLUGIN_PAGE(page)->window);
-/*FIXME Create widget */
 
-    scrolled_window = gtk_scrolled_window_new (NULL, NULL);
-    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled_window),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
-    gtk_widget_show(scrolled_window);
-    gtk_box_pack_start(GTK_BOX (priv->widget), scrolled_window, TRUE, TRUE, 0);
-
-    tree_view = priv->tv;
-    g_object_set(G_OBJECT(tree_view), "gconf-section", GCONF_SECTION, 
-                 "show-column-menu", TRUE, NULL);
-
-    gnc_tree_view_configure_columns(GNC_TREE_VIEW(tree_view));
-
-    gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_view), TRUE);
-    gtk_widget_show(GTK_WIDGET (tree_view));
-    gtk_container_add(GTK_CONTAINER(scrolled_window),
-                      GTK_WIDGET(tree_view));
-    gtk_widget_show(priv->widget);
-
-#ifdef SKIP
-
-    gsr = gnc_split_reg_new(priv->ledger,
+    gsr = gnc_split_reg2_new(priv->ledger,
                             gnc_window_get_gtk_window(gnc_window),
                             numRows, priv->read_only);
-    priv->gsr = (GNCSplitReg *)gsr;
-/*    gtk_widget_show (gsr); */
-/*    gtk_box_pack_start (GTK_BOX (priv->widget), gsr, TRUE, TRUE, 0); */
+    priv->gsr = (GNCSplitReg2 *)gsr;
+    gtk_widget_show (gsr);
 
+    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 ),
                       page );
 
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
 
-    gnc_split_register_config(reg, reg->type, reg->style,
-                              reg->use_double_line);
-    gnc_ledger_display_refresh(priv->ledger);
+    gnc_tree_model_split_reg_config (model, model->type, model->style, model->use_double_line);
 
-#endif
-
     gnc_plugin_page_register2_ui_initial_state (page);
     gnc_plugin_page_register2_ui_update (NULL, page);
 
-#ifdef SKIP
+    ledger_type = gnc_ledger_display2_type (priv->ledger);
 
-    ledger_type = gnc_ledger_display_type (priv->ledger);
 
-
-    if (ledger_type == LD_SINGLE || ledger_type == LD_SUBACCOUNT)
+    if (ledger_type == LD2_SINGLE || ledger_type == LD2_SUBACCOUNT)
     {
         /* Set the sort order for the split register and status of save order button */
         priv->sd.save_order = FALSE;
@@ -1004,7 +953,7 @@
 
         PINFO("Loaded Sort order is %s", order);
 
-        gnc_split_reg_set_sort_type(priv->gsr, SortTypefromString(order));
+        gnc_split_reg2_set_sort_type(priv->gsr, SortTypefromString(order));
 
         if (order && (g_strcmp0 (order, DEFAULT_SORT_ORDER) != 0))
             priv->sd.save_order = TRUE;
@@ -1049,13 +998,14 @@
         g_strfreev(filter);
 
         /* Update Query with Filter Status and Dates */
-        gnc_ppr_update_status_query (page);
-        gnc_ppr_update_date_query(page);
+        gnc_ppr_update_status_query (page, FALSE);
+        gnc_ppr_update_date_query (page, FALSE);
     }
-#endif
 
-#ifdef SKIP
-    plugin_page->summarybar = gsr_create_summary_bar(priv->gsr);
+    gnc_ledger_display2_refresh (priv->ledger);
+
+
+    plugin_page->summarybar = gsr2_create_summary_bar(priv->gsr);
     if (plugin_page->summarybar)
     {
         gtk_widget_show_all(plugin_page->summarybar);
@@ -1065,7 +1015,6 @@
         gnc_gconf_general_register_cb(KEY_SUMMARYBAR_POSITION,
                                       gnc_plugin_page_register2_summarybar_position_changed, page);
     }
-#endif
 
     priv->event_handler_id = qof_event_register_handler
                              ((QofEventHandler)gnc_plugin_page_register2_event_handler, page);
@@ -1081,11 +1030,11 @@
         gnc_gui_component_watch_entity (
             priv->component_manager_id, xaccAccountGetGUID(acct),
             QOF_EVENT_DESTROY | QOF_EVENT_MODIFY);
-/*
-    gnc_split_reg_set_moved_cb
+
+    /* This allows the plugin page to be updated from the view */
+    gnc_split_reg2_set_moved_cb
     (priv->gsr, (GFunc)gnc_plugin_page_register2_ui_update, page);
-*/
-    /* DRH - Probably lots of other stuff from regWindowLedger should end up here. */
+
     LEAVE(" ");
     return priv->widget;
 }
@@ -1136,7 +1085,7 @@
     }
 
     gtk_widget_hide(priv->widget);
-    gnc_ledger_display_close (priv->ledger);
+    gnc_ledger_display2_close (priv->ledger);
     priv->ledger = NULL;
     LEAVE(" ");
 }
@@ -1171,11 +1120,13 @@
 #define KEY_REGISTER_STYLE      "RegisterStyle"
 #define KEY_DOUBLE_LINE         "DoubleLineMode"
 
+
 #define LABEL_ACCOUNT		"Account"
 #define LABEL_SUBACCOUNT	"SubAccount"
 #define LABEL_GL		"GL"
 #define LABEL_SEARCH		"Search"
 
+#define SPLIT_REGISTER_GUID "SplitRegister GUID"
 
 /** Save enough information about this register page that it can be
  *  recreated next time the user starts gnucash.
@@ -1183,7 +1134,7 @@
  *  @param plugin_page The page to save.
  *
  *  @param key_file A pointer to the GKeyFile data structure where the
- *  page information should be written.
+ *  page information should be written.gnc_plugin_page_register2_save_page
  *
  *  @param group_name The group name to use when saving data. */
 static void
@@ -1193,8 +1144,8 @@
 {
     GncPluginPageRegister2 *page;
     GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplayType ledger_type;
-    SplitRegister *reg;
+    GNCLedgerDisplay2Type ledger_type;
+    GncTreeModelSplitReg *model;
     Account *leader;
 
     g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
@@ -1207,30 +1158,30 @@
     page = GNC_PLUGIN_PAGE_REGISTER2(plugin_page);
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
 
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
-    ledger_type = gnc_ledger_display_type(priv->ledger);
-    if (ledger_type > LD_GL)
+    model = gnc_ledger_display2_get_split_model_register(priv->ledger);
+    ledger_type = gnc_ledger_display2_type(priv->ledger);
+    if (ledger_type > LD2_GL)
     {
         LEAVE("Unsupported ledger type");
         return;
     }
-    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
+    if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
     {
         const gchar *label;
         gchar* name;
-        label = (ledger_type == LD_SINGLE) ? LABEL_ACCOUNT : LABEL_SUBACCOUNT;
-        leader = gnc_ledger_display_leader(priv->ledger);
+        label = (ledger_type == LD2_SINGLE) ? LABEL_ACCOUNT : LABEL_SUBACCOUNT;
+        leader = gnc_ledger_display2_leader(priv->ledger);
         g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE, label);
         name = gnc_account_get_full_name(leader);
         g_key_file_set_string(key_file, group_name, KEY_ACCOUNT_NAME, name);
         g_free(name);
     }
-    else if (reg->type == GENERAL_LEDGER)
+    else if (model->type == GENERAL_LEDGER2)
     {
         g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE,
                               LABEL_GL);
     }
-    else if (reg->type == SEARCH_LEDGER)
+    else if (model->type == SEARCH_LEDGER2)
     {
         g_key_file_set_string(key_file, group_name, KEY_REGISTER_TYPE,
                               LABEL_SEARCH);
@@ -1241,10 +1192,8 @@
         return;
     }
 
-    g_key_file_set_string(key_file, group_name, KEY_REGISTER_STYLE,
-                          style_names[reg->style]);
-    g_key_file_set_boolean(key_file, group_name, KEY_DOUBLE_LINE,
-                           reg->use_double_line);
+    g_key_file_set_string(key_file, group_name, KEY_REGISTER_STYLE, style_names[model->style]);
+    g_key_file_set_boolean(key_file, group_name, KEY_DOUBLE_LINE, model->use_double_line);
 
     LEAVE(" ");
 }
@@ -1291,7 +1240,7 @@
     g_free(style_name);
 
     /* Update the style menu action for this page */
-    if (i <= REG_STYLE_JOURNAL)
+    if (i <= REG2_STYLE_JOURNAL)
     {
         DEBUG("Setting style: %d", i);
         action = gnc_plugin_page_get_action(page, radio_entries_2[i].name);
@@ -1394,10 +1343,11 @@
     gboolean can_copy = FALSE, can_cut = FALSE, can_paste = FALSE;
     gboolean has_selection;
     gboolean is_readwrite = !qof_book_is_readonly(gnc_get_current_book());
-
+//g_print("gnc_plugin_page_register2_update_edit_menu\n");
     reg_page = GNC_PLUGIN_PAGE_REGISTER2(page);
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(reg_page);
-    has_selection = gnucash_register_has_selection (priv->gsr->reg);
+/*FIXME    has_selection = gnucash_register_has_selection (priv->gsr->reg); */
+    has_selection = FALSE;
 
     can_copy = has_selection;
     can_cut = is_readwrite && has_selection;
@@ -1420,16 +1370,16 @@
 {
     GncPluginPageRegister2Private *priv;
     GncPluginPageRegister2 *reg_page;
-    SplitRegister *reg;
+    GncTreeModelSplitReg *model;
     GtkWidget *dialog, *window;
     const gchar *name;
     gint response;
 
     reg_page = GNC_PLUGIN_PAGE_REGISTER2(page);
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(reg_page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    model = gnc_ledger_display2_get_split_model_register(priv->ledger);
 
-    if (!reg || !gnc_split_register_changed(reg))
+/*FIXME    if (!model || !gnc_split_register_changed(model)) */
         return TRUE;
 
     name = gnc_plugin_page_register2_get_tab_name(page);
@@ -1460,12 +1410,12 @@
     switch (response)
     {
     case GTK_RESPONSE_ACCEPT:
-        gnc_split_register_save(reg, TRUE);
+/*FIXME        gnc_split_register_save(model, TRUE); */
         return TRUE;
 
     case GTK_RESPONSE_REJECT:
-        gnc_split_register_cancel_cursor_trans_changes(reg);
-        gnc_split_register_save (reg, TRUE);
+/*FIXME        gnc_split_register_cancel_cursor_trans_changes(model); */
+/*FIXME        gnc_split_register_save (model, TRUE); */
         return TRUE;
 
     default:
@@ -1478,29 +1428,29 @@
 gnc_plugin_page_register2_get_tab_name (GncPluginPage *plugin_page)
 {
     GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplayType ledger_type;
-    GNCLedgerDisplay *ld;
-    SplitRegister *reg;
+    GNCLedgerDisplay2Type ledger_type;
+    GNCLedgerDisplay2 *ld;
+    GncTreeModelSplitReg *model;
     Account *leader;
 
     g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page), _("unknown"));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
     ld = priv->ledger;
-    reg = gnc_ledger_display_get_split_register (ld);
-    ledger_type = gnc_ledger_display_type (ld);
-    leader = gnc_ledger_display_leader (ld);
+    model = gnc_ledger_display2_get_split_model_register(ld);
+    ledger_type = gnc_ledger_display2_type (ld);
+    leader = gnc_ledger_display2_leader (ld);
 
     switch (ledger_type)
     {
-    case LD_SINGLE:
+    case LD2_SINGLE:
         return g_strdup(xaccAccountGetName (leader));
 
-    case LD_SUBACCOUNT:
+    case LD2_SUBACCOUNT:
         return g_strdup_printf("%s+", xaccAccountGetName (leader));
 
-    case LD_GL:
-        switch (reg->type)
+    case LD2_GL:
+        switch (model->type)
         {
         case GENERAL_LEDGER:
         case INCOME_LEDGER:
@@ -1525,9 +1475,8 @@
 gnc_plugin_page_register2_get_tab_color (GncPluginPage *plugin_page)
 {
     GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplayType ledger_type;
-    GNCLedgerDisplay *ld;
-    SplitRegister *reg;
+    GNCLedgerDisplay2Type ledger_type;
+    GNCLedgerDisplay2 *ld;
     Account *leader;
     const char* color;
 
@@ -1535,12 +1484,11 @@
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
     ld = priv->ledger;
-    reg = gnc_ledger_display_get_split_register (ld);
-    ledger_type = gnc_ledger_display_type (ld);
-    leader = gnc_ledger_display_leader (ld);
+    ledger_type = gnc_ledger_display2_type (ld);
+    leader = gnc_ledger_display2_leader (ld);
     color = NULL;
 
-    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
+    if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
         color = xaccAccountGetColor (leader);
 
     return g_strdup(color ? color : "Not Set");
@@ -1550,9 +1498,8 @@
 gnc_plugin_page_register2_get_filter (GncPluginPage *plugin_page)
 {
     GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplayType ledger_type;
-    GNCLedgerDisplay *ld;
-    SplitRegister *reg;
+    GNCLedgerDisplay2Type ledger_type;
+    GNCLedgerDisplay2 *ld;
     Account *leader;
     const char* filter;
 
@@ -1560,12 +1507,11 @@
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
     ld = priv->ledger;
-    reg = gnc_ledger_display_get_split_register (ld);
-    ledger_type = gnc_ledger_display_type (ld);
-    leader = gnc_ledger_display_leader (ld);
+    ledger_type = gnc_ledger_display2_type (ld);
+    leader = gnc_ledger_display2_leader (ld);
     filter = NULL;
 
-    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
+    if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
         filter = xaccAccountGetFilter (leader);
 
     return filter ? g_strdup(filter) : g_strdup_printf("%s,%s,%s", DEFAULT_FILTER, "0", "0");
@@ -1575,17 +1521,15 @@
 gnc_plugin_page_register2_set_filter (GncPluginPage *plugin_page, const gchar *filter )
 {
     GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplayType ledger_type;
-    GNCLedgerDisplay *ld;
-    SplitRegister *reg;
+    GNCLedgerDisplay2Type ledger_type;
+    GNCLedgerDisplay2 *ld;
     Account *leader;
     gchar *default_filter;
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
     ld = priv->ledger;
-    reg = gnc_ledger_display_get_split_register (ld);
-    ledger_type = gnc_ledger_display_type (ld);
-    leader = gnc_ledger_display_leader (ld);
+    ledger_type = gnc_ledger_display2_type (ld);
+    leader = gnc_ledger_display2_leader (ld);
 
     if (leader != NULL)
     {
@@ -1598,7 +1542,6 @@
 
         g_free (default_filter);
     }
-
     return;
 }
 
@@ -1606,9 +1549,8 @@
 gnc_plugin_page_register2_get_sort_order (GncPluginPage *plugin_page)
 {
     GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplayType ledger_type;
-    GNCLedgerDisplay *ld;
-    SplitRegister *reg;
+    GNCLedgerDisplay2Type ledger_type;
+    GNCLedgerDisplay2 *ld;
     Account *leader;
     const char* sort_order;
 
@@ -1616,12 +1558,11 @@
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
     ld = priv->ledger;
-    reg = gnc_ledger_display_get_split_register (ld);
-    ledger_type = gnc_ledger_display_type (ld);
-    leader = gnc_ledger_display_leader (ld);
+    ledger_type = gnc_ledger_display2_type (ld);
+    leader = gnc_ledger_display2_leader (ld);
     sort_order = NULL;
 
-    if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
+    if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
         sort_order = xaccAccountGetSortOrder (leader);
 
     return g_strdup(sort_order ? sort_order : DEFAULT_SORT_ORDER);
@@ -1631,16 +1572,14 @@
 gnc_plugin_page_register2_set_sort_order (GncPluginPage *plugin_page, const gchar *sort_order )
 {
     GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplayType ledger_type;
-    GNCLedgerDisplay *ld;
-    SplitRegister *reg;
+    GNCLedgerDisplay2Type ledger_type;
+    GNCLedgerDisplay2 *ld;
     Account *leader;
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
     ld = priv->ledger;
-    reg = gnc_ledger_display_get_split_register (ld);
-    ledger_type = gnc_ledger_display_type (ld);
-    leader = gnc_ledger_display_leader (ld);
+    ledger_type = gnc_ledger_display2_type (ld);
+    leader = gnc_ledger_display2_leader (ld);
 
     if (leader != NULL)
     {
@@ -1657,25 +1596,23 @@
 gnc_plugin_page_register2_get_long_name (GncPluginPage *plugin_page)
 {
     GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplayType ledger_type;
-    GNCLedgerDisplay *ld;
-    SplitRegister *reg;
+    GNCLedgerDisplay2Type ledger_type;
+    GNCLedgerDisplay2 *ld;
     Account *leader;
 
     g_return_val_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page), _("unknown"));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
     ld = priv->ledger;
-    reg = gnc_ledger_display_get_split_register (ld);
-    ledger_type = gnc_ledger_display_type (ld);
-    leader = gnc_ledger_display_leader (ld);
+    ledger_type = gnc_ledger_display2_type (ld);
+    leader = gnc_ledger_display2_leader (ld);
 
     switch (ledger_type)
     {
-    case LD_SINGLE:
+    case LD2_SINGLE:
         return gnc_account_get_full_name (leader);
 
-    case LD_SUBACCOUNT:
+    case LD2_SUBACCOUNT:
     {
         gchar *account_full_name = gnc_account_get_full_name (leader);
         gchar *return_string = g_strdup_printf("%s+", account_full_name);
@@ -1755,7 +1692,7 @@
     if (response != GTK_RESPONSE_OK)
     {
         /* Restore the original sort order */
-        gnc_split_reg_set_sort_type(priv->gsr, priv->sd.original_sort_type);
+        gnc_split_reg2_set_sort_type(priv->gsr, priv->sd.original_sort_type);
         priv->sd.save_order = priv->sd.original_save_order;
     }
     else
@@ -1764,7 +1701,7 @@
 
         if (priv->sd.save_order)
         {
-            type = gnc_split_reg_get_sort_type(priv->gsr);
+            type = gnc_split_reg2_get_sort_type(priv->gsr);
             order = SortTypeasString(type);
             gnc_plugin_page_register2_set_sort_order (plugin_page, order);
         }
@@ -1798,7 +1735,7 @@
     name = gtk_buildable_get_name(GTK_BUILDABLE(button));
     ENTER("button %s(%p), page %p", name, button, page);
     type = SortTypefromString(name);
-    gnc_split_reg_set_sort_type(priv->gsr, type);
+    gnc_split_reg2_set_sort_type(priv->gsr, type);
     LEAVE(" ");
 }
 
@@ -1850,15 +1787,15 @@
  *  associated with this filter dialog.
  */
 static void
-gnc_ppr_update_status_query (GncPluginPageRegister2 *page)
+gnc_ppr_update_status_query (GncPluginPageRegister2 *page, gboolean refresh_page)
 {
     GncPluginPageRegister2Private *priv;
     GSList *param_list;
     Query *query;
-
+//g_print("gnc_ppr_update_status_query\n");
     ENTER(" ");
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    query = gnc_ledger_display_get_query( priv->ledger );
+    query = gnc_ledger_display2_get_query (priv->ledger );
     if (!query)
     {
         LEAVE("no query found");
@@ -1877,7 +1814,8 @@
     if (priv->fd.cleared_match != CLEARED_ALL)
         xaccQueryAddClearedMatch(query, priv->fd.cleared_match, QOF_QUERY_AND);
 
-    gnc_ledger_display_refresh (priv->ledger);
+    if(refresh_page)
+        gnc_ledger_display2_refresh (priv->ledger);
     LEAVE(" ");
 }
 
@@ -1895,7 +1833,7 @@
  *  associated with this filter dialog.
  */
 static void
-gnc_ppr_update_date_query (GncPluginPageRegister2 *page)
+gnc_ppr_update_date_query (GncPluginPageRegister2 *page, gboolean refresh_page)
 {
     GncPluginPageRegister2Private *priv;
     GSList *param_list;
@@ -1909,7 +1847,7 @@
         return;
     }
 
-    query = gnc_ledger_display_get_query( priv->ledger );
+    query = gnc_ledger_display2_get_query( priv->ledger );
     if (!query)
     {
         LEAVE("no query");
@@ -1933,7 +1871,8 @@
                                 QOF_QUERY_AND);
     }
 
-    gnc_ledger_display_refresh (priv->ledger);
+    if(refresh_page)
+        gnc_ledger_display2_refresh (priv->ledger);
     LEAVE(" ");
 }
 
@@ -2019,7 +1958,7 @@
         priv->fd.cleared_match |= value;
     else
         priv->fd.cleared_match &= ~value;
-    gnc_ppr_update_status_query(page);
+    gnc_ppr_update_status_query(page, TRUE);
     LEAVE(" ");
 }
 
@@ -2058,7 +1997,7 @@
     /* Set the requested status */
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
     priv->fd.cleared_match = CLEARED_ALL;
-    gnc_ppr_update_status_query(page);
+    gnc_ppr_update_status_query(page, TRUE);
     LEAVE(" ");
 }
 
@@ -2158,7 +2097,7 @@
         priv->fd.start_time = 0;
         priv->fd.end_time = 0;
     }
-    gnc_ppr_update_date_query(page);
+    gnc_ppr_update_date_query(page, TRUE);
     LEAVE(" ");
 }
 
@@ -2181,7 +2120,7 @@
 
     ENTER("(widget %s(%p), page %p)", gtk_buildable_get_name(GTK_BUILDABLE(unused)), unused, page);
     get_filter_times(page);
-    gnc_ppr_update_date_query(page);
+    gnc_ppr_update_date_query(page, TRUE);
     LEAVE(" ");
 }
 
@@ -2228,7 +2167,7 @@
     active = ( g_strcmp0(name, g_strdup("start_date_choose")) == 0 ? 1 : 0 );
     gtk_widget_set_sensitive(priv->fd.start_date, active);
     get_filter_times(page);
-    gnc_ppr_update_date_query(page);
+    gnc_ppr_update_date_query(page, TRUE);
     LEAVE(" ");
 }
 
@@ -2275,7 +2214,7 @@
     active = ( g_strcmp0(name, g_strdup("end_date_choose")) == 0 ? 1 : 0 );
     gtk_widget_set_sensitive(priv->fd.end_date, active);
     get_filter_times(page);
-    gnc_ppr_update_date_query(page);
+    gnc_ppr_update_date_query(page, TRUE);
     LEAVE(" ");
 }
 
@@ -2339,11 +2278,12 @@
     {
         /* Remove the old status match */
         priv->fd.cleared_match = priv->fd.original_cleared_match;
-        gnc_ppr_update_status_query(page);
+        gnc_ppr_update_status_query(page, FALSE);
         priv->fd.start_time = priv->fd.original_start_time;
         priv->fd.end_time = priv->fd.original_end_time;
         priv->fd.save_filter = priv->fd.original_save_filter;
-        gnc_ppr_update_date_query(page);
+        gnc_ppr_update_date_query(page, FALSE);
+        gnc_ledger_display2_refresh (priv->ledger);
     }
     else
     {
@@ -2389,22 +2329,22 @@
 /************************************************************/
 
 static char *
-gnc_reg_get_name (GNCLedgerDisplay *ledger, gboolean for_window)
+gnc_reg_get_name (GNCLedgerDisplay2 *ledger, gboolean for_window)
 {
     Account *leader;
-    SplitRegister *reg;
+    GncTreeModelSplitReg *model;
     gchar *account_name;
     gchar *reg_name;
     gchar *name;
-    GNCLedgerDisplayType ledger_type;
+    GNCLedgerDisplay2Type ledger_type;
 
     if (ledger == NULL)
         return NULL;
 
-    reg = gnc_ledger_display_get_split_register (ledger);
-    ledger_type = gnc_ledger_display_type (ledger);
+    model = gnc_ledger_display2_get_split_model_register (ledger);
+    ledger_type = gnc_ledger_display2_type (ledger);
 
-    switch (reg->type)
+    switch (model->type)
     {
     case GENERAL_LEDGER:
     case INCOME_LEDGER:
@@ -2433,13 +2373,13 @@
         break;
     }
 
-    leader = gnc_ledger_display_leader (ledger);
+    leader = gnc_ledger_display2_leader (ledger);
 
-    if ((leader != NULL) && (ledger_type != LD_GL))
+    if ((leader != NULL) && (ledger_type != LD2_GL))
     {
         account_name = gnc_account_get_full_name (leader);
 
-        if (ledger_type == LD_SINGLE)
+        if (ledger_type == LD2_SINGLE)
         {
             name = g_strconcat (account_name, " - ", reg_name, NULL);
         }
@@ -2447,7 +2387,7 @@
         {
             name = g_strconcat (account_name, " ", _("and subaccounts"), " - ", reg_name, NULL);
         }
-        g_free(account_name);
+        g_free (account_name);
     }
     else
         name = g_strdup (reg_name);
@@ -2456,9 +2396,9 @@
 }
 
 static int
-report_helper (GNCLedgerDisplay *ledger, Split *split, Query *query)
+report_helper (GNCLedgerDisplay2 *ledger, Split *split, Query *query)
 {
-    SplitRegister *reg = gnc_ledger_display_get_split_register (ledger);
+    SplitRegister *reg = gnc_ledger_display2_get_split_register (ledger);
     Account *account;
     char *str;
     swig_type_info * qtype;
@@ -2490,7 +2430,7 @@
 
     if (!query)
     {
-        query = gnc_ledger_display_get_query (ledger);
+        query = gnc_ledger_display2_get_query (ledger);
         g_return_val_if_fail (query != NULL, -1);
     }
 
@@ -2519,7 +2459,7 @@
     qtype = SWIG_TypeQuery ("_p_Account");
     g_return_val_if_fail (qtype, -1);
 
-    account = gnc_ledger_display_leader (ledger);
+    account = gnc_ledger_display2_leader (ledger);
     arg = SWIG_NewPointerObj (account, qtype, 0);
     args = scm_cons (arg, args);
     g_return_val_if_fail (arg != SCM_UNDEFINED, -1);
@@ -2545,16 +2485,16 @@
     Split         * split;
     Transaction   * trans;
     GList         * splits = NULL, *item;
-    GNCLedgerDisplayType ledger_type;
+    GNCLedgerDisplay2Type ledger_type;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 #ifdef SKIP
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
-    ledger_type = gnc_ledger_display_type(priv->ledger);
-    if (ledger_type == LD_SINGLE || ledger_type == LD_SUBACCOUNT)
+    reg = gnc_ledger_display2_get_split_register (priv->ledger);
+    ledger_type = gnc_ledger_display2_type(priv->ledger);
+    if (ledger_type == LD2_SINGLE || ledger_type == LD2_SUBACCOUNT)
     {
         split    = gnc_split_register_get_current_split(reg);
         trans    = xaccSplitGetParent(split);
@@ -2566,10 +2506,10 @@
             g_list_free(splits);
         }
     }
-    else if (ledger_type == LD_GL && reg->type == SEARCH_LEDGER)
+    else if (ledger_type == LD2_GL && reg->type == SEARCH_LEDGER)
     {
         Account *common_acct = NULL, *account;
-        splits = qof_query_run(gnc_ledger_display_get_query(priv->ledger));
+        splits = qof_query_run(gnc_ledger_display2_get_query(priv->ledger));
         /* Make sure each split is from the same account */
         for (item = splits; item; item = g_list_next(item))
         {
@@ -2695,7 +2635,7 @@
 
     ENTER("(action %p, page %p)", action, page);
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-/* This function has the original ledger type */
+/*FIXME This function has the original ledger type */
 /*    gnc_ui_find_transactions_dialog_create(priv->ledger); */
     LEAVE(" ");
 }
@@ -2712,7 +2652,7 @@
 
     ENTER("(action %p, page %p)", action, page);
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    reg = gnc_ledger_display2_get_split_register(priv->ledger);
     gnc_split_register_cut_current(reg);
     LEAVE(" ");
 }
@@ -2729,7 +2669,7 @@
 
     ENTER("(action %p, page %p)", action, page);
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    reg = gnc_ledger_display2_get_split_register(priv->ledger);
     gnc_split_register_copy_current(reg);
     LEAVE(" ");
 }
@@ -2746,7 +2686,7 @@
 
     ENTER("(action %p, page %p)", action, page);
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    reg = gnc_ledger_display2_get_split_register(priv->ledger);
     gnc_split_register_paste_current(reg);
     LEAVE(" ");
 }
@@ -2769,7 +2709,7 @@
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    reg = gnc_ledger_display2_get_split_register(priv->ledger);
     trans = gnc_split_register_get_current_trans(reg);
     if (trans == NULL)
         return;
@@ -2785,7 +2725,7 @@
         return;
 
     builder = gtk_builder_new();
-    gnc_builder_add_from_file  (builder , "gnc-plugin-page-register.glade", "Void Transaction");
+    gnc_builder_add_from_file  (builder , "gnc-plugin-page-register2.glade", "Void Transaction");
     dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Void Transaction"));
     entry = GTK_WIDGET(gtk_builder_get_object (builder, "reason"));
 
@@ -2817,7 +2757,7 @@
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    reg = gnc_ledger_display2_get_split_register(priv->ledger);
     trans = gnc_split_register_get_current_trans(reg);
     if (!xaccTransHasSplitsInState(trans, VREC))
         return;
@@ -2832,7 +2772,7 @@
 {
     GncPluginPageRegister2Private *priv;
     SplitRegister *reg;
-    GNCSplitReg *gsr;
+    GNCSplitReg2 *gsr;
     Transaction *trans, *new_trans;
 
     ENTER("(action %p, page %p)", action, page);
@@ -2840,7 +2780,7 @@
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    reg = gnc_ledger_display2_get_split_register(priv->ledger);
     trans = gnc_split_register_get_current_trans(reg);
     if (trans == NULL)
         return;
@@ -2863,7 +2803,7 @@
 
     /* Now jump to new trans */
     gsr = gnc_plugin_page_register2_get_gsr(GNC_PLUGIN_PAGE(page));
-    gnc_split_reg_jump_to_split(gsr, xaccTransGetSplit(new_trans, 0));
+    gnc_split_reg2_jump_to_split(gsr, xaccTransGetSplit(new_trans, 0));
     LEAVE(" ");
 }
 
@@ -2873,7 +2813,7 @@
 {
     GncPluginPageRegister2Private *priv;
     SplitRegister *reg;
-    GNCSplitReg *gsr;
+    GNCSplitReg2 *gsr;
     Transaction *trans, *new_trans;
     Timespec entered;
 
@@ -2882,7 +2822,7 @@
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    reg = gnc_ledger_display2_get_split_register(priv->ledger);
     trans = gnc_split_register_get_current_trans(reg);
     if (trans == NULL)
         return;
@@ -2922,7 +2862,7 @@
     /* Create the dialog */
 
     builder = gtk_builder_new();
-    gnc_builder_add_from_file  (builder, "gnc-plugin-page-register.glade", "Sort By");
+    gnc_builder_add_from_file  (builder, "gnc-plugin-page-register2.glade", "Sort By");
     dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Sort By"));
     priv->sd.dialog = dialog;
     gtk_window_set_transient_for(GTK_WINDOW(dialog),
@@ -2934,7 +2874,7 @@
     g_free(title);
 
     /* Set the button for the current sort order */
-    sort = gnc_split_reg_get_sort_type(priv->gsr);
+    sort = gnc_split_reg2_get_sort_type(priv->gsr);
     name = SortTypeasString(sort);
     button = GTK_WIDGET(gtk_builder_get_object (builder, name));
     DEBUG("current sort %d, button %s(%p)", sort, name, button);
@@ -2980,7 +2920,7 @@
 
     /* Create the dialog */
     builder = gtk_builder_new();
-    gnc_builder_add_from_file (builder, "gnc-plugin-page-register.glade", "Filter By");
+    gnc_builder_add_from_file (builder, "gnc-plugin-page-register2.glade", "Filter By");
     dialog = GTK_WIDGET(gtk_builder_get_object (builder, "Filter By"));
     priv->fd.dialog = dialog;
     gtk_window_set_transient_for(GTK_WINDOW(dialog),
@@ -3009,7 +2949,7 @@
 
     /* Set the date info */
     button = GTK_WIDGET(gtk_builder_get_object (builder, "filter_show_range"));
-    query = gnc_ledger_display_get_query (priv->ledger);
+    query = gnc_ledger_display2_get_query (priv->ledger);
     xaccQueryGetDateMatchTT(query, &start_time, &end_time);
     priv->fd.original_start_time = start_time;
     priv->fd.start_time = start_time;
@@ -3108,10 +3048,10 @@
 static void
 gnc_plugin_page_register2_cmd_style_changed (GtkAction *action,
         GtkRadioAction *current,
-        GncPluginPageRegister2 *plugin_page)
+        GncPluginPageRegister2 *plugin_page) //this works
 {
     GncPluginPageRegister2Private *priv;
-    SplitRegisterStyle value;
+    SplitRegisterStyle2 value;
 
     ENTER("(action %p, radio action %p, plugin_page %p)",
           action, current, plugin_page);
@@ -3122,18 +3062,21 @@
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
     value = gtk_radio_action_get_current_value(current);
-    gnc_split_reg_change_style(priv->gsr, value);
+    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)));
+
     gnc_plugin_page_register2_ui_update (NULL, plugin_page);
     LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_register2_cmd_style_double_line (GtkToggleAction *action,
-        GncPluginPageRegister2 *plugin_page)
+        GncPluginPageRegister2 *plugin_page) // this works
 {
     GncPluginPageRegister2Private *priv;
-    SplitRegister *reg;
+    GncTreeModelSplitReg *model;
+    GncTreeViewSplitReg *view;
     gboolean use_double_line;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
@@ -3142,13 +3085,16 @@
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
+    model = gnc_ledger_display2_get_split_model_register (priv->ledger);
 
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
     use_double_line =  gtk_toggle_action_get_active (action);
-    if (use_double_line != reg->use_double_line)
+    if (use_double_line != model->use_double_line)
     {
-        gnc_split_register_config(reg, reg->type, reg->style, use_double_line);
-        gnc_ledger_display_refresh(priv->ledger);
+        gnc_tree_model_split_reg_config (model, model->type, model->style, use_double_line);
+        gtk_tree_view_collapse_all (GTK_TREE_VIEW(view));
+        gnc_ledger_display2_refresh (priv->ledger);
     }
     LEAVE(" ");
 }
@@ -3244,69 +3190,71 @@
 
 static void
 gnc_plugin_page_register2_cmd_enter_transaction (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page)
+        GncPluginPageRegister2 *plugin_page) //this works
 {
     GncPluginPageRegister2Private *priv;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+    g_return_if_fail (GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
 
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    gnc_split_reg_enter(priv->gsr, FALSE);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    gnc_split_reg2_enter (priv->gsr, FALSE);
     LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_register2_cmd_cancel_transaction (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page)
+        GncPluginPageRegister2 *plugin_page) //this works
 {
     GncPluginPageRegister2Private *priv;
+    GncTreeViewSplitReg *view;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
 
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    gnc_split_register_cancel_cursor_trans_changes
-    (gnc_ledger_display_get_split_register(priv->ledger));
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+
+    gnc_tree_view_split_reg_cancel_edit (view);
+
     LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_register2_cmd_delete_transaction (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page)
+        GncPluginPageRegister2 *plugin_page) //this works
 {
     GncPluginPageRegister2Private *priv;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
 
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    gsr_default_delete_handler(priv->gsr, NULL);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+
+    gsr2_default_delete_handler (priv->gsr, NULL);
     LEAVE(" ");
 
 }
 
 static void
 gnc_plugin_page_register2_cmd_blank_transaction (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page)
+        GncPluginPageRegister2 *plugin_page) //this works
 {
     GncPluginPageRegister2Private *priv;
-    SplitRegister *reg;
+    GncTreeViewSplitReg *view;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
 
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
 
-    if (gnc_split_register_save (reg, TRUE))
-        gnc_split_register_redraw (reg);
-
-    gnc_split_reg_jump_to_blank (priv->gsr);
+    gnc_tree_view_split_reg_jump_to_blank (view);
     LEAVE(" ");
 }
 
@@ -3322,41 +3270,41 @@
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
     gnc_split_register_duplicate_current
-    (gnc_ledger_display_get_split_register(priv->ledger));
+    (gnc_ledger_display2_get_split_register(priv->ledger));
     LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_register2_cmd_reinitialize_transaction (GtkAction *action,
-        GncPluginPageRegister2 *plugin_page)
+        GncPluginPageRegister2 *plugin_page) //this works
 {
     GncPluginPageRegister2Private *priv;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
 
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    gsr_default_reinit_handler(priv->gsr, NULL);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    gsr2_default_reinit_handler (priv->gsr, NULL);
     LEAVE(" ");
 }
 
 static void
 gnc_plugin_page_register2_cmd_expand_transaction (GtkToggleAction *action,
-        GncPluginPageRegister2 *plugin_page)
+        GncPluginPageRegister2 *plugin_page) // this works
 {
     GncPluginPageRegister2Private *priv;
-    SplitRegister *reg;
+    GncTreeViewSplitReg *view;
     gboolean expand;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
 
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
     expand = gtk_toggle_action_get_active (action);
-    gnc_split_register_expand_current_trans (reg, expand);
+    gnc_tree_view_split_reg_expand_current_trans (view, expand);
     LEAVE(" ");
 }
 
@@ -3372,7 +3320,7 @@
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
+    reg = gnc_ledger_display2_get_split_register (priv->ledger);
 
     /* XXX Ignore the return value -- we don't care if this succeeds */
     (void)gnc_split_register_handle_exchange (reg, TRUE);
@@ -3381,23 +3329,24 @@
 
 static void
 gnc_plugin_page_register2_cmd_jump (GtkAction *action,
-                                   GncPluginPageRegister2 *plugin_page)
+                                   GncPluginPageRegister2 *plugin_page) //this works
 {
     GncPluginPageRegister2Private *priv;
     GncPluginPage *new_page;
     GncPluginPageRegister2 *new_reg_page;
     GtkWidget *window;
-    GNCSplitReg *gsr;
-    SplitRegister *reg;
+    GNCSplitReg2 *gsr;
+    GncTreeViewSplitReg *view;
     Account *account;
     Account *leader;
     Split *split;
+    RowDepth depth;
 
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
-    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
+    g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2 (plugin_page));
 
-    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
+    priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE (plugin_page);
     window = GNC_PLUGIN_PAGE (plugin_page)->window;
     if (window == NULL)
     {
@@ -3405,35 +3354,52 @@
         return;
     }
 
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
-    split = gnc_split_register_get_current_split (reg);
+    view = gnc_ledger_display2_get_split_view_register (priv->ledger);
+    split = gnc_tree_view_split_reg_get_current_split (view);
     if (split == NULL)
     {
-        LEAVE("no split (1)");
+        LEAVE("split is NULL");
         return;
     }
 
+    if (!gnc_tree_view_split_reg_current_trans_expanded (view))
+    {
+        Transaction *trans = xaccSplitGetParent (split);
+        if (xaccTransCountSplits (trans) > 2)
+        {
+            LEAVE("more than 2 splits");
+            return;
+        }
+    }
+
+    depth = gnc_tree_view_reg_get_selected_row_depth (view);
+    if (gnc_tree_view_split_reg_current_trans_expanded (view) && depth != SPLIT3)
+    {
+        LEAVE("expanded but no split selected");
+        return;
+    }
+
     account = xaccSplitGetAccount (split);
     if (account == NULL)
     {
-        LEAVE("no account");
+        LEAVE("account is NULL");
         return;
     }
 
-    leader = gnc_ledger_display_leader (priv->ledger);
+    leader = gnc_ledger_display2_leader (priv->ledger);
     if (account == leader)
     {
         split = xaccSplitGetOtherSplit (split);
         if (split == NULL)
         {
-            LEAVE("no split (2)");
+            LEAVE("no other split");
             return;
         }
 
         account = xaccSplitGetAccount (split);
         if (account == NULL)
         {
-            LEAVE("no account (2)");
+            LEAVE("no other account");
             return;
         }
 
@@ -3450,11 +3416,11 @@
         LEAVE("couldn't create new page");
         return;
     }
-    new_reg_page = GNC_PLUGIN_PAGE_REGISTER2(new_page);
+    new_reg_page = GNC_PLUGIN_PAGE_REGISTER2 (new_page);
 
-    gnc_main_window_open_page (GNC_MAIN_WINDOW(window), new_page);
+    gnc_main_window_open_page (GNC_MAIN_WINDOW (window), new_page);
     gsr = gnc_plugin_page_register2_get_gsr (new_page);
-    gnc_split_reg_jump_to_split(gsr, split);
+    gnc_split_reg2_jump_to_split (gsr, split);
     LEAVE(" ");
 }
 
@@ -3469,7 +3435,7 @@
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    gsr_default_schedule_handler(priv->gsr, NULL);
+    gsr2_default_schedule_handler(priv->gsr, NULL);
     LEAVE(" ");
 }
 
@@ -3488,14 +3454,14 @@
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    query = gnc_ledger_display_get_query( priv->ledger );
+    query = gnc_ledger_display2_get_query( priv->ledger );
     if (query == NULL)
     {
         LEAVE("no query found");
         return;
     }
 
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    reg = gnc_ledger_display2_get_split_register(priv->ledger);
     trans = gnc_split_register_get_current_trans(reg);
     if (trans == NULL)
     {
@@ -3527,7 +3493,7 @@
     ENTER("(action %p, plugin_page %p)", action, plugin_page);
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    query = gnc_ledger_display_get_query( priv->ledger );
+    query = gnc_ledger_display2_get_query( priv->ledger );
     if (!query)
     {
         LEAVE("no query found");
@@ -3587,7 +3553,7 @@
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(plugin_page));
 
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(plugin_page);
-    reg = gnc_ledger_display_get_split_register (priv->ledger);
+    reg = gnc_ledger_display2_get_split_register (priv->ledger);
 
     split = gnc_split_register_get_current_split (reg);
     if (!split)
@@ -3627,7 +3593,7 @@
     priv->read_only         = read_only;
 }
 
-GNCSplitReg *
+GNCSplitReg2 *
 gnc_plugin_page_register2_get_gsr (GncPluginPage *plugin_page)
 {
     GncPluginPageRegister2 *page;
@@ -3642,7 +3608,7 @@
 }
 
 static void
-gnc_plugin_page_help_changed_cb (GNCSplitReg *gsr, GncPluginPageRegister2 *register_page)
+gnc_plugin_page_help_changed_cb (GNCSplitReg2 *gsr, GncPluginPageRegister2 *register_page)
 {
     GncPluginPageRegister2Private *priv;
     SplitRegister *reg;
@@ -3661,7 +3627,7 @@
 
     /* Get the text from the ledger */
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(register_page);
-    reg = gnc_ledger_display_get_split_register(priv->ledger);
+    reg = gnc_ledger_display2_get_split_register(priv->ledger);
     help = gnc_table_get_help(reg->table);
     gnc_window_set_status(window, GNC_PLUGIN_PAGE(register_page), help);
     g_free(help);
@@ -3675,10 +3641,11 @@
 
     g_return_if_fail(GNC_IS_PLUGIN_PAGE_REGISTER2(page));
     priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-
+//g_print("gnc_plugin_page_register2_refresh_cb\n");
     if (changes)
     {
         const EventInfo* ei;
+//g_print("gnc_plugin_page_register2_refresh_cb 1\n");
         ei = gnc_gui_get_entity_events(changes, &priv->key);
         if (ei)
         {
@@ -3694,8 +3661,10 @@
     }
     else
     {
-        /* forced updates */
-        gnucash_register_refresh_from_gconf(priv->gsr->reg);
+//g_print("gnc_plugin_page_register2_refresh_cb 2\n");
+        /* Force updates */
+
+/*FIXME        gnucash_register_refresh_from_gconf(priv->gsr->reg); */
         gtk_widget_queue_draw(priv->widget);
     }
 
@@ -3722,7 +3691,7 @@
 {
     GncPluginPageRegister2 *page;
     GncPluginPageRegister2Private *priv;
-    GNCLedgerDisplayType ledger_type;
+    GNCLedgerDisplay2Type ledger_type;
     const GncGUID *acct_guid;
     const GList *citem;
     GList *item, *kill = NULL;
@@ -3736,13 +3705,13 @@
     {
         page = (GncPluginPageRegister2 *)citem->data;
         priv = GNC_PLUGIN_PAGE_REGISTER2_GET_PRIVATE(page);
-        ledger_type = gnc_ledger_display_type (priv->ledger);
-        if (ledger_type == LD_GL)
+        ledger_type = gnc_ledger_display2_type (priv->ledger);
+        if (ledger_type == LD2_GL)
         {
             kill = g_list_append(kill, page);
             /* kill it */
         }
-        else if ((ledger_type == LD_SINGLE) || (ledger_type == LD_SUBACCOUNT))
+        else if ((ledger_type == LD2_SINGLE) || (ledger_type == LD2_SUBACCOUNT))
         {
             if (guid_compare(acct_guid, &priv->key) == 0)
             {
Index: src/gnome/gnc-plugin-page-register2.h
===================================================================
--- src/gnome/gnc-plugin-page-register2.h	(revision 22433)
+++ src/gnome/gnc-plugin-page-register2.h	(working copy)
@@ -38,9 +38,9 @@
 #include <gtk/gtk.h>
 
 #include "Account.h"
-#include "gnc-ledger-display.h"
+#include "gnc-ledger-display2.h"
 #include "gnc-plugin-page.h"
-#include "gnc-split-reg.h"
+#include "gnc-split-reg2.h"
 
 G_BEGIN_DECLS
 
@@ -99,7 +99,7 @@
  *  @return The newly created plugin page.
  */
 GncPluginPage *
-gnc_plugin_page_register2_new_ledger (GNCLedgerDisplay *ledger);
+gnc_plugin_page_register2_new_ledger (GNCLedgerDisplay2 *ledger);
 
 
 /** Create a new "register" plugin page containing a general ledger.
@@ -129,7 +129,7 @@
  *
  *  @param plugin_page A "register" page.
  */
-GNCSplitReg *
+GNCSplitReg2 *
 gnc_plugin_page_register2_get_gsr (GncPluginPage *plugin_page);
 

Index: src/gnome/gtkbuilder/gnc-plugin-page-register2.glade
===================================================================
--- src/gnome/gtkbuilder/gnc-plugin-page-register2.glade	(revision 0)
+++ src/gnome/gtkbuilder/gnc-plugin-page-register2.glade	(revision 0)
@@ -0,0 +1,1193 @@
+<?xml version="1.0"?>
+<interface>
+  <requires lib="gtk+" version="2.16"/>
+  <!-- interface-naming-policy toplevel-contextual -->
+  <object class="GtkDialog" id="Duplicate Transaction Dialog">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Duplicate Transaction</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox15">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">6</property>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area15">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button76">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button77">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="duplicate_title_label">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">0</property>
+            <property name="label" translatable="yes">&lt;b&gt;New Transaction Information&lt;/b&gt;</property>
+            <property name="use_markup">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkAlignment" id="alignment1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="left_padding">12</property>
+            <child>
+              <object class="GtkTable" id="duplicate_table">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="n_rows">2</property>
+                <property name="n_columns">2</property>
+                <property name="column_spacing">12</property>
+                <property name="row_spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="date_label">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">_Date:</property>
+                    <property name="use_underline">True</property>
+                    <property name="justify">center</property>
+                  </object>
+                  <packing>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="num_label">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">_Number:</property>
+                    <property name="use_underline">True</property>
+                    <property name="justify">center</property>
+                    <property name="mnemonic_widget">num_spin</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="num_spin">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="has_focus">True</property>
+                    <property name="primary_icon_activatable">False</property>
+                    <property name="secondary_icon_activatable">False</property>
+                    <property name="primary_icon_sensitive">True</property>
+                    <property name="secondary_icon_sensitive">True</property>
+                    <property name="adjustment">adjustment1</property>
+                    <property name="climb_rate">1</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="y_options"></property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHBox" id="date_hbox">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                    <property name="y_options">GTK_FILL</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">button76</action-widget>
+      <action-widget response="-5">button77</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="Filter By">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Filter register by...</property>
+    <property name="resizable">False</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">dialog</property>
+    <signal name="response" handler="gnc_plugin_page_register2_filter_response_cb" swapped="no"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox19">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">6</property>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area21">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="cancelbutton4">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="okbutton4">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkNotebook" id="notebook1">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <child>
+              <object class="GtkVBox" id="vbox103">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="border_width">12</property>
+                <child>
+                  <object class="GtkRadioButton" id="filter_show_all">
+                    <property name="label" translatable="yes">Show _All</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label847680">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="filter_show_range">
+                    <property name="label" translatable="yes">Select Range:</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                    <property name="group">filter_show_all</property>
+                    <signal name="toggled" handler="gnc_plugin_page_register2_filter_select_range_cb" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkTable" id="select_range_table">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="n_rows">7</property>
+                    <property name="n_columns">3</property>
+                    <property name="column_spacing">6</property>
+                    <child>
+                      <object class="GtkLabel" id="label847682">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Start:</property>
+                      </object>
+                      <packing>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                        <property name="x_padding">12</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="start_date_earliest">
+                        <property name="label" translatable="yes">_Earliest</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="clicked" handler="gnc_plugin_page_register2_filter_start_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="end_date_choose">
+                        <property name="label" translatable="yes">Choo_se Date:</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="clicked" handler="gnc_plugin_page_register2_filter_end_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">6</property>
+                        <property name="bottom_attach">7</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="end_date_today">
+                        <property name="label" translatable="yes">Toda_y</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">end_date_choose</property>
+                        <signal name="clicked" handler="gnc_plugin_page_register2_filter_end_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">5</property>
+                        <property name="bottom_attach">6</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="end_date_latest">
+                        <property name="label" translatable="yes">_Latest</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">end_date_choose</property>
+                        <signal name="clicked" handler="gnc_plugin_page_register2_filter_end_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">4</property>
+                        <property name="bottom_attach">5</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label847683">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label847684">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">End:</property>
+                      </object>
+                      <packing>
+                        <property name="top_attach">4</property>
+                        <property name="bottom_attach">5</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                        <property name="x_padding">12</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="start_date_choose">
+                        <property name="label" translatable="yes">C_hoose Date:</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">start_date_earliest</property>
+                        <signal name="clicked" handler="gnc_plugin_page_register2_filter_start_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkRadioButton" id="start_date_today">
+                        <property name="label" translatable="yes">_Today</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <property name="group">start_date_earliest</property>
+                        <signal name="clicked" handler="gnc_plugin_page_register2_filter_start_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkHBox" id="start_date_hbox">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkHBox" id="end_date_hbox">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <placeholder/>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left_attach">2</property>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">6</property>
+                        <property name="bottom_attach">7</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="label847678">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Date</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkVBox" id="vbox104">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkTable" id="table1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="border_width">12</property>
+                    <property name="n_rows">7</property>
+                    <property name="n_columns">3</property>
+                    <child>
+                      <object class="GtkCheckButton" id="filter_status_unreconciled">
+                        <property name="label" translatable="yes">_Unreconciled</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="toggled" handler="gnc_plugin_page_register2_filter_status_one_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="right_attach">3</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="filter_status_reconciled">
+                        <property name="label" translatable="yes">_Reconciled</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="toggled" handler="gnc_plugin_page_register2_filter_status_one_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="filter_status_cleared">
+                        <property name="label" translatable="yes">C_leared</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="toggled" handler="gnc_plugin_page_register2_filter_status_one_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">2</property>
+                        <property name="bottom_attach">3</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="filter_status_voided">
+                        <property name="label" translatable="yes">_Voided</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="toggled" handler="gnc_plugin_page_register2_filter_status_one_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">3</property>
+                        <property name="bottom_attach">4</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkCheckButton" id="filter_status_frozen">
+                        <property name="label" translatable="yes">_Frozen</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                        <signal name="toggled" handler="gnc_plugin_page_register2_filter_status_one_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">4</property>
+                        <property name="bottom_attach">5</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkButton" id="button84">
+                        <property name="label" translatable="yes">Select _All</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <signal name="clicked" handler="gnc_plugin_page_register2_filter_status_all_cb" swapped="no"/>
+                      </object>
+                      <packing>
+                        <property name="left_attach">1</property>
+                        <property name="right_attach">2</property>
+                        <property name="top_attach">6</property>
+                        <property name="bottom_attach">7</property>
+                        <property name="x_options">GTK_FILL</property>
+                        <property name="y_options"></property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkHSeparator" id="hseparator1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                      </object>
+                      <packing>
+                        <property name="right_attach">3</property>
+                        <property name="top_attach">5</property>
+                        <property name="bottom_attach">6</property>
+                        <property name="y_options">GTK_EXPAND</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child type="tab">
+              <object class="GtkLabel" id="label847679">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Status</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="position">1</property>
+                <property name="tab_fill">False</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkHBox" id="hbox1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkCheckButton" id="filter_save">
+                <property name="label" translatable="yes">Sa_ve Filter</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="xalign">1</property>
+                <property name="draw_indicator">True</property>
+                <signal name="toggled" handler="gnc_plugin_page_register2_filter_save_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="padding">6</property>
+                <property name="pack_type">end</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancelbutton4</action-widget>
+      <action-widget response="-5">okbutton4</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="Sort By">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Sort register by...</property>
+    <property name="resizable">False</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="type_hint">dialog</property>
+    <signal name="response" handler="gnc_plugin_page_register2_sort_response_cb" swapped="no"/>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox17">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">6</property>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area19">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="cancelbutton2">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="okbutton2">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVBox" id="vbox101">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">12</property>
+            <child>
+              <object class="GtkRadioButton" id="BY_STANDARD">
+                <property name="label" translatable="yes">_Standard Order</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Keep normal account order</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+                <signal name="toggled" handler="gnc_plugin_page_register2_sort_button_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHSeparator" id="hseparator2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="BY_DATE">
+                <property name="label" translatable="yes">_Date</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Sort by date</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">BY_STANDARD</property>
+                <signal name="toggled" handler="gnc_plugin_page_register2_sort_button_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="BY_DATE_ENTERED">
+                <property name="label" translatable="yes">Date of _Entry</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Sort by the date of entry</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">BY_STANDARD</property>
+                <signal name="toggled" handler="gnc_plugin_page_register2_sort_button_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="BY_DATE_RECONCILED">
+                <property name="label" translatable="yes">S_tatement Date</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Sort by the statement date (unreconciled items last)</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">BY_STANDARD</property>
+                <signal name="toggled" handler="gnc_plugin_page_register2_sort_button_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">4</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="BY_NUM">
+                <property name="label" translatable="yes">Num_ber</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Sort by number</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">BY_STANDARD</property>
+                <signal name="toggled" handler="gnc_plugin_page_register2_sort_button_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">5</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="BY_AMOUNT">
+                <property name="label" translatable="yes">Amo_unt</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Sort by amount</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">BY_STANDARD</property>
+                <signal name="toggled" handler="gnc_plugin_page_register2_sort_button_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">6</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="BY_MEMO">
+                <property name="label" translatable="yes">_Memo</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Sort by memo</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">BY_STANDARD</property>
+                <signal name="toggled" handler="gnc_plugin_page_register2_sort_button_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">7</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="BY_DESC">
+                <property name="label" translatable="yes">Descri_ption</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Sort by description</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">BY_STANDARD</property>
+                <signal name="toggled" handler="gnc_plugin_page_register2_sort_button_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">8</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="BY_ACTION">
+                <property name="label" translatable="yes">_Action</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Sort by action field</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">BY_STANDARD</property>
+                <signal name="toggled" handler="gnc_plugin_page_register2_sort_button_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">9</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="BY_NOTES">
+                <property name="label" translatable="yes">_Notes</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="tooltip_text" translatable="yes">Sort by notes field</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">BY_STANDARD</property>
+                <signal name="toggled" handler="gnc_plugin_page_register2_sort_button_cb" swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">10</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHSeparator" id="hseparator1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">11</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">12</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkHBox" id="hbox1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <child>
+                  <object class="GtkCheckButton" id="sort_save">
+                    <property name="label" translatable="yes">Sa_ve Sort Order</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_action_appearance">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">1</property>
+                    <property name="draw_indicator">True</property>
+                    <signal name="toggled" handler="gnc_plugin_page_register2_sort_order_save_cb" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="padding">6</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">False</property>
+                <property name="position">14</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancelbutton2</action-widget>
+      <action-widget response="-5">okbutton2</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkDialog" id="Void Transaction">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Void Transaction</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox16">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">6</property>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area18">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="cancelbutton1">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="okbutton1">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVBox" id="vbox100">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkLabel" id="label847671">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label" translatable="yes">Reason for voiding transaction:</property>
+                <property name="justify">center</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkEntry" id="reason">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="has_focus">True</property>
+                <property name="activates_default">True</property>
+                <property name="primary_icon_activatable">False</property>
+                <property name="secondary_icon_activatable">False</property>
+                <property name="primary_icon_sensitive">True</property>
+                <property name="secondary_icon_sensitive">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancelbutton1</action-widget>
+      <action-widget response="-5">okbutton1</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">1000000000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+</interface>
Index: src/gnome/gtkbuilder/Makefile.am
===================================================================
--- src/gnome/gtkbuilder/Makefile.am	(revision 22433)
+++ src/gnome/gtkbuilder/Makefile.am	(working copy)
@@ -15,6 +15,7 @@
 	dialog-tax-info.glade \
 	gnc-plugin-page-budget.glade \
 	gnc-plugin-page-register.glade \
+	gnc-plugin-page-register2.glade \
 	window-autoclear.glade \
 	window-reconcile.glade
 
Index: src/gnome/Makefile.am
===================================================================
--- src/gnome/Makefile.am	(revision 22433)
+++ src/gnome/Makefile.am	(working copy)
@@ -53,6 +53,7 @@
   gnc-plugin-page-register.c \
   gnc-plugin-page-register2.c \
   gnc-split-reg.c \
+  gnc-split-reg2.c \
   reconcile-view.c \
   top-level.c \
   window-reconcile.c \
@@ -91,6 +92,7 @@
   gnc-plugin-page-register.h \
   gnc-plugin-page-register2.h \
   gnc-split-reg.h \
+  gnc-split-reg2.h \
   reconcile-view.h \
   top-level.h \
   window-reconcile.h \
Index: src/gnome/ui/gnc-plugin-page-account-tree2-ui.xml
===================================================================
--- src/gnome/ui/gnc-plugin-page-account-tree2-ui.xml	(revision 22433)
+++ src/gnome/ui/gnc-plugin-page-account-tree2-ui.xml	(working copy)
@@ -9,6 +9,7 @@
         <menuitem name="FileOpenAccount" action="FileOpenAccountAction"/>
         <menuitem name="FileOpenAccount2" action="FileOpenAccount2Action"/>
         <menuitem name="FileOpenSubaccounts" action="FileOpenSubaccountsAction"/>
+        <menuitem name="FileOpenSubaccounts2" action="FileOpenSubaccounts2Action"/>
       </placeholder>
     </menu>
     <menu name="Actions" action="ActionsAction">
@@ -37,6 +38,7 @@
       <menuitem name="AccountOpenAccount" action="FileOpenAccountAction"/>
       <menuitem name="AccountOpenAccount2" action="FileOpenAccount2Action"/>
       <menuitem name="AccountOpenSubaccounts" action="FileOpenSubaccountsAction"/>
+      <menuitem name="AccountOpenSubaccounts2" action="FileOpenSubaccounts2Action"/>
       <menuitem name="AccountEditAccount" action="EditEditAccountAction"/>
       <separator name="AccountSep1"/>
       <menuitem name="AccountReconcile" action="ActionsReconcileAction"/>
Index: po/POTFILES.in
===================================================================
--- po/POTFILES.in	(revision 22433)
+++ po/POTFILES.in	(working copy)
@@ -205,6 +205,7 @@
 src/gnome/gnc-plugin-register2.c
 src/gnome/gnc-plugin-register.c
 src/gnome/gnc-split-reg.c
+src/gnome/gnc-split-reg2.c
 src/gnome/gtkbuilder/assistant-acct-period.glade
 src/gnome/gtkbuilder/assistant-hierarchy.glade
 src/gnome/gtkbuilder/assistant-loan.glade
@@ -220,6 +221,7 @@
 src/gnome/gtkbuilder/dialog-tax-info.glade
 src/gnome/gtkbuilder/gnc-plugin-page-budget.glade
 src/gnome/gtkbuilder/gnc-plugin-page-register.glade
+src/gnome/gtkbuilder/gnc-plugin-page-register2.glade
 src/gnome/gtkbuilder/window-autoclear.glade
 src/gnome/gtkbuilder/window-reconcile.glade
 src/gnome/reconcile-view.c
@@ -456,6 +458,7 @@
 src/plugins/customer_import/libgncmod-customer_import.c
 src/python/gncmod-python.c
 src/register/ledger-core/gnc-ledger-display.c
+src/register/ledger-core/gnc-ledger-display2.c
 src/register/ledger-core/gncmod-ledger-core.c
 src/register/ledger-core/split-register.c
 src/register/ledger-core/split-register-control.c
