mirror of
https://github.com/xenia-project/xenia.git
synced 2026-04-06 07:03:33 +00:00
Displaying (unformatted) function code.
This commit is contained in:
parent
4ecdfed46f
commit
c92142ca02
20 changed files with 242 additions and 44 deletions
|
|
@ -17,17 +17,47 @@ var module = angular.module('xe.ui.code.functionView', [
|
|||
|
||||
module.controller('FunctionViewController', function(
|
||||
$rootScope, $scope, app, log) {
|
||||
$scope.codeType = 'ppc';
|
||||
$scope.codeType = 'source';
|
||||
|
||||
function refresh() {
|
||||
if (!app.session || !app.session.dataSource) {
|
||||
$scope.fn = null;
|
||||
return;
|
||||
}
|
||||
var dataSource = app.session.dataSource;
|
||||
|
||||
dataSource.getFunction($scope.functionAddress).then(function(fn) {
|
||||
$scope.fn = fn;
|
||||
updateCode();
|
||||
}, function(e) {
|
||||
log.error('Unable to fetch function');
|
||||
});
|
||||
};
|
||||
$rootScope.$on('refresh', refresh);
|
||||
$scope.$watch('functionAddress', refresh);
|
||||
|
||||
var textArea = document.querySelector('.debugger-fnview-textarea');
|
||||
$scope.codeMirror = CodeMirror.fromTextArea(textArea, {
|
||||
mode: 'javascript',
|
||||
theme: 'default',
|
||||
indentUnit: 2,
|
||||
tabSize: 2,
|
||||
lineNumbers: true,
|
||||
firstLineNumber: 0,
|
||||
lineNumberFormatter: function(line) {
|
||||
return String(line);
|
||||
},
|
||||
gutters: [],
|
||||
readOnly: true
|
||||
});
|
||||
|
||||
function updateCode() {
|
||||
var codeType = $scope.codeType;
|
||||
var value = '';
|
||||
if ($scope.fn) {
|
||||
value = $scope.fn.disasm[codeType];
|
||||
}
|
||||
$scope.codeMirror.setValue(value || '');
|
||||
};
|
||||
$scope.$watch('codeType', updateCode);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue