projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
work on docs
[pspp]
/
src
/
ui
/
gui
/
spreadsheet-test.c
diff --git
a/src/ui/gui/spreadsheet-test.c
b/src/ui/gui/spreadsheet-test.c
index 2f1680409ac45e2789b1c8c801eeccb26c1839fc..dfdd95c0ae8e119a5127c1c11e22131a9fa1f264 100644
(file)
--- a/
src/ui/gui/spreadsheet-test.c
+++ b/
src/ui/gui/spreadsheet-test.c
@@
-1,5
+1,5
@@
/* PSPPIRE - a graphical user interface for PSPP.
/* PSPPIRE - a graphical user interface for PSPP.
- Copyright (C) 2013 Free Software Foundation
+ Copyright (C) 2013
, 2014
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
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
@@
-19,6
+19,7
@@
#include <config.h>
#include <config.h>
+#include <float.h>
#include <gtk/gtk.h>
#include "psppire-spreadsheet-model.h"
#include <gtk/gtk.h>
#include "psppire-spreadsheet-model.h"
@@
-28,7
+29,10
@@
#include "data/spreadsheet-reader.h"
#include "data/casereader.h"
#include "data/case.h"
#include "data/spreadsheet-reader.h"
#include "data/casereader.h"
#include "data/case.h"
+#include "data/settings.h"
#include "libpspp/message.h"
#include "libpspp/message.h"
+#include "libpspp/i18n.h"
+
#include "gl/xalloc.h"
#include "gl/xalloc.h"
@@
-65,7
+69,7
@@
on_clicked (GtkButton *button, struct xxx *stuff)
proto = casereader_get_proto (reader);
nvals = caseproto_get_n_widths (proto);
proto = casereader_get_proto (reader);
nvals = caseproto_get_n_widths (proto);
-
+
for (; (c = casereader_read (reader)) != NULL; case_unref (c))
{
int i;
for (; (c = casereader_read (reader)) != NULL; case_unref (c))
{
int i;
@@
-75,12
+79,12
@@
on_clicked (GtkButton *button, struct xxx *stuff)
const int width = caseproto_get_width (proto, i);
const union value *val = case_data_idx (c, i);
if (0 == width)
const int width = caseproto_get_width (proto, i);
const union value *val = case_data_idx (c, i);
if (0 == width)
- printf ("%
g "
, val->f);
+ printf ("%
.*g ", DBL_DIG + 1
, val->f);
else
{
char *ss = xzalloc (width + 1);
else
{
char *ss = xzalloc (width + 1);
- memcpy (ss, val
ue_str (val, width)
, width);
-
+ memcpy (ss, val
->s
, width);
+
printf ("%s ", ss);
free (ss);
}
printf ("%s ", ss);
free (ss);
}
@@
-91,7
+95,7
@@
on_clicked (GtkButton *button, struct xxx *stuff)
casereader_destroy (reader);
}
casereader_destroy (reader);
}
-static void
+static void
print_msg (const struct msg *m, void *aux UNUSED)
{
fprintf (stderr, "%s\n", m->text);
print_msg (const struct msg *m, void *aux UNUSED)
{
fprintf (stderr, "%s\n", m->text);
@@
-99,7
+103,7
@@
print_msg (const struct msg *m, void *aux UNUSED)
int
int
-main (int argc, char *argv[]
)
+main (int argc, char *argv[])
{
GtkWidget *window;
GtkWidget *hbox;
{
GtkWidget *window;
GtkWidget *hbox;
@@
-110,12
+114,15
@@
main (int argc, char *argv[] )
GtkWidget *button;
struct xxx stuff;
GtkWidget *button;
struct xxx stuff;
+ i18n_init ();
+ settings_init ();
+
gtk_init (&argc, &argv);
gtk_init (&argc, &argv);
-
- if (
argc < 2)
+
+ if (argc < 2)
g_error ("Usage: prog file\n");
g_error ("Usage: prog file\n");
- msg_set_handler (
print_msg, 0
);
+ msg_set_handler (
&(struct msg_handler) { .output_msg = print_msg }
);
stuff.sp = NULL;
stuff.sp = NULL;
@@
-124,7
+131,7
@@
main (int argc, char *argv[] )
if (stuff.sp == NULL)
stuff.sp = ods_probe (argv[1], false);
if (stuff.sp == NULL)
stuff.sp = ods_probe (argv[1], false);
-
+
if (stuff.sp == NULL)
{
g_error ("%s is neither a gnumeric nor a ods file\n", argv[1]);
if (stuff.sp == NULL)
{
g_error ("%s is neither a gnumeric nor a ods file\n", argv[1]);
@@
-133,14
+140,14
@@
main (int argc, char *argv[] )
tm = psppire_spreadsheet_model_new (stuff.sp);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
tm = psppire_spreadsheet_model_new (stuff.sp);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- hbox = gtk_
hbox_new (FALSE
, 5);
- vbox = gtk_
vbox_new (FALSE
, 5);
+ hbox = gtk_
box_new (GTK_ORIENTATION_HORIZONTAL
, 5);
+ vbox = gtk_
box_new (GTK_ORIENTATION_VERTICAL
, 5);
button = gtk_button_new_with_label ("Test reader");
g_signal_connect (button, "clicked", G_CALLBACK (on_clicked), &stuff);
button = gtk_button_new_with_label ("Test reader");
g_signal_connect (button, "clicked", G_CALLBACK (on_clicked), &stuff);
-
+
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
gtk_container_set_border_width (GTK_CONTAINER (window), 10);
-
+
stuff.combo_box = gtk_combo_box_new();
{
stuff.combo_box = gtk_combo_box_new();
{
@@
-185,7
+192,7
@@
main (int argc, char *argv[] )
gtk_main ();
gtk_main ();
- spreadsheet_
destroy
(stuff.sp);
+ spreadsheet_
unref
(stuff.sp);
return 0;
}
return 0;
}