1 /* hf_dialog_options.h - headers for the "melting pot" structure
2  * 		controlling the HF interface relationships
3  *		Needs some rework in the future for clarity sake
4  *		Separated from hf_wrapper.c/.h on 2006-01-02
5  *
6  * Copyright (C) 2001, 2006 Patrice St-Gelais
7  *         patrstg@users.sourceforge.net
8  *         http://geomorph.sourceforge.net
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23  */
24 
25 //	This file includes the prototypes for the dialog creation functions
26 //	for each HF subtypes
27 //	These functions are defined in other files than hf_dialog.c
28 
29 #ifndef _HF_DIALOG_OPTIONS
30 #define _HF_DIALOG_OPTIONS 1
31 
32 #include <gtk/gtk.h>
33 #include "globals.h"
34 #include "hf.h"
35 #include "hf_creation_dialog.h"
36 #include "hf_filters.h"
37 #include "hf_filters_dialog.h"
38 #include "subdiv1.h"
39 #include "subdiv2.h"
40 #include "uniform.h"
41 #include "surfadd.h"
42 #include "img_process_dialog.h"
43 #include "draw_tools_dialog.h"
44 #include "gl_preview.h"
45 #include "../fourier/fourier.h"
46 #include "../fourier/fourier_dialog.h"
47 #include "../app/stack.h"
48 
49 typedef struct {
50 
51 //	HF creation and HF tools options
52 
53 //	A few options inherited from the calling application
54 //	for building new widgets, for instance toolbars
55 
56 //	HF CREATION OPTIONS
57 
58 	hf_creation_wdg_struct *creation_widgets;
59 	GtkWidget *creation_container;
60 	GtkTooltips *tooltips;
61 	gpointer hfw_ptr_ptr;
62 	GtkWidget *current_dialog;	// Current creation subdialog
63 	gchar *last_creation_action;	// String describing the current creation dialog
64 						// It gives the last action performed on a new document,
65 						// recorded in the undo / redo stack
66 	gint hf_size;	// Result of the size widget, in the creation dialog
67 
68 //	Some generation algorithm - related options
69 	GtkWidget *uniform_dialog;
70 	hf_type *uniform_value;
71 	gboolean flag_uniform_done;  // True if the HF has been committed with the filter
72 				// Avoid recomputing the HF when drawing (faster!)
73 	GtkWidget *subdiv1_dialog;
74 	subdiv1_opt *subdiv1_options;
75 	GtkWidget *subdiv2_dialog;
76 	GtkObject *freq_subdiv2_adj[12];	// Adjustments for frequency control, from [0]=2 to [11]=4096
77 	gboolean subdiv2_direct_upd;
78 	subdiv2_opt *subdiv2_options;
79 //	gpointer subdiv2_options;
80 	GtkWidget *surfadd_dialog;
81 	surfadd_opt *surfadd_options;
82 	gpointer primit_surf;	// HF wrapper for primitive surface (SURFADD)
83 	GtkWidget *waves_dialog;
84 //	waves_opt *waves_options;
85 	gpointer waves_options;
86 	void (*current_callb) (GtkWidget *wdg, gpointer data);  // For executing default options
87 	gpointer current_options;	// Can be *uniform_value, subdiv1-2_options, sufadd_options....
88 	GtkObject *freq_control_adj[12];	// Adjustments for frequency control, from [0]=2 to [11]=4096
89 
90 	// (Re)calculates HF during the creation process
91 	// Varies with kind of HF algorithm
92 	gpointer (*current_calculation) (gpointer hf, gpointer options);
93 
94 //	Options shared by the whole HF dialog subsystem
95 
96 //	Shape filters defined once in the application
97 	dist_matrix_struct *dist_matrix;
98 	filter_struct *wide_filter;
99 	filter_struct *medium_filter1;
100 	filter_struct *medium_filter2;
101 	filter_struct *sharp_filter;
102 	filter_struct *gauss_filter;
103 	filter_struct *image_filter;
104 //	Filter dialog struct for creation (there is another one in ->img)
105 	filter_dialog_struct *creation_fd_struct;
106 //	Current filter struct we are processing (= ->creation_fd_struct or ->img->filter_dialog)
107 	filter_dialog_struct *fd_struct;
108 
109 //	List of open HF (required by the filter dialog, and maybe others in the future)
110 	GList *doc_list;
111 	render_struct *render_str; // Povray launch management
112 
113 	gdouble *gauss_list[GAUSS_LIST_LENGTH];	// Cache of normalized gaussian vectors, for drawing
114 	gl_defaults_struct *gl_defaults;	// For OpenGL preview display
115 
116 	stack_struct *stack;	// A pointer to an undo-redo structure initialized at the global application level
117 	gboolean need_tmp_buf;		// TRUE if we need to initialize hf_struct->tmp_buf after an undo
118 
119 // 	HF TOOLS OPTIONS
120 
121 	GtkWidget *tools_window;
122 	GtkWidget *tools_dialog;		// Where we put the tools dialog
123 					// Inherited from the doc_type struct
124 					// A vbox to which we can add / subtract widgets
125 	GtkWidget *current_tools;		// Current tools dialog, to show / hide
126 	gint context;			// Current context (dialog ID) - most important for drawing
127 
128 	draw_tools_struct *draw;
129 
130 	GdkCursor *current_cursor; // Current cursor for the document window (pen / arrow)
131 	GdkCursor *default_cursor;
132 	GdkCursor *pencil_cursor;
133 	GdkCursor *watch_cursor;
134 	GdkCursor *fleur_cursor;
135 	img_dialog_struct *img;		// Dialogs and structures for image transformations
136 	fourier_dialog_struct *fourier;
137 
138 	gpointer all_docs;		// Structure inherited from the calling application,
139 					// containing all the open documents
140 	gchar *doc_type;		// Name of the current document type,
141 					// inherited from the calling application
142 	GList *(*get_doc_list_from_type) (gpointer all_docs, gchar* doc_type);
143 					// Extracts all the documents of the current type,
144 } hf_options_struct;
145 
146 
147 /*****************************************************************************/
148 
149 gpointer hf_options_dialog_new (GtkWidget*,
150 	GtkWidget *,
151 	GtkTooltips*,
152 	gpointer widget_list,
153 	gpointer callback_data,
154 	stack_struct *stack,
155 	gchar *doc_type,
156 	gpointer all_docs,
157 	GList *(*get_doc_list_from_type) (gpointer all_docs, gchar *doc_type));
158 
159 void hf_options_dialog_free(gpointer);
160 
161 //	Specific processing after committing or resetting a change
162 //	To be fed to the global stack_struct
163 void hf_specific_commit_or_reset (stack_struct *);
164 
165 // Transitional function - 2010.12.05 - to be replaced by a "stack struct" function
166 void hf_commit_or_reset (hf_options_struct *hfo);
167 
168 void set_creation_container (hf_options_struct *hfo, GtkWidget *creation_container);
169 void hf_dialog_defaults (hf_options_struct *hfo);
170 
171 void gener_hf_from_ptr_ptr (gpointer hfw_ptr_ptr) ;
172 
173 #endif // _HF_DIALOG_OPTIONS
174