Merge lp:~unity-team/nux/nux.redirected-views into lp:nux
- nux.redirected-views
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Neil J. Patel |
Approved revision: | no longer in the source branch. |
Merged at revision: | 661 |
Proposed branch: | lp:~unity-team/nux/nux.redirected-views |
Merge into: | lp:nux |
Diff against target: |
6727 lines (+2510/-1026) 96 files modified
Nux/AbstractCheckedButton.cpp (+1/-1) Nux/AbstractComboBox.cpp (+2/-2) Nux/AbstractComboBox.h (+2/-2) Nux/Area.cpp (+211/-25) Nux/Area.h (+113/-8) Nux/BaseWindow.h (+0/-1) Nux/BasicView.cpp (+46/-0) Nux/BasicView.h (+42/-0) Nux/Button.cpp (+25/-8) Nux/CheckBox.cpp (+0/-2) Nux/ClientArea.cpp (+74/-125) Nux/ClientArea.h (+0/-1) Nux/ColorEditor.cpp (+29/-53) Nux/ColorPreview.cpp (+1/-1) Nux/ComboBoxSimple.cpp (+1/-1) Nux/Coverflow.cpp (+3/-3) Nux/Coverflow.h (+1/-1) Nux/CoverflowItem.h (+1/-1) Nux/EditTextBox.cpp (+1/-1) Nux/FloatingWindow.cpp (+11/-11) Nux/FloatingWindow.h (+5/-5) Nux/GridHLayout.cpp (+1/-1) Nux/GridVLayout.cpp (+1/-1) Nux/GroupBox.h (+1/-1) Nux/GroupBox2.cpp (+1/-1) Nux/GroupBox2.h (+1/-1) Nux/HScrollBar.cpp (+4/-4) Nux/HScrollBar.h (+4/-4) Nux/HSplitter.cpp (+0/-20) Nux/HSplitter.h (+1/-1) Nux/InputArea.cpp (+4/-2) Nux/InputArea.h (+0/-2) Nux/LayeredLayout.cpp (+2/-7) Nux/Layout.cpp (+306/-63) Nux/Layout.h (+26/-9) Nux/LinearLayout.cpp (+3/-3) Nux/MainLoopGLib.cpp (+0/-1) Nux/Makefile.am (+3/-0) Nux/MenuBar.cpp (+5/-5) Nux/MenuBar.h (+1/-1) Nux/MouseAreaCtrl.cpp (+1/-1) Nux/MouseAreaCtrl.h (+1/-1) Nux/Nux.cpp (+1/-0) Nux/Nux.h (+5/-0) Nux/NuxTimerTickSource.h (+54/-0) Nux/PaintLayer.cpp (+9/-0) Nux/Painter.cpp (+42/-4) Nux/Painter.h (+7/-0) Nux/RGBValuator.cpp (+10/-21) Nux/RGBValuator.h (+9/-9) Nux/RadioButton.cpp (+1/-3) Nux/RangeValue.cpp (+1/-1) Nux/RangeValue.h (+1/-1) Nux/RangeValueInteger.cpp (+1/-1) Nux/RangeValueInteger.h (+1/-1) Nux/ScrollView.cpp (+0/-2) Nux/SpinBox_Logic.cpp (+2/-2) Nux/SpinBox_Logic.h (+2/-2) Nux/TabView.cpp (+3/-3) Nux/TabView.h (+3/-3) Nux/TextEntry.cpp (+6/-7) Nux/TextEntry.h (+1/-1) Nux/Theme.cpp (+1/-1) Nux/VScrollBar.cpp (+4/-4) Nux/VScrollBar.h (+4/-4) Nux/VSplitter.cpp (+0/-19) Nux/VSplitter.h (+1/-1) Nux/View.cpp (+290/-36) Nux/View.h (+22/-14) Nux/WindowCompositor.cpp (+12/-12) Nux/WindowCompositor.h (+0/-1) Nux/WindowThread.cpp (+0/-1) Nux/WindowThread.h (+0/-1) NuxCore/Animation.cpp (+3/-2) NuxCore/AnimationController.cpp (+1/-0) NuxCore/AnimationController.h (+6/-1) NuxCore/Color.cpp (+1/-1) NuxCore/EasingCurve.cpp (+14/-0) NuxCore/EasingCurve.h (+6/-0) NuxGraphics/GLWindowManager.cpp (+2/-2) NuxGraphics/GLWindowManager.h (+2/-2) NuxGraphics/GpuDevice.cpp (+27/-4) NuxGraphics/GpuDevice.h (+10/-1) NuxGraphics/GpuDeviceTexture.cpp (+11/-0) NuxGraphics/GraphicsDisplayWin.cpp (+233/-244) NuxGraphics/GraphicsDisplayWin.h (+32/-37) NuxGraphics/GraphicsDisplayX11.cpp (+54/-55) NuxGraphics/GraphicsDisplayX11.h (+13/-15) NuxGraphics/GraphicsEngine.cpp (+7/-0) NuxGraphics/GraphicsEngine.h (+38/-2) NuxGraphics/IOpenGLFrameBufferObject.cpp (+190/-90) NuxGraphics/IOpenGLFrameBufferObject.h (+24/-9) NuxGraphics/RenderingPipe.cpp (+32/-6) NuxGraphics/RenderingPipeAsm.cpp (+120/-0) NuxGraphics/RenderingPipeGLSL.cpp (+254/-18) configure.ac (+2/-1) |
To merge this branch: | bzr merge lp:~unity-team/nux/nux.redirected-views |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Neil J. Patel (community) | Approve | ||
Review via email: mp+124661@code.launchpad.net |
Commit message
This branch introduces "Redirected Views" in Nux. Redirected views allows a view to be rendered inside its own texture and that texture is latter composited inside the main rendering.
This branch contains the required changes for redirected views. The opportunty was also taken to fix minor issues and introduce API changes.
== Core of the Redirected View
Nux/Area.cpp
Nux/Area.h
Nux/Layout.cpp
Nux/Layout.h
Nux/View.cpp
Nux/View.h
== Fixed ClientArea to work with RedirectedViews
Nux/ClientAre
Nux/ClientArea.h
== Concrete implementation of a view to replace InputArea in some locations
Nux/BasicView.cpp
Nux/BasicView.h
== Nux.h contains the Feature.h file of Nux
Nux/Nux.h
== API change to frame buffer object architecture
NuxGraphics/
NuxGraphics/
== Added InitSlTexturePr
NuxGraphics/
NuxGraphics/
NuxGraphics/
NuxGraphics/
== Fixed texture inversion
NuxGraphics/
Description of the change
This branch introduces "Redirected Views" in Nux. Redirected views allows a view to be rendered inside its own texture and that texture is latter composited inside the main rendering.
This branch contains the required changes for redirected views. The opportunty was also taken to fix minor issues and introduce API changes.
== Core of the Redirected View
Nux/Area.cpp
Nux/Area.h
Nux/Layout.cpp
Nux/Layout.h
Nux/View.cpp
Nux/View.h
== Fixed ClientArea to work with RedirectedViews
Nux/ClientAre
Nux/ClientArea.h
== Concrete implementation of a view to replace InputArea in some locations
Nux/BasicView.cpp
Nux/BasicView.h
== Nux.h contains the Feature.h file of Nux
Nux/Nux.h
== API change to frame buffer object architecture
NuxGraphics/
NuxGraphics/
== Added InitSlTexturePr
NuxGraphics/
NuxGraphics/
NuxGraphics/
NuxGraphics/
== Fixed texture inversion
NuxGraphics/
- 661. By Jay Taoko
-
This branch introduces "Redirected Views" in Nux. Redirected views allows a view to be rendered inside its own texture and that texture is latter composited inside the main rendering.
This branch contains the required changes for redirected views. The opportunty was also taken to fix minor issues and introduce API changes.== Core of the Redirected View
Nux/Area.cpp
Nux/Area.h
Nux/Layout.cpp
Nux/Layout.h
Nux/View.cpp
Nux/View.h== Fixed ClientArea to work with RedirectedViews
Nux/ClientArea.cpp
Nux/ClientArea.h== Concrete implementation of a view to replace InputArea in some locations
Nux/BasicView.cpp
Nux/BasicView.h== Nux.h contains the Feature.h file of Nux
Nux/Nux.h== API change to frame buffer object architecture
NuxGraphics/IOpenGLFrameBuf ferObject. cpp
NuxGraphics/IOpenGLFrameBuf ferObject. h == Added InitSlTexturePr
emultiplyShader shader
NuxGraphics/RenderingPipeGL SL.cpp
NuxGraphics/GraphicsEngine. cpp
NuxGraphics/GraphicsEngine. h
NuxGraphics/RenderingPipeAs m.cpp == Fixed texture inversion
NuxGraphics/RenderingPipe. cpp. Fixes: https:/ /bugs.launchpad .net/bugs/ 1049593. Approved by Neil J. Patel.
Preview Diff
1 | === modified file 'Nux/AbstractCheckedButton.cpp' | |||
2 | --- Nux/AbstractCheckedButton.cpp 2011-10-18 20:00:59 +0000 | |||
3 | +++ Nux/AbstractCheckedButton.cpp 2012-09-18 11:05:23 +0000 | |||
4 | @@ -39,7 +39,7 @@ | |||
5 | 39 | static_text_ = new StaticText(label_, NUX_TRACKER_LOCATION); | 39 | static_text_ = new StaticText(label_, NUX_TRACKER_LOCATION); |
6 | 40 | static_text_->SetTextColor(label_color_); | 40 | static_text_->SetTextColor(label_color_); |
7 | 41 | hlayout_ = new HLayout(NUX_TRACKER_LOCATION); | 41 | hlayout_ = new HLayout(NUX_TRACKER_LOCATION); |
9 | 42 | check_area_ = new InputArea(NUX_TRACKER_LOCATION); | 42 | check_area_ = new BasicView(NUX_TRACKER_LOCATION); |
10 | 43 | 43 | ||
11 | 44 | check_area_->SetInputEventSensitivity(false); | 44 | check_area_->SetInputEventSensitivity(false); |
12 | 45 | static_text_->SetInputEventSensitivity(false); | 45 | static_text_->SetInputEventSensitivity(false); |
13 | 46 | 46 | ||
14 | === modified file 'Nux/AbstractComboBox.cpp' | |||
15 | --- Nux/AbstractComboBox.cpp 2011-10-10 01:52:00 +0000 | |||
16 | +++ Nux/AbstractComboBox.cpp 2012-09-18 11:05:23 +0000 | |||
17 | @@ -37,8 +37,8 @@ | |||
18 | 37 | , m_MenuIsActive(false) | 37 | , m_MenuIsActive(false) |
19 | 38 | { | 38 | { |
20 | 39 | m_hlayout = new HLayout(NUX_TRACKER_LOCATION); | 39 | m_hlayout = new HLayout(NUX_TRACKER_LOCATION); |
23 | 40 | _combo_box_area = new InputArea(NUX_TRACKER_LOCATION); | 40 | _combo_box_area = new BasicView(NUX_TRACKER_LOCATION); |
24 | 41 | _combo_box_opening_area = new InputArea(NUX_TRACKER_LOCATION); | 41 | _combo_box_opening_area = new BasicView(NUX_TRACKER_LOCATION); |
25 | 42 | 42 | ||
26 | 43 | m_hlayout->AddView(_combo_box_area, 1); | 43 | m_hlayout->AddView(_combo_box_area, 1); |
27 | 44 | m_hlayout->AddView(_combo_box_opening_area, 0); | 44 | m_hlayout->AddView(_combo_box_opening_area, 0); |
28 | 45 | 45 | ||
29 | === modified file 'Nux/AbstractComboBox.h' | |||
30 | --- Nux/AbstractComboBox.h 2011-10-10 01:52:00 +0000 | |||
31 | +++ Nux/AbstractComboBox.h 2012-09-18 11:05:23 +0000 | |||
32 | @@ -48,8 +48,8 @@ | |||
33 | 48 | 48 | ||
34 | 49 | protected: | 49 | protected: |
35 | 50 | HLayout *m_hlayout; | 50 | HLayout *m_hlayout; |
38 | 51 | InputArea *_combo_box_area; | 51 | BasicView *_combo_box_area; |
39 | 52 | InputArea *_combo_box_opening_area; | 52 | BasicView *_combo_box_opening_area; |
40 | 53 | StaticText *_pango_static_text; | 53 | StaticText *_pango_static_text; |
41 | 54 | bool m_MenuIsActive; | 54 | bool m_MenuIsActive; |
42 | 55 | bool m_IsOpeningMenu; | 55 | bool m_IsOpeningMenu; |
43 | 56 | 56 | ||
44 | === modified file 'Nux/Area.cpp' | |||
45 | --- Nux/Area.cpp 2012-09-14 19:41:27 +0000 | |||
46 | +++ Nux/Area.cpp 2012-09-18 11:05:23 +0000 | |||
47 | @@ -39,11 +39,15 @@ | |||
48 | 39 | NUX_IMPLEMENT_OBJECT_TYPE(Area); | 39 | NUX_IMPLEMENT_OBJECT_TYPE(Area); |
49 | 40 | 40 | ||
50 | 41 | Area::Area(NUX_FILE_LINE_DECL) | 41 | Area::Area(NUX_FILE_LINE_DECL) |
56 | 42 | : InitiallyUnownedObject(NUX_FILE_LINE_PARAM) | 42 | : InitiallyUnownedObject(NUX_FILE_LINE_PARAM) |
57 | 43 | , geometry_(0, 0, DEFAULT_WIDGET_WIDTH, DEFAULT_WIDGET_HEIGHT) | 43 | , redirect_rendering_to_texture_(false) |
58 | 44 | , min_size_(AREA_MIN_WIDTH, AREA_MIN_HEIGHT) | 44 | , update_backup_texture_(false) |
59 | 45 | , max_size_(AREA_MAX_WIDTH, AREA_MAX_HEIGHT) | 45 | , present_redirected_view_(true) |
60 | 46 | , layout_done_(true) | 46 | , copy_previous_fbo_for_background_(true) |
61 | 47 | , geometry_(0, 0, DEFAULT_WIDGET_WIDTH, DEFAULT_WIDGET_HEIGHT) | ||
62 | 48 | , min_size_(AREA_MIN_WIDTH, AREA_MIN_HEIGHT) | ||
63 | 49 | , max_size_(AREA_MAX_WIDTH, AREA_MAX_HEIGHT) | ||
64 | 50 | , layout_done_(true) | ||
65 | 47 | { | 51 | { |
66 | 48 | window_thread_ = GetWindowThread(); | 52 | window_thread_ = GetWindowThread(); |
67 | 49 | visible_ = true; | 53 | visible_ = true; |
68 | @@ -321,41 +325,76 @@ | |||
69 | 321 | return parent_area_; | 325 | return parent_area_; |
70 | 322 | } | 326 | } |
71 | 323 | 327 | ||
73 | 324 | int Area::GetBaseX () const | 328 | int Area::GetX() const |
74 | 325 | { | 329 | { |
75 | 326 | return geometry_.x; | 330 | return geometry_.x; |
76 | 327 | } | 331 | } |
77 | 328 | 332 | ||
79 | 329 | int Area::GetBaseY () const | 333 | int Area::GetBaseX() const |
80 | 334 | { | ||
81 | 335 | return GetX(); | ||
82 | 336 | } | ||
83 | 337 | |||
84 | 338 | int Area::GetY() const | ||
85 | 330 | { | 339 | { |
86 | 331 | return geometry_.y; | 340 | return geometry_.y; |
87 | 332 | } | 341 | } |
88 | 333 | 342 | ||
90 | 334 | int Area::GetBaseWidth () const | 343 | int Area::GetBaseY() const |
91 | 344 | { | ||
92 | 345 | return GetY(); | ||
93 | 346 | } | ||
94 | 347 | |||
95 | 348 | int Area::GetWidth() const | ||
96 | 335 | { | 349 | { |
97 | 336 | return geometry_.width; | 350 | return geometry_.width; |
98 | 337 | } | 351 | } |
99 | 338 | 352 | ||
101 | 339 | int Area::GetBaseHeight () const | 353 | int Area::GetBaseWidth() const |
102 | 354 | { | ||
103 | 355 | return GetWidth(); | ||
104 | 356 | } | ||
105 | 357 | |||
106 | 358 | int Area::GetHeight() const | ||
107 | 340 | { | 359 | { |
108 | 341 | return geometry_.height; | 360 | return geometry_.height; |
109 | 342 | } | 361 | } |
110 | 343 | 362 | ||
111 | 363 | int Area::GetBaseHeight() const | ||
112 | 364 | { | ||
113 | 365 | return GetHeight(); | ||
114 | 366 | } | ||
115 | 367 | |||
116 | 344 | void Area::SetGeometry(int x, int y, int w, int h) | 368 | void Area::SetGeometry(int x, int y, int w, int h) |
117 | 345 | { | 369 | { |
118 | 346 | h = nux::Clamp<int> (h, min_size_.height, max_size_.height); | 370 | h = nux::Clamp<int> (h, min_size_.height, max_size_.height); |
119 | 347 | w = nux::Clamp<int> (w, min_size_.width, max_size_.width); | 371 | w = nux::Clamp<int> (w, min_size_.width, max_size_.width); |
120 | 348 | 372 | ||
121 | 373 | bool detected_size_change = false; | ||
122 | 374 | bool detected_position_change = false; | ||
123 | 375 | |||
124 | 376 | if (geometry_.x != x || geometry_.y != y) | ||
125 | 377 | detected_position_change = true; | ||
126 | 378 | |||
127 | 379 | if (geometry_.width != w || geometry_.height != h) | ||
128 | 380 | detected_size_change = true; | ||
129 | 381 | |||
130 | 349 | nux::Geometry geometry(x, y, w, h); | 382 | nux::Geometry geometry(x, y, w, h); |
131 | 350 | if (geometry_ == geometry) | 383 | if (geometry_ == geometry) |
132 | 351 | return; | 384 | return; |
133 | 352 | 385 | ||
135 | 353 | GeometryChangePending(); | 386 | GeometryChangePending(detected_position_change, detected_size_change); |
136 | 354 | geometry_ = geometry; | 387 | geometry_ = geometry; |
137 | 355 | ReconfigureParentLayout(); | 388 | ReconfigureParentLayout(); |
141 | 356 | GeometryChanged(); | 389 | GeometryChanged(detected_position_change, detected_size_change); |
142 | 357 | 390 | ||
143 | 358 | OnGeometryChanged.emit(this, geometry_); | 391 | geometry_changed.emit(this, geometry_); |
144 | 392 | |||
145 | 393 | if (detected_position_change) | ||
146 | 394 | position_changed.emit(this, x, y); | ||
147 | 395 | |||
148 | 396 | if (detected_size_change) | ||
149 | 397 | size_changed.emit(this, w, h); | ||
150 | 359 | } | 398 | } |
151 | 360 | 399 | ||
152 | 361 | void Area::SetGeometry(const Geometry &geo) | 400 | void Area::SetGeometry(const Geometry &geo) |
153 | @@ -368,40 +407,64 @@ | |||
154 | 368 | return geometry_; | 407 | return geometry_; |
155 | 369 | } | 408 | } |
156 | 370 | 409 | ||
158 | 371 | void Area::SetBaseX(int x) | 410 | void Area::SetX(int x) |
159 | 372 | { | 411 | { |
160 | 373 | SetGeometry(x, geometry_.y, geometry_.width, geometry_.height); | 412 | SetGeometry(x, geometry_.y, geometry_.width, geometry_.height); |
161 | 374 | } | 413 | } |
162 | 375 | 414 | ||
164 | 376 | void Area::SetBaseY (int y) | 415 | void Area::SetY (int y) |
165 | 377 | { | 416 | { |
166 | 378 | SetGeometry(geometry_.x, y, geometry_.width, geometry_.height); | 417 | SetGeometry(geometry_.x, y, geometry_.width, geometry_.height); |
167 | 379 | } | 418 | } |
168 | 380 | 419 | ||
170 | 381 | void Area::SetBaseXY (int x, int y) | 420 | void Area::SetBaseX(int x) |
171 | 421 | { | ||
172 | 422 | SetX(x); | ||
173 | 423 | } | ||
174 | 424 | |||
175 | 425 | void Area::SetBaseY(int y) | ||
176 | 426 | { | ||
177 | 427 | SetY(y); | ||
178 | 428 | } | ||
179 | 429 | |||
180 | 430 | void Area::SetXY(int x, int y) | ||
181 | 382 | { | 431 | { |
182 | 383 | SetGeometry(x, y, geometry_.width, geometry_.height); | 432 | SetGeometry(x, y, geometry_.width, geometry_.height); |
183 | 384 | } | 433 | } |
184 | 385 | 434 | ||
185 | 435 | void Area::SetBaseXY(int x, int y) | ||
186 | 436 | { | ||
187 | 437 | SetXY(x, y); | ||
188 | 438 | } | ||
189 | 439 | |||
190 | 440 | void Area::SetSize(int w, int h) | ||
191 | 441 | { | ||
192 | 442 | SetGeometry(geometry_.x, geometry_.y, w, h); | ||
193 | 443 | } | ||
194 | 444 | |||
195 | 386 | void Area::SetBaseSize(int w, int h) | 445 | void Area::SetBaseSize(int w, int h) |
196 | 387 | { | 446 | { |
198 | 388 | SetGeometry(geometry_.x, geometry_.y, w, h); | 447 | SetSize(w, h); |
199 | 448 | } | ||
200 | 449 | |||
201 | 450 | void Area::SetWidth(int w) | ||
202 | 451 | { | ||
203 | 452 | SetGeometry(geometry_.x, geometry_.y, w, geometry_.height); | ||
204 | 389 | } | 453 | } |
205 | 390 | 454 | ||
206 | 391 | void Area::SetBaseWidth(int w) | 455 | void Area::SetBaseWidth(int w) |
207 | 392 | { | 456 | { |
209 | 393 | SetGeometry(geometry_.x, geometry_.y, w, geometry_.height); | 457 | SetWidth(w); |
210 | 458 | } | ||
211 | 459 | |||
212 | 460 | void Area::SetHeight(int h) | ||
213 | 461 | { | ||
214 | 462 | SetGeometry(geometry_.x, geometry_.y, geometry_.width, h); | ||
215 | 394 | } | 463 | } |
216 | 395 | 464 | ||
217 | 396 | void Area::SetBaseHeight(int h) | 465 | void Area::SetBaseHeight(int h) |
218 | 397 | { | 466 | { |
226 | 398 | SetGeometry(geometry_.x, geometry_.y, geometry_.width, h); | 467 | SetHeight(h); |
220 | 399 | } | ||
221 | 400 | |||
222 | 401 | void Area::IncreaseSize(int x, int y) | ||
223 | 402 | { | ||
224 | 403 | geometry_.OffsetPosition(x, y); | ||
225 | 404 | OnResize.emit(geometry_.x, geometry_.y, geometry_.width, geometry_.height ); | ||
227 | 405 | } | 468 | } |
228 | 406 | 469 | ||
229 | 407 | long Area::ComputeContentSize() | 470 | long Area::ComputeContentSize() |
230 | @@ -1043,6 +1106,129 @@ | |||
231 | 1043 | return false; | 1106 | return false; |
232 | 1044 | } | 1107 | } |
233 | 1045 | 1108 | ||
234 | 1109 | /*** Support for redirected rendering ***/ | ||
235 | 1110 | void Area::SetRedirectRenderingToTexture(bool redirect) | ||
236 | 1111 | { | ||
237 | 1112 | if (redirect_rendering_to_texture_ == redirect) | ||
238 | 1113 | { | ||
239 | 1114 | return; | ||
240 | 1115 | } | ||
241 | 1116 | |||
242 | 1117 | if ((redirect_rendering_to_texture_ == false) && redirect) | ||
243 | 1118 | { | ||
244 | 1119 | update_backup_texture_ = true; | ||
245 | 1120 | } | ||
246 | 1121 | |||
247 | 1122 | redirect_rendering_to_texture_ = redirect; | ||
248 | 1123 | if (redirect == false) | ||
249 | 1124 | { | ||
250 | 1125 | // Free the texture of this view | ||
251 | 1126 | backup_fbo_.Release(); | ||
252 | 1127 | backup_texture_.Release(); | ||
253 | 1128 | backup_depth_texture_.Release(); | ||
254 | 1129 | prev_fbo_.Release(); | ||
255 | 1130 | } | ||
256 | 1131 | } | ||
257 | 1132 | |||
258 | 1133 | bool Area::RedirectRenderingToTexture() const | ||
259 | 1134 | { | ||
260 | 1135 | return redirect_rendering_to_texture_; | ||
261 | 1136 | } | ||
262 | 1137 | |||
263 | 1138 | void Area::SetUpdateBackupTextureForChildRendering(bool update) | ||
264 | 1139 | { | ||
265 | 1140 | update_backup_texture_ = update; | ||
266 | 1141 | } | ||
267 | 1142 | |||
268 | 1143 | ObjectPtr<IOpenGLBaseTexture> Area::BackupTexture() const | ||
269 | 1144 | { | ||
270 | 1145 | // if RedirectRenderingToTexture() is false, then backup_texture_ is not a valid smart pointer. | ||
271 | 1146 | return backup_texture_; | ||
272 | 1147 | } | ||
273 | 1148 | |||
274 | 1149 | bool Area::UpdateBackupTextureForChildRendering() const | ||
275 | 1150 | { | ||
276 | 1151 | return update_backup_texture_; | ||
277 | 1152 | } | ||
278 | 1153 | |||
279 | 1154 | void Area::PrepareParentRedirectedView() | ||
280 | 1155 | { | ||
281 | 1156 | Area* parent = GetParentObject(); | ||
282 | 1157 | |||
283 | 1158 | while (parent) | ||
284 | 1159 | { | ||
285 | 1160 | if (parent->RedirectRenderingToTexture() && (parent->UpdateBackupTextureForChildRendering() == false)) | ||
286 | 1161 | { | ||
287 | 1162 | parent->SetUpdateBackupTextureForChildRendering(true); | ||
288 | 1163 | parent->PrepareParentRedirectedView(); | ||
289 | 1164 | } | ||
290 | 1165 | else if (parent->RedirectRenderingToTexture() && (parent->UpdateBackupTextureForChildRendering() == true)) | ||
291 | 1166 | { | ||
292 | 1167 | break; | ||
293 | 1168 | } | ||
294 | 1169 | else | ||
295 | 1170 | { | ||
296 | 1171 | parent->PrepareParentRedirectedView(); | ||
297 | 1172 | break; | ||
298 | 1173 | } | ||
299 | 1174 | } | ||
300 | 1175 | } | ||
301 | 1176 | |||
302 | 1177 | bool Area::HasParentRedirectedView() | ||
303 | 1178 | { | ||
304 | 1179 | Area* parent = GetParentObject(); | ||
305 | 1180 | |||
306 | 1181 | while (parent && !parent->Type().IsDerivedFromType(View::StaticObjectType)) | ||
307 | 1182 | { | ||
308 | 1183 | parent = parent->GetParentObject(); | ||
309 | 1184 | } | ||
310 | 1185 | |||
311 | 1186 | if (parent) | ||
312 | 1187 | { | ||
313 | 1188 | View* view = static_cast<View*>(parent); | ||
314 | 1189 | if (view->RedirectRenderingToTexture()) | ||
315 | 1190 | { | ||
316 | 1191 | return true; | ||
317 | 1192 | } | ||
318 | 1193 | else | ||
319 | 1194 | { | ||
320 | 1195 | return view->HasParentRedirectedView(); | ||
321 | 1196 | } | ||
322 | 1197 | } | ||
323 | 1198 | return false; | ||
324 | 1199 | } | ||
325 | 1200 | |||
326 | 1201 | Area* Area::RedirectedAncestor() | ||
327 | 1202 | { | ||
328 | 1203 | Area* parent = GetParentObject(); | ||
329 | 1204 | |||
330 | 1205 | while (parent) | ||
331 | 1206 | { | ||
332 | 1207 | if (parent->RedirectRenderingToTexture()) | ||
333 | 1208 | { | ||
334 | 1209 | return parent; | ||
335 | 1210 | } | ||
336 | 1211 | parent = parent->GetParentObject(); | ||
337 | 1212 | } | ||
338 | 1213 | |||
339 | 1214 | return NULL; | ||
340 | 1215 | } | ||
341 | 1216 | |||
342 | 1217 | void Area::SetCopyPreviousFboTexture(bool copy_background) | ||
343 | 1218 | { | ||
344 | 1219 | copy_previous_fbo_for_background_ = copy_background; | ||
345 | 1220 | } | ||
346 | 1221 | |||
347 | 1222 | void Area::SetPresentRedirectedView(bool present_redirected_view) | ||
348 | 1223 | { | ||
349 | 1224 | present_redirected_view_ = present_redirected_view; | ||
350 | 1225 | } | ||
351 | 1226 | |||
352 | 1227 | bool Area::PresentRedirectedView() const | ||
353 | 1228 | { | ||
354 | 1229 | return present_redirected_view_; | ||
355 | 1230 | } | ||
356 | 1231 | |||
357 | 1046 | #ifdef NUX_GESTURES_SUPPORT | 1232 | #ifdef NUX_GESTURES_SUPPORT |
358 | 1047 | Area* Area::GetInputAreaHitByGesture(const GestureEvent &event) | 1233 | Area* Area::GetInputAreaHitByGesture(const GestureEvent &event) |
359 | 1048 | { | 1234 | { |
360 | 1049 | 1235 | ||
361 | === modified file 'Nux/Area.h' | |||
362 | --- Nux/Area.h 2012-08-27 09:09:21 +0000 | |||
363 | +++ Nux/Area.h 2012-09-18 11:05:23 +0000 | |||
364 | @@ -25,7 +25,6 @@ | |||
365 | 25 | 25 | ||
366 | 26 | #include <string> | 26 | #include <string> |
367 | 27 | #include <sigc++/sigc++.h> | 27 | #include <sigc++/sigc++.h> |
368 | 28 | #include "Features.h" | ||
369 | 29 | #include "NuxCore/InitiallyUnownedObject.h" | 28 | #include "NuxCore/InitiallyUnownedObject.h" |
370 | 30 | #include "NuxGraphics/Events.h" | 29 | #include "NuxGraphics/Events.h" |
371 | 31 | #include "Utils.h" | 30 | #include "Utils.h" |
372 | @@ -35,6 +34,9 @@ | |||
373 | 35 | { | 34 | { |
374 | 36 | class WindowThread; | 35 | class WindowThread; |
375 | 37 | class GraphicsEngine; | 36 | class GraphicsEngine; |
376 | 37 | class IOpenGLBaseTexture; | ||
377 | 38 | class IOpenGLFrameBufferObject; | ||
378 | 39 | |||
379 | 38 | #ifdef NUX_GESTURES_SUPPORT | 40 | #ifdef NUX_GESTURES_SUPPORT |
380 | 39 | class GestureEvent; | 41 | class GestureEvent; |
381 | 40 | #endif // NUX_GESTURES_SUPPORT | 42 | #endif // NUX_GESTURES_SUPPORT |
382 | @@ -156,6 +158,17 @@ | |||
383 | 156 | Area(NUX_FILE_LINE_DECL); | 158 | Area(NUX_FILE_LINE_DECL); |
384 | 157 | virtual ~Area(); | 159 | virtual ~Area(); |
385 | 158 | 160 | ||
386 | 161 | int GetX() const; | ||
387 | 162 | int GetY() const; | ||
388 | 163 | int GetWidth() const; | ||
389 | 164 | int GetHeight() const; | ||
390 | 165 | |||
391 | 166 | void SetX(int x); | ||
392 | 167 | void SetY(int y); | ||
393 | 168 | void SetXY(int x, int y); | ||
394 | 169 | void SetWidth(int w); | ||
395 | 170 | void SetHeight(int h); | ||
396 | 171 | |||
397 | 159 | int GetBaseX() const; | 172 | int GetBaseX() const; |
398 | 160 | int GetBaseY() const; | 173 | int GetBaseY() const; |
399 | 161 | int GetBaseWidth() const; | 174 | int GetBaseWidth() const; |
400 | @@ -172,6 +185,7 @@ | |||
401 | 172 | The size is adjusted to respect the min and max size policy | 185 | The size is adjusted to respect the min and max size policy |
402 | 173 | \sa SetWidth(), SetHeight(), SetMinimumSize(), SetMaximumSize(). | 186 | \sa SetWidth(), SetHeight(), SetMinimumSize(), SetMaximumSize(). |
403 | 174 | */ | 187 | */ |
404 | 188 | virtual void SetSize(int w, int h); | ||
405 | 175 | virtual void SetBaseSize(int w, int h); | 189 | virtual void SetBaseSize(int w, int h); |
406 | 176 | 190 | ||
407 | 177 | virtual void SetMinimumSize(int w, int h); | 191 | virtual void SetMinimumSize(int w, int h); |
408 | @@ -213,7 +227,7 @@ | |||
409 | 213 | 227 | ||
410 | 214 | \sa SetBaseWidth(), SetBaseHeight(), SetBaseX(), SetBaseY(). | 228 | \sa SetBaseWidth(), SetBaseHeight(), SetBaseX(), SetBaseY(). |
411 | 215 | */ | 229 | */ |
413 | 216 | void SetGeometry(int x, int y, int w, int h); | 230 | virtual void SetGeometry(int x, int y, int w, int h); |
414 | 217 | 231 | ||
415 | 218 | //! Set the geometry of the object. | 232 | //! Set the geometry of the object. |
416 | 219 | /*! | 233 | /*! |
417 | @@ -223,13 +237,12 @@ | |||
418 | 223 | @param geo Geometry object. | 237 | @param geo Geometry object. |
419 | 224 | \sa SetWidth(), SetHeight(), SetX(), SetY(). | 238 | \sa SetWidth(), SetHeight(), SetX(), SetY(). |
420 | 225 | */ | 239 | */ |
421 | 226 | void SetGeometry(const Geometry &geo); | ||
422 | 227 | |||
423 | 228 | void IncreaseSize(int x, int y); | ||
424 | 229 | 240 | ||
425 | 230 | void SetBaseString(std::string const& caption); | 241 | void SetBaseString(std::string const& caption); |
426 | 231 | std::string const& GetBaseString() const; | 242 | std::string const& GetBaseString() const; |
427 | 232 | 243 | ||
428 | 244 | virtual void SetGeometry(const Geometry& geo); | ||
429 | 245 | |||
430 | 233 | //! Deprecated. Use GetToplevel. | 246 | //! Deprecated. Use GetToplevel. |
431 | 234 | Area* GetToplevel(); | 247 | Area* GetToplevel(); |
432 | 235 | 248 | ||
433 | @@ -461,7 +474,17 @@ | |||
434 | 461 | This signal is only meant to inform of a change of size. When receiving this signal don't do anything | 474 | This signal is only meant to inform of a change of size. When receiving this signal don't do anything |
435 | 462 | that could change the size of this object. Or you risk creating an infinite loop. | 475 | that could change the size of this object. Or you risk creating an infinite loop. |
436 | 463 | */ | 476 | */ |
438 | 464 | sigc::signal<void, Area *, Geometry&> OnGeometryChanged; | 477 | sigc::signal<void, Area*, Geometry&> geometry_changed; |
439 | 478 | |||
440 | 479 | /*! | ||
441 | 480 | This signal emitted when the size of the area has changed. It is emitted after geometry_changed. | ||
442 | 481 | */ | ||
443 | 482 | sigc::signal<void, Area*, int, int> size_changed; | ||
444 | 483 | |||
445 | 484 | /*! | ||
446 | 485 | This signal emitted when the position of the area has changed. It is emitted after geometry_changed. | ||
447 | 486 | */ | ||
448 | 487 | sigc::signal<void, Area*, int, int> position_changed; | ||
449 | 465 | 488 | ||
450 | 466 | /*! | 489 | /*! |
451 | 467 | SetParentObject/UnParentObject are protected API. They are not meant to be used directly by users. | 490 | SetParentObject/UnParentObject are protected API. They are not meant to be used directly by users. |
452 | @@ -588,13 +611,13 @@ | |||
453 | 588 | This signal is only meant to inform that the size is about to change. When overriding this function, | 611 | This signal is only meant to inform that the size is about to change. When overriding this function, |
454 | 589 | don't do anything that could change the size of this object. Or you risk creating an infinite loop. | 612 | don't do anything that could change the size of this object. Or you risk creating an infinite loop. |
455 | 590 | */ | 613 | */ |
457 | 591 | virtual void GeometryChangePending() {} | 614 | virtual void GeometryChangePending(bool position_about_to_change, bool size_about_to_change) {} |
458 | 592 | 615 | ||
459 | 593 | /*! | 616 | /*! |
460 | 594 | This signal is only meant to inform that the size has changed. When overriding this function, | 617 | This signal is only meant to inform that the size has changed. When overriding this function, |
461 | 595 | don't do anything that could change the size of this object. Or you risk creating an infinite loop. | 618 | don't do anything that could change the size of this object. Or you risk creating an infinite loop. |
462 | 596 | */ | 619 | */ |
464 | 597 | virtual void GeometryChanged() {} | 620 | virtual void GeometryChanged(bool position_has_changed, bool size_has_changed) {} |
465 | 598 | 621 | ||
466 | 599 | //! Request a Layout recompute after a change of size | 622 | //! Request a Layout recompute after a change of size |
467 | 600 | /* | 623 | /* |
468 | @@ -628,6 +651,88 @@ | |||
469 | 628 | //! If this variable is not NULL, then this area is part of the keyboard focus chain. | 651 | //! If this variable is not NULL, then this area is part of the keyboard focus chain. |
470 | 629 | Area* next_object_to_key_focus_area_; | 652 | Area* next_object_to_key_focus_area_; |
471 | 630 | 653 | ||
472 | 654 | |||
473 | 655 | /**********************************************/ | ||
474 | 656 | /*** Begin support for redirected rendering ***/ | ||
475 | 657 | /**********************************************/ | ||
476 | 658 | public: | ||
477 | 659 | //! Redirect the rendering of this view to a texture. | ||
478 | 660 | /*! | ||
479 | 661 | Redirect the rendering of this view to a texture. \sa BackupTexture(). | ||
480 | 662 | @param redirect If true, redirect the rendering of this view to a texture. | ||
481 | 663 | */ | ||
482 | 664 | virtual void SetRedirectRenderingToTexture(bool redirect); | ||
483 | 665 | |||
484 | 666 | /*! | ||
485 | 667 | @return True if the rendering of this view is done in a texture. | ||
486 | 668 | */ | ||
487 | 669 | virtual bool RedirectRenderingToTexture() const; | ||
488 | 670 | |||
489 | 671 | //! Return the texture of this View if RedirectRenderingToTexture is enabled. | ||
490 | 672 | /* | ||
491 | 673 | Return the texture of this View if RedirectRenderingToTexture is enabled. | ||
492 | 674 | If RedirectRenderingToTexture() is false, then backup_texture_ is not a valid smart pointer. | ||
493 | 675 | |||
494 | 676 | @return the device texture that contains the rendering of this view. | ||
495 | 677 | */ | ||
496 | 678 | ObjectPtr<IOpenGLBaseTexture> BackupTexture() const; | ||
497 | 679 | |||
498 | 680 | /*! | ||
499 | 681 | The use of this function is a bit arcan but it gives more rendering | ||
500 | 682 | options to redirected areas. | ||
501 | 683 | */ | ||
502 | 684 | void SetCopyPreviousFboTexture(bool copy); | ||
503 | 685 | |||
504 | 686 | /*! | ||
505 | 687 | Activate/Deactivate the presentation of the redirected texture in the rendering tree. | ||
506 | 688 | */ | ||
507 | 689 | void SetPresentRedirectedView(bool present_redirected_view); | ||
508 | 690 | |||
509 | 691 | /*! | ||
510 | 692 | @return True if the redirected texture is displayed in the rendering tree. | ||
511 | 693 | */ | ||
512 | 694 | bool PresentRedirectedView() const; | ||
513 | 695 | |||
514 | 696 | protected: | ||
515 | 697 | //! Redirect the rendering of the view to a texture. | ||
516 | 698 | bool redirect_rendering_to_texture_; | ||
517 | 699 | bool update_backup_texture_; | ||
518 | 700 | bool present_redirected_view_; | ||
519 | 701 | //! The texture that holds the rendering of this view. | ||
520 | 702 | ObjectPtr<IOpenGLBaseTexture> backup_texture_; | ||
521 | 703 | ObjectPtr<IOpenGLBaseTexture> backup_depth_texture_; | ||
522 | 704 | ObjectPtr<IOpenGLBaseTexture> background_texture_; | ||
523 | 705 | ObjectPtr<IOpenGLFrameBufferObject> backup_fbo_; | ||
524 | 706 | ObjectPtr<IOpenGLFrameBufferObject> prev_fbo_; | ||
525 | 707 | Geometry prev_viewport_; | ||
526 | 708 | Matrix4 model_view_matrix_; | ||
527 | 709 | Matrix4 perspective_matrix_; | ||
528 | 710 | /*! | ||
529 | 711 | If true, copy the area in the previous fbo texture | ||
530 | 712 | into background_texture_. | ||
531 | 713 | */ | ||
532 | 714 | bool copy_previous_fbo_for_background_; | ||
533 | 715 | |||
534 | 716 | /*! | ||
535 | 717 | Implemented in nux::View and nux::Layout. | ||
536 | 718 | Report to a parent view with redirect_rendering_to_texture_ set to true that one of its children | ||
537 | 719 | needs to be redrawn. | ||
538 | 720 | */ | ||
539 | 721 | virtual void PrepareParentRedirectedView(); | ||
540 | 722 | |||
541 | 723 | virtual bool HasParentRedirectedView(); | ||
542 | 724 | Area* RedirectedAncestor(); | ||
543 | 725 | |||
544 | 726 | /*! | ||
545 | 727 | Inform this view that one of its children has requested a draw. This view must have its rendering redirected to a texture. | ||
546 | 728 | @param update True if this view is redirected and one of its children has requested a draw. | ||
547 | 729 | */ | ||
548 | 730 | virtual void SetUpdateBackupTextureForChildRendering(bool update); | ||
549 | 731 | virtual bool UpdateBackupTextureForChildRendering() const; | ||
550 | 732 | |||
551 | 733 | /********************************************/ | ||
552 | 734 | /*** End support for redirected rendering ***/ | ||
553 | 735 | /********************************************/ | ||
554 | 631 | 736 | ||
555 | 632 | #ifdef NUX_GESTURES_SUPPORT | 737 | #ifdef NUX_GESTURES_SUPPORT |
556 | 633 | //! Returns the InputArea hit by the given gesture | 738 | //! Returns the InputArea hit by the given gesture |
557 | 634 | 739 | ||
558 | === modified file 'Nux/BaseWindow.h' | |||
559 | --- Nux/BaseWindow.h 2012-05-31 21:50:05 +0000 | |||
560 | +++ Nux/BaseWindow.h 2012-09-18 11:05:23 +0000 | |||
561 | @@ -26,7 +26,6 @@ | |||
562 | 26 | 26 | ||
563 | 27 | #include <boost/scoped_ptr.hpp> | 27 | #include <boost/scoped_ptr.hpp> |
564 | 28 | #include "ScrollView.h" | 28 | #include "ScrollView.h" |
565 | 29 | #include "Features.h" | ||
566 | 30 | 29 | ||
567 | 31 | #if defined(NUX_OS_WINDOWS) | 30 | #if defined(NUX_OS_WINDOWS) |
568 | 32 | #include "NuxGraphics/Events.h" | 31 | #include "NuxGraphics/Events.h" |
569 | 33 | 32 | ||
570 | === added file 'Nux/BasicView.cpp' | |||
571 | --- Nux/BasicView.cpp 1970-01-01 00:00:00 +0000 | |||
572 | +++ Nux/BasicView.cpp 2012-09-18 11:05:23 +0000 | |||
573 | @@ -0,0 +1,46 @@ | |||
574 | 1 | /* | ||
575 | 2 | * Copyright 2012 Inalogic Inc. | ||
576 | 3 | * | ||
577 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
578 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
579 | 6 | * by the Free Software Foundation. | ||
580 | 7 | * | ||
581 | 8 | * This program is distributed in the hope that it will be useful, but | ||
582 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
583 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
584 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
585 | 12 | * | ||
586 | 13 | * You should have received a copy of the GNU General Public License | ||
587 | 14 | * version 3 along with this program. If not, see | ||
588 | 15 | * <http://www.gnu.org/licenses/> | ||
589 | 16 | * | ||
590 | 17 | * Authored by: Jay Taoko <jaytaoko@inalogic.com> | ||
591 | 18 | * | ||
592 | 19 | */ | ||
593 | 20 | |||
594 | 21 | #include "Nux/Nux.h" | ||
595 | 22 | #include "BasicView.h" | ||
596 | 23 | |||
597 | 24 | |||
598 | 25 | namespace nux { | ||
599 | 26 | NUX_IMPLEMENT_OBJECT_TYPE(BasicView); | ||
600 | 27 | |||
601 | 28 | BasicView::BasicView(NUX_FILE_LINE_DECL) | ||
602 | 29 | : nux::View(NUX_FILE_LINE_PARAM) | ||
603 | 30 | { | ||
604 | 31 | |||
605 | 32 | } | ||
606 | 33 | |||
607 | 34 | BasicView::~BasicView() | ||
608 | 35 | { | ||
609 | 36 | |||
610 | 37 | } | ||
611 | 38 | |||
612 | 39 | void BasicView::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw) | ||
613 | 40 | { | ||
614 | 41 | // Draw nothing | ||
615 | 42 | // For debug only: | ||
616 | 43 | // graphics_engine.QRP_Color(GetBaseX(), GetBaseY(), GetBaseWidth(), GetBaseHeight(), nux::color::Pink); | ||
617 | 44 | } | ||
618 | 45 | |||
619 | 46 | } | ||
620 | 0 | 47 | ||
621 | === added file 'Nux/BasicView.h' | |||
622 | --- Nux/BasicView.h 1970-01-01 00:00:00 +0000 | |||
623 | +++ Nux/BasicView.h 2012-09-18 11:05:23 +0000 | |||
624 | @@ -0,0 +1,42 @@ | |||
625 | 1 | /* | ||
626 | 2 | * Copyright 2012 Inalogic Inc. | ||
627 | 3 | * | ||
628 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
629 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
630 | 6 | * by the Free Software Foundation. | ||
631 | 7 | * | ||
632 | 8 | * This program is distributed in the hope that it will be useful, but | ||
633 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
634 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
635 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
636 | 12 | * | ||
637 | 13 | * You should have received a copy of the GNU General Public License | ||
638 | 14 | * version 3 along with this program. If not, see | ||
639 | 15 | * <http://www.gnu.org/licenses/> | ||
640 | 16 | * | ||
641 | 17 | * Authored by: Jay Taoko <jaytaoko@inalogic.com> | ||
642 | 18 | * | ||
643 | 19 | */ | ||
644 | 20 | |||
645 | 21 | #ifndef BASIC_VIEW_H | ||
646 | 22 | #define BASIC_VIEW_H | ||
647 | 23 | |||
648 | 24 | |||
649 | 25 | namespace nux { | ||
650 | 26 | |||
651 | 27 | //! A very basic View object with no rendering. | ||
652 | 28 | class BasicView: public nux::View | ||
653 | 29 | { | ||
654 | 30 | NUX_DECLARE_OBJECT_TYPE(BasicView, View); | ||
655 | 31 | public: | ||
656 | 32 | BasicView(NUX_FILE_LINE_PROTO); | ||
657 | 33 | ~BasicView(); | ||
658 | 34 | |||
659 | 35 | |||
660 | 36 | protected: | ||
661 | 37 | void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw); | ||
662 | 38 | }; | ||
663 | 39 | |||
664 | 40 | } | ||
665 | 41 | #endif // BASIC_VIEW_H | ||
666 | 42 | |||
667 | 0 | 43 | ||
668 | === modified file 'Nux/Button.cpp' | |||
669 | --- Nux/Button.cpp 2011-10-22 06:17:42 +0000 | |||
670 | +++ Nux/Button.cpp 2012-09-18 11:05:23 +0000 | |||
671 | @@ -344,20 +344,36 @@ | |||
672 | 344 | Geometry base = GetGeometry(); | 344 | Geometry base = GetGeometry(); |
673 | 345 | 345 | ||
674 | 346 | graphics_engine.PushClippingRectangle(base); | 346 | graphics_engine.PushClippingRectangle(base); |
676 | 347 | GetPainter().PaintBackground(graphics_engine, base); | 347 | |
677 | 348 | UXStyleImageRef ref_style = eIMAGE_STYLE_NONE; | ||
678 | 348 | 349 | ||
679 | 349 | if (visual_state_ == VISUAL_STATE_PRESSED) | 350 | if (visual_state_ == VISUAL_STATE_PRESSED) |
680 | 350 | { | 351 | { |
682 | 351 | GetPainter().PaintTextureShape(graphics_engine, base, eBUTTON_FOCUS); | 352 | ref_style = eBUTTON_FOCUS; |
683 | 352 | } | 353 | } |
684 | 353 | else if (visual_state_ == VISUAL_STATE_PRELIGHT) | 354 | else if (visual_state_ == VISUAL_STATE_PRELIGHT) |
685 | 354 | { | 355 | { |
687 | 355 | GetPainter().PaintTextureShape(graphics_engine, base, eBUTTON_PRELIGHT); | 356 | ref_style = eBUTTON_PRELIGHT; |
688 | 356 | } | 357 | } |
689 | 357 | else | 358 | else |
690 | 358 | { | 359 | { |
693 | 359 | GetPainter().PaintTextureShape(graphics_engine, base, eBUTTON_NORMAL); | 360 | ref_style = eBUTTON_NORMAL; |
694 | 360 | } | 361 | } |
695 | 362 | |||
696 | 363 | const PainterImage *pimage = GetTheme().GetImage(ref_style); | ||
697 | 364 | BaseTexture* texture = NULL; | ||
698 | 365 | if (pimage != NULL) | ||
699 | 366 | { | ||
700 | 367 | texture = pimage->texture; | ||
701 | 368 | } | ||
702 | 369 | |||
703 | 370 | TexCoordXForm texxform; | ||
704 | 371 | ROPConfig rop; | ||
705 | 372 | rop.Blend = true; | ||
706 | 373 | rop.SrcBlend = GL_ONE; | ||
707 | 374 | rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA; | ||
708 | 375 | |||
709 | 376 | GetPainter().PushDrawSliceScaledTextureLayer(graphics_engine, base, ref_style, color::White, eAllCorners, true, rop); | ||
710 | 361 | 377 | ||
711 | 362 | if (GetCompositionLayout()) | 378 | if (GetCompositionLayout()) |
712 | 363 | { | 379 | { |
713 | @@ -368,13 +384,14 @@ | |||
714 | 368 | clip_geo.OffsetSize(-left_clip_ - right_clip_, -top_clip_ - bottom_clip_); | 384 | clip_geo.OffsetSize(-left_clip_ - right_clip_, -top_clip_ - bottom_clip_); |
715 | 369 | 385 | ||
716 | 370 | graphics_engine.PushClippingRectangle(clip_geo); | 386 | graphics_engine.PushClippingRectangle(clip_geo); |
720 | 371 | GetPainter().PushPaintLayerStack(); | 387 | |
721 | 372 | GetCompositionLayout()->ProcessDraw(graphics_engine, force_draw); | 388 | GetCompositionLayout()->ProcessDraw(graphics_engine, true); |
722 | 373 | GetPainter().PopPaintLayerStack(); | 389 | |
723 | 374 | graphics_engine.PopClippingRectangle(); | 390 | graphics_engine.PopClippingRectangle(); |
724 | 375 | } | 391 | } |
725 | 376 | GetPainter().PopPaintLayerStack(); | 392 | GetPainter().PopPaintLayerStack(); |
726 | 377 | } | 393 | } |
727 | 394 | GetPainter().PopPaintLayer(); | ||
728 | 378 | graphics_engine.PopClippingRectangle(); | 395 | graphics_engine.PopClippingRectangle(); |
729 | 379 | } | 396 | } |
730 | 380 | 397 | ||
731 | 381 | 398 | ||
732 | === modified file 'Nux/CheckBox.cpp' | |||
733 | --- Nux/CheckBox.cpp 2011-10-18 20:00:59 +0000 | |||
734 | +++ Nux/CheckBox.cpp 2012-09-18 11:05:23 +0000 | |||
735 | @@ -43,8 +43,6 @@ | |||
736 | 43 | Geometry base = GetGeometry(); | 43 | Geometry base = GetGeometry(); |
737 | 44 | graphics_engine.PushClippingRectangle(base); | 44 | graphics_engine.PushClippingRectangle(base); |
738 | 45 | 45 | ||
739 | 46 | GetPainter().PaintBackground(graphics_engine, base); | ||
740 | 47 | |||
741 | 48 | InteractState is; | 46 | InteractState is; |
742 | 49 | is.is_on = active_; | 47 | is.is_on = active_; |
743 | 50 | 48 | ||
744 | 51 | 49 | ||
745 | === modified file 'Nux/ClientArea.cpp' | |||
746 | --- Nux/ClientArea.cpp 2012-02-04 23:19:44 +0000 | |||
747 | +++ Nux/ClientArea.cpp 2012-09-18 11:05:23 +0000 | |||
748 | @@ -46,36 +46,38 @@ | |||
749 | 46 | mouse_drag.connect(sigc::mem_fun(this, &ClientArea::RecvMouseDrag)); | 46 | mouse_drag.connect(sigc::mem_fun(this, &ClientArea::RecvMouseDrag)); |
750 | 47 | mouse_move.connect(sigc::mem_fun(this, &ClientArea::RecvMouseMove)); | 47 | mouse_move.connect(sigc::mem_fun(this, &ClientArea::RecvMouseMove)); |
751 | 48 | key_down.connect(sigc::mem_fun(this, &ClientArea::RecvKeyEvent)); | 48 | key_down.connect(sigc::mem_fun(this, &ClientArea::RecvKeyEvent)); |
752 | 49 | |||
753 | 50 | if (GetWindowThread()->GetGraphicsDisplay().HasFrameBufferSupport()) | ||
754 | 51 | { | ||
755 | 52 | m_FrameBufferObject = GetGraphicsDisplay()->GetGpuDevice()->CreateFrameBufferObject(); | ||
756 | 53 | m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | ||
757 | 54 | m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | ||
758 | 55 | } | ||
759 | 56 | } | 49 | } |
760 | 57 | 50 | ||
761 | 58 | ClientArea::~ClientArea() | 51 | ClientArea::~ClientArea() |
762 | 59 | { | 52 | { |
763 | 60 | } | 53 | } |
764 | 61 | 54 | ||
766 | 62 | void ClientArea::BeginDraw(GraphicsEngine &graphics_engine, bool force_draw) | 55 | void ClientArea::BeginDraw(GraphicsEngine& graphics_engine, bool force_draw) |
767 | 63 | { | 56 | { |
770 | 64 | if ((IsRedrawNeeded() == false) && (force_draw == false)) | 57 | // if ((IsRedrawNeeded() == false) && (force_draw == false)) |
771 | 65 | return; | 58 | // return; |
772 | 59 | |||
773 | 60 | // Save blend states | ||
774 | 61 | unsigned int current_alpha_blend; | ||
775 | 62 | unsigned int current_src_blend_factor; | ||
776 | 63 | unsigned int current_dest_blend_factor; | ||
777 | 64 | graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); | ||
778 | 65 | |||
779 | 66 | ObjectPtr<IOpenGLFrameBufferObject> prev_fbo_ = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject(); | ||
780 | 67 | Geometry prev_viewport_ = graphics_engine.GetViewportRect(); | ||
781 | 66 | 68 | ||
782 | 67 | if (GetWindowThread()->GetGraphicsDisplay().HasFrameBufferSupport()) | 69 | if (GetWindowThread()->GetGraphicsDisplay().HasFrameBufferSupport()) |
783 | 68 | { | 70 | { |
786 | 69 | int buffer_width = GetBaseWidth(); | 71 | int width = GetWidth(); |
787 | 70 | int buffer_height = GetBaseHeight(); | 72 | int height = GetHeight(); |
788 | 71 | int window_width, window_height; | 73 | int window_width, window_height; |
791 | 72 | window_width = graphics_engine.GetViewportWidth(); | 74 | window_width = prev_viewport_.width; |
792 | 73 | window_height = graphics_engine.GetViewportHeight(); | 75 | window_height = prev_viewport_.height; |
793 | 74 | 76 | ||
798 | 75 | m_ctx.x = GetBaseX(); | 77 | m_ctx.x = GetX(); |
799 | 76 | m_ctx.y = GetBaseY(); | 78 | m_ctx.y = GetY(); |
800 | 77 | m_ctx.width = GetBaseWidth(); | 79 | m_ctx.width = width; |
801 | 78 | m_ctx.height = GetBaseHeight(); | 80 | m_ctx.height = height; |
802 | 79 | 81 | ||
803 | 80 | // A is obtained from graphics_engine. So A dimension's are in relative window coordinates. | 82 | // A is obtained from graphics_engine. So A dimension's are in relative window coordinates. |
804 | 81 | Rect A = graphics_engine.GetClippingRegion(); | 83 | Rect A = graphics_engine.GetClippingRegion(); |
805 | @@ -87,102 +89,62 @@ | |||
806 | 87 | m_ctx.width_clipregion = C.GetWidth(); | 89 | m_ctx.width_clipregion = C.GetWidth(); |
807 | 88 | m_ctx.height_clipregion = C.GetHeight(); | 90 | m_ctx.height_clipregion = C.GetHeight(); |
808 | 89 | 91 | ||
820 | 90 | ObjectPtr<IOpenGLFrameBufferObject> prevFBO = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject(); | 92 | //ObjectPtr<IOpenGLFrameBufferObject> prevFBO = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject(); |
821 | 91 | 93 | ||
822 | 92 | if ((m_FrameBufferObject->GetWidth() != buffer_width) || (m_FrameBufferObject->GetHeight() != buffer_height)) | 94 | if (m_FrameBufferObject.IsNull()) |
823 | 93 | { | 95 | { |
824 | 94 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); | 96 | // Create the fbo before using it for the first time. |
825 | 95 | m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | 97 | m_FrameBufferObject = GetGraphicsDisplay()->GetGpuDevice()->CreateFrameBufferObject(); |
826 | 96 | m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | 98 | } |
827 | 97 | } | 99 | |
828 | 98 | 100 | if (!m_MainColorRT.IsValid() || (m_MainColorRT->GetWidth() != width) || (m_MainColorRT->GetHeight() != height)) | |
829 | 99 | m_FrameBufferObject->SetRenderTarget(0, m_MainColorRT->GetSurfaceLevel(0)); | 101 | { |
830 | 100 | m_FrameBufferObject->SetDepthSurface(m_MainDepthRT->GetSurfaceLevel(0)); | 102 | // Create or resize the color and depth textures before using them. |
831 | 103 | m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(width, height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | ||
832 | 104 | m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(width, height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | ||
833 | 105 | } | ||
834 | 106 | |||
835 | 107 | m_FrameBufferObject->FormatFrameBufferObject(width, height, BITFMT_R8G8B8A8); | ||
836 | 108 | m_FrameBufferObject->EmptyClippingRegion(); | ||
837 | 109 | m_FrameBufferObject->SetTextureAttachment(0, m_MainColorRT, 0); | ||
838 | 110 | m_FrameBufferObject->SetDepthTextureAttachment(m_MainDepthRT, 0); | ||
839 | 101 | m_FrameBufferObject->Activate(); | 111 | m_FrameBufferObject->Activate(); |
840 | 102 | 112 | ||
924 | 103 | graphics_engine.SetViewport(0, 0, buffer_width, buffer_height); | 113 | graphics_engine.SetViewport(0, 0, width, height); |
925 | 104 | m_FrameBufferObject->EmptyClippingRegion(); | 114 | |
926 | 105 | 115 | ||
927 | 106 | ClientDraw(graphics_engine, m_ctx, force_draw); | 116 | ClientDraw(graphics_engine, m_ctx, force_draw); |
928 | 107 | 117 | } | |
929 | 108 | // Restore the main frame buffer object | 118 | |
930 | 109 | prevFBO->Activate(); | 119 | if (prev_fbo_.IsValid()) |
931 | 110 | 120 | { | |
932 | 111 | Area* view_window = GetTopLevelViewWindow(); | 121 | // Restore the previous fbo |
933 | 112 | if (view_window) | 122 | prev_fbo_->Activate(); |
934 | 113 | { | 123 | |
935 | 114 | graphics_engine.SetViewport(0, 0, view_window->GetBaseWidth(), view_window->GetBaseHeight()); | 124 | prev_fbo_->ApplyClippingRegion(); |
936 | 115 | graphics_engine.ApplyClippingRectangle(); | 125 | } |
937 | 116 | graphics_engine.ApplyModelViewMatrix(); | 126 | |
938 | 117 | graphics_engine.SetOrthographicProjectionMatrix(view_window->GetBaseWidth(), view_window->GetBaseHeight()); | 127 | // Restore the matrices and the view port. |
939 | 118 | 128 | graphics_engine.ApplyModelViewMatrix(); | |
940 | 119 | } | 129 | graphics_engine.SetOrthographicProjectionMatrix(prev_viewport_.width, prev_viewport_.height); |
941 | 120 | else | 130 | graphics_engine.SetViewport(prev_viewport_.x, prev_viewport_.y, prev_viewport_.width, prev_viewport_.height); |
942 | 121 | { | 131 | |
943 | 122 | graphics_engine.SetViewport(0, 0, window_width, window_height); | 132 | { |
944 | 123 | graphics_engine.ApplyClippingRectangle(); | 133 | unsigned int w, h; |
945 | 124 | graphics_engine.ApplyModelViewMatrix(); | 134 | w = m_MainColorRT->GetWidth(); |
946 | 125 | graphics_engine.SetOrthographicProjectionMatrix(window_width, window_height); | 135 | h = m_MainColorRT->GetHeight(); |
947 | 126 | } | 136 | int x = m_ctx.x; |
948 | 127 | 137 | int y = m_ctx.y; | |
949 | 128 | // Copy the client frame buffer into the main frame buffer. | 138 | |
950 | 129 | { | 139 | TexCoordXForm texxform0; |
951 | 130 | unsigned int w, h; | 140 | texxform0.uwrap = TEXWRAP_CLAMP; |
952 | 131 | w = m_MainColorRT->GetWidth(); | 141 | texxform0.vwrap = TEXWRAP_CLAMP; |
953 | 132 | h = m_MainColorRT->GetHeight(); | 142 | texxform0.FlipVCoord(true); |
954 | 133 | int x = m_ctx.x; | 143 | GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(x, y, w, h, m_MainColorRT, texxform0, Color(color::White)); |
955 | 134 | int y = m_ctx.y; | 144 | } |
956 | 135 | 145 | ||
957 | 136 | TexCoordXForm texxform0; | 146 | // restore blend states |
958 | 137 | texxform0.uwrap = TEXWRAP_CLAMP; | 147 | graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); |
876 | 138 | texxform0.vwrap = TEXWRAP_CLAMP; | ||
877 | 139 | texxform0.FlipVCoord(true); | ||
878 | 140 | GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(x, y, w, h, m_MainColorRT, texxform0, Color(color::White)); | ||
879 | 141 | } | ||
880 | 142 | } | ||
881 | 143 | else | ||
882 | 144 | { | ||
883 | 145 | int x = graphics_engine.GetContextX(); | ||
884 | 146 | int y = graphics_engine.GetContextY(); | ||
885 | 147 | |||
886 | 148 | // The clientarea is in absolute window coordinates. It needs to be offset so that it is in relative window coordinates. | ||
887 | 149 | m_ctx.x = GetBaseX() + x; | ||
888 | 150 | m_ctx.y = GetBaseY() + y; | ||
889 | 151 | m_ctx.width = GetBaseWidth(); | ||
890 | 152 | m_ctx.height = GetBaseHeight(); | ||
891 | 153 | |||
892 | 154 | // A is obtained from graphics_engine. So A dimension's are in relative window coordinates. | ||
893 | 155 | Rect A = graphics_engine.GetClippingRegion(); | ||
894 | 156 | |||
895 | 157 | Rect B = Rect(m_ctx.x, m_ctx.y, m_ctx.width, m_ctx.height); | ||
896 | 158 | Rect C = A.Intersect(B); | ||
897 | 159 | |||
898 | 160 | m_ctx.x_clipregion = C.x; | ||
899 | 161 | m_ctx.y_clipregion = C.y; | ||
900 | 162 | m_ctx.width_clipregion = C.GetWidth(); | ||
901 | 163 | m_ctx.height_clipregion = C.GetHeight(); | ||
902 | 164 | |||
903 | 165 | int window_width, window_height; | ||
904 | 166 | window_width = graphics_engine.GetViewportWidth(); | ||
905 | 167 | window_height = graphics_engine.GetViewportHeight(); | ||
906 | 168 | |||
907 | 169 | SetClientViewport(graphics_engine); | ||
908 | 170 | // graphics_engine.SetViewport( | ||
909 | 171 | // m_ctx.x, window_height - m_ctx.y - m_ctx.height, m_ctx.width, m_ctx.height); | ||
910 | 172 | // | ||
911 | 173 | // graphics_engine.SetOpenGLClippingRectangle( | ||
912 | 174 | // m_ctx.x_clipregion, | ||
913 | 175 | // window_height - m_ctx.y_clipregion - m_ctx.height_clipregion, | ||
914 | 176 | // m_ctx.width_clipregion, | ||
915 | 177 | // m_ctx.height_clipregion); | ||
916 | 178 | |||
917 | 179 | ClientDraw(graphics_engine, m_ctx, force_draw); | ||
918 | 180 | |||
919 | 181 | // go back to 2D in case that was changed by the client. | ||
920 | 182 | graphics_engine.SetViewport(0, 0, window_width, window_height); | ||
921 | 183 | graphics_engine.ApplyClippingRectangle(); | ||
922 | 184 | graphics_engine.Push2DWindow(window_width, window_height); | ||
923 | 185 | } | ||
959 | 186 | } | 148 | } |
960 | 187 | 149 | ||
961 | 188 | void ClientArea::Draw(GraphicsEngine &graphics_engine, bool force_draw) | 150 | void ClientArea::Draw(GraphicsEngine &graphics_engine, bool force_draw) |
962 | @@ -270,19 +232,6 @@ | |||
963 | 270 | 232 | ||
964 | 271 | } | 233 | } |
965 | 272 | 234 | ||
966 | 273 | void ClientArea::QueueDraw() | ||
967 | 274 | { | ||
968 | 275 | //GetWindowCompositor()..AddToDrawList(this); | ||
969 | 276 | WindowThread* application = GetWindowThread(); | ||
970 | 277 | if (application) | ||
971 | 278 | { | ||
972 | 279 | application->AddToDrawList(this); | ||
973 | 280 | application->RequestRedraw(); | ||
974 | 281 | //GetWindowCompositor().AddToDrawList(this); | ||
975 | 282 | } | ||
976 | 283 | draw_cmd_queued_ = true; | ||
977 | 284 | } | ||
978 | 285 | |||
979 | 286 | bool ClientArea::AcceptKeyNavFocus() | 235 | bool ClientArea::AcceptKeyNavFocus() |
980 | 287 | { | 236 | { |
981 | 288 | return false; | 237 | return false; |
982 | 289 | 238 | ||
983 | === modified file 'Nux/ClientArea.h' | |||
984 | --- Nux/ClientArea.h 2011-11-10 17:28:44 +0000 | |||
985 | +++ Nux/ClientArea.h 2012-09-18 11:05:23 +0000 | |||
986 | @@ -49,7 +49,6 @@ | |||
987 | 49 | virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw); | 49 | virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw); |
988 | 50 | virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw); | 50 | virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw); |
989 | 51 | virtual void PostDraw(GraphicsEngine &graphics_engine, bool force_draw); | 51 | virtual void PostDraw(GraphicsEngine &graphics_engine, bool force_draw); |
990 | 52 | virtual void QueueDraw(); | ||
991 | 53 | 52 | ||
992 | 54 | void EnableClientDraw(bool b) | 53 | void EnableClientDraw(bool b) |
993 | 55 | { | 54 | { |
994 | 56 | 55 | ||
995 | === modified file 'Nux/ColorEditor.cpp' | |||
996 | --- Nux/ColorEditor.cpp 2012-02-06 01:06:09 +0000 | |||
997 | +++ Nux/ColorEditor.cpp 2012-09-18 11:05:23 +0000 | |||
998 | @@ -207,9 +207,9 @@ | |||
999 | 207 | m_Validator.SetMaximum(1.0); | 207 | m_Validator.SetMaximum(1.0); |
1000 | 208 | m_Validator.SetDecimals(2); | 208 | m_Validator.SetDecimals(2); |
1001 | 209 | 209 | ||
1005 | 210 | picker_area_ = new InputArea(NUX_TRACKER_LOCATION); | 210 | picker_area_ = new BasicView(NUX_TRACKER_LOCATION); |
1006 | 211 | channel_area_ = new InputArea(NUX_TRACKER_LOCATION); | 211 | channel_area_ = new BasicView(NUX_TRACKER_LOCATION); |
1007 | 212 | selected_color_area_ = new InputArea(NUX_TRACKER_LOCATION); | 212 | selected_color_area_ = new BasicView(NUX_TRACKER_LOCATION); |
1008 | 213 | m_hlayout = new HLayout(NUX_TRACKER_LOCATION); | 213 | m_hlayout = new HLayout(NUX_TRACKER_LOCATION); |
1009 | 214 | 214 | ||
1010 | 215 | channel_area_->mouse_down.connect(sigc::mem_fun(this, &ColorEditor::RecvMouseDown)); | 215 | channel_area_->mouse_down.connect(sigc::mem_fun(this, &ColorEditor::RecvMouseDown)); |
1011 | @@ -316,18 +316,6 @@ | |||
1012 | 316 | ctrllayout->SetHorizontalExternalMargin(2); | 316 | ctrllayout->SetHorizontalExternalMargin(2); |
1013 | 317 | ctrllayout->SetVerticalInternalMargin(2); | 317 | ctrllayout->SetVerticalInternalMargin(2); |
1014 | 318 | 318 | ||
1015 | 319 | // //ctrllayout->AddView(new SpaceLayout(20,20,20,40), 1); | ||
1016 | 320 | // OkButton = new ToggleButton("OK", NUX_TRACKER_LOCATION); | ||
1017 | 321 | // OkButton->SetMinimumWidth(60); | ||
1018 | 322 | // OkButton->SetMinimumHeight(20); | ||
1019 | 323 | // | ||
1020 | 324 | // CancelButton = new ToggleButton("Cancel", NUX_TRACKER_LOCATION); | ||
1021 | 325 | // CancelButton->SetMinimumWidth(60); | ||
1022 | 326 | // CancelButton->SetMinimumHeight(20); | ||
1023 | 327 | // | ||
1024 | 328 | // // ctrllayout->AddView(OkButton, 1); | ||
1025 | 329 | // // ctrllayout->AddView(CancelButton, 1); | ||
1026 | 330 | |||
1027 | 331 | m_hlayout->AddLayout(ctrllayout, 0); | 319 | m_hlayout->AddLayout(ctrllayout, 0); |
1028 | 332 | 320 | ||
1029 | 333 | radiogroup = new RadioButtonGroup(NUX_TRACKER_LOCATION); | 321 | radiogroup = new RadioButtonGroup(NUX_TRACKER_LOCATION); |
1030 | @@ -379,13 +367,11 @@ | |||
1031 | 379 | { | 367 | { |
1032 | 380 | Geometry base = GetGeometry(); | 368 | Geometry base = GetGeometry(); |
1033 | 381 | 369 | ||
1034 | 382 | GetPainter().PaintBackground(graphics_engine, base); | ||
1035 | 383 | //GetPainter().Paint2DQuadWireframe(graphics_engine, base, Color(COLOR_BACKGROUND_SECONDARY)); | ||
1036 | 384 | |||
1037 | 385 | base.OffsetPosition(1, 1); | 370 | base.OffsetPosition(1, 1); |
1038 | 386 | base.OffsetSize(-2, -2); | 371 | base.OffsetSize(-2, -2); |
1039 | 387 | 372 | ||
1040 | 388 | graphics_engine.PushClippingRectangle(base); | 373 | graphics_engine.PushClippingRectangle(base); |
1041 | 374 | GetPainter().PushDrawShapeLayer(graphics_engine, base, eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true); | ||
1042 | 389 | 375 | ||
1043 | 390 | if (m_ColorModel == color::RGB) | 376 | if (m_ColorModel == color::RGB) |
1044 | 391 | { | 377 | { |
1045 | @@ -396,26 +382,33 @@ | |||
1046 | 396 | DrawHSV(graphics_engine, force_draw); | 382 | DrawHSV(graphics_engine, force_draw); |
1047 | 397 | } | 383 | } |
1048 | 398 | 384 | ||
1066 | 399 | redcheck->QueueDraw(); | 385 | GetPainter().PopBackground(); |
1050 | 400 | redtext->QueueDraw(); | ||
1051 | 401 | greencheck->QueueDraw(); | ||
1052 | 402 | greentext->QueueDraw(); | ||
1053 | 403 | bluecheck->QueueDraw(); | ||
1054 | 404 | bluetext->QueueDraw(); | ||
1055 | 405 | |||
1056 | 406 | huecheck->QueueDraw(); | ||
1057 | 407 | hue_text_entry_->QueueDraw(); | ||
1058 | 408 | saturationcheck->QueueDraw(); | ||
1059 | 409 | saturation_text_entry_->QueueDraw(); | ||
1060 | 410 | valuecheck->QueueDraw(); | ||
1061 | 411 | value_text_entry_->QueueDraw(); | ||
1062 | 412 | |||
1063 | 413 | // OkButton->QueueDraw(); | ||
1064 | 414 | // CancelButton->QueueDraw(); | ||
1065 | 415 | |||
1067 | 416 | graphics_engine.PopClippingRectangle(); | 386 | graphics_engine.PopClippingRectangle(); |
1068 | 417 | } | 387 | } |
1069 | 418 | 388 | ||
1070 | 389 | void ColorEditor::DrawContent(GraphicsEngine &graphics_engine, bool force_draw) | ||
1071 | 390 | { | ||
1072 | 391 | Geometry base = GetGeometry(); | ||
1073 | 392 | GetPainter().PushShapeLayer(graphics_engine, base, eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true); | ||
1074 | 393 | |||
1075 | 394 | bool force = force_draw || IsFullRedraw(); | ||
1076 | 395 | redcheck->ProcessDraw(graphics_engine, force); | ||
1077 | 396 | redtext->ProcessDraw(graphics_engine, force); | ||
1078 | 397 | greencheck->ProcessDraw(graphics_engine, force); | ||
1079 | 398 | greentext->ProcessDraw(graphics_engine, force); | ||
1080 | 399 | bluecheck->ProcessDraw(graphics_engine, force); | ||
1081 | 400 | bluetext->ProcessDraw(graphics_engine, force); | ||
1082 | 401 | |||
1083 | 402 | huecheck->ProcessDraw(graphics_engine, force); | ||
1084 | 403 | hue_text_entry_->ProcessDraw(graphics_engine, force); | ||
1085 | 404 | saturationcheck->ProcessDraw(graphics_engine, force); | ||
1086 | 405 | saturation_text_entry_->ProcessDraw(graphics_engine, force); | ||
1087 | 406 | valuecheck->ProcessDraw(graphics_engine, force); | ||
1088 | 407 | value_text_entry_->ProcessDraw(graphics_engine, force); | ||
1089 | 408 | |||
1090 | 409 | GetPainter().PopBackground(); | ||
1091 | 410 | } | ||
1092 | 411 | |||
1093 | 419 | // Draw Marker on Base Chanel Area | 412 | // Draw Marker on Base Chanel Area |
1094 | 420 | void ColorEditor::DrawBaseChannelMarker(GraphicsEngine &graphics_engine) | 413 | void ColorEditor::DrawBaseChannelMarker(GraphicsEngine &graphics_engine) |
1095 | 421 | { | 414 | { |
1096 | @@ -621,23 +614,6 @@ | |||
1097 | 621 | } | 614 | } |
1098 | 622 | } | 615 | } |
1099 | 623 | 616 | ||
1100 | 624 | void ColorEditor::DrawContent(GraphicsEngine &graphics_engine, bool force_draw) | ||
1101 | 625 | { | ||
1102 | 626 | redcheck->ProcessDraw(graphics_engine, force_draw); | ||
1103 | 627 | redtext->ProcessDraw(graphics_engine, force_draw); | ||
1104 | 628 | greencheck->ProcessDraw(graphics_engine, force_draw); | ||
1105 | 629 | greentext->ProcessDraw(graphics_engine, force_draw); | ||
1106 | 630 | bluecheck->ProcessDraw(graphics_engine, force_draw); | ||
1107 | 631 | bluetext->ProcessDraw(graphics_engine, force_draw); | ||
1108 | 632 | |||
1109 | 633 | huecheck->ProcessDraw(graphics_engine, force_draw); | ||
1110 | 634 | hue_text_entry_->ProcessDraw(graphics_engine, force_draw); | ||
1111 | 635 | saturationcheck->ProcessDraw(graphics_engine, force_draw); | ||
1112 | 636 | saturation_text_entry_->ProcessDraw(graphics_engine, force_draw); | ||
1113 | 637 | valuecheck->ProcessDraw(graphics_engine, force_draw); | ||
1114 | 638 | value_text_entry_->ProcessDraw(graphics_engine, force_draw); | ||
1115 | 639 | } | ||
1116 | 640 | |||
1117 | 641 | void ColorEditor::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags) | 617 | void ColorEditor::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags) |
1118 | 642 | { | 618 | { |
1119 | 643 | float BaseValue; | 619 | float BaseValue; |
1120 | @@ -958,7 +934,7 @@ | |||
1121 | 958 | { | 934 | { |
1122 | 959 | rgb_ = color::RedGreenBlue(Clamp<double>(r, 0.0, 1.0), | 935 | rgb_ = color::RedGreenBlue(Clamp<double>(r, 0.0, 1.0), |
1123 | 960 | Clamp<double>(g, 0.0, 1.0), | 936 | Clamp<double>(g, 0.0, 1.0), |
1125 | 961 | Clamp<double> (b, 0.0, 1.0)); | 937 | Clamp<double>(b, 0.0, 1.0)); |
1126 | 962 | hsv_ = color::HueSaturationValue(rgb_); | 938 | hsv_ = color::HueSaturationValue(rgb_); |
1127 | 963 | RecvCheckColorModel(true, m_ColorModel, color_channel_); | 939 | RecvCheckColorModel(true, m_ColorModel, color_channel_); |
1128 | 964 | sigChange.emit(this); | 940 | sigChange.emit(this); |
1129 | 965 | 941 | ||
1130 | === modified file 'Nux/ColorPreview.cpp' | |||
1131 | --- Nux/ColorPreview.cpp 2012-07-04 16:36:46 +0000 | |||
1132 | +++ Nux/ColorPreview.cpp 2012-09-18 11:05:23 +0000 | |||
1133 | @@ -38,7 +38,7 @@ | |||
1134 | 38 | { | 38 | { |
1135 | 39 | //setSize(200, 100); | 39 | //setSize(200, 100); |
1136 | 40 | m_hlayout = new HLayout(NUX_TRACKER_LOCATION); | 40 | m_hlayout = new HLayout(NUX_TRACKER_LOCATION); |
1138 | 41 | m_ColorArea = new InputArea(NUX_TRACKER_LOCATION); | 41 | m_ColorArea = new BasicView(NUX_TRACKER_LOCATION); |
1139 | 42 | m_ColorValue = new StaticTextBox("", NUX_TRACKER_LOCATION); | 42 | m_ColorValue = new StaticTextBox("", NUX_TRACKER_LOCATION); |
1140 | 43 | m_DialogThreadProxy = new ColorDialogProxy(true); | 43 | m_DialogThreadProxy = new ColorDialogProxy(true); |
1141 | 44 | 44 | ||
1142 | 45 | 45 | ||
1143 | === modified file 'Nux/ComboBoxSimple.cpp' | |||
1144 | --- Nux/ComboBoxSimple.cpp 2011-12-14 02:01:43 +0000 | |||
1145 | +++ Nux/ComboBoxSimple.cpp 2012-09-18 11:05:23 +0000 | |||
1146 | @@ -55,7 +55,7 @@ | |||
1147 | 55 | _combo_box_area->SetMinimumSize(2 * DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT); | 55 | _combo_box_area->SetMinimumSize(2 * DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT); |
1148 | 56 | _combo_box_area->SetGeometry(Geometry(0, 0, 3 * DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT)); | 56 | _combo_box_area->SetGeometry(Geometry(0, 0, 3 * DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT)); |
1149 | 57 | //_pango_static_text->SetClipping(_combo_box_area->GetBaseWidth()); | 57 | //_pango_static_text->SetClipping(_combo_box_area->GetBaseWidth()); |
1151 | 58 | _combo_box_area->OnGeometryChanged.connect(sigc::mem_fun(this, &ComboBoxSimple::RecvGeometryChanged)); | 58 | _combo_box_area->geometry_changed.connect(sigc::mem_fun(this, &ComboBoxSimple::RecvGeometryChanged)); |
1152 | 59 | 59 | ||
1153 | 60 | //m_CurrentMenu = new MenuPage; | 60 | //m_CurrentMenu = new MenuPage; |
1154 | 61 | m_CurrentMenu->SetParentMenu(0); | 61 | m_CurrentMenu->SetParentMenu(0); |
1155 | 62 | 62 | ||
1156 | === modified file 'Nux/Coverflow.cpp' | |||
1157 | --- Nux/Coverflow.cpp 2012-08-20 18:43:15 +0000 | |||
1158 | +++ Nux/Coverflow.cpp 2012-09-18 11:05:23 +0000 | |||
1159 | @@ -224,7 +224,7 @@ | |||
1160 | 224 | parent_->mouse_up.connect(sigc::mem_fun(this, &Impl::HandleMouseUp)); | 224 | parent_->mouse_up.connect(sigc::mem_fun(this, &Impl::HandleMouseUp)); |
1161 | 225 | parent_->mouse_down.connect(sigc::mem_fun(this, &Impl::HandleMouseDown)); | 225 | parent_->mouse_down.connect(sigc::mem_fun(this, &Impl::HandleMouseDown)); |
1162 | 226 | parent_->mouse_wheel.connect(sigc::mem_fun(this, &Impl::HandleMouseWheel)); | 226 | parent_->mouse_wheel.connect(sigc::mem_fun(this, &Impl::HandleMouseWheel)); |
1164 | 227 | parent_->OnGeometryChanged.connect(sigc::mem_fun(this, &Impl::HandleGeometryChange)); | 227 | parent_->geometry_changed.connect(sigc::mem_fun(this, &Impl::HandleGeometryChange)); |
1165 | 228 | 228 | ||
1166 | 229 | 229 | ||
1167 | 230 | camera_position_.x = 0.0f; | 230 | camera_position_.x = 0.0f; |
1168 | @@ -286,7 +286,8 @@ | |||
1169 | 286 | 286 | ||
1170 | 287 | text_loader_.font_size = 10; | 287 | text_loader_.font_size = 10; |
1171 | 288 | 288 | ||
1173 | 289 | BaseTexture* texture = LoadTextureFromFile(PKGDATADIR"/UITextures/coverflow.oval-shadow.png"); | 289 | NString resource_path = NUX_FIND_RESOURCE_LOCATION_NOFAIL("UITextures/coverflow.oval-shadow.png"); |
1174 | 290 | BaseTexture* texture = LoadTextureFromFile(resource_path.GetTCharPtr()); | ||
1175 | 290 | drop_shadow_texture_ = texture->GetDeviceTexture(); | 291 | drop_shadow_texture_ = texture->GetDeviceTexture(); |
1176 | 291 | texture->UnReference(); | 292 | texture->UnReference(); |
1177 | 292 | 293 | ||
1178 | @@ -1087,7 +1088,6 @@ | |||
1179 | 1087 | graphics_engine.GetRenderStates().SetPremultipliedBlend(SRC_OVER); | 1088 | graphics_engine.GetRenderStates().SetPremultipliedBlend(SRC_OVER); |
1180 | 1088 | graphics_engine.GetRenderStates().SetColorMask(true, true, true, true); | 1089 | graphics_engine.GetRenderStates().SetColorMask(true, true, true, true); |
1181 | 1089 | 1090 | ||
1182 | 1090 | nux::GetPainter().PaintBackground(graphics_engine, GetGeometry()); | ||
1183 | 1091 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | 1091 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
1184 | 1092 | 1092 | ||
1185 | 1093 | glViewport(0, 0, ctx.width, ctx.height); | 1093 | glViewport(0, 0, ctx.width, ctx.height); |
1186 | 1094 | 1094 | ||
1187 | === modified file 'Nux/Coverflow.h' | |||
1188 | --- Nux/Coverflow.h 2012-02-13 05:26:32 +0000 | |||
1189 | +++ Nux/Coverflow.h 2012-09-18 11:05:23 +0000 | |||
1190 | @@ -20,9 +20,9 @@ | |||
1191 | 20 | #ifndef COVERFLOWVIEW_H | 20 | #ifndef COVERFLOWVIEW_H |
1192 | 21 | #define COVERFLOWVIEW_H | 21 | #define COVERFLOWVIEW_H |
1193 | 22 | 22 | ||
1194 | 23 | #include "Nux/ClientArea.h" | ||
1195 | 24 | #include "NuxCore/Math/Vector4.h" | 23 | #include "NuxCore/Math/Vector4.h" |
1196 | 25 | #include "CoverflowModel.h" | 24 | #include "CoverflowModel.h" |
1197 | 25 | #include "ClientArea.h" | ||
1198 | 26 | 26 | ||
1199 | 27 | #if defined(NUX_OS_WINDOWS) | 27 | #if defined(NUX_OS_WINDOWS) |
1200 | 28 | #define PKGDATADIR "../../data/" | 28 | #define PKGDATADIR "../../data/" |
1201 | 29 | 29 | ||
1202 | === modified file 'Nux/CoverflowItem.h' | |||
1203 | --- Nux/CoverflowItem.h 2012-08-20 18:43:15 +0000 | |||
1204 | +++ Nux/CoverflowItem.h 2012-09-18 11:05:23 +0000 | |||
1205 | @@ -23,7 +23,7 @@ | |||
1206 | 23 | #include <memory> | 23 | #include <memory> |
1207 | 24 | #include <string> | 24 | #include <string> |
1208 | 25 | 25 | ||
1210 | 26 | #include <Nux/Nux.h> | 26 | #include "Nux.h" |
1211 | 27 | #include <sigc++/sigc++.h> | 27 | #include <sigc++/sigc++.h> |
1212 | 28 | 28 | ||
1213 | 29 | namespace nux | 29 | namespace nux |
1214 | 30 | 30 | ||
1215 | === modified file 'Nux/EditTextBox.cpp' | |||
1216 | --- Nux/EditTextBox.cpp 2012-08-27 09:09:21 +0000 | |||
1217 | +++ Nux/EditTextBox.cpp 2012-09-18 11:05:23 +0000 | |||
1218 | @@ -94,7 +94,7 @@ | |||
1219 | 94 | void EditTextBox::ScrollTimerInterrupt(void *v) | 94 | void EditTextBox::ScrollTimerInterrupt(void *v) |
1220 | 95 | { | 95 | { |
1221 | 96 | Geometry base = GetGeometry(); | 96 | Geometry base = GetGeometry(); |
1223 | 97 | Event &event = GetGraphicsDisplay()->GetCurrentEvent(); | 97 | const Event& event = GetGraphicsDisplay()->GetCurrentEvent(); |
1224 | 98 | 98 | ||
1225 | 99 | int X = event.x; | 99 | int X = event.x; |
1226 | 100 | m_KeyboardHandler.CaretAutoScroll(event.x, event.y, base); | 100 | m_KeyboardHandler.CaretAutoScroll(event.x, event.y, base); |
1227 | 101 | 101 | ||
1228 | === modified file 'Nux/FloatingWindow.cpp' | |||
1229 | --- Nux/FloatingWindow.cpp 2012-08-27 09:09:21 +0000 | |||
1230 | +++ Nux/FloatingWindow.cpp 2012-09-18 11:05:23 +0000 | |||
1231 | @@ -52,27 +52,27 @@ | |||
1232 | 52 | _resize_handle_height = 20; | 52 | _resize_handle_height = 20; |
1233 | 53 | _title_bar_height = 20; | 53 | _title_bar_height = 20; |
1234 | 54 | 54 | ||
1236 | 55 | _minimize_button = new InputArea(NUX_TRACKER_LOCATION); | 55 | _minimize_button = new BasicView(NUX_TRACKER_LOCATION); |
1237 | 56 | _minimize_button->SetParentObject(this); | 56 | _minimize_button->SetParentObject(this); |
1238 | 57 | 57 | ||
1240 | 58 | _resize_handle = new InputArea(NUX_TRACKER_LOCATION); | 58 | _resize_handle = new BasicView(NUX_TRACKER_LOCATION); |
1241 | 59 | _resize_handle->SinkReference(); | 59 | _resize_handle->SinkReference(); |
1242 | 60 | _resize_handle->SetParentObject(this); | 60 | _resize_handle->SetParentObject(this); |
1243 | 61 | 61 | ||
1245 | 62 | _title_bar = new InputArea(NUX_TRACKER_LOCATION); | 62 | _title_bar = new BasicView(NUX_TRACKER_LOCATION); |
1246 | 63 | _title_bar->SinkReference(); | 63 | _title_bar->SinkReference(); |
1247 | 64 | _title_bar->SetParentObject(this); | 64 | _title_bar->SetParentObject(this); |
1248 | 65 | 65 | ||
1250 | 66 | _close_button = new InputArea(NUX_TRACKER_LOCATION); | 66 | _close_button = new BasicView(NUX_TRACKER_LOCATION); |
1251 | 67 | _window_title_bar = new StaticTextBox("", NUX_TRACKER_LOCATION); | 67 | _window_title_bar = new StaticTextBox("", NUX_TRACKER_LOCATION); |
1252 | 68 | 68 | ||
1253 | 69 | _title_bar_layout = new HLayout(NUX_TRACKER_LOCATION); | 69 | _title_bar_layout = new HLayout(NUX_TRACKER_LOCATION); |
1254 | 70 | _title_bar_layout->Reference(); | 70 | _title_bar_layout->Reference(); |
1255 | 71 | 71 | ||
1256 | 72 | _minimize_button->SetMinMaxSize(20, 20); | 72 | _minimize_button->SetMinMaxSize(20, 20); |
1258 | 73 | _minimize_button->SetGeometry(0, 0, 20, 20); | 73 | _minimize_button->SetGeometry(Geometry(0, 0, 20, 20)); |
1259 | 74 | _close_button->SetMinimumSize(20, 20); | 74 | _close_button->SetMinimumSize(20, 20); |
1261 | 75 | _close_button->SetGeometry(0, 0, 20, 20); | 75 | _close_button->SetGeometry(Geometry(0, 0, 20, 20)); |
1262 | 76 | _resize_handle->SetMinimumSize(_resize_handle_width, _resize_handle_height); | 76 | _resize_handle->SetMinimumSize(_resize_handle_width, _resize_handle_height); |
1263 | 77 | _resize_handle->SetGeometry(Geometry(0, 0, _resize_handle_width, _resize_handle_height)); | 77 | _resize_handle->SetGeometry(Geometry(0, 0, _resize_handle_width, _resize_handle_height)); |
1264 | 78 | 78 | ||
1265 | @@ -322,7 +322,7 @@ | |||
1266 | 322 | // No need to compute the window layout elements [LayoutWindowElements()]. They haven't changed. | 322 | // No need to compute the window layout elements [LayoutWindowElements()]. They haven't changed. |
1267 | 323 | // No need to compute the layout [ComputeContentSize()]. It hasn't changed. | 323 | // No need to compute the layout [ComputeContentSize()]. It hasn't changed. |
1268 | 324 | 324 | ||
1270 | 325 | _title_bar->SetGeometry(0, 0, geo.GetWidth(), _title_bar_height); | 325 | _title_bar->SetGeometry(Geometry(0, 0, geo.GetWidth(), _title_bar_height)); |
1271 | 326 | 326 | ||
1272 | 327 | #if defined(NUX_OS_LINUX) | 327 | #if defined(NUX_OS_LINUX) |
1273 | 328 | if (m_input_window != 0) | 328 | if (m_input_window != 0) |
1274 | @@ -371,7 +371,7 @@ | |||
1275 | 371 | // Drag Bar Geometry | 371 | // Drag Bar Geometry |
1276 | 372 | if (HasTitleBar()) | 372 | if (HasTitleBar()) |
1277 | 373 | { | 373 | { |
1279 | 374 | _title_bar->SetGeometry(0, 0, geo.GetWidth(), _title_bar_height); | 374 | _title_bar->SetGeometry(Geometry(0, 0, geo.GetWidth(), _title_bar_height)); |
1280 | 375 | } | 375 | } |
1281 | 376 | 376 | ||
1282 | 377 | // Size grip Geometry | 377 | // Size grip Geometry |
1283 | @@ -408,7 +408,7 @@ | |||
1284 | 408 | // Drag Bar Geometry | 408 | // Drag Bar Geometry |
1285 | 409 | if (HasTitleBar()) | 409 | if (HasTitleBar()) |
1286 | 410 | { | 410 | { |
1288 | 411 | _title_bar->SetGeometry(0, 0, geo.GetWidth(), _title_bar_height); | 411 | _title_bar->SetGeometry(Geometry(0, 0, geo.GetWidth(), _title_bar_height)); |
1289 | 412 | } | 412 | } |
1290 | 413 | 413 | ||
1291 | 414 | // Size grip Geometry | 414 | // Size grip Geometry |
1292 | @@ -436,7 +436,7 @@ | |||
1293 | 436 | // Drag Bar Geometry | 436 | // Drag Bar Geometry |
1294 | 437 | if (HasTitleBar()) | 437 | if (HasTitleBar()) |
1295 | 438 | { | 438 | { |
1297 | 439 | _title_bar->SetGeometry(0, 0, geo.GetWidth(), _title_bar_height); | 439 | _title_bar->SetGeometry(Geometry(0, 0, geo.GetWidth(), _title_bar_height)); |
1298 | 440 | } | 440 | } |
1299 | 441 | 441 | ||
1300 | 442 | // Size grip Geometry | 442 | // Size grip Geometry |
1301 | @@ -455,7 +455,7 @@ | |||
1302 | 455 | // Define the geometry of some of the component of the window. Otherwise, if the composition layout is not set, | 455 | // Define the geometry of some of the component of the window. Otherwise, if the composition layout is not set, |
1303 | 456 | // then the component won't be correctly placed after a SetGeometry. This can be redundant if the composition layout is set. | 456 | // then the component won't be correctly placed after a SetGeometry. This can be redundant if the composition layout is set. |
1304 | 457 | Geometry base = GetGeometry(); | 457 | Geometry base = GetGeometry(); |
1306 | 458 | _title_bar->SetGeometry(0, 0, base.GetWidth(), _title_bar_height); | 458 | _title_bar->SetGeometry(Geometry(0, 0, base.GetWidth(), _title_bar_height)); |
1307 | 459 | 459 | ||
1308 | 460 | _title_bar_layout->SetGeometry(_title_bar->GetGeometry()); | 460 | _title_bar_layout->SetGeometry(_title_bar->GetGeometry()); |
1309 | 461 | GetWindowThread()->ComputeElementLayout(_title_bar_layout); | 461 | GetWindowThread()->ComputeElementLayout(_title_bar_layout); |
1310 | 462 | 462 | ||
1311 | === modified file 'Nux/FloatingWindow.h' | |||
1312 | --- Nux/FloatingWindow.h 2011-12-14 02:01:43 +0000 | |||
1313 | +++ Nux/FloatingWindow.h 2012-09-18 11:05:23 +0000 | |||
1314 | @@ -27,7 +27,7 @@ | |||
1315 | 27 | 27 | ||
1316 | 28 | #include "ScrollView.h" | 28 | #include "ScrollView.h" |
1317 | 29 | #include "BaseWindow.h" | 29 | #include "BaseWindow.h" |
1319 | 30 | #include "InputArea.h" | 30 | #include "BasicView.h" |
1320 | 31 | #include "Layout.h" | 31 | #include "Layout.h" |
1321 | 32 | #include "HLayout.h" | 32 | #include "HLayout.h" |
1322 | 33 | #include "VLayout.h" | 33 | #include "VLayout.h" |
1323 | @@ -112,12 +112,12 @@ | |||
1324 | 112 | int _resize_handle_height; | 112 | int _resize_handle_height; |
1325 | 113 | int _title_bar_height; | 113 | int _title_bar_height; |
1326 | 114 | 114 | ||
1329 | 115 | InputArea *_resize_handle; | 115 | BasicView *_resize_handle; |
1330 | 116 | InputArea *_title_bar; | 116 | BasicView *_title_bar; |
1331 | 117 | Point _title_bar_mouse_down_location; | 117 | Point _title_bar_mouse_down_location; |
1332 | 118 | 118 | ||
1335 | 119 | InputArea *_minimize_button; | 119 | BasicView *_minimize_button; |
1336 | 120 | InputArea *_close_button; | 120 | BasicView *_close_button; |
1337 | 121 | StaticTextBox *_window_title_bar; | 121 | StaticTextBox *_window_title_bar; |
1338 | 122 | bool m_hasTitleBar; | 122 | bool m_hasTitleBar; |
1339 | 123 | 123 | ||
1340 | 124 | 124 | ||
1341 | === modified file 'Nux/GridHLayout.cpp' | |||
1342 | --- Nux/GridHLayout.cpp 2012-07-25 20:10:56 +0000 | |||
1343 | +++ Nux/GridHLayout.cpp 2012-09-18 11:05:23 +0000 | |||
1344 | @@ -579,7 +579,7 @@ | |||
1345 | 579 | graphics_engine.PopClippingRectangle(); | 579 | graphics_engine.PopClippingRectangle(); |
1346 | 580 | graphics_engine.PopModelViewMatrix(); | 580 | graphics_engine.PopModelViewMatrix(); |
1347 | 581 | 581 | ||
1349 | 582 | _queued_draw = false; | 582 | draw_cmd_queued_ = false; |
1350 | 583 | } | 583 | } |
1351 | 584 | 584 | ||
1352 | 585 | Area* GridHLayout::KeyNavIterationRowOrder(KeyNavDirection direction) | 585 | Area* GridHLayout::KeyNavIterationRowOrder(KeyNavDirection direction) |
1353 | 586 | 586 | ||
1354 | === modified file 'Nux/GridVLayout.cpp' | |||
1355 | --- Nux/GridVLayout.cpp 2011-10-21 22:06:35 +0000 | |||
1356 | +++ Nux/GridVLayout.cpp 2012-09-18 11:05:23 +0000 | |||
1357 | @@ -348,7 +348,7 @@ | |||
1358 | 348 | graphics_engine.PopClippingRectangle(); | 348 | graphics_engine.PopClippingRectangle(); |
1359 | 349 | graphics_engine.PopModelViewMatrix(); | 349 | graphics_engine.PopModelViewMatrix(); |
1360 | 350 | 350 | ||
1362 | 351 | _queued_draw = false; | 351 | draw_cmd_queued_ = false; |
1363 | 352 | } | 352 | } |
1364 | 353 | 353 | ||
1365 | 354 | Area* GridVLayout::KeyNavIteration(KeyNavDirection direction) | 354 | Area* GridVLayout::KeyNavIteration(KeyNavDirection direction) |
1366 | 355 | 355 | ||
1367 | === modified file 'Nux/GroupBox.h' | |||
1368 | --- Nux/GroupBox.h 2011-10-17 21:23:50 +0000 | |||
1369 | +++ Nux/GroupBox.h 2012-09-18 11:05:23 +0000 | |||
1370 | @@ -55,7 +55,7 @@ | |||
1371 | 55 | virtual void ComputeContentPosition(float offsetX, float offsetY); | 55 | virtual void ComputeContentPosition(float offsetX, float offsetY); |
1372 | 56 | 56 | ||
1373 | 57 | bool bCaptionAvailable; | 57 | bool bCaptionAvailable; |
1375 | 58 | InputArea m_CaptionArea; | 58 | BasicView m_CaptionArea; |
1376 | 59 | Layout *m_layout; | 59 | Layout *m_layout; |
1377 | 60 | }; | 60 | }; |
1378 | 61 | } | 61 | } |
1379 | 62 | 62 | ||
1380 | === modified file 'Nux/GroupBox2.cpp' | |||
1381 | --- Nux/GroupBox2.cpp 2011-10-17 21:23:50 +0000 | |||
1382 | +++ Nux/GroupBox2.cpp 2012-09-18 11:05:23 +0000 | |||
1383 | @@ -39,7 +39,7 @@ | |||
1384 | 39 | , bCaptionAvailable(false) | 39 | , bCaptionAvailable(false) |
1385 | 40 | , m_layout(0) | 40 | , m_layout(0) |
1386 | 41 | { | 41 | { |
1388 | 42 | m_CaptionArea = new InputArea(NUX_TRACKER_LOCATION); | 42 | m_CaptionArea = new BasicView(NUX_TRACKER_LOCATION); |
1389 | 43 | SetMinimumSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5); | 43 | SetMinimumSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5); |
1390 | 44 | SetBaseSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5); | 44 | SetBaseSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5); |
1391 | 45 | SetCaption(Caption); | 45 | SetCaption(Caption); |
1392 | 46 | 46 | ||
1393 | === modified file 'Nux/GroupBox2.h' | |||
1394 | --- Nux/GroupBox2.h 2011-10-17 21:23:50 +0000 | |||
1395 | +++ Nux/GroupBox2.h 2012-09-18 11:05:23 +0000 | |||
1396 | @@ -54,7 +54,7 @@ | |||
1397 | 54 | virtual void ComputeContentPosition(float offsetX, float offsetY); | 54 | virtual void ComputeContentPosition(float offsetX, float offsetY); |
1398 | 55 | 55 | ||
1399 | 56 | bool bCaptionAvailable; | 56 | bool bCaptionAvailable; |
1401 | 57 | InputArea *m_CaptionArea; | 57 | BasicView *m_CaptionArea; |
1402 | 58 | Layout *m_layout; | 58 | Layout *m_layout; |
1403 | 59 | 59 | ||
1404 | 60 | static int CAPTION_X_MARGIN; | 60 | static int CAPTION_X_MARGIN; |
1405 | 61 | 61 | ||
1406 | === modified file 'Nux/HScrollBar.cpp' | |||
1407 | --- Nux/HScrollBar.cpp 2012-07-04 16:36:46 +0000 | |||
1408 | +++ Nux/HScrollBar.cpp 2012-09-18 11:05:23 +0000 | |||
1409 | @@ -52,10 +52,10 @@ | |||
1410 | 52 | m_RightTimerHandler = 0; | 52 | m_RightTimerHandler = 0; |
1411 | 53 | 53 | ||
1412 | 54 | hlayout = new HLayout(NUX_TRACKER_LOCATION); | 54 | hlayout = new HLayout(NUX_TRACKER_LOCATION); |
1417 | 55 | _scroll_left_button = new InputArea(NUX_TRACKER_LOCATION); | 55 | _scroll_left_button = new BasicView(NUX_TRACKER_LOCATION); |
1418 | 56 | _track = new InputArea(NUX_TRACKER_LOCATION); | 56 | _track = new BasicView(NUX_TRACKER_LOCATION); |
1419 | 57 | _scroll_right_button = new InputArea(NUX_TRACKER_LOCATION); | 57 | _scroll_right_button = new BasicView(NUX_TRACKER_LOCATION); |
1420 | 58 | _slider = new InputArea(NUX_TRACKER_LOCATION); | 58 | _slider = new BasicView(NUX_TRACKER_LOCATION); |
1421 | 59 | _slider->SetParentObject(this); | 59 | _slider->SetParentObject(this); |
1422 | 60 | 60 | ||
1423 | 61 | // Set Original State | 61 | // Set Original State |
1424 | 62 | 62 | ||
1425 | === modified file 'Nux/HScrollBar.h' | |||
1426 | --- Nux/HScrollBar.h 2011-10-10 01:52:00 +0000 | |||
1427 | +++ Nux/HScrollBar.h 2012-09-18 11:05:23 +0000 | |||
1428 | @@ -99,10 +99,10 @@ | |||
1429 | 99 | bool AtMaximum(); | 99 | bool AtMaximum(); |
1430 | 100 | 100 | ||
1431 | 101 | HLayout *hlayout; | 101 | HLayout *hlayout; |
1436 | 102 | InputArea *_slider; | 102 | BasicView *_slider; |
1437 | 103 | InputArea *_scroll_left_button; | 103 | BasicView *_scroll_left_button; |
1438 | 104 | InputArea *_scroll_right_button; | 104 | BasicView *_scroll_right_button; |
1439 | 105 | InputArea *_track; | 105 | BasicView *_track; |
1440 | 106 | 106 | ||
1441 | 107 | int content_width_; | 107 | int content_width_; |
1442 | 108 | int content_height_; | 108 | int content_height_; |
1443 | 109 | 109 | ||
1444 | === modified file 'Nux/HSplitter.cpp' | |||
1445 | --- Nux/HSplitter.cpp 2011-12-06 16:29:06 +0000 | |||
1446 | +++ Nux/HSplitter.cpp 2012-09-18 11:05:23 +0000 | |||
1447 | @@ -143,11 +143,6 @@ | |||
1448 | 143 | View *ic = static_cast<View *>(*it); | 143 | View *ic = static_cast<View *>(*it); |
1449 | 144 | ic->ProcessDraw(graphics_engine, true); | 144 | ic->ProcessDraw(graphics_engine, true); |
1450 | 145 | } | 145 | } |
1451 | 146 | else if ((*it)->Type().IsObjectType(InputArea::StaticObjectType)) | ||
1452 | 147 | { | ||
1453 | 148 | InputArea *base_area = static_cast<InputArea *>(*it); | ||
1454 | 149 | base_area->OnDraw(graphics_engine, true); | ||
1455 | 150 | } | ||
1456 | 151 | else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType)) | 146 | else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType)) |
1457 | 152 | { | 147 | { |
1458 | 153 | HLayout *layout = static_cast<HLayout *>(*it); | 148 | HLayout *layout = static_cast<HLayout *>(*it); |
1459 | @@ -166,11 +161,6 @@ | |||
1460 | 166 | View *ic = static_cast<View *>(*it); | 161 | View *ic = static_cast<View *>(*it); |
1461 | 167 | ic->ProcessDraw(graphics_engine, false); | 162 | ic->ProcessDraw(graphics_engine, false); |
1462 | 168 | } | 163 | } |
1463 | 169 | else if ((*it)->Type().IsObjectType(InputArea::StaticObjectType)) | ||
1464 | 170 | { | ||
1465 | 171 | InputArea *base_area = static_cast<InputArea *>(*it); | ||
1466 | 172 | base_area->OnDraw(graphics_engine, false); | ||
1467 | 173 | } | ||
1468 | 174 | else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType)) | 164 | else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType)) |
1469 | 175 | { | 165 | { |
1470 | 176 | HLayout *layout = static_cast<HLayout *>(*it); | 166 | HLayout *layout = static_cast<HLayout *>(*it); |
1471 | @@ -359,11 +349,6 @@ | |||
1472 | 359 | // ComputeElementLayout to force the computing of this element layout. | 349 | // ComputeElementLayout to force the computing of this element layout. |
1473 | 360 | GetWindowThread()->ComputeElementLayout(ic); | 350 | GetWindowThread()->ComputeElementLayout(ic); |
1474 | 361 | } | 351 | } |
1475 | 362 | else if (m_InterfaceObject[i]->Type().IsObjectType(InputArea::StaticObjectType)) | ||
1476 | 363 | { | ||
1477 | 364 | InputArea *base_area = static_cast<InputArea *>(m_InterfaceObject[i]); | ||
1478 | 365 | base_area->SetGeometry(Geometry(x, accheight, w, splitter_geo.y - accheight)); | ||
1479 | 366 | } | ||
1480 | 367 | else if (m_InterfaceObject[i]->Type().IsDerivedFromType(Layout::StaticObjectType)) | 352 | else if (m_InterfaceObject[i]->Type().IsDerivedFromType(Layout::StaticObjectType)) |
1481 | 368 | { | 353 | { |
1482 | 369 | Layout *layout = static_cast<Layout *>(m_InterfaceObject[i]); | 354 | Layout *layout = static_cast<Layout *>(m_InterfaceObject[i]); |
1483 | @@ -566,11 +551,6 @@ | |||
1484 | 566 | View *ic = static_cast<View *>(*it); | 551 | View *ic = static_cast<View *>(*it); |
1485 | 567 | ic->DoneRedraw(); | 552 | ic->DoneRedraw(); |
1486 | 568 | } | 553 | } |
1487 | 569 | |||
1488 | 570 | else if ((*it)->Type().IsObjectType(InputArea::StaticObjectType)) | ||
1489 | 571 | { | ||
1490 | 572 | //InputArea* base_area = NUX_STATIC_CAST(InputArea*, (*it)); | ||
1491 | 573 | } | ||
1492 | 574 | } | 554 | } |
1493 | 575 | } | 555 | } |
1494 | 576 | 556 | ||
1495 | 577 | 557 | ||
1496 | === modified file 'Nux/HSplitter.h' | |||
1497 | --- Nux/HSplitter.h 2011-10-21 22:06:35 +0000 | |||
1498 | +++ Nux/HSplitter.h 2012-09-18 11:05:23 +0000 | |||
1499 | @@ -80,7 +80,7 @@ | |||
1500 | 80 | virtual Area* KeyNavIteration(KeyNavDirection direction); | 80 | virtual Area* KeyNavIteration(KeyNavDirection direction); |
1501 | 81 | 81 | ||
1502 | 82 | private: | 82 | private: |
1504 | 83 | typedef InputArea MySplitter; | 83 | typedef BasicView MySplitter; |
1505 | 84 | std::vector<Area *> m_InterfaceObject; | 84 | std::vector<Area *> m_InterfaceObject; |
1506 | 85 | std::vector<MySplitter *> m_SplitterObject; | 85 | std::vector<MySplitter *> m_SplitterObject; |
1507 | 86 | std::vector<float> m_SplitConfig; | 86 | std::vector<float> m_SplitConfig; |
1508 | 87 | 87 | ||
1509 | === modified file 'Nux/InputArea.cpp' | |||
1510 | --- Nux/InputArea.cpp 2012-09-14 16:49:35 +0000 | |||
1511 | +++ Nux/InputArea.cpp 2012-09-18 11:05:23 +0000 | |||
1512 | @@ -27,7 +27,6 @@ | |||
1513 | 27 | 27 | ||
1514 | 28 | #include "NuxCore/Logger.h" | 28 | #include "NuxCore/Logger.h" |
1515 | 29 | 29 | ||
1516 | 30 | #include "Features.h" | ||
1517 | 31 | #include "Nux.h" | 30 | #include "Nux.h" |
1518 | 32 | #include "InputArea.h" | 31 | #include "InputArea.h" |
1519 | 33 | #include "NuxGraphics/GraphicsEngine.h" | 32 | #include "NuxGraphics/GraphicsEngine.h" |
1520 | @@ -73,7 +72,10 @@ | |||
1521 | 73 | 72 | ||
1522 | 74 | void InputArea::OnDraw(GraphicsEngine &graphics_engine, bool force_draw) | 73 | void InputArea::OnDraw(GraphicsEngine &graphics_engine, bool force_draw) |
1523 | 75 | { | 74 | { |
1525 | 76 | graphics_engine.QRP_Color(GetBaseX(), GetBaseY(), GetBaseWidth(), GetBaseHeight(), area_color_); | 75 | // Draw Nothing! |
1526 | 76 | |||
1527 | 77 | // For debug Only: | ||
1528 | 78 | // graphics_engine.QRP_Color(GetBaseX(), GetBaseY(), GetBaseWidth(), GetBaseHeight(), area_color_); | ||
1529 | 77 | } | 79 | } |
1530 | 78 | 80 | ||
1531 | 79 | bool InputArea::HasKeyboardFocus() | 81 | bool InputArea::HasKeyboardFocus() |
1532 | 80 | 82 | ||
1533 | === modified file 'Nux/InputArea.h' | |||
1534 | --- Nux/InputArea.h 2012-08-27 09:09:21 +0000 | |||
1535 | +++ Nux/InputArea.h 2012-09-18 11:05:23 +0000 | |||
1536 | @@ -23,8 +23,6 @@ | |||
1537 | 23 | #ifndef INPUTAREA_H | 23 | #ifndef INPUTAREA_H |
1538 | 24 | #define INPUTAREA_H | 24 | #define INPUTAREA_H |
1539 | 25 | 25 | ||
1540 | 26 | #include "Features.h" | ||
1541 | 27 | |||
1542 | 28 | #include "Area.h" | 26 | #include "Area.h" |
1543 | 29 | 27 | ||
1544 | 30 | #if defined(NUX_OS_WINDOWS) | 28 | #if defined(NUX_OS_WINDOWS) |
1545 | 31 | 29 | ||
1546 | === modified file 'Nux/LayeredLayout.cpp' | |||
1547 | --- Nux/LayeredLayout.cpp 2012-04-10 00:58:09 +0000 | |||
1548 | +++ Nux/LayeredLayout.cpp 2012-09-18 11:05:23 +0000 | |||
1549 | @@ -59,7 +59,7 @@ | |||
1550 | 59 | m_child_draw_queued(false) | 59 | m_child_draw_queued(false) |
1551 | 60 | { | 60 | { |
1552 | 61 | m_ContentStacking = eStackLeft; | 61 | m_ContentStacking = eStackLeft; |
1554 | 62 | OnChildQueueDraw.connect(sigc::mem_fun(this, &LayeredLayout::ChildQueueDraw)); | 62 | child_queue_draw.connect(sigc::mem_fun(this, &LayeredLayout::ChildQueueDraw)); |
1555 | 63 | } | 63 | } |
1556 | 64 | 64 | ||
1557 | 65 | LayeredLayout::~LayeredLayout() | 65 | LayeredLayout::~LayeredLayout() |
1558 | @@ -163,11 +163,6 @@ | |||
1559 | 163 | Layout *layout = NUX_STATIC_CAST(Layout *, _area); | 163 | Layout *layout = NUX_STATIC_CAST(Layout *, _area); |
1560 | 164 | layout->ProcessDraw(graphics_engine, force_draw); | 164 | layout->ProcessDraw(graphics_engine, force_draw); |
1561 | 165 | } | 165 | } |
1562 | 166 | else if (_area->IsArea()) | ||
1563 | 167 | { | ||
1564 | 168 | InputArea *area = NUX_STATIC_CAST(InputArea *, _area); | ||
1565 | 169 | area->OnDraw(graphics_engine, force_draw); | ||
1566 | 170 | } | ||
1567 | 171 | } | 166 | } |
1568 | 172 | 167 | ||
1569 | 173 | void LayeredLayout::ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw) | 168 | void LayeredLayout::ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw) |
1570 | @@ -204,7 +199,7 @@ | |||
1571 | 204 | } | 199 | } |
1572 | 205 | 200 | ||
1573 | 206 | graphics_engine.PopClippingRectangle(); | 201 | graphics_engine.PopClippingRectangle(); |
1575 | 207 | _queued_draw = false; | 202 | draw_cmd_queued_ = false; |
1576 | 208 | } | 203 | } |
1577 | 209 | 204 | ||
1578 | 210 | Area* LayeredLayout::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type) | 205 | Area* LayeredLayout::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type) |
1579 | 211 | 206 | ||
1580 | === modified file 'Nux/Layout.cpp' | |||
1581 | --- Nux/Layout.cpp 2012-05-31 21:50:05 +0000 | |||
1582 | +++ Nux/Layout.cpp 2012-09-18 11:05:23 +0000 | |||
1583 | @@ -41,7 +41,8 @@ | |||
1584 | 41 | m_contentWidth = 0; | 41 | m_contentWidth = 0; |
1585 | 42 | m_contentHeight = 0; | 42 | m_contentHeight = 0; |
1586 | 43 | m_ContentStacking = eStackExpand; | 43 | m_ContentStacking = eStackExpand; |
1588 | 44 | _queued_draw = false; | 44 | draw_cmd_queued_ = false; |
1589 | 45 | child_draw_cmd_queued_ = false; | ||
1590 | 45 | 46 | ||
1591 | 46 | SetMinimumSize(1, 1); | 47 | SetMinimumSize(1, 1); |
1592 | 47 | } | 48 | } |
1593 | @@ -146,13 +147,13 @@ | |||
1594 | 146 | left_padding_ = left < 0 ? 0 : left; | 147 | left_padding_ = left < 0 ? 0 : left; |
1595 | 147 | } | 148 | } |
1596 | 148 | 149 | ||
1598 | 149 | //! Deprecated. Use SetLeftRightPadding. | 150 | //! Deprecated. Use SetLeftAndRightPadding. |
1599 | 150 | void Layout::SetHorizontalExternalMargin(int padding) | 151 | void Layout::SetHorizontalExternalMargin(int padding) |
1600 | 151 | { | 152 | { |
1601 | 152 | SetLeftAndRightPadding(padding); | 153 | SetLeftAndRightPadding(padding); |
1602 | 153 | } | 154 | } |
1603 | 154 | 155 | ||
1605 | 155 | //! Deprecated. Use SetTopBottomPadding, | 156 | //! Deprecated. Use SetTopAndBottomPadding, |
1606 | 156 | void Layout::SetVerticalExternalMargin(int padding) | 157 | void Layout::SetVerticalExternalMargin(int padding) |
1607 | 157 | { | 158 | { |
1608 | 158 | SetTopAndBottomPadding(padding); | 159 | SetTopAndBottomPadding(padding); |
1609 | @@ -229,8 +230,8 @@ | |||
1610 | 229 | 230 | ||
1611 | 230 | layout->SetParentObject(this); | 231 | layout->SetParentObject(this); |
1612 | 231 | 232 | ||
1615 | 232 | layout->OnChildQueueDraw.connect(sigc::mem_fun(this, &Layout::ChildLayoutChildQueuedDraw)); | 233 | layout->child_queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw)); |
1616 | 233 | layout->OnQueueDraw.connect(sigc::mem_fun(this, &Layout::ChildLayoutQueuedDraw)); | 234 | layout->queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw)); |
1617 | 234 | 235 | ||
1618 | 235 | if (index < 0) | 236 | if (index < 0) |
1619 | 236 | index = NUX_LAYOUT_BEGIN; | 237 | index = NUX_LAYOUT_BEGIN; |
1620 | @@ -283,6 +284,9 @@ | |||
1621 | 283 | nuxAssertMsg(bo != 0, "[Layout::AddView] Invalid parameter."); | 284 | nuxAssertMsg(bo != 0, "[Layout::AddView] Invalid parameter."); |
1622 | 284 | NUX_RETURN_IF_TRUE(bo == 0); | 285 | NUX_RETURN_IF_TRUE(bo == 0); |
1623 | 285 | 286 | ||
1624 | 287 | if (!bo->IsView()) | ||
1625 | 288 | return; | ||
1626 | 289 | |||
1627 | 286 | Area *parent = bo->GetParentObject(); | 290 | Area *parent = bo->GetParentObject(); |
1628 | 287 | nuxAssertMsg(parent == 0, "[Layout::AddView] Trying to add an object that already has a parent."); | 291 | nuxAssertMsg(parent == 0, "[Layout::AddView] Trying to add an object that already has a parent."); |
1629 | 288 | NUX_RETURN_IF_TRUE(parent != 0); | 292 | NUX_RETURN_IF_TRUE(parent != 0); |
1630 | @@ -309,7 +313,10 @@ | |||
1631 | 309 | bo->SetParentObject(this); | 313 | bo->SetParentObject(this); |
1632 | 310 | 314 | ||
1633 | 311 | if (bo->IsView()) | 315 | if (bo->IsView()) |
1635 | 312 | static_cast<View *> (bo)->OnQueueDraw.connect(sigc::mem_fun(this, &Layout::ChildViewQueuedDraw)); | 316 | { |
1636 | 317 | static_cast<View*> (bo)->queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw)); | ||
1637 | 318 | static_cast<View*> (bo)->child_queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw)); | ||
1638 | 319 | } | ||
1639 | 313 | 320 | ||
1640 | 314 | //if(HasFocusControl() && HasFocusableEntries() == false) | 321 | //if(HasFocusControl() && HasFocusableEntries() == false) |
1641 | 315 | //{ | 322 | //{ |
1642 | @@ -492,77 +499,272 @@ | |||
1643 | 492 | void Layout::ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw) | 499 | void Layout::ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw) |
1644 | 493 | { | 500 | { |
1645 | 494 | std::list<Area *>::iterator it; | 501 | std::list<Area *>::iterator it; |
1679 | 495 | graphics_engine.PushModelViewMatrix(Get2DMatrix()); | 502 | |
1680 | 496 | 503 | if (RedirectRenderingToTexture()) | |
1681 | 497 | // Clip against the padding region. | 504 | { |
1682 | 498 | Geometry clip_geo = GetGeometry(); | 505 | if (update_backup_texture_ || force_draw || draw_cmd_queued_) |
1683 | 499 | clip_geo.OffsetPosition(left_padding_, top_padding_); | 506 | { |
1684 | 500 | clip_geo.OffsetSize(-left_padding_ - right_padding_, -top_padding_ - bottom_padding_); | 507 | GetPainter().PushPaintLayerStack(); |
1685 | 501 | 508 | BeginBackupTextureRendering(graphics_engine, force_draw); | |
1686 | 502 | graphics_engine.PushClippingRectangle(clip_geo); | 509 | { |
1687 | 503 | 510 | graphics_engine.PushModelViewMatrix(Get2DMatrix()); | |
1688 | 504 | for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++) | 511 | |
1689 | 505 | { | 512 | for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++) |
1690 | 506 | if (!(*it)->IsVisible()) | 513 | { |
1691 | 507 | continue; | 514 | if (!(*it)->IsVisible()) |
1692 | 508 | 515 | continue; | |
1693 | 509 | if ((*it)->IsView()) | 516 | |
1694 | 510 | { | 517 | if ((*it)->IsView()) |
1695 | 511 | View *ic = NUX_STATIC_CAST(View*, (*it)); | 518 | { |
1696 | 512 | ic->ProcessDraw(graphics_engine, force_draw); | 519 | View* view = static_cast<View*>(*it); |
1697 | 513 | } | 520 | view->ProcessDraw(graphics_engine, force_draw); |
1698 | 514 | else if ((*it)->IsLayout()) | 521 | } |
1699 | 515 | { | 522 | else if ((*it)->IsLayout()) |
1700 | 516 | Layout *layout = NUX_STATIC_CAST(Layout*, (*it)); | 523 | { |
1701 | 517 | layout->ProcessDraw(graphics_engine, force_draw); | 524 | Layout* layout = static_cast<Layout*>(*it); |
1702 | 518 | } | 525 | layout->ProcessDraw(graphics_engine, force_draw); |
1703 | 519 | // InputArea should be tested last | 526 | } |
1704 | 520 | else if ((*it)->IsInputArea()) | 527 | } |
1705 | 521 | { | 528 | graphics_engine.PopModelViewMatrix(); |
1706 | 522 | InputArea *input_area = NUX_STATIC_CAST(InputArea*, (*it)); | 529 | } |
1707 | 523 | input_area->OnDraw(graphics_engine, force_draw); | 530 | EndBackupTextureRendering(graphics_engine, force_draw); |
1708 | 524 | } | 531 | GetPainter().PopPaintLayerStack(); |
1709 | 525 | } | 532 | } |
1710 | 526 | 533 | ||
1711 | 527 | graphics_engine.PopClippingRectangle(); | 534 | if (PresentRedirectedView()) |
1712 | 535 | { | ||
1713 | 536 | unsigned int current_alpha_blend; | ||
1714 | 537 | unsigned int current_src_blend_factor; | ||
1715 | 538 | unsigned int current_dest_blend_factor; | ||
1716 | 539 | // Be a good citizen, get a copy of the current GPU sates according to Nux | ||
1717 | 540 | graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); | ||
1718 | 541 | |||
1719 | 542 | TexCoordXForm texxform; | ||
1720 | 543 | //Geometry xform_geo = GetGraphicsDisplay()->GetGraphicsEngine()->ModelViewXFormRect(GetGeometry()); | ||
1721 | 544 | if ((force_draw || draw_cmd_queued_) && background_texture_.IsValid()) | ||
1722 | 545 | { | ||
1723 | 546 | graphics_engine.GetRenderStates().SetBlend(false); | ||
1724 | 547 | texxform.FlipVCoord(true); | ||
1725 | 548 | // Draw the background of this view. | ||
1726 | 549 | GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), background_texture_->GetWidth(), background_texture_->GetHeight(), background_texture_, texxform, color::White); | ||
1727 | 550 | } | ||
1728 | 551 | |||
1729 | 552 | texxform.uwrap = TEXWRAP_CLAMP; | ||
1730 | 553 | texxform.vwrap = TEXWRAP_CLAMP; | ||
1731 | 554 | texxform.FlipVCoord(true); | ||
1732 | 555 | |||
1733 | 556 | graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | ||
1734 | 557 | GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), GetWidth(), GetHeight(), backup_texture_, texxform, Color(color::White)); | ||
1735 | 558 | // Be a good citizen, restore the Nux blending states. | ||
1736 | 559 | graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); | ||
1737 | 560 | } | ||
1738 | 561 | } | ||
1739 | 562 | else | ||
1740 | 563 | { | ||
1741 | 564 | graphics_engine.PushModelViewMatrix(Get2DMatrix()); | ||
1742 | 565 | |||
1743 | 566 | // Clip against the padding region. | ||
1744 | 567 | Geometry clip_geo = GetGeometry(); | ||
1745 | 568 | clip_geo.OffsetPosition(left_padding_, top_padding_); | ||
1746 | 569 | clip_geo.OffsetSize(-left_padding_ - right_padding_, -top_padding_ - bottom_padding_); | ||
1747 | 570 | |||
1748 | 571 | graphics_engine.PushClippingRectangle(clip_geo); | ||
1749 | 572 | |||
1750 | 573 | for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++) | ||
1751 | 574 | { | ||
1752 | 575 | if (!(*it)->IsVisible()) | ||
1753 | 576 | continue; | ||
1754 | 577 | |||
1755 | 578 | if ((*it)->IsView()) | ||
1756 | 579 | { | ||
1757 | 580 | View* view = static_cast<View*>(*it); | ||
1758 | 581 | view->ProcessDraw(graphics_engine, force_draw); | ||
1759 | 582 | } | ||
1760 | 583 | else if ((*it)->IsLayout()) | ||
1761 | 584 | { | ||
1762 | 585 | Layout* layout = static_cast<Layout*>(*it); | ||
1763 | 586 | layout->ProcessDraw(graphics_engine, force_draw); | ||
1764 | 587 | } | ||
1765 | 588 | } | ||
1766 | 589 | |||
1767 | 590 | graphics_engine.PopClippingRectangle(); | ||
1768 | 591 | graphics_engine.PopModelViewMatrix(); | ||
1769 | 592 | } | ||
1770 | 593 | |||
1771 | 594 | ResetQueueDraw(); | ||
1772 | 595 | } | ||
1773 | 596 | |||
1774 | 597 | void Layout::BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw) | ||
1775 | 598 | { | ||
1776 | 599 | ObjectPtr<IOpenGLBaseTexture> active_fbo_texture; | ||
1777 | 600 | if (force_draw || draw_cmd_queued_) | ||
1778 | 601 | { | ||
1779 | 602 | // Get the active fbo color texture | ||
1780 | 603 | active_fbo_texture = GetGraphicsDisplay()->GetGpuDevice()->ActiveFboTextureAttachment(0); | ||
1781 | 604 | } | ||
1782 | 605 | |||
1783 | 606 | Geometry xform_geo; | ||
1784 | 607 | // Compute position in the active fbo texture. | ||
1785 | 608 | xform_geo = graphics_engine.ModelViewXFormRect(GetGeometry()); | ||
1786 | 609 | |||
1787 | 610 | // Get the current fbo... | ||
1788 | 611 | prev_fbo_ = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject(); | ||
1789 | 612 | // ... and the size of the view port rectangle. | ||
1790 | 613 | prev_viewport_ = graphics_engine.GetViewportRect(); | ||
1791 | 614 | |||
1792 | 615 | const int width = GetWidth(); | ||
1793 | 616 | const int height = GetHeight(); | ||
1794 | 617 | |||
1795 | 618 | // Compute intersection with active fbo. | ||
1796 | 619 | Geometry intersection = xform_geo; | ||
1797 | 620 | if (active_fbo_texture.IsValid()) | ||
1798 | 621 | { | ||
1799 | 622 | Geometry active_fbo_geo(0, 0, active_fbo_texture->GetWidth(), active_fbo_texture->GetHeight()); | ||
1800 | 623 | intersection = active_fbo_geo.Intersect(xform_geo); | ||
1801 | 624 | } | ||
1802 | 625 | |||
1803 | 626 | if (backup_fbo_.IsNull()) | ||
1804 | 627 | { | ||
1805 | 628 | // Create the fbo before using it for the first time. | ||
1806 | 629 | backup_fbo_ = GetGraphicsDisplay()->GetGpuDevice()->CreateFrameBufferObject(); | ||
1807 | 630 | } | ||
1808 | 631 | |||
1809 | 632 | if (!backup_texture_.IsValid() || (backup_texture_->GetWidth() != width) || (backup_texture_->GetHeight() != height)) | ||
1810 | 633 | { | ||
1811 | 634 | // Create or resize the color and depth textures before using them. | ||
1812 | 635 | backup_texture_ = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(width, height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | ||
1813 | 636 | backup_depth_texture_ = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(width, height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | ||
1814 | 637 | } | ||
1815 | 638 | |||
1816 | 639 | if (!background_texture_.IsValid() || (background_texture_->GetWidth() != intersection.width) || (background_texture_->GetHeight() != intersection.height)) | ||
1817 | 640 | { | ||
1818 | 641 | background_texture_ = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(intersection.width, intersection.height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | ||
1819 | 642 | } | ||
1820 | 643 | |||
1821 | 644 | // Draw the background on the previous fbo texture | ||
1822 | 645 | if ((force_draw || draw_cmd_queued_) && background_texture_.IsValid()) | ||
1823 | 646 | { | ||
1824 | 647 | backup_fbo_->FormatFrameBufferObject(intersection.width, intersection.height, BITFMT_R8G8B8A8); | ||
1825 | 648 | backup_fbo_->EmptyClippingRegion(); | ||
1826 | 649 | |||
1827 | 650 | graphics_engine.SetViewport(0, 0, intersection.width, intersection.height); | ||
1828 | 651 | graphics_engine.SetOrthographicProjectionMatrix(intersection.width, intersection.height); | ||
1829 | 652 | |||
1830 | 653 | // Set the background texture in the fbo | ||
1831 | 654 | backup_fbo_->SetTextureAttachment(0, background_texture_, 0); | ||
1832 | 655 | backup_fbo_->SetDepthTextureAttachment(ObjectPtr<IOpenGLBaseTexture>(0), 0); | ||
1833 | 656 | backup_fbo_->Activate(); | ||
1834 | 657 | graphics_engine.SetViewport(0, 0, background_texture_->GetWidth(), background_texture_->GetHeight()); | ||
1835 | 658 | |||
1836 | 659 | // Clear surface | ||
1837 | 660 | CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f)); | ||
1838 | 661 | CHECKGL(glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)); | ||
1839 | 662 | |||
1840 | 663 | TexCoordXForm texxform; | ||
1841 | 664 | texxform.uoffset = xform_geo.x / (float) active_fbo_texture->GetWidth(); | ||
1842 | 665 | texxform.voffset = xform_geo.y / (float) active_fbo_texture->GetHeight(); | ||
1843 | 666 | texxform.SetTexCoordType(TexCoordXForm::OFFSET_COORD); | ||
1844 | 667 | texxform.flip_v_coord = true; | ||
1845 | 668 | |||
1846 | 669 | // Temporarily change the model-view matrix to copy the texture background texture. | ||
1847 | 670 | // This way we are not affceted by the regular model-view matrix. | ||
1848 | 671 | graphics_engine.SetModelViewMatrix(Matrix4::IDENTITY()); | ||
1849 | 672 | // Copy the texture from the previous fbo attachment into our background texture. | ||
1850 | 673 | if (copy_previous_fbo_for_background_) | ||
1851 | 674 | { | ||
1852 | 675 | graphics_engine.QRP_1Tex(0, 0, intersection.width, intersection.height, active_fbo_texture, texxform, color::White); | ||
1853 | 676 | } | ||
1854 | 677 | else | ||
1855 | 678 | { | ||
1856 | 679 | graphics_engine.QRP_Color(0, 0, intersection.width, intersection.height, Color(0.0f, 0.0f, 0.0f, 0.0f)); | ||
1857 | 680 | } | ||
1858 | 681 | // Restore the model-view matrix. | ||
1859 | 682 | graphics_engine.ApplyModelViewMatrix(); | ||
1860 | 683 | } | ||
1861 | 684 | |||
1862 | 685 | backup_fbo_->FormatFrameBufferObject(width, height, BITFMT_R8G8B8A8); | ||
1863 | 686 | backup_fbo_->EmptyClippingRegion(); | ||
1864 | 687 | backup_fbo_->SetTextureAttachment(0, backup_texture_, 0); | ||
1865 | 688 | backup_fbo_->SetDepthTextureAttachment(backup_depth_texture_, 0); | ||
1866 | 689 | backup_fbo_->Activate(); | ||
1867 | 690 | |||
1868 | 691 | if (force_draw || draw_cmd_queued_) | ||
1869 | 692 | { | ||
1870 | 693 | CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f)); | ||
1871 | 694 | CHECKGL(glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)); | ||
1872 | 695 | } | ||
1873 | 696 | |||
1874 | 697 | graphics_engine.SetViewport(0, 0, width, height); | ||
1875 | 698 | graphics_engine.SetOrthographicProjectionMatrix(width, height); | ||
1876 | 699 | // Transform the geometry of this area through the current model view matrix. This gives the | ||
1877 | 700 | // the position of the view in the active fbo texture. | ||
1878 | 701 | Geometry offset_rect = graphics_engine.ModelViewXFormRect(GetGeometry()); | ||
1879 | 702 | int x_offset = -offset_rect.x; | ||
1880 | 703 | int y_offset = -offset_rect.y; | ||
1881 | 704 | graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(x_offset, y_offset, 0)); | ||
1882 | 705 | } | ||
1883 | 706 | |||
1884 | 707 | void Layout::EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw) | ||
1885 | 708 | { | ||
1886 | 528 | graphics_engine.PopModelViewMatrix(); | 709 | graphics_engine.PopModelViewMatrix(); |
1887 | 529 | 710 | ||
1891 | 530 | //graphics_engine.PopClipOffset(); | 711 | if (prev_fbo_.IsValid()) |
1892 | 531 | 712 | { | |
1893 | 532 | _queued_draw = false; | 713 | // Restore the previous fbo |
1894 | 714 | prev_fbo_->Activate(); | ||
1895 | 715 | |||
1896 | 716 | prev_fbo_->ApplyClippingRegion(); | ||
1897 | 717 | } | ||
1898 | 718 | |||
1899 | 719 | // Release the reference on the previous fbo | ||
1900 | 720 | prev_fbo_.Release(); | ||
1901 | 721 | |||
1902 | 722 | // Restore the matrices and the view port. | ||
1903 | 723 | graphics_engine.ApplyModelViewMatrix(); | ||
1904 | 724 | graphics_engine.SetOrthographicProjectionMatrix(prev_viewport_.width, prev_viewport_.height); | ||
1905 | 725 | graphics_engine.SetViewport(prev_viewport_.x, prev_viewport_.y, prev_viewport_.width, prev_viewport_.height); | ||
1906 | 533 | } | 726 | } |
1907 | 534 | 727 | ||
1908 | 535 | void Layout::QueueDraw() | 728 | void Layout::QueueDraw() |
1909 | 536 | { | 729 | { |
1911 | 537 | if (_queued_draw) | 730 | if (draw_cmd_queued_) |
1912 | 538 | { | 731 | { |
1913 | 539 | // A draw has already been scheduled. | 732 | // A draw has already been scheduled. |
1914 | 540 | return; | 733 | return; |
1915 | 541 | } | 734 | } |
1916 | 542 | 735 | ||
1918 | 543 | std::list<Area *>::iterator it; | 736 | // Report to a parent view with redirect_rendering_to_texture_ set to true that one of its children |
1919 | 737 | // needs to be redrawn. | ||
1920 | 738 | PrepareParentRedirectedView(); | ||
1921 | 739 | |||
1922 | 740 | std::list<Area*>::iterator it; | ||
1923 | 544 | 741 | ||
1924 | 545 | for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++) | 742 | for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++) |
1925 | 546 | { | 743 | { |
1926 | 547 | if ((*it)->IsView()) | 744 | if ((*it)->IsView()) |
1927 | 548 | { | 745 | { |
1930 | 549 | View *ic = NUX_STATIC_CAST(View *, (*it)); | 746 | View* view = static_cast<View*>(*it); |
1931 | 550 | ic->QueueDraw(); | 747 | view->QueueDraw(); |
1932 | 551 | } | 748 | } |
1933 | 552 | else if ((*it)->IsLayout()) | 749 | else if ((*it)->IsLayout()) |
1934 | 553 | { | 750 | { |
1936 | 554 | Layout *layout = NUX_STATIC_CAST(Layout *, (*it)); | 751 | Layout* layout = static_cast<Layout*>(*it); |
1937 | 555 | layout->QueueDraw(); | 752 | layout->QueueDraw(); |
1938 | 556 | } | 753 | } |
1939 | 557 | } | 754 | } |
1940 | 558 | 755 | ||
1943 | 559 | _queued_draw = true; | 756 | draw_cmd_queued_ = true; |
1944 | 560 | OnQueueDraw.emit(this); | 757 | queue_draw.emit(this); |
1945 | 561 | } | 758 | } |
1946 | 562 | 759 | ||
1947 | 563 | bool Layout::IsQueuedForDraw() | 760 | bool Layout::IsQueuedForDraw() |
1948 | 564 | { | 761 | { |
1950 | 565 | return _queued_draw; | 762 | return draw_cmd_queued_; |
1951 | 763 | } | ||
1952 | 764 | |||
1953 | 765 | bool Layout::ChildQueuedForDraw() | ||
1954 | 766 | { | ||
1955 | 767 | return child_draw_cmd_queued_; | ||
1956 | 566 | } | 768 | } |
1957 | 567 | 769 | ||
1958 | 568 | void Layout::SetContentDistribution(LayoutContentDistribution stacking) | 770 | void Layout::SetContentDistribution(LayoutContentDistribution stacking) |
1959 | @@ -580,19 +782,12 @@ | |||
1960 | 580 | 782 | ||
1961 | 581 | } | 783 | } |
1962 | 582 | 784 | ||
1976 | 583 | void Layout::ChildViewQueuedDraw(View *view) | 785 | void Layout::ChildQueueDraw(Area* area) |
1977 | 584 | { | 786 | { |
1978 | 585 | OnChildQueueDraw.emit(view); | 787 | if (child_draw_cmd_queued_) |
1979 | 586 | } | 788 | return; |
1980 | 587 | 789 | child_draw_cmd_queued_ = true; | |
1981 | 588 | void Layout::ChildLayoutQueuedDraw(Layout *layout) | 790 | child_queue_draw.emit(area); |
1969 | 589 | { | ||
1970 | 590 | OnChildQueueDraw.emit(layout); | ||
1971 | 591 | } | ||
1972 | 592 | |||
1973 | 593 | void Layout::ChildLayoutChildQueuedDraw(Area *area) | ||
1974 | 594 | { | ||
1975 | 595 | OnChildQueueDraw.emit(area); | ||
1982 | 596 | } | 791 | } |
1983 | 597 | 792 | ||
1984 | 598 | bool Layout::AcceptKeyNavFocus() | 793 | bool Layout::AcceptKeyNavFocus() |
1985 | @@ -600,6 +795,54 @@ | |||
1986 | 600 | return false; | 795 | return false; |
1987 | 601 | } | 796 | } |
1988 | 602 | 797 | ||
1989 | 798 | void Layout::ResetQueueDraw() | ||
1990 | 799 | { | ||
1991 | 800 | std::list<Area*>::iterator it; | ||
1992 | 801 | for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++) | ||
1993 | 802 | { | ||
1994 | 803 | if ((*it)->IsLayout()) | ||
1995 | 804 | { | ||
1996 | 805 | Layout* layout = NUX_STATIC_CAST(Layout*, (*it)); | ||
1997 | 806 | if (layout->ChildQueuedForDraw()) | ||
1998 | 807 | { | ||
1999 | 808 | layout->ResetQueueDraw(); | ||
2000 | 809 | } | ||
2001 | 810 | } | ||
2002 | 811 | else if ((*it)->IsView()) | ||
2003 | 812 | { | ||
2004 | 813 | View* view = NUX_STATIC_CAST(View*, (*it)); | ||
2005 | 814 | if (view->GetLayout()) | ||
2006 | 815 | { | ||
2007 | 816 | view->GetLayout()->ResetQueueDraw(); | ||
2008 | 817 | view->draw_cmd_queued_ = false; | ||
2009 | 818 | view->child_draw_cmd_queued_ = false; | ||
2010 | 819 | } | ||
2011 | 820 | } | ||
2012 | 821 | } | ||
2013 | 822 | |||
2014 | 823 | draw_cmd_queued_ = false; | ||
2015 | 824 | child_draw_cmd_queued_ = false; | ||
2016 | 825 | update_backup_texture_ = false; | ||
2017 | 826 | } | ||
2018 | 827 | |||
2019 | 828 | void Layout::GeometryChangePending(bool position_about_to_change, bool size_about_to_change) | ||
2020 | 829 | { | ||
2021 | 830 | if (IsLayoutDone()) | ||
2022 | 831 | QueueDraw(); | ||
2023 | 832 | } | ||
2024 | 833 | |||
2025 | 834 | void Layout::GeometryChanged(bool position_has_changed, bool size_has_changed) | ||
2026 | 835 | { | ||
2027 | 836 | if (RedirectedAncestor()) | ||
2028 | 837 | { | ||
2029 | 838 | if (size_has_changed) | ||
2030 | 839 | QueueDraw(); | ||
2031 | 840 | return; | ||
2032 | 841 | } | ||
2033 | 842 | if (IsLayoutDone()) | ||
2034 | 843 | QueueDraw(); | ||
2035 | 844 | } | ||
2036 | 845 | |||
2037 | 603 | #ifdef NUX_GESTURES_SUPPORT | 846 | #ifdef NUX_GESTURES_SUPPORT |
2038 | 604 | Area* Layout::GetInputAreaHitByGesture(const GestureEvent &event) | 847 | Area* Layout::GetInputAreaHitByGesture(const GestureEvent &event) |
2039 | 605 | { | 848 | { |
2040 | 606 | 849 | ||
2041 | === modified file 'Nux/Layout.h' | |||
2042 | --- Nux/Layout.h 2012-05-31 21:50:05 +0000 | |||
2043 | +++ Nux/Layout.h 2012-09-18 11:05:23 +0000 | |||
2044 | @@ -137,10 +137,10 @@ | |||
2045 | 137 | }; | 137 | }; |
2046 | 138 | 138 | ||
2047 | 139 | 139 | ||
2049 | 140 | //! Deprecated. Use SetLeftRightPadding. | 140 | //! Deprecated. Use SetLeftAndRightPadding. |
2050 | 141 | void SetHorizontalExternalMargin(int m); | 141 | void SetHorizontalExternalMargin(int m); |
2051 | 142 | 142 | ||
2053 | 143 | //! Deprecated. Use SetTopBottomPadding, | 143 | //! Deprecated. Use SetTopAndBottomPadding, |
2054 | 144 | void SetVerticalExternalMargin(int m); | 144 | void SetVerticalExternalMargin(int m); |
2055 | 145 | 145 | ||
2056 | 146 | //! Set the left/right/top/bottom padding of the layout. | 146 | //! Set the left/right/top/bottom padding of the layout. |
2057 | @@ -199,7 +199,7 @@ | |||
2058 | 199 | /*! | 199 | /*! |
2059 | 200 | Mark all element in the layout as dirty. This will also mark all sub elements as dirty. | 200 | Mark all element in the layout as dirty. This will also mark all sub elements as dirty. |
2060 | 201 | InputArea element are not marked as dirty(they don't have the flags). | 201 | InputArea element are not marked as dirty(they don't have the flags). |
2062 | 202 | Emits the signal \i OnQueueDraw. | 202 | Emits the signal \i queue_draw. |
2063 | 203 | */ | 203 | */ |
2064 | 204 | virtual void QueueDraw(); | 204 | virtual void QueueDraw(); |
2065 | 205 | 205 | ||
2066 | @@ -209,6 +209,12 @@ | |||
2067 | 209 | */ | 209 | */ |
2068 | 210 | bool IsQueuedForDraw(); | 210 | bool IsQueuedForDraw(); |
2069 | 211 | 211 | ||
2070 | 212 | //! Return true if a draw has been scheduled for a child of this layout | ||
2071 | 213 | /*! | ||
2072 | 214 | @return True if a draw has been scheduled for a child of this layout. | ||
2073 | 215 | */ | ||
2074 | 216 | bool ChildQueuedForDraw(); | ||
2075 | 217 | |||
2076 | 212 | //! Define how elements are spread out inside the layout. | 218 | //! Define how elements are spread out inside the layout. |
2077 | 213 | /*! | 219 | /*! |
2078 | 214 | Typically, a layout stacks it elements from left to right(HLayout) or top to bottom(VLayout). | 220 | Typically, a layout stacks it elements from left to right(HLayout) or top to bottom(VLayout). |
2079 | @@ -240,23 +246,34 @@ | |||
2080 | 240 | return _layout_element_list; | 246 | return _layout_element_list; |
2081 | 241 | } | 247 | } |
2082 | 242 | 248 | ||
2086 | 243 | virtual void ChildViewQueuedDraw(View *view); | 249 | virtual void ChildQueueDraw(Area* area); |
2084 | 244 | virtual void ChildLayoutQueuedDraw(Layout *layout); | ||
2085 | 245 | virtual void ChildLayoutChildQueuedDraw(Area *area); | ||
2087 | 246 | 250 | ||
2090 | 247 | sigc::signal<void, Layout*> OnQueueDraw; //!< Signal emitted when a layout is scheduled for a draw. | 251 | sigc::signal<void, Layout*> queue_draw; //!< Signal emitted when a layout is scheduled for a draw. |
2091 | 248 | sigc::signal<void, Area*> OnChildQueueDraw; | 252 | sigc::signal<void, Area*> child_queue_draw; |
2092 | 249 | sigc::signal<void, Layout*, Area*> ViewAdded; | 253 | sigc::signal<void, Layout*, Area*> ViewAdded; |
2093 | 250 | sigc::signal<void, Layout*, Area*> ViewRemoved; | 254 | sigc::signal<void, Layout*, Area*> ViewRemoved; |
2094 | 251 | 255 | ||
2095 | 252 | #ifdef NUX_GESTURES_SUPPORT | 256 | #ifdef NUX_GESTURES_SUPPORT |
2096 | 253 | virtual Area* GetInputAreaHitByGesture(const GestureEvent &event); | 257 | virtual Area* GetInputAreaHitByGesture(const GestureEvent &event); |
2097 | 254 | #endif | 258 | #endif |
2098 | 259 | |||
2099 | 260 | /*! | ||
2100 | 261 | When a layout goes through Layout::ProcessDraw, this call isn't necessary. Otherwise, call it | ||
2101 | 262 | to set the value of draw_cmd_queued_ to false. | ||
2102 | 263 | */ | ||
2103 | 264 | virtual void ResetQueueDraw(); | ||
2104 | 255 | 265 | ||
2105 | 256 | protected: | 266 | protected: |
2106 | 267 | void BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw); | ||
2107 | 268 | void EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw); | ||
2108 | 269 | |||
2109 | 270 | virtual void GeometryChangePending(bool position_about_to_change, bool size_about_to_change); | ||
2110 | 271 | virtual void GeometryChanged(bool position_has_changed, bool size_has_changed); | ||
2111 | 272 | |||
2112 | 257 | virtual bool AcceptKeyNavFocus(); | 273 | virtual bool AcceptKeyNavFocus(); |
2113 | 258 | 274 | ||
2115 | 259 | bool _queued_draw; //<! The rendering of the layout needs to be refreshed. | 275 | bool draw_cmd_queued_; //<! The rendering of the layout needs to be refreshed. |
2116 | 276 | bool child_draw_cmd_queued_; //<! A child of this layout has requested a draw. | ||
2117 | 260 | 277 | ||
2118 | 261 | Size m_ContentSize; | 278 | Size m_ContentSize; |
2119 | 262 | int m_contentWidth; | 279 | int m_contentWidth; |
2120 | 263 | 280 | ||
2121 | === modified file 'Nux/LinearLayout.cpp' | |||
2122 | --- Nux/LinearLayout.cpp 2011-10-17 20:57:35 +0000 | |||
2123 | +++ Nux/LinearLayout.cpp 2012-09-18 11:05:23 +0000 | |||
2124 | @@ -73,8 +73,8 @@ | |||
2125 | 73 | 73 | ||
2126 | 74 | layout->SetParentObject(this); | 74 | layout->SetParentObject(this); |
2127 | 75 | 75 | ||
2130 | 76 | layout->OnChildQueueDraw.connect(sigc::mem_fun(this, &Layout::ChildLayoutChildQueuedDraw)); | 76 | layout->child_queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw)); |
2131 | 77 | layout->OnQueueDraw.connect(sigc::mem_fun(this, &Layout::ChildLayoutQueuedDraw)); | 77 | layout->queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw)); |
2132 | 78 | 78 | ||
2133 | 79 | if (index < 0) | 79 | if (index < 0) |
2134 | 80 | index = NUX_LAYOUT_BEGIN; | 80 | index = NUX_LAYOUT_BEGIN; |
2135 | @@ -153,7 +153,7 @@ | |||
2136 | 153 | bo->SetParentObject(this); | 153 | bo->SetParentObject(this); |
2137 | 154 | 154 | ||
2138 | 155 | if (bo->IsView()) | 155 | if (bo->IsView()) |
2140 | 156 | static_cast<View *> (bo)->OnQueueDraw.connect(sigc::mem_fun(this, &Layout::ChildViewQueuedDraw)); | 156 | (static_cast<View *> (bo))->queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw)); |
2141 | 157 | 157 | ||
2142 | 158 | //if(HasFocusControl() && HasFocusableEntries() == false) | 158 | //if(HasFocusControl() && HasFocusableEntries() == false) |
2143 | 159 | //{ | 159 | //{ |
2144 | 160 | 160 | ||
2145 | === modified file 'Nux/MainLoopGLib.cpp' | |||
2146 | --- Nux/MainLoopGLib.cpp 2012-05-31 21:40:37 +0000 | |||
2147 | +++ Nux/MainLoopGLib.cpp 2012-09-18 11:05:23 +0000 | |||
2148 | @@ -1,4 +1,3 @@ | |||
2149 | 1 | #include "Features.h" | ||
2150 | 2 | #include "Nux.h" | 1 | #include "Nux.h" |
2151 | 3 | #include "Layout.h" | 2 | #include "Layout.h" |
2152 | 4 | #include "NuxCore/Logger.h" | 3 | #include "NuxCore/Logger.h" |
2153 | 5 | 4 | ||
2154 | === modified file 'Nux/Makefile.am' | |||
2155 | --- Nux/Makefile.am 2012-07-27 19:40:40 +0000 | |||
2156 | +++ Nux/Makefile.am 2012-09-18 11:05:23 +0000 | |||
2157 | @@ -41,6 +41,7 @@ | |||
2158 | 41 | $(srcdir)/InputArea.cpp \ | 41 | $(srcdir)/InputArea.cpp \ |
2159 | 42 | $(srcdir)/Area.cpp \ | 42 | $(srcdir)/Area.cpp \ |
2160 | 43 | $(srcdir)/BaseWindow.cpp \ | 43 | $(srcdir)/BaseWindow.cpp \ |
2161 | 44 | $(srcdir)/BasicView.cpp \ | ||
2162 | 44 | $(srcdir)/Button.cpp \ | 45 | $(srcdir)/Button.cpp \ |
2163 | 45 | $(srcdir)/Canvas.cpp \ | 46 | $(srcdir)/Canvas.cpp \ |
2164 | 46 | $(srcdir)/CairoWrapper.cpp \ | 47 | $(srcdir)/CairoWrapper.cpp \ |
2165 | @@ -135,6 +136,7 @@ | |||
2166 | 135 | $(srcdir)/InputArea.h \ | 136 | $(srcdir)/InputArea.h \ |
2167 | 136 | $(srcdir)/Area.h \ | 137 | $(srcdir)/Area.h \ |
2168 | 137 | $(srcdir)/BaseWindow.h \ | 138 | $(srcdir)/BaseWindow.h \ |
2169 | 139 | $(srcdir)/BasicView.h \ | ||
2170 | 138 | $(srcdir)/Button.h \ | 140 | $(srcdir)/Button.h \ |
2171 | 139 | $(srcdir)/Canvas.h \ | 141 | $(srcdir)/Canvas.h \ |
2172 | 140 | $(srcdir)/CairoWrapper.h \ | 142 | $(srcdir)/CairoWrapper.h \ |
2173 | @@ -171,6 +173,7 @@ | |||
2174 | 171 | $(srcdir)/MouseAreaCtrl.h \ | 173 | $(srcdir)/MouseAreaCtrl.h \ |
2175 | 172 | $(srcdir)/NumericValuator.h \ | 174 | $(srcdir)/NumericValuator.h \ |
2176 | 173 | $(srcdir)/Nux.h \ | 175 | $(srcdir)/Nux.h \ |
2177 | 176 | $(srcdir)/NuxTimerTickSource.h \ | ||
2178 | 174 | $(srcdir)/NuxGlobalInitializer.h \ | 177 | $(srcdir)/NuxGlobalInitializer.h \ |
2179 | 175 | $(srcdir)/Painter.h \ | 178 | $(srcdir)/Painter.h \ |
2180 | 176 | $(srcdir)/Panel.h \ | 179 | $(srcdir)/Panel.h \ |
2181 | 177 | 180 | ||
2182 | === modified file 'Nux/MenuBar.cpp' | |||
2183 | --- Nux/MenuBar.cpp 2012-08-27 09:09:21 +0000 | |||
2184 | +++ Nux/MenuBar.cpp 2012-09-18 11:05:23 +0000 | |||
2185 | @@ -41,7 +41,7 @@ | |||
2186 | 41 | : Object(true, NUX_FILE_LINE_PARAM) | 41 | : Object(true, NUX_FILE_LINE_PARAM) |
2187 | 42 | { | 42 | { |
2188 | 43 | // This area is added to the layout of the MenuBar. The Menubar will will ref/unref it. | 43 | // This area is added to the layout of the MenuBar. The Menubar will will ref/unref it. |
2190 | 44 | area = new InputArea(NUX_TRACKER_LOCATION); | 44 | area = new BasicView(NUX_TRACKER_LOCATION); |
2191 | 45 | icon = 0; | 45 | icon = 0; |
2192 | 46 | } | 46 | } |
2193 | 47 | 47 | ||
2194 | @@ -97,7 +97,7 @@ | |||
2195 | 97 | 97 | ||
2196 | 98 | for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++) | 98 | for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++) |
2197 | 99 | { | 99 | { |
2199 | 100 | InputArea *area = (*it)->area; | 100 | BasicView *area = (*it)->area; |
2200 | 101 | item_geometry = area->GetGeometry(); | 101 | item_geometry = area->GetGeometry(); |
2201 | 102 | 102 | ||
2202 | 103 | if (area->IsMouseInside()) | 103 | if (area->IsMouseInside()) |
2203 | @@ -151,7 +151,7 @@ | |||
2204 | 151 | 151 | ||
2205 | 152 | if (m_MenuIsActive) | 152 | if (m_MenuIsActive) |
2206 | 153 | { | 153 | { |
2208 | 154 | InputArea *area = m_CurrentMenu->area; | 154 | BasicView *area = m_CurrentMenu->area; |
2209 | 155 | item_geometry = area->GetGeometry(); | 155 | item_geometry = area->GetGeometry(); |
2210 | 156 | GetPainter().PaintBackground(graphics_engine, item_geometry); | 156 | GetPainter().PaintBackground(graphics_engine, item_geometry); |
2211 | 157 | GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000)); | 157 | GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000)); |
2212 | @@ -342,7 +342,7 @@ | |||
2213 | 342 | // | 342 | // |
2214 | 343 | // for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++) | 343 | // for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++) |
2215 | 344 | // { | 344 | // { |
2217 | 345 | // InputArea *area = (*it)->area; | 345 | // BasicView *area = (*it)->area; |
2218 | 346 | // Geometry geometry = area->GetGeometry(); | 346 | // Geometry geometry = area->GetGeometry(); |
2219 | 347 | // | 347 | // |
2220 | 348 | // if (geometry.IsPointInside(winx, winy)) | 348 | // if (geometry.IsPointInside(winx, winy)) |
2221 | @@ -407,7 +407,7 @@ | |||
2222 | 407 | 407 | ||
2223 | 408 | for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++) | 408 | for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++) |
2224 | 409 | { | 409 | { |
2226 | 410 | InputArea *area = (*it)->area; | 410 | BasicView *area = (*it)->area; |
2227 | 411 | geometry = area->GetGeometry(); | 411 | geometry = area->GetGeometry(); |
2228 | 412 | 412 | ||
2229 | 413 | if (geometry.IsPointInside(x, y)) | 413 | if (geometry.IsPointInside(x, y)) |
2230 | 414 | 414 | ||
2231 | === modified file 'Nux/MenuBar.h' | |||
2232 | --- Nux/MenuBar.h 2011-10-17 21:23:50 +0000 | |||
2233 | +++ Nux/MenuBar.h 2012-09-18 11:05:23 +0000 | |||
2234 | @@ -45,7 +45,7 @@ | |||
2235 | 45 | MenuBarItem(NUX_FILE_LINE_PROTO); | 45 | MenuBarItem(NUX_FILE_LINE_PROTO); |
2236 | 46 | ~MenuBarItem(); | 46 | ~MenuBarItem(); |
2237 | 47 | private: | 47 | private: |
2239 | 48 | InputArea *area; | 48 | BasicView *area; |
2240 | 49 | MenuPage *menu; | 49 | MenuPage *menu; |
2241 | 50 | BaseTexture *icon; // should be 24x24 | 50 | BaseTexture *icon; // should be 24x24 |
2242 | 51 | 51 | ||
2243 | 52 | 52 | ||
2244 | === modified file 'Nux/MouseAreaCtrl.cpp' | |||
2245 | --- Nux/MouseAreaCtrl.cpp 2011-10-10 01:52:00 +0000 | |||
2246 | +++ Nux/MouseAreaCtrl.cpp 2012-09-18 11:05:23 +0000 | |||
2247 | @@ -31,7 +31,7 @@ | |||
2248 | 31 | { | 31 | { |
2249 | 32 | // Set Original State | 32 | // Set Original State |
2250 | 33 | m_vlayout = new VLayout(NUX_TRACKER_LOCATION); | 33 | m_vlayout = new VLayout(NUX_TRACKER_LOCATION); |
2252 | 34 | m_Area = new InputArea(NUX_TRACKER_LOCATION); | 34 | m_Area = new BasicView(NUX_TRACKER_LOCATION); |
2253 | 35 | 35 | ||
2254 | 36 | // Set Signals | 36 | // Set Signals |
2255 | 37 | m_Area->mouse_down.connect(sigc::mem_fun(this, &MouseAreaCtrl::MouseDown)); | 37 | m_Area->mouse_down.connect(sigc::mem_fun(this, &MouseAreaCtrl::MouseDown)); |
2256 | 38 | 38 | ||
2257 | === modified file 'Nux/MouseAreaCtrl.h' | |||
2258 | --- Nux/MouseAreaCtrl.h 2011-10-10 01:52:00 +0000 | |||
2259 | +++ Nux/MouseAreaCtrl.h 2012-09-18 11:05:23 +0000 | |||
2260 | @@ -64,7 +64,7 @@ | |||
2261 | 64 | 64 | ||
2262 | 65 | private: | 65 | private: |
2263 | 66 | VLayout *m_vlayout; | 66 | VLayout *m_vlayout; |
2265 | 67 | InputArea *m_Area; | 67 | BasicView *m_Area; |
2266 | 68 | 68 | ||
2267 | 69 | public: | 69 | public: |
2268 | 70 | virtual void SetGeometry(const Geometry &geo) | 70 | virtual void SetGeometry(const Geometry &geo) |
2269 | 71 | 71 | ||
2270 | === modified file 'Nux/Nux.cpp' | |||
2271 | --- Nux/Nux.cpp 2011-12-29 18:06:53 +0000 | |||
2272 | +++ Nux/Nux.cpp 2012-09-18 11:05:23 +0000 | |||
2273 | @@ -172,6 +172,7 @@ | |||
2274 | 172 | w->user_exit_func_ = 0; | 172 | w->user_exit_func_ = 0; |
2275 | 173 | w->initialization_data_ = data; | 173 | w->initialization_data_ = data; |
2276 | 174 | w->window_style_ = WINDOWSTYLE_NORMAL; | 174 | w->window_style_ = WINDOWSTYLE_NORMAL; |
2277 | 175 | w->embedded_window_ = true; | ||
2278 | 175 | w->ThreadCtor(WindowHandle, WindowDCHandle, OpenGLRenderingContext); | 176 | w->ThreadCtor(WindowHandle, WindowDCHandle, OpenGLRenderingContext); |
2279 | 176 | return w; | 177 | return w; |
2280 | 177 | } | 178 | } |
2281 | 178 | 179 | ||
2282 | === modified file 'Nux/Nux.h' | |||
2283 | --- Nux/Nux.h 2012-02-19 00:02:14 +0000 | |||
2284 | +++ Nux/Nux.h 2012-09-18 11:05:23 +0000 | |||
2285 | @@ -52,6 +52,10 @@ | |||
2286 | 52 | #define NUX_USE_GLIB_LOOP_ON_WINDOWS | 52 | #define NUX_USE_GLIB_LOOP_ON_WINDOWS |
2287 | 53 | //#define NUX_DISABLE_GLIB_LOOP | 53 | //#define NUX_DISABLE_GLIB_LOOP |
2288 | 54 | 54 | ||
2289 | 55 | #if defined(NUX_OS_LINUX) | ||
2290 | 56 | #include "Features.h" | ||
2291 | 57 | #endif | ||
2292 | 58 | |||
2293 | 55 | #include "Utils.h" | 59 | #include "Utils.h" |
2294 | 56 | #include "WidgetMetrics.h" | 60 | #include "WidgetMetrics.h" |
2295 | 57 | #include "Area.h" | 61 | #include "Area.h" |
2296 | @@ -59,6 +63,7 @@ | |||
2297 | 59 | #include "Theme.h" | 63 | #include "Theme.h" |
2298 | 60 | #include "Painter.h" | 64 | #include "Painter.h" |
2299 | 61 | #include "View.h" | 65 | #include "View.h" |
2300 | 66 | #include "BasicView.h" | ||
2301 | 62 | #include "AbstractThread.h" | 67 | #include "AbstractThread.h" |
2302 | 63 | #include "WindowThread.h" | 68 | #include "WindowThread.h" |
2303 | 64 | #include "WindowCompositor.h" | 69 | #include "WindowCompositor.h" |
2304 | 65 | 70 | ||
2305 | === added file 'Nux/NuxTimerTickSource.h' | |||
2306 | --- Nux/NuxTimerTickSource.h 1970-01-01 00:00:00 +0000 | |||
2307 | +++ Nux/NuxTimerTickSource.h 2012-09-18 11:05:23 +0000 | |||
2308 | @@ -0,0 +1,54 @@ | |||
2309 | 1 | #ifndef NUX_TIMER_TICK_SOURCE_H | ||
2310 | 2 | #define NUX_TIMER_TICK_SOURCE_H | ||
2311 | 3 | |||
2312 | 4 | #include "NuxCore/Animation.h" | ||
2313 | 5 | #include "NuxCore/AnimationController.h" | ||
2314 | 6 | #include "Nux/Nux.h" | ||
2315 | 7 | #include "Nux/TimerProc.h" | ||
2316 | 8 | |||
2317 | 9 | namespace nux | ||
2318 | 10 | { | ||
2319 | 11 | |||
2320 | 12 | // Everything inline, but should be extracted. | ||
2321 | 13 | class NuxTimerTickSource: public animation::TickSource | ||
2322 | 14 | { | ||
2323 | 15 | public: | ||
2324 | 16 | NuxTimerTickSource() | ||
2325 | 17 | : foo(0) | ||
2326 | 18 | { | ||
2327 | 19 | timer_.tick.connect(sigc::mem_fun(this, &NuxTimerTickSource::Tick)); | ||
2328 | 20 | timer_.expired.connect(sigc::mem_fun(this, &NuxTimerTickSource::TimerExpired)); | ||
2329 | 21 | unsigned int period = 16; // ms | ||
2330 | 22 | int duration = -1; // run forever | ||
2331 | 23 | timer_handle_ = nux::GetTimer().AddDurationTimer(period, duration, &timer_, NULL); | ||
2332 | 24 | } | ||
2333 | 25 | |||
2334 | 26 | ~NuxTimerTickSource() | ||
2335 | 27 | { | ||
2336 | 28 | if (timer_handle_.Activated()) | ||
2337 | 29 | nux::GetTimer().RemoveTimerHandler(timer_handle_); | ||
2338 | 30 | } | ||
2339 | 31 | |||
2340 | 32 | private: | ||
2341 | 33 | void Tick(void*) | ||
2342 | 34 | { | ||
2343 | 35 | tick.emit(g_get_monotonic_time()); | ||
2344 | 36 | if (++foo % 60 == 0) | ||
2345 | 37 | { | ||
2346 | 38 | // LOG_WARN(logger) << "tick..."; | ||
2347 | 39 | } | ||
2348 | 40 | } | ||
2349 | 41 | void TimerExpired(void*) | ||
2350 | 42 | { | ||
2351 | 43 | //LOG_WARN(logger) << "Timer expired."; | ||
2352 | 44 | } | ||
2353 | 45 | |||
2354 | 46 | private: | ||
2355 | 47 | int foo; | ||
2356 | 48 | TimerFunctor timer_; | ||
2357 | 49 | TimerHandle timer_handle_; | ||
2358 | 50 | }; | ||
2359 | 51 | |||
2360 | 52 | } | ||
2361 | 53 | |||
2362 | 54 | #endif // NUX_TIMER_TICK_SOURCE_H | ||
2363 | 0 | 55 | ||
2364 | === modified file 'Nux/PaintLayer.cpp' | |||
2365 | --- Nux/PaintLayer.cpp 2012-03-13 02:50:57 +0000 | |||
2366 | +++ Nux/PaintLayer.cpp 2012-09-18 11:05:23 +0000 | |||
2367 | @@ -117,7 +117,16 @@ | |||
2368 | 117 | 117 | ||
2369 | 118 | void SliceScaledTextureLayer::Renderlayer(GraphicsEngine& graphics_engine) | 118 | void SliceScaledTextureLayer::Renderlayer(GraphicsEngine& graphics_engine) |
2370 | 119 | { | 119 | { |
2371 | 120 | unsigned int current_alpha_blend; | ||
2372 | 121 | unsigned int current_src_blend_factor; | ||
2373 | 122 | unsigned int current_dest_blend_factor; | ||
2374 | 123 | |||
2375 | 124 | // Get the current blend states. They will be restored later. | ||
2376 | 125 | graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); | ||
2377 | 126 | |||
2378 | 120 | GetPainter().PaintTextureShape(graphics_engine, geometry_, m_image_style); | 127 | GetPainter().PaintTextureShape(graphics_engine, geometry_, m_image_style); |
2379 | 128 | |||
2380 | 129 | graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); | ||
2381 | 121 | } | 130 | } |
2382 | 122 | 131 | ||
2383 | 123 | AbstractPaintLayer* SliceScaledTextureLayer::Clone() const | 132 | AbstractPaintLayer* SliceScaledTextureLayer::Clone() const |
2384 | 124 | 133 | ||
2385 | === modified file 'Nux/Painter.cpp' | |||
2386 | --- Nux/Painter.cpp 2012-08-27 09:09:21 +0000 | |||
2387 | +++ Nux/Painter.cpp 2012-09-18 11:05:23 +0000 | |||
2388 | @@ -797,7 +797,7 @@ | |||
2389 | 797 | graphics_engine.GetRenderStates().SetBlend(false); | 797 | graphics_engine.GetRenderStates().SetBlend(false); |
2390 | 798 | } | 798 | } |
2391 | 799 | 799 | ||
2393 | 800 | void BasePainter::PaintBackground(GraphicsEngine &graphics_engine, const Geometry &geo) | 800 | void BasePainter::PaintActivePaintLayerStack(GraphicsEngine &graphics_engine, const Geometry &geo) |
2394 | 801 | { | 801 | { |
2395 | 802 | if (active_paint_layer_stack_.empty()) | 802 | if (active_paint_layer_stack_.empty()) |
2396 | 803 | { | 803 | { |
2397 | @@ -806,7 +806,12 @@ | |||
2398 | 806 | 806 | ||
2399 | 807 | std::list<AbstractPaintLayer *>::const_reverse_iterator rev_it; | 807 | std::list<AbstractPaintLayer *>::const_reverse_iterator rev_it; |
2400 | 808 | 808 | ||
2402 | 809 | bool first = true; | 809 | bool clear_background = false; |
2403 | 810 | if (pushed_paint_layer_stack_.size() == 0) | ||
2404 | 811 | { | ||
2405 | 812 | // This is the first stack of layers. Clear the background | ||
2406 | 813 | clear_background = true; | ||
2407 | 814 | } | ||
2408 | 810 | 815 | ||
2409 | 811 | for (rev_it = active_paint_layer_stack_.rbegin(); rev_it != active_paint_layer_stack_.rend(); rev_it++) | 816 | for (rev_it = active_paint_layer_stack_.rbegin(); rev_it != active_paint_layer_stack_.rend(); rev_it++) |
2410 | 812 | { | 817 | { |
2411 | @@ -817,10 +822,10 @@ | |||
2412 | 817 | graphics_engine.PushClippingRectangle(geo); | 822 | graphics_engine.PushClippingRectangle(geo); |
2413 | 818 | graphics_engine.SetModelViewMatrix(layer->GetModelViewMatrix()); | 823 | graphics_engine.SetModelViewMatrix(layer->GetModelViewMatrix()); |
2414 | 819 | 824 | ||
2416 | 820 | if (first) | 825 | if (clear_background) |
2417 | 821 | { | 826 | { |
2418 | 822 | Paint2DQuadColor(graphics_engine, layer_geo, Color(0x0)); | 827 | Paint2DQuadColor(graphics_engine, layer_geo, Color(0x0)); |
2420 | 823 | first = false; | 828 | clear_background = false; |
2421 | 824 | } | 829 | } |
2422 | 825 | 830 | ||
2423 | 826 | RenderSinglePaintLayer(graphics_engine, layer_geo, layer); | 831 | RenderSinglePaintLayer(graphics_engine, layer_geo, layer); |
2424 | @@ -831,6 +836,39 @@ | |||
2425 | 831 | } | 836 | } |
2426 | 832 | } | 837 | } |
2427 | 833 | 838 | ||
2428 | 839 | void BasePainter::PaintBackground(GraphicsEngine& graphics_engine, const Geometry& geo) | ||
2429 | 840 | { | ||
2430 | 841 | PaintActivePaintLayerStack(graphics_engine, geo); | ||
2431 | 842 | } | ||
2432 | 843 | |||
2433 | 844 | void BasePainter::PaintAllLayerStack(GraphicsEngine& graphics_engine, const Geometry& geo) | ||
2434 | 845 | { | ||
2435 | 846 | std::list<std::list<AbstractPaintLayer*> >::const_iterator stack_it; | ||
2436 | 847 | std::list<AbstractPaintLayer *>::const_reverse_iterator rev_layer_it; | ||
2437 | 848 | |||
2438 | 849 | bool clear_background = true; | ||
2439 | 850 | |||
2440 | 851 | for (stack_it = pushed_paint_layer_stack_.begin(); stack_it != pushed_paint_layer_stack_.end(); stack_it++) | ||
2441 | 852 | { | ||
2442 | 853 | std::list<AbstractPaintLayer*> stack = (*stack_it); | ||
2443 | 854 | for (rev_layer_it = stack.rbegin(); rev_layer_it != stack.rend(); rev_layer_it++) | ||
2444 | 855 | { | ||
2445 | 856 | AbstractPaintLayer* layer = (*rev_layer_it); | ||
2446 | 857 | Geometry layer_geo = layer->GetGeometry(); | ||
2447 | 858 | |||
2448 | 859 | graphics_engine.PushClippingRectangle(geo); | ||
2449 | 860 | if (clear_background) | ||
2450 | 861 | { | ||
2451 | 862 | Paint2DQuadColor(graphics_engine, layer_geo, Color(0x0)); | ||
2452 | 863 | clear_background = false; | ||
2453 | 864 | } | ||
2454 | 865 | |||
2455 | 866 | RenderSinglePaintLayer(graphics_engine, layer_geo, layer); | ||
2456 | 867 | graphics_engine.PopClippingRectangle(); | ||
2457 | 868 | } | ||
2458 | 869 | } | ||
2459 | 870 | } | ||
2460 | 871 | |||
2461 | 834 | void BasePainter::RenderSinglePaintLayer(GraphicsEngine &graphics_engine, Geometry geo, AbstractPaintLayer *paint_layer) | 872 | void BasePainter::RenderSinglePaintLayer(GraphicsEngine &graphics_engine, Geometry geo, AbstractPaintLayer *paint_layer) |
2462 | 835 | { | 873 | { |
2463 | 836 | paint_layer->Renderlayer(graphics_engine); | 874 | paint_layer->Renderlayer(graphics_engine); |
2464 | 837 | 875 | ||
2465 | === modified file 'Nux/Painter.h' | |||
2466 | --- Nux/Painter.h 2012-08-27 09:09:21 +0000 | |||
2467 | +++ Nux/Painter.h 2012-09-18 11:05:23 +0000 | |||
2468 | @@ -423,6 +423,13 @@ | |||
2469 | 423 | */ | 423 | */ |
2470 | 424 | void PaintActivePaintLayerStack(GraphicsEngine &graphics_engine, const Geometry &geo); | 424 | void PaintActivePaintLayerStack(GraphicsEngine &graphics_engine, const Geometry &geo); |
2471 | 425 | 425 | ||
2472 | 426 | //! Paint all layers in all stacks | ||
2473 | 427 | /* | ||
2474 | 428 | Paint all layers in all stacks with the current model-view and projection matrices. | ||
2475 | 429 | This is useful for redirected rendering to textures. | ||
2476 | 430 | */ | ||
2477 | 431 | void PaintAllLayerStack(GraphicsEngine& graphics_engine, const Geometry& geo); | ||
2478 | 432 | |||
2479 | 426 | //! Deprecated. Use PushPaintLayerStack. | 433 | //! Deprecated. Use PushPaintLayerStack. |
2480 | 427 | void PushBackgroundStack(); | 434 | void PushBackgroundStack(); |
2481 | 428 | 435 | ||
2482 | 429 | 436 | ||
2483 | === modified file 'Nux/RGBValuator.cpp' | |||
2484 | --- Nux/RGBValuator.cpp 2012-08-27 09:09:21 +0000 | |||
2485 | +++ Nux/RGBValuator.cpp 2012-09-18 11:05:23 +0000 | |||
2486 | @@ -120,16 +120,16 @@ | |||
2487 | 120 | blue_caption_ = new EditTextBox("", NUX_TRACKER_LOCATION); | 120 | blue_caption_ = new EditTextBox("", NUX_TRACKER_LOCATION); |
2488 | 121 | alpha_caption_ = new EditTextBox("", NUX_TRACKER_LOCATION); | 121 | alpha_caption_ = new EditTextBox("", NUX_TRACKER_LOCATION); |
2489 | 122 | 122 | ||
2495 | 123 | red_valuator_ = new InputArea(NUX_TRACKER_LOCATION); | 123 | red_valuator_ = new BasicView(NUX_TRACKER_LOCATION); |
2496 | 124 | green_valuator_ = new InputArea(NUX_TRACKER_LOCATION); | 124 | green_valuator_ = new BasicView(NUX_TRACKER_LOCATION); |
2497 | 125 | blue_valuator_ = new InputArea(NUX_TRACKER_LOCATION); | 125 | blue_valuator_ = new BasicView(NUX_TRACKER_LOCATION); |
2498 | 126 | alpha_valuator_ = new InputArea(NUX_TRACKER_LOCATION); | 126 | alpha_valuator_ = new BasicView(NUX_TRACKER_LOCATION); |
2499 | 127 | color_square_ = new InputArea(NUX_TRACKER_LOCATION); | 127 | color_square_ = new BasicView(NUX_TRACKER_LOCATION); |
2500 | 128 | 128 | ||
2505 | 129 | m_ComponentLabel0 = new InputArea(NUX_TRACKER_LOCATION); | 129 | m_ComponentLabel0 = new BasicView(NUX_TRACKER_LOCATION); |
2506 | 130 | m_ComponentLabel1 = new InputArea(NUX_TRACKER_LOCATION); | 130 | m_ComponentLabel1 = new BasicView(NUX_TRACKER_LOCATION); |
2507 | 131 | m_ComponentLabel2 = new InputArea(NUX_TRACKER_LOCATION); | 131 | m_ComponentLabel2 = new BasicView(NUX_TRACKER_LOCATION); |
2508 | 132 | m_ComponentAlpha = new InputArea(NUX_TRACKER_LOCATION); | 132 | m_ComponentAlpha = new BasicView(NUX_TRACKER_LOCATION); |
2509 | 133 | } | 133 | } |
2510 | 134 | 134 | ||
2511 | 135 | void RGBValuator::InitializeWidgets() | 135 | void RGBValuator::InitializeWidgets() |
2512 | @@ -152,10 +152,6 @@ | |||
2513 | 152 | alpha_valuator_->mouse_drag.connect(sigc::mem_fun(this, &RGBValuator::OnReceiveMouseDrag_Alpha)); | 152 | alpha_valuator_->mouse_drag.connect(sigc::mem_fun(this, &RGBValuator::OnReceiveMouseDrag_Alpha)); |
2514 | 153 | m_ColorModel->click.connect(sigc::mem_fun(this, &RGBValuator::OnChangeColorModel)); | 153 | m_ColorModel->click.connect(sigc::mem_fun(this, &RGBValuator::OnChangeColorModel)); |
2515 | 154 | m_ColorFormat->click.connect(sigc::mem_fun(this, &RGBValuator::OnChangeColorFormat)); | 154 | m_ColorFormat->click.connect(sigc::mem_fun(this, &RGBValuator::OnChangeColorFormat)); |
2516 | 155 | // m_ColorModel->mouse_down.connect(sigc::mem_fun(this, &RGBValuator::RecvColorModelEvent)); | ||
2517 | 156 | // m_ColorModel->mouse_up.connect(sigc::mem_fun(this, &RGBValuator::RecvColorModelEvent)); | ||
2518 | 157 | // m_ColorModel->mouse_enter.connect(sigc::mem_fun(this, &RGBValuator::RecvColorModelEvent)); | ||
2519 | 158 | |||
2520 | 159 | 155 | ||
2521 | 160 | m_ColorModel->SetFont(GetSysBoldFont()); | 156 | m_ColorModel->SetFont(GetSysBoldFont()); |
2522 | 161 | m_ColorFormat->SetFont(GetSysBoldFont()); | 157 | m_ColorFormat->SetFont(GetSysBoldFont()); |
2523 | @@ -403,7 +399,7 @@ | |||
2524 | 403 | Geometry base = GetGeometry(); | 399 | Geometry base = GetGeometry(); |
2525 | 404 | 400 | ||
2526 | 405 | graphics_engine.PushClippingRectangle(base); | 401 | graphics_engine.PushClippingRectangle(base); |
2528 | 406 | GetPainter().PushDrawShapeLayer(graphics_engine, vlayout->GetGeometry(), eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners); | 402 | GetPainter().PushDrawShapeLayer(graphics_engine, vlayout->GetGeometry(), eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true); |
2529 | 407 | 403 | ||
2530 | 408 | if (m_color_model == color::RGB) | 404 | if (m_color_model == color::RGB) |
2531 | 409 | { | 405 | { |
2532 | @@ -428,13 +424,6 @@ | |||
2533 | 428 | DrawBlueMarker(graphics_engine); | 424 | DrawBlueMarker(graphics_engine); |
2534 | 429 | DrawAlphaMarker(graphics_engine); | 425 | DrawAlphaMarker(graphics_engine); |
2535 | 430 | 426 | ||
2536 | 431 | red_caption_->QueueDraw(); | ||
2537 | 432 | green_caption_->QueueDraw(); | ||
2538 | 433 | blue_caption_->QueueDraw(); | ||
2539 | 434 | alpha_caption_->QueueDraw(); | ||
2540 | 435 | m_ColorModel->QueueDraw(); | ||
2541 | 436 | m_ColorFormat->QueueDraw(); | ||
2542 | 437 | |||
2543 | 438 | GetPainter().PopBackground(); | 427 | GetPainter().PopBackground(); |
2544 | 439 | graphics_engine.PopClippingRectangle(); | 428 | graphics_engine.PopClippingRectangle(); |
2545 | 440 | } | 429 | } |
2546 | 441 | 430 | ||
2547 | === modified file 'Nux/RGBValuator.h' | |||
2548 | --- Nux/RGBValuator.h 2011-10-18 20:00:59 +0000 | |||
2549 | +++ Nux/RGBValuator.h 2012-09-18 11:05:23 +0000 | |||
2550 | @@ -148,16 +148,16 @@ | |||
2551 | 148 | EditTextBox *green_caption_; | 148 | EditTextBox *green_caption_; |
2552 | 149 | EditTextBox *blue_caption_; | 149 | EditTextBox *blue_caption_; |
2553 | 150 | EditTextBox *alpha_caption_; | 150 | EditTextBox *alpha_caption_; |
2559 | 151 | InputArea *red_valuator_; | 151 | BasicView *red_valuator_; |
2560 | 152 | InputArea *green_valuator_; | 152 | BasicView *green_valuator_; |
2561 | 153 | InputArea *blue_valuator_; | 153 | BasicView *blue_valuator_; |
2562 | 154 | InputArea *alpha_valuator_; | 154 | BasicView *alpha_valuator_; |
2563 | 155 | InputArea *color_square_; | 155 | BasicView *color_square_; |
2564 | 156 | 156 | ||
2569 | 157 | InputArea *m_ComponentLabel0; | 157 | BasicView *m_ComponentLabel0; |
2570 | 158 | InputArea *m_ComponentLabel1; | 158 | BasicView *m_ComponentLabel1; |
2571 | 159 | InputArea *m_ComponentLabel2; | 159 | BasicView *m_ComponentLabel2; |
2572 | 160 | InputArea *m_ComponentAlpha; | 160 | BasicView *m_ComponentAlpha; |
2573 | 161 | 161 | ||
2574 | 162 | TextureLayer *m_CheckboardLayer; | 162 | TextureLayer *m_CheckboardLayer; |
2575 | 163 | 163 | ||
2576 | 164 | 164 | ||
2577 | === modified file 'Nux/RadioButton.cpp' | |||
2578 | --- Nux/RadioButton.cpp 2012-01-17 04:34:19 +0000 | |||
2579 | +++ Nux/RadioButton.cpp 2012-09-18 11:05:23 +0000 | |||
2580 | @@ -56,8 +56,6 @@ | |||
2581 | 56 | Geometry base = GetGeometry(); | 56 | Geometry base = GetGeometry(); |
2582 | 57 | graphics_engine.PushClippingRectangle(base); | 57 | graphics_engine.PushClippingRectangle(base); |
2583 | 58 | 58 | ||
2584 | 59 | GetPainter().PaintBackground(graphics_engine, base); | ||
2585 | 60 | |||
2586 | 61 | InteractState is; | 59 | InteractState is; |
2587 | 62 | is.is_on = active_; | 60 | is.is_on = active_; |
2588 | 63 | 61 | ||
2589 | @@ -81,7 +79,7 @@ | |||
2590 | 81 | static_text_->ProcessDraw(graphics_engine, true); | 79 | static_text_->ProcessDraw(graphics_engine, true); |
2591 | 82 | } | 80 | } |
2592 | 83 | GetPainter().PopPaintLayerStack(); | 81 | GetPainter().PopPaintLayerStack(); |
2594 | 84 | 82 | ||
2595 | 85 | graphics_engine.PopClippingRectangle(); | 83 | graphics_engine.PopClippingRectangle(); |
2596 | 86 | } | 84 | } |
2597 | 87 | 85 | ||
2598 | 88 | 86 | ||
2599 | === modified file 'Nux/RangeValue.cpp' | |||
2600 | --- Nux/RangeValue.cpp 2012-01-17 04:34:19 +0000 | |||
2601 | +++ Nux/RangeValue.cpp 2012-09-18 11:05:23 +0000 | |||
2602 | @@ -85,7 +85,7 @@ | |||
2603 | 85 | void RangeValue::InitializeLayout() | 85 | void RangeValue::InitializeLayout() |
2604 | 86 | { | 86 | { |
2605 | 87 | hlayout = new HLayout(NUX_TRACKER_LOCATION); | 87 | hlayout = new HLayout(NUX_TRACKER_LOCATION); |
2607 | 88 | m_Percentage = new InputArea(NUX_TRACKER_LOCATION); | 88 | m_Percentage = new BasicView(NUX_TRACKER_LOCATION); |
2608 | 89 | m_ValueString = new EditTextBox("", NUX_TRACKER_LOCATION); | 89 | m_ValueString = new EditTextBox("", NUX_TRACKER_LOCATION); |
2609 | 90 | } | 90 | } |
2610 | 91 | 91 | ||
2611 | 92 | 92 | ||
2612 | === modified file 'Nux/RangeValue.h' | |||
2613 | --- Nux/RangeValue.h 2012-01-17 04:34:19 +0000 | |||
2614 | +++ Nux/RangeValue.h 2012-09-18 11:05:23 +0000 | |||
2615 | @@ -114,7 +114,7 @@ | |||
2616 | 114 | protected: | 114 | protected: |
2617 | 115 | HLayout *hlayout; | 115 | HLayout *hlayout; |
2618 | 116 | EditTextBox *m_ValueString; | 116 | EditTextBox *m_ValueString; |
2620 | 117 | InputArea *m_Percentage; | 117 | BasicView *m_Percentage; |
2621 | 118 | Color m_StartColor; | 118 | Color m_StartColor; |
2622 | 119 | Color m_EndColor; | 119 | Color m_EndColor; |
2623 | 120 | Color m_ProgressColor; | 120 | Color m_ProgressColor; |
2624 | 121 | 121 | ||
2625 | === modified file 'Nux/RangeValueInteger.cpp' | |||
2626 | --- Nux/RangeValueInteger.cpp 2011-10-10 01:52:00 +0000 | |||
2627 | +++ Nux/RangeValueInteger.cpp 2012-09-18 11:05:23 +0000 | |||
2628 | @@ -87,7 +87,7 @@ | |||
2629 | 87 | void RangeValueInteger::InitializeLayout() | 87 | void RangeValueInteger::InitializeLayout() |
2630 | 88 | { | 88 | { |
2631 | 89 | hlayout = new HLayout(NUX_TRACKER_LOCATION); | 89 | hlayout = new HLayout(NUX_TRACKER_LOCATION); |
2633 | 90 | m_Percentage = new InputArea(NUX_TRACKER_LOCATION); | 90 | m_Percentage = new BasicView(NUX_TRACKER_LOCATION); |
2634 | 91 | m_ValueString = new EditTextBox("", NUX_TRACKER_LOCATION); | 91 | m_ValueString = new EditTextBox("", NUX_TRACKER_LOCATION); |
2635 | 92 | } | 92 | } |
2636 | 93 | 93 | ||
2637 | 94 | 94 | ||
2638 | === modified file 'Nux/RangeValueInteger.h' | |||
2639 | --- Nux/RangeValueInteger.h 2011-10-10 01:52:00 +0000 | |||
2640 | +++ Nux/RangeValueInteger.h 2012-09-18 11:05:23 +0000 | |||
2641 | @@ -118,7 +118,7 @@ | |||
2642 | 118 | protected: | 118 | protected: |
2643 | 119 | HLayout *hlayout; | 119 | HLayout *hlayout; |
2644 | 120 | EditTextBox *m_ValueString; | 120 | EditTextBox *m_ValueString; |
2646 | 121 | InputArea *m_Percentage; | 121 | BasicView *m_Percentage; |
2647 | 122 | Color m_StartColor; | 122 | Color m_StartColor; |
2648 | 123 | Color m_EndColor; | 123 | Color m_EndColor; |
2649 | 124 | Color m_ProgressColor; | 124 | Color m_ProgressColor; |
2650 | 125 | 125 | ||
2651 | === modified file 'Nux/ScrollView.cpp' | |||
2652 | --- Nux/ScrollView.cpp 2012-09-14 00:26:47 +0000 | |||
2653 | +++ Nux/ScrollView.cpp 2012-09-18 11:05:23 +0000 | |||
2654 | @@ -289,14 +289,12 @@ | |||
2655 | 289 | void ScrollView::EnableVerticalScrollBar(bool b) | 289 | void ScrollView::EnableVerticalScrollBar(bool b) |
2656 | 290 | { | 290 | { |
2657 | 291 | m_vertical_scrollbar_enable = b; | 291 | m_vertical_scrollbar_enable = b; |
2658 | 292 | _delta_y = 0; | ||
2659 | 293 | ComputeContentSize(); | 292 | ComputeContentSize(); |
2660 | 294 | } | 293 | } |
2661 | 295 | 294 | ||
2662 | 296 | void ScrollView::EnableHorizontalScrollBar(bool b) | 295 | void ScrollView::EnableHorizontalScrollBar(bool b) |
2663 | 297 | { | 296 | { |
2664 | 298 | m_horizontal_scrollbar_enable = b; | 297 | m_horizontal_scrollbar_enable = b; |
2665 | 299 | _delta_x = 0; | ||
2666 | 300 | ComputeContentSize(); | 298 | ComputeContentSize(); |
2667 | 301 | } | 299 | } |
2668 | 302 | 300 | ||
2669 | 303 | 301 | ||
2670 | === modified file 'Nux/SpinBox_Logic.cpp' | |||
2671 | --- Nux/SpinBox_Logic.cpp 2012-07-04 16:36:46 +0000 | |||
2672 | +++ Nux/SpinBox_Logic.cpp 2012-09-18 11:05:23 +0000 | |||
2673 | @@ -32,8 +32,8 @@ | |||
2674 | 32 | , m_UpTimerHandler(0) | 32 | , m_UpTimerHandler(0) |
2675 | 33 | , m_DownTimerHandler(0) | 33 | , m_DownTimerHandler(0) |
2676 | 34 | { | 34 | { |
2679 | 35 | m_SpinnerUpBtn = new InputArea(NUX_TRACKER_LOCATION); | 35 | m_SpinnerUpBtn = new BasicView(NUX_TRACKER_LOCATION); |
2680 | 36 | m_SpinnerDownBtn = new InputArea(NUX_TRACKER_LOCATION); | 36 | m_SpinnerDownBtn = new BasicView(NUX_TRACKER_LOCATION); |
2681 | 37 | m_EditLine = new EditTextBox("", NUX_TRACKER_LOCATION); | 37 | m_EditLine = new EditTextBox("", NUX_TRACKER_LOCATION); |
2682 | 38 | 38 | ||
2683 | 39 | // Set Original State | 39 | // Set Original State |
2684 | 40 | 40 | ||
2685 | === modified file 'Nux/SpinBox_Logic.h' | |||
2686 | --- Nux/SpinBox_Logic.h 2011-10-10 01:52:00 +0000 | |||
2687 | +++ Nux/SpinBox_Logic.h 2012-09-18 11:05:23 +0000 | |||
2688 | @@ -74,8 +74,8 @@ | |||
2689 | 74 | 74 | ||
2690 | 75 | protected: | 75 | protected: |
2691 | 76 | EditTextBox *m_EditLine; | 76 | EditTextBox *m_EditLine; |
2694 | 77 | InputArea *m_SpinnerUpBtn; | 77 | BasicView *m_SpinnerUpBtn; |
2695 | 78 | InputArea *m_SpinnerDownBtn; | 78 | BasicView *m_SpinnerDownBtn; |
2696 | 79 | 79 | ||
2697 | 80 | TimerFunctor *m_UpTimerCallback; | 80 | TimerFunctor *m_UpTimerCallback; |
2698 | 81 | TimerFunctor *m_DownTimerCallback; | 81 | TimerFunctor *m_DownTimerCallback; |
2699 | 82 | 82 | ||
2700 | === modified file 'Nux/TabView.cpp' | |||
2701 | --- Nux/TabView.cpp 2012-07-04 16:36:46 +0000 | |||
2702 | +++ Nux/TabView.cpp 2012-09-18 11:05:23 +0000 | |||
2703 | @@ -45,7 +45,7 @@ | |||
2704 | 45 | _index = 0; | 45 | _index = 0; |
2705 | 46 | _tab_name = TabName; | 46 | _tab_name = TabName; |
2706 | 47 | _tab_content_layout = TabLayout; | 47 | _tab_content_layout = TabLayout; |
2708 | 48 | _tab_area = new InputArea(NUX_TRACKER_LOCATION); | 48 | _tab_area = new BasicView(NUX_TRACKER_LOCATION); |
2709 | 49 | 49 | ||
2710 | 50 | _tab_content_layout->Reference(); | 50 | _tab_content_layout->Reference(); |
2711 | 51 | _tab_area->Reference(); | 51 | _tab_area->Reference(); |
2712 | @@ -100,8 +100,8 @@ | |||
2713 | 100 | //_tabview_heads_layout->SetParentObject(this); | 100 | //_tabview_heads_layout->SetParentObject(this); |
2714 | 101 | _tabview_scroll_button_layout = new HLayout(NUX_TRACKER_LOCATION); | 101 | _tabview_scroll_button_layout = new HLayout(NUX_TRACKER_LOCATION); |
2715 | 102 | _tabview_scroll_button_layout->SetParentObject(this); | 102 | _tabview_scroll_button_layout->SetParentObject(this); |
2718 | 103 | _scroll_right = new InputArea(NUX_TRACKER_LOCATION); | 103 | _scroll_right = new BasicView(NUX_TRACKER_LOCATION); |
2719 | 104 | _scroll_left = new InputArea(NUX_TRACKER_LOCATION); | 104 | _scroll_left = new BasicView(NUX_TRACKER_LOCATION); |
2720 | 105 | 105 | ||
2721 | 106 | _scroll_right->SetMinimumSize(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT); | 106 | _scroll_right->SetMinimumSize(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT); |
2722 | 107 | _scroll_left->SetMinimumSize(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT); | 107 | _scroll_left->SetMinimumSize(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT); |
2723 | 108 | 108 | ||
2724 | === modified file 'Nux/TabView.h' | |||
2725 | --- Nux/TabView.h 2011-10-10 01:52:00 +0000 | |||
2726 | +++ Nux/TabView.h 2012-09-18 11:05:23 +0000 | |||
2727 | @@ -74,7 +74,7 @@ | |||
2728 | 74 | 74 | ||
2729 | 75 | NString _tab_name; | 75 | NString _tab_name; |
2730 | 76 | Layout *_tab_content_layout; | 76 | Layout *_tab_content_layout; |
2732 | 77 | InputArea *_tab_area; | 77 | BasicView *_tab_area; |
2733 | 78 | int _index; | 78 | int _index; |
2734 | 79 | }; | 79 | }; |
2735 | 80 | 80 | ||
2736 | @@ -103,8 +103,8 @@ | |||
2737 | 103 | void TranslateRight(int x, int y, unsigned long button_flags, unsigned long key_flags); | 103 | void TranslateRight(int x, int y, unsigned long button_flags, unsigned long key_flags); |
2738 | 104 | void TranslateTabLayout(int offset); | 104 | void TranslateTabLayout(int offset); |
2739 | 105 | 105 | ||
2742 | 106 | InputArea *_scroll_right; | 106 | BasicView *_scroll_right; |
2743 | 107 | InputArea *_scroll_left; | 107 | BasicView *_scroll_left; |
2744 | 108 | 108 | ||
2745 | 109 | Layout *_visible_tab_content_layout; | 109 | Layout *_visible_tab_content_layout; |
2746 | 110 | HLayout *_tabview_heads_layout; | 110 | HLayout *_tabview_heads_layout; |
2747 | 111 | 111 | ||
2748 | === modified file 'Nux/TextEntry.cpp' | |||
2749 | --- Nux/TextEntry.cpp 2012-08-28 21:30:51 +0000 | |||
2750 | +++ Nux/TextEntry.cpp 2012-09-18 11:05:23 +0000 | |||
2751 | @@ -27,9 +27,9 @@ | |||
2752 | 27 | #include "NuxGraphics/CairoGraphics.h" | 27 | #include "NuxGraphics/CairoGraphics.h" |
2753 | 28 | 28 | ||
2754 | 29 | #include "TextEntry.h" | 29 | #include "TextEntry.h" |
2755 | 30 | |||
2756 | 31 | #if defined(NUX_OS_LINUX) | ||
2757 | 30 | #include "TextEntryComposeSeqs.h" | 32 | #include "TextEntryComposeSeqs.h" |
2758 | 31 | |||
2759 | 32 | #if defined(NUX_OS_LINUX) | ||
2760 | 33 | #include <X11/cursorfont.h> | 33 | #include <X11/cursorfont.h> |
2761 | 34 | #include "InputMethodIBus.h" | 34 | #include "InputMethodIBus.h" |
2762 | 35 | #endif | 35 | #endif |
2763 | @@ -187,6 +187,7 @@ | |||
2764 | 187 | 187 | ||
2765 | 188 | SetAcceptKeyboardEvent(true); | 188 | SetAcceptKeyboardEvent(true); |
2766 | 189 | EnableDoubleClick(true); | 189 | EnableDoubleClick(true); |
2767 | 190 | SetPasswordChar("*"); | ||
2768 | 190 | } | 191 | } |
2769 | 191 | 192 | ||
2770 | 192 | TextEntry::~TextEntry() | 193 | TextEntry::~TextEntry() |
2771 | @@ -220,10 +221,8 @@ | |||
2772 | 220 | 221 | ||
2773 | 221 | void TextEntry::GeometryChanged() | 222 | void TextEntry::GeometryChanged() |
2774 | 222 | { | 223 | { |
2775 | 223 | |||
2776 | 224 | update_canvas_ = true; | 224 | update_canvas_ = true; |
2779 | 225 | View::GeometryChanged(); | 225 | View::GeometryChanged(true, true); |
2778 | 226 | |||
2780 | 227 | } | 226 | } |
2781 | 228 | 227 | ||
2782 | 229 | Area* TextEntry::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type) | 228 | Area* TextEntry::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type) |
2783 | @@ -633,6 +632,7 @@ | |||
2784 | 633 | { | 632 | { |
2785 | 634 | SearchState search_state = SearchState::NO_MATCH; | 633 | SearchState search_state = SearchState::NO_MATCH; |
2786 | 635 | 634 | ||
2787 | 635 | #if defined(NUX_OS_LINUX) | ||
2788 | 636 | if (input.size() >= ComposeSequence::MAX_SYMBOLS) | 636 | if (input.size() >= ComposeSequence::MAX_SYMBOLS) |
2789 | 637 | return search_state; | 637 | return search_state; |
2790 | 638 | 638 | ||
2791 | @@ -670,6 +670,7 @@ | |||
2792 | 670 | } | 670 | } |
2793 | 671 | } | 671 | } |
2794 | 672 | } | 672 | } |
2795 | 673 | #endif | ||
2796 | 673 | 674 | ||
2797 | 674 | return search_state; | 675 | return search_state; |
2798 | 675 | } | 676 | } |
2799 | @@ -2555,12 +2556,10 @@ | |||
2800 | 2555 | { | 2556 | { |
2801 | 2556 | if (c == NULL || *c == 0 || !IsLegalUTF8Char(c, GetUTF8CharLength(c))) | 2557 | if (c == NULL || *c == 0 || !IsLegalUTF8Char(c, GetUTF8CharLength(c))) |
2802 | 2557 | { | 2558 | { |
2803 | 2558 | SetVisibility(true); | ||
2804 | 2559 | password_char_.clear(); | 2559 | password_char_.clear(); |
2805 | 2560 | } | 2560 | } |
2806 | 2561 | else | 2561 | else |
2807 | 2562 | { | 2562 | { |
2808 | 2563 | SetVisibility(false); | ||
2809 | 2564 | password_char_.assign(c, GetUTF8CharLength(c)); | 2563 | password_char_.assign(c, GetUTF8CharLength(c)); |
2810 | 2565 | } | 2564 | } |
2811 | 2566 | QueueRefresh(true, true); | 2565 | QueueRefresh(true, true); |
2812 | 2567 | 2566 | ||
2813 | === modified file 'Nux/TextEntry.h' | |||
2814 | --- Nux/TextEntry.h 2012-08-28 21:30:51 +0000 | |||
2815 | +++ Nux/TextEntry.h 2012-09-18 11:05:23 +0000 | |||
2816 | @@ -237,7 +237,7 @@ | |||
2817 | 237 | /** | 237 | /** |
2818 | 238 | * Enum used for the search state of the compose list | 238 | * Enum used for the search state of the compose list |
2819 | 239 | */ | 239 | */ |
2821 | 240 | enum class SearchState { | 240 | enum SearchState { |
2822 | 241 | NO_MATCH, | 241 | NO_MATCH, |
2823 | 242 | PARTIAL, | 242 | PARTIAL, |
2824 | 243 | MATCH | 243 | MATCH |
2825 | 244 | 244 | ||
2826 | === modified file 'Nux/Theme.cpp' | |||
2827 | --- Nux/Theme.cpp 2012-07-26 00:17:42 +0000 | |||
2828 | +++ Nux/Theme.cpp 2012-09-18 11:05:23 +0000 | |||
2829 | @@ -22,7 +22,7 @@ | |||
2830 | 22 | #include "Nux.h" | 22 | #include "Nux.h" |
2831 | 23 | #include "Theme.h" | 23 | #include "Theme.h" |
2832 | 24 | #if defined(NUX_OS_WINDOWS) | 24 | #if defined(NUX_OS_WINDOWS) |
2834 | 25 | #include "NuxCore/TinyXML/tinyxml.h" | 25 | #include "tinyxml/tinyxml.h" |
2835 | 26 | #endif | 26 | #endif |
2836 | 27 | 27 | ||
2837 | 28 | namespace nux | 28 | namespace nux |
2838 | 29 | 29 | ||
2839 | === modified file 'Nux/VScrollBar.cpp' | |||
2840 | --- Nux/VScrollBar.cpp 2012-07-04 16:36:46 +0000 | |||
2841 | +++ Nux/VScrollBar.cpp 2012-09-18 11:05:23 +0000 | |||
2842 | @@ -52,10 +52,10 @@ | |||
2843 | 52 | m_DownTimerHandler = 0; | 52 | m_DownTimerHandler = 0; |
2844 | 53 | 53 | ||
2845 | 54 | vlayout = new VLayout(NUX_TRACKER_LOCATION); | 54 | vlayout = new VLayout(NUX_TRACKER_LOCATION); |
2850 | 55 | _scroll_up_button = new InputArea(NUX_TRACKER_LOCATION); | 55 | _scroll_up_button = new BasicView(NUX_TRACKER_LOCATION); |
2851 | 56 | _track = new InputArea(NUX_TRACKER_LOCATION); | 56 | _track = new BasicView(NUX_TRACKER_LOCATION); |
2852 | 57 | _scroll_down_button = new InputArea(NUX_TRACKER_LOCATION); | 57 | _scroll_down_button = new BasicView(NUX_TRACKER_LOCATION); |
2853 | 58 | _slider = new InputArea(NUX_TRACKER_LOCATION); | 58 | _slider = new BasicView(NUX_TRACKER_LOCATION); |
2854 | 59 | _slider->SetParentObject(this); | 59 | _slider->SetParentObject(this); |
2855 | 60 | 60 | ||
2856 | 61 | // Set Original State | 61 | // Set Original State |
2857 | 62 | 62 | ||
2858 | === modified file 'Nux/VScrollBar.h' | |||
2859 | --- Nux/VScrollBar.h 2012-01-02 20:39:31 +0000 | |||
2860 | +++ Nux/VScrollBar.h 2012-09-18 11:05:23 +0000 | |||
2861 | @@ -98,10 +98,10 @@ | |||
2862 | 98 | bool AtMaximum(); | 98 | bool AtMaximum(); |
2863 | 99 | 99 | ||
2864 | 100 | VLayout *vlayout; | 100 | VLayout *vlayout; |
2869 | 101 | InputArea *_slider; | 101 | BasicView *_slider; |
2870 | 102 | InputArea *_scroll_up_button; | 102 | BasicView *_scroll_up_button; |
2871 | 103 | InputArea *_scroll_down_button; | 103 | BasicView *_scroll_down_button; |
2872 | 104 | InputArea *_track; | 104 | BasicView *_track; |
2873 | 105 | 105 | ||
2874 | 106 | int content_width_; | 106 | int content_width_; |
2875 | 107 | int content_height_; | 107 | int content_height_; |
2876 | 108 | 108 | ||
2877 | === modified file 'Nux/VSplitter.cpp' | |||
2878 | --- Nux/VSplitter.cpp 2012-07-30 21:07:40 +0000 | |||
2879 | +++ Nux/VSplitter.cpp 2012-09-18 11:05:23 +0000 | |||
2880 | @@ -139,11 +139,6 @@ | |||
2881 | 139 | View *ic = NUX_STATIC_CAST(View *, (*it)); | 139 | View *ic = NUX_STATIC_CAST(View *, (*it)); |
2882 | 140 | ic->ProcessDraw(graphics_engine, true); | 140 | ic->ProcessDraw(graphics_engine, true); |
2883 | 141 | } | 141 | } |
2884 | 142 | else if ((*it)->Type().IsObjectType(InputArea::StaticObjectType)) | ||
2885 | 143 | { | ||
2886 | 144 | InputArea *base_area = NUX_STATIC_CAST(InputArea *, (*it)); | ||
2887 | 145 | base_area->OnDraw(graphics_engine, true); | ||
2888 | 146 | } | ||
2889 | 147 | else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType)) | 142 | else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType)) |
2890 | 148 | { | 143 | { |
2891 | 149 | HLayout *layout = NUX_STATIC_CAST(HLayout *, (*it)); | 144 | HLayout *layout = NUX_STATIC_CAST(HLayout *, (*it)); |
2892 | @@ -162,11 +157,6 @@ | |||
2893 | 162 | View *ic = NUX_STATIC_CAST(View *, (*it)); | 157 | View *ic = NUX_STATIC_CAST(View *, (*it)); |
2894 | 163 | ic->ProcessDraw(graphics_engine, false); | 158 | ic->ProcessDraw(graphics_engine, false); |
2895 | 164 | } | 159 | } |
2896 | 165 | else if ((*it)->Type().IsObjectType(InputArea::StaticObjectType)) | ||
2897 | 166 | { | ||
2898 | 167 | InputArea *base_area = NUX_STATIC_CAST(InputArea *, (*it)); | ||
2899 | 168 | base_area->OnDraw(graphics_engine, false); | ||
2900 | 169 | } | ||
2901 | 170 | else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType)) | 160 | else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType)) |
2902 | 171 | { | 161 | { |
2903 | 172 | HLayout *layout = NUX_STATIC_CAST(HLayout *, (*it)); | 162 | HLayout *layout = NUX_STATIC_CAST(HLayout *, (*it)); |
2904 | @@ -355,11 +345,6 @@ | |||
2905 | 355 | // ComputeElementLayout to force the computing of this element layout. | 345 | // ComputeElementLayout to force the computing of this element layout. |
2906 | 356 | GetWindowThread()->ComputeElementLayout(ic); | 346 | GetWindowThread()->ComputeElementLayout(ic); |
2907 | 357 | } | 347 | } |
2908 | 358 | else if (m_InterfaceObject[i]->Type().IsObjectType(InputArea::StaticObjectType)) | ||
2909 | 359 | { | ||
2910 | 360 | InputArea *base_area = NUX_STATIC_CAST(InputArea *, m_InterfaceObject[i]); | ||
2911 | 361 | base_area->SetGeometry(Geometry(accwidth, y, splitter_geo.x - accwidth, h)); | ||
2912 | 362 | } | ||
2913 | 363 | else if (m_InterfaceObject[i]->Type().IsDerivedFromType(Layout::StaticObjectType)) | 348 | else if (m_InterfaceObject[i]->Type().IsDerivedFromType(Layout::StaticObjectType)) |
2914 | 364 | { | 349 | { |
2915 | 365 | Layout *layout = NUX_STATIC_CAST(Layout *, m_InterfaceObject[i]); | 350 | Layout *layout = NUX_STATIC_CAST(Layout *, m_InterfaceObject[i]); |
2916 | @@ -562,10 +547,6 @@ | |||
2917 | 562 | View *ic = NUX_STATIC_CAST(View *, (*it)); | 547 | View *ic = NUX_STATIC_CAST(View *, (*it)); |
2918 | 563 | ic->DoneRedraw(); | 548 | ic->DoneRedraw(); |
2919 | 564 | } | 549 | } |
2920 | 565 | else if ((*it)->Type().IsObjectType(InputArea::StaticObjectType)) | ||
2921 | 566 | { | ||
2922 | 567 | //InputArea* base_area = NUX_STATIC_CAST(InputArea*, (*it)); | ||
2923 | 568 | } | ||
2924 | 569 | } | 550 | } |
2925 | 570 | } | 551 | } |
2926 | 571 | 552 | ||
2927 | 572 | 553 | ||
2928 | === modified file 'Nux/VSplitter.h' | |||
2929 | --- Nux/VSplitter.h 2011-10-21 22:06:35 +0000 | |||
2930 | +++ Nux/VSplitter.h 2012-09-18 11:05:23 +0000 | |||
2931 | @@ -80,7 +80,7 @@ | |||
2932 | 80 | 80 | ||
2933 | 81 | private: | 81 | private: |
2934 | 82 | 82 | ||
2936 | 83 | typedef InputArea MySplitter; | 83 | typedef BasicView MySplitter; |
2937 | 84 | std::vector<Area *> m_InterfaceObject; | 84 | std::vector<Area *> m_InterfaceObject; |
2938 | 85 | std::vector<MySplitter *> m_SplitterObject; | 85 | std::vector<MySplitter *> m_SplitterObject; |
2939 | 86 | std::vector<float> m_SplitConfig; | 86 | std::vector<float> m_SplitConfig; |
2940 | 87 | 87 | ||
2941 | === modified file 'Nux/View.cpp' | |||
2942 | --- Nux/View.cpp 2012-05-31 21:50:05 +0000 | |||
2943 | +++ Nux/View.cpp 2012-09-18 11:05:23 +0000 | |||
2944 | @@ -27,19 +27,25 @@ | |||
2945 | 27 | 27 | ||
2946 | 28 | namespace nux | 28 | namespace nux |
2947 | 29 | { | 29 | { |
2948 | 30 | |||
2949 | 31 | NUX_IMPLEMENT_OBJECT_TYPE(View); | 30 | NUX_IMPLEMENT_OBJECT_TYPE(View); |
2950 | 32 | 31 | ||
2951 | 33 | View::View(NUX_FILE_LINE_DECL) | 32 | View::View(NUX_FILE_LINE_DECL) |
2953 | 34 | : InputArea(NUX_FILE_LINE_PARAM) | 33 | : InputArea(NUX_FILE_LINE_PARAM) |
2954 | 34 | // , redirect_rendering_to_texture_(false) | ||
2955 | 35 | // , update_backup_texture_(false) | ||
2956 | 35 | { | 36 | { |
2960 | 36 | view_layout_ = NULL; | 37 | view_layout_ = NULL; |
2961 | 37 | draw_cmd_queued_ = false; | 38 | draw_cmd_queued_ = false; |
2962 | 38 | m_TextColor = Color(1.0f, 1.0f, 1.0f, 1.0f); | 39 | m_TextColor = Color(1.0f, 1.0f, 1.0f, 1.0f); |
2963 | 39 | } | 40 | } |
2964 | 40 | 41 | ||
2965 | 41 | View::~View() | 42 | View::~View() |
2966 | 42 | { | 43 | { |
2967 | 44 | backup_fbo_.Release(); | ||
2968 | 45 | backup_texture_.Release(); | ||
2969 | 46 | backup_depth_texture_.Release(); | ||
2970 | 47 | background_texture_.Release(); | ||
2971 | 48 | |||
2972 | 43 | // It is possible that the window thread has been deleted before the view | 49 | // It is possible that the window thread has been deleted before the view |
2973 | 44 | // itself, so check prior to calling. | 50 | // itself, so check prior to calling. |
2974 | 45 | WindowThread* wt = GetWindowThread(); | 51 | WindowThread* wt = GetWindowThread(); |
2975 | @@ -157,46 +163,264 @@ | |||
2976 | 157 | { | 163 | { |
2977 | 158 | full_view_draw_cmd_ = false; | 164 | full_view_draw_cmd_ = false; |
2978 | 159 | 165 | ||
2982 | 160 | graphics_engine.PushModelViewMatrix(Get2DMatrix()); | 166 | if (RedirectRenderingToTexture()) |
2980 | 161 | |||
2981 | 162 | if (force_draw) | ||
2983 | 163 | { | 167 | { |
2994 | 164 | GetPainter().PaintBackground(graphics_engine, GetGeometry()); | 168 | if (update_backup_texture_ || force_draw || draw_cmd_queued_) |
2995 | 165 | GetPainter().PushPaintLayerStack(); | 169 | { |
2996 | 166 | 170 | GetPainter().PushPaintLayerStack(); | |
2997 | 167 | draw_cmd_queued_ = true; | 171 | BeginBackupTextureRendering(graphics_engine, force_draw); |
2998 | 168 | full_view_draw_cmd_ = true; | 172 | { |
2999 | 169 | Draw(graphics_engine, force_draw); | 173 | graphics_engine.PushModelViewMatrix(Get2DMatrix()); |
3000 | 170 | DrawContent(graphics_engine, force_draw); | 174 | |
3001 | 171 | PostDraw(graphics_engine, force_draw); | 175 | Geometry translated_geo = GetGeometry(); |
3002 | 172 | 176 | translated_geo.x = 0; | |
3003 | 173 | GetPainter().PopPaintLayerStack(); | 177 | translated_geo.y = 0; |
3004 | 178 | if (force_draw) | ||
3005 | 179 | { | ||
3006 | 180 | draw_cmd_queued_ = true; | ||
3007 | 181 | full_view_draw_cmd_ = true; | ||
3008 | 182 | Draw(graphics_engine, force_draw); | ||
3009 | 183 | DrawContent(graphics_engine, force_draw); | ||
3010 | 184 | PostDraw(graphics_engine, force_draw); | ||
3011 | 185 | } | ||
3012 | 186 | else | ||
3013 | 187 | { | ||
3014 | 188 | if (draw_cmd_queued_) | ||
3015 | 189 | { | ||
3016 | 190 | full_view_draw_cmd_ = true; | ||
3017 | 191 | Draw(graphics_engine, false); | ||
3018 | 192 | DrawContent(graphics_engine, false); | ||
3019 | 193 | PostDraw(graphics_engine, false); | ||
3020 | 194 | } | ||
3021 | 195 | else if (update_backup_texture_) | ||
3022 | 196 | { | ||
3023 | 197 | DrawContent(graphics_engine, false); | ||
3024 | 198 | PostDraw(graphics_engine, false); | ||
3025 | 199 | } | ||
3026 | 200 | } | ||
3027 | 201 | graphics_engine.PopModelViewMatrix(); | ||
3028 | 202 | } | ||
3029 | 203 | EndBackupTextureRendering(graphics_engine, force_draw); | ||
3030 | 204 | GetPainter().PopPaintLayerStack(); | ||
3031 | 205 | } | ||
3032 | 206 | |||
3033 | 207 | if (PresentRedirectedView()) | ||
3034 | 208 | { | ||
3035 | 209 | unsigned int current_alpha_blend; | ||
3036 | 210 | unsigned int current_src_blend_factor; | ||
3037 | 211 | unsigned int current_dest_blend_factor; | ||
3038 | 212 | // Be a good citizen, get a copy of the current GPU sates according to Nux | ||
3039 | 213 | graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); | ||
3040 | 214 | |||
3041 | 215 | TexCoordXForm texxform; | ||
3042 | 216 | |||
3043 | 217 | if ((force_draw || draw_cmd_queued_) && (background_texture_.IsValid())) | ||
3044 | 218 | { | ||
3045 | 219 | graphics_engine.GetRenderStates().SetBlend(false); | ||
3046 | 220 | texxform.FlipVCoord(true); | ||
3047 | 221 | // Draw the background of this view. | ||
3048 | 222 | GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), background_texture_->GetWidth(), background_texture_->GetHeight(), background_texture_, texxform, color::White); | ||
3049 | 223 | } | ||
3050 | 224 | |||
3051 | 225 | texxform.uwrap = TEXWRAP_CLAMP; | ||
3052 | 226 | texxform.vwrap = TEXWRAP_CLAMP; | ||
3053 | 227 | texxform.FlipVCoord(true); | ||
3054 | 228 | |||
3055 | 229 | graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); | ||
3056 | 230 | GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), GetWidth(), GetHeight(), backup_texture_, texxform, Color(color::White)); | ||
3057 | 231 | // Be a good citizen, restore the Nux blending states. | ||
3058 | 232 | graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor); | ||
3059 | 233 | } | ||
3060 | 174 | } | 234 | } |
3061 | 175 | else | 235 | else |
3062 | 176 | { | 236 | { |
3064 | 177 | if (draw_cmd_queued_) | 237 | graphics_engine.PushModelViewMatrix(Get2DMatrix()); |
3065 | 238 | |||
3066 | 239 | if (force_draw) | ||
3067 | 178 | { | 240 | { |
3068 | 179 | GetPainter().PaintBackground(graphics_engine, GetGeometry()); | 241 | GetPainter().PaintBackground(graphics_engine, GetGeometry()); |
3069 | 180 | GetPainter().PushPaintLayerStack(); | 242 | GetPainter().PushPaintLayerStack(); |
3070 | 181 | 243 | ||
3071 | 244 | draw_cmd_queued_ = true; | ||
3072 | 182 | full_view_draw_cmd_ = true; | 245 | full_view_draw_cmd_ = true; |
3076 | 183 | Draw(graphics_engine, false); | 246 | Draw(graphics_engine, force_draw); |
3077 | 184 | DrawContent(graphics_engine, false); | 247 | DrawContent(graphics_engine, force_draw); |
3078 | 185 | PostDraw(graphics_engine, false); | 248 | PostDraw(graphics_engine, force_draw); |
3079 | 186 | 249 | ||
3080 | 187 | GetPainter().PopPaintLayerStack(); | 250 | GetPainter().PopPaintLayerStack(); |
3081 | 188 | } | 251 | } |
3082 | 189 | else | 252 | else |
3083 | 190 | { | 253 | { |
3089 | 191 | DrawContent(graphics_engine, false); | 254 | if (draw_cmd_queued_) |
3090 | 192 | PostDraw(graphics_engine, false); | 255 | { |
3091 | 193 | } | 256 | GetPainter().PaintBackground(graphics_engine, GetGeometry()); |
3092 | 194 | } | 257 | GetPainter().PushPaintLayerStack(); |
3093 | 195 | 258 | ||
3094 | 259 | full_view_draw_cmd_ = true; | ||
3095 | 260 | Draw(graphics_engine, false); | ||
3096 | 261 | DrawContent(graphics_engine, false); | ||
3097 | 262 | PostDraw(graphics_engine, false); | ||
3098 | 263 | |||
3099 | 264 | GetPainter().PopPaintLayerStack(); | ||
3100 | 265 | } | ||
3101 | 266 | else | ||
3102 | 267 | { | ||
3103 | 268 | DrawContent(graphics_engine, false); | ||
3104 | 269 | PostDraw(graphics_engine, false); | ||
3105 | 270 | } | ||
3106 | 271 | } | ||
3107 | 272 | |||
3108 | 273 | graphics_engine.PopModelViewMatrix(); | ||
3109 | 274 | } | ||
3110 | 275 | |||
3111 | 276 | if (view_layout_) | ||
3112 | 277 | { | ||
3113 | 278 | view_layout_->ResetQueueDraw(); | ||
3114 | 279 | } | ||
3115 | 280 | |||
3116 | 281 | draw_cmd_queued_ = false; | ||
3117 | 282 | child_draw_cmd_queued_ = false; | ||
3118 | 283 | full_view_draw_cmd_ = false; | ||
3119 | 284 | update_backup_texture_ = false; | ||
3120 | 285 | } | ||
3121 | 286 | |||
3122 | 287 | void View::BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw) | ||
3123 | 288 | { | ||
3124 | 289 | ObjectPtr<IOpenGLBaseTexture> active_fbo_texture; | ||
3125 | 290 | if (force_draw || draw_cmd_queued_) | ||
3126 | 291 | { | ||
3127 | 292 | // Get the active fbo color texture | ||
3128 | 293 | active_fbo_texture = GetGraphicsDisplay()->GetGpuDevice()->ActiveFboTextureAttachment(0); | ||
3129 | 294 | } | ||
3130 | 295 | |||
3131 | 296 | Geometry xform_geo; | ||
3132 | 297 | // Compute position in the active fbo texture. | ||
3133 | 298 | xform_geo = graphics_engine.ModelViewXFormRect(GetGeometry()); | ||
3134 | 299 | |||
3135 | 300 | // Get the active fbo... | ||
3136 | 301 | prev_fbo_ = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject(); | ||
3137 | 302 | // ... and the size of the view port rectangle. | ||
3138 | 303 | prev_viewport_ = graphics_engine.GetViewportRect(); | ||
3139 | 304 | |||
3140 | 305 | const int width = GetWidth(); | ||
3141 | 306 | const int height = GetHeight(); | ||
3142 | 307 | |||
3143 | 308 | // Compute intersection with active fbo. | ||
3144 | 309 | Geometry intersection = xform_geo; | ||
3145 | 310 | if (active_fbo_texture.IsValid()) | ||
3146 | 311 | { | ||
3147 | 312 | Geometry active_fbo_geo(0, 0, active_fbo_texture->GetWidth(), active_fbo_texture->GetHeight()); | ||
3148 | 313 | intersection = active_fbo_geo.Intersect(xform_geo); | ||
3149 | 314 | } | ||
3150 | 315 | |||
3151 | 316 | if (backup_fbo_.IsNull()) | ||
3152 | 317 | { | ||
3153 | 318 | // Create the fbo before using it for the first time. | ||
3154 | 319 | backup_fbo_ = GetGraphicsDisplay()->GetGpuDevice()->CreateFrameBufferObject(); | ||
3155 | 320 | } | ||
3156 | 321 | |||
3157 | 322 | if (!backup_texture_.IsValid() || (backup_texture_->GetWidth() != width) || (backup_texture_->GetHeight() != height)) | ||
3158 | 323 | { | ||
3159 | 324 | // Create or resize the color and depth textures before using them. | ||
3160 | 325 | backup_texture_ = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(width, height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | ||
3161 | 326 | backup_depth_texture_ = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(width, height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION); | ||
3162 | 327 | } | ||
3163 | 328 | |||
3164 | 329 | if (!background_texture_.IsValid() || (background_texture_->GetWidth() != intersection.width) || (background_texture_->GetHeight() != intersection.height)) | ||
3165 | 330 | { | ||
3166 | 331 | background_texture_ = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(intersection.width, intersection.height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION); | ||
3167 | 332 | } | ||
3168 | 333 | |||
3169 | 334 | backup_fbo_->FormatFrameBufferObject(width, height, BITFMT_R8G8B8A8); | ||
3170 | 335 | backup_fbo_->EmptyClippingRegion(); | ||
3171 | 336 | |||
3172 | 337 | graphics_engine.SetViewport(0, 0, width, height); | ||
3173 | 338 | graphics_engine.SetOrthographicProjectionMatrix(width, height); | ||
3174 | 339 | |||
3175 | 340 | // Draw the background on the previous fbo texture | ||
3176 | 341 | if ((force_draw || draw_cmd_queued_) && background_texture_.IsValid()) | ||
3177 | 342 | { | ||
3178 | 343 | backup_fbo_->FormatFrameBufferObject(intersection.width, intersection.height, BITFMT_R8G8B8A8); | ||
3179 | 344 | backup_fbo_->EmptyClippingRegion(); | ||
3180 | 345 | |||
3181 | 346 | graphics_engine.SetViewport(0, 0, intersection.width, intersection.height); | ||
3182 | 347 | graphics_engine.SetOrthographicProjectionMatrix(intersection.width, intersection.height); | ||
3183 | 348 | |||
3184 | 349 | // Set the background texture in the fbo | ||
3185 | 350 | backup_fbo_->SetTextureAttachment(0, background_texture_, 0); | ||
3186 | 351 | backup_fbo_->SetDepthTextureAttachment(ObjectPtr<IOpenGLBaseTexture>(0), 0); | ||
3187 | 352 | backup_fbo_->Activate(); | ||
3188 | 353 | graphics_engine.SetViewport(0, 0, background_texture_->GetWidth(), background_texture_->GetHeight()); | ||
3189 | 354 | |||
3190 | 355 | // Clear surface | ||
3191 | 356 | // Clear surface | ||
3192 | 357 | CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f)); | ||
3193 | 358 | CHECKGL(glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)); | ||
3194 | 359 | |||
3195 | 360 | TexCoordXForm texxform; | ||
3196 | 361 | texxform.uoffset = xform_geo.x / (float) active_fbo_texture->GetWidth(); | ||
3197 | 362 | texxform.voffset = xform_geo.y / (float) active_fbo_texture->GetHeight(); | ||
3198 | 363 | texxform.SetTexCoordType(TexCoordXForm::OFFSET_COORD); | ||
3199 | 364 | texxform.flip_v_coord = true; | ||
3200 | 365 | |||
3201 | 366 | // Temporarily change the model-view matrix to copy the texture background texture. | ||
3202 | 367 | // This way we are not affceted by the regular model-view matrix. | ||
3203 | 368 | graphics_engine.SetModelViewMatrix(Matrix4::IDENTITY()); | ||
3204 | 369 | // Copy the texture from the previous fbo attachment into our background texture. | ||
3205 | 370 | if (copy_previous_fbo_for_background_) | ||
3206 | 371 | { | ||
3207 | 372 | graphics_engine.QRP_1Tex(0, 0, intersection.width, intersection.height, active_fbo_texture, texxform, color::White); | ||
3208 | 373 | } | ||
3209 | 374 | else | ||
3210 | 375 | { | ||
3211 | 376 | graphics_engine.QRP_Color(0, 0, intersection.width, intersection.height, Color(0.0f, 0.0f, 0.0f, 0.0f)); | ||
3212 | 377 | } | ||
3213 | 378 | // Restore the model-view matrix. | ||
3214 | 379 | graphics_engine.ApplyModelViewMatrix(); | ||
3215 | 380 | } | ||
3216 | 381 | |||
3217 | 382 | backup_fbo_->FormatFrameBufferObject(width, height, BITFMT_R8G8B8A8); | ||
3218 | 383 | backup_fbo_->EmptyClippingRegion(); | ||
3219 | 384 | backup_fbo_->SetTextureAttachment(0, backup_texture_, 0); | ||
3220 | 385 | backup_fbo_->SetDepthTextureAttachment(backup_depth_texture_, 0); | ||
3221 | 386 | backup_fbo_->Activate(); | ||
3222 | 387 | |||
3223 | 388 | if (force_draw || draw_cmd_queued_) | ||
3224 | 389 | { | ||
3225 | 390 | CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f)); | ||
3226 | 391 | CHECKGL(glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT)); | ||
3227 | 392 | } | ||
3228 | 393 | |||
3229 | 394 | graphics_engine.SetViewport(0, 0, width, height); | ||
3230 | 395 | graphics_engine.SetOrthographicProjectionMatrix(width, height); | ||
3231 | 396 | // Transform the geometry of this area through the current model view matrix. This gives the | ||
3232 | 397 | // the position of the view in the active fbo texture. | ||
3233 | 398 | Geometry offset_rect = graphics_engine.ModelViewXFormRect(GetGeometry()); | ||
3234 | 399 | int x_offset = -offset_rect.x; | ||
3235 | 400 | int y_offset = -offset_rect.y; | ||
3236 | 401 | graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(x_offset, y_offset, 0)); | ||
3237 | 402 | |||
3238 | 403 | } | ||
3239 | 404 | |||
3240 | 405 | void View::EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw) | ||
3241 | 406 | { | ||
3242 | 196 | graphics_engine.PopModelViewMatrix(); | 407 | graphics_engine.PopModelViewMatrix(); |
3243 | 197 | 408 | ||
3246 | 198 | draw_cmd_queued_ = false; | 409 | if (prev_fbo_.IsValid()) |
3247 | 199 | full_view_draw_cmd_ = false; | 410 | { |
3248 | 411 | // Restore the previous fbo | ||
3249 | 412 | prev_fbo_->Activate(); | ||
3250 | 413 | |||
3251 | 414 | prev_fbo_->ApplyClippingRegion(); | ||
3252 | 415 | } | ||
3253 | 416 | |||
3254 | 417 | // Release the reference on the previous fbo | ||
3255 | 418 | prev_fbo_.Release(); | ||
3256 | 419 | |||
3257 | 420 | // Restore the matrices and the view port. | ||
3258 | 421 | graphics_engine.ApplyModelViewMatrix(); | ||
3259 | 422 | graphics_engine.SetOrthographicProjectionMatrix(prev_viewport_.width, prev_viewport_.height); | ||
3260 | 423 | graphics_engine.SetViewport(prev_viewport_.x, prev_viewport_.y, prev_viewport_.width, prev_viewport_.height); | ||
3261 | 200 | } | 424 | } |
3262 | 201 | 425 | ||
3263 | 202 | void View::Draw(GraphicsEngine &graphics_engine, bool force_draw) | 426 | void View::Draw(GraphicsEngine &graphics_engine, bool force_draw) |
3264 | @@ -219,19 +443,26 @@ | |||
3265 | 219 | if (draw_cmd_queued_) | 443 | if (draw_cmd_queued_) |
3266 | 220 | return; | 444 | return; |
3267 | 221 | 445 | ||
3268 | 222 | //GetWindowCompositor()..AddToDrawList(this); | ||
3269 | 223 | WindowThread* application = GetWindowThread(); | 446 | WindowThread* application = GetWindowThread(); |
3270 | 224 | if (application) | 447 | if (application) |
3271 | 225 | { | 448 | { |
3272 | 226 | application->AddToDrawList(this); | 449 | application->AddToDrawList(this); |
3273 | 227 | application->RequestRedraw(); | 450 | application->RequestRedraw(); |
3274 | 228 | //GetWindowCompositor().AddToDrawList(this); | ||
3275 | 229 | } | 451 | } |
3276 | 452 | |||
3277 | 453 | // Report to a parent view with redirect_rendering_to_texture_ set to true that one of its children | ||
3278 | 454 | // needs to be redrawn. | ||
3279 | 455 | PrepareParentRedirectedView(); | ||
3280 | 456 | |||
3281 | 230 | if (view_layout_) | 457 | if (view_layout_) |
3282 | 458 | { | ||
3283 | 459 | // If this view has requested a draw, then all of it children in the view_layout_ | ||
3284 | 460 | // need to be redrawn as well. | ||
3285 | 231 | view_layout_->QueueDraw(); | 461 | view_layout_->QueueDraw(); |
3286 | 462 | } | ||
3287 | 232 | 463 | ||
3288 | 233 | draw_cmd_queued_ = true; | 464 | draw_cmd_queued_ = true; |
3290 | 234 | OnQueueDraw.emit(this); | 465 | queue_draw.emit(this); |
3291 | 235 | } | 466 | } |
3292 | 236 | 467 | ||
3293 | 237 | void View::NeedSoftRedraw() | 468 | void View::NeedSoftRedraw() |
3294 | @@ -310,9 +541,19 @@ | |||
3295 | 310 | 541 | ||
3296 | 311 | LayoutAdded.emit(this, view_layout_); | 542 | LayoutAdded.emit(this, view_layout_); |
3297 | 312 | 543 | ||
3298 | 544 | view_layout_->queue_draw.connect(sigc::mem_fun(this, &View::ChildViewQueuedDraw)); | ||
3299 | 545 | view_layout_->child_queue_draw.connect(sigc::mem_fun(this, &View::ChildViewQueuedDraw)); | ||
3300 | 313 | return true; | 546 | return true; |
3301 | 314 | } | 547 | } |
3302 | 315 | 548 | ||
3303 | 549 | void View::ChildViewQueuedDraw(Area* area) | ||
3304 | 550 | { | ||
3305 | 551 | if (child_draw_cmd_queued_) | ||
3306 | 552 | return; | ||
3307 | 553 | child_draw_cmd_queued_ = true; | ||
3308 | 554 | child_queue_draw.emit(area); | ||
3309 | 555 | } | ||
3310 | 556 | |||
3311 | 316 | void View::OnChildFocusChanged(/*Area *parent,*/ Area *child) | 557 | void View::OnChildFocusChanged(/*Area *parent,*/ Area *child) |
3312 | 317 | { | 558 | { |
3313 | 318 | ChildFocusChanged.emit(/*parent,*/ child); | 559 | ChildFocusChanged.emit(/*parent,*/ child); |
3314 | @@ -354,9 +595,16 @@ | |||
3315 | 354 | return false; | 595 | return false; |
3316 | 355 | } | 596 | } |
3317 | 356 | 597 | ||
3319 | 357 | void View::SetGeometry(const Geometry &geo) | 598 | // void View::SetGeometry(int x, int y, int w, int h) |
3320 | 599 | // { | ||
3321 | 600 | // Area::SetGeometry(x, y, w, h); | ||
3322 | 601 | // ComputeContentSize(); | ||
3323 | 602 | // PostResizeGeometry(); | ||
3324 | 603 | // } | ||
3325 | 604 | |||
3326 | 605 | void View::SetGeometry(const Geometry& geo) | ||
3327 | 358 | { | 606 | { |
3329 | 359 | Area::SetGeometry(geo); | 607 | Area::SetGeometry(geo.x, geo.y, geo.width, geo.height); |
3330 | 360 | ComputeContentSize(); | 608 | ComputeContentSize(); |
3331 | 361 | PostResizeGeometry(); | 609 | PostResizeGeometry(); |
3332 | 362 | } | 610 | } |
3333 | @@ -410,14 +658,20 @@ | |||
3334 | 410 | return view_enabled_; | 658 | return view_enabled_; |
3335 | 411 | } | 659 | } |
3336 | 412 | 660 | ||
3338 | 413 | void View::GeometryChangePending() | 661 | void View::GeometryChangePending(bool position_about_to_change, bool size_about_to_change) |
3339 | 414 | { | 662 | { |
3340 | 415 | if (IsLayoutDone()) | 663 | if (IsLayoutDone()) |
3341 | 416 | QueueDraw(); | 664 | QueueDraw(); |
3342 | 417 | } | 665 | } |
3343 | 418 | 666 | ||
3345 | 419 | void View::GeometryChanged() | 667 | void View::GeometryChanged(bool position_has_changed, bool size_has_changed) |
3346 | 420 | { | 668 | { |
3347 | 669 | if (RedirectedAncestor()) | ||
3348 | 670 | { | ||
3349 | 671 | if (size_has_changed) | ||
3350 | 672 | QueueDraw(); | ||
3351 | 673 | return; | ||
3352 | 674 | } | ||
3353 | 421 | if (IsLayoutDone()) | 675 | if (IsLayoutDone()) |
3354 | 422 | QueueDraw(); | 676 | QueueDraw(); |
3355 | 423 | } | 677 | } |
3356 | 424 | 678 | ||
3357 | === modified file 'Nux/View.h' | |||
3358 | --- Nux/View.h 2012-05-31 21:50:05 +0000 | |||
3359 | +++ Nux/View.h 2012-09-18 11:05:23 +0000 | |||
3360 | @@ -23,7 +23,6 @@ | |||
3361 | 23 | #ifndef ABSTRACTOBJECTBASE_H | 23 | #ifndef ABSTRACTOBJECTBASE_H |
3362 | 24 | #define ABSTRACTOBJECTBASE_H | 24 | #define ABSTRACTOBJECTBASE_H |
3363 | 25 | 25 | ||
3364 | 26 | #include "Features.h" | ||
3365 | 27 | #include "Nux.h" | 26 | #include "Nux.h" |
3366 | 28 | #include "NuxCore/Property.h" | 27 | #include "NuxCore/Property.h" |
3367 | 29 | 28 | ||
3368 | @@ -48,7 +47,6 @@ | |||
3369 | 48 | /* | 47 | /* |
3370 | 49 | If ComputeContentSize is called while outside of the layout process (\sa IsInsideLayoutCycle) then the parents of | 48 | If ComputeContentSize is called while outside of the layout process (\sa IsInsideLayoutCycle) then the parents of |
3371 | 50 | this object maybe added to the layout queue if this view size changes. \sa Area::ReconfigureParentLayout. | 49 | this object maybe added to the layout queue if this view size changes. \sa Area::ReconfigureParentLayout. |
3372 | 51 | |||
3373 | 52 | */ | 50 | */ |
3374 | 53 | virtual long ComputeContentSize(); | 51 | virtual long ComputeContentSize(); |
3375 | 54 | virtual void ComputeContentPosition(float offsetX, float offsetY); | 52 | virtual void ComputeContentPosition(float offsetX, float offsetY); |
3376 | @@ -85,7 +83,7 @@ | |||
3377 | 85 | virtual void ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw); | 83 | virtual void ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw); |
3378 | 86 | //! Causes a redraw. The widget parameter draw_cmd_queued_ is set to true. The widget Draw(), DrawContent() and PostDraw() are called. | 84 | //! Causes a redraw. The widget parameter draw_cmd_queued_ is set to true. The widget Draw(), DrawContent() and PostDraw() are called. |
3379 | 87 | /*! | 85 | /*! |
3381 | 88 | Emits the signal \i OnQueueDraw. | 86 | Emits the signal \i queue_draw. |
3382 | 89 | */ | 87 | */ |
3383 | 90 | virtual void QueueDraw(); | 88 | virtual void QueueDraw(); |
3384 | 91 | 89 | ||
3385 | @@ -101,6 +99,9 @@ | |||
3386 | 101 | bool SearchInAllSubNodes(Area *bo); | 99 | bool SearchInAllSubNodes(Area *bo); |
3387 | 102 | bool SearchInFirstSubNodes(Area *bo); | 100 | bool SearchInFirstSubNodes(Area *bo); |
3388 | 103 | 101 | ||
3389 | 102 | |||
3390 | 103 | /* void SetGeometry(int x, int y, int w, int h);*/ | ||
3391 | 104 | |||
3392 | 104 | //! Set Geometry | 105 | //! Set Geometry |
3393 | 105 | /* | 106 | /* |
3394 | 106 | Set the Geometry of the View and the geometry of the Default Background Area. | 107 | Set the Geometry of the View and the geometry of the Default Background Area. |
3395 | @@ -144,18 +145,28 @@ | |||
3396 | 144 | void SetFont(ObjectPtr<FontTexture> font); | 145 | void SetFont(ObjectPtr<FontTexture> font); |
3397 | 145 | ObjectPtr<FontTexture> GetFont(); | 146 | ObjectPtr<FontTexture> GetFont(); |
3398 | 146 | 147 | ||
3400 | 147 | sigc::signal<void, View*> OnQueueDraw; //!< Signal emitted when a view is scheduled for a draw. | 148 | sigc::signal<void, View*> queue_draw; //!< Signal emitted when a view is scheduled for a draw. |
3401 | 149 | sigc::signal<void, Area*> child_queue_draw; //!< Signal emitted when a child of this view is scheduled for a draw. | ||
3402 | 148 | 150 | ||
3403 | 149 | virtual Area* KeyNavIteration(KeyNavDirection direction); | 151 | virtual Area* KeyNavIteration(KeyNavDirection direction); |
3404 | 150 | virtual bool AcceptKeyNavFocus(); | 152 | virtual bool AcceptKeyNavFocus(); |
3405 | 151 | 153 | ||
3407 | 152 | void IsHitDetectionSkipingChildren(bool skip_children); | 154 | virtual Area* FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type); |
3408 | 155 | |||
3409 | 156 | virtual Area* FindKeyFocusArea(unsigned int key_symbol, | ||
3410 | 157 | unsigned long x11_key_code, | ||
3411 | 158 | unsigned long special_keys_state); | ||
3412 | 153 | 159 | ||
3413 | 154 | #ifdef NUX_GESTURES_SUPPORT | 160 | #ifdef NUX_GESTURES_SUPPORT |
3414 | 155 | virtual Area* GetInputAreaHitByGesture(const nux::GestureEvent &event); | 161 | virtual Area* GetInputAreaHitByGesture(const nux::GestureEvent &event); |
3415 | 156 | #endif | 162 | #endif |
3416 | 157 | 163 | ||
3417 | 158 | protected: | 164 | protected: |
3418 | 165 | virtual void ChildViewQueuedDraw(Area* area); | ||
3419 | 166 | |||
3420 | 167 | void BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw); | ||
3421 | 168 | |||
3422 | 169 | void EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw); | ||
3423 | 159 | 170 | ||
3424 | 160 | void OnChildFocusChanged(/*Area *parent,*/ Area *child); | 171 | void OnChildFocusChanged(/*Area *parent,*/ Area *child); |
3425 | 161 | sigc::connection _on_focus_changed_handler; | 172 | sigc::connection _on_focus_changed_handler; |
3426 | @@ -191,18 +202,13 @@ | |||
3427 | 191 | */ | 202 | */ |
3428 | 192 | bool IsFullRedraw() const; | 203 | bool IsFullRedraw() const; |
3429 | 193 | 204 | ||
3438 | 194 | virtual void GeometryChangePending(); | 205 | virtual void GeometryChangePending(bool position_about_to_change, bool size_about_to_change); |
3439 | 195 | virtual void GeometryChanged(); | 206 | virtual void GeometryChanged(bool position_has_changed, bool size_has_changed); |
3432 | 196 | |||
3433 | 197 | virtual Area* FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type); | ||
3434 | 198 | |||
3435 | 199 | virtual Area* FindKeyFocusArea(unsigned int key_symbol, | ||
3436 | 200 | unsigned long x11_key_code, | ||
3437 | 201 | unsigned long special_keys_state); | ||
3440 | 202 | 207 | ||
3441 | 203 | Layout *view_layout_; | 208 | Layout *view_layout_; |
3442 | 204 | 209 | ||
3443 | 205 | bool draw_cmd_queued_; //<! The rendering of the view needs to be refreshed. | 210 | bool draw_cmd_queued_; //<! The rendering of the view needs to be refreshed. |
3444 | 211 | bool child_draw_cmd_queued_; //<! A child of this view has requested a draw. | ||
3445 | 206 | 212 | ||
3446 | 207 | bool full_view_draw_cmd_; //<! True if Draw is called before ContentDraw. It is read-only and can be accessed by calling IsFullRedraw(); | 213 | bool full_view_draw_cmd_; //<! True if Draw is called before ContentDraw. It is read-only and can be accessed by calling IsFullRedraw(); |
3447 | 208 | 214 | ||
3448 | @@ -213,8 +219,10 @@ | |||
3449 | 213 | friend class Layout; | 219 | friend class Layout; |
3450 | 214 | friend class Area; | 220 | friend class Area; |
3451 | 215 | friend class LayeredLayout; | 221 | friend class LayeredLayout; |
3452 | 222 | friend class Canvas; | ||
3453 | 223 | friend class VSplitter; | ||
3454 | 224 | friend class HSplitter; | ||
3455 | 216 | }; | 225 | }; |
3456 | 217 | |||
3457 | 218 | } | 226 | } |
3458 | 219 | 227 | ||
3459 | 220 | #endif // ABSTRACTOBJECTBASE_H | 228 | #endif // ABSTRACTOBJECTBASE_H |
3460 | 221 | 229 | ||
3461 | === modified file 'Nux/WindowCompositor.cpp' | |||
3462 | --- Nux/WindowCompositor.cpp 2012-09-14 19:41:27 +0000 | |||
3463 | +++ Nux/WindowCompositor.cpp 2012-09-18 11:05:23 +0000 | |||
3464 | @@ -1428,8 +1428,8 @@ | |||
3465 | 1428 | } | 1428 | } |
3466 | 1429 | 1429 | ||
3467 | 1430 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); | 1430 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); |
3470 | 1431 | m_FrameBufferObject->SetRenderTarget( 0, rt.color_rt->GetSurfaceLevel(0)); | 1431 | m_FrameBufferObject->SetTextureAttachment(0, rt.color_rt, 0); |
3471 | 1432 | m_FrameBufferObject->SetDepthSurface( rt.depth_rt->GetSurfaceLevel(0)); | 1432 | m_FrameBufferObject->SetDepthTextureAttachment(rt.depth_rt, 0); |
3472 | 1433 | m_FrameBufferObject->Activate(); | 1433 | m_FrameBufferObject->Activate(); |
3473 | 1434 | graphics_engine.SetViewport(0, 0, buffer_width, buffer_height); | 1434 | graphics_engine.SetViewport(0, 0, buffer_width, buffer_height); |
3474 | 1435 | graphics_engine.SetOrthographicProjectionMatrix(buffer_width, buffer_height); | 1435 | graphics_engine.SetOrthographicProjectionMatrix(buffer_width, buffer_height); |
3475 | @@ -1496,8 +1496,8 @@ | |||
3476 | 1496 | } | 1496 | } |
3477 | 1497 | 1497 | ||
3478 | 1498 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); | 1498 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); |
3481 | 1499 | m_FrameBufferObject->SetRenderTarget(0, m_MainColorRT->GetSurfaceLevel(0)); | 1499 | m_FrameBufferObject->SetTextureAttachment(0, m_MainColorRT, 0); |
3482 | 1500 | m_FrameBufferObject->SetDepthSurface(m_MainDepthRT->GetSurfaceLevel(0)); | 1500 | m_FrameBufferObject->SetDepthTextureAttachment(m_MainDepthRT, 0); |
3483 | 1501 | m_FrameBufferObject->Activate(); | 1501 | m_FrameBufferObject->Activate(); |
3484 | 1502 | 1502 | ||
3485 | 1503 | window_thread_->GetGraphicsEngine().EmptyClippingRegion(); | 1503 | window_thread_->GetGraphicsEngine().EmptyClippingRegion(); |
3486 | @@ -1573,8 +1573,8 @@ | |||
3487 | 1573 | nuxAssert(m_MainColorRT->GetWidth() == window_width); | 1573 | nuxAssert(m_MainColorRT->GetWidth() == window_width); |
3488 | 1574 | nuxAssert(m_MainColorRT->GetHeight() == window_height); | 1574 | nuxAssert(m_MainColorRT->GetHeight() == window_height); |
3489 | 1575 | m_FrameBufferObject->FormatFrameBufferObject(window_width, window_height, BITFMT_R8G8B8A8); | 1575 | m_FrameBufferObject->FormatFrameBufferObject(window_width, window_height, BITFMT_R8G8B8A8); |
3492 | 1576 | m_FrameBufferObject->SetRenderTarget( 0, m_MainColorRT->GetSurfaceLevel(0)); | 1576 | m_FrameBufferObject->SetTextureAttachment(0, m_MainColorRT, 0); |
3493 | 1577 | m_FrameBufferObject->SetDepthSurface( m_MainDepthRT->GetSurfaceLevel(0)); | 1577 | m_FrameBufferObject->SetDepthTextureAttachment(m_MainDepthRT, 0); |
3494 | 1578 | m_FrameBufferObject->Activate(); | 1578 | m_FrameBufferObject->Activate(); |
3495 | 1579 | } | 1579 | } |
3496 | 1580 | else | 1580 | else |
3497 | @@ -1923,8 +1923,8 @@ | |||
3498 | 1923 | 1923 | ||
3499 | 1924 | // Clear the buffer the first time... | 1924 | // Clear the buffer the first time... |
3500 | 1925 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); | 1925 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); |
3503 | 1926 | m_FrameBufferObject->SetRenderTarget(0, m_MainColorRT->GetSurfaceLevel(0)); | 1926 | m_FrameBufferObject->SetTextureAttachment(0, m_MainColorRT, 0); |
3504 | 1927 | m_FrameBufferObject->SetDepthSurface(m_MainDepthRT->GetSurfaceLevel(0)); | 1927 | m_FrameBufferObject->SetDepthTextureAttachment(m_MainDepthRT, 0); |
3505 | 1928 | m_FrameBufferObject->Activate(); | 1928 | m_FrameBufferObject->Activate(); |
3506 | 1929 | 1929 | ||
3507 | 1930 | CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f)); | 1930 | CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f)); |
3508 | @@ -1966,8 +1966,8 @@ | |||
3509 | 1966 | } | 1966 | } |
3510 | 1967 | 1967 | ||
3511 | 1968 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); | 1968 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); |
3514 | 1969 | m_FrameBufferObject->SetRenderTarget(0, rt.color_rt->GetSurfaceLevel(0)); | 1969 | m_FrameBufferObject->SetTextureAttachment(0, rt.color_rt, 0); |
3515 | 1970 | m_FrameBufferObject->SetDepthSurface(rt.depth_rt->GetSurfaceLevel(0)); | 1970 | m_FrameBufferObject->SetDepthTextureAttachment(rt.depth_rt, 0); |
3516 | 1971 | m_FrameBufferObject->Activate(); | 1971 | m_FrameBufferObject->Activate(); |
3517 | 1972 | 1972 | ||
3518 | 1973 | window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height); | 1973 | window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height); |
3519 | @@ -1984,8 +1984,8 @@ | |||
3520 | 1984 | nuxAssert(buffer_height >= 1); | 1984 | nuxAssert(buffer_height >= 1); |
3521 | 1985 | // Restore Main Frame Buffer | 1985 | // Restore Main Frame Buffer |
3522 | 1986 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); | 1986 | m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8); |
3525 | 1987 | m_FrameBufferObject->SetRenderTarget(0, m_MainColorRT->GetSurfaceLevel(0)); | 1987 | m_FrameBufferObject->SetTextureAttachment(0, m_MainColorRT, 0); |
3526 | 1988 | m_FrameBufferObject->SetDepthSurface(m_MainDepthRT->GetSurfaceLevel(0)); | 1988 | m_FrameBufferObject->SetDepthTextureAttachment(m_MainDepthRT, 0); |
3527 | 1989 | m_FrameBufferObject->Activate(); | 1989 | m_FrameBufferObject->Activate(); |
3528 | 1990 | 1990 | ||
3529 | 1991 | window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height); | 1991 | window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height); |
3530 | 1992 | 1992 | ||
3531 | === modified file 'Nux/WindowCompositor.h' | |||
3532 | --- Nux/WindowCompositor.h 2012-09-03 18:39:58 +0000 | |||
3533 | +++ Nux/WindowCompositor.h 2012-09-18 11:05:23 +0000 | |||
3534 | @@ -23,7 +23,6 @@ | |||
3535 | 23 | #ifndef WINDOWCOMPOSITOR_H | 23 | #ifndef WINDOWCOMPOSITOR_H |
3536 | 24 | #define WINDOWCOMPOSITOR_H | 24 | #define WINDOWCOMPOSITOR_H |
3537 | 25 | 25 | ||
3538 | 26 | #include "Features.h" | ||
3539 | 27 | #include "BaseWindow.h" | 26 | #include "BaseWindow.h" |
3540 | 28 | 27 | ||
3541 | 29 | #include <sigc++/trackable.h> | 28 | #include <sigc++/trackable.h> |
3542 | 30 | 29 | ||
3543 | === modified file 'Nux/WindowThread.cpp' | |||
3544 | --- Nux/WindowThread.cpp 2012-08-02 17:46:47 +0000 | |||
3545 | +++ Nux/WindowThread.cpp 2012-09-18 11:05:23 +0000 | |||
3546 | @@ -19,7 +19,6 @@ | |||
3547 | 19 | * | 19 | * |
3548 | 20 | */ | 20 | */ |
3549 | 21 | 21 | ||
3550 | 22 | #include "Features.h" | ||
3551 | 23 | #include "Nux.h" | 22 | #include "Nux.h" |
3552 | 24 | #include "Layout.h" | 23 | #include "Layout.h" |
3553 | 25 | #include "NuxCore/Logger.h" | 24 | #include "NuxCore/Logger.h" |
3554 | 26 | 25 | ||
3555 | === modified file 'Nux/WindowThread.h' | |||
3556 | --- Nux/WindowThread.h 2012-05-31 21:40:37 +0000 | |||
3557 | +++ Nux/WindowThread.h 2012-09-18 11:05:23 +0000 | |||
3558 | @@ -24,7 +24,6 @@ | |||
3559 | 24 | #define WINDOWTHREAD_H | 24 | #define WINDOWTHREAD_H |
3560 | 25 | 25 | ||
3561 | 26 | #include "TimerProc.h" | 26 | #include "TimerProc.h" |
3562 | 27 | #include "Features.h" | ||
3563 | 28 | 27 | ||
3564 | 29 | #ifdef NUX_GESTURES_SUPPORT | 28 | #ifdef NUX_GESTURES_SUPPORT |
3565 | 30 | #include "GeisAdapter.h" | 29 | #include "GeisAdapter.h" |
3566 | 31 | 30 | ||
3567 | === modified file 'NuxCore/Animation.cpp' | |||
3568 | --- NuxCore/Animation.cpp 2012-07-13 04:58:08 +0000 | |||
3569 | +++ NuxCore/Animation.cpp 2012-09-18 11:05:23 +0000 | |||
3570 | @@ -20,8 +20,9 @@ | |||
3571 | 20 | * | 20 | * |
3572 | 21 | */ | 21 | */ |
3573 | 22 | 22 | ||
3576 | 23 | #include <Animation.h> | 23 | #include "NuxCore.h" |
3577 | 24 | #include <AnimationController.h> | 24 | #include "Animation.h" |
3578 | 25 | #include "AnimationController.h" | ||
3579 | 25 | 26 | ||
3580 | 26 | namespace na = nux::animation; | 27 | namespace na = nux::animation; |
3581 | 27 | 28 | ||
3582 | 28 | 29 | ||
3583 | === modified file 'NuxCore/AnimationController.cpp' | |||
3584 | --- NuxCore/AnimationController.cpp 2012-07-13 04:58:08 +0000 | |||
3585 | +++ NuxCore/AnimationController.cpp 2012-09-18 11:05:23 +0000 | |||
3586 | @@ -20,6 +20,7 @@ | |||
3587 | 20 | * | 20 | * |
3588 | 21 | */ | 21 | */ |
3589 | 22 | 22 | ||
3590 | 23 | #include "NuxCore.h" | ||
3591 | 23 | #include "AnimationController.h" | 24 | #include "AnimationController.h" |
3592 | 24 | #include "Animation.h" | 25 | #include "Animation.h" |
3593 | 25 | 26 | ||
3594 | 26 | 27 | ||
3595 | === modified file 'NuxCore/AnimationController.h' | |||
3596 | --- NuxCore/AnimationController.h 2012-07-12 23:55:40 +0000 | |||
3597 | +++ NuxCore/AnimationController.h 2012-09-18 11:05:23 +0000 | |||
3598 | @@ -59,8 +59,13 @@ | |||
3599 | 59 | virtual void RemoveAnimation(Animation* animation) = 0; | 59 | virtual void RemoveAnimation(Animation* animation) = 0; |
3600 | 60 | 60 | ||
3601 | 61 | private: | 61 | private: |
3602 | 62 | #if defined(NUX_OS_WINDOWS) && !defined(NUX_VISUAL_STUDIO_VC11) | ||
3603 | 63 | Controller(Controller const&); | ||
3604 | 64 | Controller& operator = (Controller const&); | ||
3605 | 65 | #else | ||
3606 | 62 | Controller(Controller const&) = delete; | 66 | Controller(Controller const&) = delete; |
3608 | 63 | Controller& operator=(Controller const&) = delete; | 67 | Controller& operator = (Controller const&) = delete; |
3609 | 68 | #endif | ||
3610 | 64 | }; | 69 | }; |
3611 | 65 | 70 | ||
3612 | 66 | class AnimationController : public Controller, public sigc::trackable | 71 | class AnimationController : public Controller, public sigc::trackable |
3613 | 67 | 72 | ||
3614 | === modified file 'NuxCore/Color.cpp' | |||
3615 | --- NuxCore/Color.cpp 2012-05-24 18:08:18 +0000 | |||
3616 | +++ NuxCore/Color.cpp 2012-09-18 11:05:23 +0000 | |||
3617 | @@ -139,7 +139,7 @@ | |||
3618 | 139 | return (((std::rand() % 255) << 24) | | 139 | return (((std::rand() % 255) << 24) | |
3619 | 140 | ((std::rand() % 255) << 16) | | 140 | ((std::rand() % 255) << 16) | |
3620 | 141 | ((std::rand() % 255) << 8) | | 141 | ((std::rand() % 255) << 8) | |
3622 | 142 | (std::rand() % 255)); | 142 | (255)); |
3623 | 143 | } | 143 | } |
3624 | 144 | 144 | ||
3625 | 145 | Color operator + (Color const& lhs, Color const& rhs) | 145 | Color operator + (Color const& lhs, Color const& rhs) |
3626 | 146 | 146 | ||
3627 | === modified file 'NuxCore/EasingCurve.cpp' | |||
3628 | --- NuxCore/EasingCurve.cpp 2012-07-17 04:01:54 +0000 | |||
3629 | +++ NuxCore/EasingCurve.cpp 2012-09-18 11:05:23 +0000 | |||
3630 | @@ -20,6 +20,7 @@ | |||
3631 | 20 | * | 20 | * |
3632 | 21 | */ | 21 | */ |
3633 | 22 | 22 | ||
3634 | 23 | #include "NuxCore.h" | ||
3635 | 23 | #include "EasingCurve.h" | 24 | #include "EasingCurve.h" |
3636 | 24 | 25 | ||
3637 | 25 | namespace na = nux::animation; | 26 | namespace na = nux::animation; |
3638 | @@ -122,6 +123,15 @@ | |||
3639 | 122 | return in_out(progress, bounce_out); | 123 | return in_out(progress, bounce_out); |
3640 | 123 | } | 124 | } |
3641 | 124 | 125 | ||
3642 | 126 | double expo_ease_in(double progress) | ||
3643 | 127 | { | ||
3644 | 128 | return (progress == 0) ? 0.0 : 1.0 * std::pow (2, 10 * (progress / 1.0 - 1) ) + 0.0; | ||
3645 | 129 | } | ||
3646 | 130 | |||
3647 | 131 | double expo_ease_out(double progress) | ||
3648 | 132 | { | ||
3649 | 133 | return reverse(progress, expo_ease_in); | ||
3650 | 134 | } | ||
3651 | 125 | 135 | ||
3652 | 126 | na::EasingCurve::EasingFunction GetEasingFunction(na::EasingCurve::Type type) | 136 | na::EasingCurve::EasingFunction GetEasingFunction(na::EasingCurve::Type type) |
3653 | 127 | { | 137 | { |
3654 | @@ -145,6 +155,10 @@ | |||
3655 | 145 | return bounce_out; | 155 | return bounce_out; |
3656 | 146 | case na::EasingCurve::Type::BounceInOut: | 156 | case na::EasingCurve::Type::BounceInOut: |
3657 | 147 | return bounce_in_out; | 157 | return bounce_in_out; |
3658 | 158 | case na::EasingCurve::Type::ExpoEaseIn: | ||
3659 | 159 | return expo_ease_in; | ||
3660 | 160 | case na::EasingCurve::Type::ExpoEaseOut: | ||
3661 | 161 | return expo_ease_out; | ||
3662 | 148 | case na::EasingCurve::Type::Linear: | 162 | case na::EasingCurve::Type::Linear: |
3663 | 149 | default: | 163 | default: |
3664 | 150 | return linear; | 164 | return linear; |
3665 | 151 | 165 | ||
3666 | === modified file 'NuxCore/EasingCurve.h' | |||
3667 | --- NuxCore/EasingCurve.h 2012-07-17 04:01:54 +0000 | |||
3668 | +++ NuxCore/EasingCurve.h 2012-09-18 11:05:23 +0000 | |||
3669 | @@ -31,7 +31,11 @@ | |||
3670 | 31 | class EasingCurve | 31 | class EasingCurve |
3671 | 32 | { | 32 | { |
3672 | 33 | public: | 33 | public: |
3673 | 34 | #if defined(NUX_OS_WINDOWS) && !defined(NUX_VISUAL_STUDIO_VC11) | ||
3674 | 35 | enum Type | ||
3675 | 36 | #else | ||
3676 | 34 | enum class Type | 37 | enum class Type |
3677 | 38 | #endif | ||
3678 | 35 | { | 39 | { |
3679 | 36 | Linear, | 40 | Linear, |
3680 | 37 | InQuad, | 41 | InQuad, |
3681 | @@ -43,6 +47,8 @@ | |||
3682 | 43 | BounceIn, | 47 | BounceIn, |
3683 | 44 | BounceOut, | 48 | BounceOut, |
3684 | 45 | BounceInOut, | 49 | BounceInOut, |
3685 | 50 | ExpoEaseIn, | ||
3686 | 51 | ExpoEaseOut | ||
3687 | 46 | }; | 52 | }; |
3688 | 47 | 53 | ||
3689 | 48 | typedef double (*EasingFunction)(double); | 54 | typedef double (*EasingFunction)(double); |
3690 | 49 | 55 | ||
3691 | === modified file 'NuxGraphics/GLWindowManager.cpp' | |||
3692 | --- NuxGraphics/GLWindowManager.cpp 2011-10-19 20:32:38 +0000 | |||
3693 | +++ NuxGraphics/GLWindowManager.cpp 2012-09-18 11:05:23 +0000 | |||
3694 | @@ -99,7 +99,7 @@ | |||
3695 | 99 | GraphicsDisplay *DisplayAccessController::CreateGLWindow(const char *WindowTitle, unsigned int WindowWidth, unsigned int WindowHeight, | 99 | GraphicsDisplay *DisplayAccessController::CreateGLWindow(const char *WindowTitle, unsigned int WindowWidth, unsigned int WindowHeight, |
3696 | 100 | WindowStyle Style, | 100 | WindowStyle Style, |
3697 | 101 | GraphicsDisplay *GLWindow, | 101 | GraphicsDisplay *GLWindow, |
3699 | 102 | bool FullscreenFlag, | 102 | bool fullscreen_flag, |
3700 | 103 | bool create_rendering_data) | 103 | bool create_rendering_data) |
3701 | 104 | { | 104 | { |
3702 | 105 | if (GetGraphicsDisplay()) | 105 | if (GetGraphicsDisplay()) |
3703 | @@ -110,7 +110,7 @@ | |||
3704 | 110 | } | 110 | } |
3705 | 111 | 111 | ||
3706 | 112 | GraphicsDisplay *glwindow = new GraphicsDisplay(); | 112 | GraphicsDisplay *glwindow = new GraphicsDisplay(); |
3708 | 113 | glwindow->CreateOpenGLWindow(WindowTitle, WindowWidth, WindowHeight, Style, GLWindow, FullscreenFlag, create_rendering_data); | 113 | glwindow->CreateOpenGLWindow(WindowTitle, WindowWidth, WindowHeight, Style, GLWindow, fullscreen_flag, create_rendering_data); |
3709 | 114 | 114 | ||
3710 | 115 | return glwindow; | 115 | return glwindow; |
3711 | 116 | } | 116 | } |
3712 | 117 | 117 | ||
3713 | === modified file 'NuxGraphics/GLWindowManager.h' | |||
3714 | --- NuxGraphics/GLWindowManager.h 2011-10-19 20:32:38 +0000 | |||
3715 | +++ NuxGraphics/GLWindowManager.h 2012-09-18 11:05:23 +0000 | |||
3716 | @@ -49,12 +49,12 @@ | |||
3717 | 49 | @param WindowHeight Window height. | 49 | @param WindowHeight Window height. |
3718 | 50 | @param Style Window style. | 50 | @param Style Window style. |
3719 | 51 | @param parent The parent window. | 51 | @param parent The parent window. |
3721 | 52 | @param FullscreenFlag True to create a full screen window. | 52 | @param fullscreen_flag True to create a full screen window. |
3722 | 53 | @param create_rendering_data If true, then in GraphicsEngine, the system creates the OpenGL shaders and the font textures for the rendering. | 53 | @param create_rendering_data If true, then in GraphicsEngine, the system creates the OpenGL shaders and the font textures for the rendering. |
3723 | 54 | */ | 54 | */ |
3724 | 55 | GraphicsDisplay *CreateGLWindow(const char *WindowTitle, unsigned int WindowWidth, unsigned int WindowHeight, WindowStyle Style, | 55 | GraphicsDisplay *CreateGLWindow(const char *WindowTitle, unsigned int WindowWidth, unsigned int WindowHeight, WindowStyle Style, |
3725 | 56 | GraphicsDisplay *parent, | 56 | GraphicsDisplay *parent, |
3727 | 57 | bool FullscreenFlag = false, | 57 | bool fullscreen_flag = false, |
3728 | 58 | bool create_rendering_data = true); | 58 | bool create_rendering_data = true); |
3729 | 59 | 59 | ||
3730 | 60 | #if defined(NUX_OS_WINDOWS) | 60 | #if defined(NUX_OS_WINDOWS) |
3731 | 61 | 61 | ||
3732 | === modified file 'NuxGraphics/GpuDevice.cpp' | |||
3733 | --- NuxGraphics/GpuDevice.cpp 2012-04-10 21:14:18 +0000 | |||
3734 | +++ NuxGraphics/GpuDevice.cpp 2012-09-18 11:05:23 +0000 | |||
3735 | @@ -622,7 +622,7 @@ | |||
3736 | 622 | NUX_SAFE_DELETE(_gpu_render_states); | 622 | NUX_SAFE_DELETE(_gpu_render_states); |
3737 | 623 | 623 | ||
3738 | 624 | _FrameBufferObject.Release(); | 624 | _FrameBufferObject.Release(); |
3740 | 625 | _CurrentFrameBufferObject.Release(); | 625 | active_framebuffer_object_.Release(); |
3741 | 626 | 626 | ||
3742 | 627 | _PixelBufferArray.clear(); | 627 | _PixelBufferArray.clear(); |
3743 | 628 | 628 | ||
3744 | @@ -916,12 +916,30 @@ | |||
3745 | 916 | 916 | ||
3746 | 917 | void GpuDevice::SetCurrentFrameBufferObject(ObjectPtr<IOpenGLFrameBufferObject> fbo) | 917 | void GpuDevice::SetCurrentFrameBufferObject(ObjectPtr<IOpenGLFrameBufferObject> fbo) |
3747 | 918 | { | 918 | { |
3749 | 919 | _CurrentFrameBufferObject = fbo; | 919 | active_framebuffer_object_ = fbo; |
3750 | 920 | } | 920 | } |
3751 | 921 | 921 | ||
3752 | 922 | ObjectPtr<IOpenGLFrameBufferObject> GpuDevice::GetCurrentFrameBufferObject() | 922 | ObjectPtr<IOpenGLFrameBufferObject> GpuDevice::GetCurrentFrameBufferObject() |
3753 | 923 | { | 923 | { |
3755 | 924 | return _CurrentFrameBufferObject; | 924 | return active_framebuffer_object_; |
3756 | 925 | } | ||
3757 | 926 | |||
3758 | 927 | ObjectPtr<IOpenGLBaseTexture> GpuDevice::ActiveFboTextureAttachment(int color_attachment_index) | ||
3759 | 928 | { | ||
3760 | 929 | if (active_framebuffer_object_.IsValid()) | ||
3761 | 930 | { | ||
3762 | 931 | return active_framebuffer_object_->TextureAttachment(color_attachment_index); | ||
3763 | 932 | } | ||
3764 | 933 | return ObjectPtr<IOpenGLBaseTexture>(0); | ||
3765 | 934 | } | ||
3766 | 935 | |||
3767 | 936 | ObjectPtr<IOpenGLBaseTexture> GpuDevice::ActiveFboDepthTextureAttachment() | ||
3768 | 937 | { | ||
3769 | 938 | if (active_framebuffer_object_.IsValid()) | ||
3770 | 939 | { | ||
3771 | 940 | return active_framebuffer_object_->DepthTextureAttachment(); | ||
3772 | 941 | } | ||
3773 | 942 | return ObjectPtr<IOpenGLBaseTexture>(0); | ||
3774 | 925 | } | 943 | } |
3775 | 926 | 944 | ||
3776 | 927 | void GpuDevice::DeactivateFrameBuffer() | 945 | void GpuDevice::DeactivateFrameBuffer() |
3777 | @@ -932,7 +950,7 @@ | |||
3778 | 932 | return; | 950 | return; |
3779 | 933 | } | 951 | } |
3780 | 934 | 952 | ||
3782 | 935 | _CurrentFrameBufferObject.Release(); | 953 | active_framebuffer_object_.Release(); |
3783 | 936 | CHECKGL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0)); | 954 | CHECKGL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0)); |
3784 | 937 | CHECKGL(glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0)); | 955 | CHECKGL(glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0)); |
3785 | 938 | } | 956 | } |
3786 | @@ -944,6 +962,11 @@ | |||
3787 | 944 | , BitmapFormat PixelFormat | 962 | , BitmapFormat PixelFormat |
3788 | 945 | , NUX_FILE_LINE_DECL) | 963 | , NUX_FILE_LINE_DECL) |
3789 | 946 | { | 964 | { |
3790 | 965 | if ((Width <= 0) || (Height <= 0)) | ||
3791 | 966 | { | ||
3792 | 967 | return ObjectPtr<IOpenGLBaseTexture>(0); | ||
3793 | 968 | } | ||
3794 | 969 | |||
3795 | 947 | if (GetGpuInfo().Support_ARB_Texture_Non_Power_Of_Two()) | 970 | if (GetGpuInfo().Support_ARB_Texture_Non_Power_Of_Two()) |
3796 | 948 | { | 971 | { |
3797 | 949 | return CreateTexture(Width, Height, Levels, PixelFormat, NUX_FILE_LINE_PARAM); | 972 | return CreateTexture(Width, Height, Levels, PixelFormat, NUX_FILE_LINE_PARAM); |
3798 | 950 | 973 | ||
3799 | === modified file 'NuxGraphics/GpuDevice.h' | |||
3800 | --- NuxGraphics/GpuDevice.h 2012-08-02 15:38:08 +0000 | |||
3801 | +++ NuxGraphics/GpuDevice.h 2012-09-18 11:05:23 +0000 | |||
3802 | @@ -302,6 +302,12 @@ | |||
3803 | 302 | ObjectPtr<IOpenGLVertexDeclaration> CreateVertexDeclaration( | 302 | ObjectPtr<IOpenGLVertexDeclaration> CreateVertexDeclaration( |
3804 | 303 | const VERTEXELEMENT *pVertexElements); | 303 | const VERTEXELEMENT *pVertexElements); |
3805 | 304 | 304 | ||
3806 | 305 | //! Create an return an ObjectPtr that encapsulates OpenGL framebuffer object. | ||
3807 | 306 | /*! | ||
3808 | 307 | Create an return an ObjectPtr that encapsulates OpenGL framebuffer object. | ||
3809 | 308 | This function has side effects. It will change the framebuffer object that | ||
3810 | 309 | is set in the GPU. | ||
3811 | 310 | */ | ||
3812 | 305 | ObjectPtr<IOpenGLFrameBufferObject> CreateFrameBufferObject(); | 311 | ObjectPtr<IOpenGLFrameBufferObject> CreateFrameBufferObject(); |
3813 | 306 | 312 | ||
3814 | 307 | ObjectPtr<IOpenGLShaderProgram> CreateShaderProgram(); | 313 | ObjectPtr<IOpenGLShaderProgram> CreateShaderProgram(); |
3815 | @@ -386,13 +392,16 @@ | |||
3816 | 386 | public: | 392 | public: |
3817 | 387 | void SetCurrentFrameBufferObject(ObjectPtr<IOpenGLFrameBufferObject> fbo); | 393 | void SetCurrentFrameBufferObject(ObjectPtr<IOpenGLFrameBufferObject> fbo); |
3818 | 388 | ObjectPtr<IOpenGLFrameBufferObject> GetCurrentFrameBufferObject(); | 394 | ObjectPtr<IOpenGLFrameBufferObject> GetCurrentFrameBufferObject(); |
3819 | 395 | ObjectPtr<IOpenGLBaseTexture> ActiveFboTextureAttachment(int color_attachment_index); | ||
3820 | 396 | ObjectPtr<IOpenGLBaseTexture> ActiveFboDepthTextureAttachment(); | ||
3821 | 397 | |||
3822 | 389 | 398 | ||
3823 | 390 | int GetOpenGLMajorVersion() const; | 399 | int GetOpenGLMajorVersion() const; |
3824 | 391 | int GetOpenGLMinorVersion() const; | 400 | int GetOpenGLMinorVersion() const; |
3825 | 392 | private: | 401 | private: |
3826 | 393 | // Default FrameBufferobject | 402 | // Default FrameBufferobject |
3827 | 394 | ObjectPtr<IOpenGLFrameBufferObject> _FrameBufferObject; | 403 | ObjectPtr<IOpenGLFrameBufferObject> _FrameBufferObject; |
3829 | 395 | ObjectPtr<IOpenGLFrameBufferObject> _CurrentFrameBufferObject; | 404 | ObjectPtr<IOpenGLFrameBufferObject> active_framebuffer_object_; |
3830 | 396 | 405 | ||
3831 | 397 | struct PixelBufferObject | 406 | struct PixelBufferObject |
3832 | 398 | { | 407 | { |
3833 | 399 | 408 | ||
3834 | === modified file 'NuxGraphics/GpuDeviceTexture.cpp' | |||
3835 | --- NuxGraphics/GpuDeviceTexture.cpp 2011-10-22 06:17:42 +0000 | |||
3836 | +++ NuxGraphics/GpuDeviceTexture.cpp 2012-09-18 11:05:23 +0000 | |||
3837 | @@ -56,6 +56,12 @@ | |||
3838 | 56 | , NUX_FILE_LINE_DECL | 56 | , NUX_FILE_LINE_DECL |
3839 | 57 | ) | 57 | ) |
3840 | 58 | { | 58 | { |
3841 | 59 | if ((Width <= 0) || (Height <= 0)) | ||
3842 | 60 | { | ||
3843 | 61 | *ppTexture = NULL; | ||
3844 | 62 | return 0; | ||
3845 | 63 | } | ||
3846 | 64 | |||
3847 | 59 | // From : http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_non_power_of_two.txt | 65 | // From : http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_non_power_of_two.txt |
3848 | 60 | // The "floor" convention has a relatively straightforward way to | 66 | // The "floor" convention has a relatively straightforward way to |
3849 | 61 | // evaluate(with integer math) means to determine how many mipmap | 67 | // evaluate(with integer math) means to determine how many mipmap |
3850 | @@ -135,6 +141,11 @@ | |||
3851 | 135 | , NUX_FILE_LINE_DECL | 141 | , NUX_FILE_LINE_DECL |
3852 | 136 | ) | 142 | ) |
3853 | 137 | { | 143 | { |
3854 | 144 | if ((Width <= 0) || (Height <= 0)) | ||
3855 | 145 | { | ||
3856 | 146 | *ppTexture = NULL; | ||
3857 | 147 | return 0; | ||
3858 | 148 | } | ||
3859 | 138 | 149 | ||
3860 | 139 | // From : http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_non_power_of_two.txt | 150 | // From : http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_non_power_of_two.txt |
3861 | 140 | // The "floor" convention has a relatively straightforward way to | 151 | // The "floor" convention has a relatively straightforward way to |
3862 | 141 | 152 | ||
3863 | === modified file 'NuxGraphics/GraphicsDisplayWin.cpp' | |||
3864 | --- NuxGraphics/GraphicsDisplayWin.cpp 2012-08-02 17:46:47 +0000 | |||
3865 | +++ NuxGraphics/GraphicsDisplayWin.cpp 2012-09-18 11:05:23 +0000 | |||
3866 | @@ -105,20 +105,17 @@ | |||
3867 | 105 | HDC GraphicsDisplay::sMainDC = 0; | 105 | HDC GraphicsDisplay::sMainDC = 0; |
3868 | 106 | 106 | ||
3869 | 107 | GraphicsDisplay::GraphicsDisplay() | 107 | GraphicsDisplay::GraphicsDisplay() |
3876 | 108 | : event_(NULL) | 108 | : gfx_interface_created_(false) |
3877 | 109 | , m_GfxInterfaceCreated(false) | 109 | , fullscreen_(false) |
3878 | 110 | , m_fullscreen(false) | 110 | , screen_bit_depth_(32) |
3873 | 111 | , m_ScreenBitDepth(32) | ||
3874 | 112 | , m_num_device_modes(0) | ||
3875 | 113 | , m_index_of_current_mode(-1) | ||
3879 | 114 | , m_DeviceFactory(0) | 111 | , m_DeviceFactory(0) |
3880 | 115 | , m_GraphicsContext(0) | 112 | , m_GraphicsContext(0) |
3881 | 116 | , m_Style(WINDOWSTYLE_NORMAL) | 113 | , m_Style(WINDOWSTYLE_NORMAL) |
3882 | 117 | , cursor_(0) | 114 | , cursor_(0) |
3883 | 118 | , m_PauseGraphicsRendering(false) | 115 | , m_PauseGraphicsRendering(false) |
3887 | 119 | , m_ParentWindow(0) | 116 | , parent_window_(0) |
3888 | 120 | , m_dwExStyle(0) | 117 | , window_extended_style_(0) |
3889 | 121 | , m_dwStyle(0) | 118 | , window_style_(0) |
3890 | 122 | , device_context_(NULL) | 119 | , device_context_(NULL) |
3891 | 123 | , wnd_handle_(NULL) | 120 | , wnd_handle_(NULL) |
3892 | 124 | { | 121 | { |
3893 | @@ -149,15 +146,14 @@ | |||
3894 | 149 | 146 | ||
3895 | 150 | inlSetThreadLocalStorage(_TLS_GraphicsDisplay, this); | 147 | inlSetThreadLocalStorage(_TLS_GraphicsDisplay, this); |
3896 | 151 | 148 | ||
3899 | 152 | m_GfxInterfaceCreated = false; | 149 | gfx_interface_created_ = false; |
3898 | 153 | event_ = new Event(); | ||
3900 | 154 | GetDisplayInfo(); | 150 | GetDisplayInfo(); |
3901 | 155 | 151 | ||
3904 | 156 | m_WindowSize.width = 0; | 152 | window_size_.width = 0; |
3905 | 157 | m_WindowSize.height = 0; | 153 | window_size_.height = 0; |
3906 | 158 | 154 | ||
3907 | 159 | // A window never starts in a minimized state. | 155 | // A window never starts in a minimized state. |
3909 | 160 | m_is_window_minimized = false; | 156 | window_minimized_ = false; |
3910 | 161 | 157 | ||
3911 | 162 | //_dnd_source_grab_active = false; | 158 | //_dnd_source_grab_active = false; |
3912 | 163 | _global_keyboard_grab_data = 0; | 159 | _global_keyboard_grab_data = 0; |
3913 | @@ -171,11 +167,7 @@ | |||
3914 | 171 | NUX_SAFE_DELETE( m_GraphicsContext ); | 167 | NUX_SAFE_DELETE( m_GraphicsContext ); |
3915 | 172 | NUX_SAFE_DELETE( m_DeviceFactory ); | 168 | NUX_SAFE_DELETE( m_DeviceFactory ); |
3916 | 173 | 169 | ||
3917 | 174 | // NUX_SAFE_DELETE( m_WGLEWContext ); | ||
3918 | 175 | // NUX_SAFE_DELETE( m_GLEWContext ); | ||
3919 | 176 | |||
3920 | 177 | DestroyOpenGLWindow(); | 170 | DestroyOpenGLWindow(); |
3921 | 178 | NUX_SAFE_DELETE( event_ ); | ||
3922 | 179 | 171 | ||
3923 | 180 | inlSetThreadLocalStorage(_TLS_GraphicsDisplay, 0); | 172 | inlSetThreadLocalStorage(_TLS_GraphicsDisplay, 0); |
3924 | 181 | 173 | ||
3925 | @@ -216,7 +208,7 @@ | |||
3926 | 216 | //--------------------------------------------------------------------------------------------------------- | 208 | //--------------------------------------------------------------------------------------------------------- |
3927 | 217 | bool GraphicsDisplay::IsGfxInterfaceCreated() | 209 | bool GraphicsDisplay::IsGfxInterfaceCreated() |
3928 | 218 | { | 210 | { |
3930 | 219 | return m_GfxInterfaceCreated; | 211 | return gfx_interface_created_; |
3931 | 220 | } | 212 | } |
3932 | 221 | 213 | ||
3933 | 222 | //--------------------------------------------------------------------------------------------------------- | 214 | //--------------------------------------------------------------------------------------------------------- |
3934 | @@ -226,45 +218,42 @@ | |||
3935 | 226 | unsigned int WindowHeight, | 218 | unsigned int WindowHeight, |
3936 | 227 | WindowStyle Style, | 219 | WindowStyle Style, |
3937 | 228 | const GraphicsDisplay *Parent, | 220 | const GraphicsDisplay *Parent, |
3939 | 229 | bool FullscreenFlag, | 221 | bool fullscreen_flag, |
3940 | 230 | bool create_rendering_data) | 222 | bool create_rendering_data) |
3941 | 231 | { | 223 | { |
3942 | 232 | NScopeLock Scope(&CreateOpenGLWindow_CriticalSection); | 224 | NScopeLock Scope(&CreateOpenGLWindow_CriticalSection); |
3943 | 233 | 225 | ||
3944 | 234 | RECT WindowRect; // Grabs Rectangle Upper Left / Lower Right Values | 226 | RECT WindowRect; // Grabs Rectangle Upper Left / Lower Right Values |
3945 | 235 | 227 | ||
3947 | 236 | m_GfxInterfaceCreated = false; | 228 | gfx_interface_created_ = false; |
3948 | 237 | 229 | ||
3949 | 238 | // FIXME : put at the end | 230 | // FIXME : put at the end |
3954 | 239 | m_ViewportSize.width = WindowWidth; | 231 | viewport_size_.width = WindowWidth; |
3955 | 240 | m_ViewportSize.height = WindowHeight; | 232 | viewport_size_.height = WindowHeight; |
3956 | 241 | m_WindowSize.width = WindowWidth; | 233 | window_size_.width = WindowWidth; |
3957 | 242 | m_WindowSize.height = WindowHeight; | 234 | window_size_.height = WindowHeight; |
3958 | 243 | 235 | ||
3959 | 244 | // end of fixme | 236 | // end of fixme |
3960 | 245 | 237 | ||
3961 | 246 | WindowRect.left = (long) 0; | 238 | WindowRect.left = (long) 0; |
3963 | 247 | WindowRect.right = (long) m_ViewportSize.width; | 239 | WindowRect.right = (long) viewport_size_.width; |
3964 | 248 | WindowRect.top = (long) 0; | 240 | WindowRect.top = (long) 0; |
3972 | 249 | WindowRect.bottom = (long) m_ViewportSize.height; | 241 | WindowRect.bottom = (long) viewport_size_.height; |
3973 | 250 | 242 | ||
3974 | 251 | m_fullscreen = FullscreenFlag; // Set The Global Fullscreen Flag | 243 | fullscreen_ = fullscreen_flag; // Set The Global Fullscreen Flag |
3975 | 252 | m_index_of_current_mode = -1; // assume -1 if the mode is not fullscreen | 244 | |
3976 | 253 | 245 | if (fullscreen_) // Attempt Fullscreen Mode? | |
3970 | 254 | |||
3971 | 255 | if (m_fullscreen) // Attempt Fullscreen Mode? | ||
3977 | 256 | { | 246 | { |
3978 | 257 | // check if resolution is supported | 247 | // check if resolution is supported |
3979 | 258 | bool mode_supported = false; | 248 | bool mode_supported = false; |
3980 | 259 | 249 | ||
3981 | 260 | for (int num_modes = 0 ; num_modes < m_num_gfx_device_modes; num_modes++) | 250 | for (int num_modes = 0 ; num_modes < m_num_gfx_device_modes; num_modes++) |
3982 | 261 | { | 251 | { |
3986 | 262 | if ((m_gfx_device_modes[num_modes].width == m_ViewportSize.width) | 252 | if ((m_gfx_device_modes[num_modes].width == viewport_size_.width) |
3987 | 263 | && (m_gfx_device_modes[num_modes].height == m_ViewportSize.height) | 253 | && (m_gfx_device_modes[num_modes].height == viewport_size_.height) |
3988 | 264 | && (m_gfx_device_modes[num_modes].format == m_ScreenBitDepth)) | 254 | && (m_gfx_device_modes[num_modes].format == screen_bit_depth_)) |
3989 | 265 | { | 255 | { |
3990 | 266 | mode_supported = true; | 256 | mode_supported = true; |
3991 | 267 | m_index_of_current_mode = num_modes; | ||
3992 | 268 | break; | 257 | break; |
3993 | 269 | } | 258 | } |
3994 | 270 | } | 259 | } |
3995 | @@ -274,16 +263,16 @@ | |||
3996 | 274 | if (inlWin32MessageBox(NULL, "Info", MBTYPE_Ok, MBICON_Information, MBMODAL_ApplicationModal, | 263 | if (inlWin32MessageBox(NULL, "Info", MBTYPE_Ok, MBICON_Information, MBMODAL_ApplicationModal, |
3997 | 275 | "The requested fullscreen mode is not supported by your monitor.\nUsing windowed mode instead.") == MBRES_Yes) | 264 | "The requested fullscreen mode is not supported by your monitor.\nUsing windowed mode instead.") == MBRES_Yes) |
3998 | 276 | { | 265 | { |
4000 | 277 | m_fullscreen = FALSE; // Windowed Mode Selected. Fullscreen = FALSE | 266 | fullscreen_ = FALSE; // Windowed Mode Selected. Fullscreen = FALSE |
4001 | 278 | } | 267 | } |
4002 | 279 | } | 268 | } |
4003 | 280 | 269 | ||
4004 | 281 | DEVMODE dmScreenSettings; // Device Mode | 270 | DEVMODE dmScreenSettings; // Device Mode |
4005 | 282 | memset(&dmScreenSettings, 0, sizeof(dmScreenSettings)); // Makes Sure Memory's Cleared | 271 | memset(&dmScreenSettings, 0, sizeof(dmScreenSettings)); // Makes Sure Memory's Cleared |
4006 | 283 | dmScreenSettings.dmSize = sizeof(dmScreenSettings); // Size Of The Devmode Structure | 272 | dmScreenSettings.dmSize = sizeof(dmScreenSettings); // Size Of The Devmode Structure |
4010 | 284 | dmScreenSettings.dmPelsWidth = m_ViewportSize.width; // Selected Screen Width | 273 | dmScreenSettings.dmPelsWidth = viewport_size_.width; // Selected Screen Width |
4011 | 285 | dmScreenSettings.dmPelsHeight = m_ViewportSize.height; // Selected Screen Height | 274 | dmScreenSettings.dmPelsHeight = viewport_size_.height; // Selected Screen Height |
4012 | 286 | dmScreenSettings.dmBitsPerPel = m_ScreenBitDepth; // Selected Bits Per Pixel | 275 | dmScreenSettings.dmBitsPerPel = screen_bit_depth_; // Selected Bits Per Pixel |
4013 | 287 | dmScreenSettings.dmDisplayFrequency = 60; | 276 | dmScreenSettings.dmDisplayFrequency = 60; |
4014 | 288 | dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY; | 277 | dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY; |
4015 | 289 | 278 | ||
4016 | @@ -293,7 +282,7 @@ | |||
4017 | 293 | if (inlWin32MessageBox(NULL, "Info", MBTYPE_Ok, MBICON_Information, MBMODAL_ApplicationModal, | 282 | if (inlWin32MessageBox(NULL, "Info", MBTYPE_Ok, MBICON_Information, MBMODAL_ApplicationModal, |
4018 | 294 | "The requested fullscreen mode is not supported by your monitor.\nUsing windowed mode instead.") == MBRES_Yes) | 283 | "The requested fullscreen mode is not supported by your monitor.\nUsing windowed mode instead.") == MBRES_Yes) |
4019 | 295 | { | 284 | { |
4021 | 296 | m_fullscreen = FALSE; // Windowed Mode Selected. Fullscreen = FALSE | 285 | fullscreen_ = FALSE; // Windowed Mode Selected. Fullscreen = FALSE |
4022 | 297 | } | 286 | } |
4023 | 298 | else | 287 | else |
4024 | 299 | { | 288 | { |
4025 | @@ -303,21 +292,21 @@ | |||
4026 | 303 | } | 292 | } |
4027 | 304 | } | 293 | } |
4028 | 305 | 294 | ||
4031 | 306 | m_dwExStyle = 0; | 295 | window_extended_style_ = 0; |
4032 | 307 | m_dwStyle = 0; | 296 | window_style_ = 0; |
4033 | 308 | 297 | ||
4035 | 309 | if (m_fullscreen) // Are We Still In Fullscreen Mode? | 298 | if (fullscreen_) // Are We Still In Fullscreen Mode? |
4036 | 310 | { | 299 | { |
4039 | 311 | m_dwExStyle = WS_EX_APPWINDOW; // Window Extended Style | 300 | window_extended_style_ = WS_EX_APPWINDOW; // Window Extended Style |
4040 | 312 | m_dwStyle = WS_POPUP; // Windows Style | 301 | window_style_ = WS_POPUP; // Windows Style |
4041 | 313 | ShowCursor(FALSE); // Hide Mouse Pointer | 302 | ShowCursor(FALSE); // Hide Mouse Pointer |
4042 | 314 | } | 303 | } |
4043 | 315 | else | 304 | else |
4044 | 316 | { | 305 | { |
4045 | 317 | // Window Extended Style | 306 | // Window Extended Style |
4047 | 318 | m_dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; | 307 | window_extended_style_ = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; |
4048 | 319 | // Windows Style | 308 | // Windows Style |
4050 | 320 | m_dwStyle = WS_OVERLAPPED; // Creates an overlapped window. An overlapped window has a title bar and a border | 309 | window_style_ = WS_OVERLAPPED; // Creates an overlapped window. An overlapped window has a title bar and a border |
4051 | 321 | 310 | ||
4052 | 322 | // See Win32 Window Hierarchy and Styles: http://msdn.microsoft.com/en-us/library/ms997562.aspx | 311 | // See Win32 Window Hierarchy and Styles: http://msdn.microsoft.com/en-us/library/ms997562.aspx |
4053 | 323 | 312 | ||
4054 | @@ -333,31 +322,31 @@ | |||
4055 | 333 | 322 | ||
4056 | 334 | if (Style == WINDOWSTYLE_TOOL) | 323 | if (Style == WINDOWSTYLE_TOOL) |
4057 | 335 | { | 324 | { |
4060 | 336 | m_dwExStyle = WS_EX_TOOLWINDOW; | 325 | window_extended_style_ = WS_EX_TOOLWINDOW; |
4061 | 337 | m_dwStyle = WS_CAPTION | WS_SYSMENU; | 326 | window_style_ = WS_CAPTION | WS_SYSMENU; |
4062 | 338 | } | 327 | } |
4063 | 339 | else if (Style == WINDOWSTYLE_DIALOG) | 328 | else if (Style == WINDOWSTYLE_DIALOG) |
4064 | 340 | { | 329 | { |
4067 | 341 | m_dwExStyle = WS_EX_DLGMODALFRAME; | 330 | window_extended_style_ = WS_EX_DLGMODALFRAME; |
4068 | 342 | m_dwStyle = WS_CAPTION | WS_SYSMENU; | 331 | window_style_ = WS_CAPTION | WS_SYSMENU; |
4069 | 343 | } | 332 | } |
4070 | 344 | else if (Style == WINDOWSTYLE_NOBORDER) | 333 | else if (Style == WINDOWSTYLE_NOBORDER) |
4071 | 345 | { | 334 | { |
4074 | 346 | m_dwExStyle = WS_EX_TOPMOST | WS_EX_TOOLWINDOW; | 335 | window_extended_style_ = WS_EX_TOPMOST | WS_EX_TOOLWINDOW; |
4075 | 347 | m_dwStyle = WS_POPUP; | 336 | window_style_ = WS_POPUP; |
4076 | 348 | } | 337 | } |
4077 | 349 | else if (Style == WINDOWSTYLE_PANEL) | 338 | else if (Style == WINDOWSTYLE_PANEL) |
4078 | 350 | { | 339 | { |
4081 | 351 | m_dwExStyle = 0; // Specifies that a window has a border with a raised edge | 340 | window_extended_style_ = 0; // Specifies that a window has a border with a raised edge |
4082 | 352 | m_dwStyle = WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SIZEBOX; | 341 | window_style_ = WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SIZEBOX; |
4083 | 353 | } | 342 | } |
4084 | 354 | else | 343 | else |
4085 | 355 | { | 344 | { |
4086 | 356 | // Normal Window: NormalWindow | 345 | // Normal Window: NormalWindow |
4088 | 357 | m_dwExStyle = WS_EX_APPWINDOW | // Forces a top-level window onto the taskbar when the window is visible | 346 | window_extended_style_ = WS_EX_APPWINDOW | // Forces a top-level window onto the taskbar when the window is visible |
4089 | 358 | WS_EX_WINDOWEDGE; // Specifies that a window has a border with a raised edge | 347 | WS_EX_WINDOWEDGE; // Specifies that a window has a border with a raised edge |
4090 | 359 | 348 | ||
4092 | 360 | m_dwStyle |= WS_CAPTION | // Creates a window that has a title bar. | 349 | window_style_ |= WS_CAPTION | // Creates a window that has a title bar. |
4093 | 361 | WS_SYSMENU | // Creates a window that has a window menu on its title bar. The WS_CAPTION style must also be specified. | 350 | WS_SYSMENU | // Creates a window that has a window menu on its title bar. The WS_CAPTION style must also be specified. |
4094 | 362 | WS_THICKFRAME | // Creates a window that has a sizing border. | 351 | WS_THICKFRAME | // Creates a window that has a sizing border. |
4095 | 363 | WS_MINIMIZEBOX | // Creates a window that has a minimize button. | 352 | WS_MINIMIZEBOX | // Creates a window that has a minimize button. |
4096 | @@ -368,7 +357,7 @@ | |||
4097 | 368 | // The AdjustWindowRectEx function calculates the required size of the window rectangle, | 357 | // The AdjustWindowRectEx function calculates the required size of the window rectangle, |
4098 | 369 | // based on the desired size of the client rectangle. The window rectangle can then be passed to | 358 | // based on the desired size of the client rectangle. The window rectangle can then be passed to |
4099 | 370 | // the CreateWindowEx function to create a window whose client area is the desired size. | 359 | // the CreateWindowEx function to create a window whose client area is the desired size. |
4101 | 371 | AdjustWindowRectEx(&WindowRect, m_dwStyle, FALSE, m_dwExStyle); // Adjust Window To True Requested Size | 360 | AdjustWindowRectEx(&WindowRect, window_style_, FALSE, window_extended_style_); // Adjust Window To True Requested Size |
4102 | 372 | 361 | ||
4103 | 373 | RECT rect; | 362 | RECT rect; |
4104 | 374 | rect.top = 0; | 363 | rect.top = 0; |
4105 | @@ -380,8 +369,8 @@ | |||
4106 | 380 | 369 | ||
4107 | 381 | if (Parent) | 370 | if (Parent) |
4108 | 382 | { | 371 | { |
4111 | 383 | m_ParentWindow = Parent->GetWindowHandle(); | 372 | parent_window_ = Parent->GetWindowHandle(); |
4112 | 384 | GetWindowRect(m_ParentWindow, &rect); | 373 | GetWindowRect(parent_window_, &rect); |
4113 | 385 | 374 | ||
4114 | 386 | int width = rect.right - rect.left; | 375 | int width = rect.right - rect.left; |
4115 | 387 | int height = rect.bottom - rect.top; | 376 | int height = rect.bottom - rect.top; |
4116 | @@ -389,29 +378,29 @@ | |||
4117 | 389 | WindowX = rect.left + (width - (WindowRect.right - WindowRect.left)) / 2; | 378 | WindowX = rect.left + (width - (WindowRect.right - WindowRect.left)) / 2; |
4118 | 390 | WindowY = rect.top + (height - (WindowRect.bottom - WindowRect.top)) / 2; | 379 | WindowY = rect.top + (height - (WindowRect.bottom - WindowRect.top)) / 2; |
4119 | 391 | } | 380 | } |
4121 | 392 | else if (!m_fullscreen) | 381 | else if (!fullscreen_) |
4122 | 393 | { | 382 | { |
4123 | 394 | ClipOrCenterRectToMonitor(&rect, 0); | 383 | ClipOrCenterRectToMonitor(&rect, 0); |
4124 | 395 | WindowX = rect.left; | 384 | WindowX = rect.left; |
4125 | 396 | WindowY = rect.top; | 385 | WindowY = rect.top; |
4126 | 397 | } | 386 | } |
4127 | 398 | 387 | ||
4129 | 399 | m_WindowTitle = WindowTitle; | 388 | window_title_ = WindowTitle; |
4130 | 400 | 389 | ||
4131 | 401 | // Create The Window | 390 | // Create The Window |
4133 | 402 | if (! (wnd_handle_ = ::CreateWindowEx(m_dwExStyle, // Extended Style For The Window | 391 | if (! (wnd_handle_ = ::CreateWindowEx(window_extended_style_, // Extended Style For The Window |
4134 | 403 | WINDOW_CLASS_NAME, // Class Name | 392 | WINDOW_CLASS_NAME, // Class Name |
4137 | 404 | m_WindowTitle.GetTCharPtr(), // Window Title | 393 | window_title_.c_str(), // Window Title |
4138 | 405 | m_dwStyle | // Defined Window Style | 394 | window_style_ | // Defined Window Style |
4139 | 406 | WS_CLIPSIBLINGS | // Required Window Style | 395 | WS_CLIPSIBLINGS | // Required Window Style |
4140 | 407 | WS_CLIPCHILDREN, // Required Window Style | 396 | WS_CLIPCHILDREN, // Required Window Style |
4141 | 408 | WindowX, WindowY, // Window Position | 397 | WindowX, WindowY, // Window Position |
4142 | 409 | WindowRect.right - WindowRect.left, // Calculate Window Width | 398 | WindowRect.right - WindowRect.left, // Calculate Window Width |
4143 | 410 | WindowRect.bottom - WindowRect.top, // Calculate Window Height | 399 | WindowRect.bottom - WindowRect.top, // Calculate Window Height |
4145 | 411 | m_ParentWindow, // No Parent Window | 400 | parent_window_, // No Parent Window |
4146 | 412 | NULL, // No Menu | 401 | NULL, // No Menu |
4147 | 413 | gGLWindowManager.GetInstance(), // Instance | 402 | gGLWindowManager.GetInstance(), // Instance |
4149 | 414 | NULL))) // Dont Pass Anything To WM_CREATE | 403 | NULL))) // Don't Pass Anything To WM_CREATE |
4150 | 415 | { | 404 | { |
4151 | 416 | DestroyOpenGLWindow(); | 405 | DestroyOpenGLWindow(); |
4152 | 417 | MessageBox(NULL, "Window Creation Error.", "ERROR", MB_OK | MB_ICONERROR); | 406 | MessageBox(NULL, "Window Creation Error.", "ERROR", MB_OK | MB_ICONERROR); |
4153 | @@ -486,14 +475,14 @@ | |||
4154 | 486 | return FALSE; | 475 | return FALSE; |
4155 | 487 | } | 476 | } |
4156 | 488 | 477 | ||
4158 | 489 | if (! (m_PixelFormat = ChoosePixelFormat(device_context_, &pfd))) // Did Windows Find A Matching Pixel Format? | 478 | if (! (pixel_format_ = ChoosePixelFormat(device_context_, &pfd))) // Did Windows Find A Matching Pixel Format? |
4159 | 490 | { | 479 | { |
4160 | 491 | DestroyOpenGLWindow(); | 480 | DestroyOpenGLWindow(); |
4161 | 492 | MessageBox(NULL, "Can't Find A Suitable PixelFormat.", "ERROR", MB_OK | MB_ICONERROR); | 481 | MessageBox(NULL, "Can't Find A Suitable PixelFormat.", "ERROR", MB_OK | MB_ICONERROR); |
4162 | 493 | return FALSE; | 482 | return FALSE; |
4163 | 494 | } | 483 | } |
4164 | 495 | 484 | ||
4166 | 496 | if (!SetPixelFormat(device_context_, m_PixelFormat, &pfd)) // Are We Able To Set The Pixel Format? | 485 | if (!SetPixelFormat(device_context_, pixel_format_, &pfd)) // Are We Able To Set The Pixel Format? |
4167 | 497 | { | 486 | { |
4168 | 498 | DestroyOpenGLWindow(); | 487 | DestroyOpenGLWindow(); |
4169 | 499 | MessageBox(NULL, "Can't Set The PixelFormat.", "ERROR", MB_OK | MB_ICONERROR); | 488 | MessageBox(NULL, "Can't Set The PixelFormat.", "ERROR", MB_OK | MB_ICONERROR); |
4170 | @@ -540,13 +529,13 @@ | |||
4171 | 540 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | 529 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
4172 | 541 | SwapBuffer(); | 530 | SwapBuffer(); |
4173 | 542 | 531 | ||
4175 | 543 | m_GfxInterfaceCreated = true; | 532 | gfx_interface_created_ = true; |
4176 | 544 | 533 | ||
4177 | 545 | //m_GLEWContext = new GLEWContext(); | 534 | //m_GLEWContext = new GLEWContext(); |
4178 | 546 | //m_WGLEWContext = new WGLEWContext(); | 535 | //m_WGLEWContext = new WGLEWContext(); |
4179 | 547 | 536 | ||
4180 | 548 | HGLRC new_opengl_rendering_context = opengl_rendering_context_; | 537 | HGLRC new_opengl_rendering_context = opengl_rendering_context_; |
4182 | 549 | m_DeviceFactory = new GpuDevice(m_ViewportSize.width, m_ViewportSize.height, BITFMT_R8G8B8A8, | 538 | m_DeviceFactory = new GpuDevice(viewport_size_.width, viewport_size_.height, BITFMT_R8G8B8A8, |
4183 | 550 | device_context_, | 539 | device_context_, |
4184 | 551 | new_opengl_rendering_context, | 540 | new_opengl_rendering_context, |
4185 | 552 | 1, 0, false); | 541 | 1, 0, false); |
4186 | @@ -579,13 +568,13 @@ | |||
4187 | 579 | 568 | ||
4188 | 580 | RECT rect; | 569 | RECT rect; |
4189 | 581 | ::GetClientRect(wnd_handle_, &rect); | 570 | ::GetClientRect(wnd_handle_, &rect); |
4192 | 582 | m_WindowSize = Size(rect.right - rect.left, rect.bottom - rect.top); | 571 | window_size_ = Size(rect.right - rect.left, rect.bottom - rect.top); |
4193 | 583 | m_ViewportSize = Size(rect.right - rect.left, rect.bottom - rect.top); | 572 | viewport_size_ = Size(rect.right - rect.left, rect.bottom - rect.top); |
4194 | 584 | 573 | ||
4195 | 585 | // The opengl context should be made current by an external entity. | 574 | // The opengl context should be made current by an external entity. |
4196 | 586 | 575 | ||
4199 | 587 | m_GfxInterfaceCreated = true; | 576 | gfx_interface_created_ = true; |
4200 | 588 | m_DeviceFactory = new GpuDevice(m_ViewportSize.width, m_ViewportSize.height, BITFMT_R8G8B8A8, | 577 | m_DeviceFactory = new GpuDevice(viewport_size_.width, viewport_size_.height, BITFMT_R8G8B8A8, |
4201 | 589 | device_context_, | 578 | device_context_, |
4202 | 590 | opengl_rendering_context_); | 579 | opengl_rendering_context_); |
4203 | 591 | 580 | ||
4204 | @@ -616,28 +605,28 @@ | |||
4205 | 616 | //--------------------------------------------------------------------------------------------------------- | 605 | //--------------------------------------------------------------------------------------------------------- |
4206 | 617 | void GraphicsDisplay::GetWindowSize(int &w, int &h) | 606 | void GraphicsDisplay::GetWindowSize(int &w, int &h) |
4207 | 618 | { | 607 | { |
4210 | 619 | w = m_WindowSize.width; | 608 | w = window_size_.width; |
4211 | 620 | h = m_WindowSize.height; | 609 | h = window_size_.height; |
4212 | 621 | } | 610 | } |
4213 | 622 | 611 | ||
4214 | 623 | //--------------------------------------------------------------------------------------------------------- | 612 | //--------------------------------------------------------------------------------------------------------- |
4215 | 624 | int GraphicsDisplay::GetWindowWidth() | 613 | int GraphicsDisplay::GetWindowWidth() |
4216 | 625 | { | 614 | { |
4218 | 626 | return m_WindowSize.width; | 615 | return window_size_.width; |
4219 | 627 | } | 616 | } |
4220 | 628 | 617 | ||
4221 | 629 | //--------------------------------------------------------------------------------------------------------- | 618 | //--------------------------------------------------------------------------------------------------------- |
4222 | 630 | int GraphicsDisplay::GetWindowHeight() | 619 | int GraphicsDisplay::GetWindowHeight() |
4223 | 631 | { | 620 | { |
4225 | 632 | return m_WindowSize.height; | 621 | return window_size_.height; |
4226 | 633 | } | 622 | } |
4227 | 634 | 623 | ||
4228 | 635 | void GraphicsDisplay::ResetWindowSize() | 624 | void GraphicsDisplay::ResetWindowSize() |
4229 | 636 | { | 625 | { |
4230 | 637 | RECT rect; | 626 | RECT rect; |
4231 | 638 | ::GetClientRect(wnd_handle_, &rect); | 627 | ::GetClientRect(wnd_handle_, &rect); |
4234 | 639 | m_WindowSize = Size(rect.right - rect.left, rect.bottom - rect.top); | 628 | window_size_ = Size(rect.right - rect.left, rect.bottom - rect.top); |
4235 | 640 | m_ViewportSize = Size(rect.right - rect.left, rect.bottom - rect.top); | 629 | viewport_size_ = Size(rect.right - rect.left, rect.bottom - rect.top); |
4236 | 641 | } | 630 | } |
4237 | 642 | 631 | ||
4238 | 643 | //--------------------------------------------------------------------------------------------------------- | 632 | //--------------------------------------------------------------------------------------------------------- |
4239 | @@ -651,7 +640,7 @@ | |||
4240 | 651 | new_rect.right = width; | 640 | new_rect.right = width; |
4241 | 652 | new_rect.top = 0; | 641 | new_rect.top = 0; |
4242 | 653 | new_rect.bottom = height; | 642 | new_rect.bottom = height; |
4244 | 654 | BOOL b = ::AdjustWindowRectEx(&new_rect, m_dwStyle, FALSE, m_dwExStyle); // Adjust Window To True Requested Size | 643 | BOOL b = ::AdjustWindowRectEx(&new_rect, window_style_, FALSE, window_extended_style_); // Adjust Window To True Requested Size |
4245 | 655 | 644 | ||
4246 | 656 | ::MoveWindow(wnd_handle_, | 645 | ::MoveWindow(wnd_handle_, |
4247 | 657 | window_rect.left, | 646 | window_rect.left, |
4248 | @@ -666,11 +655,11 @@ | |||
4249 | 666 | { | 655 | { |
4250 | 667 | if (IsGfxInterfaceCreated()) | 656 | if (IsGfxInterfaceCreated()) |
4251 | 668 | { | 657 | { |
4255 | 669 | //do not rely on m_ViewportSize: glViewport can be called directly | 658 | //do not rely on viewport_size_: glViewport can be called directly |
4256 | 670 | m_ViewportSize.width = width; | 659 | viewport_size_.width = width; |
4257 | 671 | m_ViewportSize.height = height; | 660 | viewport_size_.height = height; |
4258 | 672 | 661 | ||
4260 | 673 | m_GraphicsContext->SetViewport(x, y, m_ViewportSize.width, m_ViewportSize.height); | 662 | m_GraphicsContext->SetViewport(x, y, viewport_size_.width, viewport_size_.height); |
4261 | 674 | m_GraphicsContext->SetScissor(0, 0, width, height); | 663 | m_GraphicsContext->SetScissor(0, 0, width, height); |
4262 | 675 | } | 664 | } |
4263 | 676 | } | 665 | } |
4264 | @@ -767,9 +756,9 @@ | |||
4265 | 767 | //--------------------------------------------------------------------------------------------------------- | 756 | //--------------------------------------------------------------------------------------------------------- |
4266 | 768 | void GraphicsDisplay::DestroyOpenGLWindow() | 757 | void GraphicsDisplay::DestroyOpenGLWindow() |
4267 | 769 | { | 758 | { |
4269 | 770 | if (m_GfxInterfaceCreated == true) | 759 | if (gfx_interface_created_ == true) |
4270 | 771 | { | 760 | { |
4272 | 772 | if (m_fullscreen) // Are We In Fullscreen Mode? | 761 | if (fullscreen_) // Are We In Fullscreen Mode? |
4273 | 773 | { | 762 | { |
4274 | 774 | ChangeDisplaySettings(NULL, 0); // If So Switch Back To The Desktop | 763 | ChangeDisplaySettings(NULL, 0); // If So Switch Back To The Desktop |
4275 | 775 | ShowCursor(TRUE); // Show Mouse Pointer | 764 | ShowCursor(TRUE); // Show Mouse Pointer |
4276 | @@ -803,7 +792,7 @@ | |||
4277 | 803 | wnd_handle_ = NULL; // Set Window Handle To NULL | 792 | wnd_handle_ = NULL; // Set Window Handle To NULL |
4278 | 804 | } | 793 | } |
4279 | 805 | 794 | ||
4281 | 806 | m_GfxInterfaceCreated = false; | 795 | gfx_interface_created_ = false; |
4282 | 807 | } | 796 | } |
4283 | 808 | 797 | ||
4284 | 809 | 798 | ||
4285 | @@ -902,26 +891,26 @@ | |||
4286 | 902 | return extended ? extendedlut[vk] : vklut[vk]; | 891 | return extended ? extendedlut[vk] : vklut[vk]; |
4287 | 903 | }*/ | 892 | }*/ |
4288 | 904 | //--------------------------------------------------------------------------------------------------------- | 893 | //--------------------------------------------------------------------------------------------------------- |
4290 | 905 | static int mouse_event(HWND window, Event *event, int what, int button, | 894 | static int InspectMouseEvent(HWND window, Event& event, int what, int button, |
4291 | 906 | WPARAM wParam, LPARAM lParam) | 895 | WPARAM wParam, LPARAM lParam) |
4292 | 907 | { | 896 | { |
4293 | 908 | static int pmx, pmy; | 897 | static int pmx, pmy; |
4298 | 909 | event->x = (signed short) LOWORD(lParam); | 898 | event.x = (signed short) LOWORD(lParam); |
4299 | 910 | event->y = (signed short) HIWORD(lParam); | 899 | event.y = (signed short) HIWORD(lParam); |
4300 | 911 | event->x_root = 0; | 900 | event.x_root = 0; |
4301 | 912 | event->y_root = 0; | 901 | event.y_root = 0; |
4302 | 913 | 902 | ||
4303 | 914 | POINT EventScreenPosition; | 903 | POINT EventScreenPosition; |
4304 | 915 | 904 | ||
4305 | 916 | ClientToScreen(window, &EventScreenPosition); | 905 | ClientToScreen(window, &EventScreenPosition); |
4308 | 917 | EventScreenPosition.x = event->x; | 906 | EventScreenPosition.x = event.x; |
4309 | 918 | EventScreenPosition.y = event->y; | 907 | EventScreenPosition.y = event.y; |
4310 | 919 | POINT WindowScreenPosition; | 908 | POINT WindowScreenPosition; |
4311 | 920 | WindowScreenPosition.x = WindowScreenPosition.y = 0; | 909 | WindowScreenPosition.x = WindowScreenPosition.y = 0; |
4312 | 921 | ClientToScreen(window, &WindowScreenPosition); | 910 | ClientToScreen(window, &WindowScreenPosition); |
4313 | 922 | 911 | ||
4314 | 923 | // Erase mouse event and mouse doubleclick events. Keep the mouse states. | 912 | // Erase mouse event and mouse doubleclick events. Keep the mouse states. |
4316 | 924 | ulong _mouse_state = event->mouse_state & 0x0F000000; | 913 | ulong _mouse_state = event.mouse_state & 0x0F000000; |
4317 | 925 | 914 | ||
4318 | 926 | // establish cause of the event | 915 | // establish cause of the event |
4319 | 927 | // if (button == 1) | 916 | // if (button == 1) |
4320 | @@ -933,16 +922,16 @@ | |||
4321 | 933 | // else | 922 | // else |
4322 | 934 | if (button == 4) | 923 | if (button == 4) |
4323 | 935 | { | 924 | { |
4326 | 936 | event->mouse_state |= NUX_EVENT_MOUSEWHEEL; | 925 | event.mouse_state |= NUX_EVENT_MOUSEWHEEL; |
4327 | 937 | event->type = NUX_MOUSE_WHEEL; | 926 | event.type = NUX_MOUSE_WHEEL; |
4328 | 938 | 927 | ||
4329 | 939 | int zDelta = GET_WHEEL_DELTA_WPARAM(wParam); | 928 | int zDelta = GET_WHEEL_DELTA_WPARAM(wParam); |
4330 | 940 | int xPos = (int) (short) LOWORD(lParam) - WindowScreenPosition.x; | 929 | int xPos = (int) (short) LOWORD(lParam) - WindowScreenPosition.x; |
4331 | 941 | int yPos = (int) (short) HIWORD(lParam) - WindowScreenPosition.y; | 930 | int yPos = (int) (short) HIWORD(lParam) - WindowScreenPosition.y; |
4334 | 942 | event->x = xPos; | 931 | event.x = xPos; |
4335 | 943 | event->y = yPos; | 932 | event.y = yPos; |
4336 | 944 | 933 | ||
4338 | 945 | event->wheel_delta = zDelta; | 934 | event.wheel_delta = zDelta; |
4339 | 946 | return 1; | 935 | return 1; |
4340 | 947 | } | 936 | } |
4341 | 948 | 937 | ||
4342 | @@ -1016,39 +1005,39 @@ | |||
4343 | 1016 | break; | 1005 | break; |
4344 | 1017 | } | 1006 | } |
4345 | 1018 | 1007 | ||
4347 | 1019 | event->mouse_state = _mouse_state; | 1008 | event.mouse_state = _mouse_state; |
4348 | 1020 | 1009 | ||
4349 | 1021 | switch(what) | 1010 | switch(what) |
4350 | 1022 | { | 1011 | { |
4351 | 1023 | static int px, py; | 1012 | static int px, py; |
4352 | 1024 | case 1: // double-click | 1013 | case 1: // double-click |
4353 | 1025 | 1014 | ||
4355 | 1026 | if (event->is_click) | 1015 | if (event.is_click) |
4356 | 1027 | { | 1016 | { |
4358 | 1028 | event->clicks++; | 1017 | event.clicks++; |
4359 | 1029 | // The SetCapture function sets the mouse capture to the specified window belonging to | 1018 | // The SetCapture function sets the mouse capture to the specified window belonging to |
4360 | 1030 | // the current thread. SetCapture captures mouse input either when the mouse is over the | 1019 | // the current thread. SetCapture captures mouse input either when the mouse is over the |
4361 | 1031 | // capturing window, or when the mouse button was pressed while the mouse was over the | 1020 | // capturing window, or when the mouse button was pressed while the mouse was over the |
4362 | 1032 | // capturing window and the button is still down. Only one window at a time can capture the mouse. | 1021 | // capturing window and the button is still down. Only one window at a time can capture the mouse. |
4363 | 1033 | SetCapture(window); | 1022 | SetCapture(window); |
4368 | 1034 | event->is_click = 1; | 1023 | event.is_click = 1; |
4369 | 1035 | px = pmx = event->x; | 1024 | px = pmx = event.x; |
4370 | 1036 | py = pmy = event->y; | 1025 | py = pmy = event.y; |
4371 | 1037 | event->type = NUX_MOUSE_DOUBLECLICK; | 1026 | event.type = NUX_MOUSE_DOUBLECLICK; |
4372 | 1038 | return 1; | 1027 | return 1; |
4373 | 1039 | } | 1028 | } |
4374 | 1040 | 1029 | ||
4375 | 1041 | case 0: // single-click | 1030 | case 0: // single-click |
4377 | 1042 | event->clicks = 0; | 1031 | event.clicks = 0; |
4378 | 1043 | // The SetCapture function sets the mouse capture to the specified window belonging to | 1032 | // The SetCapture function sets the mouse capture to the specified window belonging to |
4379 | 1044 | // the current thread. SetCapture captures mouse input either when the mouse is over the | 1033 | // the current thread. SetCapture captures mouse input either when the mouse is over the |
4380 | 1045 | // capturing window, or when the mouse button was pressed while the mouse was over the | 1034 | // capturing window, or when the mouse button was pressed while the mouse was over the |
4381 | 1046 | // capturing window and the button is still down. Only one window at a time can capture the mouse. | 1035 | // capturing window and the button is still down. Only one window at a time can capture the mouse. |
4382 | 1047 | SetCapture(window); | 1036 | SetCapture(window); |
4387 | 1048 | event->is_click = 1; | 1037 | event.is_click = 1; |
4388 | 1049 | px = pmx = event->x; | 1038 | px = pmx = event.x; |
4389 | 1050 | py = pmy = event->y; | 1039 | py = pmy = event.y; |
4390 | 1051 | event->type = NUX_MOUSE_PRESSED; | 1040 | event.type = NUX_MOUSE_PRESSED; |
4391 | 1052 | return 1; | 1041 | return 1; |
4392 | 1053 | 1042 | ||
4393 | 1054 | case 2: // release: | 1043 | case 2: // release: |
4394 | @@ -1057,21 +1046,21 @@ | |||
4395 | 1057 | // mouse input, regardless of the position of the cursor, except when a mouse button is clicked | 1046 | // mouse input, regardless of the position of the cursor, except when a mouse button is clicked |
4396 | 1058 | // while the cursor hot spot is in the window of another thread. | 1047 | // while the cursor hot spot is in the window of another thread. |
4397 | 1059 | ReleaseCapture(); | 1048 | ReleaseCapture(); |
4399 | 1060 | event->type = NUX_MOUSE_RELEASED; | 1049 | event.type = NUX_MOUSE_RELEASED; |
4400 | 1061 | return 1; | 1050 | return 1; |
4401 | 1062 | 1051 | ||
4402 | 1063 | case 3: // move: | 1052 | case 3: // move: |
4403 | 1064 | default: // avoid compiler warning | 1053 | default: // avoid compiler warning |
4404 | 1065 | // MSWindows produces extra events even if mouse does not move, ignore them. | 1054 | // MSWindows produces extra events even if mouse does not move, ignore them. |
4405 | 1066 | // http://blogs.msdn.com/oldnewthing/archive/2003/10/01/55108.aspx: Why do I get spurious WM_MOUSEMOVE messages? | 1055 | // http://blogs.msdn.com/oldnewthing/archive/2003/10/01/55108.aspx: Why do I get spurious WM_MOUSEMOVE messages? |
4407 | 1067 | if (event->x == pmx && event->y == pmy) | 1056 | if (event.x == pmx && event.y == pmy) |
4408 | 1068 | return 1; | 1057 | return 1; |
4409 | 1069 | 1058 | ||
4415 | 1070 | pmx = event->x; | 1059 | pmx = event.x; |
4416 | 1071 | pmy = event->y; | 1060 | pmy = event.y; |
4417 | 1072 | // if (abs(event->x - px)>5 || abs(event->y - py)>5) | 1061 | // if (abs(event.x - px)>5 || abs(event.y - py)>5) |
4418 | 1073 | // event->is_click = 0; | 1062 | // event.is_click = 0; |
4419 | 1074 | event->type = NUX_MOUSE_MOVE; | 1063 | event.type = NUX_MOUSE_MOVE; |
4420 | 1075 | return 1; | 1064 | return 1; |
4421 | 1076 | } | 1065 | } |
4422 | 1077 | 1066 | ||
4423 | @@ -1131,12 +1120,12 @@ | |||
4424 | 1131 | } | 1120 | } |
4425 | 1132 | 1121 | ||
4426 | 1133 | //--------------------------------------------------------------------------------------------------------- | 1122 | //--------------------------------------------------------------------------------------------------------- |
4428 | 1134 | bool GraphicsDisplay::GetSystemEvent(Event *evt) | 1123 | bool GraphicsDisplay::GetSystemEvent(Event *event) |
4429 | 1135 | { | 1124 | { |
4430 | 1136 | MSG msg; | 1125 | MSG msg; |
4432 | 1137 | event_->Reset(); | 1126 | event_.Reset(); |
4433 | 1138 | // Erase mouse event and mouse doubleclick states. Keep the mouse states. | 1127 | // Erase mouse event and mouse doubleclick states. Keep the mouse states. |
4435 | 1139 | event_->mouse_state &= 0x0F000000; | 1128 | event_.mouse_state &= 0x0F000000; |
4436 | 1140 | bool got_event; | 1129 | bool got_event; |
4437 | 1141 | 1130 | ||
4438 | 1142 | // Always set the second parameter of PeekMessage to NULL. Indeed, many services creates | 1131 | // Always set the second parameter of PeekMessage to NULL. Indeed, many services creates |
4439 | @@ -1154,12 +1143,12 @@ | |||
4440 | 1154 | TranslateMessage(&msg); | 1143 | TranslateMessage(&msg); |
4441 | 1155 | DispatchMessage(&msg); | 1144 | DispatchMessage(&msg); |
4442 | 1156 | 1145 | ||
4444 | 1157 | memcpy(evt, event_, sizeof(Event)); | 1146 | memcpy(event, &event_, sizeof(Event)); |
4445 | 1158 | got_event = true; | 1147 | got_event = true; |
4446 | 1159 | } | 1148 | } |
4447 | 1160 | else | 1149 | else |
4448 | 1161 | { | 1150 | { |
4450 | 1162 | memcpy(evt, event_, sizeof(Event)); | 1151 | memcpy(event, &event_, sizeof(Event)); |
4451 | 1163 | got_event = false; | 1152 | got_event = false; |
4452 | 1164 | } | 1153 | } |
4453 | 1165 | 1154 | ||
4454 | @@ -1169,14 +1158,14 @@ | |||
4455 | 1169 | // See [Modality, part 3: The WM_QUIT message] http://blogs.msdn.com/oldnewthing/archive/2005/02/22/378018.aspx | 1158 | // See [Modality, part 3: The WM_QUIT message] http://blogs.msdn.com/oldnewthing/archive/2005/02/22/378018.aspx |
4456 | 1170 | PostQuitMessage(msg.wParam); | 1159 | PostQuitMessage(msg.wParam); |
4457 | 1171 | 1160 | ||
4460 | 1172 | event_->type = NUX_TERMINATE_APP; | 1161 | event_.type = NUX_TERMINATE_APP; |
4461 | 1173 | memcpy(evt, event_, sizeof(Event)); | 1162 | memcpy(event, &event_, sizeof(Event)); |
4462 | 1174 | } | 1163 | } |
4463 | 1175 | 1164 | ||
4464 | 1176 | if (msg.message == -1) // error | 1165 | if (msg.message == -1) // error |
4465 | 1177 | { | 1166 | { |
4468 | 1178 | event_->type = NUX_NO_EVENT; | 1167 | event_.type = NUX_NO_EVENT; |
4469 | 1179 | memcpy(evt, event_, sizeof(Event)); | 1168 | memcpy(event, &event_, sizeof(Event)); |
4470 | 1180 | } | 1169 | } |
4471 | 1181 | 1170 | ||
4472 | 1182 | return got_event; | 1171 | return got_event; |
4473 | @@ -1184,16 +1173,16 @@ | |||
4474 | 1184 | 1173 | ||
4475 | 1185 | void GraphicsDisplay::ProcessForeignWin32Event(HWND hWnd, MSG msg, WPARAM wParam, LPARAM lParam, Event *event) | 1174 | void GraphicsDisplay::ProcessForeignWin32Event(HWND hWnd, MSG msg, WPARAM wParam, LPARAM lParam, Event *event) |
4476 | 1186 | { | 1175 | { |
4478 | 1187 | event_->Reset(); | 1176 | event_.Reset(); |
4479 | 1188 | // Erase mouse event and mouse doubleclick states. Keep the mouse states. | 1177 | // Erase mouse event and mouse doubleclick states. Keep the mouse states. |
4481 | 1189 | event_->mouse_state &= 0x0F000000; | 1178 | event_.mouse_state &= 0x0F000000; |
4482 | 1190 | 1179 | ||
4483 | 1191 | // Always set the second parameter of PeekMessage to NULL. Indeed, many services creates | 1180 | // Always set the second parameter of PeekMessage to NULL. Indeed, many services creates |
4484 | 1192 | // windows on the program behalf. If pass the main window as filter, we will miss all the | 1181 | // windows on the program behalf. If pass the main window as filter, we will miss all the |
4485 | 1193 | // messages from the other windows. | 1182 | // messages from the other windows. |
4486 | 1194 | // Same with GetMessage. | 1183 | // Same with GetMessage. |
4487 | 1195 | ProcessWin32Event(hWnd, msg.message, wParam, lParam); | 1184 | ProcessWin32Event(hWnd, msg.message, wParam, lParam); |
4489 | 1196 | memcpy(event, event_, sizeof(Event)); | 1185 | memcpy(event, &event_, sizeof(Event)); |
4490 | 1197 | 1186 | ||
4491 | 1198 | if (msg.message != WM_QUIT) | 1187 | if (msg.message != WM_QUIT) |
4492 | 1199 | { | 1188 | { |
4493 | @@ -1201,20 +1190,20 @@ | |||
4494 | 1201 | // See [Modality, part 3: The WM_QUIT message] http://blogs.msdn.com/oldnewthing/archive/2005/02/22/378018.aspx | 1190 | // See [Modality, part 3: The WM_QUIT message] http://blogs.msdn.com/oldnewthing/archive/2005/02/22/378018.aspx |
4495 | 1202 | PostQuitMessage(msg.wParam); | 1191 | PostQuitMessage(msg.wParam); |
4496 | 1203 | 1192 | ||
4499 | 1204 | event_->type = NUX_TERMINATE_APP; | 1193 | event_.type = NUX_TERMINATE_APP; |
4500 | 1205 | memcpy(event, event_, sizeof(Event)); | 1194 | memcpy(event, &event_, sizeof(Event)); |
4501 | 1206 | } | 1195 | } |
4502 | 1207 | 1196 | ||
4503 | 1208 | if (msg.message == -1) // error | 1197 | if (msg.message == -1) // error |
4504 | 1209 | { | 1198 | { |
4507 | 1210 | event_->type = NUX_NO_EVENT; | 1199 | event_.type = NUX_NO_EVENT; |
4508 | 1211 | memcpy(event, event_, sizeof(Event)); | 1200 | memcpy(event, &event_, sizeof(Event)); |
4509 | 1212 | } | 1201 | } |
4510 | 1213 | } | 1202 | } |
4511 | 1214 | 1203 | ||
4513 | 1215 | Event &GraphicsDisplay::GetCurrentEvent() | 1204 | const Event& GraphicsDisplay::GetCurrentEvent() const |
4514 | 1216 | { | 1205 | { |
4516 | 1217 | return *event_; | 1206 | return event_; |
4517 | 1218 | } | 1207 | } |
4518 | 1219 | 1208 | ||
4519 | 1220 | //--------------------------------------------------------------------------------------------------------- | 1209 | //--------------------------------------------------------------------------------------------------------- |
4520 | @@ -1268,13 +1257,13 @@ | |||
4521 | 1268 | { | 1257 | { |
4522 | 1269 | case WM_DESTROY: | 1258 | case WM_DESTROY: |
4523 | 1270 | { | 1259 | { |
4525 | 1271 | nuxDebugMsg("[GraphicsDisplay::WndProc]: Window \"%s\" received WM_DESTROY message.", m_WindowTitle.GetTCharPtr()); | 1260 | nuxDebugMsg("[GraphicsDisplay::WndProc]: Window \"%s\" received WM_DESTROY message.", window_title_.c_str()); |
4526 | 1272 | break; | 1261 | break; |
4527 | 1273 | } | 1262 | } |
4528 | 1274 | 1263 | ||
4529 | 1275 | case WM_CLOSE: | 1264 | case WM_CLOSE: |
4530 | 1276 | { | 1265 | { |
4532 | 1277 | nuxDebugMsg("[GraphicsDisplay::WndProc]: Window \"%s\" received WM_CLOSE message.", m_WindowTitle.GetTCharPtr()); | 1266 | nuxDebugMsg("[GraphicsDisplay::WndProc]: Window \"%s\" received WM_CLOSE message.", window_title_.c_str()); |
4533 | 1278 | // close? yes or no? | 1267 | // close? yes or no? |
4534 | 1279 | PostQuitMessage(0); | 1268 | PostQuitMessage(0); |
4535 | 1280 | return 0; | 1269 | return 0; |
4536 | @@ -1283,7 +1272,7 @@ | |||
4537 | 1283 | case WM_PAINT: | 1272 | case WM_PAINT: |
4538 | 1284 | { | 1273 | { |
4539 | 1285 | ValidateRect(hWnd, NULL); // validate the surface to avoid receiving WM_PAINT continuously | 1274 | ValidateRect(hWnd, NULL); // validate the surface to avoid receiving WM_PAINT continuously |
4541 | 1286 | event_->type = NUX_WINDOW_DIRTY; | 1275 | event_.type = NUX_WINDOW_DIRTY; |
4542 | 1287 | break; | 1276 | break; |
4543 | 1288 | } | 1277 | } |
4544 | 1289 | 1278 | ||
4545 | @@ -1293,7 +1282,7 @@ | |||
4546 | 1293 | if ((HWND) lParam == hWnd) | 1282 | if ((HWND) lParam == hWnd) |
4547 | 1294 | { | 1283 | { |
4548 | 1295 | // Cancel everything about the mouse state and send a NUX_WINDOW_EXIT_FOCUS message. | 1284 | // Cancel everything about the mouse state and send a NUX_WINDOW_EXIT_FOCUS message. |
4550 | 1296 | event_->mouse_state = 0; | 1285 | event_.mouse_state = 0; |
4551 | 1297 | //nuxDebugMsg("Windows Msg: WM_CAPTURECHANGED/NUX_WINDOW_EXIT_FOCUS"); | 1286 | //nuxDebugMsg("Windows Msg: WM_CAPTURECHANGED/NUX_WINDOW_EXIT_FOCUS"); |
4552 | 1298 | return 0; | 1287 | return 0; |
4553 | 1299 | } | 1288 | } |
4554 | @@ -1311,9 +1300,9 @@ | |||
4555 | 1311 | RECT clientrect; | 1300 | RECT clientrect; |
4556 | 1312 | GetClientRect( hWnd, &clientrect); | 1301 | GetClientRect( hWnd, &clientrect); |
4557 | 1313 | 1302 | ||
4561 | 1314 | event_->type = NUX_SIZE_CONFIGURATION; | 1303 | event_.type = NUX_SIZE_CONFIGURATION; |
4562 | 1315 | event_->width = clientrect.right - clientrect.left; | 1304 | event_.width = clientrect.right - clientrect.left; |
4563 | 1316 | event_->height = clientrect.bottom - clientrect.top; | 1305 | event_.height = clientrect.bottom - clientrect.top; |
4564 | 1317 | return 0; | 1306 | return 0; |
4565 | 1318 | } | 1307 | } |
4566 | 1319 | 1308 | ||
4567 | @@ -1322,26 +1311,26 @@ | |||
4568 | 1322 | RECT clientrect; | 1311 | RECT clientrect; |
4569 | 1323 | GetClientRect( hWnd, &clientrect); | 1312 | GetClientRect( hWnd, &clientrect); |
4570 | 1324 | 1313 | ||
4574 | 1325 | event_->type = NUX_NO_EVENT; //NUX_SIZE_CONFIGURATION; | 1314 | event_.type = NUX_NO_EVENT; //NUX_SIZE_CONFIGURATION; |
4575 | 1326 | event_->width = clientrect.right - clientrect.left; | 1315 | event_.width = clientrect.right - clientrect.left; |
4576 | 1327 | event_->height = clientrect.bottom - clientrect.top; | 1316 | event_.height = clientrect.bottom - clientrect.top; |
4577 | 1328 | 1317 | ||
4578 | 1329 | //setViewPort(0, 0, clientrect.right - clientrect.left, clientrect.bottom - clientrect.top); | 1318 | //setViewPort(0, 0, clientrect.right - clientrect.left, clientrect.bottom - clientrect.top); |
4581 | 1330 | m_WindowSize.width = clientrect.right - clientrect.left; | 1319 | window_size_.width = clientrect.right - clientrect.left; |
4582 | 1331 | m_WindowSize.height = clientrect.bottom - clientrect.top; | 1320 | window_size_.height = clientrect.bottom - clientrect.top; |
4583 | 1332 | 1321 | ||
4584 | 1333 | if ((wParam == SIZE_MAXHIDE) || (wParam == SIZE_MINIMIZED)) | 1322 | if ((wParam == SIZE_MAXHIDE) || (wParam == SIZE_MINIMIZED)) |
4585 | 1334 | { | 1323 | { |
4587 | 1335 | m_is_window_minimized = true; | 1324 | window_minimized_ = true; |
4588 | 1336 | } | 1325 | } |
4589 | 1337 | else | 1326 | else |
4590 | 1338 | { | 1327 | { |
4592 | 1339 | m_is_window_minimized = false; | 1328 | window_minimized_ = false; |
4593 | 1340 | } | 1329 | } |
4594 | 1341 | 1330 | ||
4595 | 1342 | if ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED)) | 1331 | if ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED)) |
4596 | 1343 | { | 1332 | { |
4598 | 1344 | event_->type = NUX_SIZE_CONFIGURATION; | 1333 | event_.type = NUX_SIZE_CONFIGURATION; |
4599 | 1345 | } | 1334 | } |
4600 | 1346 | 1335 | ||
4601 | 1347 | return 0; | 1336 | return 0; |
4602 | @@ -1349,32 +1338,32 @@ | |||
4603 | 1349 | 1338 | ||
4604 | 1350 | case WM_SETFOCUS: | 1339 | case WM_SETFOCUS: |
4605 | 1351 | { | 1340 | { |
4608 | 1352 | event_->type = NUX_WINDOW_ENTER_FOCUS; | 1341 | event_.type = NUX_WINDOW_ENTER_FOCUS; |
4609 | 1353 | event_->mouse_state = 0; | 1342 | event_.mouse_state = 0; |
4610 | 1354 | 1343 | ||
4611 | 1355 | // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process(). | 1344 | // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process(). |
4612 | 1356 | // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be | 1345 | // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be |
4613 | 1357 | // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y. | 1346 | // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y. |
4619 | 1358 | event_->x = 0xFFFFFFFF; | 1347 | event_.x = 0xFFFFFFFF; |
4620 | 1359 | event_->y = 0xFFFFFFFF; | 1348 | event_.y = 0xFFFFFFFF; |
4621 | 1360 | event_->dx = 0; | 1349 | event_.dx = 0; |
4622 | 1361 | event_->dy = 0; | 1350 | event_.dy = 0; |
4623 | 1362 | event_->virtual_code = 0; | 1351 | event_.virtual_code = 0; |
4624 | 1363 | //nuxDebugMsg("Windows Msg: WM_SETFOCUS/NUX_WINDOW_ENTER_FOCUS"); | 1352 | //nuxDebugMsg("Windows Msg: WM_SETFOCUS/NUX_WINDOW_ENTER_FOCUS"); |
4625 | 1364 | break; | 1353 | break; |
4626 | 1365 | } | 1354 | } |
4627 | 1366 | 1355 | ||
4628 | 1367 | case WM_KILLFOCUS: | 1356 | case WM_KILLFOCUS: |
4629 | 1368 | { | 1357 | { |
4632 | 1369 | event_->type = NUX_WINDOW_EXIT_FOCUS; | 1358 | event_.type = NUX_WINDOW_EXIT_FOCUS; |
4633 | 1370 | event_->mouse_state = 0; | 1359 | event_.mouse_state = 0; |
4634 | 1371 | 1360 | ||
4635 | 1372 | // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process() | 1361 | // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process() |
4641 | 1373 | event_->x = 0xFFFFFFFF; | 1362 | event_.x = 0xFFFFFFFF; |
4642 | 1374 | event_->y = 0xFFFFFFFF; | 1363 | event_.y = 0xFFFFFFFF; |
4643 | 1375 | event_->dx = 0; | 1364 | event_.dx = 0; |
4644 | 1376 | event_->dy = 0; | 1365 | event_.dy = 0; |
4645 | 1377 | event_->virtual_code = 0; | 1366 | event_.virtual_code = 0; |
4646 | 1378 | //nuxDebugMsg("Windows Msg: WM_KILLFOCUS/NUX_WINDOW_EXIT_FOCUS"); | 1367 | //nuxDebugMsg("Windows Msg: WM_KILLFOCUS/NUX_WINDOW_EXIT_FOCUS"); |
4647 | 1379 | break; | 1368 | break; |
4648 | 1380 | } | 1369 | } |
4649 | @@ -1388,24 +1377,24 @@ | |||
4650 | 1388 | { | 1377 | { |
4651 | 1389 | if (LOWORD(wParam) != WA_INACTIVE) | 1378 | if (LOWORD(wParam) != WA_INACTIVE) |
4652 | 1390 | { | 1379 | { |
4654 | 1391 | event_->type = NUX_WINDOW_ENTER_FOCUS; | 1380 | event_.type = NUX_WINDOW_ENTER_FOCUS; |
4655 | 1392 | } | 1381 | } |
4656 | 1393 | else | 1382 | else |
4657 | 1394 | { | 1383 | { |
4659 | 1395 | event_->type = NUX_WINDOW_EXIT_FOCUS; | 1384 | event_.type = NUX_WINDOW_EXIT_FOCUS; |
4660 | 1396 | } | 1385 | } |
4662 | 1397 | event_->mouse_state = 0; | 1386 | event_.mouse_state = 0; |
4663 | 1398 | 1387 | ||
4664 | 1399 | // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process(). | 1388 | // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process(). |
4665 | 1400 | // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be | 1389 | // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be |
4666 | 1401 | // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y. | 1390 | // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y. |
4672 | 1402 | event_->x = 0xFFFFFFFF; | 1391 | event_.x = 0xFFFFFFFF; |
4673 | 1403 | event_->y = 0xFFFFFFFF; | 1392 | event_.y = 0xFFFFFFFF; |
4674 | 1404 | event_->dx = 0; | 1393 | event_.dx = 0; |
4675 | 1405 | event_->dy = 0; | 1394 | event_.dy = 0; |
4676 | 1406 | event_->virtual_code = 0; | 1395 | event_.virtual_code = 0; |
4677 | 1407 | 1396 | ||
4679 | 1408 | event_->key_modifiers = GetModifierKeyState(); | 1397 | event_.key_modifiers = GetModifierKeyState(); |
4680 | 1409 | return 0; | 1398 | return 0; |
4681 | 1410 | } | 1399 | } |
4682 | 1411 | 1400 | ||
4683 | @@ -1413,48 +1402,48 @@ | |||
4684 | 1413 | { | 1402 | { |
4685 | 1414 | if (wParam) | 1403 | if (wParam) |
4686 | 1415 | { | 1404 | { |
4688 | 1416 | event_->type = NUX_WINDOW_ENTER_FOCUS; | 1405 | event_.type = NUX_WINDOW_ENTER_FOCUS; |
4689 | 1417 | } | 1406 | } |
4690 | 1418 | else | 1407 | else |
4691 | 1419 | { | 1408 | { |
4693 | 1420 | event_->type = NUX_WINDOW_EXIT_FOCUS; | 1409 | event_.type = NUX_WINDOW_EXIT_FOCUS; |
4694 | 1421 | } | 1410 | } |
4696 | 1422 | event_->mouse_state = 0; | 1411 | event_.mouse_state = 0; |
4697 | 1423 | 1412 | ||
4698 | 1424 | // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process(). | 1413 | // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process(). |
4699 | 1425 | // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be | 1414 | // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be |
4700 | 1426 | // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y. | 1415 | // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y. |
4706 | 1427 | event_->x = 0xFFFFFFFF; | 1416 | event_.x = 0xFFFFFFFF; |
4707 | 1428 | event_->y = 0xFFFFFFFF; | 1417 | event_.y = 0xFFFFFFFF; |
4708 | 1429 | event_->dx = 0; | 1418 | event_.dx = 0; |
4709 | 1430 | event_->dy = 0; | 1419 | event_.dy = 0; |
4710 | 1431 | event_->virtual_code = 0; | 1420 | event_.virtual_code = 0; |
4711 | 1432 | 1421 | ||
4713 | 1433 | event_->key_modifiers = GetModifierKeyState(); | 1422 | event_.key_modifiers = GetModifierKeyState(); |
4714 | 1434 | return 0; | 1423 | return 0; |
4715 | 1435 | } | 1424 | } |
4716 | 1436 | 1425 | ||
4717 | 1437 | case WM_SYSKEYDOWN: | 1426 | case WM_SYSKEYDOWN: |
4718 | 1438 | case WM_KEYDOWN: | 1427 | case WM_KEYDOWN: |
4719 | 1439 | { | 1428 | { |
4723 | 1440 | event_->type = NUX_KEYDOWN; | 1429 | event_.type = NUX_KEYDOWN; |
4724 | 1441 | event_->key_modifiers = GetModifierKeyState(); | 1430 | event_.key_modifiers = GetModifierKeyState(); |
4725 | 1442 | event_->win32_keysym = wParam; | 1431 | event_.win32_keysym = wParam; |
4726 | 1443 | 1432 | ||
4727 | 1444 | if ((uMsg == WM_KEYDOWN) || (uMsg == WM_SYSKEYDOWN)) | 1433 | if ((uMsg == WM_KEYDOWN) || (uMsg == WM_SYSKEYDOWN)) |
4728 | 1445 | { | 1434 | { |
4730 | 1446 | event_->VirtualKeycodeState[GraphicsDisplay::Win32KeySymToINL(wParam) ] = 1; | 1435 | event_.VirtualKeycodeState[GraphicsDisplay::Win32KeySymToINL(wParam) ] = 1; |
4731 | 1447 | } | 1436 | } |
4732 | 1448 | 1437 | ||
4733 | 1449 | if (wParam == VK_CONTROL) | 1438 | if (wParam == VK_CONTROL) |
4734 | 1450 | { | 1439 | { |
4735 | 1451 | if (lParam & (1 << 24)) | 1440 | if (lParam & (1 << 24)) |
4736 | 1452 | { | 1441 | { |
4738 | 1453 | event_->win32_keysym = NUX_VK_RCONTROL; | 1442 | event_.win32_keysym = NUX_VK_RCONTROL; |
4739 | 1454 | } | 1443 | } |
4740 | 1455 | else | 1444 | else |
4741 | 1456 | { | 1445 | { |
4743 | 1457 | event_->win32_keysym = NUX_VK_LCONTROL; | 1446 | event_.win32_keysym = NUX_VK_LCONTROL; |
4744 | 1458 | } | 1447 | } |
4745 | 1459 | } | 1448 | } |
4746 | 1460 | 1449 | ||
4747 | @@ -1462,11 +1451,11 @@ | |||
4748 | 1462 | { | 1451 | { |
4749 | 1463 | if (lParam & (1 << 24)) | 1452 | if (lParam & (1 << 24)) |
4750 | 1464 | { | 1453 | { |
4752 | 1465 | event_->win32_keysym = NUX_VK_RALT; | 1454 | event_.win32_keysym = NUX_VK_RALT; |
4753 | 1466 | } | 1455 | } |
4754 | 1467 | else | 1456 | else |
4755 | 1468 | { | 1457 | { |
4757 | 1469 | event_->win32_keysym = NUX_VK_LALT; | 1458 | event_.win32_keysym = NUX_VK_LALT; |
4758 | 1470 | } | 1459 | } |
4759 | 1471 | } | 1460 | } |
4760 | 1472 | 1461 | ||
4761 | @@ -1474,11 +1463,11 @@ | |||
4762 | 1474 | { | 1463 | { |
4763 | 1475 | if (HIWORD(GetAsyncKeyState(VK_LSHIFT))) | 1464 | if (HIWORD(GetAsyncKeyState(VK_LSHIFT))) |
4764 | 1476 | { | 1465 | { |
4766 | 1477 | event_->win32_keysym = NUX_VK_LSHIFT; | 1466 | event_.win32_keysym = NUX_VK_LSHIFT; |
4767 | 1478 | } | 1467 | } |
4768 | 1479 | else if (HIWORD(GetAsyncKeyState(VK_RSHIFT))) | 1468 | else if (HIWORD(GetAsyncKeyState(VK_RSHIFT))) |
4769 | 1480 | { | 1469 | { |
4771 | 1481 | event_->win32_keysym = NUX_VK_RSHIFT; | 1470 | event_.win32_keysym = NUX_VK_RSHIFT; |
4772 | 1482 | } | 1471 | } |
4773 | 1483 | } | 1472 | } |
4774 | 1484 | 1473 | ||
4775 | @@ -1488,13 +1477,13 @@ | |||
4776 | 1488 | case WM_SYSKEYUP: | 1477 | case WM_SYSKEYUP: |
4777 | 1489 | case WM_KEYUP: | 1478 | case WM_KEYUP: |
4778 | 1490 | { | 1479 | { |
4782 | 1491 | event_->type = NUX_KEYUP; | 1480 | event_.type = NUX_KEYUP; |
4783 | 1492 | event_->key_modifiers = GetModifierKeyState(); | 1481 | event_.key_modifiers = GetModifierKeyState(); |
4784 | 1493 | event_->win32_keysym = wParam; | 1482 | event_.win32_keysym = wParam; |
4785 | 1494 | 1483 | ||
4786 | 1495 | if ((uMsg == WM_KEYUP) || (uMsg == WM_SYSKEYUP)) | 1484 | if ((uMsg == WM_KEYUP) || (uMsg == WM_SYSKEYUP)) |
4787 | 1496 | { | 1485 | { |
4789 | 1497 | event_->VirtualKeycodeState[GraphicsDisplay::Win32KeySymToINL(wParam) ] = 0; | 1486 | event_.VirtualKeycodeState[GraphicsDisplay::Win32KeySymToINL(wParam) ] = 0; |
4790 | 1498 | } | 1487 | } |
4791 | 1499 | 1488 | ||
4792 | 1500 | break; | 1489 | break; |
4793 | @@ -1505,22 +1494,22 @@ | |||
4794 | 1505 | case WM_CHAR: | 1494 | case WM_CHAR: |
4795 | 1506 | case WM_SYSCHAR: | 1495 | case WM_SYSCHAR: |
4796 | 1507 | { | 1496 | { |
4798 | 1508 | event_->key_modifiers = GetModifierKeyState(); | 1497 | event_.key_modifiers = GetModifierKeyState(); |
4799 | 1509 | 1498 | ||
4800 | 1510 | // reset key repeat count to 0. | 1499 | // reset key repeat count to 0. |
4802 | 1511 | event_->key_repeat_count = 0; | 1500 | event_.key_repeat_count = 0; |
4803 | 1512 | 1501 | ||
4804 | 1513 | if (lParam & (1 << 31)) | 1502 | if (lParam & (1 << 31)) |
4805 | 1514 | { | 1503 | { |
4806 | 1515 | // key up events. | 1504 | // key up events. |
4808 | 1516 | event_->type = NUX_KEYUP; | 1505 | event_.type = NUX_KEYUP; |
4809 | 1517 | return 0; | 1506 | return 0; |
4810 | 1518 | } | 1507 | } |
4811 | 1519 | else | 1508 | else |
4812 | 1520 | { | 1509 | { |
4813 | 1521 | // key down events. | 1510 | // key down events. |
4816 | 1522 | event_->type = NUX_KEYDOWN; | 1511 | event_.type = NUX_KEYDOWN; |
4817 | 1523 | event_->key_repeat_count = (int) (lParam & 0xff); | 1512 | event_.key_repeat_count = (int) (lParam & 0xff); |
4818 | 1524 | } | 1513 | } |
4819 | 1525 | 1514 | ||
4820 | 1526 | 1515 | ||
4821 | @@ -1533,12 +1522,12 @@ | |||
4822 | 1533 | } | 1522 | } |
4823 | 1534 | 1523 | ||
4824 | 1535 | wchar_t *utf16_str = new wchar_t [4]; | 1524 | wchar_t *utf16_str = new wchar_t [4]; |
4827 | 1536 | Memset(utf16_str, 0, sizeof(wchar_t) * 4); | 1525 | std::memset(utf16_str, 0, sizeof(wchar_t) * 4); |
4828 | 1537 | Memcpy(utf16_str, (int*) &wParam, sizeof(wParam)); | 1526 | std::memcpy(utf16_str, (int*) &wParam, sizeof(wParam)); |
4829 | 1538 | wchar_t *temp0 = utf16_str; | 1527 | wchar_t *temp0 = utf16_str; |
4830 | 1539 | 1528 | ||
4831 | 1540 | unsigned char *utf8_str = new unsigned char [NUX_EVENT_TEXT_BUFFER_SIZE]; | 1529 | unsigned char *utf8_str = new unsigned char [NUX_EVENT_TEXT_BUFFER_SIZE]; |
4833 | 1541 | Memset(utf8_str, 0, sizeof(unsigned char) * NUX_EVENT_TEXT_BUFFER_SIZE); | 1530 | std::memset(utf8_str, 0, sizeof(unsigned char) * NUX_EVENT_TEXT_BUFFER_SIZE); |
4834 | 1542 | unsigned char *temp1 = utf8_str; | 1531 | unsigned char *temp1 = utf8_str; |
4835 | 1543 | 1532 | ||
4836 | 1544 | 1533 | ||
4837 | @@ -1550,7 +1539,7 @@ | |||
4838 | 1550 | 1539 | ||
4839 | 1551 | if (res == conversionOK) | 1540 | if (res == conversionOK) |
4840 | 1552 | { | 1541 | { |
4842 | 1553 | Memcpy(event_->text, utf8_str, NUX_EVENT_TEXT_BUFFER_SIZE); | 1542 | std::memcpy(event_.text, utf8_str, NUX_EVENT_TEXT_BUFFER_SIZE); |
4843 | 1554 | } | 1543 | } |
4844 | 1555 | delete utf8_str; | 1544 | delete utf8_str; |
4845 | 1556 | delete utf16_str; | 1545 | delete utf16_str; |
4846 | @@ -1563,31 +1552,31 @@ | |||
4847 | 1563 | if (wParam == UNICODE_NOCHAR) | 1552 | if (wParam == UNICODE_NOCHAR) |
4848 | 1564 | return 1; | 1553 | return 1; |
4849 | 1565 | 1554 | ||
4851 | 1566 | event_->key_modifiers = GetModifierKeyState(); | 1555 | event_.key_modifiers = GetModifierKeyState(); |
4852 | 1567 | 1556 | ||
4853 | 1568 | // reset key repeat count to 0. | 1557 | // reset key repeat count to 0. |
4855 | 1569 | event_->key_repeat_count = 0; | 1558 | event_.key_repeat_count = 0; |
4856 | 1570 | 1559 | ||
4857 | 1571 | if (lParam & (1 << 31)) | 1560 | if (lParam & (1 << 31)) |
4858 | 1572 | { | 1561 | { |
4859 | 1573 | // key up events. | 1562 | // key up events. |
4861 | 1574 | event_->type = NUX_KEYUP; | 1563 | event_.type = NUX_KEYUP; |
4862 | 1575 | return 0; | 1564 | return 0; |
4863 | 1576 | } | 1565 | } |
4864 | 1577 | else | 1566 | else |
4865 | 1578 | { | 1567 | { |
4866 | 1579 | // key down events. | 1568 | // key down events. |
4869 | 1580 | event_->type = NUX_KEYDOWN; | 1569 | event_.type = NUX_KEYDOWN; |
4870 | 1581 | event_->key_repeat_count = (int) (lParam & 0xff); | 1570 | event_.key_repeat_count = (int) (lParam & 0xff); |
4871 | 1582 | } | 1571 | } |
4872 | 1583 | 1572 | ||
4873 | 1584 | unsigned int *utf32_str = new unsigned int [4]; | 1573 | unsigned int *utf32_str = new unsigned int [4]; |
4876 | 1585 | Memset(utf32_str, 0, sizeof(unsigned int) * 4); | 1574 | std::memset(utf32_str, 0, sizeof(unsigned int) * 4); |
4877 | 1586 | Memcpy(utf32_str, (int*) &wParam, sizeof(wParam)); | 1575 | std::memcpy(utf32_str, (int*) &wParam, sizeof(wParam)); |
4878 | 1587 | unsigned int *temp0 = utf32_str; | 1576 | unsigned int *temp0 = utf32_str; |
4879 | 1588 | 1577 | ||
4880 | 1589 | unsigned char *utf8_str = new unsigned char [NUX_EVENT_TEXT_BUFFER_SIZE]; | 1578 | unsigned char *utf8_str = new unsigned char [NUX_EVENT_TEXT_BUFFER_SIZE]; |
4882 | 1590 | Memset(utf8_str, 0, sizeof(unsigned char) * NUX_EVENT_TEXT_BUFFER_SIZE); | 1579 | std::memset(utf8_str, 0, sizeof(unsigned char) * NUX_EVENT_TEXT_BUFFER_SIZE); |
4883 | 1591 | unsigned char *temp1 = utf8_str; | 1580 | unsigned char *temp1 = utf8_str; |
4884 | 1592 | 1581 | ||
4885 | 1593 | 1582 | ||
4886 | @@ -1599,7 +1588,7 @@ | |||
4887 | 1599 | 1588 | ||
4888 | 1600 | if (res == conversionOK) | 1589 | if (res == conversionOK) |
4889 | 1601 | { | 1590 | { |
4891 | 1602 | Memcpy(event_->text, utf8_str, NUX_EVENT_TEXT_BUFFER_SIZE); | 1591 | std::memcpy(event_.text, utf8_str, NUX_EVENT_TEXT_BUFFER_SIZE); |
4892 | 1603 | } | 1592 | } |
4893 | 1604 | delete utf8_str; | 1593 | delete utf8_str; |
4894 | 1605 | delete utf32_str; | 1594 | delete utf32_str; |
4895 | @@ -1607,107 +1596,107 @@ | |||
4896 | 1607 | 1596 | ||
4897 | 1608 | case WM_LBUTTONDOWN: | 1597 | case WM_LBUTTONDOWN: |
4898 | 1609 | { | 1598 | { |
4900 | 1610 | mouse_event(hWnd, event_, 0, 1, wParam, lParam); | 1599 | InspectMouseEvent(hWnd, event_, 0, 1, wParam, lParam); |
4901 | 1611 | //nuxDebugMsg("Windows Msg: WM_LBUTTONDOWN"); | 1600 | //nuxDebugMsg("Windows Msg: WM_LBUTTONDOWN"); |
4902 | 1612 | return 0; | 1601 | return 0; |
4903 | 1613 | } | 1602 | } |
4904 | 1614 | case WM_LBUTTONDBLCLK: | 1603 | case WM_LBUTTONDBLCLK: |
4905 | 1615 | { | 1604 | { |
4907 | 1616 | mouse_event(hWnd, event_, 1, 1, wParam, lParam); | 1605 | InspectMouseEvent(hWnd, event_, 1, 1, wParam, lParam); |
4908 | 1617 | //nuxDebugMsg("Windows Msg: WM_LBUTTONDBLCLK"); | 1606 | //nuxDebugMsg("Windows Msg: WM_LBUTTONDBLCLK"); |
4909 | 1618 | return 0; | 1607 | return 0; |
4910 | 1619 | } | 1608 | } |
4911 | 1620 | case WM_LBUTTONUP: | 1609 | case WM_LBUTTONUP: |
4912 | 1621 | { | 1610 | { |
4914 | 1622 | mouse_event(hWnd, event_, 2, 1, wParam, lParam); | 1611 | InspectMouseEvent(hWnd, event_, 2, 1, wParam, lParam); |
4915 | 1623 | //nuxDebugMsg("Windows Msg: WM_LBUTTONUP"); | 1612 | //nuxDebugMsg("Windows Msg: WM_LBUTTONUP"); |
4916 | 1624 | return 0; | 1613 | return 0; |
4917 | 1625 | } | 1614 | } |
4918 | 1626 | case WM_MBUTTONDOWN: | 1615 | case WM_MBUTTONDOWN: |
4919 | 1627 | { | 1616 | { |
4921 | 1628 | mouse_event(hWnd, event_, 0, 2, wParam, lParam); | 1617 | InspectMouseEvent(hWnd, event_, 0, 2, wParam, lParam); |
4922 | 1629 | break; | 1618 | break; |
4923 | 1630 | } | 1619 | } |
4924 | 1631 | case WM_MBUTTONDBLCLK: | 1620 | case WM_MBUTTONDBLCLK: |
4925 | 1632 | { | 1621 | { |
4927 | 1633 | mouse_event(hWnd, event_, 1, 2, wParam, lParam); | 1622 | InspectMouseEvent(hWnd, event_, 1, 2, wParam, lParam); |
4928 | 1634 | break; | 1623 | break; |
4929 | 1635 | } | 1624 | } |
4930 | 1636 | case WM_MBUTTONUP: | 1625 | case WM_MBUTTONUP: |
4931 | 1637 | { | 1626 | { |
4933 | 1638 | mouse_event(hWnd, event_, 2, 2, wParam, lParam); | 1627 | InspectMouseEvent(hWnd, event_, 2, 2, wParam, lParam); |
4934 | 1639 | break; | 1628 | break; |
4935 | 1640 | } | 1629 | } |
4936 | 1641 | case WM_RBUTTONDOWN: | 1630 | case WM_RBUTTONDOWN: |
4937 | 1642 | { | 1631 | { |
4939 | 1643 | mouse_event(hWnd, event_, 0, 3, wParam, lParam); | 1632 | InspectMouseEvent(hWnd, event_, 0, 3, wParam, lParam); |
4940 | 1644 | break; | 1633 | break; |
4941 | 1645 | } | 1634 | } |
4942 | 1646 | case WM_RBUTTONDBLCLK: | 1635 | case WM_RBUTTONDBLCLK: |
4943 | 1647 | { | 1636 | { |
4945 | 1648 | mouse_event(hWnd, event_, 1, 3, wParam, lParam); | 1637 | InspectMouseEvent(hWnd, event_, 1, 3, wParam, lParam); |
4946 | 1649 | break; | 1638 | break; |
4947 | 1650 | } | 1639 | } |
4948 | 1651 | case WM_RBUTTONUP: | 1640 | case WM_RBUTTONUP: |
4949 | 1652 | { | 1641 | { |
4951 | 1653 | mouse_event(hWnd, event_, 2, 3, wParam, lParam); | 1642 | InspectMouseEvent(hWnd, event_, 2, 3, wParam, lParam); |
4952 | 1654 | break; | 1643 | break; |
4953 | 1655 | } | 1644 | } |
4954 | 1656 | case WM_MOUSEWHEEL: | 1645 | case WM_MOUSEWHEEL: |
4955 | 1657 | { | 1646 | { |
4957 | 1658 | mouse_event(hWnd, event_, 0, 4, wParam, lParam); | 1647 | InspectMouseEvent(hWnd, event_, 0, 4, wParam, lParam); |
4958 | 1659 | break; | 1648 | break; |
4959 | 1660 | } | 1649 | } |
4960 | 1661 | 1650 | ||
4961 | 1662 | case WM_NCLBUTTONDBLCLK: | 1651 | case WM_NCLBUTTONDBLCLK: |
4962 | 1663 | { | 1652 | { |
4964 | 1664 | event_->type = NUX_NC_WINDOW_CONFIGURATION; | 1653 | event_.type = NUX_NC_WINDOW_CONFIGURATION; |
4965 | 1665 | break; | 1654 | break; |
4966 | 1666 | } | 1655 | } |
4967 | 1667 | case WM_NCLBUTTONDOWN: | 1656 | case WM_NCLBUTTONDOWN: |
4968 | 1668 | { | 1657 | { |
4970 | 1669 | event_->type = NUX_NC_WINDOW_CONFIGURATION; | 1658 | event_.type = NUX_NC_WINDOW_CONFIGURATION; |
4971 | 1670 | break; | 1659 | break; |
4972 | 1671 | } | 1660 | } |
4973 | 1672 | case WM_NCLBUTTONUP: | 1661 | case WM_NCLBUTTONUP: |
4974 | 1673 | { | 1662 | { |
4976 | 1674 | event_->type = NUX_NC_WINDOW_CONFIGURATION; | 1663 | event_.type = NUX_NC_WINDOW_CONFIGURATION; |
4977 | 1675 | break; | 1664 | break; |
4978 | 1676 | } | 1665 | } |
4979 | 1677 | case WM_NCMBUTTONDBLCLK: | 1666 | case WM_NCMBUTTONDBLCLK: |
4980 | 1678 | { | 1667 | { |
4982 | 1679 | event_->type = NUX_NC_WINDOW_CONFIGURATION; | 1668 | event_.type = NUX_NC_WINDOW_CONFIGURATION; |
4983 | 1680 | break; | 1669 | break; |
4984 | 1681 | } | 1670 | } |
4985 | 1682 | case WM_NCMBUTTONDOWN: | 1671 | case WM_NCMBUTTONDOWN: |
4986 | 1683 | { | 1672 | { |
4988 | 1684 | event_->type = NUX_NC_WINDOW_CONFIGURATION; | 1673 | event_.type = NUX_NC_WINDOW_CONFIGURATION; |
4989 | 1685 | break; | 1674 | break; |
4990 | 1686 | } | 1675 | } |
4991 | 1687 | case WM_NCMBUTTONUP: | 1676 | case WM_NCMBUTTONUP: |
4992 | 1688 | { | 1677 | { |
4994 | 1689 | event_->type = NUX_NC_WINDOW_CONFIGURATION; | 1678 | event_.type = NUX_NC_WINDOW_CONFIGURATION; |
4995 | 1690 | break; | 1679 | break; |
4996 | 1691 | } | 1680 | } |
4997 | 1692 | case WM_NCRBUTTONDBLCLK: | 1681 | case WM_NCRBUTTONDBLCLK: |
4998 | 1693 | { | 1682 | { |
5000 | 1694 | event_->type = NUX_NC_WINDOW_CONFIGURATION; | 1683 | event_.type = NUX_NC_WINDOW_CONFIGURATION; |
Been testing this for over a week and works well. Diff is larger as there is API clean up too, but the guts aren't crazy and i've been over them a few times. Tests for the work are covered in the Unity branch that uses them (https:/ /code.launchpad .net/~unity- team/unity/ unity.dash- to-preview/ +merge/ 124664). Approved.