mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-12 03:39:51 +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/status_bar.h"
|
||||||
#include "app/ui/toolbar.h"
|
#include "app/ui/toolbar.h"
|
||||||
#include "app/ui_context.h"
|
#include "app/ui_context.h"
|
||||||
|
#include "base/clamp.h"
|
||||||
#include "base/fs.h"
|
#include "base/fs.h"
|
||||||
#include "base/memory.h"
|
#include "base/memory.h"
|
||||||
#include "base/shared_ptr.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
|
// Default position
|
||||||
Rect orig_pos = window->bounds();
|
Rect orig_pos = window->bounds();
|
||||||
@ -272,11 +274,17 @@ void load_window_pos(Widget* window, const char *section)
|
|||||||
// Load configurated position
|
// Load configurated position
|
||||||
pos = get_config_rect(section, "WindowPos", pos);
|
pos = get_config_rect(section, "WindowPos", pos);
|
||||||
|
|
||||||
pos.w = MID(orig_pos.w, pos.w, ui::display_w());
|
if (limitMinSize) {
|
||||||
pos.h = MID(orig_pos.h, pos.h, ui::display_h());
|
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),
|
pos.setOrigin(Point(base::clamp(pos.x, 0, ui::display_w()-pos.w),
|
||||||
MID(0, pos.y, ui::display_h()-pos.h)));
|
base::clamp(pos.y, 0, ui::display_h()-pos.h)));
|
||||||
|
|
||||||
window->setBounds(pos);
|
window->setBounds(pos);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2018 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2017 David Capello
|
// Copyright (C) 2001-2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -36,7 +37,8 @@ namespace app {
|
|||||||
|
|
||||||
void update_screen_for_document(const Doc* document);
|
void update_screen_for_document(const Doc* document);
|
||||||
|
|
||||||
void load_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);
|
void save_window_pos(ui::Widget* window, const char* section);
|
||||||
|
|
||||||
ui::Widget* setup_mini_font(ui::Widget* widget);
|
ui::Widget* setup_mini_font(ui::Widget* widget);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2018 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// 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,
|
ui::display_h() - height - StatusBar::instance()->bounds().h - extra,
|
||||||
width, height));
|
width, height));
|
||||||
|
|
||||||
load_window_pos(this, "MiniEditor");
|
load_window_pos(this, "MiniEditor", false);
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user