Hide rtl ui when no ansi editor is selected. - icy_draw - icy_draw is the successor to mystic draw. fork / mirror
 (HTM) git clone https://git.drkhsh.at/icy_draw.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 7ed350d8038ed63df67c983c702b82ad7e4dde81
 (DIR) parent 101f3ea880a788a77b1618b77ea424e32e89b2d8
 (HTM) Author: Mike Krüger <mkrueger@posteo.de>
       Date:   Fri, 15 Sep 2023 16:26:21 +0200
       
       Hide rtl ui when no ansi editor is selected.
       
       Diffstat:
         M src/ui/document_docking.rs          |      16 ++++++++++++++--
         M src/ui/top_bar.rs                   |       4 +++-
       
       2 files changed, 17 insertions(+), 3 deletions(-)
       ---
 (DIR) diff --git a/src/ui/document_docking.rs b/src/ui/document_docking.rs
       @@ -260,8 +260,20 @@ impl egui_tiles::Behavior<DocumentTab> for DocumentBehavior {
                tiles: &Tiles<DocumentTab>,
                ui: &mut Ui,
                _tile_id: TileId,
       -        _tabs: &Tabs,
       +        tabs: &Tabs,
            ) {
       +        let mut show = false;
       +        if let Some(active_id) = tabs.active {
       +            if let Some(egui_tiles::Tile::Pane(pane)) = tiles.get(active_id) {
       +                if pane.doc.lock().unwrap().get_ansi_editor().is_some() {
       +                    show = true;
       +                }
       +            }
       +        }
       +        if !show {
       +            return;
       +        }
       +
                ui.add_space(4.0);
                let mut buffer = Buffer::new((48, 1));
                let char_set = Settings::get_character_set();
       @@ -314,7 +326,7 @@ impl egui_tiles::Behavior<DocumentTab> for DocumentBehavior {
                    img.show(ui);
                }
        
       -        if let Some(id) = _tabs.active {
       +        if let Some(id) = tabs.active {
                    if let Some(egui_tiles::Tile::Pane(pane)) = tiles.get(id) {
                        if let Ok(doc) = &mut pane.doc.lock() {
                            if let Some(editor) = doc.get_ansi_editor() {
 (DIR) diff --git a/src/ui/top_bar.rs b/src/ui/top_bar.rs
       @@ -300,7 +300,9 @@ impl MainWindow {
                            .ui_enabled(ui, has_buffer, &mut result);
                    });
                    ui.menu_button(fl!(crate::LANGUAGE_LOADER, "menu-fonts"), |ui| {
       -                self.commands.open_font_manager.ui(ui, &mut result);
       +                self.commands
       +                    .open_font_manager
       +                    .ui_enabled(ui, has_buffer, &mut result);
                        ui.separator();
                        self.commands.open_font_directory.ui(ui, &mut result);
                        self.commands.open_tdf_directory.ui(ui, &mut result);