add tick and on_tick event, fix unsaved document prompt, implement TextInput blinking cursor
This commit is contained in:
@@ -92,6 +92,12 @@ void App::dialog_newdoc()
|
||||
std::string name = dialog->input->m_string;
|
||||
std::string path = work_path + "/" + name + ".ppi";
|
||||
|
||||
if (name.empty())
|
||||
{
|
||||
message_box("Warning", "You need to specify a name to file.");
|
||||
return;
|
||||
}
|
||||
|
||||
auto action = [this, dialog, name, path] {
|
||||
std::array<int, 4> resolutions{ 512, 1024, 1536, 2048 };
|
||||
int res = resolutions[dialog->m_resolution->m_current_index];
|
||||
@@ -110,6 +116,8 @@ void App::dialog_newdoc()
|
||||
canvas->m_canvas->layer_add("Default");
|
||||
layers->add_layer("Default");
|
||||
|
||||
canvas->m_canvas->m_unsaved = true;
|
||||
canvas->m_canvas->m_newdoc = false;
|
||||
title_update();
|
||||
|
||||
dialog->destroy();
|
||||
@@ -154,8 +162,11 @@ void App::dialog_newdoc()
|
||||
m->btn_ok->m_text->set_text("Yes");
|
||||
m->btn_cancel->m_text->set_text("No");
|
||||
m->btn_ok->on_click = [this, m, show_dialog](Node*) {
|
||||
ui::Canvas::I->project_save([this, m, show_dialog] {
|
||||
show_dialog();
|
||||
ui::Canvas::I->project_save([this, m, show_dialog](bool success){
|
||||
if (success)
|
||||
show_dialog();
|
||||
else
|
||||
message_box("Saving Error", "There was a problem saving the document");
|
||||
});
|
||||
m->destroy();
|
||||
};
|
||||
@@ -215,8 +226,11 @@ void App::dialog_open()
|
||||
m->btn_ok->m_text->set_text("Yes");
|
||||
m->btn_cancel->m_text->set_text("No");
|
||||
m->btn_ok->on_click = [this,m,show_dialog](Node*){
|
||||
ui::Canvas::I->project_save([this,m,show_dialog] {
|
||||
show_dialog();
|
||||
ui::Canvas::I->project_save([this,m,show_dialog](bool success){
|
||||
if (success)
|
||||
show_dialog();
|
||||
else
|
||||
message_box("Saving Error", "There was a problem saving the document");
|
||||
});
|
||||
m->destroy();
|
||||
};
|
||||
@@ -268,8 +282,11 @@ void App::dialog_browse()
|
||||
m->btn_ok->m_text->set_text("Yes");
|
||||
m->btn_cancel->m_text->set_text("No");
|
||||
m->btn_ok->on_click = [this, m, show_dialog](Node*) {
|
||||
ui::Canvas::I->project_save([this, m, show_dialog] {
|
||||
show_dialog();
|
||||
ui::Canvas::I->project_save([this, m, show_dialog](bool success){
|
||||
if (success)
|
||||
show_dialog();
|
||||
else
|
||||
message_box("Saving Error", "There was a problem saving the document");
|
||||
});
|
||||
m->destroy();
|
||||
};
|
||||
@@ -335,21 +352,16 @@ void App::dialog_save()
|
||||
|
||||
if (name.empty())
|
||||
{
|
||||
auto msgbox = new NodeMessageBox();
|
||||
msgbox->m_manager = &layout;
|
||||
msgbox->init();
|
||||
msgbox->m_title->set_text("Warning");
|
||||
msgbox->m_message->set_text("You need to specify a name to file.");
|
||||
layout[main_id]->add_child(msgbox);
|
||||
message_box("Warning", "You need to specify a name to file.");
|
||||
return;
|
||||
}
|
||||
|
||||
auto action = [this, dialog, name, path] {
|
||||
canvas->m_canvas->project_save(path);
|
||||
doc_name = name;
|
||||
doc_path = path;
|
||||
doc_dir = work_path;
|
||||
title_update();
|
||||
canvas->m_canvas->project_save(path);
|
||||
dialog->destroy();
|
||||
App::I.hideKeyboard();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user