New iteration of the highlighter module. Now added as an overlay to presentation

git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@3757 af16638f-c34d-0410-8cfa-b39d5352b314
This commit is contained in:
Denis Zgonjanin 2010-02-26 20:02:51 +00:00
parent 88e2c2febc
commit 8b3f934c11
14 changed files with 163 additions and 68 deletions

View File

@ -41,6 +41,7 @@
<module application="src/BigBlueButton.mxml" destPath="DeskShareModule.swf" optimize="true" sourcePath="src/DeskShareModule.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="PhoneModule.swf" optimize="true" sourcePath="src/PhoneModule.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="ViewersModule.swf" optimize="true" sourcePath="src/ViewersModule.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="NotesModule.swf" optimize="true" sourcePath="src/NotesModule.mxml"/>
</modules>
<buildCSSFiles/>
</actionScriptProperties>

View File

@ -25,13 +25,11 @@
<mx:Script>
<![CDATA[
import org.bigbluebutton.modules.highlighter.events.StartHighligtherModuleEvent;
import org.bigbluebutton.main.events.AddHighligtherCanvasEvent;
import com.asfusion.mate.events.Dispatcher;
import org.bigbluebutton.common.messaging.EndpointMessageConstants;
import org.puremvc.as3.multicore.utilities.pipes.interfaces.IPipeMessage;
import org.bigbluebutton.common.messaging.Endpoint;
import mx.controls.Alert;
import org.bigbluebutton.modules.highlighter.views.HighlighterCanvas;
import org.bigbluebutton.common.messaging.Router;
private static const TO_HIGHLIGHTER_MODULE:String = "TO_HIGHLIGHTER_MODULE";
@ -42,7 +40,6 @@
private var _moduleName:String = "Highlighter Module";
private var _attributes:Object;
private var highlighterCanvas:HighlighterCanvas;
private var globalDispatcher:Dispatcher;
private function init():void{

View File

@ -1,38 +0,0 @@
/*
* BigBlueButton - http://www.bigbluebutton.org
*
* Copyright (c) 2008-2009 by respective authors (see below). All rights reserved.
*
* BigBlueButton is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, If not, see <http://www.gnu.org/licenses/>.
*
* $Id: $
*/
package org.bigbluebutton.main.events
{
import flash.events.Event;
import mx.containers.Canvas;
public class AddHighligtherCanvasEvent extends Event
{
public static const ADD_HIGHLIGHTER_CANVAS:String = "addHighlighterCanvas";
public var canvas:Canvas;
public function AddHighligtherCanvasEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = false)
{
super(type, bubbles, cancelable);
}
}
}

View File

@ -33,9 +33,11 @@ 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.AddPresentationToolbarEvent;
import org.bigbluebutton.modules.present.events.WindowResizedEvent;
import org.bigbluebutton.modules.present.events.AddOverlayCanvasEvent;
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.modules.viewers.events.UserStatusEvent;
import org.bigbluebutton.main.events.AddHighligtherCanvasEvent;
import org.bigbluebutton.modules.viewers.view.events.StreamStartedEvent;
import org.bigbluebutton.modules.videoconf.events.BroadcastStoppedEvent;
import org.bigbluebutton.modules.videoconf.events.BroadcastStartedEvent;
@ -47,7 +49,9 @@ TypeError: Error #1034: Type Coercion failed: cannot convert org.bigbluebutton.m
<Listener type="{BroadcastStartedEvent.BROADCAST_STARTED_EVENT}" />
<Listener type="{BroadcastStoppedEvent.BROADCAST_STOPPED}" />
<Listener type="{StreamStartedEvent.STREAM_STARTED}" />
<Listener type="{AddHighligtherCanvasEvent.ADD_HIGHLIGHTER_CANVAS}" />
<Listener type="{AddOverlayCanvasEvent}" />
<Listener type="{WindowResizedEvent}" />
<Listener type="{UserStatusEvent}" />
<Listener type="{MadePresenterEvent}" />
<Listener type="{AddPresentationToolbarEvent}" />
</EventMap>

View File

@ -30,7 +30,6 @@
<mate:Listener type="{OpenWindowEvent.OPEN_WINDOW_EVENT}" method="handleOpenWindowEvent" />
<mate:Listener type="{CloseWindowEvent.CLOSE_WINDOW_EVENT}" method="handleCloseWindowEvent"/>
<mate:Listener type="{AddHighligtherCanvasEvent.ADD_HIGHLIGHTER_CANVAS}" method="handleAddHighlighter" />
<mate:Listener type="{JoinFailedEvent.JOIN_FAILED_EVENT}" method="handleJoinFailedEvent" />
<maps:CrossModuleEventMap />
@ -41,7 +40,6 @@
import org.bigbluebutton.common.Images;
import org.bigbluebutton.modules.viewers.events.JoinFailedEvent;
import com.asfusion.mate.events.Dispatcher;
import org.bigbluebutton.main.events.AddHighligtherCanvasEvent;
import org.bigbluebutton.main.events.OpenWindowEvent;
import org.bigbluebutton.main.events.CloseWindowEvent;
import org.bigbluebutton.common.IBbbModuleWindow;
@ -171,10 +169,6 @@
t.y = point1.y + 25;
}
private function handleAddHighlighter(event:AddHighligtherCanvasEvent):void {
trace("GOT HIGHLIGHTER EVENT");
}
private function resetLayout():void{
var windows:Array = mdiCanvas.windowManager.getOpenWindowList();
for (var i:Number=0; i<windows.length; i++){

View File

@ -2,30 +2,50 @@ package org.bigbluebutton.modules.highlighter.managers
{
import com.asfusion.mate.events.Dispatcher;
import org.bigbluebutton.common.IBbbModuleWindow;
import org.bigbluebutton.main.events.OpenWindowEvent;
import org.bigbluebutton.modules.highlighter.views.HighlighterWindow;
import flash.events.TimerEvent;
import flash.utils.Timer;
import org.bigbluebutton.modules.highlighter.views.HighlighterCanvas;
import org.bigbluebutton.modules.highlighter.views.HighlighterToolbar;
import org.bigbluebutton.modules.present.events.AddOverlayCanvasEvent;
import org.bigbluebutton.modules.present.events.AddPresentationToolbarEvent;
public class HighlighterManager
{
private var globalDispatcher:Dispatcher;
private var highlighterWindow:HighlighterWindow;
//private var highlighterWindow:HighlighterWindow;
private var highlighterCanvas:HighlighterCanvas;
private var highlighterToolbar:HighlighterToolbar;
public function HighlighterManager()
{
globalDispatcher = new Dispatcher();
}
public function handleStartModuleEvent():void{
if (highlighterWindow != null) return;
highlighterWindow = new HighlighterWindow();
openWindow(highlighterWindow);
public function handleStartModuleEvent():void{
if (highlighterCanvas != null) return;
highlighterCanvas = new HighlighterCanvas();
if (highlighterToolbar != null) return;
highlighterToolbar = new HighlighterToolbar();
highlighterToolbar.canvas = highlighterCanvas;
//Necessary now because of module loading race conditions
var t:Timer = new Timer(2000, 1);
t.addEventListener(TimerEvent.TIMER, addHighlighterCanvas);
t.addEventListener(TimerEvent.TIMER, addHighlighterToolbar);
t.start();
}
private function openWindow(window:IBbbModuleWindow):void{
var event:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT);
event.window = window;
globalDispatcher.dispatchEvent(event);
private function addHighlighterCanvas(e:TimerEvent):void{
var overlayEvent:AddOverlayCanvasEvent = new AddOverlayCanvasEvent(AddOverlayCanvasEvent.ADD_OVERLAY_CANVAS);
overlayEvent.canvas = highlighterCanvas;
globalDispatcher.dispatchEvent(overlayEvent);
}
private function addHighlighterToolbar(e:TimerEvent):void{
var toolbarEvent:AddPresentationToolbarEvent = new AddPresentationToolbarEvent(AddPresentationToolbarEvent.ADD_TOOLBAR);
toolbarEvent.toolbar = highlighterToolbar;
globalDispatcher.dispatchEvent(toolbarEvent);
}
}

View File

@ -7,10 +7,8 @@
import mx.events.FlexEvent;
import org.bigbluebutton.modules.highlighter.managers.HighlighterManager;
import org.bigbluebutton.main.events.ModuleStartedEvent;
import org.bigbluebutton.main.events.AddHighligtherCanvasEvent;
import org.bigbluebutton.modules.highlighter.events.HighlighterDrawEvent;
import org.bigbluebutton.modules.highlighter.views.HighlighterCanvas;
import org.bigbluebutton.main.events.AddHighligtherCanvasEvent;
]]>
</mx:Script>

View File

@ -3,10 +3,10 @@
mouseDown="doMouseDown()" mouseMove="doMouseMove()" mouseUp="doMouseUp()" creationComplete="init()">
<mx:Script>
<![CDATA[
import org.bigbluebutton.modules.present.events.WindowResizedEvent;
import org.bigbluebutton.modules.highlighter.events.HighlighterUpdate;
import org.bigbluebutton.common.mate.SharedObjectEvent;
import org.bigbluebutton.modules.highlighter.maps.HighlighterEventMap;
import mx.controls.Alert;
import org.bigbluebutton.modules.highlighter.events.HighlighterDrawEvent;
import mx.core.Application;
import org.bigbluebutton.modules.highlighter.business.shapes.ShapeFactory;
@ -38,6 +38,7 @@
private function init():void{
drawFactory = new DrawObjectFactory();
shapeFactory = new ShapeFactory();
this.label = "Highlighter";
}
/**
@ -177,6 +178,11 @@
_yPosition = y;
}
private function scaleCanvas(e:WindowResizedEvent):void{
this.scaleX = this.scaleX * (e.width/e.old_width);
this.scaleY = this.scaleY * (e.height/e.old_height);
}
]]>
</mx:Script>
@ -184,4 +190,5 @@
<mate:Listener type="{HighlighterUpdate.BOARD_CLEARED}" method="clearBoard" />
<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" />
</mx:Canvas>

View File

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<DockableToolBar xmlns="flexlib.containers.*" xmlns:mx="http://www.adobe.com/2006/mxml" draggable="true">
<mx:Script>
<![CDATA[
import org.bigbluebutton.modules.highlighter.business.shapes.DrawObject;
import org.bigbluebutton.modules.highlighter.events.HighlighterDrawEvent;
import org.bigbluebutton.common.Images;
private var images:Images = new Images();
[Bindable] private var pencil_icon:Class = images.pencil_icon;
[Bindable] private var undo_icon:Class = images.undo_icon;
[Bindable] private var delete_icon:Class = images.delete_icon;
public var canvas:HighlighterCanvas;
/**
* Sets the type of shape we're drawing (pencil, rectangle, etc...)
* @param s The type
*
*/
protected function setShape(s:String):void{
canvas.setShape(s);
}
/**
* Sets the color
* @param e event containing the color (e.target.selectedColor)
*
*/
protected function changeColor(e:Event):void{
canvas.changeColor(e);
}
/**
* Sets the thickness
* @param e event containing the thickness (e.target.value)
*
*/
protected function changeThickness(e:Event):void{
canvas.changeThickness(e);
}
]]>
</mx:Script>
<mx:Button width="20" height="20" id="btnPenc" click="setShape(DrawObject.PENCIL)" icon="{pencil_icon}" />
<mx:Button width="20" height="20" id="btnClear" click="dispatchEvent(new HighlighterDrawEvent(HighlighterDrawEvent.CLEAR_BOARD))" icon="{delete_icon}" />
<mx:Button width="20" height="20" id="btnUndo" click="dispatchEvent(new HighlighterDrawEvent(HighlighterDrawEvent.UNDO_SHAPE))" icon="{undo_icon}" />
<mx:ColorPicker change="changeColor(event)" id="cpik"/>
<mx:HSlider width="50" id="sld" change="changeThickness(event)"/>
</DockableToolBar>

View File

@ -0,0 +1,19 @@
package org.bigbluebutton.modules.present.events
{
import flash.events.Event;
import mx.containers.Canvas;
public class AddOverlayCanvasEvent extends Event
{
public static const ADD_OVERLAY_CANVAS:String = "ADD_OVERLAY_CANVAS";
public var canvas:Canvas;
public function AddOverlayCanvasEvent(type:String)
{
super(type, true, false);
}
}
}

View File

@ -0,0 +1,19 @@
package org.bigbluebutton.modules.present.events
{
import flash.events.Event;
import flexlib.containers.DockableToolBar;
public class AddPresentationToolbarEvent extends Event
{
public static const ADD_TOOLBAR:String = "ADD_TOOLBAR";
public var toolbar:DockableToolBar;
public function AddPresentationToolbarEvent(type:String)
{
super(type, true, false);
}
}
}

View File

@ -8,6 +8,9 @@ package org.bigbluebutton.modules.present.events
public var width:int = 450;
public var height:int = 450;
public var old_width:int = 450;
public var old_height:int = 450;
public function WindowResizedEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=true)
{
super(type, bubbles, cancelable);

View File

@ -34,7 +34,7 @@
rollOut="hideThumbs()" xmlns:mate="http://mate.asfusion.com/"
width="{DEFAULT_WINDOW_WIDTH}" height="{DEFAULT_WINDOW_HEIGHT}"
x="{DEFAULT_X_POSITION}" y="{DEFAULT_Y_POSITION}"
title="{currentPresentation}" keyUp="onKeyUp(event)">
title="{currentPresentation}" keyUp="onKeyUp(event)" xmlns:code="http://code.google.com/p/flexlib/">
<mate:Dispatcher id="globalDispatcher" />
<mate:Listener type="{MadePresenterEvent.SWITCH_TO_PRESENTER_MODE}" method="becomePresenter" />
@ -44,9 +44,15 @@
<mate:Listener type="{UploadEvent.CLEAR_PRESENTATION}" method="clearPresentation" />
<mate:Listener type="{SlideResizedEvent.SLIDE_RESIZED_EVENT}" method="handleSlideResizedEvent" />
<mate:Listener type="{DisplaySlideEvent.DISPLAY_SLIDE_EVENT}" method="handleDisplaySlideEvent" />
<mate:Listener type="{AddOverlayCanvasEvent.ADD_OVERLAY_CANVAS}" method="addOverlayCanvas" />
<mate:Listener type="{AddPresentationToolbarEvent.ADD_TOOLBAR}" method="addToolbar" />
<mx:Script>
<![CDATA[
import flexlib.containers.DockableToolBar;
import org.bigbluebutton.modules.present.events.AddPresentationToolbarEvent;
import mx.controls.Alert;
import org.bigbluebutton.modules.present.events.AddOverlayCanvasEvent;
import org.bigbluebutton.modules.present.events.SlideResizedEvent;
import org.bigbluebutton.modules.present.events.WindowResizedEvent;
import org.bigbluebutton.modules.present.events.DisplaySlideEvent;
@ -225,6 +231,8 @@
var dispEvent:WindowResizedEvent = new WindowResizedEvent(WindowResizedEvent.PRESENTATION_WINDOW_RESIZED_EVENT);
dispEvent.width = slideWidth;
dispEvent.height = slideHeight;
dispEvent.old_width = this.slideView.slideCanvas.width;
dispEvent.old_height = this.slideView.slideCanvas.height;
dispatcher.dispatchEvent(dispEvent);
}
@ -495,6 +503,18 @@
return val;
}
private function addOverlayCanvas(e:AddOverlayCanvasEvent):void{
var canvas:Canvas = e.canvas;
this.mainCanvas.addChild(canvas);
canvas.x = 0;
canvas.y = 0;
}
private function addToolbar(e:AddPresentationToolbarEvent):void{
var toolbar:DockableToolBar = e.toolbar;
this.toolbarDocker.addChild(toolbar);
}
]]>
</mx:Script>
@ -534,6 +554,7 @@
useHandCursor="true" snapInterval="5" allowTrackClick="true" liveDragging="true"
dataTipFormatFunction="removeDecimalFromDataTip" change="onSliderZoom()" width="100"/>
<mx:Spacer width="50%" id="spacer3"/>
<code:Docker id="toolbarDocker" height="100%" width="200" />
<mx:Button id="btnResetZoom" icon="{magnifierIcon}" visible="false" width="20" height="20"
toolTip="Reset Zoom" click="onResetZoom()"/>
<mx:Spacer width="5" id="spacer4"/>

View File

@ -43,7 +43,6 @@
<![CDATA[
import org.bigbluebutton.modules.present.events.UploadEvent;
import org.bigbluebutton.modules.present.events.SlideResizedEvent;
import mx.controls.Alert;
import org.bigbluebutton.modules.present.events.DisplaySlideEvent;
import com.asfusion.mate.events.Dispatcher;
import org.bigbluebutton.modules.present.events.CursorEvent;
@ -96,6 +95,8 @@
[Bindable] public var slides:ArrayCollection;
[Bindable] public var selectedSlide:int=0;
[Bindable] private var isPresenter:Boolean = false;
private var dispatcher:Dispatcher = new Dispatcher();
private function onCreationComplete():void{
swfSlideLoader.width = canvasWidth();
@ -275,7 +276,6 @@
private function notifyListenersOfSlideResize(percent:Number):void {
var event:SlideResizedEvent = new SlideResizedEvent();
event.percent = percent;
var dispatcher:Dispatcher = new Dispatcher();
dispatcher.dispatchEvent(event);
}
@ -407,7 +407,6 @@
}
private function dispatchNewSlideDisplayedEvent(slideRealWidth:int, slideRealHeight:int):void {
var dispatcher:Dispatcher = new Dispatcher();
var dispEvent:DisplaySlideEvent = new DisplaySlideEvent(DisplaySlideEvent.DISPLAY_SLIDE_EVENT);
dispEvent.slideWidth = slideRealWidth;
dispEvent.slideHeight = slideRealHeight;