mirror of https://github.com/aseprite/aseprite.git
Add corner radius field in context bar
This commit is contained in:
parent
26cf154198
commit
5d8a50d009
|
@ -601,6 +601,7 @@ discard_brush = Discard Brush (Esc)
|
||||||
brush_type = Brush Type
|
brush_type = Brush Type
|
||||||
brush_size = Brush Size (in pixels)
|
brush_size = Brush Size (in pixels)
|
||||||
brush_angle = Brush Angle (in degrees)
|
brush_angle = Brush Angle (in degrees)
|
||||||
|
corner_radius = Corner Radius (in pixels)
|
||||||
ink = Ink
|
ink = Ink
|
||||||
opacity = Opacity (paint intensity)
|
opacity = Opacity (paint intensity)
|
||||||
shades = Shades
|
shades = Shades
|
||||||
|
|
|
@ -223,6 +223,7 @@ public:
|
||||||
if (loop->getIntertwine()->cornerRadiusSupport() &&
|
if (loop->getIntertwine()->cornerRadiusSupport() &&
|
||||||
(int(loop->getModifiers()) & int(ToolLoopModifiers::kCornerRadius))) {
|
(int(loop->getModifiers()) & int(ToolLoopModifiers::kCornerRadius))) {
|
||||||
m_cornerRadius.modifyRadius(stroke, pt);
|
m_cornerRadius.modifyRadius(stroke, pt);
|
||||||
|
m_cornerRadius.save();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "app/tools/controller.h"
|
#include "app/tools/controller.h"
|
||||||
#include "app/tools/ink.h"
|
#include "app/tools/ink.h"
|
||||||
#include "app/tools/ink_type.h"
|
#include "app/tools/ink_type.h"
|
||||||
|
#include "app/tools/intertwine.h"
|
||||||
#include "app/tools/point_shape.h"
|
#include "app/tools/point_shape.h"
|
||||||
#include "app/tools/tool.h"
|
#include "app/tools/tool.h"
|
||||||
#include "app/tools/tool_box.h"
|
#include "app/tools/tool_box.h"
|
||||||
|
@ -349,6 +350,24 @@ protected:
|
||||||
bool m_lock;
|
bool m_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ContextBar::CornerRadiusField : public IntEntry {
|
||||||
|
public:
|
||||||
|
CornerRadiusField() : IntEntry(0, 999) { setSuffix("px"); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void onValueChange() override
|
||||||
|
{
|
||||||
|
if (g_updatingFromCode)
|
||||||
|
return;
|
||||||
|
|
||||||
|
IntEntry::onValueChange();
|
||||||
|
base::ScopedValue lockFlag(g_updatingFromCode, true);
|
||||||
|
|
||||||
|
Tool* tool = App::instance()->activeTool();
|
||||||
|
Preferences::instance().tool(tool).cornerRadius.setValue(getValue());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class ContextBar::ToleranceField : public IntEntry {
|
class ContextBar::ToleranceField : public IntEntry {
|
||||||
public:
|
public:
|
||||||
ToleranceField() : IntEntry(0, 255) {}
|
ToleranceField() : IntEntry(0, 255) {}
|
||||||
|
@ -1919,6 +1938,8 @@ ContextBar::ContextBar(TooltipManager* tooltipManager, ColorBar* colorBar)
|
||||||
addChild(m_brushBack = new BrushBackField);
|
addChild(m_brushBack = new BrushBackField);
|
||||||
addChild(m_brushType = new BrushTypeField(this));
|
addChild(m_brushType = new BrushTypeField(this));
|
||||||
addChild(m_brushSize = new BrushSizeField());
|
addChild(m_brushSize = new BrushSizeField());
|
||||||
|
addChild(m_cornerRadius = new CornerRadiusField());
|
||||||
|
m_cornerRadius->useSlider(false);
|
||||||
addChild(m_brushAngle = new BrushAngleField(m_brushType));
|
addChild(m_brushAngle = new BrushAngleField(m_brushType));
|
||||||
addChild(m_brushPatternField = new BrushPatternField());
|
addChild(m_brushPatternField = new BrushPatternField());
|
||||||
|
|
||||||
|
@ -2074,6 +2095,11 @@ void ContextBar::onBrushSizeChange()
|
||||||
updateForActiveTool();
|
updateForActiveTool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContextBar::onCornerRadiusChange(int value)
|
||||||
|
{
|
||||||
|
m_cornerRadius->setValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
void ContextBar::onBrushAngleChange()
|
void ContextBar::onBrushAngleChange()
|
||||||
{
|
{
|
||||||
if (m_activeBrush->type() != kImageBrushType)
|
if (m_activeBrush->type() != kImageBrushType)
|
||||||
|
@ -2164,6 +2190,9 @@ void ContextBar::updateForTool(tools::Tool* tool)
|
||||||
m_freehandAlgoConn = toolPref->freehandAlgorithm.AfterChange.connect(
|
m_freehandAlgoConn = toolPref->freehandAlgorithm.AfterChange.connect(
|
||||||
[this] { onToolSetFreehandAlgorithm(); });
|
[this] { onToolSetFreehandAlgorithm(); });
|
||||||
m_contiguousConn = toolPref->contiguous.AfterChange.connect([this] { onToolSetContiguous(); });
|
m_contiguousConn = toolPref->contiguous.AfterChange.connect([this] { onToolSetContiguous(); });
|
||||||
|
m_cornerRadius->setValue(toolPref->cornerRadius());
|
||||||
|
m_cornerRadiusConn = toolPref->cornerRadius.AfterChange.connect(
|
||||||
|
[this](const int value) { onCornerRadiusChange(value); });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tool)
|
if (tool)
|
||||||
|
@ -2241,6 +2270,9 @@ void ContextBar::updateForTool(tools::Tool* tool)
|
||||||
const bool isFloodfill = tool && (tool->getPointShape(0)->isFloodFill() ||
|
const bool isFloodfill = tool && (tool->getPointShape(0)->isFloodFill() ||
|
||||||
tool->getPointShape(1)->isFloodFill());
|
tool->getPointShape(1)->isFloodFill());
|
||||||
|
|
||||||
|
const bool hasCornerRadius = tool && (tool->getIntertwine(0)->cornerRadiusSupport() ||
|
||||||
|
tool->getIntertwine(1)->cornerRadiusSupport());
|
||||||
|
|
||||||
// True if the current tool needs tolerance options
|
// True if the current tool needs tolerance options
|
||||||
const bool hasTolerance = tool && (tool->getPointShape(0)->isFloodFill() ||
|
const bool hasTolerance = tool && (tool->getPointShape(0)->isFloodFill() ||
|
||||||
tool->getPointShape(1)->isFloodFill());
|
tool->getPointShape(1)->isFloodFill());
|
||||||
|
@ -2276,6 +2308,7 @@ void ContextBar::updateForTool(tools::Tool* tool)
|
||||||
m_brushSize->setVisible(supportOpacity && !isFloodfill && !hasImageBrush);
|
m_brushSize->setVisible(supportOpacity && !isFloodfill && !hasImageBrush);
|
||||||
m_brushAngle->setVisible(supportOpacity && !isFloodfill && !hasImageBrush && hasBrushWithAngle);
|
m_brushAngle->setVisible(supportOpacity && !isFloodfill && !hasImageBrush && hasBrushWithAngle);
|
||||||
m_brushPatternField->setVisible(supportOpacity && hasImageBrush && !withDithering);
|
m_brushPatternField->setVisible(supportOpacity && hasImageBrush && !withDithering);
|
||||||
|
m_cornerRadius->setVisible(hasCornerRadius);
|
||||||
m_inkType->setVisible(hasInk);
|
m_inkType->setVisible(hasInk);
|
||||||
m_inkOpacityLabel->setVisible(showOpacity);
|
m_inkOpacityLabel->setVisible(showOpacity);
|
||||||
m_inkOpacity->setVisible(showOpacity);
|
m_inkOpacity->setVisible(showOpacity);
|
||||||
|
@ -2637,6 +2670,7 @@ void ContextBar::setupTooltips(TooltipManager* tooltipManager)
|
||||||
tooltipManager->addTooltipFor(m_brushType->at(0), Strings::context_bar_brush_type(), BOTTOM);
|
tooltipManager->addTooltipFor(m_brushType->at(0), Strings::context_bar_brush_type(), BOTTOM);
|
||||||
tooltipManager->addTooltipFor(m_brushSize, Strings::context_bar_brush_size(), BOTTOM);
|
tooltipManager->addTooltipFor(m_brushSize, Strings::context_bar_brush_size(), BOTTOM);
|
||||||
tooltipManager->addTooltipFor(m_brushAngle, Strings::context_bar_brush_angle(), BOTTOM);
|
tooltipManager->addTooltipFor(m_brushAngle, Strings::context_bar_brush_angle(), BOTTOM);
|
||||||
|
tooltipManager->addTooltipFor(m_cornerRadius, Strings::context_bar_corner_radius(), BOTTOM);
|
||||||
tooltipManager->addTooltipFor(m_inkType->at(0), Strings::context_bar_ink(), BOTTOM);
|
tooltipManager->addTooltipFor(m_inkType->at(0), Strings::context_bar_ink(), BOTTOM);
|
||||||
tooltipManager->addTooltipFor(m_inkOpacity, Strings::context_bar_opacity(), BOTTOM);
|
tooltipManager->addTooltipFor(m_inkOpacity, Strings::context_bar_opacity(), BOTTOM);
|
||||||
tooltipManager->addTooltipFor(m_inkShades->at(0), Strings::context_bar_shades(), BOTTOM);
|
tooltipManager->addTooltipFor(m_inkShades->at(0), Strings::context_bar_shades(), BOTTOM);
|
||||||
|
|
|
@ -131,6 +131,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
void onBrushSizeChange();
|
void onBrushSizeChange();
|
||||||
void onBrushAngleChange();
|
void onBrushAngleChange();
|
||||||
|
void onCornerRadiusChange(int value);
|
||||||
void onSymmetryModeChange();
|
void onSymmetryModeChange();
|
||||||
void onFgOrBgColorChange(doc::Brush::ImageColor imageColor);
|
void onFgOrBgColorChange(doc::Brush::ImageColor imageColor);
|
||||||
void onOpacityRangeChange();
|
void onOpacityRangeChange();
|
||||||
|
@ -168,6 +169,7 @@ private:
|
||||||
class DynamicsField;
|
class DynamicsField;
|
||||||
class FreehandAlgorithmField;
|
class FreehandAlgorithmField;
|
||||||
class BrushPatternField;
|
class BrushPatternField;
|
||||||
|
class CornerRadiusField;
|
||||||
class EyedropperField;
|
class EyedropperField;
|
||||||
class DropPixelsField;
|
class DropPixelsField;
|
||||||
class AutoSelectLayerField;
|
class AutoSelectLayerField;
|
||||||
|
@ -181,6 +183,7 @@ private:
|
||||||
BrushTypeField* m_brushType;
|
BrushTypeField* m_brushType;
|
||||||
BrushAngleField* m_brushAngle;
|
BrushAngleField* m_brushAngle;
|
||||||
BrushSizeField* m_brushSize;
|
BrushSizeField* m_brushSize;
|
||||||
|
CornerRadiusField* m_cornerRadius;
|
||||||
ui::Label* m_toleranceLabel;
|
ui::Label* m_toleranceLabel;
|
||||||
ToleranceField* m_tolerance;
|
ToleranceField* m_tolerance;
|
||||||
ContiguousField* m_contiguous;
|
ContiguousField* m_contiguous;
|
||||||
|
@ -224,6 +227,7 @@ private:
|
||||||
obs::scoped_connection m_opacityConn;
|
obs::scoped_connection m_opacityConn;
|
||||||
obs::scoped_connection m_freehandAlgoConn;
|
obs::scoped_connection m_freehandAlgoConn;
|
||||||
obs::scoped_connection m_contiguousConn;
|
obs::scoped_connection m_contiguousConn;
|
||||||
|
obs::scoped_connection m_cornerRadiusConn;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace app
|
} // namespace app
|
||||||
|
|
Loading…
Reference in New Issue