From 8d340ec58c16b97556054c21170120003e01244a Mon Sep 17 00:00:00 2001 From: Kingsley Stephens Date: Wed, 8 Apr 2015 14:13:18 +0100 Subject: [PATCH] Size negotiation patch 2: Fix builder example scripts Change-Id: I6f9e0583cb67a3297039d76759db5ab0ddec18b6 --- demo/dali-demo.cpp | 2 +- .../size-negotiation/size-negotiation-example.cpp | 74 +--------------------- resources/scripts/button.json | 6 +- resources/scripts/super-blur-view.json | 2 +- resources/scripts/table-view.json | 14 ++-- resources/scripts/timing.json | 2 + 6 files changed, 18 insertions(+), 82 deletions(-) diff --git a/demo/dali-demo.cpp b/demo/dali-demo.cpp index 31ddbd0..c88dd8c 100644 --- a/demo/dali-demo.cpp +++ b/demo/dali-demo.cpp @@ -39,7 +39,7 @@ int main(int argc, char **argv) demo.AddExample(Example("refraction-effect.example", "Refraction")); demo.AddExample(Example("scroll-view.example", "Scroll View")); demo.AddExample(Example("shadow-bone-lighting.example", "Lights and shadows")); -// demo.AddExample(Example("builder.example", "Script Based UI")); + demo.AddExample(Example("builder.example", "Script Based UI")); demo.AddExample(Example("image-scaling-irregular-grid.example", "Image Scaling Modes")); demo.AddExample(Example("text-view.example", "Text View")); demo.AddExample(Example("animated-shapes.example", "Animated Shapes")); diff --git a/examples/size-negotiation/size-negotiation-example.cpp b/examples/size-negotiation/size-negotiation-example.cpp index 473f16a..4e6aa16 100644 --- a/examples/size-negotiation/size-negotiation-example.cpp +++ b/examples/size-negotiation/size-negotiation-example.cpp @@ -341,9 +341,6 @@ public: { mPopup = CreatePopup(); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == POPUP_BUTTON_TITLE_ID ) @@ -351,9 +348,6 @@ public: mPopup = CreatePopup(); mPopup.SetTitle( "Popup!" ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == POPUP_BUTTON_BUTTONS_1_ID ) @@ -370,9 +364,6 @@ public: mPopup.AddButton( okayButton ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == POPUP_BUTTON_BUTTONS_2_ID ) @@ -399,9 +390,6 @@ public: mPopup.AddButton( okayButton ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == POPUP_BUTTON_TITLE_BUTTONS_ID ) @@ -429,9 +417,6 @@ public: mPopup.AddButton( okayButton ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == POPUP_BUTTON_CONTENT_TEXT_ID ) @@ -450,9 +435,6 @@ public: mPopup.Add( text ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_ID ) @@ -466,9 +448,6 @@ public: mPopup.Add( image ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_SCALE_ID ) @@ -483,9 +462,6 @@ public: mPopup.Add( image ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FIT_ID ) @@ -501,9 +477,6 @@ public: mPopup.Add( image ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == POPUP_BUTTON_CONTENT_IMAGE_FILL_ID ) @@ -519,9 +492,6 @@ public: mPopup.Add( image ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_ID ) @@ -541,9 +511,6 @@ public: mPopup.Add( text ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == POPUP_BUTTON_TITLE_CONTENT_TEXT_BUTTONS_ID ) @@ -583,9 +550,6 @@ public: mPopup.AddButton( okayButton ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == POPUP_BUTTON_COMPLEX_ID ) @@ -651,7 +615,7 @@ public: root.AddChild( text, Toolkit::TableView::CellPosition( 0, 1 ) ); - content.AddChild( root, Toolkit::TableView::CellPosition( 1, 0, 0, 2 ) ); // Column span 2 + content.AddChild( root, Toolkit::TableView::CellPosition( 1, 0 ) ); } mPopup.Add( content ); @@ -677,9 +641,6 @@ public: mPopup.AddButton( okayButton ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == TABLEVIEW_BUTTON_EMPTY_ID ) @@ -694,9 +655,6 @@ public: mPopup.Add( table ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == TABLEVIEW_BUTTON_1CELL_ID ) @@ -716,9 +674,6 @@ public: mPopup.Add( table ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == TABLEVIEW_BUTTON_3CELL_ID ) @@ -749,9 +704,6 @@ public: mPopup.Add( table ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == TABLEVIEW_BUTTON_3X3CELL_ID ) @@ -817,9 +769,6 @@ public: mPopup.Add( table ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == TABLEVIEW_BUTTON_FIXED1_ID ) @@ -863,9 +812,6 @@ public: mPopup.Add( table ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == TABLEVIEW_BUTTON_FIXED2_ID ) @@ -910,9 +856,6 @@ public: mPopup.Add( table ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == TABLEVIEW_BUTTON_FIT1_ID ) @@ -965,9 +908,6 @@ public: mPopup.Add( table ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == TABLEVIEW_BUTTON_FIT2_ID ) @@ -1017,9 +957,6 @@ public: mPopup.Add( table ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL1_ID ) @@ -1075,9 +1012,6 @@ public: mPopup.Add( table ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL2_ID ) @@ -1121,9 +1055,6 @@ public: mPopup.Add( table ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == TABLEVIEW_BUTTON_NATURAL3_ID ) @@ -1165,9 +1096,6 @@ public: mPopup.Add( table ); - // The popup is not yet on the stage so needs to be flaged as dirty - mPopup.MarkDirtyForRelayout(); - mPopup.Show(); } else if( button.GetName() == OKAY_BUTTON_ID || button.GetName() == CANCEL_BUTTON_ID ) diff --git a/resources/scripts/button.json b/resources/scripts/button.json index 392f97d..1ce7c91 100644 --- a/resources/scripts/button.json +++ b/resources/scripts/button.json @@ -25,7 +25,7 @@ "parent-origin": "TOP_CENTER", "anchor-point": "TOP_CENTER", "position": [0, 0, 0], - "size": [0, 200, 0], + "size": [400, 200, 0], "normal-state-actor": { "type": "ImageActor", "image": { @@ -50,7 +50,7 @@ "parent-origin": "CENTER", "anchor-point": "CENTER", "position": [0, 0, 0], - "size": [0, 200, 0], + "size": [400, 200, 0], "label-actor": { "type": "TextView", "text": "Disabled" @@ -83,7 +83,7 @@ "parent-origin": "BOTTOM_CENTER", "anchor-point": "BOTTOM_CENTER", "position": [0, 0, 0], - "size": [0, 200, 0], + "size": [400, 200, 0], "label-actor": { "type": "TextView", "text": "Toggle" diff --git a/resources/scripts/super-blur-view.json b/resources/scripts/super-blur-view.json index dd31564..7351b85 100644 --- a/resources/scripts/super-blur-view.json +++ b/resources/scripts/super-blur-view.json @@ -65,7 +65,7 @@ "parent-origin": "BOTTOM_CENTER", "anchor-point": "BOTTOM_CENTER", "position": [0, 0, 0], - "size": [0, 100, 0], + "size": [200, 100, 0], "label-actor": { "type": "TextView", "text": "Blur" diff --git a/resources/scripts/table-view.json b/resources/scripts/table-view.json index 85940fa..0a9fdca 100644 --- a/resources/scripts/table-view.json +++ b/resources/scripts/table-view.json @@ -22,8 +22,6 @@ "background-color": [0.5,0.5,0,1], "parent-origin": "CENTER", "size":[400,500,1], - "rows": 4, - "columns":4, "cell-padding": [10, 5], "layout-rows": { // set the height of the rows "0": { "policy": "fixed", "value": 40 }, @@ -38,17 +36,21 @@ "actors": [{ "name":"gallery-1", "type":"ImageActor", + "width-resize-policy":"FILL_TO_PARENT", + "height-resize-policy":"FILL_TO_PARENT", "image": { "filename": "{DALI_IMAGE_DIR}gallery-large-1.jpg" }, "custom-properties": { // properties registered dynamically - "cell-indices": [0,0],// property to specify the top-left cell this child occupies + "cell-indices": [0,0], // property to specify the top-left cell this child occupies "row-span":4, // property to specify how many rows this child occupies, if not set, default value is 1 - "column-spam":1 // property to specify how many columns this child occupies, if nor set, defualt cvalue is 1 + "column-span":1 // property to specify how many columns this child occupies, if nor set, defualt cvalue is 1 } },{ "name":"gallery-2", "type":"ImageActor", + "width-resize-policy":"FILL_TO_PARENT", + "height-resize-policy":"FILL_TO_PARENT", "image": { "filename": "{DALI_IMAGE_DIR}gallery-large-2.jpg" }, @@ -59,6 +61,8 @@ }, { "name":"gallery-3", "type":"ImageActor", + "width-resize-policy":"FILL_TO_PARENT", + "height-resize-policy":"FILL_TO_PARENT", "image": { "filename": "{DALI_IMAGE_DIR}gallery-large-3.jpg" }, @@ -68,6 +72,8 @@ }, { "name":"gallery-4", "type":"ImageActor", + "width-resize-policy":"FILL_TO_PARENT", + "height-resize-policy":"FILL_TO_PARENT", "image": { "filename": "{DALI_IMAGE_DIR}gallery-large-4.jpg" }, diff --git a/resources/scripts/timing.json b/resources/scripts/timing.json index 74344c3..a5d8024 100644 --- a/resources/scripts/timing.json +++ b/resources/scripts/timing.json @@ -91,6 +91,8 @@ "name": "ControlBack", "parent-origin": "CENTER", "anchor-point": "CENTER", + "width-resize-policy": "FILL_TO_PARENT", + "height-resize-policy": "FILL_TO_PARENT", "position": [ 0, 0, -- 2.7.4