*/
#include <config.h>
+#include "psppire-syntax-window.h"
+
#include <glib-object.h>
#include <glib.h>
#include "helper.h"
#include "message-dialog.h"
+#include <data/format.h>
#include <data/data-in.h>
#include <data/data-out.h>
#include <data/dictionary.h>
#include <language/lexer/lexer.h>
#include "psppire-data-store.h"
#include <output/manager.h>
-#include "output-viewer.h"
+#include "psppire-output-window.h"
#include "xalloc.h"
}
msg_disable ();
- ok = data_in (ss_cstr (text), LEGACY_NATIVE, format.type, 0, 0,
+ ok = data_in (ss_cstr (text), LEGACY_NATIVE, format.type, 0, 0, 0,
v, fmt_var_width (&format));
msg_enable ();
static void
give_help (void)
{
- static struct msg m = {
- MSG_GENERAL,
- MSG_NOTE,
- {0, -1},
- 0,
- };
-
- if (! m.text)
- m.text=g_strdup (_("Sorry. The help system hasn't yet been implemented."));
-
- popup_message (&m);
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_INFO,
+ GTK_BUTTONS_CLOSE,
+ _("Sorry. The help system hasn't yet "
+ "been implemented."));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
}
void
GList *i;
for ( i = g_list_first (helps); i ; i = g_list_next (i))
g_signal_connect (GTK_WIDGET (i->data), "clicked", give_help, 0);
+
+ g_list_free (helps);
}
reader = proc_extract_active_file_data (the_dataset);
if (!lazy_casereader_destroy (reader, lazy_serial))
- psppire_data_store_set_case_file (the_data_store,
- psppire_case_file_new (reader));
+ psppire_data_store_set_reader (the_data_store, reader);
som_flush ();
- reload_the_viewer ();
+ psppire_output_window_reload ();
return retval;
}
-#ifdef G_ENABLE_DEBUG
-# define g_marshal_value_peek_int(v) g_value_get_int (v)
-#else
-# define g_marshal_value_peek_int(v) (v)->data[0].v_int
-#endif
+/* Create a deep copy of SRC */
+GtkListStore *
+clone_list_store (const GtkListStore *src)
+{
+ GtkTreeIter src_iter;
+ gboolean ok;
+ gint i;
+ const gint n_cols = gtk_tree_model_get_n_columns (GTK_TREE_MODEL (src));
+ GType *types = g_malloc (sizeof (*types) * n_cols);
+ int row = 0;
+ GtkListStore *dest;
-/* VOID:INT,INT,INT */
-void
-marshaller_VOID__INT_INT_INT (GClosure *closure,
- GValue *return_value,
- guint n_param_values,
- const GValue *param_values,
- gpointer invocation_hint,
- gpointer marshal_data)
-{
- typedef void (*GMarshalFunc_VOID__INT_INT_INT) (gpointer data1,
- gint arg_1,
- gint arg_2,
- gint arg_3,
- gpointer data2);
- register GMarshalFunc_VOID__INT_INT_INT callback;
- register GCClosure *cc = (GCClosure*) closure;
- register gpointer data1, data2;
-
- g_return_if_fail (n_param_values == 4);
-
- if (G_CCLOSURE_SWAP_DATA (closure))
- {
- data1 = closure->data;
- data2 = g_value_peek_pointer (param_values + 0);
- }
- else
+ for (i = 0 ; i < n_cols; ++i )
+ types[i] = gtk_tree_model_get_column_type (GTK_TREE_MODEL (src), i);
+
+ dest = gtk_list_store_newv (n_cols, types);
+
+ for (ok = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (src),
+ &src_iter);
+ ok;
+ ok = gtk_tree_model_iter_next (GTK_TREE_MODEL (src), &src_iter))
{
- data1 = g_value_peek_pointer (param_values + 0);
- data2 = closure->data;
+ GtkTreeIter dest_iter;
+ gtk_list_store_append (dest, &dest_iter);
+
+ for (i = 0 ; i < n_cols; ++i )
+ {
+ GValue val = {0};
+
+ gtk_tree_model_get_value (GTK_TREE_MODEL (src), &src_iter, i, &val);
+ gtk_list_store_set_value (dest, &dest_iter, i, &val);
+
+ g_value_unset (&val);
+ }
+ row++;
}
- callback = (GMarshalFunc_VOID__INT_INT_INT) (marshal_data ? marshal_data : cc->callback);
- callback (data1,
- g_marshal_value_peek_int (param_values + 1),
- g_marshal_value_peek_int (param_values + 2),
- g_marshal_value_peek_int (param_values + 3),
- data2);
+ g_free (types);
+
+ return dest;
+}
+
+
+
+
+void
+paste_syntax_in_new_window (const gchar *syntax)
+{
+ GtkWidget *se = psppire_syntax_window_new ();
+
+ gtk_text_buffer_insert_at_cursor (PSPPIRE_SYNTAX_WINDOW (se)->buffer, syntax, -1);
+
+ gtk_widget_show (se);
}