mirror of
https://github.com/vsariola/sointu.git
synced 2026-02-13 11:43:19 -05:00
refactor(tracker): group Model methods, with each group in one source file
This commit is contained in:
parent
b93304adab
commit
86ca3fb300
@ -36,7 +36,6 @@ type (
|
||||
patch []derivedInstrument
|
||||
tracks []derivedTrack
|
||||
railError RailError
|
||||
presetSearch derivedPresetSearch
|
||||
searchResults []string
|
||||
}
|
||||
|
||||
@ -54,52 +53,6 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
// public methods to access the derived data
|
||||
|
||||
func (s *Model) RailError() RailError { return s.derived.railError }
|
||||
|
||||
func (s *Model) RailWidth() int {
|
||||
i := s.d.InstrIndex
|
||||
if i < 0 || i >= len(s.derived.patch) {
|
||||
return 0
|
||||
}
|
||||
return s.derived.patch[i].railWidth
|
||||
}
|
||||
|
||||
func (m *Model) Wires(yield func(wire Wire) bool) {
|
||||
i := m.d.InstrIndex
|
||||
if i < 0 || i >= len(m.derived.patch) {
|
||||
return
|
||||
}
|
||||
for _, wire := range m.derived.patch[i].wires {
|
||||
wire.Highlight = (wire.FromSet && m.d.UnitIndex == wire.From) || (wire.ToSet && m.d.UnitIndex == wire.To.Y && m.d.ParamIndex == wire.To.X)
|
||||
if !yield(wire) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Model) TrackTitle(index int) string {
|
||||
if index < 0 || index >= len(m.derived.tracks) {
|
||||
return ""
|
||||
}
|
||||
return m.derived.tracks[index].title
|
||||
}
|
||||
|
||||
func (m *Model) PatternUnique(track, pat int) bool {
|
||||
if track < 0 || track >= len(m.derived.tracks) {
|
||||
return false
|
||||
}
|
||||
if pat < 0 || pat >= len(m.derived.tracks[track].patternUseCounts) {
|
||||
return false
|
||||
}
|
||||
return m.derived.tracks[track].patternUseCounts[pat] <= 1
|
||||
}
|
||||
|
||||
func (e *RailError) Error() string { return e.Err.Error() }
|
||||
|
||||
func (s *Rail) StackAfter() int { return s.PassThrough + s.StackUse.NumOutputs }
|
||||
|
||||
// init / update methods
|
||||
|
||||
func (m *Model) updateDeriveData(changeType ChangeType) {
|
||||
|
||||
Reference in New Issue
Block a user