mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-28 18:32:50 +00:00
Show/hide opacity and tolerance parameters depending if the current tool supports these.
This commit is contained in:
parent
78366fa545
commit
4fc1b7f9f8
@ -98,7 +98,9 @@ static void on_current_tool_change()
|
||||
Widget* brush_angle = window->findChild("brush_angle");
|
||||
Widget* brush_type = window->findChild("brush_type");
|
||||
Widget* brush_preview = window->findChild("brush_preview");
|
||||
Widget* opacity_label = window->findChild("opacity_label");
|
||||
Widget* opacity = window->findChild("opacity");
|
||||
Widget* tolerance_label = window->findChild("tolerance_label");
|
||||
Widget* tolerance = window->findChild("tolerance");
|
||||
Widget* spray_box = window->findChild("spray_box");
|
||||
Widget* spray_width = window->findChild("spray_width");
|
||||
@ -125,18 +127,30 @@ static void on_current_tool_change()
|
||||
// Regenerate the preview
|
||||
brush_preview->dirty();
|
||||
|
||||
// True if the current tool needs opacity options
|
||||
bool hasOpacity = (current_tool->getInk(0)->isPaint() ||
|
||||
current_tool->getInk(0)->isEffect() ||
|
||||
current_tool->getInk(1)->isPaint() ||
|
||||
current_tool->getInk(1)->isEffect());
|
||||
|
||||
// True if the current tool needs tolerance options
|
||||
bool hasTolerance = (current_tool->getPointShape(0)->isFloodFill() ||
|
||||
current_tool->getPointShape(1)->isFloodFill());
|
||||
|
||||
// True if the current tool needs spray options
|
||||
bool hasSprayOptions = (current_tool->getPointShape(0)->isSpray() ||
|
||||
current_tool->getPointShape(1)->isSpray());
|
||||
|
||||
// Show/Hide spray settings
|
||||
// Show/Hide parameters
|
||||
opacity_label->setVisible(hasOpacity);
|
||||
opacity->setVisible(hasOpacity);
|
||||
tolerance_label->setVisible(hasTolerance);
|
||||
tolerance->setVisible(hasTolerance);
|
||||
spray_box->setVisible(hasSprayOptions);
|
||||
|
||||
// Get the required size of the whole window
|
||||
Size reqSize = window->getPreferredSize();
|
||||
|
||||
// Set the window height
|
||||
if (jrect_h(window->rc) != reqSize.h) {
|
||||
if (jrect_h(window->rc) != reqSize.h) { // Setup the correct window height
|
||||
JRect rect = jrect_new(window->rc->x1, window->rc->y1,
|
||||
window->rc->x2, window->rc->y1 + reqSize.h);
|
||||
|
||||
|
@ -72,6 +72,8 @@ public:
|
||||
class FloodFillPointShape : public ToolPointShape
|
||||
{
|
||||
public:
|
||||
bool isFloodFill() { return true; }
|
||||
|
||||
void transformPoint(IToolLoop* loop, int x, int y)
|
||||
{
|
||||
algo_floodfill(loop->getSrcImage(), x, y, loop->getTolerance(), loop, (AlgoHLine)doInkHline);
|
||||
|
@ -122,6 +122,7 @@ class ToolPointShape
|
||||
// none, pixel, pen, floodfill, spray
|
||||
public:
|
||||
virtual ~ToolPointShape() { }
|
||||
virtual bool isFloodFill() { return false; }
|
||||
virtual bool isSpray() { return false; }
|
||||
virtual void transformPoint(IToolLoop* loop, int x, int y) = 0;
|
||||
virtual void getModifiedArea(IToolLoop* loop, int x, int y, Rect& area) = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user