Fixed broken data sheet for very long strings.
Fixed broken makefile dependency.
+Thu May 4 17:55:48 WST 2006 John Darrington <john@darrington.wattle.id.au>
+
+ * gtksheet.c: Added callback on inserted rows.
+
+Sat Jan 28 08:48:08 2006 UTC John Darrington <john@darrington.wattle.id.au>
+
* Separated the data out of the GtkSheet. The gtksheet should now be
regarded as a way of looking into the data. The data is represented by a
GSheetModel and the rows and columns by GSheetRow and GSheetColumn.
}
+/* Callback which occurs whenever rows are inserted/deleted in the model */
static void
-rows_deleted_callback (GSheetModel *m, gint first_row, gint n_rows,
+rows_inserted_deleted_callback (GSheetModel *m, gint first_row, gint n_rows,
gpointer data)
{
GtkSheet *sheet = GTK_SHEET(data);
GtkSheetRange range;
+ /* Need to update all the rows starting from the first row and onwards.
+ * Previous rows are unchanged, so don't need to be updated.
+ */
range.row0 = first_row;
range.col0 = 0;
range.rowi = yyy_row_count(sheet) - 1;
g_signal_connect(model, "range_changed",
G_CALLBACK(range_update_callback), sheet);
+ g_signal_connect(model, "rows_inserted",
+ G_CALLBACK(rows_inserted_deleted_callback), sheet);
+
g_signal_connect(model, "rows_deleted",
- G_CALLBACK(rows_deleted_callback), sheet);
+ G_CALLBACK(rows_inserted_deleted_callback), sheet);
}
g_return_if_fail (GTK_IS_SHEET (sheet));
if (column >= xxx_column_count(sheet) || column < 0) return;
- g_print("%s:%d Iterating rows\n",__FILE__, __LINE__);
for (row = 0; row < yyy_row_count(sheet); row++){
const gchar *text = gtk_sheet_cell_get_text(sheet, row, column);
if (text && strlen(text) > 0){
#endif
gtk_sheet_draw_backing_pixmap(sheet, sheet->range);
gtk_sheet_draw_border(sheet, sheet->range);
-
}
+Thu May 4 18:01:37 WST 2006 John Darrington <john@darrington.wattle.id.au>
+
+ * message.c message.h: Added functions to create and copy a msg.
+
Tue May 2 15:41:50 2006 Ben Pfaff <blp@gnu.org>
* str.c (ds_append_uninit): No need to add 1 to arg passed to
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <libpspp/alloc.h>
#include <libpspp/version.h>
{
}
+
+/* Duplicate a message */
+struct msg *
+msg_dup(const struct msg *m)
+{
+ struct msg *new_msg = xmalloc (sizeof *m);
+
+ *new_msg = *m;
+ new_msg->text = strdup(m->text);
+
+ return new_msg;
+}
+
+void
+msg_destroy(struct msg *m)
+{
+ free(m->text);
+ free(m);
+}
+
+
/* Emits M as an error message.
Frees allocated data in M. */
void
void msg_init (void (*handler) (const struct msg *));
void msg_done (void);
+struct msg * msg_dup(const struct msg *m);
+void msg_destroy(struct msg *m);
+
/* Emitting messages. */
void msg (enum msg_class, const char *format, ...)
PRINTF_FORMAT (2, 3);
+Thu May 4 18:04:04 WST 2006 John Darrington <john@darrington.wattle.id.au>
+
+ * message-dialog.c message-dialog.h: Added simple queuing to messages
+ reported, and ensure that dialog boxes dont appear when pointer grab
+ is active.
+
+ * psppire-data-store.c: Fix overflow on very long string variables.
+
+ * automake.mk: Fix broken dependency.
+
+
Tue Apr 25 11:08:04 2006 Ben Pfaff <blp@gnu.org>
Finish reforming error message support. In this phase, move
src_ui_gui_psppire_LDADD = \
$(GTK_LIBS) \
$(GLADE_LIBS) \
- -lgtksheet -L$(top_builddir)/lib/gtksheet \
- -ldata -L$(top_builddir)/src/data \
- -lpspp -L$(top_builddir)/src/libpspp \
- -lgl -L$(top_builddir)/gl \
- @LIBINTL@ @LIBREADLINE@
+ $(top_builddir)/lib/gtksheet/libgtksheet.a \
+ $(top_builddir)/src/data/libdata.a \
+ $(top_builddir)/src/libpspp/libpspp.a \
+ $(top_builddir)/gl/libgl.a \
+ @LIBINTL@ @LIBREADLINE@
src_ui_gui_psppiredir = $(pkgdatadir)
#include <gtk/gtk.h>
#include <glade/glade.h>
+#include <glib.h>
#include "helper.h"
#define _(A) A
static void handle_msg(const struct msg *);
+static void enqueue_msg(const struct msg *m);
+
+
+static GQueue *message_queue;
void
message_dialog_init (void)
{
- msg_init(handle_msg);
+ message_queue = g_queue_new();
+ msg_init(enqueue_msg);
+}
+
+
+void
+message_dialog_done (void)
+{
+ msg_done();
+ g_queue_free(message_queue);
+}
+
+static gboolean
+dequeue_message(gpointer data)
+{
+ struct msg * m ;
+
+ /* If a pointer grab is in effect, then the combination of that, and
+ a modal dialog box, will cause an impossible situation.
+ So don't pop it up just yet.
+ */
+ if ( gdk_pointer_is_grabbed())
+ return TRUE;
+
+ m = g_queue_pop_tail(message_queue);
+
+ if ( m )
+ {
+ handle_msg(m);
+ msg_destroy(m);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+enqueue_msg(const struct msg *msg)
+{
+ struct msg *m = msg_dup(msg);
+
+ g_queue_push_head(message_queue, m);
+
+ g_idle_add(dequeue_message, 0);
}
static void
#include <libpspp/message.h>
void message_dialog_init (void);
+void message_dialog_done (void);
#endif
static const gchar *const
psppire_data_store_get_string(GSheetModel *model, gint row, gint column)
{
+
const struct fmt_spec *fp ;
const struct PsppireVariable *pv ;
const union value *v ;
- static gchar s[255];
+ GString *s;
PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
g_return_val_if_fail(store->dict, NULL);
if ( row >= psppire_case_array_get_n_cases(store->cases))
return NULL;
+
pv = psppire_dict_get_variable(store->dict, column);
v = psppire_case_array_get_value(store->cases, row,
fp = psppire_variable_get_write_spec(pv);
- if ( psppire_variable_get_type(pv) == NUMERIC )
- {
- /* Converts binary value V into printable form in the exactly
- FP->W character in buffer S according to format specification
- FP. No null terminator is appended to the buffer. */
- data_out (s, fp, v);
- s[fp->w] = '\0';
- }
- else
- {
- const gint len = psppire_variable_get_width(pv);
- memcpy(s, v->s, len);
- s[len] = '\0';
- }
+ s = g_string_sized_new (fp->w);
+
+ /* Converts binary value V into printable form in the exactly
+ FP->W character in buffer S according to format specification
+ FP. No null terminator is appended to the buffer. */
+ data_out (s->str, fp, v);
+ return g_string_free(s, FALSE);
+#if 0
{
static gchar buf[255];
GError *err = NULL;
return buf ;
}
+#endif
}
/* FIXME: make this a member of the data store */
static PangoLayout *layout = 0;
-
gtk_sheet_get_attributes(sheet, row, col, &attributes);
if (! layout )
layout = gtk_widget_create_pango_layout (GTK_WIDGET(sheet), "M");
+
+ g_assert(layout);
pango_layout_set_font_description (layout,
attributes.font_desc);
GtkSheet *var_sheet ;
GtkSheet *data_sheet ;
+ gtk_init(&argc, &argv);
+
if ( ! parse_command_line(&argc, &argv) )
return 0;
- gtk_init(&argc, &argv);
glade_init();
/* start the event loop */
gtk_main();
+
+ message_dialog_done();
+
return 0;
}
g_print(legal);
return false;
default:
- assert (0);
+ return false;
}
}