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 
78   GtkWidget *new_value_entry;
79 
80   GtkWidget *old_value_chooser;
81 
82   GtkListStore *value_map;
83 
84   GtkWidget *acr;
85 
86   gboolean input_var_is_string;
87 
88   GtkWidget *new_name_entry;
89   GtkWidget *new_label_entry;
90   GtkWidget *change_button;
91   GtkWidget *old_and_new;
92 
93   GtkWidget *output_variable_box;
94 
95   GtkWidget *string_button;
96   GtkWidget *width_entry;
97 };
98 
99 
100 struct _PsppireDialogActionRecodeClass
101 {
102   PsppireDialogActionClass parent_class;
103 
104   gboolean (*target_is_string) (const PsppireDialogActionRecode *);
105 };
106 
107 GType psppire_dialog_action_recode_get_type (void) ;
108 
109 void psppire_dialog_action_recode_refresh (PsppireDialogAction *);
110 
111 GtkBuilder * psppire_dialog_action_recode_pre_activate (PsppireDialogActionRecode *act,
112 							void (*populate_treeview) (PsppireDialogActionRecode *));
113 
114 
115 GType new_value_get_type (void);
116 
117 
118 char *psppire_dialog_action_recode_generate_syntax (const PsppireDialogAction *act,
119 						    void (*add_string_decls) (const PsppireDialogActionRecode *, struct string *),
120 						    void (*add_into_clause) (const PsppireDialogActionRecode *, struct string *),
121 						    void (*add_new_value_labels) (const PsppireDialogActionRecode *, struct string *));
122 
123 G_END_DECLS
124 
125 #endif /* __PSPPIRE_DIALOG_ACTION_RECODE_H__ */
126