Replace more uses of 'cnt' by 'n'.
[pspp] / src / ui / gui / psppire-data-window.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2008, 2010, 2011, 2012, 2013, 2014, 2016  Free Software Foundation
3
4    This program is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
16
17
18 #ifndef __PSPPIRE_DATA_WINDOW_H__
19 #define __PSPPIRE_DATA_WINDOW_H__
20
21 /* PsppireDataWindow is a top-level window for editing a PSPP dataset.
22
23    PsppireDataWindow contains a PsppireDataEditor.
24
25    PsppireDataWindow's own functionality basically amounts to managing menus
26    and toolbars.  In addition to maintaining some menu itema and toolbar items
27    of its own, it merges in menu and toolbar items provided by its child
28    PsppireDataEditor (based on the "ui-manager" property of PsppireDataEditor).
29  */
30
31 #include <glib.h>
32 #include <glib-object.h>
33 #include <gtk/gtk.h>
34
35 #include "libpspp/ll.h"
36 #include "ui/gui/psppire-window.h"
37 #include "ui/gui/psppire-data-editor.h"
38
39 G_BEGIN_DECLS
40
41 #define PSPPIRE_DATA_WINDOW_TYPE            (psppire_data_window_get_type ())
42 #define PSPPIRE_DATA_WINDOW(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PSPPIRE_DATA_WINDOW_TYPE, PsppireDataWindow))
43 #define PSPPIRE_DATA_WINDOW_CLASS(class)    (G_TYPE_CHECK_CLASS_CAST ((class), \
44     PSPPIRE_DATA_WINDOW_TYPE, PsppireData_WindowClass))
45 #define PSPPIRE_IS_DATA_WINDOW(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
46     PSPPIRE_DATA_WINDOW_TYPE))
47 #define PSPPIRE_IS_DATA_WINDOW_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
48     PSPPIRE_DATA_WINDOW_TYPE))
49
50
51 typedef struct _PsppireDataWindow       PsppireDataWindow;
52 typedef struct _PsppireDataWindowClass  PsppireDataWindowClass;
53
54
55 enum PsppireDataWindowFormat {
56   PSPPIRE_DATA_WINDOW_SAV,
57   PSPPIRE_DATA_WINDOW_ZSAV,
58   PSPPIRE_DATA_WINDOW_POR
59 };
60
61 struct _PsppireDataWindow
62 {
63   PsppireWindow parent;
64
65   gboolean dispose_has_run;
66
67   /* <private> */
68   PsppireDataEditor *data_editor;
69   GtkBuilder *builder;
70
71   PsppireDict *dict;
72   struct dataset *dataset;
73   PsppireDataStore *data_store;
74
75   enum PsppireDataWindowFormat format;
76
77   struct ll ll;                 /* In global 'all_data_windows' list. */
78   unsigned long int lazy_serial;
79   unsigned int dataset_seqno;
80
81   GtkToolItem *ti_value_labels_button;
82
83   GtkToolItem *ti_jump_to_variable;
84   GtkToolItem *ti_insert_variable;
85   GtkToolItem *ti_jump_to_case;
86   GtkToolItem *ti_insert_case;
87   GtkToolItem *ti_find;
88
89   GtkWidget *mi_go_to_case;
90   GtkWidget *mi_insert_case;
91   GtkWidget *mi_find;
92   GtkWidget *mi_find_separator;
93   GtkWidget *mi_options;
94
95   GtkWidget *mi_edit_separator ;
96   GtkWidget *mi_cut;
97   GtkWidget *mi_copy;
98   GtkWidget *mi_paste;
99   GtkWidget *mi_clear_variables;
100   GtkWidget *mi_clear_cases;
101   GtkWidget *mi_insert_var;
102 };
103
104 struct _PsppireDataWindowClass
105 {
106   PsppireWindowClass parent_class;
107 };
108
109 extern struct session *the_session;
110 extern struct ll_list all_data_windows;
111
112 GType      psppire_data_window_get_type        (void);
113 GtkWidget* psppire_data_window_new             (struct dataset *);
114
115 PsppireDataWindow *psppire_default_data_window (void);
116 void psppire_data_window_set_default (PsppireDataWindow *);
117 void psppire_data_window_undefault (PsppireDataWindow *);
118
119 PsppireDataWindow *psppire_data_window_for_dataset (struct dataset *);
120 PsppireDataWindow *psppire_data_window_for_data_store (PsppireDataStore *);
121
122 bool psppire_data_window_is_empty (PsppireDataWindow *);
123 GtkWindow * create_data_window (void);
124 GtkWindow * open_data_window (PsppireWindow *victim, const char *file_name,
125                        const char *encoding, gpointer hint);
126
127 G_END_DECLS
128
129 #endif /* __PSPPIRE_DATA_WINDOW_H__ */