From 8f655eda7f1eaf8a038c3a163af85af1a944965f Mon Sep 17 00:00:00 2001 From: Weird Constructor Date: Wed, 19 May 2021 05:01:30 +0200 Subject: [PATCH] added one more thing tot he UIPatternModel --- src/dsp/tracker/pattern.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/dsp/tracker/pattern.rs b/src/dsp/tracker/pattern.rs index 5010dd0..07202fb 100644 --- a/src/dsp/tracker/pattern.rs +++ b/src/dsp/tracker/pattern.rs @@ -227,6 +227,16 @@ impl PatternData { #[cfg(feature="hexotk")] pub use hexotk::widgets::UIPatternModel; + +#[cfg(not(feature="hexotk"))] +impl dyn UIPatternModel { + fn change_value(&mut self, row: usize, col: usize, offs: i16) { + let val = self.get_cell_value(row, col) as i16; + let val = (val + offs).max(0).min(0xfff); + self.set_cell_value(row, col, val as u16); + } +} + #[cfg(not(feature="hexotk"))] pub trait UIPatternModel: std::fmt::Debug { fn get_cell(&mut self, row: usize, col: usize) -> Option<&str>;