Skip to content

Commit

Permalink
Multiple pages support for Highligher module
Browse files Browse the repository at this point in the history
git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@3763 af16638f-c34d-0410-8cfa-b39d5352b314
  • Loading branch information
Denis Zgonjanin committed Mar 1, 2010
1 parent a48ca7b commit 8726194
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ TypeError: Error #1034: Type Coercion failed: cannot convert org.bigbluebutton.m
<EventMap xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="http://mate.asfusion.com/">
<mx:Script>
<![CDATA[
import org.bigbluebutton.modules.present.events.PresentationEvent;
import org.bigbluebutton.modules.present.events.NavigationEvent;
import org.bigbluebutton.modules.present.events.AddPresentationToolbarEvent;
import org.bigbluebutton.modules.present.events.WindowResizedEvent;
import org.bigbluebutton.modules.present.events.AddOverlayCanvasEvent;
Expand All @@ -54,4 +56,6 @@ TypeError: Error #1034: Type Coercion failed: cannot convert org.bigbluebutton.m
<Listener type="{UserStatusEvent}" />
<Listener type="{MadePresenterEvent}" />
<Listener type="{AddPresentationToolbarEvent}" />
<Listener type="{NavigationEvent}" />
<Listener type="{PresentationEvent}" />
</EventMap>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.bigbluebutton.modules.highlighter.events
{
import flash.events.Event;

import mx.collections.ArrayCollection;

public class PageEvent extends Event
{
public static const CHANGE_PAGE:String = "ChangePage";

public var pageNum:Number;
public var shapes:ArrayCollection;

public function PageEvent(type:String)
{
super(type, true, false);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package org.bigbluebutton.modules.highlighter.managers
{
import com.asfusion.mate.events.Dispatcher;

import mx.collections.ArrayCollection;
import mx.controls.Alert;

import org.bigbluebutton.modules.highlighter.events.HighlighterUpdate;
import org.bigbluebutton.modules.highlighter.events.PageEvent;
import org.bigbluebutton.modules.present.events.NavigationEvent;
import org.bigbluebutton.modules.present.events.PresentationEvent;

public class PageManager
{
private var pageNum:int;
private var numberOfSlides:int;
private var pages:ArrayCollection;

private var dispatcher:Dispatcher;

public function PageManager()
{
pageNum = 0;
pages = new ArrayCollection();
dispatcher = new Dispatcher();
}

public function addShapeToPage(e:HighlighterUpdate):void{
(pages.getItemAt(pageNum) as ArrayCollection).addItem(e.data);
}

public function undoShapeFromPage():void{
(pages.getItemAt(pageNum) as ArrayCollection).removeItemAt(pages.length - 1);
}

public function clearPage():void{
var page:ArrayCollection = pages.getItemAt(pageNum) as ArrayCollection;
page = new ArrayCollection();
}

public function changePage(e:NavigationEvent):void{
var event:PageEvent = new PageEvent(PageEvent.CHANGE_PAGE);
event.pageNum = e.pageNumber;
this.pageNum = e.pageNumber;
event.shapes = this.pages.getItemAt(this.pageNum) as ArrayCollection;
dispatcher.dispatchEvent(event);
}

public function createPages(e:PresentationEvent):void{
this.numberOfSlides = e.numberOfSlides;
for (var i:int = 0; i<numberOfSlides; i++){
pages.addItem(new ArrayCollection());
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,33 @@
<EventMap xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="http://mate.asfusion.com/" xmlns:mate="org.bigbluebutton.common.mate.*">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import org.bigbluebutton.modules.present.events.NavigationEvent;
import org.bigbluebutton.modules.highlighter.events.HighlighterUpdate;
import org.bigbluebutton.modules.highlighter.business.DrawProxy;
import org.bigbluebutton.modules.highlighter.events.StartHighligtherModuleEvent;
import mx.events.FlexEvent;
import org.bigbluebutton.modules.highlighter.managers.HighlighterManager;
import org.bigbluebutton.main.events.ModuleStartedEvent;
import org.bigbluebutton.modules.highlighter.events.HighlighterDrawEvent;
import org.bigbluebutton.modules.highlighter.views.HighlighterCanvas;
import org.bigbluebutton.modules.highlighter.managers.PageManager;
import org.bigbluebutton.modules.present.events.PresentationEvent;
]]>
</mx:Script>

<EventHandlers type="{FlexEvent.PREINITIALIZE}">
<ObjectBuilder generator="{HighlighterManager}" cache="global" />
<ObjectBuilder generator="{DrawProxy}" cache="global" />
<ObjectBuilder generator="{PageManager}" cache="global" />
</EventHandlers>

<EventHandlers type="{NavigationEvent.GOTO_PAGE}" >
<MethodInvoker generator="{PageManager}" method="changePage" arguments="{event}" />
</EventHandlers>

<EventHandlers type="{PresentationEvent.PRESENTATION_LOADED}" >
<MethodInvoker generator="{PageManager}" method="createPages" arguments="{event}" />
</EventHandlers>

<EventHandlers type="{StartHighligtherModuleEvent.START_HIGHLIGHTER_MODULE_EVENT}">
Expand All @@ -34,4 +47,16 @@
<EventHandlers type="{HighlighterDrawEvent.UNDO_SHAPE}" >
<MethodInvoker generator="{DrawProxy}" method="undoShape" />
</EventHandlers>

<EventHandlers type="{HighlighterUpdate.BOARD_UPDATED}">
<MethodInvoker generator="{PageManager}" method="addShapeToPage" arguments="{event}" />
</EventHandlers>

<EventHandlers type="{HighlighterUpdate.SHAPE_UNDONE}" >
<MethodInvoker generator="{PageManager}" method="undoShapeFromPage" />
</EventHandlers>

<EventHandlers type="{HighlighterUpdate.BOARD_CLEARED}" >
<MethodInvoker generator="{PageManager}" method="clearPage" />
</EventHandlers>
</EventMap>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
mouseDown="doMouseDown()" mouseMove="doMouseMove()" mouseUp="doMouseUp()" creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import org.bigbluebutton.modules.highlighter.events.PageEvent;
import org.bigbluebutton.modules.present.events.WindowResizedEvent;
import org.bigbluebutton.modules.highlighter.events.HighlighterUpdate;
import org.bigbluebutton.common.mate.SharedObjectEvent;
Expand Down Expand Up @@ -107,13 +109,16 @@
* is executed on all clients, even the one which sent the update request.
*/
public function drawSegment(event:HighlighterUpdate):void{
var draw:DrawObject = event.data;
newShape = shapeFactory.makeShape(draw);
var o:DrawObject = event.data;
draw(o);
}
private function draw(o:DrawObject):void{
newShape = shapeFactory.makeShape(o);
shapeList.push(newShape);
rawChildren.addChild(shapeList[shapeList.length-1]);
segment = new Array();
newShape = new Shape();
}
/**
Expand Down Expand Up @@ -146,7 +151,7 @@
/**
* Clears the entire board
*/
public function clearBoard(event:HighlighterUpdate):void{
public function clearBoard(event:HighlighterUpdate = null):void{
for (var i:Number = 0; i<this.shapeList.length; i++){
if (this.rawChildren.contains(this.shapeList[i])){
this.rawChildren.removeChild(this.shapeList[i]);
Expand Down Expand Up @@ -183,6 +188,16 @@
this.scaleY = this.scaleY * (e.height/e.old_height);
}
private function changePage(e:PageEvent):void{
var page:Number = e.pageNum;
var shapes:ArrayCollection = e.shapes;
clearBoard();
for (var i:int = 0; i<shapes.length; i++){
var o:DrawObject = shapes.getItemAt(i) as DrawObject;
draw(o);
}
}
]]>
</mx:Script>

Expand All @@ -191,4 +206,5 @@
<mate:Listener type="{HighlighterUpdate.BOARD_UPDATED}" method="drawSegment" />
<mate:Listener type="{HighlighterUpdate.SHAPE_UNDONE}" method="undoShape" />
<mate:Listener type="{WindowResizedEvent.PRESENTATION_WINDOW_RESIZED_EVENT}" method="scaleCanvas" />
<mate:Listener type="{PageEvent.CHANGE_PAGE}" method="changePage" />
</mx:Canvas>
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<DockableToolBar xmlns="flexlib.containers.*" xmlns:mx="http://www.adobe.com/2006/mxml" draggable="true">
<DockableToolBar xmlns="flexlib.containers.*" xmlns:mx="http://www.adobe.com/2006/mxml" draggable="true" xmlns:mate="http://mate.asfusion.com/">

<mate:Listener type="{MadePresenterEvent.SWITCH_TO_PRESENTER_MODE}" method="presenterMode" />
<mate:Listener type="{MadePresenterEvent.SWITCH_TO_VIEWER_MODE}" method="viewerMode" />

<mx:Script>
<![CDATA[
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.modules.highlighter.business.shapes.DrawObject;
import org.bigbluebutton.modules.highlighter.events.HighlighterDrawEvent;
import org.bigbluebutton.common.Images;
Expand Down Expand Up @@ -40,6 +45,14 @@
canvas.changeThickness(e);
}
private function presenterMode(e:MadePresenterEvent):void{
this.visible = false;
}
private function viewerMode(e:MadePresenterEvent):void{
this.visible = true;
}
]]>
</mx:Script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,22 @@ package org.bigbluebutton.modules.present.events
public static const PRESENTATION_NOT_LOADED:String = "Presentation Not Loaded";

public var presentationName:String;
public var slides:PresentationSlides;
private var _slides:PresentationSlides;
public var numberOfSlides:int;

public function PresentationEvent(type:String)
{
super(type, true, false);
}

public function set slides(presentSlides:PresentationSlides):void{
this._slides = presentSlides;
this.numberOfSlides = presentSlides.size();
}

public function get slides():PresentationSlides{
return this._slides;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@
if (e.presentationName == currentPresentation) return;
currentPresentation = e.presentationName;
presentationLoaded = true;
slideView.slides = e.slides.slides;
slideView.slides = e.slides.slides;
slideView.visible = true;
if (slideManager != null) slideManager.clear();
Expand Down

0 comments on commit 8726194

Please sign in to comment.