Nux

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

Proposed by Jay Taoko
Status: Merged
Approved by: Neil J. Patel
Approved revision: no longer in the source branch.
Merged at revision: 661
Proposed branch: lp:~unity-team/nux/nux.redirected-views
Merge into: lp:nux
Diff against target: 6727 lines (+2510/-1026)
96 files modified
Nux/AbstractCheckedButton.cpp (+1/-1)
Nux/AbstractComboBox.cpp (+2/-2)
Nux/AbstractComboBox.h (+2/-2)
Nux/Area.cpp (+211/-25)
Nux/Area.h (+113/-8)
Nux/BaseWindow.h (+0/-1)
Nux/BasicView.cpp (+46/-0)
Nux/BasicView.h (+42/-0)
Nux/Button.cpp (+25/-8)
Nux/CheckBox.cpp (+0/-2)
Nux/ClientArea.cpp (+74/-125)
Nux/ClientArea.h (+0/-1)
Nux/ColorEditor.cpp (+29/-53)
Nux/ColorPreview.cpp (+1/-1)
Nux/ComboBoxSimple.cpp (+1/-1)
Nux/Coverflow.cpp (+3/-3)
Nux/Coverflow.h (+1/-1)
Nux/CoverflowItem.h (+1/-1)
Nux/EditTextBox.cpp (+1/-1)
Nux/FloatingWindow.cpp (+11/-11)
Nux/FloatingWindow.h (+5/-5)
Nux/GridHLayout.cpp (+1/-1)
Nux/GridVLayout.cpp (+1/-1)
Nux/GroupBox.h (+1/-1)
Nux/GroupBox2.cpp (+1/-1)
Nux/GroupBox2.h (+1/-1)
Nux/HScrollBar.cpp (+4/-4)
Nux/HScrollBar.h (+4/-4)
Nux/HSplitter.cpp (+0/-20)
Nux/HSplitter.h (+1/-1)
Nux/InputArea.cpp (+4/-2)
Nux/InputArea.h (+0/-2)
Nux/LayeredLayout.cpp (+2/-7)
Nux/Layout.cpp (+306/-63)
Nux/Layout.h (+26/-9)
Nux/LinearLayout.cpp (+3/-3)
Nux/MainLoopGLib.cpp (+0/-1)
Nux/Makefile.am (+3/-0)
Nux/MenuBar.cpp (+5/-5)
Nux/MenuBar.h (+1/-1)
Nux/MouseAreaCtrl.cpp (+1/-1)
Nux/MouseAreaCtrl.h (+1/-1)
Nux/Nux.cpp (+1/-0)
Nux/Nux.h (+5/-0)
Nux/NuxTimerTickSource.h (+54/-0)
Nux/PaintLayer.cpp (+9/-0)
Nux/Painter.cpp (+42/-4)
Nux/Painter.h (+7/-0)
Nux/RGBValuator.cpp (+10/-21)
Nux/RGBValuator.h (+9/-9)
Nux/RadioButton.cpp (+1/-3)
Nux/RangeValue.cpp (+1/-1)
Nux/RangeValue.h (+1/-1)
Nux/RangeValueInteger.cpp (+1/-1)
Nux/RangeValueInteger.h (+1/-1)
Nux/ScrollView.cpp (+0/-2)
Nux/SpinBox_Logic.cpp (+2/-2)
Nux/SpinBox_Logic.h (+2/-2)
Nux/TabView.cpp (+3/-3)
Nux/TabView.h (+3/-3)
Nux/TextEntry.cpp (+6/-7)
Nux/TextEntry.h (+1/-1)
Nux/Theme.cpp (+1/-1)
Nux/VScrollBar.cpp (+4/-4)
Nux/VScrollBar.h (+4/-4)
Nux/VSplitter.cpp (+0/-19)
Nux/VSplitter.h (+1/-1)
Nux/View.cpp (+290/-36)
Nux/View.h (+22/-14)
Nux/WindowCompositor.cpp (+12/-12)
Nux/WindowCompositor.h (+0/-1)
Nux/WindowThread.cpp (+0/-1)
Nux/WindowThread.h (+0/-1)
NuxCore/Animation.cpp (+3/-2)
NuxCore/AnimationController.cpp (+1/-0)
NuxCore/AnimationController.h (+6/-1)
NuxCore/Color.cpp (+1/-1)
NuxCore/EasingCurve.cpp (+14/-0)
NuxCore/EasingCurve.h (+6/-0)
NuxGraphics/GLWindowManager.cpp (+2/-2)
NuxGraphics/GLWindowManager.h (+2/-2)
NuxGraphics/GpuDevice.cpp (+27/-4)
NuxGraphics/GpuDevice.h (+10/-1)
NuxGraphics/GpuDeviceTexture.cpp (+11/-0)
NuxGraphics/GraphicsDisplayWin.cpp (+233/-244)
NuxGraphics/GraphicsDisplayWin.h (+32/-37)
NuxGraphics/GraphicsDisplayX11.cpp (+54/-55)
NuxGraphics/GraphicsDisplayX11.h (+13/-15)
NuxGraphics/GraphicsEngine.cpp (+7/-0)
NuxGraphics/GraphicsEngine.h (+38/-2)
NuxGraphics/IOpenGLFrameBufferObject.cpp (+190/-90)
NuxGraphics/IOpenGLFrameBufferObject.h (+24/-9)
NuxGraphics/RenderingPipe.cpp (+32/-6)
NuxGraphics/RenderingPipeAsm.cpp (+120/-0)
NuxGraphics/RenderingPipeGLSL.cpp (+254/-18)
configure.ac (+2/-1)
To merge this branch: bzr merge lp:~unity-team/nux/nux.redirected-views
Reviewer Review Type Date Requested Status
Neil J. Patel (community) Approve
Review via email: mp+124661@code.launchpad.net

Commit message

This branch introduces "Redirected Views" in Nux. Redirected views allows a view to be rendered inside its own texture and that texture is latter composited inside the main rendering.
This branch contains the required changes for redirected views. The opportunty was also taken to fix minor issues and introduce API changes.

== Core of the Redirected View
  Nux/Area.cpp
  Nux/Area.h
  Nux/Layout.cpp
  Nux/Layout.h
  Nux/View.cpp
  Nux/View.h

== Fixed ClientArea to work with RedirectedViews
  Nux/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.
Revision history for this message
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

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
=== modified file 'Nux/AbstractCheckedButton.cpp'
--- Nux/AbstractCheckedButton.cpp 2011-10-18 20:00:59 +0000
+++ Nux/AbstractCheckedButton.cpp 2012-09-18 11:05:23 +0000
@@ -39,7 +39,7 @@
39 static_text_ = new StaticText(label_, NUX_TRACKER_LOCATION);39 static_text_ = new StaticText(label_, NUX_TRACKER_LOCATION);
40 static_text_->SetTextColor(label_color_);40 static_text_->SetTextColor(label_color_);
41 hlayout_ = new HLayout(NUX_TRACKER_LOCATION);41 hlayout_ = new HLayout(NUX_TRACKER_LOCATION);
42 check_area_ = new InputArea(NUX_TRACKER_LOCATION);42 check_area_ = new BasicView(NUX_TRACKER_LOCATION);
4343
44 check_area_->SetInputEventSensitivity(false);44 check_area_->SetInputEventSensitivity(false);
45 static_text_->SetInputEventSensitivity(false);45 static_text_->SetInputEventSensitivity(false);
4646
=== modified file 'Nux/AbstractComboBox.cpp'
--- Nux/AbstractComboBox.cpp 2011-10-10 01:52:00 +0000
+++ Nux/AbstractComboBox.cpp 2012-09-18 11:05:23 +0000
@@ -37,8 +37,8 @@
37 , m_MenuIsActive(false)37 , m_MenuIsActive(false)
38 {38 {
39 m_hlayout = new HLayout(NUX_TRACKER_LOCATION);39 m_hlayout = new HLayout(NUX_TRACKER_LOCATION);
40 _combo_box_area = new InputArea(NUX_TRACKER_LOCATION);40 _combo_box_area = new BasicView(NUX_TRACKER_LOCATION);
41 _combo_box_opening_area = new InputArea(NUX_TRACKER_LOCATION);41 _combo_box_opening_area = new BasicView(NUX_TRACKER_LOCATION);
4242
43 m_hlayout->AddView(_combo_box_area, 1);43 m_hlayout->AddView(_combo_box_area, 1);
44 m_hlayout->AddView(_combo_box_opening_area, 0);44 m_hlayout->AddView(_combo_box_opening_area, 0);
4545
=== modified file 'Nux/AbstractComboBox.h'
--- Nux/AbstractComboBox.h 2011-10-10 01:52:00 +0000
+++ Nux/AbstractComboBox.h 2012-09-18 11:05:23 +0000
@@ -48,8 +48,8 @@
4848
49 protected:49 protected:
50 HLayout *m_hlayout;50 HLayout *m_hlayout;
51 InputArea *_combo_box_area;51 BasicView *_combo_box_area;
52 InputArea *_combo_box_opening_area;52 BasicView *_combo_box_opening_area;
53 StaticText *_pango_static_text;53 StaticText *_pango_static_text;
54 bool m_MenuIsActive;54 bool m_MenuIsActive;
55 bool m_IsOpeningMenu;55 bool m_IsOpeningMenu;
5656
=== modified file 'Nux/Area.cpp'
--- Nux/Area.cpp 2012-09-14 19:41:27 +0000
+++ Nux/Area.cpp 2012-09-18 11:05:23 +0000
@@ -39,11 +39,15 @@
39 NUX_IMPLEMENT_OBJECT_TYPE(Area);39 NUX_IMPLEMENT_OBJECT_TYPE(Area);
4040
41 Area::Area(NUX_FILE_LINE_DECL)41 Area::Area(NUX_FILE_LINE_DECL)
42 : InitiallyUnownedObject(NUX_FILE_LINE_PARAM)42 : InitiallyUnownedObject(NUX_FILE_LINE_PARAM)
43 , geometry_(0, 0, DEFAULT_WIDGET_WIDTH, DEFAULT_WIDGET_HEIGHT)43 , redirect_rendering_to_texture_(false)
44 , min_size_(AREA_MIN_WIDTH, AREA_MIN_HEIGHT)44 , update_backup_texture_(false)
45 , max_size_(AREA_MAX_WIDTH, AREA_MAX_HEIGHT)45 , present_redirected_view_(true)
46 , layout_done_(true)46 , copy_previous_fbo_for_background_(true)
47 , geometry_(0, 0, DEFAULT_WIDGET_WIDTH, DEFAULT_WIDGET_HEIGHT)
48 , min_size_(AREA_MIN_WIDTH, AREA_MIN_HEIGHT)
49 , max_size_(AREA_MAX_WIDTH, AREA_MAX_HEIGHT)
50 , layout_done_(true)
47 {51 {
48 window_thread_ = GetWindowThread();52 window_thread_ = GetWindowThread();
49 visible_ = true;53 visible_ = true;
@@ -321,41 +325,76 @@
321 return parent_area_;325 return parent_area_;
322 }326 }
323327
324 int Area::GetBaseX () const328 int Area::GetX() const
325 {329 {
326 return geometry_.x;330 return geometry_.x;
327 }331 }
328332
329 int Area::GetBaseY () const333 int Area::GetBaseX() const
334 {
335 return GetX();
336 }
337
338 int Area::GetY() const
330 {339 {
331 return geometry_.y;340 return geometry_.y;
332 }341 }
333342
334 int Area::GetBaseWidth () const343 int Area::GetBaseY() const
344 {
345 return GetY();
346 }
347
348 int Area::GetWidth() const
335 {349 {
336 return geometry_.width;350 return geometry_.width;
337 }351 }
338352
339 int Area::GetBaseHeight () const353 int Area::GetBaseWidth() const
354 {
355 return GetWidth();
356 }
357
358 int Area::GetHeight() const
340 {359 {
341 return geometry_.height;360 return geometry_.height;
342 }361 }
343362
363 int Area::GetBaseHeight() const
364 {
365 return GetHeight();
366 }
367
344 void Area::SetGeometry(int x, int y, int w, int h)368 void Area::SetGeometry(int x, int y, int w, int h)
345 {369 {
346 h = nux::Clamp<int> (h, min_size_.height, max_size_.height);370 h = nux::Clamp<int> (h, min_size_.height, max_size_.height);
347 w = nux::Clamp<int> (w, min_size_.width, max_size_.width);371 w = nux::Clamp<int> (w, min_size_.width, max_size_.width);
348372
373 bool detected_size_change = false;
374 bool detected_position_change = false;
375
376 if (geometry_.x != x || geometry_.y != y)
377 detected_position_change = true;
378
379 if (geometry_.width != w || geometry_.height != h)
380 detected_size_change = true;
381
349 nux::Geometry geometry(x, y, w, h);382 nux::Geometry geometry(x, y, w, h);
350 if (geometry_ == geometry)383 if (geometry_ == geometry)
351 return;384 return;
352385
353 GeometryChangePending();386 GeometryChangePending(detected_position_change, detected_size_change);
354 geometry_ = geometry;387 geometry_ = geometry;
355 ReconfigureParentLayout();388 ReconfigureParentLayout();
356 GeometryChanged();389 GeometryChanged(detected_position_change, detected_size_change);
357390
358 OnGeometryChanged.emit(this, geometry_);391 geometry_changed.emit(this, geometry_);
392
393 if (detected_position_change)
394 position_changed.emit(this, x, y);
395
396 if (detected_size_change)
397 size_changed.emit(this, w, h);
359 }398 }
360399
361 void Area::SetGeometry(const Geometry &geo)400 void Area::SetGeometry(const Geometry &geo)
@@ -368,40 +407,64 @@
368 return geometry_;407 return geometry_;
369 }408 }
370409
371 void Area::SetBaseX(int x)410 void Area::SetX(int x)
372 {411 {
373 SetGeometry(x, geometry_.y, geometry_.width, geometry_.height);412 SetGeometry(x, geometry_.y, geometry_.width, geometry_.height);
374 }413 }
375414
376 void Area::SetBaseY (int y)415 void Area::SetY (int y)
377 {416 {
378 SetGeometry(geometry_.x, y, geometry_.width, geometry_.height);417 SetGeometry(geometry_.x, y, geometry_.width, geometry_.height);
379 }418 }
380419
381 void Area::SetBaseXY (int x, int y)420 void Area::SetBaseX(int x)
421 {
422 SetX(x);
423 }
424
425 void Area::SetBaseY(int y)
426 {
427 SetY(y);
428 }
429
430 void Area::SetXY(int x, int y)
382 {431 {
383 SetGeometry(x, y, geometry_.width, geometry_.height);432 SetGeometry(x, y, geometry_.width, geometry_.height);
384 }433 }
385434
435 void Area::SetBaseXY(int x, int y)
436 {
437 SetXY(x, y);
438 }
439
440 void Area::SetSize(int w, int h)
441 {
442 SetGeometry(geometry_.x, geometry_.y, w, h);
443 }
444
386 void Area::SetBaseSize(int w, int h)445 void Area::SetBaseSize(int w, int h)
387 {446 {
388 SetGeometry(geometry_.x, geometry_.y, w, h);447 SetSize(w, h);
448 }
449
450 void Area::SetWidth(int w)
451 {
452 SetGeometry(geometry_.x, geometry_.y, w, geometry_.height);
389 }453 }
390454
391 void Area::SetBaseWidth(int w)455 void Area::SetBaseWidth(int w)
392 {456 {
393 SetGeometry(geometry_.x, geometry_.y, w, geometry_.height);457 SetWidth(w);
458 }
459
460 void Area::SetHeight(int h)
461 {
462 SetGeometry(geometry_.x, geometry_.y, geometry_.width, h);
394 }463 }
395464
396 void Area::SetBaseHeight(int h)465 void Area::SetBaseHeight(int h)
397 {466 {
398 SetGeometry(geometry_.x, geometry_.y, geometry_.width, h);467 SetHeight(h);
399 }
400
401 void Area::IncreaseSize(int x, int y)
402 {
403 geometry_.OffsetPosition(x, y);
404 OnResize.emit(geometry_.x, geometry_.y, geometry_.width, geometry_.height );
405 }468 }
406469
407 long Area::ComputeContentSize()470 long Area::ComputeContentSize()
@@ -1043,6 +1106,129 @@
1043 return false;1106 return false;
1044 }1107 }
10451108
1109 /*** Support for redirected rendering ***/
1110 void Area::SetRedirectRenderingToTexture(bool redirect)
1111 {
1112 if (redirect_rendering_to_texture_ == redirect)
1113 {
1114 return;
1115 }
1116
1117 if ((redirect_rendering_to_texture_ == false) && redirect)
1118 {
1119 update_backup_texture_ = true;
1120 }
1121
1122 redirect_rendering_to_texture_ = redirect;
1123 if (redirect == false)
1124 {
1125 // Free the texture of this view
1126 backup_fbo_.Release();
1127 backup_texture_.Release();
1128 backup_depth_texture_.Release();
1129 prev_fbo_.Release();
1130 }
1131 }
1132
1133 bool Area::RedirectRenderingToTexture() const
1134 {
1135 return redirect_rendering_to_texture_;
1136 }
1137
1138 void Area::SetUpdateBackupTextureForChildRendering(bool update)
1139 {
1140 update_backup_texture_ = update;
1141 }
1142
1143 ObjectPtr<IOpenGLBaseTexture> Area::BackupTexture() const
1144 {
1145 // if RedirectRenderingToTexture() is false, then backup_texture_ is not a valid smart pointer.
1146 return backup_texture_;
1147 }
1148
1149 bool Area::UpdateBackupTextureForChildRendering() const
1150 {
1151 return update_backup_texture_;
1152 }
1153
1154 void Area::PrepareParentRedirectedView()
1155 {
1156 Area* parent = GetParentObject();
1157
1158 while (parent)
1159 {
1160 if (parent->RedirectRenderingToTexture() && (parent->UpdateBackupTextureForChildRendering() == false))
1161 {
1162 parent->SetUpdateBackupTextureForChildRendering(true);
1163 parent->PrepareParentRedirectedView();
1164 }
1165 else if (parent->RedirectRenderingToTexture() && (parent->UpdateBackupTextureForChildRendering() == true))
1166 {
1167 break;
1168 }
1169 else
1170 {
1171 parent->PrepareParentRedirectedView();
1172 break;
1173 }
1174 }
1175 }
1176
1177 bool Area::HasParentRedirectedView()
1178 {
1179 Area* parent = GetParentObject();
1180
1181 while (parent && !parent->Type().IsDerivedFromType(View::StaticObjectType))
1182 {
1183 parent = parent->GetParentObject();
1184 }
1185
1186 if (parent)
1187 {
1188 View* view = static_cast<View*>(parent);
1189 if (view->RedirectRenderingToTexture())
1190 {
1191 return true;
1192 }
1193 else
1194 {
1195 return view->HasParentRedirectedView();
1196 }
1197 }
1198 return false;
1199 }
1200
1201 Area* Area::RedirectedAncestor()
1202 {
1203 Area* parent = GetParentObject();
1204
1205 while (parent)
1206 {
1207 if (parent->RedirectRenderingToTexture())
1208 {
1209 return parent;
1210 }
1211 parent = parent->GetParentObject();
1212 }
1213
1214 return NULL;
1215 }
1216
1217 void Area::SetCopyPreviousFboTexture(bool copy_background)
1218 {
1219 copy_previous_fbo_for_background_ = copy_background;
1220 }
1221
1222 void Area::SetPresentRedirectedView(bool present_redirected_view)
1223 {
1224 present_redirected_view_ = present_redirected_view;
1225 }
1226
1227 bool Area::PresentRedirectedView() const
1228 {
1229 return present_redirected_view_;
1230 }
1231
1046#ifdef NUX_GESTURES_SUPPORT1232#ifdef NUX_GESTURES_SUPPORT
1047 Area* Area::GetInputAreaHitByGesture(const GestureEvent &event)1233 Area* Area::GetInputAreaHitByGesture(const GestureEvent &event)
1048 {1234 {
10491235
=== modified file 'Nux/Area.h'
--- Nux/Area.h 2012-08-27 09:09:21 +0000
+++ Nux/Area.h 2012-09-18 11:05:23 +0000
@@ -25,7 +25,6 @@
2525
26#include <string>26#include <string>
27#include <sigc++/sigc++.h>27#include <sigc++/sigc++.h>
28#include "Features.h"
29#include "NuxCore/InitiallyUnownedObject.h"28#include "NuxCore/InitiallyUnownedObject.h"
30#include "NuxGraphics/Events.h"29#include "NuxGraphics/Events.h"
31#include "Utils.h"30#include "Utils.h"
@@ -35,6 +34,9 @@
35{34{
36 class WindowThread;35 class WindowThread;
37 class GraphicsEngine;36 class GraphicsEngine;
37 class IOpenGLBaseTexture;
38 class IOpenGLFrameBufferObject;
39
38#ifdef NUX_GESTURES_SUPPORT40#ifdef NUX_GESTURES_SUPPORT
39 class GestureEvent;41 class GestureEvent;
40#endif // NUX_GESTURES_SUPPORT42#endif // NUX_GESTURES_SUPPORT
@@ -156,6 +158,17 @@
156 Area(NUX_FILE_LINE_DECL);158 Area(NUX_FILE_LINE_DECL);
157 virtual ~Area();159 virtual ~Area();
158160
161 int GetX() const;
162 int GetY() const;
163 int GetWidth() const;
164 int GetHeight() const;
165
166 void SetX(int x);
167 void SetY(int y);
168 void SetXY(int x, int y);
169 void SetWidth(int w);
170 void SetHeight(int h);
171
159 int GetBaseX() const;172 int GetBaseX() const;
160 int GetBaseY() const;173 int GetBaseY() const;
161 int GetBaseWidth() const;174 int GetBaseWidth() const;
@@ -172,6 +185,7 @@
172 The size is adjusted to respect the min and max size policy185 The size is adjusted to respect the min and max size policy
173 \sa SetWidth(), SetHeight(), SetMinimumSize(), SetMaximumSize().186 \sa SetWidth(), SetHeight(), SetMinimumSize(), SetMaximumSize().
174 */187 */
188 virtual void SetSize(int w, int h);
175 virtual void SetBaseSize(int w, int h);189 virtual void SetBaseSize(int w, int h);
176190
177 virtual void SetMinimumSize(int w, int h);191 virtual void SetMinimumSize(int w, int h);
@@ -213,7 +227,7 @@
213227
214 \sa SetBaseWidth(), SetBaseHeight(), SetBaseX(), SetBaseY().228 \sa SetBaseWidth(), SetBaseHeight(), SetBaseX(), SetBaseY().
215 */229 */
216 void SetGeometry(int x, int y, int w, int h);230 virtual void SetGeometry(int x, int y, int w, int h);
217231
218 //! Set the geometry of the object.232 //! Set the geometry of the object.
219 /*!233 /*!
@@ -223,13 +237,12 @@
223 @param geo Geometry object.237 @param geo Geometry object.
224 \sa SetWidth(), SetHeight(), SetX(), SetY().238 \sa SetWidth(), SetHeight(), SetX(), SetY().
225 */239 */
226 void SetGeometry(const Geometry &geo);
227
228 void IncreaseSize(int x, int y);
229240
230 void SetBaseString(std::string const& caption);241 void SetBaseString(std::string const& caption);
231 std::string const& GetBaseString() const;242 std::string const& GetBaseString() const;
232243
244 virtual void SetGeometry(const Geometry& geo);
245
233 //! Deprecated. Use GetToplevel.246 //! Deprecated. Use GetToplevel.
234 Area* GetToplevel();247 Area* GetToplevel();
235248
@@ -461,7 +474,17 @@
461 This signal is only meant to inform of a change of size. When receiving this signal don't do anything474 This signal is only meant to inform of a change of size. When receiving this signal don't do anything
462 that could change the size of this object. Or you risk creating an infinite loop.475 that could change the size of this object. Or you risk creating an infinite loop.
463 */476 */
464 sigc::signal<void, Area *, Geometry&> OnGeometryChanged;477 sigc::signal<void, Area*, Geometry&> geometry_changed;
478
479 /*!
480 This signal emitted when the size of the area has changed. It is emitted after geometry_changed.
481 */
482 sigc::signal<void, Area*, int, int> size_changed;
483
484 /*!
485 This signal emitted when the position of the area has changed. It is emitted after geometry_changed.
486 */
487 sigc::signal<void, Area*, int, int> position_changed;
465488
466 /*!489 /*!
467 SetParentObject/UnParentObject are protected API. They are not meant to be used directly by users.490 SetParentObject/UnParentObject are protected API. They are not meant to be used directly by users.
@@ -588,13 +611,13 @@
588 This signal is only meant to inform that the size is about to change. When overriding this function,611 This signal is only meant to inform that the size is about to change. When overriding this function,
589 don't do anything that could change the size of this object. Or you risk creating an infinite loop.612 don't do anything that could change the size of this object. Or you risk creating an infinite loop.
590 */613 */
591 virtual void GeometryChangePending() {}614 virtual void GeometryChangePending(bool position_about_to_change, bool size_about_to_change) {}
592 615
593 /*!616 /*!
594 This signal is only meant to inform that the size has changed. When overriding this function,617 This signal is only meant to inform that the size has changed. When overriding this function,
595 don't do anything that could change the size of this object. Or you risk creating an infinite loop.618 don't do anything that could change the size of this object. Or you risk creating an infinite loop.
596 */619 */
597 virtual void GeometryChanged() {}620 virtual void GeometryChanged(bool position_has_changed, bool size_has_changed) {}
598621
599 //! Request a Layout recompute after a change of size622 //! Request a Layout recompute after a change of size
600 /*623 /*
@@ -628,6 +651,88 @@
628 //! If this variable is not NULL, then this area is part of the keyboard focus chain.651 //! If this variable is not NULL, then this area is part of the keyboard focus chain.
629 Area* next_object_to_key_focus_area_;652 Area* next_object_to_key_focus_area_;
630653
654
655 /**********************************************/
656 /*** Begin support for redirected rendering ***/
657 /**********************************************/
658public:
659 //! Redirect the rendering of this view to a texture.
660 /*!
661 Redirect the rendering of this view to a texture. \sa BackupTexture().
662 @param redirect If true, redirect the rendering of this view to a texture.
663 */
664 virtual void SetRedirectRenderingToTexture(bool redirect);
665
666 /*!
667 @return True if the rendering of this view is done in a texture.
668 */
669 virtual bool RedirectRenderingToTexture() const;
670
671 //! Return the texture of this View if RedirectRenderingToTexture is enabled.
672 /*
673 Return the texture of this View if RedirectRenderingToTexture is enabled.
674 If RedirectRenderingToTexture() is false, then backup_texture_ is not a valid smart pointer.
675
676 @return the device texture that contains the rendering of this view.
677 */
678 ObjectPtr<IOpenGLBaseTexture> BackupTexture() const;
679
680 /*!
681 The use of this function is a bit arcan but it gives more rendering
682 options to redirected areas.
683 */
684 void SetCopyPreviousFboTexture(bool copy);
685
686 /*!
687 Activate/Deactivate the presentation of the redirected texture in the rendering tree.
688 */
689 void SetPresentRedirectedView(bool present_redirected_view);
690
691 /*!
692 @return True if the redirected texture is displayed in the rendering tree.
693 */
694 bool PresentRedirectedView() const;
695
696protected:
697 //! Redirect the rendering of the view to a texture.
698 bool redirect_rendering_to_texture_;
699 bool update_backup_texture_;
700 bool present_redirected_view_;
701 //! The texture that holds the rendering of this view.
702 ObjectPtr<IOpenGLBaseTexture> backup_texture_;
703 ObjectPtr<IOpenGLBaseTexture> backup_depth_texture_;
704 ObjectPtr<IOpenGLBaseTexture> background_texture_;
705 ObjectPtr<IOpenGLFrameBufferObject> backup_fbo_;
706 ObjectPtr<IOpenGLFrameBufferObject> prev_fbo_;
707 Geometry prev_viewport_;
708 Matrix4 model_view_matrix_;
709 Matrix4 perspective_matrix_;
710 /*!
711 If true, copy the area in the previous fbo texture
712 into background_texture_.
713 */
714 bool copy_previous_fbo_for_background_;
715
716 /*!
717 Implemented in nux::View and nux::Layout.
718 Report to a parent view with redirect_rendering_to_texture_ set to true that one of its children
719 needs to be redrawn.
720 */
721 virtual void PrepareParentRedirectedView();
722
723 virtual bool HasParentRedirectedView();
724 Area* RedirectedAncestor();
725
726 /*!
727 Inform this view that one of its children has requested a draw. This view must have its rendering redirected to a texture.
728 @param update True if this view is redirected and one of its children has requested a draw.
729 */
730 virtual void SetUpdateBackupTextureForChildRendering(bool update);
731 virtual bool UpdateBackupTextureForChildRendering() const;
732
733 /********************************************/
734 /*** End support for redirected rendering ***/
735 /********************************************/
631736
632#ifdef NUX_GESTURES_SUPPORT737#ifdef NUX_GESTURES_SUPPORT
633 //! Returns the InputArea hit by the given gesture738 //! Returns the InputArea hit by the given gesture
634739
=== modified file 'Nux/BaseWindow.h'
--- Nux/BaseWindow.h 2012-05-31 21:50:05 +0000
+++ Nux/BaseWindow.h 2012-09-18 11:05:23 +0000
@@ -26,7 +26,6 @@
2626
27#include <boost/scoped_ptr.hpp>27#include <boost/scoped_ptr.hpp>
28#include "ScrollView.h"28#include "ScrollView.h"
29#include "Features.h"
3029
31#if defined(NUX_OS_WINDOWS)30#if defined(NUX_OS_WINDOWS)
32#include "NuxGraphics/Events.h"31#include "NuxGraphics/Events.h"
3332
=== added file 'Nux/BasicView.cpp'
--- Nux/BasicView.cpp 1970-01-01 00:00:00 +0000
+++ Nux/BasicView.cpp 2012-09-18 11:05:23 +0000
@@ -0,0 +1,46 @@
1/*
2 * Copyright 2012 Inalogic Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * version 3 along with this program. If not, see
15 * <http://www.gnu.org/licenses/>
16 *
17 * Authored by: Jay Taoko <jaytaoko@inalogic.com>
18 *
19 */
20
21#include "Nux/Nux.h"
22#include "BasicView.h"
23
24
25namespace nux {
26NUX_IMPLEMENT_OBJECT_TYPE(BasicView);
27
28BasicView::BasicView(NUX_FILE_LINE_DECL)
29: nux::View(NUX_FILE_LINE_PARAM)
30{
31
32}
33
34BasicView::~BasicView()
35{
36
37}
38
39void BasicView::Draw(nux::GraphicsEngine& graphics_engine, bool force_draw)
40{
41 // Draw nothing
42 // For debug only:
43 // graphics_engine.QRP_Color(GetBaseX(), GetBaseY(), GetBaseWidth(), GetBaseHeight(), nux::color::Pink);
44}
45
46}
047
=== added file 'Nux/BasicView.h'
--- Nux/BasicView.h 1970-01-01 00:00:00 +0000
+++ Nux/BasicView.h 2012-09-18 11:05:23 +0000
@@ -0,0 +1,42 @@
1/*
2 * Copyright 2012 Inalogic Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 3, as published
6 * by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranties of
10 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11 * PURPOSE. See the GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * version 3 along with this program. If not, see
15 * <http://www.gnu.org/licenses/>
16 *
17 * Authored by: Jay Taoko <jaytaoko@inalogic.com>
18 *
19 */
20
21#ifndef BASIC_VIEW_H
22#define BASIC_VIEW_H
23
24
25namespace nux {
26
27//! A very basic View object with no rendering.
28class BasicView: public nux::View
29{
30 NUX_DECLARE_OBJECT_TYPE(BasicView, View);
31public:
32 BasicView(NUX_FILE_LINE_PROTO);
33 ~BasicView();
34
35
36protected:
37 void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw);
38};
39
40}
41#endif // BASIC_VIEW_H
42
043
=== modified file 'Nux/Button.cpp'
--- Nux/Button.cpp 2011-10-22 06:17:42 +0000
+++ Nux/Button.cpp 2012-09-18 11:05:23 +0000
@@ -344,20 +344,36 @@
344 Geometry base = GetGeometry();344 Geometry base = GetGeometry();
345345
346 graphics_engine.PushClippingRectangle(base);346 graphics_engine.PushClippingRectangle(base);
347 GetPainter().PaintBackground(graphics_engine, base);347
348 UXStyleImageRef ref_style = eIMAGE_STYLE_NONE;
348349
349 if (visual_state_ == VISUAL_STATE_PRESSED)350 if (visual_state_ == VISUAL_STATE_PRESSED)
350 {351 {
351 GetPainter().PaintTextureShape(graphics_engine, base, eBUTTON_FOCUS);352 ref_style = eBUTTON_FOCUS;
352 }353 }
353 else if (visual_state_ == VISUAL_STATE_PRELIGHT)354 else if (visual_state_ == VISUAL_STATE_PRELIGHT)
354 {355 {
355 GetPainter().PaintTextureShape(graphics_engine, base, eBUTTON_PRELIGHT);356 ref_style = eBUTTON_PRELIGHT;
356 }357 }
357 else358 else
358 {359 {
359 GetPainter().PaintTextureShape(graphics_engine, base, eBUTTON_NORMAL);360 ref_style = eBUTTON_NORMAL;
360 }361 }
362
363 const PainterImage *pimage = GetTheme().GetImage(ref_style);
364 BaseTexture* texture = NULL;
365 if (pimage != NULL)
366 {
367 texture = pimage->texture;
368 }
369
370 TexCoordXForm texxform;
371 ROPConfig rop;
372 rop.Blend = true;
373 rop.SrcBlend = GL_ONE;
374 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
375
376 GetPainter().PushDrawSliceScaledTextureLayer(graphics_engine, base, ref_style, color::White, eAllCorners, true, rop);
361377
362 if (GetCompositionLayout())378 if (GetCompositionLayout())
363 {379 {
@@ -368,13 +384,14 @@
368 clip_geo.OffsetSize(-left_clip_ - right_clip_, -top_clip_ - bottom_clip_);384 clip_geo.OffsetSize(-left_clip_ - right_clip_, -top_clip_ - bottom_clip_);
369385
370 graphics_engine.PushClippingRectangle(clip_geo);386 graphics_engine.PushClippingRectangle(clip_geo);
371 GetPainter().PushPaintLayerStack();387
372 GetCompositionLayout()->ProcessDraw(graphics_engine, force_draw);388 GetCompositionLayout()->ProcessDraw(graphics_engine, true);
373 GetPainter().PopPaintLayerStack();389
374 graphics_engine.PopClippingRectangle();390 graphics_engine.PopClippingRectangle();
375 }391 }
376 GetPainter().PopPaintLayerStack();392 GetPainter().PopPaintLayerStack();
377 }393 }
394 GetPainter().PopPaintLayer();
378 graphics_engine.PopClippingRectangle();395 graphics_engine.PopClippingRectangle();
379 }396 }
380397
381398
=== modified file 'Nux/CheckBox.cpp'
--- Nux/CheckBox.cpp 2011-10-18 20:00:59 +0000
+++ Nux/CheckBox.cpp 2012-09-18 11:05:23 +0000
@@ -43,8 +43,6 @@
43 Geometry base = GetGeometry();43 Geometry base = GetGeometry();
44 graphics_engine.PushClippingRectangle(base);44 graphics_engine.PushClippingRectangle(base);
4545
46 GetPainter().PaintBackground(graphics_engine, base);
47
48 InteractState is;46 InteractState is;
49 is.is_on = active_;47 is.is_on = active_;
5048
5149
=== modified file 'Nux/ClientArea.cpp'
--- Nux/ClientArea.cpp 2012-02-04 23:19:44 +0000
+++ Nux/ClientArea.cpp 2012-09-18 11:05:23 +0000
@@ -46,36 +46,38 @@
46 mouse_drag.connect(sigc::mem_fun(this, &ClientArea::RecvMouseDrag));46 mouse_drag.connect(sigc::mem_fun(this, &ClientArea::RecvMouseDrag));
47 mouse_move.connect(sigc::mem_fun(this, &ClientArea::RecvMouseMove));47 mouse_move.connect(sigc::mem_fun(this, &ClientArea::RecvMouseMove));
48 key_down.connect(sigc::mem_fun(this, &ClientArea::RecvKeyEvent));48 key_down.connect(sigc::mem_fun(this, &ClientArea::RecvKeyEvent));
49
50 if (GetWindowThread()->GetGraphicsDisplay().HasFrameBufferSupport())
51 {
52 m_FrameBufferObject = GetGraphicsDisplay()->GetGpuDevice()->CreateFrameBufferObject();
53 m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
54 m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);
55 }
56 }49 }
5750
58 ClientArea::~ClientArea()51 ClientArea::~ClientArea()
59 {52 {
60 }53 }
6154
62 void ClientArea::BeginDraw(GraphicsEngine &graphics_engine, bool force_draw)55 void ClientArea::BeginDraw(GraphicsEngine& graphics_engine, bool force_draw)
63 {56 {
64 if ((IsRedrawNeeded() == false) && (force_draw == false))57 // if ((IsRedrawNeeded() == false) && (force_draw == false))
65 return;58 // return;
59
60 // Save blend states
61 unsigned int current_alpha_blend;
62 unsigned int current_src_blend_factor;
63 unsigned int current_dest_blend_factor;
64 graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
65
66 ObjectPtr<IOpenGLFrameBufferObject> prev_fbo_ = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject();
67 Geometry prev_viewport_ = graphics_engine.GetViewportRect();
6668
67 if (GetWindowThread()->GetGraphicsDisplay().HasFrameBufferSupport())69 if (GetWindowThread()->GetGraphicsDisplay().HasFrameBufferSupport())
68 {70 {
69 int buffer_width = GetBaseWidth();71 int width = GetWidth();
70 int buffer_height = GetBaseHeight();72 int height = GetHeight();
71 int window_width, window_height;73 int window_width, window_height;
72 window_width = graphics_engine.GetViewportWidth();74 window_width = prev_viewport_.width;
73 window_height = graphics_engine.GetViewportHeight();75 window_height = prev_viewport_.height;
7476
75 m_ctx.x = GetBaseX();77 m_ctx.x = GetX();
76 m_ctx.y = GetBaseY();78 m_ctx.y = GetY();
77 m_ctx.width = GetBaseWidth();79 m_ctx.width = width;
78 m_ctx.height = GetBaseHeight();80 m_ctx.height = height;
7981
80 // A is obtained from graphics_engine. So A dimension's are in relative window coordinates.82 // A is obtained from graphics_engine. So A dimension's are in relative window coordinates.
81 Rect A = graphics_engine.GetClippingRegion();83 Rect A = graphics_engine.GetClippingRegion();
@@ -87,102 +89,62 @@
87 m_ctx.width_clipregion = C.GetWidth();89 m_ctx.width_clipregion = C.GetWidth();
88 m_ctx.height_clipregion = C.GetHeight();90 m_ctx.height_clipregion = C.GetHeight();
8991
90 ObjectPtr<IOpenGLFrameBufferObject> prevFBO = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject();92 //ObjectPtr<IOpenGLFrameBufferObject> prevFBO = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject();
9193
92 if ((m_FrameBufferObject->GetWidth() != buffer_width) || (m_FrameBufferObject->GetHeight() != buffer_height))94 if (m_FrameBufferObject.IsNull())
93 {95 {
94 m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);96 // Create the fbo before using it for the first time.
95 m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);97 m_FrameBufferObject = GetGraphicsDisplay()->GetGpuDevice()->CreateFrameBufferObject();
96 m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);98 }
97 }99
98100 if (!m_MainColorRT.IsValid() || (m_MainColorRT->GetWidth() != width) || (m_MainColorRT->GetHeight() != height))
99 m_FrameBufferObject->SetRenderTarget(0, m_MainColorRT->GetSurfaceLevel(0));101 {
100 m_FrameBufferObject->SetDepthSurface(m_MainDepthRT->GetSurfaceLevel(0));102 // Create or resize the color and depth textures before using them.
103 m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(width, height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
104 m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(width, height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);
105 }
106
107 m_FrameBufferObject->FormatFrameBufferObject(width, height, BITFMT_R8G8B8A8);
108 m_FrameBufferObject->EmptyClippingRegion();
109 m_FrameBufferObject->SetTextureAttachment(0, m_MainColorRT, 0);
110 m_FrameBufferObject->SetDepthTextureAttachment(m_MainDepthRT, 0);
101 m_FrameBufferObject->Activate();111 m_FrameBufferObject->Activate();
102112
103 graphics_engine.SetViewport(0, 0, buffer_width, buffer_height);113 graphics_engine.SetViewport(0, 0, width, height);
104 m_FrameBufferObject->EmptyClippingRegion();114
105115
106 ClientDraw(graphics_engine, m_ctx, force_draw);116 ClientDraw(graphics_engine, m_ctx, force_draw);
107117 }
108 // Restore the main frame buffer object118
109 prevFBO->Activate();119 if (prev_fbo_.IsValid())
110120 {
111 Area* view_window = GetTopLevelViewWindow();121 // Restore the previous fbo
112 if (view_window)122 prev_fbo_->Activate();
113 {123
114 graphics_engine.SetViewport(0, 0, view_window->GetBaseWidth(), view_window->GetBaseHeight());124 prev_fbo_->ApplyClippingRegion();
115 graphics_engine.ApplyClippingRectangle();125 }
116 graphics_engine.ApplyModelViewMatrix();126
117 graphics_engine.SetOrthographicProjectionMatrix(view_window->GetBaseWidth(), view_window->GetBaseHeight());127 // Restore the matrices and the view port.
118128 graphics_engine.ApplyModelViewMatrix();
119 }129 graphics_engine.SetOrthographicProjectionMatrix(prev_viewport_.width, prev_viewport_.height);
120 else130 graphics_engine.SetViewport(prev_viewport_.x, prev_viewport_.y, prev_viewport_.width, prev_viewport_.height);
121 {131
122 graphics_engine.SetViewport(0, 0, window_width, window_height);132 {
123 graphics_engine.ApplyClippingRectangle();133 unsigned int w, h;
124 graphics_engine.ApplyModelViewMatrix();134 w = m_MainColorRT->GetWidth();
125 graphics_engine.SetOrthographicProjectionMatrix(window_width, window_height);135 h = m_MainColorRT->GetHeight();
126 }136 int x = m_ctx.x;
127 137 int y = m_ctx.y;
128 // Copy the client frame buffer into the main frame buffer.138
129 {139 TexCoordXForm texxform0;
130 unsigned int w, h;140 texxform0.uwrap = TEXWRAP_CLAMP;
131 w = m_MainColorRT->GetWidth();141 texxform0.vwrap = TEXWRAP_CLAMP;
132 h = m_MainColorRT->GetHeight();142 texxform0.FlipVCoord(true);
133 int x = m_ctx.x;143 GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(x, y, w, h, m_MainColorRT, texxform0, Color(color::White));
134 int y = m_ctx.y;144 }
135145
136 TexCoordXForm texxform0;146 // restore blend states
137 texxform0.uwrap = TEXWRAP_CLAMP;147 graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
138 texxform0.vwrap = TEXWRAP_CLAMP;
139 texxform0.FlipVCoord(true);
140 GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(x, y, w, h, m_MainColorRT, texxform0, Color(color::White));
141 }
142 }
143 else
144 {
145 int x = graphics_engine.GetContextX();
146 int y = graphics_engine.GetContextY();
147
148 // The clientarea is in absolute window coordinates. It needs to be offset so that it is in relative window coordinates.
149 m_ctx.x = GetBaseX() + x;
150 m_ctx.y = GetBaseY() + y;
151 m_ctx.width = GetBaseWidth();
152 m_ctx.height = GetBaseHeight();
153
154 // A is obtained from graphics_engine. So A dimension's are in relative window coordinates.
155 Rect A = graphics_engine.GetClippingRegion();
156
157 Rect B = Rect(m_ctx.x, m_ctx.y, m_ctx.width, m_ctx.height);
158 Rect C = A.Intersect(B);
159
160 m_ctx.x_clipregion = C.x;
161 m_ctx.y_clipregion = C.y;
162 m_ctx.width_clipregion = C.GetWidth();
163 m_ctx.height_clipregion = C.GetHeight();
164
165 int window_width, window_height;
166 window_width = graphics_engine.GetViewportWidth();
167 window_height = graphics_engine.GetViewportHeight();
168
169 SetClientViewport(graphics_engine);
170// graphics_engine.SetViewport(
171// m_ctx.x, window_height - m_ctx.y - m_ctx.height, m_ctx.width, m_ctx.height);
172//
173// graphics_engine.SetOpenGLClippingRectangle(
174// m_ctx.x_clipregion,
175// window_height - m_ctx.y_clipregion - m_ctx.height_clipregion,
176// m_ctx.width_clipregion,
177// m_ctx.height_clipregion);
178
179 ClientDraw(graphics_engine, m_ctx, force_draw);
180
181 // go back to 2D in case that was changed by the client.
182 graphics_engine.SetViewport(0, 0, window_width, window_height);
183 graphics_engine.ApplyClippingRectangle();
184 graphics_engine.Push2DWindow(window_width, window_height);
185 }
186 }148 }
187149
188 void ClientArea::Draw(GraphicsEngine &graphics_engine, bool force_draw)150 void ClientArea::Draw(GraphicsEngine &graphics_engine, bool force_draw)
@@ -270,19 +232,6 @@
270232
271 }233 }
272234
273 void ClientArea::QueueDraw()
274 {
275 //GetWindowCompositor()..AddToDrawList(this);
276 WindowThread* application = GetWindowThread();
277 if (application)
278 {
279 application->AddToDrawList(this);
280 application->RequestRedraw();
281 //GetWindowCompositor().AddToDrawList(this);
282 }
283 draw_cmd_queued_ = true;
284 }
285
286 bool ClientArea::AcceptKeyNavFocus()235 bool ClientArea::AcceptKeyNavFocus()
287 {236 {
288 return false;237 return false;
289238
=== modified file 'Nux/ClientArea.h'
--- Nux/ClientArea.h 2011-11-10 17:28:44 +0000
+++ Nux/ClientArea.h 2012-09-18 11:05:23 +0000
@@ -49,7 +49,6 @@
49 virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw);49 virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw);
50 virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw);50 virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw);
51 virtual void PostDraw(GraphicsEngine &graphics_engine, bool force_draw);51 virtual void PostDraw(GraphicsEngine &graphics_engine, bool force_draw);
52 virtual void QueueDraw();
5352
54 void EnableClientDraw(bool b)53 void EnableClientDraw(bool b)
55 {54 {
5655
=== modified file 'Nux/ColorEditor.cpp'
--- Nux/ColorEditor.cpp 2012-02-06 01:06:09 +0000
+++ Nux/ColorEditor.cpp 2012-09-18 11:05:23 +0000
@@ -207,9 +207,9 @@
207 m_Validator.SetMaximum(1.0);207 m_Validator.SetMaximum(1.0);
208 m_Validator.SetDecimals(2);208 m_Validator.SetDecimals(2);
209209
210 picker_area_ = new InputArea(NUX_TRACKER_LOCATION);210 picker_area_ = new BasicView(NUX_TRACKER_LOCATION);
211 channel_area_ = new InputArea(NUX_TRACKER_LOCATION);211 channel_area_ = new BasicView(NUX_TRACKER_LOCATION);
212 selected_color_area_ = new InputArea(NUX_TRACKER_LOCATION);212 selected_color_area_ = new BasicView(NUX_TRACKER_LOCATION);
213 m_hlayout = new HLayout(NUX_TRACKER_LOCATION);213 m_hlayout = new HLayout(NUX_TRACKER_LOCATION);
214214
215 channel_area_->mouse_down.connect(sigc::mem_fun(this, &ColorEditor::RecvMouseDown));215 channel_area_->mouse_down.connect(sigc::mem_fun(this, &ColorEditor::RecvMouseDown));
@@ -316,18 +316,6 @@
316 ctrllayout->SetHorizontalExternalMargin(2);316 ctrllayout->SetHorizontalExternalMargin(2);
317 ctrllayout->SetVerticalInternalMargin(2);317 ctrllayout->SetVerticalInternalMargin(2);
318318
319// //ctrllayout->AddView(new SpaceLayout(20,20,20,40), 1);
320// OkButton = new ToggleButton("OK", NUX_TRACKER_LOCATION);
321// OkButton->SetMinimumWidth(60);
322// OkButton->SetMinimumHeight(20);
323//
324// CancelButton = new ToggleButton("Cancel", NUX_TRACKER_LOCATION);
325// CancelButton->SetMinimumWidth(60);
326// CancelButton->SetMinimumHeight(20);
327//
328// // ctrllayout->AddView(OkButton, 1);
329// // ctrllayout->AddView(CancelButton, 1);
330
331 m_hlayout->AddLayout(ctrllayout, 0);319 m_hlayout->AddLayout(ctrllayout, 0);
332320
333 radiogroup = new RadioButtonGroup(NUX_TRACKER_LOCATION);321 radiogroup = new RadioButtonGroup(NUX_TRACKER_LOCATION);
@@ -379,13 +367,11 @@
379 {367 {
380 Geometry base = GetGeometry();368 Geometry base = GetGeometry();
381369
382 GetPainter().PaintBackground(graphics_engine, base);
383 //GetPainter().Paint2DQuadWireframe(graphics_engine, base, Color(COLOR_BACKGROUND_SECONDARY));
384
385 base.OffsetPosition(1, 1);370 base.OffsetPosition(1, 1);
386 base.OffsetSize(-2, -2);371 base.OffsetSize(-2, -2);
387372
388 graphics_engine.PushClippingRectangle(base);373 graphics_engine.PushClippingRectangle(base);
374 GetPainter().PushDrawShapeLayer(graphics_engine, base, eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true);
389375
390 if (m_ColorModel == color::RGB)376 if (m_ColorModel == color::RGB)
391 {377 {
@@ -396,26 +382,33 @@
396 DrawHSV(graphics_engine, force_draw);382 DrawHSV(graphics_engine, force_draw);
397 }383 }
398384
399 redcheck->QueueDraw();385 GetPainter().PopBackground();
400 redtext->QueueDraw();
401 greencheck->QueueDraw();
402 greentext->QueueDraw();
403 bluecheck->QueueDraw();
404 bluetext->QueueDraw();
405
406 huecheck->QueueDraw();
407 hue_text_entry_->QueueDraw();
408 saturationcheck->QueueDraw();
409 saturation_text_entry_->QueueDraw();
410 valuecheck->QueueDraw();
411 value_text_entry_->QueueDraw();
412
413// OkButton->QueueDraw();
414// CancelButton->QueueDraw();
415
416 graphics_engine.PopClippingRectangle();386 graphics_engine.PopClippingRectangle();
417 }387 }
418388
389 void ColorEditor::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
390 {
391 Geometry base = GetGeometry();
392 GetPainter().PushShapeLayer(graphics_engine, base, eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true);
393
394 bool force = force_draw || IsFullRedraw();
395 redcheck->ProcessDraw(graphics_engine, force);
396 redtext->ProcessDraw(graphics_engine, force);
397 greencheck->ProcessDraw(graphics_engine, force);
398 greentext->ProcessDraw(graphics_engine, force);
399 bluecheck->ProcessDraw(graphics_engine, force);
400 bluetext->ProcessDraw(graphics_engine, force);
401
402 huecheck->ProcessDraw(graphics_engine, force);
403 hue_text_entry_->ProcessDraw(graphics_engine, force);
404 saturationcheck->ProcessDraw(graphics_engine, force);
405 saturation_text_entry_->ProcessDraw(graphics_engine, force);
406 valuecheck->ProcessDraw(graphics_engine, force);
407 value_text_entry_->ProcessDraw(graphics_engine, force);
408
409 GetPainter().PopBackground();
410 }
411
419// Draw Marker on Base Chanel Area412// Draw Marker on Base Chanel Area
420 void ColorEditor::DrawBaseChannelMarker(GraphicsEngine &graphics_engine)413 void ColorEditor::DrawBaseChannelMarker(GraphicsEngine &graphics_engine)
421 {414 {
@@ -621,23 +614,6 @@
621 }614 }
622 }615 }
623616
624 void ColorEditor::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
625 {
626 redcheck->ProcessDraw(graphics_engine, force_draw);
627 redtext->ProcessDraw(graphics_engine, force_draw);
628 greencheck->ProcessDraw(graphics_engine, force_draw);
629 greentext->ProcessDraw(graphics_engine, force_draw);
630 bluecheck->ProcessDraw(graphics_engine, force_draw);
631 bluetext->ProcessDraw(graphics_engine, force_draw);
632
633 huecheck->ProcessDraw(graphics_engine, force_draw);
634 hue_text_entry_->ProcessDraw(graphics_engine, force_draw);
635 saturationcheck->ProcessDraw(graphics_engine, force_draw);
636 saturation_text_entry_->ProcessDraw(graphics_engine, force_draw);
637 valuecheck->ProcessDraw(graphics_engine, force_draw);
638 value_text_entry_->ProcessDraw(graphics_engine, force_draw);
639 }
640
641 void ColorEditor::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags)617 void ColorEditor::RecvMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags)
642 {618 {
643 float BaseValue;619 float BaseValue;
@@ -958,7 +934,7 @@
958 {934 {
959 rgb_ = color::RedGreenBlue(Clamp<double>(r, 0.0, 1.0),935 rgb_ = color::RedGreenBlue(Clamp<double>(r, 0.0, 1.0),
960 Clamp<double>(g, 0.0, 1.0),936 Clamp<double>(g, 0.0, 1.0),
961 Clamp<double> (b, 0.0, 1.0));937 Clamp<double>(b, 0.0, 1.0));
962 hsv_ = color::HueSaturationValue(rgb_);938 hsv_ = color::HueSaturationValue(rgb_);
963 RecvCheckColorModel(true, m_ColorModel, color_channel_);939 RecvCheckColorModel(true, m_ColorModel, color_channel_);
964 sigChange.emit(this);940 sigChange.emit(this);
965941
=== modified file 'Nux/ColorPreview.cpp'
--- Nux/ColorPreview.cpp 2012-07-04 16:36:46 +0000
+++ Nux/ColorPreview.cpp 2012-09-18 11:05:23 +0000
@@ -38,7 +38,7 @@
38 {38 {
39 //setSize(200, 100);39 //setSize(200, 100);
40 m_hlayout = new HLayout(NUX_TRACKER_LOCATION);40 m_hlayout = new HLayout(NUX_TRACKER_LOCATION);
41 m_ColorArea = new InputArea(NUX_TRACKER_LOCATION);41 m_ColorArea = new BasicView(NUX_TRACKER_LOCATION);
42 m_ColorValue = new StaticTextBox("", NUX_TRACKER_LOCATION);42 m_ColorValue = new StaticTextBox("", NUX_TRACKER_LOCATION);
43 m_DialogThreadProxy = new ColorDialogProxy(true);43 m_DialogThreadProxy = new ColorDialogProxy(true);
4444
4545
=== modified file 'Nux/ComboBoxSimple.cpp'
--- Nux/ComboBoxSimple.cpp 2011-12-14 02:01:43 +0000
+++ Nux/ComboBoxSimple.cpp 2012-09-18 11:05:23 +0000
@@ -55,7 +55,7 @@
55 _combo_box_area->SetMinimumSize(2 * DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT);55 _combo_box_area->SetMinimumSize(2 * DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT);
56 _combo_box_area->SetGeometry(Geometry(0, 0, 3 * DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT));56 _combo_box_area->SetGeometry(Geometry(0, 0, 3 * DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT));
57 //_pango_static_text->SetClipping(_combo_box_area->GetBaseWidth());57 //_pango_static_text->SetClipping(_combo_box_area->GetBaseWidth());
58 _combo_box_area->OnGeometryChanged.connect(sigc::mem_fun(this, &ComboBoxSimple::RecvGeometryChanged));58 _combo_box_area->geometry_changed.connect(sigc::mem_fun(this, &ComboBoxSimple::RecvGeometryChanged));
5959
60 //m_CurrentMenu = new MenuPage;60 //m_CurrentMenu = new MenuPage;
61 m_CurrentMenu->SetParentMenu(0);61 m_CurrentMenu->SetParentMenu(0);
6262
=== modified file 'Nux/Coverflow.cpp'
--- Nux/Coverflow.cpp 2012-08-20 18:43:15 +0000
+++ Nux/Coverflow.cpp 2012-09-18 11:05:23 +0000
@@ -224,7 +224,7 @@
224 parent_->mouse_up.connect(sigc::mem_fun(this, &Impl::HandleMouseUp));224 parent_->mouse_up.connect(sigc::mem_fun(this, &Impl::HandleMouseUp));
225 parent_->mouse_down.connect(sigc::mem_fun(this, &Impl::HandleMouseDown));225 parent_->mouse_down.connect(sigc::mem_fun(this, &Impl::HandleMouseDown));
226 parent_->mouse_wheel.connect(sigc::mem_fun(this, &Impl::HandleMouseWheel));226 parent_->mouse_wheel.connect(sigc::mem_fun(this, &Impl::HandleMouseWheel));
227 parent_->OnGeometryChanged.connect(sigc::mem_fun(this, &Impl::HandleGeometryChange));227 parent_->geometry_changed.connect(sigc::mem_fun(this, &Impl::HandleGeometryChange));
228228
229229
230 camera_position_.x = 0.0f;230 camera_position_.x = 0.0f;
@@ -286,7 +286,8 @@
286286
287 text_loader_.font_size = 10;287 text_loader_.font_size = 10;
288288
289 BaseTexture* texture = LoadTextureFromFile(PKGDATADIR"/UITextures/coverflow.oval-shadow.png");289 NString resource_path = NUX_FIND_RESOURCE_LOCATION_NOFAIL("UITextures/coverflow.oval-shadow.png");
290 BaseTexture* texture = LoadTextureFromFile(resource_path.GetTCharPtr());
290 drop_shadow_texture_ = texture->GetDeviceTexture();291 drop_shadow_texture_ = texture->GetDeviceTexture();
291 texture->UnReference();292 texture->UnReference();
292293
@@ -1087,7 +1088,6 @@
1087 graphics_engine.GetRenderStates().SetPremultipliedBlend(SRC_OVER);1088 graphics_engine.GetRenderStates().SetPremultipliedBlend(SRC_OVER);
1088 graphics_engine.GetRenderStates().SetColorMask(true, true, true, true);1089 graphics_engine.GetRenderStates().SetColorMask(true, true, true, true);
10891090
1090 nux::GetPainter().PaintBackground(graphics_engine, GetGeometry());
1091 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);1091 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
10921092
1093 glViewport(0, 0, ctx.width, ctx.height);1093 glViewport(0, 0, ctx.width, ctx.height);
10941094
=== modified file 'Nux/Coverflow.h'
--- Nux/Coverflow.h 2012-02-13 05:26:32 +0000
+++ Nux/Coverflow.h 2012-09-18 11:05:23 +0000
@@ -20,9 +20,9 @@
20#ifndef COVERFLOWVIEW_H20#ifndef COVERFLOWVIEW_H
21#define COVERFLOWVIEW_H21#define COVERFLOWVIEW_H
2222
23#include "Nux/ClientArea.h"
24#include "NuxCore/Math/Vector4.h"23#include "NuxCore/Math/Vector4.h"
25#include "CoverflowModel.h"24#include "CoverflowModel.h"
25#include "ClientArea.h"
2626
27#if defined(NUX_OS_WINDOWS)27#if defined(NUX_OS_WINDOWS)
28 #define PKGDATADIR "../../data/"28 #define PKGDATADIR "../../data/"
2929
=== modified file 'Nux/CoverflowItem.h'
--- Nux/CoverflowItem.h 2012-08-20 18:43:15 +0000
+++ Nux/CoverflowItem.h 2012-09-18 11:05:23 +0000
@@ -23,7 +23,7 @@
23#include <memory>23#include <memory>
24#include <string>24#include <string>
2525
26#include <Nux/Nux.h>26#include "Nux.h"
27#include <sigc++/sigc++.h>27#include <sigc++/sigc++.h>
2828
29namespace nux29namespace nux
3030
=== modified file 'Nux/EditTextBox.cpp'
--- Nux/EditTextBox.cpp 2012-08-27 09:09:21 +0000
+++ Nux/EditTextBox.cpp 2012-09-18 11:05:23 +0000
@@ -94,7 +94,7 @@
94 void EditTextBox::ScrollTimerInterrupt(void *v)94 void EditTextBox::ScrollTimerInterrupt(void *v)
95 {95 {
96 Geometry base = GetGeometry();96 Geometry base = GetGeometry();
97 Event &event = GetGraphicsDisplay()->GetCurrentEvent();97 const Event& event = GetGraphicsDisplay()->GetCurrentEvent();
9898
99 int X = event.x;99 int X = event.x;
100 m_KeyboardHandler.CaretAutoScroll(event.x, event.y, base);100 m_KeyboardHandler.CaretAutoScroll(event.x, event.y, base);
101101
=== modified file 'Nux/FloatingWindow.cpp'
--- Nux/FloatingWindow.cpp 2012-08-27 09:09:21 +0000
+++ Nux/FloatingWindow.cpp 2012-09-18 11:05:23 +0000
@@ -52,27 +52,27 @@
52 _resize_handle_height = 20;52 _resize_handle_height = 20;
53 _title_bar_height = 20;53 _title_bar_height = 20;
5454
55 _minimize_button = new InputArea(NUX_TRACKER_LOCATION);55 _minimize_button = new BasicView(NUX_TRACKER_LOCATION);
56 _minimize_button->SetParentObject(this);56 _minimize_button->SetParentObject(this);
5757
58 _resize_handle = new InputArea(NUX_TRACKER_LOCATION);58 _resize_handle = new BasicView(NUX_TRACKER_LOCATION);
59 _resize_handle->SinkReference();59 _resize_handle->SinkReference();
60 _resize_handle->SetParentObject(this);60 _resize_handle->SetParentObject(this);
6161
62 _title_bar = new InputArea(NUX_TRACKER_LOCATION);62 _title_bar = new BasicView(NUX_TRACKER_LOCATION);
63 _title_bar->SinkReference();63 _title_bar->SinkReference();
64 _title_bar->SetParentObject(this);64 _title_bar->SetParentObject(this);
6565
66 _close_button = new InputArea(NUX_TRACKER_LOCATION);66 _close_button = new BasicView(NUX_TRACKER_LOCATION);
67 _window_title_bar = new StaticTextBox("", NUX_TRACKER_LOCATION);67 _window_title_bar = new StaticTextBox("", NUX_TRACKER_LOCATION);
6868
69 _title_bar_layout = new HLayout(NUX_TRACKER_LOCATION);69 _title_bar_layout = new HLayout(NUX_TRACKER_LOCATION);
70 _title_bar_layout->Reference();70 _title_bar_layout->Reference();
71 71
72 _minimize_button->SetMinMaxSize(20, 20);72 _minimize_button->SetMinMaxSize(20, 20);
73 _minimize_button->SetGeometry(0, 0, 20, 20);73 _minimize_button->SetGeometry(Geometry(0, 0, 20, 20));
74 _close_button->SetMinimumSize(20, 20);74 _close_button->SetMinimumSize(20, 20);
75 _close_button->SetGeometry(0, 0, 20, 20);75 _close_button->SetGeometry(Geometry(0, 0, 20, 20));
76 _resize_handle->SetMinimumSize(_resize_handle_width, _resize_handle_height);76 _resize_handle->SetMinimumSize(_resize_handle_width, _resize_handle_height);
77 _resize_handle->SetGeometry(Geometry(0, 0, _resize_handle_width, _resize_handle_height));77 _resize_handle->SetGeometry(Geometry(0, 0, _resize_handle_width, _resize_handle_height));
7878
@@ -322,7 +322,7 @@
322 // No need to compute the window layout elements [LayoutWindowElements()]. They haven't changed.322 // No need to compute the window layout elements [LayoutWindowElements()]. They haven't changed.
323 // No need to compute the layout [ComputeContentSize()]. It hasn't changed.323 // No need to compute the layout [ComputeContentSize()]. It hasn't changed.
324324
325 _title_bar->SetGeometry(0, 0, geo.GetWidth(), _title_bar_height);325 _title_bar->SetGeometry(Geometry(0, 0, geo.GetWidth(), _title_bar_height));
326326
327#if defined(NUX_OS_LINUX)327#if defined(NUX_OS_LINUX)
328 if (m_input_window != 0)328 if (m_input_window != 0)
@@ -371,7 +371,7 @@
371 // Drag Bar Geometry371 // Drag Bar Geometry
372 if (HasTitleBar())372 if (HasTitleBar())
373 {373 {
374 _title_bar->SetGeometry(0, 0, geo.GetWidth(), _title_bar_height);374 _title_bar->SetGeometry(Geometry(0, 0, geo.GetWidth(), _title_bar_height));
375 }375 }
376376
377 // Size grip Geometry377 // Size grip Geometry
@@ -408,7 +408,7 @@
408 // Drag Bar Geometry408 // Drag Bar Geometry
409 if (HasTitleBar())409 if (HasTitleBar())
410 {410 {
411 _title_bar->SetGeometry(0, 0, geo.GetWidth(), _title_bar_height);411 _title_bar->SetGeometry(Geometry(0, 0, geo.GetWidth(), _title_bar_height));
412 }412 }
413413
414 // Size grip Geometry414 // Size grip Geometry
@@ -436,7 +436,7 @@
436 // Drag Bar Geometry436 // Drag Bar Geometry
437 if (HasTitleBar())437 if (HasTitleBar())
438 {438 {
439 _title_bar->SetGeometry(0, 0, geo.GetWidth(), _title_bar_height);439 _title_bar->SetGeometry(Geometry(0, 0, geo.GetWidth(), _title_bar_height));
440 }440 }
441441
442 // Size grip Geometry442 // Size grip Geometry
@@ -455,7 +455,7 @@
455 // Define the geometry of some of the component of the window. Otherwise, if the composition layout is not set,455 // Define the geometry of some of the component of the window. Otherwise, if the composition layout is not set,
456 // then the component won't be correctly placed after a SetGeometry. This can be redundant if the composition layout is set.456 // then the component won't be correctly placed after a SetGeometry. This can be redundant if the composition layout is set.
457 Geometry base = GetGeometry();457 Geometry base = GetGeometry();
458 _title_bar->SetGeometry(0, 0, base.GetWidth(), _title_bar_height);458 _title_bar->SetGeometry(Geometry(0, 0, base.GetWidth(), _title_bar_height));
459459
460 _title_bar_layout->SetGeometry(_title_bar->GetGeometry());460 _title_bar_layout->SetGeometry(_title_bar->GetGeometry());
461 GetWindowThread()->ComputeElementLayout(_title_bar_layout);461 GetWindowThread()->ComputeElementLayout(_title_bar_layout);
462462
=== modified file 'Nux/FloatingWindow.h'
--- Nux/FloatingWindow.h 2011-12-14 02:01:43 +0000
+++ Nux/FloatingWindow.h 2012-09-18 11:05:23 +0000
@@ -27,7 +27,7 @@
2727
28#include "ScrollView.h"28#include "ScrollView.h"
29#include "BaseWindow.h"29#include "BaseWindow.h"
30#include "InputArea.h"30#include "BasicView.h"
31#include "Layout.h"31#include "Layout.h"
32#include "HLayout.h"32#include "HLayout.h"
33#include "VLayout.h"33#include "VLayout.h"
@@ -112,12 +112,12 @@
112 int _resize_handle_height;112 int _resize_handle_height;
113 int _title_bar_height;113 int _title_bar_height;
114114
115 InputArea *_resize_handle;115 BasicView *_resize_handle;
116 InputArea *_title_bar;116 BasicView *_title_bar;
117 Point _title_bar_mouse_down_location;117 Point _title_bar_mouse_down_location;
118118
119 InputArea *_minimize_button;119 BasicView *_minimize_button;
120 InputArea *_close_button;120 BasicView *_close_button;
121 StaticTextBox *_window_title_bar;121 StaticTextBox *_window_title_bar;
122 bool m_hasTitleBar;122 bool m_hasTitleBar;
123123
124124
=== modified file 'Nux/GridHLayout.cpp'
--- Nux/GridHLayout.cpp 2012-07-25 20:10:56 +0000
+++ Nux/GridHLayout.cpp 2012-09-18 11:05:23 +0000
@@ -579,7 +579,7 @@
579 graphics_engine.PopClippingRectangle();579 graphics_engine.PopClippingRectangle();
580 graphics_engine.PopModelViewMatrix();580 graphics_engine.PopModelViewMatrix();
581581
582 _queued_draw = false;582 draw_cmd_queued_ = false;
583 }583 }
584584
585 Area* GridHLayout::KeyNavIterationRowOrder(KeyNavDirection direction)585 Area* GridHLayout::KeyNavIterationRowOrder(KeyNavDirection direction)
586586
=== modified file 'Nux/GridVLayout.cpp'
--- Nux/GridVLayout.cpp 2011-10-21 22:06:35 +0000
+++ Nux/GridVLayout.cpp 2012-09-18 11:05:23 +0000
@@ -348,7 +348,7 @@
348 graphics_engine.PopClippingRectangle();348 graphics_engine.PopClippingRectangle();
349 graphics_engine.PopModelViewMatrix();349 graphics_engine.PopModelViewMatrix();
350350
351 _queued_draw = false;351 draw_cmd_queued_ = false;
352 }352 }
353353
354 Area* GridVLayout::KeyNavIteration(KeyNavDirection direction)354 Area* GridVLayout::KeyNavIteration(KeyNavDirection direction)
355355
=== modified file 'Nux/GroupBox.h'
--- Nux/GroupBox.h 2011-10-17 21:23:50 +0000
+++ Nux/GroupBox.h 2012-09-18 11:05:23 +0000
@@ -55,7 +55,7 @@
55 virtual void ComputeContentPosition(float offsetX, float offsetY);55 virtual void ComputeContentPosition(float offsetX, float offsetY);
5656
57 bool bCaptionAvailable;57 bool bCaptionAvailable;
58 InputArea m_CaptionArea;58 BasicView m_CaptionArea;
59 Layout *m_layout;59 Layout *m_layout;
60 };60 };
61}61}
6262
=== modified file 'Nux/GroupBox2.cpp'
--- Nux/GroupBox2.cpp 2011-10-17 21:23:50 +0000
+++ Nux/GroupBox2.cpp 2012-09-18 11:05:23 +0000
@@ -39,7 +39,7 @@
39 , bCaptionAvailable(false)39 , bCaptionAvailable(false)
40 , m_layout(0)40 , m_layout(0)
41 {41 {
42 m_CaptionArea = new InputArea(NUX_TRACKER_LOCATION);42 m_CaptionArea = new BasicView(NUX_TRACKER_LOCATION);
43 SetMinimumSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5);43 SetMinimumSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5);
44 SetBaseSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5);44 SetBaseSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5);
45 SetCaption(Caption);45 SetCaption(Caption);
4646
=== modified file 'Nux/GroupBox2.h'
--- Nux/GroupBox2.h 2011-10-17 21:23:50 +0000
+++ Nux/GroupBox2.h 2012-09-18 11:05:23 +0000
@@ -54,7 +54,7 @@
54 virtual void ComputeContentPosition(float offsetX, float offsetY);54 virtual void ComputeContentPosition(float offsetX, float offsetY);
5555
56 bool bCaptionAvailable;56 bool bCaptionAvailable;
57 InputArea *m_CaptionArea;57 BasicView *m_CaptionArea;
58 Layout *m_layout;58 Layout *m_layout;
5959
60 static int CAPTION_X_MARGIN;60 static int CAPTION_X_MARGIN;
6161
=== modified file 'Nux/HScrollBar.cpp'
--- Nux/HScrollBar.cpp 2012-07-04 16:36:46 +0000
+++ Nux/HScrollBar.cpp 2012-09-18 11:05:23 +0000
@@ -52,10 +52,10 @@
52 m_RightTimerHandler = 0;52 m_RightTimerHandler = 0;
5353
54 hlayout = new HLayout(NUX_TRACKER_LOCATION);54 hlayout = new HLayout(NUX_TRACKER_LOCATION);
55 _scroll_left_button = new InputArea(NUX_TRACKER_LOCATION);55 _scroll_left_button = new BasicView(NUX_TRACKER_LOCATION);
56 _track = new InputArea(NUX_TRACKER_LOCATION);56 _track = new BasicView(NUX_TRACKER_LOCATION);
57 _scroll_right_button = new InputArea(NUX_TRACKER_LOCATION);57 _scroll_right_button = new BasicView(NUX_TRACKER_LOCATION);
58 _slider = new InputArea(NUX_TRACKER_LOCATION);58 _slider = new BasicView(NUX_TRACKER_LOCATION);
59 _slider->SetParentObject(this);59 _slider->SetParentObject(this);
6060
61 // Set Original State61 // Set Original State
6262
=== modified file 'Nux/HScrollBar.h'
--- Nux/HScrollBar.h 2011-10-10 01:52:00 +0000
+++ Nux/HScrollBar.h 2012-09-18 11:05:23 +0000
@@ -99,10 +99,10 @@
99 bool AtMaximum();99 bool AtMaximum();
100100
101 HLayout *hlayout;101 HLayout *hlayout;
102 InputArea *_slider;102 BasicView *_slider;
103 InputArea *_scroll_left_button;103 BasicView *_scroll_left_button;
104 InputArea *_scroll_right_button;104 BasicView *_scroll_right_button;
105 InputArea *_track;105 BasicView *_track;
106106
107 int content_width_;107 int content_width_;
108 int content_height_;108 int content_height_;
109109
=== modified file 'Nux/HSplitter.cpp'
--- Nux/HSplitter.cpp 2011-12-06 16:29:06 +0000
+++ Nux/HSplitter.cpp 2012-09-18 11:05:23 +0000
@@ -143,11 +143,6 @@
143 View *ic = static_cast<View *>(*it);143 View *ic = static_cast<View *>(*it);
144 ic->ProcessDraw(graphics_engine, true);144 ic->ProcessDraw(graphics_engine, true);
145 }145 }
146 else if ((*it)->Type().IsObjectType(InputArea::StaticObjectType))
147 {
148 InputArea *base_area = static_cast<InputArea *>(*it);
149 base_area->OnDraw(graphics_engine, true);
150 }
151 else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType))146 else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType))
152 {147 {
153 HLayout *layout = static_cast<HLayout *>(*it);148 HLayout *layout = static_cast<HLayout *>(*it);
@@ -166,11 +161,6 @@
166 View *ic = static_cast<View *>(*it);161 View *ic = static_cast<View *>(*it);
167 ic->ProcessDraw(graphics_engine, false);162 ic->ProcessDraw(graphics_engine, false);
168 }163 }
169 else if ((*it)->Type().IsObjectType(InputArea::StaticObjectType))
170 {
171 InputArea *base_area = static_cast<InputArea *>(*it);
172 base_area->OnDraw(graphics_engine, false);
173 }
174 else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType))164 else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType))
175 {165 {
176 HLayout *layout = static_cast<HLayout *>(*it);166 HLayout *layout = static_cast<HLayout *>(*it);
@@ -359,11 +349,6 @@
359 // ComputeElementLayout to force the computing of this element layout.349 // ComputeElementLayout to force the computing of this element layout.
360 GetWindowThread()->ComputeElementLayout(ic);350 GetWindowThread()->ComputeElementLayout(ic);
361 }351 }
362 else if (m_InterfaceObject[i]->Type().IsObjectType(InputArea::StaticObjectType))
363 {
364 InputArea *base_area = static_cast<InputArea *>(m_InterfaceObject[i]);
365 base_area->SetGeometry(Geometry(x, accheight, w, splitter_geo.y - accheight));
366 }
367 else if (m_InterfaceObject[i]->Type().IsDerivedFromType(Layout::StaticObjectType))352 else if (m_InterfaceObject[i]->Type().IsDerivedFromType(Layout::StaticObjectType))
368 {353 {
369 Layout *layout = static_cast<Layout *>(m_InterfaceObject[i]);354 Layout *layout = static_cast<Layout *>(m_InterfaceObject[i]);
@@ -566,11 +551,6 @@
566 View *ic = static_cast<View *>(*it);551 View *ic = static_cast<View *>(*it);
567 ic->DoneRedraw();552 ic->DoneRedraw();
568 }553 }
569
570 else if ((*it)->Type().IsObjectType(InputArea::StaticObjectType))
571 {
572 //InputArea* base_area = NUX_STATIC_CAST(InputArea*, (*it));
573 }
574 }554 }
575 }555 }
576556
577557
=== modified file 'Nux/HSplitter.h'
--- Nux/HSplitter.h 2011-10-21 22:06:35 +0000
+++ Nux/HSplitter.h 2012-09-18 11:05:23 +0000
@@ -80,7 +80,7 @@
80 virtual Area* KeyNavIteration(KeyNavDirection direction);80 virtual Area* KeyNavIteration(KeyNavDirection direction);
8181
82 private:82 private:
83 typedef InputArea MySplitter;83 typedef BasicView MySplitter;
84 std::vector<Area *> m_InterfaceObject;84 std::vector<Area *> m_InterfaceObject;
85 std::vector<MySplitter *> m_SplitterObject;85 std::vector<MySplitter *> m_SplitterObject;
86 std::vector<float> m_SplitConfig;86 std::vector<float> m_SplitConfig;
8787
=== modified file 'Nux/InputArea.cpp'
--- Nux/InputArea.cpp 2012-09-14 16:49:35 +0000
+++ Nux/InputArea.cpp 2012-09-18 11:05:23 +0000
@@ -27,7 +27,6 @@
2727
28#include "NuxCore/Logger.h"28#include "NuxCore/Logger.h"
2929
30#include "Features.h"
31#include "Nux.h"30#include "Nux.h"
32#include "InputArea.h"31#include "InputArea.h"
33#include "NuxGraphics/GraphicsEngine.h"32#include "NuxGraphics/GraphicsEngine.h"
@@ -73,7 +72,10 @@
7372
74 void InputArea::OnDraw(GraphicsEngine &graphics_engine, bool force_draw)73 void InputArea::OnDraw(GraphicsEngine &graphics_engine, bool force_draw)
75 {74 {
76 graphics_engine.QRP_Color(GetBaseX(), GetBaseY(), GetBaseWidth(), GetBaseHeight(), area_color_);75 // Draw Nothing!
76
77 // For debug Only:
78 // graphics_engine.QRP_Color(GetBaseX(), GetBaseY(), GetBaseWidth(), GetBaseHeight(), area_color_);
77 }79 }
7880
79 bool InputArea::HasKeyboardFocus()81 bool InputArea::HasKeyboardFocus()
8082
=== modified file 'Nux/InputArea.h'
--- Nux/InputArea.h 2012-08-27 09:09:21 +0000
+++ Nux/InputArea.h 2012-09-18 11:05:23 +0000
@@ -23,8 +23,6 @@
23#ifndef INPUTAREA_H23#ifndef INPUTAREA_H
24#define INPUTAREA_H24#define INPUTAREA_H
2525
26#include "Features.h"
27
28#include "Area.h"26#include "Area.h"
2927
30#if defined(NUX_OS_WINDOWS)28#if defined(NUX_OS_WINDOWS)
3129
=== modified file 'Nux/LayeredLayout.cpp'
--- Nux/LayeredLayout.cpp 2012-04-10 00:58:09 +0000
+++ Nux/LayeredLayout.cpp 2012-09-18 11:05:23 +0000
@@ -59,7 +59,7 @@
59 m_child_draw_queued(false)59 m_child_draw_queued(false)
60 {60 {
61 m_ContentStacking = eStackLeft;61 m_ContentStacking = eStackLeft;
62 OnChildQueueDraw.connect(sigc::mem_fun(this, &LayeredLayout::ChildQueueDraw));62 child_queue_draw.connect(sigc::mem_fun(this, &LayeredLayout::ChildQueueDraw));
63 }63 }
6464
65 LayeredLayout::~LayeredLayout()65 LayeredLayout::~LayeredLayout()
@@ -163,11 +163,6 @@
163 Layout *layout = NUX_STATIC_CAST(Layout *, _area);163 Layout *layout = NUX_STATIC_CAST(Layout *, _area);
164 layout->ProcessDraw(graphics_engine, force_draw);164 layout->ProcessDraw(graphics_engine, force_draw);
165 }165 }
166 else if (_area->IsArea())
167 {
168 InputArea *area = NUX_STATIC_CAST(InputArea *, _area);
169 area->OnDraw(graphics_engine, force_draw);
170 }
171 }166 }
172167
173 void LayeredLayout::ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw)168 void LayeredLayout::ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw)
@@ -204,7 +199,7 @@
204 }199 }
205200
206 graphics_engine.PopClippingRectangle();201 graphics_engine.PopClippingRectangle();
207 _queued_draw = false;202 draw_cmd_queued_ = false;
208 }203 }
209204
210 Area* LayeredLayout::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type)205 Area* LayeredLayout::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type)
211206
=== modified file 'Nux/Layout.cpp'
--- Nux/Layout.cpp 2012-05-31 21:50:05 +0000
+++ Nux/Layout.cpp 2012-09-18 11:05:23 +0000
@@ -41,7 +41,8 @@
41 m_contentWidth = 0;41 m_contentWidth = 0;
42 m_contentHeight = 0;42 m_contentHeight = 0;
43 m_ContentStacking = eStackExpand;43 m_ContentStacking = eStackExpand;
44 _queued_draw = false;44 draw_cmd_queued_ = false;
45 child_draw_cmd_queued_ = false;
4546
46 SetMinimumSize(1, 1);47 SetMinimumSize(1, 1);
47 }48 }
@@ -146,13 +147,13 @@
146 left_padding_ = left < 0 ? 0 : left;147 left_padding_ = left < 0 ? 0 : left;
147 }148 }
148149
149 //! Deprecated. Use SetLeftRightPadding.150 //! Deprecated. Use SetLeftAndRightPadding.
150 void Layout::SetHorizontalExternalMargin(int padding)151 void Layout::SetHorizontalExternalMargin(int padding)
151 {152 {
152 SetLeftAndRightPadding(padding);153 SetLeftAndRightPadding(padding);
153 }154 }
154155
155 //! Deprecated. Use SetTopBottomPadding,156 //! Deprecated. Use SetTopAndBottomPadding,
156 void Layout::SetVerticalExternalMargin(int padding)157 void Layout::SetVerticalExternalMargin(int padding)
157 {158 {
158 SetTopAndBottomPadding(padding);159 SetTopAndBottomPadding(padding);
@@ -229,8 +230,8 @@
229230
230 layout->SetParentObject(this);231 layout->SetParentObject(this);
231232
232 layout->OnChildQueueDraw.connect(sigc::mem_fun(this, &Layout::ChildLayoutChildQueuedDraw));233 layout->child_queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw));
233 layout->OnQueueDraw.connect(sigc::mem_fun(this, &Layout::ChildLayoutQueuedDraw));234 layout->queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw));
234235
235 if (index < 0)236 if (index < 0)
236 index = NUX_LAYOUT_BEGIN;237 index = NUX_LAYOUT_BEGIN;
@@ -283,6 +284,9 @@
283 nuxAssertMsg(bo != 0, "[Layout::AddView] Invalid parameter.");284 nuxAssertMsg(bo != 0, "[Layout::AddView] Invalid parameter.");
284 NUX_RETURN_IF_TRUE(bo == 0);285 NUX_RETURN_IF_TRUE(bo == 0);
285286
287 if (!bo->IsView())
288 return;
289
286 Area *parent = bo->GetParentObject();290 Area *parent = bo->GetParentObject();
287 nuxAssertMsg(parent == 0, "[Layout::AddView] Trying to add an object that already has a parent.");291 nuxAssertMsg(parent == 0, "[Layout::AddView] Trying to add an object that already has a parent.");
288 NUX_RETURN_IF_TRUE(parent != 0);292 NUX_RETURN_IF_TRUE(parent != 0);
@@ -309,7 +313,10 @@
309 bo->SetParentObject(this);313 bo->SetParentObject(this);
310314
311 if (bo->IsView())315 if (bo->IsView())
312 static_cast<View *> (bo)->OnQueueDraw.connect(sigc::mem_fun(this, &Layout::ChildViewQueuedDraw));316 {
317 static_cast<View*> (bo)->queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw));
318 static_cast<View*> (bo)->child_queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw));
319 }
313320
314 //if(HasFocusControl() && HasFocusableEntries() == false)321 //if(HasFocusControl() && HasFocusableEntries() == false)
315 //{322 //{
@@ -492,77 +499,272 @@
492 void Layout::ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw)499 void Layout::ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw)
493 {500 {
494 std::list<Area *>::iterator it;501 std::list<Area *>::iterator it;
495 graphics_engine.PushModelViewMatrix(Get2DMatrix());502
496503 if (RedirectRenderingToTexture())
497 // Clip against the padding region.504 {
498 Geometry clip_geo = GetGeometry();505 if (update_backup_texture_ || force_draw || draw_cmd_queued_)
499 clip_geo.OffsetPosition(left_padding_, top_padding_);506 {
500 clip_geo.OffsetSize(-left_padding_ - right_padding_, -top_padding_ - bottom_padding_);507 GetPainter().PushPaintLayerStack();
501508 BeginBackupTextureRendering(graphics_engine, force_draw);
502 graphics_engine.PushClippingRectangle(clip_geo);509 {
503510 graphics_engine.PushModelViewMatrix(Get2DMatrix());
504 for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)511
505 {512 for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
506 if (!(*it)->IsVisible())513 {
507 continue;514 if (!(*it)->IsVisible())
508515 continue;
509 if ((*it)->IsView())516
510 {517 if ((*it)->IsView())
511 View *ic = NUX_STATIC_CAST(View*, (*it));518 {
512 ic->ProcessDraw(graphics_engine, force_draw);519 View* view = static_cast<View*>(*it);
513 }520 view->ProcessDraw(graphics_engine, force_draw);
514 else if ((*it)->IsLayout())521 }
515 {522 else if ((*it)->IsLayout())
516 Layout *layout = NUX_STATIC_CAST(Layout*, (*it));523 {
517 layout->ProcessDraw(graphics_engine, force_draw);524 Layout* layout = static_cast<Layout*>(*it);
518 }525 layout->ProcessDraw(graphics_engine, force_draw);
519 // InputArea should be tested last526 }
520 else if ((*it)->IsInputArea())527 }
521 {528 graphics_engine.PopModelViewMatrix();
522 InputArea *input_area = NUX_STATIC_CAST(InputArea*, (*it));529 }
523 input_area->OnDraw(graphics_engine, force_draw);530 EndBackupTextureRendering(graphics_engine, force_draw);
524 }531 GetPainter().PopPaintLayerStack();
525 }532 }
526533
527 graphics_engine.PopClippingRectangle();534 if (PresentRedirectedView())
535 {
536 unsigned int current_alpha_blend;
537 unsigned int current_src_blend_factor;
538 unsigned int current_dest_blend_factor;
539 // Be a good citizen, get a copy of the current GPU sates according to Nux
540 graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
541
542 TexCoordXForm texxform;
543 //Geometry xform_geo = GetGraphicsDisplay()->GetGraphicsEngine()->ModelViewXFormRect(GetGeometry());
544 if ((force_draw || draw_cmd_queued_) && background_texture_.IsValid())
545 {
546 graphics_engine.GetRenderStates().SetBlend(false);
547 texxform.FlipVCoord(true);
548 // Draw the background of this view.
549 GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), background_texture_->GetWidth(), background_texture_->GetHeight(), background_texture_, texxform, color::White);
550 }
551
552 texxform.uwrap = TEXWRAP_CLAMP;
553 texxform.vwrap = TEXWRAP_CLAMP;
554 texxform.FlipVCoord(true);
555
556 graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
557 GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), GetWidth(), GetHeight(), backup_texture_, texxform, Color(color::White));
558 // Be a good citizen, restore the Nux blending states.
559 graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
560 }
561 }
562 else
563 {
564 graphics_engine.PushModelViewMatrix(Get2DMatrix());
565
566 // Clip against the padding region.
567 Geometry clip_geo = GetGeometry();
568 clip_geo.OffsetPosition(left_padding_, top_padding_);
569 clip_geo.OffsetSize(-left_padding_ - right_padding_, -top_padding_ - bottom_padding_);
570
571 graphics_engine.PushClippingRectangle(clip_geo);
572
573 for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
574 {
575 if (!(*it)->IsVisible())
576 continue;
577
578 if ((*it)->IsView())
579 {
580 View* view = static_cast<View*>(*it);
581 view->ProcessDraw(graphics_engine, force_draw);
582 }
583 else if ((*it)->IsLayout())
584 {
585 Layout* layout = static_cast<Layout*>(*it);
586 layout->ProcessDraw(graphics_engine, force_draw);
587 }
588 }
589
590 graphics_engine.PopClippingRectangle();
591 graphics_engine.PopModelViewMatrix();
592 }
593
594 ResetQueueDraw();
595 }
596
597 void Layout::BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw)
598 {
599 ObjectPtr<IOpenGLBaseTexture> active_fbo_texture;
600 if (force_draw || draw_cmd_queued_)
601 {
602 // Get the active fbo color texture
603 active_fbo_texture = GetGraphicsDisplay()->GetGpuDevice()->ActiveFboTextureAttachment(0);
604 }
605
606 Geometry xform_geo;
607 // Compute position in the active fbo texture.
608 xform_geo = graphics_engine.ModelViewXFormRect(GetGeometry());
609
610 // Get the current fbo...
611 prev_fbo_ = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject();
612 // ... and the size of the view port rectangle.
613 prev_viewport_ = graphics_engine.GetViewportRect();
614
615 const int width = GetWidth();
616 const int height = GetHeight();
617
618 // Compute intersection with active fbo.
619 Geometry intersection = xform_geo;
620 if (active_fbo_texture.IsValid())
621 {
622 Geometry active_fbo_geo(0, 0, active_fbo_texture->GetWidth(), active_fbo_texture->GetHeight());
623 intersection = active_fbo_geo.Intersect(xform_geo);
624 }
625
626 if (backup_fbo_.IsNull())
627 {
628 // Create the fbo before using it for the first time.
629 backup_fbo_ = GetGraphicsDisplay()->GetGpuDevice()->CreateFrameBufferObject();
630 }
631
632 if (!backup_texture_.IsValid() || (backup_texture_->GetWidth() != width) || (backup_texture_->GetHeight() != height))
633 {
634 // Create or resize the color and depth textures before using them.
635 backup_texture_ = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(width, height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
636 backup_depth_texture_ = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(width, height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);
637 }
638
639 if (!background_texture_.IsValid() || (background_texture_->GetWidth() != intersection.width) || (background_texture_->GetHeight() != intersection.height))
640 {
641 background_texture_ = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(intersection.width, intersection.height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
642 }
643
644 // Draw the background on the previous fbo texture
645 if ((force_draw || draw_cmd_queued_) && background_texture_.IsValid())
646 {
647 backup_fbo_->FormatFrameBufferObject(intersection.width, intersection.height, BITFMT_R8G8B8A8);
648 backup_fbo_->EmptyClippingRegion();
649
650 graphics_engine.SetViewport(0, 0, intersection.width, intersection.height);
651 graphics_engine.SetOrthographicProjectionMatrix(intersection.width, intersection.height);
652
653 // Set the background texture in the fbo
654 backup_fbo_->SetTextureAttachment(0, background_texture_, 0);
655 backup_fbo_->SetDepthTextureAttachment(ObjectPtr<IOpenGLBaseTexture>(0), 0);
656 backup_fbo_->Activate();
657 graphics_engine.SetViewport(0, 0, background_texture_->GetWidth(), background_texture_->GetHeight());
658
659 // Clear surface
660 CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
661 CHECKGL(glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT));
662
663 TexCoordXForm texxform;
664 texxform.uoffset = xform_geo.x / (float) active_fbo_texture->GetWidth();
665 texxform.voffset = xform_geo.y / (float) active_fbo_texture->GetHeight();
666 texxform.SetTexCoordType(TexCoordXForm::OFFSET_COORD);
667 texxform.flip_v_coord = true;
668
669 // Temporarily change the model-view matrix to copy the texture background texture.
670 // This way we are not affceted by the regular model-view matrix.
671 graphics_engine.SetModelViewMatrix(Matrix4::IDENTITY());
672 // Copy the texture from the previous fbo attachment into our background texture.
673 if (copy_previous_fbo_for_background_)
674 {
675 graphics_engine.QRP_1Tex(0, 0, intersection.width, intersection.height, active_fbo_texture, texxform, color::White);
676 }
677 else
678 {
679 graphics_engine.QRP_Color(0, 0, intersection.width, intersection.height, Color(0.0f, 0.0f, 0.0f, 0.0f));
680 }
681 // Restore the model-view matrix.
682 graphics_engine.ApplyModelViewMatrix();
683 }
684
685 backup_fbo_->FormatFrameBufferObject(width, height, BITFMT_R8G8B8A8);
686 backup_fbo_->EmptyClippingRegion();
687 backup_fbo_->SetTextureAttachment(0, backup_texture_, 0);
688 backup_fbo_->SetDepthTextureAttachment(backup_depth_texture_, 0);
689 backup_fbo_->Activate();
690
691 if (force_draw || draw_cmd_queued_)
692 {
693 CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
694 CHECKGL(glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT));
695 }
696
697 graphics_engine.SetViewport(0, 0, width, height);
698 graphics_engine.SetOrthographicProjectionMatrix(width, height);
699 // Transform the geometry of this area through the current model view matrix. This gives the
700 // the position of the view in the active fbo texture.
701 Geometry offset_rect = graphics_engine.ModelViewXFormRect(GetGeometry());
702 int x_offset = -offset_rect.x;
703 int y_offset = -offset_rect.y;
704 graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(x_offset, y_offset, 0));
705 }
706
707 void Layout::EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw)
708 {
528 graphics_engine.PopModelViewMatrix();709 graphics_engine.PopModelViewMatrix();
529710
530 //graphics_engine.PopClipOffset();711 if (prev_fbo_.IsValid())
531712 {
532 _queued_draw = false;713 // Restore the previous fbo
714 prev_fbo_->Activate();
715
716 prev_fbo_->ApplyClippingRegion();
717 }
718
719 // Release the reference on the previous fbo
720 prev_fbo_.Release();
721
722 // Restore the matrices and the view port.
723 graphics_engine.ApplyModelViewMatrix();
724 graphics_engine.SetOrthographicProjectionMatrix(prev_viewport_.width, prev_viewport_.height);
725 graphics_engine.SetViewport(prev_viewport_.x, prev_viewport_.y, prev_viewport_.width, prev_viewport_.height);
533 }726 }
534727
535 void Layout::QueueDraw()728 void Layout::QueueDraw()
536 {729 {
537 if (_queued_draw)730 if (draw_cmd_queued_)
538 {731 {
539 // A draw has already been scheduled.732 // A draw has already been scheduled.
540 return;733 return;
541 }734 }
542735
543 std::list<Area *>::iterator it;736 // Report to a parent view with redirect_rendering_to_texture_ set to true that one of its children
737 // needs to be redrawn.
738 PrepareParentRedirectedView();
739
740 std::list<Area*>::iterator it;
544741
545 for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)742 for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
546 {743 {
547 if ((*it)->IsView())744 if ((*it)->IsView())
548 {745 {
549 View *ic = NUX_STATIC_CAST(View *, (*it));746 View* view = static_cast<View*>(*it);
550 ic->QueueDraw();747 view->QueueDraw();
551 }748 }
552 else if ((*it)->IsLayout())749 else if ((*it)->IsLayout())
553 {750 {
554 Layout *layout = NUX_STATIC_CAST(Layout *, (*it));751 Layout* layout = static_cast<Layout*>(*it);
555 layout->QueueDraw();752 layout->QueueDraw();
556 }753 }
557 }754 }
558755
559 _queued_draw = true;756 draw_cmd_queued_ = true;
560 OnQueueDraw.emit(this);757 queue_draw.emit(this);
561 }758 }
562759
563 bool Layout::IsQueuedForDraw()760 bool Layout::IsQueuedForDraw()
564 {761 {
565 return _queued_draw;762 return draw_cmd_queued_;
763 }
764
765 bool Layout::ChildQueuedForDraw()
766 {
767 return child_draw_cmd_queued_;
566 }768 }
567769
568 void Layout::SetContentDistribution(LayoutContentDistribution stacking)770 void Layout::SetContentDistribution(LayoutContentDistribution stacking)
@@ -580,19 +782,12 @@
580782
581 }783 }
582784
583 void Layout::ChildViewQueuedDraw(View *view)785 void Layout::ChildQueueDraw(Area* area)
584 {786 {
585 OnChildQueueDraw.emit(view);787 if (child_draw_cmd_queued_)
586 }788 return;
587789 child_draw_cmd_queued_ = true;
588 void Layout::ChildLayoutQueuedDraw(Layout *layout)790 child_queue_draw.emit(area);
589 {
590 OnChildQueueDraw.emit(layout);
591 }
592
593 void Layout::ChildLayoutChildQueuedDraw(Area *area)
594 {
595 OnChildQueueDraw.emit(area);
596 }791 }
597792
598 bool Layout::AcceptKeyNavFocus()793 bool Layout::AcceptKeyNavFocus()
@@ -600,6 +795,54 @@
600 return false;795 return false;
601 }796 }
602797
798 void Layout::ResetQueueDraw()
799 {
800 std::list<Area*>::iterator it;
801 for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
802 {
803 if ((*it)->IsLayout())
804 {
805 Layout* layout = NUX_STATIC_CAST(Layout*, (*it));
806 if (layout->ChildQueuedForDraw())
807 {
808 layout->ResetQueueDraw();
809 }
810 }
811 else if ((*it)->IsView())
812 {
813 View* view = NUX_STATIC_CAST(View*, (*it));
814 if (view->GetLayout())
815 {
816 view->GetLayout()->ResetQueueDraw();
817 view->draw_cmd_queued_ = false;
818 view->child_draw_cmd_queued_ = false;
819 }
820 }
821 }
822
823 draw_cmd_queued_ = false;
824 child_draw_cmd_queued_ = false;
825 update_backup_texture_ = false;
826 }
827
828 void Layout::GeometryChangePending(bool position_about_to_change, bool size_about_to_change)
829 {
830 if (IsLayoutDone())
831 QueueDraw();
832 }
833
834 void Layout::GeometryChanged(bool position_has_changed, bool size_has_changed)
835 {
836 if (RedirectedAncestor())
837 {
838 if (size_has_changed)
839 QueueDraw();
840 return;
841 }
842 if (IsLayoutDone())
843 QueueDraw();
844 }
845
603#ifdef NUX_GESTURES_SUPPORT846#ifdef NUX_GESTURES_SUPPORT
604 Area* Layout::GetInputAreaHitByGesture(const GestureEvent &event)847 Area* Layout::GetInputAreaHitByGesture(const GestureEvent &event)
605 {848 {
606849
=== modified file 'Nux/Layout.h'
--- Nux/Layout.h 2012-05-31 21:50:05 +0000
+++ Nux/Layout.h 2012-09-18 11:05:23 +0000
@@ -137,10 +137,10 @@
137 };137 };
138138
139139
140 //! Deprecated. Use SetLeftRightPadding.140 //! Deprecated. Use SetLeftAndRightPadding.
141 void SetHorizontalExternalMargin(int m);141 void SetHorizontalExternalMargin(int m);
142142
143 //! Deprecated. Use SetTopBottomPadding,143 //! Deprecated. Use SetTopAndBottomPadding,
144 void SetVerticalExternalMargin(int m);144 void SetVerticalExternalMargin(int m);
145145
146 //! Set the left/right/top/bottom padding of the layout.146 //! Set the left/right/top/bottom padding of the layout.
@@ -199,7 +199,7 @@
199 /*!199 /*!
200 Mark all element in the layout as dirty. This will also mark all sub elements as dirty.200 Mark all element in the layout as dirty. This will also mark all sub elements as dirty.
201 InputArea element are not marked as dirty(they don't have the flags).201 InputArea element are not marked as dirty(they don't have the flags).
202 Emits the signal \i OnQueueDraw.202 Emits the signal \i queue_draw.
203 */203 */
204 virtual void QueueDraw();204 virtual void QueueDraw();
205205
@@ -209,6 +209,12 @@
209 */209 */
210 bool IsQueuedForDraw();210 bool IsQueuedForDraw();
211211
212 //! Return true if a draw has been scheduled for a child of this layout
213 /*!
214 @return True if a draw has been scheduled for a child of this layout.
215 */
216 bool ChildQueuedForDraw();
217
212 //! Define how elements are spread out inside the layout.218 //! Define how elements are spread out inside the layout.
213 /*!219 /*!
214 Typically, a layout stacks it elements from left to right(HLayout) or top to bottom(VLayout).220 Typically, a layout stacks it elements from left to right(HLayout) or top to bottom(VLayout).
@@ -240,23 +246,34 @@
240 return _layout_element_list;246 return _layout_element_list;
241 }247 }
242248
243 virtual void ChildViewQueuedDraw(View *view);249 virtual void ChildQueueDraw(Area* area);
244 virtual void ChildLayoutQueuedDraw(Layout *layout);
245 virtual void ChildLayoutChildQueuedDraw(Area *area);
246250
247 sigc::signal<void, Layout*> OnQueueDraw; //!< Signal emitted when a layout is scheduled for a draw.251 sigc::signal<void, Layout*> queue_draw; //!< Signal emitted when a layout is scheduled for a draw.
248 sigc::signal<void, Area*> OnChildQueueDraw;252 sigc::signal<void, Area*> child_queue_draw;
249 sigc::signal<void, Layout*, Area*> ViewAdded;253 sigc::signal<void, Layout*, Area*> ViewAdded;
250 sigc::signal<void, Layout*, Area*> ViewRemoved;254 sigc::signal<void, Layout*, Area*> ViewRemoved;
251255
252#ifdef NUX_GESTURES_SUPPORT256#ifdef NUX_GESTURES_SUPPORT
253 virtual Area* GetInputAreaHitByGesture(const GestureEvent &event);257 virtual Area* GetInputAreaHitByGesture(const GestureEvent &event);
254#endif258#endif
259
260 /*!
261 When a layout goes through Layout::ProcessDraw, this call isn't necessary. Otherwise, call it
262 to set the value of draw_cmd_queued_ to false.
263 */
264 virtual void ResetQueueDraw();
255265
256 protected:266 protected:
267 void BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
268 void EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
269
270 virtual void GeometryChangePending(bool position_about_to_change, bool size_about_to_change);
271 virtual void GeometryChanged(bool position_has_changed, bool size_has_changed);
272
257 virtual bool AcceptKeyNavFocus();273 virtual bool AcceptKeyNavFocus();
258 274
259 bool _queued_draw; //<! The rendering of the layout needs to be refreshed.275 bool draw_cmd_queued_; //<! The rendering of the layout needs to be refreshed.
276 bool child_draw_cmd_queued_; //<! A child of this layout has requested a draw.
260277
261 Size m_ContentSize;278 Size m_ContentSize;
262 int m_contentWidth;279 int m_contentWidth;
263280
=== modified file 'Nux/LinearLayout.cpp'
--- Nux/LinearLayout.cpp 2011-10-17 20:57:35 +0000
+++ Nux/LinearLayout.cpp 2012-09-18 11:05:23 +0000
@@ -73,8 +73,8 @@
7373
74 layout->SetParentObject(this);74 layout->SetParentObject(this);
7575
76 layout->OnChildQueueDraw.connect(sigc::mem_fun(this, &Layout::ChildLayoutChildQueuedDraw));76 layout->child_queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw));
77 layout->OnQueueDraw.connect(sigc::mem_fun(this, &Layout::ChildLayoutQueuedDraw));77 layout->queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw));
7878
79 if (index < 0)79 if (index < 0)
80 index = NUX_LAYOUT_BEGIN;80 index = NUX_LAYOUT_BEGIN;
@@ -153,7 +153,7 @@
153 bo->SetParentObject(this);153 bo->SetParentObject(this);
154154
155 if (bo->IsView())155 if (bo->IsView())
156 static_cast<View *> (bo)->OnQueueDraw.connect(sigc::mem_fun(this, &Layout::ChildViewQueuedDraw));156 (static_cast<View *> (bo))->queue_draw.connect(sigc::mem_fun(this, &Layout::ChildQueueDraw));
157157
158 //if(HasFocusControl() && HasFocusableEntries() == false)158 //if(HasFocusControl() && HasFocusableEntries() == false)
159 //{159 //{
160160
=== modified file 'Nux/MainLoopGLib.cpp'
--- Nux/MainLoopGLib.cpp 2012-05-31 21:40:37 +0000
+++ Nux/MainLoopGLib.cpp 2012-09-18 11:05:23 +0000
@@ -1,4 +1,3 @@
1#include "Features.h"
2#include "Nux.h"1#include "Nux.h"
3#include "Layout.h"2#include "Layout.h"
4#include "NuxCore/Logger.h"3#include "NuxCore/Logger.h"
54
=== modified file 'Nux/Makefile.am'
--- Nux/Makefile.am 2012-07-27 19:40:40 +0000
+++ Nux/Makefile.am 2012-09-18 11:05:23 +0000
@@ -41,6 +41,7 @@
41 $(srcdir)/InputArea.cpp \41 $(srcdir)/InputArea.cpp \
42 $(srcdir)/Area.cpp \42 $(srcdir)/Area.cpp \
43 $(srcdir)/BaseWindow.cpp \43 $(srcdir)/BaseWindow.cpp \
44 $(srcdir)/BasicView.cpp \
44 $(srcdir)/Button.cpp \45 $(srcdir)/Button.cpp \
45 $(srcdir)/Canvas.cpp \46 $(srcdir)/Canvas.cpp \
46 $(srcdir)/CairoWrapper.cpp \47 $(srcdir)/CairoWrapper.cpp \
@@ -135,6 +136,7 @@
135 $(srcdir)/InputArea.h \136 $(srcdir)/InputArea.h \
136 $(srcdir)/Area.h \137 $(srcdir)/Area.h \
137 $(srcdir)/BaseWindow.h \138 $(srcdir)/BaseWindow.h \
139 $(srcdir)/BasicView.h \
138 $(srcdir)/Button.h \140 $(srcdir)/Button.h \
139 $(srcdir)/Canvas.h \141 $(srcdir)/Canvas.h \
140 $(srcdir)/CairoWrapper.h \142 $(srcdir)/CairoWrapper.h \
@@ -171,6 +173,7 @@
171 $(srcdir)/MouseAreaCtrl.h \173 $(srcdir)/MouseAreaCtrl.h \
172 $(srcdir)/NumericValuator.h \174 $(srcdir)/NumericValuator.h \
173 $(srcdir)/Nux.h \175 $(srcdir)/Nux.h \
176 $(srcdir)/NuxTimerTickSource.h \
174 $(srcdir)/NuxGlobalInitializer.h \177 $(srcdir)/NuxGlobalInitializer.h \
175 $(srcdir)/Painter.h \178 $(srcdir)/Painter.h \
176 $(srcdir)/Panel.h \179 $(srcdir)/Panel.h \
177180
=== modified file 'Nux/MenuBar.cpp'
--- Nux/MenuBar.cpp 2012-08-27 09:09:21 +0000
+++ Nux/MenuBar.cpp 2012-09-18 11:05:23 +0000
@@ -41,7 +41,7 @@
41 : Object(true, NUX_FILE_LINE_PARAM)41 : Object(true, NUX_FILE_LINE_PARAM)
42 {42 {
43 // This area is added to the layout of the MenuBar. The Menubar will will ref/unref it.43 // This area is added to the layout of the MenuBar. The Menubar will will ref/unref it.
44 area = new InputArea(NUX_TRACKER_LOCATION);44 area = new BasicView(NUX_TRACKER_LOCATION);
45 icon = 0;45 icon = 0;
46 }46 }
4747
@@ -97,7 +97,7 @@
9797
98 for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++)98 for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++)
99 {99 {
100 InputArea *area = (*it)->area;100 BasicView *area = (*it)->area;
101 item_geometry = area->GetGeometry();101 item_geometry = area->GetGeometry();
102102
103 if (area->IsMouseInside())103 if (area->IsMouseInside())
@@ -151,7 +151,7 @@
151151
152 if (m_MenuIsActive)152 if (m_MenuIsActive)
153 {153 {
154 InputArea *area = m_CurrentMenu->area;154 BasicView *area = m_CurrentMenu->area;
155 item_geometry = area->GetGeometry();155 item_geometry = area->GetGeometry();
156 GetPainter().PaintBackground(graphics_engine, item_geometry);156 GetPainter().PaintBackground(graphics_engine, item_geometry);
157 GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000));157 GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000));
@@ -342,7 +342,7 @@
342// 342//
343// for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++)343// for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++)
344// {344// {
345// InputArea *area = (*it)->area;345// BasicView *area = (*it)->area;
346// Geometry geometry = area->GetGeometry();346// Geometry geometry = area->GetGeometry();
347// 347//
348// if (geometry.IsPointInside(winx, winy))348// if (geometry.IsPointInside(winx, winy))
@@ -407,7 +407,7 @@
407407
408 for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++)408 for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++)
409 {409 {
410 InputArea *area = (*it)->area;410 BasicView *area = (*it)->area;
411 geometry = area->GetGeometry();411 geometry = area->GetGeometry();
412412
413 if (geometry.IsPointInside(x, y))413 if (geometry.IsPointInside(x, y))
414414
=== modified file 'Nux/MenuBar.h'
--- Nux/MenuBar.h 2011-10-17 21:23:50 +0000
+++ Nux/MenuBar.h 2012-09-18 11:05:23 +0000
@@ -45,7 +45,7 @@
45 MenuBarItem(NUX_FILE_LINE_PROTO);45 MenuBarItem(NUX_FILE_LINE_PROTO);
46 ~MenuBarItem();46 ~MenuBarItem();
47 private:47 private:
48 InputArea *area;48 BasicView *area;
49 MenuPage *menu;49 MenuPage *menu;
50 BaseTexture *icon; // should be 24x2450 BaseTexture *icon; // should be 24x24
5151
5252
=== modified file 'Nux/MouseAreaCtrl.cpp'
--- Nux/MouseAreaCtrl.cpp 2011-10-10 01:52:00 +0000
+++ Nux/MouseAreaCtrl.cpp 2012-09-18 11:05:23 +0000
@@ -31,7 +31,7 @@
31 {31 {
32 // Set Original State32 // Set Original State
33 m_vlayout = new VLayout(NUX_TRACKER_LOCATION);33 m_vlayout = new VLayout(NUX_TRACKER_LOCATION);
34 m_Area = new InputArea(NUX_TRACKER_LOCATION);34 m_Area = new BasicView(NUX_TRACKER_LOCATION);
3535
36 // Set Signals36 // Set Signals
37 m_Area->mouse_down.connect(sigc::mem_fun(this, &MouseAreaCtrl::MouseDown));37 m_Area->mouse_down.connect(sigc::mem_fun(this, &MouseAreaCtrl::MouseDown));
3838
=== modified file 'Nux/MouseAreaCtrl.h'
--- Nux/MouseAreaCtrl.h 2011-10-10 01:52:00 +0000
+++ Nux/MouseAreaCtrl.h 2012-09-18 11:05:23 +0000
@@ -64,7 +64,7 @@
6464
65 private:65 private:
66 VLayout *m_vlayout;66 VLayout *m_vlayout;
67 InputArea *m_Area;67 BasicView *m_Area;
6868
69 public:69 public:
70 virtual void SetGeometry(const Geometry &geo)70 virtual void SetGeometry(const Geometry &geo)
7171
=== modified file 'Nux/Nux.cpp'
--- Nux/Nux.cpp 2011-12-29 18:06:53 +0000
+++ Nux/Nux.cpp 2012-09-18 11:05:23 +0000
@@ -172,6 +172,7 @@
172 w->user_exit_func_ = 0;172 w->user_exit_func_ = 0;
173 w->initialization_data_ = data;173 w->initialization_data_ = data;
174 w->window_style_ = WINDOWSTYLE_NORMAL;174 w->window_style_ = WINDOWSTYLE_NORMAL;
175 w->embedded_window_ = true;
175 w->ThreadCtor(WindowHandle, WindowDCHandle, OpenGLRenderingContext);176 w->ThreadCtor(WindowHandle, WindowDCHandle, OpenGLRenderingContext);
176 return w;177 return w;
177 }178 }
178179
=== modified file 'Nux/Nux.h'
--- Nux/Nux.h 2012-02-19 00:02:14 +0000
+++ Nux/Nux.h 2012-09-18 11:05:23 +0000
@@ -52,6 +52,10 @@
52#define NUX_USE_GLIB_LOOP_ON_WINDOWS52#define NUX_USE_GLIB_LOOP_ON_WINDOWS
53//#define NUX_DISABLE_GLIB_LOOP53//#define NUX_DISABLE_GLIB_LOOP
5454
55#if defined(NUX_OS_LINUX)
56#include "Features.h"
57#endif
58
55#include "Utils.h"59#include "Utils.h"
56#include "WidgetMetrics.h"60#include "WidgetMetrics.h"
57#include "Area.h"61#include "Area.h"
@@ -59,6 +63,7 @@
59#include "Theme.h"63#include "Theme.h"
60#include "Painter.h"64#include "Painter.h"
61#include "View.h"65#include "View.h"
66#include "BasicView.h"
62#include "AbstractThread.h"67#include "AbstractThread.h"
63#include "WindowThread.h"68#include "WindowThread.h"
64#include "WindowCompositor.h"69#include "WindowCompositor.h"
6570
=== added file 'Nux/NuxTimerTickSource.h'
--- Nux/NuxTimerTickSource.h 1970-01-01 00:00:00 +0000
+++ Nux/NuxTimerTickSource.h 2012-09-18 11:05:23 +0000
@@ -0,0 +1,54 @@
1#ifndef NUX_TIMER_TICK_SOURCE_H
2#define NUX_TIMER_TICK_SOURCE_H
3
4#include "NuxCore/Animation.h"
5#include "NuxCore/AnimationController.h"
6#include "Nux/Nux.h"
7#include "Nux/TimerProc.h"
8
9namespace nux
10{
11
12// Everything inline, but should be extracted.
13class NuxTimerTickSource: public animation::TickSource
14{
15public:
16 NuxTimerTickSource()
17 : foo(0)
18 {
19 timer_.tick.connect(sigc::mem_fun(this, &NuxTimerTickSource::Tick));
20 timer_.expired.connect(sigc::mem_fun(this, &NuxTimerTickSource::TimerExpired));
21 unsigned int period = 16; // ms
22 int duration = -1; // run forever
23 timer_handle_ = nux::GetTimer().AddDurationTimer(period, duration, &timer_, NULL);
24 }
25
26 ~NuxTimerTickSource()
27 {
28 if (timer_handle_.Activated())
29 nux::GetTimer().RemoveTimerHandler(timer_handle_);
30 }
31
32private:
33 void Tick(void*)
34 {
35 tick.emit(g_get_monotonic_time());
36 if (++foo % 60 == 0)
37 {
38 // LOG_WARN(logger) << "tick...";
39 }
40 }
41 void TimerExpired(void*)
42 {
43 //LOG_WARN(logger) << "Timer expired.";
44 }
45
46private:
47 int foo;
48 TimerFunctor timer_;
49 TimerHandle timer_handle_;
50};
51
52}
53
54#endif // NUX_TIMER_TICK_SOURCE_H
055
=== modified file 'Nux/PaintLayer.cpp'
--- Nux/PaintLayer.cpp 2012-03-13 02:50:57 +0000
+++ Nux/PaintLayer.cpp 2012-09-18 11:05:23 +0000
@@ -117,7 +117,16 @@
117117
118 void SliceScaledTextureLayer::Renderlayer(GraphicsEngine& graphics_engine)118 void SliceScaledTextureLayer::Renderlayer(GraphicsEngine& graphics_engine)
119 {119 {
120 unsigned int current_alpha_blend;
121 unsigned int current_src_blend_factor;
122 unsigned int current_dest_blend_factor;
123
124 // Get the current blend states. They will be restored later.
125 graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
126
120 GetPainter().PaintTextureShape(graphics_engine, geometry_, m_image_style);127 GetPainter().PaintTextureShape(graphics_engine, geometry_, m_image_style);
128
129 graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
121 }130 }
122131
123 AbstractPaintLayer* SliceScaledTextureLayer::Clone() const132 AbstractPaintLayer* SliceScaledTextureLayer::Clone() const
124133
=== modified file 'Nux/Painter.cpp'
--- Nux/Painter.cpp 2012-08-27 09:09:21 +0000
+++ Nux/Painter.cpp 2012-09-18 11:05:23 +0000
@@ -797,7 +797,7 @@
797 graphics_engine.GetRenderStates().SetBlend(false);797 graphics_engine.GetRenderStates().SetBlend(false);
798 }798 }
799799
800 void BasePainter::PaintBackground(GraphicsEngine &graphics_engine, const Geometry &geo)800 void BasePainter::PaintActivePaintLayerStack(GraphicsEngine &graphics_engine, const Geometry &geo)
801 {801 {
802 if (active_paint_layer_stack_.empty())802 if (active_paint_layer_stack_.empty())
803 {803 {
@@ -806,7 +806,12 @@
806806
807 std::list<AbstractPaintLayer *>::const_reverse_iterator rev_it;807 std::list<AbstractPaintLayer *>::const_reverse_iterator rev_it;
808808
809 bool first = true;809 bool clear_background = false;
810 if (pushed_paint_layer_stack_.size() == 0)
811 {
812 // This is the first stack of layers. Clear the background
813 clear_background = true;
814 }
810815
811 for (rev_it = active_paint_layer_stack_.rbegin(); rev_it != active_paint_layer_stack_.rend(); rev_it++)816 for (rev_it = active_paint_layer_stack_.rbegin(); rev_it != active_paint_layer_stack_.rend(); rev_it++)
812 {817 {
@@ -817,10 +822,10 @@
817 graphics_engine.PushClippingRectangle(geo);822 graphics_engine.PushClippingRectangle(geo);
818 graphics_engine.SetModelViewMatrix(layer->GetModelViewMatrix());823 graphics_engine.SetModelViewMatrix(layer->GetModelViewMatrix());
819824
820 if (first)825 if (clear_background)
821 {826 {
822 Paint2DQuadColor(graphics_engine, layer_geo, Color(0x0));827 Paint2DQuadColor(graphics_engine, layer_geo, Color(0x0));
823 first = false;828 clear_background = false;
824 }829 }
825830
826 RenderSinglePaintLayer(graphics_engine, layer_geo, layer);831 RenderSinglePaintLayer(graphics_engine, layer_geo, layer);
@@ -831,6 +836,39 @@
831 }836 }
832 }837 }
833838
839 void BasePainter::PaintBackground(GraphicsEngine& graphics_engine, const Geometry& geo)
840 {
841 PaintActivePaintLayerStack(graphics_engine, geo);
842 }
843
844 void BasePainter::PaintAllLayerStack(GraphicsEngine& graphics_engine, const Geometry& geo)
845 {
846 std::list<std::list<AbstractPaintLayer*> >::const_iterator stack_it;
847 std::list<AbstractPaintLayer *>::const_reverse_iterator rev_layer_it;
848
849 bool clear_background = true;
850
851 for (stack_it = pushed_paint_layer_stack_.begin(); stack_it != pushed_paint_layer_stack_.end(); stack_it++)
852 {
853 std::list<AbstractPaintLayer*> stack = (*stack_it);
854 for (rev_layer_it = stack.rbegin(); rev_layer_it != stack.rend(); rev_layer_it++)
855 {
856 AbstractPaintLayer* layer = (*rev_layer_it);
857 Geometry layer_geo = layer->GetGeometry();
858
859 graphics_engine.PushClippingRectangle(geo);
860 if (clear_background)
861 {
862 Paint2DQuadColor(graphics_engine, layer_geo, Color(0x0));
863 clear_background = false;
864 }
865
866 RenderSinglePaintLayer(graphics_engine, layer_geo, layer);
867 graphics_engine.PopClippingRectangle();
868 }
869 }
870 }
871
834 void BasePainter::RenderSinglePaintLayer(GraphicsEngine &graphics_engine, Geometry geo, AbstractPaintLayer *paint_layer)872 void BasePainter::RenderSinglePaintLayer(GraphicsEngine &graphics_engine, Geometry geo, AbstractPaintLayer *paint_layer)
835 {873 {
836 paint_layer->Renderlayer(graphics_engine);874 paint_layer->Renderlayer(graphics_engine);
837875
=== modified file 'Nux/Painter.h'
--- Nux/Painter.h 2012-08-27 09:09:21 +0000
+++ Nux/Painter.h 2012-09-18 11:05:23 +0000
@@ -423,6 +423,13 @@
423 */423 */
424 void PaintActivePaintLayerStack(GraphicsEngine &graphics_engine, const Geometry &geo);424 void PaintActivePaintLayerStack(GraphicsEngine &graphics_engine, const Geometry &geo);
425425
426 //! Paint all layers in all stacks
427 /*
428 Paint all layers in all stacks with the current model-view and projection matrices.
429 This is useful for redirected rendering to textures.
430 */
431 void PaintAllLayerStack(GraphicsEngine& graphics_engine, const Geometry& geo);
432
426 //! Deprecated. Use PushPaintLayerStack.433 //! Deprecated. Use PushPaintLayerStack.
427 void PushBackgroundStack();434 void PushBackgroundStack();
428435
429436
=== modified file 'Nux/RGBValuator.cpp'
--- Nux/RGBValuator.cpp 2012-08-27 09:09:21 +0000
+++ Nux/RGBValuator.cpp 2012-09-18 11:05:23 +0000
@@ -120,16 +120,16 @@
120 blue_caption_ = new EditTextBox("", NUX_TRACKER_LOCATION);120 blue_caption_ = new EditTextBox("", NUX_TRACKER_LOCATION);
121 alpha_caption_ = new EditTextBox("", NUX_TRACKER_LOCATION);121 alpha_caption_ = new EditTextBox("", NUX_TRACKER_LOCATION);
122122
123 red_valuator_ = new InputArea(NUX_TRACKER_LOCATION);123 red_valuator_ = new BasicView(NUX_TRACKER_LOCATION);
124 green_valuator_ = new InputArea(NUX_TRACKER_LOCATION);124 green_valuator_ = new BasicView(NUX_TRACKER_LOCATION);
125 blue_valuator_ = new InputArea(NUX_TRACKER_LOCATION);125 blue_valuator_ = new BasicView(NUX_TRACKER_LOCATION);
126 alpha_valuator_ = new InputArea(NUX_TRACKER_LOCATION);126 alpha_valuator_ = new BasicView(NUX_TRACKER_LOCATION);
127 color_square_ = new InputArea(NUX_TRACKER_LOCATION);127 color_square_ = new BasicView(NUX_TRACKER_LOCATION);
128128
129 m_ComponentLabel0 = new InputArea(NUX_TRACKER_LOCATION);129 m_ComponentLabel0 = new BasicView(NUX_TRACKER_LOCATION);
130 m_ComponentLabel1 = new InputArea(NUX_TRACKER_LOCATION);130 m_ComponentLabel1 = new BasicView(NUX_TRACKER_LOCATION);
131 m_ComponentLabel2 = new InputArea(NUX_TRACKER_LOCATION);131 m_ComponentLabel2 = new BasicView(NUX_TRACKER_LOCATION);
132 m_ComponentAlpha = new InputArea(NUX_TRACKER_LOCATION);132 m_ComponentAlpha = new BasicView(NUX_TRACKER_LOCATION);
133 }133 }
134134
135 void RGBValuator::InitializeWidgets()135 void RGBValuator::InitializeWidgets()
@@ -152,10 +152,6 @@
152 alpha_valuator_->mouse_drag.connect(sigc::mem_fun(this, &RGBValuator::OnReceiveMouseDrag_Alpha));152 alpha_valuator_->mouse_drag.connect(sigc::mem_fun(this, &RGBValuator::OnReceiveMouseDrag_Alpha));
153 m_ColorModel->click.connect(sigc::mem_fun(this, &RGBValuator::OnChangeColorModel));153 m_ColorModel->click.connect(sigc::mem_fun(this, &RGBValuator::OnChangeColorModel));
154 m_ColorFormat->click.connect(sigc::mem_fun(this, &RGBValuator::OnChangeColorFormat));154 m_ColorFormat->click.connect(sigc::mem_fun(this, &RGBValuator::OnChangeColorFormat));
155// m_ColorModel->mouse_down.connect(sigc::mem_fun(this, &RGBValuator::RecvColorModelEvent));
156// m_ColorModel->mouse_up.connect(sigc::mem_fun(this, &RGBValuator::RecvColorModelEvent));
157// m_ColorModel->mouse_enter.connect(sigc::mem_fun(this, &RGBValuator::RecvColorModelEvent));
158
159155
160 m_ColorModel->SetFont(GetSysBoldFont());156 m_ColorModel->SetFont(GetSysBoldFont());
161 m_ColorFormat->SetFont(GetSysBoldFont());157 m_ColorFormat->SetFont(GetSysBoldFont());
@@ -403,7 +399,7 @@
403 Geometry base = GetGeometry();399 Geometry base = GetGeometry();
404400
405 graphics_engine.PushClippingRectangle(base);401 graphics_engine.PushClippingRectangle(base);
406 GetPainter().PushDrawShapeLayer(graphics_engine, vlayout->GetGeometry(), eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners);402 GetPainter().PushDrawShapeLayer(graphics_engine, vlayout->GetGeometry(), eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true);
407403
408 if (m_color_model == color::RGB)404 if (m_color_model == color::RGB)
409 {405 {
@@ -428,13 +424,6 @@
428 DrawBlueMarker(graphics_engine);424 DrawBlueMarker(graphics_engine);
429 DrawAlphaMarker(graphics_engine);425 DrawAlphaMarker(graphics_engine);
430426
431 red_caption_->QueueDraw();
432 green_caption_->QueueDraw();
433 blue_caption_->QueueDraw();
434 alpha_caption_->QueueDraw();
435 m_ColorModel->QueueDraw();
436 m_ColorFormat->QueueDraw();
437
438 GetPainter().PopBackground();427 GetPainter().PopBackground();
439 graphics_engine.PopClippingRectangle();428 graphics_engine.PopClippingRectangle();
440 }429 }
441430
=== modified file 'Nux/RGBValuator.h'
--- Nux/RGBValuator.h 2011-10-18 20:00:59 +0000
+++ Nux/RGBValuator.h 2012-09-18 11:05:23 +0000
@@ -148,16 +148,16 @@
148 EditTextBox *green_caption_;148 EditTextBox *green_caption_;
149 EditTextBox *blue_caption_;149 EditTextBox *blue_caption_;
150 EditTextBox *alpha_caption_;150 EditTextBox *alpha_caption_;
151 InputArea *red_valuator_;151 BasicView *red_valuator_;
152 InputArea *green_valuator_;152 BasicView *green_valuator_;
153 InputArea *blue_valuator_;153 BasicView *blue_valuator_;
154 InputArea *alpha_valuator_;154 BasicView *alpha_valuator_;
155 InputArea *color_square_;155 BasicView *color_square_;
156156
157 InputArea *m_ComponentLabel0;157 BasicView *m_ComponentLabel0;
158 InputArea *m_ComponentLabel1;158 BasicView *m_ComponentLabel1;
159 InputArea *m_ComponentLabel2;159 BasicView *m_ComponentLabel2;
160 InputArea *m_ComponentAlpha;160 BasicView *m_ComponentAlpha;
161161
162 TextureLayer *m_CheckboardLayer;162 TextureLayer *m_CheckboardLayer;
163163
164164
=== modified file 'Nux/RadioButton.cpp'
--- Nux/RadioButton.cpp 2012-01-17 04:34:19 +0000
+++ Nux/RadioButton.cpp 2012-09-18 11:05:23 +0000
@@ -56,8 +56,6 @@
56 Geometry base = GetGeometry();56 Geometry base = GetGeometry();
57 graphics_engine.PushClippingRectangle(base);57 graphics_engine.PushClippingRectangle(base);
5858
59 GetPainter().PaintBackground(graphics_engine, base);
60
61 InteractState is;59 InteractState is;
62 is.is_on = active_;60 is.is_on = active_;
6361
@@ -81,7 +79,7 @@
81 static_text_->ProcessDraw(graphics_engine, true);79 static_text_->ProcessDraw(graphics_engine, true);
82 }80 }
83 GetPainter().PopPaintLayerStack();81 GetPainter().PopPaintLayerStack();
8482
85 graphics_engine.PopClippingRectangle();83 graphics_engine.PopClippingRectangle();
86 }84 }
8785
8886
=== modified file 'Nux/RangeValue.cpp'
--- Nux/RangeValue.cpp 2012-01-17 04:34:19 +0000
+++ Nux/RangeValue.cpp 2012-09-18 11:05:23 +0000
@@ -85,7 +85,7 @@
85 void RangeValue::InitializeLayout()85 void RangeValue::InitializeLayout()
86 {86 {
87 hlayout = new HLayout(NUX_TRACKER_LOCATION);87 hlayout = new HLayout(NUX_TRACKER_LOCATION);
88 m_Percentage = new InputArea(NUX_TRACKER_LOCATION);88 m_Percentage = new BasicView(NUX_TRACKER_LOCATION);
89 m_ValueString = new EditTextBox("", NUX_TRACKER_LOCATION);89 m_ValueString = new EditTextBox("", NUX_TRACKER_LOCATION);
90 }90 }
9191
9292
=== modified file 'Nux/RangeValue.h'
--- Nux/RangeValue.h 2012-01-17 04:34:19 +0000
+++ Nux/RangeValue.h 2012-09-18 11:05:23 +0000
@@ -114,7 +114,7 @@
114 protected:114 protected:
115 HLayout *hlayout;115 HLayout *hlayout;
116 EditTextBox *m_ValueString;116 EditTextBox *m_ValueString;
117 InputArea *m_Percentage;117 BasicView *m_Percentage;
118 Color m_StartColor;118 Color m_StartColor;
119 Color m_EndColor;119 Color m_EndColor;
120 Color m_ProgressColor;120 Color m_ProgressColor;
121121
=== modified file 'Nux/RangeValueInteger.cpp'
--- Nux/RangeValueInteger.cpp 2011-10-10 01:52:00 +0000
+++ Nux/RangeValueInteger.cpp 2012-09-18 11:05:23 +0000
@@ -87,7 +87,7 @@
87 void RangeValueInteger::InitializeLayout()87 void RangeValueInteger::InitializeLayout()
88 {88 {
89 hlayout = new HLayout(NUX_TRACKER_LOCATION);89 hlayout = new HLayout(NUX_TRACKER_LOCATION);
90 m_Percentage = new InputArea(NUX_TRACKER_LOCATION);90 m_Percentage = new BasicView(NUX_TRACKER_LOCATION);
91 m_ValueString = new EditTextBox("", NUX_TRACKER_LOCATION);91 m_ValueString = new EditTextBox("", NUX_TRACKER_LOCATION);
92 }92 }
9393
9494
=== modified file 'Nux/RangeValueInteger.h'
--- Nux/RangeValueInteger.h 2011-10-10 01:52:00 +0000
+++ Nux/RangeValueInteger.h 2012-09-18 11:05:23 +0000
@@ -118,7 +118,7 @@
118 protected:118 protected:
119 HLayout *hlayout;119 HLayout *hlayout;
120 EditTextBox *m_ValueString;120 EditTextBox *m_ValueString;
121 InputArea *m_Percentage;121 BasicView *m_Percentage;
122 Color m_StartColor;122 Color m_StartColor;
123 Color m_EndColor;123 Color m_EndColor;
124 Color m_ProgressColor;124 Color m_ProgressColor;
125125
=== modified file 'Nux/ScrollView.cpp'
--- Nux/ScrollView.cpp 2012-09-14 00:26:47 +0000
+++ Nux/ScrollView.cpp 2012-09-18 11:05:23 +0000
@@ -289,14 +289,12 @@
289 void ScrollView::EnableVerticalScrollBar(bool b)289 void ScrollView::EnableVerticalScrollBar(bool b)
290 {290 {
291 m_vertical_scrollbar_enable = b;291 m_vertical_scrollbar_enable = b;
292 _delta_y = 0;
293 ComputeContentSize();292 ComputeContentSize();
294 }293 }
295294
296 void ScrollView::EnableHorizontalScrollBar(bool b)295 void ScrollView::EnableHorizontalScrollBar(bool b)
297 {296 {
298 m_horizontal_scrollbar_enable = b;297 m_horizontal_scrollbar_enable = b;
299 _delta_x = 0;
300 ComputeContentSize();298 ComputeContentSize();
301 }299 }
302300
303301
=== modified file 'Nux/SpinBox_Logic.cpp'
--- Nux/SpinBox_Logic.cpp 2012-07-04 16:36:46 +0000
+++ Nux/SpinBox_Logic.cpp 2012-09-18 11:05:23 +0000
@@ -32,8 +32,8 @@
32 , m_UpTimerHandler(0)32 , m_UpTimerHandler(0)
33 , m_DownTimerHandler(0)33 , m_DownTimerHandler(0)
34 {34 {
35 m_SpinnerUpBtn = new InputArea(NUX_TRACKER_LOCATION);35 m_SpinnerUpBtn = new BasicView(NUX_TRACKER_LOCATION);
36 m_SpinnerDownBtn = new InputArea(NUX_TRACKER_LOCATION);36 m_SpinnerDownBtn = new BasicView(NUX_TRACKER_LOCATION);
37 m_EditLine = new EditTextBox("", NUX_TRACKER_LOCATION);37 m_EditLine = new EditTextBox("", NUX_TRACKER_LOCATION);
3838
39 // Set Original State39 // Set Original State
4040
=== modified file 'Nux/SpinBox_Logic.h'
--- Nux/SpinBox_Logic.h 2011-10-10 01:52:00 +0000
+++ Nux/SpinBox_Logic.h 2012-09-18 11:05:23 +0000
@@ -74,8 +74,8 @@
7474
75 protected:75 protected:
76 EditTextBox *m_EditLine;76 EditTextBox *m_EditLine;
77 InputArea *m_SpinnerUpBtn;77 BasicView *m_SpinnerUpBtn;
78 InputArea *m_SpinnerDownBtn;78 BasicView *m_SpinnerDownBtn;
7979
80 TimerFunctor *m_UpTimerCallback;80 TimerFunctor *m_UpTimerCallback;
81 TimerFunctor *m_DownTimerCallback;81 TimerFunctor *m_DownTimerCallback;
8282
=== modified file 'Nux/TabView.cpp'
--- Nux/TabView.cpp 2012-07-04 16:36:46 +0000
+++ Nux/TabView.cpp 2012-09-18 11:05:23 +0000
@@ -45,7 +45,7 @@
45 _index = 0;45 _index = 0;
46 _tab_name = TabName;46 _tab_name = TabName;
47 _tab_content_layout = TabLayout;47 _tab_content_layout = TabLayout;
48 _tab_area = new InputArea(NUX_TRACKER_LOCATION);48 _tab_area = new BasicView(NUX_TRACKER_LOCATION);
4949
50 _tab_content_layout->Reference();50 _tab_content_layout->Reference();
51 _tab_area->Reference();51 _tab_area->Reference();
@@ -100,8 +100,8 @@
100 //_tabview_heads_layout->SetParentObject(this);100 //_tabview_heads_layout->SetParentObject(this);
101 _tabview_scroll_button_layout = new HLayout(NUX_TRACKER_LOCATION);101 _tabview_scroll_button_layout = new HLayout(NUX_TRACKER_LOCATION);
102 _tabview_scroll_button_layout->SetParentObject(this);102 _tabview_scroll_button_layout->SetParentObject(this);
103 _scroll_right = new InputArea(NUX_TRACKER_LOCATION);103 _scroll_right = new BasicView(NUX_TRACKER_LOCATION);
104 _scroll_left = new InputArea(NUX_TRACKER_LOCATION);104 _scroll_left = new BasicView(NUX_TRACKER_LOCATION);
105105
106 _scroll_right->SetMinimumSize(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT);106 _scroll_right->SetMinimumSize(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT);
107 _scroll_left->SetMinimumSize(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT);107 _scroll_left->SetMinimumSize(TAB_BUTTON_WIDTH, TAB_BUTTON_HEIGHT);
108108
=== modified file 'Nux/TabView.h'
--- Nux/TabView.h 2011-10-10 01:52:00 +0000
+++ Nux/TabView.h 2012-09-18 11:05:23 +0000
@@ -74,7 +74,7 @@
7474
75 NString _tab_name;75 NString _tab_name;
76 Layout *_tab_content_layout;76 Layout *_tab_content_layout;
77 InputArea *_tab_area;77 BasicView *_tab_area;
78 int _index;78 int _index;
79 };79 };
8080
@@ -103,8 +103,8 @@
103 void TranslateRight(int x, int y, unsigned long button_flags, unsigned long key_flags);103 void TranslateRight(int x, int y, unsigned long button_flags, unsigned long key_flags);
104 void TranslateTabLayout(int offset);104 void TranslateTabLayout(int offset);
105105
106 InputArea *_scroll_right;106 BasicView *_scroll_right;
107 InputArea *_scroll_left;107 BasicView *_scroll_left;
108108
109 Layout *_visible_tab_content_layout;109 Layout *_visible_tab_content_layout;
110 HLayout *_tabview_heads_layout;110 HLayout *_tabview_heads_layout;
111111
=== modified file 'Nux/TextEntry.cpp'
--- Nux/TextEntry.cpp 2012-08-28 21:30:51 +0000
+++ Nux/TextEntry.cpp 2012-09-18 11:05:23 +0000
@@ -27,9 +27,9 @@
27#include "NuxGraphics/CairoGraphics.h"27#include "NuxGraphics/CairoGraphics.h"
2828
29#include "TextEntry.h"29#include "TextEntry.h"
30
31#if defined(NUX_OS_LINUX)
30#include "TextEntryComposeSeqs.h"32#include "TextEntryComposeSeqs.h"
31
32#if defined(NUX_OS_LINUX)
33#include <X11/cursorfont.h>33#include <X11/cursorfont.h>
34#include "InputMethodIBus.h"34#include "InputMethodIBus.h"
35#endif35#endif
@@ -187,6 +187,7 @@
187187
188 SetAcceptKeyboardEvent(true);188 SetAcceptKeyboardEvent(true);
189 EnableDoubleClick(true);189 EnableDoubleClick(true);
190 SetPasswordChar("*");
190 }191 }
191192
192 TextEntry::~TextEntry()193 TextEntry::~TextEntry()
@@ -220,10 +221,8 @@
220221
221 void TextEntry::GeometryChanged()222 void TextEntry::GeometryChanged()
222 {223 {
223
224 update_canvas_ = true;224 update_canvas_ = true;
225 View::GeometryChanged();225 View::GeometryChanged(true, true);
226
227 }226 }
228227
229 Area* TextEntry::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type)228 Area* TextEntry::FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type)
@@ -633,6 +632,7 @@
633 {632 {
634 SearchState search_state = SearchState::NO_MATCH;633 SearchState search_state = SearchState::NO_MATCH;
635634
635#if defined(NUX_OS_LINUX)
636 if (input.size() >= ComposeSequence::MAX_SYMBOLS)636 if (input.size() >= ComposeSequence::MAX_SYMBOLS)
637 return search_state;637 return search_state;
638638
@@ -670,6 +670,7 @@
670 }670 }
671 }671 }
672 }672 }
673#endif
673674
674 return search_state;675 return search_state;
675 }676 }
@@ -2555,12 +2556,10 @@
2555 {2556 {
2556 if (c == NULL || *c == 0 || !IsLegalUTF8Char(c, GetUTF8CharLength(c)))2557 if (c == NULL || *c == 0 || !IsLegalUTF8Char(c, GetUTF8CharLength(c)))
2557 {2558 {
2558 SetVisibility(true);
2559 password_char_.clear();2559 password_char_.clear();
2560 }2560 }
2561 else2561 else
2562 {2562 {
2563 SetVisibility(false);
2564 password_char_.assign(c, GetUTF8CharLength(c));2563 password_char_.assign(c, GetUTF8CharLength(c));
2565 }2564 }
2566 QueueRefresh(true, true);2565 QueueRefresh(true, true);
25672566
=== modified file 'Nux/TextEntry.h'
--- Nux/TextEntry.h 2012-08-28 21:30:51 +0000
+++ Nux/TextEntry.h 2012-09-18 11:05:23 +0000
@@ -237,7 +237,7 @@
237 /**237 /**
238 * Enum used for the search state of the compose list238 * Enum used for the search state of the compose list
239 */239 */
240 enum class SearchState {240 enum SearchState {
241 NO_MATCH,241 NO_MATCH,
242 PARTIAL,242 PARTIAL,
243 MATCH243 MATCH
244244
=== modified file 'Nux/Theme.cpp'
--- Nux/Theme.cpp 2012-07-26 00:17:42 +0000
+++ Nux/Theme.cpp 2012-09-18 11:05:23 +0000
@@ -22,7 +22,7 @@
22#include "Nux.h"22#include "Nux.h"
23#include "Theme.h"23#include "Theme.h"
24#if defined(NUX_OS_WINDOWS)24#if defined(NUX_OS_WINDOWS)
25 #include "NuxCore/TinyXML/tinyxml.h"25 #include "tinyxml/tinyxml.h"
26#endif26#endif
2727
28namespace nux28namespace nux
2929
=== modified file 'Nux/VScrollBar.cpp'
--- Nux/VScrollBar.cpp 2012-07-04 16:36:46 +0000
+++ Nux/VScrollBar.cpp 2012-09-18 11:05:23 +0000
@@ -52,10 +52,10 @@
52 m_DownTimerHandler = 0;52 m_DownTimerHandler = 0;
5353
54 vlayout = new VLayout(NUX_TRACKER_LOCATION);54 vlayout = new VLayout(NUX_TRACKER_LOCATION);
55 _scroll_up_button = new InputArea(NUX_TRACKER_LOCATION);55 _scroll_up_button = new BasicView(NUX_TRACKER_LOCATION);
56 _track = new InputArea(NUX_TRACKER_LOCATION);56 _track = new BasicView(NUX_TRACKER_LOCATION);
57 _scroll_down_button = new InputArea(NUX_TRACKER_LOCATION);57 _scroll_down_button = new BasicView(NUX_TRACKER_LOCATION);
58 _slider = new InputArea(NUX_TRACKER_LOCATION);58 _slider = new BasicView(NUX_TRACKER_LOCATION);
59 _slider->SetParentObject(this);59 _slider->SetParentObject(this);
6060
61 // Set Original State61 // Set Original State
6262
=== modified file 'Nux/VScrollBar.h'
--- Nux/VScrollBar.h 2012-01-02 20:39:31 +0000
+++ Nux/VScrollBar.h 2012-09-18 11:05:23 +0000
@@ -98,10 +98,10 @@
98 bool AtMaximum();98 bool AtMaximum();
9999
100 VLayout *vlayout;100 VLayout *vlayout;
101 InputArea *_slider;101 BasicView *_slider;
102 InputArea *_scroll_up_button;102 BasicView *_scroll_up_button;
103 InputArea *_scroll_down_button;103 BasicView *_scroll_down_button;
104 InputArea *_track;104 BasicView *_track;
105105
106 int content_width_;106 int content_width_;
107 int content_height_;107 int content_height_;
108108
=== modified file 'Nux/VSplitter.cpp'
--- Nux/VSplitter.cpp 2012-07-30 21:07:40 +0000
+++ Nux/VSplitter.cpp 2012-09-18 11:05:23 +0000
@@ -139,11 +139,6 @@
139 View *ic = NUX_STATIC_CAST(View *, (*it));139 View *ic = NUX_STATIC_CAST(View *, (*it));
140 ic->ProcessDraw(graphics_engine, true);140 ic->ProcessDraw(graphics_engine, true);
141 }141 }
142 else if ((*it)->Type().IsObjectType(InputArea::StaticObjectType))
143 {
144 InputArea *base_area = NUX_STATIC_CAST(InputArea *, (*it));
145 base_area->OnDraw(graphics_engine, true);
146 }
147 else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType))142 else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType))
148 {143 {
149 HLayout *layout = NUX_STATIC_CAST(HLayout *, (*it));144 HLayout *layout = NUX_STATIC_CAST(HLayout *, (*it));
@@ -162,11 +157,6 @@
162 View *ic = NUX_STATIC_CAST(View *, (*it));157 View *ic = NUX_STATIC_CAST(View *, (*it));
163 ic->ProcessDraw(graphics_engine, false);158 ic->ProcessDraw(graphics_engine, false);
164 }159 }
165 else if ((*it)->Type().IsObjectType(InputArea::StaticObjectType))
166 {
167 InputArea *base_area = NUX_STATIC_CAST(InputArea *, (*it));
168 base_area->OnDraw(graphics_engine, false);
169 }
170 else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType))160 else if ((*it)->Type().IsObjectType(HLayout::StaticObjectType))
171 {161 {
172 HLayout *layout = NUX_STATIC_CAST(HLayout *, (*it));162 HLayout *layout = NUX_STATIC_CAST(HLayout *, (*it));
@@ -355,11 +345,6 @@
355 // ComputeElementLayout to force the computing of this element layout.345 // ComputeElementLayout to force the computing of this element layout.
356 GetWindowThread()->ComputeElementLayout(ic);346 GetWindowThread()->ComputeElementLayout(ic);
357 }347 }
358 else if (m_InterfaceObject[i]->Type().IsObjectType(InputArea::StaticObjectType))
359 {
360 InputArea *base_area = NUX_STATIC_CAST(InputArea *, m_InterfaceObject[i]);
361 base_area->SetGeometry(Geometry(accwidth, y, splitter_geo.x - accwidth, h));
362 }
363 else if (m_InterfaceObject[i]->Type().IsDerivedFromType(Layout::StaticObjectType))348 else if (m_InterfaceObject[i]->Type().IsDerivedFromType(Layout::StaticObjectType))
364 {349 {
365 Layout *layout = NUX_STATIC_CAST(Layout *, m_InterfaceObject[i]);350 Layout *layout = NUX_STATIC_CAST(Layout *, m_InterfaceObject[i]);
@@ -562,10 +547,6 @@
562 View *ic = NUX_STATIC_CAST(View *, (*it));547 View *ic = NUX_STATIC_CAST(View *, (*it));
563 ic->DoneRedraw();548 ic->DoneRedraw();
564 }549 }
565 else if ((*it)->Type().IsObjectType(InputArea::StaticObjectType))
566 {
567 //InputArea* base_area = NUX_STATIC_CAST(InputArea*, (*it));
568 }
569 }550 }
570 }551 }
571552
572553
=== modified file 'Nux/VSplitter.h'
--- Nux/VSplitter.h 2011-10-21 22:06:35 +0000
+++ Nux/VSplitter.h 2012-09-18 11:05:23 +0000
@@ -80,7 +80,7 @@
8080
81 private:81 private:
8282
83 typedef InputArea MySplitter;83 typedef BasicView MySplitter;
84 std::vector<Area *> m_InterfaceObject;84 std::vector<Area *> m_InterfaceObject;
85 std::vector<MySplitter *> m_SplitterObject;85 std::vector<MySplitter *> m_SplitterObject;
86 std::vector<float> m_SplitConfig;86 std::vector<float> m_SplitConfig;
8787
=== modified file 'Nux/View.cpp'
--- Nux/View.cpp 2012-05-31 21:50:05 +0000
+++ Nux/View.cpp 2012-09-18 11:05:23 +0000
@@ -27,19 +27,25 @@
2727
28namespace nux28namespace nux
29{29{
30
31 NUX_IMPLEMENT_OBJECT_TYPE(View);30 NUX_IMPLEMENT_OBJECT_TYPE(View);
3231
33 View::View(NUX_FILE_LINE_DECL)32 View::View(NUX_FILE_LINE_DECL)
34 : InputArea(NUX_FILE_LINE_PARAM)33 : InputArea(NUX_FILE_LINE_PARAM)
34// , redirect_rendering_to_texture_(false)
35// , update_backup_texture_(false)
35 {36 {
36 view_layout_ = NULL;37 view_layout_ = NULL;
37 draw_cmd_queued_ = false;38 draw_cmd_queued_ = false;
38 m_TextColor = Color(1.0f, 1.0f, 1.0f, 1.0f);39 m_TextColor = Color(1.0f, 1.0f, 1.0f, 1.0f);
39 }40 }
4041
41 View::~View()42 View::~View()
42 {43 {
44 backup_fbo_.Release();
45 backup_texture_.Release();
46 backup_depth_texture_.Release();
47 background_texture_.Release();
48
43 // It is possible that the window thread has been deleted before the view49 // It is possible that the window thread has been deleted before the view
44 // itself, so check prior to calling.50 // itself, so check prior to calling.
45 WindowThread* wt = GetWindowThread();51 WindowThread* wt = GetWindowThread();
@@ -157,46 +163,264 @@
157 {163 {
158 full_view_draw_cmd_ = false;164 full_view_draw_cmd_ = false;
159165
160 graphics_engine.PushModelViewMatrix(Get2DMatrix());166 if (RedirectRenderingToTexture())
161
162 if (force_draw)
163 {167 {
164 GetPainter().PaintBackground(graphics_engine, GetGeometry());168 if (update_backup_texture_ || force_draw || draw_cmd_queued_)
165 GetPainter().PushPaintLayerStack();169 {
166170 GetPainter().PushPaintLayerStack();
167 draw_cmd_queued_ = true;171 BeginBackupTextureRendering(graphics_engine, force_draw);
168 full_view_draw_cmd_ = true;172 {
169 Draw(graphics_engine, force_draw);173 graphics_engine.PushModelViewMatrix(Get2DMatrix());
170 DrawContent(graphics_engine, force_draw);174
171 PostDraw(graphics_engine, force_draw);175 Geometry translated_geo = GetGeometry();
172176 translated_geo.x = 0;
173 GetPainter().PopPaintLayerStack();177 translated_geo.y = 0;
178 if (force_draw)
179 {
180 draw_cmd_queued_ = true;
181 full_view_draw_cmd_ = true;
182 Draw(graphics_engine, force_draw);
183 DrawContent(graphics_engine, force_draw);
184 PostDraw(graphics_engine, force_draw);
185 }
186 else
187 {
188 if (draw_cmd_queued_)
189 {
190 full_view_draw_cmd_ = true;
191 Draw(graphics_engine, false);
192 DrawContent(graphics_engine, false);
193 PostDraw(graphics_engine, false);
194 }
195 else if (update_backup_texture_)
196 {
197 DrawContent(graphics_engine, false);
198 PostDraw(graphics_engine, false);
199 }
200 }
201 graphics_engine.PopModelViewMatrix();
202 }
203 EndBackupTextureRendering(graphics_engine, force_draw);
204 GetPainter().PopPaintLayerStack();
205 }
206
207 if (PresentRedirectedView())
208 {
209 unsigned int current_alpha_blend;
210 unsigned int current_src_blend_factor;
211 unsigned int current_dest_blend_factor;
212 // Be a good citizen, get a copy of the current GPU sates according to Nux
213 graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
214
215 TexCoordXForm texxform;
216
217 if ((force_draw || draw_cmd_queued_) && (background_texture_.IsValid()))
218 {
219 graphics_engine.GetRenderStates().SetBlend(false);
220 texxform.FlipVCoord(true);
221 // Draw the background of this view.
222 GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), background_texture_->GetWidth(), background_texture_->GetHeight(), background_texture_, texxform, color::White);
223 }
224
225 texxform.uwrap = TEXWRAP_CLAMP;
226 texxform.vwrap = TEXWRAP_CLAMP;
227 texxform.FlipVCoord(true);
228
229 graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
230 GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), GetWidth(), GetHeight(), backup_texture_, texxform, Color(color::White));
231 // Be a good citizen, restore the Nux blending states.
232 graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
233 }
174 }234 }
175 else235 else
176 {236 {
177 if (draw_cmd_queued_)237 graphics_engine.PushModelViewMatrix(Get2DMatrix());
238
239 if (force_draw)
178 {240 {
179 GetPainter().PaintBackground(graphics_engine, GetGeometry());241 GetPainter().PaintBackground(graphics_engine, GetGeometry());
180 GetPainter().PushPaintLayerStack();242 GetPainter().PushPaintLayerStack();
181243
244 draw_cmd_queued_ = true;
182 full_view_draw_cmd_ = true;245 full_view_draw_cmd_ = true;
183 Draw(graphics_engine, false);246 Draw(graphics_engine, force_draw);
184 DrawContent(graphics_engine, false);247 DrawContent(graphics_engine, force_draw);
185 PostDraw(graphics_engine, false);248 PostDraw(graphics_engine, force_draw);
186249
187 GetPainter().PopPaintLayerStack();250 GetPainter().PopPaintLayerStack();
188 }251 }
189 else252 else
190 {253 {
191 DrawContent(graphics_engine, false);254 if (draw_cmd_queued_)
192 PostDraw(graphics_engine, false);255 {
193 }256 GetPainter().PaintBackground(graphics_engine, GetGeometry());
194 }257 GetPainter().PushPaintLayerStack();
195258
259 full_view_draw_cmd_ = true;
260 Draw(graphics_engine, false);
261 DrawContent(graphics_engine, false);
262 PostDraw(graphics_engine, false);
263
264 GetPainter().PopPaintLayerStack();
265 }
266 else
267 {
268 DrawContent(graphics_engine, false);
269 PostDraw(graphics_engine, false);
270 }
271 }
272
273 graphics_engine.PopModelViewMatrix();
274 }
275
276 if (view_layout_)
277 {
278 view_layout_->ResetQueueDraw();
279 }
280
281 draw_cmd_queued_ = false;
282 child_draw_cmd_queued_ = false;
283 full_view_draw_cmd_ = false;
284 update_backup_texture_ = false;
285 }
286
287 void View::BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw)
288 {
289 ObjectPtr<IOpenGLBaseTexture> active_fbo_texture;
290 if (force_draw || draw_cmd_queued_)
291 {
292 // Get the active fbo color texture
293 active_fbo_texture = GetGraphicsDisplay()->GetGpuDevice()->ActiveFboTextureAttachment(0);
294 }
295
296 Geometry xform_geo;
297 // Compute position in the active fbo texture.
298 xform_geo = graphics_engine.ModelViewXFormRect(GetGeometry());
299
300 // Get the active fbo...
301 prev_fbo_ = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject();
302 // ... and the size of the view port rectangle.
303 prev_viewport_ = graphics_engine.GetViewportRect();
304
305 const int width = GetWidth();
306 const int height = GetHeight();
307
308 // Compute intersection with active fbo.
309 Geometry intersection = xform_geo;
310 if (active_fbo_texture.IsValid())
311 {
312 Geometry active_fbo_geo(0, 0, active_fbo_texture->GetWidth(), active_fbo_texture->GetHeight());
313 intersection = active_fbo_geo.Intersect(xform_geo);
314 }
315
316 if (backup_fbo_.IsNull())
317 {
318 // Create the fbo before using it for the first time.
319 backup_fbo_ = GetGraphicsDisplay()->GetGpuDevice()->CreateFrameBufferObject();
320 }
321
322 if (!backup_texture_.IsValid() || (backup_texture_->GetWidth() != width) || (backup_texture_->GetHeight() != height))
323 {
324 // Create or resize the color and depth textures before using them.
325 backup_texture_ = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(width, height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
326 backup_depth_texture_ = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(width, height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);
327 }
328
329 if (!background_texture_.IsValid() || (background_texture_->GetWidth() != intersection.width) || (background_texture_->GetHeight() != intersection.height))
330 {
331 background_texture_ = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(intersection.width, intersection.height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
332 }
333
334 backup_fbo_->FormatFrameBufferObject(width, height, BITFMT_R8G8B8A8);
335 backup_fbo_->EmptyClippingRegion();
336
337 graphics_engine.SetViewport(0, 0, width, height);
338 graphics_engine.SetOrthographicProjectionMatrix(width, height);
339
340 // Draw the background on the previous fbo texture
341 if ((force_draw || draw_cmd_queued_) && background_texture_.IsValid())
342 {
343 backup_fbo_->FormatFrameBufferObject(intersection.width, intersection.height, BITFMT_R8G8B8A8);
344 backup_fbo_->EmptyClippingRegion();
345
346 graphics_engine.SetViewport(0, 0, intersection.width, intersection.height);
347 graphics_engine.SetOrthographicProjectionMatrix(intersection.width, intersection.height);
348
349 // Set the background texture in the fbo
350 backup_fbo_->SetTextureAttachment(0, background_texture_, 0);
351 backup_fbo_->SetDepthTextureAttachment(ObjectPtr<IOpenGLBaseTexture>(0), 0);
352 backup_fbo_->Activate();
353 graphics_engine.SetViewport(0, 0, background_texture_->GetWidth(), background_texture_->GetHeight());
354
355 // Clear surface
356 // Clear surface
357 CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
358 CHECKGL(glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT));
359
360 TexCoordXForm texxform;
361 texxform.uoffset = xform_geo.x / (float) active_fbo_texture->GetWidth();
362 texxform.voffset = xform_geo.y / (float) active_fbo_texture->GetHeight();
363 texxform.SetTexCoordType(TexCoordXForm::OFFSET_COORD);
364 texxform.flip_v_coord = true;
365
366 // Temporarily change the model-view matrix to copy the texture background texture.
367 // This way we are not affceted by the regular model-view matrix.
368 graphics_engine.SetModelViewMatrix(Matrix4::IDENTITY());
369 // Copy the texture from the previous fbo attachment into our background texture.
370 if (copy_previous_fbo_for_background_)
371 {
372 graphics_engine.QRP_1Tex(0, 0, intersection.width, intersection.height, active_fbo_texture, texxform, color::White);
373 }
374 else
375 {
376 graphics_engine.QRP_Color(0, 0, intersection.width, intersection.height, Color(0.0f, 0.0f, 0.0f, 0.0f));
377 }
378 // Restore the model-view matrix.
379 graphics_engine.ApplyModelViewMatrix();
380 }
381
382 backup_fbo_->FormatFrameBufferObject(width, height, BITFMT_R8G8B8A8);
383 backup_fbo_->EmptyClippingRegion();
384 backup_fbo_->SetTextureAttachment(0, backup_texture_, 0);
385 backup_fbo_->SetDepthTextureAttachment(backup_depth_texture_, 0);
386 backup_fbo_->Activate();
387
388 if (force_draw || draw_cmd_queued_)
389 {
390 CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
391 CHECKGL(glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT));
392 }
393
394 graphics_engine.SetViewport(0, 0, width, height);
395 graphics_engine.SetOrthographicProjectionMatrix(width, height);
396 // Transform the geometry of this area through the current model view matrix. This gives the
397 // the position of the view in the active fbo texture.
398 Geometry offset_rect = graphics_engine.ModelViewXFormRect(GetGeometry());
399 int x_offset = -offset_rect.x;
400 int y_offset = -offset_rect.y;
401 graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(x_offset, y_offset, 0));
402
403 }
404
405 void View::EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw)
406 {
196 graphics_engine.PopModelViewMatrix();407 graphics_engine.PopModelViewMatrix();
197408
198 draw_cmd_queued_ = false;409 if (prev_fbo_.IsValid())
199 full_view_draw_cmd_ = false;410 {
411 // Restore the previous fbo
412 prev_fbo_->Activate();
413
414 prev_fbo_->ApplyClippingRegion();
415 }
416
417 // Release the reference on the previous fbo
418 prev_fbo_.Release();
419
420 // Restore the matrices and the view port.
421 graphics_engine.ApplyModelViewMatrix();
422 graphics_engine.SetOrthographicProjectionMatrix(prev_viewport_.width, prev_viewport_.height);
423 graphics_engine.SetViewport(prev_viewport_.x, prev_viewport_.y, prev_viewport_.width, prev_viewport_.height);
200 }424 }
201425
202 void View::Draw(GraphicsEngine &graphics_engine, bool force_draw)426 void View::Draw(GraphicsEngine &graphics_engine, bool force_draw)
@@ -219,19 +443,26 @@
219 if (draw_cmd_queued_)443 if (draw_cmd_queued_)
220 return;444 return;
221445
222 //GetWindowCompositor()..AddToDrawList(this);
223 WindowThread* application = GetWindowThread();446 WindowThread* application = GetWindowThread();
224 if (application)447 if (application)
225 {448 {
226 application->AddToDrawList(this);449 application->AddToDrawList(this);
227 application->RequestRedraw();450 application->RequestRedraw();
228 //GetWindowCompositor().AddToDrawList(this);
229 }451 }
452
453 // Report to a parent view with redirect_rendering_to_texture_ set to true that one of its children
454 // needs to be redrawn.
455 PrepareParentRedirectedView();
456
230 if (view_layout_)457 if (view_layout_)
458 {
459 // If this view has requested a draw, then all of it children in the view_layout_
460 // need to be redrawn as well.
231 view_layout_->QueueDraw();461 view_layout_->QueueDraw();
462 }
232463
233 draw_cmd_queued_ = true;464 draw_cmd_queued_ = true;
234 OnQueueDraw.emit(this);465 queue_draw.emit(this);
235 }466 }
236467
237 void View::NeedSoftRedraw()468 void View::NeedSoftRedraw()
@@ -310,9 +541,19 @@
310541
311 LayoutAdded.emit(this, view_layout_);542 LayoutAdded.emit(this, view_layout_);
312543
544 view_layout_->queue_draw.connect(sigc::mem_fun(this, &View::ChildViewQueuedDraw));
545 view_layout_->child_queue_draw.connect(sigc::mem_fun(this, &View::ChildViewQueuedDraw));
313 return true;546 return true;
314 }547 }
315548
549 void View::ChildViewQueuedDraw(Area* area)
550 {
551 if (child_draw_cmd_queued_)
552 return;
553 child_draw_cmd_queued_ = true;
554 child_queue_draw.emit(area);
555 }
556
316 void View::OnChildFocusChanged(/*Area *parent,*/ Area *child)557 void View::OnChildFocusChanged(/*Area *parent,*/ Area *child)
317 {558 {
318 ChildFocusChanged.emit(/*parent,*/ child);559 ChildFocusChanged.emit(/*parent,*/ child);
@@ -354,9 +595,16 @@
354 return false;595 return false;
355 }596 }
356597
357 void View::SetGeometry(const Geometry &geo)598// void View::SetGeometry(int x, int y, int w, int h)
599// {
600// Area::SetGeometry(x, y, w, h);
601// ComputeContentSize();
602// PostResizeGeometry();
603// }
604
605 void View::SetGeometry(const Geometry& geo)
358 {606 {
359 Area::SetGeometry(geo);607 Area::SetGeometry(geo.x, geo.y, geo.width, geo.height);
360 ComputeContentSize();608 ComputeContentSize();
361 PostResizeGeometry();609 PostResizeGeometry();
362 }610 }
@@ -410,14 +658,20 @@
410 return view_enabled_;658 return view_enabled_;
411 }659 }
412660
413 void View::GeometryChangePending()661 void View::GeometryChangePending(bool position_about_to_change, bool size_about_to_change)
414 {662 {
415 if (IsLayoutDone())663 if (IsLayoutDone())
416 QueueDraw();664 QueueDraw();
417 }665 }
418666
419 void View::GeometryChanged()667 void View::GeometryChanged(bool position_has_changed, bool size_has_changed)
420 {668 {
669 if (RedirectedAncestor())
670 {
671 if (size_has_changed)
672 QueueDraw();
673 return;
674 }
421 if (IsLayoutDone())675 if (IsLayoutDone())
422 QueueDraw();676 QueueDraw();
423 }677 }
424678
=== modified file 'Nux/View.h'
--- Nux/View.h 2012-05-31 21:50:05 +0000
+++ Nux/View.h 2012-09-18 11:05:23 +0000
@@ -23,7 +23,6 @@
23#ifndef ABSTRACTOBJECTBASE_H23#ifndef ABSTRACTOBJECTBASE_H
24#define ABSTRACTOBJECTBASE_H24#define ABSTRACTOBJECTBASE_H
2525
26#include "Features.h"
27#include "Nux.h"26#include "Nux.h"
28#include "NuxCore/Property.h"27#include "NuxCore/Property.h"
2928
@@ -48,7 +47,6 @@
48 /*47 /*
49 If ComputeContentSize is called while outside of the layout process (\sa IsInsideLayoutCycle) then the parents of 48 If ComputeContentSize is called while outside of the layout process (\sa IsInsideLayoutCycle) then the parents of
50 this object maybe added to the layout queue if this view size changes. \sa Area::ReconfigureParentLayout.49 this object maybe added to the layout queue if this view size changes. \sa Area::ReconfigureParentLayout.
51
52 */50 */
53 virtual long ComputeContentSize();51 virtual long ComputeContentSize();
54 virtual void ComputeContentPosition(float offsetX, float offsetY);52 virtual void ComputeContentPosition(float offsetX, float offsetY);
@@ -85,7 +83,7 @@
85 virtual void ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw);83 virtual void ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw);
86 //! Causes a redraw. The widget parameter draw_cmd_queued_ is set to true. The widget Draw(), DrawContent() and PostDraw() are called.84 //! Causes a redraw. The widget parameter draw_cmd_queued_ is set to true. The widget Draw(), DrawContent() and PostDraw() are called.
87 /*!85 /*!
88 Emits the signal \i OnQueueDraw.86 Emits the signal \i queue_draw.
89 */87 */
90 virtual void QueueDraw();88 virtual void QueueDraw();
9189
@@ -101,6 +99,9 @@
101 bool SearchInAllSubNodes(Area *bo);99 bool SearchInAllSubNodes(Area *bo);
102 bool SearchInFirstSubNodes(Area *bo);100 bool SearchInFirstSubNodes(Area *bo);
103101
102
103/* void SetGeometry(int x, int y, int w, int h);*/
104
104 //! Set Geometry105 //! Set Geometry
105 /*106 /*
106 Set the Geometry of the View and the geometry of the Default Background Area.107 Set the Geometry of the View and the geometry of the Default Background Area.
@@ -144,18 +145,28 @@
144 void SetFont(ObjectPtr<FontTexture> font);145 void SetFont(ObjectPtr<FontTexture> font);
145 ObjectPtr<FontTexture> GetFont();146 ObjectPtr<FontTexture> GetFont();
146147
147 sigc::signal<void, View*> OnQueueDraw; //!< Signal emitted when a view is scheduled for a draw.148 sigc::signal<void, View*> queue_draw; //!< Signal emitted when a view is scheduled for a draw.
149 sigc::signal<void, Area*> child_queue_draw; //!< Signal emitted when a child of this view is scheduled for a draw.
148150
149 virtual Area* KeyNavIteration(KeyNavDirection direction);151 virtual Area* KeyNavIteration(KeyNavDirection direction);
150 virtual bool AcceptKeyNavFocus();152 virtual bool AcceptKeyNavFocus();
151153
152 void IsHitDetectionSkipingChildren(bool skip_children);154 virtual Area* FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type);
155
156 virtual Area* FindKeyFocusArea(unsigned int key_symbol,
157 unsigned long x11_key_code,
158 unsigned long special_keys_state);
153159
154#ifdef NUX_GESTURES_SUPPORT160#ifdef NUX_GESTURES_SUPPORT
155 virtual Area* GetInputAreaHitByGesture(const nux::GestureEvent &event);161 virtual Area* GetInputAreaHitByGesture(const nux::GestureEvent &event);
156#endif162#endif
157163
158 protected:164 protected:
165 virtual void ChildViewQueuedDraw(Area* area);
166
167 void BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
168
169 void EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
159170
160 void OnChildFocusChanged(/*Area *parent,*/ Area *child);171 void OnChildFocusChanged(/*Area *parent,*/ Area *child);
161 sigc::connection _on_focus_changed_handler;172 sigc::connection _on_focus_changed_handler;
@@ -191,18 +202,13 @@
191 */202 */
192 bool IsFullRedraw() const;203 bool IsFullRedraw() const;
193204
194 virtual void GeometryChangePending();205 virtual void GeometryChangePending(bool position_about_to_change, bool size_about_to_change);
195 virtual void GeometryChanged();206 virtual void GeometryChanged(bool position_has_changed, bool size_has_changed);
196
197 virtual Area* FindAreaUnderMouse(const Point& mouse_position, NuxEventType event_type);
198
199 virtual Area* FindKeyFocusArea(unsigned int key_symbol,
200 unsigned long x11_key_code,
201 unsigned long special_keys_state);
202207
203 Layout *view_layout_;208 Layout *view_layout_;
204209
205 bool draw_cmd_queued_; //<! The rendering of the view needs to be refreshed.210 bool draw_cmd_queued_; //<! The rendering of the view needs to be refreshed.
211 bool child_draw_cmd_queued_; //<! A child of this view has requested a draw.
206212
207 bool full_view_draw_cmd_; //<! True if Draw is called before ContentDraw. It is read-only and can be accessed by calling IsFullRedraw();213 bool full_view_draw_cmd_; //<! True if Draw is called before ContentDraw. It is read-only and can be accessed by calling IsFullRedraw();
208214
@@ -213,8 +219,10 @@
213 friend class Layout;219 friend class Layout;
214 friend class Area;220 friend class Area;
215 friend class LayeredLayout;221 friend class LayeredLayout;
222 friend class Canvas;
223 friend class VSplitter;
224 friend class HSplitter;
216 };225 };
217
218}226}
219227
220#endif // ABSTRACTOBJECTBASE_H228#endif // ABSTRACTOBJECTBASE_H
221229
=== modified file 'Nux/WindowCompositor.cpp'
--- Nux/WindowCompositor.cpp 2012-09-14 19:41:27 +0000
+++ Nux/WindowCompositor.cpp 2012-09-18 11:05:23 +0000
@@ -1428,8 +1428,8 @@
1428 }1428 }
14291429
1430 m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);1430 m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);
1431 m_FrameBufferObject->SetRenderTarget( 0, rt.color_rt->GetSurfaceLevel(0));1431 m_FrameBufferObject->SetTextureAttachment(0, rt.color_rt, 0);
1432 m_FrameBufferObject->SetDepthSurface( rt.depth_rt->GetSurfaceLevel(0));1432 m_FrameBufferObject->SetDepthTextureAttachment(rt.depth_rt, 0);
1433 m_FrameBufferObject->Activate();1433 m_FrameBufferObject->Activate();
1434 graphics_engine.SetViewport(0, 0, buffer_width, buffer_height);1434 graphics_engine.SetViewport(0, 0, buffer_width, buffer_height);
1435 graphics_engine.SetOrthographicProjectionMatrix(buffer_width, buffer_height);1435 graphics_engine.SetOrthographicProjectionMatrix(buffer_width, buffer_height);
@@ -1496,8 +1496,8 @@
1496 }1496 }
14971497
1498 m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);1498 m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);
1499 m_FrameBufferObject->SetRenderTarget(0, m_MainColorRT->GetSurfaceLevel(0));1499 m_FrameBufferObject->SetTextureAttachment(0, m_MainColorRT, 0);
1500 m_FrameBufferObject->SetDepthSurface(m_MainDepthRT->GetSurfaceLevel(0));1500 m_FrameBufferObject->SetDepthTextureAttachment(m_MainDepthRT, 0);
1501 m_FrameBufferObject->Activate();1501 m_FrameBufferObject->Activate();
15021502
1503 window_thread_->GetGraphicsEngine().EmptyClippingRegion();1503 window_thread_->GetGraphicsEngine().EmptyClippingRegion();
@@ -1573,8 +1573,8 @@
1573 nuxAssert(m_MainColorRT->GetWidth() == window_width);1573 nuxAssert(m_MainColorRT->GetWidth() == window_width);
1574 nuxAssert(m_MainColorRT->GetHeight() == window_height);1574 nuxAssert(m_MainColorRT->GetHeight() == window_height);
1575 m_FrameBufferObject->FormatFrameBufferObject(window_width, window_height, BITFMT_R8G8B8A8);1575 m_FrameBufferObject->FormatFrameBufferObject(window_width, window_height, BITFMT_R8G8B8A8);
1576 m_FrameBufferObject->SetRenderTarget( 0, m_MainColorRT->GetSurfaceLevel(0));1576 m_FrameBufferObject->SetTextureAttachment(0, m_MainColorRT, 0);
1577 m_FrameBufferObject->SetDepthSurface( m_MainDepthRT->GetSurfaceLevel(0));1577 m_FrameBufferObject->SetDepthTextureAttachment(m_MainDepthRT, 0);
1578 m_FrameBufferObject->Activate();1578 m_FrameBufferObject->Activate();
1579 }1579 }
1580 else1580 else
@@ -1923,8 +1923,8 @@
19231923
1924 // Clear the buffer the first time...1924 // Clear the buffer the first time...
1925 m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);1925 m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);
1926 m_FrameBufferObject->SetRenderTarget(0, m_MainColorRT->GetSurfaceLevel(0));1926 m_FrameBufferObject->SetTextureAttachment(0, m_MainColorRT, 0);
1927 m_FrameBufferObject->SetDepthSurface(m_MainDepthRT->GetSurfaceLevel(0));1927 m_FrameBufferObject->SetDepthTextureAttachment(m_MainDepthRT, 0);
1928 m_FrameBufferObject->Activate();1928 m_FrameBufferObject->Activate();
19291929
1930 CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f));1930 CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
@@ -1966,8 +1966,8 @@
1966 }1966 }
19671967
1968 m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);1968 m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);
1969 m_FrameBufferObject->SetRenderTarget(0, rt.color_rt->GetSurfaceLevel(0));1969 m_FrameBufferObject->SetTextureAttachment(0, rt.color_rt, 0);
1970 m_FrameBufferObject->SetDepthSurface(rt.depth_rt->GetSurfaceLevel(0));1970 m_FrameBufferObject->SetDepthTextureAttachment(rt.depth_rt, 0);
1971 m_FrameBufferObject->Activate();1971 m_FrameBufferObject->Activate();
19721972
1973 window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);1973 window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);
@@ -1984,8 +1984,8 @@
1984 nuxAssert(buffer_height >= 1);1984 nuxAssert(buffer_height >= 1);
1985 // Restore Main Frame Buffer1985 // Restore Main Frame Buffer
1986 m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);1986 m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);
1987 m_FrameBufferObject->SetRenderTarget(0, m_MainColorRT->GetSurfaceLevel(0));1987 m_FrameBufferObject->SetTextureAttachment(0, m_MainColorRT, 0);
1988 m_FrameBufferObject->SetDepthSurface(m_MainDepthRT->GetSurfaceLevel(0));1988 m_FrameBufferObject->SetDepthTextureAttachment(m_MainDepthRT, 0);
1989 m_FrameBufferObject->Activate();1989 m_FrameBufferObject->Activate();
19901990
1991 window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);1991 window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);
19921992
=== modified file 'Nux/WindowCompositor.h'
--- Nux/WindowCompositor.h 2012-09-03 18:39:58 +0000
+++ Nux/WindowCompositor.h 2012-09-18 11:05:23 +0000
@@ -23,7 +23,6 @@
23#ifndef WINDOWCOMPOSITOR_H23#ifndef WINDOWCOMPOSITOR_H
24#define WINDOWCOMPOSITOR_H24#define WINDOWCOMPOSITOR_H
2525
26#include "Features.h"
27#include "BaseWindow.h"26#include "BaseWindow.h"
2827
29#include <sigc++/trackable.h>28#include <sigc++/trackable.h>
3029
=== modified file 'Nux/WindowThread.cpp'
--- Nux/WindowThread.cpp 2012-08-02 17:46:47 +0000
+++ Nux/WindowThread.cpp 2012-09-18 11:05:23 +0000
@@ -19,7 +19,6 @@
19 *19 *
20 */20 */
2121
22#include "Features.h"
23#include "Nux.h"22#include "Nux.h"
24#include "Layout.h"23#include "Layout.h"
25#include "NuxCore/Logger.h"24#include "NuxCore/Logger.h"
2625
=== modified file 'Nux/WindowThread.h'
--- Nux/WindowThread.h 2012-05-31 21:40:37 +0000
+++ Nux/WindowThread.h 2012-09-18 11:05:23 +0000
@@ -24,7 +24,6 @@
24#define WINDOWTHREAD_H24#define WINDOWTHREAD_H
2525
26#include "TimerProc.h"26#include "TimerProc.h"
27#include "Features.h"
2827
29#ifdef NUX_GESTURES_SUPPORT28#ifdef NUX_GESTURES_SUPPORT
30#include "GeisAdapter.h"29#include "GeisAdapter.h"
3130
=== modified file 'NuxCore/Animation.cpp'
--- NuxCore/Animation.cpp 2012-07-13 04:58:08 +0000
+++ NuxCore/Animation.cpp 2012-09-18 11:05:23 +0000
@@ -20,8 +20,9 @@
20 *20 *
21 */21 */
2222
23#include <Animation.h>23#include "NuxCore.h"
24#include <AnimationController.h>24#include "Animation.h"
25#include "AnimationController.h"
2526
26namespace na = nux::animation;27namespace na = nux::animation;
2728
2829
=== modified file 'NuxCore/AnimationController.cpp'
--- NuxCore/AnimationController.cpp 2012-07-13 04:58:08 +0000
+++ NuxCore/AnimationController.cpp 2012-09-18 11:05:23 +0000
@@ -20,6 +20,7 @@
20 *20 *
21 */21 */
2222
23#include "NuxCore.h"
23#include "AnimationController.h"24#include "AnimationController.h"
24#include "Animation.h"25#include "Animation.h"
2526
2627
=== modified file 'NuxCore/AnimationController.h'
--- NuxCore/AnimationController.h 2012-07-12 23:55:40 +0000
+++ NuxCore/AnimationController.h 2012-09-18 11:05:23 +0000
@@ -59,8 +59,13 @@
59 virtual void RemoveAnimation(Animation* animation) = 0;59 virtual void RemoveAnimation(Animation* animation) = 0;
6060
61private:61private:
62#if defined(NUX_OS_WINDOWS) && !defined(NUX_VISUAL_STUDIO_VC11)
63 Controller(Controller const&);
64 Controller& operator = (Controller const&);
65#else
62 Controller(Controller const&) = delete;66 Controller(Controller const&) = delete;
63 Controller& operator=(Controller const&) = delete;67 Controller& operator = (Controller const&) = delete;
68#endif
64};69};
6570
66class AnimationController : public Controller, public sigc::trackable71class AnimationController : public Controller, public sigc::trackable
6772
=== modified file 'NuxCore/Color.cpp'
--- NuxCore/Color.cpp 2012-05-24 18:08:18 +0000
+++ NuxCore/Color.cpp 2012-09-18 11:05:23 +0000
@@ -139,7 +139,7 @@
139 return (((std::rand() % 255) << 24) |139 return (((std::rand() % 255) << 24) |
140 ((std::rand() % 255) << 16) |140 ((std::rand() % 255) << 16) |
141 ((std::rand() % 255) << 8) |141 ((std::rand() % 255) << 8) |
142 (std::rand() % 255));142 (255));
143 }143 }
144144
145 Color operator + (Color const& lhs, Color const& rhs)145 Color operator + (Color const& lhs, Color const& rhs)
146146
=== modified file 'NuxCore/EasingCurve.cpp'
--- NuxCore/EasingCurve.cpp 2012-07-17 04:01:54 +0000
+++ NuxCore/EasingCurve.cpp 2012-09-18 11:05:23 +0000
@@ -20,6 +20,7 @@
20 *20 *
21 */21 */
2222
23#include "NuxCore.h"
23#include "EasingCurve.h"24#include "EasingCurve.h"
2425
25namespace na = nux::animation;26namespace na = nux::animation;
@@ -122,6 +123,15 @@
122 return in_out(progress, bounce_out);123 return in_out(progress, bounce_out);
123}124}
124125
126double expo_ease_in(double progress)
127{
128 return (progress == 0) ? 0.0 : 1.0 * std::pow (2, 10 * (progress / 1.0 - 1) ) + 0.0;
129}
130
131double expo_ease_out(double progress)
132{
133 return reverse(progress, expo_ease_in);
134}
125135
126na::EasingCurve::EasingFunction GetEasingFunction(na::EasingCurve::Type type)136na::EasingCurve::EasingFunction GetEasingFunction(na::EasingCurve::Type type)
127{137{
@@ -145,6 +155,10 @@
145 return bounce_out;155 return bounce_out;
146 case na::EasingCurve::Type::BounceInOut:156 case na::EasingCurve::Type::BounceInOut:
147 return bounce_in_out;157 return bounce_in_out;
158 case na::EasingCurve::Type::ExpoEaseIn:
159 return expo_ease_in;
160 case na::EasingCurve::Type::ExpoEaseOut:
161 return expo_ease_out;
148 case na::EasingCurve::Type::Linear:162 case na::EasingCurve::Type::Linear:
149 default:163 default:
150 return linear;164 return linear;
151165
=== modified file 'NuxCore/EasingCurve.h'
--- NuxCore/EasingCurve.h 2012-07-17 04:01:54 +0000
+++ NuxCore/EasingCurve.h 2012-09-18 11:05:23 +0000
@@ -31,7 +31,11 @@
31class EasingCurve31class EasingCurve
32{32{
33public:33public:
34#if defined(NUX_OS_WINDOWS) && !defined(NUX_VISUAL_STUDIO_VC11)
35 enum Type
36#else
34 enum class Type37 enum class Type
38#endif
35 {39 {
36 Linear,40 Linear,
37 InQuad,41 InQuad,
@@ -43,6 +47,8 @@
43 BounceIn,47 BounceIn,
44 BounceOut,48 BounceOut,
45 BounceInOut,49 BounceInOut,
50 ExpoEaseIn,
51 ExpoEaseOut
46 };52 };
4753
48 typedef double (*EasingFunction)(double);54 typedef double (*EasingFunction)(double);
4955
=== modified file 'NuxGraphics/GLWindowManager.cpp'
--- NuxGraphics/GLWindowManager.cpp 2011-10-19 20:32:38 +0000
+++ NuxGraphics/GLWindowManager.cpp 2012-09-18 11:05:23 +0000
@@ -99,7 +99,7 @@
99 GraphicsDisplay *DisplayAccessController::CreateGLWindow(const char *WindowTitle, unsigned int WindowWidth, unsigned int WindowHeight,99 GraphicsDisplay *DisplayAccessController::CreateGLWindow(const char *WindowTitle, unsigned int WindowWidth, unsigned int WindowHeight,
100 WindowStyle Style,100 WindowStyle Style,
101 GraphicsDisplay *GLWindow,101 GraphicsDisplay *GLWindow,
102 bool FullscreenFlag,102 bool fullscreen_flag,
103 bool create_rendering_data)103 bool create_rendering_data)
104 {104 {
105 if (GetGraphicsDisplay())105 if (GetGraphicsDisplay())
@@ -110,7 +110,7 @@
110 }110 }
111111
112 GraphicsDisplay *glwindow = new GraphicsDisplay();112 GraphicsDisplay *glwindow = new GraphicsDisplay();
113 glwindow->CreateOpenGLWindow(WindowTitle, WindowWidth, WindowHeight, Style, GLWindow, FullscreenFlag, create_rendering_data);113 glwindow->CreateOpenGLWindow(WindowTitle, WindowWidth, WindowHeight, Style, GLWindow, fullscreen_flag, create_rendering_data);
114114
115 return glwindow;115 return glwindow;
116 }116 }
117117
=== modified file 'NuxGraphics/GLWindowManager.h'
--- NuxGraphics/GLWindowManager.h 2011-10-19 20:32:38 +0000
+++ NuxGraphics/GLWindowManager.h 2012-09-18 11:05:23 +0000
@@ -49,12 +49,12 @@
49 @param WindowHeight Window height.49 @param WindowHeight Window height.
50 @param Style Window style.50 @param Style Window style.
51 @param parent The parent window.51 @param parent The parent window.
52 @param FullscreenFlag True to create a full screen window.52 @param fullscreen_flag True to create a full screen window.
53 @param create_rendering_data If true, then in GraphicsEngine, the system creates the OpenGL shaders and the font textures for the rendering.53 @param create_rendering_data If true, then in GraphicsEngine, the system creates the OpenGL shaders and the font textures for the rendering.
54 */54 */
55 GraphicsDisplay *CreateGLWindow(const char *WindowTitle, unsigned int WindowWidth, unsigned int WindowHeight, WindowStyle Style,55 GraphicsDisplay *CreateGLWindow(const char *WindowTitle, unsigned int WindowWidth, unsigned int WindowHeight, WindowStyle Style,
56 GraphicsDisplay *parent,56 GraphicsDisplay *parent,
57 bool FullscreenFlag = false,57 bool fullscreen_flag = false,
58 bool create_rendering_data = true);58 bool create_rendering_data = true);
5959
60#if defined(NUX_OS_WINDOWS)60#if defined(NUX_OS_WINDOWS)
6161
=== modified file 'NuxGraphics/GpuDevice.cpp'
--- NuxGraphics/GpuDevice.cpp 2012-04-10 21:14:18 +0000
+++ NuxGraphics/GpuDevice.cpp 2012-09-18 11:05:23 +0000
@@ -622,7 +622,7 @@
622 NUX_SAFE_DELETE(_gpu_render_states);622 NUX_SAFE_DELETE(_gpu_render_states);
623623
624 _FrameBufferObject.Release();624 _FrameBufferObject.Release();
625 _CurrentFrameBufferObject.Release();625 active_framebuffer_object_.Release();
626626
627 _PixelBufferArray.clear();627 _PixelBufferArray.clear();
628628
@@ -916,12 +916,30 @@
916916
917 void GpuDevice::SetCurrentFrameBufferObject(ObjectPtr<IOpenGLFrameBufferObject> fbo)917 void GpuDevice::SetCurrentFrameBufferObject(ObjectPtr<IOpenGLFrameBufferObject> fbo)
918 {918 {
919 _CurrentFrameBufferObject = fbo;919 active_framebuffer_object_ = fbo;
920 }920 }
921921
922 ObjectPtr<IOpenGLFrameBufferObject> GpuDevice::GetCurrentFrameBufferObject()922 ObjectPtr<IOpenGLFrameBufferObject> GpuDevice::GetCurrentFrameBufferObject()
923 {923 {
924 return _CurrentFrameBufferObject;924 return active_framebuffer_object_;
925 }
926
927 ObjectPtr<IOpenGLBaseTexture> GpuDevice::ActiveFboTextureAttachment(int color_attachment_index)
928 {
929 if (active_framebuffer_object_.IsValid())
930 {
931 return active_framebuffer_object_->TextureAttachment(color_attachment_index);
932 }
933 return ObjectPtr<IOpenGLBaseTexture>(0);
934 }
935
936 ObjectPtr<IOpenGLBaseTexture> GpuDevice::ActiveFboDepthTextureAttachment()
937 {
938 if (active_framebuffer_object_.IsValid())
939 {
940 return active_framebuffer_object_->DepthTextureAttachment();
941 }
942 return ObjectPtr<IOpenGLBaseTexture>(0);
925 }943 }
926944
927 void GpuDevice::DeactivateFrameBuffer()945 void GpuDevice::DeactivateFrameBuffer()
@@ -932,7 +950,7 @@
932 return;950 return;
933 }951 }
934952
935 _CurrentFrameBufferObject.Release();953 active_framebuffer_object_.Release();
936 CHECKGL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));954 CHECKGL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
937 CHECKGL(glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0));955 CHECKGL(glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0));
938 }956 }
@@ -944,6 +962,11 @@
944 , BitmapFormat PixelFormat962 , BitmapFormat PixelFormat
945 , NUX_FILE_LINE_DECL)963 , NUX_FILE_LINE_DECL)
946 {964 {
965 if ((Width <= 0) || (Height <= 0))
966 {
967 return ObjectPtr<IOpenGLBaseTexture>(0);
968 }
969
947 if (GetGpuInfo().Support_ARB_Texture_Non_Power_Of_Two())970 if (GetGpuInfo().Support_ARB_Texture_Non_Power_Of_Two())
948 {971 {
949 return CreateTexture(Width, Height, Levels, PixelFormat, NUX_FILE_LINE_PARAM);972 return CreateTexture(Width, Height, Levels, PixelFormat, NUX_FILE_LINE_PARAM);
950973
=== modified file 'NuxGraphics/GpuDevice.h'
--- NuxGraphics/GpuDevice.h 2012-08-02 15:38:08 +0000
+++ NuxGraphics/GpuDevice.h 2012-09-18 11:05:23 +0000
@@ -302,6 +302,12 @@
302 ObjectPtr<IOpenGLVertexDeclaration> CreateVertexDeclaration(302 ObjectPtr<IOpenGLVertexDeclaration> CreateVertexDeclaration(
303 const VERTEXELEMENT *pVertexElements);303 const VERTEXELEMENT *pVertexElements);
304304
305 //! Create an return an ObjectPtr that encapsulates OpenGL framebuffer object.
306 /*!
307 Create an return an ObjectPtr that encapsulates OpenGL framebuffer object.
308 This function has side effects. It will change the framebuffer object that
309 is set in the GPU.
310 */
305 ObjectPtr<IOpenGLFrameBufferObject> CreateFrameBufferObject();311 ObjectPtr<IOpenGLFrameBufferObject> CreateFrameBufferObject();
306312
307 ObjectPtr<IOpenGLShaderProgram> CreateShaderProgram();313 ObjectPtr<IOpenGLShaderProgram> CreateShaderProgram();
@@ -386,13 +392,16 @@
386 public:392 public:
387 void SetCurrentFrameBufferObject(ObjectPtr<IOpenGLFrameBufferObject> fbo);393 void SetCurrentFrameBufferObject(ObjectPtr<IOpenGLFrameBufferObject> fbo);
388 ObjectPtr<IOpenGLFrameBufferObject> GetCurrentFrameBufferObject();394 ObjectPtr<IOpenGLFrameBufferObject> GetCurrentFrameBufferObject();
395 ObjectPtr<IOpenGLBaseTexture> ActiveFboTextureAttachment(int color_attachment_index);
396 ObjectPtr<IOpenGLBaseTexture> ActiveFboDepthTextureAttachment();
397
389398
390 int GetOpenGLMajorVersion() const;399 int GetOpenGLMajorVersion() const;
391 int GetOpenGLMinorVersion() const;400 int GetOpenGLMinorVersion() const;
392 private:401 private:
393 // Default FrameBufferobject402 // Default FrameBufferobject
394 ObjectPtr<IOpenGLFrameBufferObject> _FrameBufferObject;403 ObjectPtr<IOpenGLFrameBufferObject> _FrameBufferObject;
395 ObjectPtr<IOpenGLFrameBufferObject> _CurrentFrameBufferObject;404 ObjectPtr<IOpenGLFrameBufferObject> active_framebuffer_object_;
396405
397 struct PixelBufferObject406 struct PixelBufferObject
398 {407 {
399408
=== modified file 'NuxGraphics/GpuDeviceTexture.cpp'
--- NuxGraphics/GpuDeviceTexture.cpp 2011-10-22 06:17:42 +0000
+++ NuxGraphics/GpuDeviceTexture.cpp 2012-09-18 11:05:23 +0000
@@ -56,6 +56,12 @@
56 , NUX_FILE_LINE_DECL56 , NUX_FILE_LINE_DECL
57 )57 )
58 {58 {
59 if ((Width <= 0) || (Height <= 0))
60 {
61 *ppTexture = NULL;
62 return 0;
63 }
64
59 // From : http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_non_power_of_two.txt65 // From : http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_non_power_of_two.txt
60 // The "floor" convention has a relatively straightforward way to66 // The "floor" convention has a relatively straightforward way to
61 // evaluate(with integer math) means to determine how many mipmap67 // evaluate(with integer math) means to determine how many mipmap
@@ -135,6 +141,11 @@
135 , NUX_FILE_LINE_DECL141 , NUX_FILE_LINE_DECL
136 )142 )
137 {143 {
144 if ((Width <= 0) || (Height <= 0))
145 {
146 *ppTexture = NULL;
147 return 0;
148 }
138149
139 // From : http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_non_power_of_two.txt150 // From : http://oss.sgi.com/projects/ogl-sample/registry/ARB/texture_non_power_of_two.txt
140 // The "floor" convention has a relatively straightforward way to151 // The "floor" convention has a relatively straightforward way to
141152
=== modified file 'NuxGraphics/GraphicsDisplayWin.cpp'
--- NuxGraphics/GraphicsDisplayWin.cpp 2012-08-02 17:46:47 +0000
+++ NuxGraphics/GraphicsDisplayWin.cpp 2012-09-18 11:05:23 +0000
@@ -105,20 +105,17 @@
105 HDC GraphicsDisplay::sMainDC = 0;105 HDC GraphicsDisplay::sMainDC = 0;
106106
107 GraphicsDisplay::GraphicsDisplay()107 GraphicsDisplay::GraphicsDisplay()
108 : event_(NULL)108 : gfx_interface_created_(false)
109 , m_GfxInterfaceCreated(false)109 , fullscreen_(false)
110 , m_fullscreen(false)110 , screen_bit_depth_(32)
111 , m_ScreenBitDepth(32)
112 , m_num_device_modes(0)
113 , m_index_of_current_mode(-1)
114 , m_DeviceFactory(0)111 , m_DeviceFactory(0)
115 , m_GraphicsContext(0)112 , m_GraphicsContext(0)
116 , m_Style(WINDOWSTYLE_NORMAL)113 , m_Style(WINDOWSTYLE_NORMAL)
117 , cursor_(0)114 , cursor_(0)
118 , m_PauseGraphicsRendering(false)115 , m_PauseGraphicsRendering(false)
119 , m_ParentWindow(0)116 , parent_window_(0)
120 , m_dwExStyle(0)117 , window_extended_style_(0)
121 , m_dwStyle(0)118 , window_style_(0)
122 , device_context_(NULL)119 , device_context_(NULL)
123 , wnd_handle_(NULL)120 , wnd_handle_(NULL)
124 {121 {
@@ -149,15 +146,14 @@
149146
150 inlSetThreadLocalStorage(_TLS_GraphicsDisplay, this);147 inlSetThreadLocalStorage(_TLS_GraphicsDisplay, this);
151148
152 m_GfxInterfaceCreated = false;149 gfx_interface_created_ = false;
153 event_ = new Event();
154 GetDisplayInfo();150 GetDisplayInfo();
155151
156 m_WindowSize.width = 0;152 window_size_.width = 0;
157 m_WindowSize.height = 0;153 window_size_.height = 0;
158154
159 // A window never starts in a minimized state.155 // A window never starts in a minimized state.
160 m_is_window_minimized = false;156 window_minimized_ = false;
161157
162 //_dnd_source_grab_active = false;158 //_dnd_source_grab_active = false;
163 _global_keyboard_grab_data = 0;159 _global_keyboard_grab_data = 0;
@@ -171,11 +167,7 @@
171 NUX_SAFE_DELETE( m_GraphicsContext );167 NUX_SAFE_DELETE( m_GraphicsContext );
172 NUX_SAFE_DELETE( m_DeviceFactory );168 NUX_SAFE_DELETE( m_DeviceFactory );
173169
174// NUX_SAFE_DELETE( m_WGLEWContext );
175// NUX_SAFE_DELETE( m_GLEWContext );
176
177 DestroyOpenGLWindow();170 DestroyOpenGLWindow();
178 NUX_SAFE_DELETE( event_ );
179171
180 inlSetThreadLocalStorage(_TLS_GraphicsDisplay, 0);172 inlSetThreadLocalStorage(_TLS_GraphicsDisplay, 0);
181173
@@ -216,7 +208,7 @@
216//---------------------------------------------------------------------------------------------------------208//---------------------------------------------------------------------------------------------------------
217 bool GraphicsDisplay::IsGfxInterfaceCreated()209 bool GraphicsDisplay::IsGfxInterfaceCreated()
218 {210 {
219 return m_GfxInterfaceCreated;211 return gfx_interface_created_;
220 }212 }
221213
222//---------------------------------------------------------------------------------------------------------214//---------------------------------------------------------------------------------------------------------
@@ -226,45 +218,42 @@
226 unsigned int WindowHeight,218 unsigned int WindowHeight,
227 WindowStyle Style,219 WindowStyle Style,
228 const GraphicsDisplay *Parent,220 const GraphicsDisplay *Parent,
229 bool FullscreenFlag,221 bool fullscreen_flag,
230 bool create_rendering_data)222 bool create_rendering_data)
231 {223 {
232 NScopeLock Scope(&CreateOpenGLWindow_CriticalSection);224 NScopeLock Scope(&CreateOpenGLWindow_CriticalSection);
233225
234 RECT WindowRect; // Grabs Rectangle Upper Left / Lower Right Values226 RECT WindowRect; // Grabs Rectangle Upper Left / Lower Right Values
235227
236 m_GfxInterfaceCreated = false;228 gfx_interface_created_ = false;
237229
238 // FIXME : put at the end230 // FIXME : put at the end
239 m_ViewportSize.width = WindowWidth;231 viewport_size_.width = WindowWidth;
240 m_ViewportSize.height = WindowHeight;232 viewport_size_.height = WindowHeight;
241 m_WindowSize.width = WindowWidth;233 window_size_.width = WindowWidth;
242 m_WindowSize.height = WindowHeight;234 window_size_.height = WindowHeight;
243235
244 // end of fixme236 // end of fixme
245237
246 WindowRect.left = (long) 0;238 WindowRect.left = (long) 0;
247 WindowRect.right = (long) m_ViewportSize.width;239 WindowRect.right = (long) viewport_size_.width;
248 WindowRect.top = (long) 0;240 WindowRect.top = (long) 0;
249 WindowRect.bottom = (long) m_ViewportSize.height;241 WindowRect.bottom = (long) viewport_size_.height;
250242
251 m_fullscreen = FullscreenFlag; // Set The Global Fullscreen Flag243 fullscreen_ = fullscreen_flag; // Set The Global Fullscreen Flag
252 m_index_of_current_mode = -1; // assume -1 if the mode is not fullscreen244
253245 if (fullscreen_) // Attempt Fullscreen Mode?
254
255 if (m_fullscreen) // Attempt Fullscreen Mode?
256 {246 {
257 // check if resolution is supported247 // check if resolution is supported
258 bool mode_supported = false;248 bool mode_supported = false;
259249
260 for (int num_modes = 0 ; num_modes < m_num_gfx_device_modes; num_modes++)250 for (int num_modes = 0 ; num_modes < m_num_gfx_device_modes; num_modes++)
261 {251 {
262 if ((m_gfx_device_modes[num_modes].width == m_ViewportSize.width)252 if ((m_gfx_device_modes[num_modes].width == viewport_size_.width)
263 && (m_gfx_device_modes[num_modes].height == m_ViewportSize.height)253 && (m_gfx_device_modes[num_modes].height == viewport_size_.height)
264 && (m_gfx_device_modes[num_modes].format == m_ScreenBitDepth))254 && (m_gfx_device_modes[num_modes].format == screen_bit_depth_))
265 {255 {
266 mode_supported = true;256 mode_supported = true;
267 m_index_of_current_mode = num_modes;
268 break;257 break;
269 }258 }
270 }259 }
@@ -274,16 +263,16 @@
274 if (inlWin32MessageBox(NULL, "Info", MBTYPE_Ok, MBICON_Information, MBMODAL_ApplicationModal,263 if (inlWin32MessageBox(NULL, "Info", MBTYPE_Ok, MBICON_Information, MBMODAL_ApplicationModal,
275 "The requested fullscreen mode is not supported by your monitor.\nUsing windowed mode instead.") == MBRES_Yes)264 "The requested fullscreen mode is not supported by your monitor.\nUsing windowed mode instead.") == MBRES_Yes)
276 {265 {
277 m_fullscreen = FALSE; // Windowed Mode Selected. Fullscreen = FALSE266 fullscreen_ = FALSE; // Windowed Mode Selected. Fullscreen = FALSE
278 }267 }
279 }268 }
280269
281 DEVMODE dmScreenSettings; // Device Mode270 DEVMODE dmScreenSettings; // Device Mode
282 memset(&dmScreenSettings, 0, sizeof(dmScreenSettings)); // Makes Sure Memory's Cleared271 memset(&dmScreenSettings, 0, sizeof(dmScreenSettings)); // Makes Sure Memory's Cleared
283 dmScreenSettings.dmSize = sizeof(dmScreenSettings); // Size Of The Devmode Structure272 dmScreenSettings.dmSize = sizeof(dmScreenSettings); // Size Of The Devmode Structure
284 dmScreenSettings.dmPelsWidth = m_ViewportSize.width; // Selected Screen Width273 dmScreenSettings.dmPelsWidth = viewport_size_.width; // Selected Screen Width
285 dmScreenSettings.dmPelsHeight = m_ViewportSize.height; // Selected Screen Height274 dmScreenSettings.dmPelsHeight = viewport_size_.height; // Selected Screen Height
286 dmScreenSettings.dmBitsPerPel = m_ScreenBitDepth; // Selected Bits Per Pixel275 dmScreenSettings.dmBitsPerPel = screen_bit_depth_; // Selected Bits Per Pixel
287 dmScreenSettings.dmDisplayFrequency = 60;276 dmScreenSettings.dmDisplayFrequency = 60;
288 dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;277 dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
289278
@@ -293,7 +282,7 @@
293 if (inlWin32MessageBox(NULL, "Info", MBTYPE_Ok, MBICON_Information, MBMODAL_ApplicationModal,282 if (inlWin32MessageBox(NULL, "Info", MBTYPE_Ok, MBICON_Information, MBMODAL_ApplicationModal,
294 "The requested fullscreen mode is not supported by your monitor.\nUsing windowed mode instead.") == MBRES_Yes)283 "The requested fullscreen mode is not supported by your monitor.\nUsing windowed mode instead.") == MBRES_Yes)
295 {284 {
296 m_fullscreen = FALSE; // Windowed Mode Selected. Fullscreen = FALSE285 fullscreen_ = FALSE; // Windowed Mode Selected. Fullscreen = FALSE
297 }286 }
298 else287 else
299 {288 {
@@ -303,21 +292,21 @@
303 }292 }
304 }293 }
305294
306 m_dwExStyle = 0;295 window_extended_style_ = 0;
307 m_dwStyle = 0;296 window_style_ = 0;
308297
309 if (m_fullscreen) // Are We Still In Fullscreen Mode?298 if (fullscreen_) // Are We Still In Fullscreen Mode?
310 {299 {
311 m_dwExStyle = WS_EX_APPWINDOW; // Window Extended Style300 window_extended_style_ = WS_EX_APPWINDOW; // Window Extended Style
312 m_dwStyle = WS_POPUP; // Windows Style301 window_style_ = WS_POPUP; // Windows Style
313 ShowCursor(FALSE); // Hide Mouse Pointer302 ShowCursor(FALSE); // Hide Mouse Pointer
314 }303 }
315 else304 else
316 {305 {
317 // Window Extended Style306 // Window Extended Style
318 m_dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;307 window_extended_style_ = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
319 // Windows Style308 // Windows Style
320 m_dwStyle = WS_OVERLAPPED; // Creates an overlapped window. An overlapped window has a title bar and a border309 window_style_ = WS_OVERLAPPED; // Creates an overlapped window. An overlapped window has a title bar and a border
321310
322 // See Win32 Window Hierarchy and Styles: http://msdn.microsoft.com/en-us/library/ms997562.aspx311 // See Win32 Window Hierarchy and Styles: http://msdn.microsoft.com/en-us/library/ms997562.aspx
323312
@@ -333,31 +322,31 @@
333322
334 if (Style == WINDOWSTYLE_TOOL)323 if (Style == WINDOWSTYLE_TOOL)
335 {324 {
336 m_dwExStyle = WS_EX_TOOLWINDOW;325 window_extended_style_ = WS_EX_TOOLWINDOW;
337 m_dwStyle = WS_CAPTION | WS_SYSMENU;326 window_style_ = WS_CAPTION | WS_SYSMENU;
338 }327 }
339 else if (Style == WINDOWSTYLE_DIALOG)328 else if (Style == WINDOWSTYLE_DIALOG)
340 {329 {
341 m_dwExStyle = WS_EX_DLGMODALFRAME;330 window_extended_style_ = WS_EX_DLGMODALFRAME;
342 m_dwStyle = WS_CAPTION | WS_SYSMENU;331 window_style_ = WS_CAPTION | WS_SYSMENU;
343 }332 }
344 else if (Style == WINDOWSTYLE_NOBORDER)333 else if (Style == WINDOWSTYLE_NOBORDER)
345 {334 {
346 m_dwExStyle = WS_EX_TOPMOST | WS_EX_TOOLWINDOW;335 window_extended_style_ = WS_EX_TOPMOST | WS_EX_TOOLWINDOW;
347 m_dwStyle = WS_POPUP;336 window_style_ = WS_POPUP;
348 }337 }
349 else if (Style == WINDOWSTYLE_PANEL)338 else if (Style == WINDOWSTYLE_PANEL)
350 {339 {
351 m_dwExStyle = 0; // Specifies that a window has a border with a raised edge340 window_extended_style_ = 0; // Specifies that a window has a border with a raised edge
352 m_dwStyle = WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SIZEBOX;341 window_style_ = WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SIZEBOX;
353 }342 }
354 else343 else
355 {344 {
356 // Normal Window: NormalWindow345 // Normal Window: NormalWindow
357 m_dwExStyle = WS_EX_APPWINDOW | // Forces a top-level window onto the taskbar when the window is visible346 window_extended_style_ = WS_EX_APPWINDOW | // Forces a top-level window onto the taskbar when the window is visible
358 WS_EX_WINDOWEDGE; // Specifies that a window has a border with a raised edge347 WS_EX_WINDOWEDGE; // Specifies that a window has a border with a raised edge
359348
360 m_dwStyle |= WS_CAPTION | // Creates a window that has a title bar.349 window_style_ |= WS_CAPTION | // Creates a window that has a title bar.
361 WS_SYSMENU | // Creates a window that has a window menu on its title bar. The WS_CAPTION style must also be specified.350 WS_SYSMENU | // Creates a window that has a window menu on its title bar. The WS_CAPTION style must also be specified.
362 WS_THICKFRAME | // Creates a window that has a sizing border.351 WS_THICKFRAME | // Creates a window that has a sizing border.
363 WS_MINIMIZEBOX | // Creates a window that has a minimize button.352 WS_MINIMIZEBOX | // Creates a window that has a minimize button.
@@ -368,7 +357,7 @@
368 // The AdjustWindowRectEx function calculates the required size of the window rectangle,357 // The AdjustWindowRectEx function calculates the required size of the window rectangle,
369 // based on the desired size of the client rectangle. The window rectangle can then be passed to358 // based on the desired size of the client rectangle. The window rectangle can then be passed to
370 // the CreateWindowEx function to create a window whose client area is the desired size.359 // the CreateWindowEx function to create a window whose client area is the desired size.
371 AdjustWindowRectEx(&WindowRect, m_dwStyle, FALSE, m_dwExStyle); // Adjust Window To True Requested Size360 AdjustWindowRectEx(&WindowRect, window_style_, FALSE, window_extended_style_); // Adjust Window To True Requested Size
372361
373 RECT rect;362 RECT rect;
374 rect.top = 0;363 rect.top = 0;
@@ -380,8 +369,8 @@
380369
381 if (Parent)370 if (Parent)
382 {371 {
383 m_ParentWindow = Parent->GetWindowHandle();372 parent_window_ = Parent->GetWindowHandle();
384 GetWindowRect(m_ParentWindow, &rect);373 GetWindowRect(parent_window_, &rect);
385374
386 int width = rect.right - rect.left;375 int width = rect.right - rect.left;
387 int height = rect.bottom - rect.top;376 int height = rect.bottom - rect.top;
@@ -389,29 +378,29 @@
389 WindowX = rect.left + (width - (WindowRect.right - WindowRect.left)) / 2;378 WindowX = rect.left + (width - (WindowRect.right - WindowRect.left)) / 2;
390 WindowY = rect.top + (height - (WindowRect.bottom - WindowRect.top)) / 2;379 WindowY = rect.top + (height - (WindowRect.bottom - WindowRect.top)) / 2;
391 }380 }
392 else if (!m_fullscreen)381 else if (!fullscreen_)
393 {382 {
394 ClipOrCenterRectToMonitor(&rect, 0);383 ClipOrCenterRectToMonitor(&rect, 0);
395 WindowX = rect.left;384 WindowX = rect.left;
396 WindowY = rect.top;385 WindowY = rect.top;
397 }386 }
398387
399 m_WindowTitle = WindowTitle;388 window_title_ = WindowTitle;
400389
401 // Create The Window390 // Create The Window
402 if (! (wnd_handle_ = ::CreateWindowEx(m_dwExStyle, // Extended Style For The Window391 if (! (wnd_handle_ = ::CreateWindowEx(window_extended_style_, // Extended Style For The Window
403 WINDOW_CLASS_NAME, // Class Name392 WINDOW_CLASS_NAME, // Class Name
404 m_WindowTitle.GetTCharPtr(), // Window Title393 window_title_.c_str(), // Window Title
405 m_dwStyle | // Defined Window Style394 window_style_ | // Defined Window Style
406 WS_CLIPSIBLINGS | // Required Window Style395 WS_CLIPSIBLINGS | // Required Window Style
407 WS_CLIPCHILDREN, // Required Window Style396 WS_CLIPCHILDREN, // Required Window Style
408 WindowX, WindowY, // Window Position397 WindowX, WindowY, // Window Position
409 WindowRect.right - WindowRect.left, // Calculate Window Width398 WindowRect.right - WindowRect.left, // Calculate Window Width
410 WindowRect.bottom - WindowRect.top, // Calculate Window Height399 WindowRect.bottom - WindowRect.top, // Calculate Window Height
411 m_ParentWindow, // No Parent Window400 parent_window_, // No Parent Window
412 NULL, // No Menu401 NULL, // No Menu
413 gGLWindowManager.GetInstance(), // Instance402 gGLWindowManager.GetInstance(), // Instance
414 NULL))) // Dont Pass Anything To WM_CREATE403 NULL))) // Don't Pass Anything To WM_CREATE
415 {404 {
416 DestroyOpenGLWindow();405 DestroyOpenGLWindow();
417 MessageBox(NULL, "Window Creation Error.", "ERROR", MB_OK | MB_ICONERROR);406 MessageBox(NULL, "Window Creation Error.", "ERROR", MB_OK | MB_ICONERROR);
@@ -486,14 +475,14 @@
486 return FALSE;475 return FALSE;
487 }476 }
488477
489 if (! (m_PixelFormat = ChoosePixelFormat(device_context_, &pfd))) // Did Windows Find A Matching Pixel Format?478 if (! (pixel_format_ = ChoosePixelFormat(device_context_, &pfd))) // Did Windows Find A Matching Pixel Format?
490 {479 {
491 DestroyOpenGLWindow();480 DestroyOpenGLWindow();
492 MessageBox(NULL, "Can't Find A Suitable PixelFormat.", "ERROR", MB_OK | MB_ICONERROR);481 MessageBox(NULL, "Can't Find A Suitable PixelFormat.", "ERROR", MB_OK | MB_ICONERROR);
493 return FALSE;482 return FALSE;
494 }483 }
495484
496 if (!SetPixelFormat(device_context_, m_PixelFormat, &pfd)) // Are We Able To Set The Pixel Format?485 if (!SetPixelFormat(device_context_, pixel_format_, &pfd)) // Are We Able To Set The Pixel Format?
497 {486 {
498 DestroyOpenGLWindow();487 DestroyOpenGLWindow();
499 MessageBox(NULL, "Can't Set The PixelFormat.", "ERROR", MB_OK | MB_ICONERROR);488 MessageBox(NULL, "Can't Set The PixelFormat.", "ERROR", MB_OK | MB_ICONERROR);
@@ -540,13 +529,13 @@
540 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);529 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
541 SwapBuffer();530 SwapBuffer();
542531
543 m_GfxInterfaceCreated = true;532 gfx_interface_created_ = true;
544533
545 //m_GLEWContext = new GLEWContext();534 //m_GLEWContext = new GLEWContext();
546 //m_WGLEWContext = new WGLEWContext();535 //m_WGLEWContext = new WGLEWContext();
547536
548 HGLRC new_opengl_rendering_context = opengl_rendering_context_;537 HGLRC new_opengl_rendering_context = opengl_rendering_context_;
549 m_DeviceFactory = new GpuDevice(m_ViewportSize.width, m_ViewportSize.height, BITFMT_R8G8B8A8,538 m_DeviceFactory = new GpuDevice(viewport_size_.width, viewport_size_.height, BITFMT_R8G8B8A8,
550 device_context_,539 device_context_,
551 new_opengl_rendering_context,540 new_opengl_rendering_context,
552 1, 0, false);541 1, 0, false);
@@ -579,13 +568,13 @@
579568
580 RECT rect;569 RECT rect;
581 ::GetClientRect(wnd_handle_, &rect);570 ::GetClientRect(wnd_handle_, &rect);
582 m_WindowSize = Size(rect.right - rect.left, rect.bottom - rect.top);571 window_size_ = Size(rect.right - rect.left, rect.bottom - rect.top);
583 m_ViewportSize = Size(rect.right - rect.left, rect.bottom - rect.top);572 viewport_size_ = Size(rect.right - rect.left, rect.bottom - rect.top);
584573
585 // The opengl context should be made current by an external entity.574 // The opengl context should be made current by an external entity.
586575
587 m_GfxInterfaceCreated = true;576 gfx_interface_created_ = true;
588 m_DeviceFactory = new GpuDevice(m_ViewportSize.width, m_ViewportSize.height, BITFMT_R8G8B8A8,577 m_DeviceFactory = new GpuDevice(viewport_size_.width, viewport_size_.height, BITFMT_R8G8B8A8,
589 device_context_,578 device_context_,
590 opengl_rendering_context_);579 opengl_rendering_context_);
591580
@@ -616,28 +605,28 @@
616//---------------------------------------------------------------------------------------------------------605//---------------------------------------------------------------------------------------------------------
617 void GraphicsDisplay::GetWindowSize(int &w, int &h)606 void GraphicsDisplay::GetWindowSize(int &w, int &h)
618 {607 {
619 w = m_WindowSize.width;608 w = window_size_.width;
620 h = m_WindowSize.height;609 h = window_size_.height;
621 }610 }
622611
623//---------------------------------------------------------------------------------------------------------612//---------------------------------------------------------------------------------------------------------
624 int GraphicsDisplay::GetWindowWidth()613 int GraphicsDisplay::GetWindowWidth()
625 {614 {
626 return m_WindowSize.width;615 return window_size_.width;
627 }616 }
628617
629//---------------------------------------------------------------------------------------------------------618//---------------------------------------------------------------------------------------------------------
630 int GraphicsDisplay::GetWindowHeight()619 int GraphicsDisplay::GetWindowHeight()
631 {620 {
632 return m_WindowSize.height;621 return window_size_.height;
633 }622 }
634623
635 void GraphicsDisplay::ResetWindowSize()624 void GraphicsDisplay::ResetWindowSize()
636 {625 {
637 RECT rect;626 RECT rect;
638 ::GetClientRect(wnd_handle_, &rect);627 ::GetClientRect(wnd_handle_, &rect);
639 m_WindowSize = Size(rect.right - rect.left, rect.bottom - rect.top);628 window_size_ = Size(rect.right - rect.left, rect.bottom - rect.top);
640 m_ViewportSize = Size(rect.right - rect.left, rect.bottom - rect.top);629 viewport_size_ = Size(rect.right - rect.left, rect.bottom - rect.top);
641 }630 }
642631
643//---------------------------------------------------------------------------------------------------------632//---------------------------------------------------------------------------------------------------------
@@ -651,7 +640,7 @@
651 new_rect.right = width;640 new_rect.right = width;
652 new_rect.top = 0;641 new_rect.top = 0;
653 new_rect.bottom = height;642 new_rect.bottom = height;
654 BOOL b = ::AdjustWindowRectEx(&new_rect, m_dwStyle, FALSE, m_dwExStyle); // Adjust Window To True Requested Size643 BOOL b = ::AdjustWindowRectEx(&new_rect, window_style_, FALSE, window_extended_style_); // Adjust Window To True Requested Size
655644
656 ::MoveWindow(wnd_handle_,645 ::MoveWindow(wnd_handle_,
657 window_rect.left,646 window_rect.left,
@@ -666,11 +655,11 @@
666 {655 {
667 if (IsGfxInterfaceCreated())656 if (IsGfxInterfaceCreated())
668 {657 {
669 //do not rely on m_ViewportSize: glViewport can be called directly658 //do not rely on viewport_size_: glViewport can be called directly
670 m_ViewportSize.width = width;659 viewport_size_.width = width;
671 m_ViewportSize.height = height;660 viewport_size_.height = height;
672661
673 m_GraphicsContext->SetViewport(x, y, m_ViewportSize.width, m_ViewportSize.height);662 m_GraphicsContext->SetViewport(x, y, viewport_size_.width, viewport_size_.height);
674 m_GraphicsContext->SetScissor(0, 0, width, height);663 m_GraphicsContext->SetScissor(0, 0, width, height);
675 }664 }
676 }665 }
@@ -767,9 +756,9 @@
767//---------------------------------------------------------------------------------------------------------756//---------------------------------------------------------------------------------------------------------
768 void GraphicsDisplay::DestroyOpenGLWindow()757 void GraphicsDisplay::DestroyOpenGLWindow()
769 {758 {
770 if (m_GfxInterfaceCreated == true)759 if (gfx_interface_created_ == true)
771 {760 {
772 if (m_fullscreen) // Are We In Fullscreen Mode?761 if (fullscreen_) // Are We In Fullscreen Mode?
773 {762 {
774 ChangeDisplaySettings(NULL, 0); // If So Switch Back To The Desktop763 ChangeDisplaySettings(NULL, 0); // If So Switch Back To The Desktop
775 ShowCursor(TRUE); // Show Mouse Pointer764 ShowCursor(TRUE); // Show Mouse Pointer
@@ -803,7 +792,7 @@
803 wnd_handle_ = NULL; // Set Window Handle To NULL792 wnd_handle_ = NULL; // Set Window Handle To NULL
804 }793 }
805794
806 m_GfxInterfaceCreated = false;795 gfx_interface_created_ = false;
807 }796 }
808797
809798
@@ -902,26 +891,26 @@
902 return extended ? extendedlut[vk] : vklut[vk];891 return extended ? extendedlut[vk] : vklut[vk];
903 }*/892 }*/
904//---------------------------------------------------------------------------------------------------------893//---------------------------------------------------------------------------------------------------------
905 static int mouse_event(HWND window, Event *event, int what, int button,894 static int InspectMouseEvent(HWND window, Event& event, int what, int button,
906 WPARAM wParam, LPARAM lParam)895 WPARAM wParam, LPARAM lParam)
907 {896 {
908 static int pmx, pmy;897 static int pmx, pmy;
909 event->x = (signed short) LOWORD(lParam);898 event.x = (signed short) LOWORD(lParam);
910 event->y = (signed short) HIWORD(lParam);899 event.y = (signed short) HIWORD(lParam);
911 event->x_root = 0;900 event.x_root = 0;
912 event->y_root = 0;901 event.y_root = 0;
913902
914 POINT EventScreenPosition;903 POINT EventScreenPosition;
915904
916 ClientToScreen(window, &EventScreenPosition);905 ClientToScreen(window, &EventScreenPosition);
917 EventScreenPosition.x = event->x;906 EventScreenPosition.x = event.x;
918 EventScreenPosition.y = event->y;907 EventScreenPosition.y = event.y;
919 POINT WindowScreenPosition;908 POINT WindowScreenPosition;
920 WindowScreenPosition.x = WindowScreenPosition.y = 0;909 WindowScreenPosition.x = WindowScreenPosition.y = 0;
921 ClientToScreen(window, &WindowScreenPosition);910 ClientToScreen(window, &WindowScreenPosition);
922911
923 // Erase mouse event and mouse doubleclick events. Keep the mouse states.912 // Erase mouse event and mouse doubleclick events. Keep the mouse states.
924 ulong _mouse_state = event->mouse_state & 0x0F000000;913 ulong _mouse_state = event.mouse_state & 0x0F000000;
925914
926 // establish cause of the event915 // establish cause of the event
927// if (button == 1)916// if (button == 1)
@@ -933,16 +922,16 @@
933// else922// else
934 if (button == 4)923 if (button == 4)
935 {924 {
936 event->mouse_state |= NUX_EVENT_MOUSEWHEEL;925 event.mouse_state |= NUX_EVENT_MOUSEWHEEL;
937 event->type = NUX_MOUSE_WHEEL;926 event.type = NUX_MOUSE_WHEEL;
938927
939 int zDelta = GET_WHEEL_DELTA_WPARAM(wParam);928 int zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
940 int xPos = (int) (short) LOWORD(lParam) - WindowScreenPosition.x;929 int xPos = (int) (short) LOWORD(lParam) - WindowScreenPosition.x;
941 int yPos = (int) (short) HIWORD(lParam) - WindowScreenPosition.y;930 int yPos = (int) (short) HIWORD(lParam) - WindowScreenPosition.y;
942 event->x = xPos;931 event.x = xPos;
943 event->y = yPos;932 event.y = yPos;
944933
945 event->wheel_delta = zDelta;934 event.wheel_delta = zDelta;
946 return 1;935 return 1;
947 }936 }
948937
@@ -1016,39 +1005,39 @@
1016 break;1005 break;
1017 }1006 }
10181007
1019 event->mouse_state = _mouse_state;1008 event.mouse_state = _mouse_state;
10201009
1021 switch(what)1010 switch(what)
1022 {1011 {
1023 static int px, py;1012 static int px, py;
1024 case 1: // double-click1013 case 1: // double-click
10251014
1026 if (event->is_click)1015 if (event.is_click)
1027 {1016 {
1028 event->clicks++;1017 event.clicks++;
1029 // The SetCapture function sets the mouse capture to the specified window belonging to1018 // The SetCapture function sets the mouse capture to the specified window belonging to
1030 // the current thread. SetCapture captures mouse input either when the mouse is over the1019 // the current thread. SetCapture captures mouse input either when the mouse is over the
1031 // capturing window, or when the mouse button was pressed while the mouse was over the1020 // capturing window, or when the mouse button was pressed while the mouse was over the
1032 // capturing window and the button is still down. Only one window at a time can capture the mouse.1021 // capturing window and the button is still down. Only one window at a time can capture the mouse.
1033 SetCapture(window);1022 SetCapture(window);
1034 event->is_click = 1;1023 event.is_click = 1;
1035 px = pmx = event->x;1024 px = pmx = event.x;
1036 py = pmy = event->y;1025 py = pmy = event.y;
1037 event->type = NUX_MOUSE_DOUBLECLICK;1026 event.type = NUX_MOUSE_DOUBLECLICK;
1038 return 1;1027 return 1;
1039 }1028 }
10401029
1041 case 0: // single-click1030 case 0: // single-click
1042 event->clicks = 0;1031 event.clicks = 0;
1043 // The SetCapture function sets the mouse capture to the specified window belonging to1032 // The SetCapture function sets the mouse capture to the specified window belonging to
1044 // the current thread. SetCapture captures mouse input either when the mouse is over the1033 // the current thread. SetCapture captures mouse input either when the mouse is over the
1045 // capturing window, or when the mouse button was pressed while the mouse was over the1034 // capturing window, or when the mouse button was pressed while the mouse was over the
1046 // capturing window and the button is still down. Only one window at a time can capture the mouse.1035 // capturing window and the button is still down. Only one window at a time can capture the mouse.
1047 SetCapture(window);1036 SetCapture(window);
1048 event->is_click = 1;1037 event.is_click = 1;
1049 px = pmx = event->x;1038 px = pmx = event.x;
1050 py = pmy = event->y;1039 py = pmy = event.y;
1051 event->type = NUX_MOUSE_PRESSED;1040 event.type = NUX_MOUSE_PRESSED;
1052 return 1;1041 return 1;
10531042
1054 case 2: // release:1043 case 2: // release:
@@ -1057,21 +1046,21 @@
1057 // mouse input, regardless of the position of the cursor, except when a mouse button is clicked1046 // mouse input, regardless of the position of the cursor, except when a mouse button is clicked
1058 // while the cursor hot spot is in the window of another thread.1047 // while the cursor hot spot is in the window of another thread.
1059 ReleaseCapture();1048 ReleaseCapture();
1060 event->type = NUX_MOUSE_RELEASED;1049 event.type = NUX_MOUSE_RELEASED;
1061 return 1;1050 return 1;
10621051
1063 case 3: // move:1052 case 3: // move:
1064 default: // avoid compiler warning1053 default: // avoid compiler warning
1065 // MSWindows produces extra events even if mouse does not move, ignore them.1054 // MSWindows produces extra events even if mouse does not move, ignore them.
1066 // http://blogs.msdn.com/oldnewthing/archive/2003/10/01/55108.aspx: Why do I get spurious WM_MOUSEMOVE messages?1055 // http://blogs.msdn.com/oldnewthing/archive/2003/10/01/55108.aspx: Why do I get spurious WM_MOUSEMOVE messages?
1067 if (event->x == pmx && event->y == pmy)1056 if (event.x == pmx && event.y == pmy)
1068 return 1;1057 return 1;
10691058
1070 pmx = event->x;1059 pmx = event.x;
1071 pmy = event->y;1060 pmy = event.y;
1072// if (abs(event->x - px)>5 || abs(event->y - py)>5)1061// if (abs(event.x - px)>5 || abs(event.y - py)>5)
1073// event->is_click = 0;1062// event.is_click = 0;
1074 event->type = NUX_MOUSE_MOVE;1063 event.type = NUX_MOUSE_MOVE;
1075 return 1;1064 return 1;
1076 }1065 }
10771066
@@ -1131,12 +1120,12 @@
1131 }1120 }
11321121
1133//---------------------------------------------------------------------------------------------------------1122//---------------------------------------------------------------------------------------------------------
1134 bool GraphicsDisplay::GetSystemEvent(Event *evt)1123 bool GraphicsDisplay::GetSystemEvent(Event *event)
1135 {1124 {
1136 MSG msg;1125 MSG msg;
1137 event_->Reset();1126 event_.Reset();
1138 // Erase mouse event and mouse doubleclick states. Keep the mouse states.1127 // Erase mouse event and mouse doubleclick states. Keep the mouse states.
1139 event_->mouse_state &= 0x0F000000;1128 event_.mouse_state &= 0x0F000000;
1140 bool got_event;1129 bool got_event;
11411130
1142 // Always set the second parameter of PeekMessage to NULL. Indeed, many services creates1131 // Always set the second parameter of PeekMessage to NULL. Indeed, many services creates
@@ -1154,12 +1143,12 @@
1154 TranslateMessage(&msg);1143 TranslateMessage(&msg);
1155 DispatchMessage(&msg);1144 DispatchMessage(&msg);
11561145
1157 memcpy(evt, event_, sizeof(Event));1146 memcpy(event, &event_, sizeof(Event));
1158 got_event = true;1147 got_event = true;
1159 }1148 }
1160 else1149 else
1161 {1150 {
1162 memcpy(evt, event_, sizeof(Event));1151 memcpy(event, &event_, sizeof(Event));
1163 got_event = false;1152 got_event = false;
1164 }1153 }
11651154
@@ -1169,14 +1158,14 @@
1169 // See [Modality, part 3: The WM_QUIT message] http://blogs.msdn.com/oldnewthing/archive/2005/02/22/378018.aspx1158 // See [Modality, part 3: The WM_QUIT message] http://blogs.msdn.com/oldnewthing/archive/2005/02/22/378018.aspx
1170 PostQuitMessage(msg.wParam);1159 PostQuitMessage(msg.wParam);
11711160
1172 event_->type = NUX_TERMINATE_APP;1161 event_.type = NUX_TERMINATE_APP;
1173 memcpy(evt, event_, sizeof(Event));1162 memcpy(event, &event_, sizeof(Event));
1174 }1163 }
11751164
1176 if (msg.message == -1) // error1165 if (msg.message == -1) // error
1177 {1166 {
1178 event_->type = NUX_NO_EVENT;1167 event_.type = NUX_NO_EVENT;
1179 memcpy(evt, event_, sizeof(Event));1168 memcpy(event, &event_, sizeof(Event));
1180 }1169 }
11811170
1182 return got_event;1171 return got_event;
@@ -1184,16 +1173,16 @@
11841173
1185 void GraphicsDisplay::ProcessForeignWin32Event(HWND hWnd, MSG msg, WPARAM wParam, LPARAM lParam, Event *event)1174 void GraphicsDisplay::ProcessForeignWin32Event(HWND hWnd, MSG msg, WPARAM wParam, LPARAM lParam, Event *event)
1186 {1175 {
1187 event_->Reset();1176 event_.Reset();
1188 // Erase mouse event and mouse doubleclick states. Keep the mouse states.1177 // Erase mouse event and mouse doubleclick states. Keep the mouse states.
1189 event_->mouse_state &= 0x0F000000;1178 event_.mouse_state &= 0x0F000000;
11901179
1191 // Always set the second parameter of PeekMessage to NULL. Indeed, many services creates1180 // Always set the second parameter of PeekMessage to NULL. Indeed, many services creates
1192 // windows on the program behalf. If pass the main window as filter, we will miss all the1181 // windows on the program behalf. If pass the main window as filter, we will miss all the
1193 // messages from the other windows.1182 // messages from the other windows.
1194 // Same with GetMessage.1183 // Same with GetMessage.
1195 ProcessWin32Event(hWnd, msg.message, wParam, lParam);1184 ProcessWin32Event(hWnd, msg.message, wParam, lParam);
1196 memcpy(event, event_, sizeof(Event));1185 memcpy(event, &event_, sizeof(Event));
11971186
1198 if (msg.message != WM_QUIT)1187 if (msg.message != WM_QUIT)
1199 {1188 {
@@ -1201,20 +1190,20 @@
1201 // See [Modality, part 3: The WM_QUIT message] http://blogs.msdn.com/oldnewthing/archive/2005/02/22/378018.aspx1190 // See [Modality, part 3: The WM_QUIT message] http://blogs.msdn.com/oldnewthing/archive/2005/02/22/378018.aspx
1202 PostQuitMessage(msg.wParam);1191 PostQuitMessage(msg.wParam);
12031192
1204 event_->type = NUX_TERMINATE_APP;1193 event_.type = NUX_TERMINATE_APP;
1205 memcpy(event, event_, sizeof(Event));1194 memcpy(event, &event_, sizeof(Event));
1206 }1195 }
12071196
1208 if (msg.message == -1) // error1197 if (msg.message == -1) // error
1209 {1198 {
1210 event_->type = NUX_NO_EVENT;1199 event_.type = NUX_NO_EVENT;
1211 memcpy(event, event_, sizeof(Event));1200 memcpy(event, &event_, sizeof(Event));
1212 }1201 }
1213 }1202 }
12141203
1215 Event &GraphicsDisplay::GetCurrentEvent()1204 const Event& GraphicsDisplay::GetCurrentEvent() const
1216 {1205 {
1217 return *event_;1206 return event_;
1218 }1207 }
12191208
1220//---------------------------------------------------------------------------------------------------------1209//---------------------------------------------------------------------------------------------------------
@@ -1268,13 +1257,13 @@
1268 {1257 {
1269 case WM_DESTROY:1258 case WM_DESTROY:
1270 {1259 {
1271 nuxDebugMsg("[GraphicsDisplay::WndProc]: Window \"%s\" received WM_DESTROY message.", m_WindowTitle.GetTCharPtr());1260 nuxDebugMsg("[GraphicsDisplay::WndProc]: Window \"%s\" received WM_DESTROY message.", window_title_.c_str());
1272 break;1261 break;
1273 }1262 }
12741263
1275 case WM_CLOSE:1264 case WM_CLOSE:
1276 {1265 {
1277 nuxDebugMsg("[GraphicsDisplay::WndProc]: Window \"%s\" received WM_CLOSE message.", m_WindowTitle.GetTCharPtr());1266 nuxDebugMsg("[GraphicsDisplay::WndProc]: Window \"%s\" received WM_CLOSE message.", window_title_.c_str());
1278 // close? yes or no?1267 // close? yes or no?
1279 PostQuitMessage(0);1268 PostQuitMessage(0);
1280 return 0;1269 return 0;
@@ -1283,7 +1272,7 @@
1283 case WM_PAINT:1272 case WM_PAINT:
1284 {1273 {
1285 ValidateRect(hWnd, NULL); // validate the surface to avoid receiving WM_PAINT continuously1274 ValidateRect(hWnd, NULL); // validate the surface to avoid receiving WM_PAINT continuously
1286 event_->type = NUX_WINDOW_DIRTY;1275 event_.type = NUX_WINDOW_DIRTY;
1287 break;1276 break;
1288 }1277 }
12891278
@@ -1293,7 +1282,7 @@
1293 if ((HWND) lParam == hWnd)1282 if ((HWND) lParam == hWnd)
1294 {1283 {
1295 // Cancel everything about the mouse state and send a NUX_WINDOW_EXIT_FOCUS message.1284 // Cancel everything about the mouse state and send a NUX_WINDOW_EXIT_FOCUS message.
1296 event_->mouse_state = 0;1285 event_.mouse_state = 0;
1297 //nuxDebugMsg("Windows Msg: WM_CAPTURECHANGED/NUX_WINDOW_EXIT_FOCUS");1286 //nuxDebugMsg("Windows Msg: WM_CAPTURECHANGED/NUX_WINDOW_EXIT_FOCUS");
1298 return 0;1287 return 0;
1299 }1288 }
@@ -1311,9 +1300,9 @@
1311 RECT clientrect;1300 RECT clientrect;
1312 GetClientRect( hWnd, &clientrect);1301 GetClientRect( hWnd, &clientrect);
13131302
1314 event_->type = NUX_SIZE_CONFIGURATION;1303 event_.type = NUX_SIZE_CONFIGURATION;
1315 event_->width = clientrect.right - clientrect.left;1304 event_.width = clientrect.right - clientrect.left;
1316 event_->height = clientrect.bottom - clientrect.top;1305 event_.height = clientrect.bottom - clientrect.top;
1317 return 0;1306 return 0;
1318 }1307 }
13191308
@@ -1322,26 +1311,26 @@
1322 RECT clientrect;1311 RECT clientrect;
1323 GetClientRect( hWnd, &clientrect);1312 GetClientRect( hWnd, &clientrect);
13241313
1325 event_->type = NUX_NO_EVENT; //NUX_SIZE_CONFIGURATION;1314 event_.type = NUX_NO_EVENT; //NUX_SIZE_CONFIGURATION;
1326 event_->width = clientrect.right - clientrect.left;1315 event_.width = clientrect.right - clientrect.left;
1327 event_->height = clientrect.bottom - clientrect.top;1316 event_.height = clientrect.bottom - clientrect.top;
13281317
1329 //setViewPort(0, 0, clientrect.right - clientrect.left, clientrect.bottom - clientrect.top);1318 //setViewPort(0, 0, clientrect.right - clientrect.left, clientrect.bottom - clientrect.top);
1330 m_WindowSize.width = clientrect.right - clientrect.left;1319 window_size_.width = clientrect.right - clientrect.left;
1331 m_WindowSize.height = clientrect.bottom - clientrect.top;1320 window_size_.height = clientrect.bottom - clientrect.top;
13321321
1333 if ((wParam == SIZE_MAXHIDE) || (wParam == SIZE_MINIMIZED))1322 if ((wParam == SIZE_MAXHIDE) || (wParam == SIZE_MINIMIZED))
1334 {1323 {
1335 m_is_window_minimized = true;1324 window_minimized_ = true;
1336 }1325 }
1337 else1326 else
1338 {1327 {
1339 m_is_window_minimized = false;1328 window_minimized_ = false;
1340 }1329 }
13411330
1342 if ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED))1331 if ((wParam == SIZE_MAXIMIZED) || (wParam == SIZE_RESTORED))
1343 {1332 {
1344 event_->type = NUX_SIZE_CONFIGURATION;1333 event_.type = NUX_SIZE_CONFIGURATION;
1345 }1334 }
13461335
1347 return 0;1336 return 0;
@@ -1349,32 +1338,32 @@
13491338
1350 case WM_SETFOCUS:1339 case WM_SETFOCUS:
1351 {1340 {
1352 event_->type = NUX_WINDOW_ENTER_FOCUS;1341 event_.type = NUX_WINDOW_ENTER_FOCUS;
1353 event_->mouse_state = 0;1342 event_.mouse_state = 0;
13541343
1355 // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process().1344 // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process().
1356 // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be1345 // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be
1357 // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y.1346 // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y.
1358 event_->x = 0xFFFFFFFF;1347 event_.x = 0xFFFFFFFF;
1359 event_->y = 0xFFFFFFFF;1348 event_.y = 0xFFFFFFFF;
1360 event_->dx = 0;1349 event_.dx = 0;
1361 event_->dy = 0;1350 event_.dy = 0;
1362 event_->virtual_code = 0;1351 event_.virtual_code = 0;
1363 //nuxDebugMsg("Windows Msg: WM_SETFOCUS/NUX_WINDOW_ENTER_FOCUS");1352 //nuxDebugMsg("Windows Msg: WM_SETFOCUS/NUX_WINDOW_ENTER_FOCUS");
1364 break;1353 break;
1365 }1354 }
13661355
1367 case WM_KILLFOCUS:1356 case WM_KILLFOCUS:
1368 {1357 {
1369 event_->type = NUX_WINDOW_EXIT_FOCUS;1358 event_.type = NUX_WINDOW_EXIT_FOCUS;
1370 event_->mouse_state = 0;1359 event_.mouse_state = 0;
13711360
1372 // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process()1361 // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process()
1373 event_->x = 0xFFFFFFFF;1362 event_.x = 0xFFFFFFFF;
1374 event_->y = 0xFFFFFFFF;1363 event_.y = 0xFFFFFFFF;
1375 event_->dx = 0;1364 event_.dx = 0;
1376 event_->dy = 0;1365 event_.dy = 0;
1377 event_->virtual_code = 0;1366 event_.virtual_code = 0;
1378 //nuxDebugMsg("Windows Msg: WM_KILLFOCUS/NUX_WINDOW_EXIT_FOCUS");1367 //nuxDebugMsg("Windows Msg: WM_KILLFOCUS/NUX_WINDOW_EXIT_FOCUS");
1379 break;1368 break;
1380 }1369 }
@@ -1388,24 +1377,24 @@
1388 {1377 {
1389 if (LOWORD(wParam) != WA_INACTIVE)1378 if (LOWORD(wParam) != WA_INACTIVE)
1390 {1379 {
1391 event_->type = NUX_WINDOW_ENTER_FOCUS;1380 event_.type = NUX_WINDOW_ENTER_FOCUS;
1392 }1381 }
1393 else1382 else
1394 {1383 {
1395 event_->type = NUX_WINDOW_EXIT_FOCUS;1384 event_.type = NUX_WINDOW_EXIT_FOCUS;
1396 }1385 }
1397 event_->mouse_state = 0;1386 event_.mouse_state = 0;
13981387
1399 // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process().1388 // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process().
1400 // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be1389 // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be
1401 // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y.1390 // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y.
1402 event_->x = 0xFFFFFFFF;1391 event_.x = 0xFFFFFFFF;
1403 event_->y = 0xFFFFFFFF;1392 event_.y = 0xFFFFFFFF;
1404 event_->dx = 0;1393 event_.dx = 0;
1405 event_->dy = 0;1394 event_.dy = 0;
1406 event_->virtual_code = 0;1395 event_.virtual_code = 0;
14071396
1408 event_->key_modifiers = GetModifierKeyState();1397 event_.key_modifiers = GetModifierKeyState();
1409 return 0;1398 return 0;
1410 }1399 }
14111400
@@ -1413,48 +1402,48 @@
1413 {1402 {
1414 if (wParam)1403 if (wParam)
1415 {1404 {
1416 event_->type = NUX_WINDOW_ENTER_FOCUS;1405 event_.type = NUX_WINDOW_ENTER_FOCUS;
1417 }1406 }
1418 else1407 else
1419 {1408 {
1420 event_->type = NUX_WINDOW_EXIT_FOCUS;1409 event_.type = NUX_WINDOW_EXIT_FOCUS;
1421 }1410 }
1422 event_->mouse_state = 0;1411 event_.mouse_state = 0;
14231412
1424 // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process().1413 // This causes the mouse to be outside of all widgets when it is tested in m_EventHandler.Process().
1425 // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be1414 // Because WM_SETFOCUS can happen with the mouse outside of the client area, we set x and y so that the mouse will be
1426 // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y.1415 // outside of all widgets. A subsequent mouse down or mouse move event will set the correct values for x and y.
1427 event_->x = 0xFFFFFFFF;1416 event_.x = 0xFFFFFFFF;
1428 event_->y = 0xFFFFFFFF;1417 event_.y = 0xFFFFFFFF;
1429 event_->dx = 0;1418 event_.dx = 0;
1430 event_->dy = 0;1419 event_.dy = 0;
1431 event_->virtual_code = 0;1420 event_.virtual_code = 0;
14321421
1433 event_->key_modifiers = GetModifierKeyState();1422 event_.key_modifiers = GetModifierKeyState();
1434 return 0;1423 return 0;
1435 }1424 }
14361425
1437 case WM_SYSKEYDOWN:1426 case WM_SYSKEYDOWN:
1438 case WM_KEYDOWN:1427 case WM_KEYDOWN:
1439 {1428 {
1440 event_->type = NUX_KEYDOWN;1429 event_.type = NUX_KEYDOWN;
1441 event_->key_modifiers = GetModifierKeyState();1430 event_.key_modifiers = GetModifierKeyState();
1442 event_->win32_keysym = wParam;1431 event_.win32_keysym = wParam;
14431432
1444 if ((uMsg == WM_KEYDOWN) || (uMsg == WM_SYSKEYDOWN))1433 if ((uMsg == WM_KEYDOWN) || (uMsg == WM_SYSKEYDOWN))
1445 {1434 {
1446 event_->VirtualKeycodeState[GraphicsDisplay::Win32KeySymToINL(wParam) ] = 1;1435 event_.VirtualKeycodeState[GraphicsDisplay::Win32KeySymToINL(wParam) ] = 1;
1447 }1436 }
14481437
1449 if (wParam == VK_CONTROL)1438 if (wParam == VK_CONTROL)
1450 {1439 {
1451 if (lParam & (1 << 24))1440 if (lParam & (1 << 24))
1452 {1441 {
1453 event_->win32_keysym = NUX_VK_RCONTROL;1442 event_.win32_keysym = NUX_VK_RCONTROL;
1454 }1443 }
1455 else1444 else
1456 {1445 {
1457 event_->win32_keysym = NUX_VK_LCONTROL;1446 event_.win32_keysym = NUX_VK_LCONTROL;
1458 }1447 }
1459 }1448 }
14601449
@@ -1462,11 +1451,11 @@
1462 {1451 {
1463 if (lParam & (1 << 24))1452 if (lParam & (1 << 24))
1464 {1453 {
1465 event_->win32_keysym = NUX_VK_RALT;1454 event_.win32_keysym = NUX_VK_RALT;
1466 }1455 }
1467 else1456 else
1468 {1457 {
1469 event_->win32_keysym = NUX_VK_LALT;1458 event_.win32_keysym = NUX_VK_LALT;
1470 }1459 }
1471 }1460 }
14721461
@@ -1474,11 +1463,11 @@
1474 {1463 {
1475 if (HIWORD(GetAsyncKeyState(VK_LSHIFT)))1464 if (HIWORD(GetAsyncKeyState(VK_LSHIFT)))
1476 {1465 {
1477 event_->win32_keysym = NUX_VK_LSHIFT;1466 event_.win32_keysym = NUX_VK_LSHIFT;
1478 }1467 }
1479 else if (HIWORD(GetAsyncKeyState(VK_RSHIFT)))1468 else if (HIWORD(GetAsyncKeyState(VK_RSHIFT)))
1480 {1469 {
1481 event_->win32_keysym = NUX_VK_RSHIFT;1470 event_.win32_keysym = NUX_VK_RSHIFT;
1482 }1471 }
1483 }1472 }
14841473
@@ -1488,13 +1477,13 @@
1488 case WM_SYSKEYUP:1477 case WM_SYSKEYUP:
1489 case WM_KEYUP:1478 case WM_KEYUP:
1490 {1479 {
1491 event_->type = NUX_KEYUP;1480 event_.type = NUX_KEYUP;
1492 event_->key_modifiers = GetModifierKeyState();1481 event_.key_modifiers = GetModifierKeyState();
1493 event_->win32_keysym = wParam;1482 event_.win32_keysym = wParam;
14941483
1495 if ((uMsg == WM_KEYUP) || (uMsg == WM_SYSKEYUP))1484 if ((uMsg == WM_KEYUP) || (uMsg == WM_SYSKEYUP))
1496 {1485 {
1497 event_->VirtualKeycodeState[GraphicsDisplay::Win32KeySymToINL(wParam) ] = 0;1486 event_.VirtualKeycodeState[GraphicsDisplay::Win32KeySymToINL(wParam) ] = 0;
1498 }1487 }
14991488
1500 break;1489 break;
@@ -1505,22 +1494,22 @@
1505 case WM_CHAR:1494 case WM_CHAR:
1506 case WM_SYSCHAR:1495 case WM_SYSCHAR:
1507 {1496 {
1508 event_->key_modifiers = GetModifierKeyState();1497 event_.key_modifiers = GetModifierKeyState();
15091498
1510 // reset key repeat count to 0.1499 // reset key repeat count to 0.
1511 event_->key_repeat_count = 0;1500 event_.key_repeat_count = 0;
15121501
1513 if (lParam & (1 << 31))1502 if (lParam & (1 << 31))
1514 {1503 {
1515 // key up events.1504 // key up events.
1516 event_->type = NUX_KEYUP;1505 event_.type = NUX_KEYUP;
1517 return 0;1506 return 0;
1518 }1507 }
1519 else1508 else
1520 {1509 {
1521 // key down events.1510 // key down events.
1522 event_->type = NUX_KEYDOWN;1511 event_.type = NUX_KEYDOWN;
1523 event_->key_repeat_count = (int) (lParam & 0xff);1512 event_.key_repeat_count = (int) (lParam & 0xff);
1524 }1513 }
15251514
15261515
@@ -1533,12 +1522,12 @@
1533 }1522 }
15341523
1535 wchar_t *utf16_str = new wchar_t [4];1524 wchar_t *utf16_str = new wchar_t [4];
1536 Memset(utf16_str, 0, sizeof(wchar_t) * 4);1525 std::memset(utf16_str, 0, sizeof(wchar_t) * 4);
1537 Memcpy(utf16_str, (int*) &wParam, sizeof(wParam));1526 std::memcpy(utf16_str, (int*) &wParam, sizeof(wParam));
1538 wchar_t *temp0 = utf16_str;1527 wchar_t *temp0 = utf16_str;
15391528
1540 unsigned char *utf8_str = new unsigned char [NUX_EVENT_TEXT_BUFFER_SIZE];1529 unsigned char *utf8_str = new unsigned char [NUX_EVENT_TEXT_BUFFER_SIZE];
1541 Memset(utf8_str, 0, sizeof(unsigned char) * NUX_EVENT_TEXT_BUFFER_SIZE);1530 std::memset(utf8_str, 0, sizeof(unsigned char) * NUX_EVENT_TEXT_BUFFER_SIZE);
1542 unsigned char *temp1 = utf8_str;1531 unsigned char *temp1 = utf8_str;
15431532
15441533
@@ -1550,7 +1539,7 @@
15501539
1551 if (res == conversionOK)1540 if (res == conversionOK)
1552 {1541 {
1553 Memcpy(event_->text, utf8_str, NUX_EVENT_TEXT_BUFFER_SIZE);1542 std::memcpy(event_.text, utf8_str, NUX_EVENT_TEXT_BUFFER_SIZE);
1554 }1543 }
1555 delete utf8_str;1544 delete utf8_str;
1556 delete utf16_str;1545 delete utf16_str;
@@ -1563,31 +1552,31 @@
1563 if (wParam == UNICODE_NOCHAR)1552 if (wParam == UNICODE_NOCHAR)
1564 return 1;1553 return 1;
15651554
1566 event_->key_modifiers = GetModifierKeyState();1555 event_.key_modifiers = GetModifierKeyState();
15671556
1568 // reset key repeat count to 0.1557 // reset key repeat count to 0.
1569 event_->key_repeat_count = 0;1558 event_.key_repeat_count = 0;
15701559
1571 if (lParam & (1 << 31))1560 if (lParam & (1 << 31))
1572 {1561 {
1573 // key up events.1562 // key up events.
1574 event_->type = NUX_KEYUP;1563 event_.type = NUX_KEYUP;
1575 return 0;1564 return 0;
1576 }1565 }
1577 else1566 else
1578 {1567 {
1579 // key down events.1568 // key down events.
1580 event_->type = NUX_KEYDOWN;1569 event_.type = NUX_KEYDOWN;
1581 event_->key_repeat_count = (int) (lParam & 0xff);1570 event_.key_repeat_count = (int) (lParam & 0xff);
1582 }1571 }
15831572
1584 unsigned int *utf32_str = new unsigned int [4];1573 unsigned int *utf32_str = new unsigned int [4];
1585 Memset(utf32_str, 0, sizeof(unsigned int) * 4);1574 std::memset(utf32_str, 0, sizeof(unsigned int) * 4);
1586 Memcpy(utf32_str, (int*) &wParam, sizeof(wParam));1575 std::memcpy(utf32_str, (int*) &wParam, sizeof(wParam));
1587 unsigned int *temp0 = utf32_str;1576 unsigned int *temp0 = utf32_str;
15881577
1589 unsigned char *utf8_str = new unsigned char [NUX_EVENT_TEXT_BUFFER_SIZE];1578 unsigned char *utf8_str = new unsigned char [NUX_EVENT_TEXT_BUFFER_SIZE];
1590 Memset(utf8_str, 0, sizeof(unsigned char) * NUX_EVENT_TEXT_BUFFER_SIZE);1579 std::memset(utf8_str, 0, sizeof(unsigned char) * NUX_EVENT_TEXT_BUFFER_SIZE);
1591 unsigned char *temp1 = utf8_str;1580 unsigned char *temp1 = utf8_str;
15921581
15931582
@@ -1599,7 +1588,7 @@
15991588
1600 if (res == conversionOK)1589 if (res == conversionOK)
1601 {1590 {
1602 Memcpy(event_->text, utf8_str, NUX_EVENT_TEXT_BUFFER_SIZE);1591 std::memcpy(event_.text, utf8_str, NUX_EVENT_TEXT_BUFFER_SIZE);
1603 }1592 }
1604 delete utf8_str;1593 delete utf8_str;
1605 delete utf32_str;1594 delete utf32_str;
@@ -1607,107 +1596,107 @@
16071596
1608 case WM_LBUTTONDOWN:1597 case WM_LBUTTONDOWN:
1609 {1598 {
1610 mouse_event(hWnd, event_, 0, 1, wParam, lParam);1599 InspectMouseEvent(hWnd, event_, 0, 1, wParam, lParam);
1611 //nuxDebugMsg("Windows Msg: WM_LBUTTONDOWN");1600 //nuxDebugMsg("Windows Msg: WM_LBUTTONDOWN");
1612 return 0;1601 return 0;
1613 }1602 }
1614 case WM_LBUTTONDBLCLK:1603 case WM_LBUTTONDBLCLK:
1615 {1604 {
1616 mouse_event(hWnd, event_, 1, 1, wParam, lParam);1605 InspectMouseEvent(hWnd, event_, 1, 1, wParam, lParam);
1617 //nuxDebugMsg("Windows Msg: WM_LBUTTONDBLCLK");1606 //nuxDebugMsg("Windows Msg: WM_LBUTTONDBLCLK");
1618 return 0;1607 return 0;
1619 }1608 }
1620 case WM_LBUTTONUP:1609 case WM_LBUTTONUP:
1621 {1610 {
1622 mouse_event(hWnd, event_, 2, 1, wParam, lParam);1611 InspectMouseEvent(hWnd, event_, 2, 1, wParam, lParam);
1623 //nuxDebugMsg("Windows Msg: WM_LBUTTONUP");1612 //nuxDebugMsg("Windows Msg: WM_LBUTTONUP");
1624 return 0;1613 return 0;
1625 }1614 }
1626 case WM_MBUTTONDOWN:1615 case WM_MBUTTONDOWN:
1627 {1616 {
1628 mouse_event(hWnd, event_, 0, 2, wParam, lParam);1617 InspectMouseEvent(hWnd, event_, 0, 2, wParam, lParam);
1629 break;1618 break;
1630 }1619 }
1631 case WM_MBUTTONDBLCLK:1620 case WM_MBUTTONDBLCLK:
1632 {1621 {
1633 mouse_event(hWnd, event_, 1, 2, wParam, lParam);1622 InspectMouseEvent(hWnd, event_, 1, 2, wParam, lParam);
1634 break;1623 break;
1635 }1624 }
1636 case WM_MBUTTONUP:1625 case WM_MBUTTONUP:
1637 {1626 {
1638 mouse_event(hWnd, event_, 2, 2, wParam, lParam);1627 InspectMouseEvent(hWnd, event_, 2, 2, wParam, lParam);
1639 break;1628 break;
1640 }1629 }
1641 case WM_RBUTTONDOWN:1630 case WM_RBUTTONDOWN:
1642 {1631 {
1643 mouse_event(hWnd, event_, 0, 3, wParam, lParam);1632 InspectMouseEvent(hWnd, event_, 0, 3, wParam, lParam);
1644 break;1633 break;
1645 }1634 }
1646 case WM_RBUTTONDBLCLK:1635 case WM_RBUTTONDBLCLK:
1647 {1636 {
1648 mouse_event(hWnd, event_, 1, 3, wParam, lParam);1637 InspectMouseEvent(hWnd, event_, 1, 3, wParam, lParam);
1649 break;1638 break;
1650 }1639 }
1651 case WM_RBUTTONUP:1640 case WM_RBUTTONUP:
1652 {1641 {
1653 mouse_event(hWnd, event_, 2, 3, wParam, lParam);1642 InspectMouseEvent(hWnd, event_, 2, 3, wParam, lParam);
1654 break;1643 break;
1655 }1644 }
1656 case WM_MOUSEWHEEL:1645 case WM_MOUSEWHEEL:
1657 {1646 {
1658 mouse_event(hWnd, event_, 0, 4, wParam, lParam);1647 InspectMouseEvent(hWnd, event_, 0, 4, wParam, lParam);
1659 break;1648 break;
1660 }1649 }
16611650
1662 case WM_NCLBUTTONDBLCLK:1651 case WM_NCLBUTTONDBLCLK:
1663 {1652 {
1664 event_->type = NUX_NC_WINDOW_CONFIGURATION;1653 event_.type = NUX_NC_WINDOW_CONFIGURATION;
1665 break;1654 break;
1666 }1655 }
1667 case WM_NCLBUTTONDOWN:1656 case WM_NCLBUTTONDOWN:
1668 {1657 {
1669 event_->type = NUX_NC_WINDOW_CONFIGURATION;1658 event_.type = NUX_NC_WINDOW_CONFIGURATION;
1670 break;1659 break;
1671 }1660 }
1672 case WM_NCLBUTTONUP:1661 case WM_NCLBUTTONUP:
1673 {1662 {
1674 event_->type = NUX_NC_WINDOW_CONFIGURATION;1663 event_.type = NUX_NC_WINDOW_CONFIGURATION;
1675 break;1664 break;
1676 }1665 }
1677 case WM_NCMBUTTONDBLCLK:1666 case WM_NCMBUTTONDBLCLK:
1678 {1667 {
1679 event_->type = NUX_NC_WINDOW_CONFIGURATION;1668 event_.type = NUX_NC_WINDOW_CONFIGURATION;
1680 break;1669 break;
1681 }1670 }
1682 case WM_NCMBUTTONDOWN:1671 case WM_NCMBUTTONDOWN:
1683 {1672 {
1684 event_->type = NUX_NC_WINDOW_CONFIGURATION;1673 event_.type = NUX_NC_WINDOW_CONFIGURATION;
1685 break;1674 break;
1686 }1675 }
1687 case WM_NCMBUTTONUP:1676 case WM_NCMBUTTONUP:
1688 {1677 {
1689 event_->type = NUX_NC_WINDOW_CONFIGURATION;1678 event_.type = NUX_NC_WINDOW_CONFIGURATION;
1690 break;1679 break;
1691 }1680 }
1692 case WM_NCRBUTTONDBLCLK:1681 case WM_NCRBUTTONDBLCLK:
1693 {1682 {
1694 event_->type = NUX_NC_WINDOW_CONFIGURATION;1683 event_.type = NUX_NC_WINDOW_CONFIGURATION;
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches