mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-28 00:35:30 +00:00
Add "Zoom with Scroll Wheel" option (on/true by default)
This commit is contained in:
parent
0c250df97a
commit
331688bd86
@ -19,6 +19,7 @@
|
||||
<label text="Screen Scale:" />
|
||||
<combobox id="screen_scale" expansive="true" />
|
||||
</grid>
|
||||
<check text="Zoom with Scroll Wheel" id="wheel_zoom" />
|
||||
</vbox>
|
||||
|
||||
<!-- Editor -->
|
||||
|
@ -74,6 +74,7 @@ public:
|
||||
>> "undo_size_limit" >> m_undo_size_limit
|
||||
>> "undo_goto_modified" >> m_undo_goto_modified
|
||||
>> "screen_scale" >> m_screen_scale
|
||||
>> "wheel_zoom" >> m_wheel_zoom
|
||||
>> "locate_file" >> m_locate_file
|
||||
>> "button_ok" >> m_button_ok;
|
||||
|
||||
@ -105,6 +106,9 @@ public:
|
||||
m_screen_scale->addItem("4:1");
|
||||
m_screen_scale->setSelectedItemIndex(get_screen_scaling()-1);
|
||||
|
||||
// Zoom with Scroll Wheel
|
||||
m_wheel_zoom->setSelected(m_settings->getZoomWithScrollWheel());
|
||||
|
||||
// Checked background size
|
||||
m_checked_bg->addItem("16x16");
|
||||
m_checked_bg->addItem("8x8");
|
||||
@ -149,6 +153,7 @@ public:
|
||||
set_config_bool("Options", "AutoShowTimeline", m_check_autotimeline->isSelected());
|
||||
|
||||
m_settings->setShowSpriteEditorScrollbars(m_show_scrollbars->isSelected());
|
||||
m_settings->setZoomWithScrollWheel(m_wheel_zoom->isSelected());
|
||||
|
||||
RenderEngine::setCheckedBgType((RenderEngine::CheckedBgType)m_checked_bg->getSelectedItemIndex());
|
||||
RenderEngine::setCheckedBgZoom(m_checked_bg_zoom->isSelected());
|
||||
@ -213,6 +218,7 @@ private:
|
||||
Widget* m_undo_size_limit;
|
||||
Widget* m_undo_goto_modified;
|
||||
ComboBox* m_screen_scale;
|
||||
CheckBox* m_wheel_zoom;
|
||||
LinkLabel* m_locate_file;
|
||||
ColorButton* m_checked_bg_color1;
|
||||
ColorButton* m_checked_bg_color2;
|
||||
|
@ -52,6 +52,7 @@ namespace app {
|
||||
virtual ~ISettings() { }
|
||||
|
||||
// General settings
|
||||
virtual bool getZoomWithScrollWheel() = 0;
|
||||
virtual bool getShowSpriteEditorScrollbars() = 0;
|
||||
virtual bool getGrabAlpha() = 0;
|
||||
virtual app::Color getFgColor() = 0;
|
||||
@ -59,6 +60,7 @@ namespace app {
|
||||
virtual tools::Tool* getCurrentTool() = 0;
|
||||
virtual app::ColorSwatches* getColorSwatches() = 0;
|
||||
|
||||
virtual void setZoomWithScrollWheel(bool state) = 0;
|
||||
virtual void setShowSpriteEditorScrollbars(bool state) = 0;
|
||||
virtual void setGrabAlpha(bool state) = 0;
|
||||
virtual void setFgColor(const app::Color& color) = 0;
|
||||
|
@ -212,6 +212,7 @@ UISettingsImpl::UISettingsImpl()
|
||||
, m_globalDocumentSettings(new UIDocumentSettingsImpl)
|
||||
, m_colorSwatches(NULL)
|
||||
, m_selectionSettings(new UISelectionSettingsImpl)
|
||||
, m_zoomWithScrollWheel(get_config_bool("Options", "ZoomWithMouseWheel", true))
|
||||
, m_showSpriteEditorScrollbars(get_config_bool("Options", "ShowScrollbars", true))
|
||||
, m_grabAlpha(get_config_bool("Options", "GrabAlpha", false))
|
||||
{
|
||||
@ -224,6 +225,7 @@ UISettingsImpl::UISettingsImpl()
|
||||
|
||||
UISettingsImpl::~UISettingsImpl()
|
||||
{
|
||||
set_config_bool("Options", "ZoomWithMouseWheel", m_zoomWithScrollWheel);
|
||||
set_config_bool("Options", "ShowScrollbars", m_showSpriteEditorScrollbars);
|
||||
set_config_bool("Options", "GrabAlpha", m_grabAlpha);
|
||||
|
||||
@ -244,6 +246,11 @@ UISettingsImpl::~UISettingsImpl()
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// General settings
|
||||
|
||||
bool UISettingsImpl::getZoomWithScrollWheel()
|
||||
{
|
||||
return m_zoomWithScrollWheel;
|
||||
}
|
||||
|
||||
bool UISettingsImpl::getShowSpriteEditorScrollbars()
|
||||
{
|
||||
return m_showSpriteEditorScrollbars;
|
||||
@ -277,6 +284,11 @@ app::ColorSwatches* UISettingsImpl::getColorSwatches()
|
||||
return m_colorSwatches;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setZoomWithScrollWheel(bool state)
|
||||
{
|
||||
m_zoomWithScrollWheel = state;
|
||||
}
|
||||
|
||||
void UISettingsImpl::setShowSpriteEditorScrollbars(bool state)
|
||||
{
|
||||
m_showSpriteEditorScrollbars = state;
|
||||
|
@ -41,6 +41,7 @@ namespace app {
|
||||
~UISettingsImpl();
|
||||
|
||||
// ISettings implementation
|
||||
bool getZoomWithScrollWheel() OVERRIDE;
|
||||
bool getShowSpriteEditorScrollbars() OVERRIDE;
|
||||
bool getGrabAlpha() OVERRIDE;
|
||||
app::Color getFgColor() OVERRIDE;
|
||||
@ -48,6 +49,7 @@ namespace app {
|
||||
tools::Tool* getCurrentTool() OVERRIDE;
|
||||
app::ColorSwatches* getColorSwatches() OVERRIDE;
|
||||
|
||||
void setZoomWithScrollWheel(bool state) OVERRIDE;
|
||||
void setShowSpriteEditorScrollbars(bool state) OVERRIDE;
|
||||
void setGrabAlpha(bool state) OVERRIDE;
|
||||
void setFgColor(const app::Color& color) OVERRIDE;
|
||||
@ -76,6 +78,7 @@ namespace app {
|
||||
app::ColorSwatches* m_colorSwatches;
|
||||
std::vector<app::ColorSwatches*> m_colorSwatchesStore;
|
||||
base::UniquePtr<ISelectionSettings> m_selectionSettings;
|
||||
bool m_zoomWithScrollWheel;
|
||||
bool m_showSpriteEditorScrollbars;
|
||||
bool m_grabAlpha;
|
||||
};
|
||||
|
@ -285,33 +285,31 @@ bool StandbyState::onMouseWheel(Editor* editor, MouseMessage* msg)
|
||||
WHEEL_ACTION wheelAction = WHEEL_NONE;
|
||||
bool scrollBigSteps = false;
|
||||
|
||||
// Without modifiers
|
||||
if (msg->keyModifiers() == kKeyNoneModifier) {
|
||||
if (msg->wheelDelta().x != 0)
|
||||
// Alt+mouse wheel changes the fg/bg colors
|
||||
if (msg->altPressed()) {
|
||||
if (msg->shiftPressed())
|
||||
wheelAction = WHEEL_BG;
|
||||
else
|
||||
wheelAction = WHEEL_FG;
|
||||
}
|
||||
// Normal behavior: mouse wheel zooms
|
||||
else if (UIContext::instance()->settings()->getZoomWithScrollWheel()) {
|
||||
if (msg->ctrlPressed())
|
||||
wheelAction = WHEEL_FRAME;
|
||||
else if (msg->wheelDelta().x != 0 || msg->shiftPressed())
|
||||
wheelAction = WHEEL_HSCROLL;
|
||||
else
|
||||
wheelAction = WHEEL_ZOOM;
|
||||
}
|
||||
// For laptops, it's convenient to that Ctrl+wheel zoom (because
|
||||
// it's the "pinch" gesture).
|
||||
else {
|
||||
#if 1 // TODO make it configurable
|
||||
if (msg->altPressed()) {
|
||||
if (msg->shiftPressed())
|
||||
wheelAction = WHEEL_BG;
|
||||
else
|
||||
wheelAction = WHEEL_FG;
|
||||
}
|
||||
else if (msg->ctrlPressed()) {
|
||||
wheelAction = WHEEL_FRAME;
|
||||
}
|
||||
#else
|
||||
if (msg->ctrlPressed())
|
||||
wheelAction = WHEEL_ZOOM;
|
||||
else if (msg->wheelDelta().x != 0 || msg->shiftPressed())
|
||||
wheelAction = WHEEL_HSCROLL;
|
||||
else
|
||||
wheelAction = WHEEL_VSCROLL;
|
||||
|
||||
if (msg->shiftPressed())
|
||||
scrollBigSteps = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
switch (wheelAction) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user