channels.rs - 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
       ---
       channels.rs (1639B)
       ---
            1 use std::sync::Arc;
            2 
            3 use eframe::egui::{self, RichText};
            4 use egui::mutex::Mutex;
            5 use i18n_embed_fl::fl;
            6 
            7 use crate::{Document, Message, ToolWindow};
            8 
            9 #[derive(Default)]
           10 pub struct ChannelToolWindow {}
           11 
           12 impl ToolWindow for ChannelToolWindow {
           13     fn get_title(&self) -> String {
           14         fl!(crate::LANGUAGE_LOADER, "channel_tool_title")
           15     }
           16 
           17     fn show_ui(&mut self, ui: &mut egui::Ui, active_document: Option<Arc<Mutex<Box<dyn Document>>>>) -> Option<Message> {
           18         if let Some(doc) = active_document {
           19             if let Some(editor) = doc.lock().get_ansi_editor() {
           20                 ui.add_space(8.0);
           21                 ui.horizontal(|ui| {
           22                     ui.add_space(4.0);
           23                     if ui
           24                         .checkbox(&mut editor.buffer_view.lock().use_fg, fl!(crate::LANGUAGE_LOADER, "channel_tool_fg"))
           25                         .changed()
           26                     {
           27                         editor.buffer_view.lock().redraw_view();
           28                     }
           29                 });
           30                 ui.horizontal(|ui| {
           31                     ui.add_space(4.0);
           32                     if ui
           33                         .checkbox(&mut editor.buffer_view.lock().use_bg, fl!(crate::LANGUAGE_LOADER, "channel_tool_bg"))
           34                         .changed()
           35                     {
           36                         editor.buffer_view.lock().redraw_view();
           37                     }
           38                 });
           39             }
           40         } else {
           41             ui.vertical_centered(|ui| {
           42                 ui.add_space(8.0);
           43                 ui.label(RichText::new(fl!(crate::LANGUAGE_LOADER, "no_document_selected")).small());
           44             });
           45         }
           46         None
           47     }
           48 }