mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-05 18:40:37 +00:00
Rename MiniEditorWindow to PreviewEditorWindow
This commit is contained in:
parent
d1d49c5038
commit
5f78fbe354
@ -293,12 +293,12 @@ add_library(app-lib
|
||||
ui/keyboard_shortcuts.cpp
|
||||
ui/main_menu_bar.cpp
|
||||
ui/main_window.cpp
|
||||
ui/mini_editor.cpp
|
||||
ui/notifications.cpp
|
||||
ui/palette_popup.cpp
|
||||
ui/palette_view.cpp
|
||||
ui/palettes_listbox.cpp
|
||||
ui/popup_window_pin.cpp
|
||||
ui/preview_editor.cpp
|
||||
ui/resources_listbox.cpp
|
||||
ui/select_accelerator.cpp
|
||||
ui/skin/button_icon_impl.cpp
|
||||
|
@ -34,14 +34,14 @@
|
||||
#include "app/settings/settings.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui/mini_editor.h"
|
||||
#include "app/ui/preview_editor.h"
|
||||
#include "doc/image.h"
|
||||
#include "doc/palette.h"
|
||||
#include "doc/sprite.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
// TODO merge this with MiniEditor logic and create a new Editor state
|
||||
// TODO merge this with PreviewEditor logic and create a new Editor state
|
||||
|
||||
using namespace ui;
|
||||
|
||||
@ -192,16 +192,17 @@ void PlayAnimationCommand::onExecute(Context* context)
|
||||
}
|
||||
|
||||
// Hide mini editor
|
||||
MiniEditorWindow* miniEditor = App::instance()->getMainWindow()->getMiniEditor();
|
||||
bool enabled = (miniEditor ? miniEditor->isMiniEditorEnabled(): false);
|
||||
PreviewEditorWindow* preview =
|
||||
App::instance()->getMainWindow()->getPreviewEditor();
|
||||
bool enabled = (preview ? preview->isPreviewEnabled(): false);
|
||||
if (enabled)
|
||||
miniEditor->setMiniEditorEnabled(false);
|
||||
preview->setPreviewEnabled(false);
|
||||
|
||||
PlayAniWindow window(context, current_editor);
|
||||
window.openWindowInForeground();
|
||||
|
||||
if (enabled)
|
||||
miniEditor->setMiniEditorEnabled(enabled);
|
||||
preview->setPreviewEnabled(enabled);
|
||||
}
|
||||
|
||||
Command* CommandFactory::createPlayAnimationCommand()
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "app/commands/command.h"
|
||||
#include "app/context.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui/mini_editor.h"
|
||||
#include "app/ui/preview_editor.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
@ -58,17 +58,17 @@ bool TogglePreviewCommand::onChecked(Context* context)
|
||||
if (!mainWin)
|
||||
return false;
|
||||
|
||||
MiniEditorWindow* previewWin = mainWin->getMiniEditor();
|
||||
PreviewEditorWindow* previewWin = mainWin->getPreviewEditor();
|
||||
return (previewWin && previewWin->isVisible());
|
||||
}
|
||||
|
||||
void TogglePreviewCommand::onExecute(Context* context)
|
||||
{
|
||||
MiniEditorWindow* previewWin =
|
||||
App::instance()->getMainWindow()->getMiniEditor();
|
||||
PreviewEditorWindow* previewWin =
|
||||
App::instance()->getMainWindow()->getPreviewEditor();
|
||||
|
||||
bool state = previewWin->isMiniEditorEnabled();
|
||||
previewWin->setMiniEditorEnabled(!state);
|
||||
bool state = previewWin->isPreviewEnabled();
|
||||
previewWin->setPreviewEnabled(!state);
|
||||
}
|
||||
|
||||
Command* CommandFactory::createTogglePreviewCommand()
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "app/ui/editor/editor_view.h"
|
||||
#include "app/ui/keyboard_shortcuts.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui/mini_editor.h"
|
||||
#include "app/ui/preview_editor.h"
|
||||
#include "app/ui/workspace.h"
|
||||
#include "base/path.h"
|
||||
#include "doc/document_event.h"
|
||||
@ -62,16 +62,16 @@ public:
|
||||
|
||||
// EditorObserver implementation
|
||||
void dispose() override {
|
||||
App::instance()->getMainWindow()->getMiniEditor()->updateUsingEditor(NULL);
|
||||
App::instance()->getMainWindow()->getPreviewEditor()->updateUsingEditor(NULL);
|
||||
}
|
||||
|
||||
void onScrollChanged(Editor* editor) override {
|
||||
if (current_editor == this)
|
||||
App::instance()->getMainWindow()->getMiniEditor()->updateUsingEditor(this);
|
||||
App::instance()->getMainWindow()->getPreviewEditor()->updateUsingEditor(this);
|
||||
}
|
||||
|
||||
void onAfterFrameChanged(Editor* editor) override {
|
||||
App::instance()->getMainWindow()->getMiniEditor()->updateUsingEditor(this);
|
||||
App::instance()->getMainWindow()->getPreviewEditor()->updateUsingEditor(this);
|
||||
|
||||
set_current_palette(editor->sprite()->palette(editor->frame()), true);
|
||||
}
|
||||
@ -157,7 +157,7 @@ DocumentView::DocumentView(Document* document, Type type)
|
||||
EditorView::AlwaysSelected))
|
||||
, m_editor(type == Normal ?
|
||||
new AppEditor(document):
|
||||
new Editor(document, Editor::kShowOutside)) // Don't show grid/mask in mini preview
|
||||
new Editor(document, Editor::kShowOutside)) // Don't show grid/mask in preview preview
|
||||
{
|
||||
addChild(m_view);
|
||||
|
||||
|
@ -36,8 +36,8 @@
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/editor/editor_view.h"
|
||||
#include "app/ui/main_menu_bar.h"
|
||||
#include "app/ui/mini_editor.h"
|
||||
#include "app/ui/notifications.h"
|
||||
#include "app/ui/preview_editor.h"
|
||||
#include "app/ui/skin/skin_property.h"
|
||||
#include "app/ui/skin/skin_theme.h"
|
||||
#include "app/ui/start_view.h"
|
||||
@ -89,7 +89,7 @@ MainWindow::MainWindow()
|
||||
m_tabsBar = new Tabs(this);
|
||||
m_workspace = new Workspace();
|
||||
m_workspace->ActiveViewChanged.connect(&MainWindow::onActiveViewChange, this);
|
||||
m_miniEditor = new MiniEditorWindow();
|
||||
m_previewEditor = new PreviewEditorWindow();
|
||||
m_timeline = new Timeline();
|
||||
m_colorBarSplitter = findChildT<Splitter>("colorbarsplitter");
|
||||
m_timelineSplitter = findChildT<Splitter>("timelinesplitter");
|
||||
@ -138,7 +138,7 @@ MainWindow::~MainWindow()
|
||||
delete m_startView;
|
||||
}
|
||||
delete m_contextBar;
|
||||
delete m_miniEditor;
|
||||
delete m_previewEditor;
|
||||
|
||||
// Destroy the workspace first so ~Editor can dettach slots from
|
||||
// ColorBar. TODO this is a terrible hack for slot/signal stuff,
|
||||
|
@ -33,7 +33,7 @@ namespace app {
|
||||
class ContextBar;
|
||||
class INotificationDelegate;
|
||||
class MainMenuBar;
|
||||
class MiniEditorWindow;
|
||||
class PreviewEditorWindow;
|
||||
class Notifications;
|
||||
class StartView;
|
||||
class StatusBar;
|
||||
@ -58,7 +58,7 @@ namespace app {
|
||||
Tabs* getTabsBar() { return m_tabsBar; }
|
||||
Timeline* getTimeline() { return m_timeline; }
|
||||
Workspace* getWorkspace() { return m_workspace; }
|
||||
MiniEditorWindow* getMiniEditor() { return m_miniEditor; }
|
||||
PreviewEditorWindow* getPreviewEditor() { return m_previewEditor; }
|
||||
|
||||
void start();
|
||||
void reloadMenus();
|
||||
@ -94,7 +94,7 @@ namespace app {
|
||||
Mode m_mode;
|
||||
Timeline* m_timeline;
|
||||
Workspace* m_workspace;
|
||||
MiniEditorWindow* m_miniEditor;
|
||||
PreviewEditorWindow* m_previewEditor;
|
||||
StartView* m_startView;
|
||||
Notifications* m_notifications;
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Aseprite
|
||||
* Copyright (C) 2001-2013 David Capello
|
||||
* Copyright (C) 2001-2015 David Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -20,7 +20,7 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/ui/mini_editor.h"
|
||||
#include "app/ui/preview_editor.h"
|
||||
|
||||
#include "app/document.h"
|
||||
#include "app/handle_anidir.h"
|
||||
@ -114,7 +114,7 @@ private:
|
||||
bool m_isPlaying;
|
||||
};
|
||||
|
||||
MiniEditorWindow::MiniEditorWindow()
|
||||
PreviewEditorWindow::PreviewEditorWindow()
|
||||
: Window(WithTitleBar, "Preview")
|
||||
, m_docView(NULL)
|
||||
, m_playButton(new MiniPlayButton())
|
||||
@ -127,25 +127,25 @@ MiniEditorWindow::MiniEditorWindow()
|
||||
|
||||
m_isEnabled = get_config_bool("MiniEditor", "Enabled", true);
|
||||
|
||||
m_playButton->Click.connect(Bind<void>(&MiniEditorWindow::onPlayClicked, this));
|
||||
m_playButton->Click.connect(Bind<void>(&PreviewEditorWindow::onPlayClicked, this));
|
||||
addChild(m_playButton);
|
||||
|
||||
m_playTimer.Tick.connect(&MiniEditorWindow::onPlaybackTick, this);
|
||||
m_playTimer.Tick.connect(&PreviewEditorWindow::onPlaybackTick, this);
|
||||
}
|
||||
|
||||
MiniEditorWindow::~MiniEditorWindow()
|
||||
PreviewEditorWindow::~PreviewEditorWindow()
|
||||
{
|
||||
set_config_bool("MiniEditor", "Enabled", m_isEnabled);
|
||||
}
|
||||
|
||||
void MiniEditorWindow::setMiniEditorEnabled(bool state)
|
||||
void PreviewEditorWindow::setPreviewEnabled(bool state)
|
||||
{
|
||||
m_isEnabled = state;
|
||||
|
||||
updateUsingEditor(current_editor);
|
||||
}
|
||||
|
||||
bool MiniEditorWindow::onProcessMessage(ui::Message* msg)
|
||||
bool PreviewEditorWindow::onProcessMessage(ui::Message* msg)
|
||||
{
|
||||
switch (msg->type()) {
|
||||
|
||||
@ -175,7 +175,7 @@ bool MiniEditorWindow::onProcessMessage(ui::Message* msg)
|
||||
return Window::onProcessMessage(msg);
|
||||
}
|
||||
|
||||
void MiniEditorWindow::onClose(ui::CloseEvent& ev)
|
||||
void PreviewEditorWindow::onClose(ui::CloseEvent& ev)
|
||||
{
|
||||
Button* closeButton = dynamic_cast<Button*>(ev.getSource());
|
||||
if (closeButton != NULL &&
|
||||
@ -194,7 +194,7 @@ void MiniEditorWindow::onClose(ui::CloseEvent& ev)
|
||||
}
|
||||
}
|
||||
|
||||
void MiniEditorWindow::onWindowResize()
|
||||
void PreviewEditorWindow::onWindowResize()
|
||||
{
|
||||
Window::onWindowResize();
|
||||
|
||||
@ -203,7 +203,7 @@ void MiniEditorWindow::onWindowResize()
|
||||
updateUsingEditor(view->getEditor());
|
||||
}
|
||||
|
||||
void MiniEditorWindow::onPlayClicked()
|
||||
void PreviewEditorWindow::onPlayClicked()
|
||||
{
|
||||
if (m_playButton->isPlaying()) {
|
||||
Editor* miniEditor = (m_docView ? m_docView->getEditor(): NULL);
|
||||
@ -222,7 +222,7 @@ void MiniEditorWindow::onPlayClicked()
|
||||
}
|
||||
}
|
||||
|
||||
void MiniEditorWindow::updateUsingEditor(Editor* editor)
|
||||
void PreviewEditorWindow::updateUsingEditor(Editor* editor)
|
||||
{
|
||||
if (!m_isEnabled || !editor) {
|
||||
hideWindow();
|
||||
@ -255,7 +255,7 @@ void MiniEditorWindow::updateUsingEditor(Editor* editor)
|
||||
miniEditor->setFrame(editor->frame());
|
||||
}
|
||||
|
||||
void MiniEditorWindow::hideWindow()
|
||||
void PreviewEditorWindow::hideWindow()
|
||||
{
|
||||
delete m_docView;
|
||||
m_docView = NULL;
|
||||
@ -264,7 +264,7 @@ void MiniEditorWindow::hideWindow()
|
||||
closeWindow(NULL);
|
||||
}
|
||||
|
||||
void MiniEditorWindow::onPlaybackTick()
|
||||
void PreviewEditorWindow::onPlaybackTick()
|
||||
{
|
||||
Editor* miniEditor = (m_docView ? m_docView->getEditor(): NULL);
|
||||
if (!miniEditor)
|
@ -1,5 +1,5 @@
|
||||
/* Aseprite
|
||||
* Copyright (C) 2001-2013 David Capello
|
||||
* Copyright (C) 2001-2015 David Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -16,8 +16,8 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef APP_UI_MINI_EDITOR_VIEW_H_INCLUDED
|
||||
#define APP_UI_MINI_EDITOR_VIEW_H_INCLUDED
|
||||
#ifndef APP_UI_PREVIEW_EDITOR_H_INCLUDED
|
||||
#define APP_UI_PREVIEW_EDITOR_H_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "app/ui/document_view.h"
|
||||
@ -27,13 +27,13 @@
|
||||
namespace app {
|
||||
class MiniPlayButton;
|
||||
|
||||
class MiniEditorWindow : public ui::Window {
|
||||
class PreviewEditorWindow : public ui::Window {
|
||||
public:
|
||||
MiniEditorWindow();
|
||||
~MiniEditorWindow();
|
||||
PreviewEditorWindow();
|
||||
~PreviewEditorWindow();
|
||||
|
||||
bool isMiniEditorEnabled() const { return m_isEnabled; }
|
||||
void setMiniEditorEnabled(bool state);
|
||||
bool isPreviewEnabled() const { return m_isEnabled; }
|
||||
void setPreviewEnabled(bool state);
|
||||
|
||||
void updateUsingEditor(Editor* editor);
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "app/tools/tool_box.h"
|
||||
#include "app/ui/keyboard_shortcuts.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui/mini_editor.h"
|
||||
#include "app/ui/preview_editor.h"
|
||||
#include "app/ui/skin/skin_theme.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/ui_context.h"
|
||||
@ -166,14 +166,14 @@ bool ToolBar::onProcessMessage(Message* msg)
|
||||
UIContext::instance()->executeCommand(conf_tools_cmd);
|
||||
}
|
||||
|
||||
toolrc = getToolGroupBounds(MiniEditorVisibilityIndex);
|
||||
toolrc = getToolGroupBounds(PreviewVisibilityIndex);
|
||||
if (mouseMsg->position().y >= toolrc.y &&
|
||||
mouseMsg->position().y < toolrc.y+toolrc.h) {
|
||||
// Switch the state of the mini editor
|
||||
MiniEditorWindow* miniEditorWindow =
|
||||
App::instance()->getMainWindow()->getMiniEditor();
|
||||
bool state = miniEditorWindow->isMiniEditorEnabled();
|
||||
miniEditorWindow->setMiniEditorEnabled(!state);
|
||||
// Toggle preview visibility
|
||||
PreviewEditorWindow* preview =
|
||||
App::instance()->getMainWindow()->getPreviewEditor();
|
||||
bool state = preview->isPreviewEnabled();
|
||||
preview->setPreviewEnabled(!state);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -211,10 +211,10 @@ bool ToolBar::onProcessMessage(Message* msg)
|
||||
new_hot_index = ConfigureToolIndex;
|
||||
}
|
||||
|
||||
toolrc = getToolGroupBounds(MiniEditorVisibilityIndex);
|
||||
toolrc = getToolGroupBounds(PreviewVisibilityIndex);
|
||||
if (mouseMsg->position().y >= toolrc.y &&
|
||||
mouseMsg->position().y < toolrc.y+toolrc.h) {
|
||||
new_hot_index = MiniEditorVisibilityIndex;
|
||||
new_hot_index = PreviewVisibilityIndex;
|
||||
}
|
||||
|
||||
// hot button changed
|
||||
@ -373,11 +373,11 @@ void ToolBar::onPaint(ui::PaintEvent& ev)
|
||||
toolrc.y+toolrc.h/2-icon->height()/2);
|
||||
}
|
||||
|
||||
// Draw button to show/hide mini editor
|
||||
toolrc = getToolGroupBounds(MiniEditorVisibilityIndex);
|
||||
// Draw button to show/hide preview
|
||||
toolrc = getToolGroupBounds(PreviewVisibilityIndex);
|
||||
toolrc.offset(-getBounds().x, -getBounds().y);
|
||||
isHot = (m_hotIndex == MiniEditorVisibilityIndex ||
|
||||
App::instance()->getMainWindow()->getMiniEditor()->isMiniEditorEnabled());
|
||||
isHot = (m_hotIndex == PreviewVisibilityIndex ||
|
||||
App::instance()->getMainWindow()->getPreviewEditor()->isPreviewEnabled());
|
||||
theme->draw_bounds_nw(g,
|
||||
toolrc,
|
||||
isHot ? PART_TOOLBUTTON_HOT_NW:
|
||||
@ -490,7 +490,7 @@ Rect ToolBar::getToolGroupBounds(int group_index)
|
||||
rc.h = iconsize.h+2*guiscale();
|
||||
break;
|
||||
|
||||
case MiniEditorVisibilityIndex:
|
||||
case PreviewVisibilityIndex:
|
||||
rc.y += rc.h - iconsize.h - 2*guiscale();
|
||||
rc.h = iconsize.h+2*guiscale();
|
||||
break;
|
||||
@ -551,11 +551,11 @@ void ToolBar::openTipWindow(int group_index, Tool* tool)
|
||||
else if (group_index == ConfigureToolIndex) {
|
||||
tooltip = "Configure Tool";
|
||||
}
|
||||
else if (group_index == MiniEditorVisibilityIndex) {
|
||||
if (App::instance()->getMainWindow()->getMiniEditor()->isMiniEditorEnabled())
|
||||
tooltip = "Disable Mini-Editor";
|
||||
else if (group_index == PreviewVisibilityIndex) {
|
||||
if (App::instance()->getMainWindow()->getPreviewEditor()->isPreviewEnabled())
|
||||
tooltip = "Hide Preview";
|
||||
else
|
||||
tooltip = "Enable Mini-Editor";
|
||||
tooltip = "Show Preview";
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Aseprite
|
||||
* Copyright (C) 2001-2013 David Capello
|
||||
* Copyright (C) 2001-2015 David Capello
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -47,7 +47,7 @@ namespace app {
|
||||
|
||||
static const int NoneIndex = -1;
|
||||
static const int ConfigureToolIndex = -2;
|
||||
static const int MiniEditorVisibilityIndex = -3;
|
||||
static const int PreviewVisibilityIndex = -3;
|
||||
|
||||
ToolBar();
|
||||
~ToolBar();
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "app/ui/document_view.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/main_window.h"
|
||||
#include "app/ui/mini_editor.h"
|
||||
#include "app/ui/preview_editor.h"
|
||||
#include "app/ui/tabs.h"
|
||||
#include "app/ui/timeline.h"
|
||||
#include "app/ui/workspace.h"
|
||||
@ -92,11 +92,12 @@ void UIContext::setActiveView(DocumentView* docView)
|
||||
|
||||
setActiveDocument(docView ? docView->getDocument(): NULL);
|
||||
|
||||
if (docView != NULL) {
|
||||
App::instance()->getMainWindow()->getTabsBar()->selectTab(docView);
|
||||
MainWindow* mainWin = App::instance()->getMainWindow();
|
||||
if (docView) {
|
||||
mainWin->getTabsBar()->selectTab(docView);
|
||||
|
||||
if (App::instance()->getMainWindow()->getWorkspace()->activeView() != docView)
|
||||
App::instance()->getMainWindow()->getWorkspace()->setActiveView(docView);
|
||||
if (mainWin->getWorkspace()->activeView() != docView)
|
||||
mainWin->getWorkspace()->setActiveView(docView);
|
||||
}
|
||||
|
||||
current_editor = (docView ? docView->getEditor(): NULL);
|
||||
@ -104,8 +105,8 @@ void UIContext::setActiveView(DocumentView* docView)
|
||||
if (current_editor)
|
||||
current_editor->requestFocus();
|
||||
|
||||
App::instance()->getMainWindow()->getMiniEditor()->updateUsingEditor(current_editor);
|
||||
App::instance()->getMainWindow()->getTimeline()->updateUsingEditor(current_editor);
|
||||
mainWin->getPreviewEditor()->updateUsingEditor(current_editor);
|
||||
mainWin->getTimeline()->updateUsingEditor(current_editor);
|
||||
|
||||
// Change the image-type of color bar.
|
||||
ColorBar::instance()->setPixelFormat(app_get_current_pixel_format());
|
||||
|
Loading…
x
Reference in New Issue
Block a user