12) h-=12;
else if ( h==0 ) h='12';
this.setText( h + ap );
]]>
//Debug.write("ONINIT: this =" + this);
this.mdel = new LzDelegate(this,"trackmouse");
this.clipdel = new LzDelegate(this,"checkClip");
this.hidedel = new LzDelegate(this,"checkHide");
this.startDragDel = new LzDelegate(this,"startDrag");
//debug.write("event selector.oninit");
bar.setVisible(false);
bar.followstate.remove();
this.followview = null;
this.clipdel.unregisterAll();
this.hidedel.unregisterAll();
this.setAttribute( "freedragging" , true );
infopanel.unselectEvent();
//debug.write("selectData: "+e);
//debug.write ("selectData Deselecting: "+
//currenteventDP.serialize());
currenteventDP.setNodeAttribute( "selected" , false );
e.datapath.setNodeAttribute( "selected" , true );
// transform the color of the selector bar to match the event
var cat = currenteventDP.xpathQuery('category[1]/@value');
if (cat==undefined || cat=="")
var transColor = {ra:80, ga:80, ba:80};
else{
var catColor = category_colors[cat];
var trans = gColorTable[catColor].trans;
var transColor = { ra: trans.ra, ga: trans.ga, ba: trans.ba };
}
bar.gripper.top.setColorTransform(transColor);
bar.gripper.bottom.setColorTransform(transColor);
bar.gripper.button.bkgnd.setColorTransform(transColor);
//debug.write("eventselector doubleclick");
infopanel.open();
// OLD cal_interior.showInfo(smallevent.event);
//called by day (d);
var h = d.calcHourFromY( bar.getAttributeRelative( 'y' , d) );
var newh = Math.floor( h );
//round to nearest 15 min
var newm = Math.floor( ( h - newh ) * 4 ) * 15;
eventDataMgr.changeEventTime( newh , newm );
//called by day (d);
if ( !this.freedragging ) return;
bar.setWidth( d.eventwidth );
if ( xoff > bar.width ){
//move it over so that you're still dragging it in a
//sensible spot
this.xoff = bar.width-10;
}
-snapEdge ) {
var ybar = bar.getAttributeRelative( 'y' ,
followview.parent ) +
( this.getMouse('y') - yoff - bar.y );
//Debug.write( ybar + " d " +
//( this.getMouse('y') - yoff - bar.y ) );
//Debug.write( this.getMouse('y') + " m " + bar.y + " o " + yoff );
var h = followview.classroot.details.bgrect.height -
bar.height;
if ( ybar > -snapEdge && ybar < h+snapEdge ){
//we're within tolerance
needset = false;
if ( this.freedragging ) {
this.setAttribute( "freedragging" , false );
//this needs to happen second, after the
//clipping view changes coordinates
bar.setX( this.origx );
//need to reset y in new coordinate system
}
if ( ybar <= 0 ){
followview.classroot.details.bgrect.scrollview.sb.step(-1);
bar.setY( 0 );
} else if ( ybar > h ){
followview.classroot.details.bgrect.scrollview.sb.step(1);
bar.setY( h );
} else {
bar.setY( this.getMouse( 'y' ) - yoff );
}
var newStartHour = Math.floor (
followview.classroot.calcHourFromY(
bar.getAttributeRelative( 'y' ,
followview.classroot)) );
// Format output
var ap='a';
if (newStartHour > 11) ap='p';
if (newStartHour > 12) newStartHour-=12;
if (newStartHour == 0) newStartHour='12';
bar.timeArea.setText(newStartHour+ap);
}
}
}
if ( needset && !this.freedragging ){
this.setAttribute( "freedragging" , true );
}
if ( this.freedragging ){
bar.setX( this.getMouse( 'x' ) - xoff );
bar.setY( this.getMouse( 'y' ) - yoff );
}
]]>
this.mouseisdown = true;
this.bkgnd.button.setResourceNumber( this.downRsrcNumber );
this.i.setX(1);
this.i.setY(1);
this.mouseisdown = false;
if (this.mouseisover) {
this.bkgnd.button.setResourceNumber( this.overRsrcNumber );
} else {
this.bkgnd.button.setResourceNumber( this.normalRsrcNumber );
}
this.i.setX(0);
this.i.setY(0);