Nux

Merge lp:~unity-team/nux/nux.redirected-views into lp:nux

Proposed by Jay Taoko on 2012-09-17
Status: Merged
Approved by: Neil J. Patel on 2012-09-18
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
Reviewer Review Type Date Requested Status
Neil J. Patel (community) 2012-09-17 Approve on 2012-09-18
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/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/IOpenGLFrameBufferObject.cpp
  NuxGraphics/IOpenGLFrameBufferObject.h

== Added InitSlTexturePremultiplyShader shader
  NuxGraphics/RenderingPipeGLSL.cpp
  NuxGraphics/GraphicsEngine.cpp
  NuxGraphics/GraphicsEngine.h
  NuxGraphics/RenderingPipeAsm.cpp

== Fixed texture inversion
  NuxGraphics/RenderingPipe.cpp

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/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/IOpenGLFrameBufferObject.cpp
  NuxGraphics/IOpenGLFrameBufferObject.h

== Added InitSlTexturePremultiplyShader shader
  NuxGraphics/RenderingPipeGLSL.cpp
  NuxGraphics/GraphicsEngine.cpp
  NuxGraphics/GraphicsEngine.h
  NuxGraphics/RenderingPipeAsm.cpp

== Fixed texture inversion
  NuxGraphics/RenderingPipe.cpp

To post a comment you must log in.
Neil J. Patel (njpatel) wrote :

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.

review: Approve
661. By Jay Taoko on 2012-09-18

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/IOpenGLFrameBufferObject.cpp
  NuxGraphics/IOpenGLFrameBufferObject.h

== Added InitSlTexturePremultiplyShader shader
  NuxGraphics/RenderingPipeGLSL.cpp
  NuxGraphics/GraphicsEngine.cpp
  NuxGraphics/GraphicsEngine.h
  NuxGraphics/RenderingPipeAsm.cpp

== Fixed texture inversion
  NuxGraphics/RenderingPipe.cpp. Fixes: https://bugs.launchpad.net/bugs/1049593. Approved by Neil J. Patel.

Preview Diff

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

Subscribers

People subscribed via source and target branches