mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-09 13:16:44 +01:00
switch toolbar actions; bold borders and titles
This commit is contained in:
parent
7dd5f7f488
commit
31f8ec5362
8 changed files with 103 additions and 116 deletions
|
|
@ -6,68 +6,36 @@ pub fn render (
|
|||
stdout: &mut Stdout,
|
||||
offset: (u16, u16)
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
render_toolbar(state, stdout, offset)?;
|
||||
//render_toolbar(state, stdout, offset)?;
|
||||
render_grid(state, stdout, offset)?;
|
||||
render_events(state, stdout, offset)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn render_toolbar (
|
||||
state: &mut Sequencer,
|
||||
stdout: &mut Stdout,
|
||||
offset: (u16, u16)
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
stdout
|
||||
.queue(MoveTo(1, 0))?
|
||||
.queue(PrintStyledContent("Arrows".yellow().bold()))?
|
||||
.queue(MoveTo(1, 1))?
|
||||
.queue(PrintStyledContent("Navigate".yellow()))?
|
||||
|
||||
.queue(MoveTo(12, 0))?
|
||||
.queue(PrintStyledContent("+/-".yellow().bold()))?
|
||||
.queue(MoveTo(12, 1))?
|
||||
.queue(PrintStyledContent("Zoom".yellow()))?
|
||||
|
||||
.queue(MoveTo(20, 0))?
|
||||
.queue(PrintStyledContent("a/d".yellow().bold()))?
|
||||
.queue(MoveTo(20, 1))?
|
||||
.queue(PrintStyledContent("Add/delete".yellow()))?
|
||||
|
||||
.queue(MoveTo(33, 0))?
|
||||
.queue(PrintStyledContent("[/]".yellow().bold()))?
|
||||
.queue(MoveTo(33, 1))?
|
||||
.queue(PrintStyledContent("Duration".yellow()))?
|
||||
|
||||
.queue(MoveTo(45, 0))?
|
||||
.queue(PrintStyledContent("CapsLock".yellow().bold()))?
|
||||
.queue(MoveTo(45, 1))?
|
||||
.queue(PrintStyledContent("Auto advance".yellow()))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn render_grid (
|
||||
state: &mut Sequencer,
|
||||
stdout: &mut Stdout,
|
||||
offset: (u16, u16)
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
let move_to = |col, row| crossterm::cursor::MoveTo(offset.0 + col, offset.1 + row);
|
||||
let bg = "┊···············┊···············┊···············┊···············";
|
||||
let cursor: String = if state.duration == 0 {
|
||||
let cursor: String = if state.cursor.2 == 0 {
|
||||
"X".into()
|
||||
} else {
|
||||
std::iter::repeat("·")
|
||||
.take(state.duration as usize)
|
||||
.take(state.cursor.2 as usize)
|
||||
.collect()
|
||||
};
|
||||
stdout
|
||||
.queue(MoveTo(1, 3))?.queue(Print("1.1"))?
|
||||
.queue(MoveTo(17, 3))?.queue(Print("1.2"))?
|
||||
.queue(MoveTo(33, 3))?.queue(Print("1.3"))?
|
||||
.queue(MoveTo(49, 3))?.queue(Print("1.4"))?
|
||||
.queue(MoveTo(1, 4))?.queue(PrintStyledContent(bg.grey()))?
|
||||
.queue(MoveTo(1, 5))?.queue(PrintStyledContent(bg.grey()))?
|
||||
.queue(MoveTo(1, 6))?.queue(PrintStyledContent(bg.grey()))?
|
||||
.queue(MoveTo(1, 7))?.queue(PrintStyledContent(bg.grey()))?
|
||||
.queue(MoveTo(1 + state.cursor.0, 4 + state.cursor.1))?
|
||||
.queue(move_to(1, 3))?.queue(Print("1.1"))?
|
||||
.queue(move_to(17, 3))?.queue(Print("1.2"))?
|
||||
.queue(move_to(33, 3))?.queue(Print("1.3"))?
|
||||
.queue(move_to(49, 3))?.queue(Print("1.4"))?
|
||||
.queue(move_to(1, 4))?.queue(PrintStyledContent(bg.grey()))?
|
||||
.queue(move_to(1, 5))?.queue(PrintStyledContent(bg.grey()))?
|
||||
.queue(move_to(1, 6))?.queue(PrintStyledContent(bg.grey()))?
|
||||
.queue(move_to(1, 7))?.queue(PrintStyledContent(bg.grey()))?
|
||||
.queue(move_to(1 + state.cursor.0, 4 + state.cursor.1))?
|
||||
.queue(PrintStyledContent(cursor.reverse()))?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue