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