conditional os in UI xml, add system dialog file open on osx, check api format or error message when opening a document, per-char text wrap on NodeText, additional info on create doc dialog like working path

This commit is contained in:
2018-10-06 14:20:07 +02:00
parent 5baa807cce
commit 739784b0d1
23 changed files with 161 additions and 63 deletions

View File

@@ -12,6 +12,7 @@ void NodeText::clone_copy(Node* dest) const
{
Node::clone_copy(dest);
NodeText* n = static_cast<NodeText*>(dest);
n->m_text_mesh.max_width = m_text_mesh.max_width;
n->m_text_mesh.create();
n->m_text_mesh.update(font_id, m_text.c_str());
n->m_text = m_text;
@@ -53,6 +54,9 @@ void NodeText::parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* att
Node::parse_attributes(ka, attr);
switch (ka)
{
case kAttribute::TextWrapWidth:
m_text_mesh.max_width = attr->IntValue();
break;
case kAttribute::Text:
m_text = unescape(attr->Value());
break;
@@ -84,6 +88,18 @@ void NodeText::set_text(const char* s)
SetSize(m_text_mesh.bb);
}
void NodeText::set_text_format(const char* fmt, ...)
{
static char buffer[4096];
va_list args;
va_start(args, fmt);
vsnprintf(buffer, sizeof(buffer), fmt, args);
va_end(args);
m_text = buffer;
m_text_mesh.update(font_id, buffer);
SetSize(m_text_mesh.bb);
}
void NodeText::draw()
{
using namespace ui;