1
/****************************************************************************
3
** This file is part of the LibreCAD project, a 2D CAD program
5
** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl)
6
** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
9
** This file may be distributed and/or modified under the terms of the
10
** GNU General Public License version 2 as published by the Free Software
11
** Foundation and appearing in the file gpl-2.0.txt included in the
12
** packaging of this file.
14
** This program is distributed in the hope that it will be useful,
15
** but WITHOUT ANY WARRANTY; without even the implied warranty of
16
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
** GNU General Public License for more details.
19
** You should have received a copy of the GNU General Public License
20
** along with this program; if not, write to the Free Software
21
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
** This copyright notice MUST APPEAR in all copies of the script!
25
**********************************************************************/
28
#ifndef RS_DIALOGFACTORYINTERFACE_H
29
#define RS_DIALOGFACTORYINTERFACE_H
33
class RS_ActionInterface;
35
class RS_AttributesData;
41
class RS_DimLinearData;
42
class RS_DimensionData;
45
class RS_EventHandler;
55
class RS_MoveRotateData;
68
* Interface for objects that can create and show dialogs.
70
class RS_DialogFactoryInterface {
72
RS_DialogFactoryInterface() {}
73
virtual ~RS_DialogFactoryInterface() {}
76
* This virtual method must be overwritten and must show the previously
77
* shown menu in the cad toolbar.
79
virtual void requestPreviousMenu() = 0;
82
* This virtual method must be overwritten and must provide
85
virtual void requestWarningDialog(const QString& warning) = 0;
88
* This virtual method must be overwritten and must create a new
89
* window for the given document or for a new document isf no document
92
virtual RS_GraphicView* requestNewDocument(const QString& fileName = QString::null,
93
RS_Document* doc=NULL) = 0;
96
* This virtual method must be overwritten and must provide
97
* a dialog for choosing the properties of a new layer to be
98
* created. The method must create the new layer but not add
99
* it to the layer list. The latter is up to the caller.
101
* @return The implementation is expected to return a pointer
102
* to the newly created layer or NULL if the user
103
* cancels the dialog.
105
virtual RS_Layer* requestNewLayerDialog(
106
RS_LayerList* layerList = NULL) = 0;
109
* This virtual method must be overwritten and must provide
110
* a dialog that asks for permission for removing the selected
111
* layer from the layer list. The method must not actually
112
* remove the layer. This is up to the caller.
114
* @return The implementation is expected to return a pointer
115
* to the layer which can ne removed or NULL if the user
116
* cancels the dialog.
118
virtual RS_Layer* requestLayerRemovalDialog(
119
RS_LayerList* layerList = NULL) = 0;
122
* This virtual method must be overwritten and must provide
123
* a dialog to edit the layers attributes. The method must
124
* not actually edit the layer. This is up to the caller.
126
* @return The implementation is expected to return a pointer
127
* to the modified layer or NULL if the user
128
* cancels the dialog.
130
virtual RS_Layer* requestEditLayerDialog(
131
RS_LayerList* layerList = NULL) = 0;
134
* This virtual method must be overwritten and must provide
135
* a dialog for choosing the properties of a new block to be
136
* created. The method must create the new block but not add
137
* it to the block list. The latter is up to the caller.
139
* @param block Pointer to the newly created block with default
142
* @return The implementation is expected to return a pointer
143
* to the newly created block or NULL if the user
144
* cancels the dialog.
146
virtual RS_BlockData requestNewBlockDialog(RS_BlockList* blockList) = 0;
149
* This virtual method must be overwritten and must provide
150
* a dialog that asks for permission for removing the selected
151
* block from the block list. The method must not actually
152
* remove the block. This is up to the caller.
154
* @return The implementation is expected to return a pointer
155
* to the block which can be removed or NULL if the user
156
* cancels the dialog.
158
virtual RS_Block* requestBlockRemovalDialog(
159
RS_BlockList* blockList) = 0;
162
* This virtual method must be overwritten and must provide
163
* a dialog that allows to change blocks attributes of the
164
* currently active block.
166
* @return The implementation is expected to return a pointer
167
* to the block which was changed or NULL if the user
168
* cancels the dialog.
170
virtual RS_BlockData requestBlockAttributesDialog(
171
RS_BlockList* blockList) = 0;
174
* This virtual method must be overwritten and should provide
175
* a way to edit a block.
177
virtual void requestEditBlockWindow(
178
RS_BlockList* blockList) = 0;
180
virtual void closeEditBlockWindow(RS_Block* block) = 0;
183
* This virtual method must be overwritten and must provide
184
* a dialog to get a filename for saving a file. The method must
185
* not actually save the file. This is up to the caller.
187
* @return The implementation is expected to return a string
188
* which contains the file name or an empty string if
189
* the user cancels the dialog.
191
//virtual QString requestFileSaveAsDialog() = 0;
194
* This virtual method must be overwritten and must provide
195
* a dialog to get a filename for opening a file. The method must
196
* not actually open the file. This is up to the caller.
198
* @return The implementation is expected to return a string
199
* which contains the file name or an empty string if
200
* the user cancels the dialog.
202
//virtual QString requestFileOpenDialog() = 0;
205
* This virtual method must be overwritten and must provide
206
* a dialog to get a filename for opening an image file. The method must
207
* not actually open the file. This is up to the caller.
209
* @return The implementation is expected to return a string
210
* which contains the file name or an empty string if
211
* the user cancels the dialog.
213
virtual QString requestImageOpenDialog() = 0;
216
* This virtual method must be overwritten and must present
217
* a widget for options for the given action.
219
* @param action Pointer to the action which needs the options.
220
* @param on true: switch widget on, false: off
221
* @param update true: widget gets data from the action, false:
222
* widget gets data from config file.
224
virtual void requestOptions(RS_ActionInterface* action,
225
bool on, bool update = false) = 0;
228
* This virtual method must be overwritten and must present
229
* a widget for snap point with distance options.
231
* @param dist Distance which can be directly changed
232
* by the presented widget.
233
* @param on true: switch widget on, false: off
235
virtual void requestSnapDistOptions(double& dist, bool on) = 0;
236
virtual void requestSnapMiddleOptions(int& middlePoints, bool on) = 0;
238
*This virtual method must overwritten and must present
239
* a widget for actionmodifyoffset distance
240
* @dist, distance of offset
241
* @on, to create the widget if true, and to delete the widget if false
243
virtual void requestModifyOffsetOptions(double& dist, bool on) = 0;
246
* This virtual method must be overwritten and must present
247
* a widget for entity attributes.
249
* @param data Attribute data which can be directly changed
250
* by the presented widget.
252
virtual bool requestAttributesDialog(RS_AttributesData& data,
253
RS_LayerList& layerList) = 0;
256
* This virtual method must be overwritten and must present
257
* a widget for move options (number of copies).
259
* @param data Move data which can be directly changed
260
* by the presented widget.
262
virtual bool requestMoveDialog(RS_MoveData& data) = 0;
265
* This virtual method must be overwritten and must present
266
* a widget for rotate options (number of copies, angle).
268
* @param data Rotation data which can be directly changed
269
* by the presented widget.
271
virtual bool requestRotateDialog(RS_RotateData& data) = 0;
274
* This virtual method must be overwritten and must present
275
* a widget for rotate options (number of copies, angle).
277
* @param data Scaling data which can be directly changed
278
* by the presented widget.
280
virtual bool requestScaleDialog(RS_ScaleData& data) = 0;
283
* This virtual method must be overwritten and must present
284
* a widget for mirror options (number of copies).
286
* @param data Mirror data which can be directly changed
287
* by the presented widget.
289
virtual bool requestMirrorDialog(RS_MirrorData& data) = 0;
292
* This virtual method must be overwritten and must present
293
* a widget for move/rotate options (number of copies, angle).
295
* @param data Move/rotate data which can be directly changed
296
* by the presented widget.
298
virtual bool requestMoveRotateDialog(RS_MoveRotateData& data) = 0;
301
* This virtual method must be overwritten and must present
302
* a widget for rotate around two centers options (number of
305
* @param data Rotate data which can be directly changed
306
* by the presented widget.
308
virtual bool requestRotate2Dialog(RS_Rotate2Data& data) = 0;
311
* This virtual method must be overwritten and must show
314
* @param id Tool bar ID.
316
virtual void requestToolBar(RS2::ToolBarId id) = 0;
317
virtual void requestPreviousToolBar() = 0;
318
virtual void resetToolBar() = 0;
319
virtual void showCadToolBar(RS2::ActionType actionType) = 0;
322
* This virtual method must be overwritten and must show
323
* the tag toolbar with a button for launching the given
326
* @param nextAction ID of next action to create after selecting was done.
328
virtual void requestToolBarSelect(RS_ActionInterface* selectAction,
329
RS2::ActionType nextAction) = 0;
332
* This virtual method must be overwritten and must present
333
* a dialog to edit the given entity.
335
* @param entity Pointer to the entity.
337
virtual bool requestModifyEntityDialog(RS_Entity* entity) = 0;
340
* This virtual method must be overwritten and must present
341
* a dialog to edit multi-line text entity attributes.
343
* @param entity Pointer to the mtext entity.
345
virtual bool requestMTextDialog(RS_MText* text) = 0;
348
* This virtual method must be overwritten and must present
349
* a dialog to edit text entity attributes.
351
* @param entity Pointer to the text entity.
353
virtual bool requestTextDialog(RS_Text* text) = 0;
356
* This virtual method must be overwritten and must present
357
* a dialog to select pattern attributes.
359
* @param entity Pointer to the hatch entity.
361
virtual bool requestHatchDialog(RS_Hatch* hatch) = 0;
364
* This virtual method must be overwritten and must present
365
* a dialog for general application options.
367
virtual void requestOptionsGeneralDialog() = 0;
370
* This virtual method must be overwritten and must present
371
* a dialog for drawing options.
373
* @param graphic Graphic document.
375
virtual void requestOptionsDrawingDialog(RS_Graphic& graphic) = 0;
378
* This virtual method must be overwritten if the graphic view has
379
* a component that is interested in the current mouse position.
380
* The implementation will be called every time the mouse position
383
* @param abs Absolute coordiante of the mouse cursor or the
385
* @param rel Relative coordiante.
387
virtual void updateCoordinateWidget(const RS_Vector& abs, const RS_Vector& rel, bool updateFormat=false) = 0;
390
* This virtual method must be overwritten if the graphic view has
391
* a component that is interested in the current mouse button hints.
392
* The implementation will be called typically by actions to inform
393
* the user about the current functionalty of the mouse buttons.
395
* @param left Help text for the left mouse button.
396
* @param right Help text for the right mouse button.
398
virtual void updateMouseWidget(const QString& left,
399
const QString& right,
400
bool keeping=true) = 0;
401
virtual void restoreMouseWidget(void)=0;
402
virtual void updateArcTangentialOptions(const double& d, bool byRadius)=0;
405
* This virtual method must be overwritten if the graphic view has
406
* a component that is interested in the current number of selected
408
* The implementation will be called every time the selection
411
* @param num Number of selected entities
413
virtual void updateSelectionWidget(int num, double length) = 0;
416
* This virtual method must be overwritten if the graphic view has
417
* a component that is interested in command messages (such as a
418
* command line history).
419
* The implementation will be called typically by actions to inform
420
* the user about current events and errors.
422
* @param message The message for the user.
424
virtual void commandMessage(const QString& message) = 0;
427
virtual bool isAdapter() = 0;