mirror of https://github.com/aseprite/aseprite.git
[lua] Make Dialog:separator more in line with other widgets (fix #4989)
This commit is contained in:
parent
03422e7251
commit
698d79b049
|
@ -713,6 +713,7 @@
|
||||||
<background color="window_face" />
|
<background color="window_face" />
|
||||||
<background-border part="separator_horz" align="middle" />
|
<background-border part="separator_horz" align="middle" />
|
||||||
<text color="separator_label" x="4" align="left middle" />
|
<text color="separator_label" x="4" align="left middle" />
|
||||||
|
<text color="disabled" x="4" align="left middle" state="disabled"/>
|
||||||
</style>
|
</style>
|
||||||
<style id="menu_separator" extends="horizontal_separator" />
|
<style id="menu_separator" extends="horizontal_separator" />
|
||||||
<style id="separator_in_view" extends="horizontal_separator">
|
<style id="separator_in_view" extends="horizontal_separator">
|
||||||
|
|
|
@ -706,6 +706,7 @@
|
||||||
<background color="window_face" />
|
<background color="window_face" />
|
||||||
<background-border part="separator_horz" align="middle" />
|
<background-border part="separator_horz" align="middle" />
|
||||||
<text color="separator_label" x="4" align="left middle" />
|
<text color="separator_label" x="4" align="left middle" />
|
||||||
|
<text color="disabled" x="4" align="left middle" state="disabled"/>
|
||||||
</style>
|
</style>
|
||||||
<style id="menu_separator" extends="horizontal_separator" />
|
<style id="menu_separator" extends="horizontal_separator" />
|
||||||
<style id="separator_in_view" extends="horizontal_separator">
|
<style id="separator_in_view" extends="horizontal_separator">
|
||||||
|
|
|
@ -575,8 +575,9 @@ int Dialog_add_widget(lua_State* L, Widget* widget)
|
||||||
bool vexpand = (widget->type() == Canvas::Type());
|
bool vexpand = (widget->type() == Canvas::Type());
|
||||||
|
|
||||||
// This is to separate different kind of widgets without label in
|
// This is to separate different kind of widgets without label in
|
||||||
// different rows.
|
// different rows. Separator widgets will always create a new row.
|
||||||
if (dlg->lastWidgetType != widget->type() || dlg->autoNewRow) {
|
if (dlg->lastWidgetType != widget->type() || dlg->autoNewRow ||
|
||||||
|
widget->type() == ui::kSeparatorWidget) {
|
||||||
dlg->lastWidgetType = widget->type();
|
dlg->lastWidgetType = widget->type();
|
||||||
dlg->hbox = nullptr;
|
dlg->hbox = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -631,8 +632,8 @@ int Dialog_add_widget(lua_State* L, Widget* widget)
|
||||||
dlg->labelWidgets[id] = labelWidget;
|
dlg->labelWidgets[id] = labelWidget;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// For tabs we don't want the empty space of an unspecified label.
|
// For tabs and separators, we don't want the empty space of an unspecified label.
|
||||||
if (widget->type() != Tabs::Type()) {
|
if (widget->type() != Tabs::Type() && widget->type() != ui::kSeparatorWidget) {
|
||||||
dlg->currentGrid->addChildInCell(new ui::HBox, 1, 1, ui::LEFT | ui::TOP);
|
dlg->currentGrid->addChildInCell(new ui::HBox, 1, 1, ui::LEFT | ui::TOP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -641,14 +642,15 @@ int Dialog_add_widget(lua_State* L, Widget* widget)
|
||||||
if (widget->type() == ui::kButtonWidget)
|
if (widget->type() == ui::kButtonWidget)
|
||||||
hbox->enableFlags(ui::HOMOGENEOUS);
|
hbox->enableFlags(ui::HOMOGENEOUS);
|
||||||
|
|
||||||
// For tabs we don't want the empty space of an unspecified label, so
|
// For tabs and unlabeled separators, we don't want the empty space of an unspecified label, so
|
||||||
// span 2 columns.
|
// span 2 columns.
|
||||||
const int hspan = (widget->type() == Tabs::Type() ? 2 : 1);
|
const int hspan =
|
||||||
|
((widget->type() == Tabs::Type()) || (widget->type() == ui::kSeparatorWidget && !label) ? 2 :
|
||||||
|
1);
|
||||||
dlg->currentGrid->addChildInCell(hbox,
|
dlg->currentGrid->addChildInCell(hbox,
|
||||||
hspan,
|
hspan,
|
||||||
1,
|
1,
|
||||||
ui::HORIZONTAL | (vexpand ? ui::VERTICAL : ui::TOP));
|
ui::HORIZONTAL | (vexpand ? ui::VERTICAL : ui::TOP));
|
||||||
|
|
||||||
dlg->hbox = hbox;
|
dlg->hbox = hbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,12 +711,7 @@ int Dialog_separator(lua_State* L)
|
||||||
dlg->dataWidgets[id] = widget;
|
dlg->dataWidgets[id] = widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
dlg->mainWidgets.push_back(widget);
|
return Dialog_add_widget(L, widget);
|
||||||
dlg->currentGrid->addChildInCell(widget, 2, 1, ui::HORIZONTAL | ui::TOP);
|
|
||||||
dlg->hbox = nullptr;
|
|
||||||
|
|
||||||
lua_pushvalue(L, 1);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int Dialog_label(lua_State* L)
|
int Dialog_label(lua_State* L)
|
||||||
|
|
Loading…
Reference in New Issue