add shortcuts panel
This commit is contained in:
@@ -263,6 +263,7 @@ public:
|
||||
void dialog_export_mp4();
|
||||
void dialog_timelapse_export();
|
||||
void dialog_whatsnew(bool force_show);
|
||||
void dialog_shortcuts();
|
||||
|
||||
void cloud_upload();
|
||||
void cloud_upload_all();
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "node_usermanual.h"
|
||||
#include "node_dialog_export_ppbr.h"
|
||||
#include "node_remote_page.h"
|
||||
#include "node_shorcuts.h"
|
||||
|
||||
#include <codec_api.h>
|
||||
#define MP4V2_NO_STDINT_DEFS
|
||||
@@ -869,4 +870,9 @@ void App::dialog_whatsnew(bool force_show)
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void App::dialog_shortcuts()
|
||||
{
|
||||
layout[main_id]->add_child<NodeShortcuts>();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "serializer.h"
|
||||
#include "font.h"
|
||||
#include "node_remote_page.h"
|
||||
#include "node_shorcuts.h"
|
||||
|
||||
void App::title_update()
|
||||
{
|
||||
@@ -1043,7 +1044,13 @@ void App::init_menu_tools()
|
||||
popup_exp->mouse_release();
|
||||
popup_exp->destroy();
|
||||
};
|
||||
|
||||
|
||||
popup_exp->find<NodeButtonCustom>("shortcuts")->on_click = [this, popup_exp](Node*) {
|
||||
dialog_shortcuts();
|
||||
popup_exp->mouse_release();
|
||||
popup_exp->destroy();
|
||||
};
|
||||
|
||||
/*
|
||||
popup_exp->find<NodeButtonCustom>("mp4test")->on_click = [this, popup_exp](Node*) {
|
||||
dialog_export_mp4();
|
||||
@@ -1381,13 +1388,13 @@ void App::initLayout()
|
||||
LOG("initializing layout designer xml");
|
||||
layout_designer.on_loaded = [&](bool reloaded) {
|
||||
layout_designer.create();
|
||||
//layout_designer[main_id]->add_child(layout_designer.instantiate("tpl-panel-animation"));
|
||||
auto p = layout_designer[main_id]->add_child<NodePanelFloating>();
|
||||
p->SetPosition(300, 300);
|
||||
p->SetSize(600, 400);
|
||||
p->m_container->add_child<NodePanelAnimation>();
|
||||
//layout_designer[main_id]->add_child(layout_designer.instantiate("shortcuts"));
|
||||
auto p = layout_designer[main_id]->add_child<NodeShortcuts>();
|
||||
//p->SetPosition(300, 300);
|
||||
//p->SetSize(600, 400);
|
||||
//p->m_container->add_child<NodePanelAnimation>();
|
||||
};
|
||||
//layout_designer.load("data/dialogs/panel-animation.xml");
|
||||
//layout_designer.load("data/dialogs/shortcuts.xml");
|
||||
}
|
||||
|
||||
void App::set_ui_scale(float scale)
|
||||
|
||||
62
src/node_shorcuts.cpp
Normal file
62
src/node_shorcuts.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#include "pch.h"
|
||||
#include "node_shorcuts.h"
|
||||
#include "node_button.h"
|
||||
#include "node_text.h"
|
||||
#include "node_scroll.h"
|
||||
|
||||
Node* NodeShortcuts::clone_instantiate() const
|
||||
{
|
||||
return new NodeShortcuts;
|
||||
}
|
||||
|
||||
void NodeShortcuts::init()
|
||||
{
|
||||
init_template_file("data/dialogs/shortcuts.xml", "shortcuts");
|
||||
init_controls();
|
||||
}
|
||||
|
||||
void NodeShortcuts::init_controls()
|
||||
{
|
||||
m_content = find<NodeScroll>("content");
|
||||
m_btn_close = find<NodeButton>("btn-ok");
|
||||
m_btn_close->on_click = [this](Node*) {
|
||||
destroy();
|
||||
};
|
||||
add_shortcut("New File", "Ctrl+N");
|
||||
}
|
||||
|
||||
void NodeShortcuts::add_shortcut(const std::string& descr, const std::string& shortcut) noexcept
|
||||
{
|
||||
auto item = m_content->add_child<NodeShortcutsItem>();
|
||||
item->set_descr(descr);
|
||||
item->set_shortcut(shortcut);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Node* NodeShortcutsItem::clone_instantiate() const
|
||||
{
|
||||
return new NodeShortcutsItem;
|
||||
}
|
||||
|
||||
void NodeShortcutsItem::init()
|
||||
{
|
||||
init_template_file("data/dialogs/shortcuts.xml", "item");
|
||||
init_controls();
|
||||
}
|
||||
|
||||
void NodeShortcutsItem::init_controls()
|
||||
{
|
||||
m_descr = find<NodeText>("descr");
|
||||
m_shortcut = find<NodeText>("shortcut");
|
||||
}
|
||||
|
||||
void NodeShortcutsItem::set_descr(const std::string& str) noexcept
|
||||
{
|
||||
m_descr->set_text(str);
|
||||
}
|
||||
|
||||
void NodeShortcutsItem::set_shortcut(const std::string& str) noexcept
|
||||
{
|
||||
m_shortcut->set_text(str);
|
||||
}
|
||||
25
src/node_shorcuts.h
Normal file
25
src/node_shorcuts.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
#include "node_border.h"
|
||||
|
||||
class NodeShortcutsItem : public NodeBorder
|
||||
{
|
||||
class NodeText* m_descr;
|
||||
class NodeText* m_shortcut;
|
||||
public:
|
||||
virtual Node* clone_instantiate() const override;
|
||||
virtual void init() override;
|
||||
void init_controls();
|
||||
void set_descr(const std::string& str) noexcept;
|
||||
void set_shortcut(const std::string& str) noexcept;
|
||||
};
|
||||
|
||||
class NodeShortcuts : public NodeBorder
|
||||
{
|
||||
class NodeButton* m_btn_close;
|
||||
class NodeScroll* m_content;
|
||||
public:
|
||||
virtual Node* clone_instantiate() const override;
|
||||
virtual void init() override;
|
||||
void init_controls();
|
||||
void add_shortcut(const std::string& descr, const std::string& shortcut) noexcept;
|
||||
};
|
||||
Reference in New Issue
Block a user