aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2016-07-10 18:48:25 +0200
committerDavid Runge <dave@sleepmap.de>2016-07-10 18:48:25 +0200
commitc3e0dad854184458b1e7907009bebde207c1328f (patch)
tree2fad3b2fbba934fdbb02af6d2d7867679112245d
parent908abace18d669402f067276f1d995ca5b8ea6ba (diff)
downloadbowelyzer-c3e0dad854184458b1e7907009bebde207c1328f.tar.gz
bowelyzer-c3e0dad854184458b1e7907009bebde207c1328f.tar.bz2
bowelyzer-c3e0dad854184458b1e7907009bebde207c1328f.tar.xz
bowelyzer-c3e0dad854184458b1e7907009bebde207c1328f.zip
classes/BowelyzerGUI.sc: Refactoring the initialization and removal of configView into two separate functions. Moving towards using layout.insert for inserting Views into the settingsView layout.
-rw-r--r--classes/BowelyzerGUI.sc57
1 files changed, 36 insertions, 21 deletions
diff --git a/classes/BowelyzerGUI.sc b/classes/BowelyzerGUI.sc
index 457abf7..bc5cb0a 100644
--- a/classes/BowelyzerGUI.sc
+++ b/classes/BowelyzerGUI.sc
@@ -50,7 +50,7 @@ BowelyzerGUI{
//setup the main view, in which all other views reside
setupMainView{
arg config, configFilePath;
- var channelScrollView, configView, layout;
+ var channelScrollView, layout;
mainView = PageLayout.new("Bowelyzer");
mainView.asView.background = Color.fromHexString("#DBDBDB");
layout = mainView.asView.addFlowLayout(0@0, 0@0);
@@ -65,23 +65,13 @@ BowelyzerGUI{
settingsView.layout = HLayout();
settingsView.layout.spacing = 0;
settingsView.layout.margins = [0,0,0,0];
-
- //config
- configView = View(settingsView.asView);
- configView.asView.background = Color.fromHexString("#DDDDEF");
- configView.layout = VLayout();
- configView.layout.spacing = 0;
- configView.layout.margins = settingsSubViewMargins;
- configView.name = "config";
- configView.maxSize_(configViewSize);
- this.setupSaveButton(configView, configFilePath);
- this.setupSaveAsButton(configView);
- this.setupLoadButton(configView);
-
- this.setupAddressesAndPorts(settingsView.asView, config);
+ this.setupConfigView;
+ this.setupAddressesAndPorts(config);
// go to next line in layout
layout.nextLine;
+
+ // scrollview for channels
channelScrollView = ScrollView(mainView.asView, Rect(0 , 0, mainView.bounds.width, mainView.bounds.height-settingsView.bounds.height)).autohidesScrollers_(false).hasBorder_(true);
// container for channelViews
channelContainerView = View(parent: channelScrollView, bounds: Rect(0, 0, (channelViewWidth*config.at(\inputs).size)+buttonWidth, channelViewHeight));
@@ -92,13 +82,36 @@ BowelyzerGUI{
channelContainerView.name = \channelContainerView;
}
+ // setup the config View with Buttons to save and load configurations
+ setupConfigView{
+ var configView = View();
+ configView.asView.background = Color.fromHexString("#DDDDEF");
+ configView.layout = VLayout();
+ configView.layout.spacing = 0;
+ configView.layout.margins = settingsSubViewMargins;
+ configView.name = "config";
+ configView.maxSize_(configViewSize);
+ this.setupSaveButton(configView);
+ this.setupSaveAsButton(configView);
+ this.setupLoadButton(configView);
+ settingsView.layout.insert(configView, 0);
+ }
+
+ removeConfigView{
+ settingsView.children.do({|setting, i|
+ if(setting.isKindOf(View) && (setting.name == "config"),{
+ setting.remove;
+ });
+ });
+ }
+
// setup Views for addresses and ports
setupAddressesAndPorts{
- arg parent, config;
+ arg config;
var forwardView, hubView, synthServerView;
//synthServer
- synthServerView = View(parent, Rect(0, 0, settingsSubViewSize.x, settingsSubViewSize.y));
+ synthServerView = View(bounds: Rect(0, 0, settingsSubViewSize.x, settingsSubViewSize.y));
synthServerView.asView.background = Color.fromHexString("#DDDDEF");
synthServerView.layout = VLayout();
synthServerView.layout.spacing = 0;
@@ -122,9 +135,10 @@ BowelyzerGUI{
item.align_(\right);
});
});
+ settingsView.layout.insert(synthServerView, 1);
//hub
- hubView = View(parent, Rect(0, 0, settingsSubViewSize.x, settingsSubViewSize.y));
+ hubView = View(bounds: Rect(0, 0, settingsSubViewSize.x, settingsSubViewSize.y));
hubView.asView.background = Color.fromHexString("#DDDDEF");
hubView.layout = VLayout();
hubView.layout.spacing = 0;
@@ -148,9 +162,10 @@ BowelyzerGUI{
item.align_(\right);
});
});
+ settingsView.layout.insert(hubView, 2);
//forward
- forwardView = View(parent, Rect(0, 0, settingsSubViewSize.x, settingsSubViewSize.y));
+ forwardView = View(bounds: Rect(0, 0, settingsSubViewSize.x, settingsSubViewSize.y));
forwardView.asView.background = Color.fromHexString("#DDDDEF");
forwardView.layout = VLayout();
forwardView.layout.spacing = 0;
@@ -174,6 +189,7 @@ BowelyzerGUI{
item.align_(\right);
});
});
+ settingsView.layout.insert(forwardView, 3);
}
// remove Views for addresses and ports
@@ -364,7 +380,7 @@ BowelyzerGUI{
// create a save button, that launches a FileDialog on press
setupSaveButton{
- arg parent, file, state = 1;
+ arg parent;
^Button(parent, Rect(0, 0, buttonWidth, buttonHeight))
.states_([
["save", Color.black, Color.fromHexString("#99FF99")]
@@ -376,7 +392,6 @@ BowelyzerGUI{
postln("Sending: ["++type++"]");
address.sendMsg(type);
})
- .value_(1)
.maxSize_(buttonWidth@buttonHeight)
;
}