mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
2001-05-02 Dave Peticolas <dave@krondo.com>
* src/gnome/dialog-column-view.c: work on gui * src/gnome/dialog-utils.c (gnc_clist_columns_autosize): new func git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4101 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
d6e1de9a0a
commit
aa777e7cc8
@ -1,3 +1,9 @@
|
||||
2001-05-02 Dave Peticolas <dave@krondo.com>
|
||||
|
||||
* src/gnome/dialog-column-view.c: work on gui
|
||||
|
||||
* src/gnome/dialog-utils.c (gnc_clist_columns_autosize): new func
|
||||
|
||||
2001-05-02 Robert Graham Merkel <rgmerk@mira.net>
|
||||
|
||||
* src/scm/report/transaction-report.scm: Fix bug with subheading
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "dialog-column-view.h"
|
||||
#include "dialog-options.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "glade-cb-gnc-dialogs.h"
|
||||
#include "glade-gnc-dialogs.h"
|
||||
#include "messages.h"
|
||||
@ -71,29 +72,60 @@ update_display_lists(gnc_column_view_edit * view) {
|
||||
gnc_option_db_lookup_option(view->odb, "__general", "report-list",
|
||||
SCM_BOOL_F);
|
||||
SCM this_report, this_options, this_name;
|
||||
SCM selection;
|
||||
char * name[3];
|
||||
int row, i;
|
||||
|
||||
row = view->available_selected;
|
||||
|
||||
if(gh_list_p(view->available_list) && !gh_null_p (view->available_list)) {
|
||||
row = MIN (row, gh_length (view->available_list) - 1);
|
||||
selection = gh_list_ref (view->available_list, gh_int2scm (row));
|
||||
}
|
||||
else {
|
||||
selection = SCM_UNDEFINED;
|
||||
}
|
||||
|
||||
scm_unprotect_object(view->available_list);
|
||||
view->available_list = names;
|
||||
scm_protect_object(view->available_list);
|
||||
|
||||
gtk_clist_freeze(view->available);
|
||||
gtk_clist_clear(view->available);
|
||||
if(gh_list_p(names)) {
|
||||
for(; !gh_null_p(names); names = gh_cdr(names)) {
|
||||
for(i = 0; !gh_null_p(names); names = gh_cdr(names), i++) {
|
||||
if (gh_equal_p (gh_car(names), selection))
|
||||
row = i;
|
||||
name[0] = gh_scm2newstr(gh_car(names), NULL);
|
||||
gtk_clist_append(view->available, name);
|
||||
free(name[0]);
|
||||
}
|
||||
}
|
||||
gtk_clist_select_row(view->available, view->available_selected, 0);
|
||||
gtk_clist_select_row(view->available, row, 0);
|
||||
gtk_clist_thaw(view->available);
|
||||
|
||||
|
||||
row = view->contents_selected;
|
||||
|
||||
if(gh_list_p(view->contents_list) && !gh_null_p (view->contents_list)) {
|
||||
row = MIN (row, gh_length (view->contents_list) - 1);
|
||||
selection = gh_list_ref (view->contents_list, gh_int2scm (row));
|
||||
}
|
||||
else {
|
||||
selection = SCM_UNDEFINED;
|
||||
}
|
||||
|
||||
scm_unprotect_object(view->contents_list);
|
||||
view->contents_list = contents;
|
||||
scm_protect_object(view->contents_list);
|
||||
|
||||
gtk_clist_freeze(view->contents);
|
||||
gtk_clist_clear(view->contents);
|
||||
if(gh_list_p(contents)) {
|
||||
for(; !gh_null_p(contents); contents = gh_cdr(contents)) {
|
||||
for(i = 0; !gh_null_p(contents); contents = gh_cdr(contents), i++) {
|
||||
if (gh_equal_p (gh_car(contents), selection))
|
||||
row = i;
|
||||
|
||||
this_report = gh_call1(find_report, gh_caar(contents));
|
||||
this_options = gh_call1(get_options, this_report);
|
||||
this_name = gh_call1(get_value,
|
||||
@ -109,7 +141,11 @@ update_display_lists(gnc_column_view_edit * view) {
|
||||
g_free(name[2]);
|
||||
}
|
||||
}
|
||||
gtk_clist_select_row(view->contents, view->contents_selected, 0);
|
||||
gtk_clist_select_row(view->contents, row, 0);
|
||||
gtk_clist_thaw(view->contents);
|
||||
|
||||
gnc_clist_columns_autosize (view->available);
|
||||
gnc_clist_columns_autosize (view->contents);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -213,6 +249,9 @@ gnc_column_view_edit_options(SCM options, SCM view) {
|
||||
|
||||
update_display_lists(r);
|
||||
|
||||
gtk_clist_column_titles_passive (r->available);
|
||||
gtk_clist_column_titles_passive (r->contents);
|
||||
|
||||
gnc_options_dialog_set_apply_cb(r->optwin,
|
||||
gnc_column_view_edit_apply_cb, r);
|
||||
gnc_options_dialog_set_close_cb(r->optwin,
|
||||
@ -291,8 +330,6 @@ gnc_column_view_edit_remove_cb(GtkButton * button, gpointer user_data) {
|
||||
int count;
|
||||
int oldlength;
|
||||
|
||||
printf("remove cb\n");
|
||||
|
||||
if(gh_list_p(r->contents_list)) {
|
||||
oldlength = gh_length(r->contents_list);
|
||||
if(oldlength > r->contents_selected) {
|
||||
|
@ -801,3 +801,43 @@ gnc_clist_set_check (GtkCList *list, int row, int col, gboolean checked)
|
||||
else
|
||||
gtk_clist_set_text (list, row, col, "");
|
||||
}
|
||||
|
||||
void
|
||||
gnc_clist_columns_autosize (GtkCList *list)
|
||||
{
|
||||
GtkStyle *style;
|
||||
GdkFont *font;
|
||||
gint i;
|
||||
|
||||
if (!list) return;
|
||||
g_return_if_fail (GTK_IS_CLIST (list));
|
||||
|
||||
style = gtk_widget_get_style (GTK_WIDGET(list));
|
||||
if (!style)
|
||||
return;
|
||||
|
||||
font = style->font;
|
||||
if (!font)
|
||||
return;
|
||||
|
||||
for (i = 0; TRUE; i++)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
char *title;
|
||||
gint width;
|
||||
|
||||
widget = gtk_clist_get_column_widget (list, i);
|
||||
if (!widget)
|
||||
break;
|
||||
|
||||
if (!GTK_IS_LABEL (widget))
|
||||
continue;
|
||||
|
||||
gtk_label_get (GTK_LABEL (widget), &title);
|
||||
|
||||
width = gdk_string_width (font, title);
|
||||
gtk_clist_set_column_min_width (list, i, width + 5);
|
||||
}
|
||||
|
||||
gtk_clist_columns_autosize (list);
|
||||
}
|
||||
|
@ -84,4 +84,9 @@ void gnc_window_adjust_for_screen (GtkWindow * window);
|
||||
* widgets. */
|
||||
void gnc_clist_set_check (GtkCList *list, int row, int col, gboolean checked);
|
||||
|
||||
/* This function is similar to gtk_clist_columns_autosize, but
|
||||
* also takes into account the column titles. */
|
||||
void gnc_clist_columns_autosize (GtkCList *list);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -7004,7 +7004,7 @@ create_Edit_Column_View_Page (void)
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (scrolledwindow26);
|
||||
gtk_box_pack_start (GTK_BOX (view_contents_hbox), scrolledwindow26, TRUE, TRUE, 0);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow26), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow26), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||
|
||||
available_list = gtk_clist_new (1);
|
||||
gtk_widget_ref (available_list);
|
||||
@ -7099,7 +7099,7 @@ create_Edit_Column_View_Page (void)
|
||||
(GtkDestroyNotify) gtk_widget_unref);
|
||||
gtk_widget_show (scrolledwindow27);
|
||||
gtk_box_pack_start (GTK_BOX (view_contents_hbox), scrolledwindow27, TRUE, TRUE, 0);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow27), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow27), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
||||
|
||||
contents_list = gtk_clist_new (3);
|
||||
gtk_widget_ref (contents_list);
|
||||
|
@ -10316,7 +10316,7 @@ quit without making any changes.</text>
|
||||
<widget>
|
||||
<class>GtkScrolledWindow</class>
|
||||
<name>scrolledwindow26</name>
|
||||
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
|
||||
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
|
||||
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
|
||||
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
||||
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
||||
@ -10529,7 +10529,7 @@ quit without making any changes.</text>
|
||||
<widget>
|
||||
<class>GtkScrolledWindow</class>
|
||||
<name>scrolledwindow27</name>
|
||||
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
|
||||
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
|
||||
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
|
||||
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
||||
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
||||
|
Loading…
Reference in New Issue
Block a user