1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
/*
* Copyright (c) 2003 Patrick Julien <[email protected]>
*
* 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CANVAS_SUBJECT_H_
#define KIS_CANVAS_SUBJECT_H_
#include "kis_types.h"
#include "kis_id.h"
class KisDoc;
class KisBrush;
class KisCanvasController;
class KisCanvasObserver;
class KisGradient;
class KisPattern;
class KisPaintOpFactory;
class KisToolControllerInterface;
class KisUndoAdapter;
class KisProgressDisplayInterface;
class KisSelectionManager;
class TQWidget;
class TQCursor;
class KisColor;
class KoPaletteManager;
class KisProfile;
class KisPaintOpSettings;
class KisPerspectiveGridManager;
/**
* KisCanvasSubject is part of the Observer pattern. Classes implementing KisCanvasObserver
* that have attached themselves to a class implementing this interface will be notified
* whenever any of the methods defined in this class will return something different.
*
* Historical notes: This class has grown a bit an now seems to be the abstract definition
* of the View part in the Model-View-Controller pattern. We need to fix this!
*/
class KisCanvasSubject {
public:
KisCanvasSubject() {};
virtual ~KisCanvasSubject() {};
public:
/**
* From now on, the observer will be notified of changes in
* brush, foreground color, background color, pattern, gradient
* and paintop
*/
virtual void attach(KisCanvasObserver *observer) = 0;
/**
* From now on, the specified observer will no longer be informed
* of changes.
*/
virtual void detach(KisCanvasObserver *observer) = 0;
/**
* Calling this method will notify all observers. Do not call this
* method from the Update method of a KisCanvasObserver!
*/
virtual void notifyObservers() = 0;
/**
* @return the image that is currently active.
*/
virtual KisImageSP currentImg() const = 0;
/**
* @return the background color
*/
virtual KisColor bgColor() const = 0;
/**
* Set the background color. This should cause all observers to be notified. Do not call from KisCanvasObserver::update()!
*
* @param c the new background color
*/
virtual void setBGColor(const KisColor& c) = 0;
/**
* @return the currently set foreground or painting color
*/
virtual KisColor fgColor() const = 0;
/**
* Set the foreground or painting color. This should cause all observers to be notified. Do not call from KisCanvasObserver::update()!
*
* @param c the new foreground color
*/
virtual void setFGColor(const KisColor& c) = 0;
/**
* @return the exposure value. This determines which exposure of multiple exposure or HDR images will be displayed
*/
virtual float HDRExposure() const = 0;
/**
* Set the exposure value. This determines which exposure of multiple exposure or HDR images will be displayed. All observers should be notified.
*
* @param exposure the new exposure value
*/
virtual void setHDRExposure(float exposure) = 0;
/**
* @return the current brush object.
*/
virtual KisBrush *currentBrush() const = 0;
/**
* @return the current pattern object.
*/
virtual KisPattern *currentPattern() const = 0;
/**
* @return the current gradient object
*/
virtual KisGradient *currentGradient() const = 0;
/**
* @return the identification of the current paintop object, not the paintop object itself.
*/
virtual KisID currentPaintop() const = 0;
/**
* @return the settings for the current paintop object, or 0 if there are no options set.
*/
virtual const KisPaintOpSettings *currentPaintopSettings() const = 0;
/**
* @return the currently applied zoom factor. XXX: Shouldn't this be in the canvas controller?
*/
virtual double zoomFactor() const = 0;
/**
* retrieve the undo adapater -- there is one undo adapter
* per document, and it collects all transactions
*/
virtual KisUndoAdapter *undoAdapter() const = 0;
/**
* @return the interface to the canvas widget
*/
virtual KisCanvasController *canvasController() const = 0;
/// XXX: Remove this method
virtual KisToolControllerInterface *toolController() const = 0;
/// XXX: Remove this method
virtual KisDoc * document() const = 0;
/// XXX: Remove this method
virtual KisProgressDisplayInterface *progressDisplay() const = 0;
/// XXX: Remove this method
virtual KisSelectionManager * selectionManager() = 0;
/// XXX: Remove this method
virtual KoPaletteManager * paletteManager() = 0;
/**
* Get the profile that this view uses to display itself on
* he monitor.
*/
virtual KisProfile * monitorProfile() = 0;
/**
* Get the perspective grid manager.
*/
virtual KisPerspectiveGridManager* perspectiveGridManager() = 0;
private:
KisCanvasSubject(const KisCanvasSubject&);
KisCanvasSubject& operator=(const KisCanvasSubject&);
};
#endif // KIS_CANVAS_SUBJECT_H_
|