1 // Copyright (C) 2006 Erik Dahlberg
3 // This file is part of LSystem3D.
5 // LSystem3D is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // LSystem3D is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with LSystem3D; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 #include "lindenmayersystem.h"
30 #include "lsystemparameters.h"
31 #include "renderingsurface.h"
40 class GUI
: public FXMainWindow
42 // macro to set up class declaration
50 ID_GENERATE
= FXMainWindow::ID_LAST
,
62 * @param application the application object
63 * @param renderingSurface the rendering surface
64 * @param lsystem the Lindenmayer system generator
66 GUI(FXApp
*application
, RenderingSurface
*renderingSurface
, LindenmayerSystem
*lsystem
);
75 * Create and initialize the window
77 virtual void create();
81 * Called by the system when the "Generate" button is pressed
82 * @param sender the sender object
83 * @param selector message type and id
84 * @param data event related data
87 long onGenerate(FXObject
*sender
, FXSelector selector
, void *data
);
90 * Called by the system when the File->Load menu command is selected
91 * @param sender the sender object
92 * @param selector message type and id
93 * @param data event related data
96 long onLoad(FXObject
*sender
, FXSelector selector
, void *data
);
99 * Called by the system when the File->Save menu command is selected
100 * @param sender the sender object
101 * @param selector message type and id
102 * @param data event related data
105 long onSave(FXObject
*sender
, FXSelector selector
, void *data
);
108 * Called by the system when the close button or the File->Quit menu command is selected
109 * @param sender the sender object
110 * @param selector message type and id
111 * @param data event related data
114 long onQuit(FXObject
*sender
, FXSelector selector
, void *data
);
117 * Called by the system when the Help->Usage menu command is selected
118 * @param sender the sender object
119 * @param selector message type and id
120 * @param data event related data
123 long onHelpUsage(FXObject
*sender
, FXSelector selector
, void *data
);
126 * Called by the system when the Help->Rules menu command is selected
127 * @param sender the sender object
128 * @param selector message type and id
129 * @param data event related data
132 long onHelpRules(FXObject
*sender
, FXSelector selector
, void *data
);
143 * Load L-system from file and sync with GUI
144 * @param filename path of the L-system file
146 void loadLSystem(string filename
);
151 FXMenuPane
*_fileMenuPane
; // File menu
152 FXMenuPane
*_helpMenuPane
; // Help menu
154 FXTextField
*_axiomTextField
; // Axiom
155 FXText
*_rulesText
; // Rules
156 FXRealSpinner
*_angleRealSpinner
; // Angle
157 FXSpinner
*_depthSpinner
; // Depth
159 FXRealSpinner
*_diameterRealSpinner
; // Diameter
160 FXRealSpinner
*_diameterFactorRealSpinner
; // Diameter factor
162 FXMessageBox
*_helpUsageMessageBox
; // Usage help dialog
163 FXMessageBox
*_helpRulesMessageBox
; // Rules help dialog
166 LindenmayerSystem
*_lsystem
; // The Lindenmayer system generator
167 LSystemParameters _lsystemParameters
; // Saver and loader for L-system parameters
168 RenderingSurface
*_renderingSurface
; // The rendering surface