mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-11 22:26:44 +01:00
weird formatting
This commit is contained in:
parent
75c9a4ce49
commit
45f57214f1
2 changed files with 20 additions and 41 deletions
|
|
@ -34,8 +34,7 @@ impl Content for PhrasePool<Tui> {
|
|||
let row2 = TuiStyle::bold(row2, true);
|
||||
let bg = if i == self.phrase { color } else { color };
|
||||
add(&col!(row1, row2).fill_x().bg(bg))?;
|
||||
if *focused && i == self.phrase { add(&CORNERS)?; }
|
||||
Ok(())
|
||||
Ok(if *focused && i == self.phrase { add(&CORNERS)?; })
|
||||
})
|
||||
);
|
||||
let border_color = if *focused {Color::Rgb(100, 110, 40)} else {Color::Rgb(70, 80, 50)};
|
||||
|
|
@ -44,7 +43,7 @@ impl Content for PhrasePool<Tui> {
|
|||
let title_color = if *focused {Color::Rgb(150, 160, 90)} else {Color::Rgb(120, 130, 100)};
|
||||
let title = format!("Phrases ({})", phrases.len());
|
||||
let title = TuiStyle::fg(title, title_color).push_x(1);
|
||||
Layers::new(move|add|{ add(&content)?; add(&title)?; Ok(()) })
|
||||
Layers::new(move|add|{ add(&content)?; Ok(add(&title)?) })
|
||||
}
|
||||
}
|
||||
impl Content for PhraseEditor<Tui> {
|
||||
|
|
@ -60,15 +59,14 @@ impl Content for PhraseEditor<Tui> {
|
|||
let color = Color::Rgb(0,255,0);
|
||||
let color = phrase.as_ref().map(|p|p.read().unwrap().color).unwrap_or(color);
|
||||
let keys = CustomWidget::new(|to:[u16;2]|Ok(Some(to.clip_w(5))), move|to: &mut TuiOutput|{
|
||||
if to.area().h() >= 2 {
|
||||
Ok(if to.area().h() >= 2 {
|
||||
to.buffer_update(to.area().set_w(5), &|cell, x, y|{
|
||||
let y = y + (note_start / 2) as u16;
|
||||
if x < keys.area.width && y < keys.area.height {
|
||||
*cell = keys.get(x, y).clone()
|
||||
}
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}).fill_y();
|
||||
let notes_bg_null = Color::Rgb(28, 35, 25);
|
||||
let notes = CustomWidget::new(|to|Ok(Some(to)), move|to: &mut TuiOutput|{
|
||||
|
|
@ -82,7 +80,7 @@ impl Content for PhraseEditor<Tui> {
|
|||
axis.start += 2;
|
||||
}
|
||||
}
|
||||
if to.area().h() >= 2 {
|
||||
Ok(if to.area().h() >= 2 {
|
||||
let area = to.area();
|
||||
to.buffer_update(area, &move |cell, x, y|{
|
||||
cell.set_bg(notes_bg_null);
|
||||
|
|
@ -96,11 +94,10 @@ impl Content for PhraseEditor<Tui> {
|
|||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
}).fill_x();
|
||||
let cursor = CustomWidget::new(|to|Ok(Some(to)), move|to: &mut TuiOutput|{
|
||||
if *entered {
|
||||
Ok(if *entered {
|
||||
let area = to.area();
|
||||
if let (Some(time), Some(note)) = (time_point, note_point) {
|
||||
let x1 = area.x() + (time / time_scale) as u16;
|
||||
|
|
@ -111,8 +108,7 @@ impl Content for PhraseEditor<Tui> {
|
|||
to.blit(&c, x, y, Some(Style::default().fg(color)));
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
});
|
||||
let playhead_inactive = Style::default().fg(Color::Rgb(255,255,255)).bg(Color::Rgb(0,0,0));
|
||||
let playhead_active = playhead_inactive.clone().yellow().bold().not_dim();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue