Added the Compute dialog box.
authorJohn Darrington <john@darrington.wattle.id.au>
Wed, 4 Apr 2007 11:02:31 +0000 (11:02 +0000)
committerJohn Darrington <john@darrington.wattle.id.au>
Wed, 4 Apr 2007 11:02:31 +0000 (11:02 +0000)
33 files changed:
glade/ChangeLog
glade/automake.mk
glade/icons/16x16/psppire-buttonbox.png [deleted file]
glade/icons/16x16/psppire-hbuttonbox.png [new file with mode: 0644]
glade/icons/16x16/psppire-vbuttonbox.png [new file with mode: 0644]
glade/icons/22x22/psppire-buttonbox.png [deleted file]
glade/icons/22x22/psppire-hbuttonbox.png [new file with mode: 0644]
glade/icons/22x22/psppire-vbuttonbox.png [new file with mode: 0644]
glade/psppire.xml
src/ui/gui/ChangeLog
src/ui/gui/about.h
src/ui/gui/automake.mk
src/ui/gui/compute-dialog.c [new file with mode: 0644]
src/ui/gui/compute-dialog.h [new file with mode: 0644]
src/ui/gui/data-editor.c
src/ui/gui/data-editor.glade
src/ui/gui/data-editor.h
src/ui/gui/glade-register.c
src/ui/gui/helper.c
src/ui/gui/psppire-buttonbox.c
src/ui/gui/psppire-buttonbox.h
src/ui/gui/psppire-dialog.h
src/ui/gui/psppire-hbuttonbox.c [new file with mode: 0644]
src/ui/gui/psppire-hbuttonbox.h [new file with mode: 0644]
src/ui/gui/psppire-keypad.c
src/ui/gui/psppire-keypad.h
src/ui/gui/psppire-selector.c
src/ui/gui/psppire-vbuttonbox.c [new file with mode: 0644]
src/ui/gui/psppire-vbuttonbox.h [new file with mode: 0644]
src/ui/gui/psppire.glade
src/ui/gui/sort-cases-dialog.c
src/ui/gui/sort-cases-dialog.h
src/ui/gui/window-manager.h

index d7d467750ffc102f839e33715d7d5bf2820d882b..4540c2cd46ec28888a42c795af1593a7bcf89b76 100644 (file)
@@ -1,3 +1,7 @@
+4/4/2007 John Darrington <john@darrington.wattle.id.au>
+
+  * Seperated psppire-buttonbox into psppire-vbuttonbox and psppire-buttonbox
+
 Sat Mar 31 07:09:33 WST 2007 John Darrington <john@darrington.wattle.id.au>
        
   * Added icons directory and its contents.
index e9af9aeb49e290ac627f78ea17de1808441c6d24..20d15d64ed7e3ddb1d3f939ddb99b061ccc8a527 100644 (file)
@@ -14,6 +14,8 @@ libglade_psppire_la_SOURCES = \
        glade/bbox.c \
        glade/selector.c \
        src/ui/gui/psppire-buttonbox.c \
+       src/ui/gui/psppire-hbuttonbox.c \
+       src/ui/gui/psppire-vbuttonbox.c \
        src/ui/gui/psppire-dialog.c \
        src/ui/gui/psppire-keypad.c \
        src/ui/gui/psppire-selector.c
@@ -22,16 +24,18 @@ nodist_catalog_DATA = \
        glade/psppire.xml
 
 nodist_small_pixmap_DATA = \
-       glade/icons/16x16/psppire-buttonbox.png \
+       glade/icons/16x16/psppire-hbuttonbox.png \
+       glade/icons/16x16/psppire-vbuttonbox.png \
        glade/icons/16x16/psppire-dialog.png \
        glade/icons/16x16/psppire-keypad.png \
        glade/icons/16x16/psppire-selector.png 
 
 nodist_large_pixmap_DATA = \
-       glade/icons/22x22/psppire-buttonbox.png \
+       glade/icons/22x22/psppire-hbuttonbox.png \
+       glade/icons/22x22/psppire-vbuttonbox.png \
        glade/icons/22x22/psppire-dialog.png \
        glade/icons/22x22/psppire-keypad.png \
-       glade/icons/16x16/psppire-selector.png 
+       glade/icons/22x22/psppire-selector.png 
 
 
 libglade_psppire_la_CFLAGS = $(GLADE_UI_CFLAGS) $(GLADE_CFLAGS) \
diff --git a/glade/icons/16x16/psppire-buttonbox.png b/glade/icons/16x16/psppire-buttonbox.png
deleted file mode 100644 (file)
index d37d4df..0000000
Binary files a/glade/icons/16x16/psppire-buttonbox.png and /dev/null differ
diff --git a/glade/icons/16x16/psppire-hbuttonbox.png b/glade/icons/16x16/psppire-hbuttonbox.png
new file mode 100644 (file)
index 0000000..bedcf63
Binary files /dev/null and b/glade/icons/16x16/psppire-hbuttonbox.png differ
diff --git a/glade/icons/16x16/psppire-vbuttonbox.png b/glade/icons/16x16/psppire-vbuttonbox.png
new file mode 100644 (file)
index 0000000..d37d4df
Binary files /dev/null and b/glade/icons/16x16/psppire-vbuttonbox.png differ
diff --git a/glade/icons/22x22/psppire-buttonbox.png b/glade/icons/22x22/psppire-buttonbox.png
deleted file mode 100644 (file)
index f241e68..0000000
Binary files a/glade/icons/22x22/psppire-buttonbox.png and /dev/null differ
diff --git a/glade/icons/22x22/psppire-hbuttonbox.png b/glade/icons/22x22/psppire-hbuttonbox.png
new file mode 100644 (file)
index 0000000..538a2fb
Binary files /dev/null and b/glade/icons/22x22/psppire-hbuttonbox.png differ
diff --git a/glade/icons/22x22/psppire-vbuttonbox.png b/glade/icons/22x22/psppire-vbuttonbox.png
new file mode 100644 (file)
index 0000000..f241e68
Binary files /dev/null and b/glade/icons/22x22/psppire-vbuttonbox.png differ
index 9fb55bae0c7116e3ce617fa1291e0c58ca2da50b..847afb266641409da3b7b8e4ce9faf628a506c39 100644 (file)
 
        <property id="modal" ignore="True" default="True" />
        <property id="visible" ignore="True" default="False" />
-       
     </properties>
 
     </glade-widget-class>
 
 
-    <glade-widget-class name="PsppireButtonBox" generic-name="psppire-buttonbox" title="Psppire Button Box">
+    <glade-widget-class name="PsppireVButtonBox" generic-name="psppire-vbuttonbox" title="Vertical Button Box">
 
       <post-create-function>glade_psppire_button_box_post_create</post-create-function>
       <get-children-function>glade_psppire_button_box_get_children</get-children-function>
@@ -64,7 +63,8 @@
       <get-internal-child-function>glade_psppire_button_box_get_internal_child</get-internal-child-function>
 
     <properties>
-      <property id="child"                disabled="True" />
+      <property id="child"  disabled="True" />
+      <property id="visible" ignore="True" default="True" />
     </properties>
 
     <packing-defaults>
 
     </glade-widget-class>
 
+    <glade-widget-class name="PsppireHButtonBox" generic-name="psppire-hbuttonbox" title="Horizontal Button Box">
+
+      <post-create-function>glade_psppire_button_box_post_create</post-create-function>
+      <get-children-function>glade_psppire_button_box_get_children</get-children-function>
+
+      <get-internal-child-function>glade_psppire_button_box_get_internal_child</get-internal-child-function>
+
+    <properties>
+      <property id="child"                disabled="True" />
+
+      <property id="visible" ignore="True" default="True" />
+    </properties>
+
+
+    <packing-defaults>
+      <parent-class name="GtkVBox">
+       <child-property id="expand" default="False"/>
+       <child-property id="fill" default="False"/>
+       <child-property id="pack-type" default="GTK_PACK_END"/>
+      </parent-class>
+    </packing-defaults>
+
+    </glade-widget-class>
+
 
 
     <glade-widget-class name="PsppireKeypad" 
        <property id="visible-window" disabled="True"/>
        <property id="resize-mode"    disabled="True"/>
        <property id="border-width"   disabled="True"/>
+
+       <property id="visible" ignore="True" default="True" />
      </properties>
   
     </glade-widget-class>
          </displayable-values>
        </property>
 
+
+       <property id="visible" ignore="True" default="True" />
      </properties>
 
     </glade-widget-class>
 
  <glade-widget-group name="psppire" title="Psppire">
   <glade-widget-class-ref name="PsppireDialog"/>
-  <glade-widget-class-ref name="PsppireButtonBox"/>
+  <glade-widget-class-ref name="PsppireHButtonBox"/>
+  <glade-widget-class-ref name="PsppireVButtonBox"/>
   <glade-widget-class-ref name="PsppireKeypad"/>
   <glade-widget-class-ref name="PsppireSelector"/>
  </glade-widget-group>
index 7df5f7473076cf39b3207fdc7db5dd5aacc1b1cc..14fd0cf0481d04094d1126bf2b792e7e1d2110fb 100644 (file)
@@ -1,3 +1,21 @@
+2007-04-04   John Darrington <john@darrington.wattle.id.au>
+
+       * compute-dialog.c compute-dialog.h: New files
+
+       * data-editor.c data-editor.h data-editor.glade : Added Transform 
+       menu, and support for Compute dialog
+
+       * glade-register.c psppire-buttonbox.c psppire-buttonbox.h 
+         psppire-vbottonbox.c psppire-vbuttonbox.h psppire-hbuttonbox.c 
+         psppire-vbuttonbox.h : Made buttonbox an abstract base class 
+         and separated it into vbuttonbox and hbuttonbox.
+
+       * psppire-selector.c : Allowed GtkTextView to be the destination 
+       widget.
+
+       * psppire-keypad.c: Added an "erase" signal.  Fixed other 
+        minor problems.
+
 2007-04-03  Ben Pfaff  <blp@gnu.org>
            John McCabe-Dansted <gmatht@gmail.com>
 
index 4065a802021caabed2b9457cff6d27521872a0cb..1deb79311ec97d82b6cc6cf31541b90fc78d8713 100644 (file)
@@ -1,3 +1,23 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+
 
 
 void about_new (GtkMenuItem *m, GtkWindow *parent);
index e8da4c4d9793f9d32c76add582db4d934b8b913b..6b95ff6878657e5d01ab42241fbf3a43beda7f5d 100644 (file)
@@ -65,6 +65,8 @@ dist_src_ui_gui_psppire_DATA = \
 src_ui_gui_psppire_SOURCES = \
        src/ui/gui/about.c \
        src/ui/gui/about.h \
+       src/ui/gui/compute-dialog.c \
+       src/ui/gui/compute-dialog.h \
        src/ui/gui/customentry.c \
        src/ui/gui/customentry.h \
        src/ui/gui/data-sheet.c \
@@ -86,6 +88,10 @@ src_ui_gui_psppire_SOURCES = \
        src/ui/gui/missing-val-dialog.h \
        src/ui/gui/psppire-buttonbox.c \
        src/ui/gui/psppire-buttonbox.h \
+       src/ui/gui/psppire-hbuttonbox.c \
+       src/ui/gui/psppire-hbuttonbox.h \
+       src/ui/gui/psppire-vbuttonbox.c \
+       src/ui/gui/psppire-vbuttonbox.h \
        src/ui/gui/psppire-case-file.c \
        src/ui/gui/psppire-case-file.h \
        src/ui/gui/psppire-data-store.c \
diff --git a/src/ui/gui/compute-dialog.c b/src/ui/gui/compute-dialog.c
new file mode 100644 (file)
index 0000000..bc2b15c
--- /dev/null
@@ -0,0 +1,466 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+
+#include <gtk/gtk.h>
+#include "compute-dialog.h"
+#include "helper.h"
+#include "psppire-dialog.h"
+#include "psppire-keypad.h"
+#include "data-editor.h"
+#include <gtksheet/gtksheet.h>
+#include "psppire-var-store.h"
+#include "dialog-common.h"
+#include "dict-display.h"
+
+#include <language/syntax-string-source.h>
+#include "syntax-editor.h"
+
+
+#include <language/expressions/private.h>
+#include "c-ctype.h"
+
+static void function_list_populate (GtkTreeView *tv);
+
+static void insert_function_into_syntax_area (GtkTreeIter iter,
+                                             GtkWidget *text_view,
+                                             GtkTreeModel *model
+                                             );
+
+static void insert_source_row_into_text_view (GtkTreeIter iter,
+                                             GtkWidget *dest,
+                                             GtkTreeModel *model
+                                             );
+
+
+
+struct compute_dialog
+{
+  GladeXML *xml;  /* The xml that generated the widgets */
+};
+
+
+static void
+on_target_change (GObject *obj, const struct compute_dialog *cd)
+{
+  GtkWidget *target = get_widget_assert (cd->xml, "compute-entry1");
+  GtkWidget *type_and_label = get_widget_assert (cd->xml, "compute-button1");
+
+  const gchar *var_name = gtk_entry_get_text (GTK_ENTRY (target));
+  gboolean valid = var_name && strcmp ("", var_name);
+
+  gtk_widget_set_sensitive (type_and_label, valid);
+}
+
+static void
+refresh (GObject *obj, const struct compute_dialog *cd)
+{
+  GtkTextIter start, end;
+  GtkWidget *target = get_widget_assert (cd->xml, "compute-entry1");
+  GtkWidget *syntax_area = get_widget_assert (cd->xml, "compute-textview1");
+  GtkWidget *varlist = get_widget_assert (cd->xml, "compute-treeview1");
+  GtkWidget *funclist = get_widget_assert (cd->xml, "compute-treeview2");
+
+  GtkTextBuffer *buffer =
+    gtk_text_view_get_buffer (GTK_TEXT_VIEW (syntax_area));
+
+  GtkTreeSelection *selection;
+
+
+  /* Clear the target variable entry box */
+  gtk_entry_set_text (GTK_ENTRY (target), "");
+  g_signal_emit_by_name (target, "changed");
+
+
+  /* Clear the syntax area textbuffer */
+  gtk_text_buffer_get_start_iter (buffer, &start);
+  gtk_text_buffer_get_end_iter (buffer, &end);
+  gtk_text_buffer_delete (buffer, &start, &end);
+
+
+  /* Unselect all items in the treeview */
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (varlist));
+  gtk_tree_selection_unselect_all (selection);
+
+  /* And the other one */
+  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (funclist));
+  gtk_tree_selection_unselect_all (selection);
+}
+
+
+static void
+erase_selection (GtkTextBuffer *buffer)
+{
+  GtkTextIter start, end;
+
+  gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
+
+  gtk_text_buffer_delete (buffer, &start, &end);
+}
+
+
+
+static void
+on_keypad_button (PsppireKeypad *kp, const gchar *syntax, gpointer data)
+{
+  GladeXML *xml = data;
+
+  GtkWidget *rhs = get_widget_assert (xml, "compute-textview1");
+
+  GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (rhs));
+
+  erase_selection (buffer);
+
+  gtk_text_buffer_insert_at_cursor (buffer, syntax, strlen (syntax));
+
+  if (0 == strcmp (syntax, "()"))
+    {
+      GtkTextIter iter;
+      GtkTextMark *cursor = gtk_text_buffer_get_insert (buffer);
+      gtk_text_buffer_get_iter_at_mark (buffer, &iter, cursor);
+      gtk_text_iter_backward_cursor_position (&iter);
+      gtk_text_buffer_move_mark (buffer, cursor, &iter);
+    }
+
+}
+
+static void
+erase (PsppireKeypad *kp, gpointer data)
+{
+  GladeXML *xml = data;
+
+  GtkWidget *rhs = get_widget_assert (xml, "compute-textview1");
+
+  GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (rhs));
+
+  erase_selection (buffer);
+}
+
+static char *
+generate_syntax (const struct compute_dialog *cd)
+{
+  gchar *text;
+  GString *string ;
+  GtkTextIter start, end;
+  GtkWidget *target =    get_widget_assert   (cd->xml, "compute-entry1");
+  GtkWidget *syntax_area = get_widget_assert (cd->xml, "compute-textview1");
+
+  GtkTextBuffer *buffer =
+    gtk_text_view_get_buffer (GTK_TEXT_VIEW (syntax_area));
+
+  gtk_text_buffer_get_start_iter (buffer, &start);
+  gtk_text_buffer_get_end_iter (buffer, &end);
+
+
+  string = g_string_new ("COMPUTE ");
+
+  g_string_append (string, gtk_entry_get_text (GTK_ENTRY (target)));
+
+  g_string_append (string, " = ");
+
+  g_string_append (string,
+                  gtk_text_buffer_get_text (buffer, &start, &end, FALSE));
+
+  g_string_append (string, ".");
+
+  text = string->str;
+
+  g_string_free (string, FALSE);
+
+  return text;
+}
+
+
+/* Pops up the Compute dialog box */
+void
+compute_dialog (GObject *o, gpointer data)
+{
+  gint response;
+  struct data_editor *de = data;
+
+  PsppireVarStore *vs;
+  struct compute_dialog scd;
+
+  GladeXML *xml = XML_NEW ("psppire.glade");
+
+  GtkWidget *dialog = get_widget_assert   (xml, "compute-variable-dialog");
+
+  GtkWidget *dict_view = get_widget_assert   (xml, "compute-treeview1");
+  GtkWidget *functions = get_widget_assert   (xml, "compute-treeview2");
+  GtkWidget *keypad =    get_widget_assert   (xml, "psppire-keypad1");
+  GtkWidget *target =    get_widget_assert   (xml, "compute-entry1");
+  GtkWidget *syntax_area = get_widget_assert (xml, "compute-textview1");
+  GtkWidget *var_selector = get_widget_assert (xml, "compute-selector1");
+  GtkWidget *func_selector = get_widget_assert (xml, "compute-selector2");
+
+  GtkSheet *var_sheet =
+    GTK_SHEET (get_widget_assert (de->xml, "variable_sheet"));
+
+  vs = PSPPIRE_VAR_STORE (gtk_sheet_get_model (var_sheet));
+
+
+  gtk_window_set_transient_for (GTK_WINDOW (dialog), de->parent.window);
+
+
+  attach_dictionary_to_treeview (GTK_TREE_VIEW (dict_view),
+                                vs->dict,
+                                GTK_SELECTION_SINGLE, NULL);
+
+
+  psppire_selector_set_subjects (PSPPIRE_SELECTOR (var_selector),
+                                dict_view, syntax_area,
+                                insert_source_row_into_text_view,
+                                NULL);
+
+
+  function_list_populate (GTK_TREE_VIEW (functions));
+
+  psppire_selector_set_subjects (PSPPIRE_SELECTOR (func_selector),
+                                functions, syntax_area,
+                                insert_function_into_syntax_area,
+                                NULL);
+
+
+  scd.xml = xml;
+
+  g_signal_connect (target, "changed", G_CALLBACK (on_target_change), &scd);
+
+  g_signal_connect (dialog, "refresh", G_CALLBACK (refresh),  &scd);
+
+  g_signal_connect (keypad, "insert-syntax",
+                   G_CALLBACK (on_keypad_button),  xml);
+
+  g_signal_connect (keypad, "erase",
+                   G_CALLBACK (erase),  xml);
+
+
+  response = psppire_dialog_run (PSPPIRE_DIALOG (dialog));
+
+
+  switch (response)
+    {
+    case GTK_RESPONSE_OK:
+      {
+       gchar *syntax = generate_syntax (&scd);
+       struct getl_interface *sss = create_syntax_string_source (syntax);
+       execute_syntax (sss);
+
+       g_free (syntax);
+      }
+      break;
+    case PSPPIRE_RESPONSE_PASTE:
+      {
+       gchar *syntax = generate_syntax (&scd);
+
+       struct syntax_editor *se =
+         (struct syntax_editor *) window_create (WINDOW_SYNTAX, NULL);
+
+       gtk_text_buffer_insert_at_cursor (se->buffer, syntax, -1);
+
+       g_free (syntax);
+      }
+      break;
+    default:
+      break;
+    }
+
+  g_object_unref (xml);
+}
+
+
+enum {
+  COL_NAME,
+  COL_USAGE,
+  COL_ARITY
+};
+
+
+static const struct operation fs[] =
+  {
+#include <language/expressions/parse.inc>
+  };
+
+
+static void
+function_list_populate (GtkTreeView *tv)
+{
+  GtkListStore *liststore;
+  GtkTreeIter iter;
+  gint i;
+
+  const gint n_funcs = sizeof (fs) / sizeof fs[0] ;
+
+  liststore = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
+
+  for (i = 0 ; i < n_funcs ; ++i)
+    {
+      if ( fs[i].prototype == NULL)
+       continue;
+
+      /* All the real ones seem to begin with an upper case letter */
+      if ( !c_isupper(*fs[i].prototype))
+       continue;
+
+      gtk_list_store_append (liststore, &iter);
+
+      gtk_list_store_set (liststore, &iter,
+                         COL_NAME, fs[i].name,
+                         COL_USAGE,fs[i].prototype,
+                         COL_ARITY, fs[i].arg_cnt,
+                         -1);
+    }
+
+
+
+  /* Set the cell rendering */
+
+  {
+    GtkTreeViewColumn *col;
+    GtkCellRenderer *renderer;
+
+
+    col = gtk_tree_view_column_new ();
+
+    gtk_tree_view_append_column (tv, col);
+
+    renderer = gtk_cell_renderer_text_new ();
+
+    gtk_tree_view_column_pack_start (col, renderer, TRUE);
+
+    gtk_tree_view_column_add_attribute (col, renderer, "text", COL_USAGE);
+  }
+
+  gtk_tree_view_set_model (tv, GTK_TREE_MODEL (liststore));
+}
+
+
+
+
+static void
+insert_function_into_syntax_area (GtkTreeIter iter,
+                                 GtkWidget *text_view,
+                                 GtkTreeModel *model
+                                 )
+{
+  GString *string;
+  GValue name_value = {0};
+  GValue arity_value = {0};
+  gint arity;
+  gint i;
+
+  GtkTextBuffer *buffer ;
+
+  g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
+
+  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
+
+  gtk_tree_model_get_value (model, &iter, COL_NAME, &name_value);
+  gtk_tree_model_get_value (model, &iter, COL_ARITY, &arity_value);
+
+  arity = g_value_get_int (&arity_value);
+
+  string = g_string_new (g_value_get_string (&name_value));
+
+  g_string_append (string, "(");
+  for ( i = 0 ; i < arity -1 ; ++i )
+    {
+      g_string_append (string, "?,");
+    }
+  g_string_append (string, "?)");
+
+
+  erase_selection (buffer);
+
+  gtk_text_buffer_insert_at_cursor (buffer, string->str, string->len);
+
+  g_value_unset (&name_value);
+  g_value_unset (&arity_value);
+  g_string_free (string, TRUE);
+
+  /* Now position the cursor over the first '?' */
+  {
+    GtkTextIter insert;
+    GtkTextIter selectbound;
+    GtkTextMark *cursor = gtk_text_buffer_get_insert (buffer);
+    gtk_text_buffer_get_iter_at_mark (buffer, &insert, cursor);
+    for ( i = 0 ; i < arity ; ++i )
+      {
+       gtk_text_iter_backward_cursor_position (&insert);
+       gtk_text_iter_backward_cursor_position (&insert);
+      }
+    selectbound = insert;
+    gtk_text_iter_forward_cursor_position (&selectbound);
+
+    gtk_text_buffer_select_range (buffer, &insert, &selectbound);
+  }
+
+}
+
+/* Inserts the name of the selected variable into the destination widget.
+   The destination widget must be a GtkTextView
+ */
+static void
+insert_source_row_into_text_view (GtkTreeIter iter,
+                                 GtkWidget *dest,
+                                 GtkTreeModel *model
+                                 )
+{
+  GtkTreePath *path;
+  PsppireDict *dict;
+  gint *idx;
+  struct variable *var;
+  GtkTreeIter dict_iter;
+  gchar *name;
+  GtkTextBuffer *buffer;
+
+  g_return_if_fail (GTK_IS_TEXT_VIEW (dest));
+
+  if ( GTK_IS_TREE_MODEL_FILTER (model))
+    {
+      dict = PSPPIRE_DICT (gtk_tree_model_filter_get_model
+                          (GTK_TREE_MODEL_FILTER(model)));
+
+      gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER
+                                                       (model),
+                                                       &dict_iter, &iter);
+    }
+  else
+    {
+      dict = PSPPIRE_DICT (model);
+      dict_iter = iter;
+    }
+
+  path = gtk_tree_model_get_path (GTK_TREE_MODEL (dict), &dict_iter);
+
+  idx = gtk_tree_path_get_indices (path);
+
+  var =  psppire_dict_get_variable (dict, *idx);
+
+  gtk_tree_path_free (path);
+
+  name = pspp_locale_to_utf8 (var_get_name (var), -1, NULL);
+
+  buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (dest));
+
+  erase_selection (buffer);
+
+  gtk_text_buffer_insert_at_cursor (buffer, name, -1);
+
+  g_free (name);
+}
diff --git a/src/ui/gui/compute-dialog.h b/src/ui/gui/compute-dialog.h
new file mode 100644 (file)
index 0000000..588058f
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+#ifndef __COMPUTE_DIALOG_H
+#define __COMPUTE_DIALOG_H
+
+
+#include <gtk/gtk.h>
+#include <glade/glade.h>
+
+
+void compute_dialog (GObject *o, gpointer data);
+
+#endif
index 5a0f83581953d82d1d671f4ef1c963022dbf00d3..f733c15256d8a38bb9fb46f548e32e720edc3aaa 100644 (file)
@@ -35,6 +35,7 @@
 #include "split-file-dialog.h"
 #include "transpose-dialog.h"
 #include "sort-cases-dialog.h"
+#include "compute-dialog.h"
 #include "dict-display.h"
 
 #define _(msgid) gettext (msgid)
@@ -250,6 +251,16 @@ new_data_editor (void)
                    G_CALLBACK (sort_cases_dialog), de);
 
 
+  de->invoke_compute_dialog =
+    gtk_action_new ("compute-dialog",
+                   _("Compute"),
+                   _("Compute new values for a variable"),
+                   "pspp-compute");
+
+  g_signal_connect (de->invoke_compute_dialog, "activate",
+                   G_CALLBACK (compute_dialog), de);
+
+
   e->window = GTK_WINDOW (get_widget_assert (de->xml, "data_editor"));
 
   g_signal_connect_swapped (get_widget_assert (de->xml,"file_new_data"),
@@ -349,6 +360,10 @@ new_data_editor (void)
                            get_widget_assert (de->xml, "data_sort-cases")
                            );
 
+  gtk_action_connect_proxy (de->invoke_compute_dialog,
+                           get_widget_assert (de->xml, "transform_compute")
+                           );
+
 
   g_signal_connect (get_widget_assert (de->xml,"help_about"),
                    "activate",
index 8761fc93a35d61779b9eb44117f28a6a10b28516..ddd62ba57e5dee99c8de515675855c9adae21596 100644 (file)
                 </child>
               </widget>
             </child>
+            <child>
+              <widget class="GtkMenuItem" id="transform">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label" translatable="yes">_Transform</property>
+                <property name="use_underline">True</property>
+                <child>
+                  <widget class="GtkMenu" id="menu2">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <child>
+                      <widget class="GtkMenuItem" id="transform_compute">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="label" translatable="yes">_Compute</property>
+                        <property name="use_underline">True</property>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkMenuItem" id="transform_rank">
+                        <property name="visible">True</property>
+                        <property name="sensitive">False</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="label" translatable="yes">Ran_k Cases</property>
+                        <property name="use_underline">True</property>
+                      </widget>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+            </child>
             <child>
               <widget class="GtkMenuItem" id="windows">
                 <property name="visible">True</property>
                     <property name="visible">True</property>
                     <property name="sensitive">False</property>
                     <property name="tooltip" translatable="yes">Recall</property>
-                    <property name="stock_id">gtk-missing-image</property>
+                    <property name="stock_id">pspp-recent-dialogs</property>
                   </widget>
                   <packing>
                     <property name="expand">False</property>
index 0fe62ea627fda1a6797b8c8a729856bcb726940c..42266408636b0574bd0521af5c32e0e3a4fd9d29 100644 (file)
@@ -37,8 +37,8 @@ struct data_editor
   GtkAction *invoke_weight_cases_dialog;
   GtkAction *invoke_transpose_dialog;
   GtkAction *invoke_split_file_dialog;
-
   GtkAction *invoke_sort_cases_dialog;
+  GtkAction *invoke_compute_dialog;
 
   GladeXML *xml;
 
index 40d3a6b80938baba9dfa19460bf5c6138dd126d4..6283081d380580e3cc9ba20e20358db18f70aa62 100644 (file)
@@ -1,11 +1,33 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+
 #include <config.h>
 
 #include <string.h>
 
 #include <glade/glade-build.h>
 #include "psppire-dialog.h"
-#include "psppire-buttonbox.h"
 #include "psppire-selector.h"
+#include "psppire-keypad.h"
+#include "psppire-hbuttonbox.h"
+#include "psppire-vbuttonbox.h"
 
 GLADE_MODULE_CHECK_INIT
 
@@ -30,13 +52,22 @@ glade_module_register_widgets (void)
                         dialog_find_internal_child);
 
 
-  glade_register_widget (PSPPIRE_BUTTONBOX_TYPE, NULL,
+  glade_register_widget (PSPPIRE_VBUTTON_BOX_TYPE, NULL,
+                        glade_standard_build_children,
+                        NULL);
+
+  glade_register_widget (PSPPIRE_HBUTTON_BOX_TYPE, NULL,
                         glade_standard_build_children,
                         NULL);
 
   glade_register_widget (PSPPIRE_SELECTOR_TYPE, NULL,
                         glade_standard_build_children,
                         NULL);
+
+  glade_register_widget (PSPPIRE_KEYPAD_TYPE, NULL,
+                        glade_standard_build_children,
+                        NULL);
+
 }
 
 
index bd6e2198f4efc7ca276dc2b04cc79645e4338534..69b5d4376cb6198248c42b34c82d9496a19230c9 100644 (file)
@@ -1,3 +1,23 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+
 /* This file is a rubbish bin where stuff gets put when it doesn't seem to
    belong anywhere else.
 */
index e5c1c561a76704c59851820541c2212aec6958d2..400c0c1f5410649af4c6a80d37284d9dbceefc00 100644 (file)
 #define N_(msgid) msgid
 
 
-static void psppire_buttonbox_class_init          (PsppireButtonBoxClass *);
-static void psppire_buttonbox_init                (PsppireButtonBox      *);
+static void psppire_button_box_class_init          (PsppireButtonBoxClass *);
+static void psppire_button_box_init                (PsppireButtonBox      *);
 
 
 GType
 psppire_button_box_get_type (void)
 {
-  static GType buttonbox_type = 0;
+  static GType button_box_type = 0;
 
-  if (!buttonbox_type)
+  if (!button_box_type)
     {
-      static const GTypeInfo buttonbox_info =
+      static const GTypeInfo button_box_info =
       {
        sizeof (PsppireButtonBoxClass),
        NULL, /* base_init */
         NULL, /* base_finalize */
-       (GClassInitFunc) psppire_buttonbox_class_init,
+       (GClassInitFunc) psppire_button_box_class_init,
         NULL, /* class_finalize */
        NULL, /* class_data */
         sizeof (PsppireButtonBox),
        0,
-       (GInstanceInitFunc) psppire_buttonbox_init,
+       (GInstanceInitFunc) psppire_button_box_init,
       };
 
-      buttonbox_type = g_type_register_static (GTK_TYPE_VBUTTON_BOX,
-                                           "PsppireButtonBox", &buttonbox_info, 0);
+      button_box_type = g_type_register_static (GTK_TYPE_BUTTON_BOX,
+                                           "PsppireButtonBox", &button_box_info, 0);
     }
 
-  return buttonbox_type;
+  return button_box_type;
 }
 
 static void
-psppire_buttonbox_class_init (PsppireButtonBoxClass *class)
+psppire_button_box_class_init (PsppireButtonBoxClass *class)
 {
 }
 
@@ -118,46 +118,120 @@ refresh_clicked (GtkWidget *w, gpointer data)
 
 
 static void
-psppire_buttonbox_init (PsppireButtonBox *buttonbox)
+psppire_button_box_init (PsppireButtonBox *button_box)
 {
   GtkWidget *button ;
 
   button = gtk_button_new_from_stock (GTK_STOCK_OK);
-  gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
+  gtk_box_pack_start_defaults (GTK_BOX (button_box), button);
   g_signal_connect (button, "clicked", G_CALLBACK (ok_button_clicked), NULL);
   gtk_widget_show (button);
 
   button = gtk_button_new_with_mnemonic (_("_Paste"));
   g_signal_connect (button, "clicked", G_CALLBACK (paste_button_clicked),
                    NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
+  gtk_box_pack_start_defaults (GTK_BOX (button_box), button);
   gtk_widget_show (button);
 
   button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
   g_signal_connect (button, "clicked", G_CALLBACK (close_dialog), NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
+  gtk_box_pack_start_defaults (GTK_BOX (button_box), button);
   gtk_widget_show (button);
 
   button = gtk_button_new_from_stock (GTK_STOCK_REFRESH);
   g_signal_connect (button, "clicked", G_CALLBACK (refresh_clicked), NULL);
-  gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
+  gtk_box_pack_start_defaults (GTK_BOX (button_box), button);
   gtk_widget_show (button);
 
   button = gtk_button_new_from_stock (GTK_STOCK_HELP);
-  gtk_box_pack_start_defaults (GTK_BOX (buttonbox), button);
+  gtk_box_pack_start_defaults (GTK_BOX (button_box), button);
   gtk_widget_show (button);
 
-  gtk_widget_show (GTK_WIDGET (buttonbox));
 }
 
 
-GtkWidget*
-psppire_buttonbox_new (void)
-{
-  PsppireButtonBox *buttonbox ;
+/* This function is lifted verbatim from the Gtk2.10.6 library */
 
-  buttonbox = g_object_new (psppire_button_box_get_type (), NULL);
+void
+_psppire_button_box_child_requisition (GtkWidget *widget,
+                                      int       *nvis_children,
+                                      int       *nvis_secondaries,
+                                      int       *width,
+                                      int       *height)
+{
+  GtkButtonBox *bbox;
+  GtkBoxChild *child;
+  GList *children;
+  gint nchildren;
+  gint nsecondaries;
+  gint needed_width;
+  gint needed_height;
+  GtkRequisition child_requisition;
+  gint ipad_w;
+  gint ipad_h;
+  gint width_default;
+  gint height_default;
+  gint ipad_x_default;
+  gint ipad_y_default;
+
+  gint child_min_width;
+  gint child_min_height;
+  gint ipad_x;
+  gint ipad_y;
+
+  g_return_if_fail (GTK_IS_BUTTON_BOX (widget));
+
+  bbox = GTK_BUTTON_BOX (widget);
+
+  gtk_widget_style_get (widget,
+                        "child-min-width", &width_default,
+                        "child-min-height", &height_default,
+                        "child-internal-pad-x", &ipad_x_default,
+                        "child-internal-pad-y", &ipad_y_default,
+                       NULL);
+
+  child_min_width = bbox->child_min_width   != GTK_BUTTONBOX_DEFAULT
+    ? bbox->child_min_width : width_default;
+  child_min_height = bbox->child_min_height !=GTK_BUTTONBOX_DEFAULT
+    ? bbox->child_min_height : height_default;
+  ipad_x = bbox->child_ipad_x != GTK_BUTTONBOX_DEFAULT
+    ? bbox->child_ipad_x : ipad_x_default;
+  ipad_y = bbox->child_ipad_y != GTK_BUTTONBOX_DEFAULT
+    ? bbox->child_ipad_y : ipad_y_default;
+
+  nchildren = 0;
+  nsecondaries = 0;
+  children = GTK_BOX(bbox)->children;
+  needed_width = child_min_width;
+  needed_height = child_min_height;
+  ipad_w = ipad_x * 2;
+  ipad_h = ipad_y * 2;
+
+  while (children)
+    {
+      child = children->data;
+      children = children->next;
+
+      if (GTK_WIDGET_VISIBLE (child->widget))
+       {
+         nchildren += 1;
+         gtk_widget_size_request (child->widget, &child_requisition);
+
+         if (child_requisition.width + ipad_w > needed_width)
+           needed_width = child_requisition.width + ipad_w;
+         if (child_requisition.height + ipad_h > needed_height)
+           needed_height = child_requisition.height + ipad_h;
+         if (child->is_secondary)
+           nsecondaries++;
+       }
+    }
 
-  return GTK_WIDGET (buttonbox) ;
+  if (nvis_children)
+    *nvis_children = nchildren;
+  if (nvis_secondaries)
+    *nvis_secondaries = nsecondaries;
+  if (width)
+    *width = needed_width;
+  if (height)
+    *height = needed_height;
 }
-
index b9d8ea34ae218f34c586b81d1c12165f9d227a1e..91d355511256d72e6f58871799de541e15ab0c9e 100644 (file)
@@ -1,10 +1,30 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+
 #ifndef __PSPPIRE_BUTTONBOX_H__
 #define __PSPPIRE_BUTTONBOX_H__
 
 
 #include <glib.h>
 #include <glib-object.h>
-#include <gtk/gtkvbbox.h>
+#include <gtk/gtkbbox.h>
 
 G_BEGIN_DECLS
 
@@ -20,16 +40,24 @@ typedef struct _PsppireButtonBoxClass  PsppireButtonBoxClass;
 
 struct _PsppireButtonBox
 {
-  GtkVButtonBox parent;
+  GtkButtonBox parent;
 };
 
 struct _PsppireButtonBoxClass
 {
-  GtkVButtonBoxClass parent_class;
+  GtkButtonBoxClass parent_class;
 };
 
 GType          psppire_button_box_get_type        (void);
-GtkWidget*     psppire_buttonbox_new             (void);
+
+
+/* Internal function.  Do not use */
+void
+_psppire_button_box_child_requisition (GtkWidget *widget,
+                                      int       *nvis_children,
+                                      int       *nvis_secondaries,
+                                      int       *width,
+                                      int       *height);
 
 G_END_DECLS
 
index b7e39a7c41687e3b7184b1ee9362a96ec952047f..17d8b50fd3956b9e8e31e785e20b417f79207bc9 100644 (file)
@@ -1,3 +1,23 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+
 #ifndef __PSPPIRE_DIALOG_H__
 #define __PSPPIRE_DIALOG_H__
 
diff --git a/src/ui/gui/psppire-hbuttonbox.c b/src/ui/gui/psppire-hbuttonbox.c
new file mode 100644 (file)
index 0000000..8b146a9
--- /dev/null
@@ -0,0 +1,275 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+
+#include <config.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gtk/gtksignal.h>
+#include "psppire-hbuttonbox.h"
+#include "psppire-dialog.h"
+
+#include <gtk/gtkbbox.h>
+
+#include <gettext.h>
+
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+static void psppire_hbuttonbox_class_init          (PsppireHButtonBoxClass *);
+static void psppire_hbuttonbox_init                (PsppireHButtonBox      *);
+
+static void gtk_hbutton_box_size_request  (GtkWidget      *widget,
+                                          GtkRequisition *requisition);
+static void gtk_hbutton_box_size_allocate (GtkWidget      *widget,
+                                          GtkAllocation  *allocation);
+
+
+static GtkButtonBoxStyle default_layout_style = GTK_BUTTONBOX_EDGE;
+
+GType
+psppire_hbutton_box_get_type (void)
+{
+  static GType hbuttonbox_type = 0;
+
+  if (!hbuttonbox_type)
+    {
+      static const GTypeInfo hbuttonbox_info =
+      {
+       sizeof (PsppireHButtonBoxClass),
+       NULL, /* base_init */
+        NULL, /* base_finalize */
+       (GClassInitFunc) psppire_hbuttonbox_class_init,
+        NULL, /* class_finalize */
+       NULL, /* class_data */
+        sizeof (PsppireHButtonBox),
+       0,
+       (GInstanceInitFunc) psppire_hbuttonbox_init,
+      };
+
+      hbuttonbox_type = g_type_register_static (PSPPIRE_BUTTONBOX_TYPE,
+                                           "PsppireHButtonBox", &hbuttonbox_info, 0);
+    }
+
+  return hbuttonbox_type;
+}
+
+static void
+psppire_hbuttonbox_class_init (PsppireHButtonBoxClass *class)
+{
+  GtkWidgetClass *widget_class;
+
+  widget_class = (GtkWidgetClass*) class;
+
+  widget_class->size_request = gtk_hbutton_box_size_request;
+  widget_class->size_allocate = gtk_hbutton_box_size_allocate;
+}
+
+
+static void
+psppire_hbuttonbox_init (PsppireHButtonBox *hbuttonbox)
+{
+}
+
+
+GtkWidget*
+psppire_hbuttonbox_new (void)
+{
+  PsppireHButtonBox *hbuttonbox ;
+
+  hbuttonbox = g_object_new (psppire_hbutton_box_get_type (), NULL);
+
+  return GTK_WIDGET (hbuttonbox) ;
+}
+
+
+
+/* The following two functions are lifted verbatim from
+   the Gtk2.10.6 library */
+
+static void
+gtk_hbutton_box_size_request (GtkWidget      *widget,
+                             GtkRequisition *requisition)
+{
+  GtkBox *box;
+  GtkButtonBox *bbox;
+  gint nvis_children;
+  gint child_width;
+  gint child_height;
+  gint spacing;
+  GtkButtonBoxStyle layout;
+
+  box = GTK_BOX (widget);
+  bbox = GTK_BUTTON_BOX (widget);
+
+  spacing = box->spacing;
+  layout = bbox->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
+         ? bbox->layout_style : default_layout_style;
+
+  _psppire_button_box_child_requisition (widget,
+                                     &nvis_children,
+                                    NULL,
+                                     &child_width,
+                                     &child_height);
+
+  if (nvis_children == 0)
+  {
+    requisition->width = 0;
+    requisition->height = 0;
+  }
+  else
+  {
+    switch (layout)
+    {
+    case GTK_BUTTONBOX_SPREAD:
+      requisition->width =
+             nvis_children*child_width + ((nvis_children+1)*spacing);
+      break;
+    case GTK_BUTTONBOX_EDGE:
+    case GTK_BUTTONBOX_START:
+    case GTK_BUTTONBOX_END:
+      requisition->width = nvis_children*child_width + ((nvis_children-1)*spacing);
+      break;
+    default:
+      g_assert_not_reached();
+      break;
+    }
+
+    requisition->height = child_height;
+  }
+
+  requisition->width += GTK_CONTAINER (box)->border_width * 2;
+  requisition->height += GTK_CONTAINER (box)->border_width * 2;
+}
+
+
+
+static void
+gtk_hbutton_box_size_allocate (GtkWidget     *widget,
+                              GtkAllocation *allocation)
+{
+  GtkBox *base_box;
+  GtkButtonBox *box;
+  GtkBoxChild *child;
+  GList *children;
+  GtkAllocation child_allocation;
+  gint nvis_children;
+  gint n_secondaries;
+  gint child_width;
+  gint child_height;
+  gint x = 0;
+  gint secondary_x = 0;
+  gint y = 0;
+  gint width;
+  gint childspace;
+  gint childspacing = 0;
+  GtkButtonBoxStyle layout;
+  gint spacing;
+
+  base_box = GTK_BOX (widget);
+  box = GTK_BUTTON_BOX (widget);
+  spacing = base_box->spacing;
+  layout = box->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
+         ? box->layout_style : default_layout_style;
+  _psppire_button_box_child_requisition (widget,
+                                     &nvis_children,
+                                    &n_secondaries,
+                                     &child_width,
+                                     &child_height);
+  widget->allocation = *allocation;
+  width = allocation->width - GTK_CONTAINER (box)->border_width*2;
+  switch (layout)
+  {
+  case GTK_BUTTONBOX_SPREAD:
+    childspacing = (width - (nvis_children * child_width)) / (nvis_children + 1);
+    x = allocation->x + GTK_CONTAINER (box)->border_width + childspacing;
+    secondary_x = x + ((nvis_children - n_secondaries) * (child_width + childspacing));
+    break;
+  case GTK_BUTTONBOX_EDGE:
+    if (nvis_children >= 2)
+      {
+       childspacing = (width - (nvis_children * child_width)) / (nvis_children - 1);
+       x = allocation->x + GTK_CONTAINER (box)->border_width;
+       secondary_x = x + ((nvis_children - n_secondaries) * (child_width + childspacing));
+      }
+    else
+      {
+       /* one or zero children, just center */
+        childspacing = width;
+       x = secondary_x = allocation->x + (allocation->width - child_width) / 2;
+      }
+    break;
+  case GTK_BUTTONBOX_START:
+    childspacing = spacing;
+    x = allocation->x + GTK_CONTAINER (box)->border_width;
+    secondary_x = allocation->x + allocation->width
+      - child_width * n_secondaries
+      - spacing * (n_secondaries - 1)
+      - GTK_CONTAINER (box)->border_width;
+    break;
+  case GTK_BUTTONBOX_END:
+    childspacing = spacing;
+    x = allocation->x + allocation->width
+      - child_width * (nvis_children - n_secondaries)
+      - spacing * (nvis_children - n_secondaries - 1)
+      - GTK_CONTAINER (box)->border_width;
+    secondary_x = allocation->x + GTK_CONTAINER (box)->border_width;
+    break;
+  default:
+    g_assert_not_reached();
+    break;
+  }
+
+
+  y = allocation->y + (allocation->height - child_height) / 2;
+  childspace = child_width + childspacing;
+
+  children = GTK_BOX (box)->children;
+
+  while (children)
+    {
+      child = children->data;
+      children = children->next;
+
+      if (GTK_WIDGET_VISIBLE (child->widget))
+       {
+         child_allocation.width = child_width;
+         child_allocation.height = child_height;
+         child_allocation.y = y;
+
+         if (child->is_secondary)
+           {
+             child_allocation.x = secondary_x;
+             secondary_x += childspace;
+           }
+         else
+           {
+             child_allocation.x = x;
+             x += childspace;
+           }
+
+         if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
+           child_allocation.x = (allocation->x + allocation->width) - (child_allocation.x + child_width - allocation->x);
+
+         gtk_widget_size_allocate (child->widget, &child_allocation);
+       }
+    }
+}
diff --git a/src/ui/gui/psppire-hbuttonbox.h b/src/ui/gui/psppire-hbuttonbox.h
new file mode 100644 (file)
index 0000000..60d6a72
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+
+#ifndef __PSPPIRE_HBBOX_H__
+#define __PSPPIRE_HBBOX_H__
+
+
+#include <glib.h>
+#include <glib-object.h>
+#include "psppire-buttonbox.h"
+
+G_BEGIN_DECLS
+
+#define PSPPIRE_HBUTTON_BOX_TYPE            (psppire_hbutton_box_get_type ())
+#define PSPPIRE_HBUTTON_BOX(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_HBUTTON_BOX_TYPE, PsppireHButtonBox))
+#define PSPPIRE_HBUTTON_BOX_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PSPPIRE_HBUTTON_BOX_TYPE, PsppireHButtonBoxClass))
+#define PSPPIRE_IS_HBUTTON_BOX(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_HBUTTON_BOX_TYPE))
+#define PSPPIRE_IS_HBUTTON_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_HBUTTON_BOX_TYPE))
+
+
+typedef struct _PsppireHButtonBox       PsppireHButtonBox;
+typedef struct _PsppireHButtonBoxClass  PsppireHButtonBoxClass;
+
+struct _PsppireHButtonBox
+{
+  PsppireButtonBox parent;
+};
+
+struct _PsppireHButtonBoxClass
+{
+  PsppireButtonBoxClass parent_class;
+};
+
+GType          psppire_hbutton_box_get_type        (void);
+GtkWidget*     psppire_hbutton_box_new             (void);
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_HBBOX_H__ */
+
index af0e592487f795179bb8cc76fde26e0d8fb46a3c..c68307c98cae7c0aecc9cc06012251610325fcfc 100644 (file)
@@ -25,6 +25,7 @@
 
 enum {
   INSERT_SYNTAX,
+  ERASE,
   n_SIGNALS
 };
 
@@ -106,6 +107,16 @@ psppire_keypad_class_init (PsppireKeypadClass *klass)
                                         g_cclosure_marshal_VOID__STRING,
                                          G_TYPE_NONE, 1,
                                         G_TYPE_STRING);
+
+  keypad_signals[ERASE] = g_signal_new ("erase",
+                                        G_TYPE_FROM_CLASS (klass),
+                                        G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                                        G_STRUCT_OFFSET (PsppireKeypadClass,
+                                                         keypad),
+                                         NULL,
+                                         NULL,
+                                        g_cclosure_marshal_VOID__VOID,
+                                         G_TYPE_NONE, 0);
 }
 
 
@@ -118,7 +129,7 @@ psppire_keypad_class_init (PsppireKeypadClass *klass)
 static const char *keypad_insert_text[] = {
   "0",  "1",  "2", "3", "4", "5", "6", "7", "8", "9",
   ".", "+", "-", "*", "**", "/", "=", "<>", "<", "<=",
-  ">", ">=", "&", "|", "~", "(", ")"
+  ">", ">=", "&", "|", "~", "()", NULL
 };
 
 
@@ -131,7 +142,11 @@ button_click (GtkButton *b, PsppireKeypad *kp)
 {
   const gchar *s = g_hash_table_lookup (kp->frag_table, b);
 
-  g_signal_emit (kp, keypad_signals [INSERT_SYNTAX], 0, s);
+
+  if ( s )
+    g_signal_emit (kp, keypad_signals [INSERT_SYNTAX], 0, s);
+  else
+    g_signal_emit (kp, keypad_signals [ERASE], 0);
 }
 
 static const gint cols = 6;
@@ -369,12 +384,15 @@ psppire_keypad_init (PsppireKeypad *kp)
       g_markup_printf_escaped ("<span style=\"italic\">x<sup>y</sup></span>");
 
     label = gtk_label_new ("**");
+
     gtk_label_set_markup (GTK_LABEL (label), markup);
     g_free (markup);
 
     kp->star_star = gtk_button_new ();
     gtk_container_add (GTK_CONTAINER (kp->star_star), label);
 
+    gtk_widget_show (label);
+
     add_button (kp, &kp->star_star,
                0, 1,
                4, 5);
index 340696c6d0479b97ea194bd5512ce7436e2802f2..f288111bda347e44df078578535fe2ddc002672e 100644 (file)
@@ -52,6 +52,7 @@
 #include <glib.h>
 #include <glib-object.h>
 #include <gtk/gtkeventbox.h>
+#include <gtk/gtktable.h>
 
 
 G_BEGIN_DECLS
index 6465189d759d365b8c627654b84a8209f464db74..a041fd5a05cae1ef23356a206f563f2a4961fc6e 100644 (file)
@@ -68,6 +68,7 @@
 
 #include <gtk/gtktreeview.h>
 #include <gtk/gtktreeselection.h>
+#include <gtk/gtktextview.h>
 #include <gtk/gtkwidget.h>
 
 static void psppire_selector_base_finalize (PsppireSelectorClass *, gpointer);
@@ -561,8 +562,8 @@ is_source_item_visible (GtkTreeModel *childmodel,
     {
       PsppireSelector *selector = list->data;
 
-      if ( selector->filter (childmodel, iter, selector))
-         return FALSE;
+      if ( selector->filter && selector->filter (childmodel, iter, selector))
+       return FALSE;
 
       list = list->next;
     }
@@ -745,6 +746,11 @@ psppire_selector_set_subjects (PsppireSelector *selector,
   else if ( GTK_IS_ENTRY (dest))
     set_entry_dest (selector, GTK_ENTRY (dest));
 
+  else if (GTK_IS_TEXT_VIEW (dest))
+    {
+      /* Nothing to be done */
+    }
+
   else
     g_error ("Unsupported destination widget: %s", G_OBJECT_TYPE_NAME (dest));
 
diff --git a/src/ui/gui/psppire-vbuttonbox.c b/src/ui/gui/psppire-vbuttonbox.c
new file mode 100644 (file)
index 0000000..59ae0cc
--- /dev/null
@@ -0,0 +1,272 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+
+#include <config.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gtk/gtksignal.h>
+#include "psppire-vbuttonbox.h"
+#include "psppire-dialog.h"
+
+#include <gtk/gtkbbox.h>
+
+#include <gettext.h>
+
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
+
+static void psppire_vbuttonbox_class_init          (PsppireVButtonBoxClass *);
+static void psppire_vbuttonbox_init                (PsppireVButtonBox      *);
+
+static void gtk_vbutton_box_size_request  (GtkWidget      *widget,
+                                          GtkRequisition *requisition);
+static void gtk_vbutton_box_size_allocate (GtkWidget      *widget,
+                                          GtkAllocation  *allocation);
+
+
+static GtkButtonBoxStyle default_layout_style = GTK_BUTTONBOX_EDGE;
+
+GType
+psppire_vbutton_box_get_type (void)
+{
+  static GType vbuttonbox_type = 0;
+
+  if (!vbuttonbox_type)
+    {
+      static const GTypeInfo vbuttonbox_info =
+      {
+       sizeof (PsppireVButtonBoxClass),
+       NULL, /* base_init */
+        NULL, /* base_finalize */
+       (GClassInitFunc) psppire_vbuttonbox_class_init,
+        NULL, /* class_finalize */
+       NULL, /* class_data */
+        sizeof (PsppireVButtonBox),
+       0,
+       (GInstanceInitFunc) psppire_vbuttonbox_init,
+      };
+
+      vbuttonbox_type = g_type_register_static (PSPPIRE_BUTTONBOX_TYPE,
+                                           "PsppireVButtonBox", &vbuttonbox_info, 0);
+    }
+
+  return vbuttonbox_type;
+}
+
+static void
+psppire_vbuttonbox_class_init (PsppireVButtonBoxClass *class)
+{
+  GtkWidgetClass *widget_class;
+
+  widget_class = (GtkWidgetClass*) class;
+
+  widget_class->size_request = gtk_vbutton_box_size_request;
+  widget_class->size_allocate = gtk_vbutton_box_size_allocate;
+}
+
+
+static void
+psppire_vbuttonbox_init (PsppireVButtonBox *vbuttonbox)
+{
+}
+
+
+GtkWidget*
+psppire_vbuttonbox_new (void)
+{
+  PsppireVButtonBox *vbuttonbox ;
+
+  vbuttonbox = g_object_new (psppire_vbutton_box_get_type (), NULL);
+
+  return GTK_WIDGET (vbuttonbox) ;
+}
+
+
+
+/* The following two functions are lifted verbatim from
+   the Gtk2.10.6 library */
+
+static void
+gtk_vbutton_box_size_request (GtkWidget      *widget,
+                             GtkRequisition *requisition)
+{
+  GtkBox *box;
+  GtkButtonBox *bbox;
+  gint nvis_children;
+  gint child_width;
+  gint child_height;
+  gint spacing;
+  GtkButtonBoxStyle layout;
+
+  box = GTK_BOX (widget);
+  bbox = GTK_BUTTON_BOX (widget);
+
+  spacing = box->spacing;
+  layout = bbox->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
+         ? bbox->layout_style : default_layout_style;
+
+  _psppire_button_box_child_requisition (widget,
+                                        &nvis_children,
+                                        NULL,
+                                        &child_width,
+                                        &child_height);
+
+  if (nvis_children == 0)
+    {
+      requisition->width = 0;
+      requisition->height = 0;
+    }
+  else
+    {
+      switch (layout)
+      {
+      case GTK_BUTTONBOX_SPREAD:
+        requisition->height =
+               nvis_children*child_height + ((nvis_children+1)*spacing);
+       break;
+      case GTK_BUTTONBOX_EDGE:
+      case GTK_BUTTONBOX_START:
+      case GTK_BUTTONBOX_END:
+        requisition->height =
+               nvis_children*child_height + ((nvis_children-1)*spacing);
+       break;
+      default:
+           g_assert_not_reached();
+           break;
+      }
+      requisition->width = child_width;
+    }
+
+  requisition->width += GTK_CONTAINER (box)->border_width * 2;
+  requisition->height += GTK_CONTAINER (box)->border_width * 2;
+}
+
+
+
+static void
+gtk_vbutton_box_size_allocate (GtkWidget     *widget,
+                              GtkAllocation *allocation)
+{
+  GtkBox *base_box;
+  GtkButtonBox *box;
+  GtkBoxChild *child;
+  GList *children;
+  GtkAllocation child_allocation;
+  gint nvis_children;
+  gint n_secondaries;
+  gint child_width;
+  gint child_height;
+  gint x = 0;
+  gint y = 0;
+  gint secondary_y = 0;
+  gint height;
+  gint childspace;
+  gint childspacing = 0;
+  GtkButtonBoxStyle layout;
+  gint spacing;
+
+  base_box = GTK_BOX (widget);
+  box = GTK_BUTTON_BOX (widget);
+  spacing = base_box->spacing;
+  layout = box->layout_style != GTK_BUTTONBOX_DEFAULT_STYLE
+         ? box->layout_style : default_layout_style;
+  _psppire_button_box_child_requisition (widget,
+                                     &nvis_children,
+                                    &n_secondaries,
+                                     &child_width,
+                                     &child_height);
+  widget->allocation = *allocation;
+  height = allocation->height - GTK_CONTAINER (box)->border_width*2;
+  switch (layout)
+  {
+  case GTK_BUTTONBOX_SPREAD:
+    childspacing = (height - (nvis_children * child_height)) / (nvis_children + 1);
+    y = allocation->y + GTK_CONTAINER (box)->border_width + childspacing;
+    secondary_y = y + ((nvis_children - n_secondaries) * (child_height + childspacing));
+    break;
+  case GTK_BUTTONBOX_EDGE:
+    if (nvis_children >= 2)
+      {
+        childspacing = (height - (nvis_children*child_height)) / (nvis_children-1);
+       y = allocation->y + GTK_CONTAINER (box)->border_width;
+       secondary_y = y + ((nvis_children - n_secondaries) * (child_height + childspacing));
+      }
+    else
+      {
+       /* one or zero children, just center */
+       childspacing = height;
+       y = secondary_y = allocation->y + (allocation->height - child_height) / 2;
+      }
+    break;
+  case GTK_BUTTONBOX_START:
+    childspacing = spacing;
+    y = allocation->y + GTK_CONTAINER (box)->border_width;
+    secondary_y = allocation->y + allocation->height
+      - child_height * n_secondaries
+      - spacing * (n_secondaries - 1)
+      - GTK_CONTAINER (box)->border_width;
+    break;
+  case GTK_BUTTONBOX_END:
+    childspacing = spacing;
+    y = allocation->y + allocation->height
+      - child_height * (nvis_children - n_secondaries)
+      - spacing * (nvis_children - n_secondaries - 1)
+      - GTK_CONTAINER (box)->border_width;
+    secondary_y = allocation->y + GTK_CONTAINER (box)->border_width;
+    break;
+  default:
+    g_assert_not_reached();
+    break;
+  }
+
+  x = allocation->x + (allocation->width - child_width) / 2;
+  childspace = child_height + childspacing;
+
+  children = GTK_BOX (box)->children;
+
+  while (children)
+    {
+      child = children->data;
+      children = children->next;
+
+      if (GTK_WIDGET_VISIBLE (child->widget))
+       {
+         child_allocation.width = child_width;
+         child_allocation.height = child_height;
+         child_allocation.x = x;
+
+         if (child->is_secondary)
+           {
+             child_allocation.y = secondary_y;
+             secondary_y += childspace;
+           }
+         else
+           {
+             child_allocation.y = y;
+             y += childspace;
+           }
+
+         gtk_widget_size_allocate (child->widget, &child_allocation);
+       }
+    }
+}
+
diff --git a/src/ui/gui/psppire-vbuttonbox.h b/src/ui/gui/psppire-vbuttonbox.h
new file mode 100644 (file)
index 0000000..5b30cc7
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+
+#ifndef __PSPPIRE_VBBOX_H__
+#define __PSPPIRE_VBBOX_H__
+
+
+#include <glib.h>
+#include <glib-object.h>
+#include "psppire-buttonbox.h"
+
+G_BEGIN_DECLS
+
+#define PSPPIRE_VBUTTON_BOX_TYPE            (psppire_vbutton_box_get_type ())
+#define PSPPIRE_VBUTTON_BOX(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_VBUTTON_BOX_TYPE, PsppireVButtonBox))
+#define PSPPIRE_VBUTTON_BOX_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PSPPIRE_VBUTTON_BOX_TYPE, PsppireVButtonBoxClass))
+#define PSPPIRE_IS_VBUTTON_BOX(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_VBUTTON_BOX_TYPE))
+#define PSPPIRE_IS_VBUTTON_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_VBUTTON_BOX_TYPE))
+
+
+typedef struct _PsppireVButtonBox       PsppireVButtonBox;
+typedef struct _PsppireVButtonBoxClass  PsppireVButtonBoxClass;
+
+struct _PsppireVButtonBox
+{
+  PsppireButtonBox parent;
+};
+
+struct _PsppireVButtonBoxClass
+{
+  PsppireButtonBoxClass parent_class;
+};
+
+GType          psppire_vbutton_box_get_type        (void);
+GtkWidget*     psppire_vbutton_box_new             (void);
+
+G_END_DECLS
+
+#endif /* __PSPPIRE_VBBOX_H__ */
+
index 75352ab6fb13ecf47aadca06298f1c93c0daa305..eb5ab42385439a1619ff02e5e5a741160ce47c47 100644 (file)
           </packing>
         </child>
         <child>
-          <widget class="PsppireButtonBox" id="psppire-buttonbox1">
+          <widget class="PsppireVButtonBox" id="psppire-buttonbox1">
+            <property name="visible">True</property>
             <property name="border_width">5</property>
           </widget>
           <packing>
           </packing>
         </child>
         <child>
-          <widget class="PsppireButtonBox" id="psppire-buttonbox2">
+          <widget class="PsppireVButtonBox" id="psppire-buttonbox2">
+            <property name="visible">True</property>
             <property name="border_width">5</property>
           </widget>
           <packing>
           </widget>
         </child>
         <child>
-          <widget class="PsppireButtonBox" id="psppire-buttonbox3">
+          <widget class="PsppireVButtonBox" id="psppire-buttonbox3">
             <property name="visible">True</property>
             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
             <property name="border_width">5</property>
             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
             <property name="spacing">5</property>
             <child>
-              <widget class="GtkFrame" id="frame7">
+              <widget class="GtkScrolledWindow" id="scrolledwindow5">
                 <property name="visible">True</property>
+                <property name="can_focus">True</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                <property name="label_xalign">0</property>
+                <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
                 <property name="shadow_type">GTK_SHADOW_IN</property>
                 <child>
-                  <widget class="GtkScrolledWindow" id="scrolledwindow5">
+                  <widget class="GtkTreeView" id="treeview1">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                    <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                    <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-                    <child>
-                      <widget class="GtkTreeView" id="treeview1">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
-                        <property name="headers_visible">False</property>
-                        <property name="fixed_height_mode">True</property>
-                      </widget>
-                    </child>
+                    <property name="headers_visible">False</property>
+                    <property name="fixed_height_mode">True</property>
                   </widget>
                 </child>
-                <child>
-                  <placeholder/>
-                  <packing>
-                    <property name="type">label_item</property>
-                  </packing>
-                </child>
               </widget>
             </child>
             <child>
                                 <property name="active">True</property>
                                 <property name="draw_indicator">True</property>
                               </widget>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
+                              </packing>
                             </child>
                             <child>
                               <widget class="GtkRadioButton" id="radiobutton3">
           </packing>
         </child>
         <child>
-          <widget class="GtkHButtonBox" id="hbuttonbox2">
+          <widget class="PsppireHButtonBox" id="psppire-hbuttonbox1">
             <property name="visible">True</property>
             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="border_width">5</property>
             <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
           </widget>
           <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="pack_type">GTK_PACK_END</property>
             <property name="position">2</property>
           </packing>
         </child>
           </widget>
         </child>
         <child>
-          <widget class="PsppireButtonBox" id="psppire-buttonbox4">
+          <widget class="PsppireVButtonBox" id="psppire-buttonbox4">
             <property name="visible">True</property>
             <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
             <property name="border_width">5</property>
       </widget>
     </child>
   </widget>
+  <widget class="PsppireDialog" id="compute-variable-dialog">
+    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+    <property name="title">Compute Variable</property>
+    <property name="modal">True</property>
+    <child internal-child="hbox">
+      <widget class="GtkHBox" id="dialog-hbox5">
+        <property name="visible">True</property>
+        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+        <property name="spacing">2</property>
+        <child>
+          <widget class="GtkAlignment" id="alignment8">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="bottom_padding">5</property>
+            <property name="left_padding">5</property>
+            <child>
+              <widget class="GtkHBox" id="hbox15">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <child>
+                  <widget class="GtkVBox" id="vbox19">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="spacing">5</property>
+                    <child>
+                      <widget class="GtkVBox" id="vbox20">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <child>
+                          <widget class="GtkLabel" id="label20">
+                            <property name="visible">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Target Variable:</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkEntry" id="compute-entry1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkButton" id="compute-button1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="label" translatable="yes">Type &amp; Label</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkScrolledWindow" id="scrolledwindow9">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                        <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                        <property name="shadow_type">GTK_SHADOW_IN</property>
+                        <child>
+                          <widget class="GtkTreeView" id="compute-treeview1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="headers_visible">False</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkVBox" id="vbox21">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <child>
+                      <widget class="GtkLabel" id="label21">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="label" translatable="yes">=</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="PsppireSelector" id="compute-selector1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="border_width">5</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </widget>
+            </child>
+          </widget>
+        </child>
+        <child>
+          <widget class="GtkVBox" id="vbox17">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="spacing">5</property>
+            <child>
+              <widget class="GtkVBox" id="vbox18">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <child>
+                  <widget class="GtkLabel" id="label19">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Numeric Expressions:</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkScrolledWindow" id="scrolledwindow8">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                    <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                    <property name="shadow_type">GTK_SHADOW_IN</property>
+                    <child>
+                      <widget class="GtkTextView" id="compute-textview1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkHBox" id="hbox16">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="spacing">5</property>
+                <child>
+                  <widget class="PsppireKeypad" id="psppire-keypad1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_FOCUS_CHANGE_MASK</property>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkVBox" id="vbox22">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox17">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <child>
+                          <widget class="GtkLabel" id="label22">
+                            <property name="visible">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Functions:</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="PsppireSelector" id="compute-selector2">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="border_width">5</property>
+                            <property name="orientation">PSPPIRE_SELECT_SOURCE_BELOW_DEST</property>
+                          </widget>
+                          <packing>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkScrolledWindow" id="scrolledwindow10">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+                        <property name="shadow_type">GTK_SHADOW_IN</property>
+                        <child>
+                          <widget class="GtkTreeView" id="compute-treeview2">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="headers_visible">False</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkHBox" id="hbox18">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <child>
+                  <widget class="GtkButton" id="button4">
+                    <property name="visible">True</property>
+                    <property name="sensitive">False</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <property name="label" translatable="yes">If...</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                  </packing>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label23">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                  </widget>
+                  <packing>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="PsppireHButtonBox" id="psppire-hbuttonbox2">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="border_width">5</property>
+                <property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
+              </widget>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="pack_type">GTK_PACK_END</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="padding">5</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>
index 1d5c551007cd8755066b6c5a018788c931982daf..d7b742c279128656a587ddbbebccb156bc87eb7f 100644 (file)
@@ -1,3 +1,23 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+
 #include <gtk/gtk.h>
 #include "sort-cases-dialog.h"
 #include "helper.h"
index ef2e72b11727c167a99c99a1287611fef6ff1b11..5353b738f2ee32aeb03a012646270ea6a257e178 100644 (file)
@@ -1,6 +1,6 @@
 /*
     PSPPIRE --- A Graphical User Interface for PSPP
-    Copyright (C) 2006  Free Software Foundation
+    Copyright (C) 2007  Free Software Foundation
 
     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
index ba0abced435848a43eac661b62e13da9fbfe0e38..449d1d26bf8ba54b75c2b902281ca5414f1184d8 100644 (file)
@@ -1,3 +1,23 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2007  Free Software Foundation
+
+    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., 51 Franklin Street, Fifth Floor, Boston, MA
+    02110-1301, USA. */
+
+
 #ifndef WINDOW_MANAGER_H
 #define WINDOW_MANAGER_H