mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-03 15:24:00 +01:00
Move resultsBar according to scroll pos & panes
scrollbarVisible now part of top.ICEcoder namespace Placement of resultsBar done in setLayout now and takes splitpane into account On change we set scrollbarVisible and set layout again
This commit is contained in:
@@ -23,6 +23,7 @@ var ICEcoder = {
|
||||
nextcMInstance: 1, // Next available CodeMirror instance no
|
||||
selectedFiles: [], // Array of selected files
|
||||
findMode: false, // States if we're in find/replace mode
|
||||
scrollbarVisible: false, // Indicates if the main pane has a scrollbar
|
||||
lockedNav: true, // Nav is locked or not
|
||||
mouseDown: false, // If the mouse is down
|
||||
draggingFilesW: false, // If we're dragging the file manager width
|
||||
@@ -132,7 +133,14 @@ var ICEcoder = {
|
||||
top.ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[i]].setSize("100%",top.ICEcoder.content.style.height);
|
||||
top.ICEcoder.content.contentWindow['cM'+ICEcoder.cMInstances[i]+'diff'].setSize("0",top.ICEcoder.content.style.height);
|
||||
}
|
||||
}},4);
|
||||
}
|
||||
// Place resultsBar to edge of pane or it's scrollbar
|
||||
if (!top.ICEcoder.splitPane) {
|
||||
top.ICEcoder.content.contentWindow.document.getElementById('resultsBar').style.right = !top.ICEcoder.scrollBarVisible ? "0" : "17px";
|
||||
} else {
|
||||
top.ICEcoder.content.contentWindow.document.getElementById('resultsBar').style.right = !top.ICEcoder.scrollBarVisible ? parseInt(parseInt(ICEcoder.content.style.width,10)/2,10)+"px" : (parseInt(parseInt(ICEcoder.content.style.width,10)/2,10)+17)+"px";
|
||||
}
|
||||
},4);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -269,6 +277,13 @@ var ICEcoder = {
|
||||
if (!top.ICEcoder.loadingFile) {
|
||||
top.ICEcoder.redoTabHighlight(top.ICEcoder.selectedTab);
|
||||
}
|
||||
|
||||
// Detect if we have a scrollbar & set layout again
|
||||
setTimeout(function() {
|
||||
top.ICEcoder.scrollBarVisible = thisCM.getScrollInfo().height > thisCM.getScrollInfo().clientHeight;
|
||||
top.ICEcoder.setLayout();
|
||||
},0);
|
||||
|
||||
top.ICEcoder.getCaretPosition();
|
||||
top.ICEcoder.updateCharDisplay();
|
||||
top.ICEcoder.updateByteDisplay();
|
||||
@@ -1470,7 +1485,7 @@ var ICEcoder = {
|
||||
|
||||
// Find & replace text according to user selections
|
||||
findReplace: function(findString,resultsOnly,buttonClick) {
|
||||
var find, replace, results, cM, cMdiff, thisCM, content, scrollBarVisible, cursor, avgBlockH, addPadding, rBlocks, blockColor, replaceQS, targetQS, filesQS;
|
||||
var find, replace, results, cM, cMdiff, thisCM, content, cursor, avgBlockH, addPadding, rBlocks, blockColor, replaceQS, targetQS, filesQS;
|
||||
|
||||
// Determine our find & replace strings and results display
|
||||
find = findString.toLowerCase();
|
||||
@@ -1514,8 +1529,6 @@ var ICEcoder = {
|
||||
|
||||
// If we have results
|
||||
if (ICEcoder.results.length>0) {
|
||||
// Detect if we have a scrollbar
|
||||
scrollBarVisible = thisCM.getScrollInfo().height > thisCM.getScrollInfo().clientHeight;
|
||||
|
||||
// Show results only
|
||||
if (resultsOnly) {
|
||||
@@ -1548,11 +1561,9 @@ var ICEcoder = {
|
||||
|
||||
// Display the find results bar
|
||||
// The avg block is either line height or fraction of space available
|
||||
avgBlockH = !scrollBarVisible ? thisCM.defaultTextHeight() : parseInt(top.ICEcoder.content.style.height,10)/thisCM.lineCount();
|
||||
avgBlockH = !top.ICEcoder.scrollBarVisible ? thisCM.defaultTextHeight() : parseInt(top.ICEcoder.content.style.height,10)/thisCM.lineCount();
|
||||
// Need to add padding if there's no scrollbar, so current line highlighting lines up with it
|
||||
addPadding = !scrollBarVisible ? thisCM.heightAtLine(0) : 0;
|
||||
// Place to edge of screen or scrollbar
|
||||
top.ICEcoder.content.contentWindow.document.getElementById('resultsBar').style.right = !scrollBarVisible ? "0" : "17px";
|
||||
addPadding = !top.ICEcoder.scrollBarVisible ? thisCM.heightAtLine(0) : 0;
|
||||
rBlocks = "";
|
||||
for (var i=1; i<=thisCM.lineCount(); i++) {
|
||||
blockColor = ICEcoder.resultsLines.indexOf(i)>-1 ? thisCM.getCursor().line+1 == i ? "#b00" : "#888" : "transparent"
|
||||
|
||||
Reference in New Issue
Block a user