Permalink
Browse files

Bit more progress with docking...

I've got dock channels implemented as dockables and placed in a stacking dock
station.  It's not very pleasant though.  We need to figure out how to:

* create fixed size dockables, or maybe fixed ratio
* replace default border and title bar with something lighter weight and usable
 - want to be able to drag and drop elements like scopes, mixing channels, synth
   controls, and sequencers, into custom GUI arrangements, finer grain than
   typical docking with windows or palettes
  • Loading branch information...
1 parent 08cf024 commit 97081380804417a4085c485a4d905a165e2ecf1b @rosejn rosejn committed Feb 10, 2012
Showing with 30 additions and 19 deletions.
  1. +18 −11 src/overtone/gui/dock.clj
  2. +12 −8 src/overtone/gui/mixer.clj
View
29 src/overtone/gui/dock.clj
@@ -30,11 +30,20 @@
[w]
(.setRootWindow dock-controller (to-root w)))
-(comment defn screen-dock
- []
- (let [station (ScreenDockStation.)]
- (.add dock-controller station)
- station))
+(defn dockable
+ [component]
+ (let [dock (DefaultDockable.)]
+ (.add dock component)
+ dock))
+
+(defn to-dockable
+ [component]
+ (if (isa? (class component) Dockable)
+ component
+ (dockable component)))
+
+; Question: How can we integrate seesaw compatible :id and :class metadata
+; for these widgets?
(defn flap-dock
[]
@@ -43,13 +52,11 @@
station))
(defn split-dock
- []
+ [& {:keys [items]
+ :or {}}]
(let [station (SplitDockStation.)]
(.add dock-controller station)
+ (doseq [item items]
+ (.drop station (to-dockable item)))
station))
-(defn dockable
- [component]
- (let [dock (DefaultDockable.)]
- (.add dock component)
- dock))
View
20 src/overtone/gui/mixer.clj
@@ -1,8 +1,7 @@
(ns overtone.gui.mixer
(:use [seesaw core border]
overtone.studio.mixer
- overtone.gui.dial
- overtone.gui.adjustment-popup
+ [overtone.gui dock dial adjustment-popup]
[overtone.libs event])
(:require [seesaw.bind :as bind]))
@@ -39,17 +38,17 @@
(bind/bind pan-dial
(bind/transform (fn [p] (/ p 100.0)))
(bind/b-do [p] (inst-pan ins p)))
- (vertical-panel :size [CHAN-WIDTH :by CHAN-HEIGHT] :border (to-border (inst-name ins))
- :items [vsp pan-dial mute-btn solo-btn])))
+ (vertical-panel :size [CHAN-WIDTH :by CHAN-HEIGHT] :border (to-border (inst-name ins))
+ :items [vsp pan-dial mute-btn solo-btn])))
(defn mixing-console
([] (mixing-console (vals @instruments*)))
([insts]
(invoke-now
- (let [f (-> (frame :title "Mixer"
- :on-close :dispose
- :content (horizontal-panel :id :mix-panel
- :items (map mixing-channel insts)))
+ (let [channels (map mixing-channel insts)
+ f (-> (frame :title "Mixer"
+ :on-close :dispose
+ :content (split-dock :items channels))
pack!
show!)]
(on-event :new-inst
@@ -63,3 +62,8 @@
:inst-added)
f))))
+(comment
+ (use :reload 'overtone.gui.mixer)
+ (mixing-console)
+
+ )

0 comments on commit 9708138

Please sign in to comment.