| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- //-----------------------------------------------------------------------------
- // Verve
- // Copyright (C) - Violent Tulip
- //-----------------------------------------------------------------------------
- function VEditorScrollControl::onScroll( %this )
- {
- %notifyObj = %this.getObject( 0 );
- if ( %notifyObj.isMethod( "onScroll" ) )
- {
- %notifyObj.onScroll();
- }
- }
- function VerveEditorScrollNotify::onWake( %this )
- {
- VerveEditorScrollNotifyV::onWake( %this );
- VerveEditorScrollNotifyH::onWake( %this );
- }
- function VerveEditorScrollNotify::onScroll( %this )
- {
- %this.onResize();
- }
- function VerveEditorScrollNotify::onResize( %this )
- {
- VerveEditorScrollNotifyV::onResize( %this );
- VerveEditorScrollNotifyH::onResize( %this );
- }
- function VerveEditorScrollNotify::onParentResized( %this )
- {
- %this.schedule( 32, "updateSize" );
- }
- function VerveEditorScrollNotify::updateSize( %this )
- {
- VerveEditorScrollNotifyH::updateSize( %this );
- VerveEditorScrollNotifyV::updateSize( %this );
- }
- //-------------------------------------------------------------------------
- function VerveEditorScrollNotifyV::onWake( %this )
- {
- if ( !isObject( $VerveEditor::ScrollNotifyVSet ) )
- {
- $VerveEditor::ScrollNotifyVSet = new SimSet();
- }
-
- $VerveEditor::ScrollNotifyVSet.add( %this );
- }
- function VerveEditorScrollNotifyV::onScroll( %this )
- {
- %this.onResize();
- }
- function VerveEditorScrollNotifyV::onResize( %this )
- {
- if ( !isObject( $VerveEditor::ScrollNotifyVSet ) )
- {
- // Not Awake Yet!
- return;
- }
-
- %scrollPosition = %this.getParent().getScrollPositionY();
- if ( !%this.SurpressUpdate )
- {
- %refSet = $VerveEditor::ScrollNotifyVSet;
- %refCount = %refSet.getCount();
- for ( %i = 0; %i < %refCount; %i++ )
- {
- %refObject = %refSet.getObject( %i ).getParent();
- %refObject.SurpressUpdate = true;
- %refObject.setScrollPosition( %refObject.getScrollPositionX(), %scrollPosition );
- %refObject.SurpressUpdate = false;
- }
- }
- }
- function VerveEditorScrollNotifyV::onParentResized( %this )
- {
- %this.schedule( 32, "updateSize" );
- }
- function VerveEditorScrollNotifyV::updateSize( %this )
- {
- %minX = getWord( %this.getObject( 0 ).MinExtent, 0 );
- %minY = getWord( %this.getParent().getExtent(), 1 ) - 3;
- %this.MinExtent = %minX SPC %minY;
-
- %newX = getWord( %this.getExtent(), 0 );
- %newY = getWord( VerveEditorTrackStack.getExtent(), 1 );
- %this.setExtent( %newX, %newY );
-
- // The onResize callback isn't called if all we did was move around
- %this.onResize();
- }
- //-------------------------------------------------------------------------
- function VerveEditorScrollNotifyH::onWake( %this )
- {
- if ( !isObject( $VerveEditor::ScrollNotifyHSet ) )
- {
- $VerveEditor::ScrollNotifyHSet = new SimSet();
- }
-
- $VerveEditor::ScrollNotifyHSet.add( %this );
- }
- function VerveEditorScrollNotifyH::onScroll( %this )
- {
- %this.onResize();
- }
- function VerveEditorScrollNotifyH::onResize( %this )
- {
- if ( !isObject( $VerveEditor::ScrollNotifyHSet ) )
- {
- // Not Awake Yet!
- return;
- }
-
- %scrollPosition = %this.getParent().getScrollPositionX();
- if ( !%this.SurpressUpdate )
- {
- %refSet = $VerveEditor::ScrollNotifyHSet;
- %refCount = %refSet.getCount();
- for ( %i = 0; %i < %refCount; %i++ )
- {
- %refObject = %refSet.getObject( %i ).getParent();
- %refObject.SurpressUpdate = true;
- %refObject.setScrollPosition( %scrollPosition, %refObject.getScrollPositionY() );
- %refObject.SurpressUpdate = false;
- }
- }
- }
- function VerveEditorScrollNotifyH::onParentResized( %this )
- {
- %this.schedule( 32, "updateSize" );
- }
- function VerveEditorScrollNotifyH::updateSize( %this )
- {
- %this.MinExtent = %this.getObject( 0 ).MinExtent;
- %this.setExtent( getWord( %this.getParent().getExtent(), 0 ) - 19, getWord( %this.getExtent(), 1 ) );
-
- // The onResize callback isn't called if all we did was move around
- %this.onResize();
- }
|