Permalink
Browse files

CVCenter:*initClass - backwards compatibility fix

Signed-off-by: nuss <st9fan@gmail.com>
  • Loading branch information...
nuss committed Apr 5, 2013
1 parent e79f9a7 commit 7de11fe2845607dd81d91d91f9f7aedc4134c9a5
Showing with 20 additions and 14 deletions.
  1. +20 −14 CVCenter/CVCenter.sc
View
@@ -28,12 +28,28 @@ CVCenter {
*initClass {
var newPrefs, newBounds;
+ var shutDownFunc;
Class.initClassTree(CVCenterPreferences);
Class.initClassTree(CVWidget);
prefs = CVCenterPreferences.readPreferences;
prefs !? {
prefs[\saveGuiProperties] !? {
+ shutDownFunc = {
+ // "shutdown action triggered".postln;
+ newPrefs = CVCenterPreferences.readPreferences;
+ CVCenterPreferences.writePreferences(
+ newPrefs[\saveGuiProperties],
+ boundsOnShutDown ?? { newPrefs[\guiProperties] },
+ newPrefs[\saveClassVars],
+ newPrefs[\midiMode],
+ newPrefs[\midiResolution],
+ newPrefs[\midiMean],
+ newPrefs[\softWithin],
+ newPrefs[\ctrlButtonBank],
+ newPrefs[\removeResponders]
+ )
+ };
if(prefs[\saveGuiProperties] == 1 or:{
prefs[\saveGuiProperties] == 2
}, {
@@ -43,20 +59,10 @@ CVCenter {
this.guiheight_(prefs[\guiProperties] !? { prefs[\guiProperties].height });
});
if(prefs[\saveGuiProperties] == 1, {
- ShutDown.add({
- // "shutdown action triggered".postln;
- newPrefs = CVCenterPreferences.readPreferences;
- CVCenterPreferences.writePreferences(
- newPrefs[\saveGuiProperties],
- boundsOnShutDown ?? { newPrefs[\guiProperties] },
- newPrefs[\saveClassVars],
- newPrefs[\midiMode],
- newPrefs[\midiResolution],
- newPrefs[\midiMean],
- newPrefs[\softWithin],
- newPrefs[\ctrlButtonBank],
- newPrefs[\removeResponders]
- )
+ if(Main.versionAtLeast(3, 5), {
+ ShutDown.add(shutDownFunc);
+ }, {
+ UI.registerForShutdown(shutDownFunc);
})
})
};

0 comments on commit 7de11fe

Please sign in to comment.