Better handling of Cel Properties for multiple cels

This commit is contained in:
David Capello 2021-06-11 11:04:52 -03:00
parent a4e7ac13c1
commit 9f300bf55d
3 changed files with 13 additions and 11 deletions

View File

@ -84,14 +84,16 @@ public:
if (m_document)
m_document->add_observer(this);
if (countCels() > 0 && m_cel) {
if (countCels() > 0) {
ui::Grid* mainGrid = g_window->propertiesGrid();
m_userDataView.configureAndSet(m_cel->data()->userData(), mainGrid);
m_userDataView.configureAndSet(
(m_cel ? m_cel->data()->userData(): UserData()), mainGrid);
}
else if (!m_cel)
m_userDataView.setVisible(false, false);
g_window->remapWindow();
manager()->invalidate();
g_window->expandWindow(gfx::Size(g_window->bounds().w,
g_window->sizeHint().h));
updateFromCel();
}
@ -220,10 +222,10 @@ private:
}
void onToggleUserData() {
if (m_cel) {
if (countCels() > 0) {
m_userDataView.toggleVisibility();
g_window->remapWindow();
manager()->invalidate();
g_window->expandWindow(gfx::Size(g_window->bounds().w,
g_window->sizeHint().h));
}
}

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2020-2021 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -29,7 +29,7 @@ UserDataView::UserDataView(gen::UserData* userDataWidgetsContainer, Option<bool>
{
}
void UserDataView::configureAndSet(doc::UserData& userData, ui::Grid* parent)
void UserDataView::configureAndSet(const doc::UserData& userData, ui::Grid* parent)
{
if (!isConfigured()) {
// Find the correct hspan to add to an arbitrary grid column count:

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2020 Igara Studio S.A.
// Copyright (C) 2020-2021 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@ -24,7 +24,7 @@ namespace app {
public:
UserDataView(gen::UserData* userDataWidgetsContainer, Option<bool>* visibility);
void configureAndSet(doc::UserData& userData, ui::Grid* parent);
void configureAndSet(const doc::UserData& userData, ui::Grid* parent);
void toggleVisibility();
void setVisible(bool state, bool saveAsDefault = true);
void freeUserDataWidgets(ui::Grid* parent);