buffer: Extract columns to separate objects.
Co-authored-by: Kyle <kyle@zed.dev>
This commit is contained in:
parent
4aa5df4cda
commit
ff4370f88e
1 changed files with 75 additions and 77 deletions
|
@ -220,6 +220,7 @@ impl View for BufferSearchBar {
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let icon_style = theme.search.editor_icon.clone();
|
||||||
let nav_column = Flex::column()
|
let nav_column = Flex::column()
|
||||||
.with_child(
|
.with_child(
|
||||||
Flex::row()
|
Flex::row()
|
||||||
|
@ -240,101 +241,98 @@ impl View for BufferSearchBar {
|
||||||
)
|
)
|
||||||
.contained();
|
.contained();
|
||||||
|
|
||||||
let icon_style = theme.search.editor_icon.clone();
|
let editor_column = Flex::column()
|
||||||
Flex::row()
|
.align_children_center()
|
||||||
.with_child(nav_column)
|
|
||||||
.with_child(
|
.with_child(
|
||||||
Flex::column()
|
Flex::row()
|
||||||
.align_children_center()
|
.align_children_center()
|
||||||
.with_child(
|
.with_child(
|
||||||
Flex::row()
|
Flex::row()
|
||||||
.align_children_center()
|
.align_children_center()
|
||||||
.with_child(
|
.with_child(
|
||||||
Flex::row()
|
Svg::for_style(icon_style.icon)
|
||||||
.align_children_center()
|
|
||||||
.with_child(
|
|
||||||
Svg::for_style(icon_style.icon)
|
|
||||||
.contained()
|
|
||||||
.with_style(icon_style.container)
|
|
||||||
.constrained(),
|
|
||||||
)
|
|
||||||
.with_child(
|
|
||||||
ChildView::new(&self.query_editor, cx)
|
|
||||||
.aligned()
|
|
||||||
.left()
|
|
||||||
.flex(1., true),
|
|
||||||
)
|
|
||||||
.with_child(
|
|
||||||
Flex::row()
|
|
||||||
.with_children(render_search_option(
|
|
||||||
supported_options.case,
|
|
||||||
"icons/case_insensitive_12.svg",
|
|
||||||
SearchOptions::CASE_SENSITIVE,
|
|
||||||
cx,
|
|
||||||
))
|
|
||||||
.with_children(render_search_option(
|
|
||||||
supported_options.word,
|
|
||||||
"icons/word_search_12.svg",
|
|
||||||
SearchOptions::WHOLE_WORD,
|
|
||||||
cx,
|
|
||||||
))
|
|
||||||
.flex(1., true)
|
|
||||||
.contained(),
|
|
||||||
)
|
|
||||||
.contained()
|
.contained()
|
||||||
.with_style(editor_container)
|
.with_style(icon_style.container)
|
||||||
|
.constrained(),
|
||||||
|
)
|
||||||
|
.with_child(
|
||||||
|
ChildView::new(&self.query_editor, cx)
|
||||||
.aligned()
|
.aligned()
|
||||||
.top()
|
.left()
|
||||||
.constrained()
|
.flex(1., true),
|
||||||
.with_min_width(theme.search.editor.min_width)
|
|
||||||
.with_max_width(theme.search.editor.max_width)
|
|
||||||
.with_max_height(theme.search.search_bar_row_height)
|
|
||||||
.flex(1., false),
|
|
||||||
)
|
)
|
||||||
.with_child(
|
.with_child(
|
||||||
Flex::row()
|
Flex::row()
|
||||||
.with_child(self.render_action_button("Select All", cx))
|
.with_children(render_search_option(
|
||||||
.aligned(),
|
supported_options.case,
|
||||||
|
"icons/case_insensitive_12.svg",
|
||||||
|
SearchOptions::CASE_SENSITIVE,
|
||||||
|
cx,
|
||||||
|
))
|
||||||
|
.with_children(render_search_option(
|
||||||
|
supported_options.word,
|
||||||
|
"icons/word_search_12.svg",
|
||||||
|
SearchOptions::WHOLE_WORD,
|
||||||
|
cx,
|
||||||
|
))
|
||||||
|
.flex(1., true)
|
||||||
|
.contained(),
|
||||||
)
|
)
|
||||||
|
.contained()
|
||||||
|
.with_style(editor_container)
|
||||||
|
.aligned()
|
||||||
|
.top()
|
||||||
|
.constrained()
|
||||||
|
.with_min_width(theme.search.editor.min_width)
|
||||||
|
.with_max_width(theme.search.editor.max_width)
|
||||||
|
.with_max_height(theme.search.search_bar_row_height)
|
||||||
.flex(1., false),
|
.flex(1., false),
|
||||||
)
|
)
|
||||||
.contained()
|
.with_child(
|
||||||
.aligned()
|
Flex::row()
|
||||||
.top()
|
.with_child(self.render_action_button("Select All", cx))
|
||||||
|
.aligned(),
|
||||||
|
)
|
||||||
.flex(1., false),
|
.flex(1., false),
|
||||||
)
|
)
|
||||||
.with_child(
|
.contained()
|
||||||
Flex::column().with_child(
|
.aligned()
|
||||||
|
.top()
|
||||||
|
.flex(1., false);
|
||||||
|
let mode_column = Flex::column().with_child(
|
||||||
|
Flex::row()
|
||||||
|
.align_children_center()
|
||||||
|
.with_child(
|
||||||
Flex::row()
|
Flex::row()
|
||||||
.align_children_center()
|
.with_child(search_button_for_mode(SearchMode::Text, cx))
|
||||||
.with_child(
|
.with_child(search_button_for_mode(SearchMode::Regex, cx))
|
||||||
Flex::row()
|
|
||||||
.with_child(search_button_for_mode(SearchMode::Text, cx))
|
|
||||||
.with_child(search_button_for_mode(SearchMode::Regex, cx))
|
|
||||||
.aligned()
|
|
||||||
.left()
|
|
||||||
.contained()
|
|
||||||
.with_style(theme.search.modes_container),
|
|
||||||
)
|
|
||||||
.with_child(
|
|
||||||
super::search_bar::render_close_button(
|
|
||||||
"Dismiss Buffer Search",
|
|
||||||
&theme.search,
|
|
||||||
cx,
|
|
||||||
|_, this, cx| this.dismiss(&Default::default(), cx),
|
|
||||||
Some(Box::new(Dismiss)),
|
|
||||||
)
|
|
||||||
.aligned()
|
|
||||||
.right(),
|
|
||||||
)
|
|
||||||
.constrained()
|
|
||||||
.with_height(theme.search.search_bar_row_height)
|
|
||||||
.aligned()
|
.aligned()
|
||||||
.right()
|
.left()
|
||||||
.top()
|
.contained()
|
||||||
.flex(1., true),
|
.with_style(theme.search.modes_container),
|
||||||
),
|
)
|
||||||
)
|
.with_child(
|
||||||
|
super::search_bar::render_close_button(
|
||||||
|
"Dismiss Buffer Search",
|
||||||
|
&theme.search,
|
||||||
|
cx,
|
||||||
|
|_, this, cx| this.dismiss(&Default::default(), cx),
|
||||||
|
Some(Box::new(Dismiss)),
|
||||||
|
)
|
||||||
|
.aligned()
|
||||||
|
.right(),
|
||||||
|
)
|
||||||
|
.constrained()
|
||||||
|
.with_height(theme.search.search_bar_row_height)
|
||||||
|
.aligned()
|
||||||
|
.right()
|
||||||
|
.top()
|
||||||
|
.flex(1., true),
|
||||||
|
);
|
||||||
|
Flex::row()
|
||||||
|
.with_child(nav_column)
|
||||||
|
.with_child(editor_column)
|
||||||
|
.with_child(mode_column)
|
||||||
.contained()
|
.contained()
|
||||||
.with_style(theme.search.container)
|
.with_style(theme.search.container)
|
||||||
.flex_float()
|
.flex_float()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue