/* hf_wrapper.h - headers for the height field wrapper class * * Copyright (C) 2001, 2006 Patrice St-Gelais * patrstg@users.sourceforge.net * http://geomorph.sourceforge.net * * 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 * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _HF_WRAPPER #define _HF_WRAPPER 1 #include #include "globals.h" #include "hf.h" #include "fourier.h" #include "gl_preview.h" #include "dialog_utilities.h" #include "hf_dialog_options.h" // HF types: pen (for painting) or main (background) #ifndef HFPEN #define HFPEN 1 #endif #ifndef HFMAIN #define HFMAIN 2 #endif // This one is for progressive surface addition #ifndef HFPRIMITIVE #define HFPRIMITIVE 3 #endif // For adding noise by merging a simple subdivision with another HF #ifndef HFNOISE #define HFNOISE 4 #endif // Scale labels #define SCALE_12_5 "12,5" #define SCALE_25 "25" #define SCALE_50 "50" #define SCALE_100 "100" #define SCALE_200 "200" #define SCALE_400 "400" #ifndef SCALE_PAD #define SCALE_PAD 25 #endif typedef struct { gchar **filename; // Inherited from the embedding document structure // Needed for manipulating list of opened HF gchar **dirname; // Inherited from the embedding document structure GtkWidget *window; // HF main window GtkWidget *area; GtkWidget *scrolled_window; // Scrolled window for the image guint exp_handler; // Connect handler to "area" expose event gint area_size; // Size of area (supposed to be square, avoid calculation) gl_preview_struct *gl_preview; control_line_struct *control_line; GtkWidget *creation_container; // Where we put the hf options during creation // Inherited from the doc_type_struct GtkWidget *tiling_wdg; // A checkbox connected to hf_struct->if_tiles gint type; // HFPEN, HFMAIN, HFPRIMITIVE hf_struct_type *hf_struct; // Contains the hf data hf_options_struct *hf_options; // Redundancy of optional parts of the creation dialog // The original is in doc_type_struct as a gpointer gboolean mouse_dragging; // Used for mouse tracking GtkWidget *mouse_position; // A label containing (mousex,mousey) gboolean creation_mode; // TRUE if creation not commited gboolean if_calculated; // For managing recomputing from options gboolean apply_filter; // TRUE: we must apply the current filter gboolean *if_modified; // "Bucket" inherited from the document wrapper // in the calling application structure. // Set to TRUE after any update gboolean *to_register_in_history; // Flag used by the calling app for managing // the undo-redo stack; // must be set to TRUE after any significant update void (*init_history_flag) (GtkWidget *, gboolean *); // Function which inits the preceding flag gchar *last_action; // Last modif, info for undo / redo stack gint display_scale; // Output of a widget controlling display scale // Transmitted (inherited to) hf_struct GSList *scale_group; // List of scale buttons (widgets) GtkWidget *draw_area_frame; // Frame containing the HF pixmap gpointer all_docs; // Structure inherited from the calling application, // containing all the open documents gchar *doc_type; // Name of the current document type, // inherited from the calling application GList *(*get_doc_list_from_type) (gpointer all_docs, gchar* doc_type); // Extracts all the documents of the current type, // for building menus, etc. Inherited. gboolean size_change_request; // For managing expose and configure events // after a size change request fourier_struct *fourier_dialog; } hf_wrapper_struct; gpointer hf_wrapper_new ( gchar **dirname, gchar **filename, GtkWidget *window, GtkWidget *creation_dialog, gpointer callback_data, gboolean *if_modified, gboolean *to_register_in_history, void (*init_history_flag) (GtkWidget *, gboolean*), gchar *path_n_file, gboolean *fname_tochoose, gchar *doc_type, gpointer all_docs, GList *(*get_doc_list_from_type) (gpointer all_docs, gchar *doc_type)); void hf_wrapper_free(gpointer, gboolean); gpointer hf_wrapper_copy(gpointer hfw_from, gpointer hfw_to); void hf_wrapper_display(gpointer hfw_struct); void draw_hf (hf_wrapper_struct *) ; void draw_hf_partial (hf_wrapper_struct *hfw, gint from_x, gint to_x, gint from_y, gint to_y, gboolean update_gl_area) ; void gener_hf (hf_wrapper_struct *hfw); gchar* hf_get_last_action (gpointer); gint hf_default_size(); void hf_wrapper_save (gpointer data, gchar *path_n_file); void hf_stats (gpointer hf_wrapper); GtkWidget * hf_get_icon (gpointer hfw, gint size_x, gint size_y); void set_widget_display_scale (hf_wrapper_struct *hfw); void set_watch_cursor (hf_wrapper_struct *hfw); void unset_watch_cursor (hf_wrapper_struct *hfw); // Undo / redo stack management // Should it be a distinct class in the future? void record_action(hf_wrapper_struct *, gchar *action); void begin_pending_record(hf_wrapper_struct *, gchar *action, gpointer commit_fn, gpointer reset_fn); void commit_pending_record(hf_wrapper_struct *); void accept_fn (hf_wrapper_struct *hfw); void reset_fn (hf_wrapper_struct *hfw); void accept_fault_fn (hf_wrapper_struct *hfw); // Misc (eventually check consistency!) void set_frq_vector(hf_wrapper_struct *hfw,gint *frq, gint nbrfrq); // For setting frequencies in subdiv2 #endif