add quick access panel
This commit is contained in:
@@ -236,6 +236,7 @@
|
|||||||
<ClCompile Include="src\node_panel_color.cpp" />
|
<ClCompile Include="src\node_panel_color.cpp" />
|
||||||
<ClCompile Include="src\node_panel_grid.cpp" />
|
<ClCompile Include="src\node_panel_grid.cpp" />
|
||||||
<ClCompile Include="src\node_panel_layer.cpp" />
|
<ClCompile Include="src\node_panel_layer.cpp" />
|
||||||
|
<ClCompile Include="src\node_panel_quick.cpp" />
|
||||||
<ClCompile Include="src\node_panel_stroke.cpp" />
|
<ClCompile Include="src\node_panel_stroke.cpp" />
|
||||||
<ClCompile Include="src\node_popup_menu.cpp" />
|
<ClCompile Include="src\node_popup_menu.cpp" />
|
||||||
<ClCompile Include="src\node_progress_bar.cpp" />
|
<ClCompile Include="src\node_progress_bar.cpp" />
|
||||||
@@ -361,6 +362,7 @@
|
|||||||
<ClInclude Include="src\node_panel_color.h" />
|
<ClInclude Include="src\node_panel_color.h" />
|
||||||
<ClInclude Include="src\node_panel_grid.h" />
|
<ClInclude Include="src\node_panel_grid.h" />
|
||||||
<ClInclude Include="src\node_panel_layer.h" />
|
<ClInclude Include="src\node_panel_layer.h" />
|
||||||
|
<ClInclude Include="src\node_panel_quick.h" />
|
||||||
<ClInclude Include="src\node_panel_stroke.h" />
|
<ClInclude Include="src\node_panel_stroke.h" />
|
||||||
<ClInclude Include="src\node_popup_menu.h" />
|
<ClInclude Include="src\node_popup_menu.h" />
|
||||||
<ClInclude Include="src\node_progress_bar.h" />
|
<ClInclude Include="src\node_progress_bar.h" />
|
||||||
|
|||||||
@@ -306,6 +306,9 @@
|
|||||||
<ClCompile Include="libs\fmt\src\posix.cc">
|
<ClCompile Include="libs\fmt\src\posix.cc">
|
||||||
<Filter>libs\fmt</Filter>
|
<Filter>libs\fmt</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\node_panel_quick.cpp">
|
||||||
|
<Filter>Source Files\ui</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="src\app.h">
|
<ClInclude Include="src\app.h">
|
||||||
@@ -533,6 +536,9 @@
|
|||||||
<ClInclude Include="src\abr.h">
|
<ClInclude Include="src\abr.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\node_panel_quick.h">
|
||||||
|
<Filter>Header Files\ui</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ResourceCompile Include="PanoPainter.rc">
|
<ResourceCompile Include="PanoPainter.rc">
|
||||||
|
|||||||
@@ -1411,6 +1411,40 @@ Here's a list of what's available in this release.
|
|||||||
</popup-menu>
|
</popup-menu>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
||||||
|
<!-- quick access -->
|
||||||
|
<layout id="panel-quick">
|
||||||
|
<border color="0 0 0 0.3" width="80" dir="col" pad="5" align="center" mouse-capture="true" shrink="1">
|
||||||
|
<node dir="row" pad="5">
|
||||||
|
<!--size-->
|
||||||
|
<node dir="col" margin="0 4 0 0" align="center">
|
||||||
|
<text text="Size" margin="0 0 10 0"/>
|
||||||
|
<slider-v id="quick-size" height="150" width="30"/>
|
||||||
|
</node>
|
||||||
|
<!--flow-->
|
||||||
|
<node dir="col" align="center">
|
||||||
|
<text text="Flow" margin="0 0 10 0"/>
|
||||||
|
<slider-v id="quick-flow" height="150" width="30"/>
|
||||||
|
</node>
|
||||||
|
</node>
|
||||||
|
<!--color-->
|
||||||
|
<text text="Colors" margin="10 0 5 0"/>
|
||||||
|
<button-custom id="quick-color1" dir="row" pad="4" margin="0 0 1 0">
|
||||||
|
<border color="1 0 0 1" width="60" height="30"/>
|
||||||
|
</button-custom>
|
||||||
|
<button-custom id="quick-color2" pad="4" margin="0 0 1 0">
|
||||||
|
<border color="0 0 0 1" width="60" height="30"/>
|
||||||
|
</button-custom>
|
||||||
|
<button-custom id="quick-color3" pad="4" margin="0 0 1 0">
|
||||||
|
<border color="1 1 1 1" width="60" height="30"/>
|
||||||
|
</button-custom>
|
||||||
|
<!--brushes-->
|
||||||
|
<text text="Brushes" margin="20 0 10 0"/>
|
||||||
|
<button-custom height="35" pad="4">
|
||||||
|
<stroke-preview id="quick-brush1" width="60" height="100%"/>
|
||||||
|
</button-custom>
|
||||||
|
</border>
|
||||||
|
</layout>
|
||||||
|
|
||||||
<!--main-->
|
<!--main-->
|
||||||
<layout id="main">
|
<layout id="main">
|
||||||
<canvas id="paint-canvas" positioning="absolute" width="100%" height="100%" grow="1"/>
|
<canvas id="paint-canvas" positioning="absolute" width="100%" height="100%" grow="1"/>
|
||||||
@@ -1555,6 +1589,12 @@ Here's a list of what's available in this release.
|
|||||||
<!--<panel-grid/>-->
|
<!--<panel-grid/>-->
|
||||||
</scroll>
|
</scroll>
|
||||||
</node>
|
</node>
|
||||||
|
|
||||||
|
<!--quick bar-->
|
||||||
|
<node justify="center" align="center">
|
||||||
|
<panel-quick/>
|
||||||
|
</node>
|
||||||
|
|
||||||
<!-- timeline -->
|
<!-- timeline -->
|
||||||
<!--
|
<!--
|
||||||
<node height="100%" width="1" grow="1" dir="col" justify="flex-start" rtl="ltr">
|
<node height="100%" width="1" grow="1" dir="col" justify="flex-start" rtl="ltr">
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#include "node_about.h"
|
#include "node_about.h"
|
||||||
#include "node_changelog.h"
|
#include "node_changelog.h"
|
||||||
#include "node_usermanual.h"
|
#include "node_usermanual.h"
|
||||||
|
#include "node_panel_quick.h"
|
||||||
|
|
||||||
void Node::app_redraw()
|
void Node::app_redraw()
|
||||||
{
|
{
|
||||||
@@ -232,11 +233,12 @@ const Node* Node::init_template(const char* id)
|
|||||||
{
|
{
|
||||||
auto node = c->clone();
|
auto node = c->clone();
|
||||||
add_child(node);
|
add_child(node);
|
||||||
node->init();
|
//node->init();
|
||||||
node->create();
|
//node->create();
|
||||||
node->loaded();
|
//node->loaded();
|
||||||
}
|
}
|
||||||
YGNodeCopyStyle(y_node, m_template->y_node);
|
YGNodeCopyStyle(y_node, m_template->y_node);
|
||||||
|
m_template->clone_copy(this);
|
||||||
return m_template;
|
return m_template;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1045,6 +1047,7 @@ void Node::load_internal(const tinyxml2::XMLElement* x_node)
|
|||||||
CASE(kWidget::PanelColor, NodePanelColor);
|
CASE(kWidget::PanelColor, NodePanelColor);
|
||||||
CASE(kWidget::PanelStroke, NodePanelStroke);
|
CASE(kWidget::PanelStroke, NodePanelStroke);
|
||||||
CASE(kWidget::PanelGrid, NodePanelGrid);
|
CASE(kWidget::PanelGrid, NodePanelGrid);
|
||||||
|
CASE(kWidget::PanelQuick, NodePanelQuick);
|
||||||
CASE(kWidget::ColorQuad, NodeColorQuad);
|
CASE(kWidget::ColorQuad, NodeColorQuad);
|
||||||
CASE(kWidget::StrokePreview, NodeStrokePreview);
|
CASE(kWidget::StrokePreview, NodeStrokePreview);
|
||||||
CASE(kWidget::Canvas, NodeCanvas);
|
CASE(kWidget::Canvas, NodeCanvas);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "util.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
|
||||||
enum class kAttribute : uint16_t
|
enum class kAttribute : uint16_t
|
||||||
@@ -74,6 +75,7 @@ enum class kWidget : uint16_t
|
|||||||
PanelColor = const_hash("panel-color"),
|
PanelColor = const_hash("panel-color"),
|
||||||
PanelStroke = const_hash("panel-stroke"),
|
PanelStroke = const_hash("panel-stroke"),
|
||||||
PanelGrid = const_hash("panel-grid"),
|
PanelGrid = const_hash("panel-grid"),
|
||||||
|
PanelQuick = const_hash("panel-quick"),
|
||||||
ColorQuad = const_hash("color-quad"),
|
ColorQuad = const_hash("color-quad"),
|
||||||
StrokePreview = const_hash("stroke-preview"),
|
StrokePreview = const_hash("stroke-preview"),
|
||||||
Canvas = const_hash("canvas"),
|
Canvas = const_hash("canvas"),
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class NodePanelBrush : public Node
|
|||||||
NodeButtonCustom* m_btn_remove;
|
NodeButtonCustom* m_btn_remove;
|
||||||
struct header_t {
|
struct header_t {
|
||||||
char magic[5]{ 'P', 'P', 'B', 'R', 0 };
|
char magic[5]{ 'P', 'P', 'B', 'R', 0 };
|
||||||
uint16_t version = 1;
|
uint16_t version = 0;
|
||||||
uint16_t build = g_version_build;
|
uint16_t build = g_version_build;
|
||||||
uint16_t brushes = 0;
|
uint16_t brushes = 0;
|
||||||
uint16_t deleted = 0;
|
uint16_t deleted = 0;
|
||||||
|
|||||||
31
src/node_panel_quick.cpp
Normal file
31
src/node_panel_quick.cpp
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
#include "pch.h"
|
||||||
|
#include "node_panel_quick.h"
|
||||||
|
#include "node_stroke_preview.h"
|
||||||
|
|
||||||
|
Node* NodePanelQuick::clone_instantiate() const
|
||||||
|
{
|
||||||
|
return new this_class;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NodePanelQuick::clone_finalize(Node* dest) const
|
||||||
|
{
|
||||||
|
parent::clone_finalize(dest);
|
||||||
|
auto n = static_cast<this_class*>(dest);
|
||||||
|
n->init_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NodePanelQuick::init()
|
||||||
|
{
|
||||||
|
parent::init();
|
||||||
|
auto t = static_cast<const NodeBorder*>(init_template("panel-quick"));
|
||||||
|
init_controls();
|
||||||
|
}
|
||||||
|
|
||||||
|
void NodePanelQuick::init_controls()
|
||||||
|
{
|
||||||
|
auto s = find<NodeStrokePreview>("quick-brush1");
|
||||||
|
s->m_brush = std::make_shared<Brush>();
|
||||||
|
s->m_brush->m_tip_size = 10;
|
||||||
|
s->m_brush->load_tip("data/brushes/Round-Hard.png", "data/brushes/thumbs/Round-Hard.png");
|
||||||
|
s->draw_stroke();
|
||||||
|
}
|
||||||
22
src/node_panel_quick.h
Normal file
22
src/node_panel_quick.h
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "node.h"
|
||||||
|
#include "node_button_custom.h"
|
||||||
|
#include "node_border.h"
|
||||||
|
|
||||||
|
class NodePanelQuick : public NodeBorder
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using this_class = NodePanelQuick;
|
||||||
|
using parent = NodeBorder;
|
||||||
|
NodeButtonCustom* m_slider_size;
|
||||||
|
NodeButtonCustom* m_slider_flow;
|
||||||
|
NodeButtonCustom* m_button_color1;
|
||||||
|
NodeButtonCustom* m_button_color2;
|
||||||
|
NodeButtonCustom* m_button_color3;
|
||||||
|
virtual Node* clone_instantiate() const override;
|
||||||
|
virtual void clone_finalize(Node* dest) const override;
|
||||||
|
virtual void init() override;
|
||||||
|
private:
|
||||||
|
void init_controls();
|
||||||
|
};
|
||||||
|
|
||||||
@@ -298,10 +298,10 @@ void NodeStrokePreview::draw_stroke_immediate()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
float min_pad = size.x * 0.05f;
|
||||||
float pad = (5.f + glm::max(glm::min(m_stroke.m_max_size, m_brush->m_tip_size) / 2.f, 10.f)) * App::I.zoom;
|
float pad = (5.f + glm::max(glm::min(m_stroke.m_max_size, m_brush->m_tip_size) / 2.f, min_pad)) * App::I.zoom;
|
||||||
if (b->m_tip_size_pressure)
|
if (b->m_tip_size_pressure)
|
||||||
pad = 10.f * App::I.zoom;
|
pad = min_pad * App::I.zoom;
|
||||||
float w = m_size.x * App::I.zoom;
|
float w = m_size.x * App::I.zoom;
|
||||||
float h = m_size.y * App::I.zoom;
|
float h = m_size.y * App::I.zoom;
|
||||||
std::vector<glm::vec2> kp = {
|
std::vector<glm::vec2> kp = {
|
||||||
@@ -530,7 +530,6 @@ void NodeStrokePreview::handle_resize(glm::vec2 old_size, glm::vec2 new_size)
|
|||||||
if (m_rtt.getWidth() == new_size.x && m_rtt.getHeight() == new_size.y || !m_brush)
|
if (m_rtt.getWidth() == new_size.x && m_rtt.getHeight() == new_size.y || !m_brush)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float pad = m_size.x * .15f;
|
|
||||||
new_size *= root()->m_zoom;
|
new_size *= root()->m_zoom;
|
||||||
|
|
||||||
m_rtt.create((int)new_size.x, (int)new_size.y);
|
m_rtt.create((int)new_size.x, (int)new_size.y);
|
||||||
|
|||||||
Reference in New Issue
Block a user