From: John Darrington Date: Wed, 4 Apr 2007 11:02:31 +0000 (+0000) Subject: Added the Compute dialog box. X-Git-Tag: v0.6.0~498 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp-builds.git;a=commitdiff_plain;h=146997e1690f055481e2003529eaa4f8848ca4a8 Added the Compute dialog box. --- diff --git a/glade/ChangeLog b/glade/ChangeLog index d7d46775..4540c2cd 100644 --- a/glade/ChangeLog +++ b/glade/ChangeLog @@ -1,3 +1,7 @@ +4/4/2007 John Darrington + + * Seperated psppire-buttonbox into psppire-vbuttonbox and psppire-buttonbox + Sat Mar 31 07:09:33 WST 2007 John Darrington * Added icons directory and its contents. diff --git a/glade/automake.mk b/glade/automake.mk index e9af9aeb..20d15d64 100644 --- a/glade/automake.mk +++ b/glade/automake.mk @@ -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 index d37d4df5..00000000 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 index 00000000..bedcf633 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 index 00000000..d37d4df5 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 index f241e680..00000000 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 index 00000000..538a2fb9 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 index 00000000..f241e680 Binary files /dev/null and b/glade/icons/22x22/psppire-vbuttonbox.png differ diff --git a/glade/psppire.xml b/glade/psppire.xml index 9fb55bae..847afb26 100644 --- a/glade/psppire.xml +++ b/glade/psppire.xml @@ -50,13 +50,12 @@ - - + glade_psppire_button_box_post_create glade_psppire_button_box_get_children @@ -64,7 +63,8 @@ glade_psppire_button_box_get_internal_child - + + @@ -77,6 +77,30 @@ + + + glade_psppire_button_box_post_create + glade_psppire_button_box_get_children + + glade_psppire_button_box_get_internal_child + + + + + + + + + + + + + + + + + + + + @@ -136,6 +162,8 @@ + + @@ -147,7 +175,8 @@ - + + diff --git a/src/ui/gui/ChangeLog b/src/ui/gui/ChangeLog index 7df5f747..14fd0cf0 100644 --- a/src/ui/gui/ChangeLog +++ b/src/ui/gui/ChangeLog @@ -1,3 +1,21 @@ +2007-04-04 John Darrington + + * 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 John McCabe-Dansted diff --git a/src/ui/gui/about.h b/src/ui/gui/about.h index 4065a802..1deb7931 100644 --- a/src/ui/gui/about.h +++ b/src/ui/gui/about.h @@ -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); diff --git a/src/ui/gui/automake.mk b/src/ui/gui/automake.mk index e8da4c4d..6b95ff68 100644 --- a/src/ui/gui/automake.mk +++ b/src/ui/gui/automake.mk @@ -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 index 00000000..bc2b15c1 --- /dev/null +++ b/src/ui/gui/compute-dialog.c @@ -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 +#include "compute-dialog.h" +#include "helper.h" +#include "psppire-dialog.h" +#include "psppire-keypad.h" +#include "data-editor.h" +#include +#include "psppire-var-store.h" +#include "dialog-common.h" +#include "dict-display.h" + +#include +#include "syntax-editor.h" + + +#include +#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 + }; + + +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 index 00000000..588058f5 --- /dev/null +++ b/src/ui/gui/compute-dialog.h @@ -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 +#include + + +void compute_dialog (GObject *o, gpointer data); + +#endif diff --git a/src/ui/gui/data-editor.c b/src/ui/gui/data-editor.c index 5a0f8358..f733c152 100644 --- a/src/ui/gui/data-editor.c +++ b/src/ui/gui/data-editor.c @@ -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", diff --git a/src/ui/gui/data-editor.glade b/src/ui/gui/data-editor.glade index 8761fc93..ddd62ba5 100644 --- a/src/ui/gui/data-editor.glade +++ b/src/ui/gui/data-editor.glade @@ -372,6 +372,37 @@ + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + _Transform + True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + _Compute + True + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Ran_k Cases + True + + + + + + True @@ -464,7 +495,7 @@ True False Recall - gtk-missing-image + pspp-recent-dialogs False diff --git a/src/ui/gui/data-editor.h b/src/ui/gui/data-editor.h index 0fe62ea6..42266408 100644 --- a/src/ui/gui/data-editor.h +++ b/src/ui/gui/data-editor.h @@ -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; diff --git a/src/ui/gui/glade-register.c b/src/ui/gui/glade-register.c index 40d3a6b8..6283081d 100644 --- a/src/ui/gui/glade-register.c +++ b/src/ui/gui/glade-register.c @@ -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 #include #include #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); + } diff --git a/src/ui/gui/helper.c b/src/ui/gui/helper.c index bd6e2198..69b5d437 100644 --- a/src/ui/gui/helper.c +++ b/src/ui/gui/helper.c @@ -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. */ diff --git a/src/ui/gui/psppire-buttonbox.c b/src/ui/gui/psppire-buttonbox.c index e5c1c561..400c0c1f 100644 --- a/src/ui/gui/psppire-buttonbox.c +++ b/src/ui/gui/psppire-buttonbox.c @@ -32,39 +32,39 @@ #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; } - diff --git a/src/ui/gui/psppire-buttonbox.h b/src/ui/gui/psppire-buttonbox.h index b9d8ea34..91d35551 100644 --- a/src/ui/gui/psppire-buttonbox.h +++ b/src/ui/gui/psppire-buttonbox.h @@ -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 #include -#include +#include 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 diff --git a/src/ui/gui/psppire-dialog.h b/src/ui/gui/psppire-dialog.h index b7e39a7c..17d8b50f 100644 --- a/src/ui/gui/psppire-dialog.h +++ b/src/ui/gui/psppire-dialog.h @@ -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 index 00000000..8b146a9b --- /dev/null +++ b/src/ui/gui/psppire-hbuttonbox.c @@ -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 + +#include +#include +#include +#include "psppire-hbuttonbox.h" +#include "psppire-dialog.h" + +#include + +#include + +#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 index 00000000..60d6a720 --- /dev/null +++ b/src/ui/gui/psppire-hbuttonbox.h @@ -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 +#include +#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__ */ + diff --git a/src/ui/gui/psppire-keypad.c b/src/ui/gui/psppire-keypad.c index af0e5924..c68307c9 100644 --- a/src/ui/gui/psppire-keypad.c +++ b/src/ui/gui/psppire-keypad.c @@ -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 ("xy"); 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); diff --git a/src/ui/gui/psppire-keypad.h b/src/ui/gui/psppire-keypad.h index 340696c6..f288111b 100644 --- a/src/ui/gui/psppire-keypad.h +++ b/src/ui/gui/psppire-keypad.h @@ -52,6 +52,7 @@ #include #include #include +#include G_BEGIN_DECLS diff --git a/src/ui/gui/psppire-selector.c b/src/ui/gui/psppire-selector.c index 6465189d..a041fd5a 100644 --- a/src/ui/gui/psppire-selector.c +++ b/src/ui/gui/psppire-selector.c @@ -68,6 +68,7 @@ #include #include +#include #include 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 index 00000000..59ae0cc4 --- /dev/null +++ b/src/ui/gui/psppire-vbuttonbox.c @@ -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 + +#include +#include +#include +#include "psppire-vbuttonbox.h" +#include "psppire-dialog.h" + +#include + +#include + +#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 index 00000000..5b30cc73 --- /dev/null +++ b/src/ui/gui/psppire-vbuttonbox.h @@ -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 +#include +#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__ */ + diff --git a/src/ui/gui/psppire.glade b/src/ui/gui/psppire.glade index 75352ab6..eb5ab423 100644 --- a/src/ui/gui/psppire.glade +++ b/src/ui/gui/psppire.glade @@ -191,7 +191,8 @@ - + + True 5 @@ -364,7 +365,8 @@ - + + True 5 @@ -655,7 +657,7 @@ - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 @@ -682,35 +684,22 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 - + True + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 0 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC GTK_SHADOW_IN - + True True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - True - - + False + True - - - - label_item - - @@ -741,6 +730,10 @@ True True + + False + False + @@ -1091,27 +1084,16 @@ - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 GTK_BUTTONBOX_SPREAD - - - - - - - - - - - - - - - + False + False + GTK_PACK_END 2 @@ -1284,7 +1266,7 @@ - + True GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 @@ -1299,4 +1281,317 @@ + + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Compute Variable + True + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 2 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Target Variable: + + + False + False + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + False + False + 1 + + + + + False + False + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Type & Label + + + False + False + 1 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + + + 2 + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + = + + + False + False + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + False + False + 1 + + + + + False + False + 1 + + + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Numeric Expressions: + + + False + False + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + + 1 + + + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + + + True + True + 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 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 0 + Functions: + + + + + True + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + PSPPIRE_SELECT_SOURCE_BELOW_DEST + + + False + 1 + + + + + False + False + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_POLICY_NEVER + GTK_SHADOW_IN + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + + + + + 1 + + + + + 1 + + + + + 1 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + True + False + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + If... + + + False + False + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + 1 + + + + + False + False + 2 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 + GTK_BUTTONBOX_SPREAD + + + False + False + GTK_PACK_END + 3 + + + + + 5 + 1 + + + + + diff --git a/src/ui/gui/sort-cases-dialog.c b/src/ui/gui/sort-cases-dialog.c index 1d5c5510..d7b742c2 100644 --- a/src/ui/gui/sort-cases-dialog.c +++ b/src/ui/gui/sort-cases-dialog.c @@ -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 #include "sort-cases-dialog.h" #include "helper.h" diff --git a/src/ui/gui/sort-cases-dialog.h b/src/ui/gui/sort-cases-dialog.h index ef2e72b1..5353b738 100644 --- a/src/ui/gui/sort-cases-dialog.h +++ b/src/ui/gui/sort-cases-dialog.h @@ -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 diff --git a/src/ui/gui/window-manager.h b/src/ui/gui/window-manager.h index ba0abced..449d1d26 100644 --- a/src/ui/gui/window-manager.h +++ b/src/ui/gui/window-manager.h @@ -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