mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-30 04:20:23 +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:
|
||||
UISelectionSettingsImpl();
|
||||
~UISelectionSettingsImpl();
|
||||
virtual ~UISelectionSettingsImpl();
|
||||
|
||||
SelectionMode getSelectionMode();
|
||||
app::Color getMoveTransparentColor();
|
||||
@ -827,6 +827,8 @@ UISelectionSettingsImpl::UISelectionSettingsImpl() :
|
||||
|
||||
UISelectionSettingsImpl::~UISelectionSettingsImpl()
|
||||
{
|
||||
set_config_int("Tools", "SelectionMode", (int)m_selectionMode);
|
||||
set_config_int("Tools", "RotAlgorithm", (int)m_rotationAlgorithm);
|
||||
}
|
||||
|
||||
SelectionMode UISelectionSettingsImpl::getSelectionMode()
|
||||
@ -859,7 +861,6 @@ void UISelectionSettingsImpl::setMoveTransparentColor(app::Color color)
|
||||
void UISelectionSettingsImpl::setRotationAlgorithm(RotationAlgorithm algorithm)
|
||||
{
|
||||
m_rotationAlgorithm = algorithm;
|
||||
set_config_int("Tools", "RotAlgorithm", m_rotationAlgorithm);
|
||||
notifyObservers(&SelectionSettingsObserver::onSetRotationAlgorithm, algorithm);
|
||||
}
|
||||
|
||||
|
@ -395,16 +395,23 @@ class ContextBar::RotAlgorithmField : public ComboBox
|
||||
{
|
||||
public:
|
||||
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("RotSprite", kRotSpriteRotationAlgorithm));
|
||||
m_lockChange = false;
|
||||
|
||||
setSelectedItemIndex((int)
|
||||
UIContext::instance()->settings()->selection()
|
||||
->getRotationAlgorithm());
|
||||
setSelectedItemIndex((int)UIContext::instance()->settings()
|
||||
->selection()->getRotationAlgorithm());
|
||||
}
|
||||
|
||||
protected:
|
||||
void onChange() OVERRIDE {
|
||||
if (m_lockChange)
|
||||
return;
|
||||
|
||||
UIContext::instance()->settings()->selection()
|
||||
->setRotationAlgorithm(static_cast<Item*>(getSelectedItem())->algo());
|
||||
}
|
||||
@ -426,6 +433,8 @@ private:
|
||||
private:
|
||||
RotationAlgorithm m_algo;
|
||||
};
|
||||
|
||||
bool m_lockChange;
|
||||
};
|
||||
|
||||
class ContextBar::FreehandAlgorithmField : public CheckBox
|
||||
@ -457,6 +466,9 @@ public:
|
||||
PART_SELECTION_REPLACE,
|
||||
PART_SELECTION_ADD,
|
||||
PART_SELECTION_SUBTRACT) {
|
||||
setSelectedItem(
|
||||
(int)UIContext::instance()->settings()
|
||||
->selection()->getSelectionMode());
|
||||
}
|
||||
|
||||
void setupTooltips(TooltipManager* tooltipManager)
|
||||
|
Loading…
x
Reference in New Issue
Block a user