diff --git a/lib/coder.js b/lib/coder.js index d9b1ce2..ea497ef 100644 --- a/lib/coder.js +++ b/lib/coder.js @@ -369,13 +369,18 @@ var ICEcoder = { // Reset all tabs to be without a highlight and then highlight the selected redoTabHighlight: function(selectedTab) { - var bgVPos, tColor; + var cM, bgVPos, tColor, fileLink; + cM = ICEcoder.getcMInstance(); for(var i=1;i<=ICEcoder.changedContent.length;i++) { if (document.getElementById('closeTabButton'+i)) { - ICEcoder.changedContent[i-1]==1 ? document.getElementById('closeTabButton'+i).style.backgroundColor = "#b00" : document.getElementById('closeTabButton'+i).style.backgroundColor = "rgba(255,255,255,0.3)"; + ICEcoder.changedContent[i-1]==1 && cM.historySize().undo>0 ? document.getElementById('closeTabButton'+i).style.backgroundColor = "#b00" : document.getElementById('closeTabButton'+i).style.backgroundColor = "rgba(255,255,255,0.3)"; } i==selectedTab ? tColor = "#000" : tColor = "#fff"; + if ("undefined" != typeof top.ICEcoder.openFiles[i-1] && top.ICEcoder.openFiles[i-1] != "/[NEW]") { + fileLink = top.ICEcoder.filesFrame.contentWindow.document.getElementById(top.ICEcoder.openFiles[i-1].replace(/\//g,"|")); + i==selectedTab ? fileLink.style.backgroundColor = "#4499dd" : fileLink.style.backgroundColor = "rgba(255,255,255,0.15)"; + } document.getElementById('tab'+i).style.color = tColor; i==selectedTab ? bgVPos = -22 : bgVPos = 0; document.getElementById('tab'+i).style.backgroundPosition = "0 "+bgVPos+"px"; @@ -422,7 +427,7 @@ var ICEcoder = { // Add a new value ready to indicate if this content has been changed top.ICEcoder.changedContent.push(0); - top.ICEcoder.setLastOpenedFiles(); + top.ICEcoder.setPreviousFiles(); }, // Create a new tab for a file @@ -565,7 +570,7 @@ var ICEcoder = { top.ICEcoder.changedContent.splice(closeTabNum-1,1); top.parent.ICEcoder.redoTabHighlight(ICEcoder.selectedTab); - top.ICEcoder.setLastOpenedFiles(); + top.ICEcoder.setPreviousFiles(); } // Lastly, stop it from trying to also switch tab top.ICEcoder.canSwitchTabs=false; @@ -693,7 +698,19 @@ var ICEcoder = { // Select or deselect file selectDeselectFile: function(action,file) { - action == "select" ? file.style.backgroundColor="#888" : file.style.backgroundColor="transparent"; + var isOpen; + + top.ICEcoder.openFiles.indexOf(file.id.replace(/\|/g,"/")) > -1 ? isOpen = true : isOpen = false; + + if (top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1] == file.id.replace(/\|/g,"/")) { + file.style.backgroundColor="#4499dd"; + } else { + if (action=="select") { + file.style.backgroundColor="#888"; + } else { + isOpen ? file.style.backgroundColor = "rgba(255,255,255,0.15)" : file.style.backgroundColor="transparent"; + } + } action == "select" ? file.style.color="#fff" : file.style.color="#eee"; }, @@ -789,7 +806,7 @@ var ICEcoder = { top.ICEcoder.serverQueue("add","lib/file-control.php?action=rename&file="+renamedFile+"&oldFileName="+top.ICEcoder.rightClickedFile.replace(/\|/g,"/")); top.ICEcoder.serverMessage('Renaming to
'+renamedFile); - top.ICEcoder.setLastOpenedFiles(); + top.ICEcoder.setPreviousFiles(); } }, @@ -1392,27 +1409,27 @@ var ICEcoder = { top.ICEcoder.dontSelect = true; }, - // Set the current lastOpenedFiles in the settings file - setLastOpenedFiles: function() { - var lastOpenedFiles; + // Set the current previousFiles in the settings file + setPreviousFiles: function() { + var previousFiles; - lastOpenedFiles = ""; + previousFiles = ""; // Generate a comma seperated list for (var i=0;i