pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] pspp po/de.po po/pspp.pot src/ui/gui/ChangeLog ...


From: John Darrington
Subject: [Pspp-cvs] pspp po/de.po po/pspp.pot src/ui/gui/ChangeLog ...
Date: Sun, 17 Dec 2006 00:01:05 +0000

CVSROOT:        /sources/pspp
Module name:    pspp
Changes by:     John Darrington <jmd>   06/12/17 00:01:05

Modified files:
        po             : de.po pspp.pot 
        src/ui/gui     : ChangeLog automake.mk message-dialog.c 
                         psppire-dict.c psppire-dict.h psppire.c 
                         psppire.glade syntax-editor.c 
Added files:
        src/ui/gui     : syntax-editor-source.c syntax-editor-source.h 
                         syntax-editor.h 

Log message:
        Added the ability to run syntax from the syntax editor.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/po/de.po?cvsroot=pspp&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/pspp/po/pspp.pot?cvsroot=pspp&r1=1.108&r2=1.109
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/ChangeLog?cvsroot=pspp&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/automake.mk?cvsroot=pspp&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/message-dialog.c?cvsroot=pspp&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-dict.c?cvsroot=pspp&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-dict.h?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire.c?cvsroot=pspp&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire.glade?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/syntax-editor.c?cvsroot=pspp&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/syntax-editor-source.c?cvsroot=pspp&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/syntax-editor-source.h?cvsroot=pspp&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/syntax-editor.h?cvsroot=pspp&rev=1.1

Patches:
Index: po/de.po
===================================================================
RCS file: /sources/pspp/pspp/po/de.po,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- po/de.po    16 Dec 2006 04:26:42 -0000      1.24
+++ po/de.po    17 Dec 2006 00:01:04 -0000      1.25
@@ -10,7 +10,7 @@
 msgstr ""
 "Project-Id-Version: PSPP 0.4.2\n"
 "Report-Msgid-Bugs-To: address@hidden"
-"POT-Creation-Date: 2006-12-16 13:22+0900\n"
+"POT-Creation-Date: 2006-12-16 15:49+0900\n"
 "PO-Revision-Date: 2006-05-26 17:49+0800\n"
 "Last-Translator: John Darrington <address@hidden>\n"
 "Language-Team: German <address@hidden>\n"
@@ -4165,8 +4165,8 @@
 msgid "Style of bevel around the custom entry button"
 msgstr ""
 
-#: src/ui/gui/menu-actions.c:63 src/ui/gui/syntax-editor.c:60
-#: src/ui/gui/syntax-editor.c:82
+#: src/ui/gui/menu-actions.c:63 src/ui/gui/syntax-editor.c:64
+#: src/ui/gui/syntax-editor.c:86
 msgid "Untitled"
 msgstr "Unbetitelt"
 
@@ -4186,8 +4186,8 @@
 msgid "Portable Files (*.por) "
 msgstr "Tragbardatein (*.por)"
 
-#: src/ui/gui/menu-actions.c:239 src/ui/gui/syntax-editor.c:121
-#: src/ui/gui/syntax-editor.c:377
+#: src/ui/gui/menu-actions.c:239 src/ui/gui/syntax-editor.c:125
+#: src/ui/gui/syntax-editor.c:416
 msgid "All Files"
 msgstr "Alle Datei"
 
@@ -4211,6 +4211,11 @@
 msgid "PSPP Error"
 msgstr "PSPP Fehler"
 
+#: src/ui/gui/message-dialog.c:149
+#, c-format
+msgid "%s (line %d) %s"
+msgstr ""
+
 #: src/ui/gui/missing-val-dialog.c:117 src/ui/gui/missing-val-dialog.c:162
 msgid "Incorrect value for variable type"
 msgstr "Unpassend Wert für Variable"
@@ -4219,7 +4224,7 @@
 msgid "Incorrect range specification"
 msgstr "Falshe Spannweitebeschreibung"
 
-#: src/ui/gui/psppire.c:71
+#: src/ui/gui/psppire.c:74
 msgid "Sorry. The help system hasn't yet been implemented."
 msgstr "Es gibt noch nicht kein Helpsysteme. Schade!"
 
@@ -4566,27 +4571,27 @@
 msgid "Criteria"
 msgstr ""
 
-#: src/ui/gui/syntax-editor.c:59
+#: src/ui/gui/syntax-editor.c:63
 #, c-format
 msgid "Save contents of syntax editor to %s?"
 msgstr ""
 
-#: src/ui/gui/syntax-editor.c:107
+#: src/ui/gui/syntax-editor.c:111
 #, fuzzy
 msgid "Save Syntax"
 msgstr "Speichern unter"
 
-#: src/ui/gui/syntax-editor.c:115 src/ui/gui/syntax-editor.c:371
+#: src/ui/gui/syntax-editor.c:119 src/ui/gui/syntax-editor.c:410
 #, fuzzy
 msgid "Syntax Files (*.sps) "
 msgstr "Systemedatein (*.sav)"
 
-#: src/ui/gui/syntax-editor.c:276
+#: src/ui/gui/syntax-editor.c:312
 #, fuzzy, c-format
 msgid "%s --- PSPP Syntax Editor"
 msgstr "PSPP Dateiaufbereiter"
 
-#: src/ui/gui/syntax-editor.c:363
+#: src/ui/gui/syntax-editor.c:402
 msgid "Open Syntax"
 msgstr ""
 

Index: po/pspp.pot
===================================================================
RCS file: /sources/pspp/pspp/po/pspp.pot,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -b -r1.108 -r1.109
--- po/pspp.pot 16 Dec 2006 04:26:42 -0000      1.108
+++ po/pspp.pot 17 Dec 2006 00:01:05 -0000      1.109
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: address@hidden"
-"POT-Creation-Date: 2006-12-16 13:22+0900\n"
+"POT-Creation-Date: 2006-12-16 15:49+0900\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <address@hidden>\n"
 "Language-Team: LANGUAGE <address@hidden>\n"
@@ -4160,8 +4160,8 @@
 msgid "Style of bevel around the custom entry button"
 msgstr ""
 
-#: src/ui/gui/menu-actions.c:63 src/ui/gui/syntax-editor.c:60
-#: src/ui/gui/syntax-editor.c:82
+#: src/ui/gui/menu-actions.c:63 src/ui/gui/syntax-editor.c:64
+#: src/ui/gui/syntax-editor.c:86
 msgid "Untitled"
 msgstr ""
 
@@ -4181,8 +4181,8 @@
 msgid "Portable Files (*.por) "
 msgstr ""
 
-#: src/ui/gui/menu-actions.c:239 src/ui/gui/syntax-editor.c:121
-#: src/ui/gui/syntax-editor.c:377
+#: src/ui/gui/menu-actions.c:239 src/ui/gui/syntax-editor.c:125
+#: src/ui/gui/syntax-editor.c:416
 msgid "All Files"
 msgstr ""
 
@@ -4206,6 +4206,11 @@
 msgid "PSPP Error"
 msgstr ""
 
+#: src/ui/gui/message-dialog.c:149
+#, c-format
+msgid "%s (line %d) %s"
+msgstr ""
+
 #: src/ui/gui/missing-val-dialog.c:117 src/ui/gui/missing-val-dialog.c:162
 msgid "Incorrect value for variable type"
 msgstr ""
@@ -4214,7 +4219,7 @@
 msgid "Incorrect range specification"
 msgstr ""
 
-#: src/ui/gui/psppire.c:71
+#: src/ui/gui/psppire.c:74
 msgid "Sorry. The help system hasn't yet been implemented."
 msgstr ""
 
@@ -4552,25 +4557,25 @@
 msgid "Criteria"
 msgstr ""
 
-#: src/ui/gui/syntax-editor.c:59
+#: src/ui/gui/syntax-editor.c:63
 #, c-format
 msgid "Save contents of syntax editor to %s?"
 msgstr ""
 
-#: src/ui/gui/syntax-editor.c:107
+#: src/ui/gui/syntax-editor.c:111
 msgid "Save Syntax"
 msgstr ""
 
-#: src/ui/gui/syntax-editor.c:115 src/ui/gui/syntax-editor.c:371
+#: src/ui/gui/syntax-editor.c:119 src/ui/gui/syntax-editor.c:410
 msgid "Syntax Files (*.sps) "
 msgstr ""
 
-#: src/ui/gui/syntax-editor.c:276
+#: src/ui/gui/syntax-editor.c:312
 #, c-format
 msgid "%s --- PSPP Syntax Editor"
 msgstr ""
 
-#: src/ui/gui/syntax-editor.c:363
+#: src/ui/gui/syntax-editor.c:402
 msgid "Open Syntax"
 msgstr ""
 

Index: src/ui/gui/ChangeLog
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/ChangeLog,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- src/ui/gui/ChangeLog        16 Dec 2006 22:13:12 -0000      1.29
+++ src/ui/gui/ChangeLog        17 Dec 2006 00:01:05 -0000      1.30
@@ -1,3 +1,15 @@
+Sun Dec 17 08:26:10 WST 2006 John Darrington <address@hidden>
+
+       * syntax-editor-source.c syntax-editor-source.h syntax-editor.h: 
+       New files. 
+
+       * message-dialog.c :  Now reports the filename and line number in 
+       error messages.
+       
+       * psppire.c psppire.glade syntax-editor.c: Added the ability to run 
+       syntax from the syntax editor.
+
+       
 Sat Dec 16 14:13:07 2006  Ben Pfaff  <address@hidden>
 
        * psppire-data-store.c (geometry_get_justification): Don't assume

Index: src/ui/gui/automake.mk
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/automake.mk,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- src/ui/gui/automake.mk      16 Dec 2006 03:40:41 -0000      1.16
+++ src/ui/gui/automake.mk      17 Dec 2006 00:01:05 -0000      1.17
@@ -8,13 +8,19 @@
        -export-dynamic 
 
 src_ui_gui_psppire_LDADD = \
+       lib/gtksheet/libgtksheet.a \
+       src/language/liblanguage.a \
+       src/ui/libuicommon.a \
+       src/output/charts/libcharts.a \
+       src/output/liboutput.a \
+       src/math/libpspp_math.a  \
+       src/math/linreg/libpspp_linreg.a  \
+       lib/linreg/liblinreg.a  \
+       lib/gsl-extras/libgsl-extras.a  \
+       src/data/libdata.a \
+       src/libpspp/libpspp.a \
        $(GTK_LIBS) \
        $(GLADE_LIBS) \
-       $(top_builddir)/lib/gtksheet/libgtksheet.a \
-       $(top_builddir)/src/ui/libuicommon.a \
-       $(top_builddir)/src/math/libpspp_math.a \
-       $(top_builddir)/src/data/libdata.a \
-       $(top_builddir)/src/libpspp/libpspp.a \
        $(top_builddir)/gl/libgl.a \
        @LIBINTL@ @LIBREADLINE@
 
@@ -60,6 +66,9 @@
        src/ui/gui/sort-cases-dialog.c \
        src/ui/gui/sort-cases-dialog.h \
        src/ui/gui/syntax-editor.c \
+       src/ui/gui/syntax-editor.h \
+       src/ui/gui/syntax-editor-source.c \
+       src/ui/gui/syntax-editor-source.h \
        src/ui/gui/val-labs-dialog.c \
        src/ui/gui/val-labs-dialog.h \
        src/ui/gui/var-sheet.c \

Index: src/ui/gui/message-dialog.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/message-dialog.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- src/ui/gui/message-dialog.c 16 Dec 2006 04:26:43 -0000      1.17
+++ src/ui/gui/message-dialog.c 17 Dec 2006 00:01:05 -0000      1.18
@@ -146,7 +146,10 @@
                                  msg);
   
   gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                                           "%s", m->text);
+                                           _("%s (line %d) %s"),
+                                          m->where.file_name,
+                                          m->where.line_number,
+                                          m->text);
     
   gtk_window_set_transient_for(GTK_WINDOW(dialog), parent);
 

Index: src/ui/gui/psppire-dict.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-dict.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- src/ui/gui/psppire-dict.c   16 Dec 2006 04:26:43 -0000      1.12
+++ src/ui/gui/psppire-dict.c   17 Dec 2006 00:01:05 -0000      1.13
@@ -200,27 +200,10 @@
 static void
 psppire_dict_init (PsppireDict *psppire_dict)
 {
-  psppire_dict->dict = dict_create ();
-
-  dict_set_callbacks (psppire_dict->dict, &gui_callbacks, psppire_dict);
-
   psppire_dict->stamp = g_random_int();
 }
 
 /**
- * psppire_dict_new:
- * @returns: a new #PsppireDict object
- *
- * Creates a new #PsppireDict.
- */
-PsppireDict*
-psppire_dict_new (void)
-{
-  return g_object_new (G_TYPE_PSPPIRE_DICT, NULL);
-}
-
-
-/**
  * psppire_dict_new_from_dict:
  * @returns: a new #PsppireDict object
  *
@@ -232,6 +215,8 @@
   PsppireDict *new_dict = g_object_new (G_TYPE_PSPPIRE_DICT, NULL);
   new_dict->dict = d;
 
+  dict_set_callbacks (new_dict->dict, &gui_callbacks, new_dict);
+
   return new_dict;
 }
 

Index: src/ui/gui/psppire-dict.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-dict.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/ui/gui/psppire-dict.h   16 Dec 2006 04:26:43 -0000      1.8
+++ src/ui/gui/psppire-dict.h   17 Dec 2006 00:01:05 -0000      1.9
@@ -66,7 +66,6 @@
 
 /* -- PsppireDict --- */
 GType          psppire_dict_get_type (void);
-PsppireDict*     psppire_dict_new (void);
 PsppireDict*     psppire_dict_new_from_dict (struct dictionary *d);
 void           psppire_dict_set_name (PsppireDict* s, gint idx, const gchar 
*name);
 void           psppire_dict_delete_var (PsppireDict *s, gint idx);

Index: src/ui/gui/psppire.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- src/ui/gui/psppire.c        16 Dec 2006 04:26:43 -0000      1.23
+++ src/ui/gui/psppire.c        17 Dec 2006 00:01:05 -0000      1.24
@@ -24,10 +24,13 @@
 
 #include <libpspp/version.h>
 #include <libpspp/copyleft.h>
+#include <data/file-handle-def.h>
 #include <data/format.h>
 #include <data/settings.h>
 #include <data/file-name.h>
+#include <data/procedure.h>
 #include <libpspp/getl.h>
+#include <language/lexer/lexer.h>
 
 #include <getopt.h>
 #include <gtk/gtk.h>
@@ -77,7 +80,10 @@
 
 void create_icon_factory (void);
 
-static struct source_stream *the_source_stream ;
+struct source_stream *the_source_stream ;
+struct lexer *the_lexer;
+struct dataset * the_dataset = NULL;
+
 
 int 
 main(int argc, char *argv[]) 
@@ -118,13 +124,21 @@
 
   fmt_init();
   settings_init();
+  fh_init ();
   the_source_stream = create_source_stream (
                          fn_getenv_default ("STAT_INCLUDE_PATH", include_path)
                          );
 
+  the_lexer = lex_create (the_source_stream);
+
+  the_dataset = create_dataset ();
+
   message_dialog_init (the_source_stream);
 
-  the_dictionary = psppire_dict_new();
+  the_dictionary =
+    psppire_dict_new_from_dict (
+                               dataset_dict (the_dataset)
+                               );
 
   bind_textdomain_codeset(PACKAGE, "UTF-8");
 

Index: src/ui/gui/psppire.glade
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire.glade,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/ui/gui/psppire.glade    7 Dec 2006 11:10:23 -0000       1.8
+++ src/ui/gui/psppire.glade    17 Dec 2006 00:01:05 -0000      1.9
@@ -3138,7 +3138,7 @@
                <widget class="GtkMenu" id="run1_menu">
 
                  <child>
-                   <widget class="GtkMenuItem" id="all1">
+                   <widget class="GtkMenuItem" id="run_all">
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">All</property>
                      <property name="use_underline">True</property>
@@ -3146,7 +3146,7 @@
                  </child>
 
                  <child>
-                   <widget class="GtkMenuItem" id="selection1">
+                   <widget class="GtkMenuItem" id="run_selection">
                      <property name="visible">True</property>
                      <property name="label" 
translatable="yes">Selection</property>
                      <property name="use_underline">True</property>
@@ -3154,7 +3154,7 @@
                  </child>
 
                  <child>
-                   <widget class="GtkMenuItem" id="current_line1">
+                   <widget class="GtkMenuItem" id="run_current_line">
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">Current 
Line</property>
                      <property name="use_underline">True</property>
@@ -3162,7 +3162,7 @@
                  </child>
 
                  <child>
-                   <widget class="GtkMenuItem" id="to_end1">
+                   <widget class="GtkMenuItem" id="run_to_end">
                      <property name="visible">True</property>
                      <property name="label" translatable="yes">To 
End</property>
                      <property name="use_underline">True</property>

Index: src/ui/gui/syntax-editor.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/syntax-editor.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- src/ui/gui/syntax-editor.c  16 Dec 2006 04:26:43 -0000      1.3
+++ src/ui/gui/syntax-editor.c  17 Dec 2006 00:01:05 -0000      1.4
@@ -26,17 +26,21 @@
 #include <glade/glade.h>
 #include <gtk/gtk.h>
 #include <libpspp/message.h>
-
+#include <libpspp/getl.h>
 #include "helper.h"
 
-extern GladeXML *xml;
 
-struct syntax_editor
-{
-  GtkWidget *window;      /* The top level window of the editor */
-  GtkTextBuffer *buffer;  /* The buffer which contains the text */
-  gchar *name;            /* The name of this syntax buffer/editor */
-};
+
+#include <language/command.h>
+#include <data/procedure.h>
+#include "syntax-editor.h"
+#include "syntax-editor-source.h"
+
+extern struct source_stream *the_source_stream ;
+extern struct lexer *the_lexer;
+extern struct dataset *the_dataset;
+
+extern GladeXML *xml;
 
 static gboolean save_editor_to_file (struct syntax_editor *se,
                                     const gchar *filename,
@@ -188,6 +192,29 @@
   return FALSE;
 }
 
+static void
+on_run_all (GtkMenuItem *menuitem, gpointer user_data)
+{
+  GtkTextIter begin, end;
+  struct syntax_editor *se = user_data;
+
+  gtk_text_buffer_get_iter_at_line (se->buffer, &begin, 0);
+  gtk_text_buffer_get_iter_at_line (se->buffer, &end, -1);
+
+  getl_append_source (the_source_stream,
+                     create_syntax_editor_source (se, begin, end));
+  for (;;)
+    {
+      int result = cmd_parse (the_lexer, the_dataset,
+                             proc_has_source (the_dataset)
+                             ? CMD_STATE_DATA : CMD_STATE_INITIAL);
+
+      if (result == CMD_EOF || result == CMD_FINISH)
+       break;
+    }
+}
+
+
 void
 new_syntax_window (GtkMenuItem     *menuitem,
                   gpointer         user_data);
@@ -198,7 +225,8 @@
                                gpointer user_data);
 
 
-/* Create a new syntax editor with NAME.
+/*
+  Create a new syntax editor with NAME.
    If NAME is NULL, a name will be automatically assigned
 */
 static struct syntax_editor *
@@ -245,6 +273,12 @@
                    G_CALLBACK(on_syntax_save_as),
                    se);
 
+
+  g_signal_connect (get_widget_assert (new_xml,"run_all"),
+                   "activate",
+                   G_CALLBACK(on_run_all),
+                   se);
+
   g_object_unref (new_xml);
 
   g_signal_connect (se->window, "delete-event",
@@ -253,7 +287,9 @@
   return se;
 }
 
-/* Callback for the File->New->Syntax menuitem */
+/*
+   Callback for the File->New->Syntax menuitem
+*/
 void
 new_syntax_window (GtkMenuItem     *menuitem,
                   gpointer         user_data)
@@ -280,8 +316,10 @@
 }
 
 
-/* Save BUFFER to the file called FILENAME.
-   If successful, clears the buffer's modified flag */
+/*
+  Save BUFFER to the file called FILENAME.
+  If successful, clears the buffer's modified flag
+*/
 static gboolean
 save_editor_to_file (struct syntax_editor *se,
                     const gchar *filename,
@@ -317,7 +355,8 @@
 }
 
 
-/* Loads the buffer from the file called FILENAME
+/*
+  Loads the buffer from the file called FILENAME
 */
 static gboolean
 load_editor_from_file (struct syntax_editor *se,
@@ -423,3 +462,7 @@
 }
 #endif
 
+
+
+
+

Index: src/ui/gui/syntax-editor-source.c
===================================================================
RCS file: src/ui/gui/syntax-editor-source.c
diff -N src/ui/gui/syntax-editor-source.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ src/ui/gui/syntax-editor-source.c   17 Dec 2006 00:01:05 -0000      1.1
@@ -0,0 +1,130 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2006  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 <libpspp/getl.h>
+#include <libpspp/alloc.h>
+#include <libpspp/compiler.h>
+#include <libpspp/str.h>
+
+#include <stdlib.h>
+
+#include <gtk/gtk.h>
+
+#include "syntax-editor-source.h"
+#include "syntax-editor.h"
+
+struct syntax_editor_source
+  {
+    struct getl_interface parent;
+    const struct syntax_editor *se;
+    GtkTextIter i;
+    GtkTextIter end;
+  };
+
+
+static bool
+always_false (const struct getl_interface *i UNUSED)
+{
+  return false;
+}
+
+/* Returns the name of the source */
+static const char *
+name (const struct getl_interface *i)
+{
+  const struct syntax_editor_source *ses =
+    (const struct syntax_editor_source *) i;
+
+  return ses->se->name;
+}
+
+
+/* Returns the location within the source */
+static int
+location (const struct getl_interface *i)
+{
+  const struct syntax_editor_source *ses = (const struct syntax_editor_source 
*) i;
+
+  return gtk_text_iter_get_line (&ses->i);
+}
+
+
+static bool
+read_line_from_buffer (struct getl_interface *i,
+                      struct string *line,
+                      enum getl_syntax *syntax_rules)
+{
+  gchar *text;
+  GtkTextIter next_line;
+
+  struct syntax_editor_source *ses = (struct syntax_editor_source *) i;
+
+  if ( gtk_text_iter_compare (&ses->i, &ses->end) >= 0)
+    return false;
+
+  gtk_text_buffer_get_iter_at_line ( ses->se->buffer,
+                                    &next_line,
+                                    1 + gtk_text_iter_get_line (&ses->i)
+                                    );
+
+  text = gtk_text_buffer_get_text (ses->se->buffer,
+                                  &ses->i, &next_line,
+                                  FALSE);
+  g_strchomp (text);
+
+  ds_assign_cstr (line, text);
+
+  g_free (text);
+
+  gtk_text_iter_forward_line (&ses->i);
+
+  return true;
+}
+
+
+static void
+close (struct getl_interface *i )
+{
+  free (i);
+}
+
+struct getl_interface *
+create_syntax_editor_source (const struct syntax_editor *se,
+                            GtkTextIter start,
+                            GtkTextIter stop
+                            )
+{
+  struct syntax_editor_source *ses = xzalloc (sizeof *ses);
+
+  ses->se = se;
+  ses->i = start;
+  ses->end = stop;
+
+
+  ses->parent.interactive = always_false;
+  ses->parent.read = read_line_from_buffer;
+  ses->parent.close = close;
+
+  ses->parent.name = name;
+  ses->parent.location = location;
+
+
+  return (struct getl_interface *) ses;
+}

Index: src/ui/gui/syntax-editor-source.h
===================================================================
RCS file: src/ui/gui/syntax-editor-source.h
diff -N src/ui/gui/syntax-editor-source.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ src/ui/gui/syntax-editor-source.h   17 Dec 2006 00:01:05 -0000      1.1
@@ -0,0 +1,36 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2006  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 SYNTAX_EDITOR_SOURCE_H
+#define SYNTAX_EDITOR_SOURCE_H
+
+#include <gtk/gtk.h>
+struct getl_interface;
+
+struct syntax_editor;
+
+struct getl_interface *
+create_syntax_editor_source (const struct syntax_editor *se,
+                            GtkTextIter start,
+                            GtkTextIter stop
+                            );
+
+
+
+#endif

Index: src/ui/gui/syntax-editor.h
===================================================================
RCS file: src/ui/gui/syntax-editor.h
diff -N src/ui/gui/syntax-editor.h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ src/ui/gui/syntax-editor.h  17 Dec 2006 00:01:05 -0000      1.1
@@ -0,0 +1,36 @@
+/*
+    PSPPIRE --- A Graphical User Interface for PSPP
+    Copyright (C) 2006  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 SYNTAX_EDITOR_H
+#define SYNTAX_EDITOR_H
+
+#include <gtk/gtk.h>
+
+
+
+struct syntax_editor
+{
+  GtkWidget *window;      /* The top level window of the editor */
+  GtkTextBuffer *buffer;  /* The buffer which contains the text */
+  gchar *name;            /* The name of this syntax buffer/editor */
+};
+
+
+#endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]