@@ -55,6 +55,12 @@ def __init__(self):
5555 self .CLEAR = None
5656 self .LOOP = None
5757 self .METRO = None
58+
59+ self .UNDO = None
60+ self .REDO = None
61+ self .QUANTIZE = None
62+ self .AUTO = None
63+
5864 self .MUTE_SELECTED = None
5965 self .SOLO_SELECTED = None
6066
@@ -72,6 +78,9 @@ def OnInit(self):
7278 self .OnRefresh (midi .HW_Dirty_LEDs )
7379 self .OnRefresh (260 )
7480
81+ nihia .buttons .setLight ("QUANTIZE" , 1 )
82+ nihia .buttons .setLight ("AUTO" , 0 )
83+
7584 # Update mixer
7685 self .mixer .update ()
7786
@@ -164,7 +173,7 @@ def OnMidiMsg(self, event):
164173 # Redo button
165174 elif event .data1 == nihia .buttons .button_list .get ("REDO" ):
166175 event .handled = True
167- general .undo ()
176+ general .undoDown ()
168177
169178
170179 # Quantize button
@@ -364,6 +373,20 @@ def OnRefresh(self, flag):
364373 self .METRO = ui .isMetronomeEnabled ()
365374 nihia .buttons .setLight ("METRO" , ui .isMetronomeEnabled ())
366375
376+ # UNDO button
377+ if self .getUndoStatus () != self .UNDO :
378+ self .UNDO = self .getUndoStatus ()
379+ nihia .buttons .setLight ("UNDO" , self .getUndoStatus ())
380+
381+ # REDO button
382+ if self .getRedoStatus () != self .REDO :
383+ self .REDO = self .getRedoStatus ()
384+ nihia .buttons .setLight ("REDO" , self .getRedoStatus ())
385+
386+ # QUANTIZE button is set on init and permanently on
387+
388+ # AUTO button is set on init and permanently on
389+
367390 # MUTE button
368391 if mixer .isTrackMuted (mixer .trackNumber ()) != self .MUTE_SELECTED :
369392 self .MUTE_SELECTED = mixer .isTrackMuted (mixer .trackNumber ())
@@ -431,6 +454,50 @@ def adjustMixer(self, knob: int, dataType: str, action: str, selectedTrack: int)
431454 elif action == "DECREASE" :
432455 mixer .setTrackPan (trackFirst + knob , mixer .getTrackPan (trackFirst + knob ) - config .KNOB_INCREMENTS_PAN )
433456
457+ def getUndoStatus (self ):
458+ """ Helper function to set the light on the UNDO button. """
459+
460+ # general.getUndoHistoryPos() is broken, returning always the same result
461+ # as general.getUndoHistoryCount()
462+ # Function is a stub
463+ """
464+ undoLength = general.getUndoHistoryCount()
465+ undoPosition = general.getUndoHistoryPos()
466+
467+ # In FL Studio, the first (most ancient) undo point in the history seems to have
468+ # the greatest number and the entire history as an index of 1
469+ if undoPosition == undoLength:
470+ status = 0
471+ else:
472+ status = 1
473+
474+ return status
475+ """
476+
477+ return 1
478+
479+ def getRedoStatus (self ):
480+ """ Helper function to set the light on the REDO button. """
481+
482+ # general.getUndoHistoryPos() is broken, returning always the same result
483+ # as general.getUndoHistoryCount()
484+ # Function is a stub
485+ """
486+ undoLength = general.getUndoHistoryCount()
487+ undoPosition = general.getUndoHistoryPos()
488+
489+ # In FL Studio, the first (most ancient) undo point in the history seems to have
490+ # the greatest number and the entire history as an index of 1
491+ if general.getUndoHistoryPos() == 1:
492+ status = 0
493+ else:
494+ status = 1
495+
496+ return status
497+ """
498+
499+ return 1
500+
434501class A_Series (Core ):
435502 """ Controller code specific to A/M-Series keyboards. """
436503 def OnMidiMsgAdd (self , event ):
0 commit comments