Recode Dialog: Convert to PsppireDialogAction
[pspp] / src / ui / gui / psppire-dialog-action-recode.h
1 /* PSPPIRE - a graphical user interface for PSPP.
2    Copyright (C) 2012  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 #include <glib-object.h>
19 #include <glib.h>
20
21 #include "psppire-dialog-action.h"
22
23 #ifndef __PSPPIRE_DIALOG_ACTION_RECODE_H__
24 #define __PSPPIRE_DIALOG_ACTION_RECODE_H__
25
26 G_BEGIN_DECLS
27
28 enum
29   {
30     BUTTON_NEW_VALUE,
31     BUTTON_NEW_COPY,
32     BUTTON_NEW_SYSMIS,
33     n_BUTTONS
34   };
35
36 #define PSPPIRE_TYPE_DIALOG_ACTION_RECODE (psppire_dialog_action_recode_get_type ())
37
38 #define PSPPIRE_DIALOG_ACTION_RECODE(obj)       \
39                      (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
40                                                   PSPPIRE_TYPE_DIALOG_ACTION_RECODE, PsppireDialogActionRecode))
41
42 #define PSPPIRE_DIALOG_ACTION_RECODE_CLASS(klass) \
43                      (G_TYPE_CHECK_CLASS_CAST ((klass), \
44                                  PSPPIRE_TYPE_DIALOG_ACTION_RECODE, \
45                                  PsppireDialogActionRecodeClass))
46
47
48 #define PSPPIRE_IS_DIALOG_ACTION_RECODE(obj) \
49                      (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PSPPIRE_TYPE_DIALOG_ACTION_RECODE))
50
51 #define PSPPIRE_IS_DIALOG_ACTION_RECODE_CLASS(klass) \
52                      (G_TYPE_CHECK_CLASS_TYPE ((klass), PSPPIRE_TYPE_DIALOG_ACTION_RECODE))
53
54
55 #define PSPPIRE_DIALOG_ACTION_RECODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
56                                    PSPPIRE_TYPE_DIALOG_ACTION_RECODE, \
57                                    PsppireDialogActionRecodeClass))
58
59 typedef struct _PsppireDialogActionRecode       PsppireDialogActionRecode;
60 typedef struct _PsppireDialogActionRecodeClass  PsppireDialogActionRecodeClass;
61
62
63 struct _PsppireDialogActionRecode
64 {
65   PsppireDialogAction parent;
66
67   PsppireDialog *old_and_new_dialog;
68
69   GtkWidget *dict_treeview;
70   GtkWidget *variable_treeview;
71   GtkWidget *toggle[n_BUTTONS];
72
73   GtkWidget *strings_box;
74   GtkWidget *convert_button;
75   GtkWidget *new_copy_label;
76
77   GtkWidget *new_value_entry;
78
79   GtkWidget *old_value_chooser;
80
81   GtkListStore *value_map;
82
83   /* Indicates that the INTO {new variables} form of the dialog
84      is being used */
85   gboolean different;
86
87   GtkWidget *acr;
88
89   gboolean input_var_is_string;
90
91   GtkWidget *new_name_entry;
92   GtkWidget *new_label_entry;
93   GtkWidget *change_button;
94
95   GtkWidget *string_button;
96   GtkWidget *width_entry;
97
98   /* A hash table of struct nlp's indexed by variable */
99   GHashTable *varmap;
100 };
101
102
103 struct _PsppireDialogActionRecodeClass
104 {
105   PsppireDialogActionClass parent_class;
106 };
107
108
109 GType psppire_dialog_action_recode_get_type (void) ;
110
111 G_END_DECLS
112
113 #endif /* __PSPPIRE_DIALOG_ACTION_RECODE_H__ */