// Javascript escrito para el iFG visual var current, currentxy, currentwh, sobreElemento; var x, y, w, h, padX, padY, fila, elemento, tipo; var startX, startY, offsetX, offsetY; var comp; var sector; var mostrarPos; var snap = 1; var posx, posy; document.onmouseup = mouseUp; document.onmousedown = mouseDown; document.onkeydown = keyDown; document.onkeyup = keyUp; document.onmousemove = showMouse; var usarContext = false; // debe aparecer el menu para seleccionar estilos? var mouseSobreContext = false; // esta el mouse sobre el context menu? var contextMenu = document.getElementById('contextMenu'); var currentEstilo, contextEstilo, contextFila, contextElemento; var contextInicializado = false; //*******Generar HTML******* function regenerarHtml(generar) { qxIni("regenerarHtml(generar)", 1, "generadorgrafico.js"); document.conector.regenerarHtml(generar, qdf.autohide.checked); qxEnd(); } function borrarElmto(f, e) { qxIni("borrarElmto(f, e)", 1, "generadorgrafico.js"); if(f!='' && e!='' && proFila[f-1][13]!='1') document.conector.borrarElmto(f - 1, e - 1, qdf.autohide.checked); qxEnd(); } function crearElmto(f, e, tipo) { qxIni("crearElmto(f, e, tipo)", 1, "generadorgrafico.js"); if(f!='' && e!='') document.conector.crearElmto(f - 1, e - 1, tipo, qdf.autohide.checked); qxEnd(); } function crearFila(f) { qxIni("crearFila(f)", 1, "generadorgrafico.js"); document.conector.crearFila(true, f, qdf.autohide.checked); qxEnd(); } function nuevoFormulario() { qxIni("nuevoFormulario()", 1, "generadorgrafico.js"); document.conector.nuevoFormulario(true, true, qdf.autohide.checked); qxEnd(); } function editarFila(f) { qxIni("editarFila(f)", 1, "generadorgrafico.js"); var ff; var hayCambios = false; var hojaEstilos = document.styleSheets[1]; // Desde el combo de opciones en la barra de herramientas if(f == null) { f = showModalDialog("html/selRow.html", proFila.length, "status:false;dialogWidth:146px;dialogHeight:115px;scroll:no;help:no;status:no;"); } if(f != null && f != "") { document.conector.actualizarElemento(f, 0, null, qdf.autohide.checked); var args = new Array(); for(var i=0; i (h - padY - 1)) { setMouse(obj, 'sw-resize'); sector = 7; //SW }else { setMouse(obj, 'w-resize'); sector = 4; //W } }else if(offsetX > (w - padX - 1)) { //Hecho click en el lado derecho if(offsetY < padY) { setMouse(obj, 'ne-resize'); sector = 3; //NE }else if(offsetY > (h - padY - 1)) { setMouse(obj, 'se-resize'); sector = 9; //SE }else { setMouse(obj, 'e-resize'); sector = 6; //E } }else { //Hecho click en el medio if(offsetY < padY) { setMouse(obj, 'n-resize'); sector = 2; //N }else if(offsetY > (h - padY - 1)) { setMouse(obj, 's-resize'); sector = 8; //S }else { setMouse(obj, 'move'); sector = 5; //Center } } //window.status="Event: ["+event.clientX+","+event.clientY+"] w/h: ["+w+"/"+h+"] offset:["+offsetX+","+offsetY+"] snap="+snap; //alert("Setarea "+offsetX+":"+offsetY+":"+w+":"+h+":"+sector); } function mouseDown() { if(mouseSobreContext || current || !currentxy) { return; } var div = document.getElementById('contextMenu'); if(event.button == 2) { if(!sobreElemento) { mouseOut(); if(div) div.style.display = 'none'; return; }else { usarContext = true; return; } }else if(div && div.style.display != 'none') { div.style.display = 'none'; if(!sobreElemento) return; } current = event.srcElement; switch(sector){ case(1): document.onmousemove = extNW; break; case(2): document.onmousemove = extN; break; case(3): document.onmousemove = extNE; break; case(4): document.onmousemove = extW; break; case(5): document.onmousemove = mover; break; case(6): document.onmousemove = extE; break; case(7): document.onmousemove = extSW; break; case(8): document.onmousemove = extS; break; case(9): document.onmousemove = extSE; break; default: //alert("Error, sector no es definido (generadorgrafico.js)"); } } function mouseUp() { //Al terminar de mover/extender un elemento, se envia la informacion //al iFG y se retira la accion del elemento. if(!current || current.type=='hidden') return; var w1, h1; if(!currentwh) w1 = h1 = 0; //A veces elementos no tienen width o height else if(currentwh.width || currentwh.height) { w1 = currentwh.width ? currentwh.width : 0; h1 = currentwh.height ? currentwh.height : 0; }else if(currentwh.style.width || currentwh.style.height) { if(tipo.match("CheckBox|RadioBoton")) { current = null; return; } if(currentwh.style.width) w1 = parseInt(currentwh.style.width.substr(0, currentwh.style.width.length - 2)); //quita el "px" else w1 = 0; if(currentwh.style.height) h1 = parseInt(currentwh.style.height.substr(0, currentwh.style.height.length - 2)); //quita el "px" else h1 = 0; }else w1 = h1 = 0; document.onmousemove = showMouse; current = null; qdf.qzFila.value = fila + 1; qdf.qzElmto.value = elemento + 1; qdf.qzTipo.value = tipo; document.conector.actualizarElemento(fila, elemento, currentxy.style.pixelLeft, currentxy.style.pixelTop, w1, h1, qdf.autohide.checked); //if(comp==1) alert("Enviando informacion: [Fila:"+fila+" Elemento:"+elemento+" x:"+x+" y:"+y+" w:"+w+" h:"+h+"]"); return false; } function mouseOut() { sobreElemento = false; var div = document.getElementById('contextMenu'); if(!current && div && div.style.display == 'none') currentxy = currentwh = currentEstilo = null; } function getAtributos(e, dato, atributos) { for(var i=0; i