From 5190b245ff3461b1fe1618ad61890b14f4843c36 Mon Sep 17 00:00:00 2001 From: David Runge Date: Thu, 14 Jul 2016 02:55:00 +0200 Subject: classes/BowelyzerGUI.sc: Refactoring setupAddressesAndPorts into setupSynthServerView, setupHubView and setupForwardView. Dropping removeConfigView and removeAddressesandPorts in favor of the unifying removeSettingsView, that can remove a settingsView by name. Setting up all Buttons and EZViews by adding them to the layout of their parent. This is also true for the children of settingsView, which makes their distribution and resizing much easier (by additionally introducing a variable width stretching object). Factoring the sending of the /load message out of the load Button, to also be able to use it in the 'Current configuration' list, which is setup using setupConfigFilePathView and updated by setupCurrentConfigFilePath. The ScrollView holding the channelViews was added to lowerView, to make room for a higher level Button View on the left side of the screen. Removing useless additional colors and resetting some margins. --- classes/Bowelyzer.sc | 23 +++++-- classes/BowelyzerGUI.sc | 163 ++++++++++++++++++++++++++++++++---------------- 2 files changed, 129 insertions(+), 57 deletions(-) (limited to 'classes') diff --git a/classes/Bowelyzer.sc b/classes/Bowelyzer.sc index e1fba76..35aa0c3 100644 --- a/classes/Bowelyzer.sc +++ b/classes/Bowelyzer.sc @@ -193,9 +193,19 @@ Bowelyzer{ key: \saveas, func: {|msg, time, addr, recvPort| var name = msg[0], - fileName = msg[1]; + fileName = msg[1], + dict; postln("Received: "++msg); - config.writeConfigurationFile(fileName); + if(config.writeConfigurationFile(fileName), { + if((gui.configFilePathView.items.size == 0), { + gui.setCurrentConfigFilePath(fileName); + },{ + dict = Dictionary.with(*gui.configFilePathView.items); + if(dict.includesKey(fileName.asSymbol).not,{ + gui.setCurrentConfigFilePath(fileName); + }); + }); + }); }, path: "/saveas", srcID: hub.local @@ -225,8 +235,13 @@ Bowelyzer{ hub.addSynthListener(name); }); // reload the addresses and ports Views - gui.removeAddressesAndPorts; - gui.setupAddressesAndPorts(config.config); + gui.removeSettingsView("synthServer"); + gui.removeSettingsView("hub"); + gui.removeSettingsView("forward"); + gui.setupSynthServerView(config.config); + gui.setupHubView(config.config); + gui.setupForwardView(config.config); + gui.setCurrentConfigFilePath(config.configFilePath); },{ ("Configuration could not be read: "++fileName).error; }); diff --git a/classes/BowelyzerGUI.sc b/classes/BowelyzerGUI.sc index 48b1688..31dea20 100644 --- a/classes/BowelyzerGUI.sc +++ b/classes/BowelyzerGUI.sc @@ -1,6 +1,6 @@ BowelyzerGUI{ - var mainView,