~librecad-dev/librecad/librecad

« back to all changes in this revision

Viewing changes to librecad/src/lib/gui/rs_dialogfactoryinterface.h

  • Committer: Scott Howard
  • Date: 2014-02-21 19:07:55 UTC
  • Revision ID: showard@debian.org-20140221190755-csjax9wb146hgdq4
first commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** This file is part of the LibreCAD project, a 2D CAD program
 
4
**
 
5
** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl)
 
6
** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
 
7
**
 
8
**
 
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.
 
13
**
 
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.
 
18
**
 
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
 
22
**
 
23
** This copyright notice MUST APPEAR in all copies of the script!
 
24
**
 
25
**********************************************************************/
 
26
 
 
27
 
 
28
#ifndef RS_DIALOGFACTORYINTERFACE_H
 
29
#define RS_DIALOGFACTORYINTERFACE_H
 
30
 
 
31
#include "rs.h"
 
32
 
 
33
class RS_ActionInterface;
 
34
class RS_ArcData;
 
35
class RS_AttributesData;
 
36
class RS_BevelData;
 
37
class RS_Block;
 
38
class RS_BlockData;
 
39
class RS_BlockList;
 
40
class RS_CircleData;
 
41
class RS_DimLinearData;
 
42
class RS_DimensionData;
 
43
class RS_Document;
 
44
class RS_Entity;
 
45
class RS_EventHandler;
 
46
class RS_Graphic;
 
47
class RS_GraphicView;
 
48
class RS_Grid;
 
49
class RS_Hatch;
 
50
class RS_Insert;
 
51
class RS_Layer;
 
52
class RS_LayerList;
 
53
class RS_MirrorData;
 
54
class RS_MoveData;
 
55
class RS_MoveRotateData;
 
56
class RS_MText;
 
57
class RS_Painter;
 
58
class RS_Rotate2Data;
 
59
class RS_RotateData;
 
60
class RS_RoundData;
 
61
class RS_ScaleData;
 
62
class RS_Solid;
 
63
class RS_Text;
 
64
class RS_Vector;
 
65
class QG_CadToolBar;
 
66
 
 
67
/**
 
68
 * Interface for objects that can create and show dialogs.
 
69
 */
 
70
class RS_DialogFactoryInterface {
 
71
public:
 
72
    RS_DialogFactoryInterface() {}
 
73
    virtual ~RS_DialogFactoryInterface() {}
 
74
 
 
75
    /**
 
76
     * This virtual method must be overwritten and must show the previously
 
77
     * shown menu in the cad toolbar.
 
78
     */
 
79
    virtual void requestPreviousMenu() = 0;
 
80
 
 
81
    /**
 
82
     * This virtual method must be overwritten and must provide
 
83
     * a message dialog.
 
84
     */
 
85
    virtual void requestWarningDialog(const QString& warning) = 0;
 
86
 
 
87
        /**
 
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
 
90
         * is given.
 
91
         */
 
92
    virtual RS_GraphicView* requestNewDocument(const QString& fileName = QString::null,
 
93
                        RS_Document* doc=NULL) = 0;
 
94
 
 
95
    /**
 
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.
 
100
     *
 
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.
 
104
     */
 
105
    virtual RS_Layer* requestNewLayerDialog(
 
106
        RS_LayerList* layerList = NULL) = 0;
 
107
 
 
108
    /**
 
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.
 
113
     *
 
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.
 
117
     */
 
118
    virtual RS_Layer* requestLayerRemovalDialog(
 
119
        RS_LayerList* layerList = NULL) = 0;
 
120
 
 
121
    /**
 
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.
 
125
     *
 
126
     * @return The implementation is expected to return a pointer
 
127
     *         to the modified layer or NULL if the user
 
128
     *         cancels the dialog.
 
129
     */
 
130
    virtual RS_Layer* requestEditLayerDialog(
 
131
        RS_LayerList* layerList = NULL) = 0;
 
132
 
 
133
    /**
 
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.
 
138
    *
 
139
    * @param block Pointer to the newly created block with default
 
140
    *              attributes.
 
141
     *
 
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.
 
145
     */
 
146
    virtual RS_BlockData requestNewBlockDialog(RS_BlockList* blockList) = 0;
 
147
 
 
148
    /**
 
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.
 
153
     *
 
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.
 
157
     */
 
158
    virtual RS_Block* requestBlockRemovalDialog(
 
159
        RS_BlockList* blockList) = 0;
 
160
 
 
161
    /**
 
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.
 
165
     *
 
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.
 
169
     */
 
170
    virtual RS_BlockData requestBlockAttributesDialog(
 
171
        RS_BlockList* blockList) = 0;
 
172
 
 
173
    /**
 
174
     * This virtual method must be overwritten and should provide
 
175
     * a way to edit a block.
 
176
     */
 
177
    virtual void requestEditBlockWindow(
 
178
        RS_BlockList* blockList) = 0;
 
179
 
 
180
        virtual void closeEditBlockWindow(RS_Block* block) = 0;
 
181
 
 
182
    /**
 
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.
 
186
     *
 
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.
 
190
     */
 
191
    //virtual QString requestFileSaveAsDialog() = 0;
 
192
 
 
193
    /**
 
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.
 
197
     *
 
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.
 
201
     */
 
202
    //virtual QString requestFileOpenDialog() = 0;
 
203
 
 
204
    /**
 
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.
 
208
     *
 
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.
 
212
     */
 
213
    virtual QString requestImageOpenDialog() = 0;
 
214
 
 
215
    /**
 
216
     * This virtual method must be overwritten and must present
 
217
     * a widget for options for the given action.
 
218
     *
 
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.
 
223
     */
 
224
    virtual void requestOptions(RS_ActionInterface* action,
 
225
                bool on, bool update = false) = 0;
 
226
 
 
227
    /**
 
228
     * This virtual method must be overwritten and must present
 
229
     * a widget for snap point with distance options.
 
230
     *
 
231
     * @param dist Distance which can be directly changed
 
232
     *             by the presented widget.
 
233
     * @param on true: switch widget on, false: off
 
234
     */
 
235
    virtual void requestSnapDistOptions(double& dist, bool on) = 0;
 
236
    virtual void requestSnapMiddleOptions(int& middlePoints, bool on) = 0;
 
237
    /**
 
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
 
242
      */
 
243
    virtual void requestModifyOffsetOptions(double& dist, bool on) = 0;
 
244
 
 
245
    /**
 
246
     * This virtual method must be overwritten and must present
 
247
     * a widget for entity attributes.
 
248
     *
 
249
     * @param data Attribute data which can be directly changed
 
250
     *             by the presented widget.
 
251
     */
 
252
    virtual bool requestAttributesDialog(RS_AttributesData& data,
 
253
                RS_LayerList& layerList) = 0;
 
254
 
 
255
    /**
 
256
     * This virtual method must be overwritten and must present
 
257
     * a widget for move options (number of copies).
 
258
     *
 
259
     * @param data Move data which can be directly changed
 
260
     *             by the presented widget.
 
261
     */
 
262
    virtual bool requestMoveDialog(RS_MoveData& data) = 0;
 
263
 
 
264
    /**
 
265
     * This virtual method must be overwritten and must present
 
266
     * a widget for rotate options (number of copies, angle).
 
267
     *
 
268
     * @param data Rotation data which can be directly changed
 
269
     *             by the presented widget.
 
270
     */
 
271
    virtual bool requestRotateDialog(RS_RotateData& data) = 0;
 
272
 
 
273
    /**
 
274
     * This virtual method must be overwritten and must present
 
275
     * a widget for rotate options (number of copies, angle).
 
276
     *
 
277
     * @param data Scaling data which can be directly changed
 
278
     *             by the presented widget.
 
279
     */
 
280
    virtual bool requestScaleDialog(RS_ScaleData& data) = 0;
 
281
 
 
282
    /**
 
283
     * This virtual method must be overwritten and must present
 
284
     * a widget for mirror options (number of copies).
 
285
     *
 
286
     * @param data Mirror data which can be directly changed
 
287
     *             by the presented widget.
 
288
     */
 
289
    virtual bool requestMirrorDialog(RS_MirrorData& data) = 0;
 
290
 
 
291
    /**
 
292
     * This virtual method must be overwritten and must present
 
293
     * a widget for move/rotate options (number of copies, angle).
 
294
     *
 
295
     * @param data Move/rotate data which can be directly changed
 
296
     *             by the presented widget.
 
297
     */
 
298
    virtual bool requestMoveRotateDialog(RS_MoveRotateData& data) = 0;
 
299
 
 
300
    /**
 
301
     * This virtual method must be overwritten and must present
 
302
     * a widget for rotate around two centers options (number of
 
303
    * copies, angles).
 
304
     *
 
305
     * @param data Rotate data which can be directly changed
 
306
     *             by the presented widget.
 
307
     */
 
308
    virtual bool requestRotate2Dialog(RS_Rotate2Data& data) = 0;
 
309
 
 
310
    /**
 
311
     * This virtual method must be overwritten and must show
 
312
     * the given toolbar.
 
313
     *
 
314
     * @param id Tool bar ID.
 
315
     */
 
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;
 
320
 
 
321
    /**
 
322
     * This virtual method must be overwritten and must show
 
323
     * the tag toolbar with a button for launching the given
 
324
     * action.
 
325
     *
 
326
     * @param nextAction ID of next action to create after selecting was done.
 
327
     */
 
328
    virtual void requestToolBarSelect(RS_ActionInterface* selectAction,
 
329
                                      RS2::ActionType nextAction) = 0;
 
330
 
 
331
    /**
 
332
     * This virtual method must be overwritten and must present
 
333
     * a dialog to edit the given entity.
 
334
     *
 
335
     * @param entity Pointer to the entity.
 
336
     */
 
337
    virtual bool requestModifyEntityDialog(RS_Entity* entity) = 0;
 
338
 
 
339
    /**
 
340
     * This virtual method must be overwritten and must present
 
341
     * a dialog to edit multi-line text entity attributes.
 
342
     *
 
343
     * @param entity Pointer to the mtext entity.
 
344
     */
 
345
    virtual bool requestMTextDialog(RS_MText* text) = 0;
 
346
 
 
347
    /**
 
348
     * This virtual method must be overwritten and must present
 
349
     * a dialog to edit text entity attributes.
 
350
     *
 
351
     * @param entity Pointer to the text entity.
 
352
     */
 
353
    virtual bool requestTextDialog(RS_Text* text) = 0;
 
354
 
 
355
    /**
 
356
     * This virtual method must be overwritten and must present
 
357
     * a dialog to select pattern attributes.
 
358
     *
 
359
     * @param entity Pointer to the hatch entity.
 
360
     */
 
361
    virtual bool requestHatchDialog(RS_Hatch* hatch) = 0;
 
362
 
 
363
    /**
 
364
     * This virtual method must be overwritten and must present
 
365
     * a dialog for general application options.
 
366
     */
 
367
    virtual void requestOptionsGeneralDialog() = 0;
 
368
 
 
369
    /**
 
370
     * This virtual method must be overwritten and must present
 
371
     * a dialog for drawing options.
 
372
         *
 
373
         * @param graphic Graphic document.
 
374
     */
 
375
    virtual void requestOptionsDrawingDialog(RS_Graphic& graphic) = 0;
 
376
 
 
377
    /**
 
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
 
381
     * changes.
 
382
     *
 
383
     * @param abs Absolute coordiante of the mouse cursor or the
 
384
     *            point it snaps to.
 
385
     * @param rel Relative coordiante.
 
386
     */
 
387
    virtual void updateCoordinateWidget(const RS_Vector& abs, const RS_Vector& rel, bool updateFormat=false) = 0;
 
388
 
 
389
    /**
 
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.
 
394
     *
 
395
     * @param left Help text for the left mouse button.
 
396
     * @param right Help text for the right mouse button.
 
397
     */
 
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;
 
403
 
 
404
    /**
 
405
     * This virtual method must be overwritten if the graphic view has
 
406
     * a component that is interested in the current number of selected
 
407
         * entities.
 
408
     * The implementation will be called every time the selection
 
409
     * changes.
 
410
     *
 
411
     * @param num Number of selected entities
 
412
     */
 
413
    virtual void updateSelectionWidget(int num, double length) = 0;
 
414
 
 
415
    /**
 
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.
 
421
     *
 
422
     * @param message The message for the user.
 
423
     */
 
424
    virtual void commandMessage(const QString& message) = 0;
 
425
 
 
426
 
 
427
        virtual bool isAdapter() = 0;
 
428
 
 
429
};
 
430
 
 
431
#endif