From 93ba986b30c8e66eedfd2c4f239f25bd1aea8172 Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Wed, 28 Feb 2001 07:04:44 +0000 Subject: [PATCH] * src/register/gnome/gnucash-scrolled-window.c: subclass of gtk_scrolled_window for use in register. * src/register/gnome/gnucash-item-list.c: use scrolled window for really long account names. * doc/sgml/es/Makefile.am (GNUCASH_SGML_FILES): fix list of sgml files * src/gnc-ui.h: use gncUIWidget not GtkWidget* in non-gnome directories. * src/engine/sql/PostgresBackend.c (pgendSyncTransaction): add missing call to gnc_engine_resume_events (). git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3717 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 17 ++++ doc/sgml/es/Makefile.am | 13 +-- src/engine/sql/PostgresBackend.c | 6 +- src/gnc-ui.h | 6 +- src/register/gnome/Makefile.am | 2 + src/register/gnome/combocell-gnome.c | 7 +- src/register/gnome/gnucash-item-edit.c | 30 +++++-- src/register/gnome/gnucash-item-edit.h | 5 +- src/register/gnome/gnucash-item-list.c | 40 +++++---- src/register/gnome/gnucash-scrolled-window.c | 90 ++++++++++++++++++++ src/register/gnome/gnucash-scrolled-window.h | 64 ++++++++++++++ 11 files changed, 240 insertions(+), 40 deletions(-) create mode 100644 src/register/gnome/gnucash-scrolled-window.c create mode 100644 src/register/gnome/gnucash-scrolled-window.h diff --git a/ChangeLog b/ChangeLog index 26124e2e65..6bb601567c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2001-02-27 Dave Peticolas + + * src/register/gnome/gnucash-scrolled-window.c: subclass of + gtk_scrolled_window for use in register. + + * src/register/gnome/gnucash-item-list.c: use scrolled window + for really long account names. + + * doc/sgml/es/Makefile.am (GNUCASH_SGML_FILES): fix list of sgml + files + + * src/gnc-ui.h: use gncUIWidget not GtkWidget* in non-gnome + directories. + + * src/engine/sql/PostgresBackend.c (pgendSyncTransaction): add + missing call to gnc_engine_resume_events (). + 2001-02-28 Robert Graham Merkel * src/scm/report/transaction-report.scm: Formatting cleanups. diff --git a/doc/sgml/es/Makefile.am b/doc/sgml/es/Makefile.am index c933040219..7327fdaa1b 100644 --- a/doc/sgml/es/Makefile.am +++ b/doc/sgml/es/Makefile.am @@ -2,7 +2,9 @@ gnucash_helpdir = $(GNC_HELPDIR)/es GNUCASH_SGML_FILES = \ bofa-mym.sgml \ - gnucash.sgml \ + gnucash.sgml \ + gpl-es.sgml \ + traduccion.sgml \ xacc-about.sgml \ xacc-accountedit.sgml \ xacc-acctypes.sgml \ @@ -15,7 +17,7 @@ GNUCASH_SGML_FILES = \ xacc-currencyhandling.sgml \ xacc-dateinput.sgml \ xacc-depreciation.sgml \ - xacc-dochack.sgml \ + xacc-dochack.sgml \ xacc-doubleentry.sgml \ xacc-euro.sgml \ xacc-gpl.sgml \ @@ -38,10 +40,11 @@ GNUCASH_SGML_FILES = \ xacc-tax-report.sgml \ xacc-ticker.sgml \ xacc-trans-report.sgml \ - xacc-txf-export-report.sgml \ xacc-txf-export-anomalies.sgml \ - xacc-userdocs.sgml \ - xacc-y2k.sgml + xacc-txf-export-report.sgml \ + xacc-userdocs.sgml \ + xacc-y2k.sgml + gnucash_html_dir = $(top_srcdir)/doc/html/C diff --git a/src/engine/sql/PostgresBackend.c b/src/engine/sql/PostgresBackend.c index ad1c0db233..3582aa046b 100644 --- a/src/engine/sql/PostgresBackend.c +++ b/src/engine/sql/PostgresBackend.c @@ -904,8 +904,8 @@ pgendCopyTransactionToEngine (PGBackend *be, GUID *trans_guid) * account. */ modity = gnc_string_to_commodity (DB_GET_VAL("currency",j)); #if 0 - xaccTransSetCurrency (trans, - gnc_string_to_commodity (DB_GET_VAL("currency",j))); + xaccTransSetCurrency + (trans, gnc_string_to_commodity (DB_GET_VAL("currency",j))); #endif } } @@ -1136,6 +1136,8 @@ pgendSyncTransaction (PGBackend *be, GUID *trans_guid) * pretty much shouldn't be allowed to exist in this * framework */ pgendStoreTransaction (be, trans); + + gnc_engine_resume_events(); return; } diff --git a/src/gnc-ui.h b/src/gnc-ui.h index 09359686fe..f3be1a4e84 100644 --- a/src/gnc-ui.h +++ b/src/gnc-ui.h @@ -85,9 +85,9 @@ int gnc_choose_radio_option_dialog_parented(gncUIWidget parent, int default_value, char **radio_list); -gboolean gnc_dup_trans_dialog (GtkWidget * parent, time_t *date_p, +gboolean gnc_dup_trans_dialog (gncUIWidget parent, time_t *date_p, const char *num, char **out_num); -void gnc_tax_info_dialog (GtkWidget * parent); +void gnc_tax_info_dialog (gncUIWidget parent); void gnc_stock_split_dialog (Account * initial); /* Open a dialog asking for username and password. The heading and @@ -96,7 +96,7 @@ void gnc_stock_split_dialog (Account * initial); * output variables. They should be g_freed when no longer needed. If * the dialog returns FALSE, the user pressed CANCEL and NULL was * stored in username and password. */ -gboolean gnc_get_username_password (GtkWidget *parent, +gboolean gnc_get_username_password (gncUIWidget parent, const char *heading, const char *initial_username, const char *initial_password, diff --git a/src/register/gnome/Makefile.am b/src/register/gnome/Makefile.am index ad5a49fe57..a60c51a236 100644 --- a/src/register/gnome/Makefile.am +++ b/src/register/gnome/Makefile.am @@ -11,6 +11,7 @@ libgncregistergnome_a_SOURCES = \ gnucash-header.c \ gnucash-item-edit.c \ gnucash-item-list.c \ + gnucash-scrolled-window.c \ gnucash-sheet.c \ gnucash-style.c \ quickfillcell-gnome.c \ @@ -24,6 +25,7 @@ noinst_HEADERS = \ gnucash-header.h \ gnucash-item-edit.h \ gnucash-item-list.h \ + gnucash-scrolled-window.h \ gnucash-sheet.h \ gnucash-style.h diff --git a/src/register/gnome/combocell-gnome.c b/src/register/gnome/combocell-gnome.c index 8f6b926be9..180d2224be 100644 --- a/src/register/gnome/combocell-gnome.c +++ b/src/register/gnome/combocell-gnome.c @@ -773,14 +773,15 @@ get_popup_height (GnomeCanvasItem *item, int row_height, gpointer user_data) { - return (space_available / row_height) * row_height; + return space_available; } -static void +static int popup_autosize (GnomeCanvasItem *item, + int max_width, gpointer user_data) { - gnc_item_list_autosize (GNC_ITEM_LIST (item)); + return max_width; } static void diff --git a/src/register/gnome/gnucash-item-edit.c b/src/register/gnome/gnucash-item-edit.c index b7adfd2468..db5ba625ee 100644 --- a/src/register/gnome/gnucash-item-edit.c +++ b/src/register/gnome/gnucash-item-edit.c @@ -1291,6 +1291,7 @@ item_edit_show_popup (ItemEdit *item_edit) gint x, y, w, h; gint y_offset; gint popup_x, popup_y; + gint popup_width; gint popup_height; gint popup_max_width; gint view_height; @@ -1338,15 +1339,28 @@ item_edit_show_popup (ItemEdit *item_edit) item_edit->popup_user_data); if (item_edit->popup_autosize) - item_edit->popup_autosize (item_edit->popup_item, - item_edit->popup_user_data); + popup_width = + item_edit->popup_autosize (item_edit->popup_item, + popup_max_width, + item_edit->popup_user_data); + else + popup_width = 0; - gnome_canvas_item_set (item_edit->popup_item, - "x", (gdouble) popup_x, - "y", (gdouble) popup_y, - "height", (gdouble) popup_height, - "anchor", popup_anchor, - NULL); + if (popup_width > 0) + gnome_canvas_item_set (item_edit->popup_item, + "x", (gdouble) popup_x, + "y", (gdouble) popup_y, + "height", (gdouble) popup_height, + "width", (gdouble) popup_max_width, + "anchor", popup_anchor, + NULL); + else + gnome_canvas_item_set (item_edit->popup_item, + "x", (gdouble) popup_x, + "y", (gdouble) popup_y, + "height", (gdouble) popup_height, + "anchor", popup_anchor, + NULL); toggle = item_edit->popup_toggle.toggle_button; diff --git a/src/register/gnome/gnucash-item-edit.h b/src/register/gnome/gnucash-item-edit.h index 662c28f331..26bc687e9f 100644 --- a/src/register/gnome/gnucash-item-edit.h +++ b/src/register/gnome/gnucash-item-edit.h @@ -37,8 +37,9 @@ typedef int (*GetPopupHeight) (GnomeCanvasItem *item, int row_height, gpointer user_data); -typedef void (*PopupAutosize) (GnomeCanvasItem *item, - gpointer user_data); +typedef int (*PopupAutosize) (GnomeCanvasItem *item, + int max_width, + gpointer user_data); typedef void (*PopupSetFocus) (GnomeCanvasItem *item, gpointer user_data); diff --git a/src/register/gnome/gnucash-item-list.c b/src/register/gnome/gnucash-item-list.c index fe56411615..05766bc8f9 100644 --- a/src/register/gnome/gnucash-item-list.c +++ b/src/register/gnome/gnucash-item-list.c @@ -26,8 +26,9 @@ #include -#include "gnucash-item-list.h" #include "gnc-engine-util.h" +#include "gnucash-item-list.h" +#include "gnucash-scrolled-window.h" /* Item list signals */ @@ -355,34 +356,39 @@ clist_select_row_cb(GtkCList *clist, gint row, gint column, GnomeCanvasItem * gnc_item_list_new(GnomeCanvasGroup *parent) { - GtkWidget *clist, *hbox, *scrollbar; + GtkWidget *frame; + GtkWidget *clist; + GtkWidget *scrollwin; GnomeCanvasItem *item; GNCItemList *item_list; - hbox = gtk_hbox_new(FALSE, 0); + frame = gtk_frame_new (NULL); - clist = gtk_clist_new(1); - gtk_box_pack_start(GTK_BOX(hbox), clist, TRUE, TRUE, 0); + scrollwin = gnc_scrolled_window_new (); + gtk_container_add (GTK_CONTAINER (frame), scrollwin); + + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + + clist = gtk_clist_new (1); + gtk_container_add (GTK_CONTAINER (scrollwin), clist); gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_BROWSE); - scrollbar = gtk_vscrollbar_new(NULL); - gtk_box_pack_start(GTK_BOX(hbox), scrollbar, FALSE, FALSE, 0); - gtk_clist_set_vadjustment(GTK_CLIST(clist), - gtk_range_get_adjustment - (GTK_RANGE(scrollbar))); + gtk_widget_show_all (frame); - item = gnome_canvas_item_new(parent, gnc_item_list_get_type(), - "widget", hbox, - "size_pixels", TRUE, - "x", -10000.0, - "y", -10000.0, - NULL); + item = gnome_canvas_item_new (parent, gnc_item_list_get_type(), + "widget", frame, + "size_pixels", TRUE, + "x", -10000.0, + "y", -10000.0, + NULL); item_list = GNC_ITEM_LIST (item); item_list->clist = GTK_CLIST (clist); - gtk_signal_connect_after(GTK_OBJECT(hbox), "button_press_event", + gtk_signal_connect_after(GTK_OBJECT(frame), "button_press_event", GTK_SIGNAL_FUNC(gnc_item_list_button_event), (gpointer) item_list); diff --git a/src/register/gnome/gnucash-scrolled-window.c b/src/register/gnome/gnucash-scrolled-window.c new file mode 100644 index 0000000000..61d4c69ede --- /dev/null +++ b/src/register/gnome/gnucash-scrolled-window.c @@ -0,0 +1,90 @@ +/********************************************************************\ + * gnucash-scrolled-window.c -- gnucash specific scrolled window * + * Copyright (C) 2001 Gnumatic, Inc. * + * Author: Dave Peticolas * + * * + * 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 * + * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * + * Boston, MA 02111-1307, USA gnu@gnu.org * +\********************************************************************/ + +#include "config.h" + +#include "gnucash-scrolled-window.h" + + +/** Static Globals ****************************************************/ +static GtkScrolledWindowClass *parent_class = NULL; + + +/** Declarations ******************************************************/ +static void gnc_scrolled_window_class_init (GNCScrolledWindowClass *class); +static void gnc_scrolled_window_init (GNCScrolledWindow *scrollwin); + + +/** Implementations ***************************************************/ + +GtkType +gnc_scrolled_window_get_type (void) +{ + static GtkType gnc_scrolled_window_type = 0; + + if (!gnc_scrolled_window_type) + { + static const GtkTypeInfo gnc_scrolled_window_info = + { + "GNCScrolledWindow", + sizeof (GNCScrolledWindow), + sizeof (GNCScrolledWindowClass), + (GtkClassInitFunc) gnc_scrolled_window_class_init, + (GtkObjectInitFunc) gnc_scrolled_window_init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL + }; + + gnc_scrolled_window_type = gtk_type_unique (GTK_TYPE_SCROLLED_WINDOW, + &gnc_scrolled_window_info); + } + + return gnc_scrolled_window_type; +} + + +GtkWidget * +gnc_scrolled_window_new (void) +{ + return gtk_widget_new (GNC_TYPE_SCROLLED_WINDOW, + "hadjustment", NULL, + "vadjustment", NULL, + NULL); +} + + +static void +gnc_scrolled_window_class_init (GNCScrolledWindowClass *class) +{ + GtkScrolledWindowClass *scroll_class = (GtkScrolledWindowClass *) class; + + parent_class = gtk_type_class (GTK_TYPE_SCROLLED_WINDOW); + + scroll_class->scrollbar_spacing = 0; +} + +static void +gnc_scrolled_window_init (GNCScrolledWindow *scrollwin) +{ +} diff --git a/src/register/gnome/gnucash-scrolled-window.h b/src/register/gnome/gnucash-scrolled-window.h new file mode 100644 index 0000000000..94e2a32f14 --- /dev/null +++ b/src/register/gnome/gnucash-scrolled-window.h @@ -0,0 +1,64 @@ +/********************************************************************\ + * gnucash-scrolled-window.h -- gnucash specific scrolled window * + * Copyright (C) 2001 Gnumatic, Inc. * + * Author: Dave Peticolas * + * * + * 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 * + * 59 Temple Place - Suite 330 Fax: +1-617-542-2652 * + * Boston, MA 02111-1307, USA gnu@gnu.org * +\********************************************************************/ + +#ifndef __GNC_SCROLLED_WINDOW_H__ +#define __GNC_SCROLLED_WINDOW_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +#define GNC_TYPE_SCROLLED_WINDOW (gnc_scrolled_window_get_type ()) +#define GNC_SCROLLED_WINDOW(obj) (GTK_CHECK_CAST ((obj), GNC_TYPE_SCROLLED_WINDOW, GNCScrolledWindow)) +#define GNC_SCROLLED_WINDOW_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_SCROLLED_WINDOW, GNCScrolledWindowClass)) +#define GNC_IS_SCROLLED_WINDOW(obj) (GTK_CHECK_TYPE ((obj), GNC_TYPE_SCROLLED_WINDOW)) +#define GNC_IS_SCROLLED_WINDOW_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GNC_TYPE_SCROLLED_WINDOW)) + + +typedef struct _GNCScrolledWindow GNCScrolledWindow; +typedef struct _GNCScrolledWindowClass GNCScrolledWindowClass; + +struct _GNCScrolledWindow +{ + GtkScrolledWindow scrollwin; +}; + +struct _GNCScrolledWindowClass +{ + GtkScrolledWindowClass parent_class; +}; + + +GtkType gnc_scrolled_window_get_type (void); +GtkWidget * gnc_scrolled_window_new (void); + + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __GNC_SCROLLED_WINDOW_H__ */