Skip to content

Commit

Permalink
Move search
Browse files Browse the repository at this point in the history
  • Loading branch information
Leinnan committed Sep 22, 2024
1 parent da72099 commit a598b61
Show file tree
Hide file tree
Showing 4 changed files with 242 additions and 238 deletions.
35 changes: 2 additions & 33 deletions src/app/central_panel.rs
Original file line number Diff line number Diff line change
@@ -1,46 +1,15 @@
use egui::{Context, Layout, Shadow};

use crate::consts::TOP_SIDE_MARGIN;
use egui::{Context, Shadow};

use super::App;

impl App {
#[allow(clippy::too_many_lines)] // todo refactor
pub(crate) fn central_panel(&mut self, ctx: &Context, search_changed: &mut bool) {
pub(crate) fn central_panel(&mut self, ctx: &Context) {
let frame = egui::Frame::central_panel(&ctx.style())
.shadow(Shadow::NONE)
.inner_margin(egui::Margin::ZERO)
.outer_margin(egui::Margin::ZERO);
egui::CentralPanel::default().frame(frame).show(ctx, |ui| {
let Some(active_tab) = self.tabs.get_current_tab() else {
return;
};
if active_tab.settings.search.visible {
ui.with_layout(Layout::right_to_left(eframe::emath::Align::Min), |ui| {
*search_changed |= ui
.add(
egui::TextEdit::singleline(&mut active_tab.settings.search.value)
.hint_text("Search"),
)
.changed();
*search_changed |= ui
.add(egui::Slider::new(
&mut active_tab.settings.search.depth,
1..=7,
))
.on_hover_text("Search depth")
.changed();
*search_changed |= ui
.toggle_value(&mut active_tab.settings.search.case_sensitive, "🇨")
.on_hover_text("Case sensitive")
.changed();
*search_changed |= ui
.toggle_value(&mut active_tab.settings.search.favorites, "💕")
.on_hover_text("Search favorites")
.changed();
});
ui.add_space(TOP_SIDE_MARGIN);
}
self.tabs.ui(ui);
});
}
Expand Down
Loading

0 comments on commit a598b61

Please sign in to comment.