1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:27:35 +00:00

Userland+LibGUI: Make Margins arguments match CSS ordering

Previously the argument order for Margins was (left, top, right,
bottom). To make it more familiar and closer to how CSS does it, the
argument order is now (top, right, bottom, left).
This commit is contained in:
sin-ack 2021-08-17 00:10:51 +00:00 committed by Andreas Kling
parent c17f9adb12
commit 9c9a5c55cb
43 changed files with 78 additions and 78 deletions

View file

@ -221,12 +221,12 @@ int main(int argc, char** argv)
container.set_fill_with_background_color(true);
container.set_frame_shadow(Gfx::FrameShadow::Raised);
auto& layout = container.set_layout<GUI::VerticalBoxLayout>();
layout.set_margins({ 8, 8, 8, 0 });
layout.set_margins({ 8, 8, 0, 8 });
auto& text_box = container.add<GUI::TextBox>();
auto& results_container = container.add<GUI::Widget>();
auto& results_layout = results_container.set_layout<GUI::VerticalBoxLayout>();
results_layout.set_margins({ 0, 10, 0, 10 });
results_layout.set_margins({ 10, 0, 10, 0 });
auto mark_selected_item = [&]() {
for (size_t i = 0; i < app_state.visible_result_count; ++i) {

View file

@ -7,7 +7,7 @@
@GUI::GroupBox {
layout: @GUI::VerticalBoxLayout {
margins: [16, 24, 16, 6]
margins: [24, 16, 6, 16]
}
title: "Workspaces"

View file

@ -18,7 +18,7 @@
@GUI::Widget {
shrink_to_fit: true
layout: @GUI::HorizontalBoxLayout {
margins: [16, 8, 8, 6]
margins: [8, 8, 6, 16]
}
@GUI::Label {
@ -34,7 +34,7 @@
@GUI::GroupBox {
layout: @GUI::VerticalBoxLayout {
margins: [16, 24, 16, 6]
margins: [24, 16, 6, 16]
}
title: "Screen settings"

View file

@ -1,6 +1,6 @@
@GUI::Widget {
layout: @GUI::VerticalBoxLayout {
margins: [12, 8, 12, 8]
margins: [8, 12, 8, 12]
spacing: 10
}

View file

@ -443,12 +443,12 @@ int run_in_windowed_mode(RefPtr<Core::ConfigFile> config, String initial_locatio
auto& toolbar_container = *widget.find_descendant_of_type_named<GUI::ToolbarContainer>("toolbar_container");
auto& main_toolbar = *widget.find_descendant_of_type_named<GUI::Toolbar>("main_toolbar");
auto& location_toolbar = *widget.find_descendant_of_type_named<GUI::Toolbar>("location_toolbar");
location_toolbar.layout()->set_margins({ 6, 3, 6, 3 });
location_toolbar.layout()->set_margins({ 3, 6, 3, 6 });
auto& location_textbox = *widget.find_descendant_of_type_named<GUI::TextBox>("location_textbox");
auto& breadcrumb_toolbar = *widget.find_descendant_of_type_named<GUI::Toolbar>("breadcrumb_toolbar");
breadcrumb_toolbar.layout()->set_margins({ 6, 0, 6, 0 });
breadcrumb_toolbar.layout()->set_margins({ 0, 6, 0, 6 });
auto& breadcrumbbar = *widget.find_descendant_of_type_named<GUI::Breadcrumbbar>("breadcrumbbar");
auto& splitter = *widget.find_descendant_of_type_named<GUI::HorizontalSplitter>("splitter");

View file

@ -11,7 +11,7 @@
title: "Metadata"
fixed_width: 200
layout: @GUI::VerticalBoxLayout {
margins: [8, 16, 8, 8]
margins: [16, 8, 8, 8]
}
@GUI::Widget {
@ -125,7 +125,7 @@
@GUI::Widget {
name: "glyph_editor_container"
layout: @GUI::VerticalBoxLayout {
margins: [0, 5, 0, 0]
margins: [5, 0, 0, 0]
}
}

View file

@ -298,7 +298,7 @@ void IRCAppWindow::setup_widgets()
auto& outer_container = widget.add<GUI::Widget>();
outer_container.set_layout<GUI::VerticalBoxLayout>();
outer_container.layout()->set_margins({ 2, 0, 2, 2 });
outer_container.layout()->set_margins({ 0, 2, 2, 2 });
auto& horizontal_container = outer_container.add<GUI::HorizontalSplitter>();

View file

@ -154,7 +154,7 @@ int main(int argc, char** argv)
bottom_widget.set_layout<GUI::HorizontalBoxLayout>();
bottom_widget.layout()->add_spacer();
bottom_widget.set_fixed_height(30);
bottom_widget.set_content_margins({ 0, 4, 0, 4 });
bottom_widget.set_content_margins({ 4, 0, 4, 0 });
auto& ok_button = bottom_widget.add<GUI::Button>();
ok_button.set_text("OK");

View file

@ -11,7 +11,7 @@
fixed_height: 170
layout: @GUI::VerticalBoxLayout {
margins: [8, 16, 8, 8]
margins: [16, 8, 8, 8]
spacing: 2
}
@ -101,7 +101,7 @@
fixed_height: 110
layout: @GUI::VerticalBoxLayout {
margins: [8, 16, 8, 8]
margins: [16, 8, 8, 8]
spacing: 2
}

View file

@ -11,7 +11,7 @@
fixed_height: 110
layout: @GUI::VerticalBoxLayout {
margins: [8, 16, 8, 8]
margins: [16, 8, 8, 8]
spacing: 2
}
@ -60,7 +60,7 @@
fixed_height: 110
layout: @GUI::VerticalBoxLayout {
margins: [8, 16, 8, 8]
margins: [16, 8, 8, 8]
spacing: 2
}
@ -114,7 +114,7 @@
fixed_height: 110
layout: @GUI::VerticalBoxLayout {
margins: [8, 16, 8, 8]
margins: [16, 8, 8, 8]
spacing: 2
}

View file

@ -14,7 +14,7 @@
shrink_to_fit: true
layout: @GUI::HorizontalBoxLayout {
margins: [10,20,10,10]
margins: [20,10,10,10]
}
@GUI::RadioButton {

View file

@ -25,7 +25,7 @@ LayerPropertiesWidget::LayerPropertiesWidget()
auto& group_box = add<GUI::GroupBox>("Layer properties");
auto& layout = group_box.set_layout<GUI::VerticalBoxLayout>();
layout.set_margins({ 10, 20, 10, 10 });
layout.set_margins({ 20, 10, 10, 10 });
auto& name_container = group_box.add<GUI::Widget>();
name_container.set_fixed_height(20);

View file

@ -51,7 +51,7 @@
@GUI::GroupBox {
title: "Layers"
layout: @GUI::VerticalBoxLayout {
margins: [6, 16, 6, 6]
margins: [16, 6, 6, 6]
}
@PixelPaint::LayerListWidget {

View file

@ -19,7 +19,7 @@ ToolPropertiesWidget::ToolPropertiesWidget()
m_group_box = add<GUI::GroupBox>("Tool properties");
auto& layout = m_group_box->set_layout<GUI::VerticalBoxLayout>();
layout.set_margins({ 10, 20, 10, 10 });
layout.set_margins({ 20, 10, 10, 10 });
m_tool_widget_stack = m_group_box->add<GUI::StackWidget>();
m_blank_widget = m_tool_widget_stack->add<GUI::Widget>();
}

View file

@ -101,7 +101,7 @@ int main(int argc, char** argv)
auto& toolbox = *main_widget.find_descendant_of_type_named<PixelPaint::ToolboxWidget>("toolbox");
auto& tab_widget = *main_widget.find_descendant_of_type_named<GUI::TabWidget>("tab_widget");
tab_widget.set_container_margins({ 4, 4, 5, 5 });
tab_widget.set_container_margins({ 4, 5, 5, 4 });
tab_widget.set_close_button_enabled(true);
auto& palette_widget = *main_widget.find_descendant_of_type_named<PixelPaint::PaletteWidget>("palette_widget");

View file

@ -199,7 +199,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
{
auto& horizontal_alignment_selection_container = alignment_tab.add<GUI::Widget>();
horizontal_alignment_selection_container.set_layout<GUI::HorizontalBoxLayout>();
horizontal_alignment_selection_container.layout()->set_margins({ 0, 4, 0, 0 });
horizontal_alignment_selection_container.layout()->set_margins({ 4, 0, 0, 0 });
horizontal_alignment_selection_container.set_fixed_height(22);
auto& horizontal_alignment_label = horizontal_alignment_selection_container.add<GUI::Label>();
@ -273,7 +273,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
// FIXME: Somehow allow unsetting these.
auto& foreground_container = static_formatting_container.add<GUI::Widget>();
foreground_container.set_layout<GUI::HorizontalBoxLayout>();
foreground_container.layout()->set_margins({ 0, 4, 0, 0 });
foreground_container.layout()->set_margins({ 4, 0, 0, 0 });
foreground_container.set_shrink_to_fit(true);
auto& foreground_label = foreground_container.add<GUI::Label>();
@ -293,7 +293,7 @@ void CellTypeDialog::setup_tabs(GUI::TabWidget& tabs, const Vector<Position>& po
// FIXME: Somehow allow unsetting these.
auto& background_container = static_formatting_container.add<GUI::Widget>();
background_container.set_layout<GUI::HorizontalBoxLayout>();
background_container.layout()->set_margins({ 0, 4, 0, 0 });
background_container.layout()->set_margins({ 4, 0, 0, 0 });
background_container.set_shrink_to_fit(true);
auto& background_label = background_container.add<GUI::Label>();

View file

@ -19,7 +19,7 @@
layout: @GUI::VerticalBoxLayout {
// FIXME: This is working around the fact that group boxes don't allocate space for their title and border!
margins: [10, 20, 10, 10]
margins: [20, 10, 10, 10]
}
@GUI::RadioButton {
@ -70,7 +70,7 @@
layout: @GUI::VerticalBoxLayout {
// FIXME: This is working around the fact that group boxes don't allocate space for their title and border!
margins: [10, 20, 10, 10]
margins: [20, 10, 10, 10]
}
@GUI::RadioButton {
@ -152,7 +152,7 @@
layout: @GUI::VerticalBoxLayout {
// FIXME: This is working around the fact that group boxes don't allocate space for their title and border!
margins: [10, 20, 10, 10]
margins: [20, 10, 10, 10]
}
@GUI::TextEditor {

View file

@ -19,7 +19,7 @@
layout: @GUI::VerticalBoxLayout {
// FIXME: This is working around the fact that group boxes don't allocate space for their title and border!
margins: [10, 20, 10, 10]
margins: [20, 10, 10, 10]
}
@GUI::RadioButton {
@ -70,7 +70,7 @@
layout: @GUI::VerticalBoxLayout {
// FIXME: This is working around the fact that group boxes don't allocate space for their title and border!
margins: [10, 20, 10, 10]
margins: [20, 10, 10, 10]
}
@GUI::RadioButton {
@ -133,7 +133,7 @@
fixed_height: 40
layout: @GUI::VerticalBoxLayout {
margins: [6, 6, 6, 0]
margins: [6, 6, 0, 6]
}
@GUI::Widget {
@ -165,7 +165,7 @@
layout: @GUI::VerticalBoxLayout {
// FIXME: This is working around the fact that group boxes don't allocate space for their title and border!
margins: [10, 20, 10, 10]
margins: [20, 10, 10, 10]
}
@GUI::StackWidget {

View file

@ -31,7 +31,7 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget& graph)
set_fixed_height(110);
set_layout<GUI::VerticalBoxLayout>();
layout()->set_margins({ 0, 8, 0, 0 });
layout()->set_margins({ 8, 0, 0, 0 });
layout()->set_spacing(3);
auto build_widgets_for_label = [this](const String& description) -> RefPtr<GUI::Label> {

View file

@ -32,7 +32,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
auto& adapters_group_box = add<GUI::GroupBox>("Adapters");
adapters_group_box.set_layout<GUI::VerticalBoxLayout>();
adapters_group_box.layout()->set_margins({ 6, 16, 6, 6 });
adapters_group_box.layout()->set_margins({ 16, 6, 6, 6 });
adapters_group_box.set_fixed_height(120);
m_adapter_table_view = adapters_group_box.add<GUI::TableView>();
@ -69,7 +69,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
auto& tcp_sockets_group_box = add<GUI::GroupBox>("TCP Sockets");
tcp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>();
tcp_sockets_group_box.layout()->set_margins({ 6, 16, 6, 6 });
tcp_sockets_group_box.layout()->set_margins({ 16, 6, 6, 6 });
m_tcp_socket_table_view = tcp_sockets_group_box.add<GUI::TableView>();
@ -90,7 +90,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
auto& udp_sockets_group_box = add<GUI::GroupBox>("UDP Sockets");
udp_sockets_group_box.set_layout<GUI::VerticalBoxLayout>();
udp_sockets_group_box.layout()->set_margins({ 6, 16, 6, 6 });
udp_sockets_group_box.layout()->set_margins({ 16, 6, 6, 6 });
m_udp_socket_table_view = udp_sockets_group_box.add<GUI::TableView>();

View file

@ -179,7 +179,7 @@ int main(int argc, char** argv)
auto& tabwidget_container = main_widget.add<GUI::Widget>();
tabwidget_container.set_layout<GUI::VerticalBoxLayout>();
tabwidget_container.layout()->set_margins({ 4, 0, 4, 4 });
tabwidget_container.layout()->set_margins({ 0, 4, 4, 4 });
auto& tabwidget = tabwidget_container.add<GUI::TabWidget>();
statusbar = main_widget.add<GUI::Statusbar>(3);
@ -669,7 +669,7 @@ NonnullRefPtr<GUI::Widget> build_graphs_tab()
auto& cpu_graph_group_box = graphs_container->add<GUI::GroupBox>("CPU usage");
cpu_graph_group_box.set_layout<GUI::HorizontalBoxLayout>();
cpu_graph_group_box.layout()->set_margins({ 6, 16, 6, 6 });
cpu_graph_group_box.layout()->set_margins({ 16, 6, 6, 6 });
cpu_graph_group_box.set_fixed_height(120);
Vector<GraphWidget&> cpu_graphs;
for (size_t i = 0; i < ProcessModel::the().cpus().size(); i++) {
@ -701,7 +701,7 @@ NonnullRefPtr<GUI::Widget> build_graphs_tab()
auto& memory_graph_group_box = graphs_container->add<GUI::GroupBox>("Memory usage");
memory_graph_group_box.set_layout<GUI::VerticalBoxLayout>();
memory_graph_group_box.layout()->set_margins({ 6, 16, 6, 6 });
memory_graph_group_box.layout()->set_margins({ 16, 6, 6, 6 });
memory_graph_group_box.set_fixed_height(120);
auto& memory_graph = memory_graph_group_box.add<GraphWidget>();
memory_graph.set_stack_values(true);

View file

@ -10,7 +10,7 @@
shrink_to_fit: true
layout: @GUI::VerticalBoxLayout {
margins: [6, 16, 6, 6]
margins: [16, 6, 6, 6]
}
@GUI::RadioButton {
@ -34,7 +34,7 @@
shrink_to_fit: true
layout: @GUI::VerticalBoxLayout {
margins: [6, 16, 6, 6]
margins: [16, 6, 6, 6]
}
@GUI::OpacitySlider {
@ -50,7 +50,7 @@
shrink_to_fit: true
layout: @GUI::VerticalBoxLayout {
margins: [6, 16, 6, 6]
margins: [16, 6, 6, 6]
}
@GUI::SpinBox {
@ -66,7 +66,7 @@
shrink_to_fit: true
layout: @GUI::VerticalBoxLayout {
margins: [6, 16, 6, 6]
margins: [16, 6, 6, 6]
}
@GUI::ComboBox {

View file

@ -17,7 +17,7 @@
min_width: 340
min_height: 160
layout: @GUI::HorizontalBoxLayout {
margins: [0, 0, 16, 0]
margins: [0, 16, 0, 0]
}
@GUI::Widget {