Nux

Merge lp:~nux-team/nux/nux.attempt-to-fix-widgets-new into lp:nux

Proposed by Eleni Maria Stea
Status: Needs review
Proposed branch: lp:~nux-team/nux/nux.attempt-to-fix-widgets-new
Merge into: lp:nux
Diff against target: 4681 lines (+1137/-701)
59 files modified
Nux/AbstractCheckedButton.cpp (+6/-6)
Nux/AbstractCheckedButton.h (+1/-1)
Nux/AnimatedTextureArea.cpp (+2/-2)
Nux/Area.cpp (+83/-14)
Nux/Area.h (+25/-5)
Nux/BaseWindow.cpp (+15/-15)
Nux/BasicView.h (+1/-1)
Nux/Button.cpp (+34/-5)
Nux/Button.h (+12/-11)
Nux/CheckBox.cpp (+5/-5)
Nux/ColorEditor.cpp (+89/-82)
Nux/ColorEditor.h (+3/-3)
Nux/ColorPreview.cpp (+2/-3)
Nux/ColorPreview.h (+1/-1)
Nux/EditTextBox.cpp (+7/-7)
Nux/FileSelector.cpp (+5/-5)
Nux/FloatingWindow.cpp (+24/-23)
Nux/GridHLayout.cpp (+3/-3)
Nux/GroupBox.cpp (+14/-13)
Nux/GroupBox2.cpp (+47/-79)
Nux/GroupBox2.h (+5/-7)
Nux/HLayout.cpp (+6/-6)
Nux/HScrollBar.cpp (+4/-4)
Nux/HSplitter.cpp (+47/-41)
Nux/HSplitter.h (+1/-0)
Nux/Layout.cpp (+47/-30)
Nux/Layout.h (+6/-4)
Nux/LinearLayout.h (+2/-2)
Nux/Makefile.am (+2/-0)
Nux/MenuBar.cpp (+21/-15)
Nux/MenuPage.cpp (+10/-10)
Nux/NumericValuator.cpp (+3/-3)
Nux/PaintLayer.cpp (+6/-6)
Nux/Panel.cpp (+2/-2)
Nux/RGBValuator.cpp (+62/-60)
Nux/RadioButton.cpp (+4/-6)
Nux/RangeValue.cpp (+3/-3)
Nux/RangeValueInteger.cpp (+3/-3)
Nux/SceneComposer.cpp (+111/-0)
Nux/SceneComposer.h (+78/-0)
Nux/ScrollView.cpp (+47/-45)
Nux/SpinBox.cpp (+7/-7)
Nux/SpinBoxDouble.cpp (+7/-7)
Nux/StaticText.cpp (+2/-2)
Nux/StaticTextBox.cpp (+3/-3)
Nux/TabView.cpp (+37/-32)
Nux/TextureArea.cpp (+4/-4)
Nux/VLayout.cpp (+9/-9)
Nux/VScrollBar.cpp (+2/-2)
Nux/VSplitter.cpp (+42/-31)
Nux/VSplitter.h (+1/-0)
Nux/View.cpp (+71/-40)
Nux/View.h (+2/-1)
Nux/WindowCompositor.cpp (+68/-15)
Nux/WindowCompositor.h (+18/-2)
NuxCore/NuxCore.cpp (+3/-3)
NuxGraphics/GLRenderStates.h (+1/-1)
NuxGraphics/GraphicsEngine.cpp (+1/-1)
NuxGraphics/RenderingPipeGLSL.cpp (+10/-10)
To merge this branch: bzr merge lp:~nux-team/nux/nux.attempt-to-fix-widgets-new
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Jay Taoko Pending
Review via email: mp+140232@code.launchpad.net

Description of the change

changed nux widgets to use relative coord system
related unity branch: https://code.launchpad.net/~unity-team/unity/unity.attempt-to-fix-widgets
needs testing :)

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:717
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~nux-team/nux/nux.attempt-to-fix-widgets-new/+merge/140232/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/nux-ci/3/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/nux-raring-amd64-ci/3/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/nux-raring-armhf-ci/3/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/nux-raring-i386-ci/3/console

Click here to trigger a rebuild:
http://s-jenkins:8080/job/nux-ci/3/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

717. By Eleni Maria Stea

local merge

716. By Eleni Maria Stea

added jay's fix for GroupBox2 from this branch:
http://bazaar.launchpad.net/~unity-team/nux/nux.rebase-area-xy-rgbvaluator/revision/704#Nux/ClientArea.cpp

715. By Eleni Maria Stea

!!work in progress!! the menu contents now appear but there are
still issues with the menupage position

714. By Eleni Maria Stea

Paint2DQuadColor function finally calls a fragment
shader that needs the absolute pixel position therefore
we use absolute geometry

713. By Eleni Maria Stea

text rendering in tabview needs
absolute geometry :->

712. By Eleni Maria Stea

reverted the events geometry

711. By Eleni Maria Stea

fixed tabview geometry (work in progress)

710. By Eleni Maria Stea

fixed groupbox2 layout geometry

709. By Eleni Maria Stea

Fixed captions of GroupBox2

708. By Eleni Maria Stea

removed comment

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 2012-11-05 21:31:06 +0000
+++ Nux/AbstractCheckedButton.cpp 2012-12-17 15:42:23 +0000
@@ -28,7 +28,7 @@
28namespace nux28namespace nux
29{29{
30 NUX_IMPLEMENT_OBJECT_TYPE(AbstractCheckedButton);30 NUX_IMPLEMENT_OBJECT_TYPE(AbstractCheckedButton);
31 31
32 AbstractCheckedButton::AbstractCheckedButton(const std::string &str, bool state, NUX_FILE_LINE_DECL)32 AbstractCheckedButton::AbstractCheckedButton(const std::string &str, bool state, NUX_FILE_LINE_DECL)
33 : AbstractButton(NUX_FILE_LINE_PARAM)33 : AbstractButton(NUX_FILE_LINE_PARAM)
34 {34 {
@@ -86,7 +86,7 @@
8686
87 void AbstractCheckedButton::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)87 void AbstractCheckedButton::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
88 {88 {
89 Geometry base = GetGeometry();89 Geometry base = GetNativeGeometry();
90 graphics_engine.PushClippingRectangle(base);90 graphics_engine.PushClippingRectangle(base);
9191
92 GetPainter().PaintBackground(graphics_engine, base);92 GetPainter().PaintBackground(graphics_engine, base);
@@ -110,7 +110,7 @@
110110
111 GetPainter().PushPaintLayerStack();111 GetPainter().PushPaintLayerStack();
112 {112 {
113 GetPainter().PaintCheckBox(graphics_engine, check_area_->GetGeometry(), is, Color(0xff000000));113 GetPainter().PaintCheckBox(graphics_engine, check_area_->GetGeometryRelativeTo(this), is, Color(0xff000000));
114 static_text_->ProcessDraw(graphics_engine, true);114 static_text_->ProcessDraw(graphics_engine, true);
115 }115 }
116 GetPainter().PopPaintLayerStack();116 GetPainter().PopPaintLayerStack();
@@ -138,9 +138,9 @@
138138
139 {139 {
140 // Check if the text view goes out of the AbstractCheckedButton area.140 // Check if the text view goes out of the AbstractCheckedButton area.
141 Geometry base = GetGeometry();141 Geometry base = GetNativeGeometry();
142 Geometry text_geo = static_text_->GetGeometry();142 Geometry text_geo = static_text_->GetGeometryRelativeTo(this);
143 143
144 // Intersect the AbstractCheckedButton and the text view144 // Intersect the AbstractCheckedButton and the text view
145 Geometry intersection = base.Intersect(text_geo);145 Geometry intersection = base.Intersect(text_geo);
146 if (intersection != text_geo)146 if (intersection != text_geo)
147147
=== modified file 'Nux/AbstractCheckedButton.h'
--- Nux/AbstractCheckedButton.h 2011-10-18 20:00:59 +0000
+++ Nux/AbstractCheckedButton.h 2012-12-17 15:42:23 +0000
@@ -89,7 +89,7 @@
89 virtual long ComputeContentSize();89 virtual long ComputeContentSize();
9090
91 HLayout *hlayout_;91 HLayout *hlayout_;
92 InputArea *check_area_;92 BasicView *check_area_;
9393
94 private:94 private:
95 //! Override of Area::SetMinimumHeight and made private.95 //! Override of Area::SetMinimumHeight and made private.
9696
=== modified file 'Nux/AnimatedTextureArea.cpp'
--- Nux/AnimatedTextureArea.cpp 2012-10-02 07:32:55 +0000
+++ Nux/AnimatedTextureArea.cpp 2012-12-17 15:42:23 +0000
@@ -52,9 +52,9 @@
52 {52 {
53 if (m_UserTexture)53 if (m_UserTexture)
54 {54 {
55 GetPainter().PaintBackground(graphics_engine, GetGeometry());55 GetPainter().PaintBackground(graphics_engine, GetNativeGeometry());
56 graphics_engine.GetRenderStates().SetBlend(true, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);56 graphics_engine.GetRenderStates().SetBlend(true, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
57 nux::Geometry base = GetGeometry();57 nux::Geometry base = GetNativeGeometry();
58 nux::TexCoordXForm texxform;58 nux::TexCoordXForm texxform;
59 graphics_engine.QRP_1Tex(base.x, base.y, base.width, base.height, m_UserTexture->GetDeviceTexture(), texxform, nux::color::White);59 graphics_engine.QRP_1Tex(base.x, base.y, base.width, base.height, m_UserTexture->GetDeviceTexture(), texxform, nux::color::White);
6060
6161
=== modified file 'Nux/Area.cpp'
--- Nux/Area.cpp 2012-11-12 20:59:56 +0000
+++ Nux/Area.cpp 2012-12-17 15:42:23 +0000
@@ -347,6 +347,16 @@
347 return GetY();347 return GetY();
348 }348 }
349349
350 int Area::GetNativeX() const
351 {
352 return 0;
353 }
354
355 int Area::GetNativeY() const
356 {
357 return 0;
358 }
359
350 int Area::GetWidth() const360 int Area::GetWidth() const
351 {361 {
352 return geometry_.width;362 return geometry_.width;
@@ -409,6 +419,53 @@
409 return geometry_;419 return geometry_;
410 }420 }
411421
422 Geometry Area::GetNativeGeometry() const
423 {
424 return Geometry(0, 0, geometry_.width, geometry_.height);
425 }
426
427 Geometry Area::GetInnerGeometryRelativeTo(Area* area, Geometry& geo) const
428 {
429 Area* parent = GetParentObject();
430 if (parent == area)
431 {
432 return geo;
433 }
434 else if (parent != NULL)
435 {
436 geo.OffsetPosition(parent->GetX(), parent->GetY());
437 return parent->GetInnerGeometryRelativeTo(area, geo);
438 }
439 else
440 {
441 //parent is NULL
442 return Geometry (0, 0, 0, 0);
443 }
444 }
445
446 Geometry Area::GetGeometryRelativeTo(Area* area) const
447 {
448 if (this == area)
449 return GetNativeGeometry();
450
451 Geometry geo = GetGeometry();
452 Area* parent = GetParentObject();
453 if (parent == area)
454 {
455 return geo;
456 }
457 else if (parent != NULL)
458 {
459 geo.OffsetPosition(parent->GetX(), parent->GetY());
460 return parent->GetInnerGeometryRelativeTo(area, geo);
461 }
462 else
463 {
464 //parent is NULL
465 return Geometry (0, 0, 0, 0);
466 }
467 }
468
412 void Area::SetX(int x)469 void Area::SetX(int x)
413 {470 {
414 SetGeometry(x, geometry_.y, geometry_.width, geometry_.height);471 SetGeometry(x, geometry_.y, geometry_.width, geometry_.height);
@@ -756,7 +813,7 @@
756 return _3d_area;813 return _3d_area;
757 }814 }
758815
759 static void MatrixXFormGeometry(const Matrix4 &matrix, Geometry &geo)816 static void MatrixXFormGeometry(const Matrix4& matrix, Geometry& geo)
760 {817 {
761 Vector4 in(geo.x, geo.y, 0, 1);818 Vector4 in(geo.x, geo.y, 0, 1);
762 // This is mean only for translation matrices. It will not work with matrices containing rotations or scalings.819 // This is mean only for translation matrices. It will not work with matrices containing rotations or scalings.
@@ -765,7 +822,7 @@
765 geo.y = out.y;822 geo.y = out.y;
766 }823 }
767824
768 void Area::InnerGetAbsoluteGeometry(Geometry &geometry)825 void Area::InnerGetAbsoluteGeometry(Geometry& geometry)
769 {826 {
770 if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == window_thread_->GetLayout()))827 if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == window_thread_->GetLayout()))
771 {828 {
@@ -775,9 +832,12 @@
775832
776 MatrixXFormGeometry(_2d_xform, geometry);833 MatrixXFormGeometry(_2d_xform, geometry);
777834
778 Area *parent = GetParentObject();835 Area* parent = GetParentObject();
779 if (parent)836 if (parent)
837 {
838 geometry.OffsetPosition(parent->GetX(), parent->GetY());
780 parent->InnerGetAbsoluteGeometry(geometry);839 parent->InnerGetAbsoluteGeometry(geometry);
840 }
781 }841 }
782842
783 Geometry Area::GetAbsoluteGeometry() const843 Geometry Area::GetAbsoluteGeometry() const
@@ -798,7 +858,10 @@
798858
799 Area *parent = GetParentObject();859 Area *parent = GetParentObject();
800 if (parent)860 if (parent)
861 {
862 geo.OffsetPosition(parent->GetX(), parent->GetY());
801 parent->InnerGetAbsoluteGeometry(geo);863 parent->InnerGetAbsoluteGeometry(geo);
864 }
802865
803 return geo;866 return geo;
804 }867 }
@@ -824,16 +887,19 @@
824 return GetAbsoluteGeometry().height;887 return GetAbsoluteGeometry().height;
825 }888 }
826889
827 void Area::InnerGetRootGeometry(Geometry &geometry)890 void Area::InnerGetRootGeometry(Geometry& geometry)
828 {891 {
829 if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == window_thread_->GetLayout()))892 if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == window_thread_->GetLayout()))
830 return;893 return;
831894
832 MatrixXFormGeometry(_2d_xform, geometry);895 MatrixXFormGeometry(_2d_xform, geometry);
833896
834 Area *parent = GetParentObject();897 Area* parent = GetParentObject();
835 if (parent)898 if (parent)
899 {
900 geometry.OffsetPosition(parent->GetX(), parent->GetY());
836 parent->InnerGetRootGeometry(geometry);901 parent->InnerGetRootGeometry(geometry);
902 }
837 }903 }
838904
839 Geometry Area::GetRootGeometry() const905 Geometry Area::GetRootGeometry() const
@@ -847,9 +913,12 @@
847 }913 }
848 else914 else
849 {915 {
850 Area *parent = GetParentObject();916 Area* parent = GetParentObject();
851 if (parent)917 if (parent)
918 {
919 geo.OffsetPosition(parent->GetX(), parent->GetY());
852 parent->InnerGetRootGeometry(geo);920 parent->InnerGetRootGeometry(geo);
921 }
853922
854 return geo;923 return geo;
855 }924 }
@@ -922,7 +991,7 @@
922 if (!parent || !parent_area_)991 if (!parent || !parent_area_)
923 return false;992 return false;
924993
925 return parent_area_->IsChildOf(parent); 994 return parent_area_->IsChildOf(parent);
926 }995 }
927996
928 void Area::QueueRelayout()997 void Area::QueueRelayout()
@@ -1143,7 +1212,7 @@
1143 }1212 }
1144 }1213 }
11451214
1146 bool Area::RedirectRenderingToTexture() const1215 bool Area::GetRedirectRenderingToTexture() const
1147 {1216 {
1148 return redirect_rendering_to_texture_;1217 return redirect_rendering_to_texture_;
1149 }1218 }
@@ -1155,7 +1224,7 @@
11551224
1156 ObjectPtr<IOpenGLBaseTexture> Area::BackupTexture() const1225 ObjectPtr<IOpenGLBaseTexture> Area::BackupTexture() const
1157 {1226 {
1158 // if RedirectRenderingToTexture() is false, then backup_texture_ is not a valid smart pointer.1227 // if GetRedirectRenderingToTexture() is false, then backup_texture_ is not a valid smart pointer.
1159 return backup_texture_;1228 return backup_texture_;
1160 }1229 }
11611230
@@ -1170,12 +1239,12 @@
11701239
1171 while (parent)1240 while (parent)
1172 {1241 {
1173 if (parent->RedirectRenderingToTexture() && (parent->UpdateBackupTextureForChildRendering() == false))1242 if (parent->GetRedirectRenderingToTexture() && (parent->UpdateBackupTextureForChildRendering() == false))
1174 {1243 {
1175 parent->SetUpdateBackupTextureForChildRendering(true);1244 parent->SetUpdateBackupTextureForChildRendering(true);
1176 parent->PrepareParentRedirectedView();1245 parent->PrepareParentRedirectedView();
1177 }1246 }
1178 else if (parent->RedirectRenderingToTexture() && (parent->UpdateBackupTextureForChildRendering() == true))1247 else if (parent->GetRedirectRenderingToTexture() && (parent->UpdateBackupTextureForChildRendering() == true))
1179 {1248 {
1180 break;1249 break;
1181 }1250 }
@@ -1199,7 +1268,7 @@
1199 if (parent)1268 if (parent)
1200 {1269 {
1201 View* view = static_cast<View*>(parent);1270 View* view = static_cast<View*>(parent);
1202 if (view->RedirectRenderingToTexture())1271 if (view->GetRedirectRenderingToTexture())
1203 {1272 {
1204 return true;1273 return true;
1205 }1274 }
@@ -1217,7 +1286,7 @@
12171286
1218 while (parent)1287 while (parent)
1219 {1288 {
1220 if (parent->RedirectRenderingToTexture())1289 if (parent->GetRedirectRenderingToTexture())
1221 {1290 {
1222 return parent;1291 return parent;
1223 }1292 }
@@ -1237,7 +1306,7 @@
1237 present_redirected_view_ = present_redirected_view;1306 present_redirected_view_ = present_redirected_view;
1238 }1307 }
12391308
1240 bool Area::PresentRedirectedView() const1309 bool Area::GetPresentRedirectedView() const
1241 {1310 {
1242 return present_redirected_view_;1311 return present_redirected_view_;
1243 }1312 }
12441313
=== modified file 'Nux/Area.h'
--- Nux/Area.h 2012-11-12 20:59:56 +0000
+++ Nux/Area.h 2012-12-17 15:42:23 +0000
@@ -162,6 +162,8 @@
162 int GetY() const;162 int GetY() const;
163 int GetWidth() const;163 int GetWidth() const;
164 int GetHeight() const;164 int GetHeight() const;
165 int GetNativeX() const;
166 int GetNativeY() const;
165167
166 void SetX(int x);168 void SetX(int x);
167 void SetY(int y);169 void SetY(int y);
@@ -217,6 +219,17 @@
217 */219 */
218 Geometry const& GetGeometry() const;220 Geometry const& GetGeometry() const;
219221
222 //! Get the native geometry of the object.
223 /*!
224 The native geometry of an area is its geometry as if its top left corner where the origine
225 of the coordinate system. That is, for a native geometry, the value of x and y is 0.
226 @return The native geometry of the object, with 0 as the value for x and y.
227 @sa GetBaseWidth(), GetBaseHeight(), GetBaseX(), GetBaseY().
228 */
229 Geometry GetNativeGeometry() const;
230
231 Geometry GetGeometryRelativeTo(Area* area) const;
232
220 //! Set the geometry of the object.233 //! Set the geometry of the object.
221 /*!234 /*!
222 Set the width, height, and x, y position of the object on the screen.235 Set the width, height, and x, y position of the object on the screen.
@@ -632,6 +645,8 @@
632 //! Return the absolute geometry starting with a relative geometry passed as argument.645 //! Return the absolute geometry starting with a relative geometry passed as argument.
633 void InnerGetRootGeometry(Geometry &geometry);646 void InnerGetRootGeometry(Geometry &geometry);
634647
648 Geometry GetInnerGeometryRelativeTo(Area* area, Geometry& geo) const;
649
635 bool on_geometry_change_reconfigure_parent_layout_;650 bool on_geometry_change_reconfigure_parent_layout_;
636651
637 //! If this variable is true, then this area has the keyboard focus.652 //! If this variable is true, then this area has the keyboard focus.
@@ -666,12 +681,12 @@
666 /*!681 /*!
667 @return True if the rendering of this view is done in a texture.682 @return True if the rendering of this view is done in a texture.
668 */683 */
669 virtual bool RedirectRenderingToTexture() const;684 virtual bool GetRedirectRenderingToTexture() const;
670685
671 //! Return the texture of this View if RedirectRenderingToTexture is enabled.686 //! Return the texture of this View if GetRedirectRenderingToTexture is enabled.
672 /*687 /*
673 Return the texture of this View if RedirectRenderingToTexture is enabled.688 Return the texture of this View if GetRedirectRenderingToTexture is enabled.
674 If RedirectRenderingToTexture() is false, then backup_texture_ is not a valid smart pointer.689 If GetRedirectRenderingToTexture() is false, then backup_texture_ is not a valid smart pointer.
675690
676 @return the device texture that contains the rendering of this view.691 @return the device texture that contains the rendering of this view.
677 */692 */
@@ -691,7 +706,7 @@
691 /*!706 /*!
692 @return True if the redirected texture is displayed in the rendering tree.707 @return True if the redirected texture is displayed in the rendering tree.
693 */708 */
694 bool PresentRedirectedView() const;709 bool GetPresentRedirectedView() const;
695710
696protected:711protected:
697 //! Redirect the rendering of the view to a texture.712 //! Redirect the rendering of the view to a texture.
@@ -720,6 +735,11 @@
720 */735 */
721 virtual void PrepareParentRedirectedView();736 virtual void PrepareParentRedirectedView();
722737
738 /*!
739 Gather all redirected views that are child of this, for rendering.
740 */
741 virtual void GatherRedirectedViewForRendering(GraphicsEngine& /*graphics_engine*/){};
742
723 virtual bool HasParentRedirectedView();743 virtual bool HasParentRedirectedView();
724 Area* RedirectedAncestor();744 Area* RedirectedAncestor();
725745
726746
=== modified file 'Nux/BaseWindow.cpp'
--- Nux/BaseWindow.cpp 2012-10-18 10:23:45 +0000
+++ Nux/BaseWindow.cpp 2012-12-17 15:42:23 +0000
@@ -112,7 +112,7 @@
112112
113 void BaseWindow::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)113 void BaseWindow::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
114 {114 {
115 Geometry base = GetGeometry();115 Geometry base = GetNativeGeometry();
116 // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).116 // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).
117 base.SetX(0);117 base.SetX(0);
118 base.SetY(0);118 base.SetY(0);
@@ -127,7 +127,7 @@
127 void BaseWindow::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)127 void BaseWindow::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
128 {128 {
129129
130 Geometry base = GetGeometry();130 Geometry base = GetNativeGeometry();
131 // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).131 // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).
132 base.SetX(0);132 base.SetX(0);
133 base.SetY(0);133 base.SetY(0);
@@ -162,7 +162,7 @@
162 return false;162 return false;
163163
164 m_layout = layout;164 m_layout = layout;
165 Geometry geo = GetGeometry();165 Geometry geo = GetNativeGeometry();
166 Geometry layout_geo = Geometry(geo.x + m_Border, geo.y + m_TopBorder,166 Geometry layout_geo = Geometry(geo.x + m_Border, geo.y + m_TopBorder,
167 geo.GetWidth() - 2 * m_Border, geo.GetHeight() - m_Border - m_TopBorder);167 geo.GetWidth() - 2 * m_Border, geo.GetHeight() - m_Border - m_TopBorder);
168 m_layout->SetGeometry(layout_geo);168 m_layout->SetGeometry(layout_geo);
@@ -179,7 +179,7 @@
179 // Here we need to position the header by hand because it is not under the control of vlayout.179 // Here we need to position the header by hand because it is not under the control of vlayout.
180 void BaseWindow::PreLayoutManagement()180 void BaseWindow::PreLayoutManagement()
181 {181 {
182 Geometry geo = GetGeometry();182 Geometry geo = GetNativeGeometry();
183183
184 if (m_configure_notify_callback)184 if (m_configure_notify_callback)
185 {185 {
@@ -188,13 +188,13 @@
188 if (geo.IsNull())188 if (geo.IsNull())
189 {189 {
190 nuxDebugMsg("[BaseWindow::PreLayoutManagement] Received an invalid Geometry.");190 nuxDebugMsg("[BaseWindow::PreLayoutManagement] Received an invalid Geometry.");
191 geo = GetGeometry();191 geo = GetNativeGeometry();
192 }192 }
193 else193 else
194 {194 {
195 Area::SetGeometry(geo);195 Area::SetGeometry(geo);
196 // Get the geometry adjusted with respect to min and max dimension of this area.196 // Get the geometry adjusted with respect to min and max dimension of this area.
197 geo = GetGeometry();197 geo = GetNativeGeometry();
198 }198 }
199 }199 }
200200
@@ -216,10 +216,10 @@
216 {216 {
217 if (IsSizeMatchContent() && m_layout)217 if (IsSizeMatchContent() && m_layout)
218 {218 {
219 Geometry layout_geometry = m_layout->GetGeometry();219 Geometry layout_geometry = m_layout->GetNativeGeometry();
220220
221 Geometry WindowGeometry = Geometry(GetGeometry().x,221 Geometry WindowGeometry = Geometry(GetNativeGeometry().x,
222 GetGeometry().y,222 GetNativeGeometry().y,
223 layout_geometry.GetWidth() + 2 * m_Border,223 layout_geometry.GetWidth() + 2 * m_Border,
224 layout_geometry.GetHeight() + m_Border + m_TopBorder);224 layout_geometry.GetHeight() + m_Border + m_TopBorder);
225225
@@ -251,7 +251,7 @@
251 m_input_window = new XInputWindow(title, take_focus, override_redirect);251 m_input_window = new XInputWindow(title, take_focus, override_redirect);
252252
253 m_input_window->Show();253 m_input_window->Show();
254 m_input_window->SetGeometry(GetGeometry());254 m_input_window->SetGeometry(GetNativeGeometry());
255 m_input_window_enabled = true;255 m_input_window_enabled = true;
256 }256 }
257 else257 else
@@ -344,7 +344,7 @@
344 {344 {
345 // Define the geometry of some of the component of the window. Otherwise, if the composition layout is not set,345 // Define the geometry of some of the component of the window. Otherwise, if the composition layout is not set,
346 // then the component won't be correctly placed after a SetGeometry. This can be redondant if the composition layout is set.346 // then the component won't be correctly placed after a SetGeometry. This can be redondant if the composition layout is set.
347 Geometry base = GetGeometry();347 Geometry base = GetNativeGeometry();
348 }348 }
349349
350 void BaseWindow::SetBorder(int border)350 void BaseWindow::SetBorder(int border)
@@ -385,7 +385,7 @@
385 {385 {
386 if (m_layout)386 if (m_layout)
387 {387 {
388 m_layout->SetGeometry(GetGeometry());388 m_layout->SetGeometry(GetNativeGeometry());
389 }389 }
390390
391 _entering_visible_state = true;391 _entering_visible_state = true;
@@ -430,7 +430,7 @@
430430
431 void BaseWindow::NotifyConfigurationChange(int /* Width */, int /* Height */)431 void BaseWindow::NotifyConfigurationChange(int /* Width */, int /* Height */)
432 {432 {
433 Geometry geo = GetGeometry();433 Geometry geo = GetNativeGeometry();
434434
435 if (m_configure_notify_callback)435 if (m_configure_notify_callback)
436 {436 {
@@ -439,13 +439,13 @@
439 if (geo.IsNull())439 if (geo.IsNull())
440 {440 {
441 nuxDebugMsg("[BaseWindow::NotifyConfigurationChange] Received an invalid Geometry.");441 nuxDebugMsg("[BaseWindow::NotifyConfigurationChange] Received an invalid Geometry.");
442 geo = GetGeometry();442 geo = GetNativeGeometry();
443 }443 }
444 else444 else
445 {445 {
446 Area::SetGeometry(geo);446 Area::SetGeometry(geo);
447 // Get the geometry adjusted with respect to min and max dimension of this area.447 // Get the geometry adjusted with respect to min and max dimension of this area.
448 geo = GetGeometry();448 geo = GetNativeGeometry();
449 }449 }
450 }450 }
451 else451 else
452452
=== modified file 'Nux/BasicView.h'
--- Nux/BasicView.h 2012-11-05 21:31:06 +0000
+++ Nux/BasicView.h 2012-12-17 15:42:23 +0000
@@ -32,7 +32,7 @@
32 BasicView(NUX_FILE_LINE_PROTO);32 BasicView(NUX_FILE_LINE_PROTO);
33 ~BasicView();33 ~BasicView();
3434
35 35
36protected:36protected:
37 void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw);37 void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw);
38};38};
3939
=== modified file 'Nux/Button.cpp'
--- Nux/Button.cpp 2012-11-05 21:31:06 +0000
+++ Nux/Button.cpp 2012-12-17 15:42:23 +0000
@@ -75,7 +75,7 @@
75 item_order_ = IMAGE_FIRST;75 item_order_ = IMAGE_FIRST;
76 distribution_ = CENTER_OF_LAYOUT;76 distribution_ = CENTER_OF_LAYOUT;
77 space_between_items_ = 0;77 space_between_items_ = 0;
78 78
79 layout_top_padding_ = 2;79 layout_top_padding_ = 2;
80 layout_right_padding_ = 2;80 layout_right_padding_ = 2;
81 layout_bottom_padding_ = 2;81 layout_bottom_padding_ = 2;
@@ -341,7 +341,7 @@
341341
342 void Button::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)342 void Button::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
343 {343 {
344 Geometry base = GetGeometry();344 Geometry base = GetNativeGeometry();
345345
346 graphics_engine.PushClippingRectangle(base);346 graphics_engine.PushClippingRectangle(base);
347347
@@ -367,7 +367,37 @@
367 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;367 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
368368
369 GetPainter().PushDrawSliceScaledTextureLayer(graphics_engine, base, ref_style, color::White, eAllCorners, true, rop);369 GetPainter().PushDrawSliceScaledTextureLayer(graphics_engine, base, ref_style, color::White, eAllCorners, true, rop);
370370 GetPainter().PopPaintLayer();
371
372 graphics_engine.PopClippingRectangle();
373 }
374
375 void Button::DrawContent(GraphicsEngine& graphics_engine, bool force_draw)
376 {
377 Geometry base = GetNativeGeometry();
378
379 UXStyleImageRef ref_style = eIMAGE_STYLE_NONE;
380
381 if (visual_state_ == VISUAL_STATE_PRESSED)
382 {
383 ref_style = eBUTTON_FOCUS;
384 }
385 else if (visual_state_ == VISUAL_STATE_PRELIGHT)
386 {
387 ref_style = eBUTTON_PRELIGHT;
388 }
389 else
390 {
391 ref_style = eBUTTON_NORMAL;
392 }
393
394 TexCoordXForm texxform;
395 ROPConfig rop;
396 rop.Blend = true;
397 rop.SrcBlend = GL_ONE;
398 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
399
400 GetPainter().PushSliceScaledTextureLayer(graphics_engine, base, ref_style, color::White, eAllCorners, true, rop);
371 if (GetCompositionLayout())401 if (GetCompositionLayout())
372 {402 {
373 GetPainter().PushPaintLayerStack();403 GetPainter().PushPaintLayerStack();
@@ -378,14 +408,13 @@
378408
379 graphics_engine.PushClippingRectangle(clip_geo);409 graphics_engine.PushClippingRectangle(clip_geo);
380410
381 GetCompositionLayout()->ProcessDraw(graphics_engine, true);411 GetCompositionLayout()->ProcessDraw(graphics_engine, force_draw);
382412
383 graphics_engine.PopClippingRectangle();413 graphics_engine.PopClippingRectangle();
384 }414 }
385 GetPainter().PopPaintLayerStack();415 GetPainter().PopPaintLayerStack();
386 }416 }
387 GetPainter().PopPaintLayer();417 GetPainter().PopPaintLayer();
388 graphics_engine.PopClippingRectangle();
389 }418 }
390419
391 long Button::ComputeContentSize()420 long Button::ComputeContentSize()
392421
=== modified file 'Nux/Button.h'
--- Nux/Button.h 2011-10-22 06:17:42 +0000
+++ Nux/Button.h 2012-12-17 15:42:23 +0000
@@ -19,7 +19,6 @@
19 *19 *
20 */20 */
2121
22
23#ifndef BUTTON_H22#ifndef BUTTON_H
24#define BUTTON_H23#define BUTTON_H
25#include "AbstractButton.h"24#include "AbstractButton.h"
@@ -72,9 +71,9 @@
72 SPREAD_OVER_LAYOUT,71 SPREAD_OVER_LAYOUT,
73 };72 };
7473
75 Button(TextureArea *image, NUX_FILE_LINE_PROTO);74 Button(TextureArea* image, NUX_FILE_LINE_PROTO);
76 Button(const std::string& button_label, NUX_FILE_LINE_PROTO);75 Button(const std::string& button_label, NUX_FILE_LINE_PROTO);
77 Button(const std::string& button_label, TextureArea *image, NUX_FILE_LINE_PROTO);76 Button(const std::string& button_label, TextureArea* image, NUX_FILE_LINE_PROTO);
78 Button(NUX_FILE_LINE_PROTO);77 Button(NUX_FILE_LINE_PROTO);
79 virtual ~Button();78 virtual ~Button();
8079
@@ -95,7 +94,7 @@
9594
96 @param label The label of the Button.95 @param label The label of the Button.
97 */96 */
98 void SetLabel(const std::string &button_label);97 void SetLabel(const std::string& button_label);
9998
100 //!Return the label of this Button.99 //!Return the label of this Button.
101 /*!100 /*!
@@ -115,7 +114,7 @@
115114
116 @param A TextureArea.115 @param A TextureArea.
117 */116 */
118 void SetImage(TextureArea *image);117 void SetImage(TextureArea* image);
119118
120 //! Get the image.119 //! Get the image.
121 /*!120 /*!
@@ -243,17 +242,19 @@
243 int top_clip_;242 int top_clip_;
244 int bottom_clip_;243 int bottom_clip_;
245244
246 bool SetLabelProperty(std::string &value, std::string const &str);245 bool SetLabelProperty(std::string& value, std::string const& str);
247246
248 void Initialize(const std::string &str, TextureArea* texture_area);247 void Initialize(const std::string& str, TextureArea* texture_area);
249248
250 void BuildLayout(const std::string &str, TextureArea* texture_area);249 void BuildLayout(const std::string& str, TextureArea* texture_area);
251250
252 TextureArea *image_;251 TextureArea *image_;
253 Size image_minimum_size_;252 Size image_minimum_size_;
254 Size image_maximum_size_;253 Size image_maximum_size_;
255254
256 virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw);255 virtual void Draw(GraphicsEngine& graphics_engine, bool force_draw);
256 virtual void DrawContent(GraphicsEngine& graphics_engine, bool force_draw);
257
257 virtual void RecvClick(int x, int y, unsigned long button_flags, unsigned long key_flags);258 virtual void RecvClick(int x, int y, unsigned long button_flags, unsigned long key_flags);
258// virtual void PreLayoutManagement();259// virtual void PreLayoutManagement();
259// virtual long PostLayoutManagement(long LayoutResult);260// virtual long PostLayoutManagement(long LayoutResult);
260261
=== modified file 'Nux/CheckBox.cpp'
--- Nux/CheckBox.cpp 2012-11-05 21:31:06 +0000
+++ Nux/CheckBox.cpp 2012-12-17 15:42:23 +0000
@@ -28,9 +28,9 @@
28namespace nux28namespace nux
29{29{
30 NUX_IMPLEMENT_OBJECT_TYPE(CheckBox);30 NUX_IMPLEMENT_OBJECT_TYPE(CheckBox);
31 31
32 CheckBox::CheckBox(const std::string &str, bool state, NUX_FILE_LINE_DECL)32 CheckBox::CheckBox(const std::string &str, bool state, NUX_FILE_LINE_DECL)
33 : AbstractCheckedButton(str, state, NUX_FILE_LINE_PARAM)33 : AbstractCheckedButton(str, state, NUX_FILE_LINE_PARAM)
34 {34 {
35 }35 }
3636
@@ -38,9 +38,9 @@
38 {38 {
39 }39 }
4040
41 void CheckBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)41 void CheckBox::Draw(GraphicsEngine& graphics_engine, bool /* force_draw */)
42 {42 {
43 Geometry base = GetGeometry();43 Geometry base = GetNativeGeometry();
44 graphics_engine.PushClippingRectangle(base);44 graphics_engine.PushClippingRectangle(base);
4545
46 InteractState is;46 InteractState is;
@@ -62,7 +62,7 @@
6262
63 GetPainter().PushPaintLayerStack();63 GetPainter().PushPaintLayerStack();
64 {64 {
65 GetPainter().PaintCheckBox(graphics_engine, check_area_->GetGeometry(), is, Color(0xff000000));65 GetPainter().PaintCheckBox(graphics_engine, check_area_->GetGeometryRelativeTo(this), is, Color(0xff000000));
66 static_text_->ProcessDraw(graphics_engine, true);66 static_text_->ProcessDraw(graphics_engine, true);
67 }67 }
68 GetPainter().PopPaintLayerStack();68 GetPainter().PopPaintLayerStack();
6969
=== modified file 'Nux/ColorEditor.cpp'
--- Nux/ColorEditor.cpp 2012-11-05 21:31:06 +0000
+++ Nux/ColorEditor.cpp 2012-12-17 15:42:23 +0000
@@ -207,10 +207,10 @@
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 BasicView(NUX_TRACKER_LOCATION);210 picker_area_ = new BasicView(NUX_TRACKER_LOCATION);
211 channel_area_ = new BasicView(NUX_TRACKER_LOCATION);211 channel_area_ = new BasicView(NUX_TRACKER_LOCATION);
212 selected_color_area_ = new BasicView(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));
216 channel_area_->mouse_up.connect(sigc::mem_fun(this, &ColorEditor::RecvMouseUp));216 channel_area_->mouse_up.connect(sigc::mem_fun(this, &ColorEditor::RecvMouseUp));
@@ -365,14 +365,23 @@
365365
366 void ColorEditor::Draw(GraphicsEngine &graphics_engine, bool force_draw)366 void ColorEditor::Draw(GraphicsEngine &graphics_engine, bool force_draw)
367 {367 {
368 Geometry base = GetGeometry();368 Geometry base = GetNativeGeometry();
369
370 base.OffsetPosition(1, 1);
371 base.OffsetSize(-2, -2);
372369
373 graphics_engine.PushClippingRectangle(base);370 graphics_engine.PushClippingRectangle(base);
374 GetPainter().PushDrawShapeLayer(graphics_engine, base, eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true);371 GetPainter().PushDrawShapeLayer(graphics_engine, base, eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true);
375372
373 GetPainter().PopBackground();
374 graphics_engine.PopClippingRectangle();
375 }
376
377 void ColorEditor::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
378 {
379 Geometry base = GetNativeGeometry();
380 GetPainter().PushShapeLayer(graphics_engine, base, eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true);
381
382 bool force = force_draw || IsFullRedraw();
383
384 GetLayout()->ProcessDraw(graphics_engine, force);
376 if (m_ColorModel == color::RGB)385 if (m_ColorModel == color::RGB)
377 {386 {
378 DrawRGB(graphics_engine, force_draw);387 DrawRGB(graphics_engine, force_draw);
@@ -381,31 +390,6 @@
381 {390 {
382 DrawHSV(graphics_engine, force_draw);391 DrawHSV(graphics_engine, force_draw);
383 }392 }
384
385 GetPainter().PopBackground();
386 graphics_engine.PopClippingRectangle();
387 }
388
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();393 GetPainter().PopBackground();
410 }394 }
411395
@@ -415,10 +399,12 @@
415 int marker_position_x;399 int marker_position_x;
416 int marker_position_y;400 int marker_position_y;
417401
418 graphics_engine.PushClippingRectangle(channel_area_->GetGeometry());402 Geometry cgeo = channel_area_->GetGeometryRelativeTo(this);
419403
420 marker_position_x = channel_area_->GetBaseX();404 graphics_engine.PushClippingRectangle(cgeo);
421 marker_position_y = channel_area_->GetBaseY() + m_VertMarkerPosition.y;405
406 marker_position_x = cgeo.x;
407 marker_position_y = cgeo.y + m_VertMarkerPosition.y;
422 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x, marker_position_y - 5,408 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x, marker_position_y - 5,
423 marker_position_x + 5, marker_position_y,409 marker_position_x + 5, marker_position_y,
424 marker_position_x, marker_position_y + 5, Color(0.0f, 0.0f, 0.0f, 1.0f));410 marker_position_x, marker_position_y + 5, Color(0.0f, 0.0f, 0.0f, 1.0f));
@@ -427,8 +413,8 @@
427 marker_position_x + 4, marker_position_y,413 marker_position_x + 4, marker_position_y,
428 marker_position_x, marker_position_y + 4, Color(0.7f, 0.7f, 0.7f, 1.0f));414 marker_position_x, marker_position_y + 4, Color(0.7f, 0.7f, 0.7f, 1.0f));
429415
430 marker_position_x = channel_area_->GetBaseX() + channel_area_->GetBaseWidth();416 marker_position_x = cgeo.x + cgeo.width;
431 marker_position_y = channel_area_->GetBaseY() + m_VertMarkerPosition.y;417 marker_position_y = cgeo.y + m_VertMarkerPosition.y;
432 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x, marker_position_y - 5,418 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x, marker_position_y - 5,
433 marker_position_x - 5, marker_position_y,419 marker_position_x - 5, marker_position_y,
434 marker_position_x, marker_position_y + 5, Color(0.0f, 0.0f, 0.0f, 1.0f));420 marker_position_x, marker_position_y + 5, Color(0.0f, 0.0f, 0.0f, 1.0f));
@@ -443,58 +429,66 @@
443 {429 {
444 if (m_ColorModel == color::RGB)430 if (m_ColorModel == color::RGB)
445 {431 {
446 GetPainter().Paint2DQuadColor(graphics_engine, selected_color_area_->GetGeometry(), Color(rgb_));432 GetPainter().Paint2DQuadColor(graphics_engine, selected_color_area_->GetGeometryRelativeTo(this), Color(rgb_));
447 Color BaseChannelTop;433 Color BaseChannelTop;
448 Color BaseChannelBottom;434 Color BaseChannelBottom;
449435
436 Geometry pgeo = picker_area_->GetGeometryRelativeTo(this);
437 Geometry ageo = picker_area_->GetAbsoluteGeometry();
438
450 if (color_channel_ == color::RED)439 if (color_channel_ == color::RED)
451 {440 {
452 m_RedShader->SetColor(rgb_.red, rgb_.green, rgb_.blue, 1.0f);441 m_RedShader->SetColor(rgb_.red, rgb_.green, rgb_.blue, 1.0f);
453 m_RedShader->SetScreenPositionOffset(graphics_engine.GetViewportX(), graphics_engine.GetViewportY());442 m_RedShader->SetScreenPositionOffset(graphics_engine.GetViewportX() + ageo.x,
443 graphics_engine.GetViewportY() + ageo.y);
454 BaseChannelTop = Color(1.0f, rgb_.green, rgb_.blue, 1.0f);444 BaseChannelTop = Color(1.0f, rgb_.green, rgb_.blue, 1.0f);
455 BaseChannelBottom = Color(0.0f, rgb_.green, rgb_.blue, 1.0f);445 BaseChannelBottom = Color(0.0f, rgb_.green, rgb_.blue, 1.0f);
456 m_RedShader->Render(446 m_RedShader->Render(
457 picker_area_->GetBaseX(),447 pgeo.x,
458 picker_area_->GetBaseY(),448 pgeo.y + graphics_engine.GetViewportY(),
459 0,449 0,
460 picker_area_->GetBaseWidth(),450 pgeo.width,
461 picker_area_->GetBaseHeight(),451 pgeo.height,
462 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()452 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()
463 );453 );
464 }454 }
465 else if (color_channel_ == color::GREEN)455 else if (color_channel_ == color::GREEN)
466 {456 {
467 m_GreenShader->SetColor(rgb_.red, rgb_.green, rgb_.blue, 1.0f);457 m_GreenShader->SetColor(rgb_.red, rgb_.green, rgb_.blue, 1.0f);
468 m_GreenShader->SetScreenPositionOffset(graphics_engine.GetViewportX(), graphics_engine.GetViewportY());458 m_GreenShader->SetScreenPositionOffset(graphics_engine.GetViewportX() + ageo.x,
459 graphics_engine.GetViewportY() + ageo.y);
469 BaseChannelTop = Color(rgb_.red, 1.0f, rgb_.blue, 1.0f);460 BaseChannelTop = Color(rgb_.red, 1.0f, rgb_.blue, 1.0f);
470 BaseChannelBottom = Color(rgb_.red, 0.0f, rgb_.blue, 1.0f);461 BaseChannelBottom = Color(rgb_.red, 0.0f, rgb_.blue, 1.0f);
471 m_GreenShader->Render(462 m_GreenShader->Render(
472 picker_area_->GetBaseX(),463 pgeo.x,
473 picker_area_->GetBaseY(),464 pgeo.y,
474 0,465 0,
475 picker_area_->GetBaseWidth(),466 pgeo.width,
476 picker_area_->GetBaseHeight(),467 pgeo.height,
477 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()468 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()
478 );469 );
479 }470 }
480 else if (color_channel_ == color::BLUE)471 else if (color_channel_ == color::BLUE)
481 {472 {
482 m_BlueShader->SetColor(rgb_.red, rgb_.green, rgb_.blue, 1.0f);473 m_BlueShader->SetColor(rgb_.red, rgb_.green, rgb_.blue, 1.0f);
483 m_BlueShader->SetScreenPositionOffset(graphics_engine.GetViewportX(), graphics_engine.GetViewportY());474 m_BlueShader->SetScreenPositionOffset(graphics_engine.GetViewportX() + ageo.x,
475 graphics_engine.GetViewportY() + ageo.y);
484 BaseChannelTop = Color(rgb_.red, rgb_.green, 1.0f, 1.0f);476 BaseChannelTop = Color(rgb_.red, rgb_.green, 1.0f, 1.0f);
485 BaseChannelBottom = Color(rgb_.red, rgb_.green, 0.0f, 1.0f);477 BaseChannelBottom = Color(rgb_.red, rgb_.green, 0.0f, 1.0f);
486 m_BlueShader->Render(478 m_BlueShader->Render(
487 picker_area_->GetBaseX(),479 pgeo.x,
488 picker_area_->GetBaseY(),480 pgeo.y,
489 0,481 0,
490 picker_area_->GetBaseWidth(),482 pgeo.width,
491 picker_area_->GetBaseHeight(),483 pgeo.height,
492 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()484 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()
493 );485 );
494 }486 }
495487
496 Geometry pickermarker = Geometry(GetBaseX() + m_MarkerPosition.x - 2, GetBaseY() + m_MarkerPosition.y - 2, 5, 5);488 Geometry cgeo = channel_area_->GetGeometryRelativeTo(this);
497 Geometry basepickermarker = Geometry(channel_area_->GetBaseX(), channel_area_->GetBaseY() + m_VertMarkerPosition.y, 5, 5);489
490 Geometry pickermarker = Geometry(GetNativeX() + m_MarkerPosition.x - 2, GetNativeY() + m_MarkerPosition.y - 2, 5, 5);
491 Geometry basepickermarker = Geometry(cgeo.x, cgeo.y + m_VertMarkerPosition.y, 5, 5);
498492
499 Color color(rgb_.red, rgb_.green, rgb_.blue);493 Color color(rgb_.red, rgb_.green, rgb_.blue);
500 float luma = color::LumaRed * rgb_.red + color::LumaGreen * rgb_.green + color::LumaBlue * rgb_.blue;494 float luma = color::LumaRed * rgb_.red + color::LumaGreen * rgb_.green + color::LumaBlue * rgb_.blue;
@@ -502,7 +496,7 @@
502496
503 GetPainter().Paint2DQuadWireframe(graphics_engine, pickermarker, one_minus_luma);497 GetPainter().Paint2DQuadWireframe(graphics_engine, pickermarker, one_minus_luma);
504498
505 GetPainter().Paint2DQuadColor(graphics_engine, channel_area_->GetGeometry(), BaseChannelTop, BaseChannelBottom, BaseChannelBottom, BaseChannelTop);499 GetPainter().Paint2DQuadColor(graphics_engine, cgeo, BaseChannelTop, BaseChannelBottom, BaseChannelBottom, BaseChannelTop);
506 // Draw Marker on Base Chanel Area500 // Draw Marker on Base Chanel Area
507 DrawBaseChannelMarker(graphics_engine);501 DrawBaseChannelMarker(graphics_engine);
508 }502 }
@@ -513,31 +507,38 @@
513 if (m_ColorModel == color::HSV)507 if (m_ColorModel == color::HSV)
514 {508 {
515 color::RedGreenBlue rgb(hsv_);509 color::RedGreenBlue rgb(hsv_);
516 GetPainter().Paint2DQuadColor(graphics_engine, selected_color_area_->GetGeometry(), Color(rgb));510 GetPainter().Paint2DQuadColor(graphics_engine, selected_color_area_->GetGeometryRelativeTo(this), Color(rgb_));
517511
518 Color BaseChannelTop;512 Color BaseChannelTop;
519 Color BaseChannelBottom;513 Color BaseChannelBottom;
520514
515 Geometry pgeo = picker_area_->GetGeometryRelativeTo(this);
516 Geometry ageo = picker_area_->GetAbsoluteGeometry();
517
518 Geometry cgeo = channel_area_->GetGeometryRelativeTo(this);
519
521 if (color_channel_ == color::HUE)520 if (color_channel_ == color::HUE)
522 {521 {
522
523 m_HueShader->SetColor(hsv_.hue, hsv_.saturation, hsv_.value, 1.0f);523 m_HueShader->SetColor(hsv_.hue, hsv_.saturation, hsv_.value, 1.0f);
524 m_HueShader->SetScreenPositionOffset(graphics_engine.GetViewportX(), graphics_engine.GetViewportY());524 m_HueShader->SetScreenPositionOffset(graphics_engine.GetViewportX() + ageo.x,
525 graphics_engine.GetViewportY() + ageo.y);
525 m_HueShader->Render(526 m_HueShader->Render(
526 picker_area_->GetBaseX(),527 pgeo.x,
527 picker_area_->GetBaseY(),528 pgeo.y,
528 0,529 0,
529 picker_area_->GetBaseWidth(),530 pgeo.width,
530 picker_area_->GetBaseHeight(),531 pgeo.height,
531 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()532 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()
532 );533 );
533534
534 Geometry P = channel_area_->GetGeometry();535 Geometry P = channel_area_->GetGeometryRelativeTo(this);
535536
536 float s = 1.0f - 1.0f;537 float s = 1.0f - 1.0f;
537 float v = 1.0f;538 float v = 1.0f;
538 float fw = P.GetHeight() / 6;539 float fw = P.GetHeight() / 6;
539540
540 Geometry p = Geometry(P.x, P.y, P.GetWidth(), fw);541 Geometry p = Geometry(P.x, P.y, P.width, fw);
541 GetPainter().Paint2DQuadVGradient(graphics_engine, p, Color(1.0f * v, s * v, s * v), Color(1.0f * v, s * v, 1.0f * v));542 GetPainter().Paint2DQuadVGradient(graphics_engine, p, Color(1.0f * v, s * v, s * v), Color(1.0f * v, s * v, 1.0f * v));
542 p.SetY(P.y + fw);543 p.SetY(P.y + fw);
543 GetPainter().Paint2DQuadVGradient(graphics_engine, p, Color(1.0f * v, s * v, 1.0f * v), Color(s * v, s * v, 1.0f * v));544 GetPainter().Paint2DQuadVGradient(graphics_engine, p, Color(1.0f * v, s * v, 1.0f * v), Color(s * v, s * v, 1.0f * v));
@@ -551,7 +552,7 @@
551 p.SetHeight(P.GetHeight() - 5 * fw); // correct rounding errors552 p.SetHeight(P.GetHeight() - 5 * fw); // correct rounding errors
552 GetPainter().Paint2DQuadVGradient(graphics_engine, p, Color(1.0f * v, 1.0f * v, s * v), Color(1.0f * v, s * v, s * v));553 GetPainter().Paint2DQuadVGradient(graphics_engine, p, Color(1.0f * v, 1.0f * v, s * v), Color(1.0f * v, s * v, s * v));
553554
554 Geometry pickermarker = Geometry(GetBaseX() + m_MarkerPosition.x - 2, GetBaseY() + m_MarkerPosition.y - 2, 5, 5);555 Geometry pickermarker = Geometry(GetNativeX() + m_MarkerPosition.x - 2, GetNativeY() + m_MarkerPosition.y - 2, 5, 5);
555556
556 float luma = color::LumaRed * rgb_.red + color::LumaGreen * rgb_.green + color::LumaBlue * rgb_.blue;557 float luma = color::LumaRed * rgb_.red + color::LumaGreen * rgb_.green + color::LumaBlue * rgb_.blue;
557 Color one_minus_luma(1.0f - luma, 1.0f - luma, 1.0f - luma);558 Color one_minus_luma(1.0f - luma, 1.0f - luma, 1.0f - luma);
@@ -563,50 +564,56 @@
563 if (value < 0.3f) value = 0.3f;564 if (value < 0.3f) value = 0.3f;
564565
565 m_SaturationShader->SetColor(hsv_.hue, hsv_.saturation, hsv_.value, 1.0f);566 m_SaturationShader->SetColor(hsv_.hue, hsv_.saturation, hsv_.value, 1.0f);
566 m_SaturationShader->SetScreenPositionOffset(graphics_engine.GetViewportX(), graphics_engine.GetViewportY());567 m_SaturationShader->SetScreenPositionOffset(graphics_engine.GetViewportX() + ageo.x,
568 graphics_engine.GetViewportY() + ageo.y);
567 BaseChannelTop = Color(color::RedGreenBlue(color::HueSaturationValue(hsv_.hue, 1.0f, value)));569 BaseChannelTop = Color(color::RedGreenBlue(color::HueSaturationValue(hsv_.hue, 1.0f, value)));
568 BaseChannelBottom = Color(value, value, value, 1.0f);570 BaseChannelBottom = Color(value, value, value, 1.0f);
569 m_SaturationShader->Render(571 m_SaturationShader->Render(
570 picker_area_->GetBaseX(),572 pgeo.x,
571 picker_area_->GetBaseY(),573 pgeo.y,
572 0,574 0,
573 picker_area_->GetBaseWidth(),575 pgeo.width,
574 picker_area_->GetBaseHeight(),576 pgeo.height,
575 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()577 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()
576 );578 );
577579
578 //Geometry pickermarker = Geometry(GetX() + x - 2, GetY() + y -2, 5, 5);580 //Geometry pickermarker = Geometry(GetX() + x - 2, GetY() + y -2, 5, 5);
579 Geometry pickermarker = Geometry(GetBaseX() + m_MarkerPosition.x - 2, GetBaseY() + m_MarkerPosition.y - 2, 5, 5);581 Geometry pickermarker = Geometry(GetNativeX() + m_MarkerPosition.x - 2, GetNativeY() + m_MarkerPosition.y - 2, 5, 5);
580582
581 float luma = color::LumaRed * rgb_.red + color::LumaGreen * rgb_.green + color::LumaBlue * rgb_.blue;583 float luma = color::LumaRed * rgb_.red + color::LumaGreen * rgb_.green + color::LumaBlue * rgb_.blue;
582 Color one_minus_luma(1.0f - luma, 1.0f - luma, 1.0f - luma);584 Color one_minus_luma(1.0f - luma, 1.0f - luma, 1.0f - luma);
583585
584 GetPainter().Paint2DQuadWireframe(graphics_engine, pickermarker, one_minus_luma);586 GetPainter().Paint2DQuadWireframe(graphics_engine, pickermarker, one_minus_luma);
585 GetPainter().Paint2DQuadColor(graphics_engine, channel_area_->GetGeometry(), BaseChannelTop, BaseChannelBottom, BaseChannelBottom, BaseChannelTop);587 GetPainter().Paint2DQuadColor(graphics_engine,
588 cgeo,
589 BaseChannelTop, BaseChannelBottom, BaseChannelBottom, BaseChannelTop);
586 }590 }
587 else if (color_channel_ == color::VALUE)591 else if (color_channel_ == color::VALUE)
588 {592 {
589 m_ValueShader->SetColor(hsv_.hue, hsv_.saturation, hsv_.value, 1.0f);593 m_ValueShader->SetColor(hsv_.hue, hsv_.saturation, hsv_.value, 1.0f);
590 m_ValueShader->SetScreenPositionOffset(graphics_engine.GetViewportX(), graphics_engine.GetViewportY());594 m_ValueShader->SetScreenPositionOffset(graphics_engine.GetViewportX() + ageo.x,
595 graphics_engine.GetViewportY() + ageo.y);
591 BaseChannelTop = Color(color::RedGreenBlue(color::HueSaturationValue(hsv_.hue, hsv_.saturation, 1.0f)));596 BaseChannelTop = Color(color::RedGreenBlue(color::HueSaturationValue(hsv_.hue, hsv_.saturation, 1.0f)));
592 BaseChannelBottom = Color(color::RedGreenBlue(color::HueSaturationValue(hsv_.hue, hsv_.saturation, 0.0f)));597 BaseChannelBottom = Color(color::RedGreenBlue(color::HueSaturationValue(hsv_.hue, hsv_.saturation, 0.0f)));
593 m_ValueShader->Render(598 m_ValueShader->Render(
594 picker_area_->GetBaseX(),599 pgeo.x,
595 picker_area_->GetBaseY(),600 pgeo.y,
596 0,601 0,
597 picker_area_->GetBaseWidth(),602 pgeo.width,
598 picker_area_->GetBaseHeight(),603 pgeo.height,
599 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()604 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()
600 );605 );
601606
602 //Geometry pickermarker = Geometry(GetX() + x - 2, GetY() + y -2, 5, 5);607 //Geometry pickermarker = Geometry(GetX() + x - 2, GetY() + y -2, 5, 5);
603 Geometry pickermarker = Geometry(GetBaseX() + m_MarkerPosition.x - 2, GetBaseY() + m_MarkerPosition.y - 2, 5, 5);608 Geometry pickermarker = Geometry(GetNativeX() + m_MarkerPosition.x - 2, GetNativeY() + m_MarkerPosition.y - 2, 5, 5);
604609
605 float luma = color::LumaRed * rgb_.red + color::LumaGreen * rgb_.green + color::LumaBlue * rgb_.blue;610 float luma = color::LumaRed * rgb_.red + color::LumaGreen * rgb_.green + color::LumaBlue * rgb_.blue;
606 Color one_minus_luma(1.0f - luma, 1.0f - luma, 1.0f - luma);611 Color one_minus_luma(1.0f - luma, 1.0f - luma, 1.0f - luma);
607612
608 GetPainter().Paint2DQuadWireframe(graphics_engine, pickermarker, one_minus_luma);613 GetPainter().Paint2DQuadWireframe(graphics_engine, pickermarker, one_minus_luma);
609 GetPainter().Paint2DQuadColor(graphics_engine, channel_area_->GetGeometry(), BaseChannelTop, BaseChannelBottom, BaseChannelBottom, BaseChannelTop);614 GetPainter().Paint2DQuadColor(graphics_engine,
615 cgeo,
616 BaseChannelTop, BaseChannelBottom, BaseChannelBottom, BaseChannelTop);
610 }617 }
611618
612 // Draw Marker on Base Chanel Area619 // Draw Marker on Base Chanel Area
@@ -1009,7 +1016,7 @@
1009 color_channel_ = colorchannel;1016 color_channel_ = colorchannel;
1010 RecvCheckColorModel(true, m_ColorModel, color_channel_);1017 RecvCheckColorModel(true, m_ColorModel, color_channel_);
10111018
1012 /*FIXME - disabled because we lost radiogroup 1019 /*FIXME - disabled because we lost radiogroup
1013 if (color_channel_ == color::RED)1020 if (color_channel_ == color::RED)
1014 radiogroup->ActivateButton(redcheck);1021 radiogroup->ActivateButton(redcheck);
1015 else if (color_channel_ == color::GREEN)1022 else if (color_channel_ == color::GREEN)
10161023
=== modified file 'Nux/ColorEditor.h'
--- Nux/ColorEditor.h 2011-10-18 20:00:59 +0000
+++ Nux/ColorEditor.h 2012-12-17 15:42:23 +0000
@@ -154,9 +154,9 @@
154154
155 color::Channel color_channel_;155 color::Channel color_channel_;
156 color::Model m_ColorModel;156 color::Model m_ColorModel;
157 InputArea *picker_area_;157 BasicView *picker_area_;
158 InputArea *channel_area_;158 BasicView *channel_area_;
159 InputArea *selected_color_area_;159 BasicView *selected_color_area_;
160 HLayout *m_hlayout;160 HLayout *m_hlayout;
161 VLayout *ctrllayout;161 VLayout *ctrllayout;
162162
163163
=== modified file 'Nux/ColorPreview.cpp'
--- Nux/ColorPreview.cpp 2012-11-05 21:31:06 +0000
+++ Nux/ColorPreview.cpp 2012-12-17 15:42:23 +0000
@@ -84,10 +84,10 @@
8484
85 void ColorPreview::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)85 void ColorPreview::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
86 {86 {
87 Geometry base = GetGeometry();87 Geometry base = GetNativeGeometry();
8888
89 GetPainter().PaintBackground(graphics_engine, base);89 GetPainter().PaintBackground(graphics_engine, base);
90 GetPainter().PaintShape(graphics_engine, m_ColorArea->GetGeometry(), m_Color, eSHAPE_CORNER_ROUND4, false);90 GetPainter().PaintShape(graphics_engine, m_ColorArea->GetGeometryRelativeTo(this), m_Color, eSHAPE_CORNER_ROUND4, false);
91 //GetPainter().Paint2DQuadWireFrameColor(graphics_engine, base, Color(COLOR_BACKGROUND_SECONDARY));91 //GetPainter().Paint2DQuadWireFrameColor(graphics_engine, base, Color(COLOR_BACKGROUND_SECONDARY));
92 m_ColorValue->QueueDraw();92 m_ColorValue->QueueDraw();
93 }93 }
@@ -138,5 +138,4 @@
138 {138 {
139 m_Color = color;139 m_Color = color;
140 }140 }
141
142}141}
143142
=== modified file 'Nux/ColorPreview.h'
--- Nux/ColorPreview.h 2012-10-02 07:32:55 +0000
+++ Nux/ColorPreview.h 2012-12-17 15:42:23 +0000
@@ -59,7 +59,7 @@
5959
60 Color m_Color;60 Color m_Color;
61 HLayout *m_hlayout;61 HLayout *m_hlayout;
62 InputArea *m_ColorArea;62 BasicView *m_ColorArea;
63 StaticTextBox *m_ColorValue;63 StaticTextBox *m_ColorValue;
64 ColorDialogProxy *m_DialogThreadProxy;64 ColorDialogProxy *m_DialogThreadProxy;
65 };65 };
6666
=== modified file 'Nux/EditTextBox.cpp'
--- Nux/EditTextBox.cpp 2012-11-05 21:31:06 +0000
+++ Nux/EditTextBox.cpp 2012-12-17 15:42:23 +0000
@@ -93,7 +93,7 @@
9393
94 void EditTextBox::ScrollTimerInterrupt(void * /* v */)94 void EditTextBox::ScrollTimerInterrupt(void * /* v */)
95 {95 {
96 Geometry base = GetGeometry();96 Geometry base = GetNativeGeometry();
97 const Event& event = GetGraphicsDisplay()->GetCurrentEvent();97 const Event& event = GetGraphicsDisplay()->GetCurrentEvent();
9898
99 int X = event.x;99 int X = event.x;
@@ -149,7 +149,7 @@
149149
150 void EditTextBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)150 void EditTextBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
151 {151 {
152 Geometry base = GetGeometry();152 Geometry base = GetNativeGeometry();
153153
154 {154 {
155 graphics_engine.PushClippingRectangle(base);155 graphics_engine.PushClippingRectangle(base);
@@ -159,7 +159,7 @@
159 if (HasKeyboardFocus())159 if (HasKeyboardFocus())
160 {160 {
161161
162 GetPainter().PaintColorTextLineEdit(graphics_engine, GetGeometry(),162 GetPainter().PaintColorTextLineEdit(graphics_engine, GetNativeGeometry(),
163 m_KeyboardHandler.GetTextLine(),163 m_KeyboardHandler.GetTextLine(),
164 GetTextColor(),164 GetTextColor(),
165 m_WriteAlpha,165 m_WriteAlpha,
@@ -176,7 +176,7 @@
176 }176 }
177 else177 else
178 {178 {
179 GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetGeometry(),179 GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetNativeGeometry(),
180 m_KeyboardHandler.GetTextLine(),180 m_KeyboardHandler.GetTextLine(),
181 GetTextColor());181 GetTextColor());
182 }182 }
@@ -285,7 +285,7 @@
285285
286 void EditTextBox::RecvMouseDrag(int x, int y, int /* dx */, int /* dy */, unsigned long /* button_flags */, unsigned long /* key_flags */)286 void EditTextBox::RecvMouseDrag(int x, int y, int /* dx */, int /* dy */, unsigned long /* button_flags */, unsigned long /* key_flags */)
287 {287 {
288 Geometry base = GetGeometry();288 Geometry base = GetNativeGeometry();
289289
290 int X = x + base.x;290 int X = x + base.x;
291291
@@ -309,7 +309,7 @@
309 {309 {
310 long ret = View::PostLayoutManagement(LayoutResult);310 long ret = View::PostLayoutManagement(LayoutResult);
311311
312 m_KeyboardHandler.SetClipRegion(GetGeometry());312 m_KeyboardHandler.SetClipRegion(GetNativeGeometry());
313 return ret;313 return ret;
314 }314 }
315315
@@ -325,7 +325,7 @@
325 if (eventType == NUX_KEYDOWN)325 if (eventType == NUX_KEYDOWN)
326 text_input_mode_ = true;326 text_input_mode_ = true;
327327
328 m_KeyboardHandler.ProcessKey(eventType, keysym, state, character[0], GetGeometry());328 m_KeyboardHandler.ProcessKey(eventType, keysym, state, character[0], GetNativeGeometry());
329329
330330
331 // When a key event happens, show the cursor.331 // When a key event happens, show the cursor.
332332
=== modified file 'Nux/FileSelector.cpp'
--- Nux/FileSelector.cpp 2012-10-10 22:46:50 +0000
+++ Nux/FileSelector.cpp 2012-12-17 15:42:23 +0000
@@ -65,25 +65,25 @@
6565
66 void FileSelector::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)66 void FileSelector::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
67 {67 {
68 Geometry base = GetGeometry();68 Geometry base = GetNativeGeometry();
6969
70 GetPainter().PaintBackground(graphics_engine, base);70 GetPainter().PaintBackground(graphics_engine, base);
7171
72 if (m_OpenButton->IsMouseInside())72 if (m_OpenButton->IsMouseInside())
73 {73 {
7474
75 GetPainter().PaintShapeCorner(graphics_engine, m_OpenButton->GetGeometry(), FILESELECTOR_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,75 GetPainter().PaintShapeCorner(graphics_engine, m_OpenButton->GetNativeGeometry(), FILESELECTOR_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
76 eCornerTopRight | eCornerBottomRight, false);76 eCornerTopRight | eCornerBottomRight, false);
77 }77 }
78 else78 else
79 {79 {
80 GetPainter().PaintShapeCorner(graphics_engine, m_OpenButton->GetGeometry(), FILESELECTOR_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,80 GetPainter().PaintShapeCorner(graphics_engine, m_OpenButton->GetNativeGeometry(), FILESELECTOR_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
81 eCornerTopRight | eCornerBottomRight, false);81 eCornerTopRight | eCornerBottomRight, false);
82 }82 }
8383
84 GeometryPositioning gp(eHACenter, eVACenter);84 GeometryPositioning gp(eHACenter, eVACenter);
85 Geometry TextureGeo = Geometry(0, 0, m_Texture->GetWidth(), m_Texture->GetHeight());85 Geometry TextureGeo = Geometry(0, 0, m_Texture->GetWidth(), m_Texture->GetHeight());
86 Geometry GeoPo = ComputeGeometryPositioning(m_OpenButton->GetGeometry(), TextureGeo, gp);86 Geometry GeoPo = ComputeGeometryPositioning(m_OpenButton->GetNativeGeometry(), TextureGeo, gp);
8787
88 GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetBlend(TRUE, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);88 GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetBlend(TRUE, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
89 GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetColorMask(TRUE, TRUE, TRUE, FALSE);89 GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetColorMask(TRUE, TRUE, TRUE, FALSE);
@@ -99,7 +99,7 @@
9999
100 void FileSelector::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)100 void FileSelector::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
101 {101 {
102 Geometry base = GetGeometry();102 Geometry base = GetNativeGeometry();
103103
104 m_FileEditTextBox->ProcessDraw(graphics_engine, force_draw);104 m_FileEditTextBox->ProcessDraw(graphics_engine, force_draw);
105 }105 }
106106
=== modified file 'Nux/FloatingWindow.cpp'
--- Nux/FloatingWindow.cpp 2012-11-12 20:59:56 +0000
+++ Nux/FloatingWindow.cpp 2012-12-17 15:42:23 +0000
@@ -68,7 +68,7 @@
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(Geometry(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);
@@ -121,7 +121,7 @@
121 _minimize_button->UnReference();121 _minimize_button->UnReference();
122 CloseIcon->UnReference();122 CloseIcon->UnReference();
123 MinimizeIcon->UnReference();123 MinimizeIcon->UnReference();
124 124
125 _title_bar_layout->UnParentObject();125 _title_bar_layout->UnParentObject();
126 _title_bar_layout->UnReference();126 _title_bar_layout->UnReference();
127 }127 }
@@ -164,7 +164,7 @@
164164
165 void FloatingWindow::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)165 void FloatingWindow::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
166 {166 {
167 Geometry base = GetGeometry();167 Geometry base = GetNativeGeometry();
168 // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).168 // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).
169 base.SetX(0);169 base.SetX(0);
170 base.SetY(0);170 base.SetY(0);
@@ -174,12 +174,13 @@
174174
175 if (HasTitleBar())175 if (HasTitleBar())
176 {176 {
177 GetPainter().PaintShapeCorner(graphics_engine, Geometry(_title_bar->GetBaseX(), _title_bar->GetBaseY(),177 Geometry tgeo = _title_bar->GetGeometryRelativeTo(this);
178 GetPainter().PaintShapeCorner(graphics_engine, Geometry(tgeo.x, tgeo.y,
178 _title_bar->GetBaseWidth(), _title_bar->GetBaseHeight()), Color(0xFF2f2f2f),179 _title_bar->GetBaseWidth(), _title_bar->GetBaseHeight()), Color(0xFF2f2f2f),
179 eSHAPE_CORNER_ROUND10, eCornerTopLeft | eCornerTopRight);180 eSHAPE_CORNER_ROUND10, eCornerTopLeft | eCornerTopRight);
180181
181 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), _window_title_bar->GetGeometry(), _window_title, Color(0xFFFFFFFF), true, eAlignTextCenter);182 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), _window_title_bar->GetNativeGeometry(), _window_title, Color(0xFFFFFFFF), true, eAlignTextCenter);
182 GetPainter().Draw2DTextureAligned(graphics_engine, CloseIcon, _close_button->GetGeometry(), TextureAlignmentStyle(eTACenter, eTACenter));183 GetPainter().Draw2DTextureAligned(graphics_engine, CloseIcon, _close_button->GetGeometryRelativeTo(this), TextureAlignmentStyle(eTACenter, eTACenter));
183 }184 }
184185
185 GetPainter().PopBackground();186 GetPainter().PopBackground();
@@ -188,7 +189,7 @@
188189
189 void FloatingWindow::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)190 void FloatingWindow::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
190 {191 {
191 Geometry base = GetGeometry();192 Geometry base = GetNativeGeometry();
192 // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).193 // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).
193 base.SetX(0);194 base.SetX(0);
194 base.SetY(0);195 base.SetY(0);
@@ -250,7 +251,7 @@
250 }251 }
251252
252 Geometry geo;253 Geometry geo;
253 geo = GetGeometry();254 geo = GetNativeGeometry();
254255
255 int ddx = 0;256 int ddx = 0;
256 int ddy = 0;257 int ddy = 0;
@@ -283,7 +284,7 @@
283 if (m_input_window != 0)284 if (m_input_window != 0)
284 {285 {
285 //nuxDebugMsg("Resize Input window: %d, %d, %d, %d", geo.x, geo.y, geo.width, geo.height);286 //nuxDebugMsg("Resize Input window: %d, %d, %d, %d", geo.x, geo.y, geo.width, geo.height);
286 m_input_window->SetGeometry(GetGeometry());287 m_input_window->SetGeometry(GetNativeGeometry());
287 }288 }
288#endif289#endif
289290
@@ -299,7 +300,7 @@
299 void FloatingWindow::RecvTitleBarMouseDrag(int /* x */, int /* y */, int dx, int dy, unsigned long /* button_flags */, unsigned long /* key_flags */)300 void FloatingWindow::RecvTitleBarMouseDrag(int /* x */, int /* y */, int dx, int dy, unsigned long /* button_flags */, unsigned long /* key_flags */)
300 {301 {
301 Geometry geo;302 Geometry geo;
302 geo = GetGeometry();303 geo = GetNativeGeometry();
303 geo.OffsetPosition(dx, dy);304 geo.OffsetPosition(dx, dy);
304305
305 // Set the Window Size and Position306 // Set the Window Size and Position
@@ -313,7 +314,7 @@
313 if (m_input_window != 0)314 if (m_input_window != 0)
314 {315 {
315 //nuxDebugMsg("Resize Input window: %d, %d, %d, %d", geo.x, geo.y, geo.width, geo.height);316 //nuxDebugMsg("Resize Input window: %d, %d, %d, %d", geo.x, geo.y, geo.width, geo.height);
316 m_input_window->SetGeometry(GetGeometry());317 m_input_window->SetGeometry(GetNativeGeometry());
317 }318 }
318#endif319#endif
319320
@@ -333,7 +334,7 @@
333// Here we need to position the header by hand because it is not under the control of vlayout.334// Here we need to position the header by hand because it is not under the control of vlayout.
334 void FloatingWindow::PreLayoutManagement()335 void FloatingWindow::PreLayoutManagement()
335 {336 {
336 Geometry geo = GetGeometry();337 Geometry geo = GetNativeGeometry();
337338
338 if (m_configure_notify_callback)339 if (m_configure_notify_callback)
339 {340 {
@@ -342,13 +343,13 @@
342 if (geo.IsNull())343 if (geo.IsNull())
343 {344 {
344 nuxDebugMsg("[FloatingWindow::PreLayoutManagement] Received an invalid Geometry.");345 nuxDebugMsg("[FloatingWindow::PreLayoutManagement] Received an invalid Geometry.");
345 geo = GetGeometry();346 geo = GetNativeGeometry();
346 }347 }
347 else348 else
348 {349 {
349 Area::SetGeometry(geo);350 Area::SetGeometry(geo);
350 // Get the geometry adjusted with respect to min and max dimension of this area.351 // Get the geometry adjusted with respect to min and max dimension of this area.
351 geo = GetGeometry();352 geo = GetNativeGeometry();
352 }353 }
353 }354 }
354355
@@ -377,17 +378,17 @@
377 {378 {
378 if (IsSizeMatchContent() && m_layout)379 if (IsSizeMatchContent() && m_layout)
379 {380 {
380 Geometry layout_geometry = m_layout->GetGeometry();381 Geometry layout_geometry = m_layout->GetNativeGeometry();
381382
382 Geometry WindowGeometry = Geometry(GetGeometry().x,383 Geometry WindowGeometry = Geometry(GetNativeGeometry().x,
383 GetGeometry().y,384 GetNativeGeometry().y,
384 layout_geometry.GetWidth() + 2 * m_Border,385 layout_geometry.GetWidth() + 2 * m_Border,
385 layout_geometry.GetHeight() + m_Border + m_TopBorder);386 layout_geometry.GetHeight() + m_Border + m_TopBorder);
386387
387 Area::SetGeometry(WindowGeometry);388 Area::SetGeometry(WindowGeometry);
388 }389 }
389390
390 Geometry geo = GetGeometry();391 Geometry geo = GetNativeGeometry();
391392
392 // Drag Bar Geometry393 // Drag Bar Geometry
393 if (HasTitleBar())394 if (HasTitleBar())
@@ -401,7 +402,7 @@
401 _resize_handle->SetGeometry(temp);402 _resize_handle->SetGeometry(temp);
402403
403 // Title Bar404 // Title Bar
404 _title_bar_layout->SetGeometry(_title_bar->GetGeometry());405 _title_bar_layout->SetGeometry(_title_bar->GetGeometryRelativeTo(this));
405 GetWindowThread()->ComputeElementLayout(_title_bar_layout);406 GetWindowThread()->ComputeElementLayout(_title_bar_layout);
406407
407 // A FloatingWindow must kill the result of the management and pass it to the parent Layout.408 // A FloatingWindow must kill the result of the management and pass it to the parent Layout.
@@ -415,7 +416,7 @@
415 {416 {
416 //ScrollView::ComputeContentPosition(offsetX, offsetY);417 //ScrollView::ComputeContentPosition(offsetX, offsetY);
417418
418 Geometry geo = GetGeometry();419 Geometry geo = GetNativeGeometry();
419420
420 // Drag Bar Geometry421 // Drag Bar Geometry
421 if (HasTitleBar())422 if (HasTitleBar())
@@ -429,7 +430,7 @@
429 _resize_handle->SetGeometry(temp);430 _resize_handle->SetGeometry(temp);
430431
431 // Title Bar432 // Title Bar
432 _title_bar_layout->SetGeometry(_title_bar->GetGeometry());433 _title_bar_layout->SetGeometry(_title_bar->GetGeometryRelativeTo(this));
433 GetWindowThread()->ComputeElementLayout(_title_bar_layout);434 GetWindowThread()->ComputeElementLayout(_title_bar_layout);
434435
435 }436 }
@@ -438,10 +439,10 @@
438 {439 {
439 // Define the geometry of some of the component of the window. Otherwise, if the composition layout is not set,440 // Define the geometry of some of the component of the window. Otherwise, if the composition layout is not set,
440 // then the component won't be correctly placed after a SetGeometry. This can be redundant if the composition layout is set.441 // then the component won't be correctly placed after a SetGeometry. This can be redundant if the composition layout is set.
441 Geometry base = GetGeometry();442 Geometry base = GetNativeGeometry();
442 _title_bar->SetGeometry(Geometry(0, 0, base.GetWidth(), _title_bar_height));443 _title_bar->SetGeometry(Geometry(0, 0, base.GetWidth(), _title_bar_height));
443444
444 _title_bar_layout->SetGeometry(_title_bar->GetGeometry());445 _title_bar_layout->SetGeometry(_title_bar->GetGeometryRelativeTo(this));
445 GetWindowThread()->ComputeElementLayout(_title_bar_layout);446 GetWindowThread()->ComputeElementLayout(_title_bar_layout);
446447
447 // Size grip Geometry448 // Size grip Geometry
448449
=== modified file 'Nux/GridHLayout.cpp'
--- Nux/GridHLayout.cpp 2012-11-05 21:31:06 +0000
+++ Nux/GridHLayout.cpp 2012-12-17 15:42:23 +0000
@@ -196,7 +196,7 @@
196 // 12 13 .. .. .. ..196 // 12 13 .. .. .. ..
197 // This is a left to right fill going down. An option can be added the fill the grid from top to bottom and going toward the right.197 // This is a left to right fill going down. An option can be added the fill the grid from top to bottom and going toward the right.
198198
199 nux::Geometry base = GetGeometry();199 nux::Geometry base = GetNativeGeometry();
200 it = elements.begin();200 it = elements.begin();
201 int num_row = 0;201 int num_row = 0;
202 int num_column = 0;202 int num_column = 0;
@@ -340,7 +340,7 @@
340340
341 int original_width = GetBaseWidth();341 int original_width = GetBaseWidth();
342342
343 nux::Geometry base = GetGeometry();343 nux::Geometry base = GetNativeGeometry();
344 it = elements.begin();344 it = elements.begin();
345 int num_row = 0;345 int num_row = 0;
346 int num_column = 0;346 int num_column = 0;
@@ -470,7 +470,7 @@
470470
471 graphics_engine.PushModelViewMatrix(Get2DMatrix());471 graphics_engine.PushModelViewMatrix(Get2DMatrix());
472472
473 Geometry base = GetGeometry();473 Geometry base = GetNativeGeometry();
474 Geometry absolute_geometry = GetAbsoluteGeometry();474 Geometry absolute_geometry = GetAbsoluteGeometry();
475 Geometry parent_geometry = absolute_geometry;475 Geometry parent_geometry = absolute_geometry;
476 Geometry visibility_geometry = absolute_geometry;476 Geometry visibility_geometry = absolute_geometry;
477477
=== modified file 'Nux/GroupBox.cpp'
--- Nux/GroupBox.cpp 2012-10-02 07:32:55 +0000
+++ Nux/GroupBox.cpp 2012-12-17 15:42:23 +0000
@@ -47,9 +47,9 @@
4747
48 void GroupBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)48 void GroupBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
49 {49 {
50 graphics_engine.PushClippingRectangle(GetGeometry());50 graphics_engine.PushClippingRectangle(GetNativeGeometry());
5151
52 Geometry wireborder_geo = GetGeometry();52 Geometry wireborder_geo = GetNativeGeometry();
5353
54 //if(bCaptionAvailable)54 //if(bCaptionAvailable)
55 {55 {
@@ -66,7 +66,8 @@
66 {66 {
67 //GetPainter().Paint2DQuadColor(m_CaptionArea.GetGeometry(), COLOR_BACKGROUND_PRIMARY);67 //GetPainter().Paint2DQuadColor(m_CaptionArea.GetGeometry(), COLOR_BACKGROUND_PRIMARY);
68 //GetPainter().PaintTextLineStatic(m_CaptionArea.GetGeometry(), m_CaptionArea.GetCaptionString(), eAlignTextCenter);68 //GetPainter().PaintTextLineStatic(m_CaptionArea.GetGeometry(), m_CaptionArea.GetCaptionString(), eAlignTextCenter);
69 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), m_CaptionArea.GetGeometry(), m_CaptionArea.GetBaseString(), GetTextColor(),69 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(),
70 m_CaptionArea.GetGeometryRelativeTo(this), m_CaptionArea.GetBaseString(), GetTextColor(),
70 true, eAlignTextCenter);71 true, eAlignTextCenter);
71 }72 }
7273
@@ -80,12 +81,12 @@
8081
81 void GroupBox::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)82 void GroupBox::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
82 {83 {
83 graphics_engine.PushClippingRectangle(GetGeometry());84 graphics_engine.PushClippingRectangle(GetNativeGeometry());
8485
85 if (m_layout)86 if (m_layout)
86 {87 {
87 graphics_engine.PushClippingRectangle(m_layout->GetGeometry());88 graphics_engine.PushClippingRectangle(GetLayout()->GetNativeGeometry());
88 m_layout->ProcessDraw(graphics_engine, force_draw);89 GetLayout()->ProcessDraw(graphics_engine, force_draw);
89 graphics_engine.PopClippingRectangle();90 graphics_engine.PopClippingRectangle();
90 }91 }
9192
@@ -114,7 +115,7 @@
114 // Give the managed layout appropriate size and position..115 // Give the managed layout appropriate size and position..
115 if (view_layout_)116 if (view_layout_)
116 {117 {
117 Geometry layout_geo = GetGeometry();118 Geometry layout_geo = GetNativeGeometry();
118 //if(bCaptionAvailable)119 //if(bCaptionAvailable)
119 {120 {
120 layout_geo.OffsetPosition(2, 20);121 layout_geo.OffsetPosition(2, 20);
@@ -136,11 +137,11 @@
136 // Only the size is change is important here of the GroupBox is important here.137 // Only the size is change is important here of the GroupBox is important here.
137138
138 long ret = 0;139 long ret = 0;
139 Geometry old_geo = Area::GetGeometry();140 Geometry old_geo = Area::GetNativeGeometry();
140141
141 if (view_layout_)142 if (view_layout_)
142 {143 {
143 Geometry base = view_layout_->GetGeometry();144 Geometry base = view_layout_->GetNativeGeometry();
144 //if(bCaptionAvailable)145 //if(bCaptionAvailable)
145 {146 {
146 base.OffsetPosition(-2, -20);147 base.OffsetPosition(-2, -20);
@@ -154,7 +155,7 @@
154 Area::SetGeometry(base);155 Area::SetGeometry(base);
155 }156 }
156157
157 Geometry base = GetGeometry();158 Geometry base = GetNativeGeometry();
158 m_CaptionArea.SetBaseXY(base.x + 6, base.y);159 m_CaptionArea.SetBaseXY(base.x + 6, base.y);
159160
160 if (old_geo.GetWidth() > base.GetWidth())161 if (old_geo.GetWidth() > base.GetWidth())
@@ -180,8 +181,8 @@
180 {181 {
181 //if(bCaptionAvailable)182 //if(bCaptionAvailable)
182 {183 {
183 view_layout_->SetBaseX(GetBaseX() + 2);184 view_layout_->SetBaseX(GetNativeX() + 2);
184 view_layout_->SetBaseY(GetBaseY() + 20);185 view_layout_->SetBaseY(GetNativeY() + 20);
185 }186 }
186// else187// else
187// {188// {
@@ -191,7 +192,7 @@
191 view_layout_->ComputeContentPosition(offsetX, offsetY);192 view_layout_->ComputeContentPosition(offsetX, offsetY);
192 }193 }
193194
194 Geometry base = GetGeometry();195 Geometry base = GetNativeGeometry();
195 m_CaptionArea.SetBaseXY(base.x + 6, base.y);196 m_CaptionArea.SetBaseXY(base.x + 6, base.y);
196 }197 }
197198
198199
=== modified file 'Nux/GroupBox2.cpp'
--- Nux/GroupBox2.cpp 2012-11-05 21:31:06 +0000
+++ Nux/GroupBox2.cpp 2012-12-17 15:42:23 +0000
@@ -36,10 +36,8 @@
3636
37 GroupBox2::GroupBox2(const char *Caption, NUX_FILE_LINE_DECL)37 GroupBox2::GroupBox2(const char *Caption, NUX_FILE_LINE_DECL)
38 : View(NUX_FILE_LINE_PARAM)38 : View(NUX_FILE_LINE_PARAM)
39 , bCaptionAvailable(false)
40 , m_layout(0)
41 {39 {
42 m_CaptionArea = new BasicView(NUX_TRACKER_LOCATION);40 header_title_ = new BasicView(NUX_TRACKER_LOCATION);
43 SetMinimumSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5);41 SetMinimumSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5);
44 SetBaseSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5);42 SetBaseSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5);
45 SetCaption(Caption);43 SetCaption(Caption);
@@ -47,30 +45,28 @@
4745
48 GroupBox2::~GroupBox2()46 GroupBox2::~GroupBox2()
49 {47 {
50 m_CaptionArea->Dispose();48 header_title_->UnReference();
51 }49 }
5250
53 void GroupBox2::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)51 void GroupBox2::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
54 {52 {
55 graphics_engine.PushClippingRectangle(GetGeometry());53 graphics_engine.PushClippingRectangle(GetNativeGeometry());
5654
57 Geometry header = GetGeometry();55 Geometry header = GetNativeGeometry();
58 header.SetHeight(TOP_HEADER_HEIGHT);56 header.SetHeight(TOP_HEADER_HEIGHT);
59 Geometry layoutgeomerty = GetGeometry();57 Geometry content_area = GetNativeGeometry();
60 layoutgeomerty.OffsetPosition(0, TOP_HEADER_HEIGHT);58 content_area.OffsetPosition(0, TOP_HEADER_HEIGHT);
61 layoutgeomerty.OffsetSize(0, -TOP_HEADER_HEIGHT);59 content_area.OffsetSize(0, -TOP_HEADER_HEIGHT);
62 GetPainter().PaintShapeCorner(graphics_engine, header, Color(0xFF000000), eSHAPE_CORNER_ROUND4, eCornerTopLeft | eCornerTopRight, false);60 GetPainter().PaintShapeCorner(graphics_engine, header, Color(0xFF000000), eSHAPE_CORNER_ROUND4, eCornerTopLeft | eCornerTopRight, false);
6361
64 GetPainter().PushDrawShapeLayer(graphics_engine, layoutgeomerty, eSHAPE_CORNER_ROUND4, GROUPBOX2_HEADER_BASE_COLOR, eCornerBottomLeft | eCornerBottomRight);62 GetPainter().PushDrawShapeLayer(graphics_engine, content_area, eSHAPE_CORNER_ROUND4, GROUPBOX2_HEADER_BASE_COLOR,
63 eCornerBottomLeft | eCornerBottomRight);
6564
66 //if(bCaptionAvailable)65 //if(bCaptionAvailable)
67 {66 {
68 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), m_CaptionArea->GetGeometry(), m_CaptionArea->GetBaseString(), GROUPBOX2_HEADER_TEXT_COLOR);67 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(),
69 }68 header_title_->GetGeometry(),
7069 header_title_->GetBaseString(), GROUPBOX2_HEADER_TEXT_COLOR);
71 if (m_layout != 0)
72 {
73 m_layout->QueueDraw();
74 }70 }
7571
76 GetPainter().PopBackground();72 GetPainter().PopBackground();
@@ -79,23 +75,21 @@
7975
80 void GroupBox2::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)76 void GroupBox2::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
81 {77 {
82 if (m_layout == 0)78 if(GetLayout() == NULL)
83 return;79 return;
8480
85 graphics_engine.PushClippingRectangle(m_layout->GetGeometry());81 Geometry content_area = GetNativeGeometry();
86 Geometry layoutgeomerty = GetGeometry();82 content_area.OffsetPosition(0, TOP_HEADER_HEIGHT);
87 layoutgeomerty.OffsetPosition(0, TOP_HEADER_HEIGHT);83 content_area.OffsetSize(0, -TOP_HEADER_HEIGHT);
88 layoutgeomerty.OffsetSize(0, -TOP_HEADER_HEIGHT);84
8985 graphics_engine.PushClippingRectangle(content_area);
90 if (force_draw)86
91 GetPainter().PushDrawShapeLayer(graphics_engine, layoutgeomerty, eSHAPE_CORNER_ROUND4, GROUPBOX2_HEADER_BASE_COLOR, eAllCorners);87 GetPainter().PushShapeLayer(graphics_engine, content_area, eSHAPE_CORNER_ROUND4, GROUPBOX2_HEADER_BASE_COLOR, eAllCorners);
92 else88
93 GetPainter().PushShapeLayer(graphics_engine, layoutgeomerty, eSHAPE_CORNER_ROUND4, GROUPBOX2_HEADER_BASE_COLOR, eAllCorners);89 if (GetLayout())
94
95 if (m_layout)
96 {90 {
97 graphics_engine.PushClippingRectangle(m_layout->GetGeometry());91 graphics_engine.PushClippingRectangle(GetLayout()->GetGeometry());
98 m_layout->ProcessDraw(graphics_engine, force_draw);92 GetLayout()->ProcessDraw(graphics_engine, force_draw);
99 graphics_engine.PopClippingRectangle();93 graphics_engine.PopClippingRectangle();
100 }94 }
10195
@@ -110,8 +104,6 @@
110 return false;104 return false;
111 }105 }
112106
113 m_layout = layout;
114
115 return true;107 return true;
116 }108 }
117109
@@ -120,17 +112,10 @@
120 // Give the managed layout appropriate size and position..112 // Give the managed layout appropriate size and position..
121 if (GetCompositionLayout())113 if (GetCompositionLayout())
122 {114 {
123 Geometry layout_geo = GetGeometry();115 Geometry layout_geo = GetNativeGeometry();
124 //if(bCaptionAvailable)116 layout_geo.OffsetPosition(X_MARGIN, TOP_HEADER_HEIGHT + Y_MARGIN);
125 {117 layout_geo.OffsetSize(-2 * X_MARGIN, -TOP_HEADER_HEIGHT - 2 * Y_MARGIN);
126 layout_geo.OffsetPosition(X_MARGIN, TOP_HEADER_HEIGHT + Y_MARGIN);118
127 layout_geo.OffsetSize(-2 * X_MARGIN, -TOP_HEADER_HEIGHT - 2 * Y_MARGIN);
128 }
129// else
130// {
131// layout_geo.OffsetPosition(X_MARGIN, 2);
132// layout_geo.OffsetSize(-2*X_MARGIN, -2*Y_MARGIN);
133// }
134 GetCompositionLayout()->SetGeometry(layout_geo);119 GetCompositionLayout()->SetGeometry(layout_geo);
135 }120 }
136 }121 }
@@ -146,22 +131,15 @@
146131
147 if (GetCompositionLayout())132 if (GetCompositionLayout())
148 {133 {
149 Geometry base = GetCompositionLayout()->GetGeometry();134 Geometry base = GetCompositionLayout()->GetNativeGeometry();
150 //if(bCaptionAvailable)135 base.OffsetPosition(-X_MARGIN, -TOP_HEADER_HEIGHT - Y_MARGIN);
151 {136 base.OffsetSize(2 * X_MARGIN, TOP_HEADER_HEIGHT + 2 * Y_MARGIN);
152 base.OffsetPosition(-X_MARGIN, -TOP_HEADER_HEIGHT - Y_MARGIN);137
153 base.OffsetSize(2 * X_MARGIN, TOP_HEADER_HEIGHT + 2 * Y_MARGIN);
154 }
155// else
156// {
157// base.OffsetPosition(-X_MARGIN, -2);
158// base.OffsetSize(2*X_MARGIN, 2*Y_MARGIN);
159// }
160 Area::SetGeometry(base);138 Area::SetGeometry(base);
161 }139 }
162140
163 Geometry base = GetGeometry();141 Geometry base = GetNativeGeometry();
164 m_CaptionArea->SetBaseXY(base.x + CAPTION_X_MARGIN, base.y + (TOP_HEADER_HEIGHT - m_CaptionArea->GetBaseHeight()) / 2);142 header_title_->SetBaseXY(base.x + CAPTION_X_MARGIN, base.y + (TOP_HEADER_HEIGHT - header_title_->GetBaseHeight()) / 2);
165143
166144
167 if (old_geo.GetWidth() > base.GetWidth())145 if (old_geo.GetWidth() > base.GetWidth())
@@ -185,45 +163,35 @@
185 {163 {
186 if (GetCompositionLayout())164 if (GetCompositionLayout())
187 {165 {
188 //if(bCaptionAvailable)166 GetCompositionLayout()->SetBaseX(GetNativeX() + X_MARGIN);
189 {167 GetCompositionLayout()->SetBaseY(GetNativeY() + TOP_HEADER_HEIGHT + Y_MARGIN);
190 GetCompositionLayout()->SetBaseX(GetBaseX() + X_MARGIN);
191 GetCompositionLayout()->SetBaseY(GetBaseY() + TOP_HEADER_HEIGHT + Y_MARGIN);
192 }
193// else
194// {
195// m_compositionLayout->SetX(GetX() + X_MARGIN);
196// m_compositionLayout->SetY(GetY() + Y_MARGIN);
197// }
198 GetCompositionLayout()->ComputeContentPosition(offsetX, offsetY);168 GetCompositionLayout()->ComputeContentPosition(offsetX, offsetY);
199 }169 }
200170
201 Geometry base = GetGeometry();171 Geometry base = GetNativeGeometry();
202 m_CaptionArea->SetBaseXY(base.x + CAPTION_X_MARGIN, base.y + (TOP_HEADER_HEIGHT - m_CaptionArea->GetBaseHeight()) / 2);172 header_title_->SetBaseXY(base.x + CAPTION_X_MARGIN, base.y + (TOP_HEADER_HEIGHT - header_title_->GetBaseHeight()) / 2);
203 }173 }
204174
205 void GroupBox2::SetCaption(const char *Caption)175 void GroupBox2::SetCaption(const char *Caption)
206 {176 {
207 if ((Caption == 0) || (StringLength(Caption) == 0))177 if ((Caption == 0) || (StringLength(Caption) == 0))
208 {178 {
209 //bCaptionAvailable = false;179 header_title_->SetBaseString("");
210 m_CaptionArea->SetBaseString("");180 header_title_->SetMinimumSize(DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT);
211 m_CaptionArea->SetMinimumSize(DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT);181 header_title_->SetBaseSize(DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT);
212 m_CaptionArea->SetBaseSize(DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT);
213 }182 }
214 else183 else
215 {184 {
216 //bCaptionAvailable = true;185 header_title_->SetBaseString(Caption);
217 m_CaptionArea->SetBaseString(Caption);186 header_title_->SetMinimumSize(4 + GetSysBoldFont()->GetStringWidth(Caption), PRACTICAL_WIDGET_HEIGHT);
218 m_CaptionArea->SetMinimumSize(4 + GetSysBoldFont()->GetStringWidth(Caption), PRACTICAL_WIDGET_HEIGHT);187 header_title_->SetBaseSize(4 + GetSysBoldFont()->GetStringWidth(Caption), PRACTICAL_WIDGET_HEIGHT);
219 m_CaptionArea->SetBaseSize(4 + GetSysBoldFont()->GetStringWidth(Caption), PRACTICAL_WIDGET_HEIGHT);
220188
221 Size s = GetMinimumSize();189 Size s = GetMinimumSize();
222190
223 if (s.width < 2 * CAPTION_X_MARGIN + m_CaptionArea->GetBaseWidth())191 if (s.width < 2 * CAPTION_X_MARGIN + header_title_->GetBaseWidth())
224 {192 {
225 SetMinimumSize(2 * CAPTION_X_MARGIN + m_CaptionArea->GetBaseWidth(), s.height);193 SetMinimumSize(2 * CAPTION_X_MARGIN + header_title_->GetBaseWidth(), s.height);
226 SetBaseSize(2 * CAPTION_X_MARGIN + m_CaptionArea->GetBaseWidth(), s.height);194 SetBaseSize(2 * CAPTION_X_MARGIN + header_title_->GetBaseWidth(), s.height);
227 }195 }
228 }196 }
229 }197 }
230198
=== modified file 'Nux/GroupBox2.h'
--- Nux/GroupBox2.h 2012-11-05 21:31:06 +0000
+++ Nux/GroupBox2.h 2012-12-17 15:42:23 +0000
@@ -39,22 +39,20 @@
39 GroupBox2(const char *Caption = "", NUX_FILE_LINE_PROTO);39 GroupBox2(const char *Caption = "", NUX_FILE_LINE_PROTO);
40 ~GroupBox2();40 ~GroupBox2();
4141
42 virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw);
43 virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw);
44
45 virtual bool SetLayout(Layout *layout);42 virtual bool SetLayout(Layout *layout);
46 void SetCaption(const char *Caption);43 void SetCaption(const char *Caption);
47 44
48 protected:45 protected:
49 virtual bool AcceptKeyNavFocus();46 virtual bool AcceptKeyNavFocus();
47 virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw);
48 virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw);
49
50 private:50 private:
51 virtual void PreLayoutManagement();51 virtual void PreLayoutManagement();
52 virtual long PostLayoutManagement(long LayoutResult);52 virtual long PostLayoutManagement(long LayoutResult);
53 virtual void ComputeContentPosition(float offsetX, float offsetY);53 virtual void ComputeContentPosition(float offsetX, float offsetY);
5454
55 bool bCaptionAvailable;55 BasicView *header_title_;
56 BasicView *m_CaptionArea;
57 Layout *m_layout;
5856
59 static int CAPTION_X_MARGIN;57 static int CAPTION_X_MARGIN;
60 static int X_MARGIN;58 static int X_MARGIN;
6159
=== modified file 'Nux/HLayout.cpp'
--- Nux/HLayout.cpp 2012-12-08 01:03:38 +0000
+++ Nux/HLayout.cpp 2012-12-17 15:42:23 +0000
@@ -240,8 +240,8 @@
240 HLayoutManagement(width, height);240 HLayoutManagement(width, height);
241241
242 // Objects have been resized, now position them.242 // Objects have been resized, now position them.
243 int current_x = GetBaseX() + left_padding_;243 int current_x = left_padding_;
244 int current_y = GetBaseY() + top_padding_;244 int current_y = top_padding_;
245245
246 int offset_space = 0;246 int offset_space = 0;
247 int space_after_element = 0;247 int space_after_element = 0;
@@ -360,9 +360,9 @@
360360
361 if (((*it)->IsLayout() || (*it)->IsView()) /*&& ((*it)->IsLayoutDone() == false)*/ /*&& ((*it)->GetScaleFactor() != 0)*/)361 if (((*it)->IsLayout() || (*it)->IsView()) /*&& ((*it)->IsLayoutDone() == false)*/ /*&& ((*it)->GetScaleFactor() != 0)*/)
362 {362 {
363 Geometry pre_geo = (*it)->GetGeometry();363 Geometry pre_geo = (*it)->GetNativeGeometry();
364 ret = (*it)->ComputeContentSize();364 ret = (*it)->ComputeContentSize();
365 Geometry post_geo = (*it)->GetGeometry();365 Geometry post_geo = (*it)->GetNativeGeometry();
366366
367 bool larger_width = pre_geo.width < post_geo.width;367 bool larger_width = pre_geo.width < post_geo.width;
368 bool smaller_width = pre_geo.width > post_geo.width;368 bool smaller_width = pre_geo.width > post_geo.width;
@@ -769,8 +769,8 @@
769 height -= (top_padding_ + bottom_padding_);769 height -= (top_padding_ + bottom_padding_);
770770
771 // Objects have been resized, now position them.771 // Objects have been resized, now position them.
772 int current_x = GetBaseX() + left_padding_ + offsetX; // add base offset in X(used for scrolling)772 int current_x = left_padding_ + offsetX; // add base offset in X(used for scrolling)
773 int current_y = GetBaseY() + top_padding_ + offsetY; // add base offset in Y(used for scrolling)773 int current_y = top_padding_ + offsetY; // add base offset in Y(used for scrolling)
774774
775 int offset_space = 0;775 int offset_space = 0;
776 int element_margin = 0;776 int element_margin = 0;
777777
=== modified file 'Nux/HScrollBar.cpp'
--- Nux/HScrollBar.cpp 2012-11-05 21:31:06 +0000
+++ Nux/HScrollBar.cpp 2012-12-17 15:42:23 +0000
@@ -277,17 +277,17 @@
277277
278 void HScrollBar::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)278 void HScrollBar::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
279 {279 {
280 Geometry base = GetGeometry();280 Geometry base = GetNativeGeometry();
281 GetPainter().PaintBackground(graphics_engine, base);281 GetPainter().PaintBackground(graphics_engine, base);
282 base.OffsetPosition(HSCROLLBAR_WIDTH, 0);282 base.OffsetPosition(HSCROLLBAR_WIDTH, 0);
283 base.OffsetSize(-2 * HSCROLLBAR_WIDTH, 0);283 base.OffsetSize(-2 * HSCROLLBAR_WIDTH, 0);
284 GetPainter().PaintShape(graphics_engine, base,284 GetPainter().PaintShape(graphics_engine, base,
285 Color(COLOR_SCROLLBAR_TRACK), eHSCROLLBAR, false);285 Color(COLOR_SCROLLBAR_TRACK), eHSCROLLBAR, false);
286286
287 GetPainter().PaintShape(graphics_engine, _scroll_left_button->GetGeometry(), Color(0xFFFFFFFF), eSCROLLBAR_TRIANGLE_LEFT);287 GetPainter().PaintShape(graphics_engine, _scroll_left_button->GetGeometryRelativeTo(this), Color(0xFFFFFFFF), eSCROLLBAR_TRIANGLE_LEFT);
288 GetPainter().PaintShape(graphics_engine, _scroll_right_button->GetGeometry(), Color(0xFFFFFFFF), eSCROLLBAR_TRIANGLE_RIGHT);288 GetPainter().PaintShape(graphics_engine, _scroll_right_button->GetGeometryRelativeTo(this), Color(0xFFFFFFFF), eSCROLLBAR_TRIANGLE_RIGHT);
289289
290 GetPainter().PaintShape(graphics_engine, _slider->GetGeometry(),290 GetPainter().PaintShape(graphics_engine, _slider->GetGeometryRelativeTo(this),
291 Color(0.2156 * m_color_factor, 0.2156 * m_color_factor, 0.2156 * m_color_factor, 1.0f),291 Color(0.2156 * m_color_factor, 0.2156 * m_color_factor, 0.2156 * m_color_factor, 1.0f),
292 eHSCROLLBAR, true);292 eHSCROLLBAR, true);
293 };293 };
294294
=== modified file 'Nux/HSplitter.cpp'
--- Nux/HSplitter.cpp 2012-11-17 16:15:55 +0000
+++ Nux/HSplitter.cpp 2012-12-17 15:42:23 +0000
@@ -49,8 +49,8 @@
49 mvt_dy = 0;49 mvt_dy = 0;
50 m_current_x = 0;50 m_current_x = 0;
51 m_current_y = 0;51 m_current_y = 0;
52 m_current_width = 200;52 m_current_width = 100;
53 m_current_height = 200;53 m_current_height = 100;
5454
55 //SetMinimumSize(200,200);55 //SetMinimumSize(200,200);
56 SetGeometry(Geometry(m_current_x, m_current_y, m_current_width, m_current_height));56 SetGeometry(Geometry(m_current_x, m_current_y, m_current_width, m_current_height));
@@ -77,20 +77,18 @@
7777
78 void HSplitter::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)78 void HSplitter::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
79 {79 {
80 graphics_engine.PushClippingRectangle(GetGeometry());80 // Save the model view matrix. We reuse it when drawing the splitter overlay during a resize operation.
81 Geometry base = GetGeometry();81 local_model_view_matrix_ = graphics_engine.GetModelViewMatrix();
82// std::vector<View*>::iterator it;82
83// for (it = m_InterfaceObject.begin(); it != m_InterfaceObject.end(); it++)83 Geometry base = GetNativeGeometry();
84// {84 graphics_engine.PushClippingRectangle(base);
85// (*it)->ProcessDraw(force_draw);85 std::vector<Area *>::iterator it;
86// }86
87
88 GetPainter().PaintBackground(graphics_engine, base);
89 std::vector<MySplitter *>::iterator it_splitter;87 std::vector<MySplitter *>::iterator it_splitter;
9088
91 for (it_splitter = m_SplitterObject.begin(); it_splitter != m_SplitterObject.end(); it_splitter++)89 for (it_splitter = m_SplitterObject.begin(); it_splitter != m_SplitterObject.end(); it_splitter++)
92 {90 {
93 Geometry geo = (*it_splitter)->GetGeometry();91 Geometry geo = (*it_splitter)->GetGeometryRelativeTo(this);
94 Geometry grip_geo;92 Geometry grip_geo;
95 int w = 20;93 int w = 20;
9694
@@ -118,19 +116,19 @@
118116
119 void HSplitter::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)117 void HSplitter::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
120 {118 {
121 Geometry base = GetGeometry();119 Geometry base = GetNativeGeometry();
122 graphics_engine.PushClippingRectangle(base);120 graphics_engine.PushClippingRectangle(base);
121
123 bool need_redraw = IsRedrawNeeded();122 bool need_redraw = IsRedrawNeeded();
124123
125 std::vector<MySplitter *>::iterator it_splitter;124 std::vector<MySplitter *>::iterator it_splitter;
126 std::vector<Area *>::iterator it;125 std::vector<Area *>::iterator it;
127126
128 //for(it = m_InterfaceObject.begin(); it != m_InterfaceObject.end(); it++)
129 for (it = m_InterfaceObject.begin(), it_splitter = m_SplitterObject.begin();127 for (it = m_InterfaceObject.begin(), it_splitter = m_SplitterObject.begin();
130 it != m_InterfaceObject.end();128 it != m_InterfaceObject.end();
131 it++, it_splitter++)129 it++, it_splitter++)
132 {130 {
133 Geometry sgeo = (*it_splitter)->GetGeometry();131 Geometry sgeo = (*it_splitter)->GetGeometryRelativeTo(this);
134 graphics_engine.PushClippingRectangle(Rect(132 graphics_engine.PushClippingRectangle(Rect(
135 base.x, base.y, base.GetWidth(), sgeo.y - base.y));133 base.x, base.y, base.GetWidth(), sgeo.y - base.y));
136134
@@ -182,13 +180,20 @@
182 void HSplitter::OverlayDrawing(GraphicsEngine &graphics_engine)180 void HSplitter::OverlayDrawing(GraphicsEngine &graphics_engine)
183 {181 {
184 unsigned int num_element = (unsigned int) m_SplitterObject.size();182 unsigned int num_element = (unsigned int) m_SplitterObject.size();
185183 Geometry base = GetNativeGeometry();
186 Geometry base = GetGeometry();184
185 // Transform this area position with the model view matrix we captured earlier.
186 Vector4 v = local_model_view_matrix_ * Vector4(base.x, base.y, 0.0f, 1.0f);
187
188 // base is now in window coordinates
189 base.x = v.x;
190 base.y = v.y;
187191
188 if (m_focus_splitter_index >= 0)192 if (m_focus_splitter_index >= 0)
189 {193 {
190 Geometry geo = m_SplitterObject[m_focus_splitter_index]->GetGeometry();194 Geometry geo = m_SplitterObject[m_focus_splitter_index]->GetGeometryRelativeTo(this);
191 geo.OffsetPosition(mvt_dx, mvt_dy);195
196 geo.OffsetPosition(base.x + mvt_dx, base.y + mvt_dy);
192197
193 if (m_focus_splitter_index == 0 && num_element > 1)198 if (m_focus_splitter_index == 0 && num_element > 1)
194 {199 {
@@ -197,22 +202,22 @@
197 geo.SetY(base.y);202 geo.SetY(base.y);
198 }203 }
199204
200 if (geo.y + HSPLITTERHEIGHT > m_SplitterObject[m_focus_splitter_index + 1]->GetGeometry().y)205 if (geo.y + HSPLITTERHEIGHT > base.y + m_SplitterObject[m_focus_splitter_index + 1]->GetGeometryRelativeTo(this).y)
201 {206 {
202 geo.SetY(m_SplitterObject[m_focus_splitter_index+1]->GetGeometry().y - HSPLITTERHEIGHT);207 geo.SetY(base.y + m_SplitterObject[m_focus_splitter_index+1]->GetGeometryRelativeTo(this).y - HSPLITTERHEIGHT);
203 }208 }
204 }209 }
205210
206 if ((m_focus_splitter_index > 0) && (m_focus_splitter_index < (int) num_element - 1))211 if ((m_focus_splitter_index > 0) && (m_focus_splitter_index < (int) num_element - 1))
207 {212 {
208 if (geo.y < m_SplitterObject[m_focus_splitter_index - 1]->GetGeometry().y + HSPLITTERHEIGHT)213 if (geo.y < m_SplitterObject[m_focus_splitter_index - 1]->GetGeometryRelativeTo(this).y + HSPLITTERHEIGHT)
209 {214 {
210 geo.SetY(m_SplitterObject[m_focus_splitter_index - 1]->GetGeometry().y + HSPLITTERHEIGHT);215 geo.SetY(m_SplitterObject[m_focus_splitter_index - 1]->GetGeometryRelativeTo(this).y + HSPLITTERHEIGHT);
211 }216 }
212217
213 if (geo.y + HSPLITTERHEIGHT > m_SplitterObject[m_focus_splitter_index + 1]->GetGeometry().y)218 if (geo.y + HSPLITTERHEIGHT > m_SplitterObject[m_focus_splitter_index + 1]->GetGeometryRelativeTo(this).y)
214 {219 {
215 geo.SetY(m_SplitterObject[m_focus_splitter_index + 1]->GetGeometry().y - HSPLITTERHEIGHT);220 geo.SetY(m_SplitterObject[m_focus_splitter_index + 1]->GetGeometryRelativeTo(this).y - HSPLITTERHEIGHT);
216 }221 }
217 }222 }
218223
@@ -255,8 +260,8 @@
255 long HSplitter::ComputeContentSize()260 long HSplitter::ComputeContentSize()
256 {261 {
257 unsigned int num_element = (unsigned int) m_InterfaceObject.size();262 unsigned int num_element = (unsigned int) m_InterfaceObject.size();
258 int x = GetBaseX();263 int x = 0;
259 int y = GetBaseY();264 int y = 0;
260 int w = GetBaseWidth();265 int w = GetBaseWidth();
261 int h = GetBaseHeight();266 int h = GetBaseHeight();
262267
@@ -289,7 +294,7 @@
289 {294 {
290 for (unsigned int i = 0; i < num_element; i++)295 for (unsigned int i = 0; i < num_element; i++)
291 {296 {
292 Geometry splitter_geo = m_SplitterObject[i]->GetGeometry();297 Geometry splitter_geo = m_SplitterObject[i]->GetGeometryRelativeTo(this);
293 splitter_geo.SetWidth(w);298 splitter_geo.SetWidth(w);
294 splitter_geo.SetX(x);299 splitter_geo.SetX(x);
295300
@@ -305,7 +310,7 @@
305310
306 for (unsigned int i = 0; i < num_element; i++)311 for (unsigned int i = 0; i < num_element; i++)
307 {312 {
308 Geometry splitter_geo = m_SplitterObject[i]->GetGeometry();313 Geometry splitter_geo = m_SplitterObject[i]->GetGeometryRelativeTo(this);
309 // compute percentage of space occupied by the element i;314 // compute percentage of space occupied by the element i;
310 // width of element i = m_SplitterObject[i]->GetY() - previous_splliter_end315 // width of element i = m_SplitterObject[i]->GetY() - previous_splliter_end
311 int splitter_start = m_SplitterObject[i]->GetBaseY();316 int splitter_start = m_SplitterObject[i]->GetBaseY();
@@ -332,7 +337,7 @@
332337
333 for (unsigned int i = 0; i < num_element; i++)338 for (unsigned int i = 0; i < num_element; i++)
334 {339 {
335 Geometry splitter_geo = m_SplitterObject[i]->GetGeometry();340 Geometry splitter_geo = m_SplitterObject[i]->GetGeometryRelativeTo(this);
336341
337 //m_InterfaceObject[i]->SetGeometry(Geometry(x, accheight, w, splitter_geo.y - accheight));342 //m_InterfaceObject[i]->SetGeometry(Geometry(x, accheight, w, splitter_geo.y - accheight));
338343
@@ -367,8 +372,8 @@
367 void HSplitter::ResetSplitConfig()372 void HSplitter::ResetSplitConfig()
368 {373 {
369374
370 int x = GetBaseX();375 int x = 0;
371 int y = GetBaseY();376 int y = 0;
372 int w = GetBaseWidth();377 int w = GetBaseWidth();
373 int h = GetBaseHeight();378 int h = GetBaseHeight();
374 unsigned int num_element = (unsigned int) m_InterfaceObject.size();379 unsigned int num_element = (unsigned int) m_InterfaceObject.size();
@@ -408,6 +413,7 @@
408 y += stretchfactor * max_size / max_stretch;413 y += stretchfactor * max_size / max_stretch;
409 Geometry geo(x, y, w, HSPLITTERHEIGHT);414 Geometry geo(x, y, w, HSPLITTERHEIGHT);
410 m_SplitterObject[i]->SetGeometry(geo);415 m_SplitterObject[i]->SetGeometry(geo);
416 y += HSPLITTERHEIGHT;
411 }417 }
412418
413 m_SplitterObject[num_element-1]->SetBaseX(y + h - HSPLITTERHEIGHT);419 m_SplitterObject[num_element-1]->SetBaseX(y + h - HSPLITTERHEIGHT);
@@ -431,7 +437,7 @@
431 {437 {
432 if (mvt_dy)438 if (mvt_dy)
433 {439 {
434 Geometry geo = m_SplitterObject[header_pos]->GetGeometry();440 Geometry geo = m_SplitterObject[header_pos]->GetGeometryRelativeTo(this);
435 geo.OffsetPosition(0, mvt_dy);441 geo.OffsetPosition(0, mvt_dy);
436442
437 unsigned int num_element = (unsigned int) m_SplitterObject.size();443 unsigned int num_element = (unsigned int) m_SplitterObject.size();
@@ -439,8 +445,8 @@
439 if (header_pos < (int) num_element - 1)445 if (header_pos < (int) num_element - 1)
440 {446 {
441 // Make the splitter bar stick to the next one if the distance between them is less than HSTICK_SIZE.447 // Make the splitter bar stick to the next one if the distance between them is less than HSTICK_SIZE.
442 if (m_SplitterObject[header_pos + 1]->GetGeometry().y - geo.y - HSPLITTERHEIGHT < HSTICK_SIZE)448 if (m_SplitterObject[header_pos + 1]->GetGeometryRelativeTo(this).y - geo.y - HSPLITTERHEIGHT < HSTICK_SIZE)
443 geo.SetY( m_SplitterObject[header_pos + 1]->GetGeometry().y - HSPLITTERHEIGHT );449 geo.SetY( m_SplitterObject[header_pos + 1]->GetGeometryRelativeTo(this).y - HSPLITTERHEIGHT );
444 }450 }
445451
446 m_SplitterObject[header_pos]->SetGeometry(geo);452 m_SplitterObject[header_pos]->SetGeometry(geo);
@@ -459,7 +465,7 @@
459465
460 void HSplitter::OnSplitterMouseDrag(int /* x */, int y, int /* dx */, int /* dy */, unsigned long /* button_flags */, unsigned long /* key_flags */, int header_pos)466 void HSplitter::OnSplitterMouseDrag(int /* x */, int y, int /* dx */, int /* dy */, unsigned long /* button_flags */, unsigned long /* key_flags */, int header_pos)
461 {467 {
462 Geometry geo = m_SplitterObject[header_pos]->GetGeometry();468 Geometry geo = m_SplitterObject[header_pos]->GetGeometryRelativeTo(this);
463 int num_element = (int) m_SplitterObject.size();469 int num_element = (int) m_SplitterObject.size();
464470
465 if (header_pos == num_element - 1)471 if (header_pos == num_element - 1)
@@ -489,17 +495,17 @@
489495
490 void HSplitter::ResizeSplitter(int header_pos)496 void HSplitter::ResizeSplitter(int header_pos)
491 {497 {
492 Geometry geo = m_SplitterObject[header_pos]->GetGeometry();498 Geometry geo = m_SplitterObject[header_pos]->GetGeometryRelativeTo(this);
493 int num_element = (int) m_SplitterObject.size();499 int num_element = (int) m_SplitterObject.size();
494500
495 if ((header_pos == 0) && (m_SplitterObject[header_pos]->GetBaseY() < GetBaseY()))501 if ((header_pos == 0) && (m_SplitterObject[header_pos]->GetBaseY() < 0))
496 {502 {
497 m_SplitterObject[header_pos]->SetBaseY(GetBaseY());503 m_SplitterObject[header_pos]->SetBaseY(0);
498 }504 }
499505
500 if ((header_pos == num_element - 1) && (m_SplitterObject[header_pos]->GetBaseY() > GetBaseY() + GetBaseHeight() - HSPLITTERHEIGHT))506 if ((header_pos == num_element - 1) && (m_SplitterObject[header_pos]->GetBaseY() > 0 + GetBaseHeight() - HSPLITTERHEIGHT))
501 {507 {
502 m_SplitterObject[header_pos]->SetBaseY(GetBaseY() + GetBaseHeight() - HSPLITTERHEIGHT);508 m_SplitterObject[header_pos]->SetBaseY(GetBaseHeight() - HSPLITTERHEIGHT);
503 }509 }
504510
505 if (header_pos < (int) num_element - 1)511 if (header_pos < (int) num_element - 1)
506512
=== modified file 'Nux/HSplitter.h'
--- Nux/HSplitter.h 2012-11-05 21:31:06 +0000
+++ Nux/HSplitter.h 2012-12-17 15:42:23 +0000
@@ -79,6 +79,7 @@
79 virtual Area* KeyNavIteration(KeyNavDirection direction);79 virtual Area* KeyNavIteration(KeyNavDirection direction);
8080
81 private:81 private:
82 Matrix4 local_model_view_matrix_;
82 typedef BasicView MySplitter;83 typedef BasicView MySplitter;
83 std::vector<Area *> m_InterfaceObject;84 std::vector<Area *> m_InterfaceObject;
84 std::vector<MySplitter *> m_SplitterObject;85 std::vector<MySplitter *> m_SplitterObject;
8586
=== modified file 'Nux/Layout.cpp'
--- Nux/Layout.cpp 2012-11-05 21:31:06 +0000
+++ Nux/Layout.cpp 2012-12-17 15:42:23 +0000
@@ -35,7 +35,7 @@
35 space_between_children_ = 0;35 space_between_children_ = 0;
3636
37 left_padding_ = 0;37 left_padding_ = 0;
38 right_padding_ = 0; 38 right_padding_ = 0;
39 top_padding_ = 0;39 top_padding_ = 0;
40 bottom_padding_ = 0;40 bottom_padding_ = 0;
41 m_contentWidth = 0;41 m_contentWidth = 0;
@@ -496,11 +496,11 @@
496 return NULL;496 return NULL;
497 }497 }
498498
499 void Layout::ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw)499 void Layout::ProcessDraw(GraphicsEngine& graphics_engine, bool force_draw)
500 {500 {
501 std::list<Area *>::iterator it;501 std::list<Area *>::iterator it;
502502
503 if (RedirectRenderingToTexture())503 if (GetRedirectRenderingToTexture())
504 {504 {
505 if (update_backup_texture_ || force_draw || draw_cmd_queued_)505 if (update_backup_texture_ || force_draw || draw_cmd_queued_)
506 {506 {
@@ -508,6 +508,9 @@
508 BeginBackupTextureRendering(graphics_engine, force_draw);508 BeginBackupTextureRendering(graphics_engine, force_draw);
509 {509 {
510 graphics_engine.PushModelViewMatrix(Get2DMatrix());510 graphics_engine.PushModelViewMatrix(Get2DMatrix());
511 Matrix4 mat;
512 mat.Translate(GetX(), GetY(), 0);
513 graphics_engine.PushModelViewMatrix(mat);
511514
512 for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)515 for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
513 {516 {
@@ -526,45 +529,36 @@
526 }529 }
527 }530 }
528 graphics_engine.PopModelViewMatrix();531 graphics_engine.PopModelViewMatrix();
532 graphics_engine.PopModelViewMatrix();
529 }533 }
530 EndBackupTextureRendering(graphics_engine, force_draw);534 EndBackupTextureRendering(graphics_engine, force_draw);
531 GetPainter().PopPaintLayerStack();535 GetPainter().PopPaintLayerStack();
532 }536
533537 if (GetPresentRedirectedView())
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 {538 {
546 graphics_engine.GetRenderStates().SetBlend(false);539 RedirectedArea ra;
547 texxform.FlipVCoord(true);540 ra.backup_texture = backup_texture_;
548 // Draw the background of this view.541 ra.geometry = GetAbsoluteGeometry();
549 GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), background_texture_->GetWidth(), background_texture_->GetHeight(), background_texture_, texxform, color::White);542 ra.clipping_region = graphics_engine.GetClippingRegion();
543 ra.area = this;
544
545 GetWindowCompositor().QueueRedirected(ra);
550 }546 }
551547 }
552 texxform.uwrap = TEXWRAP_CLAMP;548 else
553 texxform.vwrap = TEXWRAP_CLAMP;549 {
554 texxform.FlipVCoord(true);550 GatherRedirectedViewForRendering(graphics_engine);
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 }551 }
561 }552 }
562 else553 else
563 {554 {
564 graphics_engine.PushModelViewMatrix(Get2DMatrix());555 graphics_engine.PushModelViewMatrix(Get2DMatrix());
556 Matrix4 mat;
557 mat.Translate(GetX(), GetY(), 0);
558 graphics_engine.PushModelViewMatrix(mat);
565559
566 // Clip against the padding region.560 // Clip against the padding region.
567 Geometry clip_geo = GetGeometry();561 Geometry clip_geo = GetNativeGeometry();
568 clip_geo.OffsetPosition(left_padding_, top_padding_);562 clip_geo.OffsetPosition(left_padding_, top_padding_);
569 clip_geo.OffsetSize(-left_padding_ - right_padding_, -top_padding_ - bottom_padding_);563 clip_geo.OffsetSize(-left_padding_ - right_padding_, -top_padding_ - bottom_padding_);
570564
@@ -589,6 +583,7 @@
589583
590 graphics_engine.PopClippingRectangle();584 graphics_engine.PopClippingRectangle();
591 graphics_engine.PopModelViewMatrix();585 graphics_engine.PopModelViewMatrix();
586 graphics_engine.PopModelViewMatrix();
592 }587 }
593588
594 ResetQueueDraw();589 ResetQueueDraw();
@@ -843,6 +838,28 @@
843 QueueDraw();838 QueueDraw();
844 }839 }
845840
841 void Layout::GatherRedirectedViewForRendering(GraphicsEngine& graphics_engine)
842 {
843 if (IsVisible() && GetRedirectRenderingToTexture() && GetPresentRedirectedView())
844 {
845 // Go through the children of this layout and add redirected view for post-rendering composition.
846 std::list<Area *>::iterator it;
847 for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
848 {
849 (*it)->GatherRedirectedViewForRendering(graphics_engine);
850 }
851
852 RedirectedArea ra;
853 ra.backup_texture = backup_texture_;
854 ra.geometry = GetAbsoluteGeometry();
855 ra.clipping_region = graphics_engine.GetClippingRegion();
856 ra.area = this;
857
858 // Queue this area for post-rendering composition.
859 GetWindowCompositor().QueueRedirected(ra);
860 }
861 }
862
846#ifdef NUX_GESTURES_SUPPORT863#ifdef NUX_GESTURES_SUPPORT
847 Area* Layout::GetInputAreaHitByGesture(const GestureEvent &event)864 Area* Layout::GetInputAreaHitByGesture(const GestureEvent &event)
848 {865 {
849866
=== modified file 'Nux/Layout.h'
--- Nux/Layout.h 2012-11-05 21:31:06 +0000
+++ Nux/Layout.h 2012-12-17 15:42:23 +0000
@@ -25,7 +25,7 @@
2525
26namespace nux26namespace nux
27{27{
2828 class View;
29#define DEBUG_LAYOUT 029#define DEBUG_LAYOUT 0
30#define DEBUG_LAYOUT_COMPUTATION 030#define DEBUG_LAYOUT_COMPUTATION 0
3131
@@ -256,22 +256,23 @@
256#ifdef NUX_GESTURES_SUPPORT256#ifdef NUX_GESTURES_SUPPORT
257 virtual Area* GetInputAreaHitByGesture(const GestureEvent &event);257 virtual Area* GetInputAreaHitByGesture(const GestureEvent &event);
258#endif258#endif
259 259
260 /*!260 /*!
261 When a layout goes through Layout::ProcessDraw, this call isn't necessary. Otherwise, call it261 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. 262 to set the value of draw_cmd_queued_ to false.
263 */263 */
264 virtual void ResetQueueDraw(); 264 virtual void ResetQueueDraw();
265265
266 protected:266 protected:
267 void BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);267 void BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
268 void EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);268 void EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
269 virtual void GatherRedirectedViewForRendering(GraphicsEngine& graphics_engine);
269270
270 virtual void GeometryChangePending(bool position_about_to_change, bool size_about_to_change);271 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 virtual void GeometryChanged(bool position_has_changed, bool size_has_changed);
272273
273 virtual bool AcceptKeyNavFocus();274 virtual bool AcceptKeyNavFocus();
274 275
275 bool draw_cmd_queued_; //<! The rendering of the layout needs to be refreshed.276 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.277 bool child_draw_cmd_queued_; //<! A child of this layout has requested a draw.
277278
@@ -297,6 +298,7 @@
297 std::string m_name;298 std::string m_name;
298299
299 LayoutContentDistribution m_ContentStacking;300 LayoutContentDistribution m_ContentStacking;
301 friend class View;
300 };302 };
301303
302304
303305
=== modified file 'Nux/LinearLayout.h'
--- Nux/LinearLayout.h 2011-10-11 13:55:55 +0000
+++ Nux/LinearLayout.h 2012-12-17 15:42:23 +0000
@@ -33,7 +33,7 @@
33 NUX_DECLARE_OBJECT_TYPE(LinearLayout, Layout);33 NUX_DECLARE_OBJECT_TYPE(LinearLayout, Layout);
34 public:34 public:
35 virtual void AddLayout(Layout *, unsigned int stretchFactor = 1, MinorDimensionPosition = eAbove, MinorDimensionSize extend = eFull, float percentage = 100.0f, LayoutPosition = NUX_LAYOUT_END);35 virtual void AddLayout(Layout *, unsigned int stretchFactor = 1, MinorDimensionPosition = eAbove, MinorDimensionSize extend = eFull, float percentage = 100.0f, LayoutPosition = NUX_LAYOUT_END);
36 36
37 //! Add an object to the layout.37 //! Add an object to the layout.
38 /*! Add an object to the layout.38 /*! Add an object to the layout.
39 A baseobject minor dimension with respect to a layout object is the dimension opposite to the layout flow.39 A baseobject minor dimension with respect to a layout object is the dimension opposite to the layout flow.
@@ -60,7 +60,7 @@
60 */60 */
61 virtual void AddView(Area *baseobject, unsigned int stretchFactor = 1, MinorDimensionPosition positioning = eAbove, MinorDimensionSize extend = eFull, float percentage = 100.0f, LayoutPosition index = NUX_LAYOUT_END);61 virtual void AddView(Area *baseobject, unsigned int stretchFactor = 1, MinorDimensionPosition positioning = eAbove, MinorDimensionSize extend = eFull, float percentage = 100.0f, LayoutPosition index = NUX_LAYOUT_END);
62 virtual void AddSpace(unsigned int width, unsigned int stretchFactor = 0, LayoutPosition index = NUX_LAYOUT_END);62 virtual void AddSpace(unsigned int width, unsigned int stretchFactor = 0, LayoutPosition index = NUX_LAYOUT_END);
63 63
6464
65 //! Deprecated. Use SetSpaceBetweenChildren;65 //! Deprecated. Use SetSpaceBetweenChildren;
66 void SetHorizontalInternalMargin(int space);66 void SetHorizontalInternalMargin(int space);
6767
=== modified file 'Nux/Makefile.am'
--- Nux/Makefile.am 2012-12-04 19:36:00 +0000
+++ Nux/Makefile.am 2012-12-17 15:42:23 +0000
@@ -113,6 +113,7 @@
113 $(srcdir)/RangeValue.cpp \113 $(srcdir)/RangeValue.cpp \
114 $(srcdir)/RangeValueInteger.cpp \114 $(srcdir)/RangeValueInteger.cpp \
115 $(srcdir)/RGBValuator.cpp \115 $(srcdir)/RGBValuator.cpp \
116 $(srcdir)/SceneComposer.cpp \
116 $(srcdir)/ScrollBar.cpp \117 $(srcdir)/ScrollBar.cpp \
117 $(srcdir)/ScrollView.cpp \118 $(srcdir)/ScrollView.cpp \
118 $(srcdir)/SpinBox.cpp \119 $(srcdir)/SpinBox.cpp \
@@ -226,6 +227,7 @@
226 $(srcdir)/RangeValueInteger.h \227 $(srcdir)/RangeValueInteger.h \
227 $(srcdir)/Readme.txt \228 $(srcdir)/Readme.txt \
228 $(srcdir)/RGBValuator.h \229 $(srcdir)/RGBValuator.h \
230 $(srcdir)/SceneComposer.h \
229 $(srcdir)/ScrollBar.h \231 $(srcdir)/ScrollBar.h \
230 $(srcdir)/ScrollView.h \232 $(srcdir)/ScrollView.h \
231 $(srcdir)/SpinBox.h \233 $(srcdir)/SpinBox.h \
232234
=== modified file 'Nux/MenuBar.cpp'
--- Nux/MenuBar.cpp 2012-11-05 21:31:06 +0000
+++ Nux/MenuBar.cpp 2012-12-17 15:42:23 +0000
@@ -89,7 +89,7 @@
8989
90 void MenuBar::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)90 void MenuBar::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
91 {91 {
92 Geometry base = GetGeometry();92 Geometry base = GetNativeGeometry();
93 graphics_engine.PushClippingRectangle(base);93 graphics_engine.PushClippingRectangle(base);
9494
95 Geometry item_geometry;95 Geometry item_geometry;
@@ -98,7 +98,8 @@
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 BasicView *area = (*it)->area;100 BasicView *area = (*it)->area;
101 item_geometry = area->GetGeometry();101 item_geometry = area->GetGeometryRelativeTo(this);
102 Geometry ageo = area->GetAbsoluteGeometry();
102103
103 if (area->IsMouseInside())104 if (area->IsMouseInside())
104 {105 {
@@ -107,12 +108,14 @@
107108
108 if (!m_MenuIsActive)109 if (!m_MenuIsActive)
109 {110 {
110 GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000));111 //e GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000));
112 GetPainter().Paint2DQuadColor(graphics_engine, ageo, Color(0xFF000000));
111 //GetPainter().PaintShape(graphics_engine, item_geometry, Color(0xFF000000), eSHAPE_CORNER_ROUND2);113 //GetPainter().PaintShape(graphics_engine, item_geometry, Color(0xFF000000), eSHAPE_CORNER_ROUND2);
112 }114 }
113 else115 else
114 {116 {
115 GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000));117 //e GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000));
118 GetPainter().Paint2DQuadColor(graphics_engine, ageo, Color(0xFF000000));
116 //GetPainter().PaintShapeCorner(graphics_engine, item_geometry, Color(0xFF000000), eSHAPE_CORNER_ROUND2,119 //GetPainter().PaintShapeCorner(graphics_engine, item_geometry, Color(0xFF000000), eSHAPE_CORNER_ROUND2,
117 //eCornerTopLeft|eCornerTopRight, false);120 //eCornerTopLeft|eCornerTopRight, false);
118 }121 }
@@ -127,7 +130,7 @@
127 }130 }
128 else131 else
129 {132 {
130 GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), item_geometry, area->GetBaseString(), GetTextColor(), true, eAlignTextCenter);133 GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), ageo, area->GetBaseString(), GetTextColor(), true, eAlignTextCenter);
131 }134 }
132 }135 }
133 else136 else
@@ -144,7 +147,7 @@
144 }147 }
145 else148 else
146 {149 {
147 GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), item_geometry, area->GetBaseString(), GetTextColor(), true, eAlignTextCenter);150 GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), ageo, area->GetBaseString(), GetTextColor(), true, eAlignTextCenter);
148 }151 }
149 }152 }
150 }153 }
@@ -152,9 +155,12 @@
152 if (m_MenuIsActive)155 if (m_MenuIsActive)
153 {156 {
154 BasicView *area = m_CurrentMenu->area;157 BasicView *area = m_CurrentMenu->area;
155 item_geometry = area->GetGeometry();158 item_geometry = area->GetGeometryRelativeTo(this);
156 GetPainter().PaintBackground(graphics_engine, item_geometry);159 GetPainter().PaintBackground(graphics_engine, item_geometry);
157 GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000));160
161 Geometry ageo = area->GetAbsoluteGeometry();
162
163 GetPainter().Paint2DQuadColor(graphics_engine, ageo, Color(0xFF000000));
158 //GetPainter().PaintShapeCorner(graphics_engine, item_geometry, Color(0xFF000000), eSHAPE_CORNER_ROUND2, eCornerTopLeft|eCornerTopRight, true);164 //GetPainter().PaintShapeCorner(graphics_engine, item_geometry, Color(0xFF000000), eSHAPE_CORNER_ROUND2, eCornerTopLeft|eCornerTopRight, true);
159165
160 if (m_CurrentMenu->icon)166 if (m_CurrentMenu->icon)
@@ -167,7 +173,7 @@
167 }173 }
168 else174 else
169 {175 {
170 GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), item_geometry, area->GetBaseString(), GetTextColor(), true, eAlignTextCenter);176 GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), ageo, area->GetBaseString(), GetTextColor(), true, eAlignTextCenter);
171 }177 }
172 }178 }
173179
@@ -176,7 +182,7 @@
176182
177 void MenuBar::DrawContent(GraphicsEngine &graphics_engine, bool /* force_draw */)183 void MenuBar::DrawContent(GraphicsEngine &graphics_engine, bool /* force_draw */)
178 {184 {
179 graphics_engine.PushClippingRectangle(GetGeometry());185 graphics_engine.PushClippingRectangle(GetNativeGeometry());
180 graphics_engine.PopClippingRectangle();186 graphics_engine.PopClippingRectangle();
181 }187 }
182188
@@ -334,27 +340,27 @@
334// // compute window coordinates x and y;340// // compute window coordinates x and y;
335// int winx = menubar_item->area->GetBaseX() + x;341// int winx = menubar_item->area->GetBaseX() + x;
336// int winy = menubar_item->area->GetBaseY() + y;342// int winy = menubar_item->area->GetBaseY() + y;
337// 343//
338// for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++)344// for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++)
339// {345// {
340// BasicView *area = (*it)->area;346// BasicView *area = (*it)->area;
341// Geometry geometry = area->GetGeometry();347// Geometry geometry = area->GetGeometry();
342// 348//
343// if (geometry.IsPointInside(winx, winy))349// if (geometry.IsPointInside(winx, winy))
344// {350// {
345// // Close the menu below menubar_item(the one that has the focus351// // Close the menu below menubar_item(the one that has the focus
346// menubar_item->area->ForceStopFocus(0, 0);352// menubar_item->area->ForceStopFocus(0, 0);
347// 353//
348// // EmitItemMouseEnter is going to open the menu below(*it)354// // EmitItemMouseEnter is going to open the menu below(*it)
349// {355// {
350// EmitItemMouseEnter(winx, winy, button_flags, key_flags, (*it));356// EmitItemMouseEnter(winx, winy, button_flags, key_flags, (*it));
351// m_IsOpeningMenu = true;357// m_IsOpeningMenu = true;
352// area->ForceStartFocus(0, 0);358// area->ForceStartFocus(0, 0);
353// 359//
354// GetWindowThread()->GetWindowCompositor().SetMouseFocusArea(area);360// GetWindowThread()->GetWindowCompositor().SetMouseFocusArea(area);
355// GetWindowThread()->GetWindowCompositor().SetMouseOverArea(area);361// GetWindowThread()->GetWindowCompositor().SetMouseOverArea(area);
356// }362// }
357// 363//
358// break;364// break;
359// }365// }
360// }366// }
361367
=== modified file 'Nux/MenuPage.cpp'
--- Nux/MenuPage.cpp 2012-10-18 22:14:37 +0000
+++ Nux/MenuPage.cpp 2012-12-17 15:42:23 +0000
@@ -60,7 +60,7 @@
60 {60 {
61 _child_menu = 0;61 _child_menu = 0;
62 _action_item = new ActionItem(label, UserValue, NUX_TRACKER_LOCATION);62 _action_item = new ActionItem(label, UserValue, NUX_TRACKER_LOCATION);
63 63
64 _pango_static_text = new StaticText(label, NUX_TRACKER_LOCATION);64 _pango_static_text = new StaticText(label, NUX_TRACKER_LOCATION);
65 _pango_static_text->SetTextColor(Color(0.0f, 0.0f, 0.0f, 1.0f));65 _pango_static_text->SetTextColor(Color(0.0f, 0.0f, 0.0f, 1.0f));
66 }66 }
@@ -148,7 +148,7 @@
148148
149 void MenuItem::DrawAsMenuItem(GraphicsEngine &graphics_engine, const Color & /* textcolor */, bool is_highlighted, bool /* isFirstItem */, bool /* isLastItem */, bool /* draw_icone */)149 void MenuItem::DrawAsMenuItem(GraphicsEngine &graphics_engine, const Color & /* textcolor */, bool is_highlighted, bool /* isFirstItem */, bool /* isLastItem */, bool /* draw_icone */)
150 {150 {
151 Geometry geo = GetGeometry();151 Geometry geo = GetAbsoluteGeometry();
152 Geometry icon_geo(0, 0, 20, 20);152 Geometry icon_geo(0, 0, 20, 20);
153 Geometry text_geo = geo;153 Geometry text_geo = geo;
154154
@@ -208,10 +208,10 @@
208208
209 void MenuSeparator::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)209 void MenuSeparator::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
210 {210 {
211 Geometry base = GetGeometry();211 Geometry base = GetAbsoluteGeometry();
212 int y0 = base.y + base.GetHeight() / 2;212 int y0 = base.y + base.height / 2;
213 GetPainter().Draw2DLine(graphics_engine, base.x, y0, base.x + base.GetWidth(), y0, Color(0xFF222222));213 GetPainter().Draw2DLine(graphics_engine, base.x, y0, base.x + base.width, y0, Color(0xFF222222));
214 GetPainter().Draw2DLine(graphics_engine, base.x, y0 + 1, base.x + base.GetWidth(), y0 + 1, Color(0xFFAAAAAA));214 GetPainter().Draw2DLine(graphics_engine, base.x, y0 + 1, base.x + base.width, y0 + 1, Color(0xFFAAAAAA));
215 }215 }
216216
217 MenuPage::MenuPage(const char *title, NUX_FILE_LINE_DECL)217 MenuPage::MenuPage(const char *title, NUX_FILE_LINE_DECL)
@@ -260,7 +260,7 @@
260 MenuPage::~MenuPage()260 MenuPage::~MenuPage()
261 {261 {
262// std::vector <MenuItem*>::iterator it;262// std::vector <MenuItem*>::iterator it;
263// 263//
264// for (it = m_MenuItemVector.begin(); it != m_MenuItemVector.end(); it++)264// for (it = m_MenuItemVector.begin(); it != m_MenuItemVector.end(); it++)
265// {265// {
266// (*it)->UnReference();266// (*it)->UnReference();
@@ -301,7 +301,7 @@
301 {301 {
302 if (m_IsActive)302 if (m_IsActive)
303 {303 {
304 Geometry base = GetGeometry();304 Geometry base = GetAbsoluteGeometry();
305 Geometry shadow;305 Geometry shadow;
306 shadow = base;306 shadow = base;
307 shadow.OffsetPosition(4, 4);307 shadow.OffsetPosition(4, 4);
@@ -688,7 +688,7 @@
688 m_numItem = 0;688 m_numItem = 0;
689 _vlayout->Clear();689 _vlayout->Clear();
690 ComputeContentSize();690 ComputeContentSize();
691 691
692 //FIXME - Hack to fix a bug with the menu height not being reset after removing items692 //FIXME - Hack to fix a bug with the menu height not being reset after removing items
693 Geometry base = GetGeometry();693 Geometry base = GetGeometry();
694 base.height = 0;694 base.height = 0;
@@ -911,7 +911,7 @@
911911
912 void MenuPage::StartMenu(int MenuXPosition, int MenuYPosition, int /* x*/, int /* y */, bool /* OverrideCurrentMenuChain */)912 void MenuPage::StartMenu(int MenuXPosition, int MenuYPosition, int /* x*/, int /* y */, bool /* OverrideCurrentMenuChain */)
913 {913 {
914 Geometry base = GetGeometry();914 Geometry base = GetAbsoluteGeometry();
915 base.SetX(MenuXPosition);915 base.SetX(MenuXPosition);
916 base.SetY(MenuYPosition);916 base.SetY(MenuYPosition);
917917
918918
=== modified file 'Nux/NumericValuator.cpp'
--- Nux/NumericValuator.cpp 2012-10-10 22:46:50 +0000
+++ Nux/NumericValuator.cpp 2012-12-17 15:42:23 +0000
@@ -74,13 +74,13 @@
7474
75 void NumericValuator::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)75 void NumericValuator::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
76 {76 {
77 Geometry base = GetGeometry();77 Geometry base = GetNativeGeometry();
7878
79 GeometryPositioning gp(eHALeft, eVACenter);79 GeometryPositioning gp(eHALeft, eVACenter);
80 Geometry GeoPo = ComputeGeometryPositioning(m_SpinnerUpBtn->GetGeometry(), GetTheme().GetImageGeometry(eTRIANGLE_RIGHT), gp);80 Geometry GeoPo = ComputeGeometryPositioning(m_SpinnerUpBtn->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eTRIANGLE_RIGHT), gp);
81 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eTRIANGLE_RIGHT);81 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eTRIANGLE_RIGHT);
8282
83 GeoPo = ComputeGeometryPositioning(m_SpinnerDownBtn->GetGeometry(), GetTheme().GetImageGeometry(eTRIANGLE_LEFT), gp);83 GeoPo = ComputeGeometryPositioning(m_SpinnerDownBtn->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eTRIANGLE_LEFT), gp);
84 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eTRIANGLE_LEFT);84 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eTRIANGLE_LEFT);
8585
86 m_EditLine->QueueDraw();86 m_EditLine->QueueDraw();
8787
=== modified file 'Nux/PaintLayer.cpp'
--- Nux/PaintLayer.cpp 2012-11-05 21:31:06 +0000
+++ Nux/PaintLayer.cpp 2012-12-17 15:42:23 +0000
@@ -50,7 +50,7 @@
50 graphics_engine.GetRenderStates().GetColorMask(current_red_mask, current_green_mask, current_blue_mask, current_alpha_mask);50 graphics_engine.GetRenderStates().GetColorMask(current_red_mask, current_green_mask, current_blue_mask, current_alpha_mask);
51 // Get the current blend states. They will be restored later.51 // Get the current blend states. They will be restored later.
52 graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);52 graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
53 53
54 graphics_engine.GetRenderStates().SetColorMask(GL_TRUE, GL_TRUE, GL_TRUE, m_write_alpha ? GL_TRUE : GL_FALSE);54 graphics_engine.GetRenderStates().SetColorMask(GL_TRUE, GL_TRUE, GL_TRUE, m_write_alpha ? GL_TRUE : GL_FALSE);
55 graphics_engine.GetRenderStates().SetBlend(m_rop.Blend, m_rop.SrcBlend, m_rop.DstBlend);55 graphics_engine.GetRenderStates().SetBlend(m_rop.Blend, m_rop.SrcBlend, m_rop.DstBlend);
56 graphics_engine.QRP_Color(geometry_.x, geometry_.y, geometry_.GetWidth(), geometry_.GetHeight(), _color);56 graphics_engine.QRP_Color(geometry_.x, geometry_.y, geometry_.GetWidth(), geometry_.GetHeight(), _color);
@@ -135,7 +135,7 @@
135 }135 }
136136
137/////////////////////////////////////////////////////137/////////////////////////////////////////////////////
138 138
139 CompositionLayer::CompositionLayer (ObjectPtr <IOpenGLBaseTexture> texture0, TexCoordXForm texxform0, const Color& color0,139 CompositionLayer::CompositionLayer (ObjectPtr <IOpenGLBaseTexture> texture0, TexCoordXForm texxform0, const Color& color0,
140 ObjectPtr <IOpenGLBaseTexture> texture1, TexCoordXForm texxform1, const Color& color1,140 ObjectPtr <IOpenGLBaseTexture> texture1, TexCoordXForm texxform1, const Color& color1,
141 LayerBlendMode layer_blend_mode, bool write_alpha, const ROPConfig& ROP)141 LayerBlendMode layer_blend_mode, bool write_alpha, const ROPConfig& ROP)
@@ -179,7 +179,7 @@
179 }179 }
180180
181 CompositionLayer::CompositionLayer(const Color& base_color, const Color& blend_color, LayerBlendMode layer_blend_mode,181 CompositionLayer::CompositionLayer(const Color& base_color, const Color& blend_color, LayerBlendMode layer_blend_mode,
182 bool write_alpha, const ROPConfig& ROP) 182 bool write_alpha, const ROPConfig& ROP)
183 : m_source_color(base_color),183 : m_source_color(base_color),
184 m_foreground_color(blend_color),184 m_foreground_color(blend_color),
185 m_write_alpha(write_alpha),185 m_write_alpha(write_alpha),
@@ -205,14 +205,14 @@
205 unsigned int current_green_mask;205 unsigned int current_green_mask;
206 unsigned int current_blue_mask;206 unsigned int current_blue_mask;
207 unsigned int current_alpha_mask;207 unsigned int current_alpha_mask;
208 208
209 // Get the current color mask and blend states. They will be restored later.209 // Get the current color mask and blend states. They will be restored later.
210 graphics_engine.GetRenderStates().GetColorMask(current_red_mask, current_green_mask, current_blue_mask, current_alpha_mask);210 graphics_engine.GetRenderStates().GetColorMask(current_red_mask, current_green_mask, current_blue_mask, current_alpha_mask);
211 graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);211 graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
212212
213 graphics_engine.GetRenderStates().SetColorMask(GL_TRUE, GL_TRUE, GL_TRUE, m_write_alpha ? GL_TRUE : GL_FALSE);213 graphics_engine.GetRenderStates().SetColorMask(GL_TRUE, GL_TRUE, GL_TRUE, m_write_alpha ? GL_TRUE : GL_FALSE);
214 graphics_engine.GetRenderStates().SetBlend(m_rop.Blend, m_rop.SrcBlend, m_rop.DstBlend);214 graphics_engine.GetRenderStates().SetBlend(m_rop.Blend, m_rop.SrcBlend, m_rop.DstBlend);
215 215
216 if (m_source_texture.IsValid())216 if (m_source_texture.IsValid())
217 {217 {
218 if (m_foreground_texture.IsValid())218 if (m_foreground_texture.IsValid())
@@ -268,7 +268,7 @@
268 m_color_blend_mode(LAYER_BLEND_MODE_LAST)268 m_color_blend_mode(LAYER_BLEND_MODE_LAST)
269 {269 {
270 }270 }
271 271
272 TextureLayer::TextureLayer(ObjectPtr<IOpenGLBaseTexture> device_texture, TexCoordXForm texxform, const Color& color0,272 TextureLayer::TextureLayer(ObjectPtr<IOpenGLBaseTexture> device_texture, TexCoordXForm texxform, const Color& color0,
273 bool write_alpha, const ROPConfig& ROP, const Color& blend_color, LayerBlendMode color_blend_mode)273 bool write_alpha, const ROPConfig& ROP, const Color& blend_color, LayerBlendMode color_blend_mode)
274 : m_device_texture(device_texture),274 : m_device_texture(device_texture),
275275
=== modified file 'Nux/Panel.cpp'
--- Nux/Panel.cpp 2012-10-26 10:49:31 +0000
+++ Nux/Panel.cpp 2012-12-17 15:42:23 +0000
@@ -52,13 +52,13 @@
5252
53 void Panel::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)53 void Panel::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
54 {54 {
55 graphics_engine.PushClippingRectangle(GetGeometry());55 graphics_engine.PushClippingRectangle(GetNativeGeometry());
5656
57 graphics_engine.PushClippingRectangle(Rect(m_ViewX, m_ViewY, m_ViewWidth, m_ViewHeight));57 graphics_engine.PushClippingRectangle(Rect(m_ViewX, m_ViewY, m_ViewWidth, m_ViewHeight));
5858
59 if (m_layout)59 if (m_layout)
60 {60 {
61 graphics_engine.PushClippingRectangle(m_layout->GetGeometry());61 graphics_engine.PushClippingRectangle(m_layout->GetNativeGeometry());
62 m_layout->ProcessDraw(graphics_engine, force_draw);62 m_layout->ProcessDraw(graphics_engine, force_draw);
63 graphics_engine.PopClippingRectangle();63 graphics_engine.PopClippingRectangle();
64 }64 }
6565
=== modified file 'Nux/RGBValuator.cpp'
--- Nux/RGBValuator.cpp 2012-11-05 21:31:06 +0000
+++ Nux/RGBValuator.cpp 2012-12-17 15:42:23 +0000
@@ -300,10 +300,11 @@
300 if (m_color_model == color::HLS)300 if (m_color_model == color::HLS)
301 percent = hls_.hue;301 percent = hls_.hue;
302302
303 graphics_engine.PushClippingRectangle(red_valuator_->GetGeometry());303 Geometry relative_geo = red_valuator_->GetGeometryRelativeTo(this);
304 graphics_engine.PushClippingRectangle(relative_geo);
304305
305 marker_position_x = red_valuator_->GetBaseX() + percent * red_valuator_->GetBaseWidth();306 marker_position_x = relative_geo.x + percent * red_valuator_->GetBaseWidth();
306 marker_position_y = red_valuator_->GetBaseY() + red_valuator_->GetBaseHeight();307 marker_position_y = relative_geo.y + red_valuator_->GetBaseHeight();
307 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x - 5, marker_position_y,308 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x - 5, marker_position_y,
308 marker_position_x, marker_position_y - 5,309 marker_position_x, marker_position_y - 5,
309 marker_position_x + 5, marker_position_y, Color(0xFF000000));310 marker_position_x + 5, marker_position_y, Color(0xFF000000));
@@ -331,10 +332,11 @@
331 if (m_color_model == color::HLS)332 if (m_color_model == color::HLS)
332 percent = hls_.lightness;333 percent = hls_.lightness;
333334
334 graphics_engine.PushClippingRectangle(green_valuator_->GetGeometry());335 Geometry relative_geo = green_valuator_->GetGeometryRelativeTo(this);
336 graphics_engine.PushClippingRectangle(relative_geo);
335337
336 marker_position_x = green_valuator_->GetBaseX() + percent * green_valuator_->GetBaseWidth();338 marker_position_x = relative_geo.x + percent * green_valuator_->GetBaseWidth();
337 marker_position_y = green_valuator_->GetBaseY() + green_valuator_->GetBaseHeight();339 marker_position_y = relative_geo.y + green_valuator_->GetBaseHeight();
338 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x - 5, marker_position_y,340 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x - 5, marker_position_y,
339 marker_position_x, marker_position_y - 5,341 marker_position_x, marker_position_y - 5,
340 marker_position_x + 5, marker_position_y, Color(0.0f, 0.0f, 0.0f, 1.0f));342 marker_position_x + 5, marker_position_y, Color(0.0f, 0.0f, 0.0f, 1.0f));
@@ -362,10 +364,11 @@
362 if (m_color_model == color::HLS)364 if (m_color_model == color::HLS)
363 percent = hls_.saturation;365 percent = hls_.saturation;
364366
365 graphics_engine.PushClippingRectangle(blue_valuator_->GetGeometry());367 Geometry relative_geo = blue_valuator_->GetGeometryRelativeTo(this);
368 graphics_engine.PushClippingRectangle(relative_geo);
366369
367 marker_position_x = blue_valuator_->GetBaseX() + percent * blue_valuator_->GetBaseWidth();370 marker_position_x = relative_geo.x + percent * blue_valuator_->GetBaseWidth();
368 marker_position_y = blue_valuator_->GetBaseY() + blue_valuator_->GetBaseHeight();371 marker_position_y = relative_geo.y + blue_valuator_->GetBaseHeight();
369 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x - 5, marker_position_y,372 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x - 5, marker_position_y,
370 marker_position_x, marker_position_y - 5,373 marker_position_x, marker_position_y - 5,
371 marker_position_x + 5, marker_position_y, Color(0.0f, 0.0f, 0.0f, 1.0f));374 marker_position_x + 5, marker_position_y, Color(0.0f, 0.0f, 0.0f, 1.0f));
@@ -382,10 +385,11 @@
382 int marker_position_x;385 int marker_position_x;
383 int marker_position_y;386 int marker_position_y;
384387
385 graphics_engine.PushClippingRectangle(alpha_valuator_->GetGeometry());388 Geometry relative_geo = alpha_valuator_->GetGeometryRelativeTo(this);
389 graphics_engine.PushClippingRectangle(relative_geo);
386390
387 marker_position_x = alpha_valuator_->GetBaseX() + alpha_ * alpha_valuator_->GetBaseWidth();391 marker_position_x = relative_geo.x + alpha_ * alpha_valuator_->GetBaseWidth();
388 marker_position_y = alpha_valuator_->GetBaseY() + alpha_valuator_->GetBaseHeight();392 marker_position_y = relative_geo.y + alpha_valuator_->GetBaseHeight();
389 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x - 5, marker_position_y,393 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x - 5, marker_position_y,
390 marker_position_x, marker_position_y - 5,394 marker_position_x, marker_position_y - 5,
391 marker_position_x + 5, marker_position_y, Color(0.0f, 0.0f, 0.0f, 1.0f));395 marker_position_x + 5, marker_position_y, Color(0.0f, 0.0f, 0.0f, 1.0f));
@@ -399,10 +403,37 @@
399403
400 void RGBValuator::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)404 void RGBValuator::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
401 {405 {
402 Geometry base = GetGeometry();406 Geometry base = GetNativeGeometry();
403407
404 graphics_engine.PushClippingRectangle(base);408 // Set clipping region for this view
405 GetPainter().PushDrawShapeLayer(graphics_engine, vlayout->GetGeometry(), eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true);409 graphics_engine.PushClippingRectangle(base);
410
411 // Draw rounded rectangle background.
412 GetPainter().PaintShape(graphics_engine, vlayout->GetGeometry(), Color(0xFF000000), eSHAPE_CORNER_ROUND4, true);
413
414 graphics_engine.PopClippingRectangle();
415 }
416
417 void RGBValuator::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
418 {
419 Geometry base = GetNativeGeometry();
420 // Set clipping region for this view
421 graphics_engine.PushClippingRectangle(base);
422
423 GetPainter().PushShapeLayer(graphics_engine, vlayout->GetGeometry(), eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true);
424
425 // Draw the widgets inside this view. BasicView widget don't do any drawing.
426 GetLayout()->ProcessDraw(graphics_engine, force_draw);
427
428 // Draw BasicViews and other elements
429 Geometry relative_geo = m_ComponentLabel0->GetGeometryRelativeTo(this);
430 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), relative_geo, m_ComponentLabel0->GetBaseString(), Color(0xFFFFFFFF));
431 relative_geo = m_ComponentLabel1->GetGeometryRelativeTo(this);
432 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), relative_geo, m_ComponentLabel1->GetBaseString(), Color(0xFFFFFFFF));
433 relative_geo = m_ComponentLabel2->GetGeometryRelativeTo(this);
434 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), relative_geo, m_ComponentLabel2->GetBaseString(), Color(0xFFFFFFFF));
435 relative_geo = m_ComponentAlpha->GetGeometryRelativeTo(this);
436 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), relative_geo, m_ComponentAlpha->GetBaseString(), Color(0xFFFFFFFF));
406437
407 if (m_color_model == color::RGB)438 if (m_color_model == color::RGB)
408 {439 {
@@ -417,11 +448,6 @@
417 DrawHLS(graphics_engine);448 DrawHLS(graphics_engine);
418 }449 }
419450
420 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), m_ComponentLabel0->GetGeometry(), m_ComponentLabel0->GetBaseString(), Color(0xFFFFFFFF));
421 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), m_ComponentLabel1->GetGeometry(), m_ComponentLabel1->GetBaseString(), Color(0xFFFFFFFF));
422 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), m_ComponentLabel2->GetGeometry(), m_ComponentLabel2->GetBaseString(), Color(0xFFFFFFFF));
423 GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), m_ComponentAlpha->GetGeometry(), m_ComponentAlpha->GetBaseString(), Color(0xFFFFFFFF));
424
425 DrawRedMarker(graphics_engine);451 DrawRedMarker(graphics_engine);
426 DrawGreenMarker(graphics_engine);452 DrawGreenMarker(graphics_engine);
427 DrawBlueMarker(graphics_engine);453 DrawBlueMarker(graphics_engine);
@@ -431,40 +457,25 @@
431 graphics_engine.PopClippingRectangle();457 graphics_engine.PopClippingRectangle();
432 }458 }
433459
434 void RGBValuator::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
435 {
436 Geometry base = GetGeometry();
437 graphics_engine.PushClippingRectangle(base);
438
439 red_caption_->ProcessDraw(graphics_engine, force_draw);
440 green_caption_->ProcessDraw(graphics_engine, force_draw);
441 blue_caption_->ProcessDraw(graphics_engine, force_draw);
442 alpha_caption_->ProcessDraw(graphics_engine, force_draw);
443
444 m_ColorModel->ProcessDraw(graphics_engine, force_draw); // the button has round corner. That is why we need to push the background.
445 m_ColorFormat->ProcessDraw(graphics_engine, force_draw); // the button has round corner. That is why we need to push the background.
446 graphics_engine.PopClippingRectangle();
447 }
448
449 void RGBValuator::DrawRGB(GraphicsEngine &graphics_engine)460 void RGBValuator::DrawRGB(GraphicsEngine &graphics_engine)
450 {461 {
451 // Red462 // Red
452 Geometry P = red_valuator_->GetGeometry();463 Geometry P = red_valuator_->GetGeometryRelativeTo(this);
453 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(0.0f, rgb_.green, rgb_.blue), Color(0.0f, rgb_.green, rgb_.blue),464 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(0.0f, rgb_.green, rgb_.blue), Color(0.0f, rgb_.green, rgb_.blue),
454 Color(1.0f, rgb_.green, rgb_.blue), Color(1.0f, rgb_.green, rgb_.blue));465 Color(1.0f, rgb_.green, rgb_.blue), Color(1.0f, rgb_.green, rgb_.blue));
455466
456 // Green467 // Green
457 P = green_valuator_->GetGeometry();468 P = green_valuator_->GetGeometryRelativeTo(this);
458 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb_.red, 0.0f, rgb_.blue), Color(rgb_.red, 0.0f, rgb_.blue),469 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb_.red, 0.0f, rgb_.blue), Color(rgb_.red, 0.0f, rgb_.blue),
459 Color(rgb_.red, 1.0f, rgb_.blue), Color(rgb_.red, 1.0f, rgb_.blue));470 Color(rgb_.red, 1.0f, rgb_.blue), Color(rgb_.red, 1.0f, rgb_.blue));
460471
461 // Blue472 // Blue
462 P = blue_valuator_->GetGeometry();473 P = blue_valuator_->GetGeometryRelativeTo(this);
463 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb_.red, rgb_.green, 0.0f), Color(rgb_.red, rgb_.green, 0.0f),474 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb_.red, rgb_.green, 0.0f), Color(rgb_.red, rgb_.green, 0.0f),
464 Color(rgb_.red, rgb_.green, 1.0f), Color(rgb_.red, rgb_.green, 1.0f));475 Color(rgb_.red, rgb_.green, 1.0f), Color(rgb_.red, rgb_.green, 1.0f));
465476
466 // Alpha477 // Alpha
467 P = alpha_valuator_->GetGeometry();478 P = alpha_valuator_->GetGeometryRelativeTo(this);
468 m_CheckboardLayer->SetGeometry(P);479 m_CheckboardLayer->SetGeometry(P);
469 m_CheckboardLayer->Renderlayer(graphics_engine);480 m_CheckboardLayer->Renderlayer(graphics_engine);
470481
@@ -473,18 +484,15 @@
473 Color(rgb_.red, rgb_.green, rgb_.blue, 1.0f), Color(rgb_.red, rgb_.green, rgb_.blue, 1.0f));484 Color(rgb_.red, rgb_.green, rgb_.blue, 1.0f), Color(rgb_.red, rgb_.green, rgb_.blue, 1.0f));
474 graphics_engine.GetRenderStates().SetBlend(false);485 graphics_engine.GetRenderStates().SetBlend(false);
475486
476 P = color_square_->GetGeometry();487 P = color_square_->GetGeometryRelativeTo(this);
477 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb_.red, rgb_.green, rgb_.blue), Color(rgb_.red, rgb_.green, rgb_.blue),488 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb_.red, rgb_.green, rgb_.blue), Color(rgb_.red, rgb_.green, rgb_.blue),
478 Color(rgb_.red, rgb_.green, rgb_.blue), Color(rgb_.red, rgb_.green, rgb_.blue));489 Color(rgb_.red, rgb_.green, rgb_.blue), Color(rgb_.red, rgb_.green, rgb_.blue));
479
480 m_ColorModel->ProcessDraw(graphics_engine, true);
481 m_ColorFormat->ProcessDraw(graphics_engine, true);
482 }490 }
483491
484 void RGBValuator::DrawHSV(GraphicsEngine &graphics_engine)492 void RGBValuator::DrawHSV(GraphicsEngine &graphics_engine)
485 {493 {
486 // Red494 // Red
487 Geometry P = red_valuator_->GetGeometry();495 Geometry P = red_valuator_->GetGeometryRelativeTo(this);
488 float s = 0; //XSI: 1.0f - hsv_.saturation;496 float s = 0; //XSI: 1.0f - hsv_.saturation;
489 float v = 1; //XSI: hsv_.value;497 float v = 1; //XSI: hsv_.value;
490 float fw = P.GetWidth() / 6;498 float fw = P.GetWidth() / 6;
@@ -516,18 +524,18 @@
516 Color value_gray(v, v, v);524 Color value_gray(v, v, v);
517 Color value_color(Color(rgb) * v);525 Color value_color(Color(rgb) * v);
518 // Green526 // Green
519 P = green_valuator_->GetGeometry();527 P = green_valuator_->GetGeometryRelativeTo(this);
520 GetPainter().Paint2DQuadColor(graphics_engine, P, value_gray, value_gray, value_color, value_color);528 GetPainter().Paint2DQuadColor(graphics_engine, P, value_gray, value_gray, value_color, value_color);
521529
522 rgb = color::RedGreenBlue(color::HueSaturationValue(hue, hsv_.saturation, 1));530 rgb = color::RedGreenBlue(color::HueSaturationValue(hue, hsv_.saturation, 1));
523 // Blue531 // Blue
524 P = blue_valuator_->GetGeometry();532 P = blue_valuator_->GetGeometryRelativeTo(this);
525 GetPainter().Paint2DQuadColor(graphics_engine, P, color::Black, color::Black, Color(rgb), Color(rgb));533 GetPainter().Paint2DQuadColor(graphics_engine, P, color::Black, color::Black, Color(rgb), Color(rgb));
526534
527 rgb = color::RedGreenBlue(color::HueSaturationValue(hue, hsv_.saturation, hsv_.value));535 rgb = color::RedGreenBlue(color::HueSaturationValue(hue, hsv_.saturation, hsv_.value));
528536
529 // Alpha537 // Alpha
530 P = alpha_valuator_->GetGeometry();538 P = alpha_valuator_->GetGeometryRelativeTo(this);
531 m_CheckboardLayer->SetGeometry(P);539 m_CheckboardLayer->SetGeometry(P);
532 m_CheckboardLayer->Renderlayer(graphics_engine);540 m_CheckboardLayer->Renderlayer(graphics_engine);
533541
@@ -535,17 +543,14 @@
535 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(0.0f, 0.0f, 0.0f, 0.0f), Color(0.0f, 0.0f, 0.0f, 0.0f), Color(rgb), Color(rgb));543 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(0.0f, 0.0f, 0.0f, 0.0f), Color(0.0f, 0.0f, 0.0f, 0.0f), Color(rgb), Color(rgb));
536 graphics_engine.GetRenderStates().SetBlend(false);544 graphics_engine.GetRenderStates().SetBlend(false);
537545
538 P = color_square_->GetGeometry();546 P = color_square_->GetGeometryRelativeTo(this);
539 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb));547 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb));
540
541 m_ColorModel->ProcessDraw(graphics_engine, true);
542 m_ColorFormat->ProcessDraw(graphics_engine, true);
543 }548 }
544549
545 void RGBValuator::DrawHLS(GraphicsEngine &graphics_engine)550 void RGBValuator::DrawHLS(GraphicsEngine &graphics_engine)
546 {551 {
547 // Red552 // Red
548 Geometry P = red_valuator_->GetGeometry();553 Geometry P = red_valuator_->GetGeometryRelativeTo(this);
549 float s = 0; //XSI: 1.0f - hls_.saturation;554 float s = 0; //XSI: 1.0f - hls_.saturation;
550 float l = 1; //XSI: hls_.lightness;555 float l = 1; //XSI: hls_.lightness;
551 float fw = P.GetWidth() / 6;556 float fw = P.GetWidth() / 6;
@@ -585,7 +590,7 @@
585 float b = rgb.blue;590 float b = rgb.blue;
586591
587 // Green592 // Green
588 P = green_valuator_->GetGeometry();593 P = green_valuator_->GetGeometryRelativeTo(this);
589 fw = P.GetWidth() / 2;594 fw = P.GetWidth() / 2;
590 p = Geometry(P.x, P.y, fw, P.GetHeight());595 p = Geometry(P.x, P.y, fw, P.GetHeight());
591 GetPainter().Paint2DQuadColor(graphics_engine, p, Color(0.0f, 0.0f, 0.0f), Color(0.0f, 0.0f, 0.0f), Color(r* (1 - s) + 0.5f * s, g* (1 - s) + 0.5f * s, b* (1 - s) + 0.5f * s), Color(r* (1 - s) + 0.5f * s, g* (1 - s) + 0.5f * s, b* (1 - s) + 0.5f * s));596 GetPainter().Paint2DQuadColor(graphics_engine, p, Color(0.0f, 0.0f, 0.0f), Color(0.0f, 0.0f, 0.0f), Color(r* (1 - s) + 0.5f * s, g* (1 - s) + 0.5f * s, b* (1 - s) + 0.5f * s), Color(r* (1 - s) + 0.5f * s, g* (1 - s) + 0.5f * s, b* (1 - s) + 0.5f * s));
@@ -612,7 +617,7 @@
612 cb = (factor) * b * (1 - s) + 0.5 * s;617 cb = (factor) * b * (1 - s) + 0.5 * s;
613 }618 }
614619
615 P = blue_valuator_->GetGeometry();620 P = blue_valuator_->GetGeometryRelativeTo(this);
616 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(l, l, l), Color(l, l, l), Color(cr, cg, cb), Color(cr, cg, cb));621 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(l, l, l), Color(l, l, l), Color(cr, cg, cb), Color(cr, cg, cb));
617622
618 // TODO: Tim Penhey 2011-05-13623 // TODO: Tim Penhey 2011-05-13
@@ -620,7 +625,7 @@
620 rgb = color::RedGreenBlue(hls_);625 rgb = color::RedGreenBlue(hls_);
621626
622 // Alpha627 // Alpha
623 P = alpha_valuator_->GetGeometry();628 P = alpha_valuator_->GetGeometryRelativeTo(this);
624 m_CheckboardLayer->SetGeometry(P);629 m_CheckboardLayer->SetGeometry(P);
625 m_CheckboardLayer->Renderlayer(graphics_engine);630 m_CheckboardLayer->Renderlayer(graphics_engine);
626631
@@ -628,11 +633,8 @@
628 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(0.0f, 0.0f, 0.0f, 0.0f), Color(0.0f, 0.0f, 0.0f, 0.0f), Color(rgb), Color(rgb));633 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(0.0f, 0.0f, 0.0f, 0.0f), Color(0.0f, 0.0f, 0.0f, 0.0f), Color(rgb), Color(rgb));
629 graphics_engine.GetRenderStates().SetBlend(false);634 graphics_engine.GetRenderStates().SetBlend(false);
630635
631 P = color_square_->GetGeometry();636 P = color_square_->GetGeometryRelativeTo(this);
632 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb));637 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb));
633
634 m_ColorModel->ProcessDraw(graphics_engine, true);
635 m_ColorFormat->ProcessDraw(graphics_engine, true);
636 }638 }
637639
638 void RGBValuator::SetRGBA(Color const& color)640 void RGBValuator::SetRGBA(Color const& color)
639641
=== modified file 'Nux/RadioButton.cpp'
--- Nux/RadioButton.cpp 2012-11-05 21:31:06 +0000
+++ Nux/RadioButton.cpp 2012-12-17 15:42:23 +0000
@@ -29,7 +29,7 @@
29namespace nux29namespace nux
30{30{
31 NUX_IMPLEMENT_OBJECT_TYPE(RadioButton);31 NUX_IMPLEMENT_OBJECT_TYPE(RadioButton);
32 32
33 RadioButton::RadioButton(const std::string& str, bool state, NUX_FILE_LINE_DECL)33 RadioButton::RadioButton(const std::string& str, bool state, NUX_FILE_LINE_DECL)
34 : AbstractCheckedButton(str, state, NUX_FILE_LINE_PARAM)34 : AbstractCheckedButton(str, state, NUX_FILE_LINE_PARAM)
35 {35 {
@@ -53,7 +53,7 @@
5353
54 void RadioButton::Draw(GraphicsEngine& graphics_engine, bool /* force_draw */)54 void RadioButton::Draw(GraphicsEngine& graphics_engine, bool /* force_draw */)
55 {55 {
56 Geometry base = GetGeometry();56 Geometry base = GetNativeGeometry();
57 graphics_engine.PushClippingRectangle(base);57 graphics_engine.PushClippingRectangle(base);
5858
59 InteractState is;59 InteractState is;
@@ -73,13 +73,11 @@
73 is.is_prelight = false;73 is.is_prelight = false;
74 }74 }
7575
76 GetPainter().PushPaintLayerStack();
77 {76 {
78 GetPainter().PaintRadioButton(graphics_engine, check_area_->GetGeometry(), is, Color(0xff000000));77 GetPainter().PaintRadioButton(graphics_engine, check_area_->GetGeometryRelativeTo(this), is, Color(0xff000000));
79 static_text_->ProcessDraw(graphics_engine, true);78 static_text_->ProcessDraw(graphics_engine, true);
80 }79 }
81 GetPainter().PopPaintLayerStack();80
82
83 graphics_engine.PopClippingRectangle();81 graphics_engine.PopClippingRectangle();
84 }82 }
8583
8684
=== modified file 'Nux/RangeValue.cpp'
--- Nux/RangeValue.cpp 2012-11-05 21:31:06 +0000
+++ Nux/RangeValue.cpp 2012-12-17 15:42:23 +0000
@@ -97,7 +97,7 @@
97 int marker_position_x;97 int marker_position_x;
98 int marker_position_y;98 int marker_position_y;
9999
100 graphics_engine.PushClippingRectangle(m_Percentage->GetGeometry());100 graphics_engine.PushClippingRectangle(m_Percentage->GetGeometryRelativeTo(this));
101101
102 marker_position_x = m_Percentage->GetBaseX() + (m_Value - m_min) * m_Percentage->GetBaseWidth() * 1 / (m_max - m_min);102 marker_position_x = m_Percentage->GetBaseX() + (m_Value - m_min) * m_Percentage->GetBaseWidth() * 1 / (m_max - m_min);
103 marker_position_y = m_Percentage->GetBaseY() + m_Percentage->GetBaseHeight();103 marker_position_y = m_Percentage->GetBaseY() + m_Percentage->GetBaseHeight();
@@ -115,10 +115,10 @@
115115
116 void RangeValue::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)116 void RangeValue::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
117 {117 {
118 Geometry base = GetGeometry();118 Geometry base = GetNativeGeometry();
119119
120 // Percentage120 // Percentage
121 Geometry P = m_Percentage->GetGeometry();121 Geometry P = m_Percentage->GetGeometryRelativeTo(this);
122 GetPainter().Paint2DQuadColor(graphics_engine, P, m_StartColor, m_StartColor, m_EndColor, m_EndColor);122 GetPainter().Paint2DQuadColor(graphics_engine, P, m_StartColor, m_StartColor, m_EndColor, m_EndColor);
123123
124 if (m_EnableDrawProgress)124 if (m_EnableDrawProgress)
125125
=== modified file 'Nux/RangeValueInteger.cpp'
--- Nux/RangeValueInteger.cpp 2012-11-05 21:31:06 +0000
+++ Nux/RangeValueInteger.cpp 2012-12-17 15:42:23 +0000
@@ -96,7 +96,7 @@
96 int marker_position_x;96 int marker_position_x;
97 int marker_position_y;97 int marker_position_y;
9898
99 graphics_engine.PushClippingRectangle(m_Percentage->GetGeometry());99 graphics_engine.PushClippingRectangle(m_Percentage->GetGeometryRelativeTo(this));
100100
101 marker_position_x = m_Percentage->GetBaseX() + (m_MarkerPosition - m_min) * m_Percentage->GetBaseWidth() * 1 / (m_max - m_min);101 marker_position_x = m_Percentage->GetBaseX() + (m_MarkerPosition - m_min) * m_Percentage->GetBaseWidth() * 1 / (m_max - m_min);
102 marker_position_y = m_Percentage->GetBaseY() + m_Percentage->GetBaseHeight();102 marker_position_y = m_Percentage->GetBaseY() + m_Percentage->GetBaseHeight();
@@ -113,10 +113,10 @@
113113
114 void RangeValueInteger::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)114 void RangeValueInteger::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
115 {115 {
116 Geometry base = GetGeometry();116 Geometry base = GetNativeGeometry();
117117
118 // Percentage118 // Percentage
119 Geometry P = m_Percentage->GetGeometry();119 Geometry P = m_Percentage->GetGeometryRelativeTo(this);
120 GetPainter().Paint2DQuadColor(graphics_engine, P, m_StartColor, m_StartColor, m_EndColor, m_EndColor);120 GetPainter().Paint2DQuadColor(graphics_engine, P, m_StartColor, m_StartColor, m_EndColor, m_EndColor);
121121
122 if (m_EnableDrawProgress)122 if (m_EnableDrawProgress)
123123
=== added file 'Nux/SceneComposer.cpp'
--- Nux/SceneComposer.cpp 1970-01-01 00:00:00 +0000
+++ Nux/SceneComposer.cpp 2012-12-17 15:42:23 +0000
@@ -0,0 +1,111 @@
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 Lesser General Public License, as
6 * published by the Free Software Foundation; either version 2.1 or 3.0
7 * of the License.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranties of
11 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12 * PURPOSE. See the applicable version of the GNU Lesser General Public
13 * License for more details.
14 *
15 * You should have received a copy of both the GNU Lesser General Public
16 * License along with this program. If not, see <http://www.gnu.org/licenses/>
17 *
18 * Authored by: Jay Taoko <jaytaoko@inalogic.com>
19 *
20 */
21
22#include "NuxGraphics/GraphicsEngine.h"
23#include "Nux.h"
24#include "SceneComposer.h"
25
26namespace nux
27{
28
29SceneComposer::SceneComposer()
30: graphics_engine_(NULL)
31, gpu_device_(NULL)
32, dst_texture_width(0)
33, dst_texture_height(0)
34{
35
36}
37
38SceneComposer::~SceneComposer()
39{
40
41}
42
43void SceneComposer::SetGraphicsObjects(GraphicsEngine* graphics_engine, GpuDevice* gpu_device)
44{
45 graphics_engine_ = graphics_engine;
46 gpu_device_ = gpu_device;
47}
48
49void SceneComposer::SetDestinationTexture(ObjectPtr<IOpenGLBaseTexture> rendering_surface_texture)
50{
51 rendering_surface_texture_ = rendering_surface_texture;
52}
53
54void SceneComposer::SetOrthoGraphicProjection()
55{
56 if (rendering_surface_texture_.IsValid())
57 {
58 dst_texture_width = rendering_surface_texture_->GetWidth();
59 dst_texture_height = rendering_surface_texture_->GetHeight();
60
61 if (fbo_.IsNull())
62 {
63 // Create the fbo before using it for the first time.
64 fbo_ = GetGraphicsDisplay()->GetGpuDevice()->CreateFrameBufferObject();
65 }
66
67 fbo_->FormatFrameBufferObject(dst_texture_width, dst_texture_height, rendering_surface_texture_->GetPixelFormat());
68 fbo_->SetTextureAttachment(0, rendering_surface_texture_, 0);
69 fbo_->SetDepthTextureAttachment(ObjectPtr<IOpenGLBaseTexture>(0), 0);
70 fbo_->Activate();
71
72 // Drawing to a texture!
73
74 graphics_engine_->EmptyClippingRegion();
75 graphics_engine_->SetOpenGLClippingRectangle(0, 0, dst_texture_width, dst_texture_height);
76 graphics_engine_->SetViewport(0, 0, dst_texture_width, dst_texture_height);
77 graphics_engine_->SetOrthographicProjectionMatrix(dst_texture_width, dst_texture_height);
78 }
79 else
80 {
81 // Whatever frame buffer is actevated, de-activate it.
82 gpu_device_->DeactivateFrameBuffer();
83
84 // Drawing to the backbuffer!
85
86 dst_texture_width = graphics_engine_->GetWindowWidth();
87 dst_texture_height = graphics_engine_->GetWindowHeight();
88 graphics_engine_->EmptyClippingRegion();
89 graphics_engine_->SetOpenGLClippingRectangle(0, 0, dst_texture_width, dst_texture_height);
90 graphics_engine_->SetViewport(0, 0, dst_texture_width, dst_texture_height);
91 graphics_engine_->SetOrthographicProjectionMatrix(dst_texture_width, dst_texture_height);
92 }
93}
94
95void SceneComposer::RenderTexture(ObjectPtr<IOpenGLBaseTexture> texture, Geometry geo, Geometry clip, float opacity, bool blend)
96{
97 if (graphics_engine_ == NULL)
98 return;
99
100 if (texture.IsNull())
101 return;
102
103 TexCoordXForm texxform0;
104 texxform0.FlipVCoord(true);
105
106 graphics_engine_->QRP_1Tex(geo.x, geo.y, geo.width, geo.height, texture, texxform0, Color(1.0f, 1.0f, 1.0f, opacity));
107}
108
109
110};
111
0112
=== added file 'Nux/SceneComposer.h'
--- Nux/SceneComposer.h 1970-01-01 00:00:00 +0000
+++ Nux/SceneComposer.h 2012-12-17 15:42:23 +0000
@@ -0,0 +1,78 @@
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 Lesser General Public License, as
6 * published by the Free Software Foundation; either version 2.1 or 3.0
7 * of the License.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranties of
11 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12 * PURPOSE. See the applicable version of the GNU Lesser General Public
13 * License for more details.
14 *
15 * You should have received a copy of both the GNU Lesser General Public
16 * License along with this program. If not, see <http://www.gnu.org/licenses/>
17 *
18 * Authored by: Jay Taoko <jaytaoko@inalogic.com>
19 *
20 */
21
22#ifndef SCENE_COMPOSER_H
23#define SCENE_COMPOSER_H
24
25namespace nux
26{
27
28//! SceneComposer does the final composition of the rendering.
29class SceneComposer
30{
31public:
32 SceneComposer();
33 ~SceneComposer();
34
35 //! Set the destination texture
36 /*!
37 If the texture is NULL, the destination is the back-buffer.
38 @param destination_texture Surface to render into.
39 */
40 void SetDestinationTexture(ObjectPtr<IOpenGLBaseTexture> destination_texture);
41
42 /*!
43 Set the graphics objects to use for the rendering.
44 @param graphics_engine The graphics engine to use.
45 @param gpu_device The gpu device engine to use.
46 */
47 void SetGraphicsObjects(GraphicsEngine* graphics_engine, GpuDevice* gpu_device);
48
49 /*!
50 Renders a texture on the destination surface.
51 @param texture Texture to render.
52 @param geo The quad geometry.
53 @param clip Clipping region.
54 @param opacity.
55 @param premultiply.
56 */
57 void RenderTexture(ObjectPtr<IOpenGLBaseTexture> texture, Geometry geo, Geometry clip, float opacity = 1.0f, bool premultiply = false);
58
59 /*!
60 Set the rendering matrices before drawing.
61 */
62 void SetOrthoGraphicProjection();
63
64private:
65 ObjectPtr<IOpenGLBaseTexture> rendering_surface_texture_;
66 ObjectPtr<IOpenGLFrameBufferObject> fbo_;
67
68 GraphicsEngine* graphics_engine_;
69 GpuDevice* gpu_device_;
70 int dst_texture_width;
71 int dst_texture_height;
72
73};
74
75}
76
77#endif // SCENE_COMPOSER_H
78
079
=== modified file 'Nux/ScrollView.cpp'
--- Nux/ScrollView.cpp 2012-11-05 21:31:06 +0000
+++ Nux/ScrollView.cpp 2012-12-17 15:42:23 +0000
@@ -102,7 +102,6 @@
102 &ScrollView::ScrollDown));102 &ScrollView::ScrollDown));
103 _vscrollbar->mouse_wheel.connect(sigc::mem_fun(this,103 _vscrollbar->mouse_wheel.connect(sigc::mem_fun(this,
104 &ScrollView::RecvMouseWheel));104 &ScrollView::RecvMouseWheel));
105
106 _vscrollbar->UnReference();105 _vscrollbar->UnReference();
107 }106 }
108107
@@ -140,11 +139,14 @@
140 if (child->IsLayout())139 if (child->IsLayout())
141 return;140 return;
142141
143 int child_y = child->GetGeometry().y - GetGeometry().y;142 Geometry cgeo = child->GetNativeGeometry();
143 Geometry base = GetGeometryRelativeTo(this);
144
145 int child_y = cgeo.y - base.y;
144 int child_y_diff = child_y - abs(_delta_y);146 int child_y_diff = child_y - abs(_delta_y);
145147
146148
147 if (child_y_diff + child->GetGeometry().height < GetGeometry().height && child_y_diff >= 0)149 if (child_y_diff + cgeo.height < base.height && child_y_diff >= 0)
148 {150 {
149 return;151 return;
150 }152 }
@@ -155,10 +157,10 @@
155 }157 }
156 else158 else
157 {159 {
158 int size = child_y_diff - GetGeometry().height;160 int size = child_y_diff - base.height;
159161
160 // always keeps the top of a view on the screen162 // always keeps the top of a view on the screen
161 size += (child->GetGeometry().height, GetGeometry().height) ? child->GetGeometry().height : GetGeometry().height;163 size += (cgeo.height, base.height) ? cgeo.height : base.height;
162164
163 ScrollDown(1, size);165 ScrollDown(1, size);
164 }166 }
@@ -218,9 +220,9 @@
218220
219 void ScrollView::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)221 void ScrollView::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
220 {222 {
221 graphics_engine.PushClippingRectangle(GetGeometry());223 graphics_engine.PushClippingRectangle(GetNativeGeometry());
222224
223 Geometry base = GetGeometry();225 Geometry base = GetNativeGeometry();
224226
225 if (view_layout_)227 if (view_layout_)
226 view_layout_->QueueDraw();228 view_layout_->QueueDraw();
@@ -244,8 +246,8 @@
244 {246 {
245 if (IsFullRedraw())247 if (IsFullRedraw())
246 GetPainter().PushBackgroundStack();248 GetPainter().PushBackgroundStack();
247 249
248 graphics_engine.PushClippingRectangle(GetGeometry());250 graphics_engine.PushClippingRectangle(GetNativeGeometry());
249251
250 graphics_engine.PushClippingRectangle(Rect(m_ViewX, m_ViewY, m_ViewWidth, m_ViewHeight));252 graphics_engine.PushClippingRectangle(Rect(m_ViewX, m_ViewY, m_ViewWidth, m_ViewHeight));
251253
@@ -306,7 +308,7 @@
306 void ScrollView::FormatContent()308 void ScrollView::FormatContent()
307 {309 {
308 Geometry geo;310 Geometry geo;
309 geo = GetGeometry();311 geo = GetNativeGeometry();
310312
311 ComputeContentSize();313 ComputeContentSize();
312 }314 }
@@ -315,15 +317,15 @@
315 {317 {
316 // Give the managed layout the same size and position as the Control.318 // Give the managed layout the same size and position as the Control.
317319
318 Geometry geo = GetGeometry();320 Geometry geo = GetNativeGeometry();
319 int ScrollBarWidth = _vscrollbar->GetBaseWidth();321 int ScrollBarWidth = _vscrollbar->GetBaseWidth();
320 int ScrollBarHeight = _hscrollbar->GetBaseHeight();322 int ScrollBarHeight = _hscrollbar->GetBaseHeight();
321323
322 nuxAssertMsg(ScrollBarWidth > 0, "[ScrollView::PreLayoutManagement] Invalid scrollbar width: %d", ScrollBarWidth);324 nuxAssertMsg(ScrollBarWidth > 0, "[ScrollView::PreLayoutManagement] Invalid scrollbar width: %d", ScrollBarWidth);
323 nuxAssertMsg(ScrollBarHeight > 0, "[ScrollView::PreLayoutManagement] Invalid scrollbar height: %d", ScrollBarHeight);325 nuxAssertMsg(ScrollBarHeight > 0, "[ScrollView::PreLayoutManagement] Invalid scrollbar height: %d", ScrollBarHeight);
324326
325 m_ViewX = GetBaseX() + m_border + m_ViewContentLeftMargin;327 m_ViewX = GetNativeX() + m_border + m_ViewContentLeftMargin;
326 m_ViewY = GetBaseY() + m_top_border + m_ViewContentTopMargin;328 m_ViewY = GetNativeY() + m_top_border + m_ViewContentTopMargin;
327329
328 if (m_vertical_scrollbar_enable == false)330 if (m_vertical_scrollbar_enable == false)
329 m_ViewWidth = GetBaseWidth() - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin;331 m_ViewWidth = GetBaseWidth() - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin;
@@ -443,8 +445,8 @@
443 if (m_vertical_scrollbar_enable)445 if (m_vertical_scrollbar_enable)
444 ScrollBarWidth = _vscrollbar->GetBaseWidth();446 ScrollBarWidth = _vscrollbar->GetBaseWidth();
445447
446 _hscrollbar->SetContainerSize(GetBaseX() + m_border + m_ViewContentLeftMargin,448 _hscrollbar->SetContainerSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
447 GetBaseY() + m_top_border + m_ViewContentTopMargin,449 GetNativeY() + m_top_border + m_ViewContentTopMargin,
448 GetBaseWidth() - ScrollBarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,450 GetBaseWidth() - ScrollBarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
449 GetBaseHeight() - ScrollBarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);451 GetBaseHeight() - ScrollBarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
450452
@@ -457,21 +459,21 @@
457 }459 }
458 else460 else
459 {461 {
460 _hscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,462 _hscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
461 GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);463 GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
462 }464 }
463465
464 _hscrollbar->SetContentOffset(_delta_x, _delta_y);466 _hscrollbar->SetContentOffset(_delta_x, _delta_y);
465 }467 }
466 else468 else
467 {469 {
468 _hscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,470 _hscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
469 GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);471 GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
470 _hscrollbar->SetContentOffset(0, 0);472 _hscrollbar->SetContentOffset(0, 0);
471 }473 }
472474
473 _vscrollbar->SetContainerSize(GetBaseX() + m_border + m_ViewContentLeftMargin,475 _vscrollbar->SetContainerSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
474 GetBaseY() + m_top_border + m_ViewContentTopMargin,476 GetNativeY() + m_top_border + m_ViewContentTopMargin,
475 GetBaseWidth() - ScrollBarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,477 GetBaseWidth() - ScrollBarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
476 GetBaseHeight() - ScrollBarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);478 GetBaseHeight() - ScrollBarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
477479
@@ -484,16 +486,16 @@
484 }486 }
485 else487 else
486 {488 {
487 _vscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,489 _vscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
488 GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);490 GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
489 }491 }
490492
491 _vscrollbar->SetContentOffset(_delta_x, _delta_y);493 _vscrollbar->SetContentOffset(_delta_x, _delta_y);
492 }494 }
493 else495 else
494 {496 {
495 _vscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,497 _vscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
496 GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);498 GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
497 _vscrollbar->SetContentOffset(0, 0);499 _vscrollbar->SetContentOffset(0, 0);
498 }500 }
499501
@@ -553,7 +555,7 @@
553 // Set the size so that is is equal to the visible content.555 // Set the size so that is is equal to the visible content.
554 Area::SetBaseWidth(base.GetWidth());556 Area::SetBaseWidth(base.GetWidth());
555 Area::SetBaseHeight(base.GetHeight());557 Area::SetBaseHeight(base.GetHeight());
556 Geometry geo = GetGeometry();558 Geometry geo = GetNativeGeometry();
557559
558 // Horizontal scrollbar Geometry560 // Horizontal scrollbar Geometry
559 if (m_horizontal_scrollbar_enable)561 if (m_horizontal_scrollbar_enable)
@@ -568,8 +570,8 @@
568 _hscrollbar->ComputeContentSize();570 _hscrollbar->ComputeContentSize();
569571
570 //---572 //---
571 _hscrollbar->SetContainerSize(GetBaseX() + m_border + m_ViewContentLeftMargin,573 _hscrollbar->SetContainerSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
572 GetBaseY() + m_top_border + m_ViewContentTopMargin,574 GetNativeY() + m_top_border + m_ViewContentTopMargin,
573 GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,575 GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
574 GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);576 GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
575577
@@ -580,8 +582,8 @@
580 }582 }
581 else583 else
582 {584 {
583 _hscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,585 _hscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
584 GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);586 GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
585 }587 }
586588
587 _hscrollbar->SetContentOffset(_delta_x, _delta_y);589 _hscrollbar->SetContentOffset(_delta_x, _delta_y);
@@ -594,12 +596,12 @@
594 _hscrollbar->ComputeContentSize();596 _hscrollbar->ComputeContentSize();
595597
596 //---598 //---
597 _hscrollbar->SetContainerSize(GetBaseX() + m_border + m_ViewContentLeftMargin,599 _hscrollbar->SetContainerSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
598 GetBaseY() + m_top_border + m_ViewContentTopMargin,600 GetNativeY() + m_top_border + m_ViewContentTopMargin,
599 GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,601 GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
600 GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);602 GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
601 _hscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,603 _hscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
602 GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);604 GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
603 _hscrollbar->SetContentOffset(0, 0);605 _hscrollbar->SetContentOffset(0, 0);
604 }606 }
605607
@@ -617,8 +619,8 @@
617 _vscrollbar->ComputeContentSize();619 _vscrollbar->ComputeContentSize();
618620
619 //---621 //---
620 _vscrollbar->SetContainerSize(GetBaseX() + m_border + m_ViewContentLeftMargin,622 _vscrollbar->SetContainerSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
621 GetBaseY() + m_top_border + m_ViewContentTopMargin,623 GetNativeY() + m_top_border + m_ViewContentTopMargin,
622 GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,624 GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
623 GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);625 GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
624626
@@ -629,8 +631,8 @@
629 }631 }
630 else632 else
631 {633 {
632 _vscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,634 _vscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
633 GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);635 GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
634 }636 }
635637
636 _vscrollbar->SetContentOffset(_delta_x, _delta_y);638 _vscrollbar->SetContentOffset(_delta_x, _delta_y);
@@ -643,12 +645,12 @@
643 _vscrollbar->ComputeContentSize();645 _vscrollbar->ComputeContentSize();
644646
645 //---647 //---
646 _vscrollbar->SetContainerSize(GetBaseX() + m_border + m_ViewContentLeftMargin,648 _vscrollbar->SetContainerSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
647 GetBaseY() + m_top_border + m_ViewContentTopMargin,649 GetNativeY() + m_top_border + m_ViewContentTopMargin,
648 GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,650 GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
649 GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);651 GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
650 _vscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,652 _vscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
651 GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);653 GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
652 _vscrollbar->SetContentOffset(0, 0);654 _vscrollbar->SetContentOffset(0, 0);
653 }655 }
654656
@@ -666,15 +668,15 @@
666// This function is called when the ScrollView is embedded within a Layout.668// This function is called when the ScrollView is embedded within a Layout.
667 void ScrollView::ComputeContentPosition(float /* offsetX */, float /* offsetY */)669 void ScrollView::ComputeContentPosition(float /* offsetX */, float /* offsetY */)
668 {670 {
669 Geometry geo = GetGeometry();671 Geometry geo = GetNativeGeometry();
670 int w = 0;672 int w = 0;
671 int h = 0;673 int h = 0;
672674
673 w = _vscrollbar->GetBaseWidth();675 w = _vscrollbar->GetBaseWidth();
674 h = _hscrollbar->GetBaseHeight();676 h = _hscrollbar->GetBaseHeight();
675677
676 m_ViewX = GetBaseX() + m_border + m_ViewContentLeftMargin;678 m_ViewX = GetNativeX() + m_border + m_ViewContentLeftMargin;
677 m_ViewY = GetBaseY() + m_top_border + m_ViewContentTopMargin;679 m_ViewY = GetNativeY() + m_top_border + m_ViewContentTopMargin;
678680
679 if (m_vertical_scrollbar_enable == false)681 if (m_vertical_scrollbar_enable == false)
680 m_ViewWidth = GetBaseWidth() - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin;682 m_ViewWidth = GetBaseWidth() - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin;
681683
=== modified file 'Nux/SpinBox.cpp'
--- Nux/SpinBox.cpp 2012-10-10 22:46:50 +0000
+++ Nux/SpinBox.cpp 2012-12-17 15:42:23 +0000
@@ -82,27 +82,27 @@
8282
83 void SpinBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)83 void SpinBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
84 {84 {
85 Geometry base = GetGeometry();85 Geometry base = GetNativeGeometry();
86 GetPainter().PaintBackground(graphics_engine, base);86 GetPainter().PaintBackground(graphics_engine, base);
8787
88 if (m_EditLine->IsMouseInside() || m_SpinnerUpBtn->IsMouseInside() || m_SpinnerDownBtn->IsMouseInside())88 if (m_EditLine->IsMouseInside() || m_SpinnerUpBtn->IsMouseInside() || m_SpinnerDownBtn->IsMouseInside())
89 {89 {
9090
91 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometry(), SPINBOX_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,91 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometryRelativeTo(this), SPINBOX_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
92 eCornerTopRight, false);92 eCornerTopRight, false);
93 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometry(), SPINBOX_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,93 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometryRelativeTo(this), SPINBOX_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
94 eCornerBottomRight, false);94 eCornerBottomRight, false);
95 }95 }
96 else96 else
97 {97 {
98 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometry(), SPINBOX_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,98 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometryRelativeTo(this), SPINBOX_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
99 eCornerTopRight, false);99 eCornerTopRight, false);
100 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometry(), SPINBOX_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,100 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometryRelativeTo(this), SPINBOX_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
101 eCornerBottomRight, false);101 eCornerBottomRight, false);
102 }102 }
103103
104 GeometryPositioning gp(eHACenter, eVACenter);104 GeometryPositioning gp(eHACenter, eVACenter);
105 Geometry GeoPo = ComputeGeometryPositioning(m_SpinnerUpBtn->GetGeometry(), GetTheme().GetImageGeometry(eSPINER_UP), gp);105 Geometry GeoPo = ComputeGeometryPositioning(m_SpinnerUpBtn->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eSPINER_UP), gp);
106106
107 if (m_SpinnerUpBtn->IsMouseInside())107 if (m_SpinnerUpBtn->IsMouseInside())
108 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eSPINER_UP);108 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eSPINER_UP);
@@ -111,7 +111,7 @@
111111
112112
113 gp.SetAlignment(eHACenter, eVACenter);113 gp.SetAlignment(eHACenter, eVACenter);
114 GeoPo = ComputeGeometryPositioning(m_SpinnerDownBtn->GetGeometry(), GetTheme().GetImageGeometry(eSPINER_DOWN), gp);114 GeoPo = ComputeGeometryPositioning(m_SpinnerDownBtn->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eSPINER_DOWN), gp);
115115
116 if (m_SpinnerDownBtn->IsMouseInside())116 if (m_SpinnerDownBtn->IsMouseInside())
117 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eSPINER_DOWN);117 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eSPINER_DOWN);
118118
=== modified file 'Nux/SpinBoxDouble.cpp'
--- Nux/SpinBoxDouble.cpp 2012-10-10 22:46:50 +0000
+++ Nux/SpinBoxDouble.cpp 2012-12-17 15:42:23 +0000
@@ -85,27 +85,27 @@
8585
86 void SpinBoxDouble::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)86 void SpinBoxDouble::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
87 {87 {
88 Geometry base = GetGeometry();88 Geometry base = GetNativeGeometry();
89 GetPainter().PaintBackground(graphics_engine, base);89 GetPainter().PaintBackground(graphics_engine, base);
9090
91 if (m_EditLine->IsMouseInside() || m_SpinnerUpBtn->IsMouseInside() || m_SpinnerDownBtn->IsMouseInside())91 if (m_EditLine->IsMouseInside() || m_SpinnerUpBtn->IsMouseInside() || m_SpinnerDownBtn->IsMouseInside())
92 {92 {
9393
94 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometry(), SPINBOX_DOUBLE_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,94 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometryRelativeTo(this), SPINBOX_DOUBLE_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
95 eCornerTopRight, false);95 eCornerTopRight, false);
96 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometry(), SPINBOX_DOUBLE_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,96 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometryRelativeTo(this), SPINBOX_DOUBLE_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
97 eCornerBottomRight, false);97 eCornerBottomRight, false);
98 }98 }
99 else99 else
100 {100 {
101 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometry(), SPINBOX_DOUBLE_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,101 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometryRelativeTo(this), SPINBOX_DOUBLE_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
102 eCornerTopRight, false);102 eCornerTopRight, false);
103 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometry(), SPINBOX_DOUBLE_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,103 GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometryRelativeTo(this), SPINBOX_DOUBLE_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
104 eCornerBottomRight, false);104 eCornerBottomRight, false);
105 }105 }
106106
107 GeometryPositioning gp(eHACenter, eVACenter);107 GeometryPositioning gp(eHACenter, eVACenter);
108 Geometry GeoPo = ComputeGeometryPositioning(m_SpinnerUpBtn->GetGeometry(), GetTheme().GetImageGeometry(eSPINER_UP), gp);108 Geometry GeoPo = ComputeGeometryPositioning(m_SpinnerUpBtn->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eSPINER_UP), gp);
109109
110 if (m_SpinnerUpBtn->IsMouseInside())110 if (m_SpinnerUpBtn->IsMouseInside())
111 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eSPINER_UP);111 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eSPINER_UP);
@@ -114,7 +114,7 @@
114114
115115
116 gp.SetAlignment(eHACenter, eVACenter);116 gp.SetAlignment(eHACenter, eVACenter);
117 GeoPo = ComputeGeometryPositioning(m_SpinnerDownBtn->GetGeometry(), GetTheme().GetImageGeometry(eSPINER_DOWN), gp);117 GeoPo = ComputeGeometryPositioning(m_SpinnerDownBtn->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eSPINER_DOWN), gp);
118118
119 if (m_SpinnerDownBtn->IsMouseInside())119 if (m_SpinnerDownBtn->IsMouseInside())
120 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eSPINER_DOWN);120 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eSPINER_DOWN);
121121
=== modified file 'Nux/StaticText.cpp'
--- Nux/StaticText.cpp 2012-11-04 10:45:15 +0000
+++ Nux/StaticText.cpp 2012-12-17 15:42:23 +0000
@@ -224,7 +224,7 @@
224 if (!dw_texture_.IsValid())224 if (!dw_texture_.IsValid())
225 return;225 return;
226226
227 Geometry base = GetGeometry();227 Geometry base = GetNativeGeometry();
228 graphics_engine.PushClippingRectangle(base);228 graphics_engine.PushClippingRectangle(base);
229229
230 nux::GetPainter().PaintBackground(graphics_engine, base);230 nux::GetPainter().PaintBackground(graphics_engine, base);
@@ -243,7 +243,7 @@
243 int y = base.y + (base.height - dw_texture_->GetHeight()) / 2;243 int y = base.y + (base.height - dw_texture_->GetHeight()) / 2;
244244
245 int x = base.x;245 int x = base.x;
246 246
247 //Special case: In the horizontal direction, if the width of the text is smaller than the 247 //Special case: In the horizontal direction, if the width of the text is smaller than the
248 // width of the view, then center the text horizontally.248 // width of the view, then center the text horizontally.
249 if (dw_texture_->GetWidth() < base.width)249 if (dw_texture_->GetWidth() < base.width)
250250
=== modified file 'Nux/StaticTextBox.cpp'
--- Nux/StaticTextBox.cpp 2012-10-10 22:46:50 +0000
+++ Nux/StaticTextBox.cpp 2012-12-17 15:42:23 +0000
@@ -60,20 +60,20 @@
6060
61 void StaticTextBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)61 void StaticTextBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
62 {62 {
63 Geometry base = GetGeometry();63 Geometry base = GetNativeGeometry();
64 {64 {
65 graphics_engine.PushClippingRectangle(base);65 graphics_engine.PushClippingRectangle(base);
6666
67 if (m_bDrawBackground)67 if (m_bDrawBackground)
68 {68 {
69 GetPainter().PushDrawLayer(graphics_engine, base, m_Background);69 GetPainter().PushDrawLayer(graphics_engine, base, m_Background);
70 GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetGeometry(), m_Text, m_TextColor, m_WriteAlpha, m_TextAlignment);70 GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetNativeGeometry(), m_Text, m_TextColor, m_WriteAlpha, m_TextAlignment);
71 GetPainter().PopBackground();71 GetPainter().PopBackground();
72 }72 }
73 else73 else
74 {74 {
75 //GetPainter().PaintBackground(graphics_engine, base);75 //GetPainter().PaintBackground(graphics_engine, base);
76 GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetGeometry(), m_Text, m_TextColor, m_WriteAlpha, m_TextAlignment);76 GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetNativeGeometry(), m_Text, m_TextColor, m_WriteAlpha, m_TextAlignment);
77 }77 }
7878
79 graphics_engine.PopClippingRectangle();79 graphics_engine.PopClippingRectangle();
8080
=== modified file 'Nux/TabView.cpp'
--- Nux/TabView.cpp 2012-11-05 21:31:06 +0000
+++ Nux/TabView.cpp 2012-12-17 15:42:23 +0000
@@ -135,7 +135,7 @@
135 RemoveCompositionLayout();135 RemoveCompositionLayout();
136 delete(tabright_callback);136 delete(tabright_callback);
137 delete(tableft_callback);137 delete(tableft_callback);
138 138
139 std::vector<TabElement *>::iterator it;139 std::vector<TabElement *>::iterator it;
140140
141 for (it = _tab_array.begin(); it != _tab_array.end(); it++)141 for (it = _tab_array.begin(); it != _tab_array.end(); it++)
@@ -184,28 +184,30 @@
184 m_DrawBackgroundOnPreviousGeometry = false;184 m_DrawBackgroundOnPreviousGeometry = false;
185 }185 }
186186
187 graphics_engine.PushClippingRectangle(GetGeometry());187 Geometry base = GetNativeGeometry();
188 Geometry base = GetGeometry();188 graphics_engine.PushClippingRectangle(base);
189189
190 GetPainter().PushDrawShapeLayer(graphics_engine, Geometry(base.x, base.y, base.GetWidth(), TAB_HEIGHT), eSHAPE_CORNER_ROUND4, TAB_HEADER_BACKGROUND_COLOR, eCornerTopLeft | eCornerTopRight);190 base = GetGeometryRelativeTo(this);
191
192 GetPainter().PushDrawShapeLayer(graphics_engine, Geometry(base.x, base.y, base.width, TAB_HEIGHT), eSHAPE_CORNER_ROUND4, TAB_HEADER_BACKGROUND_COLOR, eCornerTopLeft | eCornerTopRight);
191193
192 if (_visible_tab_content_layout)194 if (_visible_tab_content_layout)
193 _visible_tab_content_layout->QueueDraw();195 _visible_tab_content_layout->QueueDraw();
194196
195 unsigned int vector_size = (unsigned int) _tab_array.size();197 unsigned int vector_size = (unsigned int) _tab_array.size();
196198
197 Geometry geo = GetGeometry();199 Geometry geo = GetNativeGeometry();
198 Geometry clip_geo;200 Geometry clip_geo;
199 clip_geo.SetX(geo.x);201 clip_geo.SetX(geo.x);
200 clip_geo.SetY(geo.y);202 clip_geo.SetY(geo.y);
201 clip_geo.SetWidth(geo.GetWidth() - 2 * TAB_BUTTON_WIDTH);203 clip_geo.SetWidth(geo.width - 2 * TAB_BUTTON_WIDTH);
202 clip_geo.SetHeight(_tabview_heads_layout->GetBaseHeight());204 clip_geo.SetHeight(_tabview_heads_layout->GetBaseHeight());
203205
204 graphics_engine.PushClippingRectangle(clip_geo);206 graphics_engine.PushClippingRectangle(clip_geo);
205207
206 for (unsigned int i = 0; i < vector_size; i++)208 for (unsigned int i = 0; i < vector_size; i++)
207 {209 {
208 Geometry tab_geo = _tab_array[i]->_tab_area->GetGeometry();210 Geometry tab_geo = _tab_array[i]->_tab_area->GetAbsoluteGeometry();
209 const char *tab_text = _tab_array[i]->GetName().c_str();211 const char *tab_text = _tab_array[i]->GetName().c_str();
210212
211 if (_tab_array[i]->_index == m_FocusTabIndex)213 if (_tab_array[i]->_index == m_FocusTabIndex)
@@ -224,21 +226,22 @@
224226
225 graphics_engine.PopClippingRectangle();227 graphics_engine.PopClippingRectangle();
226228
227 GetPainter().PaintShapeCorner(graphics_engine, Geometry(base.x, base.y + TAB_HEIGHT, base.GetWidth(), base.GetHeight() - TAB_HEIGHT),229 Geometry rgeo = GetGeometryRelativeTo(this);
230 GetPainter().PaintShapeCorner(graphics_engine, Geometry(rgeo.x, rgeo.y + TAB_HEIGHT, rgeo.width, rgeo.height - TAB_HEIGHT),
228 TAB_BACKGROUND_COLOR, eSHAPE_CORNER_ROUND4, eCornerBottomLeft | eCornerBottomRight, false);231 TAB_BACKGROUND_COLOR, eSHAPE_CORNER_ROUND4, eCornerBottomLeft | eCornerBottomRight, false);
229232
230 GetPainter().Paint2DQuadColor(graphics_engine, _scroll_right->GetGeometry(), TAB_HEADER_BACKGROUND_COLOR);233 GetPainter().Paint2DQuadColor(graphics_engine, _scroll_right->GetAbsoluteGeometry(), TAB_HEADER_BACKGROUND_COLOR);
231 GeometryPositioning gp(eHACenter, eVACenter);234 GeometryPositioning gp(eHACenter, eVACenter);
232 Geometry GeoPo = ComputeGeometryPositioning(_scroll_right->GetGeometry(), GetTheme().GetImageGeometry(eTAB_RIGHT), gp);235 Geometry GeoPo = ComputeGeometryPositioning(_scroll_right->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eTAB_RIGHT), gp);
233236
234 if (_scroll_right->IsMouseInside())237 if (_scroll_right->IsMouseInside())
235 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eTAB_RIGHT);238 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eTAB_RIGHT);
236 else239 else
237 GetPainter().PaintShape(graphics_engine, GeoPo, TAB_HEADER_FOCUS_COLOR, eTAB_RIGHT);240 GetPainter().PaintShape(graphics_engine, GeoPo, TAB_HEADER_FOCUS_COLOR, eTAB_RIGHT);
238241
239 GetPainter().Paint2DQuadColor(graphics_engine, _scroll_left->GetGeometry(), TAB_HEADER_BACKGROUND_COLOR);242 GetPainter().Paint2DQuadColor(graphics_engine, _scroll_left->GetAbsoluteGeometry(), TAB_HEADER_BACKGROUND_COLOR);
240 gp.SetAlignment(eHACenter, eVACenter);243 gp.SetAlignment(eHACenter, eVACenter);
241 GeoPo = ComputeGeometryPositioning(_scroll_left->GetGeometry(), GetTheme().GetImageGeometry(eTAB_LEFT), gp);244 GeoPo = ComputeGeometryPositioning(_scroll_left->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eTAB_LEFT), gp);
242245
243 if (_scroll_left->IsMouseInside())246 if (_scroll_left->IsMouseInside())
244 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eTAB_LEFT);247 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eTAB_LEFT);
@@ -251,15 +254,15 @@
251254
252 void TabView::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)255 void TabView::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
253 {256 {
254 Geometry base = GetGeometry();257 Geometry base = GetGeometryRelativeTo(this);
255258
256 graphics_engine.PushClippingRectangle(GetGeometry());259 graphics_engine.PushClippingRectangle(base);
257 GetPainter().PushShapeLayer(graphics_engine, Geometry(base.x, base.y + TAB_HEIGHT, base.GetWidth(), base.GetHeight() - TAB_HEIGHT),260 GetPainter().PushShapeLayer(graphics_engine, Geometry(base.x, base.y + TAB_HEIGHT, base.GetWidth(), base.GetHeight() - TAB_HEIGHT),
258 eSHAPE_CORNER_ROUND4, TAB_BACKGROUND_COLOR, eCornerBottomLeft | eCornerBottomRight);261 eSHAPE_CORNER_ROUND4, TAB_BACKGROUND_COLOR, eCornerBottomLeft | eCornerBottomRight);
259262
260 if (_visible_tab_content_layout)263 if (_visible_tab_content_layout)
261 {264 {
262 graphics_engine.PushClippingRectangle(_visible_tab_content_layout->GetGeometry());265 graphics_engine.PushClippingRectangle(_visible_tab_content_layout->GetGeometryRelativeTo(this));
263 _visible_tab_content_layout->ProcessDraw(graphics_engine, force_draw);266 _visible_tab_content_layout->ProcessDraw(graphics_engine, force_draw);
264 graphics_engine.PopClippingRectangle();267 graphics_engine.PopClippingRectangle();
265 }268 }
@@ -273,7 +276,7 @@
273 // Give the managed layout appropriate size and position..276 // Give the managed layout appropriate size and position..
274 if (view_layout_)277 if (view_layout_)
275 {278 {
276 Geometry layout_geo = GetGeometry();279 Geometry layout_geo = GetGeometryRelativeTo(this);
277 layout_geo.OffsetPosition(TAB_X_BORDER, TAB_HEIGHT);280 layout_geo.OffsetPosition(TAB_X_BORDER, TAB_HEIGHT);
278 layout_geo.OffsetSize(-2 * TAB_X_BORDER, - (TAB_HEIGHT) - TAB_Y_BORDER);281 layout_geo.OffsetSize(-2 * TAB_X_BORDER, - (TAB_HEIGHT) - TAB_Y_BORDER);
279 view_layout_->SetGeometry(layout_geo);282 view_layout_->SetGeometry(layout_geo);
@@ -287,15 +290,15 @@
287 // been changed by ComputeContentSize.290 // been changed by ComputeContentSize.
288 if (view_layout_)291 if (view_layout_)
289 {292 {
290 Geometry base = view_layout_->GetGeometry();293 Geometry base = view_layout_->GetGeometryRelativeTo(this);
291 base.OffsetPosition(-TAB_X_BORDER, -TAB_HEIGHT);294 base.OffsetPosition(-TAB_X_BORDER, -TAB_HEIGHT);
292 base.OffsetSize(2 * TAB_X_BORDER, TAB_HEIGHT + TAB_Y_BORDER);295 base.OffsetSize(2 * TAB_X_BORDER, TAB_HEIGHT + TAB_Y_BORDER);
293 Area::SetGeometry(base);296 Area::SetGeometry(base);
294 }297 }
295298
296 Geometry base = GetGeometry();299 Geometry base = GetGeometryRelativeTo(this);
297300
298 int tab_x = view_layout_->GetGeometry().x + view_layout_->GetGeometry().GetWidth() - 2 * TAB_BUTTON_WIDTH;301 int tab_x = base.x + base.width - 2 * TAB_BUTTON_WIDTH;
299 int tab_y = base.y;302 int tab_y = base.y;
300303
301 _scroll_left->SetBaseXY(tab_x, tab_y);304 _scroll_left->SetBaseXY(tab_x, tab_y);
@@ -325,8 +328,8 @@
325 {328 {
326 if (view_layout_)329 if (view_layout_)
327 {330 {
328 view_layout_->SetBaseX(GetBaseX() + TAB_X_BORDER);331 view_layout_->SetBaseX(GetNativeX() + TAB_X_BORDER);
329 view_layout_->SetBaseY(GetBaseY() + TAB_HEIGHT);332 view_layout_->SetBaseY(GetNativeY() + TAB_HEIGHT);
330 view_layout_->ComputeContentPosition(offsetX, offsetY);333 view_layout_->ComputeContentPosition(offsetX, offsetY);
331 }334 }
332 }335 }
@@ -402,30 +405,32 @@
402// return;405// return;
403406
404 m_TabPositionOffset += offset;407 m_TabPositionOffset += offset;
405 int lx = view_layout_->GetBaseX() + m_TabPositionOffset;408 Geometry lgeo = view_layout_->GetGeometry();
406409
407 if (lx > view_layout_->GetBaseX())410 int lx = lgeo.x + m_TabPositionOffset;
411
412 if (lx > lgeo.x)
408 {413 {
409 // end of scroll left;414 // end of scroll left;
410 m_TabPositionOffset = 0;415 m_TabPositionOffset = 0;
411 lx = view_layout_->GetBaseX() + m_TabPositionOffset;416 //lx = view_layout_->GetBaseX() + m_TabPositionOffset;
417 lx = lgeo.x + m_TabPositionOffset;
412 }418 }
413419
414 if (lx + _tabview_heads_layout->GetBaseWidth() < view_layout_->GetBaseX() +420 if (lx + _tabview_heads_layout->GetBaseWidth() < lgeo.x +
415 view_layout_->GetBaseWidth() - 2 * TAB_BUTTON_WIDTH)421 view_layout_->GetBaseWidth() - 2 * TAB_BUTTON_WIDTH)
416 {422 {
417423
418 lx = (view_layout_->GetBaseX() +424 lx = (lgeo.x +
419 view_layout_->GetBaseWidth() - 2 * TAB_BUTTON_WIDTH) - _tabview_heads_layout->GetBaseWidth();425 view_layout_->GetBaseWidth() - 2 * TAB_BUTTON_WIDTH) - _tabview_heads_layout->GetBaseWidth();
420426
421427 if (lx > lgeo.x)
422 if (lx > view_layout_->GetBaseX())
423 {428 {
424 m_TabPositionOffset = 0;429 m_TabPositionOffset = 0;
425 lx = view_layout_->GetBaseX() + m_TabPositionOffset;430 lx = lgeo.x + m_TabPositionOffset;
426 }431 }
427 else432 else
428 m_TabPositionOffset = - (view_layout_->GetBaseX() - lx);433 m_TabPositionOffset = - (lgeo.x - lx);
429 }434 }
430435
431 _tabview_heads_layout->SetBaseX(lx);436 _tabview_heads_layout->SetBaseX(lx);
432437
=== modified file 'Nux/TextureArea.cpp'
--- Nux/TextureArea.cpp 2012-11-17 23:22:51 +0000
+++ Nux/TextureArea.cpp 2012-12-17 15:42:23 +0000
@@ -50,17 +50,17 @@
50 void TextureArea::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)50 void TextureArea::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
51 {51 {
52 // Ability to rotate the widget around its center52 // Ability to rotate the widget around its center
53 graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(-GetBaseX() - GetBaseWidth() / 2, -GetBaseY() - GetBaseHeight() / 2, 0));53 graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(- GetBaseWidth() / 2, - GetBaseHeight() / 2, 0));
54 graphics_engine.PushModelViewMatrix(Get2DRotation());54 graphics_engine.PushModelViewMatrix(Get2DRotation());
55 graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(GetBaseX() + GetBaseWidth() / 2, GetBaseY() + GetBaseHeight() / 2, 0));55 graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(GetBaseWidth() / 2, GetBaseHeight() / 2, 0));
5656
57 // The TextureArea should not render the accumulated background. That is left to the caller.57 // The TextureArea should not render the accumulated background. That is left to the caller.
58 // GetPainter().PaintBackground(graphics_engine, GetGeometry());58 // GetPainter().PaintBackground(graphics_engine, GetGeometry());
5959
60 if (paint_layer_)60 if (paint_layer_)
61 {61 {
62 paint_layer_->SetGeometry(GetGeometry());62 paint_layer_->SetGeometry(GetNativeGeometry());
63 GetPainter().RenderSinglePaintLayer(graphics_engine, GetGeometry(), paint_layer_);63 GetPainter().RenderSinglePaintLayer(graphics_engine, GetNativeGeometry(), paint_layer_);
64 }64 }
6565
66 graphics_engine.PopModelViewMatrix();66 graphics_engine.PopModelViewMatrix();
6767
=== modified file 'Nux/VLayout.cpp'
--- Nux/VLayout.cpp 2012-12-08 01:03:38 +0000
+++ Nux/VLayout.cpp 2012-12-17 15:42:23 +0000
@@ -245,8 +245,8 @@
245 VLayoutManagement(width, height);245 VLayoutManagement(width, height);
246246
247 // Objects have been resized, now position them.247 // Objects have been resized, now position them.
248 int current_x = GetBaseX() + left_padding_;248 int current_x = left_padding_;
249 int current_y = GetBaseY() + top_padding_;249 int current_y = top_padding_;
250250
251 //int per_element_space = 0;251 //int per_element_space = 0;
252 //int total_used_space = 0;252 //int total_used_space = 0;
@@ -364,12 +364,12 @@
364 continue;364 continue;
365365
366 int ret = 0;366 int ret = 0;
367 367
368 if (((*it)->IsLayout() || (*it)->IsView()) /*&& ((*it)->IsLayoutDone() == false)*/ /*&& ((*it)->GetScaleFactor() != 0)*/)368 if (((*it)->IsLayout() || (*it)->IsView()) /*&& ((*it)->IsLayoutDone() == false)*/ /*&& ((*it)->GetScaleFactor() != 0)*/)
369 {369 {
370 Geometry pre_geo = (*it)->GetGeometry();370 Geometry pre_geo = (*it)->GetNativeGeometry();
371 ret = (*it)->ComputeContentSize();371 ret = (*it)->ComputeContentSize();
372 Geometry post_geo = (*it)->GetGeometry();372 Geometry post_geo = (*it)->GetNativeGeometry();
373373
374 bool larger_width = pre_geo.width < post_geo.width;374 bool larger_width = pre_geo.width < post_geo.width;
375 bool smaller_width = pre_geo.width > post_geo.width;375 bool smaller_width = pre_geo.width > post_geo.width;
@@ -563,7 +563,7 @@
563 {563 {
564 if (!(*it)->IsVisible())564 if (!(*it)->IsVisible())
565 continue;565 continue;
566 566
567 if ((*it)->GetScaleFactor() == 0 || (*it)->IsLayoutDone() == true)567 if ((*it)->GetScaleFactor() == 0 || (*it)->IsLayoutDone() == true)
568 {568 {
569 available_height -= (*it)->GetBaseHeight();569 available_height -= (*it)->GetBaseHeight();
@@ -610,7 +610,7 @@
610 {610 {
611 if (!(*it)->IsVisible())611 if (!(*it)->IsVisible())
612 continue;612 continue;
613 613
614 if (((*it)->GetScaleFactor() != 0) && ((*it)->IsLayoutDone() == false))614 if (((*it)->GetScaleFactor() != 0) && ((*it)->IsLayoutDone() == false))
615 {615 {
616 float sf = (float) (*it)->GetScaleFactor();616 float sf = (float) (*it)->GetScaleFactor();
@@ -772,8 +772,8 @@
772 height -= (int) (num_element - 1) * space_between_children_ + (top_padding_ + bottom_padding_);772 height -= (int) (num_element - 1) * space_between_children_ + (top_padding_ + bottom_padding_);
773773
774 // Objects have been resized, now position them.774 // Objects have been resized, now position them.
775 int current_x = GetBaseX() + left_padding_ + offsetX; // add base offset in X(used for scrolling)775 int current_x = left_padding_ + offsetX; // add base offset in X(used for scrolling)
776 int current_y = GetBaseY() + top_padding_ + offsetY; // add base offset in Y(used for scrolling)776 int current_y = top_padding_ + offsetY; // add base offset in Y(used for scrolling)
777777
778 int offset_space = 0;778 int offset_space = 0;
779 int element_margin = 0;779 int element_margin = 0;
780780
=== modified file 'Nux/VScrollBar.cpp'
--- Nux/VScrollBar.cpp 2012-11-05 21:31:06 +0000
+++ Nux/VScrollBar.cpp 2012-12-17 15:42:23 +0000
@@ -283,7 +283,7 @@
283283
284 void VScrollBar::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)284 void VScrollBar::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
285 {285 {
286 Geometry base = GetGeometry();286 Geometry base = GetNativeGeometry();
287 GetPainter().PaintBackground(graphics_engine, base);287 GetPainter().PaintBackground(graphics_engine, base);
288288
289 base.OffsetPosition(0, VSCROLLBAR_HEIGHT);289 base.OffsetPosition(0, VSCROLLBAR_HEIGHT);
@@ -300,7 +300,7 @@
300300
301 if (content_height_ > container_height_)301 if (content_height_ > container_height_)
302 {302 {
303 Geometry slider_geo = _slider->GetGeometry();303 Geometry slider_geo = _slider->GetGeometryRelativeTo(this);
304 graphics_engine.QRP_Color(slider_geo.x, slider_geo.y, slider_geo.width, slider_geo.height,304 graphics_engine.QRP_Color(slider_geo.x, slider_geo.y, slider_geo.width, slider_geo.height,
305 Color(1.0f, 1.0f, 1.0f, 0.8f));305 Color(1.0f, 1.0f, 1.0f, 0.8f));
306 }306 }
307307
=== modified file 'Nux/VSplitter.cpp'
--- Nux/VSplitter.cpp 2012-11-17 17:18:11 +0000
+++ Nux/VSplitter.cpp 2012-12-17 15:42:23 +0000
@@ -78,16 +78,18 @@
7878
79 void VSplitter::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)79 void VSplitter::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
80 {80 {
81 Geometry base = GetGeometry();81 // Save the model view matrix. We reuse it when drawing the splitter overlay during a resize operation.
82 local_model_view_matrix_ = graphics_engine.GetModelViewMatrix();
83
84 Geometry base = GetNativeGeometry();
82 graphics_engine.PushClippingRectangle(base);85 graphics_engine.PushClippingRectangle(base);
83 std::vector<Area *>::iterator it;86 std::vector<Area *>::iterator it;
8487
85 GetPainter().PaintBackground(graphics_engine, base);
86 std::vector<MySplitter *>::iterator it_splitter;88 std::vector<MySplitter *>::iterator it_splitter;
8789
88 for (it_splitter = m_SplitterObject.begin(); it_splitter != m_SplitterObject.end(); ++it_splitter)90 for (it_splitter = m_SplitterObject.begin(); it_splitter != m_SplitterObject.end(); ++it_splitter)
89 {91 {
90 Geometry geo = (*it_splitter)->GetGeometry();92 Geometry geo = (*it_splitter)->GetGeometryRelativeTo(this);
91 Geometry grip_geo;93 Geometry grip_geo;
92 int h = 20;94 int h = 20;
9395
@@ -115,8 +117,9 @@
115117
116 void VSplitter::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)118 void VSplitter::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
117 {119 {
118 graphics_engine.PushClippingRectangle(GetGeometry());120 Geometry base = GetNativeGeometry();
119 Geometry base = GetGeometry();121 graphics_engine.PushClippingRectangle(base);
122
120 bool need_redraw = IsRedrawNeeded();123 bool need_redraw = IsRedrawNeeded();
121124
122 std::vector<MySplitter *>::iterator it_splitter;125 std::vector<MySplitter *>::iterator it_splitter;
@@ -126,7 +129,7 @@
126 it != m_InterfaceObject.end();129 it != m_InterfaceObject.end();
127 ++it, ++it_splitter)130 ++it, ++it_splitter)
128 {131 {
129 Geometry sgeo = (*it_splitter)->GetGeometry();132 Geometry sgeo = (*it_splitter)->GetGeometryRelativeTo(this);
130 graphics_engine.PushClippingRectangle(Rect(133 graphics_engine.PushClippingRectangle(Rect(
131 base.x, base.y, sgeo.x - base.x, base.GetHeight()));134 base.x, base.y, sgeo.x - base.x, base.GetHeight()));
132135
@@ -178,13 +181,20 @@
178 void VSplitter::OverlayDrawing(GraphicsEngine &graphics_engine)181 void VSplitter::OverlayDrawing(GraphicsEngine &graphics_engine)
179 {182 {
180 unsigned int num_element = (unsigned int) m_SplitterObject.size();183 unsigned int num_element = (unsigned int) m_SplitterObject.size();
181184 Geometry base = GetNativeGeometry();
182 Geometry base = GetGeometry();185
186 // Transform this area position with the model view matrix we captured earlier.
187 Vector4 v = local_model_view_matrix_ * Vector4(base.x, base.y, 0.0f, 1.0f);
188
189 // base is now in window coordinates
190 base.x = v.x;
191 base.y = v.y;
183192
184 if (m_focus_splitter_index >= 0)193 if (m_focus_splitter_index >= 0)
185 {194 {
186 Geometry geo = m_SplitterObject[m_focus_splitter_index]->GetGeometry();195 Geometry geo = m_SplitterObject[m_focus_splitter_index]->GetGeometryRelativeTo(this);
187 geo.OffsetPosition(mvt_dx, mvt_dy);196
197 geo.OffsetPosition(base.x + mvt_dx, base.y + mvt_dy);
188198
189 if (m_focus_splitter_index == 0 && num_element > 1)199 if (m_focus_splitter_index == 0 && num_element > 1)
190 {200 {
@@ -193,22 +203,22 @@
193 geo.SetX(base.x);203 geo.SetX(base.x);
194 }204 }
195205
196 if (geo.x + VSPLITTERWIDTH > m_SplitterObject[m_focus_splitter_index + 1]->GetGeometry().x)206 if (geo.x + VSPLITTERWIDTH > base.x + m_SplitterObject[m_focus_splitter_index + 1]->GetGeometryRelativeTo(this).x)
197 {207 {
198 geo.SetX(m_SplitterObject[m_focus_splitter_index+1]->GetGeometry().x - VSPLITTERWIDTH);208 geo.SetX(base.x + m_SplitterObject[m_focus_splitter_index+1]->GetGeometryRelativeTo(this).x - VSPLITTERWIDTH);
199 }209 }
200 }210 }
201211
202 if ((m_focus_splitter_index > 0) && m_focus_splitter_index < (int) num_element - 1)212 if ((m_focus_splitter_index > 0) && m_focus_splitter_index < (int) num_element - 1)
203 {213 {
204 if (geo.x < m_SplitterObject[m_focus_splitter_index - 1]->GetGeometry().x + VSPLITTERWIDTH)214 if (geo.x < m_SplitterObject[m_focus_splitter_index - 1]->GetGeometryRelativeTo(this).x + VSPLITTERWIDTH)
205 {215 {
206 geo.SetX(m_SplitterObject[m_focus_splitter_index - 1]->GetGeometry().x + VSPLITTERWIDTH);216 geo.SetX(m_SplitterObject[m_focus_splitter_index - 1]->GetGeometryRelativeTo(this).x + VSPLITTERWIDTH);
207 }217 }
208218
209 if (geo.x + VSPLITTERWIDTH > m_SplitterObject[m_focus_splitter_index + 1]->GetGeometry().x)219 if (geo.x + VSPLITTERWIDTH > m_SplitterObject[m_focus_splitter_index + 1]->GetGeometryRelativeTo(this).x)
210 {220 {
211 geo.SetX(m_SplitterObject[m_focus_splitter_index + 1]->GetGeometry().x - VSPLITTERWIDTH);221 geo.SetX(m_SplitterObject[m_focus_splitter_index + 1]->GetGeometryRelativeTo(this).x - VSPLITTERWIDTH);
212 }222 }
213 }223 }
214224
@@ -251,8 +261,8 @@
251 long VSplitter::ComputeContentSize()261 long VSplitter::ComputeContentSize()
252 {262 {
253 unsigned int num_element = (unsigned int) m_InterfaceObject.size();263 unsigned int num_element = (unsigned int) m_InterfaceObject.size();
254 int x = GetBaseX();264 int x = 0;
255 int y = GetBaseY();265 int y = 0;
256 int w = GetBaseWidth();266 int w = GetBaseWidth();
257 int h = GetBaseHeight();267 int h = GetBaseHeight();
258268
@@ -285,7 +295,7 @@
285 {295 {
286 for (unsigned int i = 0; i < num_element; i++)296 for (unsigned int i = 0; i < num_element; i++)
287 {297 {
288 Geometry splitter_geo = m_SplitterObject[i]->GetGeometry();298 Geometry splitter_geo = m_SplitterObject[i]->GetGeometryRelativeTo(this);
289 splitter_geo.SetHeight(h);299 splitter_geo.SetHeight(h);
290 splitter_geo.SetY(y);300 splitter_geo.SetY(y);
291301
@@ -301,7 +311,7 @@
301311
302 for (unsigned int i = 0; i < num_element; i++)312 for (unsigned int i = 0; i < num_element; i++)
303 {313 {
304 Geometry splitter_geo = m_SplitterObject[i]->GetGeometry();314 Geometry splitter_geo = m_SplitterObject[i]->GetGeometryRelativeTo(this);
305 // compute percentage of space occupied by the element i;315 // compute percentage of space occupied by the element i;
306 // width of element i = m_SplitterObject[i]->GetX() - previous_splliter_end316 // width of element i = m_SplitterObject[i]->GetX() - previous_splliter_end
307 int splitter_start = m_SplitterObject[i]->GetBaseX();317 int splitter_start = m_SplitterObject[i]->GetBaseX();
@@ -328,7 +338,7 @@
328338
329 for (unsigned int i = 0; i < num_element; i++)339 for (unsigned int i = 0; i < num_element; i++)
330 {340 {
331 Geometry splitter_geo = m_SplitterObject[i]->GetGeometry();341 Geometry splitter_geo = m_SplitterObject[i]->GetGeometryRelativeTo(this);
332342
333 //m_InterfaceObject[i]->SetGeometry(Geometry(accwidth, y, splitter_geo.x - accwidth, h));343 //m_InterfaceObject[i]->SetGeometry(Geometry(accwidth, y, splitter_geo.x - accwidth, h));
334344
@@ -362,8 +372,8 @@
362372
363 void VSplitter::ResetSplitConfig()373 void VSplitter::ResetSplitConfig()
364 {374 {
365 int x = GetBaseX();375 int x = 0;
366 int y = GetBaseY();376 int y = 0;
367 int w = GetBaseWidth();377 int w = GetBaseWidth();
368 int h = GetBaseHeight();378 int h = GetBaseHeight();
369 unsigned int num_element = (unsigned int) m_InterfaceObject.size();379 unsigned int num_element = (unsigned int) m_InterfaceObject.size();
@@ -403,6 +413,7 @@
403 x += stretchfactor * max_size / max_stretch;413 x += stretchfactor * max_size / max_stretch;
404 Geometry geo(x, y, VSPLITTERWIDTH, h);414 Geometry geo(x, y, VSPLITTERWIDTH, h);
405 m_SplitterObject[i]->SetGeometry(geo);415 m_SplitterObject[i]->SetGeometry(geo);
416 x += VSPLITTERWIDTH;
406 }417 }
407418
408 m_SplitterObject[num_element-1]->SetBaseX(x + w - VSPLITTERWIDTH);419 m_SplitterObject[num_element-1]->SetBaseX(x + w - VSPLITTERWIDTH);
@@ -425,7 +436,7 @@
425 {436 {
426 if (mvt_dx)437 if (mvt_dx)
427 {438 {
428 Geometry geo = m_SplitterObject[header_pos]->GetGeometry();439 Geometry geo = m_SplitterObject[header_pos]->GetGeometryRelativeTo(this);
429 geo.OffsetPosition(mvt_dx, 0);440 geo.OffsetPosition(mvt_dx, 0);
430441
431 unsigned int num_element = (unsigned int) m_SplitterObject.size();442 unsigned int num_element = (unsigned int) m_SplitterObject.size();
@@ -433,8 +444,8 @@
433 if (header_pos < (int) num_element - 1)444 if (header_pos < (int) num_element - 1)
434 {445 {
435 // Make the splitter bar stick to the next one if the distance between them is less than VSTICK_SIZE446 // Make the splitter bar stick to the next one if the distance between them is less than VSTICK_SIZE
436 if (m_SplitterObject[header_pos + 1]->GetGeometry().x - geo.x - VSPLITTERWIDTH < VSTICK_SIZE)447 if (m_SplitterObject[header_pos + 1]->GetGeometryRelativeTo(this).x - geo.x - VSPLITTERWIDTH < VSTICK_SIZE)
437 geo.SetX( m_SplitterObject[header_pos + 1]->GetGeometry().x - VSPLITTERWIDTH );448 geo.SetX( m_SplitterObject[header_pos + 1]->GetGeometryRelativeTo(this).x - VSPLITTERWIDTH );
438 }449 }
439450
440 m_SplitterObject[header_pos]->SetGeometry(geo);451 m_SplitterObject[header_pos]->SetGeometry(geo);
@@ -453,7 +464,7 @@
453464
454 void VSplitter::OnSplitterMouseDrag(int x, int /* y */, int /* dx */, int /* dy */, unsigned long /* button_flags */, unsigned long /* key_flags */, int header_pos)465 void VSplitter::OnSplitterMouseDrag(int x, int /* y */, int /* dx */, int /* dy */, unsigned long /* button_flags */, unsigned long /* key_flags */, int header_pos)
455 {466 {
456 Geometry geo = m_SplitterObject[header_pos]->GetGeometry();467 Geometry geo = m_SplitterObject[header_pos]->GetGeometryRelativeTo(this);
457 int num_element = (int) m_SplitterObject.size();468 int num_element = (int) m_SplitterObject.size();
458469
459 if (header_pos == num_element - 1)470 if (header_pos == num_element - 1)
@@ -483,17 +494,17 @@
483494
484 void VSplitter::ResizeSplitter(int header_pos)495 void VSplitter::ResizeSplitter(int header_pos)
485 {496 {
486 Geometry geo = m_SplitterObject[header_pos]->GetGeometry();497 Geometry geo = m_SplitterObject[header_pos]->GetGeometryRelativeTo(this);
487 int num_element = (int) m_SplitterObject.size();498 int num_element = (int) m_SplitterObject.size();
488499
489 if ((header_pos == 0) && (m_SplitterObject[header_pos]->GetBaseX() < GetBaseX()))500 if ((header_pos == 0) && (m_SplitterObject[header_pos]->GetBaseX() < 0))
490 {501 {
491 m_SplitterObject[header_pos]->SetBaseX(GetBaseX());502 m_SplitterObject[header_pos]->SetBaseX(0);
492 }503 }
493504
494 if ((header_pos == num_element - 1) && (m_SplitterObject[header_pos]->GetBaseX() > GetBaseX() + GetBaseWidth() - VSPLITTERWIDTH))505 if ((header_pos == num_element - 1) && (m_SplitterObject[header_pos]->GetBaseX() > GetBaseX() + GetBaseWidth() - VSPLITTERWIDTH))
495 {506 {
496 m_SplitterObject[header_pos]->SetBaseX(GetBaseX() + GetBaseWidth() - VSPLITTERWIDTH);507 m_SplitterObject[header_pos]->SetBaseX(GetBaseWidth() - VSPLITTERWIDTH);
497 }508 }
498509
499 if (header_pos < (int) num_element - 1)510 if (header_pos < (int) num_element - 1)
500511
=== modified file 'Nux/VSplitter.h'
--- Nux/VSplitter.h 2012-11-05 21:31:06 +0000
+++ Nux/VSplitter.h 2012-12-17 15:42:23 +0000
@@ -79,6 +79,7 @@
7979
80 private:80 private:
8181
82 Matrix4 local_model_view_matrix_;
82 typedef BasicView MySplitter;83 typedef BasicView MySplitter;
83 std::vector<Area *> m_InterfaceObject;84 std::vector<Area *> m_InterfaceObject;
84 std::vector<MySplitter *> m_SplitterObject;85 std::vector<MySplitter *> m_SplitterObject;
8586
=== modified file 'Nux/View.cpp'
--- Nux/View.cpp 2012-11-05 21:31:06 +0000
+++ Nux/View.cpp 2012-12-17 15:42:23 +0000
@@ -44,7 +44,7 @@
44 backup_texture_.Release();44 backup_texture_.Release();
45 backup_depth_texture_.Release();45 backup_depth_texture_.Release();
46 background_texture_.Release();46 background_texture_.Release();
47 47
48 // It is possible that the window thread has been deleted before the view48 // It is possible that the window thread has been deleted before the view
49 // itself, so check prior to calling.49 // itself, so check prior to calling.
50 WindowThread* wt = GetWindowThread();50 WindowThread* wt = GetWindowThread();
@@ -121,8 +121,8 @@
121 {121 {
122 if (view_layout_)122 if (view_layout_)
123 {123 {
124 view_layout_->SetBaseX(GetBaseX());124 view_layout_->SetBaseX(0);
125 view_layout_->SetBaseY(GetBaseY());125 view_layout_->SetBaseY(0);
126 view_layout_->ComputeContentPosition(offsetX, offsetY);126 view_layout_->ComputeContentPosition(offsetX, offsetY);
127 }127 }
128 }128 }
@@ -131,7 +131,7 @@
131 {131 {
132 // Give the managed layout the same size and position as the Control.132 // Give the managed layout the same size and position as the Control.
133 if (view_layout_)133 if (view_layout_)
134 view_layout_->SetGeometry(GetGeometry());134 view_layout_->SetGeometry(GetNativeGeometry());
135 }135 }
136136
137 long View::PostLayoutManagement(long LayoutResult)137 long View::PostLayoutManagement(long LayoutResult)
@@ -143,7 +143,10 @@
143 {143 {
144 // If The layout is empty, do not change the size of the parent element.144 // If The layout is empty, do not change the size of the parent element.
145 if (!view_layout_->IsEmpty())145 if (!view_layout_->IsEmpty())
146 Area::SetGeometry(view_layout_->GetGeometry());146 {
147 Area::SetWidth(view_layout_->GetWidth());
148 Area::SetHeight(view_layout_->GetHeight());
149 }
147 }150 }
148151
149 return LayoutResult;152 return LayoutResult;
@@ -160,18 +163,28 @@
160163
161 void View::ProcessDraw(GraphicsEngine& graphics_engine, bool force_draw)164 void View::ProcessDraw(GraphicsEngine& graphics_engine, bool force_draw)
162 {165 {
166 if (this->Type().IsDerivedFromType(BasicView::StaticObjectType))
167 {
168 // Areas of type BasicView aren't drawing anything.
169 // Just skip them.
170 return;
171 }
172
163 full_view_draw_cmd_ = false;173 full_view_draw_cmd_ = false;
164174
165 if (RedirectRenderingToTexture())175 if (GetRedirectRenderingToTexture())
166 {176 {
167 if (update_backup_texture_ || force_draw || draw_cmd_queued_)177 if (update_backup_texture_ || force_draw || draw_cmd_queued_)
168 {178 {
169 GetPainter().PushPaintLayerStack(); 179 GetPainter().PushPaintLayerStack();
170 BeginBackupTextureRendering(graphics_engine, force_draw);180 BeginBackupTextureRendering(graphics_engine, force_draw);
171 {181 {
172 graphics_engine.PushModelViewMatrix(Get2DMatrix());182 graphics_engine.PushModelViewMatrix(Get2DMatrix());
183 Matrix4 mat;
184 mat.Translate(GetX(), GetY(), 0);
185 graphics_engine.PushModelViewMatrix(mat);
173186
174 Geometry translated_geo = GetGeometry();187 Geometry translated_geo = GetNativeGeometry();
175 translated_geo.x = 0;188 translated_geo.x = 0;
176 translated_geo.y = 0;189 translated_geo.y = 0;
177 if (force_draw)190 if (force_draw)
@@ -195,46 +208,37 @@
195 }208 }
196 }209 }
197 graphics_engine.PopModelViewMatrix();210 graphics_engine.PopModelViewMatrix();
211 graphics_engine.PopModelViewMatrix();
198 }212 }
199 EndBackupTextureRendering(graphics_engine, force_draw);213 EndBackupTextureRendering(graphics_engine, force_draw);
200 GetPainter().PopPaintLayerStack();214 GetPainter().PopPaintLayerStack();
201 }215
202216 if (GetPresentRedirectedView())
203 if (PresentRedirectedView())
204 {
205 unsigned int current_alpha_blend;
206 unsigned int current_src_blend_factor;
207 unsigned int current_dest_blend_factor;
208 // Be a good citizen, get a copy of the current GPU sates according to Nux
209 graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
210
211 TexCoordXForm texxform;
212
213 if ((force_draw || draw_cmd_queued_) && (background_texture_.IsValid()))
214 {217 {
215 graphics_engine.GetRenderStates().SetBlend(false);218 RedirectedArea ra;
216 texxform.FlipVCoord(true);219 ra.backup_texture = backup_texture_;
217 // Draw the background of this view.220 ra.geometry = GetAbsoluteGeometry();
218 GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), background_texture_->GetWidth(), background_texture_->GetHeight(), background_texture_, texxform, color::White);221 ra.clipping_region = graphics_engine.GetClippingRegion();
222 ra.area = this;
223
224 GetWindowCompositor().QueueRedirected(ra);
219 }225 }
220226 }
221 texxform.uwrap = TEXWRAP_CLAMP;227 else
222 texxform.vwrap = TEXWRAP_CLAMP;228 {
223 texxform.FlipVCoord(true);229 GatherRedirectedViewForRendering(graphics_engine);
224
225 graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
226 GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), GetWidth(), GetHeight(), backup_texture_, texxform, Color(color::White));
227 // Be a good citizen, restore the Nux blending states.
228 graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
229 }230 }
230 }231 }
231 else232 else
232 {233 {
233 graphics_engine.PushModelViewMatrix(Get2DMatrix());234 graphics_engine.PushModelViewMatrix(Get2DMatrix());
235 Matrix4 mat;
236 mat.Translate(GetX(), GetY(), 0);
237 graphics_engine.PushModelViewMatrix(mat);
234238
235 if (force_draw)239 if (force_draw)
236 {240 {
237 GetPainter().PaintBackground(graphics_engine, GetGeometry());241 GetPainter().PaintBackground(graphics_engine, GetNativeGeometry());
238 GetPainter().PushPaintLayerStack();242 GetPainter().PushPaintLayerStack();
239243
240 draw_cmd_queued_ = true;244 draw_cmd_queued_ = true;
@@ -248,7 +252,7 @@
248 {252 {
249 if (draw_cmd_queued_)253 if (draw_cmd_queued_)
250 {254 {
251 GetPainter().PaintBackground(graphics_engine, GetGeometry());255 GetPainter().PaintBackground(graphics_engine, GetNativeGeometry());
252 GetPainter().PushPaintLayerStack();256 GetPainter().PushPaintLayerStack();
253257
254 full_view_draw_cmd_ = true;258 full_view_draw_cmd_ = true;
@@ -262,7 +266,7 @@
262 DrawContent(graphics_engine, false);266 DrawContent(graphics_engine, false);
263 }267 }
264 }268 }
265269 graphics_engine.PopModelViewMatrix();
266 graphics_engine.PopModelViewMatrix();270 graphics_engine.PopModelViewMatrix();
267 }271 }
268272
@@ -288,13 +292,13 @@
288292
289 Geometry xform_geo;293 Geometry xform_geo;
290 // Compute position in the active fbo texture.294 // Compute position in the active fbo texture.
291 xform_geo = graphics_engine.ModelViewXFormRect(GetGeometry());295 xform_geo = graphics_engine.ModelViewXFormRect(GetNativeGeometry());
292296
293 // Get the active fbo...297 // Get the active fbo...
294 prev_fbo_ = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject();298 prev_fbo_ = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject();
295 // ... and the size of the view port rectangle.299 // ... and the size of the view port rectangle.
296 prev_viewport_ = graphics_engine.GetViewportRect();300 prev_viewport_ = graphics_engine.GetViewportRect();
297 301
298 const int width = GetWidth();302 const int width = GetWidth();
299 const int height = GetHeight();303 const int height = GetHeight();
300304
@@ -388,7 +392,7 @@
388 graphics_engine.SetOrthographicProjectionMatrix(width, height);392 graphics_engine.SetOrthographicProjectionMatrix(width, height);
389 // Transform the geometry of this area through the current model view matrix. This gives the393 // Transform the geometry of this area through the current model view matrix. This gives the
390 // the position of the view in the active fbo texture.394 // the position of the view in the active fbo texture.
391 Geometry offset_rect = graphics_engine.ModelViewXFormRect(GetGeometry());395 Geometry offset_rect = graphics_engine.ModelViewXFormRect(GetNativeGeometry());
392 int x_offset = -offset_rect.x;396 int x_offset = -offset_rect.x;
393 int y_offset = -offset_rect.y;397 int y_offset = -offset_rect.y;
394 graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(x_offset, y_offset, 0));398 graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(x_offset, y_offset, 0));
@@ -727,6 +731,33 @@
727 return true;731 return true;
728 }732 }
729733
734 void View::GatherRedirectedViewForRendering(GraphicsEngine& graphics_engine)
735 {
736 if (IsVisible() && GetRedirectRenderingToTexture() && GetPresentRedirectedView())
737 {
738 if (backup_texture_.IsNull())
739 {
740 // Should not happen
741 return;
742 }
743
744 // Go through the children of this layout and add redirected view for post-rendering composition.
745 if (view_layout_)
746 {
747 view_layout_->GatherRedirectedViewForRendering(graphics_engine);
748 }
749
750 RedirectedArea ra;
751 ra.backup_texture = backup_texture_;
752 ra.geometry = GetAbsoluteGeometry();
753 ra.clipping_region = graphics_engine.GetClippingRegion();
754 ra.area = this;
755
756 // Queue this area for post-rendering composition.
757 GetWindowCompositor().QueueRedirected(ra);
758 }
759 }
760
730#ifdef NUX_GESTURES_SUPPORT761#ifdef NUX_GESTURES_SUPPORT
731 Area* View::GetInputAreaHitByGesture(const nux::GestureEvent &event)762 Area* View::GetInputAreaHitByGesture(const nux::GestureEvent &event)
732 {763 {
733764
=== modified file 'Nux/View.h'
--- Nux/View.h 2012-11-05 21:31:06 +0000
+++ Nux/View.h 2012-12-17 15:42:23 +0000
@@ -164,9 +164,10 @@
164 virtual void ChildViewQueuedDraw(Area* area);164 virtual void ChildViewQueuedDraw(Area* area);
165165
166 void BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);166 void BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
167
168 void EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);167 void EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
169168
169 virtual void GatherRedirectedViewForRendering(GraphicsEngine& graphics_engine);
170
170 void OnChildFocusChanged(/*Area *parent,*/ Area *child);171 void OnChildFocusChanged(/*Area *parent,*/ Area *child);
171 sigc::connection _on_focus_changed_handler;172 sigc::connection _on_focus_changed_handler;
172173
173174
=== modified file 'Nux/WindowCompositor.cpp'
--- Nux/WindowCompositor.cpp 2012-12-08 01:03:38 +0000
+++ Nux/WindowCompositor.cpp 2012-12-17 15:42:23 +0000
@@ -33,6 +33,7 @@
33#endif33#endif
34#include "PaintLayer.h"34#include "PaintLayer.h"
35#include "Painter.h"35#include "Painter.h"
36#include "SceneComposer.h"
36#include "Layout.h"37#include "Layout.h"
3738
38#include "NuxGraphics/FontTexture.h"39#include "NuxGraphics/FontTexture.h"
@@ -43,6 +44,7 @@
43 WindowCompositor::WindowCompositor(WindowThread* window_thread)44 WindowCompositor::WindowCompositor(WindowThread* window_thread)
44 : reference_fbo_(0)45 : reference_fbo_(0)
45 , window_thread_(window_thread)46 , window_thread_(window_thread)
47 , scene_composer_(NULL)
46 {48 {
47 m_OverlayWindow = NULL;49 m_OverlayWindow = NULL;
48 _tooltip_window = NULL;50 _tooltip_window = NULL;
@@ -85,6 +87,9 @@
8587
86 m_MenuRemoved = false;88 m_MenuRemoved = false;
87 m_Background = new ColorLayer(Color(0xFF4D4D4D));89 m_Background = new ColorLayer(Color(0xFF4D4D4D));
90 scene_composer_ = new SceneComposer();
91
92 scene_composer_->SetGraphicsObjects(GetGraphicsDisplay()->GetGraphicsEngine(), GetGraphicsDisplay()->GetGpuDevice());
8893
89#ifdef NUX_GESTURES_SUPPORT94#ifdef NUX_GESTURES_SUPPORT
90 gesture_broker_.reset(new DefaultGestureBroker(this));95 gesture_broker_.reset(new DefaultGestureBroker(this));
@@ -105,11 +110,14 @@
105 _view_window_list.clear();110 _view_window_list.clear();
106 _modal_view_window_list.clear();111 _modal_view_window_list.clear();
107112
113 delete scene_composer_;
114
108#if !defined(NUX_MINIMAL)115#if !defined(NUX_MINIMAL)
109 _menu_chain->clear();116 _menu_chain->clear();
110 delete _menu_chain;
111#endif117#endif
112 delete m_Background;118
119 NUX_SAFE_DELETE(_menu_chain);
120 NUX_SAFE_DELETE(m_Background);
113 }121 }
114122
115 WindowCompositor::RenderTargetTextures& WindowCompositor::GetWindowBuffer(BaseWindow* window)123 WindowCompositor::RenderTargetTextures& WindowCompositor::GetWindowBuffer(BaseWindow* window)
@@ -1348,10 +1356,10 @@
1348 //int w, h;1356 //int w, h;
1349 window_thread_->GetGraphicsEngine().GetContextSize(m_Width, m_Height);1357 window_thread_->GetGraphicsEngine().GetContextSize(m_Width, m_Height);
1350 window_thread_->GetGraphicsEngine().SetViewport(0, 0, m_Width, m_Height);1358 window_thread_->GetGraphicsEngine().SetViewport(0, 0, m_Width, m_Height);
1351 1359
1352 // Reset the Model view Matrix and the projection matrix1360 // Reset the Model view Matrix and the projection matrix
1353 window_thread_->GetGraphicsEngine().ResetProjectionMatrix();1361 window_thread_->GetGraphicsEngine().ResetProjectionMatrix();
1354 1362
1355 window_thread_->GetGraphicsEngine().ResetModelViewMatrixStack();1363 window_thread_->GetGraphicsEngine().ResetModelViewMatrixStack();
1356 window_thread_->GetGraphicsEngine().Push2DTranslationModelViewMatrix(0.0f, 0.0f, 0.0f);1364 window_thread_->GetGraphicsEngine().Push2DTranslationModelViewMatrix(0.0f, 0.0f, 0.0f);
13571365
@@ -1694,8 +1702,14 @@
1694 window_thread_->GetGraphicsEngine().SetViewport(0, 0, window_width, window_height);1702 window_thread_->GetGraphicsEngine().SetViewport(0, 0, window_width, window_height);
1695 window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(window_width, window_height);1703 window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(window_width, window_height);
16961704
1697 PresentBufferToScreen(m_MainColorRT, 0, 0, false);1705 // PresentBufferToScreen(m_MainColorRT, 0, 0, false);
1706 Geometry geo(0, 0, m_MainColorRT->GetWidth(), m_MainColorRT->GetHeight());
1707 window_thread_->GetGraphicsEngine().GetRenderStates().SetBlend(false);
1708 scene_composer_->RenderTexture(m_MainColorRT, geo, geo);
16981709
1710 //writes in the back buffer - it might override the directed textures!! we need to get rid
1711 //of the directed unless if they have different z values when we switch to 3d rendering
1712 RenderRedirected();
1699 }1713 }
17001714
1701 void WindowCompositor::PresentBufferToScreen(ObjectPtr<IOpenGLBaseTexture> HWTexture, int x, int y, bool RenderToMainTexture, bool /* BluredBackground */, float opacity, bool premultiply)1715 void WindowCompositor::PresentBufferToScreen(ObjectPtr<IOpenGLBaseTexture> HWTexture, int x, int y, bool RenderToMainTexture, bool /* BluredBackground */, float opacity, bool premultiply)
@@ -2214,7 +2228,7 @@
2214 nuxDebugMsg("[WindowCompositor::GrabPointerAdd] The area already has the grab");2228 nuxDebugMsg("[WindowCompositor::GrabPointerAdd] The area already has the grab");
2215 return result;2229 return result;
2216 }2230 }
2217 2231
2218 if (window_thread_->GetGraphicsDisplay().PointerGrabData() != this)2232 if (window_thread_->GetGraphicsDisplay().PointerGrabData() != this)
2219 result = window_thread_->GetGraphicsDisplay().GrabPointer(NULL, this, true);2233 result = window_thread_->GetGraphicsDisplay().GrabPointer(NULL, this, true);
22202234
@@ -2240,10 +2254,10 @@
2240 return false;2254 return false;
22412255
2242 pointer_grab_stack_.erase(it);2256 pointer_grab_stack_.erase(it);
2243 2257
2244 if (pointer_grab_stack_.empty())2258 if (pointer_grab_stack_.empty())
2245 window_thread_->GetGraphicsDisplay().UngrabPointer(this);2259 window_thread_->GetGraphicsDisplay().UngrabPointer(this);
2246 2260
2247 // reset the mouse pointers areas.2261 // reset the mouse pointers areas.
2248 ResetMousePointerAreas();2262 ResetMousePointerAreas();
22492263
@@ -2286,7 +2300,7 @@
2286 {2300 {
2287 result = window_thread_->GetGraphicsDisplay().GrabKeyboard(NULL, this, true);2301 result = window_thread_->GetGraphicsDisplay().GrabKeyboard(NULL, this, true);
2288 }2302 }
2289 2303
2290 if (result)2304 if (result)
2291 {2305 {
2292 InputArea* current_keyboard_grab = GetKeyboardGrabArea();2306 InputArea* current_keyboard_grab = GetKeyboardGrabArea();
@@ -2294,7 +2308,7 @@
2294 current_keyboard_grab->end_keyboard_grab.emit(current_keyboard_grab);2308 current_keyboard_grab->end_keyboard_grab.emit(current_keyboard_grab);
22952309
2296 keyboard_grab_stack_.push_front(area);2310 keyboard_grab_stack_.push_front(area);
2297 2311
2298 // If there is any area with the key focus, cancel it.2312 // If there is any area with the key focus, cancel it.
2299 if (key_focus_area_.IsValid())2313 if (key_focus_area_.IsValid())
2300 {2314 {
@@ -2324,7 +2338,7 @@
23242338
2325 area->start_keyboard_grab.emit(area);2339 area->start_keyboard_grab.emit(area);
2326 }2340 }
2327 2341
2328 return result;2342 return result;
2329 }2343 }
23302344
@@ -2342,7 +2356,7 @@
23422356
2343 InputArea* current_keyboard_grab = (*it);2357 InputArea* current_keyboard_grab = (*it);
2344 bool has_grab = false;2358 bool has_grab = false;
2345 2359
2346 if (it == keyboard_grab_stack_.begin())2360 if (it == keyboard_grab_stack_.begin())
2347 {2361 {
2348 // At the top of the keyboard_grab_stack_. Means it has the keyboard grab.2362 // At the top of the keyboard_grab_stack_. Means it has the keyboard grab.
@@ -2384,7 +2398,7 @@
2384 key_focus_area_->key_nav_focus_change.emit(key_focus_area_.GetPointer(), false, KEY_NAV_NONE);2398 key_focus_area_->key_nav_focus_change.emit(key_focus_area_.GetPointer(), false, KEY_NAV_NONE);
2385 // nuxDebugMsg("[WindowCompositor::GrabKeyboardRemove] Area type '%s' named '%s': Lost key nav focus.",2399 // nuxDebugMsg("[WindowCompositor::GrabKeyboardRemove] Area type '%s' named '%s': Lost key nav focus.",
2386 // key_focus_area_->Type().name,2400 // key_focus_area_->Type().name,
2387 // key_focus_area_->GetBaseString().c_str()); 2401 // key_focus_area_->GetBaseString().c_str());
2388 }2402 }
23892403
2390 if (key_focus_area_->Type().IsDerivedFromType(View::StaticObjectType))2404 if (key_focus_area_->Type().IsDerivedFromType(View::StaticObjectType))
@@ -2393,14 +2407,14 @@
2393 }2407 }
2394 key_focus_area_ = NULL;2408 key_focus_area_ = NULL;
2395 }2409 }
2396 2410
2397 it = keyboard_grab_stack_.begin();2411 it = keyboard_grab_stack_.begin();
2398 SetKeyFocusArea(*it);2412 SetKeyFocusArea(*it);
23992413
2400 InputArea* new_keyboard_grab = (*it);2414 InputArea* new_keyboard_grab = (*it);
2401 new_keyboard_grab->start_keyboard_grab.emit(new_keyboard_grab);2415 new_keyboard_grab->start_keyboard_grab.emit(new_keyboard_grab);
2402 }2416 }
2403 2417
2404 return true;2418 return true;
2405 }2419 }
24062420
@@ -2425,6 +2439,45 @@
2425 return (*keyboard_grab_stack_.begin());2439 return (*keyboard_grab_stack_.begin());
2426 }2440 }
24272441
2442/* Redirected */
2443
2444 void WindowCompositor::QueueRedirected(const RedirectedArea &ra)
2445 {
2446 redirected_areas.push_back(ra);
2447 }
2448
2449 void WindowCompositor::RenderRedirected()
2450 {
2451 if (redirected_areas.size() == 0)
2452 {
2453 // Nothing o render
2454 return;
2455 }
2456
2457 for (int i = redirected_areas.size() - 1; i >= 0; --i)
2458 {
2459 //render to the back buffer
2460 scene_composer_->SetDestinationTexture(ObjectPtr<IOpenGLBaseTexture>());
2461 scene_composer_->SetOrthoGraphicProjection();
2462
2463 RedirectedArea ra = redirected_areas[i];
2464
2465 //if (blend)
2466 {
2467 GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
2468 }
2469
2470 scene_composer_->RenderTexture(ra.backup_texture, ra.geometry, ra.clipping_region);
2471
2472 //if (blend)
2473 {
2474 GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetBlend(false);
2475 }
2476 }
2477
2478 redirected_areas.clear();
2479 }
2480
2428 void WindowCompositor::SetReferenceFramebuffer(unsigned int fbo_object, Geometry fbo_geometry)2481 void WindowCompositor::SetReferenceFramebuffer(unsigned int fbo_object, Geometry fbo_geometry)
2429 {2482 {
2430 reference_fbo_ = fbo_object;2483 reference_fbo_ = fbo_object;
24312484
=== modified file 'Nux/WindowCompositor.h'
--- Nux/WindowCompositor.h 2012-11-27 17:18:13 +0000
+++ Nux/WindowCompositor.h 2012-12-17 15:42:23 +0000
@@ -47,6 +47,15 @@
47 class Area;47 class Area;
48 class PaintLayer;48 class PaintLayer;
49 class Event;49 class Event;
50 class SceneComposer;
51
52 struct RedirectedArea
53 {
54 ObjectPtr<IOpenGLBaseTexture> backup_texture;
55 Geometry geometry;
56 Rect clipping_region;
57 Area* area;
58 };
5059
51 //! A user interface composition class created by WindowThread.60 //! A user interface composition class created by WindowThread.
52 class WindowCompositor : public sigc::trackable61 class WindowCompositor : public sigc::trackable
@@ -64,7 +73,7 @@
64 Geometry GetTooltipMainWindowGeometry() const;73 Geometry GetTooltipMainWindowGeometry() const;
6574
66// bool MouseDown(Point pt);75// bool MouseDown(Point pt);
67// 76//
68// bool MouseMove(Point pt);77// bool MouseMove(Point pt);
69// bool MouseUp(Point pt);78// bool MouseUp(Point pt);
7079
@@ -231,8 +240,11 @@
231 sigc::signal<void, Area*> key_nav_focus_activate;240 sigc::signal<void, Area*> key_nav_focus_activate;
232241
233 //====================================242 //====================================
234 243
235 public:244 public:
245 void QueueRedirected(const RedirectedArea &ra);
246 void RenderRedirected();
247
236 /*!248 /*!
237 Set and external fbo to draw Nux BaseWindow into. This external fbo will be249 Set and external fbo to draw Nux BaseWindow into. This external fbo will be
238 restored after Nux completes it rendering. The external fbo is used only in embedded mode. \n250 restored after Nux completes it rendering. The external fbo is used only in embedded mode. \n
@@ -566,6 +578,8 @@
566 private:578 private:
567 WindowThread* window_thread_; //!< The WindowThread to which this object belongs.579 WindowThread* window_thread_; //!< The WindowThread to which this object belongs.
568580
581 SceneComposer* scene_composer_;
582
569#ifdef NUX_GESTURES_SUPPORT583#ifdef NUX_GESTURES_SUPPORT
570 std::unique_ptr<GestureBroker> gesture_broker_;584 std::unique_ptr<GestureBroker> gesture_broker_;
571#endif585#endif
@@ -583,6 +597,8 @@
583 // Declare operator address-of as private597 // Declare operator address-of as private
584 WindowCompositor* operator & ();598 WindowCompositor* operator & ();
585599
600 std::vector<RedirectedArea> redirected_areas;
601
586 friend class InputArea;602 friend class InputArea;
587 friend class WindowThread;603 friend class WindowThread;
588 friend class TimerHandler;604 friend class TimerHandler;
589605
=== modified file 'NuxCore/NuxCore.cpp'
--- NuxCore/NuxCore.cpp 2012-10-10 22:46:50 +0000
+++ NuxCore/NuxCore.cpp 2012-12-17 15:42:23 +0000
@@ -49,8 +49,8 @@
49 unsigned int GetVariableArgs ( TCHAR *Dest, unsigned int /* Size */, unsigned int Count, const TCHAR*& Fmt, va_list ArgPtr)49 unsigned int GetVariableArgs ( TCHAR *Dest, unsigned int /* Size */, unsigned int Count, const TCHAR*& Fmt, va_list ArgPtr)
50#endif50#endif
51 {51 {
52 unsigned int Result = VSNTPRINTF_S (Dest, Size, Count, Fmt, ArgPtr);52 unsigned int Result = VSNTPRINTF_S(Dest, Size, Count, Fmt, ArgPtr);
53 va_end (ArgPtr);53 va_end(ArgPtr);
54 return Result;54 return Result;
55 }55 }
5656
@@ -61,7 +61,7 @@
61#endif61#endif
62 {62 {
63 unsigned int Result = VSNPRINTF_S (Dest, Size, Count, Fmt, ArgPtr);63 unsigned int Result = VSNPRINTF_S (Dest, Size, Count, Fmt, ArgPtr);
64 va_end (ArgPtr);64 va_end(ArgPtr);
65 return Result;65 return Result;
66 }66 }
6767
6868
=== modified file 'NuxGraphics/GLRenderStates.h'
--- NuxGraphics/GLRenderStates.h 2012-10-15 05:05:27 +0000
+++ NuxGraphics/GLRenderStates.h 2012-12-17 15:42:23 +0000
@@ -237,7 +237,7 @@
237 unsigned int& bGreen,237 unsigned int& bGreen,
238 unsigned int& bBlue,238 unsigned int& bBlue,
239 unsigned int& bAlpha);239 unsigned int& bAlpha);
240 240
241 inline void SetDepthMask(unsigned int bDepth = TRUE);241 inline void SetDepthMask(unsigned int bDepth = TRUE);
242242
243 inline void EnableScissor(unsigned int bScissor = FALSE);243 inline void EnableScissor(unsigned int bScissor = FALSE);
244244
=== modified file 'NuxGraphics/GraphicsEngine.cpp'
--- NuxGraphics/GraphicsEngine.cpp 2012-11-28 15:16:41 +0000
+++ NuxGraphics/GraphicsEngine.cpp 2012-12-17 15:42:23 +0000
@@ -1105,7 +1105,7 @@
1105// {1105// {
1106// return Rect(_viewport.x, _viewport.y, _viewport.width, _viewport.height);1106// return Rect(_viewport.x, _viewport.y, _viewport.width, _viewport.height);
1107// }1107// }
1108 1108
1109 Rect GraphicsEngine::GetViewportRect() const1109 Rect GraphicsEngine::GetViewportRect() const
1110 {1110 {
1111 return _viewport;1111 return _viewport;
11121112
=== modified file 'NuxGraphics/RenderingPipeGLSL.cpp'
--- NuxGraphics/RenderingPipeGLSL.cpp 2012-11-12 20:59:56 +0000
+++ NuxGraphics/RenderingPipeGLSL.cpp 2012-12-17 15:42:23 +0000
@@ -36,7 +36,7 @@
36 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();36 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
37 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();37 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
3838
39 const char* VSString = 39 const char* VSString =
40 NUX_VERTEX_SHADER_HEADER40 NUX_VERTEX_SHADER_HEADER
41 "uniform mat4 ViewProjectionMatrix; \n\41 "uniform mat4 ViewProjectionMatrix; \n\
42 attribute vec4 AVertex; \n\42 attribute vec4 AVertex; \n\
@@ -50,7 +50,7 @@
5050
51 VS->SetShaderCode(TCHAR_TO_ANSI(VSString));51 VS->SetShaderCode(TCHAR_TO_ANSI(VSString));
5252
53 const char* PSString = 53 const char* PSString =
54 NUX_FRAGMENT_SHADER_HEADER54 NUX_FRAGMENT_SHADER_HEADER
55 "varying vec4 vColor; \n\55 "varying vec4 vColor; \n\
56 void main() \n\56 void main() \n\
@@ -71,7 +71,7 @@
71 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();71 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
72 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();72 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
7373
74 const char* VSString = 74 const char* VSString =
75 NUX_VERTEX_SHADER_HEADER75 NUX_VERTEX_SHADER_HEADER
76 "attribute vec4 AVertex; \n\76 "attribute vec4 AVertex; \n\
77 attribute vec4 MyTextureCoord0; \n\77 attribute vec4 MyTextureCoord0; \n\
@@ -86,7 +86,7 @@
86 varyVertexColor = VertexColor; \n\86 varyVertexColor = VertexColor; \n\
87 }";87 }";
8888
89 const char* PSString = 89 const char* PSString =
90 NUX_FRAGMENT_SHADER_HEADER90 NUX_FRAGMENT_SHADER_HEADER
91 "varying vec4 varyTexCoord0; \n\91 "varying vec4 varyTexCoord0; \n\
92 varying vec4 varyVertexColor; \n\92 varying vec4 varyVertexColor; \n\
@@ -118,7 +118,7 @@
118 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();118 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
119 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();119 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
120120
121 const char* VSString = 121 const char* VSString =
122 NUX_VERTEX_SHADER_HEADER122 NUX_VERTEX_SHADER_HEADER
123 "attribute vec4 AVertex; \n\123 "attribute vec4 AVertex; \n\
124 attribute vec4 MyTextureCoord0; \n\124 attribute vec4 MyTextureCoord0; \n\
@@ -133,7 +133,7 @@
133 varyVertexColor = VertexColor; \n\133 varyVertexColor = VertexColor; \n\
134 }";134 }";
135135
136 const char* PSString = 136 const char* PSString =
137 NUX_FRAGMENT_SHADER_HEADER137 NUX_FRAGMENT_SHADER_HEADER
138 "varying vec4 varyTexCoord0; \n\138 "varying vec4 varyTexCoord0; \n\
139 varying vec4 varyVertexColor; \n\139 varying vec4 varyVertexColor; \n\
@@ -571,7 +571,7 @@
571 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();571 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
572 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();572 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
573573
574 const char* VSString = 574 const char* VSString =
575 NUX_VERTEX_SHADER_HEADER575 NUX_VERTEX_SHADER_HEADER
576 "uniform mat4 ViewProjectionMatrix; \n\576 "uniform mat4 ViewProjectionMatrix; \n\
577 attribute vec4 AVertex; \n\577 attribute vec4 AVertex; \n\
@@ -587,7 +587,7 @@
587 }";587 }";
588588
589589
590 const char* PSString = 590 const char* PSString =
591 NUX_FRAGMENT_SHADER_HEADER591 NUX_FRAGMENT_SHADER_HEADER
592 "varying vec4 varyTexCoord0; \n\592 "varying vec4 varyTexCoord0; \n\
593 varying vec4 varyVertexColor; \n\593 varying vec4 varyVertexColor; \n\
@@ -635,7 +635,7 @@
635 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();635 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
636 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();636 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
637637
638 const char* VSString = 638 const char* VSString =
639 NUX_VERTEX_SHADER_HEADER639 NUX_VERTEX_SHADER_HEADER
640 "uniform mat4 ViewProjectionMatrix; \n\640 "uniform mat4 ViewProjectionMatrix; \n\
641 attribute vec4 AVertex; \n\641 attribute vec4 AVertex; \n\
@@ -647,7 +647,7 @@
647 gl_Position = ViewProjectionMatrix * (AVertex); \n\647 gl_Position = ViewProjectionMatrix * (AVertex); \n\
648 }";648 }";
649649
650 const char* PSString = 650 const char* PSString =
651 NUX_FRAGMENT_SHADER_HEADER651 NUX_FRAGMENT_SHADER_HEADER
652 "varying vec4 varyTexCoord0; \n\652 "varying vec4 varyTexCoord0; \n\
653 uniform sampler2D TextureObject0; \n\653 uniform sampler2D TextureObject0; \n\

Subscribers

People subscribed via source and target branches