From 62481cf4a06d9a6824a669302783d386a3478890 Mon Sep 17 00:00:00 2001
From: mcmlxxix <>
Date: Tue, 19 Feb 2013 13:59:28 +0000
Subject: [PATCH] added dynamic LayoutView creation... not sure why this wasnt
 in there from the start...

---
 exec/load/layout.js | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/exec/load/layout.js b/exec/load/layout.js
index 69346c7447..c601031d89 100644
--- a/exec/load/layout.js
+++ b/exec/load/layout.js
@@ -171,6 +171,29 @@ function Layout(frame) {
 		properties.views.push(v);
 		return v;
 	}
+	this.delView=function(title_or_index) {
+		var view = false;
+		if(isNaN(title_or_index)) {
+			for(var v=0;v<properties.views.length;v++) {
+				if(properties.views[v].title.toUpperCase() == title_or_index.toUpperCase()) {
+					view = properties.views[v];
+					properties.views.splice(v,1);
+				}
+			}
+		}
+		else if(properties.views[title_or_index]) {
+			tab = properties.views[title_or_index];
+			properties.views.splice(title_or_index,1);
+		}
+		if(view) {
+			view.frame.delete();
+			while(!properties.views[properties.index] && properties.index > 0)
+				properties.index--;
+			if(this.current)
+				this.current.active=true;
+		}
+		return view;
+	}
 	this.draw=function() {
 		for each(var view in properties.views)
 			view.draw();
@@ -370,8 +393,9 @@ function LayoutView(title,frame,parent) {
 			if(typeof t.open == "function")
 				t.open();
 		}
-		this.current=0;
 		setViewFrames();
+		this.current=0;
+		this.frame.open();
 		if(typeof this.onOpen == "function") 
 			this.onOpen();
 	}
@@ -426,7 +450,7 @@ function LayoutView(title,frame,parent) {
 		var tab = false;
 		if(isNaN(title_or_index)) {
 			for(var t=0;t<properties.tabs.length;t++) {
-				if(properties.tabs[t].title.toUpperCase() == title.toUpperCase()) {
+				if(properties.tabs[t].title.toUpperCase() == title_or_index.toUpperCase()) {
 					tab = properties.tabs[t];
 					properties.tabs.splice(t,1);
 				}
-- 
GitLab