From: Ben Pfaff Date: Wed, 24 Jun 2009 06:10:00 +0000 (-0700) Subject: output: Add overview pane to GUI output window. X-Git-Tag: v0.7.3~25 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1075412b79b988d931209188fe9c0ab0c1b2fe94;p=pspp-builds.git output: Add overview pane to GUI output window. --- diff --git a/src/ui/gui/output-viewer.glade b/src/ui/gui/output-viewer.glade index a396a7a4..7c23e77d 100644 --- a/src/ui/gui/output-viewer.glade +++ b/src/ui/gui/output-viewer.glade @@ -1,7 +1,7 @@ - - - + + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 600 @@ -26,18 +26,18 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-save True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-save True True + gtk-save-as True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-save-as True True @@ -58,9 +58,9 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + gtk-copy True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - gtk-copy True True @@ -119,20 +119,52 @@ False + 0 - + True True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC + 112 + True + + + True + True + automatic + automatic + + + True + True + False + + + + + True + True + + - + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + automatic + automatic + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + False + True + diff --git a/src/ui/gui/psppire-output-window.c b/src/ui/gui/psppire-output-window.c index 542e7b30..08e9f1d9 100644 --- a/src/ui/gui/psppire-output-window.c +++ b/src/ui/gui/psppire-output-window.c @@ -42,7 +42,11 @@ #define _(msgid) gettext (msgid) #define N_(msgid) msgid - +enum + { + COL_TITLE, /* Table title. */ + N_COLS + }; static void psppire_output_window_base_finalize (PsppireOutputWindowClass *, gpointer); static void psppire_output_window_base_init (PsppireOutputWindowClass *class); @@ -156,6 +160,9 @@ psppire_output_submit (struct outp_driver *this, struct som_entity *entity) cairo_t *cairo = gdk_cairo_create (GDK_DRAWABLE (window)); struct outp_driver *driver = xr_create_driver (cairo); /* XXX can fail */ struct tab_table *t = entity->ext; + GtkTreeStore *store; + GtkTreeIter item; + GtkTreePath *path; GtkWidget *drawing_area; void *rendering; int tw, th; @@ -187,6 +194,28 @@ psppire_output_submit (struct outp_driver *this, struct som_entity *entity) gtk_layout_set_size (the_output_viewer->output, the_output_viewer->max_width, the_output_viewer->y); + + store = GTK_TREE_STORE (gtk_tree_view_get_model ( + the_output_viewer->overview)); + if (entity->table_num != the_output_viewer->last_table_num) + { + gtk_tree_store_append (store, &item, NULL); + gtk_tree_store_set (store, &item, COL_TITLE, entity->command_name, + -1); + + /* XXX shouldn't save a GtkTreeIter */ + the_output_viewer->last_table_num = entity->table_num; + the_output_viewer->last_top_level = item; + } + gtk_tree_store_append (store, &item, + &the_output_viewer->last_top_level); + gtk_tree_store_set (store, &item, COL_TITLE, + t->title ? t->title : "(unnamed)", -1); + + path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), + &the_output_viewer->last_top_level); + gtk_tree_view_expand_row (the_output_viewer->overview, path, TRUE); + gtk_tree_path_free (path); } gtk_window_set_urgency_hint (GTK_WINDOW (the_output_viewer), TRUE); @@ -245,13 +274,30 @@ cancel_urgency (GtkWindow *window, gpointer data) static void psppire_output_window_init (PsppireOutputWindow *window) { - GtkBuilder *xml = builder_new ("output-viewer.ui"); + GtkTreeViewColumn *column; + GtkCellRenderer *renderer; + GtkBuilder *xml; + + xml = builder_new ("output-viewer.ui"); gtk_widget_reparent (get_widget_assert (xml, "vbox1"), GTK_WIDGET (window)); window->output = GTK_LAYOUT (get_widget_assert (xml, "output")); window->y = 0; + window->overview = GTK_TREE_VIEW (get_widget_assert (xml, "overview")); + gtk_tree_view_set_model (window->overview, + GTK_TREE_MODEL (gtk_tree_store_new ( + N_COLS, + G_TYPE_STRING))); /* COL_TITLE */ + window->last_table_num = -1; + + column = gtk_tree_view_column_new (); + gtk_tree_view_append_column (GTK_TREE_VIEW (window->overview), column); + renderer = gtk_cell_renderer_text_new (); + gtk_tree_view_column_pack_start (column, renderer, TRUE); + gtk_tree_view_column_add_attribute (column, renderer, "text", COL_TITLE); + gtk_widget_modify_bg (GTK_WIDGET (window->output), GTK_STATE_NORMAL, >k_widget_get_style (GTK_WIDGET (window->output))->base[GTK_STATE_NORMAL]); diff --git a/src/ui/gui/psppire-output-window.h b/src/ui/gui/psppire-output-window.h index 5cb2528e..ed06da91 100644 --- a/src/ui/gui/psppire-output-window.h +++ b/src/ui/gui/psppire-output-window.h @@ -54,6 +54,10 @@ struct _PsppireOutputWindow GtkLayout *output; int max_width; int y; + + GtkTreeView *overview; + int last_table_num; + GtkTreeIter last_top_level; }; struct _PsppireOutputWindowClass