mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
store updated phrase length; enter/exit phrase editor
This commit is contained in:
parent
ff342963a1
commit
d29dd56198
3 changed files with 42 additions and 34 deletions
|
|
@ -168,15 +168,17 @@ impl<E: Engine> PhrasePool<E> {
|
|||
}
|
||||
pub fn append_new (&mut self, name: Option<&str>, color: Option<Color>) {
|
||||
let mut phrase = Phrase::default();
|
||||
phrase.name = String::from(name.unwrap_or("(no name)"));
|
||||
phrase.color = color.unwrap_or_else(random_color);
|
||||
phrase.name = String::from(name.unwrap_or("(no name)"));
|
||||
phrase.color = color.unwrap_or_else(random_color);
|
||||
phrase.length = 4 * PPQ;
|
||||
self.phrases.push(Arc::new(RwLock::new(phrase)));
|
||||
self.phrase = self.phrases.len() - 1;
|
||||
}
|
||||
pub fn insert_new (&mut self, name: Option<&str>, color: Option<Color>) {
|
||||
let mut phrase = Phrase::default();
|
||||
phrase.name = String::from(name.unwrap_or("(no name)"));
|
||||
phrase.color = color.unwrap_or_else(random_color);
|
||||
phrase.name = String::from(name.unwrap_or("(no name)"));
|
||||
phrase.color = color.unwrap_or_else(random_color);
|
||||
phrase.length = 4 * PPQ;
|
||||
self.phrases.insert(self.phrase + 1, Arc::new(RwLock::new(phrase)));
|
||||
self.phrase += 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue