-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Friedolino
committed
Apr 29, 2024
1 parent
d11d0e5
commit f657e85
Showing
5 changed files
with
190 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Widget { | ||
layer: 1 | ||
property Array data: nil; | ||
property Bool normal: false | ||
property Float pad: 1.0/32 | ||
property Float fixedpad: 0 | ||
property Bool under_highlight: false | ||
|
||
function class_name() { "HystDataView" } | ||
|
||
function draw(vg) | ||
{ | ||
pad2 = (1-2*pad) | ||
box = Rect.new(w*pad + fixedpad, h*pad + fixedpad, | ||
w*pad2 - 2*fixedpad, h*pad2 - 2*fixedpad) | ||
|
||
Draw::WaveForm::plotHyst(vg, self.data, box, normal, 0, under_highlight) if not self.data.nil? | ||
|
||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
Widget { | ||
id: hyst_view | ||
property Bool grid: true; | ||
property Bool draw_borders: false | ||
property Object valueRef: nil | ||
property Float pad: 1.0/32 | ||
function class_name() { "HysteresisView" } | ||
|
||
onExtern: { | ||
data = OSC::RemoteParam.new($remote, hyst_view.extern) | ||
data.callback = lambda {|x| | ||
hystdata_view.data = x | ||
hystdata_view.damage_self | ||
} | ||
|
||
hyst_view.valueRef = [data] | ||
|
||
} | ||
|
||
HystDataView { | ||
id: hystdata_view | ||
} | ||
|
||
function draw(vg) | ||
{ | ||
pad2 = (1-2*pad) | ||
box = Rect.new(w*pad, h*pad, w*pad2, h*pad2) | ||
background Theme::VisualBackground | ||
|
||
if(grid) | ||
Draw::Grid::linear_x(vg,0,10,box, 1.0) | ||
Draw::Grid::linear_y(vg,0,10,box, 1.0) | ||
end | ||
|
||
if(draw_borders) | ||
vg.translate(0.5, 0.5) | ||
vg.path do |v| | ||
v.stroke_width = 1 | ||
v.stroke_color = Theme::GridLine | ||
v.rounded_rect(box.x.round(), box.y.round(), box.w.round(), box.h.round(), 2) | ||
v.stroke() | ||
end | ||
vg.translate(-0.5, -0.5) | ||
end | ||
|
||
if(extern.nil? || extern.empty?) | ||
Draw::WaveForm::sin(vg, box, 128) | ||
end | ||
} | ||
|
||
function refresh() | ||
{ | ||
return if self.valueRef.nil? | ||
self.valueRef.each do |v| | ||
v.refresh | ||
end | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters