mirror of
https://github.com/aseprite/aseprite.git
synced 2024-09-02 13:09:27 +00:00
Highlight dynamics button when some sensor is being used
This commit is contained in:
parent
eeb5be9bed
commit
046b68061a
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 17 KiB |
@ -265,8 +265,8 @@
|
||||
<part id="selection_add" x="184" y="160" w="7" h="7" />
|
||||
<part id="selection_subtract" x="192" y="160" w="7" h="7" />
|
||||
<part id="selection_intersect" x="200" y="160" w="7" h="7" />
|
||||
<part id="unpinned" x="192" y="144" w="8" h="8" />
|
||||
<part id="pinned" x="200" y="144" w="8" h="8" />
|
||||
<part id="unpinned" x="208" y="152" w="8" h="8" />
|
||||
<part id="pinned" x="216" y="152" w="8" h="8" />
|
||||
<part id="drop_down_button_left_normal" x="48" y="32" w1="3" w2="2" w3="3" h1="4" h2="6" h3="6" />
|
||||
<part id="drop_down_button_left_hot" x="64" y="32" w1="3" w2="2" w3="3" h1="4" h2="6" h3="6" />
|
||||
<part id="drop_down_button_left_focused" x="48" y="48" w1="3" w2="2" w3="3" h1="4" h2="6" h3="6" />
|
||||
@ -434,6 +434,7 @@
|
||||
<part id="outline_empty_pixel" x="208" y="224" w="5" h="5" />
|
||||
<part id="outline_full_pixel" x="214" y="224" w="5" h="5" />
|
||||
<part id="dynamics" x="176" y="144" w="16" h="16" />
|
||||
<part id="dynamics_on" x="192" y="144" w="16" h="16" />
|
||||
<part id="tiles" x="144" y="208" w="6" h="6" />
|
||||
<part id="tiles_manual" x="150" y="208" w="6" h="6" />
|
||||
<part id="tiles_auto" x="156" y="208" w="6" h="6" />
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@ -261,8 +261,8 @@
|
||||
<part id="selection_add" x="184" y="160" w="7" h="7" />
|
||||
<part id="selection_subtract" x="192" y="160" w="7" h="7" />
|
||||
<part id="selection_intersect" x="200" y="160" w="7" h="7" />
|
||||
<part id="unpinned" x="192" y="144" w="8" h="8" />
|
||||
<part id="pinned" x="200" y="144" w="8" h="8" />
|
||||
<part id="unpinned" x="208" y="152" w="8" h="8" />
|
||||
<part id="pinned" x="216" y="152" w="8" h="8" />
|
||||
<part id="drop_down_button_left_normal" x="48" y="32" w1="3" w2="2" w3="3" h1="4" h2="6" h3="6" />
|
||||
<part id="drop_down_button_left_hot" x="64" y="32" w1="3" w2="2" w3="3" h1="4" h2="6" h3="6" />
|
||||
<part id="drop_down_button_left_focused" x="48" y="48" w1="3" w2="2" w3="3" h1="4" h2="6" h3="6" />
|
||||
@ -430,6 +430,7 @@
|
||||
<part id="outline_empty_pixel" x="208" y="224" w="5" h="5" />
|
||||
<part id="outline_full_pixel" x="214" y="224" w="5" h="5" />
|
||||
<part id="dynamics" x="176" y="144" w="16" h="16" />
|
||||
<part id="dynamics_on" x="192" y="144" w="16" h="16" />
|
||||
<part id="tiles" x="144" y="208" w="6" h="6" />
|
||||
<part id="tiles_manual" x="150" y="208" w="6" h="6" />
|
||||
<part id="tiles_auto" x="156" y="208" w="6" h="6" />
|
||||
|
@ -1156,6 +1156,11 @@ public:
|
||||
addItem(SkinTheme::get(this)->parts.dynamics(), "dynamics_field");
|
||||
|
||||
loadDynamicsPref();
|
||||
initTheme();
|
||||
}
|
||||
|
||||
void updateIconFromActiveToolPref() {
|
||||
initTheme();
|
||||
}
|
||||
|
||||
void switchPopup() {
|
||||
@ -1210,11 +1215,8 @@ public:
|
||||
void saveDynamicsPref() {
|
||||
m_sameInAllTools = m_popup->sharedSettings();
|
||||
Preferences::instance().shared.shareDynamics(m_sameInAllTools);
|
||||
tools::Tool* tool = nullptr;
|
||||
if (!m_sameInAllTools)
|
||||
tool = App::instance()->activeTool();
|
||||
|
||||
auto& dynaPref = Preferences::instance().tool(tool).dynamics;
|
||||
auto& dynaPref = Preferences::instance().tool(getTool()).dynamics;
|
||||
m_dynamics = m_popup->getDynamics();
|
||||
dynaPref.stabilizer(m_dynamics.stabilizer);
|
||||
dynaPref.stabilizerFactor(m_dynamics.stabilizerFactor);
|
||||
@ -1229,15 +1231,14 @@ public:
|
||||
dynaPref.maxVelocityThreshold(m_dynamics.maxVelocityThreshold);
|
||||
dynaPref.colorFromTo(m_dynamics.colorFromTo);
|
||||
dynaPref.matrixName(m_popup->ditheringMatrixName());
|
||||
|
||||
initTheme();
|
||||
}
|
||||
|
||||
void loadDynamicsPref() {
|
||||
m_sameInAllTools = Preferences::instance().shared.shareDynamics();
|
||||
tools::Tool* tool = nullptr;
|
||||
if (!m_sameInAllTools)
|
||||
tool = App::instance()->activeTool();
|
||||
|
||||
auto& dynaPref = Preferences::instance().tool(tool).dynamics;
|
||||
auto& dynaPref = Preferences::instance().tool(getTool()).dynamics;
|
||||
m_dynamics.stabilizer = dynaPref.stabilizer();
|
||||
m_dynamics.stabilizerFactor = dynaPref.stabilizerFactor();
|
||||
m_dynamics.size = dynaPref.size();
|
||||
@ -1282,6 +1283,12 @@ private:
|
||||
Preferences::instance().tool(tool).brush.angle(angle);
|
||||
}
|
||||
|
||||
void onDynamicsChange(const tools::DynamicsOptions& dynamicsOptions) override {
|
||||
updateIcon(dynamicsOptions.size != tools::DynamicSensor::Static ||
|
||||
dynamicsOptions.angle != tools::DynamicSensor::Static ||
|
||||
dynamicsOptions.gradient != tools::DynamicSensor::Static);
|
||||
}
|
||||
|
||||
// ButtonSet overrides
|
||||
void onItemChange(Item* item) override {
|
||||
ButtonSet::onItemChange(item);
|
||||
@ -1291,10 +1298,29 @@ private:
|
||||
// Widget overrides
|
||||
void onInitTheme(InitThemeEvent& ev) override {
|
||||
ButtonSet::onInitTheme(ev);
|
||||
|
||||
auto& dynaPref = Preferences::instance().tool(getTool()).dynamics;
|
||||
updateIcon(dynaPref.size() != tools::DynamicSensor::Static ||
|
||||
dynaPref.angle() != tools::DynamicSensor::Static ||
|
||||
dynaPref.gradient() != tools::DynamicSensor::Static);
|
||||
|
||||
if (m_popup)
|
||||
m_popup->initTheme();
|
||||
}
|
||||
|
||||
tools::Tool* getTool() const {
|
||||
if (m_sameInAllTools)
|
||||
return nullptr; // For shared dynamic options we use tool=nullptr
|
||||
else
|
||||
return App::instance()->activeTool();
|
||||
}
|
||||
|
||||
void updateIcon(const bool dynamicsOn) {
|
||||
auto theme = SkinTheme::get(this);
|
||||
getItem(0)->setIcon(dynamicsOn ? theme->parts.dynamicsOn():
|
||||
theme->parts.dynamics());
|
||||
}
|
||||
|
||||
std::unique_ptr<DynamicsPopup> m_popup;
|
||||
ContextBar* m_ctxBar;
|
||||
mutable tools::DynamicsOptions m_dynamics;
|
||||
@ -2202,6 +2228,8 @@ void ContextBar::updateForTool(tools::Tool* tool)
|
||||
m_autoSelectLayer->setVisible(isMove);
|
||||
m_dynamics->setVisible(supportDynamics);
|
||||
m_dynamics->setOptionsGridVisibility(isFreehand && !hasSelectOptions);
|
||||
if (supportDynamics)
|
||||
m_dynamics->updateIconFromActiveToolPref();
|
||||
m_freehandBox->setVisible(isFreehand && (supportOpacity || hasSelectOptions));
|
||||
m_toleranceLabel->setVisible(hasTolerance);
|
||||
m_tolerance->setVisible(hasTolerance);
|
||||
|
@ -482,6 +482,10 @@ void DynamicsPopup::refreshVisibility()
|
||||
|
||||
m_hotRegion |= gfx::Region(boundsOnScreen());
|
||||
setHotRegion(m_hotRegion);
|
||||
|
||||
// Inform to the delegate that the dynamics have changed (so the
|
||||
// delegate can update the UI to show if the dynamics are on/off).
|
||||
m_delegate->onDynamicsChange(getDynamics());
|
||||
}
|
||||
|
||||
bool DynamicsPopup::sharedSettings() const
|
||||
|
@ -32,6 +32,7 @@ namespace app {
|
||||
virtual doc::BrushRef getActiveBrush() = 0;
|
||||
virtual void setMaxSize(int size) = 0;
|
||||
virtual void setMaxAngle(int angle) = 0;
|
||||
virtual void onDynamicsChange(const tools::DynamicsOptions& dynamicsOptions) = 0;
|
||||
};
|
||||
DynamicsPopup(Delegate* delegate);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user