can't create a blank file; fixed .h gutter format; right align info links

This commit is contained in:
Steven Hugg 2018-11-24 16:08:33 -05:00
parent a511d81c97
commit a10559634f
3 changed files with 13 additions and 7 deletions

View File

@ -109,6 +109,9 @@ div.mem_info a:hover {
div.mem_info a.selected {
color: #ffffff;
}
.mem_info_links {
text-align:right;
}
.btn_group {
border-radius:6px;
padding:8px;

View File

@ -286,6 +286,7 @@ export abstract class BaseFrameBasedPlatform extends BaseDebugPlatform {
export function getToolForFilename_6502(fn:string) : string {
if (fn.endsWith(".pla")) return "plasm";
if (fn.endsWith(".c")) return "cc65";
if (fn.endsWith(".h")) return "cc65";
if (fn.endsWith(".s")) return "ca65";
if (fn.endsWith(".ca65")) return "ca65";
if (fn.endsWith(".dasm")) return "dasm";
@ -572,6 +573,7 @@ export abstract class BaseZ80Platform extends BaseDebugPlatform {
export function getToolForFilename_z80(fn) {
if (fn.endsWith(".c")) return "sdcc";
if (fn.endsWith(".h")) return "sdcc";
if (fn.endsWith(".s")) return "sdasz80";
if (fn.endsWith(".ns")) return "naken";
if (fn.endsWith(".scc")) return "sccz80";

View File

@ -229,7 +229,7 @@ function getSkeletonFile(fileid:string, callback) {
function _createNewFile(e) {
// TODO: support spaces
var filename = prompt("Create New File", "newfile" + platform.getDefaultExtension());
if (filename && filename.length) {
if (filename && filename.trim().length > 0) {
if (filename.indexOf(" ") >= 0) {
alert("No spaces, please.");
return;
@ -409,6 +409,7 @@ function _revertFile(e) {
}
}, 'text')
.fail(function() {
// TODO: delete file
alert("Can only revert built-in files.");
});
return true;
@ -572,7 +573,7 @@ function showDebugInfo(state?) {
if (s) {
var hs = lastDebugInfo ? highlightDifferences(lastDebugInfo, s) : s;
meminfo.show().html(hs);
var catspan = $('<span>');
var catspan = $('<div class="mem_info_links">');
var addCategoryLink = (cat:string) => {
var catlink = $('<a>'+cat+'</a>');
if (cat == debugCategory)
@ -890,7 +891,7 @@ function addFileToProject(type, ext, linefn) {
var wnd = projectWindows.getActive();
if (wnd && wnd.insertText) {
var filename = prompt("Add "+type+" File to Project", "filename"+ext);
if (filename) {
if (filename && filename.trim().length > 0) {
var path = "local/" + filename;
var newline = "\n" + linefn(filename) + "\n";
current_project.loadFiles([path], (err, result) => {
@ -913,10 +914,10 @@ function _addIncludeFile() {
var tool = platform.getToolForFilename(fn);
if (fn.endsWith(".c") || tool == 'sdcc' || tool == 'cc65')
addFileToProject("Header", ".h", (s) => { return '#include "'+s+'"' });
else if (tool == 'dasm')
addFileToProject("Include File", ".h", (s) => { return '\tinclude "'+s+'"' });
else if (tool == 'ca65' || tool == 'sdasz80' || tool == 'zmac')
addFileToProject("Include File", ".h", (s) => { return '\t.include "'+s+'"' });
else if (tool == 'dasm' || tool == 'zmac')
addFileToProject("Include File", ".inc", (s) => { return '\tinclude "'+s+'"' });
else if (tool == 'ca65' || tool == 'sdasz80')
addFileToProject("Include File", ".inc", (s) => { return '\t.include "'+s+'"' });
else if (tool == 'verilator')
addFileToProject("Verilog File", ".v", (s) => { return '`include "'+s+'"' });
else