add scrollbar, improve presets, other small fixes

This commit is contained in:
2019-01-27 17:19:06 +01:00
parent 6f3465392b
commit 99c06803ae
14 changed files with 94 additions and 20 deletions

View File

@@ -1741,6 +1741,7 @@ void Canvas::project_save(std::function<void(bool)> on_complete)
void Canvas::project_save(std::string file_path, std::function<void(bool)> on_complete)
{
LOG("saving %s", file_path.c_str());
if (App::I.check_license())
{
std::thread t([=] {
@@ -1750,6 +1751,10 @@ void Canvas::project_save(std::string file_path, std::function<void(bool)> on_co
});
t.detach();
}
else
{
LOG("no license, no save");
}
}
bool Canvas::project_save_thread(std::string file_path)
@@ -1758,7 +1763,10 @@ bool Canvas::project_save_thread(std::string file_path)
// already saved, nothing to do
if (!m_unsaved && file_path == App::I.doc_path)
{
LOG("already saved");
return true;
}
// static char name[128];
// sprintf(name, "%s/latlong.ppi", data_path.c_str());
@@ -1768,11 +1776,15 @@ bool Canvas::project_save_thread(std::string file_path)
std::string file_name = file_path.substr(start, file_path.length() - start - strlen(".ppi"));
std::string tmp_path = App::I.data_path + '/' + file_name + ".tmp.ppi";
LOG("file name %s", file_name.c_str());
LOG("tmp path %s", tmp_path.c_str());
bool use_tmp = false;
// check if file already exists
if ((fp = fopen(file_path.c_str(), "rb")))
{
fclose(fp);
LOG("use tmp file");
// use tmp file for writing
use_tmp = true;
if (!(fp = fopen(tmp_path.c_str(), "wb")))
@@ -1781,6 +1793,8 @@ bool Canvas::project_save_thread(std::string file_path)
use_tmp = false;
}
}
LOG("save first time");
if (!fp)
{