mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-18 11:42:47 +00:00
Fix issue 406: persist ISelectionSettings
This commit is contained in:
parent
095d31a91d
commit
153071f082
@ -183,7 +183,7 @@ class UISelectionSettingsImpl
|
|||||||
, public base::Observable<SelectionSettingsObserver> {
|
, public base::Observable<SelectionSettingsObserver> {
|
||||||
public:
|
public:
|
||||||
UISelectionSettingsImpl();
|
UISelectionSettingsImpl();
|
||||||
~UISelectionSettingsImpl();
|
virtual ~UISelectionSettingsImpl();
|
||||||
|
|
||||||
SelectionMode getSelectionMode();
|
SelectionMode getSelectionMode();
|
||||||
app::Color getMoveTransparentColor();
|
app::Color getMoveTransparentColor();
|
||||||
@ -827,6 +827,8 @@ UISelectionSettingsImpl::UISelectionSettingsImpl() :
|
|||||||
|
|
||||||
UISelectionSettingsImpl::~UISelectionSettingsImpl()
|
UISelectionSettingsImpl::~UISelectionSettingsImpl()
|
||||||
{
|
{
|
||||||
|
set_config_int("Tools", "SelectionMode", (int)m_selectionMode);
|
||||||
|
set_config_int("Tools", "RotAlgorithm", (int)m_rotationAlgorithm);
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectionMode UISelectionSettingsImpl::getSelectionMode()
|
SelectionMode UISelectionSettingsImpl::getSelectionMode()
|
||||||
@ -859,7 +861,6 @@ void UISelectionSettingsImpl::setMoveTransparentColor(app::Color color)
|
|||||||
void UISelectionSettingsImpl::setRotationAlgorithm(RotationAlgorithm algorithm)
|
void UISelectionSettingsImpl::setRotationAlgorithm(RotationAlgorithm algorithm)
|
||||||
{
|
{
|
||||||
m_rotationAlgorithm = algorithm;
|
m_rotationAlgorithm = algorithm;
|
||||||
set_config_int("Tools", "RotAlgorithm", m_rotationAlgorithm);
|
|
||||||
notifyObservers(&SelectionSettingsObserver::onSetRotationAlgorithm, algorithm);
|
notifyObservers(&SelectionSettingsObserver::onSetRotationAlgorithm, algorithm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,16 +395,23 @@ class ContextBar::RotAlgorithmField : public ComboBox
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RotAlgorithmField() {
|
RotAlgorithmField() {
|
||||||
|
// We use "m_lockChange" variable to avoid setting the rotation
|
||||||
|
// algorithm when we call ComboBox::addItem() (because the first
|
||||||
|
// addItem() generates an onChange() event).
|
||||||
|
m_lockChange = true;
|
||||||
addItem(new Item("Fast Rotation", kFastRotationAlgorithm));
|
addItem(new Item("Fast Rotation", kFastRotationAlgorithm));
|
||||||
addItem(new Item("RotSprite", kRotSpriteRotationAlgorithm));
|
addItem(new Item("RotSprite", kRotSpriteRotationAlgorithm));
|
||||||
|
m_lockChange = false;
|
||||||
|
|
||||||
setSelectedItemIndex((int)
|
setSelectedItemIndex((int)UIContext::instance()->settings()
|
||||||
UIContext::instance()->settings()->selection()
|
->selection()->getRotationAlgorithm());
|
||||||
->getRotationAlgorithm());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onChange() OVERRIDE {
|
void onChange() OVERRIDE {
|
||||||
|
if (m_lockChange)
|
||||||
|
return;
|
||||||
|
|
||||||
UIContext::instance()->settings()->selection()
|
UIContext::instance()->settings()->selection()
|
||||||
->setRotationAlgorithm(static_cast<Item*>(getSelectedItem())->algo());
|
->setRotationAlgorithm(static_cast<Item*>(getSelectedItem())->algo());
|
||||||
}
|
}
|
||||||
@ -426,6 +433,8 @@ private:
|
|||||||
private:
|
private:
|
||||||
RotationAlgorithm m_algo;
|
RotationAlgorithm m_algo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool m_lockChange;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ContextBar::FreehandAlgorithmField : public CheckBox
|
class ContextBar::FreehandAlgorithmField : public CheckBox
|
||||||
@ -457,6 +466,9 @@ public:
|
|||||||
PART_SELECTION_REPLACE,
|
PART_SELECTION_REPLACE,
|
||||||
PART_SELECTION_ADD,
|
PART_SELECTION_ADD,
|
||||||
PART_SELECTION_SUBTRACT) {
|
PART_SELECTION_SUBTRACT) {
|
||||||
|
setSelectedItem(
|
||||||
|
(int)UIContext::instance()->settings()
|
||||||
|
->selection()->getSelectionMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
void setupTooltips(TooltipManager* tooltipManager)
|
void setupTooltips(TooltipManager* tooltipManager)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user