add remote page loading

This commit is contained in:
2019-11-27 19:55:31 +01:00
parent 7701e6771b
commit 41579fa3c6
18 changed files with 373 additions and 41 deletions

View File

@@ -37,6 +37,7 @@
#include "node_panel_quick.h"
#include "node_tool_bucket.h"
#include "node_panel_animation.h"
#include "node_metadata.h"
void Node::app_redraw()
{
@@ -389,6 +390,16 @@ std::shared_ptr<Node> Node::load_template(const std::string& filename, const std
return ret;
}
std::shared_ptr<Node> Node::parse_template(const std::string& xml_string, const std::string& name) const
{
LayoutManager m;
std::shared_ptr<Node> ret;
if (m.parse(xml_string))
ret = m.get_ref(name.c_str())->m_children[0]->clone();
m.unload();
return ret;
}
void Node::add_child(Node* n)
{
App::I->ui_task([&]
@@ -749,6 +760,8 @@ Node::Node(Node&& o)
m_pos_offset_childred = o.m_pos_offset_childred;
m_clip_uncut = o.m_clip_uncut;
auto_width = o.auto_width;
auto_height = o.auto_height;
}
Node::~Node()
@@ -764,12 +777,14 @@ void Node::SetWidth(float value)
{
YGNodeStyleSetWidth(y_node, value);
m_size.x = value;
auto_width = value == YGUndefined;
app_redraw();
}
void Node::SetWidthP(float value)
{
YGNodeStyleSetWidthPercent(y_node, value);
auto_width = value == YGUndefined;
app_redraw();
}
@@ -777,12 +792,14 @@ void Node::SetHeight(float value)
{
YGNodeStyleSetHeight(y_node, value);
m_size.y = value;
auto_height = value == YGUndefined;
app_redraw();
}
void Node::SetHeightP(float value)
{
YGNodeStyleSetHeightPercent(y_node, value);
auto_height = value == YGUndefined;
app_redraw();
}
@@ -1163,6 +1180,7 @@ void Node::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr)
{
YGNodeStyleSetWidth(y_node, YGUndefined);
YGNodeStyleSetWidthPercent(y_node, YGUndefined);
auto_width = true;
}
else
{
@@ -1170,6 +1188,7 @@ void Node::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr)
YGNodeStyleSetWidthPercent(y_node, attr->FloatValue());
else
YGNodeStyleSetWidth(y_node, attr->FloatValue());
auto_width = false;
}
break;
case kAttribute::MinWidth:
@@ -1183,6 +1202,7 @@ void Node::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr)
{
YGNodeStyleSetHeight(y_node, YGUndefined);
YGNodeStyleSetHeightPercent(y_node, YGUndefined);
auto_height = true;
}
else
{
@@ -1190,6 +1210,7 @@ void Node::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr)
YGNodeStyleSetHeightPercent(y_node, attr->FloatValue());
else
YGNodeStyleSetHeight(y_node, attr->FloatValue());
auto_height = false;
}
break;
case kAttribute::MinHeight:
@@ -1416,6 +1437,7 @@ void Node::load_internal(const tinyxml2::XMLElement* x_node)
CASE(kWidget::UserManual, NodeUserManual);
CASE(kWidget::ToolBucket, NodeToolBucket);
CASE(kWidget::Timeline, NodeAnimationTimeline);
CASE(kWidget::Metadata, NodeMetadata);
#undef CASE
case kWidget::Ref:
{
@@ -1481,6 +1503,9 @@ void Node::clone_copy(Node* dest) const
dest->m_pos_offset = m_pos_offset;
dest->m_pos_offset_childred = m_pos_offset_childred;
dest->m_clip_uncut = m_clip_uncut;
dest->auto_width = auto_width;
dest->auto_height = auto_height;
}
void Node::clone_children(Node* dest) const