mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 15:32:38 +00:00
Fix default MiniEditorWindow position
This commit is contained in:
parent
5584424b79
commit
9fa0f4077b
@ -107,9 +107,8 @@ void EditorView::setupScrollbars()
|
||||
!UIContext::instance()->settings()->getShowSpriteEditorScrollbars())
|
||||
hideScrollBars();
|
||||
else {
|
||||
// TODO hardcoded scroll bar width should be get from skin.xml file
|
||||
getHorizontalBar()->setBarWidth(6*jguiscale());
|
||||
getVerticalBar()->setBarWidth(6*jguiscale());
|
||||
getHorizontalBar()->setBarWidth(kEditorViewScrollbarWidth*jguiscale());
|
||||
getVerticalBar()->setBarWidth(kEditorViewScrollbarWidth*jguiscale());
|
||||
|
||||
setup_mini_look(getHorizontalBar());
|
||||
setup_mini_look(getVerticalBar());
|
||||
|
@ -25,6 +25,9 @@
|
||||
|
||||
namespace app {
|
||||
|
||||
// TODO hardcoded scroll bar width should be get from skin.xml file
|
||||
const int kEditorViewScrollbarWidth = 6;
|
||||
|
||||
class EditorView : public ui::View,
|
||||
public GlobalSettingsObserver {
|
||||
public:
|
||||
|
@ -22,18 +22,19 @@
|
||||
|
||||
#include "app/ui/mini_editor.h"
|
||||
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/ui/toolbar.h"
|
||||
#include "base/bind.h"
|
||||
#include "app/document.h"
|
||||
#include "gfx/rect.h"
|
||||
#include "app/ini_file.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/gui.h"
|
||||
#include "raster/sprite.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "app/ui/editor/editor_view.h"
|
||||
#include "app/ui/skin/skin_button.h"
|
||||
#include "app/ui/skin/skin_theme.h"
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/ui/toolbar.h"
|
||||
#include "base/bind.h"
|
||||
#include "gfx/rect.h"
|
||||
#include "raster/sprite.h"
|
||||
#include "ui/base.h"
|
||||
#include "ui/button.h"
|
||||
#include "ui/close_event.h"
|
||||
@ -119,15 +120,6 @@ MiniEditorWindow::MiniEditorWindow()
|
||||
setAutoRemap(false);
|
||||
setWantFocus(false);
|
||||
|
||||
// Default bounds
|
||||
int width = JI_SCREEN_W/4;
|
||||
int height = JI_SCREEN_H/4;
|
||||
setBounds(gfx::Rect(JI_SCREEN_W - width - ToolBar::instance()->getBounds().w,
|
||||
JI_SCREEN_H - height - StatusBar::instance()->getBounds().h,
|
||||
width, height));
|
||||
|
||||
load_window_pos(this, "MiniEditor");
|
||||
|
||||
m_isEnabled = get_config_bool("MiniEditor", "Enabled", true);
|
||||
|
||||
m_playButton->Click.connect(Bind<void>(&MiniEditorWindow::onPlayClicked, this));
|
||||
@ -139,7 +131,6 @@ MiniEditorWindow::MiniEditorWindow()
|
||||
MiniEditorWindow::~MiniEditorWindow()
|
||||
{
|
||||
set_config_bool("MiniEditor", "Enabled", m_isEnabled);
|
||||
save_window_pos(this, "MiniEditor");
|
||||
}
|
||||
|
||||
void MiniEditorWindow::setMiniEditorEnabled(bool state)
|
||||
@ -149,6 +140,35 @@ void MiniEditorWindow::setMiniEditorEnabled(bool state)
|
||||
updateUsingEditor(current_editor);
|
||||
}
|
||||
|
||||
bool MiniEditorWindow::onProcessMessage(ui::Message* msg)
|
||||
{
|
||||
switch (msg->type()) {
|
||||
|
||||
case kOpenMessage:
|
||||
{
|
||||
// Default bounds
|
||||
int width = JI_SCREEN_W/4;
|
||||
int height = JI_SCREEN_H/4;
|
||||
int extra = 2*kEditorViewScrollbarWidth*jguiscale();
|
||||
setBounds(
|
||||
gfx::Rect(
|
||||
JI_SCREEN_W - width - ToolBar::instance()->getBounds().w - extra,
|
||||
JI_SCREEN_H - height - StatusBar::instance()->getBounds().h - extra,
|
||||
width, height));
|
||||
|
||||
load_window_pos(this, "MiniEditor");
|
||||
}
|
||||
break;
|
||||
|
||||
case kCloseMessage:
|
||||
save_window_pos(this, "MiniEditor");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return Window::onProcessMessage(msg);
|
||||
}
|
||||
|
||||
void MiniEditorWindow::onClose(ui::CloseEvent& ev)
|
||||
{
|
||||
Button* closeButton = dynamic_cast<Button*>(ev.getSource());
|
||||
|
@ -38,6 +38,7 @@ namespace app {
|
||||
void updateUsingEditor(Editor* editor);
|
||||
|
||||
protected:
|
||||
bool onProcessMessage(ui::Message* msg) OVERRIDE;
|
||||
void onClose(ui::CloseEvent& ev) OVERRIDE;
|
||||
|
||||
private:
|
||||
|
Loading…
x
Reference in New Issue
Block a user