mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
Show/hide fields in ContextBar when necessary
This commit is contained in:
parent
1bf84bac41
commit
677c0588dc
@ -26,6 +26,7 @@
|
|||||||
#include "settings/settings.h"
|
#include "settings/settings.h"
|
||||||
#include "skin/skin_theme.h"
|
#include "skin/skin_theme.h"
|
||||||
#include "tools/ink.h"
|
#include "tools/ink.h"
|
||||||
|
#include "tools/point_shape.h"
|
||||||
#include "tools/tool.h"
|
#include "tools/tool.h"
|
||||||
#include "ui/button.h"
|
#include "ui/button.h"
|
||||||
#include "ui/combobox.h"
|
#include "ui/combobox.h"
|
||||||
@ -288,16 +289,18 @@ ContextBar::ContextBar()
|
|||||||
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
|
||||||
setBgColor(theme->getColor(ThemeColor::Workspace));
|
setBgColor(theme->getColor(ThemeColor::Workspace));
|
||||||
|
|
||||||
addChild(new Label("Brush:"));
|
addChild(m_brushLabel = new Label("Brush:"));
|
||||||
addChild(m_brushType = new BrushTypeField());
|
addChild(m_brushType = new BrushTypeField());
|
||||||
addChild(m_brushSize = new BrushSizeField());
|
addChild(m_brushSize = new BrushSizeField());
|
||||||
addChild(m_brushAngle = new BrushAngleField(m_brushType));
|
addChild(m_brushAngle = new BrushAngleField(m_brushType));
|
||||||
|
|
||||||
addChild(new Label("Tolerance:"));
|
addChild(m_toleranceLabel = new Label("Tolerance:"));
|
||||||
addChild(m_tolerance = new ToleranceField());
|
addChild(m_tolerance = new ToleranceField());
|
||||||
|
|
||||||
addChild(new Label("Ink:"));
|
addChild(new Label("Ink:"));
|
||||||
addChild(m_inkType = new InkTypeField());
|
addChild(m_inkType = new InkTypeField());
|
||||||
|
|
||||||
|
addChild(m_opacityLabel = new Label("Opacity:"));
|
||||||
addChild(m_inkOpacity = new InkOpacityField());
|
addChild(m_inkOpacity = new InkOpacityField());
|
||||||
// addChild(new InkChannelTargetField());
|
// addChild(new InkChannelTargetField());
|
||||||
// addChild(new InkShadeField());
|
// addChild(new InkShadeField());
|
||||||
@ -345,4 +348,32 @@ void ContextBar::onCurrentToolChange()
|
|||||||
Ink* ink = currentTool->getInk(0);
|
Ink* ink = currentTool->getInk(0);
|
||||||
m_inkType->updateSelectedInk(ink);
|
m_inkType->updateSelectedInk(ink);
|
||||||
m_inkOpacity->setTextf("%d", toolSettings->getOpacity());
|
m_inkOpacity->setTextf("%d", toolSettings->getOpacity());
|
||||||
|
|
||||||
|
// True if the current tool needs opacity options
|
||||||
|
bool hasOpacity = (currentTool->getInk(0)->isPaint() ||
|
||||||
|
currentTool->getInk(0)->isEffect() ||
|
||||||
|
currentTool->getInk(1)->isPaint() ||
|
||||||
|
currentTool->getInk(1)->isEffect());
|
||||||
|
|
||||||
|
// True if the current tool needs tolerance options
|
||||||
|
bool hasTolerance = (currentTool->getPointShape(0)->isFloodFill() ||
|
||||||
|
currentTool->getPointShape(1)->isFloodFill());
|
||||||
|
|
||||||
|
// True if the current tool needs spray options
|
||||||
|
bool hasSprayOptions = (currentTool->getPointShape(0)->isSpray() ||
|
||||||
|
currentTool->getPointShape(1)->isSpray());
|
||||||
|
|
||||||
|
// Show/Hide fields
|
||||||
|
m_brushLabel->setVisible(hasOpacity);
|
||||||
|
m_brushType->setVisible(hasOpacity);
|
||||||
|
m_brushSize->setVisible(hasOpacity);
|
||||||
|
m_brushAngle->setVisible(hasOpacity);
|
||||||
|
m_opacityLabel->setVisible(hasOpacity);
|
||||||
|
m_inkOpacity->setVisible(hasOpacity);
|
||||||
|
m_toleranceLabel->setVisible(hasTolerance);
|
||||||
|
m_tolerance->setVisible(hasTolerance);
|
||||||
|
|
||||||
|
//m_sprayBox->setVisible(hasSprayOptions);
|
||||||
|
|
||||||
|
layout();
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,10 @@
|
|||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
#include "ui/box.h"
|
#include "ui/box.h"
|
||||||
|
|
||||||
|
namespace ui {
|
||||||
|
class Label;
|
||||||
|
}
|
||||||
|
|
||||||
class ContextBar : public ui::Box
|
class ContextBar : public ui::Box
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -42,11 +46,14 @@ private:
|
|||||||
class InkTypeField;
|
class InkTypeField;
|
||||||
class InkOpacityField;
|
class InkOpacityField;
|
||||||
|
|
||||||
|
ui::Label* m_brushLabel;
|
||||||
BrushTypeField* m_brushType;
|
BrushTypeField* m_brushType;
|
||||||
BrushAngleField* m_brushAngle;
|
BrushAngleField* m_brushAngle;
|
||||||
BrushSizeField* m_brushSize;
|
BrushSizeField* m_brushSize;
|
||||||
|
ui::Label* m_toleranceLabel;
|
||||||
ToleranceField* m_tolerance;
|
ToleranceField* m_tolerance;
|
||||||
InkTypeField* m_inkType;
|
InkTypeField* m_inkType;
|
||||||
|
ui::Label* m_opacityLabel;
|
||||||
InkOpacityField* m_inkOpacity;
|
InkOpacityField* m_inkOpacity;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user