mirror of
https://github.com/alemidev/scope-tui.git
synced 2024-11-14 02:39:20 +01:00
feat: show mode in title
This commit is contained in:
parent
eb08fb6e47
commit
81ef241e87
4 changed files with 15 additions and 3 deletions
|
@ -107,7 +107,7 @@ impl App {
|
|||
let mut size = f.size();
|
||||
if self.graph.show_ui {
|
||||
f.render_widget(
|
||||
make_header(&self.graph, &self.current_display().header(&self.graph), framerate, self.pause),
|
||||
make_header(&self.graph, &self.current_display().header(&self.graph), self.current_display().mode_str(), framerate, self.pause),
|
||||
Rect { x: size.x, y: size.y, width: size.width, height:1 } // a 1px line at the top
|
||||
);
|
||||
size.height -= 1;
|
||||
|
@ -213,12 +213,12 @@ pub fn update_value_i(val: &mut u32, inc: bool, base: u32, magnitude: f64, range
|
|||
}
|
||||
}
|
||||
|
||||
fn make_header<'a>(cfg: &GraphConfig, module_header: &'a str, fps: usize, pause: bool) -> Table<'a> {
|
||||
fn make_header<'a>(cfg: &GraphConfig, module_header: &'a str, kind_o_scope: &'static str, fps: usize, pause: bool) -> Table<'a> {
|
||||
Table::new(
|
||||
vec![
|
||||
Row::new(
|
||||
vec![
|
||||
Cell::from("tui **scope").style(Style::default().fg(*cfg.palette.get(0).expect("empty palette?")).add_modifier(Modifier::BOLD)),
|
||||
Cell::from(format!("{}::scope-tui", kind_o_scope)).style(Style::default().fg(*cfg.palette.get(0).expect("empty palette?")).add_modifier(Modifier::BOLD)),
|
||||
Cell::from(module_header),
|
||||
Cell::from(format!("-{}+", cfg.scale)),
|
||||
Cell::from(format!("{}/{} spf", cfg.samples, cfg.width)),
|
||||
|
|
|
@ -15,6 +15,10 @@ pub struct Oscilloscope {
|
|||
}
|
||||
|
||||
impl DisplayMode for Oscilloscope {
|
||||
fn mode_str(&self) -> &'static str {
|
||||
"oscillo"
|
||||
}
|
||||
|
||||
fn channel_name(&self, index: usize) -> String {
|
||||
match index {
|
||||
0 => "L".into(),
|
||||
|
|
|
@ -23,6 +23,10 @@ fn complex_to_magnitude(c: Complex<f64>) -> f64 {
|
|||
}
|
||||
|
||||
impl DisplayMode for Spectroscope {
|
||||
fn mode_str(&self) -> &'static str {
|
||||
"spectro"
|
||||
}
|
||||
|
||||
fn channel_name(&self, index: usize) -> String {
|
||||
match index {
|
||||
0 => "L".into(),
|
||||
|
|
|
@ -6,6 +6,10 @@ use super::{DisplayMode, GraphConfig, DataSet, Dimension};
|
|||
pub struct Vectorscope {}
|
||||
|
||||
impl DisplayMode for Vectorscope {
|
||||
fn mode_str(&self) -> &'static str {
|
||||
"vector"
|
||||
}
|
||||
|
||||
fn channel_name(&self, index: usize) -> String {
|
||||
format!("{}", index)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue