mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-11 18:41:05 +00:00
Don't limit the minimum windows size of the Preview window when we restore its bounds
Fixes https://community.aseprite.org/t/960
This commit is contained in:
parent
4fb260d265
commit
6bdde193f3
@ -36,6 +36,7 @@
|
||||
#include "app/ui/status_bar.h"
|
||||
#include "app/ui/toolbar.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "base/clamp.h"
|
||||
#include "base/fs.h"
|
||||
#include "base/memory.h"
|
||||
#include "base/shared_ptr.h"
|
||||
@ -263,7 +264,8 @@ void update_screen_for_document(const Doc* document)
|
||||
}
|
||||
}
|
||||
|
||||
void load_window_pos(Widget* window, const char *section)
|
||||
void load_window_pos(Widget* window, const char* section,
|
||||
const bool limitMinSize)
|
||||
{
|
||||
// Default position
|
||||
Rect orig_pos = window->bounds();
|
||||
@ -272,11 +274,17 @@ void load_window_pos(Widget* window, const char *section)
|
||||
// Load configurated position
|
||||
pos = get_config_rect(section, "WindowPos", pos);
|
||||
|
||||
pos.w = MID(orig_pos.w, pos.w, ui::display_w());
|
||||
pos.h = MID(orig_pos.h, pos.h, ui::display_h());
|
||||
if (limitMinSize) {
|
||||
pos.w = base::clamp(pos.w, orig_pos.w, ui::display_w());
|
||||
pos.h = base::clamp(pos.h, orig_pos.h, ui::display_h());
|
||||
}
|
||||
else {
|
||||
pos.w = std::min(pos.w, ui::display_w());
|
||||
pos.h = std::min(pos.h, ui::display_h());
|
||||
}
|
||||
|
||||
pos.setOrigin(Point(MID(0, pos.x, ui::display_w()-pos.w),
|
||||
MID(0, pos.y, ui::display_h()-pos.h)));
|
||||
pos.setOrigin(Point(base::clamp(pos.x, 0, ui::display_w()-pos.w),
|
||||
base::clamp(pos.y, 0, ui::display_h()-pos.h)));
|
||||
|
||||
window->setBounds(pos);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -36,8 +37,9 @@ namespace app {
|
||||
|
||||
void update_screen_for_document(const Doc* document);
|
||||
|
||||
void load_window_pos(ui::Widget* window, const char *section);
|
||||
void save_window_pos(ui::Widget* window, const char *section);
|
||||
void load_window_pos(ui::Widget* window, const char* section,
|
||||
const bool limitMinSize = true);
|
||||
void save_window_pos(ui::Widget* window, const char* section);
|
||||
|
||||
ui::Widget* setup_mini_font(ui::Widget* widget);
|
||||
ui::Widget* setup_mini_look(ui::Widget* widget);
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -231,7 +232,7 @@ bool PreviewEditorWindow::onProcessMessage(ui::Message* msg)
|
||||
ui::display_h() - height - StatusBar::instance()->bounds().h - extra,
|
||||
width, height));
|
||||
|
||||
load_window_pos(this, "MiniEditor");
|
||||
load_window_pos(this, "MiniEditor", false);
|
||||
invalidate();
|
||||
}
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user