implement save request on OSX, add Quick Look extentions

This commit is contained in:
2018-07-31 00:38:10 +02:00
parent 87fcea61b8
commit 5a37f578cb
18 changed files with 814 additions and 20 deletions

View File

@@ -33,7 +33,9 @@ void App::create()
bool App::request_close()
{
static bool dialog_already_opened = false;
if (ui::Canvas::I->m_unsaved && !dialog_already_opened)
if (!ui::Canvas::I->m_unsaved)
return true;
if (!dialog_already_opened)
{
async_start();
auto* m = layout[main_id]->add_child<NodeMessageBox>();
@@ -43,9 +45,15 @@ bool App::request_close()
m->btn_ok->on_click = [](Node*) {
};
m->btn_cancel->m_text->set_text("No");
m->btn_cancel->on_click = [](Node*) {
m->btn_cancel->on_click = [this](Node*) {
#ifdef _WIN32
destroy_window();
PostQuitMessage(0);
#endif
#ifdef __OSX__
[osx_view close];
#endif
ui::Canvas::I->m_unsaved = false;
};
async_redraw();
async_end();

View File

@@ -160,9 +160,11 @@ void CanvasModePen::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
void CanvasModePen::on_Draw(const glm::mat4& ortho, const glm::mat4& proj, const glm::mat4& camera)
{
#ifndef __IOS__
if (!m_dragging && !m_picking || m_resizing)
if (1)
{
auto pos = m_resizing ? m_size_pos_start : m_cur_pos;
if (App::I.keys[(int)kKey::KeyAlt])
pos.x = pos.x - canvas->m_current_brush.m_tip_size * 500;
ui::ShaderManager::use(ui::kShader::StrokePreview);
ui::ShaderManager::u_int(ui::kShaderUniform::Tex, 0);
ui::ShaderManager::u_float(ui::kShaderUniform::Alpha, canvas->m_current_brush.m_tip_flow);