mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-05 21:57:20 +00:00
Add Editor::changePreferredSettings() to fix problems with mini editor
changing the preferred document settings (scroll+zoom).
This commit is contained in:
parent
4a4db10ea8
commit
ac74679cc2
@ -127,6 +127,17 @@ public:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MiniEditor : public Editor
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MiniEditor() {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool changePreferredSettings() OVERRIDE {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
int init_module_editors()
|
int init_module_editors()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
@ -553,7 +564,7 @@ static void create_mini_editor_frame()
|
|||||||
View* newView = new EditorView(EditorView::AlwaysSelected);
|
View* newView = new EditorView(EditorView::AlwaysSelected);
|
||||||
jwidget_expansive(newView, true);
|
jwidget_expansive(newView, true);
|
||||||
|
|
||||||
mini_editor = new Editor();
|
mini_editor = new MiniEditor();
|
||||||
editors.push_back(EditorItem(mini_editor, EditorItem::Mini));
|
editors.push_back(EditorItem(mini_editor, EditorItem::Mini));
|
||||||
|
|
||||||
newView->attachToView(mini_editor);
|
newView->attachToView(mini_editor);
|
||||||
|
@ -205,7 +205,7 @@ void Editor::setEditorScroll(int x, int y, int use_refresh_region)
|
|||||||
view->setViewScroll(Point(x, y));
|
view->setViewScroll(Point(x, y));
|
||||||
Point newScroll = view->getViewScroll();
|
Point newScroll = view->getViewScroll();
|
||||||
|
|
||||||
if (m_document) {
|
if (m_document && changePreferredSettings()) {
|
||||||
PreferredEditorSettings preferred;
|
PreferredEditorSettings preferred;
|
||||||
|
|
||||||
preferred.virgin = false;
|
preferred.virgin = false;
|
||||||
|
@ -156,6 +156,12 @@ protected:
|
|||||||
bool onProcessMessage(Message* msg) OVERRIDE;
|
bool onProcessMessage(Message* msg) OVERRIDE;
|
||||||
void onCurrentToolChange();
|
void onCurrentToolChange();
|
||||||
|
|
||||||
|
// Returns true if this editor should change the preferred document
|
||||||
|
// settings.
|
||||||
|
virtual bool changePreferredSettings() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void drawGrid(const gfx::Rect& gridBounds, const Color& color);
|
void drawGrid(const gfx::Rect& gridBounds, const Color& color);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user