automatic area expansion, #89
--HG-- extra : convert_revision : svn%3Ab267cdba-c1da-11dd-874b-8bacd04a0a74/trunk%4095
This commit is contained in:
+36
-10
@@ -347,7 +347,7 @@ SQL.Row.prototype.destroy = function() {
|
|||||||
SQL.Row.prototype.toXML = function() {
|
SQL.Row.prototype.toXML = function() {
|
||||||
var xml = "";
|
var xml = "";
|
||||||
|
|
||||||
var t = this.getTitle().replace(/"/g,"""); //"
|
var t = this.getTitle().replace(/"/g,"""); // ""
|
||||||
var nn = (this.data.nll ? "1" : "0");
|
var nn = (this.data.nll ? "1" : "0");
|
||||||
var ai = (this.data.ai ? "1" : "0");
|
var ai = (this.data.ai ? "1" : "0");
|
||||||
xml += '<row name="'+t+'" null="'+nn+'" autoincrement="'+ai+'">\n';
|
xml += '<row name="'+t+'" null="'+nn+'" autoincrement="'+ai+'">\n';
|
||||||
@@ -926,6 +926,7 @@ SQL.Table.prototype.up = function(e) {
|
|||||||
t.active = false;
|
t.active = false;
|
||||||
OZ.Event.remove(this.documentMove);
|
OZ.Event.remove(this.documentMove);
|
||||||
OZ.Event.remove(this.documentUp);
|
OZ.Event.remove(this.documentUp);
|
||||||
|
this.owner.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
SQL.Table.prototype.destroy = function() {
|
SQL.Table.prototype.destroy = function() {
|
||||||
@@ -2165,17 +2166,16 @@ SQL.Designer.prototype.init = function() {
|
|||||||
SQL.Visual.prototype.init.apply(this);
|
SQL.Visual.prototype.init.apply(this);
|
||||||
|
|
||||||
this.dom.container = this.dom.content = OZ.$("area");
|
this.dom.container = this.dom.content = OZ.$("area");
|
||||||
this.width = this.dom.container.offsetWidth;
|
this.minSize = [
|
||||||
this.height = this.dom.container.offsetHeight;
|
this.dom.container.offsetWidth,
|
||||||
|
this.dom.container.offsetHeight
|
||||||
this.flag = 2;
|
];
|
||||||
|
this.width = this.minSize[0];
|
||||||
|
this.height = this.minSize[1];
|
||||||
|
|
||||||
this.typeIndex = false;
|
this.typeIndex = false;
|
||||||
this.fkTypeFor = false;
|
this.fkTypeFor = false;
|
||||||
|
|
||||||
this.requestLanguage();
|
|
||||||
this.requestDB();
|
|
||||||
|
|
||||||
this.vector = this.getOption("vector") && (OZ.gecko || OZ.opera || OZ.webkit || OZ.ie);
|
this.vector = this.getOption("vector") && (OZ.gecko || OZ.opera || OZ.webkit || OZ.ie);
|
||||||
if (this.vector) {
|
if (this.vector) {
|
||||||
this.vector = "svg";
|
this.vector = "svg";
|
||||||
@@ -2184,10 +2184,32 @@ SQL.Designer.prototype.init = function() {
|
|||||||
if (this.vector == "svg") {
|
if (this.vector == "svg") {
|
||||||
this.svgNS = "http://www.w3.org/2000/svg";
|
this.svgNS = "http://www.w3.org/2000/svg";
|
||||||
this.dom.svg = document.createElementNS(this.svgNS, "svg");
|
this.dom.svg = document.createElementNS(this.svgNS, "svg");
|
||||||
this.dom.svg.setAttribute("width",this.dom.container.offsetWidth);
|
|
||||||
this.dom.svg.setAttribute("height",this.dom.container.offsetHeight);
|
|
||||||
this.dom.content.appendChild(this.dom.svg);
|
this.dom.content.appendChild(this.dom.svg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.flag = 2;
|
||||||
|
this.requestLanguage();
|
||||||
|
this.requestDB();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* update area size */
|
||||||
|
SQL.Designer.prototype.sync = function() {
|
||||||
|
var w = this.minSize[0];
|
||||||
|
var h = this.minSize[0];
|
||||||
|
for (var i=0;i<this.tables.length;i++) {
|
||||||
|
var t = this.tables[i];
|
||||||
|
w = Math.max(w, t.x + t.width);
|
||||||
|
h = Math.max(h, t.y + t.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.width = w;
|
||||||
|
this.height = h;
|
||||||
|
this.map.sync();
|
||||||
|
|
||||||
|
if (this.vector == "svg") {
|
||||||
|
this.dom.svg.setAttribute("width", this.width);
|
||||||
|
this.dom.svg.setAttribute("height", this.height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SQL.Designer.prototype.requestLanguage = function() { /* get locale file */
|
SQL.Designer.prototype.requestLanguage = function() { /* get locale file */
|
||||||
@@ -2235,6 +2257,8 @@ SQL.Designer.prototype.init2 = function() { /* secondary init, after locale & da
|
|||||||
this.options = new SQL.Options(this);
|
this.options = new SQL.Options(this);
|
||||||
this.window = new SQL.Window(this);
|
this.window = new SQL.Window(this);
|
||||||
|
|
||||||
|
this.sync();
|
||||||
|
|
||||||
OZ.$("docs").value = _("docs");
|
OZ.$("docs").value = _("docs");
|
||||||
|
|
||||||
var url = window.location.href;
|
var url = window.location.href;
|
||||||
@@ -2374,6 +2398,8 @@ SQL.Designer.prototype.alignTables = function() {
|
|||||||
x += 10 + w;
|
x += 10 + w;
|
||||||
if (h > max) { max = h; }
|
if (h > max) { max = h; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
SQL.Designer.prototype.findNamedTable = function(name) { /* find row specified as table(row) */
|
SQL.Designer.prototype.findNamedTable = function(name) { /* find row specified as table(row) */
|
||||||
|
|||||||
Reference in New Issue
Block a user