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

@@ -1674,31 +1674,34 @@ void ui::Canvas::project_save_thread(std::string file_path)
App::I.async_end();
}
void ui::Canvas::project_open(std::string file_path, std::function<void()> on_complete)
void ui::Canvas::project_open(std::string file_path, std::function<void(bool)> on_complete)
{
std::thread t([=] {
project_open_thread(file_path);
bool result = project_open_thread(file_path);
if (on_complete)
on_complete();
on_complete(result);
});
t.detach();
}
void ui::Canvas::project_open_thread(std::string file_path)
bool ui::Canvas::project_open_thread(std::string file_path)
{
FILE* fp = fopen(file_path.c_str(), "rb");
if (!fp)
{
LOG("cannot write project to %s", file_path.c_str());
return; // should probably return a bool
return false; // should probably return a bool
}
PPIHeader ppi_header;
fread(&ppi_header, sizeof(PPIHeader), 1, fp);
if (!ppi_header.valid())
return;
{
LOG("INVALID PPI HEADER");
return false;
}
gl_state gl;
std::shared_ptr<NodeProgressBar> pb;
if (App::I.layout.m_loaded)
@@ -1832,6 +1835,7 @@ void ui::Canvas::project_open_thread(std::string file_path)
App::I.title_update();
App::I.async_end();
}
return true;
}
ui::Image ui::Canvas::thumbnail_generate(int w, int h)
@@ -2134,7 +2138,6 @@ ui::Layer::Snapshot ui::Layer::snapshot(std::string data_path)
{
Snapshot snap;
static int counter = 0;
LOG("errno = %d", errno);
glBindTexture(GL_TEXTURE_2D, 0);
//glBindFramebuffer(GL_FRAMEBUFFER, 0);
for (int i = 0; i < 6; i++)