xenia/debugger/assets/ui/code/code-tab.js

94 lines
2.4 KiB
JavaScript
Raw Normal View History

2013-12-22 08:21:35 +00:00
/**
******************************************************************************
* Xenia : Xbox 360 Emulator Research Project *
******************************************************************************
* Copyright 2013 Ben Vanik. All rights reserved. *
* Released under the BSD license - see LICENSE in the root for more details. *
******************************************************************************
*/
'use strict';
var module = angular.module('xe.ui.code', [
2013-12-24 22:09:19 +00:00
'ui.bootstrap',
2013-12-22 08:21:35 +00:00
'xe.log',
'xe.session'
]);
module.controller('CodeTabController', function(
2013-12-24 22:09:19 +00:00
$rootScope, $scope, $modal, app, log) {
2013-12-26 04:14:41 +00:00
$scope.app = app;
2013-12-22 10:59:42 +00:00
$scope.moduleList = [];
$scope.selectedModule = null;
$scope.functionList = [];
2013-12-22 08:21:35 +00:00
function refresh() {
2013-12-26 01:31:53 +00:00
if (!app.session) {
$scope.moduleList = [];
return;
}
2013-12-22 08:21:35 +00:00
2013-12-26 01:31:53 +00:00
$scope.moduleList = app.session.state.getModuleList();
if (!$scope.selectedModule) {
if ($scope.moduleList.length) {
$scope.selectModule($scope.moduleList[0]);
2013-12-22 10:59:42 +00:00
}
2013-12-26 01:31:53 +00:00
} else {
$scope.selectModule($scope.selectedModule);
}
2013-12-22 08:21:35 +00:00
console.log('refresh');
};
$rootScope.$on('refresh', refresh);
2013-12-22 10:59:42 +00:00
$scope.selectModule = function(module) {
var moduleChange = module != $scope.selectedModule;
$scope.selectedModule = module;
if (moduleChange) {
$scope.functionList = [];
}
2013-12-26 01:31:53 +00:00
$scope.functionList = app.session.state.getFunctionList(module.name);
2013-12-22 10:59:42 +00:00
};
2013-12-26 01:31:53 +00:00
$scope.showModuleInfo = function() {
2013-12-24 22:09:19 +00:00
var modalInstance = $modal.open({
templateUrl: 'assets/ui/code/module-info.html',
controller: 'ModuleInfoController',
2013-12-25 01:25:29 +00:00
windowClass: 'debugger-module-info',
resolve: {
moduleName: function() {
return $scope.selectedModule.name;
},
moduleInfo: function() {
2013-12-26 01:31:53 +00:00
return app.session.state.getModule(
2013-12-25 01:25:29 +00:00
$scope.selectedModule.name);
}
}
2013-12-24 22:09:19 +00:00
});
2013-12-26 01:31:53 +00:00
};
$scope.showThreadInfo = function() {
var modalInstance = $modal.open({
templateUrl: 'assets/ui/code/thread-info.html',
controller: 'ThreadInfoController',
windowClass: 'debugger-module-info',
resolve: {
thread: function() {
return app.session.activeThread;
}
}
2013-12-24 22:09:19 +00:00
});
};
$scope.showLocation = function() {
//
};
if (app.session.dataSource) {
refresh();
}
2013-12-22 08:21:35 +00:00
});