- some refactoring to remove duplicates
git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@3353 af16638f-c34d-0410-8cfa-b39d5352b314
This commit is contained in:
parent
a95500444a
commit
e8043a4f2e
@ -104,6 +104,8 @@
|
|||||||
[Bindable] private var presentationLoaded:Boolean = false;
|
[Bindable] private var presentationLoaded:Boolean = false;
|
||||||
[Bindable] private var currentPresentation:String = ResourceUtil.getInstance().getString('bbb.presentation.title');
|
[Bindable] private var currentPresentation:String = ResourceUtil.getInstance().getString('bbb.presentation.title');
|
||||||
|
|
||||||
|
private var presenterName:String = "";
|
||||||
|
|
||||||
// The following code block is to deal with a bug in FLexLib
|
// The following code block is to deal with a bug in FLexLib
|
||||||
// with MDI windows not responding well to being maximized
|
// with MDI windows not responding well to being maximized
|
||||||
private var savedWindowWidth:Number;
|
private var savedWindowWidth:Number;
|
||||||
@ -271,13 +273,13 @@
|
|||||||
thumbnailWindow.y = this.height - 270;
|
thumbnailWindow.y = this.height - 270;
|
||||||
thumbnailWindow.visible = true;
|
thumbnailWindow.visible = true;
|
||||||
} else if (slideView.slides != null){
|
} else if (slideView.slides != null){
|
||||||
slideNumLbl.text = "" + ResourceUtil.getInstance().getString('bbb.presentation.pages', [(slideView.selectedSlide + 1), slideView.slides.length]);
|
displaySlideNumber(slideView.selectedSlide + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function onSlideHighlighted(e:Event):void{
|
private function onSlideHighlighted(e:Event):void{
|
||||||
if (slideView.visible)
|
if (slideView.visible)
|
||||||
slideNumLbl.text = "" + ResourceUtil.getInstance().getString('bbb.presentation.pages', [(thumbnailWindow.slideNumber + 1), slideView.slides.length]);
|
displaySlideNumber(thumbnailWindow.slideNumber + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -285,12 +287,12 @@
|
|||||||
*/
|
*/
|
||||||
private function hideThumbs():void{
|
private function hideThumbs():void{
|
||||||
if (slideView.slides != null)
|
if (slideView.slides != null)
|
||||||
slideNumLbl.text = "" + ResourceUtil.getInstance().getString('bbb.presentation.pages', [(slideView.selectedSlide + 1), slideView.slides.length]);
|
displaySlideNumber(slideView.selectedSlide + 1);
|
||||||
|
|
||||||
thumbnailWindow.visible = false;
|
thumbnailWindow.visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function showThumbs():void {
|
private function showThumbsXXX():void {
|
||||||
if (isPresenter){
|
if (isPresenter){
|
||||||
//readjust the position of the thumbnails in case the window was resized
|
//readjust the position of the thumbnails in case the window was resized
|
||||||
//Note: this is necessary because the MDIWindow does not let you listen to the resize() event!
|
//Note: this is necessary because the MDIWindow does not let you listen to the resize() event!
|
||||||
@ -300,7 +302,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function onSliderZoom():void {
|
private function onSliderZoom():void {
|
||||||
dispatchResizeEvent((zoomSlider.value/10)*10);
|
var roundOff:int = (zoomSlider.value/10)
|
||||||
|
dispatchResizeEvent(roundOff*10);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function dispatchResizeEvent(newSize:int):void {
|
private function dispatchResizeEvent(newSize:int):void {
|
||||||
@ -323,101 +326,123 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function becomePresenter(e:MadePresenterEvent):void{
|
private function becomePresenter(e:MadePresenterEvent):void{
|
||||||
uploadPres.visible = true;
|
setupPresenter(true, e.presenterName);
|
||||||
this.isPresenter = true;
|
|
||||||
|
|
||||||
if (presentationLoaded) {
|
|
||||||
slideNumLbl.text = ResourceUtil.getInstance().getString('bbb.presentation.pages', [(slideView.selectedSlide + 1), slideView.slides.length]);
|
|
||||||
backButton.visible = true;
|
|
||||||
forwardButton.visible = true;
|
|
||||||
zoomSlider.visible = true;
|
|
||||||
btnResetZoom.visible = true;
|
|
||||||
thumbnailWindow.fisheye.selectedIndex = 0;
|
|
||||||
thumbnailWindow.setDataProvider(slideView.slides);
|
|
||||||
}
|
|
||||||
|
|
||||||
presenterNameLabel.text = ResourceUtil.getInstance().getString('bbb.presentation.clickToUpload');
|
|
||||||
presenterNameLabel.visible = true;
|
|
||||||
thumbnailWindow.visible = true;
|
|
||||||
thumbnailWindow.setFisheyeVisibility(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function becomeViewer(e:MadePresenterEvent):void{
|
private function becomeViewer(e:MadePresenterEvent):void{
|
||||||
this.isPresenter = false;
|
setupPresenter(false, e.presenterName);
|
||||||
uploadPres.visible = false;
|
|
||||||
if (presentationLoaded) {
|
|
||||||
slideNumLbl.text = ResourceUtil.getInstance().getString('bbb.presentation.pages', [(slideView.selectedSlide + 1), slideView.slides.length]);
|
|
||||||
backButton.visible = false;
|
|
||||||
forwardButton.visible = false;
|
|
||||||
zoomSlider.visible = false;
|
|
||||||
btnResetZoom.visible = false;
|
|
||||||
}
|
|
||||||
dispatchEvent(new UploadEvent(UploadEvent.CLOSE_UPLOAD_WINDOW));
|
dispatchEvent(new UploadEvent(UploadEvent.CLOSE_UPLOAD_WINDOW));
|
||||||
|
}
|
||||||
|
|
||||||
|
private function setupPresenter(isPresenter:Boolean, presentersName:String):void {
|
||||||
|
this.isPresenter = isPresenter;
|
||||||
|
uploadPres.visible = isPresenter;
|
||||||
|
|
||||||
presenterNameLabel.visible = true;
|
if (presentationLoaded) {
|
||||||
if (e.presenterName != null) presenterNameLabel.text = ResourceUtil.getInstance().getString('bbb.presentation.presenting', [e.presenterName]);
|
displaySlideNumber(slideView.selectedSlide + 1);
|
||||||
thumbnailWindow.visible = false;
|
displaySlideNavigationControls(isPresenter);
|
||||||
thumbnailWindow.setFisheyeVisibility(false);
|
if (isPresenter) initializeThumbnails();
|
||||||
|
}
|
||||||
|
|
||||||
|
setPresentersName(presentersName);
|
||||||
|
showUploadPresentationLabel(isPresenter);
|
||||||
|
showFisheyeThumbnail(isPresenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function handlePresentationLoadedEvent(e:PresentationEvent):void
|
private function setPresentersName(name:String):void {
|
||||||
{
|
if (name != null) presenterName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function showFisheyeThumbnail(show:Boolean):void {
|
||||||
|
thumbnailWindow.visible = show;
|
||||||
|
thumbnailWindow.setFisheyeVisibility(show);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function handlePresentationLoadedEvent(e:PresentationEvent):void {
|
||||||
if (e.presentationName == currentPresentation) return;
|
if (e.presentationName == currentPresentation) return;
|
||||||
currentPresentation = e.presentationName;
|
currentPresentation = e.presentationName;
|
||||||
|
|
||||||
presentationLoaded = true;
|
presentationLoaded = true;
|
||||||
slideView.slides = e.slides.slides;
|
slideView.slides = e.slides.slides;
|
||||||
slideNumLbl.text = (slideView.selectedSlide + 1) + " of " + slideView.slides.length;
|
|
||||||
slideView.visible = true;
|
slideView.visible = true;
|
||||||
|
|
||||||
if (slideManager != null) slideManager.clear();
|
if (slideManager != null) slideManager.clear();
|
||||||
|
|
||||||
presenterNameLabel.visible = false;
|
showUploadPresentationLabel(false);
|
||||||
presenterNameLabel.text = "";
|
displaySlideNumber(slideView.selectedSlide + 1);
|
||||||
if (isPresenter) {
|
if (isPresenter) {
|
||||||
backButton.visible = true;
|
displaySlideNavigationControls(true);
|
||||||
forwardButton.visible = true;
|
notifyOthersOfSharingPresentation(e.presentationName);
|
||||||
zoomSlider.visible = true;
|
initializeThumbnails();
|
||||||
btnResetZoom.visible = true;
|
|
||||||
var shareEvent:PresenterCommands = new PresenterCommands(PresenterCommands.SHARE_PRESENTATION_COMMAND);
|
|
||||||
shareEvent.presentationName = e.presentationName;
|
|
||||||
shareEvent.share = true;
|
|
||||||
dispatchEvent(shareEvent);
|
|
||||||
|
|
||||||
thumbnailWindow.fisheye.selectedIndex = 0;
|
|
||||||
thumbnailWindow.setDataProvider(slideView.slides);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
dispatchEvent(new SlideEvent(SlideEvent.LOAD_CURRENT_SLIDE));
|
dispatchEvent(new SlideEvent(SlideEvent.LOAD_CURRENT_SLIDE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function initializeThumbnails():void {
|
||||||
|
thumbnailWindow.fisheye.selectedIndex = 0;
|
||||||
|
thumbnailWindow.setDataProvider(slideView.slides);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function displaySlideNavigationControls(show:Boolean):void {
|
||||||
|
backButton.visible = show;
|
||||||
|
forwardButton.visible = show;
|
||||||
|
zoomSlider.visible = show;
|
||||||
|
btnResetZoom.visible = show;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function notifyOthersOfSharingPresentation(presentationName:String):void {
|
||||||
|
var shareEvent:PresenterCommands = new PresenterCommands(PresenterCommands.SHARE_PRESENTATION_COMMAND);
|
||||||
|
shareEvent.presentationName = presentationName;
|
||||||
|
shareEvent.share = true;
|
||||||
|
dispatchEvent(shareEvent);
|
||||||
|
}
|
||||||
|
|
||||||
private function gotoPage(e:NavigationEvent):void{
|
private function gotoPage(e:NavigationEvent):void{
|
||||||
slideView.selectedSlide = e.pageNumber;
|
slideView.selectedSlide = e.pageNumber;
|
||||||
slideNumLbl.text = ResourceUtil.getInstance().getString('bbb.presentation.pages', [(e.pageNumber + 1), slideView.slides.length]);
|
|
||||||
|
if (validPageNumber(e.pageNumber)) {
|
||||||
if (e.pageNumber <= slideView.slides.length-1 && e.pageNumber >= 0)
|
loadSlide(e.pageNumber);
|
||||||
slideManager.load(slideView.slides.getItemAt(e.pageNumber) as Slide);
|
disableSlideNavigationButtons(e.pageNumber);
|
||||||
|
displaySlideNumber(e.pageNumber + 1);
|
||||||
if (e.pageNumber == 0) {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function loadSlide(page:int):void {
|
||||||
|
slideManager.load(slideView.slides.getItemAt(page) as Slide);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function validPageNumber(pageNumber:int):Boolean {
|
||||||
|
return (pageNumber <= slideView.slides.length-1 && pageNumber >= 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
private function disableSlideNavigationButtons(pageNumber:int):void {
|
||||||
|
if (pageNumber == 0) {
|
||||||
backButton.enabled = false;
|
backButton.enabled = false;
|
||||||
} else {
|
} else {
|
||||||
backButton.enabled = true;
|
backButton.enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.pageNumber < slideView.slides.length - 1) {
|
if (pageNumber < slideView.slides.length - 1) {
|
||||||
forwardButton.enabled = true;
|
forwardButton.enabled = true;
|
||||||
} else {
|
} else {
|
||||||
forwardButton.enabled = false;
|
forwardButton.enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function displaySlideNumber(currentSlide:int):void {
|
||||||
|
slideNumLbl.text = ResourceUtil.getInstance().getString('bbb.presentation.pages', [currentSlide, slideView.slides.length]);
|
||||||
|
}
|
||||||
|
|
||||||
private function clearPresentation(e:UploadEvent):void{
|
private function clearPresentation(e:UploadEvent):void{
|
||||||
slideView.visible = false;
|
slideView.visible = false;
|
||||||
slideView.selectedSlide = 0;
|
slideView.selectedSlide = 0;
|
||||||
slideNumLbl.text = "";
|
slideNumLbl.text = "";
|
||||||
presenterNameLabel.text = ResourceUtil.getInstance().getString('bbb.presentation.clickToUpload');
|
showUploadPresentationLabel(false);
|
||||||
presenterNameLabel.visible = false;
|
}
|
||||||
|
|
||||||
|
private function showUploadPresentationLabel(show:Boolean):void {
|
||||||
|
uploadPresentationLabel.text = ResourceUtil.getInstance().getString('bbb.presentation.clickToUpload');
|
||||||
|
uploadPresentationLabel.visible = show;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function enableTextSelection():void{
|
private function enableTextSelection():void{
|
||||||
@ -449,7 +474,7 @@
|
|||||||
<mx:ApplicationControlBar id="presCtrlBar" width="100%" height="{CONTROL_BAR_HEIGHT}">
|
<mx:ApplicationControlBar id="presCtrlBar" width="100%" height="{CONTROL_BAR_HEIGHT}">
|
||||||
<mx:Button id="uploadPres" icon="{uploadIcon}" visible="false" width="20" height="20"
|
<mx:Button id="uploadPres" icon="{uploadIcon}" visible="false" width="20" height="20"
|
||||||
toolTip="{ResourceUtil.getInstance().getString('bbb.presentation.uploadPresBtn')}" click="dispatchEvent(new UploadEvent(UploadEvent.OPEN_UPLOAD_WINDOW))"/>
|
toolTip="{ResourceUtil.getInstance().getString('bbb.presentation.uploadPresBtn')}" click="dispatchEvent(new UploadEvent(UploadEvent.OPEN_UPLOAD_WINDOW))"/>
|
||||||
<mx:Label id="presenterNameLabel" visible="false" text=""/>
|
<mx:Label id="uploadPresentationLabel" visible="false" text=""/>
|
||||||
<mx:Spacer width="10%" id="spacer1"/>
|
<mx:Spacer width="10%" id="spacer1"/>
|
||||||
<mx:Button id="backButton" icon="{backwardIcon}" visible="false" width="30" height="20"
|
<mx:Button id="backButton" icon="{backwardIcon}" visible="false" width="30" height="20"
|
||||||
toolTip="Previous slide." click="gotoPreviousSlide()"/>
|
toolTip="Previous slide." click="gotoPreviousSlide()"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user