Skip to content

Commit 2f26b99

Browse files
committed
Merge remote-tracking branch 'remotes/origin/feature/splitview'
2 parents 5ea0434 + 7a50b77 commit 2f26b99

File tree

14 files changed

+1030
-70
lines changed

14 files changed

+1030
-70
lines changed

client/ext/code/code.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ module.exports = ext.register("ext/code/code", {
271271
amlPage.appendChild(ceEditor);
272272
ceEditor.show();
273273

274-
this.ceEditor = ceEditor;
274+
this.ceEditor = this.amlEditor = ceEditor;
275275

276276
var _self = this;
277277

@@ -305,8 +305,6 @@ module.exports = ext.register("ext/code/code", {
305305
checked : "[{require('ext/settings/settings').model}::editors/code/@wrapmode]"
306306
}))
307307
);
308-
309-
310308

311309
mnuSyntax.onitemclick = function(e) {
312310
var file = ide.getActivePageModel();

client/ext/editors/editors.js

Lines changed: 50 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -296,21 +296,21 @@ module.exports = ext.register("ext/editors/editors", {
296296
if (init)
297297
tabEditors.setAttribute("buttons", "close");
298298

299-
var model = new apf.model(),
300-
fake = tabEditors.add("{([@changed] == 1 ? '*' : '') + [@name]}", filepath, editor.path, null, function(page){
301-
page.contentType = contentType;
302-
page.$at = new apf.actiontracker();
303-
page.$doc = doc;
304-
doc.$page = page;
305-
page.$editor = editor;
306-
page.setAttribute("tooltip", "[@path]");
307-
page.setAttribute("class",
308-
"{parseInt([@saving], 10) || parseInt([@lookup], 10) ? (tabEditors.getPage(tabEditors.activepage) == this ? 'saving_active' : 'saving') : \
309-
([@loading] ? (tabEditors.getPage(tabEditors.activepage) == this ? 'loading_active' : 'loading') : '')}"
310-
);
311-
page.setAttribute("model", page.$model = model);
312-
page.$model.load(xmlNode);
313-
});
299+
var model = new apf.model();
300+
var fake = tabEditors.add("{([@changed] == 1 ? '*' : '') + [@name]}", filepath, editor.path, null, function(page){
301+
page.contentType = contentType;
302+
page.$at = new apf.actiontracker();
303+
page.$doc = doc;
304+
doc.$page = page;
305+
page.$editor = editor;
306+
page.setAttribute("tooltip", "[@path]");
307+
page.setAttribute("class",
308+
"{parseInt([@saving], 10) || parseInt([@lookup], 10) ? (tabEditors.getPage(tabEditors.activepage) == this ? 'saving_active' : 'saving') : \
309+
([@loading] ? (tabEditors.getPage(tabEditors.activepage) == this ? 'loading_active' : 'loading') : '')}"
310+
);
311+
page.setAttribute("model", page.$model = model);
312+
page.$model.load(xmlNode);
313+
});
314314

315315
if (init)
316316
tabEditors.setAttribute("buttons", "close,scale,order");
@@ -321,28 +321,9 @@ module.exports = ext.register("ext/editors/editors", {
321321
fake.$model.load(e.node);
322322
ide.dispatchEvent("afteropenfile", {doc: doc, node: e.node, editor: editor});
323323
});
324-
325-
fake.$at.addEventListener("afterchange", function(e) {
326-
if (e.action == "reset") {
327-
delete this.undo_ptr;
328-
return;
329-
}
330-
331-
var val;
332-
if (fake.$at.ignoreChange) {
333-
val = undefined;
334-
fake.$at.ignoreChange = false;
335-
} else if(this.undolength === 0 && !this.undo_ptr)
336-
val = undefined;
337-
else
338-
val = (this.$undostack[this.$undostack.length-1] !== this.undo_ptr) ? 1 : undefined;
339-
340-
if (fake.changed !== val) {
341-
fake.changed = val;
342-
model.setQueryValue("@changed", (val ? "1" : "0"));
343-
}
344-
});
345324

325+
this.initEditorEvents(fake, model);
326+
346327
if (init && !active)
347328
return;
348329

@@ -365,6 +346,34 @@ module.exports = ext.register("ext/editors/editors", {
365346

366347
settings.save();
367348
},
349+
350+
initEditorEvents: function(fake, model) {
351+
fake.$at.addEventListener("afterchange", function(e) {
352+
if (e.action == "reset") {
353+
delete this.undo_ptr;
354+
return;
355+
}
356+
357+
var val;
358+
if (fake.$at.ignoreChange) {
359+
val = undefined;
360+
fake.$at.ignoreChange = false;
361+
}
362+
else if(this.undolength === 0 && !this.undo_ptr) {
363+
val = undefined;
364+
}
365+
else {
366+
val = (this.$undostack[this.$undostack.length - 1] !== this.undo_ptr)
367+
? 1
368+
: undefined;
369+
}
370+
371+
if (fake.changed !== val) {
372+
fake.changed = val;
373+
model.setQueryValue("@changed", (val ? "1" : "0"));
374+
}
375+
});
376+
},
368377

369378
close : function(page) {
370379
page.addEventListener("afterclose", this.$close);
@@ -423,6 +432,11 @@ module.exports = ext.register("ext/editors/editors", {
423432
editorPage.setAttribute("actiontracker", page.$at);
424433

425434
page.$editor.setDocument && page.$editor.setDocument(page.$doc, page.$at);
435+
436+
ide.dispatchEvent("editorswitch", {
437+
previousPage: e.previousPage,
438+
nextPage: e.nextPage
439+
});
426440
},
427441

428442
afterswitch : function(e) {

client/ext/imgview/imgview.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ module.exports = ext.register("ext/imgview/imgview", {
4141
nodes : [],
4242

4343
setDocument : function(doc, actiontracker){
44-
imgEditor.setProperty("value", doc.getNode().getAttribute("path"));
44+
doc.session = doc.getNode().getAttribute("path");
45+
imgEditor.setProperty("value", doc.session);
4546
},
4647

4748
hook : function() {
@@ -52,7 +53,7 @@ module.exports = ext.register("ext/imgview/imgview", {
5253
amlPage.appendChild(imgEditor);
5354
imgEditor.show();
5455

55-
this.imgEditor = imgEditor;
56+
this.imgEditor = this.amlEditor = imgEditor;
5657
//this.nodes.push();
5758
},
5859

client/ext/keybindings_default/default_mac.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ return keys.onLoad({
9090
"nexttab": "Command-Tab|Option-Tab",
9191
"previoustab": "Command-Shift-Tab|Option-Shift-Tab"
9292
},
93+
"splitview" : {
94+
"mergetableft": "Command-Option-[",
95+
"mergetabright": "Command-Option-]"
96+
},
9397
"code" : {
9498
"selectall": "Command-A",
9599
"removeline": "Command-D",

client/ext/keybindings_default/default_win.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,10 @@ return keys.onLoad({
9191
"nexttab": "Ctrl-Tab",
9292
"previoustab": "Ctrl-Shift-Tab"
9393
},
94+
"splitview" : {
95+
"mergetableft": "Ctrl-Alt-[",
96+
"mergetabright": "Ctrl-Alt-]"
97+
},
9498
"code" : {
9599
"selectall": "Ctrl-A",
96100
"removeline": "Ctrl-D",

client/ext/splitview/splitview.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.editor_tab .btnsesssioncontainer div.curbtn.splitview_active .tab_middle {
2+
color: #368419;
3+
text-shadow: rgba(255, 255, 255, .71) 0px 1px 0px;
4+
}
5+
6+
.editor_tab .btnsesssioncontainer div.curbtn.splitview_inactive .tab_middle {
7+
8+
}

0 commit comments

Comments
 (0)