Skip to content
Browse files

allow active tabset styling fixes ##496

Signed-off-by: Chris Granger <ibdknox@gmail.com>
  • Loading branch information...
1 parent 896fa6c commit 61e27b20dedae5c821b222d9ba3c672b3923a267 @ibdknox ibdknox committed Jan 15, 2014
Showing with 26 additions and 12 deletions.
  1. +4 −0 deploy/core/css/skins/new-dark.css
  2. +22 −12 src/lt/objs/tabs.cljs
View
4 deploy/core/css/skins/new-dark.css
@@ -17,6 +17,7 @@
var-hidden-fg: #bbb;
var-hidden-bg: #404040;
+ var-inactive-bg: #2C2F30;
var-highlight-bg: #616161;
var-highlight-fg: #f4f4f4;
@@ -181,6 +182,9 @@ input { color: var(highlight-fg); background:var(highlight-bg); }
#multi .list.dragging li { background:transparent !important; }
#multi .dirty.ui-sortable-placeholder:after { content:"" !important; }
#multi .tabset + .tabset { border-left:2px solid var(bg); }
+#multi .tabset .list .active { color:var(placeholder-fg); }
+#multi .tabset.active .list .active { color:var(highlight-fg); }
+#multi .tabset.active .list .dirty { color:var(accent-foreground); }
#bottombar .content { background:var(bg); border-top:0px solid var(border); }
.console > li, .console td { color:var(accent-foreground); }
View
34 src/lt/objs/tabs.cljs
@@ -327,16 +327,24 @@
(set! start (now))
))
+(defn activate-tabset [ts]
+ (when-not (= (ctx/->obj :tabset) ts)
+ (dom/remove-class (-> (ctx/->obj :tabset)
+ (object/->content))
+ :active)
+ (ctx/in! :tabset ts)
+ (dom/add-class (object/->content ts) :active)
+ true))
+
(behavior ::on-active-active-tabset
:triggers #{:active}
:reaction (fn [this]
- (ctx/in! :tabset (::tabset @this))))
+ (activate-tabset (::tabset @this))))
(behavior ::tabset-active
:triggers #{:active}
:reaction (fn [this]
- (when-not (= (ctx/->obj :tabset) this)
- (ctx/in! :tabset this)
+ (when (activate-tabset this)
(when-let [active (:active-obj @this)]
(object/raise active :focus!)))))
@@ -460,15 +468,17 @@
(active! active))
))))
-(defn add! [obj ts]
- (when-let [cur-tabset (or ts (ctx/->obj :tabset))]
- (object/add-tags obj [:tabset.tab])
- (object/update! cur-tabset [:objs] conj obj)
- (object/merge! obj {::tabset cur-tabset})
- (add-watch (subatom obj [:dirty]) :tabs (fn [_ _ _ cur]
- (object/raise cur-tabset :tab.updated)
- ))
- obj))
+(defn add!
+ ([obj] (add! obj nil))
+ ([obj ts]
+ (when-let [cur-tabset (or ts (ctx/->obj :tabset))]
+ (object/add-tags obj [:tabset.tab])
+ (object/update! cur-tabset [:objs] conj obj)
+ (object/merge! obj {::tabset cur-tabset})
+ (add-watch (subatom obj [:dirty]) :tabs (fn [_ _ _ cur]
+ (object/raise cur-tabset :tab.updated)
+ ))
+ obj)))
(defn refresh! [obj]
(when-let [ts (::tabset @obj)]

0 comments on commit 61e27b2

Please sign in to comment.
Something went wrong with that request. Please try again.