App-SocialCalc-Multiplayer
view release on metacpan or search on metacpan
socialcalc/socialcalctableeditor.js view on Meta::CPAN
else if (inputecho.prompt.style.display != "none") {
inputecho.prompt.innerHTML = "";
inputecho.prompt.style.display = "none";
}
}
SocialCalc.InputEchoHeartbeat = function() {
var editor = SocialCalc.Keyboard.focusTable; // get TableEditor doing keyboard stuff
if (!editor) return true; // we're not handling it -- let browser do default
editor.inputEcho.SetText(editor.inputBox.GetText()+"_");
}
SocialCalc.InputEchoMouseDown = function(e) {
var event = e || window.event;
var editor = SocialCalc.Keyboard.focusTable; // get TableEditor doing keyboard stuff
if (!editor) return true; // we're not handling it -- let browser do default
// if (event.stopPropagation) event.stopPropagation(); // DOM Level 2
// else event.cancelBubble = true; // IE 5+
// if (event.preventDefault) event.preventDefault(); // DOM Level 2
// else event.returnValue = false; // IE 5+
editor.inputBox.element.focus();
// return false;
};
// *************************************
//
// CellHandles class:
//
// This object creates and controls the elements around the cursor cell for dragging, etc.
//
// *************************************
SocialCalc.CellHandles = function(editor) {
var scc = SocialCalc.Constants;
var functions;
if (editor.noEdit) return; // leave us with nothing
this.editor = editor; // the TableEditor this belongs to
this.noCursorSuffix = false;
this.movedmouse = false; // used to detect no-op
this.draghandle = document.createElement("div");
SocialCalc.setStyles(this.draghandle, "display:none;position:absolute;zIndex:8;border:1px solid white;width:4px;height:4px;fontSize:1px;backgroundColor:#0E93D8;cursor:default;");
this.draghandle.innerHTML = ' ';
editor.toplevel.appendChild(this.draghandle);
SocialCalc.AssignID(editor, this.draghandle, "draghandle");
var imagetype = "png";
if (navigator.userAgent.match(/MSIE 6\.0/)) {
imagetype = "gif";
}
this.dragpalette = document.createElement("div");
SocialCalc.setStyles(this.dragpalette, "display:none;position:absolute;zIndex:8;width:90px;height:90px;fontSize:1px;textAlign:center;cursor:default;"+
"backgroundImage:url("+SocialCalc.Constants.defaultImagePrefix+"drag-handles."+imagetype+");");
this.dragpalette.innerHTML = ' ';
editor.toplevel.appendChild(this.dragpalette);
SocialCalc.AssignID(editor, this.dragpalette, "dragpalette");
this.dragtooltip = document.createElement("div");
SocialCalc.setStyles(this.dragtooltip, "display:none;position:absolute;zIndex:9;border:1px solid black;width:100px;height:auto;fontSize:10px;backgroundColor:#FFFFFF;");
this.dragtooltip.innerHTML = ' ';
editor.toplevel.appendChild(this.dragtooltip);
SocialCalc.AssignID(editor, this.dragtooltip, "dragtooltip");
this.fillinghandle = document.createElement("div");
SocialCalc.setStyles(this.fillinghandle, "display:none;position:absolute;zIndex:9;border:1px solid black;width:auto;height:14px;fontSize:10px;backgroundColor:#FFFFFF;");
this.fillinghandle.innerHTML = ' ';
editor.toplevel.appendChild(this.fillinghandle);
SocialCalc.AssignID(editor, this.fillinghandle, "fillinghandle");
if (this.draghandle.addEventListener) { // DOM Level 2 -- Firefox, et al
this.draghandle.addEventListener("mousemove", SocialCalc.CellHandlesMouseMoveOnHandle, false);
this.dragpalette.addEventListener("mousedown", SocialCalc.CellHandlesMouseDown, false);
this.dragpalette.addEventListener("mousemove", SocialCalc.CellHandlesMouseMoveOnHandle, false);
}
else if (this.draghandle.attachEvent) { // IE 5+
this.draghandle.attachEvent("onmousemove", SocialCalc.CellHandlesMouseMoveOnHandle);
this.dragpalette.attachEvent("onmousedown", SocialCalc.CellHandlesMouseDown);
this.dragpalette.attachEvent("onmousemove", SocialCalc.CellHandlesMouseMoveOnHandle);
}
else { // don't handle this
throw "Browser not supported";
}
}
// Methods:
SocialCalc.CellHandles.prototype.ShowCellHandles = function(show, moveshow) {return SocialCalc.ShowCellHandles(this, show, moveshow);};
// Functions:
SocialCalc.ShowCellHandles = function(cellhandles, show, moveshow) {
var cell, cell2, position, position2;
var editor = cellhandles.editor;
var doshow = false;
var row, col, viewport;
if (!editor) return;
do { // a block that can you can "break" out of easily
if (!show) break;
row = editor.ecell.row;
col = editor.ecell.col;
( run in 0.379 second using v1.01-cache-2.11-cpan-df04353d9ac )