Skip to content

Commit

Permalink
Merge pull request #250 from FPGAwars/memory-gutter
Browse files Browse the repository at this point in the history
Memory gutter
  • Loading branch information
Jesus89 authored Jul 19, 2018
2 parents c68659c + dacd461 commit e79a1bf
Show file tree
Hide file tree
Showing 6 changed files with 673 additions and 577 deletions.
1 change: 1 addition & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"multistr": true,
"-W064": true,
"-W069": true,
"-W083": true,
"-W084": true,
"globals": {
"$": false,
Expand Down
37 changes: 31 additions & 6 deletions app/scripts/graphics/joint.shapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1067,14 +1067,14 @@ joint.shapes.ice.MemoryView = joint.shapes.ice.ModelView.extend({
<script>\
var ' + editorLabel + ' = ace.edit("' + editorLabel + '");\
' + editorLabel + '.setTheme("ace/theme/chrome");\
' + editorLabel + '.renderer.setShowGutter(true);\
' + editorLabel + '.setHighlightActiveLine(false);\
' + editorLabel + '.setHighlightGutterLine(false);\
' + editorLabel + '.setOption("firstLineNumber", 0);\
' + editorLabel + '.setAutoScrollEditorIntoView(true);\
' + editorLabel + '.session.setMode("ace/mode/verilog");\
' + editorLabel + '.renderer.setShowGutter(true);\
' + editorLabel + '.renderer.$cursorLayer.element.style.opacity = 0;\
' + editorLabel + '.renderer.$gutter.style.background = "#F0F0F0";\
' + editorLabel + '.session.setMode("ace/mode/verilog");\
</script>\
<div class="resizer"/></div>\
</div>\
Expand Down Expand Up @@ -1176,6 +1176,7 @@ joint.shapes.ice.MemoryView = joint.shapes.ice.ModelView.extend({
this.applyName();
this.applyLocal();
this.applyValue(opt);
this.applyFormat();
},

applyName: function() {
Expand Down Expand Up @@ -1232,6 +1233,30 @@ joint.shapes.ice.MemoryView = joint.shapes.ice.ModelView.extend({
}, 10, this);
},

applyFormat: function() {
this.updating = true;

var self = this;
var data = this.model.get('data');
var radix = data.format;
this.editor.session.gutterRenderer = {
getWidth: function(session, lastLineNumber, config) {
return lastLineNumber.toString().length * config.characterWidth;
},
getText: function(session, row) {
var text = row.toString(radix).toUpperCase();
var config = self.editor.renderer.layerConfig;
var size = config.lastRow.toString(radix).length;
while (text.length < size) {text = '0' + text;}
return (radix === 16 ? '0x' : '') + text;
}
};
this.editor.renderer.setShowGutter(false);
this.editor.renderer.setShowGutter(true);

this.updating = false;
},

update: function() {
this.renderPorts();
this.editor.setReadOnly(this.model.get('disabled'));
Expand Down Expand Up @@ -1329,12 +1354,12 @@ joint.shapes.ice.CodeView = joint.shapes.ice.ModelView.extend({
<script>\
var ' + editorLabel + ' = ace.edit("' + editorLabel + '");\
' + editorLabel + '.setTheme("ace/theme/chrome");\
' + editorLabel + '.renderer.setShowGutter(true);\
' + editorLabel + '.setHighlightActiveLine(false);\
' + editorLabel + '.setHighlightGutterLine(false);\
' + editorLabel + '.setAutoScrollEditorIntoView(true);\
' + editorLabel + '.session.setMode("ace/mode/verilog");\
' + editorLabel + '.renderer.setShowGutter(true);\
' + editorLabel + '.renderer.$cursorLayer.element.style.opacity = 0;\
' + editorLabel + '.session.setMode("ace/mode/verilog");\
</script>\
<div class="resizer"/></div>\
</div>\
Expand Down Expand Up @@ -1629,12 +1654,12 @@ joint.shapes.ice.InfoView = joint.shapes.ice.ModelView.extend({
<script>\
var ' + editorLabel + ' = ace.edit("' + editorLabel + '");\
' + editorLabel + '.setTheme("ace/theme/chrome");\
' + editorLabel + '.renderer.setShowGutter(false);\
' + editorLabel + '.setHighlightActiveLine(false);\
' + editorLabel + '.setShowPrintMargin(false);\
' + editorLabel + '.setAutoScrollEditorIntoView(true);\
' + editorLabel + '.session.setMode("ace/mode/markdown");\
' + editorLabel + '.renderer.setShowGutter(false);\
' + editorLabel + '.renderer.$cursorLayer.element.style.opacity = 0;\
' + editorLabel + '.session.setMode("ace/mode/markdown");\
</script>\
<div class="info-render markdown-body' + (readonly ? '' : ' hidden') + '"></div>\
<div class="resizer"/></div>\
Expand Down
Loading

0 comments on commit e79a1bf

Please sign in to comment.