Dynamic page layout & minor fixups

dev/git-series/gccdum
Matt Godbolt 10 years ago
parent 6dd6168009
commit 9b873178c7

@ -94,6 +94,7 @@ function Compiler(domRoot, origFilters, windowLocalPrefix, onChangeCallback) {
return node[0];
}
var compileStartTime = new Date();
var errorWidgets = [];
function onCompileResponse(data) {
var stdout = data.stdout || "";
@ -105,6 +106,7 @@ function Compiler(domRoot, origFilters, windowLocalPrefix, onChangeCallback) {
}
if (_gaq) {
_gaq.push(['_trackEvent', 'Compile', data.compiler, data.options, data.code]);
_gaq.push(['_trackTiming', 'Compile', 'Timing', +(new Date() - compileStartTime)]);
}
$('.result .output :visible').remove();
var highlightLine = (data.asm == null);
@ -198,7 +200,9 @@ function Compiler(domRoot, origFilters, windowLocalPrefix, onChangeCallback) {
dataType: 'json',
data: data,
success: onCompileResponse});
asmCodeMirror.setValue("Processing...");
currentAssembly = "[Processing...]";
compileStartTime = new Date();
updateAsm();
}, 750);
setSetting('code', cppEditor.getValue());
updateAsm();
@ -258,12 +262,20 @@ function Compiler(domRoot, origFilters, windowLocalPrefix, onChangeCallback) {
onChange(); // used to just update ASM, but things like "Intel syntax" need a new request
}
function setEditorHeight(height) {
const MinHeight = 100;
if (height < MinHeight) height = MinHeight;
cppEditor.setSize(null, height);
asmCodeMirror.setSize(null, height);
}
return {
serialiseState: serialiseState,
deserialiseState: deserialiseState,
setCompilers: setCompilers,
getSource: getSource,
setSource: setSource,
setFilters: setFilters
setFilters: setFilters,
setEditorHeight: setEditorHeight
};
}

@ -3,7 +3,8 @@
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
min-height: 600px;
font-size: 10pt;
min-height: 100px;
}
.CodeMirror-scroll {
/* Set scrolling behaviour here */

@ -6,6 +6,11 @@ body {
.sideBySide {
}
.output {
height: 80px;
overflow: auto;
}
.options {
background: #ddf;
border-radius: 4px;

@ -210,6 +210,19 @@ function initialise() {
loadFromHash();
});
loadFromHash();
function resizeEditors() {
var codeMirrors = $('.CodeMirror');
var top = codeMirrors.position().top;
var windowHeight = $(window).height();
var compOutputSize = Math.max(100, windowHeight * 0.05);
$('.output').height(compOutputSize);
var resultHeight = $('.result').height();
var height = windowHeight - top - resultHeight - 40;
currentCompiler.setEditorHeight(height);
}
$(window).on("resize", resizeEditors);
resizeEditors();
}
function getAsmFilters() {

@ -102,9 +102,9 @@
<textarea>Awaiting</textarea>
</div>
</div>
<div class="row result">
<div class="row-fluid result">
<div class="topbar">Compiler output</div>
<div class="output span12">
<div class="output">
<p class="template"></p>
</div>
</div>

Loading…
Cancel
Save