PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.16], [],
[PSPP_REQUIRED_PREREQ([gtk+ 2.0 version 2.16 or later (or use --without-gui)])])
+ PKG_CHECK_MODULES([GTKSOURCEVIEW], [gtksourceview-2.0 >= 2.2])
+
AC_ARG_VAR([GLIB_GENMARSHAL])
AC_CHECK_PROGS([GLIB_GENMARSHAL], [glib-genmarshal])
if test "x$GLIB_GENMARSHAL" = x; then
if HAVE_GUI
bin_PROGRAMS += src/ui/gui/psppire
-src_ui_gui_psppire_CFLAGS = $(GTK_CFLAGS) -Wall -DGDK_MULTIHEAD_SAFE=1
+src_ui_gui_psppire_CFLAGS = $(GTK_CFLAGS) $(GTKSOURCEVIEW_CFLAGS) -Wall -DGDK_MULTIHEAD_SAFE=1
src_ui_gui_psppire_LDFLAGS = \
src/libpspp.la \
src/libpspp-core.la \
$(GTK_LIBS) \
+ $(GTKSOURCEVIEW_LIBS) \
$(CAIRO_LIBS) \
$(LIBINTL)
context = apps
+install-lang:
+ $(INSTALL) $(top_srcdir)/src/ui/gui/pspp.lang $(pkgdatadir)
+
install-icons:
for size in 16x16 ; do \
$(MKDIR_P) $(themedir)/$$size/$(context) ; \
done
gtk-update-icon-cache --ignore-theme-index $(themedir)
-INSTALL_DATA_HOOKS += install-icons
+INSTALL_DATA_HOOKS += install-icons install-lang
uninstall-icons:
for size in 16x16 ; do \
dist_src_ui_gui_psppire_DATA = \
$(UI_FILES) \
+ $(top_srcdir)/src/ui/gui/pspp.lang \
$(top_srcdir)/src/ui/gui/pspplogo.png \
$(top_srcdir)/src/ui/gui/icons/value-labels.png \
$(top_srcdir)/src/ui/gui/icons/goto-variable.png\
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ PSPP - a program for statistical analysis.
+ Copyright (C) 2006, 2009 Free Software Foundation, Inc.
+
+ 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 3 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, see <http://www.gnu.org/licenses/>.
+-->
+
+
+<language id="pspp" _name="PSPP" version="2.0" _section="Sources">
+
+ <styles>
+ <style id="string" _name="String" map-to="def:string"/>
+ <style id="escaped-character" _name="Escaped Character" map-to="def:special-char"/>
+ <style id="data-block" _name="Data Block" map-to="def:preprocessor"/>
+ <style id="included-file" _name="Included File" map-to="def:string"/>
+ <style id="char" _name="Character" map-to="def:character"/>
+ <style id="keyword" _name="Keyword" map-to="def:keyword"/>
+ <style id="type" _name="Data Type" map-to="def:type"/>
+ <style id="comment" _name="Comment" map-to="def:comment"/>
+ </styles>
+
+ <default-regex-options case-sensitive="false" />
+
+ <definitions>
+
+ <context id="pspp">
+
+ <include>
+
+ <context id="comment-star" style-ref="comment">
+ <start>^[\t ]*\*</start>
+ <end>^[\t ]*$|^(?=[^\t ])</end>
+ </context>
+
+ <context id="comment-keyword" style-ref="comment">
+ <start>^[\t ]*COMMENT</start>
+ <end>\.[\t ]*$|^[\t ]*$|^(?=[^\t ])</end>
+ </context>
+
+ <context id="data-block" style-ref="data-block">
+ <start>(?<=(^BEGIN DATA$))</start>
+ <end>(?=(^END DATA\.?))</end>
+ </context>
+
+ <context id="string-double" end-at-line-end="true"
+ style-ref="string">
+ <start>"</start>
+ <end>"</end>
+ </context>
+
+ <context id="string-single" end-at-line-end="true"
+ style-ref="string">
+ <start>'</start>
+ <end>'</end>
+ </context>
+
+ <context id="keywords" style-ref="keyword">
+ <keyword>ALL</keyword>
+ <keyword>AND</keyword>
+ <keyword>BY</keyword>
+ <keyword>EQ</keyword>
+ <keyword>GE</keyword>
+ <keyword>GT</keyword>
+ <keyword>LE</keyword>
+ <keyword>LT</keyword>
+ <keyword>NE</keyword>
+ <keyword>NOT</keyword>
+ <keyword>OR</keyword>
+ <keyword>TO</keyword>
+ <keyword>WITH</keyword>
+ </context>
+
+ </include>
+ </context>
+ </definitions>
+
+
+</language>
#include "executor.h"
#include "helper.h"
+#include <gtksourceview/gtksourcebuffer.h>
+#include <gtksourceview/gtksourcelanguage.h>
+#include <gtksourceview/gtksourcelanguagemanager.h>
+
#include <libpspp/message.h>
#include <stdlib.h>
static void
psppire_syntax_window_class_init (PsppireSyntaxWindowClass *class)
{
+ GtkSourceLanguageManager *lm = gtk_source_language_manager_get_default ();
+
+ const gchar * const *existing_paths = gtk_source_language_manager_get_search_path (lm);
+
+ const gchar **new_paths = g_strdupv (existing_paths);
+
+ int n = g_strv_length (existing_paths);
+
+ new_paths = g_realloc (new_paths, (n+1) * sizeof (*new_paths));
+ new_paths[n] = g_strdup (PKGDATADIR);
+ new_paths[n+1] = NULL;
+
+ lm = gtk_source_language_manager_new ();
+ gtk_source_language_manager_set_search_path (lm, new_paths);
+
+ class->lan = gtk_source_language_manager_get_language (lm, "pspp");
+
+ if (class->lan == NULL)
+ g_warning ("pspp.lang file not found. Syntax highlighting will not be available.");
+
parent_class = g_type_class_peek_parent (class);
}
psppire_syntax_window_base_init (PsppireSyntaxWindowClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
-
object_class->finalize = psppire_syntax_window_finalize;
}
GtkWidget *menubar = get_widget_assert (xml, "menubar");
GtkWidget *sw = get_widget_assert (xml, "scrolledwindow8");
-
GtkWidget *text_view = get_widget_assert (xml, "syntax_text_view");
- window->buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
+
+ PsppireSyntaxWindowClass *class
+ = PSPPIRE_SYNTAX_WINDOW_CLASS (G_OBJECT_GET_CLASS (window));
+
+ if (class->lan)
+ window->buffer = GTK_TEXT_BUFFER (gtk_source_buffer_new_with_language (class->lan));
+ else
+ window->buffer = GTK_TEXT_BUFFER (gtk_source_buffer_new (NULL));
+
+ gtk_text_view_set_buffer (GTK_TEXT_VIEW (text_view), window->buffer);
+
+ g_object_set (text_view,
+ "show-line-numbers", TRUE,
+ "show-line-marks", TRUE,
+ "auto-indent", TRUE,
+ "indent-width", 4,
+ "highlight-current-line", TRUE,
+ NULL);
window->lexer = lex_create (the_source_stream);
window->sb = get_widget_assert (xml, "statusbar2");
#include "psppire-window.h"
#include <gtk/gtk.h>
+#include <gtksourceview/gtksourcelanguage.h>
+#include <gtksourceview/gtksourcelanguagemanager.h>
+
G_BEGIN_DECLS
#define PSPPIRE_SYNTAX_WINDOW_TYPE (psppire_syntax_window_get_type ())
#define PSPPIRE_SYNTAX_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_SYNTAX_WINDOW_TYPE, PsppireSyntaxWindow))
#define PSPPIRE_SYNTAX_WINDOW_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
- PSPPIRE_SYNTAX_WINDOW_TYPE, PsppireSyntax_WindowClass))
+ PSPPIRE_SYNTAX_WINDOW_TYPE, PsppireSyntaxWindowClass))
#define PSPPIRE_IS_SYNTAX_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
PSPPIRE_SYNTAX_WINDOW_TYPE))
#define PSPPIRE_IS_SYNTAX_WINDOW_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
{
PsppireWindowClass parent_class;
+
+ GtkSourceLanguage *lan ;
};
GType psppire_syntax_window_get_type (void);
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
- <object class="GtkTextView" id="syntax_text_view">
+ <object class="GtkSourceView" id="syntax_text_view">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>