diff options
Diffstat (limited to 'utils/themeeditor/graphics/rbviewport.cpp')
-rw-r--r-- | utils/themeeditor/graphics/rbviewport.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/utils/themeeditor/graphics/rbviewport.cpp b/utils/themeeditor/graphics/rbviewport.cpp index fe17ebbeef..33749fdb7f 100644 --- a/utils/themeeditor/graphics/rbviewport.cpp +++ b/utils/themeeditor/graphics/rbviewport.cpp | |||
@@ -34,16 +34,19 @@ | |||
34 | #include "parsetreemodel.h" | 34 | #include "parsetreemodel.h" |
35 | #include "tag_table.h" | 35 | #include "tag_table.h" |
36 | #include "skin_parser.h" | 36 | #include "skin_parser.h" |
37 | #include "skindocument.h" | ||
37 | 38 | ||
38 | /* Pixels/second of text scrolling */ | 39 | /* Pixels/second of text scrolling */ |
39 | const double RBViewport::scrollRate = 30; | 40 | const double RBViewport::scrollRate = 30; |
40 | 41 | ||
41 | RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info) | 42 | RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info, |
43 | ParseTreeNode* pNode) | ||
42 | : RBMovable(info.screen()), foreground(info.screen()->foreground()), | 44 | : RBMovable(info.screen()), foreground(info.screen()->foreground()), |
43 | background(info.screen()->background()), textOffset(0,0), | 45 | background(info.screen()->background()), textOffset(0,0), |
44 | screen(info.screen()), textAlign(Left), showStatusBar(false), | 46 | screen(info.screen()), textAlign(Left), showStatusBar(false), |
45 | statusBarTexture(":/render/statusbar.png"), | 47 | statusBarTexture(":/render/statusbar.png"), |
46 | leftGraphic(0), centerGraphic(0), rightGraphic(0), scrollTime(0) | 48 | leftGraphic(0), centerGraphic(0), rightGraphic(0), scrollTime(0), |
49 | node(pNode), doc(info.document()) | ||
47 | { | 50 | { |
48 | setFlags(ItemIsSelectable | ItemIsMovable | ItemSendsGeometryChanges); | 51 | setFlags(ItemIsSelectable | ItemIsMovable | ItemSendsGeometryChanges); |
49 | 52 | ||
@@ -67,7 +70,6 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info) | |||
67 | } | 70 | } |
68 | else | 71 | else |
69 | { | 72 | { |
70 | int param = 0; | ||
71 | QString ident; | 73 | QString ident; |
72 | int x,y,w,h; | 74 | int x,y,w,h; |
73 | /* Rendering one of the other types of viewport */ | 75 | /* Rendering one of the other types of viewport */ |
@@ -75,7 +77,7 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info) | |||
75 | { | 77 | { |
76 | case '\0': | 78 | case '\0': |
77 | customUI = false; | 79 | customUI = false; |
78 | param = 0; | 80 | baseParam= 0; |
79 | break; | 81 | break; |
80 | 82 | ||
81 | case 'l': | 83 | case 'l': |
@@ -85,13 +87,13 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info) | |||
85 | if(!screen->viewPortDisplayed(ident)) | 87 | if(!screen->viewPortDisplayed(ident)) |
86 | hide(); | 88 | hide(); |
87 | info.screen()->loadViewport(ident, this); | 89 | info.screen()->loadViewport(ident, this); |
88 | param = 1; | 90 | baseParam= 1; |
89 | break; | 91 | break; |
90 | 92 | ||
91 | case 'i': | 93 | case 'i': |
92 | /* Custom UI Viewport */ | 94 | /* Custom UI Viewport */ |
93 | customUI = true; | 95 | customUI = true; |
94 | param = 1; | 96 | baseParam= 1; |
95 | if(node->params[0].type == skin_tag_parameter::DEFAULT) | 97 | if(node->params[0].type == skin_tag_parameter::DEFAULT) |
96 | { | 98 | { |
97 | setVisible(true); | 99 | setVisible(true); |
@@ -104,6 +106,7 @@ RBViewport::RBViewport(skin_element* node, const RBRenderInfo& info) | |||
104 | break; | 106 | break; |
105 | } | 107 | } |
106 | /* Now we grab the info common to all viewports */ | 108 | /* Now we grab the info common to all viewports */ |
109 | int param = baseParam; | ||
107 | x = node->params[param++].data.number; | 110 | x = node->params[param++].data.number; |
108 | if(x < 0) | 111 | if(x < 0) |
109 | x = info.screen()->boundingRect().right() + x; | 112 | x = info.screen()->boundingRect().right() + x; |
@@ -301,7 +304,15 @@ void RBViewport::showPlaylist(const RBRenderInfo &info, int start, | |||
301 | 304 | ||
302 | void RBViewport::saveGeometry() | 305 | void RBViewport::saveGeometry() |
303 | { | 306 | { |
307 | QRectF bounds = boundingRect(); | ||
308 | QPointF origin = pos(); | ||
304 | 309 | ||
310 | node->modParam(static_cast<int>(origin.x()), baseParam); | ||
311 | node->modParam(static_cast<int>(origin.y()), baseParam + 1); | ||
312 | node->modParam(static_cast<int>(bounds.width()), baseParam + 2); | ||
313 | node->modParam(static_cast<int>(bounds.height()), baseParam + 3); | ||
314 | |||
315 | doc->genCode(); | ||
305 | } | 316 | } |
306 | 317 | ||
307 | void RBViewport::alignLeft() | 318 | void RBViewport::alignLeft() |