Nux

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

Proposed by Eleni Maria Stea on 2012-12-17
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 on 2013-04-13
Jay Taoko 2012-12-17 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.
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 on 2012-12-13

local merge

716. By Eleni Maria Stea on 2012-11-22

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 on 2012-11-21

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

714. By Eleni Maria Stea on 2012-11-20

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

713. By Eleni Maria Stea on 2012-11-20

text rendering in tabview needs
absolute geometry :->

712. By Eleni Maria Stea on 2012-11-19

reverted the events geometry

711. By Eleni Maria Stea on 2012-11-19

fixed tabview geometry (work in progress)

710. By Eleni Maria Stea on 2012-11-19

fixed groupbox2 layout geometry

709. By Eleni Maria Stea on 2012-11-19

Fixed captions of GroupBox2

708. By Eleni Maria Stea on 2012-11-16

removed comment

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Nux/AbstractCheckedButton.cpp'
2--- Nux/AbstractCheckedButton.cpp 2012-11-05 21:31:06 +0000
3+++ Nux/AbstractCheckedButton.cpp 2012-12-17 15:42:23 +0000
4@@ -28,7 +28,7 @@
5 namespace nux
6 {
7 NUX_IMPLEMENT_OBJECT_TYPE(AbstractCheckedButton);
8-
9+
10 AbstractCheckedButton::AbstractCheckedButton(const std::string &str, bool state, NUX_FILE_LINE_DECL)
11 : AbstractButton(NUX_FILE_LINE_PARAM)
12 {
13@@ -86,7 +86,7 @@
14
15 void AbstractCheckedButton::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
16 {
17- Geometry base = GetGeometry();
18+ Geometry base = GetNativeGeometry();
19 graphics_engine.PushClippingRectangle(base);
20
21 GetPainter().PaintBackground(graphics_engine, base);
22@@ -110,7 +110,7 @@
23
24 GetPainter().PushPaintLayerStack();
25 {
26- GetPainter().PaintCheckBox(graphics_engine, check_area_->GetGeometry(), is, Color(0xff000000));
27+ GetPainter().PaintCheckBox(graphics_engine, check_area_->GetGeometryRelativeTo(this), is, Color(0xff000000));
28 static_text_->ProcessDraw(graphics_engine, true);
29 }
30 GetPainter().PopPaintLayerStack();
31@@ -138,9 +138,9 @@
32
33 {
34 // Check if the text view goes out of the AbstractCheckedButton area.
35- Geometry base = GetGeometry();
36- Geometry text_geo = static_text_->GetGeometry();
37-
38+ Geometry base = GetNativeGeometry();
39+ Geometry text_geo = static_text_->GetGeometryRelativeTo(this);
40+
41 // Intersect the AbstractCheckedButton and the text view
42 Geometry intersection = base.Intersect(text_geo);
43 if (intersection != text_geo)
44
45=== modified file 'Nux/AbstractCheckedButton.h'
46--- Nux/AbstractCheckedButton.h 2011-10-18 20:00:59 +0000
47+++ Nux/AbstractCheckedButton.h 2012-12-17 15:42:23 +0000
48@@ -89,7 +89,7 @@
49 virtual long ComputeContentSize();
50
51 HLayout *hlayout_;
52- InputArea *check_area_;
53+ BasicView *check_area_;
54
55 private:
56 //! Override of Area::SetMinimumHeight and made private.
57
58=== modified file 'Nux/AnimatedTextureArea.cpp'
59--- Nux/AnimatedTextureArea.cpp 2012-10-02 07:32:55 +0000
60+++ Nux/AnimatedTextureArea.cpp 2012-12-17 15:42:23 +0000
61@@ -52,9 +52,9 @@
62 {
63 if (m_UserTexture)
64 {
65- GetPainter().PaintBackground(graphics_engine, GetGeometry());
66+ GetPainter().PaintBackground(graphics_engine, GetNativeGeometry());
67 graphics_engine.GetRenderStates().SetBlend(true, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
68- nux::Geometry base = GetGeometry();
69+ nux::Geometry base = GetNativeGeometry();
70 nux::TexCoordXForm texxform;
71 graphics_engine.QRP_1Tex(base.x, base.y, base.width, base.height, m_UserTexture->GetDeviceTexture(), texxform, nux::color::White);
72
73
74=== modified file 'Nux/Area.cpp'
75--- Nux/Area.cpp 2012-11-12 20:59:56 +0000
76+++ Nux/Area.cpp 2012-12-17 15:42:23 +0000
77@@ -347,6 +347,16 @@
78 return GetY();
79 }
80
81+ int Area::GetNativeX() const
82+ {
83+ return 0;
84+ }
85+
86+ int Area::GetNativeY() const
87+ {
88+ return 0;
89+ }
90+
91 int Area::GetWidth() const
92 {
93 return geometry_.width;
94@@ -409,6 +419,53 @@
95 return geometry_;
96 }
97
98+ Geometry Area::GetNativeGeometry() const
99+ {
100+ return Geometry(0, 0, geometry_.width, geometry_.height);
101+ }
102+
103+ Geometry Area::GetInnerGeometryRelativeTo(Area* area, Geometry& geo) const
104+ {
105+ Area* parent = GetParentObject();
106+ if (parent == area)
107+ {
108+ return geo;
109+ }
110+ else if (parent != NULL)
111+ {
112+ geo.OffsetPosition(parent->GetX(), parent->GetY());
113+ return parent->GetInnerGeometryRelativeTo(area, geo);
114+ }
115+ else
116+ {
117+ //parent is NULL
118+ return Geometry (0, 0, 0, 0);
119+ }
120+ }
121+
122+ Geometry Area::GetGeometryRelativeTo(Area* area) const
123+ {
124+ if (this == area)
125+ return GetNativeGeometry();
126+
127+ Geometry geo = GetGeometry();
128+ Area* parent = GetParentObject();
129+ if (parent == area)
130+ {
131+ return geo;
132+ }
133+ else if (parent != NULL)
134+ {
135+ geo.OffsetPosition(parent->GetX(), parent->GetY());
136+ return parent->GetInnerGeometryRelativeTo(area, geo);
137+ }
138+ else
139+ {
140+ //parent is NULL
141+ return Geometry (0, 0, 0, 0);
142+ }
143+ }
144+
145 void Area::SetX(int x)
146 {
147 SetGeometry(x, geometry_.y, geometry_.width, geometry_.height);
148@@ -756,7 +813,7 @@
149 return _3d_area;
150 }
151
152- static void MatrixXFormGeometry(const Matrix4 &matrix, Geometry &geo)
153+ static void MatrixXFormGeometry(const Matrix4& matrix, Geometry& geo)
154 {
155 Vector4 in(geo.x, geo.y, 0, 1);
156 // This is mean only for translation matrices. It will not work with matrices containing rotations or scalings.
157@@ -765,7 +822,7 @@
158 geo.y = out.y;
159 }
160
161- void Area::InnerGetAbsoluteGeometry(Geometry &geometry)
162+ void Area::InnerGetAbsoluteGeometry(Geometry& geometry)
163 {
164 if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == window_thread_->GetLayout()))
165 {
166@@ -775,9 +832,12 @@
167
168 MatrixXFormGeometry(_2d_xform, geometry);
169
170- Area *parent = GetParentObject();
171+ Area* parent = GetParentObject();
172 if (parent)
173+ {
174+ geometry.OffsetPosition(parent->GetX(), parent->GetY());
175 parent->InnerGetAbsoluteGeometry(geometry);
176+ }
177 }
178
179 Geometry Area::GetAbsoluteGeometry() const
180@@ -798,7 +858,10 @@
181
182 Area *parent = GetParentObject();
183 if (parent)
184+ {
185+ geo.OffsetPosition(parent->GetX(), parent->GetY());
186 parent->InnerGetAbsoluteGeometry(geo);
187+ }
188
189 return geo;
190 }
191@@ -824,16 +887,19 @@
192 return GetAbsoluteGeometry().height;
193 }
194
195- void Area::InnerGetRootGeometry(Geometry &geometry)
196+ void Area::InnerGetRootGeometry(Geometry& geometry)
197 {
198 if (this->Type().IsDerivedFromType(BaseWindow::StaticObjectType) || (this == window_thread_->GetLayout()))
199 return;
200
201 MatrixXFormGeometry(_2d_xform, geometry);
202
203- Area *parent = GetParentObject();
204+ Area* parent = GetParentObject();
205 if (parent)
206+ {
207+ geometry.OffsetPosition(parent->GetX(), parent->GetY());
208 parent->InnerGetRootGeometry(geometry);
209+ }
210 }
211
212 Geometry Area::GetRootGeometry() const
213@@ -847,9 +913,12 @@
214 }
215 else
216 {
217- Area *parent = GetParentObject();
218+ Area* parent = GetParentObject();
219 if (parent)
220+ {
221+ geo.OffsetPosition(parent->GetX(), parent->GetY());
222 parent->InnerGetRootGeometry(geo);
223+ }
224
225 return geo;
226 }
227@@ -922,7 +991,7 @@
228 if (!parent || !parent_area_)
229 return false;
230
231- return parent_area_->IsChildOf(parent);
232+ return parent_area_->IsChildOf(parent);
233 }
234
235 void Area::QueueRelayout()
236@@ -1143,7 +1212,7 @@
237 }
238 }
239
240- bool Area::RedirectRenderingToTexture() const
241+ bool Area::GetRedirectRenderingToTexture() const
242 {
243 return redirect_rendering_to_texture_;
244 }
245@@ -1155,7 +1224,7 @@
246
247 ObjectPtr<IOpenGLBaseTexture> Area::BackupTexture() const
248 {
249- // if RedirectRenderingToTexture() is false, then backup_texture_ is not a valid smart pointer.
250+ // if GetRedirectRenderingToTexture() is false, then backup_texture_ is not a valid smart pointer.
251 return backup_texture_;
252 }
253
254@@ -1170,12 +1239,12 @@
255
256 while (parent)
257 {
258- if (parent->RedirectRenderingToTexture() && (parent->UpdateBackupTextureForChildRendering() == false))
259+ if (parent->GetRedirectRenderingToTexture() && (parent->UpdateBackupTextureForChildRendering() == false))
260 {
261 parent->SetUpdateBackupTextureForChildRendering(true);
262 parent->PrepareParentRedirectedView();
263 }
264- else if (parent->RedirectRenderingToTexture() && (parent->UpdateBackupTextureForChildRendering() == true))
265+ else if (parent->GetRedirectRenderingToTexture() && (parent->UpdateBackupTextureForChildRendering() == true))
266 {
267 break;
268 }
269@@ -1199,7 +1268,7 @@
270 if (parent)
271 {
272 View* view = static_cast<View*>(parent);
273- if (view->RedirectRenderingToTexture())
274+ if (view->GetRedirectRenderingToTexture())
275 {
276 return true;
277 }
278@@ -1217,7 +1286,7 @@
279
280 while (parent)
281 {
282- if (parent->RedirectRenderingToTexture())
283+ if (parent->GetRedirectRenderingToTexture())
284 {
285 return parent;
286 }
287@@ -1237,7 +1306,7 @@
288 present_redirected_view_ = present_redirected_view;
289 }
290
291- bool Area::PresentRedirectedView() const
292+ bool Area::GetPresentRedirectedView() const
293 {
294 return present_redirected_view_;
295 }
296
297=== modified file 'Nux/Area.h'
298--- Nux/Area.h 2012-11-12 20:59:56 +0000
299+++ Nux/Area.h 2012-12-17 15:42:23 +0000
300@@ -162,6 +162,8 @@
301 int GetY() const;
302 int GetWidth() const;
303 int GetHeight() const;
304+ int GetNativeX() const;
305+ int GetNativeY() const;
306
307 void SetX(int x);
308 void SetY(int y);
309@@ -217,6 +219,17 @@
310 */
311 Geometry const& GetGeometry() const;
312
313+ //! Get the native geometry of the object.
314+ /*!
315+ The native geometry of an area is its geometry as if its top left corner where the origine
316+ of the coordinate system. That is, for a native geometry, the value of x and y is 0.
317+ @return The native geometry of the object, with 0 as the value for x and y.
318+ @sa GetBaseWidth(), GetBaseHeight(), GetBaseX(), GetBaseY().
319+ */
320+ Geometry GetNativeGeometry() const;
321+
322+ Geometry GetGeometryRelativeTo(Area* area) const;
323+
324 //! Set the geometry of the object.
325 /*!
326 Set the width, height, and x, y position of the object on the screen.
327@@ -632,6 +645,8 @@
328 //! Return the absolute geometry starting with a relative geometry passed as argument.
329 void InnerGetRootGeometry(Geometry &geometry);
330
331+ Geometry GetInnerGeometryRelativeTo(Area* area, Geometry& geo) const;
332+
333 bool on_geometry_change_reconfigure_parent_layout_;
334
335 //! If this variable is true, then this area has the keyboard focus.
336@@ -666,12 +681,12 @@
337 /*!
338 @return True if the rendering of this view is done in a texture.
339 */
340- virtual bool RedirectRenderingToTexture() const;
341+ virtual bool GetRedirectRenderingToTexture() const;
342
343- //! Return the texture of this View if RedirectRenderingToTexture is enabled.
344+ //! Return the texture of this View if GetRedirectRenderingToTexture is enabled.
345 /*
346- Return the texture of this View if RedirectRenderingToTexture is enabled.
347- If RedirectRenderingToTexture() is false, then backup_texture_ is not a valid smart pointer.
348+ Return the texture of this View if GetRedirectRenderingToTexture is enabled.
349+ If GetRedirectRenderingToTexture() is false, then backup_texture_ is not a valid smart pointer.
350
351 @return the device texture that contains the rendering of this view.
352 */
353@@ -691,7 +706,7 @@
354 /*!
355 @return True if the redirected texture is displayed in the rendering tree.
356 */
357- bool PresentRedirectedView() const;
358+ bool GetPresentRedirectedView() const;
359
360 protected:
361 //! Redirect the rendering of the view to a texture.
362@@ -720,6 +735,11 @@
363 */
364 virtual void PrepareParentRedirectedView();
365
366+ /*!
367+ Gather all redirected views that are child of this, for rendering.
368+ */
369+ virtual void GatherRedirectedViewForRendering(GraphicsEngine& /*graphics_engine*/){};
370+
371 virtual bool HasParentRedirectedView();
372 Area* RedirectedAncestor();
373
374
375=== modified file 'Nux/BaseWindow.cpp'
376--- Nux/BaseWindow.cpp 2012-10-18 10:23:45 +0000
377+++ Nux/BaseWindow.cpp 2012-12-17 15:42:23 +0000
378@@ -112,7 +112,7 @@
379
380 void BaseWindow::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
381 {
382- Geometry base = GetGeometry();
383+ Geometry base = GetNativeGeometry();
384 // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).
385 base.SetX(0);
386 base.SetY(0);
387@@ -127,7 +127,7 @@
388 void BaseWindow::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
389 {
390
391- Geometry base = GetGeometry();
392+ Geometry base = GetNativeGeometry();
393 // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).
394 base.SetX(0);
395 base.SetY(0);
396@@ -162,7 +162,7 @@
397 return false;
398
399 m_layout = layout;
400- Geometry geo = GetGeometry();
401+ Geometry geo = GetNativeGeometry();
402 Geometry layout_geo = Geometry(geo.x + m_Border, geo.y + m_TopBorder,
403 geo.GetWidth() - 2 * m_Border, geo.GetHeight() - m_Border - m_TopBorder);
404 m_layout->SetGeometry(layout_geo);
405@@ -179,7 +179,7 @@
406 // Here we need to position the header by hand because it is not under the control of vlayout.
407 void BaseWindow::PreLayoutManagement()
408 {
409- Geometry geo = GetGeometry();
410+ Geometry geo = GetNativeGeometry();
411
412 if (m_configure_notify_callback)
413 {
414@@ -188,13 +188,13 @@
415 if (geo.IsNull())
416 {
417 nuxDebugMsg("[BaseWindow::PreLayoutManagement] Received an invalid Geometry.");
418- geo = GetGeometry();
419+ geo = GetNativeGeometry();
420 }
421 else
422 {
423 Area::SetGeometry(geo);
424 // Get the geometry adjusted with respect to min and max dimension of this area.
425- geo = GetGeometry();
426+ geo = GetNativeGeometry();
427 }
428 }
429
430@@ -216,10 +216,10 @@
431 {
432 if (IsSizeMatchContent() && m_layout)
433 {
434- Geometry layout_geometry = m_layout->GetGeometry();
435+ Geometry layout_geometry = m_layout->GetNativeGeometry();
436
437- Geometry WindowGeometry = Geometry(GetGeometry().x,
438- GetGeometry().y,
439+ Geometry WindowGeometry = Geometry(GetNativeGeometry().x,
440+ GetNativeGeometry().y,
441 layout_geometry.GetWidth() + 2 * m_Border,
442 layout_geometry.GetHeight() + m_Border + m_TopBorder);
443
444@@ -251,7 +251,7 @@
445 m_input_window = new XInputWindow(title, take_focus, override_redirect);
446
447 m_input_window->Show();
448- m_input_window->SetGeometry(GetGeometry());
449+ m_input_window->SetGeometry(GetNativeGeometry());
450 m_input_window_enabled = true;
451 }
452 else
453@@ -344,7 +344,7 @@
454 {
455 // Define the geometry of some of the component of the window. Otherwise, if the composition layout is not set,
456 // then the component won't be correctly placed after a SetGeometry. This can be redondant if the composition layout is set.
457- Geometry base = GetGeometry();
458+ Geometry base = GetNativeGeometry();
459 }
460
461 void BaseWindow::SetBorder(int border)
462@@ -385,7 +385,7 @@
463 {
464 if (m_layout)
465 {
466- m_layout->SetGeometry(GetGeometry());
467+ m_layout->SetGeometry(GetNativeGeometry());
468 }
469
470 _entering_visible_state = true;
471@@ -430,7 +430,7 @@
472
473 void BaseWindow::NotifyConfigurationChange(int /* Width */, int /* Height */)
474 {
475- Geometry geo = GetGeometry();
476+ Geometry geo = GetNativeGeometry();
477
478 if (m_configure_notify_callback)
479 {
480@@ -439,13 +439,13 @@
481 if (geo.IsNull())
482 {
483 nuxDebugMsg("[BaseWindow::NotifyConfigurationChange] Received an invalid Geometry.");
484- geo = GetGeometry();
485+ geo = GetNativeGeometry();
486 }
487 else
488 {
489 Area::SetGeometry(geo);
490 // Get the geometry adjusted with respect to min and max dimension of this area.
491- geo = GetGeometry();
492+ geo = GetNativeGeometry();
493 }
494 }
495 else
496
497=== modified file 'Nux/BasicView.h'
498--- Nux/BasicView.h 2012-11-05 21:31:06 +0000
499+++ Nux/BasicView.h 2012-12-17 15:42:23 +0000
500@@ -32,7 +32,7 @@
501 BasicView(NUX_FILE_LINE_PROTO);
502 ~BasicView();
503
504-
505+
506 protected:
507 void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw);
508 };
509
510=== modified file 'Nux/Button.cpp'
511--- Nux/Button.cpp 2012-11-05 21:31:06 +0000
512+++ Nux/Button.cpp 2012-12-17 15:42:23 +0000
513@@ -75,7 +75,7 @@
514 item_order_ = IMAGE_FIRST;
515 distribution_ = CENTER_OF_LAYOUT;
516 space_between_items_ = 0;
517-
518+
519 layout_top_padding_ = 2;
520 layout_right_padding_ = 2;
521 layout_bottom_padding_ = 2;
522@@ -341,7 +341,7 @@
523
524 void Button::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
525 {
526- Geometry base = GetGeometry();
527+ Geometry base = GetNativeGeometry();
528
529 graphics_engine.PushClippingRectangle(base);
530
531@@ -367,7 +367,37 @@
532 rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
533
534 GetPainter().PushDrawSliceScaledTextureLayer(graphics_engine, base, ref_style, color::White, eAllCorners, true, rop);
535-
536+ GetPainter().PopPaintLayer();
537+
538+ graphics_engine.PopClippingRectangle();
539+ }
540+
541+ void Button::DrawContent(GraphicsEngine& graphics_engine, bool force_draw)
542+ {
543+ Geometry base = GetNativeGeometry();
544+
545+ UXStyleImageRef ref_style = eIMAGE_STYLE_NONE;
546+
547+ if (visual_state_ == VISUAL_STATE_PRESSED)
548+ {
549+ ref_style = eBUTTON_FOCUS;
550+ }
551+ else if (visual_state_ == VISUAL_STATE_PRELIGHT)
552+ {
553+ ref_style = eBUTTON_PRELIGHT;
554+ }
555+ else
556+ {
557+ ref_style = eBUTTON_NORMAL;
558+ }
559+
560+ TexCoordXForm texxform;
561+ ROPConfig rop;
562+ rop.Blend = true;
563+ rop.SrcBlend = GL_ONE;
564+ rop.DstBlend = GL_ONE_MINUS_SRC_ALPHA;
565+
566+ GetPainter().PushSliceScaledTextureLayer(graphics_engine, base, ref_style, color::White, eAllCorners, true, rop);
567 if (GetCompositionLayout())
568 {
569 GetPainter().PushPaintLayerStack();
570@@ -378,14 +408,13 @@
571
572 graphics_engine.PushClippingRectangle(clip_geo);
573
574- GetCompositionLayout()->ProcessDraw(graphics_engine, true);
575+ GetCompositionLayout()->ProcessDraw(graphics_engine, force_draw);
576
577 graphics_engine.PopClippingRectangle();
578 }
579 GetPainter().PopPaintLayerStack();
580 }
581 GetPainter().PopPaintLayer();
582- graphics_engine.PopClippingRectangle();
583 }
584
585 long Button::ComputeContentSize()
586
587=== modified file 'Nux/Button.h'
588--- Nux/Button.h 2011-10-22 06:17:42 +0000
589+++ Nux/Button.h 2012-12-17 15:42:23 +0000
590@@ -19,7 +19,6 @@
591 *
592 */
593
594-
595 #ifndef BUTTON_H
596 #define BUTTON_H
597 #include "AbstractButton.h"
598@@ -72,9 +71,9 @@
599 SPREAD_OVER_LAYOUT,
600 };
601
602- Button(TextureArea *image, NUX_FILE_LINE_PROTO);
603+ Button(TextureArea* image, NUX_FILE_LINE_PROTO);
604 Button(const std::string& button_label, NUX_FILE_LINE_PROTO);
605- Button(const std::string& button_label, TextureArea *image, NUX_FILE_LINE_PROTO);
606+ Button(const std::string& button_label, TextureArea* image, NUX_FILE_LINE_PROTO);
607 Button(NUX_FILE_LINE_PROTO);
608 virtual ~Button();
609
610@@ -95,7 +94,7 @@
611
612 @param label The label of the Button.
613 */
614- void SetLabel(const std::string &button_label);
615+ void SetLabel(const std::string& button_label);
616
617 //!Return the label of this Button.
618 /*!
619@@ -115,7 +114,7 @@
620
621 @param A TextureArea.
622 */
623- void SetImage(TextureArea *image);
624+ void SetImage(TextureArea* image);
625
626 //! Get the image.
627 /*!
628@@ -243,17 +242,19 @@
629 int top_clip_;
630 int bottom_clip_;
631
632- bool SetLabelProperty(std::string &value, std::string const &str);
633-
634- void Initialize(const std::string &str, TextureArea* texture_area);
635-
636- void BuildLayout(const std::string &str, TextureArea* texture_area);
637+ bool SetLabelProperty(std::string& value, std::string const& str);
638+
639+ void Initialize(const std::string& str, TextureArea* texture_area);
640+
641+ void BuildLayout(const std::string& str, TextureArea* texture_area);
642
643 TextureArea *image_;
644 Size image_minimum_size_;
645 Size image_maximum_size_;
646
647- virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw);
648+ virtual void Draw(GraphicsEngine& graphics_engine, bool force_draw);
649+ virtual void DrawContent(GraphicsEngine& graphics_engine, bool force_draw);
650+
651 virtual void RecvClick(int x, int y, unsigned long button_flags, unsigned long key_flags);
652 // virtual void PreLayoutManagement();
653 // virtual long PostLayoutManagement(long LayoutResult);
654
655=== modified file 'Nux/CheckBox.cpp'
656--- Nux/CheckBox.cpp 2012-11-05 21:31:06 +0000
657+++ Nux/CheckBox.cpp 2012-12-17 15:42:23 +0000
658@@ -28,9 +28,9 @@
659 namespace nux
660 {
661 NUX_IMPLEMENT_OBJECT_TYPE(CheckBox);
662-
663+
664 CheckBox::CheckBox(const std::string &str, bool state, NUX_FILE_LINE_DECL)
665- : AbstractCheckedButton(str, state, NUX_FILE_LINE_PARAM)
666+ : AbstractCheckedButton(str, state, NUX_FILE_LINE_PARAM)
667 {
668 }
669
670@@ -38,9 +38,9 @@
671 {
672 }
673
674- void CheckBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
675+ void CheckBox::Draw(GraphicsEngine& graphics_engine, bool /* force_draw */)
676 {
677- Geometry base = GetGeometry();
678+ Geometry base = GetNativeGeometry();
679 graphics_engine.PushClippingRectangle(base);
680
681 InteractState is;
682@@ -62,7 +62,7 @@
683
684 GetPainter().PushPaintLayerStack();
685 {
686- GetPainter().PaintCheckBox(graphics_engine, check_area_->GetGeometry(), is, Color(0xff000000));
687+ GetPainter().PaintCheckBox(graphics_engine, check_area_->GetGeometryRelativeTo(this), is, Color(0xff000000));
688 static_text_->ProcessDraw(graphics_engine, true);
689 }
690 GetPainter().PopPaintLayerStack();
691
692=== modified file 'Nux/ColorEditor.cpp'
693--- Nux/ColorEditor.cpp 2012-11-05 21:31:06 +0000
694+++ Nux/ColorEditor.cpp 2012-12-17 15:42:23 +0000
695@@ -207,10 +207,10 @@
696 m_Validator.SetMaximum(1.0);
697 m_Validator.SetDecimals(2);
698
699- picker_area_ = new BasicView(NUX_TRACKER_LOCATION);
700- channel_area_ = new BasicView(NUX_TRACKER_LOCATION);
701- selected_color_area_ = new BasicView(NUX_TRACKER_LOCATION);
702- m_hlayout = new HLayout(NUX_TRACKER_LOCATION);
703+ picker_area_ = new BasicView(NUX_TRACKER_LOCATION);
704+ channel_area_ = new BasicView(NUX_TRACKER_LOCATION);
705+ selected_color_area_ = new BasicView(NUX_TRACKER_LOCATION);
706+ m_hlayout = new HLayout(NUX_TRACKER_LOCATION);
707
708 channel_area_->mouse_down.connect(sigc::mem_fun(this, &ColorEditor::RecvMouseDown));
709 channel_area_->mouse_up.connect(sigc::mem_fun(this, &ColorEditor::RecvMouseUp));
710@@ -365,14 +365,23 @@
711
712 void ColorEditor::Draw(GraphicsEngine &graphics_engine, bool force_draw)
713 {
714- Geometry base = GetGeometry();
715-
716- base.OffsetPosition(1, 1);
717- base.OffsetSize(-2, -2);
718+ Geometry base = GetNativeGeometry();
719
720 graphics_engine.PushClippingRectangle(base);
721 GetPainter().PushDrawShapeLayer(graphics_engine, base, eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true);
722
723+ GetPainter().PopBackground();
724+ graphics_engine.PopClippingRectangle();
725+ }
726+
727+ void ColorEditor::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
728+ {
729+ Geometry base = GetNativeGeometry();
730+ GetPainter().PushShapeLayer(graphics_engine, base, eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true);
731+
732+ bool force = force_draw || IsFullRedraw();
733+
734+ GetLayout()->ProcessDraw(graphics_engine, force);
735 if (m_ColorModel == color::RGB)
736 {
737 DrawRGB(graphics_engine, force_draw);
738@@ -381,31 +390,6 @@
739 {
740 DrawHSV(graphics_engine, force_draw);
741 }
742-
743- GetPainter().PopBackground();
744- graphics_engine.PopClippingRectangle();
745- }
746-
747- void ColorEditor::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
748- {
749- Geometry base = GetGeometry();
750- GetPainter().PushShapeLayer(graphics_engine, base, eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true);
751-
752- bool force = force_draw || IsFullRedraw();
753- redcheck->ProcessDraw(graphics_engine, force);
754- redtext->ProcessDraw(graphics_engine, force);
755- greencheck->ProcessDraw(graphics_engine, force);
756- greentext->ProcessDraw(graphics_engine, force);
757- bluecheck->ProcessDraw(graphics_engine, force);
758- bluetext->ProcessDraw(graphics_engine, force);
759-
760- huecheck->ProcessDraw(graphics_engine, force);
761- hue_text_entry_->ProcessDraw(graphics_engine, force);
762- saturationcheck->ProcessDraw(graphics_engine, force);
763- saturation_text_entry_->ProcessDraw(graphics_engine, force);
764- valuecheck->ProcessDraw(graphics_engine, force);
765- value_text_entry_->ProcessDraw(graphics_engine, force);
766-
767 GetPainter().PopBackground();
768 }
769
770@@ -415,10 +399,12 @@
771 int marker_position_x;
772 int marker_position_y;
773
774- graphics_engine.PushClippingRectangle(channel_area_->GetGeometry());
775-
776- marker_position_x = channel_area_->GetBaseX();
777- marker_position_y = channel_area_->GetBaseY() + m_VertMarkerPosition.y;
778+ Geometry cgeo = channel_area_->GetGeometryRelativeTo(this);
779+
780+ graphics_engine.PushClippingRectangle(cgeo);
781+
782+ marker_position_x = cgeo.x;
783+ marker_position_y = cgeo.y + m_VertMarkerPosition.y;
784 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x, marker_position_y - 5,
785 marker_position_x + 5, marker_position_y,
786 marker_position_x, marker_position_y + 5, Color(0.0f, 0.0f, 0.0f, 1.0f));
787@@ -427,8 +413,8 @@
788 marker_position_x + 4, marker_position_y,
789 marker_position_x, marker_position_y + 4, Color(0.7f, 0.7f, 0.7f, 1.0f));
790
791- marker_position_x = channel_area_->GetBaseX() + channel_area_->GetBaseWidth();
792- marker_position_y = channel_area_->GetBaseY() + m_VertMarkerPosition.y;
793+ marker_position_x = cgeo.x + cgeo.width;
794+ marker_position_y = cgeo.y + m_VertMarkerPosition.y;
795 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x, marker_position_y - 5,
796 marker_position_x - 5, marker_position_y,
797 marker_position_x, marker_position_y + 5, Color(0.0f, 0.0f, 0.0f, 1.0f));
798@@ -443,58 +429,66 @@
799 {
800 if (m_ColorModel == color::RGB)
801 {
802- GetPainter().Paint2DQuadColor(graphics_engine, selected_color_area_->GetGeometry(), Color(rgb_));
803+ GetPainter().Paint2DQuadColor(graphics_engine, selected_color_area_->GetGeometryRelativeTo(this), Color(rgb_));
804 Color BaseChannelTop;
805 Color BaseChannelBottom;
806
807+ Geometry pgeo = picker_area_->GetGeometryRelativeTo(this);
808+ Geometry ageo = picker_area_->GetAbsoluteGeometry();
809+
810 if (color_channel_ == color::RED)
811 {
812 m_RedShader->SetColor(rgb_.red, rgb_.green, rgb_.blue, 1.0f);
813- m_RedShader->SetScreenPositionOffset(graphics_engine.GetViewportX(), graphics_engine.GetViewportY());
814+ m_RedShader->SetScreenPositionOffset(graphics_engine.GetViewportX() + ageo.x,
815+ graphics_engine.GetViewportY() + ageo.y);
816 BaseChannelTop = Color(1.0f, rgb_.green, rgb_.blue, 1.0f);
817 BaseChannelBottom = Color(0.0f, rgb_.green, rgb_.blue, 1.0f);
818 m_RedShader->Render(
819- picker_area_->GetBaseX(),
820- picker_area_->GetBaseY(),
821+ pgeo.x,
822+ pgeo.y + graphics_engine.GetViewportY(),
823 0,
824- picker_area_->GetBaseWidth(),
825- picker_area_->GetBaseHeight(),
826+ pgeo.width,
827+ pgeo.height,
828 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()
829 );
830 }
831 else if (color_channel_ == color::GREEN)
832 {
833 m_GreenShader->SetColor(rgb_.red, rgb_.green, rgb_.blue, 1.0f);
834- m_GreenShader->SetScreenPositionOffset(graphics_engine.GetViewportX(), graphics_engine.GetViewportY());
835+ m_GreenShader->SetScreenPositionOffset(graphics_engine.GetViewportX() + ageo.x,
836+ graphics_engine.GetViewportY() + ageo.y);
837 BaseChannelTop = Color(rgb_.red, 1.0f, rgb_.blue, 1.0f);
838 BaseChannelBottom = Color(rgb_.red, 0.0f, rgb_.blue, 1.0f);
839 m_GreenShader->Render(
840- picker_area_->GetBaseX(),
841- picker_area_->GetBaseY(),
842+ pgeo.x,
843+ pgeo.y,
844 0,
845- picker_area_->GetBaseWidth(),
846- picker_area_->GetBaseHeight(),
847+ pgeo.width,
848+ pgeo.height,
849 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()
850 );
851 }
852 else if (color_channel_ == color::BLUE)
853 {
854 m_BlueShader->SetColor(rgb_.red, rgb_.green, rgb_.blue, 1.0f);
855- m_BlueShader->SetScreenPositionOffset(graphics_engine.GetViewportX(), graphics_engine.GetViewportY());
856+ m_BlueShader->SetScreenPositionOffset(graphics_engine.GetViewportX() + ageo.x,
857+ graphics_engine.GetViewportY() + ageo.y);
858 BaseChannelTop = Color(rgb_.red, rgb_.green, 1.0f, 1.0f);
859 BaseChannelBottom = Color(rgb_.red, rgb_.green, 0.0f, 1.0f);
860 m_BlueShader->Render(
861- picker_area_->GetBaseX(),
862- picker_area_->GetBaseY(),
863+ pgeo.x,
864+ pgeo.y,
865 0,
866- picker_area_->GetBaseWidth(),
867- picker_area_->GetBaseHeight(),
868+ pgeo.width,
869+ pgeo.height,
870 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()
871 );
872 }
873
874- Geometry pickermarker = Geometry(GetBaseX() + m_MarkerPosition.x - 2, GetBaseY() + m_MarkerPosition.y - 2, 5, 5);
875- Geometry basepickermarker = Geometry(channel_area_->GetBaseX(), channel_area_->GetBaseY() + m_VertMarkerPosition.y, 5, 5);
876+ Geometry cgeo = channel_area_->GetGeometryRelativeTo(this);
877+
878+ Geometry pickermarker = Geometry(GetNativeX() + m_MarkerPosition.x - 2, GetNativeY() + m_MarkerPosition.y - 2, 5, 5);
879+ Geometry basepickermarker = Geometry(cgeo.x, cgeo.y + m_VertMarkerPosition.y, 5, 5);
880
881 Color color(rgb_.red, rgb_.green, rgb_.blue);
882 float luma = color::LumaRed * rgb_.red + color::LumaGreen * rgb_.green + color::LumaBlue * rgb_.blue;
883@@ -502,7 +496,7 @@
884
885 GetPainter().Paint2DQuadWireframe(graphics_engine, pickermarker, one_minus_luma);
886
887- GetPainter().Paint2DQuadColor(graphics_engine, channel_area_->GetGeometry(), BaseChannelTop, BaseChannelBottom, BaseChannelBottom, BaseChannelTop);
888+ GetPainter().Paint2DQuadColor(graphics_engine, cgeo, BaseChannelTop, BaseChannelBottom, BaseChannelBottom, BaseChannelTop);
889 // Draw Marker on Base Chanel Area
890 DrawBaseChannelMarker(graphics_engine);
891 }
892@@ -513,31 +507,38 @@
893 if (m_ColorModel == color::HSV)
894 {
895 color::RedGreenBlue rgb(hsv_);
896- GetPainter().Paint2DQuadColor(graphics_engine, selected_color_area_->GetGeometry(), Color(rgb));
897+ GetPainter().Paint2DQuadColor(graphics_engine, selected_color_area_->GetGeometryRelativeTo(this), Color(rgb_));
898
899 Color BaseChannelTop;
900 Color BaseChannelBottom;
901
902+ Geometry pgeo = picker_area_->GetGeometryRelativeTo(this);
903+ Geometry ageo = picker_area_->GetAbsoluteGeometry();
904+
905+ Geometry cgeo = channel_area_->GetGeometryRelativeTo(this);
906+
907 if (color_channel_ == color::HUE)
908 {
909+
910 m_HueShader->SetColor(hsv_.hue, hsv_.saturation, hsv_.value, 1.0f);
911- m_HueShader->SetScreenPositionOffset(graphics_engine.GetViewportX(), graphics_engine.GetViewportY());
912+ m_HueShader->SetScreenPositionOffset(graphics_engine.GetViewportX() + ageo.x,
913+ graphics_engine.GetViewportY() + ageo.y);
914 m_HueShader->Render(
915- picker_area_->GetBaseX(),
916- picker_area_->GetBaseY(),
917+ pgeo.x,
918+ pgeo.y,
919 0,
920- picker_area_->GetBaseWidth(),
921- picker_area_->GetBaseHeight(),
922+ pgeo.width,
923+ pgeo.height,
924 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()
925 );
926
927- Geometry P = channel_area_->GetGeometry();
928+ Geometry P = channel_area_->GetGeometryRelativeTo(this);
929
930 float s = 1.0f - 1.0f;
931 float v = 1.0f;
932 float fw = P.GetHeight() / 6;
933
934- Geometry p = Geometry(P.x, P.y, P.GetWidth(), fw);
935+ Geometry p = Geometry(P.x, P.y, P.width, fw);
936 GetPainter().Paint2DQuadVGradient(graphics_engine, p, Color(1.0f * v, s * v, s * v), Color(1.0f * v, s * v, 1.0f * v));
937 p.SetY(P.y + fw);
938 GetPainter().Paint2DQuadVGradient(graphics_engine, p, Color(1.0f * v, s * v, 1.0f * v), Color(s * v, s * v, 1.0f * v));
939@@ -551,7 +552,7 @@
940 p.SetHeight(P.GetHeight() - 5 * fw); // correct rounding errors
941 GetPainter().Paint2DQuadVGradient(graphics_engine, p, Color(1.0f * v, 1.0f * v, s * v), Color(1.0f * v, s * v, s * v));
942
943- Geometry pickermarker = Geometry(GetBaseX() + m_MarkerPosition.x - 2, GetBaseY() + m_MarkerPosition.y - 2, 5, 5);
944+ Geometry pickermarker = Geometry(GetNativeX() + m_MarkerPosition.x - 2, GetNativeY() + m_MarkerPosition.y - 2, 5, 5);
945
946 float luma = color::LumaRed * rgb_.red + color::LumaGreen * rgb_.green + color::LumaBlue * rgb_.blue;
947 Color one_minus_luma(1.0f - luma, 1.0f - luma, 1.0f - luma);
948@@ -563,50 +564,56 @@
949 if (value < 0.3f) value = 0.3f;
950
951 m_SaturationShader->SetColor(hsv_.hue, hsv_.saturation, hsv_.value, 1.0f);
952- m_SaturationShader->SetScreenPositionOffset(graphics_engine.GetViewportX(), graphics_engine.GetViewportY());
953+ m_SaturationShader->SetScreenPositionOffset(graphics_engine.GetViewportX() + ageo.x,
954+ graphics_engine.GetViewportY() + ageo.y);
955 BaseChannelTop = Color(color::RedGreenBlue(color::HueSaturationValue(hsv_.hue, 1.0f, value)));
956 BaseChannelBottom = Color(value, value, value, 1.0f);
957 m_SaturationShader->Render(
958- picker_area_->GetBaseX(),
959- picker_area_->GetBaseY(),
960+ pgeo.x,
961+ pgeo.y,
962 0,
963- picker_area_->GetBaseWidth(),
964- picker_area_->GetBaseHeight(),
965+ pgeo.width,
966+ pgeo.height,
967 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()
968 );
969
970 //Geometry pickermarker = Geometry(GetX() + x - 2, GetY() + y -2, 5, 5);
971- Geometry pickermarker = Geometry(GetBaseX() + m_MarkerPosition.x - 2, GetBaseY() + m_MarkerPosition.y - 2, 5, 5);
972+ Geometry pickermarker = Geometry(GetNativeX() + m_MarkerPosition.x - 2, GetNativeY() + m_MarkerPosition.y - 2, 5, 5);
973
974 float luma = color::LumaRed * rgb_.red + color::LumaGreen * rgb_.green + color::LumaBlue * rgb_.blue;
975 Color one_minus_luma(1.0f - luma, 1.0f - luma, 1.0f - luma);
976
977 GetPainter().Paint2DQuadWireframe(graphics_engine, pickermarker, one_minus_luma);
978- GetPainter().Paint2DQuadColor(graphics_engine, channel_area_->GetGeometry(), BaseChannelTop, BaseChannelBottom, BaseChannelBottom, BaseChannelTop);
979+ GetPainter().Paint2DQuadColor(graphics_engine,
980+ cgeo,
981+ BaseChannelTop, BaseChannelBottom, BaseChannelBottom, BaseChannelTop);
982 }
983 else if (color_channel_ == color::VALUE)
984 {
985 m_ValueShader->SetColor(hsv_.hue, hsv_.saturation, hsv_.value, 1.0f);
986- m_ValueShader->SetScreenPositionOffset(graphics_engine.GetViewportX(), graphics_engine.GetViewportY());
987+ m_ValueShader->SetScreenPositionOffset(graphics_engine.GetViewportX() + ageo.x,
988+ graphics_engine.GetViewportY() + ageo.y);
989 BaseChannelTop = Color(color::RedGreenBlue(color::HueSaturationValue(hsv_.hue, hsv_.saturation, 1.0f)));
990 BaseChannelBottom = Color(color::RedGreenBlue(color::HueSaturationValue(hsv_.hue, hsv_.saturation, 0.0f)));
991 m_ValueShader->Render(
992- picker_area_->GetBaseX(),
993- picker_area_->GetBaseY(),
994+ pgeo.x,
995+ pgeo.y,
996 0,
997- picker_area_->GetBaseWidth(),
998- picker_area_->GetBaseHeight(),
999+ pgeo.width,
1000+ pgeo.height,
1001 graphics_engine.GetViewportWidth(), graphics_engine.GetViewportHeight()
1002 );
1003
1004 //Geometry pickermarker = Geometry(GetX() + x - 2, GetY() + y -2, 5, 5);
1005- Geometry pickermarker = Geometry(GetBaseX() + m_MarkerPosition.x - 2, GetBaseY() + m_MarkerPosition.y - 2, 5, 5);
1006+ Geometry pickermarker = Geometry(GetNativeX() + m_MarkerPosition.x - 2, GetNativeY() + m_MarkerPosition.y - 2, 5, 5);
1007
1008 float luma = color::LumaRed * rgb_.red + color::LumaGreen * rgb_.green + color::LumaBlue * rgb_.blue;
1009 Color one_minus_luma(1.0f - luma, 1.0f - luma, 1.0f - luma);
1010
1011 GetPainter().Paint2DQuadWireframe(graphics_engine, pickermarker, one_minus_luma);
1012- GetPainter().Paint2DQuadColor(graphics_engine, channel_area_->GetGeometry(), BaseChannelTop, BaseChannelBottom, BaseChannelBottom, BaseChannelTop);
1013+ GetPainter().Paint2DQuadColor(graphics_engine,
1014+ cgeo,
1015+ BaseChannelTop, BaseChannelBottom, BaseChannelBottom, BaseChannelTop);
1016 }
1017
1018 // Draw Marker on Base Chanel Area
1019@@ -1009,7 +1016,7 @@
1020 color_channel_ = colorchannel;
1021 RecvCheckColorModel(true, m_ColorModel, color_channel_);
1022
1023- /*FIXME - disabled because we lost radiogroup
1024+ /*FIXME - disabled because we lost radiogroup
1025 if (color_channel_ == color::RED)
1026 radiogroup->ActivateButton(redcheck);
1027 else if (color_channel_ == color::GREEN)
1028
1029=== modified file 'Nux/ColorEditor.h'
1030--- Nux/ColorEditor.h 2011-10-18 20:00:59 +0000
1031+++ Nux/ColorEditor.h 2012-12-17 15:42:23 +0000
1032@@ -154,9 +154,9 @@
1033
1034 color::Channel color_channel_;
1035 color::Model m_ColorModel;
1036- InputArea *picker_area_;
1037- InputArea *channel_area_;
1038- InputArea *selected_color_area_;
1039+ BasicView *picker_area_;
1040+ BasicView *channel_area_;
1041+ BasicView *selected_color_area_;
1042 HLayout *m_hlayout;
1043 VLayout *ctrllayout;
1044
1045
1046=== modified file 'Nux/ColorPreview.cpp'
1047--- Nux/ColorPreview.cpp 2012-11-05 21:31:06 +0000
1048+++ Nux/ColorPreview.cpp 2012-12-17 15:42:23 +0000
1049@@ -84,10 +84,10 @@
1050
1051 void ColorPreview::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
1052 {
1053- Geometry base = GetGeometry();
1054+ Geometry base = GetNativeGeometry();
1055
1056 GetPainter().PaintBackground(graphics_engine, base);
1057- GetPainter().PaintShape(graphics_engine, m_ColorArea->GetGeometry(), m_Color, eSHAPE_CORNER_ROUND4, false);
1058+ GetPainter().PaintShape(graphics_engine, m_ColorArea->GetGeometryRelativeTo(this), m_Color, eSHAPE_CORNER_ROUND4, false);
1059 //GetPainter().Paint2DQuadWireFrameColor(graphics_engine, base, Color(COLOR_BACKGROUND_SECONDARY));
1060 m_ColorValue->QueueDraw();
1061 }
1062@@ -138,5 +138,4 @@
1063 {
1064 m_Color = color;
1065 }
1066-
1067 }
1068
1069=== modified file 'Nux/ColorPreview.h'
1070--- Nux/ColorPreview.h 2012-10-02 07:32:55 +0000
1071+++ Nux/ColorPreview.h 2012-12-17 15:42:23 +0000
1072@@ -59,7 +59,7 @@
1073
1074 Color m_Color;
1075 HLayout *m_hlayout;
1076- InputArea *m_ColorArea;
1077+ BasicView *m_ColorArea;
1078 StaticTextBox *m_ColorValue;
1079 ColorDialogProxy *m_DialogThreadProxy;
1080 };
1081
1082=== modified file 'Nux/EditTextBox.cpp'
1083--- Nux/EditTextBox.cpp 2012-11-05 21:31:06 +0000
1084+++ Nux/EditTextBox.cpp 2012-12-17 15:42:23 +0000
1085@@ -93,7 +93,7 @@
1086
1087 void EditTextBox::ScrollTimerInterrupt(void * /* v */)
1088 {
1089- Geometry base = GetGeometry();
1090+ Geometry base = GetNativeGeometry();
1091 const Event& event = GetGraphicsDisplay()->GetCurrentEvent();
1092
1093 int X = event.x;
1094@@ -149,7 +149,7 @@
1095
1096 void EditTextBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
1097 {
1098- Geometry base = GetGeometry();
1099+ Geometry base = GetNativeGeometry();
1100
1101 {
1102 graphics_engine.PushClippingRectangle(base);
1103@@ -159,7 +159,7 @@
1104 if (HasKeyboardFocus())
1105 {
1106
1107- GetPainter().PaintColorTextLineEdit(graphics_engine, GetGeometry(),
1108+ GetPainter().PaintColorTextLineEdit(graphics_engine, GetNativeGeometry(),
1109 m_KeyboardHandler.GetTextLine(),
1110 GetTextColor(),
1111 m_WriteAlpha,
1112@@ -176,7 +176,7 @@
1113 }
1114 else
1115 {
1116- GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetGeometry(),
1117+ GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetNativeGeometry(),
1118 m_KeyboardHandler.GetTextLine(),
1119 GetTextColor());
1120 }
1121@@ -285,7 +285,7 @@
1122
1123 void EditTextBox::RecvMouseDrag(int x, int y, int /* dx */, int /* dy */, unsigned long /* button_flags */, unsigned long /* key_flags */)
1124 {
1125- Geometry base = GetGeometry();
1126+ Geometry base = GetNativeGeometry();
1127
1128 int X = x + base.x;
1129
1130@@ -309,7 +309,7 @@
1131 {
1132 long ret = View::PostLayoutManagement(LayoutResult);
1133
1134- m_KeyboardHandler.SetClipRegion(GetGeometry());
1135+ m_KeyboardHandler.SetClipRegion(GetNativeGeometry());
1136 return ret;
1137 }
1138
1139@@ -325,7 +325,7 @@
1140 if (eventType == NUX_KEYDOWN)
1141 text_input_mode_ = true;
1142
1143- m_KeyboardHandler.ProcessKey(eventType, keysym, state, character[0], GetGeometry());
1144+ m_KeyboardHandler.ProcessKey(eventType, keysym, state, character[0], GetNativeGeometry());
1145
1146
1147 // When a key event happens, show the cursor.
1148
1149=== modified file 'Nux/FileSelector.cpp'
1150--- Nux/FileSelector.cpp 2012-10-10 22:46:50 +0000
1151+++ Nux/FileSelector.cpp 2012-12-17 15:42:23 +0000
1152@@ -65,25 +65,25 @@
1153
1154 void FileSelector::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
1155 {
1156- Geometry base = GetGeometry();
1157+ Geometry base = GetNativeGeometry();
1158
1159 GetPainter().PaintBackground(graphics_engine, base);
1160
1161 if (m_OpenButton->IsMouseInside())
1162 {
1163
1164- GetPainter().PaintShapeCorner(graphics_engine, m_OpenButton->GetGeometry(), FILESELECTOR_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
1165+ GetPainter().PaintShapeCorner(graphics_engine, m_OpenButton->GetNativeGeometry(), FILESELECTOR_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
1166 eCornerTopRight | eCornerBottomRight, false);
1167 }
1168 else
1169 {
1170- GetPainter().PaintShapeCorner(graphics_engine, m_OpenButton->GetGeometry(), FILESELECTOR_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
1171+ GetPainter().PaintShapeCorner(graphics_engine, m_OpenButton->GetNativeGeometry(), FILESELECTOR_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
1172 eCornerTopRight | eCornerBottomRight, false);
1173 }
1174
1175 GeometryPositioning gp(eHACenter, eVACenter);
1176 Geometry TextureGeo = Geometry(0, 0, m_Texture->GetWidth(), m_Texture->GetHeight());
1177- Geometry GeoPo = ComputeGeometryPositioning(m_OpenButton->GetGeometry(), TextureGeo, gp);
1178+ Geometry GeoPo = ComputeGeometryPositioning(m_OpenButton->GetNativeGeometry(), TextureGeo, gp);
1179
1180 GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetBlend(TRUE, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1181 GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetColorMask(TRUE, TRUE, TRUE, FALSE);
1182@@ -99,7 +99,7 @@
1183
1184 void FileSelector::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
1185 {
1186- Geometry base = GetGeometry();
1187+ Geometry base = GetNativeGeometry();
1188
1189 m_FileEditTextBox->ProcessDraw(graphics_engine, force_draw);
1190 }
1191
1192=== modified file 'Nux/FloatingWindow.cpp'
1193--- Nux/FloatingWindow.cpp 2012-11-12 20:59:56 +0000
1194+++ Nux/FloatingWindow.cpp 2012-12-17 15:42:23 +0000
1195@@ -68,7 +68,7 @@
1196
1197 _title_bar_layout = new HLayout(NUX_TRACKER_LOCATION);
1198 _title_bar_layout->Reference();
1199-
1200+
1201 _minimize_button->SetMinMaxSize(20, 20);
1202 _minimize_button->SetGeometry(Geometry(0, 0, 20, 20));
1203 _close_button->SetMinimumSize(20, 20);
1204@@ -121,7 +121,7 @@
1205 _minimize_button->UnReference();
1206 CloseIcon->UnReference();
1207 MinimizeIcon->UnReference();
1208-
1209+
1210 _title_bar_layout->UnParentObject();
1211 _title_bar_layout->UnReference();
1212 }
1213@@ -164,7 +164,7 @@
1214
1215 void FloatingWindow::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
1216 {
1217- Geometry base = GetGeometry();
1218+ Geometry base = GetNativeGeometry();
1219 // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).
1220 base.SetX(0);
1221 base.SetY(0);
1222@@ -174,12 +174,13 @@
1223
1224 if (HasTitleBar())
1225 {
1226- GetPainter().PaintShapeCorner(graphics_engine, Geometry(_title_bar->GetBaseX(), _title_bar->GetBaseY(),
1227+ Geometry tgeo = _title_bar->GetGeometryRelativeTo(this);
1228+ GetPainter().PaintShapeCorner(graphics_engine, Geometry(tgeo.x, tgeo.y,
1229 _title_bar->GetBaseWidth(), _title_bar->GetBaseHeight()), Color(0xFF2f2f2f),
1230 eSHAPE_CORNER_ROUND10, eCornerTopLeft | eCornerTopRight);
1231
1232- GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), _window_title_bar->GetGeometry(), _window_title, Color(0xFFFFFFFF), true, eAlignTextCenter);
1233- GetPainter().Draw2DTextureAligned(graphics_engine, CloseIcon, _close_button->GetGeometry(), TextureAlignmentStyle(eTACenter, eTACenter));
1234+ GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), _window_title_bar->GetNativeGeometry(), _window_title, Color(0xFFFFFFFF), true, eAlignTextCenter);
1235+ GetPainter().Draw2DTextureAligned(graphics_engine, CloseIcon, _close_button->GetGeometryRelativeTo(this), TextureAlignmentStyle(eTACenter, eTACenter));
1236 }
1237
1238 GetPainter().PopBackground();
1239@@ -188,7 +189,7 @@
1240
1241 void FloatingWindow::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
1242 {
1243- Geometry base = GetGeometry();
1244+ Geometry base = GetNativeGeometry();
1245 // The elements position inside the window are referenced to top-left window corner. So bring base to(0, 0).
1246 base.SetX(0);
1247 base.SetY(0);
1248@@ -250,7 +251,7 @@
1249 }
1250
1251 Geometry geo;
1252- geo = GetGeometry();
1253+ geo = GetNativeGeometry();
1254
1255 int ddx = 0;
1256 int ddy = 0;
1257@@ -283,7 +284,7 @@
1258 if (m_input_window != 0)
1259 {
1260 //nuxDebugMsg("Resize Input window: %d, %d, %d, %d", geo.x, geo.y, geo.width, geo.height);
1261- m_input_window->SetGeometry(GetGeometry());
1262+ m_input_window->SetGeometry(GetNativeGeometry());
1263 }
1264 #endif
1265
1266@@ -299,7 +300,7 @@
1267 void FloatingWindow::RecvTitleBarMouseDrag(int /* x */, int /* y */, int dx, int dy, unsigned long /* button_flags */, unsigned long /* key_flags */)
1268 {
1269 Geometry geo;
1270- geo = GetGeometry();
1271+ geo = GetNativeGeometry();
1272 geo.OffsetPosition(dx, dy);
1273
1274 // Set the Window Size and Position
1275@@ -313,7 +314,7 @@
1276 if (m_input_window != 0)
1277 {
1278 //nuxDebugMsg("Resize Input window: %d, %d, %d, %d", geo.x, geo.y, geo.width, geo.height);
1279- m_input_window->SetGeometry(GetGeometry());
1280+ m_input_window->SetGeometry(GetNativeGeometry());
1281 }
1282 #endif
1283
1284@@ -333,7 +334,7 @@
1285 // Here we need to position the header by hand because it is not under the control of vlayout.
1286 void FloatingWindow::PreLayoutManagement()
1287 {
1288- Geometry geo = GetGeometry();
1289+ Geometry geo = GetNativeGeometry();
1290
1291 if (m_configure_notify_callback)
1292 {
1293@@ -342,13 +343,13 @@
1294 if (geo.IsNull())
1295 {
1296 nuxDebugMsg("[FloatingWindow::PreLayoutManagement] Received an invalid Geometry.");
1297- geo = GetGeometry();
1298+ geo = GetNativeGeometry();
1299 }
1300 else
1301 {
1302 Area::SetGeometry(geo);
1303 // Get the geometry adjusted with respect to min and max dimension of this area.
1304- geo = GetGeometry();
1305+ geo = GetNativeGeometry();
1306 }
1307 }
1308
1309@@ -377,17 +378,17 @@
1310 {
1311 if (IsSizeMatchContent() && m_layout)
1312 {
1313- Geometry layout_geometry = m_layout->GetGeometry();
1314+ Geometry layout_geometry = m_layout->GetNativeGeometry();
1315
1316- Geometry WindowGeometry = Geometry(GetGeometry().x,
1317- GetGeometry().y,
1318+ Geometry WindowGeometry = Geometry(GetNativeGeometry().x,
1319+ GetNativeGeometry().y,
1320 layout_geometry.GetWidth() + 2 * m_Border,
1321 layout_geometry.GetHeight() + m_Border + m_TopBorder);
1322
1323 Area::SetGeometry(WindowGeometry);
1324 }
1325
1326- Geometry geo = GetGeometry();
1327+ Geometry geo = GetNativeGeometry();
1328
1329 // Drag Bar Geometry
1330 if (HasTitleBar())
1331@@ -401,7 +402,7 @@
1332 _resize_handle->SetGeometry(temp);
1333
1334 // Title Bar
1335- _title_bar_layout->SetGeometry(_title_bar->GetGeometry());
1336+ _title_bar_layout->SetGeometry(_title_bar->GetGeometryRelativeTo(this));
1337 GetWindowThread()->ComputeElementLayout(_title_bar_layout);
1338
1339 // A FloatingWindow must kill the result of the management and pass it to the parent Layout.
1340@@ -415,7 +416,7 @@
1341 {
1342 //ScrollView::ComputeContentPosition(offsetX, offsetY);
1343
1344- Geometry geo = GetGeometry();
1345+ Geometry geo = GetNativeGeometry();
1346
1347 // Drag Bar Geometry
1348 if (HasTitleBar())
1349@@ -429,7 +430,7 @@
1350 _resize_handle->SetGeometry(temp);
1351
1352 // Title Bar
1353- _title_bar_layout->SetGeometry(_title_bar->GetGeometry());
1354+ _title_bar_layout->SetGeometry(_title_bar->GetGeometryRelativeTo(this));
1355 GetWindowThread()->ComputeElementLayout(_title_bar_layout);
1356
1357 }
1358@@ -438,10 +439,10 @@
1359 {
1360 // Define the geometry of some of the component of the window. Otherwise, if the composition layout is not set,
1361 // then the component won't be correctly placed after a SetGeometry. This can be redundant if the composition layout is set.
1362- Geometry base = GetGeometry();
1363+ Geometry base = GetNativeGeometry();
1364 _title_bar->SetGeometry(Geometry(0, 0, base.GetWidth(), _title_bar_height));
1365
1366- _title_bar_layout->SetGeometry(_title_bar->GetGeometry());
1367+ _title_bar_layout->SetGeometry(_title_bar->GetGeometryRelativeTo(this));
1368 GetWindowThread()->ComputeElementLayout(_title_bar_layout);
1369
1370 // Size grip Geometry
1371
1372=== modified file 'Nux/GridHLayout.cpp'
1373--- Nux/GridHLayout.cpp 2012-11-05 21:31:06 +0000
1374+++ Nux/GridHLayout.cpp 2012-12-17 15:42:23 +0000
1375@@ -196,7 +196,7 @@
1376 // 12 13 .. .. .. ..
1377 // 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.
1378
1379- nux::Geometry base = GetGeometry();
1380+ nux::Geometry base = GetNativeGeometry();
1381 it = elements.begin();
1382 int num_row = 0;
1383 int num_column = 0;
1384@@ -340,7 +340,7 @@
1385
1386 int original_width = GetBaseWidth();
1387
1388- nux::Geometry base = GetGeometry();
1389+ nux::Geometry base = GetNativeGeometry();
1390 it = elements.begin();
1391 int num_row = 0;
1392 int num_column = 0;
1393@@ -470,7 +470,7 @@
1394
1395 graphics_engine.PushModelViewMatrix(Get2DMatrix());
1396
1397- Geometry base = GetGeometry();
1398+ Geometry base = GetNativeGeometry();
1399 Geometry absolute_geometry = GetAbsoluteGeometry();
1400 Geometry parent_geometry = absolute_geometry;
1401 Geometry visibility_geometry = absolute_geometry;
1402
1403=== modified file 'Nux/GroupBox.cpp'
1404--- Nux/GroupBox.cpp 2012-10-02 07:32:55 +0000
1405+++ Nux/GroupBox.cpp 2012-12-17 15:42:23 +0000
1406@@ -47,9 +47,9 @@
1407
1408 void GroupBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
1409 {
1410- graphics_engine.PushClippingRectangle(GetGeometry());
1411+ graphics_engine.PushClippingRectangle(GetNativeGeometry());
1412
1413- Geometry wireborder_geo = GetGeometry();
1414+ Geometry wireborder_geo = GetNativeGeometry();
1415
1416 //if(bCaptionAvailable)
1417 {
1418@@ -66,7 +66,8 @@
1419 {
1420 //GetPainter().Paint2DQuadColor(m_CaptionArea.GetGeometry(), COLOR_BACKGROUND_PRIMARY);
1421 //GetPainter().PaintTextLineStatic(m_CaptionArea.GetGeometry(), m_CaptionArea.GetCaptionString(), eAlignTextCenter);
1422- GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), m_CaptionArea.GetGeometry(), m_CaptionArea.GetBaseString(), GetTextColor(),
1423+ GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(),
1424+ m_CaptionArea.GetGeometryRelativeTo(this), m_CaptionArea.GetBaseString(), GetTextColor(),
1425 true, eAlignTextCenter);
1426 }
1427
1428@@ -80,12 +81,12 @@
1429
1430 void GroupBox::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
1431 {
1432- graphics_engine.PushClippingRectangle(GetGeometry());
1433+ graphics_engine.PushClippingRectangle(GetNativeGeometry());
1434
1435 if (m_layout)
1436 {
1437- graphics_engine.PushClippingRectangle(m_layout->GetGeometry());
1438- m_layout->ProcessDraw(graphics_engine, force_draw);
1439+ graphics_engine.PushClippingRectangle(GetLayout()->GetNativeGeometry());
1440+ GetLayout()->ProcessDraw(graphics_engine, force_draw);
1441 graphics_engine.PopClippingRectangle();
1442 }
1443
1444@@ -114,7 +115,7 @@
1445 // Give the managed layout appropriate size and position..
1446 if (view_layout_)
1447 {
1448- Geometry layout_geo = GetGeometry();
1449+ Geometry layout_geo = GetNativeGeometry();
1450 //if(bCaptionAvailable)
1451 {
1452 layout_geo.OffsetPosition(2, 20);
1453@@ -136,11 +137,11 @@
1454 // Only the size is change is important here of the GroupBox is important here.
1455
1456 long ret = 0;
1457- Geometry old_geo = Area::GetGeometry();
1458+ Geometry old_geo = Area::GetNativeGeometry();
1459
1460 if (view_layout_)
1461 {
1462- Geometry base = view_layout_->GetGeometry();
1463+ Geometry base = view_layout_->GetNativeGeometry();
1464 //if(bCaptionAvailable)
1465 {
1466 base.OffsetPosition(-2, -20);
1467@@ -154,7 +155,7 @@
1468 Area::SetGeometry(base);
1469 }
1470
1471- Geometry base = GetGeometry();
1472+ Geometry base = GetNativeGeometry();
1473 m_CaptionArea.SetBaseXY(base.x + 6, base.y);
1474
1475 if (old_geo.GetWidth() > base.GetWidth())
1476@@ -180,8 +181,8 @@
1477 {
1478 //if(bCaptionAvailable)
1479 {
1480- view_layout_->SetBaseX(GetBaseX() + 2);
1481- view_layout_->SetBaseY(GetBaseY() + 20);
1482+ view_layout_->SetBaseX(GetNativeX() + 2);
1483+ view_layout_->SetBaseY(GetNativeY() + 20);
1484 }
1485 // else
1486 // {
1487@@ -191,7 +192,7 @@
1488 view_layout_->ComputeContentPosition(offsetX, offsetY);
1489 }
1490
1491- Geometry base = GetGeometry();
1492+ Geometry base = GetNativeGeometry();
1493 m_CaptionArea.SetBaseXY(base.x + 6, base.y);
1494 }
1495
1496
1497=== modified file 'Nux/GroupBox2.cpp'
1498--- Nux/GroupBox2.cpp 2012-11-05 21:31:06 +0000
1499+++ Nux/GroupBox2.cpp 2012-12-17 15:42:23 +0000
1500@@ -36,10 +36,8 @@
1501
1502 GroupBox2::GroupBox2(const char *Caption, NUX_FILE_LINE_DECL)
1503 : View(NUX_FILE_LINE_PARAM)
1504- , bCaptionAvailable(false)
1505- , m_layout(0)
1506 {
1507- m_CaptionArea = new BasicView(NUX_TRACKER_LOCATION);
1508+ header_title_ = new BasicView(NUX_TRACKER_LOCATION);
1509 SetMinimumSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5);
1510 SetBaseSize(DEFAULT_WIDGET_WIDTH + 5, PRACTICAL_WIDGET_HEIGHT + 5);
1511 SetCaption(Caption);
1512@@ -47,30 +45,28 @@
1513
1514 GroupBox2::~GroupBox2()
1515 {
1516- m_CaptionArea->Dispose();
1517+ header_title_->UnReference();
1518 }
1519
1520 void GroupBox2::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
1521 {
1522- graphics_engine.PushClippingRectangle(GetGeometry());
1523+ graphics_engine.PushClippingRectangle(GetNativeGeometry());
1524
1525- Geometry header = GetGeometry();
1526+ Geometry header = GetNativeGeometry();
1527 header.SetHeight(TOP_HEADER_HEIGHT);
1528- Geometry layoutgeomerty = GetGeometry();
1529- layoutgeomerty.OffsetPosition(0, TOP_HEADER_HEIGHT);
1530- layoutgeomerty.OffsetSize(0, -TOP_HEADER_HEIGHT);
1531+ Geometry content_area = GetNativeGeometry();
1532+ content_area.OffsetPosition(0, TOP_HEADER_HEIGHT);
1533+ content_area.OffsetSize(0, -TOP_HEADER_HEIGHT);
1534 GetPainter().PaintShapeCorner(graphics_engine, header, Color(0xFF000000), eSHAPE_CORNER_ROUND4, eCornerTopLeft | eCornerTopRight, false);
1535
1536- GetPainter().PushDrawShapeLayer(graphics_engine, layoutgeomerty, eSHAPE_CORNER_ROUND4, GROUPBOX2_HEADER_BASE_COLOR, eCornerBottomLeft | eCornerBottomRight);
1537+ GetPainter().PushDrawShapeLayer(graphics_engine, content_area, eSHAPE_CORNER_ROUND4, GROUPBOX2_HEADER_BASE_COLOR,
1538+ eCornerBottomLeft | eCornerBottomRight);
1539
1540 //if(bCaptionAvailable)
1541 {
1542- GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), m_CaptionArea->GetGeometry(), m_CaptionArea->GetBaseString(), GROUPBOX2_HEADER_TEXT_COLOR);
1543- }
1544-
1545- if (m_layout != 0)
1546- {
1547- m_layout->QueueDraw();
1548+ GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(),
1549+ header_title_->GetGeometry(),
1550+ header_title_->GetBaseString(), GROUPBOX2_HEADER_TEXT_COLOR);
1551 }
1552
1553 GetPainter().PopBackground();
1554@@ -79,23 +75,21 @@
1555
1556 void GroupBox2::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
1557 {
1558- if (m_layout == 0)
1559+ if(GetLayout() == NULL)
1560 return;
1561
1562- graphics_engine.PushClippingRectangle(m_layout->GetGeometry());
1563- Geometry layoutgeomerty = GetGeometry();
1564- layoutgeomerty.OffsetPosition(0, TOP_HEADER_HEIGHT);
1565- layoutgeomerty.OffsetSize(0, -TOP_HEADER_HEIGHT);
1566-
1567- if (force_draw)
1568- GetPainter().PushDrawShapeLayer(graphics_engine, layoutgeomerty, eSHAPE_CORNER_ROUND4, GROUPBOX2_HEADER_BASE_COLOR, eAllCorners);
1569- else
1570- GetPainter().PushShapeLayer(graphics_engine, layoutgeomerty, eSHAPE_CORNER_ROUND4, GROUPBOX2_HEADER_BASE_COLOR, eAllCorners);
1571-
1572- if (m_layout)
1573+ Geometry content_area = GetNativeGeometry();
1574+ content_area.OffsetPosition(0, TOP_HEADER_HEIGHT);
1575+ content_area.OffsetSize(0, -TOP_HEADER_HEIGHT);
1576+
1577+ graphics_engine.PushClippingRectangle(content_area);
1578+
1579+ GetPainter().PushShapeLayer(graphics_engine, content_area, eSHAPE_CORNER_ROUND4, GROUPBOX2_HEADER_BASE_COLOR, eAllCorners);
1580+
1581+ if (GetLayout())
1582 {
1583- graphics_engine.PushClippingRectangle(m_layout->GetGeometry());
1584- m_layout->ProcessDraw(graphics_engine, force_draw);
1585+ graphics_engine.PushClippingRectangle(GetLayout()->GetGeometry());
1586+ GetLayout()->ProcessDraw(graphics_engine, force_draw);
1587 graphics_engine.PopClippingRectangle();
1588 }
1589
1590@@ -110,8 +104,6 @@
1591 return false;
1592 }
1593
1594- m_layout = layout;
1595-
1596 return true;
1597 }
1598
1599@@ -120,17 +112,10 @@
1600 // Give the managed layout appropriate size and position..
1601 if (GetCompositionLayout())
1602 {
1603- Geometry layout_geo = GetGeometry();
1604- //if(bCaptionAvailable)
1605- {
1606- layout_geo.OffsetPosition(X_MARGIN, TOP_HEADER_HEIGHT + Y_MARGIN);
1607- layout_geo.OffsetSize(-2 * X_MARGIN, -TOP_HEADER_HEIGHT - 2 * Y_MARGIN);
1608- }
1609-// else
1610-// {
1611-// layout_geo.OffsetPosition(X_MARGIN, 2);
1612-// layout_geo.OffsetSize(-2*X_MARGIN, -2*Y_MARGIN);
1613-// }
1614+ Geometry layout_geo = GetNativeGeometry();
1615+ layout_geo.OffsetPosition(X_MARGIN, TOP_HEADER_HEIGHT + Y_MARGIN);
1616+ layout_geo.OffsetSize(-2 * X_MARGIN, -TOP_HEADER_HEIGHT - 2 * Y_MARGIN);
1617+
1618 GetCompositionLayout()->SetGeometry(layout_geo);
1619 }
1620 }
1621@@ -146,22 +131,15 @@
1622
1623 if (GetCompositionLayout())
1624 {
1625- Geometry base = GetCompositionLayout()->GetGeometry();
1626- //if(bCaptionAvailable)
1627- {
1628- base.OffsetPosition(-X_MARGIN, -TOP_HEADER_HEIGHT - Y_MARGIN);
1629- base.OffsetSize(2 * X_MARGIN, TOP_HEADER_HEIGHT + 2 * Y_MARGIN);
1630- }
1631-// else
1632-// {
1633-// base.OffsetPosition(-X_MARGIN, -2);
1634-// base.OffsetSize(2*X_MARGIN, 2*Y_MARGIN);
1635-// }
1636+ Geometry base = GetCompositionLayout()->GetNativeGeometry();
1637+ base.OffsetPosition(-X_MARGIN, -TOP_HEADER_HEIGHT - Y_MARGIN);
1638+ base.OffsetSize(2 * X_MARGIN, TOP_HEADER_HEIGHT + 2 * Y_MARGIN);
1639+
1640 Area::SetGeometry(base);
1641 }
1642
1643- Geometry base = GetGeometry();
1644- m_CaptionArea->SetBaseXY(base.x + CAPTION_X_MARGIN, base.y + (TOP_HEADER_HEIGHT - m_CaptionArea->GetBaseHeight()) / 2);
1645+ Geometry base = GetNativeGeometry();
1646+ header_title_->SetBaseXY(base.x + CAPTION_X_MARGIN, base.y + (TOP_HEADER_HEIGHT - header_title_->GetBaseHeight()) / 2);
1647
1648
1649 if (old_geo.GetWidth() > base.GetWidth())
1650@@ -185,45 +163,35 @@
1651 {
1652 if (GetCompositionLayout())
1653 {
1654- //if(bCaptionAvailable)
1655- {
1656- GetCompositionLayout()->SetBaseX(GetBaseX() + X_MARGIN);
1657- GetCompositionLayout()->SetBaseY(GetBaseY() + TOP_HEADER_HEIGHT + Y_MARGIN);
1658- }
1659-// else
1660-// {
1661-// m_compositionLayout->SetX(GetX() + X_MARGIN);
1662-// m_compositionLayout->SetY(GetY() + Y_MARGIN);
1663-// }
1664+ GetCompositionLayout()->SetBaseX(GetNativeX() + X_MARGIN);
1665+ GetCompositionLayout()->SetBaseY(GetNativeY() + TOP_HEADER_HEIGHT + Y_MARGIN);
1666 GetCompositionLayout()->ComputeContentPosition(offsetX, offsetY);
1667 }
1668
1669- Geometry base = GetGeometry();
1670- m_CaptionArea->SetBaseXY(base.x + CAPTION_X_MARGIN, base.y + (TOP_HEADER_HEIGHT - m_CaptionArea->GetBaseHeight()) / 2);
1671+ Geometry base = GetNativeGeometry();
1672+ header_title_->SetBaseXY(base.x + CAPTION_X_MARGIN, base.y + (TOP_HEADER_HEIGHT - header_title_->GetBaseHeight()) / 2);
1673 }
1674
1675 void GroupBox2::SetCaption(const char *Caption)
1676 {
1677 if ((Caption == 0) || (StringLength(Caption) == 0))
1678 {
1679- //bCaptionAvailable = false;
1680- m_CaptionArea->SetBaseString("");
1681- m_CaptionArea->SetMinimumSize(DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT);
1682- m_CaptionArea->SetBaseSize(DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT);
1683+ header_title_->SetBaseString("");
1684+ header_title_->SetMinimumSize(DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT);
1685+ header_title_->SetBaseSize(DEFAULT_WIDGET_WIDTH, PRACTICAL_WIDGET_HEIGHT);
1686 }
1687 else
1688 {
1689- //bCaptionAvailable = true;
1690- m_CaptionArea->SetBaseString(Caption);
1691- m_CaptionArea->SetMinimumSize(4 + GetSysBoldFont()->GetStringWidth(Caption), PRACTICAL_WIDGET_HEIGHT);
1692- m_CaptionArea->SetBaseSize(4 + GetSysBoldFont()->GetStringWidth(Caption), PRACTICAL_WIDGET_HEIGHT);
1693+ header_title_->SetBaseString(Caption);
1694+ header_title_->SetMinimumSize(4 + GetSysBoldFont()->GetStringWidth(Caption), PRACTICAL_WIDGET_HEIGHT);
1695+ header_title_->SetBaseSize(4 + GetSysBoldFont()->GetStringWidth(Caption), PRACTICAL_WIDGET_HEIGHT);
1696
1697 Size s = GetMinimumSize();
1698
1699- if (s.width < 2 * CAPTION_X_MARGIN + m_CaptionArea->GetBaseWidth())
1700+ if (s.width < 2 * CAPTION_X_MARGIN + header_title_->GetBaseWidth())
1701 {
1702- SetMinimumSize(2 * CAPTION_X_MARGIN + m_CaptionArea->GetBaseWidth(), s.height);
1703- SetBaseSize(2 * CAPTION_X_MARGIN + m_CaptionArea->GetBaseWidth(), s.height);
1704+ SetMinimumSize(2 * CAPTION_X_MARGIN + header_title_->GetBaseWidth(), s.height);
1705+ SetBaseSize(2 * CAPTION_X_MARGIN + header_title_->GetBaseWidth(), s.height);
1706 }
1707 }
1708 }
1709
1710=== modified file 'Nux/GroupBox2.h'
1711--- Nux/GroupBox2.h 2012-11-05 21:31:06 +0000
1712+++ Nux/GroupBox2.h 2012-12-17 15:42:23 +0000
1713@@ -39,22 +39,20 @@
1714 GroupBox2(const char *Caption = "", NUX_FILE_LINE_PROTO);
1715 ~GroupBox2();
1716
1717- virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw);
1718- virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw);
1719-
1720 virtual bool SetLayout(Layout *layout);
1721 void SetCaption(const char *Caption);
1722-
1723+
1724 protected:
1725 virtual bool AcceptKeyNavFocus();
1726+ virtual void Draw(GraphicsEngine &graphics_engine, bool force_draw);
1727+ virtual void DrawContent(GraphicsEngine &graphics_engine, bool force_draw);
1728+
1729 private:
1730 virtual void PreLayoutManagement();
1731 virtual long PostLayoutManagement(long LayoutResult);
1732 virtual void ComputeContentPosition(float offsetX, float offsetY);
1733
1734- bool bCaptionAvailable;
1735- BasicView *m_CaptionArea;
1736- Layout *m_layout;
1737+ BasicView *header_title_;
1738
1739 static int CAPTION_X_MARGIN;
1740 static int X_MARGIN;
1741
1742=== modified file 'Nux/HLayout.cpp'
1743--- Nux/HLayout.cpp 2012-12-08 01:03:38 +0000
1744+++ Nux/HLayout.cpp 2012-12-17 15:42:23 +0000
1745@@ -240,8 +240,8 @@
1746 HLayoutManagement(width, height);
1747
1748 // Objects have been resized, now position them.
1749- int current_x = GetBaseX() + left_padding_;
1750- int current_y = GetBaseY() + top_padding_;
1751+ int current_x = left_padding_;
1752+ int current_y = top_padding_;
1753
1754 int offset_space = 0;
1755 int space_after_element = 0;
1756@@ -360,9 +360,9 @@
1757
1758 if (((*it)->IsLayout() || (*it)->IsView()) /*&& ((*it)->IsLayoutDone() == false)*/ /*&& ((*it)->GetScaleFactor() != 0)*/)
1759 {
1760- Geometry pre_geo = (*it)->GetGeometry();
1761+ Geometry pre_geo = (*it)->GetNativeGeometry();
1762 ret = (*it)->ComputeContentSize();
1763- Geometry post_geo = (*it)->GetGeometry();
1764+ Geometry post_geo = (*it)->GetNativeGeometry();
1765
1766 bool larger_width = pre_geo.width < post_geo.width;
1767 bool smaller_width = pre_geo.width > post_geo.width;
1768@@ -769,8 +769,8 @@
1769 height -= (top_padding_ + bottom_padding_);
1770
1771 // Objects have been resized, now position them.
1772- int current_x = GetBaseX() + left_padding_ + offsetX; // add base offset in X(used for scrolling)
1773- int current_y = GetBaseY() + top_padding_ + offsetY; // add base offset in Y(used for scrolling)
1774+ int current_x = left_padding_ + offsetX; // add base offset in X(used for scrolling)
1775+ int current_y = top_padding_ + offsetY; // add base offset in Y(used for scrolling)
1776
1777 int offset_space = 0;
1778 int element_margin = 0;
1779
1780=== modified file 'Nux/HScrollBar.cpp'
1781--- Nux/HScrollBar.cpp 2012-11-05 21:31:06 +0000
1782+++ Nux/HScrollBar.cpp 2012-12-17 15:42:23 +0000
1783@@ -277,17 +277,17 @@
1784
1785 void HScrollBar::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
1786 {
1787- Geometry base = GetGeometry();
1788+ Geometry base = GetNativeGeometry();
1789 GetPainter().PaintBackground(graphics_engine, base);
1790 base.OffsetPosition(HSCROLLBAR_WIDTH, 0);
1791 base.OffsetSize(-2 * HSCROLLBAR_WIDTH, 0);
1792 GetPainter().PaintShape(graphics_engine, base,
1793 Color(COLOR_SCROLLBAR_TRACK), eHSCROLLBAR, false);
1794
1795- GetPainter().PaintShape(graphics_engine, _scroll_left_button->GetGeometry(), Color(0xFFFFFFFF), eSCROLLBAR_TRIANGLE_LEFT);
1796- GetPainter().PaintShape(graphics_engine, _scroll_right_button->GetGeometry(), Color(0xFFFFFFFF), eSCROLLBAR_TRIANGLE_RIGHT);
1797+ GetPainter().PaintShape(graphics_engine, _scroll_left_button->GetGeometryRelativeTo(this), Color(0xFFFFFFFF), eSCROLLBAR_TRIANGLE_LEFT);
1798+ GetPainter().PaintShape(graphics_engine, _scroll_right_button->GetGeometryRelativeTo(this), Color(0xFFFFFFFF), eSCROLLBAR_TRIANGLE_RIGHT);
1799
1800- GetPainter().PaintShape(graphics_engine, _slider->GetGeometry(),
1801+ GetPainter().PaintShape(graphics_engine, _slider->GetGeometryRelativeTo(this),
1802 Color(0.2156 * m_color_factor, 0.2156 * m_color_factor, 0.2156 * m_color_factor, 1.0f),
1803 eHSCROLLBAR, true);
1804 };
1805
1806=== modified file 'Nux/HSplitter.cpp'
1807--- Nux/HSplitter.cpp 2012-11-17 16:15:55 +0000
1808+++ Nux/HSplitter.cpp 2012-12-17 15:42:23 +0000
1809@@ -49,8 +49,8 @@
1810 mvt_dy = 0;
1811 m_current_x = 0;
1812 m_current_y = 0;
1813- m_current_width = 200;
1814- m_current_height = 200;
1815+ m_current_width = 100;
1816+ m_current_height = 100;
1817
1818 //SetMinimumSize(200,200);
1819 SetGeometry(Geometry(m_current_x, m_current_y, m_current_width, m_current_height));
1820@@ -77,20 +77,18 @@
1821
1822 void HSplitter::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
1823 {
1824- graphics_engine.PushClippingRectangle(GetGeometry());
1825- Geometry base = GetGeometry();
1826-// std::vector<View*>::iterator it;
1827-// for (it = m_InterfaceObject.begin(); it != m_InterfaceObject.end(); it++)
1828-// {
1829-// (*it)->ProcessDraw(force_draw);
1830-// }
1831-
1832- GetPainter().PaintBackground(graphics_engine, base);
1833+ // Save the model view matrix. We reuse it when drawing the splitter overlay during a resize operation.
1834+ local_model_view_matrix_ = graphics_engine.GetModelViewMatrix();
1835+
1836+ Geometry base = GetNativeGeometry();
1837+ graphics_engine.PushClippingRectangle(base);
1838+ std::vector<Area *>::iterator it;
1839+
1840 std::vector<MySplitter *>::iterator it_splitter;
1841
1842 for (it_splitter = m_SplitterObject.begin(); it_splitter != m_SplitterObject.end(); it_splitter++)
1843 {
1844- Geometry geo = (*it_splitter)->GetGeometry();
1845+ Geometry geo = (*it_splitter)->GetGeometryRelativeTo(this);
1846 Geometry grip_geo;
1847 int w = 20;
1848
1849@@ -118,19 +116,19 @@
1850
1851 void HSplitter::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
1852 {
1853- Geometry base = GetGeometry();
1854+ Geometry base = GetNativeGeometry();
1855 graphics_engine.PushClippingRectangle(base);
1856+
1857 bool need_redraw = IsRedrawNeeded();
1858
1859 std::vector<MySplitter *>::iterator it_splitter;
1860 std::vector<Area *>::iterator it;
1861
1862- //for(it = m_InterfaceObject.begin(); it != m_InterfaceObject.end(); it++)
1863 for (it = m_InterfaceObject.begin(), it_splitter = m_SplitterObject.begin();
1864 it != m_InterfaceObject.end();
1865 it++, it_splitter++)
1866 {
1867- Geometry sgeo = (*it_splitter)->GetGeometry();
1868+ Geometry sgeo = (*it_splitter)->GetGeometryRelativeTo(this);
1869 graphics_engine.PushClippingRectangle(Rect(
1870 base.x, base.y, base.GetWidth(), sgeo.y - base.y));
1871
1872@@ -182,13 +180,20 @@
1873 void HSplitter::OverlayDrawing(GraphicsEngine &graphics_engine)
1874 {
1875 unsigned int num_element = (unsigned int) m_SplitterObject.size();
1876-
1877- Geometry base = GetGeometry();
1878+ Geometry base = GetNativeGeometry();
1879+
1880+ // Transform this area position with the model view matrix we captured earlier.
1881+ Vector4 v = local_model_view_matrix_ * Vector4(base.x, base.y, 0.0f, 1.0f);
1882+
1883+ // base is now in window coordinates
1884+ base.x = v.x;
1885+ base.y = v.y;
1886
1887 if (m_focus_splitter_index >= 0)
1888 {
1889- Geometry geo = m_SplitterObject[m_focus_splitter_index]->GetGeometry();
1890- geo.OffsetPosition(mvt_dx, mvt_dy);
1891+ Geometry geo = m_SplitterObject[m_focus_splitter_index]->GetGeometryRelativeTo(this);
1892+
1893+ geo.OffsetPosition(base.x + mvt_dx, base.y + mvt_dy);
1894
1895 if (m_focus_splitter_index == 0 && num_element > 1)
1896 {
1897@@ -197,22 +202,22 @@
1898 geo.SetY(base.y);
1899 }
1900
1901- if (geo.y + HSPLITTERHEIGHT > m_SplitterObject[m_focus_splitter_index + 1]->GetGeometry().y)
1902+ if (geo.y + HSPLITTERHEIGHT > base.y + m_SplitterObject[m_focus_splitter_index + 1]->GetGeometryRelativeTo(this).y)
1903 {
1904- geo.SetY(m_SplitterObject[m_focus_splitter_index+1]->GetGeometry().y - HSPLITTERHEIGHT);
1905+ geo.SetY(base.y + m_SplitterObject[m_focus_splitter_index+1]->GetGeometryRelativeTo(this).y - HSPLITTERHEIGHT);
1906 }
1907 }
1908
1909 if ((m_focus_splitter_index > 0) && (m_focus_splitter_index < (int) num_element - 1))
1910 {
1911- if (geo.y < m_SplitterObject[m_focus_splitter_index - 1]->GetGeometry().y + HSPLITTERHEIGHT)
1912+ if (geo.y < m_SplitterObject[m_focus_splitter_index - 1]->GetGeometryRelativeTo(this).y + HSPLITTERHEIGHT)
1913 {
1914- geo.SetY(m_SplitterObject[m_focus_splitter_index - 1]->GetGeometry().y + HSPLITTERHEIGHT);
1915+ geo.SetY(m_SplitterObject[m_focus_splitter_index - 1]->GetGeometryRelativeTo(this).y + HSPLITTERHEIGHT);
1916 }
1917
1918- if (geo.y + HSPLITTERHEIGHT > m_SplitterObject[m_focus_splitter_index + 1]->GetGeometry().y)
1919+ if (geo.y + HSPLITTERHEIGHT > m_SplitterObject[m_focus_splitter_index + 1]->GetGeometryRelativeTo(this).y)
1920 {
1921- geo.SetY(m_SplitterObject[m_focus_splitter_index + 1]->GetGeometry().y - HSPLITTERHEIGHT);
1922+ geo.SetY(m_SplitterObject[m_focus_splitter_index + 1]->GetGeometryRelativeTo(this).y - HSPLITTERHEIGHT);
1923 }
1924 }
1925
1926@@ -255,8 +260,8 @@
1927 long HSplitter::ComputeContentSize()
1928 {
1929 unsigned int num_element = (unsigned int) m_InterfaceObject.size();
1930- int x = GetBaseX();
1931- int y = GetBaseY();
1932+ int x = 0;
1933+ int y = 0;
1934 int w = GetBaseWidth();
1935 int h = GetBaseHeight();
1936
1937@@ -289,7 +294,7 @@
1938 {
1939 for (unsigned int i = 0; i < num_element; i++)
1940 {
1941- Geometry splitter_geo = m_SplitterObject[i]->GetGeometry();
1942+ Geometry splitter_geo = m_SplitterObject[i]->GetGeometryRelativeTo(this);
1943 splitter_geo.SetWidth(w);
1944 splitter_geo.SetX(x);
1945
1946@@ -305,7 +310,7 @@
1947
1948 for (unsigned int i = 0; i < num_element; i++)
1949 {
1950- Geometry splitter_geo = m_SplitterObject[i]->GetGeometry();
1951+ Geometry splitter_geo = m_SplitterObject[i]->GetGeometryRelativeTo(this);
1952 // compute percentage of space occupied by the element i;
1953 // width of element i = m_SplitterObject[i]->GetY() - previous_splliter_end
1954 int splitter_start = m_SplitterObject[i]->GetBaseY();
1955@@ -332,7 +337,7 @@
1956
1957 for (unsigned int i = 0; i < num_element; i++)
1958 {
1959- Geometry splitter_geo = m_SplitterObject[i]->GetGeometry();
1960+ Geometry splitter_geo = m_SplitterObject[i]->GetGeometryRelativeTo(this);
1961
1962 //m_InterfaceObject[i]->SetGeometry(Geometry(x, accheight, w, splitter_geo.y - accheight));
1963
1964@@ -367,8 +372,8 @@
1965 void HSplitter::ResetSplitConfig()
1966 {
1967
1968- int x = GetBaseX();
1969- int y = GetBaseY();
1970+ int x = 0;
1971+ int y = 0;
1972 int w = GetBaseWidth();
1973 int h = GetBaseHeight();
1974 unsigned int num_element = (unsigned int) m_InterfaceObject.size();
1975@@ -408,6 +413,7 @@
1976 y += stretchfactor * max_size / max_stretch;
1977 Geometry geo(x, y, w, HSPLITTERHEIGHT);
1978 m_SplitterObject[i]->SetGeometry(geo);
1979+ y += HSPLITTERHEIGHT;
1980 }
1981
1982 m_SplitterObject[num_element-1]->SetBaseX(y + h - HSPLITTERHEIGHT);
1983@@ -431,7 +437,7 @@
1984 {
1985 if (mvt_dy)
1986 {
1987- Geometry geo = m_SplitterObject[header_pos]->GetGeometry();
1988+ Geometry geo = m_SplitterObject[header_pos]->GetGeometryRelativeTo(this);
1989 geo.OffsetPosition(0, mvt_dy);
1990
1991 unsigned int num_element = (unsigned int) m_SplitterObject.size();
1992@@ -439,8 +445,8 @@
1993 if (header_pos < (int) num_element - 1)
1994 {
1995 // Make the splitter bar stick to the next one if the distance between them is less than HSTICK_SIZE.
1996- if (m_SplitterObject[header_pos + 1]->GetGeometry().y - geo.y - HSPLITTERHEIGHT < HSTICK_SIZE)
1997- geo.SetY( m_SplitterObject[header_pos + 1]->GetGeometry().y - HSPLITTERHEIGHT );
1998+ if (m_SplitterObject[header_pos + 1]->GetGeometryRelativeTo(this).y - geo.y - HSPLITTERHEIGHT < HSTICK_SIZE)
1999+ geo.SetY( m_SplitterObject[header_pos + 1]->GetGeometryRelativeTo(this).y - HSPLITTERHEIGHT );
2000 }
2001
2002 m_SplitterObject[header_pos]->SetGeometry(geo);
2003@@ -459,7 +465,7 @@
2004
2005 void HSplitter::OnSplitterMouseDrag(int /* x */, int y, int /* dx */, int /* dy */, unsigned long /* button_flags */, unsigned long /* key_flags */, int header_pos)
2006 {
2007- Geometry geo = m_SplitterObject[header_pos]->GetGeometry();
2008+ Geometry geo = m_SplitterObject[header_pos]->GetGeometryRelativeTo(this);
2009 int num_element = (int) m_SplitterObject.size();
2010
2011 if (header_pos == num_element - 1)
2012@@ -489,17 +495,17 @@
2013
2014 void HSplitter::ResizeSplitter(int header_pos)
2015 {
2016- Geometry geo = m_SplitterObject[header_pos]->GetGeometry();
2017+ Geometry geo = m_SplitterObject[header_pos]->GetGeometryRelativeTo(this);
2018 int num_element = (int) m_SplitterObject.size();
2019
2020- if ((header_pos == 0) && (m_SplitterObject[header_pos]->GetBaseY() < GetBaseY()))
2021+ if ((header_pos == 0) && (m_SplitterObject[header_pos]->GetBaseY() < 0))
2022 {
2023- m_SplitterObject[header_pos]->SetBaseY(GetBaseY());
2024+ m_SplitterObject[header_pos]->SetBaseY(0);
2025 }
2026
2027- if ((header_pos == num_element - 1) && (m_SplitterObject[header_pos]->GetBaseY() > GetBaseY() + GetBaseHeight() - HSPLITTERHEIGHT))
2028+ if ((header_pos == num_element - 1) && (m_SplitterObject[header_pos]->GetBaseY() > 0 + GetBaseHeight() - HSPLITTERHEIGHT))
2029 {
2030- m_SplitterObject[header_pos]->SetBaseY(GetBaseY() + GetBaseHeight() - HSPLITTERHEIGHT);
2031+ m_SplitterObject[header_pos]->SetBaseY(GetBaseHeight() - HSPLITTERHEIGHT);
2032 }
2033
2034 if (header_pos < (int) num_element - 1)
2035
2036=== modified file 'Nux/HSplitter.h'
2037--- Nux/HSplitter.h 2012-11-05 21:31:06 +0000
2038+++ Nux/HSplitter.h 2012-12-17 15:42:23 +0000
2039@@ -79,6 +79,7 @@
2040 virtual Area* KeyNavIteration(KeyNavDirection direction);
2041
2042 private:
2043+ Matrix4 local_model_view_matrix_;
2044 typedef BasicView MySplitter;
2045 std::vector<Area *> m_InterfaceObject;
2046 std::vector<MySplitter *> m_SplitterObject;
2047
2048=== modified file 'Nux/Layout.cpp'
2049--- Nux/Layout.cpp 2012-11-05 21:31:06 +0000
2050+++ Nux/Layout.cpp 2012-12-17 15:42:23 +0000
2051@@ -35,7 +35,7 @@
2052 space_between_children_ = 0;
2053
2054 left_padding_ = 0;
2055- right_padding_ = 0;
2056+ right_padding_ = 0;
2057 top_padding_ = 0;
2058 bottom_padding_ = 0;
2059 m_contentWidth = 0;
2060@@ -496,11 +496,11 @@
2061 return NULL;
2062 }
2063
2064- void Layout::ProcessDraw(GraphicsEngine &graphics_engine, bool force_draw)
2065+ void Layout::ProcessDraw(GraphicsEngine& graphics_engine, bool force_draw)
2066 {
2067 std::list<Area *>::iterator it;
2068
2069- if (RedirectRenderingToTexture())
2070+ if (GetRedirectRenderingToTexture())
2071 {
2072 if (update_backup_texture_ || force_draw || draw_cmd_queued_)
2073 {
2074@@ -508,6 +508,9 @@
2075 BeginBackupTextureRendering(graphics_engine, force_draw);
2076 {
2077 graphics_engine.PushModelViewMatrix(Get2DMatrix());
2078+ Matrix4 mat;
2079+ mat.Translate(GetX(), GetY(), 0);
2080+ graphics_engine.PushModelViewMatrix(mat);
2081
2082 for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
2083 {
2084@@ -526,45 +529,36 @@
2085 }
2086 }
2087 graphics_engine.PopModelViewMatrix();
2088+ graphics_engine.PopModelViewMatrix();
2089 }
2090 EndBackupTextureRendering(graphics_engine, force_draw);
2091 GetPainter().PopPaintLayerStack();
2092- }
2093-
2094- if (PresentRedirectedView())
2095- {
2096- unsigned int current_alpha_blend;
2097- unsigned int current_src_blend_factor;
2098- unsigned int current_dest_blend_factor;
2099- // Be a good citizen, get a copy of the current GPU sates according to Nux
2100- graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
2101-
2102- TexCoordXForm texxform;
2103- //Geometry xform_geo = GetGraphicsDisplay()->GetGraphicsEngine()->ModelViewXFormRect(GetGeometry());
2104- if ((force_draw || draw_cmd_queued_) && background_texture_.IsValid())
2105+
2106+ if (GetPresentRedirectedView())
2107 {
2108- graphics_engine.GetRenderStates().SetBlend(false);
2109- texxform.FlipVCoord(true);
2110- // Draw the background of this view.
2111- GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), background_texture_->GetWidth(), background_texture_->GetHeight(), background_texture_, texxform, color::White);
2112+ RedirectedArea ra;
2113+ ra.backup_texture = backup_texture_;
2114+ ra.geometry = GetAbsoluteGeometry();
2115+ ra.clipping_region = graphics_engine.GetClippingRegion();
2116+ ra.area = this;
2117+
2118+ GetWindowCompositor().QueueRedirected(ra);
2119 }
2120-
2121- texxform.uwrap = TEXWRAP_CLAMP;
2122- texxform.vwrap = TEXWRAP_CLAMP;
2123- texxform.FlipVCoord(true);
2124-
2125- graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
2126- GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), GetWidth(), GetHeight(), backup_texture_, texxform, Color(color::White));
2127- // Be a good citizen, restore the Nux blending states.
2128- graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
2129+ }
2130+ else
2131+ {
2132+ GatherRedirectedViewForRendering(graphics_engine);
2133 }
2134 }
2135 else
2136 {
2137 graphics_engine.PushModelViewMatrix(Get2DMatrix());
2138+ Matrix4 mat;
2139+ mat.Translate(GetX(), GetY(), 0);
2140+ graphics_engine.PushModelViewMatrix(mat);
2141
2142 // Clip against the padding region.
2143- Geometry clip_geo = GetGeometry();
2144+ Geometry clip_geo = GetNativeGeometry();
2145 clip_geo.OffsetPosition(left_padding_, top_padding_);
2146 clip_geo.OffsetSize(-left_padding_ - right_padding_, -top_padding_ - bottom_padding_);
2147
2148@@ -589,6 +583,7 @@
2149
2150 graphics_engine.PopClippingRectangle();
2151 graphics_engine.PopModelViewMatrix();
2152+ graphics_engine.PopModelViewMatrix();
2153 }
2154
2155 ResetQueueDraw();
2156@@ -843,6 +838,28 @@
2157 QueueDraw();
2158 }
2159
2160+ void Layout::GatherRedirectedViewForRendering(GraphicsEngine& graphics_engine)
2161+ {
2162+ if (IsVisible() && GetRedirectRenderingToTexture() && GetPresentRedirectedView())
2163+ {
2164+ // Go through the children of this layout and add redirected view for post-rendering composition.
2165+ std::list<Area *>::iterator it;
2166+ for (it = _layout_element_list.begin(); it != _layout_element_list.end(); it++)
2167+ {
2168+ (*it)->GatherRedirectedViewForRendering(graphics_engine);
2169+ }
2170+
2171+ RedirectedArea ra;
2172+ ra.backup_texture = backup_texture_;
2173+ ra.geometry = GetAbsoluteGeometry();
2174+ ra.clipping_region = graphics_engine.GetClippingRegion();
2175+ ra.area = this;
2176+
2177+ // Queue this area for post-rendering composition.
2178+ GetWindowCompositor().QueueRedirected(ra);
2179+ }
2180+ }
2181+
2182 #ifdef NUX_GESTURES_SUPPORT
2183 Area* Layout::GetInputAreaHitByGesture(const GestureEvent &event)
2184 {
2185
2186=== modified file 'Nux/Layout.h'
2187--- Nux/Layout.h 2012-11-05 21:31:06 +0000
2188+++ Nux/Layout.h 2012-12-17 15:42:23 +0000
2189@@ -25,7 +25,7 @@
2190
2191 namespace nux
2192 {
2193-
2194+ class View;
2195 #define DEBUG_LAYOUT 0
2196 #define DEBUG_LAYOUT_COMPUTATION 0
2197
2198@@ -256,22 +256,23 @@
2199 #ifdef NUX_GESTURES_SUPPORT
2200 virtual Area* GetInputAreaHitByGesture(const GestureEvent &event);
2201 #endif
2202-
2203+
2204 /*!
2205 When a layout goes through Layout::ProcessDraw, this call isn't necessary. Otherwise, call it
2206 to set the value of draw_cmd_queued_ to false.
2207 */
2208- virtual void ResetQueueDraw();
2209+ virtual void ResetQueueDraw();
2210
2211 protected:
2212 void BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
2213 void EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
2214+ virtual void GatherRedirectedViewForRendering(GraphicsEngine& graphics_engine);
2215
2216 virtual void GeometryChangePending(bool position_about_to_change, bool size_about_to_change);
2217 virtual void GeometryChanged(bool position_has_changed, bool size_has_changed);
2218
2219 virtual bool AcceptKeyNavFocus();
2220-
2221+
2222 bool draw_cmd_queued_; //<! The rendering of the layout needs to be refreshed.
2223 bool child_draw_cmd_queued_; //<! A child of this layout has requested a draw.
2224
2225@@ -297,6 +298,7 @@
2226 std::string m_name;
2227
2228 LayoutContentDistribution m_ContentStacking;
2229+ friend class View;
2230 };
2231
2232
2233
2234=== modified file 'Nux/LinearLayout.h'
2235--- Nux/LinearLayout.h 2011-10-11 13:55:55 +0000
2236+++ Nux/LinearLayout.h 2012-12-17 15:42:23 +0000
2237@@ -33,7 +33,7 @@
2238 NUX_DECLARE_OBJECT_TYPE(LinearLayout, Layout);
2239 public:
2240 virtual void AddLayout(Layout *, unsigned int stretchFactor = 1, MinorDimensionPosition = eAbove, MinorDimensionSize extend = eFull, float percentage = 100.0f, LayoutPosition = NUX_LAYOUT_END);
2241-
2242+
2243 //! Add an object to the layout.
2244 /*! Add an object to the layout.
2245 A baseobject minor dimension with respect to a layout object is the dimension opposite to the layout flow.
2246@@ -60,7 +60,7 @@
2247 */
2248 virtual void AddView(Area *baseobject, unsigned int stretchFactor = 1, MinorDimensionPosition positioning = eAbove, MinorDimensionSize extend = eFull, float percentage = 100.0f, LayoutPosition index = NUX_LAYOUT_END);
2249 virtual void AddSpace(unsigned int width, unsigned int stretchFactor = 0, LayoutPosition index = NUX_LAYOUT_END);
2250-
2251+
2252
2253 //! Deprecated. Use SetSpaceBetweenChildren;
2254 void SetHorizontalInternalMargin(int space);
2255
2256=== modified file 'Nux/Makefile.am'
2257--- Nux/Makefile.am 2012-12-04 19:36:00 +0000
2258+++ Nux/Makefile.am 2012-12-17 15:42:23 +0000
2259@@ -113,6 +113,7 @@
2260 $(srcdir)/RangeValue.cpp \
2261 $(srcdir)/RangeValueInteger.cpp \
2262 $(srcdir)/RGBValuator.cpp \
2263+ $(srcdir)/SceneComposer.cpp \
2264 $(srcdir)/ScrollBar.cpp \
2265 $(srcdir)/ScrollView.cpp \
2266 $(srcdir)/SpinBox.cpp \
2267@@ -226,6 +227,7 @@
2268 $(srcdir)/RangeValueInteger.h \
2269 $(srcdir)/Readme.txt \
2270 $(srcdir)/RGBValuator.h \
2271+ $(srcdir)/SceneComposer.h \
2272 $(srcdir)/ScrollBar.h \
2273 $(srcdir)/ScrollView.h \
2274 $(srcdir)/SpinBox.h \
2275
2276=== modified file 'Nux/MenuBar.cpp'
2277--- Nux/MenuBar.cpp 2012-11-05 21:31:06 +0000
2278+++ Nux/MenuBar.cpp 2012-12-17 15:42:23 +0000
2279@@ -89,7 +89,7 @@
2280
2281 void MenuBar::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
2282 {
2283- Geometry base = GetGeometry();
2284+ Geometry base = GetNativeGeometry();
2285 graphics_engine.PushClippingRectangle(base);
2286
2287 Geometry item_geometry;
2288@@ -98,7 +98,8 @@
2289 for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++)
2290 {
2291 BasicView *area = (*it)->area;
2292- item_geometry = area->GetGeometry();
2293+ item_geometry = area->GetGeometryRelativeTo(this);
2294+ Geometry ageo = area->GetAbsoluteGeometry();
2295
2296 if (area->IsMouseInside())
2297 {
2298@@ -107,12 +108,14 @@
2299
2300 if (!m_MenuIsActive)
2301 {
2302- GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000));
2303+ //e GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000));
2304+ GetPainter().Paint2DQuadColor(graphics_engine, ageo, Color(0xFF000000));
2305 //GetPainter().PaintShape(graphics_engine, item_geometry, Color(0xFF000000), eSHAPE_CORNER_ROUND2);
2306 }
2307 else
2308 {
2309- GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000));
2310+ //e GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000));
2311+ GetPainter().Paint2DQuadColor(graphics_engine, ageo, Color(0xFF000000));
2312 //GetPainter().PaintShapeCorner(graphics_engine, item_geometry, Color(0xFF000000), eSHAPE_CORNER_ROUND2,
2313 //eCornerTopLeft|eCornerTopRight, false);
2314 }
2315@@ -127,7 +130,7 @@
2316 }
2317 else
2318 {
2319- GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), item_geometry, area->GetBaseString(), GetTextColor(), true, eAlignTextCenter);
2320+ GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), ageo, area->GetBaseString(), GetTextColor(), true, eAlignTextCenter);
2321 }
2322 }
2323 else
2324@@ -144,7 +147,7 @@
2325 }
2326 else
2327 {
2328- GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), item_geometry, area->GetBaseString(), GetTextColor(), true, eAlignTextCenter);
2329+ GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), ageo, area->GetBaseString(), GetTextColor(), true, eAlignTextCenter);
2330 }
2331 }
2332 }
2333@@ -152,9 +155,12 @@
2334 if (m_MenuIsActive)
2335 {
2336 BasicView *area = m_CurrentMenu->area;
2337- item_geometry = area->GetGeometry();
2338+ item_geometry = area->GetGeometryRelativeTo(this);
2339 GetPainter().PaintBackground(graphics_engine, item_geometry);
2340- GetPainter().Paint2DQuadColor(graphics_engine, item_geometry, Color(0xFF000000));
2341+
2342+ Geometry ageo = area->GetAbsoluteGeometry();
2343+
2344+ GetPainter().Paint2DQuadColor(graphics_engine, ageo, Color(0xFF000000));
2345 //GetPainter().PaintShapeCorner(graphics_engine, item_geometry, Color(0xFF000000), eSHAPE_CORNER_ROUND2, eCornerTopLeft|eCornerTopRight, true);
2346
2347 if (m_CurrentMenu->icon)
2348@@ -167,7 +173,7 @@
2349 }
2350 else
2351 {
2352- GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), item_geometry, area->GetBaseString(), GetTextColor(), true, eAlignTextCenter);
2353+ GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), ageo, area->GetBaseString(), GetTextColor(), true, eAlignTextCenter);
2354 }
2355 }
2356
2357@@ -176,7 +182,7 @@
2358
2359 void MenuBar::DrawContent(GraphicsEngine &graphics_engine, bool /* force_draw */)
2360 {
2361- graphics_engine.PushClippingRectangle(GetGeometry());
2362+ graphics_engine.PushClippingRectangle(GetNativeGeometry());
2363 graphics_engine.PopClippingRectangle();
2364 }
2365
2366@@ -334,27 +340,27 @@
2367 // // compute window coordinates x and y;
2368 // int winx = menubar_item->area->GetBaseX() + x;
2369 // int winy = menubar_item->area->GetBaseY() + y;
2370-//
2371+//
2372 // for (it = m_MenuBarItemList.begin(); it != m_MenuBarItemList.end(); it++)
2373 // {
2374 // BasicView *area = (*it)->area;
2375 // Geometry geometry = area->GetGeometry();
2376-//
2377+//
2378 // if (geometry.IsPointInside(winx, winy))
2379 // {
2380 // // Close the menu below menubar_item(the one that has the focus
2381 // menubar_item->area->ForceStopFocus(0, 0);
2382-//
2383+//
2384 // // EmitItemMouseEnter is going to open the menu below(*it)
2385 // {
2386 // EmitItemMouseEnter(winx, winy, button_flags, key_flags, (*it));
2387 // m_IsOpeningMenu = true;
2388 // area->ForceStartFocus(0, 0);
2389-//
2390+//
2391 // GetWindowThread()->GetWindowCompositor().SetMouseFocusArea(area);
2392 // GetWindowThread()->GetWindowCompositor().SetMouseOverArea(area);
2393 // }
2394-//
2395+//
2396 // break;
2397 // }
2398 // }
2399
2400=== modified file 'Nux/MenuPage.cpp'
2401--- Nux/MenuPage.cpp 2012-10-18 22:14:37 +0000
2402+++ Nux/MenuPage.cpp 2012-12-17 15:42:23 +0000
2403@@ -60,7 +60,7 @@
2404 {
2405 _child_menu = 0;
2406 _action_item = new ActionItem(label, UserValue, NUX_TRACKER_LOCATION);
2407-
2408+
2409 _pango_static_text = new StaticText(label, NUX_TRACKER_LOCATION);
2410 _pango_static_text->SetTextColor(Color(0.0f, 0.0f, 0.0f, 1.0f));
2411 }
2412@@ -148,7 +148,7 @@
2413
2414 void MenuItem::DrawAsMenuItem(GraphicsEngine &graphics_engine, const Color & /* textcolor */, bool is_highlighted, bool /* isFirstItem */, bool /* isLastItem */, bool /* draw_icone */)
2415 {
2416- Geometry geo = GetGeometry();
2417+ Geometry geo = GetAbsoluteGeometry();
2418 Geometry icon_geo(0, 0, 20, 20);
2419 Geometry text_geo = geo;
2420
2421@@ -208,10 +208,10 @@
2422
2423 void MenuSeparator::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
2424 {
2425- Geometry base = GetGeometry();
2426- int y0 = base.y + base.GetHeight() / 2;
2427- GetPainter().Draw2DLine(graphics_engine, base.x, y0, base.x + base.GetWidth(), y0, Color(0xFF222222));
2428- GetPainter().Draw2DLine(graphics_engine, base.x, y0 + 1, base.x + base.GetWidth(), y0 + 1, Color(0xFFAAAAAA));
2429+ Geometry base = GetAbsoluteGeometry();
2430+ int y0 = base.y + base.height / 2;
2431+ GetPainter().Draw2DLine(graphics_engine, base.x, y0, base.x + base.width, y0, Color(0xFF222222));
2432+ GetPainter().Draw2DLine(graphics_engine, base.x, y0 + 1, base.x + base.width, y0 + 1, Color(0xFFAAAAAA));
2433 }
2434
2435 MenuPage::MenuPage(const char *title, NUX_FILE_LINE_DECL)
2436@@ -260,7 +260,7 @@
2437 MenuPage::~MenuPage()
2438 {
2439 // std::vector <MenuItem*>::iterator it;
2440-//
2441+//
2442 // for (it = m_MenuItemVector.begin(); it != m_MenuItemVector.end(); it++)
2443 // {
2444 // (*it)->UnReference();
2445@@ -301,7 +301,7 @@
2446 {
2447 if (m_IsActive)
2448 {
2449- Geometry base = GetGeometry();
2450+ Geometry base = GetAbsoluteGeometry();
2451 Geometry shadow;
2452 shadow = base;
2453 shadow.OffsetPosition(4, 4);
2454@@ -688,7 +688,7 @@
2455 m_numItem = 0;
2456 _vlayout->Clear();
2457 ComputeContentSize();
2458-
2459+
2460 //FIXME - Hack to fix a bug with the menu height not being reset after removing items
2461 Geometry base = GetGeometry();
2462 base.height = 0;
2463@@ -911,7 +911,7 @@
2464
2465 void MenuPage::StartMenu(int MenuXPosition, int MenuYPosition, int /* x*/, int /* y */, bool /* OverrideCurrentMenuChain */)
2466 {
2467- Geometry base = GetGeometry();
2468+ Geometry base = GetAbsoluteGeometry();
2469 base.SetX(MenuXPosition);
2470 base.SetY(MenuYPosition);
2471
2472
2473=== modified file 'Nux/NumericValuator.cpp'
2474--- Nux/NumericValuator.cpp 2012-10-10 22:46:50 +0000
2475+++ Nux/NumericValuator.cpp 2012-12-17 15:42:23 +0000
2476@@ -74,13 +74,13 @@
2477
2478 void NumericValuator::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
2479 {
2480- Geometry base = GetGeometry();
2481+ Geometry base = GetNativeGeometry();
2482
2483 GeometryPositioning gp(eHALeft, eVACenter);
2484- Geometry GeoPo = ComputeGeometryPositioning(m_SpinnerUpBtn->GetGeometry(), GetTheme().GetImageGeometry(eTRIANGLE_RIGHT), gp);
2485+ Geometry GeoPo = ComputeGeometryPositioning(m_SpinnerUpBtn->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eTRIANGLE_RIGHT), gp);
2486 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eTRIANGLE_RIGHT);
2487
2488- GeoPo = ComputeGeometryPositioning(m_SpinnerDownBtn->GetGeometry(), GetTheme().GetImageGeometry(eTRIANGLE_LEFT), gp);
2489+ GeoPo = ComputeGeometryPositioning(m_SpinnerDownBtn->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eTRIANGLE_LEFT), gp);
2490 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eTRIANGLE_LEFT);
2491
2492 m_EditLine->QueueDraw();
2493
2494=== modified file 'Nux/PaintLayer.cpp'
2495--- Nux/PaintLayer.cpp 2012-11-05 21:31:06 +0000
2496+++ Nux/PaintLayer.cpp 2012-12-17 15:42:23 +0000
2497@@ -50,7 +50,7 @@
2498 graphics_engine.GetRenderStates().GetColorMask(current_red_mask, current_green_mask, current_blue_mask, current_alpha_mask);
2499 // Get the current blend states. They will be restored later.
2500 graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
2501-
2502+
2503 graphics_engine.GetRenderStates().SetColorMask(GL_TRUE, GL_TRUE, GL_TRUE, m_write_alpha ? GL_TRUE : GL_FALSE);
2504 graphics_engine.GetRenderStates().SetBlend(m_rop.Blend, m_rop.SrcBlend, m_rop.DstBlend);
2505 graphics_engine.QRP_Color(geometry_.x, geometry_.y, geometry_.GetWidth(), geometry_.GetHeight(), _color);
2506@@ -135,7 +135,7 @@
2507 }
2508
2509 /////////////////////////////////////////////////////
2510-
2511+
2512 CompositionLayer::CompositionLayer (ObjectPtr <IOpenGLBaseTexture> texture0, TexCoordXForm texxform0, const Color& color0,
2513 ObjectPtr <IOpenGLBaseTexture> texture1, TexCoordXForm texxform1, const Color& color1,
2514 LayerBlendMode layer_blend_mode, bool write_alpha, const ROPConfig& ROP)
2515@@ -179,7 +179,7 @@
2516 }
2517
2518 CompositionLayer::CompositionLayer(const Color& base_color, const Color& blend_color, LayerBlendMode layer_blend_mode,
2519- bool write_alpha, const ROPConfig& ROP)
2520+ bool write_alpha, const ROPConfig& ROP)
2521 : m_source_color(base_color),
2522 m_foreground_color(blend_color),
2523 m_write_alpha(write_alpha),
2524@@ -205,14 +205,14 @@
2525 unsigned int current_green_mask;
2526 unsigned int current_blue_mask;
2527 unsigned int current_alpha_mask;
2528-
2529+
2530 // Get the current color mask and blend states. They will be restored later.
2531 graphics_engine.GetRenderStates().GetColorMask(current_red_mask, current_green_mask, current_blue_mask, current_alpha_mask);
2532 graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
2533
2534 graphics_engine.GetRenderStates().SetColorMask(GL_TRUE, GL_TRUE, GL_TRUE, m_write_alpha ? GL_TRUE : GL_FALSE);
2535 graphics_engine.GetRenderStates().SetBlend(m_rop.Blend, m_rop.SrcBlend, m_rop.DstBlend);
2536-
2537+
2538 if (m_source_texture.IsValid())
2539 {
2540 if (m_foreground_texture.IsValid())
2541@@ -268,7 +268,7 @@
2542 m_color_blend_mode(LAYER_BLEND_MODE_LAST)
2543 {
2544 }
2545-
2546+
2547 TextureLayer::TextureLayer(ObjectPtr<IOpenGLBaseTexture> device_texture, TexCoordXForm texxform, const Color& color0,
2548 bool write_alpha, const ROPConfig& ROP, const Color& blend_color, LayerBlendMode color_blend_mode)
2549 : m_device_texture(device_texture),
2550
2551=== modified file 'Nux/Panel.cpp'
2552--- Nux/Panel.cpp 2012-10-26 10:49:31 +0000
2553+++ Nux/Panel.cpp 2012-12-17 15:42:23 +0000
2554@@ -52,13 +52,13 @@
2555
2556 void Panel::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
2557 {
2558- graphics_engine.PushClippingRectangle(GetGeometry());
2559+ graphics_engine.PushClippingRectangle(GetNativeGeometry());
2560
2561 graphics_engine.PushClippingRectangle(Rect(m_ViewX, m_ViewY, m_ViewWidth, m_ViewHeight));
2562
2563 if (m_layout)
2564 {
2565- graphics_engine.PushClippingRectangle(m_layout->GetGeometry());
2566+ graphics_engine.PushClippingRectangle(m_layout->GetNativeGeometry());
2567 m_layout->ProcessDraw(graphics_engine, force_draw);
2568 graphics_engine.PopClippingRectangle();
2569 }
2570
2571=== modified file 'Nux/RGBValuator.cpp'
2572--- Nux/RGBValuator.cpp 2012-11-05 21:31:06 +0000
2573+++ Nux/RGBValuator.cpp 2012-12-17 15:42:23 +0000
2574@@ -300,10 +300,11 @@
2575 if (m_color_model == color::HLS)
2576 percent = hls_.hue;
2577
2578- graphics_engine.PushClippingRectangle(red_valuator_->GetGeometry());
2579+ Geometry relative_geo = red_valuator_->GetGeometryRelativeTo(this);
2580+ graphics_engine.PushClippingRectangle(relative_geo);
2581
2582- marker_position_x = red_valuator_->GetBaseX() + percent * red_valuator_->GetBaseWidth();
2583- marker_position_y = red_valuator_->GetBaseY() + red_valuator_->GetBaseHeight();
2584+ marker_position_x = relative_geo.x + percent * red_valuator_->GetBaseWidth();
2585+ marker_position_y = relative_geo.y + red_valuator_->GetBaseHeight();
2586 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x - 5, marker_position_y,
2587 marker_position_x, marker_position_y - 5,
2588 marker_position_x + 5, marker_position_y, Color(0xFF000000));
2589@@ -331,10 +332,11 @@
2590 if (m_color_model == color::HLS)
2591 percent = hls_.lightness;
2592
2593- graphics_engine.PushClippingRectangle(green_valuator_->GetGeometry());
2594+ Geometry relative_geo = green_valuator_->GetGeometryRelativeTo(this);
2595+ graphics_engine.PushClippingRectangle(relative_geo);
2596
2597- marker_position_x = green_valuator_->GetBaseX() + percent * green_valuator_->GetBaseWidth();
2598- marker_position_y = green_valuator_->GetBaseY() + green_valuator_->GetBaseHeight();
2599+ marker_position_x = relative_geo.x + percent * green_valuator_->GetBaseWidth();
2600+ marker_position_y = relative_geo.y + green_valuator_->GetBaseHeight();
2601 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x - 5, marker_position_y,
2602 marker_position_x, marker_position_y - 5,
2603 marker_position_x + 5, marker_position_y, Color(0.0f, 0.0f, 0.0f, 1.0f));
2604@@ -362,10 +364,11 @@
2605 if (m_color_model == color::HLS)
2606 percent = hls_.saturation;
2607
2608- graphics_engine.PushClippingRectangle(blue_valuator_->GetGeometry());
2609+ Geometry relative_geo = blue_valuator_->GetGeometryRelativeTo(this);
2610+ graphics_engine.PushClippingRectangle(relative_geo);
2611
2612- marker_position_x = blue_valuator_->GetBaseX() + percent * blue_valuator_->GetBaseWidth();
2613- marker_position_y = blue_valuator_->GetBaseY() + blue_valuator_->GetBaseHeight();
2614+ marker_position_x = relative_geo.x + percent * blue_valuator_->GetBaseWidth();
2615+ marker_position_y = relative_geo.y + blue_valuator_->GetBaseHeight();
2616 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x - 5, marker_position_y,
2617 marker_position_x, marker_position_y - 5,
2618 marker_position_x + 5, marker_position_y, Color(0.0f, 0.0f, 0.0f, 1.0f));
2619@@ -382,10 +385,11 @@
2620 int marker_position_x;
2621 int marker_position_y;
2622
2623- graphics_engine.PushClippingRectangle(alpha_valuator_->GetGeometry());
2624+ Geometry relative_geo = alpha_valuator_->GetGeometryRelativeTo(this);
2625+ graphics_engine.PushClippingRectangle(relative_geo);
2626
2627- marker_position_x = alpha_valuator_->GetBaseX() + alpha_ * alpha_valuator_->GetBaseWidth();
2628- marker_position_y = alpha_valuator_->GetBaseY() + alpha_valuator_->GetBaseHeight();
2629+ marker_position_x = relative_geo.x + alpha_ * alpha_valuator_->GetBaseWidth();
2630+ marker_position_y = relative_geo.y + alpha_valuator_->GetBaseHeight();
2631 GetPainter().Draw2DTriangleColor(graphics_engine, marker_position_x - 5, marker_position_y,
2632 marker_position_x, marker_position_y - 5,
2633 marker_position_x + 5, marker_position_y, Color(0.0f, 0.0f, 0.0f, 1.0f));
2634@@ -399,10 +403,37 @@
2635
2636 void RGBValuator::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
2637 {
2638- Geometry base = GetGeometry();
2639-
2640- graphics_engine.PushClippingRectangle(base);
2641- GetPainter().PushDrawShapeLayer(graphics_engine, vlayout->GetGeometry(), eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true);
2642+ Geometry base = GetNativeGeometry();
2643+
2644+ // Set clipping region for this view
2645+ graphics_engine.PushClippingRectangle(base);
2646+
2647+ // Draw rounded rectangle background.
2648+ GetPainter().PaintShape(graphics_engine, vlayout->GetGeometry(), Color(0xFF000000), eSHAPE_CORNER_ROUND4, true);
2649+
2650+ graphics_engine.PopClippingRectangle();
2651+ }
2652+
2653+ void RGBValuator::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
2654+ {
2655+ Geometry base = GetNativeGeometry();
2656+ // Set clipping region for this view
2657+ graphics_engine.PushClippingRectangle(base);
2658+
2659+ GetPainter().PushShapeLayer(graphics_engine, vlayout->GetGeometry(), eSHAPE_CORNER_ROUND4, Color(0xFF000000), eAllCorners, true);
2660+
2661+ // Draw the widgets inside this view. BasicView widget don't do any drawing.
2662+ GetLayout()->ProcessDraw(graphics_engine, force_draw);
2663+
2664+ // Draw BasicViews and other elements
2665+ Geometry relative_geo = m_ComponentLabel0->GetGeometryRelativeTo(this);
2666+ GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), relative_geo, m_ComponentLabel0->GetBaseString(), Color(0xFFFFFFFF));
2667+ relative_geo = m_ComponentLabel1->GetGeometryRelativeTo(this);
2668+ GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), relative_geo, m_ComponentLabel1->GetBaseString(), Color(0xFFFFFFFF));
2669+ relative_geo = m_ComponentLabel2->GetGeometryRelativeTo(this);
2670+ GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), relative_geo, m_ComponentLabel2->GetBaseString(), Color(0xFFFFFFFF));
2671+ relative_geo = m_ComponentAlpha->GetGeometryRelativeTo(this);
2672+ GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), relative_geo, m_ComponentAlpha->GetBaseString(), Color(0xFFFFFFFF));
2673
2674 if (m_color_model == color::RGB)
2675 {
2676@@ -417,11 +448,6 @@
2677 DrawHLS(graphics_engine);
2678 }
2679
2680- GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), m_ComponentLabel0->GetGeometry(), m_ComponentLabel0->GetBaseString(), Color(0xFFFFFFFF));
2681- GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), m_ComponentLabel1->GetGeometry(), m_ComponentLabel1->GetBaseString(), Color(0xFFFFFFFF));
2682- GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), m_ComponentLabel2->GetGeometry(), m_ComponentLabel2->GetBaseString(), Color(0xFFFFFFFF));
2683- GetPainter().PaintTextLineStatic(graphics_engine, GetSysBoldFont(), m_ComponentAlpha->GetGeometry(), m_ComponentAlpha->GetBaseString(), Color(0xFFFFFFFF));
2684-
2685 DrawRedMarker(graphics_engine);
2686 DrawGreenMarker(graphics_engine);
2687 DrawBlueMarker(graphics_engine);
2688@@ -431,40 +457,25 @@
2689 graphics_engine.PopClippingRectangle();
2690 }
2691
2692- void RGBValuator::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
2693- {
2694- Geometry base = GetGeometry();
2695- graphics_engine.PushClippingRectangle(base);
2696-
2697- red_caption_->ProcessDraw(graphics_engine, force_draw);
2698- green_caption_->ProcessDraw(graphics_engine, force_draw);
2699- blue_caption_->ProcessDraw(graphics_engine, force_draw);
2700- alpha_caption_->ProcessDraw(graphics_engine, force_draw);
2701-
2702- m_ColorModel->ProcessDraw(graphics_engine, force_draw); // the button has round corner. That is why we need to push the background.
2703- m_ColorFormat->ProcessDraw(graphics_engine, force_draw); // the button has round corner. That is why we need to push the background.
2704- graphics_engine.PopClippingRectangle();
2705- }
2706-
2707 void RGBValuator::DrawRGB(GraphicsEngine &graphics_engine)
2708 {
2709 // Red
2710- Geometry P = red_valuator_->GetGeometry();
2711+ Geometry P = red_valuator_->GetGeometryRelativeTo(this);
2712 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(0.0f, rgb_.green, rgb_.blue), Color(0.0f, rgb_.green, rgb_.blue),
2713 Color(1.0f, rgb_.green, rgb_.blue), Color(1.0f, rgb_.green, rgb_.blue));
2714
2715 // Green
2716- P = green_valuator_->GetGeometry();
2717+ P = green_valuator_->GetGeometryRelativeTo(this);
2718 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb_.red, 0.0f, rgb_.blue), Color(rgb_.red, 0.0f, rgb_.blue),
2719 Color(rgb_.red, 1.0f, rgb_.blue), Color(rgb_.red, 1.0f, rgb_.blue));
2720
2721 // Blue
2722- P = blue_valuator_->GetGeometry();
2723+ P = blue_valuator_->GetGeometryRelativeTo(this);
2724 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb_.red, rgb_.green, 0.0f), Color(rgb_.red, rgb_.green, 0.0f),
2725 Color(rgb_.red, rgb_.green, 1.0f), Color(rgb_.red, rgb_.green, 1.0f));
2726
2727 // Alpha
2728- P = alpha_valuator_->GetGeometry();
2729+ P = alpha_valuator_->GetGeometryRelativeTo(this);
2730 m_CheckboardLayer->SetGeometry(P);
2731 m_CheckboardLayer->Renderlayer(graphics_engine);
2732
2733@@ -473,18 +484,15 @@
2734 Color(rgb_.red, rgb_.green, rgb_.blue, 1.0f), Color(rgb_.red, rgb_.green, rgb_.blue, 1.0f));
2735 graphics_engine.GetRenderStates().SetBlend(false);
2736
2737- P = color_square_->GetGeometry();
2738+ P = color_square_->GetGeometryRelativeTo(this);
2739 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb_.red, rgb_.green, rgb_.blue), Color(rgb_.red, rgb_.green, rgb_.blue),
2740 Color(rgb_.red, rgb_.green, rgb_.blue), Color(rgb_.red, rgb_.green, rgb_.blue));
2741-
2742- m_ColorModel->ProcessDraw(graphics_engine, true);
2743- m_ColorFormat->ProcessDraw(graphics_engine, true);
2744 }
2745
2746 void RGBValuator::DrawHSV(GraphicsEngine &graphics_engine)
2747 {
2748 // Red
2749- Geometry P = red_valuator_->GetGeometry();
2750+ Geometry P = red_valuator_->GetGeometryRelativeTo(this);
2751 float s = 0; //XSI: 1.0f - hsv_.saturation;
2752 float v = 1; //XSI: hsv_.value;
2753 float fw = P.GetWidth() / 6;
2754@@ -516,18 +524,18 @@
2755 Color value_gray(v, v, v);
2756 Color value_color(Color(rgb) * v);
2757 // Green
2758- P = green_valuator_->GetGeometry();
2759+ P = green_valuator_->GetGeometryRelativeTo(this);
2760 GetPainter().Paint2DQuadColor(graphics_engine, P, value_gray, value_gray, value_color, value_color);
2761
2762 rgb = color::RedGreenBlue(color::HueSaturationValue(hue, hsv_.saturation, 1));
2763 // Blue
2764- P = blue_valuator_->GetGeometry();
2765+ P = blue_valuator_->GetGeometryRelativeTo(this);
2766 GetPainter().Paint2DQuadColor(graphics_engine, P, color::Black, color::Black, Color(rgb), Color(rgb));
2767
2768 rgb = color::RedGreenBlue(color::HueSaturationValue(hue, hsv_.saturation, hsv_.value));
2769
2770 // Alpha
2771- P = alpha_valuator_->GetGeometry();
2772+ P = alpha_valuator_->GetGeometryRelativeTo(this);
2773 m_CheckboardLayer->SetGeometry(P);
2774 m_CheckboardLayer->Renderlayer(graphics_engine);
2775
2776@@ -535,17 +543,14 @@
2777 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));
2778 graphics_engine.GetRenderStates().SetBlend(false);
2779
2780- P = color_square_->GetGeometry();
2781+ P = color_square_->GetGeometryRelativeTo(this);
2782 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb));
2783-
2784- m_ColorModel->ProcessDraw(graphics_engine, true);
2785- m_ColorFormat->ProcessDraw(graphics_engine, true);
2786 }
2787
2788 void RGBValuator::DrawHLS(GraphicsEngine &graphics_engine)
2789 {
2790 // Red
2791- Geometry P = red_valuator_->GetGeometry();
2792+ Geometry P = red_valuator_->GetGeometryRelativeTo(this);
2793 float s = 0; //XSI: 1.0f - hls_.saturation;
2794 float l = 1; //XSI: hls_.lightness;
2795 float fw = P.GetWidth() / 6;
2796@@ -585,7 +590,7 @@
2797 float b = rgb.blue;
2798
2799 // Green
2800- P = green_valuator_->GetGeometry();
2801+ P = green_valuator_->GetGeometryRelativeTo(this);
2802 fw = P.GetWidth() / 2;
2803 p = Geometry(P.x, P.y, fw, P.GetHeight());
2804 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));
2805@@ -612,7 +617,7 @@
2806 cb = (factor) * b * (1 - s) + 0.5 * s;
2807 }
2808
2809- P = blue_valuator_->GetGeometry();
2810+ P = blue_valuator_->GetGeometryRelativeTo(this);
2811 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(l, l, l), Color(l, l, l), Color(cr, cg, cb), Color(cr, cg, cb));
2812
2813 // TODO: Tim Penhey 2011-05-13
2814@@ -620,7 +625,7 @@
2815 rgb = color::RedGreenBlue(hls_);
2816
2817 // Alpha
2818- P = alpha_valuator_->GetGeometry();
2819+ P = alpha_valuator_->GetGeometryRelativeTo(this);
2820 m_CheckboardLayer->SetGeometry(P);
2821 m_CheckboardLayer->Renderlayer(graphics_engine);
2822
2823@@ -628,11 +633,8 @@
2824 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));
2825 graphics_engine.GetRenderStates().SetBlend(false);
2826
2827- P = color_square_->GetGeometry();
2828+ P = color_square_->GetGeometryRelativeTo(this);
2829 GetPainter().Paint2DQuadColor(graphics_engine, P, Color(rgb));
2830-
2831- m_ColorModel->ProcessDraw(graphics_engine, true);
2832- m_ColorFormat->ProcessDraw(graphics_engine, true);
2833 }
2834
2835 void RGBValuator::SetRGBA(Color const& color)
2836
2837=== modified file 'Nux/RadioButton.cpp'
2838--- Nux/RadioButton.cpp 2012-11-05 21:31:06 +0000
2839+++ Nux/RadioButton.cpp 2012-12-17 15:42:23 +0000
2840@@ -29,7 +29,7 @@
2841 namespace nux
2842 {
2843 NUX_IMPLEMENT_OBJECT_TYPE(RadioButton);
2844-
2845+
2846 RadioButton::RadioButton(const std::string& str, bool state, NUX_FILE_LINE_DECL)
2847 : AbstractCheckedButton(str, state, NUX_FILE_LINE_PARAM)
2848 {
2849@@ -53,7 +53,7 @@
2850
2851 void RadioButton::Draw(GraphicsEngine& graphics_engine, bool /* force_draw */)
2852 {
2853- Geometry base = GetGeometry();
2854+ Geometry base = GetNativeGeometry();
2855 graphics_engine.PushClippingRectangle(base);
2856
2857 InteractState is;
2858@@ -73,13 +73,11 @@
2859 is.is_prelight = false;
2860 }
2861
2862- GetPainter().PushPaintLayerStack();
2863 {
2864- GetPainter().PaintRadioButton(graphics_engine, check_area_->GetGeometry(), is, Color(0xff000000));
2865+ GetPainter().PaintRadioButton(graphics_engine, check_area_->GetGeometryRelativeTo(this), is, Color(0xff000000));
2866 static_text_->ProcessDraw(graphics_engine, true);
2867 }
2868- GetPainter().PopPaintLayerStack();
2869-
2870+
2871 graphics_engine.PopClippingRectangle();
2872 }
2873
2874
2875=== modified file 'Nux/RangeValue.cpp'
2876--- Nux/RangeValue.cpp 2012-11-05 21:31:06 +0000
2877+++ Nux/RangeValue.cpp 2012-12-17 15:42:23 +0000
2878@@ -97,7 +97,7 @@
2879 int marker_position_x;
2880 int marker_position_y;
2881
2882- graphics_engine.PushClippingRectangle(m_Percentage->GetGeometry());
2883+ graphics_engine.PushClippingRectangle(m_Percentage->GetGeometryRelativeTo(this));
2884
2885 marker_position_x = m_Percentage->GetBaseX() + (m_Value - m_min) * m_Percentage->GetBaseWidth() * 1 / (m_max - m_min);
2886 marker_position_y = m_Percentage->GetBaseY() + m_Percentage->GetBaseHeight();
2887@@ -115,10 +115,10 @@
2888
2889 void RangeValue::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
2890 {
2891- Geometry base = GetGeometry();
2892+ Geometry base = GetNativeGeometry();
2893
2894 // Percentage
2895- Geometry P = m_Percentage->GetGeometry();
2896+ Geometry P = m_Percentage->GetGeometryRelativeTo(this);
2897 GetPainter().Paint2DQuadColor(graphics_engine, P, m_StartColor, m_StartColor, m_EndColor, m_EndColor);
2898
2899 if (m_EnableDrawProgress)
2900
2901=== modified file 'Nux/RangeValueInteger.cpp'
2902--- Nux/RangeValueInteger.cpp 2012-11-05 21:31:06 +0000
2903+++ Nux/RangeValueInteger.cpp 2012-12-17 15:42:23 +0000
2904@@ -96,7 +96,7 @@
2905 int marker_position_x;
2906 int marker_position_y;
2907
2908- graphics_engine.PushClippingRectangle(m_Percentage->GetGeometry());
2909+ graphics_engine.PushClippingRectangle(m_Percentage->GetGeometryRelativeTo(this));
2910
2911 marker_position_x = m_Percentage->GetBaseX() + (m_MarkerPosition - m_min) * m_Percentage->GetBaseWidth() * 1 / (m_max - m_min);
2912 marker_position_y = m_Percentage->GetBaseY() + m_Percentage->GetBaseHeight();
2913@@ -113,10 +113,10 @@
2914
2915 void RangeValueInteger::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
2916 {
2917- Geometry base = GetGeometry();
2918+ Geometry base = GetNativeGeometry();
2919
2920 // Percentage
2921- Geometry P = m_Percentage->GetGeometry();
2922+ Geometry P = m_Percentage->GetGeometryRelativeTo(this);
2923 GetPainter().Paint2DQuadColor(graphics_engine, P, m_StartColor, m_StartColor, m_EndColor, m_EndColor);
2924
2925 if (m_EnableDrawProgress)
2926
2927=== added file 'Nux/SceneComposer.cpp'
2928--- Nux/SceneComposer.cpp 1970-01-01 00:00:00 +0000
2929+++ Nux/SceneComposer.cpp 2012-12-17 15:42:23 +0000
2930@@ -0,0 +1,111 @@
2931+/*
2932+ * Copyright 2012 Inalogic® Inc.
2933+ *
2934+ * This program is free software: you can redistribute it and/or modify it
2935+ * under the terms of the GNU Lesser General Public License, as
2936+ * published by the Free Software Foundation; either version 2.1 or 3.0
2937+ * of the License.
2938+ *
2939+ * This program is distributed in the hope that it will be useful, but
2940+ * WITHOUT ANY WARRANTY; without even the implied warranties of
2941+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
2942+ * PURPOSE. See the applicable version of the GNU Lesser General Public
2943+ * License for more details.
2944+ *
2945+ * You should have received a copy of both the GNU Lesser General Public
2946+ * License along with this program. If not, see <http://www.gnu.org/licenses/>
2947+ *
2948+ * Authored by: Jay Taoko <jaytaoko@inalogic.com>
2949+ *
2950+ */
2951+
2952+#include "NuxGraphics/GraphicsEngine.h"
2953+#include "Nux.h"
2954+#include "SceneComposer.h"
2955+
2956+namespace nux
2957+{
2958+
2959+SceneComposer::SceneComposer()
2960+: graphics_engine_(NULL)
2961+, gpu_device_(NULL)
2962+, dst_texture_width(0)
2963+, dst_texture_height(0)
2964+{
2965+
2966+}
2967+
2968+SceneComposer::~SceneComposer()
2969+{
2970+
2971+}
2972+
2973+void SceneComposer::SetGraphicsObjects(GraphicsEngine* graphics_engine, GpuDevice* gpu_device)
2974+{
2975+ graphics_engine_ = graphics_engine;
2976+ gpu_device_ = gpu_device;
2977+}
2978+
2979+void SceneComposer::SetDestinationTexture(ObjectPtr<IOpenGLBaseTexture> rendering_surface_texture)
2980+{
2981+ rendering_surface_texture_ = rendering_surface_texture;
2982+}
2983+
2984+void SceneComposer::SetOrthoGraphicProjection()
2985+{
2986+ if (rendering_surface_texture_.IsValid())
2987+ {
2988+ dst_texture_width = rendering_surface_texture_->GetWidth();
2989+ dst_texture_height = rendering_surface_texture_->GetHeight();
2990+
2991+ if (fbo_.IsNull())
2992+ {
2993+ // Create the fbo before using it for the first time.
2994+ fbo_ = GetGraphicsDisplay()->GetGpuDevice()->CreateFrameBufferObject();
2995+ }
2996+
2997+ fbo_->FormatFrameBufferObject(dst_texture_width, dst_texture_height, rendering_surface_texture_->GetPixelFormat());
2998+ fbo_->SetTextureAttachment(0, rendering_surface_texture_, 0);
2999+ fbo_->SetDepthTextureAttachment(ObjectPtr<IOpenGLBaseTexture>(0), 0);
3000+ fbo_->Activate();
3001+
3002+ // Drawing to a texture!
3003+
3004+ graphics_engine_->EmptyClippingRegion();
3005+ graphics_engine_->SetOpenGLClippingRectangle(0, 0, dst_texture_width, dst_texture_height);
3006+ graphics_engine_->SetViewport(0, 0, dst_texture_width, dst_texture_height);
3007+ graphics_engine_->SetOrthographicProjectionMatrix(dst_texture_width, dst_texture_height);
3008+ }
3009+ else
3010+ {
3011+ // Whatever frame buffer is actevated, de-activate it.
3012+ gpu_device_->DeactivateFrameBuffer();
3013+
3014+ // Drawing to the backbuffer!
3015+
3016+ dst_texture_width = graphics_engine_->GetWindowWidth();
3017+ dst_texture_height = graphics_engine_->GetWindowHeight();
3018+ graphics_engine_->EmptyClippingRegion();
3019+ graphics_engine_->SetOpenGLClippingRectangle(0, 0, dst_texture_width, dst_texture_height);
3020+ graphics_engine_->SetViewport(0, 0, dst_texture_width, dst_texture_height);
3021+ graphics_engine_->SetOrthographicProjectionMatrix(dst_texture_width, dst_texture_height);
3022+ }
3023+}
3024+
3025+void SceneComposer::RenderTexture(ObjectPtr<IOpenGLBaseTexture> texture, Geometry geo, Geometry clip, float opacity, bool blend)
3026+{
3027+ if (graphics_engine_ == NULL)
3028+ return;
3029+
3030+ if (texture.IsNull())
3031+ return;
3032+
3033+ TexCoordXForm texxform0;
3034+ texxform0.FlipVCoord(true);
3035+
3036+ graphics_engine_->QRP_1Tex(geo.x, geo.y, geo.width, geo.height, texture, texxform0, Color(1.0f, 1.0f, 1.0f, opacity));
3037+}
3038+
3039+
3040+};
3041+
3042
3043=== added file 'Nux/SceneComposer.h'
3044--- Nux/SceneComposer.h 1970-01-01 00:00:00 +0000
3045+++ Nux/SceneComposer.h 2012-12-17 15:42:23 +0000
3046@@ -0,0 +1,78 @@
3047+/*
3048+ * Copyright 2012 Inalogic® Inc.
3049+ *
3050+ * This program is free software: you can redistribute it and/or modify it
3051+ * under the terms of the GNU Lesser General Public License, as
3052+ * published by the Free Software Foundation; either version 2.1 or 3.0
3053+ * of the License.
3054+ *
3055+ * This program is distributed in the hope that it will be useful, but
3056+ * WITHOUT ANY WARRANTY; without even the implied warranties of
3057+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
3058+ * PURPOSE. See the applicable version of the GNU Lesser General Public
3059+ * License for more details.
3060+ *
3061+ * You should have received a copy of both the GNU Lesser General Public
3062+ * License along with this program. If not, see <http://www.gnu.org/licenses/>
3063+ *
3064+ * Authored by: Jay Taoko <jaytaoko@inalogic.com>
3065+ *
3066+ */
3067+
3068+#ifndef SCENE_COMPOSER_H
3069+#define SCENE_COMPOSER_H
3070+
3071+namespace nux
3072+{
3073+
3074+//! SceneComposer does the final composition of the rendering.
3075+class SceneComposer
3076+{
3077+public:
3078+ SceneComposer();
3079+ ~SceneComposer();
3080+
3081+ //! Set the destination texture
3082+ /*!
3083+ If the texture is NULL, the destination is the back-buffer.
3084+ @param destination_texture Surface to render into.
3085+ */
3086+ void SetDestinationTexture(ObjectPtr<IOpenGLBaseTexture> destination_texture);
3087+
3088+ /*!
3089+ Set the graphics objects to use for the rendering.
3090+ @param graphics_engine The graphics engine to use.
3091+ @param gpu_device The gpu device engine to use.
3092+ */
3093+ void SetGraphicsObjects(GraphicsEngine* graphics_engine, GpuDevice* gpu_device);
3094+
3095+ /*!
3096+ Renders a texture on the destination surface.
3097+ @param texture Texture to render.
3098+ @param geo The quad geometry.
3099+ @param clip Clipping region.
3100+ @param opacity.
3101+ @param premultiply.
3102+ */
3103+ void RenderTexture(ObjectPtr<IOpenGLBaseTexture> texture, Geometry geo, Geometry clip, float opacity = 1.0f, bool premultiply = false);
3104+
3105+ /*!
3106+ Set the rendering matrices before drawing.
3107+ */
3108+ void SetOrthoGraphicProjection();
3109+
3110+private:
3111+ ObjectPtr<IOpenGLBaseTexture> rendering_surface_texture_;
3112+ ObjectPtr<IOpenGLFrameBufferObject> fbo_;
3113+
3114+ GraphicsEngine* graphics_engine_;
3115+ GpuDevice* gpu_device_;
3116+ int dst_texture_width;
3117+ int dst_texture_height;
3118+
3119+};
3120+
3121+}
3122+
3123+#endif // SCENE_COMPOSER_H
3124+
3125
3126=== modified file 'Nux/ScrollView.cpp'
3127--- Nux/ScrollView.cpp 2012-11-05 21:31:06 +0000
3128+++ Nux/ScrollView.cpp 2012-12-17 15:42:23 +0000
3129@@ -102,7 +102,6 @@
3130 &ScrollView::ScrollDown));
3131 _vscrollbar->mouse_wheel.connect(sigc::mem_fun(this,
3132 &ScrollView::RecvMouseWheel));
3133-
3134 _vscrollbar->UnReference();
3135 }
3136
3137@@ -140,11 +139,14 @@
3138 if (child->IsLayout())
3139 return;
3140
3141- int child_y = child->GetGeometry().y - GetGeometry().y;
3142+ Geometry cgeo = child->GetNativeGeometry();
3143+ Geometry base = GetGeometryRelativeTo(this);
3144+
3145+ int child_y = cgeo.y - base.y;
3146 int child_y_diff = child_y - abs(_delta_y);
3147
3148
3149- if (child_y_diff + child->GetGeometry().height < GetGeometry().height && child_y_diff >= 0)
3150+ if (child_y_diff + cgeo.height < base.height && child_y_diff >= 0)
3151 {
3152 return;
3153 }
3154@@ -155,10 +157,10 @@
3155 }
3156 else
3157 {
3158- int size = child_y_diff - GetGeometry().height;
3159+ int size = child_y_diff - base.height;
3160
3161 // always keeps the top of a view on the screen
3162- size += (child->GetGeometry().height, GetGeometry().height) ? child->GetGeometry().height : GetGeometry().height;
3163+ size += (cgeo.height, base.height) ? cgeo.height : base.height;
3164
3165 ScrollDown(1, size);
3166 }
3167@@ -218,9 +220,9 @@
3168
3169 void ScrollView::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
3170 {
3171- graphics_engine.PushClippingRectangle(GetGeometry());
3172+ graphics_engine.PushClippingRectangle(GetNativeGeometry());
3173
3174- Geometry base = GetGeometry();
3175+ Geometry base = GetNativeGeometry();
3176
3177 if (view_layout_)
3178 view_layout_->QueueDraw();
3179@@ -244,8 +246,8 @@
3180 {
3181 if (IsFullRedraw())
3182 GetPainter().PushBackgroundStack();
3183-
3184- graphics_engine.PushClippingRectangle(GetGeometry());
3185+
3186+ graphics_engine.PushClippingRectangle(GetNativeGeometry());
3187
3188 graphics_engine.PushClippingRectangle(Rect(m_ViewX, m_ViewY, m_ViewWidth, m_ViewHeight));
3189
3190@@ -306,7 +308,7 @@
3191 void ScrollView::FormatContent()
3192 {
3193 Geometry geo;
3194- geo = GetGeometry();
3195+ geo = GetNativeGeometry();
3196
3197 ComputeContentSize();
3198 }
3199@@ -315,15 +317,15 @@
3200 {
3201 // Give the managed layout the same size and position as the Control.
3202
3203- Geometry geo = GetGeometry();
3204+ Geometry geo = GetNativeGeometry();
3205 int ScrollBarWidth = _vscrollbar->GetBaseWidth();
3206 int ScrollBarHeight = _hscrollbar->GetBaseHeight();
3207
3208 nuxAssertMsg(ScrollBarWidth > 0, "[ScrollView::PreLayoutManagement] Invalid scrollbar width: %d", ScrollBarWidth);
3209 nuxAssertMsg(ScrollBarHeight > 0, "[ScrollView::PreLayoutManagement] Invalid scrollbar height: %d", ScrollBarHeight);
3210
3211- m_ViewX = GetBaseX() + m_border + m_ViewContentLeftMargin;
3212- m_ViewY = GetBaseY() + m_top_border + m_ViewContentTopMargin;
3213+ m_ViewX = GetNativeX() + m_border + m_ViewContentLeftMargin;
3214+ m_ViewY = GetNativeY() + m_top_border + m_ViewContentTopMargin;
3215
3216 if (m_vertical_scrollbar_enable == false)
3217 m_ViewWidth = GetBaseWidth() - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin;
3218@@ -443,8 +445,8 @@
3219 if (m_vertical_scrollbar_enable)
3220 ScrollBarWidth = _vscrollbar->GetBaseWidth();
3221
3222- _hscrollbar->SetContainerSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3223- GetBaseY() + m_top_border + m_ViewContentTopMargin,
3224+ _hscrollbar->SetContainerSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3225+ GetNativeY() + m_top_border + m_ViewContentTopMargin,
3226 GetBaseWidth() - ScrollBarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
3227 GetBaseHeight() - ScrollBarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
3228
3229@@ -457,21 +459,21 @@
3230 }
3231 else
3232 {
3233- _hscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3234- GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3235+ _hscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3236+ GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3237 }
3238
3239 _hscrollbar->SetContentOffset(_delta_x, _delta_y);
3240 }
3241 else
3242 {
3243- _hscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3244- GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3245+ _hscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3246+ GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3247 _hscrollbar->SetContentOffset(0, 0);
3248 }
3249
3250- _vscrollbar->SetContainerSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3251- GetBaseY() + m_top_border + m_ViewContentTopMargin,
3252+ _vscrollbar->SetContainerSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3253+ GetNativeY() + m_top_border + m_ViewContentTopMargin,
3254 GetBaseWidth() - ScrollBarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
3255 GetBaseHeight() - ScrollBarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
3256
3257@@ -484,16 +486,16 @@
3258 }
3259 else
3260 {
3261- _vscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3262- GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3263+ _vscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3264+ GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3265 }
3266
3267 _vscrollbar->SetContentOffset(_delta_x, _delta_y);
3268 }
3269 else
3270 {
3271- _vscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3272- GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3273+ _vscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3274+ GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3275 _vscrollbar->SetContentOffset(0, 0);
3276 }
3277
3278@@ -553,7 +555,7 @@
3279 // Set the size so that is is equal to the visible content.
3280 Area::SetBaseWidth(base.GetWidth());
3281 Area::SetBaseHeight(base.GetHeight());
3282- Geometry geo = GetGeometry();
3283+ Geometry geo = GetNativeGeometry();
3284
3285 // Horizontal scrollbar Geometry
3286 if (m_horizontal_scrollbar_enable)
3287@@ -568,8 +570,8 @@
3288 _hscrollbar->ComputeContentSize();
3289
3290 //---
3291- _hscrollbar->SetContainerSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3292- GetBaseY() + m_top_border + m_ViewContentTopMargin,
3293+ _hscrollbar->SetContainerSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3294+ GetNativeY() + m_top_border + m_ViewContentTopMargin,
3295 GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
3296 GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
3297
3298@@ -580,8 +582,8 @@
3299 }
3300 else
3301 {
3302- _hscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3303- GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3304+ _hscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3305+ GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3306 }
3307
3308 _hscrollbar->SetContentOffset(_delta_x, _delta_y);
3309@@ -594,12 +596,12 @@
3310 _hscrollbar->ComputeContentSize();
3311
3312 //---
3313- _hscrollbar->SetContainerSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3314- GetBaseY() + m_top_border + m_ViewContentTopMargin,
3315+ _hscrollbar->SetContainerSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3316+ GetNativeY() + m_top_border + m_ViewContentTopMargin,
3317 GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
3318 GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
3319- _hscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3320- GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3321+ _hscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3322+ GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3323 _hscrollbar->SetContentOffset(0, 0);
3324 }
3325
3326@@ -617,8 +619,8 @@
3327 _vscrollbar->ComputeContentSize();
3328
3329 //---
3330- _vscrollbar->SetContainerSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3331- GetBaseY() + m_top_border + m_ViewContentTopMargin,
3332+ _vscrollbar->SetContainerSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3333+ GetNativeY() + m_top_border + m_ViewContentTopMargin,
3334 GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
3335 GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
3336
3337@@ -629,8 +631,8 @@
3338 }
3339 else
3340 {
3341- _vscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3342- GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3343+ _vscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3344+ GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3345 }
3346
3347 _vscrollbar->SetContentOffset(_delta_x, _delta_y);
3348@@ -643,12 +645,12 @@
3349 _vscrollbar->ComputeContentSize();
3350
3351 //---
3352- _vscrollbar->SetContainerSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3353- GetBaseY() + m_top_border + m_ViewContentTopMargin,
3354+ _vscrollbar->SetContainerSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3355+ GetNativeY() + m_top_border + m_ViewContentTopMargin,
3356 GetBaseWidth() - ScrollbarWidth - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin,
3357 GetBaseHeight() - ScrollbarHeight - m_top_border - m_border - m_ViewContentBottomMargin - m_ViewContentTopMargin);
3358- _vscrollbar->SetContentSize(GetBaseX() + m_border + m_ViewContentLeftMargin,
3359- GetBaseY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3360+ _vscrollbar->SetContentSize(GetNativeX() + m_border + m_ViewContentLeftMargin,
3361+ GetNativeY() + m_top_border + m_ViewContentTopMargin, 0, 0);
3362 _vscrollbar->SetContentOffset(0, 0);
3363 }
3364
3365@@ -666,15 +668,15 @@
3366 // This function is called when the ScrollView is embedded within a Layout.
3367 void ScrollView::ComputeContentPosition(float /* offsetX */, float /* offsetY */)
3368 {
3369- Geometry geo = GetGeometry();
3370+ Geometry geo = GetNativeGeometry();
3371 int w = 0;
3372 int h = 0;
3373
3374 w = _vscrollbar->GetBaseWidth();
3375 h = _hscrollbar->GetBaseHeight();
3376
3377- m_ViewX = GetBaseX() + m_border + m_ViewContentLeftMargin;
3378- m_ViewY = GetBaseY() + m_top_border + m_ViewContentTopMargin;
3379+ m_ViewX = GetNativeX() + m_border + m_ViewContentLeftMargin;
3380+ m_ViewY = GetNativeY() + m_top_border + m_ViewContentTopMargin;
3381
3382 if (m_vertical_scrollbar_enable == false)
3383 m_ViewWidth = GetBaseWidth() - 2 * m_border - m_ViewContentRightMargin - m_ViewContentLeftMargin;
3384
3385=== modified file 'Nux/SpinBox.cpp'
3386--- Nux/SpinBox.cpp 2012-10-10 22:46:50 +0000
3387+++ Nux/SpinBox.cpp 2012-12-17 15:42:23 +0000
3388@@ -82,27 +82,27 @@
3389
3390 void SpinBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
3391 {
3392- Geometry base = GetGeometry();
3393+ Geometry base = GetNativeGeometry();
3394 GetPainter().PaintBackground(graphics_engine, base);
3395
3396 if (m_EditLine->IsMouseInside() || m_SpinnerUpBtn->IsMouseInside() || m_SpinnerDownBtn->IsMouseInside())
3397 {
3398
3399- GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometry(), SPINBOX_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
3400+ GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometryRelativeTo(this), SPINBOX_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
3401 eCornerTopRight, false);
3402- GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometry(), SPINBOX_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
3403+ GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometryRelativeTo(this), SPINBOX_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
3404 eCornerBottomRight, false);
3405 }
3406 else
3407 {
3408- GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometry(), SPINBOX_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
3409+ GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometryRelativeTo(this), SPINBOX_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
3410 eCornerTopRight, false);
3411- GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometry(), SPINBOX_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
3412+ GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometryRelativeTo(this), SPINBOX_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
3413 eCornerBottomRight, false);
3414 }
3415
3416 GeometryPositioning gp(eHACenter, eVACenter);
3417- Geometry GeoPo = ComputeGeometryPositioning(m_SpinnerUpBtn->GetGeometry(), GetTheme().GetImageGeometry(eSPINER_UP), gp);
3418+ Geometry GeoPo = ComputeGeometryPositioning(m_SpinnerUpBtn->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eSPINER_UP), gp);
3419
3420 if (m_SpinnerUpBtn->IsMouseInside())
3421 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eSPINER_UP);
3422@@ -111,7 +111,7 @@
3423
3424
3425 gp.SetAlignment(eHACenter, eVACenter);
3426- GeoPo = ComputeGeometryPositioning(m_SpinnerDownBtn->GetGeometry(), GetTheme().GetImageGeometry(eSPINER_DOWN), gp);
3427+ GeoPo = ComputeGeometryPositioning(m_SpinnerDownBtn->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eSPINER_DOWN), gp);
3428
3429 if (m_SpinnerDownBtn->IsMouseInside())
3430 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eSPINER_DOWN);
3431
3432=== modified file 'Nux/SpinBoxDouble.cpp'
3433--- Nux/SpinBoxDouble.cpp 2012-10-10 22:46:50 +0000
3434+++ Nux/SpinBoxDouble.cpp 2012-12-17 15:42:23 +0000
3435@@ -85,27 +85,27 @@
3436
3437 void SpinBoxDouble::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
3438 {
3439- Geometry base = GetGeometry();
3440+ Geometry base = GetNativeGeometry();
3441 GetPainter().PaintBackground(graphics_engine, base);
3442
3443 if (m_EditLine->IsMouseInside() || m_SpinnerUpBtn->IsMouseInside() || m_SpinnerDownBtn->IsMouseInside())
3444 {
3445
3446- GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometry(), SPINBOX_DOUBLE_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
3447+ GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometryRelativeTo(this), SPINBOX_DOUBLE_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
3448 eCornerTopRight, false);
3449- GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometry(), SPINBOX_DOUBLE_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
3450+ GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometryRelativeTo(this), SPINBOX_DOUBLE_BUTTON_MOUSEOVER_COLOR, eSHAPE_CORNER_ROUND4,
3451 eCornerBottomRight, false);
3452 }
3453 else
3454 {
3455- GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometry(), SPINBOX_DOUBLE_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
3456+ GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerUpBtn->GetGeometryRelativeTo(this), SPINBOX_DOUBLE_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
3457 eCornerTopRight, false);
3458- GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometry(), SPINBOX_DOUBLE_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
3459+ GetPainter().PaintShapeCorner(graphics_engine, m_SpinnerDownBtn->GetGeometryRelativeTo(this), SPINBOX_DOUBLE_BUTTON_COLOR, eSHAPE_CORNER_ROUND4,
3460 eCornerBottomRight, false);
3461 }
3462
3463 GeometryPositioning gp(eHACenter, eVACenter);
3464- Geometry GeoPo = ComputeGeometryPositioning(m_SpinnerUpBtn->GetGeometry(), GetTheme().GetImageGeometry(eSPINER_UP), gp);
3465+ Geometry GeoPo = ComputeGeometryPositioning(m_SpinnerUpBtn->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eSPINER_UP), gp);
3466
3467 if (m_SpinnerUpBtn->IsMouseInside())
3468 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eSPINER_UP);
3469@@ -114,7 +114,7 @@
3470
3471
3472 gp.SetAlignment(eHACenter, eVACenter);
3473- GeoPo = ComputeGeometryPositioning(m_SpinnerDownBtn->GetGeometry(), GetTheme().GetImageGeometry(eSPINER_DOWN), gp);
3474+ GeoPo = ComputeGeometryPositioning(m_SpinnerDownBtn->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eSPINER_DOWN), gp);
3475
3476 if (m_SpinnerDownBtn->IsMouseInside())
3477 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eSPINER_DOWN);
3478
3479=== modified file 'Nux/StaticText.cpp'
3480--- Nux/StaticText.cpp 2012-11-04 10:45:15 +0000
3481+++ Nux/StaticText.cpp 2012-12-17 15:42:23 +0000
3482@@ -224,7 +224,7 @@
3483 if (!dw_texture_.IsValid())
3484 return;
3485
3486- Geometry base = GetGeometry();
3487+ Geometry base = GetNativeGeometry();
3488 graphics_engine.PushClippingRectangle(base);
3489
3490 nux::GetPainter().PaintBackground(graphics_engine, base);
3491@@ -243,7 +243,7 @@
3492 int y = base.y + (base.height - dw_texture_->GetHeight()) / 2;
3493
3494 int x = base.x;
3495-
3496+
3497 //Special case: In the horizontal direction, if the width of the text is smaller than the
3498 // width of the view, then center the text horizontally.
3499 if (dw_texture_->GetWidth() < base.width)
3500
3501=== modified file 'Nux/StaticTextBox.cpp'
3502--- Nux/StaticTextBox.cpp 2012-10-10 22:46:50 +0000
3503+++ Nux/StaticTextBox.cpp 2012-12-17 15:42:23 +0000
3504@@ -60,20 +60,20 @@
3505
3506 void StaticTextBox::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
3507 {
3508- Geometry base = GetGeometry();
3509+ Geometry base = GetNativeGeometry();
3510 {
3511 graphics_engine.PushClippingRectangle(base);
3512
3513 if (m_bDrawBackground)
3514 {
3515 GetPainter().PushDrawLayer(graphics_engine, base, m_Background);
3516- GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetGeometry(), m_Text, m_TextColor, m_WriteAlpha, m_TextAlignment);
3517+ GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetNativeGeometry(), m_Text, m_TextColor, m_WriteAlpha, m_TextAlignment);
3518 GetPainter().PopBackground();
3519 }
3520 else
3521 {
3522 //GetPainter().PaintBackground(graphics_engine, base);
3523- GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetGeometry(), m_Text, m_TextColor, m_WriteAlpha, m_TextAlignment);
3524+ GetPainter().PaintTextLineStatic(graphics_engine, GetFont(), GetNativeGeometry(), m_Text, m_TextColor, m_WriteAlpha, m_TextAlignment);
3525 }
3526
3527 graphics_engine.PopClippingRectangle();
3528
3529=== modified file 'Nux/TabView.cpp'
3530--- Nux/TabView.cpp 2012-11-05 21:31:06 +0000
3531+++ Nux/TabView.cpp 2012-12-17 15:42:23 +0000
3532@@ -135,7 +135,7 @@
3533 RemoveCompositionLayout();
3534 delete(tabright_callback);
3535 delete(tableft_callback);
3536-
3537+
3538 std::vector<TabElement *>::iterator it;
3539
3540 for (it = _tab_array.begin(); it != _tab_array.end(); it++)
3541@@ -184,28 +184,30 @@
3542 m_DrawBackgroundOnPreviousGeometry = false;
3543 }
3544
3545- graphics_engine.PushClippingRectangle(GetGeometry());
3546- Geometry base = GetGeometry();
3547-
3548- GetPainter().PushDrawShapeLayer(graphics_engine, Geometry(base.x, base.y, base.GetWidth(), TAB_HEIGHT), eSHAPE_CORNER_ROUND4, TAB_HEADER_BACKGROUND_COLOR, eCornerTopLeft | eCornerTopRight);
3549+ Geometry base = GetNativeGeometry();
3550+ graphics_engine.PushClippingRectangle(base);
3551+
3552+ base = GetGeometryRelativeTo(this);
3553+
3554+ GetPainter().PushDrawShapeLayer(graphics_engine, Geometry(base.x, base.y, base.width, TAB_HEIGHT), eSHAPE_CORNER_ROUND4, TAB_HEADER_BACKGROUND_COLOR, eCornerTopLeft | eCornerTopRight);
3555
3556 if (_visible_tab_content_layout)
3557 _visible_tab_content_layout->QueueDraw();
3558
3559 unsigned int vector_size = (unsigned int) _tab_array.size();
3560
3561- Geometry geo = GetGeometry();
3562+ Geometry geo = GetNativeGeometry();
3563 Geometry clip_geo;
3564 clip_geo.SetX(geo.x);
3565 clip_geo.SetY(geo.y);
3566- clip_geo.SetWidth(geo.GetWidth() - 2 * TAB_BUTTON_WIDTH);
3567+ clip_geo.SetWidth(geo.width - 2 * TAB_BUTTON_WIDTH);
3568 clip_geo.SetHeight(_tabview_heads_layout->GetBaseHeight());
3569
3570 graphics_engine.PushClippingRectangle(clip_geo);
3571
3572 for (unsigned int i = 0; i < vector_size; i++)
3573 {
3574- Geometry tab_geo = _tab_array[i]->_tab_area->GetGeometry();
3575+ Geometry tab_geo = _tab_array[i]->_tab_area->GetAbsoluteGeometry();
3576 const char *tab_text = _tab_array[i]->GetName().c_str();
3577
3578 if (_tab_array[i]->_index == m_FocusTabIndex)
3579@@ -224,21 +226,22 @@
3580
3581 graphics_engine.PopClippingRectangle();
3582
3583- GetPainter().PaintShapeCorner(graphics_engine, Geometry(base.x, base.y + TAB_HEIGHT, base.GetWidth(), base.GetHeight() - TAB_HEIGHT),
3584+ Geometry rgeo = GetGeometryRelativeTo(this);
3585+ GetPainter().PaintShapeCorner(graphics_engine, Geometry(rgeo.x, rgeo.y + TAB_HEIGHT, rgeo.width, rgeo.height - TAB_HEIGHT),
3586 TAB_BACKGROUND_COLOR, eSHAPE_CORNER_ROUND4, eCornerBottomLeft | eCornerBottomRight, false);
3587
3588- GetPainter().Paint2DQuadColor(graphics_engine, _scroll_right->GetGeometry(), TAB_HEADER_BACKGROUND_COLOR);
3589+ GetPainter().Paint2DQuadColor(graphics_engine, _scroll_right->GetAbsoluteGeometry(), TAB_HEADER_BACKGROUND_COLOR);
3590 GeometryPositioning gp(eHACenter, eVACenter);
3591- Geometry GeoPo = ComputeGeometryPositioning(_scroll_right->GetGeometry(), GetTheme().GetImageGeometry(eTAB_RIGHT), gp);
3592+ Geometry GeoPo = ComputeGeometryPositioning(_scroll_right->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eTAB_RIGHT), gp);
3593
3594 if (_scroll_right->IsMouseInside())
3595 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eTAB_RIGHT);
3596 else
3597 GetPainter().PaintShape(graphics_engine, GeoPo, TAB_HEADER_FOCUS_COLOR, eTAB_RIGHT);
3598
3599- GetPainter().Paint2DQuadColor(graphics_engine, _scroll_left->GetGeometry(), TAB_HEADER_BACKGROUND_COLOR);
3600+ GetPainter().Paint2DQuadColor(graphics_engine, _scroll_left->GetAbsoluteGeometry(), TAB_HEADER_BACKGROUND_COLOR);
3601 gp.SetAlignment(eHACenter, eVACenter);
3602- GeoPo = ComputeGeometryPositioning(_scroll_left->GetGeometry(), GetTheme().GetImageGeometry(eTAB_LEFT), gp);
3603+ GeoPo = ComputeGeometryPositioning(_scroll_left->GetGeometryRelativeTo(this), GetTheme().GetImageGeometry(eTAB_LEFT), gp);
3604
3605 if (_scroll_left->IsMouseInside())
3606 GetPainter().PaintShape(graphics_engine, GeoPo, Color(0xFFFFFFFF), eTAB_LEFT);
3607@@ -251,15 +254,15 @@
3608
3609 void TabView::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
3610 {
3611- Geometry base = GetGeometry();
3612+ Geometry base = GetGeometryRelativeTo(this);
3613
3614- graphics_engine.PushClippingRectangle(GetGeometry());
3615+ graphics_engine.PushClippingRectangle(base);
3616 GetPainter().PushShapeLayer(graphics_engine, Geometry(base.x, base.y + TAB_HEIGHT, base.GetWidth(), base.GetHeight() - TAB_HEIGHT),
3617 eSHAPE_CORNER_ROUND4, TAB_BACKGROUND_COLOR, eCornerBottomLeft | eCornerBottomRight);
3618
3619 if (_visible_tab_content_layout)
3620 {
3621- graphics_engine.PushClippingRectangle(_visible_tab_content_layout->GetGeometry());
3622+ graphics_engine.PushClippingRectangle(_visible_tab_content_layout->GetGeometryRelativeTo(this));
3623 _visible_tab_content_layout->ProcessDraw(graphics_engine, force_draw);
3624 graphics_engine.PopClippingRectangle();
3625 }
3626@@ -273,7 +276,7 @@
3627 // Give the managed layout appropriate size and position..
3628 if (view_layout_)
3629 {
3630- Geometry layout_geo = GetGeometry();
3631+ Geometry layout_geo = GetGeometryRelativeTo(this);
3632 layout_geo.OffsetPosition(TAB_X_BORDER, TAB_HEIGHT);
3633 layout_geo.OffsetSize(-2 * TAB_X_BORDER, - (TAB_HEIGHT) - TAB_Y_BORDER);
3634 view_layout_->SetGeometry(layout_geo);
3635@@ -287,15 +290,15 @@
3636 // been changed by ComputeContentSize.
3637 if (view_layout_)
3638 {
3639- Geometry base = view_layout_->GetGeometry();
3640+ Geometry base = view_layout_->GetGeometryRelativeTo(this);
3641 base.OffsetPosition(-TAB_X_BORDER, -TAB_HEIGHT);
3642 base.OffsetSize(2 * TAB_X_BORDER, TAB_HEIGHT + TAB_Y_BORDER);
3643 Area::SetGeometry(base);
3644 }
3645
3646- Geometry base = GetGeometry();
3647+ Geometry base = GetGeometryRelativeTo(this);
3648
3649- int tab_x = view_layout_->GetGeometry().x + view_layout_->GetGeometry().GetWidth() - 2 * TAB_BUTTON_WIDTH;
3650+ int tab_x = base.x + base.width - 2 * TAB_BUTTON_WIDTH;
3651 int tab_y = base.y;
3652
3653 _scroll_left->SetBaseXY(tab_x, tab_y);
3654@@ -325,8 +328,8 @@
3655 {
3656 if (view_layout_)
3657 {
3658- view_layout_->SetBaseX(GetBaseX() + TAB_X_BORDER);
3659- view_layout_->SetBaseY(GetBaseY() + TAB_HEIGHT);
3660+ view_layout_->SetBaseX(GetNativeX() + TAB_X_BORDER);
3661+ view_layout_->SetBaseY(GetNativeY() + TAB_HEIGHT);
3662 view_layout_->ComputeContentPosition(offsetX, offsetY);
3663 }
3664 }
3665@@ -402,30 +405,32 @@
3666 // return;
3667
3668 m_TabPositionOffset += offset;
3669- int lx = view_layout_->GetBaseX() + m_TabPositionOffset;
3670-
3671- if (lx > view_layout_->GetBaseX())
3672+ Geometry lgeo = view_layout_->GetGeometry();
3673+
3674+ int lx = lgeo.x + m_TabPositionOffset;
3675+
3676+ if (lx > lgeo.x)
3677 {
3678 // end of scroll left;
3679 m_TabPositionOffset = 0;
3680- lx = view_layout_->GetBaseX() + m_TabPositionOffset;
3681+ //lx = view_layout_->GetBaseX() + m_TabPositionOffset;
3682+ lx = lgeo.x + m_TabPositionOffset;
3683 }
3684
3685- if (lx + _tabview_heads_layout->GetBaseWidth() < view_layout_->GetBaseX() +
3686+ if (lx + _tabview_heads_layout->GetBaseWidth() < lgeo.x +
3687 view_layout_->GetBaseWidth() - 2 * TAB_BUTTON_WIDTH)
3688 {
3689
3690- lx = (view_layout_->GetBaseX() +
3691+ lx = (lgeo.x +
3692 view_layout_->GetBaseWidth() - 2 * TAB_BUTTON_WIDTH) - _tabview_heads_layout->GetBaseWidth();
3693
3694-
3695- if (lx > view_layout_->GetBaseX())
3696+ if (lx > lgeo.x)
3697 {
3698 m_TabPositionOffset = 0;
3699- lx = view_layout_->GetBaseX() + m_TabPositionOffset;
3700+ lx = lgeo.x + m_TabPositionOffset;
3701 }
3702 else
3703- m_TabPositionOffset = - (view_layout_->GetBaseX() - lx);
3704+ m_TabPositionOffset = - (lgeo.x - lx);
3705 }
3706
3707 _tabview_heads_layout->SetBaseX(lx);
3708
3709=== modified file 'Nux/TextureArea.cpp'
3710--- Nux/TextureArea.cpp 2012-11-17 23:22:51 +0000
3711+++ Nux/TextureArea.cpp 2012-12-17 15:42:23 +0000
3712@@ -50,17 +50,17 @@
3713 void TextureArea::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
3714 {
3715 // Ability to rotate the widget around its center
3716- graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(-GetBaseX() - GetBaseWidth() / 2, -GetBaseY() - GetBaseHeight() / 2, 0));
3717+ graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(- GetBaseWidth() / 2, - GetBaseHeight() / 2, 0));
3718 graphics_engine.PushModelViewMatrix(Get2DRotation());
3719- graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(GetBaseX() + GetBaseWidth() / 2, GetBaseY() + GetBaseHeight() / 2, 0));
3720+ graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(GetBaseWidth() / 2, GetBaseHeight() / 2, 0));
3721
3722 // The TextureArea should not render the accumulated background. That is left to the caller.
3723 // GetPainter().PaintBackground(graphics_engine, GetGeometry());
3724
3725 if (paint_layer_)
3726 {
3727- paint_layer_->SetGeometry(GetGeometry());
3728- GetPainter().RenderSinglePaintLayer(graphics_engine, GetGeometry(), paint_layer_);
3729+ paint_layer_->SetGeometry(GetNativeGeometry());
3730+ GetPainter().RenderSinglePaintLayer(graphics_engine, GetNativeGeometry(), paint_layer_);
3731 }
3732
3733 graphics_engine.PopModelViewMatrix();
3734
3735=== modified file 'Nux/VLayout.cpp'
3736--- Nux/VLayout.cpp 2012-12-08 01:03:38 +0000
3737+++ Nux/VLayout.cpp 2012-12-17 15:42:23 +0000
3738@@ -245,8 +245,8 @@
3739 VLayoutManagement(width, height);
3740
3741 // Objects have been resized, now position them.
3742- int current_x = GetBaseX() + left_padding_;
3743- int current_y = GetBaseY() + top_padding_;
3744+ int current_x = left_padding_;
3745+ int current_y = top_padding_;
3746
3747 //int per_element_space = 0;
3748 //int total_used_space = 0;
3749@@ -364,12 +364,12 @@
3750 continue;
3751
3752 int ret = 0;
3753-
3754+
3755 if (((*it)->IsLayout() || (*it)->IsView()) /*&& ((*it)->IsLayoutDone() == false)*/ /*&& ((*it)->GetScaleFactor() != 0)*/)
3756 {
3757- Geometry pre_geo = (*it)->GetGeometry();
3758+ Geometry pre_geo = (*it)->GetNativeGeometry();
3759 ret = (*it)->ComputeContentSize();
3760- Geometry post_geo = (*it)->GetGeometry();
3761+ Geometry post_geo = (*it)->GetNativeGeometry();
3762
3763 bool larger_width = pre_geo.width < post_geo.width;
3764 bool smaller_width = pre_geo.width > post_geo.width;
3765@@ -563,7 +563,7 @@
3766 {
3767 if (!(*it)->IsVisible())
3768 continue;
3769-
3770+
3771 if ((*it)->GetScaleFactor() == 0 || (*it)->IsLayoutDone() == true)
3772 {
3773 available_height -= (*it)->GetBaseHeight();
3774@@ -610,7 +610,7 @@
3775 {
3776 if (!(*it)->IsVisible())
3777 continue;
3778-
3779+
3780 if (((*it)->GetScaleFactor() != 0) && ((*it)->IsLayoutDone() == false))
3781 {
3782 float sf = (float) (*it)->GetScaleFactor();
3783@@ -772,8 +772,8 @@
3784 height -= (int) (num_element - 1) * space_between_children_ + (top_padding_ + bottom_padding_);
3785
3786 // Objects have been resized, now position them.
3787- int current_x = GetBaseX() + left_padding_ + offsetX; // add base offset in X(used for scrolling)
3788- int current_y = GetBaseY() + top_padding_ + offsetY; // add base offset in Y(used for scrolling)
3789+ int current_x = left_padding_ + offsetX; // add base offset in X(used for scrolling)
3790+ int current_y = top_padding_ + offsetY; // add base offset in Y(used for scrolling)
3791
3792 int offset_space = 0;
3793 int element_margin = 0;
3794
3795=== modified file 'Nux/VScrollBar.cpp'
3796--- Nux/VScrollBar.cpp 2012-11-05 21:31:06 +0000
3797+++ Nux/VScrollBar.cpp 2012-12-17 15:42:23 +0000
3798@@ -283,7 +283,7 @@
3799
3800 void VScrollBar::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
3801 {
3802- Geometry base = GetGeometry();
3803+ Geometry base = GetNativeGeometry();
3804 GetPainter().PaintBackground(graphics_engine, base);
3805
3806 base.OffsetPosition(0, VSCROLLBAR_HEIGHT);
3807@@ -300,7 +300,7 @@
3808
3809 if (content_height_ > container_height_)
3810 {
3811- Geometry slider_geo = _slider->GetGeometry();
3812+ Geometry slider_geo = _slider->GetGeometryRelativeTo(this);
3813 graphics_engine.QRP_Color(slider_geo.x, slider_geo.y, slider_geo.width, slider_geo.height,
3814 Color(1.0f, 1.0f, 1.0f, 0.8f));
3815 }
3816
3817=== modified file 'Nux/VSplitter.cpp'
3818--- Nux/VSplitter.cpp 2012-11-17 17:18:11 +0000
3819+++ Nux/VSplitter.cpp 2012-12-17 15:42:23 +0000
3820@@ -78,16 +78,18 @@
3821
3822 void VSplitter::Draw(GraphicsEngine &graphics_engine, bool /* force_draw */)
3823 {
3824- Geometry base = GetGeometry();
3825+ // Save the model view matrix. We reuse it when drawing the splitter overlay during a resize operation.
3826+ local_model_view_matrix_ = graphics_engine.GetModelViewMatrix();
3827+
3828+ Geometry base = GetNativeGeometry();
3829 graphics_engine.PushClippingRectangle(base);
3830 std::vector<Area *>::iterator it;
3831
3832- GetPainter().PaintBackground(graphics_engine, base);
3833 std::vector<MySplitter *>::iterator it_splitter;
3834
3835 for (it_splitter = m_SplitterObject.begin(); it_splitter != m_SplitterObject.end(); ++it_splitter)
3836 {
3837- Geometry geo = (*it_splitter)->GetGeometry();
3838+ Geometry geo = (*it_splitter)->GetGeometryRelativeTo(this);
3839 Geometry grip_geo;
3840 int h = 20;
3841
3842@@ -115,8 +117,9 @@
3843
3844 void VSplitter::DrawContent(GraphicsEngine &graphics_engine, bool force_draw)
3845 {
3846- graphics_engine.PushClippingRectangle(GetGeometry());
3847- Geometry base = GetGeometry();
3848+ Geometry base = GetNativeGeometry();
3849+ graphics_engine.PushClippingRectangle(base);
3850+
3851 bool need_redraw = IsRedrawNeeded();
3852
3853 std::vector<MySplitter *>::iterator it_splitter;
3854@@ -126,7 +129,7 @@
3855 it != m_InterfaceObject.end();
3856 ++it, ++it_splitter)
3857 {
3858- Geometry sgeo = (*it_splitter)->GetGeometry();
3859+ Geometry sgeo = (*it_splitter)->GetGeometryRelativeTo(this);
3860 graphics_engine.PushClippingRectangle(Rect(
3861 base.x, base.y, sgeo.x - base.x, base.GetHeight()));
3862
3863@@ -178,13 +181,20 @@
3864 void VSplitter::OverlayDrawing(GraphicsEngine &graphics_engine)
3865 {
3866 unsigned int num_element = (unsigned int) m_SplitterObject.size();
3867-
3868- Geometry base = GetGeometry();
3869+ Geometry base = GetNativeGeometry();
3870+
3871+ // Transform this area position with the model view matrix we captured earlier.
3872+ Vector4 v = local_model_view_matrix_ * Vector4(base.x, base.y, 0.0f, 1.0f);
3873+
3874+ // base is now in window coordinates
3875+ base.x = v.x;
3876+ base.y = v.y;
3877
3878 if (m_focus_splitter_index >= 0)
3879 {
3880- Geometry geo = m_SplitterObject[m_focus_splitter_index]->GetGeometry();
3881- geo.OffsetPosition(mvt_dx, mvt_dy);
3882+ Geometry geo = m_SplitterObject[m_focus_splitter_index]->GetGeometryRelativeTo(this);
3883+
3884+ geo.OffsetPosition(base.x + mvt_dx, base.y + mvt_dy);
3885
3886 if (m_focus_splitter_index == 0 && num_element > 1)
3887 {
3888@@ -193,22 +203,22 @@
3889 geo.SetX(base.x);
3890 }
3891
3892- if (geo.x + VSPLITTERWIDTH > m_SplitterObject[m_focus_splitter_index + 1]->GetGeometry().x)
3893+ if (geo.x + VSPLITTERWIDTH > base.x + m_SplitterObject[m_focus_splitter_index + 1]->GetGeometryRelativeTo(this).x)
3894 {
3895- geo.SetX(m_SplitterObject[m_focus_splitter_index+1]->GetGeometry().x - VSPLITTERWIDTH);
3896+ geo.SetX(base.x + m_SplitterObject[m_focus_splitter_index+1]->GetGeometryRelativeTo(this).x - VSPLITTERWIDTH);
3897 }
3898 }
3899
3900 if ((m_focus_splitter_index > 0) && m_focus_splitter_index < (int) num_element - 1)
3901 {
3902- if (geo.x < m_SplitterObject[m_focus_splitter_index - 1]->GetGeometry().x + VSPLITTERWIDTH)
3903+ if (geo.x < m_SplitterObject[m_focus_splitter_index - 1]->GetGeometryRelativeTo(this).x + VSPLITTERWIDTH)
3904 {
3905- geo.SetX(m_SplitterObject[m_focus_splitter_index - 1]->GetGeometry().x + VSPLITTERWIDTH);
3906+ geo.SetX(m_SplitterObject[m_focus_splitter_index - 1]->GetGeometryRelativeTo(this).x + VSPLITTERWIDTH);
3907 }
3908
3909- if (geo.x + VSPLITTERWIDTH > m_SplitterObject[m_focus_splitter_index + 1]->GetGeometry().x)
3910+ if (geo.x + VSPLITTERWIDTH > m_SplitterObject[m_focus_splitter_index + 1]->GetGeometryRelativeTo(this).x)
3911 {
3912- geo.SetX(m_SplitterObject[m_focus_splitter_index + 1]->GetGeometry().x - VSPLITTERWIDTH);
3913+ geo.SetX(m_SplitterObject[m_focus_splitter_index + 1]->GetGeometryRelativeTo(this).x - VSPLITTERWIDTH);
3914 }
3915 }
3916
3917@@ -251,8 +261,8 @@
3918 long VSplitter::ComputeContentSize()
3919 {
3920 unsigned int num_element = (unsigned int) m_InterfaceObject.size();
3921- int x = GetBaseX();
3922- int y = GetBaseY();
3923+ int x = 0;
3924+ int y = 0;
3925 int w = GetBaseWidth();
3926 int h = GetBaseHeight();
3927
3928@@ -285,7 +295,7 @@
3929 {
3930 for (unsigned int i = 0; i < num_element; i++)
3931 {
3932- Geometry splitter_geo = m_SplitterObject[i]->GetGeometry();
3933+ Geometry splitter_geo = m_SplitterObject[i]->GetGeometryRelativeTo(this);
3934 splitter_geo.SetHeight(h);
3935 splitter_geo.SetY(y);
3936
3937@@ -301,7 +311,7 @@
3938
3939 for (unsigned int i = 0; i < num_element; i++)
3940 {
3941- Geometry splitter_geo = m_SplitterObject[i]->GetGeometry();
3942+ Geometry splitter_geo = m_SplitterObject[i]->GetGeometryRelativeTo(this);
3943 // compute percentage of space occupied by the element i;
3944 // width of element i = m_SplitterObject[i]->GetX() - previous_splliter_end
3945 int splitter_start = m_SplitterObject[i]->GetBaseX();
3946@@ -328,7 +338,7 @@
3947
3948 for (unsigned int i = 0; i < num_element; i++)
3949 {
3950- Geometry splitter_geo = m_SplitterObject[i]->GetGeometry();
3951+ Geometry splitter_geo = m_SplitterObject[i]->GetGeometryRelativeTo(this);
3952
3953 //m_InterfaceObject[i]->SetGeometry(Geometry(accwidth, y, splitter_geo.x - accwidth, h));
3954
3955@@ -362,8 +372,8 @@
3956
3957 void VSplitter::ResetSplitConfig()
3958 {
3959- int x = GetBaseX();
3960- int y = GetBaseY();
3961+ int x = 0;
3962+ int y = 0;
3963 int w = GetBaseWidth();
3964 int h = GetBaseHeight();
3965 unsigned int num_element = (unsigned int) m_InterfaceObject.size();
3966@@ -403,6 +413,7 @@
3967 x += stretchfactor * max_size / max_stretch;
3968 Geometry geo(x, y, VSPLITTERWIDTH, h);
3969 m_SplitterObject[i]->SetGeometry(geo);
3970+ x += VSPLITTERWIDTH;
3971 }
3972
3973 m_SplitterObject[num_element-1]->SetBaseX(x + w - VSPLITTERWIDTH);
3974@@ -425,7 +436,7 @@
3975 {
3976 if (mvt_dx)
3977 {
3978- Geometry geo = m_SplitterObject[header_pos]->GetGeometry();
3979+ Geometry geo = m_SplitterObject[header_pos]->GetGeometryRelativeTo(this);
3980 geo.OffsetPosition(mvt_dx, 0);
3981
3982 unsigned int num_element = (unsigned int) m_SplitterObject.size();
3983@@ -433,8 +444,8 @@
3984 if (header_pos < (int) num_element - 1)
3985 {
3986 // Make the splitter bar stick to the next one if the distance between them is less than VSTICK_SIZE
3987- if (m_SplitterObject[header_pos + 1]->GetGeometry().x - geo.x - VSPLITTERWIDTH < VSTICK_SIZE)
3988- geo.SetX( m_SplitterObject[header_pos + 1]->GetGeometry().x - VSPLITTERWIDTH );
3989+ if (m_SplitterObject[header_pos + 1]->GetGeometryRelativeTo(this).x - geo.x - VSPLITTERWIDTH < VSTICK_SIZE)
3990+ geo.SetX( m_SplitterObject[header_pos + 1]->GetGeometryRelativeTo(this).x - VSPLITTERWIDTH );
3991 }
3992
3993 m_SplitterObject[header_pos]->SetGeometry(geo);
3994@@ -453,7 +464,7 @@
3995
3996 void VSplitter::OnSplitterMouseDrag(int x, int /* y */, int /* dx */, int /* dy */, unsigned long /* button_flags */, unsigned long /* key_flags */, int header_pos)
3997 {
3998- Geometry geo = m_SplitterObject[header_pos]->GetGeometry();
3999+ Geometry geo = m_SplitterObject[header_pos]->GetGeometryRelativeTo(this);
4000 int num_element = (int) m_SplitterObject.size();
4001
4002 if (header_pos == num_element - 1)
4003@@ -483,17 +494,17 @@
4004
4005 void VSplitter::ResizeSplitter(int header_pos)
4006 {
4007- Geometry geo = m_SplitterObject[header_pos]->GetGeometry();
4008+ Geometry geo = m_SplitterObject[header_pos]->GetGeometryRelativeTo(this);
4009 int num_element = (int) m_SplitterObject.size();
4010
4011- if ((header_pos == 0) && (m_SplitterObject[header_pos]->GetBaseX() < GetBaseX()))
4012+ if ((header_pos == 0) && (m_SplitterObject[header_pos]->GetBaseX() < 0))
4013 {
4014- m_SplitterObject[header_pos]->SetBaseX(GetBaseX());
4015+ m_SplitterObject[header_pos]->SetBaseX(0);
4016 }
4017
4018 if ((header_pos == num_element - 1) && (m_SplitterObject[header_pos]->GetBaseX() > GetBaseX() + GetBaseWidth() - VSPLITTERWIDTH))
4019 {
4020- m_SplitterObject[header_pos]->SetBaseX(GetBaseX() + GetBaseWidth() - VSPLITTERWIDTH);
4021+ m_SplitterObject[header_pos]->SetBaseX(GetBaseWidth() - VSPLITTERWIDTH);
4022 }
4023
4024 if (header_pos < (int) num_element - 1)
4025
4026=== modified file 'Nux/VSplitter.h'
4027--- Nux/VSplitter.h 2012-11-05 21:31:06 +0000
4028+++ Nux/VSplitter.h 2012-12-17 15:42:23 +0000
4029@@ -79,6 +79,7 @@
4030
4031 private:
4032
4033+ Matrix4 local_model_view_matrix_;
4034 typedef BasicView MySplitter;
4035 std::vector<Area *> m_InterfaceObject;
4036 std::vector<MySplitter *> m_SplitterObject;
4037
4038=== modified file 'Nux/View.cpp'
4039--- Nux/View.cpp 2012-11-05 21:31:06 +0000
4040+++ Nux/View.cpp 2012-12-17 15:42:23 +0000
4041@@ -44,7 +44,7 @@
4042 backup_texture_.Release();
4043 backup_depth_texture_.Release();
4044 background_texture_.Release();
4045-
4046+
4047 // It is possible that the window thread has been deleted before the view
4048 // itself, so check prior to calling.
4049 WindowThread* wt = GetWindowThread();
4050@@ -121,8 +121,8 @@
4051 {
4052 if (view_layout_)
4053 {
4054- view_layout_->SetBaseX(GetBaseX());
4055- view_layout_->SetBaseY(GetBaseY());
4056+ view_layout_->SetBaseX(0);
4057+ view_layout_->SetBaseY(0);
4058 view_layout_->ComputeContentPosition(offsetX, offsetY);
4059 }
4060 }
4061@@ -131,7 +131,7 @@
4062 {
4063 // Give the managed layout the same size and position as the Control.
4064 if (view_layout_)
4065- view_layout_->SetGeometry(GetGeometry());
4066+ view_layout_->SetGeometry(GetNativeGeometry());
4067 }
4068
4069 long View::PostLayoutManagement(long LayoutResult)
4070@@ -143,7 +143,10 @@
4071 {
4072 // If The layout is empty, do not change the size of the parent element.
4073 if (!view_layout_->IsEmpty())
4074- Area::SetGeometry(view_layout_->GetGeometry());
4075+ {
4076+ Area::SetWidth(view_layout_->GetWidth());
4077+ Area::SetHeight(view_layout_->GetHeight());
4078+ }
4079 }
4080
4081 return LayoutResult;
4082@@ -160,18 +163,28 @@
4083
4084 void View::ProcessDraw(GraphicsEngine& graphics_engine, bool force_draw)
4085 {
4086+ if (this->Type().IsDerivedFromType(BasicView::StaticObjectType))
4087+ {
4088+ // Areas of type BasicView aren't drawing anything.
4089+ // Just skip them.
4090+ return;
4091+ }
4092+
4093 full_view_draw_cmd_ = false;
4094
4095- if (RedirectRenderingToTexture())
4096+ if (GetRedirectRenderingToTexture())
4097 {
4098 if (update_backup_texture_ || force_draw || draw_cmd_queued_)
4099 {
4100- GetPainter().PushPaintLayerStack();
4101+ GetPainter().PushPaintLayerStack();
4102 BeginBackupTextureRendering(graphics_engine, force_draw);
4103 {
4104 graphics_engine.PushModelViewMatrix(Get2DMatrix());
4105+ Matrix4 mat;
4106+ mat.Translate(GetX(), GetY(), 0);
4107+ graphics_engine.PushModelViewMatrix(mat);
4108
4109- Geometry translated_geo = GetGeometry();
4110+ Geometry translated_geo = GetNativeGeometry();
4111 translated_geo.x = 0;
4112 translated_geo.y = 0;
4113 if (force_draw)
4114@@ -195,46 +208,37 @@
4115 }
4116 }
4117 graphics_engine.PopModelViewMatrix();
4118+ graphics_engine.PopModelViewMatrix();
4119 }
4120 EndBackupTextureRendering(graphics_engine, force_draw);
4121 GetPainter().PopPaintLayerStack();
4122- }
4123-
4124- if (PresentRedirectedView())
4125- {
4126- unsigned int current_alpha_blend;
4127- unsigned int current_src_blend_factor;
4128- unsigned int current_dest_blend_factor;
4129- // Be a good citizen, get a copy of the current GPU sates according to Nux
4130- graphics_engine.GetRenderStates().GetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
4131-
4132- TexCoordXForm texxform;
4133-
4134- if ((force_draw || draw_cmd_queued_) && (background_texture_.IsValid()))
4135+
4136+ if (GetPresentRedirectedView())
4137 {
4138- graphics_engine.GetRenderStates().SetBlend(false);
4139- texxform.FlipVCoord(true);
4140- // Draw the background of this view.
4141- GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), background_texture_->GetWidth(), background_texture_->GetHeight(), background_texture_, texxform, color::White);
4142+ RedirectedArea ra;
4143+ ra.backup_texture = backup_texture_;
4144+ ra.geometry = GetAbsoluteGeometry();
4145+ ra.clipping_region = graphics_engine.GetClippingRegion();
4146+ ra.area = this;
4147+
4148+ GetWindowCompositor().QueueRedirected(ra);
4149 }
4150-
4151- texxform.uwrap = TEXWRAP_CLAMP;
4152- texxform.vwrap = TEXWRAP_CLAMP;
4153- texxform.FlipVCoord(true);
4154-
4155- graphics_engine.GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
4156- GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(GetX(), GetY(), GetWidth(), GetHeight(), backup_texture_, texxform, Color(color::White));
4157- // Be a good citizen, restore the Nux blending states.
4158- graphics_engine.GetRenderStates().SetBlend(current_alpha_blend, current_src_blend_factor, current_dest_blend_factor);
4159+ }
4160+ else
4161+ {
4162+ GatherRedirectedViewForRendering(graphics_engine);
4163 }
4164 }
4165 else
4166 {
4167 graphics_engine.PushModelViewMatrix(Get2DMatrix());
4168+ Matrix4 mat;
4169+ mat.Translate(GetX(), GetY(), 0);
4170+ graphics_engine.PushModelViewMatrix(mat);
4171
4172 if (force_draw)
4173 {
4174- GetPainter().PaintBackground(graphics_engine, GetGeometry());
4175+ GetPainter().PaintBackground(graphics_engine, GetNativeGeometry());
4176 GetPainter().PushPaintLayerStack();
4177
4178 draw_cmd_queued_ = true;
4179@@ -248,7 +252,7 @@
4180 {
4181 if (draw_cmd_queued_)
4182 {
4183- GetPainter().PaintBackground(graphics_engine, GetGeometry());
4184+ GetPainter().PaintBackground(graphics_engine, GetNativeGeometry());
4185 GetPainter().PushPaintLayerStack();
4186
4187 full_view_draw_cmd_ = true;
4188@@ -262,7 +266,7 @@
4189 DrawContent(graphics_engine, false);
4190 }
4191 }
4192-
4193+ graphics_engine.PopModelViewMatrix();
4194 graphics_engine.PopModelViewMatrix();
4195 }
4196
4197@@ -288,13 +292,13 @@
4198
4199 Geometry xform_geo;
4200 // Compute position in the active fbo texture.
4201- xform_geo = graphics_engine.ModelViewXFormRect(GetGeometry());
4202+ xform_geo = graphics_engine.ModelViewXFormRect(GetNativeGeometry());
4203
4204 // Get the active fbo...
4205 prev_fbo_ = GetGraphicsDisplay()->GetGpuDevice()->GetCurrentFrameBufferObject();
4206 // ... and the size of the view port rectangle.
4207 prev_viewport_ = graphics_engine.GetViewportRect();
4208-
4209+
4210 const int width = GetWidth();
4211 const int height = GetHeight();
4212
4213@@ -388,7 +392,7 @@
4214 graphics_engine.SetOrthographicProjectionMatrix(width, height);
4215 // Transform the geometry of this area through the current model view matrix. This gives the
4216 // the position of the view in the active fbo texture.
4217- Geometry offset_rect = graphics_engine.ModelViewXFormRect(GetGeometry());
4218+ Geometry offset_rect = graphics_engine.ModelViewXFormRect(GetNativeGeometry());
4219 int x_offset = -offset_rect.x;
4220 int y_offset = -offset_rect.y;
4221 graphics_engine.PushModelViewMatrix(Matrix4::TRANSLATE(x_offset, y_offset, 0));
4222@@ -727,6 +731,33 @@
4223 return true;
4224 }
4225
4226+ void View::GatherRedirectedViewForRendering(GraphicsEngine& graphics_engine)
4227+ {
4228+ if (IsVisible() && GetRedirectRenderingToTexture() && GetPresentRedirectedView())
4229+ {
4230+ if (backup_texture_.IsNull())
4231+ {
4232+ // Should not happen
4233+ return;
4234+ }
4235+
4236+ // Go through the children of this layout and add redirected view for post-rendering composition.
4237+ if (view_layout_)
4238+ {
4239+ view_layout_->GatherRedirectedViewForRendering(graphics_engine);
4240+ }
4241+
4242+ RedirectedArea ra;
4243+ ra.backup_texture = backup_texture_;
4244+ ra.geometry = GetAbsoluteGeometry();
4245+ ra.clipping_region = graphics_engine.GetClippingRegion();
4246+ ra.area = this;
4247+
4248+ // Queue this area for post-rendering composition.
4249+ GetWindowCompositor().QueueRedirected(ra);
4250+ }
4251+ }
4252+
4253 #ifdef NUX_GESTURES_SUPPORT
4254 Area* View::GetInputAreaHitByGesture(const nux::GestureEvent &event)
4255 {
4256
4257=== modified file 'Nux/View.h'
4258--- Nux/View.h 2012-11-05 21:31:06 +0000
4259+++ Nux/View.h 2012-12-17 15:42:23 +0000
4260@@ -164,9 +164,10 @@
4261 virtual void ChildViewQueuedDraw(Area* area);
4262
4263 void BeginBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
4264-
4265 void EndBackupTextureRendering(GraphicsEngine& graphics_engine, bool force_draw);
4266
4267+ virtual void GatherRedirectedViewForRendering(GraphicsEngine& graphics_engine);
4268+
4269 void OnChildFocusChanged(/*Area *parent,*/ Area *child);
4270 sigc::connection _on_focus_changed_handler;
4271
4272
4273=== modified file 'Nux/WindowCompositor.cpp'
4274--- Nux/WindowCompositor.cpp 2012-12-08 01:03:38 +0000
4275+++ Nux/WindowCompositor.cpp 2012-12-17 15:42:23 +0000
4276@@ -33,6 +33,7 @@
4277 #endif
4278 #include "PaintLayer.h"
4279 #include "Painter.h"
4280+#include "SceneComposer.h"
4281 #include "Layout.h"
4282
4283 #include "NuxGraphics/FontTexture.h"
4284@@ -43,6 +44,7 @@
4285 WindowCompositor::WindowCompositor(WindowThread* window_thread)
4286 : reference_fbo_(0)
4287 , window_thread_(window_thread)
4288+ , scene_composer_(NULL)
4289 {
4290 m_OverlayWindow = NULL;
4291 _tooltip_window = NULL;
4292@@ -85,6 +87,9 @@
4293
4294 m_MenuRemoved = false;
4295 m_Background = new ColorLayer(Color(0xFF4D4D4D));
4296+ scene_composer_ = new SceneComposer();
4297+
4298+ scene_composer_->SetGraphicsObjects(GetGraphicsDisplay()->GetGraphicsEngine(), GetGraphicsDisplay()->GetGpuDevice());
4299
4300 #ifdef NUX_GESTURES_SUPPORT
4301 gesture_broker_.reset(new DefaultGestureBroker(this));
4302@@ -105,11 +110,14 @@
4303 _view_window_list.clear();
4304 _modal_view_window_list.clear();
4305
4306+ delete scene_composer_;
4307+
4308 #if !defined(NUX_MINIMAL)
4309 _menu_chain->clear();
4310- delete _menu_chain;
4311 #endif
4312- delete m_Background;
4313+
4314+ NUX_SAFE_DELETE(_menu_chain);
4315+ NUX_SAFE_DELETE(m_Background);
4316 }
4317
4318 WindowCompositor::RenderTargetTextures& WindowCompositor::GetWindowBuffer(BaseWindow* window)
4319@@ -1348,10 +1356,10 @@
4320 //int w, h;
4321 window_thread_->GetGraphicsEngine().GetContextSize(m_Width, m_Height);
4322 window_thread_->GetGraphicsEngine().SetViewport(0, 0, m_Width, m_Height);
4323-
4324+
4325 // Reset the Model view Matrix and the projection matrix
4326 window_thread_->GetGraphicsEngine().ResetProjectionMatrix();
4327-
4328+
4329 window_thread_->GetGraphicsEngine().ResetModelViewMatrixStack();
4330 window_thread_->GetGraphicsEngine().Push2DTranslationModelViewMatrix(0.0f, 0.0f, 0.0f);
4331
4332@@ -1694,8 +1702,14 @@
4333 window_thread_->GetGraphicsEngine().SetViewport(0, 0, window_width, window_height);
4334 window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(window_width, window_height);
4335
4336- PresentBufferToScreen(m_MainColorRT, 0, 0, false);
4337+ // PresentBufferToScreen(m_MainColorRT, 0, 0, false);
4338+ Geometry geo(0, 0, m_MainColorRT->GetWidth(), m_MainColorRT->GetHeight());
4339+ window_thread_->GetGraphicsEngine().GetRenderStates().SetBlend(false);
4340+ scene_composer_->RenderTexture(m_MainColorRT, geo, geo);
4341
4342+ //writes in the back buffer - it might override the directed textures!! we need to get rid
4343+ //of the directed unless if they have different z values when we switch to 3d rendering
4344+ RenderRedirected();
4345 }
4346
4347 void WindowCompositor::PresentBufferToScreen(ObjectPtr<IOpenGLBaseTexture> HWTexture, int x, int y, bool RenderToMainTexture, bool /* BluredBackground */, float opacity, bool premultiply)
4348@@ -2214,7 +2228,7 @@
4349 nuxDebugMsg("[WindowCompositor::GrabPointerAdd] The area already has the grab");
4350 return result;
4351 }
4352-
4353+
4354 if (window_thread_->GetGraphicsDisplay().PointerGrabData() != this)
4355 result = window_thread_->GetGraphicsDisplay().GrabPointer(NULL, this, true);
4356
4357@@ -2240,10 +2254,10 @@
4358 return false;
4359
4360 pointer_grab_stack_.erase(it);
4361-
4362+
4363 if (pointer_grab_stack_.empty())
4364 window_thread_->GetGraphicsDisplay().UngrabPointer(this);
4365-
4366+
4367 // reset the mouse pointers areas.
4368 ResetMousePointerAreas();
4369
4370@@ -2286,7 +2300,7 @@
4371 {
4372 result = window_thread_->GetGraphicsDisplay().GrabKeyboard(NULL, this, true);
4373 }
4374-
4375+
4376 if (result)
4377 {
4378 InputArea* current_keyboard_grab = GetKeyboardGrabArea();
4379@@ -2294,7 +2308,7 @@
4380 current_keyboard_grab->end_keyboard_grab.emit(current_keyboard_grab);
4381
4382 keyboard_grab_stack_.push_front(area);
4383-
4384+
4385 // If there is any area with the key focus, cancel it.
4386 if (key_focus_area_.IsValid())
4387 {
4388@@ -2324,7 +2338,7 @@
4389
4390 area->start_keyboard_grab.emit(area);
4391 }
4392-
4393+
4394 return result;
4395 }
4396
4397@@ -2342,7 +2356,7 @@
4398
4399 InputArea* current_keyboard_grab = (*it);
4400 bool has_grab = false;
4401-
4402+
4403 if (it == keyboard_grab_stack_.begin())
4404 {
4405 // At the top of the keyboard_grab_stack_. Means it has the keyboard grab.
4406@@ -2384,7 +2398,7 @@
4407 key_focus_area_->key_nav_focus_change.emit(key_focus_area_.GetPointer(), false, KEY_NAV_NONE);
4408 // nuxDebugMsg("[WindowCompositor::GrabKeyboardRemove] Area type '%s' named '%s': Lost key nav focus.",
4409 // key_focus_area_->Type().name,
4410- // key_focus_area_->GetBaseString().c_str());
4411+ // key_focus_area_->GetBaseString().c_str());
4412 }
4413
4414 if (key_focus_area_->Type().IsDerivedFromType(View::StaticObjectType))
4415@@ -2393,14 +2407,14 @@
4416 }
4417 key_focus_area_ = NULL;
4418 }
4419-
4420+
4421 it = keyboard_grab_stack_.begin();
4422 SetKeyFocusArea(*it);
4423
4424 InputArea* new_keyboard_grab = (*it);
4425 new_keyboard_grab->start_keyboard_grab.emit(new_keyboard_grab);
4426 }
4427-
4428+
4429 return true;
4430 }
4431
4432@@ -2425,6 +2439,45 @@
4433 return (*keyboard_grab_stack_.begin());
4434 }
4435
4436+/* Redirected */
4437+
4438+ void WindowCompositor::QueueRedirected(const RedirectedArea &ra)
4439+ {
4440+ redirected_areas.push_back(ra);
4441+ }
4442+
4443+ void WindowCompositor::RenderRedirected()
4444+ {
4445+ if (redirected_areas.size() == 0)
4446+ {
4447+ // Nothing o render
4448+ return;
4449+ }
4450+
4451+ for (int i = redirected_areas.size() - 1; i >= 0; --i)
4452+ {
4453+ //render to the back buffer
4454+ scene_composer_->SetDestinationTexture(ObjectPtr<IOpenGLBaseTexture>());
4455+ scene_composer_->SetOrthoGraphicProjection();
4456+
4457+ RedirectedArea ra = redirected_areas[i];
4458+
4459+ //if (blend)
4460+ {
4461+ GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
4462+ }
4463+
4464+ scene_composer_->RenderTexture(ra.backup_texture, ra.geometry, ra.clipping_region);
4465+
4466+ //if (blend)
4467+ {
4468+ GetGraphicsDisplay()->GetGraphicsEngine()->GetRenderStates().SetBlend(false);
4469+ }
4470+ }
4471+
4472+ redirected_areas.clear();
4473+ }
4474+
4475 void WindowCompositor::SetReferenceFramebuffer(unsigned int fbo_object, Geometry fbo_geometry)
4476 {
4477 reference_fbo_ = fbo_object;
4478
4479=== modified file 'Nux/WindowCompositor.h'
4480--- Nux/WindowCompositor.h 2012-11-27 17:18:13 +0000
4481+++ Nux/WindowCompositor.h 2012-12-17 15:42:23 +0000
4482@@ -47,6 +47,15 @@
4483 class Area;
4484 class PaintLayer;
4485 class Event;
4486+ class SceneComposer;
4487+
4488+ struct RedirectedArea
4489+ {
4490+ ObjectPtr<IOpenGLBaseTexture> backup_texture;
4491+ Geometry geometry;
4492+ Rect clipping_region;
4493+ Area* area;
4494+ };
4495
4496 //! A user interface composition class created by WindowThread.
4497 class WindowCompositor : public sigc::trackable
4498@@ -64,7 +73,7 @@
4499 Geometry GetTooltipMainWindowGeometry() const;
4500
4501 // bool MouseDown(Point pt);
4502-//
4503+//
4504 // bool MouseMove(Point pt);
4505 // bool MouseUp(Point pt);
4506
4507@@ -231,8 +240,11 @@
4508 sigc::signal<void, Area*> key_nav_focus_activate;
4509
4510 //====================================
4511-
4512+
4513 public:
4514+ void QueueRedirected(const RedirectedArea &ra);
4515+ void RenderRedirected();
4516+
4517 /*!
4518 Set and external fbo to draw Nux BaseWindow into. This external fbo will be
4519 restored after Nux completes it rendering. The external fbo is used only in embedded mode. \n
4520@@ -566,6 +578,8 @@
4521 private:
4522 WindowThread* window_thread_; //!< The WindowThread to which this object belongs.
4523
4524+ SceneComposer* scene_composer_;
4525+
4526 #ifdef NUX_GESTURES_SUPPORT
4527 std::unique_ptr<GestureBroker> gesture_broker_;
4528 #endif
4529@@ -583,6 +597,8 @@
4530 // Declare operator address-of as private
4531 WindowCompositor* operator & ();
4532
4533+ std::vector<RedirectedArea> redirected_areas;
4534+
4535 friend class InputArea;
4536 friend class WindowThread;
4537 friend class TimerHandler;
4538
4539=== modified file 'NuxCore/NuxCore.cpp'
4540--- NuxCore/NuxCore.cpp 2012-10-10 22:46:50 +0000
4541+++ NuxCore/NuxCore.cpp 2012-12-17 15:42:23 +0000
4542@@ -49,8 +49,8 @@
4543 unsigned int GetVariableArgs ( TCHAR *Dest, unsigned int /* Size */, unsigned int Count, const TCHAR*& Fmt, va_list ArgPtr)
4544 #endif
4545 {
4546- unsigned int Result = VSNTPRINTF_S (Dest, Size, Count, Fmt, ArgPtr);
4547- va_end (ArgPtr);
4548+ unsigned int Result = VSNTPRINTF_S(Dest, Size, Count, Fmt, ArgPtr);
4549+ va_end(ArgPtr);
4550 return Result;
4551 }
4552
4553@@ -61,7 +61,7 @@
4554 #endif
4555 {
4556 unsigned int Result = VSNPRINTF_S (Dest, Size, Count, Fmt, ArgPtr);
4557- va_end (ArgPtr);
4558+ va_end(ArgPtr);
4559 return Result;
4560 }
4561
4562
4563=== modified file 'NuxGraphics/GLRenderStates.h'
4564--- NuxGraphics/GLRenderStates.h 2012-10-15 05:05:27 +0000
4565+++ NuxGraphics/GLRenderStates.h 2012-12-17 15:42:23 +0000
4566@@ -237,7 +237,7 @@
4567 unsigned int& bGreen,
4568 unsigned int& bBlue,
4569 unsigned int& bAlpha);
4570-
4571+
4572 inline void SetDepthMask(unsigned int bDepth = TRUE);
4573
4574 inline void EnableScissor(unsigned int bScissor = FALSE);
4575
4576=== modified file 'NuxGraphics/GraphicsEngine.cpp'
4577--- NuxGraphics/GraphicsEngine.cpp 2012-11-28 15:16:41 +0000
4578+++ NuxGraphics/GraphicsEngine.cpp 2012-12-17 15:42:23 +0000
4579@@ -1105,7 +1105,7 @@
4580 // {
4581 // return Rect(_viewport.x, _viewport.y, _viewport.width, _viewport.height);
4582 // }
4583-
4584+
4585 Rect GraphicsEngine::GetViewportRect() const
4586 {
4587 return _viewport;
4588
4589=== modified file 'NuxGraphics/RenderingPipeGLSL.cpp'
4590--- NuxGraphics/RenderingPipeGLSL.cpp 2012-11-12 20:59:56 +0000
4591+++ NuxGraphics/RenderingPipeGLSL.cpp 2012-12-17 15:42:23 +0000
4592@@ -36,7 +36,7 @@
4593 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
4594 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
4595
4596- const char* VSString =
4597+ const char* VSString =
4598 NUX_VERTEX_SHADER_HEADER
4599 "uniform mat4 ViewProjectionMatrix; \n\
4600 attribute vec4 AVertex; \n\
4601@@ -50,7 +50,7 @@
4602
4603 VS->SetShaderCode(TCHAR_TO_ANSI(VSString));
4604
4605- const char* PSString =
4606+ const char* PSString =
4607 NUX_FRAGMENT_SHADER_HEADER
4608 "varying vec4 vColor; \n\
4609 void main() \n\
4610@@ -71,7 +71,7 @@
4611 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
4612 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
4613
4614- const char* VSString =
4615+ const char* VSString =
4616 NUX_VERTEX_SHADER_HEADER
4617 "attribute vec4 AVertex; \n\
4618 attribute vec4 MyTextureCoord0; \n\
4619@@ -86,7 +86,7 @@
4620 varyVertexColor = VertexColor; \n\
4621 }";
4622
4623- const char* PSString =
4624+ const char* PSString =
4625 NUX_FRAGMENT_SHADER_HEADER
4626 "varying vec4 varyTexCoord0; \n\
4627 varying vec4 varyVertexColor; \n\
4628@@ -118,7 +118,7 @@
4629 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
4630 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
4631
4632- const char* VSString =
4633+ const char* VSString =
4634 NUX_VERTEX_SHADER_HEADER
4635 "attribute vec4 AVertex; \n\
4636 attribute vec4 MyTextureCoord0; \n\
4637@@ -133,7 +133,7 @@
4638 varyVertexColor = VertexColor; \n\
4639 }";
4640
4641- const char* PSString =
4642+ const char* PSString =
4643 NUX_FRAGMENT_SHADER_HEADER
4644 "varying vec4 varyTexCoord0; \n\
4645 varying vec4 varyVertexColor; \n\
4646@@ -571,7 +571,7 @@
4647 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
4648 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
4649
4650- const char* VSString =
4651+ const char* VSString =
4652 NUX_VERTEX_SHADER_HEADER
4653 "uniform mat4 ViewProjectionMatrix; \n\
4654 attribute vec4 AVertex; \n\
4655@@ -587,7 +587,7 @@
4656 }";
4657
4658
4659- const char* PSString =
4660+ const char* PSString =
4661 NUX_FRAGMENT_SHADER_HEADER
4662 "varying vec4 varyTexCoord0; \n\
4663 varying vec4 varyVertexColor; \n\
4664@@ -635,7 +635,7 @@
4665 ObjectPtr<IOpenGLVertexShader> VS = _graphics_display.m_DeviceFactory->CreateVertexShader();
4666 ObjectPtr<IOpenGLPixelShader> PS = _graphics_display.m_DeviceFactory->CreatePixelShader();
4667
4668- const char* VSString =
4669+ const char* VSString =
4670 NUX_VERTEX_SHADER_HEADER
4671 "uniform mat4 ViewProjectionMatrix; \n\
4672 attribute vec4 AVertex; \n\
4673@@ -647,7 +647,7 @@
4674 gl_Position = ViewProjectionMatrix * (AVertex); \n\
4675 }";
4676
4677- const char* PSString =
4678+ const char* PSString =
4679 NUX_FRAGMENT_SHADER_HEADER
4680 "varying vec4 varyTexCoord0; \n\
4681 uniform sampler2D TextureObject0; \n\

Subscribers

People subscribed via source and target branches