Merge remote branch 'ajay/bbb-whiteboard-additions' into merge-whiteboard-features

Conflicts:
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/whiteboard/AddShapeWhiteboardRecordEvent.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/recorder/whiteboard/WhiteboardEventRecorder.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/IWhiteboardRoomListener.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/Page.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/ShapeGraphic.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardApplication.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardRoom.java
	bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/whiteboard/WhiteboardService.java
	bigbluebutton-client/locale/en_US/bbbResources.properties
	bigbluebutton-client/src/org/bigbluebutton/common/Images.as
	bigbluebutton-client/src/org/bigbluebutton/common/assets/images/text_icon.png
	bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml
	bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/WhiteboardCanvasModel.as
	bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/DrawProxy.as
	bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/DrawObject.as
	bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/DrawObjectFactory.as
	bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/Ellipse.as
	bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/Pencil.as
	bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/Rectangle.as
	bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/ShapeFactory.as
	bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/managers/PageManager.as
	bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/managers/WhiteboardManager.as
	bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/maps/WhiteboardCanvasEventMap.mxml
	bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardCanvas.mxml
	bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardToolbar.mxml
This commit is contained in:
Richard Alam 2012-07-16 18:08:21 +00:00
commit 5742f2764a
86 changed files with 4508 additions and 328 deletions

3
.gitignore vendored
View File

@ -4,3 +4,6 @@ record-and-playback/playback-web/playback-web-0.1.war
bigbluebutton-client/.actionScriptProperties
bigbluebutton-client/.flexProperties
push_to_git.py
a.txt
lor
bigbluebutton-web/logfile

View File

@ -150,7 +150,7 @@ public String getJoinMeetingURL(String username, String meetingID, String passwo
//
// Note this meeting will use username for meetingID
public String getJoinURL(String username, String meetingID, String record, String welcome, Map<String, String> metadata, String xml) {
public String getJoinURL(String username, String meetingID, String record, String welcome, Map<String, String> metadata, String xml, String pw) {
String base_url_create = BigBlueButtonURL + "api/create?";
String base_url_join = BigBlueButtonURL + "api/join?";
@ -260,7 +260,7 @@ public String getJoinURLXML(String username, String meetingID, String welcome, S
.trim().equals("SUCCESS")) {
String join_parameters = "meetingID=" + urlEncode(meetingID)
+ "&fullName=" + urlEncode(username) + "&password=mp";
+ "&fullName=" + urlEncode(username) + "&password=" + pw;
return base_url_join + join_parameters + "&checksum="
+ checksum("join" + join_parameters + salt);

View File

@ -86,7 +86,17 @@ if (request.getParameterMap().isEmpty()) {
String url = BigBlueButtonURL.replace("bigbluebutton/","demo/");
// String preUploadPDF = "<?xml version='1.0' encoding='UTF-8'?><modules><module name='presentation'><document url='"+url+"pdfs/sample.pdf'/></module></modules>";
String joinURL = getJoinURL(request.getParameter("username"), "Demo Meeting", "false", null, null, null);
java.util.Random testIDGen = new java.util.Random();
int userID = testIDGen.nextInt(99999);
String username = request.getParameter("username");
String joinURL = null;
if(!username.startsWith("viewer"))
joinURL = getJoinURL(request.getParameter("username"), "Demo Meeting", "false", null, null, null, "mp");
else
joinURL = getJoinURL(request.getParameter("username"), "Demo Meeting", "false", null, null, null, "ap");
if (joinURL.startsWith("http://")) {
%>

View File

@ -22,7 +22,7 @@ public class AddShapeWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent
}
}
}
private String pointsToString(ArrayList<Double> points){
String datapoints = "";
for (Double i : points) {
@ -31,4 +31,21 @@ public class AddShapeWhiteboardRecordEvent extends AbstractWhiteboardRecordEvent
// Trim the trailing comma
return datapoints.substring(0, datapoints.length() - 1);
}
public void setFillColor(int fillColor) {
eventMap.put("fillColor", Integer.toString(fillColor));
}
public void setThickness(int thickness) {
eventMap.put("thickness", Integer.toString(thickness));
}
public void setFill(boolean fill) {
eventMap.put("fill", Boolean.toString(fill));
}
public void setTransparent(boolean transparent) {
eventMap.put("transparent", Boolean.toString(transparent));
}
}

View File

@ -0,0 +1,50 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.conference.service.recorder.whiteboard;
public class AddTextWhiteboardRecordEvent extends
AbstractWhiteboardRecordEvent {
public AddTextWhiteboardRecordEvent() {
super();
setEvent("AddTextEvent");
}
public void setDataPoints(String points) {
eventMap.put("dataPoints", points);
}
public void setText(String text) {
eventMap.put("text", text);
}
public void setTextColor(int textColor) {
eventMap.put("textColor", Integer.toString(textColor));
}
public void setBGColor(int bgColor) {
eventMap.put("bgColor", Integer.toString(bgColor));
}
public void setBGColorVisible(boolean bgColorVis) {
eventMap.put("bgColorVisible", Boolean.toString(bgColorVis));
}
}

View File

@ -0,0 +1,53 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.conference.service.recorder.whiteboard;
public class ModifyTextWhiteboardRecordEvent extends
AbstractWhiteboardRecordEvent {
public ModifyTextWhiteboardRecordEvent() {
super();
setEvent("ModifyT=TextEvent");
}
public void setDataPoints(String points) {
eventMap.put("dataPoints", points);
}
public void setText(String text) {
eventMap.put("text", text);
}
public void setTextColor(int textColor) {
eventMap.put("textColor", Integer.toString(textColor));
}
public void setBGColor(int bgColor) {
eventMap.put("bgColor", Integer.toString(bgColor));
}
public void setBGColorVisible(boolean bgColorVis) {
eventMap.put("bgColorVisible", Boolean.toString(bgColorVis));
}
public void setModifyingID(String id) {
eventMap.put("modifiedID", id);
}
}

View File

@ -0,0 +1,34 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.conference.service.recorder.whiteboard;
public class ToggleGridWhiteboardRecordEvent extends
AbstractWhiteboardRecordEvent {
public ToggleGridWhiteboardRecordEvent() {
super();
setEvent("ToggleGridEvent");
}
public void setGridEnabled(boolean enabled) {
eventMap.put("gridEnabled", Boolean.toString(enabled));
}
}

View File

@ -5,7 +5,9 @@ import org.bigbluebutton.conference.service.recorder.RecorderApplication;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
import org.bigbluebutton.conference.service.whiteboard.IWhiteboardRoomListener;
import org.bigbluebutton.conference.service.whiteboard.Presentation;
import org.bigbluebutton.conference.service.whiteboard.Presentation;
import org.bigbluebutton.conference.service.whiteboard.ShapeGraphic;
import org.bigbluebutton.conference.service.whiteboard.TextGraphic;
public class WhiteboardEventRecorder implements IWhiteboardRoomListener{
private static Logger log = Red5LoggerFactory.getLogger( WhiteboardEventRecorder.class, "bigbluebutton" );
@ -24,15 +26,36 @@ public class WhiteboardEventRecorder implements IWhiteboardRoomListener{
}
@Override
public void addAnnotation(Map<String, Object> annotation, Presentation presentation) {
@Override
public void addAnnotation(Map<String, Object> annotation, Presentation presentation) {
AddShapeWhiteboardRecordEvent event = new AddShapeWhiteboardRecordEvent();
event.setMeetingId(session);
event.setTimestamp(System.currentTimeMillis());
event.setPresentation(presentation.getName());
event.setPageNumber(presentation.getActivePage().getPageIndex());
event.setPageNumber(presentation.getActivePage().getPageIndex());
event.addAnnotation(annotation);
// event.setDataPoints(shape.getShape());
// event.setType(shape.getType());
// event.setColor(shape.getColor());
// event.setThickness(shape.getThickness());
// event.setFill(shape.isFill());
// event.setTransparent(shape.isTransparent());
recorder.record(session, event);
}
@Override
public void addText(TextGraphic text, Presentation presentation) {
AddTextWhiteboardRecordEvent event = new AddTextWhiteboardRecordEvent();
event.setMeetingId(session);
event.setTimestamp(System.currentTimeMillis());
event.setPresentation(presentation.getName());
event.setPageNumber(presentation.getActivePage().getPageIndex());
event.setText(text.getText());
event.setTextColor(text.getTextColor());
event.setBGColor(text.getBgColor());
event.setBGColorVisible(text.getBgColorVisible());
event.setDataPoints(text.getLocation());
recorder.record(session, event);
}
@ -48,7 +71,7 @@ public class WhiteboardEventRecorder implements IWhiteboardRoomListener{
}
@Override
public void undoShape(Presentation presentation) {
public void undoWBGraphic(Presentation presentation) {
UndoShapeWhiteboardRecordEvent event = new UndoShapeWhiteboardRecordEvent();
event.setMeetingId(session);
event.setTimestamp(System.currentTimeMillis());
@ -58,4 +81,45 @@ public class WhiteboardEventRecorder implements IWhiteboardRoomListener{
recorder.record(session, event);
}
@Override
public void toggleGrid(boolean enabled, Presentation presentation) {
ToggleGridWhiteboardRecordEvent event = new ToggleGridWhiteboardRecordEvent();
event.setMeetingId(session);
event.setTimestamp(System.currentTimeMillis());
event.setPresentation(presentation.getName());
event.setPageNumber(presentation.getActivePage().getPageIndex());
event.setGridEnabled(enabled);
recorder.record(session, event);
}
@Override
public void modifyText(TextGraphic text, Presentation presentation) {
ModifyTextWhiteboardRecordEvent event = new ModifyTextWhiteboardRecordEvent();
event.setMeetingId(session);
event.setTimestamp(System.currentTimeMillis());
event.setPresentation(presentation.getName());
event.setPageNumber(presentation.getActivePage().getPageIndex());
event.setText(text.getText());
event.setTextColor(text.getTextColor());
event.setBGColor(text.getBgColor());
event.setBGColorVisible(text.getBgColorVisible());
event.setDataPoints(text.getLocation());
event.setModifyingID(text.getID());
recorder.record(session, event);
}
@Override
public void undoShape(Presentation presentation) {
// TODO Auto-generated method stub
}
@Override
public void addShape(ShapeGraphic shape, Presentation presentation) {
// TODO Auto-generated method stub
}
}

View File

@ -4,8 +4,13 @@ import java.util.Map;
public interface IWhiteboardRoomListener {
public String getName();
public void addAnnotation(Map<String, Object> annotation, Presentation presentation);
public void undoShape(Presentation presentation);
public void undoShape(Presentation presentation);
public void addShape(ShapeGraphic shape, Presentation presentation);
public void addText(TextGraphic shape, Presentation presentation);
public void modifyText(TextGraphic shape, Presentation presentation);
public void undoWBGraphic(Presentation presentation);
public void toggleGrid(boolean value, Presentation presentation);
public void clearPage(Presentation presentation);
}

View File

@ -22,25 +22,28 @@
package org.bigbluebutton.conference.service.whiteboard;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.bigbluebutton.conference.service.whiteboard.WBGraphic.Type;
public class Page {
private ArrayList<Map<String, Object>> annotations;
private HashMap<String, WBGraphic> graphicObjs;
private int pageIndex;
private boolean isGrid = false;
public Page(int pageIndex){
annotations = new ArrayList<Map<String, Object>>();
public Page(int pageIndex){
annotations = new ArrayList<Map<String, Object>>();
this.graphicObjs = new HashMap<String, WBGraphic>();
this.setPageIndex(pageIndex);
}
public void addAnnotation(Map<String, Object> annotation) {
annotations.add(annotation);
}
public List<Map<String, Object>> getAnnotations() {
List<Map<String, Object>> a = new ArrayList<Map<String, Object>>();
for (Map<String, Object> v : annotations) {
@ -75,6 +78,82 @@ public class Page {
public int getNumShapesOnPage() {
return annotations.size();
}
public void addShapeGraphic(ShapeGraphic shape){
graphicObjs.put(shape.ID, shape);
System.out.println("Total shape count: " + graphicObjs.size());
}
public void addTextGraphic(TextGraphic text){
graphicObjs.put(text.ID, text);
}
public void modifyShapeGraphic(String key, ShapeGraphic shape){
if(graphicObjs.containsKey(shape))
graphicObjs.put(key, shape);
else System.out.println("ERROR: MODIFYING NON-EXISTENT KEY");
}
public void modifyTextGraphic(String key, TextGraphic text){
if(graphicObjs.containsKey(key))
graphicObjs.put(key, text);
else System.out.println("ERROR: MODIFYING NON-EXISTENT KEY");
}
public List<Object[]> getHistory(){
List<Object[]> graphics = new ArrayList<Object[]>();
for (WBGraphic g: graphicObjs.values()){
graphics.add(g.toObjectArray());
}
Object[] isGridArray = new Object[1];
isGridArray[0] = isGrid;
graphics.add(isGridArray);
System.out.println("There are currently " + graphicObjs.size() + " graphical objects on the current page");
return graphics;
}
public List<Object[]> getWBShapes(){
List<Object[]> shapes = new ArrayList<Object[]>();
for (WBGraphic g: graphicObjs.values()){
if(g.graphicType == Type.SHAPE)
shapes.add(g.toObjectArray());
}
return shapes;
}
public List<Object[]> getWBTexts(){
List<Object[]> texts = new ArrayList<Object[]>();
for (WBGraphic g: graphicObjs.values()){
if(g.graphicType == Type.TEXT)
texts.add(g.toObjectArray());
}
return texts;
}
public Map<String, WBGraphic> getWBGraphicMap(){
return graphicObjs;
}
// public void clear(){
// graphicObjs.clear();
// }
// public void undo(){
// graphicObjs.remove(Integer.toString(graphicObjs.size()-1));
// }
public void toggleGrid() {
System.out.println("Toggling grid mode on page " + pageIndex);
isGrid = !isGrid;
}
public boolean isGrid() {
return isGrid;
}
public int getNumGraphicsOnPage(){
return this.graphicObjs.size();
}
public void setPageIndex(int pageIndex) {
this.pageIndex = pageIndex;
@ -83,4 +162,6 @@ public class Page {
public int getPageIndex() {
return pageIndex;
}
}

View File

@ -24,49 +24,69 @@ package org.bigbluebutton.conference.service.whiteboard;
import org.red5.compatibility.flex.messaging.io.ArrayCollection;
public class Shape {
public class ShapeGraphic extends WBGraphic {
private String type;
private int thickness;
private int color;
private String id;
private String status;
private int fillColor;
private boolean fill;
private boolean transparent;
private double[] shape;
public static final String PENCIL = "pencil";
public static final String RECTANGLE = "rectangle";
public static final String ELLIPSE = "ellipse";
public static final String TEXT = "text";
public static final String ELLIPSE = "ellipse";
public static final String TEXT = "text";
public static final String TRIANGLE = "triangle";
public static final String HIGHLIGHTER = "highlighter";
public static final String ERASER = "eraser";
public static final String LINE = "line";
public Shape(double[] shape, String type, int color, int thickness, String id, String status){
public ShapeGraphic(double[] shape, String type, int color, int thickness, boolean fill, int fillColor, boolean transparent, String id, String status){
super(WBGraphic.Type.SHAPE);
this.shape = shape;
this.type = type;
this.color = color;
this.thickness = thickness;
this.id = id;
this.fill = fill;
this.fillColor = fillColor;
this.transparent = transparent;
this.ID = id;
this.status = status;
}
@Override
public ArrayCollection<Object> toList(){
ArrayCollection<Object> sendableList = new ArrayCollection<Object>();
sendableList.add(graphicType);
sendableList.add(shape);
sendableList.add(type);
sendableList.add(color);
sendableList.add(thickness);
sendableList.add(id);
sendableList.add(fill);
sendableList.add(fillColor);
sendableList.add(transparent);
sendableList.add(ID);
sendableList.add(status);
return sendableList;
}
@Override
public Object[] toObjectArray(){
Object[] objects = new Object[10];
objects[0] = shape;
objects[1] = type;
objects[2] = color;
objects[3] = thickness;
objects[4] = id;
objects[5] = status;
objects[0] = graphicType;
objects[1] = shape;
objects[2] = type;
objects[3] = color;
objects[4] = thickness;
objects[5] = fill;
objects[6] = fillColor;
objects[7] = transparent;
objects[8] = ID;
objects[9] = status;
return objects;
}
@ -87,7 +107,19 @@ public class Shape {
return color;
}
public int getFillColor(){
return fillColor;
}
public int getThickness(){
return thickness;
}
public boolean isTransparent() {
return transparent;
}
public boolean isFill() {
return fill;
}
}

View File

@ -0,0 +1,120 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.conference.service.whiteboard;
import org.red5.compatibility.flex.messaging.io.ArrayCollection;
public class TextGraphic extends WBGraphic {
private String text;
private int textColor;
private int bgColor;
private boolean bgColorVisible;
private int x;
private int y;
private int textSize;
public TextGraphic() {
super(WBGraphic.Type.TEXT);
}
public TextGraphic(String text, int textColor, int bgColor,
boolean bgColorVisible, int x, int y, int textSize, String id, String status) {
super(WBGraphic.Type.TEXT);
this.text = text;
this.textColor = textColor;
this.bgColor = bgColor;
this.bgColorVisible = bgColorVisible;
this.x = x;
this.y = y;
this.textSize = textSize;
this.ID = id;
this.status = status;
}
@Override
public ArrayCollection<Object> toList() {
ArrayCollection<Object> sendableList = new ArrayCollection<Object>();
sendableList.add(graphicType);
sendableList.add(text);
sendableList.add(textColor);
sendableList.add(bgColor);
sendableList.add(bgColorVisible);
sendableList.add(x);
sendableList.add(y);
sendableList.add(textSize);
sendableList.add(ID);
sendableList.add(status);
return sendableList;
}
@Override
public Object[] toObjectArray() {
Object[] objects = new Object[10];
objects[0] = graphicType;
objects[1] = text;
objects[2] = textColor;
objects[3] = bgColor;
objects[4] = bgColorVisible;
objects[5] = x;
objects[6] = y;
objects[7] = textSize;
objects[8] = ID;
objects[9] = status;
return objects;
}
public String getText() {
return text;
}
public int getTextColor() {
return textColor;
}
public int getBgColor() {
return bgColor;
}
public boolean getBgColorVisible() {
return bgColorVisible;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public String getLocation() {
return x + "," + y;
}
public int getTextSize() {
return textSize;
}
public void setTextSize(int textSize) {
this.textSize = textSize;
}
}

View File

@ -0,0 +1,33 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.conference.service.whiteboard;
public class UIDGenerator {
private int count = 0;
/*
* synchronized for safe access by multiple threads. should not degrade performance much because
* this method is called only when new 'objects' on the whiteboard are created/published and not
* while they are being updated and transmitted to other clients
*/
public synchronized int generateUID() {
return count++;
}
}

View File

@ -0,0 +1,57 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.conference.service.whiteboard;
import java.util.ArrayList;
import org.red5.compatibility.flex.messaging.io.ArrayCollection;
public abstract class WBGraphic {
public enum Type {
SHAPE, TEXT
}
protected Type graphicType;
protected String ID;
protected String status;
public WBGraphic(Type type) {
graphicType = type;
}
public Type getGraphicType() {
return graphicType;
}
public boolean equals(Object other) {
return this.ID.equals(((WBGraphic) other).ID);
}
public int hashCode() {
return ID.hashCode();
}
public String getID() {
return ID;
}
public abstract ArrayCollection<Object> toList();
public abstract Object[] toObjectArray();
}

View File

@ -21,9 +21,12 @@
*/
package org.bigbluebutton.conference.service.whiteboard;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map;
import org.bigbluebutton.conference.BigBlueButtonSession;
import org.bigbluebutton.conference.ClientMessage;
import org.bigbluebutton.conference.ConnectionInvokerService;
@ -122,8 +125,69 @@ public class WhiteboardApplication extends MultiThreadedApplicationAdapter imple
ClientMessage m = new ClientMessage(ClientMessage.BROADCAST, getMeetingId(), "WhiteboardClearCommand", message);
connInvokerService.sendMessage(m);
}
public void sendShape(double[] shape, String type, int color, int thickness, boolean fill, int fillColor, boolean transparency, String id, String status){
ShapeGraphic newShape = new ShapeGraphic(shape, type, color, thickness, fill, fillColor, transparency, id, status);
/*
maintains unique-ness. ensures that only
one entry per shape is added. exception is DrawObject.PENCIL,
because it is a collection of "points".
*/
// if(status.equals("DRAW_END")) {
// newShape.ID = Integer.toString(roomManager.getRoom(getLocalScope().getName()).getUniqueWBGraphicIdentifier());
// roomManager.getRoom(getLocalScope().getName()).addShape(newShape);
// }
// ISharedObject drawSO = getSharedObject(getLocalScope(), WHITEBOARD_SHARED_OBJECT);
// List<Object> arguments = newShape.toList();
// drawSO.sendMessage("addSegment", arguments);
}
public void sendText(String text, int textColor, int bgColor, boolean bgColorVisible, int x, int y, int textSize, String id, String status){
TextGraphic newText = new TextGraphic(text, textColor, bgColor, bgColorVisible, x, y, textSize, id, status);
/*
maintains unique-ness. ensures that only
one entry per text is added. all other calls must involve the modification of text,
and so they are handled appropriately
*/
if(status.equals("textCreated")) {
newText.ID = Integer.toString(roomManager.getRoom(getMeetingId()).getUniqueWBGraphicIdentifier());
// roomManager.getRoom(getLocalScope().getName()).addText(newText);
} else {
//// roomManager.getRoom(getLocalScope().getName()).modifyText(newText.ID, newText);
}
// ISharedObject drawSO = getSharedObject(getLocalScope(), WHITEBOARD_SHARED_OBJECT);
List<Object> arguments = newText.toList();
// drawSO.sendMessage("addText", arguments);
}
public int getNumGraphicsOnPage(int pageNum){
Presentation pres = roomManager.getRoom(getMeetingId()).getActivePresentation();
pres.setActivePage(pageNum);
return pres.getActivePage().getNumGraphicsOnPage();
}
public List<Object[]> getHistory(){
List<Object[]> graphicsList = roomManager.getRoom(getMeetingId()).getHistory();
for(Object[] o: graphicsList) {
System.out.println();
for(int i = 0; i < o.length; i++) {
System.out.print(" " + i);
}
}
return graphicsList;
}
// public void clear(){
// roomManager.getRoom(getLocalScope().getName()).clear();
// ISharedObject drawSO = getSharedObject(getLocalScope(), WHITEBOARD_SHARED_OBJECT);
// drawSO.sendMessage("clear", new ArrayList<Object>());
// }
public void undo() {
roomManager.getRoom(getMeetingId()).undo();
@ -132,6 +196,13 @@ public class WhiteboardApplication extends MultiThreadedApplicationAdapter imple
connInvokerService.sendMessage(m);
}
public void toggleGrid(){
// System.out.println("toggling grid mode ");
// roomManager.getRoom(getLocalScope().getName()).toggleGrid();
// ISharedObject drawSO = getSharedObject(getLocalScope(), WHITEBOARD_SHARED_OBJECT);
// drawSO.sendMessage("toggleGridCallback", new ArrayList<Object>());
}
@Override
public boolean appConnect(IConnection conn, Object[] params) {
return true;

View File

@ -33,12 +33,14 @@ public class WhiteboardRoom {
private Presentation activePresentation;
private boolean whiteboardEnabled = false;
private final UIDGenerator uidGen;
private final Map<String, IWhiteboardRoomListener> listeners;
public WhiteboardRoom(String id){
this.id = id;
this.presentations = new ArrayList<Presentation>();
listeners = new ConcurrentHashMap<String, IWhiteboardRoomListener>();
uidGen = new UIDGenerator();
}
public String getId() {
@ -79,7 +81,7 @@ public class WhiteboardRoom {
if (presentations.get(i).getName().equals(name)) exists = true;
}
return exists;
}
}
public void addAnnotation(Map<String, Object> annotation){
activePresentation.getActivePage().addAnnotation(annotation);
@ -88,6 +90,25 @@ public class WhiteboardRoom {
public List<Map<String, Object>> getAnnotations(){
return activePresentation.getActivePage().getAnnotations();
}
public void addShape(ShapeGraphic shape){
activePresentation.getActivePage().addShapeGraphic(shape);
// notifyAddShape(activePresentation, shape);
}
public void addText(TextGraphic text){
activePresentation.getActivePage().addTextGraphic(text);
notifyAddText(activePresentation, text);
}
public void modifyText(String key, TextGraphic text){
activePresentation.getActivePage().modifyTextGraphic(key, text);
notifyModifyText(activePresentation, text);
}
public List<Object[]> getHistory(){
return activePresentation.getActivePage().getHistory();
}
public void clear(){
@ -97,7 +118,12 @@ public class WhiteboardRoom {
public void undo(){
activePresentation.getActivePage().undo();
notifyUndoShape(activePresentation);
notifyUndoWBGraphic(activePresentation);
}
public void toggleGrid(){
activePresentation.getActivePage().toggleGrid();
notifyToggleGrid(activePresentation.getActivePage().isGrid(), activePresentation);
}
public void setWhiteboardEnabled(boolean whiteboardEnabled) {
@ -117,18 +143,44 @@ public class WhiteboardRoom {
public void removeRoomListener(IWhiteboardRoomListener listener) {
listeners.remove(listener);
}
public void notifyAddShape(Presentation presentation, Map<String, Object> annotation){
for (Iterator<IWhiteboardRoomListener> iter = listeners.values().iterator(); iter.hasNext();) {
for (Iterator<IWhiteboardRoomListener> iter = listeners.values().iterator(); iter.hasNext();) {
IWhiteboardRoomListener listener = (IWhiteboardRoomListener) iter.next();
listener.addAnnotation(annotation, presentation);
}
}
public void notifyUndoShape(Presentation presentation){
for (Iterator<IWhiteboardRoomListener> iter = listeners.values().iterator(); iter.hasNext();) {
}
}
public void notifyAddText(Presentation presentation, TextGraphic text){
for (Iterator iter = listeners.values().iterator(); iter.hasNext();) {
IWhiteboardRoomListener listener = (IWhiteboardRoomListener) iter.next();
listener.undoShape(presentation);
listener.addText(text, presentation);
}
}
public void notifyModifyText(Presentation presentation, TextGraphic text){
for (Iterator iter = listeners.values().iterator(); iter.hasNext();) {
IWhiteboardRoomListener listener = (IWhiteboardRoomListener) iter.next();
listener.modifyText(text, presentation);
}
}
public void notifyUndoWBGraphic(Presentation presentation){
for (Iterator iter = listeners.values().iterator(); iter.hasNext();) {
IWhiteboardRoomListener listener = (IWhiteboardRoomListener) iter.next();
listener.undoWBGraphic(presentation);
}
}
public void notifyToggleGrid(boolean enabled, Presentation presentation){
for (Iterator iter = listeners.values().iterator(); iter.hasNext();) {
IWhiteboardRoomListener listener = (IWhiteboardRoomListener) iter.next();
listener.toggleGrid(enabled, presentation);
}
}
@ -139,4 +191,12 @@ public class WhiteboardRoom {
}
}
public Map<String, WBGraphic> getWBGraphicMap(){
return activePresentation.getActivePage().getWBGraphicMap();
}
public int getUniqueWBGraphicIdentifier() {
return uidGen.generateUID();
}
}

View File

@ -22,6 +22,7 @@
package org.bigbluebutton.conference.service.whiteboard;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.api.Red5;
@ -38,8 +39,9 @@ public class WhiteboardService {
this.application = a;
}
public void sendShape(double[] shape, String type, int color, int thickness, String id, String status){
public void sendShape(double[] shape, String type, int color, int thickness, boolean fill, int fillColor, boolean transparency, String id, String status){
log.info("WhiteboardApplication - Sending share");
// application.sendShape(shape, type, color, thickness, id, status);
}
@ -68,14 +70,22 @@ public class WhiteboardService {
// Trim the trailing comma
// log.debug("Data Point = " + datapoints);
return datapoints.substring(0, datapoints.length() - 1);
// application.sendShape(shape, type, color, thickness, fill, fillColor, transparency, id, status);
}
public void sendText(String text, int textColor, int bgColor, boolean bgColorVisible, int x, int y, int textSize, String id, String status){
log.info("WhiteboardApplication - Sending text");
application.sendText(text, textColor, bgColor, bgColorVisible, x, y, textSize, id, status);
}
/**
* Sets the active page
* @param pageNum - the number of the page to set to active
* @return - returns the number of shapes in the history of the requested page. This way the client can perform a simple check of whether
* it should retrieve the page history. This saves some bandwidth for the server.
*/
public void setActivePage(int pageNum){
log.info("WhiteboardApplication - Getting number of shapes for page: " + pageNum);
application.changePage(pageNum);
@ -84,6 +94,26 @@ public class WhiteboardService {
public void requestAnnotationHistory() {
log.info("WhiteboardApplication - requestAnnotationHistory");
application.sendAnnotationHistory(Red5.getConnectionLocal().getClient().getId());
// public int setActivePage(int pageNum){
// log.info("WhiteboardApplication - Getting number of graphics for page: " + pageNum);
// return application.getNumGraphicsOnPage(pageNum);
}
public List<Object[]> getHistory(){
log.info("WhiteboardApplication - Returning graphics");
List<Object[]> history = application.getHistory();
/*System.out.println("Number of shapes: " + shapes.size());
System.out.println("First shape. Num params: " + shapes.get(0).length);
System.out.println("double[] : " + (double[])shapes.get(0)[0]);
System.out.println("type : " + shapes.get(0)[1]);
System.out.println("color : " + shapes.get(0)[2]);
System.out.println("thickness : " + shapes.get(0)[3]);
System.out.println("parentWidth : " + shapes.get(0)[4]);
System.out.println("parentHeight : " + shapes.get(0)[5]);*/
return history;
}
public void clear(){
@ -92,10 +122,15 @@ public class WhiteboardService {
}
public void undo(){
log.info("WhiteboardApplication - Deleting last shape");
log.info("WhiteboardApplication - Deleting last graphic");
application.undo();
}
public void toggleGrid(){
log.info("WhiteboardApplication - Toggling grid mode");
application.toggleGrid();
}
public void setActivePresentation(String name, int numPages){
log.info("WhiteboardApplication - Setting active presentation: " + name);
application.setActivePresentation(name, numPages);

0
bigbluebutton-client/-- Normal file
View File

View File

@ -1,50 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<actionScriptProperties analytics="false" mainApplicationPath="BigBlueButton.mxml" projectUUID="2f78753b-2e4c-41b4-8cf4-eddb768eb4b3" version="6">
<compiler additionalCompilerArguments="-locale=" autoRSLOrdering="false" copyDependentFiles="true" flex3CompatMode="true" flexSDK="Flex 4.5 (build 20967)" fteInMXComponents="false" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin" sourceFolderPath="src" strict="true" targetPlayerVersion="10.3.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<actionScriptProperties analytics="false" mainApplicationPath="BigBlueButton.mxml" projectUUID="2f78753b-2e4c-41b4-8cf4-eddb768eb4b3" version="10">
<compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="true" copyDependentFiles="true" flex3CompatMode="true" flexSDK="Flex 4.5" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="10.3.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true">
<compilerSourcePath/>
<libraryPath defaultLinkType="1">
<libraryPathEntry kind="4" path="">
<modifiedEntries>
<libraryPathEntry index="10" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/advancedgrids.swc" useDefaultLinkType="true">
<crossDomainRsls>
<crossDomainRslEntry autoExtract="true" policyFileUrl="http://fpdownload.adobe.com/pub/swz/crossdomain.xml" rslUrl="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/advancedgrids_4.5.0.20967.swz"/>
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="advancedgrids_4.5.0.20967.swz"/>
</crossDomainRsls>
</libraryPathEntry>
<libraryPathEntry index="6" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/charts.swc" useDefaultLinkType="true">
<crossDomainRsls>
<crossDomainRslEntry autoExtract="true" policyFileUrl="http://fpdownload.adobe.com/pub/swz/crossdomain.xml" rslUrl="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/charts_4.5.0.20967.swz"/>
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="charts_4.5.0.20967.swz"/>
</crossDomainRsls>
</libraryPathEntry>
<libraryPathEntry index="8" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/osmf.swc" useDefaultLinkType="true">
<crossDomainRsls>
<crossDomainRslEntry autoExtract="true" policyFileUrl="http://fpdownload.adobe.com/pub/swz/crossdomain.xml" rslUrl="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/osmf_1.0.0.16316.swz"/>
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="osmf_1.0.0.16316.swz"/>
</crossDomainRsls>
</libraryPathEntry>
<libraryPathEntry index="5" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/rpc.swc" useDefaultLinkType="true">
<crossDomainRsls>
<crossDomainRslEntry autoExtract="true" policyFileUrl="http://fpdownload.adobe.com/pub/swz/crossdomain.xml" rslUrl="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/rpc_4.5.0.20967.swz"/>
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="rpc_4.5.0.20967.swz"/>
</crossDomainRsls>
</libraryPathEntry>
<libraryPathEntry index="7" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/spark_dmv.swc" useDefaultLinkType="true">
<crossDomainRsls>
<crossDomainRslEntry autoExtract="true" policyFileUrl="http://fpdownload.adobe.com/pub/swz/crossdomain.xml" rslUrl="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/spark_dmv_4.5.0.20967.swz"/>
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="spark_dmv_4.5.0.20967.swz"/>
</crossDomainRsls>
</libraryPathEntry>
<libraryPathEntry index="9" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/mx/mx.swc" useDefaultLinkType="true">
<crossDomainRsls>
<crossDomainRslEntry autoExtract="true" policyFileUrl="http://fpdownload.adobe.com/pub/swz/crossdomain.xml" rslUrl="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/mx_4.5.0.20967.swz"/>
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="mx_4.5.0.20967.swz"/>
</crossDomainRsls>
</libraryPathEntry>
</modifiedEntries>
<excludedEntries>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/qtp.swc" useDefaultLinkType="false"/>
<libraryPathEntry index="4" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/sparkskins.swc" useDefaultLinkType="true">
<libraryPathEntry applicationDomain="default" forceLoad="false" index="4" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/sparkskins.swc" useDefaultLinkType="true">
<crossDomainRsls>
<crossDomainRslEntry autoExtract="true" policyFileUrl="http://fpdownload.adobe.com/pub/swz/crossdomain.xml" rslUrl="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/sparkskins_4.5.0.20967.swz"/>
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="sparkskins_4.5.0.20967.swz"/>
@ -52,16 +14,17 @@
</libraryPathEntry>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation.swc" useDefaultLinkType="false"/>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_dmv.swc" useDefaultLinkType="false"/>
<libraryPathEntry index="3" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/spark.swc" useDefaultLinkType="true">
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_agent.swc" useDefaultLinkType="false"/>
<libraryPathEntry applicationDomain="default" forceLoad="false" index="3" kind="3" linkType="4" path="${PROJECT_FRAMEWORKS}/libs/spark.swc" useDefaultLinkType="true">
<crossDomainRsls>
<crossDomainRslEntry autoExtract="true" policyFileUrl="http://fpdownload.adobe.com/pub/swz/crossdomain.xml" rslUrl="http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/spark_4.5.0.20967.swz"/>
<crossDomainRslEntry autoExtract="true" policyFileUrl="" rslUrl="spark_4.5.0.20967.swz"/>
</crossDomainRsls>
</libraryPathEntry>
<libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/automation_agent.swc" useDefaultLinkType="false"/>
</excludedEntries>
</libraryPathEntry>
<libraryPathEntry kind="1" linkType="1" path="libs"/>
<libraryPathEntry kind="3" linkType="2" path="${PROJECT_FRAMEWORKS}/libs/player/10.2/playerglobal.swc" useDefaultLinkType="false"/>
</libraryPath>
<sourceAttachmentPath/>
</compiler>
@ -73,6 +36,7 @@
<application path="BigBlueButtonUnitTests.mxml"/>
<application path="DeskshareStandalone.mxml"/>
<application path="src/TestRunners.mxml"/>
<application path="BigBlueButtonTest.mxml"/>
</applications>
<modules>
<module application="src/BigBlueButton.mxml" destPath="DynamicInfoModule.swf" optimize="true" sourcePath="src/DynamicInfoModule.mxml"/>
@ -89,9 +53,12 @@
<module application="src/BigBlueButton.mxml" destPath="SharedNotesModule.swf" optimize="true" sourcePath="src/SharedNotesModule.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="ClassroomAudioModule.swf" optimize="true" sourcePath="src/ClassroomAudioModule.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="SettingsModule.swf" optimize="true" sourcePath="src/SettingsModule.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="BigBlueButtonTest.swf" optimize="true" sourcePath="src/BigBlueButtonTest.mxml"/>
<module application="src/BigBlueButton.mxml" destPath="VideodockModule.swf" optimize="true" sourcePath="src/VideodockModule.mxml"/>
</modules>
<buildCSSFiles>
<buildCSSFileEntry destPath="bin" sourcePath="src/branding/css/logo_basic.css"/>
<buildCSSFileEntry destPath="bin" sourcePath="src/branding/css/theme.css"/>
</buildCSSFiles>
<flashCatalyst validateFlashCatalystCompatibility="false"/>
</actionScriptProperties>

View File

@ -8,3 +8,6 @@ build/
client
bbbResources.properties.*
asdoc/
html-templateBackup/
.actionScriptProperties.bak
.flexProperties.bak

0
bigbluebutton-client/cd Normal file
View File

View File

@ -132,6 +132,7 @@ bbb.desktopView.actualSize = Display actual size
bbb.toolbar.phone.toolTip = Share My Microphone
bbb.toolbar.deskshare.toolTip = Share My Desktop
bbb.toolbar.video.toolTip = Share My Camera
<<<<<<< HEAD
bbb.layout.addButton.toolTip = Add the custom layout to the list
bbb.layout.combo.toolTip = Change the current layout
bbb.layout.loadButton.toolTip = Load layouts from a file
@ -145,6 +146,9 @@ bbb.layout.save.complete = Layouts were successfully saved
bbb.layout.load.complete = Layouts were successfully loaded
bbb.layout.load.failed = Failed to load the layouts
bbb.highlighter.toolbar.pencil = Highlighter
=======
bbb.highlighter.toolbar.pencil = Pencil
>>>>>>> ajay/bbb-whiteboard-additions
bbb.highlighter.toolbar.ellipse = Circle
bbb.highlighter.toolbar.rectangle = Rectangle
bbb.highlighter.toolbar.clear = Clear Page
@ -179,3 +183,17 @@ bbb.settings.warning.close = Close this Warning
bbb.settings.noissues = No outstanding issues have been detected.
bbb.settings.instructions = Accept the Flash prompt that asks you for camera permissions. If you can see yourself and hear yourself, your browser has been set up correctly. Other potentials issues are shown bellow. Click on each to find a possible solution.
bbb.videodock.title = Video dock
ltbcustom.bbb.highlighter.toolbar.select = Selection Tool
ltbcustom.bbb.highlighter.toolbar.triangle = Triangle
ltbcustom.bbb.highlighter.toolbar.line = Line
ltbcustom.bbb.highlighter.toolbar.text = Text
ltbcustom.bbb.highlighter.toolbar.highlighter = Highlighter
ltbcustom.bbb.highlighter.toolbar.eraser = Eraser
ltbcustom.bbb.highlighter.toolbar.toggleFill = Toggle Filling
ltbcustom.bbb.highlighter.texttoolbar.toggleGrid = Toggle Grid
ltbcustom.bbb.highlighter.toolbar.toggleTransparency = Toggle Transparency
ltbcustom.bbb.highlighter.toolbar.fillColorPicker = Fill Color
ltbcustom.bbb.highlighter.texttoolbar.textColorPicker = Text color
ltbcustom.bbb.highlighter.texttoolbar.backColorPicker = Text background color
ltbcustom.bbb.highlighter.texttoolbar.backColorVisible = Enable background color
ltbcustom.bbb.highlighter.texttoolbar.textSizeMenu = Font size

View File

@ -20,6 +20,8 @@ package org.bigbluebutton.common
{
import flash.display.DisplayObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
/**
* An interface currently used to interface the Whiteboard module with the Presentation module in a decoupled sort of way.
*

View File

@ -182,11 +182,45 @@ package org.bigbluebutton.common
[Embed(source="assets/images/shape_handles.png")]
public var shape_handles:Class;
<<<<<<< HEAD
[Embed(source="assets/images/disk.png")]
public var disk:Class;
[Embed(source="assets/images/folder.png")]
public var folder:Class;
=======
// PLACE CUSTOM IMAGES BELOW
[Embed(source="assets/images/line.png")]
public var line_icon:Class;
[Embed(source="assets/images/text_icon.png")]
public var text_icon:Class;
[Embed(source="assets/images/fill_icon.png")]
public var fill_icon:Class;
[Embed(source="assets/images/transparency_icon.png")]
public var transparency_icon:Class;
[Embed(source="assets/images/eraser.png")]
public var eraser_icon:Class;
[Embed(source="assets/images/highlighter_icon.png")]
public var highlighter_icon:Class;
[Embed(source="assets/images/pointer_icon_small.png")]
public var select_icon:Class;
[Embed(source="assets/images/triangle_icon.png")]
public var triangle_icon:Class;
[Embed(source="assets/images/text_background_icon.png")]
public var toggle_text_background_icon:Class;
[Embed(source="assets/images/grid_icon.png")]
public var grid_icon:Class;
>>>>>>> ajay/bbb-whiteboard-additions
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 637 B

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 336 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 390 B

View File

@ -78,6 +78,7 @@
import org.bigbluebutton.main.events.SuccessfulLoginEvent;
import org.bigbluebutton.main.model.LayoutOptions;
import org.bigbluebutton.main.model.users.events.ConnectionFailedEvent;
<<<<<<< HEAD
import org.bigbluebutton.util.i18n.ResourceUtil;
import org.bigbluebutton.util.logging.Logger;
@ -270,6 +271,200 @@
if (e is ConnectionFailedEvent) logoutWindow.setReason((e as ConnectionFailedEvent).type);
else logoutWindow.setReason("You have logged out of the conference");
=======
import org.bigbluebutton.util.i18n.ResourceUtil;
import org.bigbluebutton.util.logging.Logger;
private var globalDispatcher:Dispatcher;
private var dispState:String; //full-screen?
private var images:Images = new Images();
private var stoppedModules:ArrayCollection;
private var logs:Logger = new Logger();
private var logWindow:LogWindow;
private var logoutWindow:LoggedOutWindow;
private var connectionLostWindow:ConnectionLostWindow;
// LIVE or PLAYBACK
private var _mode:String = 'LIVE';
[Bindable] public var appVersion:String = ' ';
private var localeVersion:String = 'old';
[Bindable] public var numberOfModules:int = 0;
[Bindable] private var fullscreen_icon:Class = images.full_screen;
[Bindable] private var logs_icon:Class = images.table;
[Bindable] private var reset_layout_icon:Class = images.layout;
private var receivedConfigLocaleVer:Boolean = false;
private var receivedResourceLocaleVer:Boolean = false;
public function get mode():String {
return _mode;
}
[Bindable] private var layoutOptions:LayoutOptions;
[Bindable] private var showToolbarOpt:Boolean = true;
public function initOptions(e:Event):void {
LogUtil.debug("**** Init layout options ***");
layoutOptions = new LayoutOptions();
layoutOptions.parseOptions();
showToolbarOpt = layoutOptions.showToolbar;
LogUtil.debug("*** show toolbar = " + layoutOptions.showToolbar);
toolbar.displayToolbar();
}
protected function initializeShell():void {
globalDispatcher = new Dispatcher();
}
protected function initFullScreen():void {
/* Set up full screen handler. */
stage.addEventListener(FullScreenEvent.FULL_SCREEN, fullScreenHandler);
dispState = stage.displayState;
}
private var sendStartModulesEvent:Boolean = true;
private function handleApplicationVersionEvent(event:AppVersionEvent):void {
if (event.configLocaleVersion == true) {
receivedConfigLocaleVer = true;
appVersion = event.appVersion;
localeVersion = event.localeVersion;
LogUtil.debug("Received locale version fron config.xml");
} else {
receivedResourceLocaleVer = true;
LogUtil.debug("Received locale version fron locale file.");
}
if (receivedConfigLocaleVer && receivedResourceLocaleVer) {
LogUtil.debug("Comparing locale versions.");
if (!event.suppressLocaleWarning) checkLocaleVersion(localeVersion);
if (sendStartModulesEvent) {
sendStartModulesEvent = false;
sendStartAllModulesEvent();
}
}
}
public function sendStartAllModulesEvent():void{
LogUtil.debug("Sending start all modules event");
var dispatcher:Dispatcher = new Dispatcher();
dispatcher.dispatchEvent(new ModuleLoadEvent(ModuleLoadEvent.START_ALL_MODULES));
}
private function fullScreenHandler(evt:FullScreenEvent):void {
dispState = stage.displayState + " (fullScreen=" + evt.fullScreen.toString() + ")";
if (evt.fullScreen) {
LogUtil.debug("Switching to full screen");
/* Do something specific here if we switched to full screen mode. */
} else {
LogUtil.debug("Switching to normal screen");
/* Do something specific here if we switched to normal mode. */
}
}
private function openLogWindow():void {
if (logWindow == null){
logWindow = new LogWindow();
logWindow.logs = logs;
}
mdiCanvas.windowManager.add(logWindow);
mdiCanvas.windowManager.absPos(logWindow, 50, 50);
logWindow.width = mdiCanvas.width - 100;
logWindow.height = mdiCanvas.height - 100;
}
private function toggleFullScreen():void{
LogUtil.debug("Toggling fullscreen");
try {
switch (stage.displayState) {
case StageDisplayState.FULL_SCREEN:
LogUtil.debug("full screen mode");
// If already in full screen mode, switch to normal mode.
stage.displayState = StageDisplayState.NORMAL;
break;
default:
LogUtil.debug("Normal screen mode");
// If not in full screen mode, switch to full screen mode.
stage.displayState = StageDisplayState.FULL_SCREEN;
break;
}
} catch (err:SecurityError) {
// ignore
}
}
private function handleOpenWindowEvent(event:OpenWindowEvent):void {
var window:IBbbModuleWindow = event.window;
mdiCanvas.addWindow(window);
}
private function handleCloseWindowEvent(event:CloseWindowEvent):void {
var window:IBbbModuleWindow = event.window;
mdiCanvas.removeWindow(window);
}
private function resetLayout():void{
mdiCanvas.resetWindowLayout();
}
private function addComponentToCanvas(e:AddUIComponentToMainCanvas):void{
mdiCanvas.addChild(e.component);
}
public function checkLocaleVersion(localeVersion:String):void {
Alert.okLabel ="OK";
var version:String = "old-locales";
version = ResourceUtil.getInstance().getString('bbb.mainshell.locale.version');
LogUtil.debug("Locale from config=" + localeVersion + ", from locale file=" + version);
if ((version == "old-locales") || (version == "") || (version == null)) {
wrongLocaleVersion();
} else {
if (version != localeVersion) wrongLocaleVersion();
}
}
private function showMicSettings(event:BBBEvent):void {
var micSettings:MicSettings = MicSettings(PopUpManager.createPopUp(mdiCanvas, MicSettings, true));
var point1:Point = new Point();
// Calculate position of TitleWindow in Application's coordinates.
point1.x = width/2;
point1.y = height/2;
micSettings.x = point1.x - (micSettings.width/2);
micSettings.y = point1.y - (micSettings.height/2);
}
private function wrongLocaleVersion():void {
var localeWindow:OldLocaleWarnWindow = OldLocaleWarnWindow(PopUpManager.createPopUp(mdiCanvas, OldLocaleWarnWindow, false));
var point1:Point = new Point();
// Calculate position of TitleWindow in Application's coordinates.
point1.x = width/2;
point1.y = height/2;
localeWindow.x = point1.x - (localeWindow.width/2);
localeWindow.y = point1.y - (localeWindow.height/2);
}
private function handleLogout(e:ConnectionFailedEvent):void {
if (layoutOptions.showLogoutWindow) {
if (logoutWindow != null) return;
logoutWindow = LoggedOutWindow(PopUpManager.createPopUp( mdiCanvas, LoggedOutWindow, false));
var point1:Point = new Point();
// Calculate position of TitleWindow in Application's coordinates.
point1.x = width/2;
point1.y = height/2;
logoutWindow.x = point1.x - (logoutWindow.width/2);
logoutWindow.y = point1.y - (logoutWindow.height/2);
if (e is ConnectionFailedEvent) logoutWindow.setReason((e as ConnectionFailedEvent).type);
else logoutWindow.setReason("You have logged out of the conference");
>>>>>>> ajay/bbb-whiteboard-additions
mdiCanvas.removeAllWindows();
} else {
mdiCanvas.removeAllWindows();
@ -323,8 +518,13 @@
<views:BrandingLogo x="{this.width - 300}" y="{this.height - 300}" />
</views:MainCanvas>
<<<<<<< HEAD
<mx:ControlBar width="100%" height="24" paddingTop="0">
<mx:Label text="{ResourceUtil.getInstance().getString('bbb.mainshell.copyrightLabel2',[appVersion])}" id="copyrightLabel2"/>
=======
<mx:ControlBar width="100%" height="20" paddingTop="0">
<mx:Label text="{ResourceUtil.getInstance().getString('bbb.mainshell.copyrightLabel2',[appVersion]) + '-- The Learn To Be Foundation'}" id="copyrightLabel2"/>
>>>>>>> ajay/bbb-whiteboard-additions
<mx:Spacer width="20"/>
<mx:Spacer width="100%"/>
<mx:Button width="20" height="20" visible="{layoutOptions.showLogButton}" toolTip="{ResourceUtil.getInstance().getString('bbb.mainshell.logBtn.toolTip')}" id="logBtn" icon="{logs_icon}" click="openLogWindow()" />

View File

@ -148,8 +148,6 @@ package org.bigbluebutton.modules.present.business
private function sendViewerNotify(e:TimerEvent):void{
if (soService == null) return;
soService.gotoSlide(0);
}
/**

View File

@ -29,8 +29,8 @@
xmlns:mate="http://mate.asfusion.com/"
paddingBottom="0" paddingTop="0" paddingLeft="0" paddingRight="0"
showCloseButton="false" layout="absolute"
verticalScrollPolicy="off"
horizontalScrollPolicy="off"
verticalScrollPolicy="on"
horizontalScrollPolicy="on"
showControls="true" resize="maximizeHandler()"
backgroundColor="#efefef"
implements="org.bigbluebutton.common.IBbbModuleWindow"
@ -494,7 +494,8 @@
<mx:Button id="forwardButton" icon="{forwardIcon}" visible="false" width="30" height="20"
toolTip="{ResourceUtil.getInstance().getString('bbb.presentation.forwardBtn.toolTip')}" click="gotoNextSlide()"/>
<mx:Spacer width="10%" id="spacer2"/>
<mx:HSlider id="zoomSlider" visible="false" value="{slideView.zoomPercentage}"
<mx:HSlider id="zoomSlider" visible="false" value="{slideView.zoomPercentage}"
minimum="100" maximum="400" dataTipPlacement="top" labels="['100%','400%']"
useHandCursor="true" snapInterval="5" allowTrackClick="true" liveDragging="true"
dataTipFormatFunction="removeDecimalFromDataTip" change="onSliderZoom()" width="100"/>

View File

@ -104,7 +104,7 @@
cursor = new Shape();
cursor.graphics.lineStyle(6, 0xFF0000, 0.6);
cursor.graphics.drawCircle(0,0,3);
cursor.graphics.drawCircle(0,0,2.5);
this.rawChildren.addChild(cursor);
cursor.visible = false;
@ -200,12 +200,10 @@
*/
private function fitSlideToLoader():void {
if (noSlideContentLoaded()) return;
slideLoader.content.x = slideLoader.x;
slideLoader.content.y = slideLoader.y;
slideLoader.content.width = slideLoader.width;
slideLoader.content.height = slideLoader.height;
moveCanvas(slideLoader.x, slideLoader.y);
zoomCanvas(slideLoader.width, slideLoader.height);
}
@ -219,9 +217,7 @@
} else {
zoomPercentage += ZOOM_STEP;
}
zoomSlide(zoomPercentage, this.mouseX, this.mouseY);
zoomSlide(zoomPercentage, this.mouseX, this.mouseY);
}
public function switchToFitToPage(ftp:Boolean):void {
@ -241,12 +237,10 @@
} else if (zoomPercentage >= SlideViewModel.MAX_ZOOM_PERCENT) {
zoomPercentage = SlideViewModel.MAX_ZOOM_PERCENT
}
slideModel.onZoom(zoomPercentage, mouseX, mouseY);
slideModel.printViewedRegion();
slideModel.displayPresenterView();
fitSlideToLoader();
notifyOthersOfZoomEvent();
}
@ -445,6 +439,7 @@
whiteboardCanvasHolder.height = height;
moveCanvas(slideLoader.x, slideLoader.y);
if (whiteboardCanvas != null) {
//LogUtil.debug("Zooming Canvas " + width + " " + height);
whiteboardCanvas.zoomCanvas(width, height);
}
}

View File

@ -1,7 +1,9 @@
package org.bigbluebutton.modules.whiteboard
{
import flash.display.DisplayObject;
import flash.display.Shape;
import flash.display.Sprite;
<<<<<<< HEAD
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.events.TextEvent;
@ -14,46 +16,97 @@ package org.bigbluebutton.modules.whiteboard
import mx.core.Application;
import mx.core.UIComponent;
import mx.managers.CursorManager;
=======
import flash.events.FocusEvent;
import flash.events.KeyboardEvent;
import flash.events.TextEvent;
import flash.geom.Point;
import flash.text.TextFieldAutoSize;
import flash.ui.Keyboard;
import mx.collections.ArrayCollection;
>>>>>>> ajay/bbb-whiteboard-additions
import org.bigbluebutton.common.IBbbCanvas;
import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.modules.present.events.WindowResizedEvent;
import org.bigbluebutton.modules.whiteboard.WhiteboardCanvasModel;
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawGrid;
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObjectFactory;
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicFactory;
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.ShapeFactory;
<<<<<<< HEAD
import org.bigbluebutton.modules.whiteboard.business.shapes.TextBox;
=======
import org.bigbluebutton.modules.whiteboard.business.shapes.TextFactory;
import org.bigbluebutton.modules.whiteboard.business.shapes.TextObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.WhiteboardConstants;
import org.bigbluebutton.modules.whiteboard.events.GraphicObjectFocusEvent;
>>>>>>> ajay/bbb-whiteboard-additions
import org.bigbluebutton.modules.whiteboard.events.PageEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
import org.bigbluebutton.modules.whiteboard.events.ToggleGridEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardSettingResetEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
import org.bigbluebutton.modules.whiteboard.maps.WhiteboardEventMap;
import org.bigbluebutton.modules.whiteboard.views.WhiteboardCanvas;
public class WhiteboardCanvasModel {
public var wbCanvas:WhiteboardCanvas;
public var isPresenter:Boolean;
private var isDrawing:Boolean;
private var sending:Boolean = false;
private var feedback:Shape = new Shape();
private var latentFeedbacks:Array = new Array();
private var segment:Array = new Array();
private var shapeList:Array = new Array();
private var graphicList:Array = new Array();
private var shapeFactory:ShapeFactory = new ShapeFactory();
private var textFactory:TextFactory = new TextFactory();
private var bbbCanvas:IBbbCanvas;
private var lastGraphicObjectSelected:GraphicObject;
private var shapeStyle:String = DrawObject.PENCIL;
private var graphicType:String = WhiteboardConstants.TYPE_SHAPE;
private var toolType:String = DrawObject.PENCIL;
private var drawColor:uint = 0x000000;
private var fillColor:uint = 0x000000;
private var thickness:uint = 1;
<<<<<<< HEAD
private var _fontStyle:String = "_sans";
private var _fontSize:Number = 18;
private var _textText:String = "Hello BBB!";
=======
private var fillOn:Boolean = false;
private var transparencyOn:Boolean = false;
/* a hack to fix the problem of shapes being cleared on viewers' side when page is changed.
need to find a better way around later.
*/
private var clearOnce:Boolean = true;
/* represents the currently selected TextObject, if any.
'selected' in this context means it is currently being edited, or is the most recent
TextObject to be edited by the presenter
*/
private var currentlySelectedTextObject:TextObject;
/* represents the max number of 'points' enumerated in 'segment'
before sending an update to server. Used to prevent
spamming red5 with unnecessary packets
*/
private var sendShapeFrequency:uint = 30;
/* same as above, except a faster interval may be desirable
when erasing, for aesthetics
*/
private var sendEraserFrequency:uint = 20;
>>>>>>> ajay/bbb-whiteboard-additions
private var drawStatus:String = DrawObject.DRAW_START;
private var textStatus:String = TextObject.TEXT_CREATED;
private var width:Number;
private var height:Number;
<<<<<<< HEAD
public function changeFontStyle(font:String):void {
_fontStyle = font;
@ -72,6 +125,45 @@ package org.bigbluebutton.modules.whiteboard
*/
isDrawing = false;
sendShapeToServer(DrawObject.DRAW_END);
=======
// isGrid represents the state of the current page (grid vs not grid)
private var isGrid:Boolean = true;
// drawGrid is the sprite added to the page when isGrid is true
private var drawGrid:DrawGrid;
public function doMouseUp():void{
if(graphicType == WhiteboardConstants.TYPE_SHAPE) {
if (isDrawing) {
/**
* Check if we are drawing because when resizing the window, it generates
* a mouseUp event at the end of resize. We don't want to dispatch another
* shape to the viewers.
*/
isDrawing = false;
//check to make sure unnecessary data is not sent
// ex. a single click when the rectangle tool is selected
// is hardly classifiable as a rectangle, and should not
// be sent to the server
if(toolType == DrawObject.RECTANGLE ||
toolType == DrawObject.ELLIPSE ||
toolType == DrawObject.TRIANGLE) {
var x:Number = segment[0];
var y:Number = segment[1];
var width:Number = segment[segment.length-2]-x;
var height:Number = segment[segment.length-1]-y;
if(!(Math.abs(width) <= 2 && Math.abs(height) <=2)) {
sendShapeToServer(DrawObject.DRAW_END);
}
} else {
sendShapeToServer(DrawObject.DRAW_END);
}
}
>>>>>>> ajay/bbb-whiteboard-additions
}
}
@ -80,10 +172,9 @@ package org.bigbluebutton.modules.whiteboard
private function sendShapeToServer(status:String):void {
if (segment.length == 0) return;
var dobj:DrawObject = shapeFactory.createDrawObject(this.shapeStyle, segment, this.drawColor, this.thickness);
dobj.id = "" + objCount++;
var dobj:DrawObject = shapeFactory.createDrawObject(this.toolType, segment, this.drawColor, this.thickness,
this.fillOn, this.fillColor, this.transparencyOn);
switch (status) {
case DrawObject.DRAW_START:
dobj.status = DrawObject.DRAW_START;
@ -98,9 +189,14 @@ package org.bigbluebutton.modules.whiteboard
break;
}
<<<<<<< HEAD
// LogUtil.error("SEGMENT LENGTH = [" + segment.length + "] STATUS = [" + dobj.status + "]");
=======
//LogUtil.error("SEGMENT LENGTH = [" + segment.length + "] STATUS = [" + dobj.status + "]");
>>>>>>> ajay/bbb-whiteboard-additions
if (this.shapeStyle == DrawObject.PENCIL) {
if (this.toolType == DrawObject.PENCIL ||
this.toolType == DrawObject.ERASER) {
dobj.status = DrawObject.DRAW_END;
drawStatus = DrawObject.DRAW_START;
segment = new Array();
@ -108,9 +204,10 @@ package org.bigbluebutton.modules.whiteboard
segment.push(xy[0], xy[1]);
}
wbCanvas.sendShapeToServer(dobj);
wbCanvas.sendGraphicToServer(dobj, WhiteboardDrawEvent.SEND_SHAPE);
}
<<<<<<< HEAD
public function doMouseDown(mouseX:Number, mouseY:Number):void {
isDrawing = true;
drawStatus = DrawObject.DRAW_START;
@ -123,6 +220,24 @@ package org.bigbluebutton.modules.whiteboard
wbCanvas.unregisterForMouseEvents();
addTextFieldExample();
}
=======
private function sendTextToServer(status:String, tobj:TextObject):void {
switch (status) {
case TextObject.TEXT_CREATED:
tobj.status = TextObject.TEXT_CREATED;
textStatus = TextObject.TEXT_UPDATED;
break;
case TextObject.TEXT_UPDATED:
tobj.status = TextObject.TEXT_UPDATED;
break;
case TextObject.TEXT_PUBLISHED:
tobj.status = TextObject.TEXT_PUBLISHED;
textStatus = TextObject.TEXT_CREATED;
break;
}
wbCanvas.sendGraphicToServer(tobj, WhiteboardDrawEvent.SEND_TEXT);
>>>>>>> ajay/bbb-whiteboard-additions
}
private var tfe:TextFieldExample;
@ -137,109 +252,576 @@ package org.bigbluebutton.modules.whiteboard
wbCanvas.addRawChild(tfe);
}
<<<<<<< HEAD
public function doMouseMove(mouseX:Number, mouseY:Number):void {
if (isDrawing){
=======
public function doMouseDown(mouseX:Number, mouseY:Number):void{
if(graphicType == WhiteboardConstants.TYPE_SHAPE) {
isDrawing = true;
drawStatus = DrawObject.DRAW_START;
segment = new Array();
>>>>>>> ajay/bbb-whiteboard-additions
segment.push(mouseX);
segment.push(mouseY);
if (segment.length > 30) {
sendShapeToServer(drawStatus);
} else if(graphicType == WhiteboardConstants.TYPE_SELECTION) {
/* The following is some experimental stuff to test out the
to-be selection tool.
*/
var objs:Array = getGraphicObjectsUnderPoint(mouseX, mouseY);
var graphics:Array = filterGraphicObjects(objs)
var topMostObject:GraphicObject = getTopMostObject(graphics) as GraphicObject;
LogUtil.debug("There are " + graphics.length + " objects" +
"under your mouse.");
LogUtil.debug("!!!TOP MOST OBJECT: " + topMostObject.getProperties());
}
}
public function doMouseDoubleClick(mouseX:Number, mouseY:Number):void {
/* creates a new TextObject and sends it to the server to notify all
the clients about it
*/
if(graphicType == WhiteboardConstants.TYPE_TEXT) {
LogUtil.error("double click received at " + mouseX + "," + mouseY);
var tobj:TextObject = new TextObject(
"TEST", 0x000000, 0x000000, false, mouseX, mouseY, 18);
sendTextToServer(TextObject.TEXT_CREATED, tobj);
}
}
public function doMouseMove(mouseX:Number, mouseY:Number):void{
if(graphicType == WhiteboardConstants.TYPE_SHAPE) {
if (isDrawing){
segment.push(mouseX);
segment.push(mouseY);
// added different "send" rates for normal shapes and the eraser
// in case one is preferable to the other
if(toolType == DrawObject.ERASER) {
if (segment.length > sendEraserFrequency) {
sendShapeToServer(drawStatus);
}
} else {
if (segment.length > sendShapeFrequency) {
sendShapeToServer(drawStatus);
}
}
}
}
}
<<<<<<< HEAD
public function drawSegment(event:WhiteboardUpdate):void {
var o:DrawObject = event.data;
draw(o);
=======
public function drawGraphic(event:WhiteboardUpdate):void{
var o:GraphicObject = event.data;
var recvdShapes:Boolean = event.recvdShapes;
if(o.getGraphicType() == WhiteboardConstants.TYPE_SHAPE) {
var dobj:DrawObject = o as DrawObject;
drawShape(dobj, recvdShapes);
} else if(o.getGraphicType() == WhiteboardConstants.TYPE_TEXT) {
var tobj:TextObject = o as TextObject;
drawText(tobj, recvdShapes);
}
>>>>>>> ajay/bbb-whiteboard-additions
}
private function draw(o:DrawObject):void{
LogUtil.debug("Got shape [" + o.getType() + " " + o.status + "]");
// Draws a DrawObject when/if it is received from the server
private function drawShape(o:DrawObject, recvdShapes:Boolean):void {
switch (o.status) {
case DrawObject.DRAW_START:
addNewShape(o);
addNewShape(o);
break;
case DrawObject.DRAW_UPDATE:
case DrawObject.DRAW_END:
if (shapeList.length == 0 || o.getType() == DrawObject.PENCIL) {
if (graphicList.length == 0 ||
o.getType() == DrawObject.PENCIL ||
o.getType() == DrawObject.ERASER ||
recvdShapes) {
addNewShape(o);
} else {
removeLastShape();
removeLastGraphic();
addNewShape(o);
}
break;
}
}
// Draws a TextObject when/if it is received from the server
private function drawText(o:TextObject, recvdShapes:Boolean):void {
if(recvdShapes) {
LogUtil.debug("Got text [" + o.text + " " +
o.status + " " + o.getGraphicID() + "]");
LogUtil.debug(String(o.getProperties()));
}
switch (o.status) {
case TextObject.TEXT_CREATED:
if(isPresenter)
addPresenterText(o);
else
addNormalText(o);
break;
case TextObject.TEXT_UPDATED:
case TextObject.TEXT_PUBLISHED:
if(isPresenter) {
if(recvdShapes) addPresenterText(o);
} else {
if(graphicList.length == 0 || recvdShapes) {
addNormalText(o);
} else modifyText(o);
}
break;
}
}
private function addNewShape(o:DrawObject):void {
<<<<<<< HEAD
LogUtil.debug("Adding new shape");
if (o.getType() == DrawObject.TEXT) return;
=======
//LogUtil.debug("Adding new shape ");
>>>>>>> ajay/bbb-whiteboard-additions
var dobj:DrawObject = shapeFactory.makeShape(o);
wbCanvas.addShape(dobj.getShape());
shapeList.push(dobj);
wbCanvas.addGraphic(dobj);
graphicList.push(dobj);
}
private function calibrateNewTextWith(o:TextObject):TextObject {
var tobj:TextObject = textFactory.makeTextObject(o);
tobj.setGraphicID(o.getGraphicID());
tobj.status = o.status;
tobj.applyTextFormat(tobj.textSize);
return tobj;
}
public function setShape(s:String):void{
this.shapeStyle = s;
/* adds a new TextObject that is suited for a presenter. For example, it will
be made editable and the appropriate listeners will be registered so that
the required events will be dispatched
*/
private function addPresenterText(o:TextObject):void {
if(!isPresenter) return;
var tobj:TextObject = calibrateNewTextWith(o);
tobj.multiline = true;
tobj.wordWrap = true;
tobj.autoSize = TextFieldAutoSize.LEFT;
tobj.makeEditable(true);
tobj.registerListeners(textObjGainedFocusListener,
textObjLostFocusListener,
textObjTextListener,
textObjSpecialListener);
wbCanvas.addGraphic(tobj);
wbCanvas.stage.focus = tobj;
graphicList.push(tobj);
}
/* adds a new TextObject that is suited for a viewer. For example, it will not
be made editable and no listeners need to be attached because the viewers
should not be able to edit/modify the TextObject
*/
private function addNormalText(o:TextObject):void {
if(isPresenter) return;
var tobj:TextObject = calibrateNewTextWith(o);
//LogUtil.debug("TEXT ADDED: " + tobj.getGraphicID());
tobj.multiline = true;
tobj.wordWrap = true;
tobj.autoSize = TextFieldAutoSize.LEFT;
tobj.makeEditable(false);
wbCanvas.addGraphic(tobj);
graphicList.push(tobj);
}
/* method to modify a TextObject that is already present on the whiteboard,
as opposed to adding a new TextObject to the whiteboard
*/
private function modifyText(o:TextObject):void {
var tobj:TextObject = calibrateNewTextWith(o);
var id:String = tobj.getGraphicID();
removeText(id);
LogUtil.debug("Text modified to " + tobj.text);
addNormalText(tobj);
}
/* invoked by the WhiteboardManager that is invoked by the TextToolbar, that
specifies the currently selected TextObject to change its attributes. For example,
when a 'text color' ColorPicker is changed in the TextToolbar, the invocation
eventually reaches this method that causes the currently selected TextObject
to be re-sent to the red5 server with the modified attributes.
*/
public function modifySelectedTextObject(textColor:uint, bgColorVisible:Boolean, backgroundColor:uint, textSize:Number):void {
currentlySelectedTextObject.textColor = textColor;
currentlySelectedTextObject.background = bgColorVisible;
currentlySelectedTextObject.backgroundColor = backgroundColor;
currentlySelectedTextObject.textSize = textSize;
currentlySelectedTextObject.applyTextFormat(currentlySelectedTextObject.textSize);
sendTextToServer(TextObject.TEXT_PUBLISHED, currentlySelectedTextObject);
}
public function setGraphicType(type:String):void{
this.graphicType = type;
}
public function setTool(s:String):void{
this.toolType = s;
}
public function changeColor(color:uint):void{
drawColor = color;
}
public function changeFillColor(color:uint):void{
fillColor = color;
}
public function changeThickness(thickness:uint):void{
this.thickness = thickness;
}
private function removeLastShape():void {
var dobj:DrawObject = shapeList.pop() as DrawObject;
wbCanvas.removeShape(dobj.getShape());
public function toggleFill():void{
fillOn = !fillOn;
}
public function toggleTransparency():void{
transparencyOn = !transparencyOn;
}
/* sets the fill mode boolean to the specified value
Used when one wants to set it to a specific value.
*/
public function setFill(fill:Boolean):void{
this.fillOn = fill;
}
/* sets the transparent mode boolean to the specified value
Used when one wants to set it to a specific value.
*/
public function setTransparent(transp:Boolean):void{
this.transparencyOn = transp;
}
/* the following three methods are used to remove any GraphicObjects (and its
subclasses) if the id of the object to remove is specified. The latter
two are convenience methods, the main one is the first of the three.
*/
private function removeGraphic(id:String):void {
var gobjData:Array = getGobjInfoWithID(id);
var removeIndex:int = gobjData[0];
var gobjToRemove:GraphicObject = gobjData[1] as GraphicObject;
wbCanvas.removeGraphic(gobjToRemove as DisplayObject);
graphicList.splice(removeIndex, 1);
}
public function clearBoard(event:WhiteboardUpdate = null):void{
var numShapes:int = this.shapeList.length;
for (var i:Number = 0; i < numShapes; i++){
removeLastShape();
}
private function removeShape(id:String):void {
var dobjData:Array = getGobjInfoWithID(id);
var removeIndex:int = dobjData[0];
var dobjToRemove:DrawObject = dobjData[1] as DrawObject;
wbCanvas.removeGraphic(dobjToRemove);
graphicList.splice(removeIndex, 1);
}
public function undoShape():void{
if (this.shapeList.length > 0) {
removeLastShape();
}
}
public 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);
}
}
public function zoomCanvas(width:Number, height:Number):void{
shapeFactory.setParentDim(width, height);
this.width = width;
this.height = height;
for (var i:int = 0; i < this.shapeList.length; i++){
redrawShape(this.shapeList[i] as DrawObject);
}
}
private function redrawShape(dobj:DrawObject):void {
wbCanvas.removeShape(dobj.getShape());
shapeFactory.makeShape(dobj);
wbCanvas.addShape(dobj.getShape());
private function removeText(id:String):void {
var tobjData:Array = getGobjInfoWithID(id);
var removeIndex:int = tobjData[0];
var tobjToRemove:TextObject = tobjData[1] as TextObject;
wbCanvas.removeGraphic(tobjToRemove);
graphicList.splice(removeIndex, 1);
}
public function isPageEmpty():Boolean {
return shapeList.length == 0;
/* returns an array of the GraphicObject that has the specified id,
and the index of that GraphicObject (if it exists, of course)
*/
private function getGobjInfoWithID(id:String):Array {
var data:Array = new Array();
for(var i:int = 0; i < graphicList.length; i++) {
var currObj:GraphicObject = graphicList[i] as GraphicObject;
if(currObj.getGraphicID() == id) {
data.push(i);
data.push(currObj);
return data;
}
}
return null;
}
private function removeLastGraphic():void {
var gobj:GraphicObject = graphicList.pop();
if(gobj.getGraphicType() == WhiteboardConstants.TYPE_TEXT) {
(gobj as TextObject).makeEditable(false);
(gobj as TextObject).deregisterListeners(textObjGainedFocusListener,
textObjLostFocusListener,
textObjTextListener,
textObjSpecialListener);
}
wbCanvas.removeGraphic(gobj as DisplayObject);
}
// returns all DrawObjects in graphicList
private function getAllShapes():Array {
var shapes:Array = new Array();
for(var i:int = 0; i < graphicList.length; i++) {
var currGobj:GraphicObject = graphicList[i];
if(currGobj.getGraphicType() == WhiteboardConstants.TYPE_SHAPE) {
shapes.push(currGobj as DrawObject);
}
}
return shapes;
}
// returns all TextObjects in graphicList
private function getAllTexts():Array {
var texts:Array = new Array();
for(var i:int = 0; i < graphicList.length; i++) {
var currGobj:GraphicObject = graphicList[i];
if(currGobj.getGraphicType() == WhiteboardConstants.TYPE_TEXT) {
texts.push(currGobj as TextObject)
}
}
return texts;
}
public function clearBoard(event:WhiteboardUpdate = null):void {
var numGraphics:int = this.graphicList.length;
for (var i:Number = 0; i < numGraphics; i++){
removeLastGraphic();
}
}
public function undoGraphic():void{
if (this.graphicList.length > 0) {
removeLastGraphic();
}
}
public function changePage(e:PageEvent):void{
var page:Number = e.pageNum;
var graphicObjs:ArrayCollection = e.graphicObjs;
this.isGrid = e.isGrid;
LogUtil.debug("CHANGING PAGE");
clearBoard();
for (var i:int = 0; i < graphicObjs.length; i++){
var o:GraphicObject = graphicObjs.getItemAt(i) as GraphicObject;
if(o.getGraphicType() == WhiteboardConstants.TYPE_SHAPE)
drawShape(o as DrawObject, true);
else if(o.getGraphicType() == WhiteboardConstants.TYPE_TEXT)
drawText(o as TextObject, true);
}
if(isPresenter) {
var evt:GraphicObjectFocusEvent =
new GraphicObjectFocusEvent(GraphicObjectFocusEvent.OBJECT_DESELECTED);
evt.data = null;
wbCanvas.dispatchEvent(evt);
}
// if the new page has a grid, draw it
addOrRemoveGrid(this.isGrid);
LogUtil.debug("GRAPHIC LIST SIZE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! " + graphicList.length);
}
public function zoomCanvas(width:Number, height:Number):void{
shapeFactory.setParentDim(width, height);
textFactory.setParentDim(width, height);
this.width = width;
this.height = height;
for (var i:int = 0; i < this.graphicList.length; i++){
redrawGraphic(this.graphicList[i] as GraphicObject, i);
}
// if the grid was drawn, redraw it with the new width and height
if(isGrid) {
addOrRemoveGrid(true, width, height);
}
}
// toggles the gridmode on or off
public function toggleGrid(event:ToggleGridEvent = null):void{
isGrid = !isGrid;
LogUtil.debug("Final gridToggle received " + isGrid + " " + wbCanvas.width + "," + wbCanvas.height);
addOrRemoveGrid(isGrid, wbCanvas.width, wbCanvas.height);
var gridChangedEvent:WhiteboardSettingResetEvent =
new WhiteboardSettingResetEvent(WhiteboardSettingResetEvent.GRID_CHANGED);
gridChangedEvent.value = isGrid;
wbCanvas.dispatchEvent(gridChangedEvent);
}
/* adds or removes the grid based on the the different parameters passed.
Also used to redraw the grid when canvas is zoomed/moved
*/
private function addOrRemoveGrid(grid:Boolean, width:Number = 0, height:Number = 0):void {
if(width == 0) width = wbCanvas.width;
if(height == 0) height = wbCanvas.height;
if(drawGrid == null)
drawGrid = new DrawGrid(width,height,10,10);
if(!wbCanvas.doesContain(drawGrid) && grid) wbCanvas.addGraphic(drawGrid);
LogUtil.debug("Grid added");
if(grid) {
drawGrid.setSize(width, height);
} else {
wbCanvas.removeGraphic(drawGrid);
}
}
/* called when a user is made presenter, automatically make all the textfields
currently on the page editable, so that they can edit it.
*/
public function makeTextObjectsEditable(e:MadePresenterEvent):void {
isPresenter = true;
var texts:Array = getAllTexts();
for(var i:int = 0; i < texts.length; i++) {
(texts[i] as TextObject).makeEditable(true);
(texts[i] as TextObject).registerListeners(textObjGainedFocusListener,
textObjLostFocusListener,
textObjTextListener,
textObjSpecialListener);
}
}
/* when a user is made viewer, automatically make all the textfields
currently on the page uneditable, so that they cannot edit it any
further and so that only the presenter can edit it.
*/
public function makeTextObjectsUneditable(e:MadePresenterEvent):void {
LogUtil.debug("MADE PRESENTER IS PRESENTER FALSE");
isPresenter = false;
var texts:Array = getAllTexts();
for(var i:int = 0; i < texts.length; i++) {
(texts[i] as TextObject).makeEditable(false);
(texts[i] as TextObject).deregisterListeners(textObjGainedFocusListener,
textObjLostFocusListener,
textObjTextListener,
textObjSpecialListener);
}
}
/* the following four methods are listeners that handle events that occur
on TextObjects, such as text being typed, which causes the textObjTextListener
to send text to the server.
*/
public function textObjSpecialListener(event:KeyboardEvent):void {
// check for special conditions
if(event.charCode == 127 || // 'delete' key
event.charCode == 8 || // 'bkspace' key
event.charCode == 13) { // 'enter' key
var sendStatus:String = TextObject.TEXT_UPDATED;
var tobj:TextObject = event.target as TextObject;
// if the enter key is pressed, remove focus from the
// TextObject so that it is sent to the server.
if(event.charCode == 13) {
wbCanvas.stage.focus = null;
tobj.stage.focus = null;
return;
}
sendTextToServer(sendStatus, tobj);
}
}
public function textObjTextListener(event:TextEvent):void {
var sendStatus:String = TextObject.TEXT_UPDATED;
var tf:TextObject = event.target as TextObject;
LogUtil.debug("ID " + tf.getGraphicID() + " modified to "
+ tf.text);
sendTextToServer(sendStatus, tf);
}
public function textObjGainedFocusListener(event:FocusEvent):void {
var tf:TextObject = event.currentTarget as TextObject;
wbCanvas.stage.focus = tf;
tf.stage.focus = tf;
currentlySelectedTextObject = tf;
var e:GraphicObjectFocusEvent =
new GraphicObjectFocusEvent(GraphicObjectFocusEvent.OBJECT_SELECTED);
e.data = tf;
wbCanvas.dispatchEvent(e);
}
public function textObjLostFocusListener(event:FocusEvent):void {
var tf:TextObject = event.target as TextObject;
sendTextToServer(TextObject.TEXT_PUBLISHED, tf);
LogUtil.debug("Text published to: " + tf.text);
var e:GraphicObjectFocusEvent =
new GraphicObjectFocusEvent(GraphicObjectFocusEvent.OBJECT_DESELECTED);
e.data = tf;
wbCanvas.dispatchEvent(e);
/* hide text toolbar because we don't want to show it
if there is no text selected */
}
private function redrawGraphic(gobj:GraphicObject, objIndex:int):void {
if(gobj.getGraphicType() == WhiteboardConstants.TYPE_SHAPE) {
var origDobj:DrawObject = gobj as DrawObject;
wbCanvas.removeGraphic(origDobj);
origDobj.graphics.clear();
var dobj:DrawObject = shapeFactory.makeShape(origDobj);
dobj.setGraphicID(origDobj.getGraphicID());
dobj.status = origDobj.status;
wbCanvas.addGraphic(dobj);
graphicList[objIndex] = dobj;
} else if(gobj.getGraphicType() == WhiteboardConstants.TYPE_TEXT) {
// haven't thought of rescaling of the text, will do later
}
}
public function isPageEmpty():Boolean {
return graphicList.length == 0;
}
/* The next three methods are used for the "selection tool" that I haven't finished implementing yet.
The idea of the selection tool is to be able to figure out what is the top most object and distinguish
the object from those that may be beneath it. The idea is to allow for the user to select individual
GraphicObjects (maybe a shape or even a text box), and allow for modification of individual elements
For example, a user could click on a rectangle shape that would then appear to become "selected", so that the user
could take actions on the shape such as rotate, delete, resize, etc. These are just the plans, and have not been
implemented yet, so the selection tool does not really have a purpose currently.
*/
private function getGraphicObjectsUnderPoint(xf:Number, yf:Number):Array {
// below is a nasty hack to get normalized/denormalized coordinates of
// "normal" coordinates. will change later.
var x:Number =
GraphicFactory.denormalize(
GraphicFactory.normalize(xf,
textFactory.getParentWidth()), textFactory.getParentWidth());
var y:Number =
GraphicFactory.denormalize(
GraphicFactory.normalize(yf,
textFactory.getParentHeight()), textFactory.getParentHeight());
var point:Point = new Point(x,y);
point = wbCanvas.localToGlobal(point);
return wbCanvas.parentApplication.getObjectsUnderPoint(point);
}
private function filterGraphicObjects(objs:Array):Array {
return objs.filter(
function callback(item:*, index:int, array:Array):Boolean
{
return item is GraphicObject;
}
);
}
private function getTopMostObject(objs:Array):Object {
var topMostObj:Object;
for(var i:int = objs.length-2; i >= 0; i--) {
var firstIndex:int =
wbCanvas.parentApplication.getChildIndex(objs[i]);
var secondIndex:int =
wbCanvas.parentApplication.getChildIndex(objs[i+1]);
topMostObj =
(firstIndex > secondIndex) ? firstIndex : secondIndex;
}
return topMostObj;
}
<<<<<<< HEAD
private var _textShape:UIComponent;
// private var _currentText:TextInput;
@ -360,6 +942,9 @@ package org.bigbluebutton.modules.whiteboard
// set focus
wbCanvas.stage.focus = _currentText;
}
=======
>>>>>>> ajay/bbb-whiteboard-additions
}
}
}

View File

@ -33,8 +33,13 @@ package org.bigbluebutton.modules.whiteboard.business
import org.bigbluebutton.modules.present.events.PresentationEvent;
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObjectFactory;
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.TextFactory;
import org.bigbluebutton.modules.whiteboard.business.shapes.TextObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.WhiteboardConstants;
import org.bigbluebutton.modules.whiteboard.events.PageEvent;
import org.bigbluebutton.modules.whiteboard.events.StartWhiteboardModuleEvent;
import org.bigbluebutton.modules.whiteboard.events.ToggleGridEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
@ -58,6 +63,7 @@ package org.bigbluebutton.modules.whiteboard.business
private var manualDisconnect:Boolean = false;
private var dispatcher:Dispatcher;
private var drawFactory:DrawObjectFactory;
private var textFactory:TextFactory;
private var initialLoading:Boolean = true;
private var initialPageEvent:PageEvent;
@ -66,6 +72,7 @@ package org.bigbluebutton.modules.whiteboard.business
public function DrawProxy(model:WhiteboardModel) {
_whiteboardModel = model;
drawFactory = new DrawObjectFactory();
textFactory = new TextFactory();
dispatcher = new Dispatcher();
BBB.initConnectionManager().addMessageListener(this);
}
@ -202,6 +209,7 @@ package org.bigbluebutton.modules.whiteboard.business
public function getPageHistory(e:PageEvent):void {
var nc:NetConnection = connection;
<<<<<<< HEAD
nc.call("whiteboard.setActivePage",
new Responder(
function(result:Object):void { // On successful result
@ -212,6 +220,21 @@ package org.bigbluebutton.modules.whiteboard.business
// } else{
// LogUtil.debug("Whiteboard: Shapes up to date, no need to update");
// }
=======
nc.call(
"whiteboard.setActivePage",// Remote function name
new Responder(
// On successful result
function(result:Object):void {
if ((result as int) != e.graphicObjs.length) {
LogUtil.debug("Whiteboard: Need to retrieve shapes. Have " + e.graphicObjs.length + " on client, "
+ (result as int) + " on server");
LogUtil.debug("Whiteboard: Retrieving shapes on page" + e.pageNum);
getHistory();
} else{
LogUtil.debug("Whiteboard: Shapes up to date, no need to update");
}
>>>>>>> ajay/bbb-whiteboard-additions
},
function(status:Object):void { // status - On error occurred
@ -231,6 +254,7 @@ package org.bigbluebutton.modules.whiteboard.business
*
*/
public function sendShape(e:WhiteboardDrawEvent):void{
<<<<<<< HEAD
var shape:DrawObject = e.message;
LogUtil.debug("*** Sending shape");
@ -256,21 +280,93 @@ package org.bigbluebutton.modules.whiteboard.business
),//new Responder
annotation
);
=======
var shape:DrawObject = e.message as DrawObject;
//LogUtil.debug("*** Sending shape");
var nc:NetConnection = connection;
nc.call(
"whiteboard.sendShape",// Remote function name
new Responder(
// On successful result
function(result:Object):void {
//LogUtil.debug("Whiteboard::sendShape() ");
},
// status - On error occurred
function(status:Object):void {
LogUtil.error("Error occurred:");
for (var x:Object in status) {
LogUtil.error(x + " : " + status[x]);
}
}
),//new Responder
shape.getShapeArray(), shape.getType(), shape.getColor(), shape.getThickness(),
shape.getFill(), shape.getFillColor(), shape.getTransparency(), shape.getGraphicID(), shape.status
); //_netConnection.call
>>>>>>> ajay/bbb-whiteboard-additions
}
/**
* Sends a TextObject to the Shared Object on the red5 server, and then triggers an update across all clients
* @param shape The shape sent to the SharedObject
*
*/
public function sendText(e:WhiteboardDrawEvent):void{
var tobj:TextObject = e.message as TextObject;
var nc:NetConnection = connection;
nc.call(
"whiteboard.sendText",// Remote function name
new Responder(
// On successful result
function(result:Object):void {
},
// status - On error occurred
function(status:Object):void {
LogUtil.error("Error occurred:");
for (var x:Object in status) {
LogUtil.error(x + " : " + status[x]);
}
}
),//new Responder
tobj.text, tobj.textColor, tobj.backgroundColor, tobj.background,
tobj.x, tobj.y, tobj.textSize, tobj.getGraphicID(), tobj.status
); //_netConnection.call
}
/**
* Adds a shape to the ValueObject, then triggers an update event
* @param array The array representation of a shape
*
*/
public function addSegment(array:Array, type:String, color:uint, thickness:uint, id:String, status:String):void{
LogUtil.debug("Rx add segment ****");
var d:DrawObject = drawFactory.makeDrawObject(type, array, color, thickness);
d.id = id;
public function addSegment(graphicType:String, array:Array, type:String, color:uint, thickness:uint,
fill:Boolean, fillColor:uint, transparent:Boolean, id:String, status:String, recvdShapes:Boolean = false):void{
//LogUtil.debug("Rx add segment **** with ID of " + id + " " + type
//+ " and " + color + " " + thickness + " " + fill + " " + transparent);
var d:DrawObject = drawFactory.makeDrawObject(type, array, color, thickness, fill, fillColor, transparent);
d.setGraphicID(id);
d.status = status;
var e:WhiteboardUpdate = new WhiteboardUpdate(WhiteboardUpdate.BOARD_UPDATED);
e.data = d;
e.recvdShapes = recvdShapes;
dispatcher.dispatchEvent(e);
}
/**
* Adds a new TextObject to the Whiteboard overlay
* @param Params represent the data used to recreate the TextObject
*
*/
public function addText(graphicType:String, text:String, textColor:uint, bgColor:uint, bgColorVisible:Boolean,
x:Number, y:Number, textSize:Number, id:String, status:String, recvdShapes:Boolean = false):void {
LogUtil.debug("Rx add text **** with ID of " + id + " " + x + "," + y);
var t:TextObject = new TextObject(text, textColor, bgColor, bgColorVisible, x, y, textSize);
t.setGraphicID(id);
t.status = status;
var e:WhiteboardUpdate = new WhiteboardUpdate(WhiteboardUpdate.BOARD_UPDATED);
e.data = t;
e.recvdShapes = recvdShapes;
dispatcher.dispatchEvent(e);
}
@ -300,17 +396,17 @@ package org.bigbluebutton.modules.whiteboard.business
/**
* Sends a call out to the red5 server to notify the clients to undo a shape
* Sends a call out to the red5 server to notify the clients to undo a GraphicObject
*
*/
public function undoShape():void{
public function undoGraphic():void{
var nc:NetConnection = connection;
nc.call(
"whiteboard.undo",// Remote function name
new Responder(
// On successful result
function(result:Object):void {
LogUtil.debug("Whiteboard::undoShape()");
LogUtil.debug("Whiteboard::undoGraphic()");
},
// status - On error occurred
function(status:Object):void {
@ -326,7 +422,53 @@ package org.bigbluebutton.modules.whiteboard.business
//drawSO.send("undo");
}
<<<<<<< HEAD
=======
/**
* Triggers the undo shape event on all clients
*
*/
public function undo():void{
dispatcher.dispatchEvent(new WhiteboardUpdate(WhiteboardUpdate.GRAPHIC_UNDONE));
}
/**
* Sends a call out to the red5 server to notify the clients to toggle grid mode
*
*/
public function toggleGrid():void{
LogUtil.debug("TOGGLING GRID...");
var nc:NetConnection = connection;
nc.call(
"whiteboard.toggleGrid",// Remote function name
new Responder(
// On successful result
function(result:Object):void {
LogUtil.debug("Whiteboard::toggleGrid()");
},
// status - On error occurred
function(status:Object):void {
LogUtil.error("Error occurred:");
for (var x:Object in status) {
LogUtil.error(x + " : " + status[x]);
}
}
)//new Responder
); //_netConnection.call
//drawSO.send("undo");
}
/**
* Triggers the toggle grid event
*
*/
public function toggleGridCallback():void{
LogUtil.debug("TOGGLE CALLBACK RECEIVED");
dispatcher.dispatchEvent(new ToggleGridEvent(ToggleGridEvent.GRID_TOGGLED));
}
>>>>>>> ajay/bbb-whiteboard-additions
public function modifyEnabled(e:WhiteboardPresenterEvent):void{
var nc:NetConnection = connection;
@ -358,12 +500,20 @@ package org.bigbluebutton.modules.whiteboard.business
private function getHistory():void{
var nc:NetConnection = connection;
nc.call(
<<<<<<< HEAD
"whiteboard.requestAnnotationHistory",// Remote function name
=======
"whiteboard.getHistory",// Remote function name
>>>>>>> ajay/bbb-whiteboard-additions
new Responder(
// On successful result
function(result:Object):void {
LogUtil.debug("Whiteboard::getHistory() : retrieving whiteboard history");
<<<<<<< HEAD
// receivedShapesHistory(result);
=======
receivedGraphicsHistory(result);
>>>>>>> ajay/bbb-whiteboard-additions
},
// status - On error occurred
function(status:Object):void {
@ -377,22 +527,54 @@ package org.bigbluebutton.modules.whiteboard.business
); //_netConnection.call
}
private function receivedShapesHistory(result:Object):void{
private function receivedGraphicsHistory(result:Object):void{
if (result == null) return;
var shapes:Array = result as Array;
//LogUtil.debug("Whiteboard::recievedShapesHistory() : recieved " + shapes.length);
var graphicObjs:Array = result as Array;
LogUtil.debug("Whiteboard::recievedShapesHistory() : recieved " + graphicObjs.length);
for (var i:int=0; i < shapes.length; i++){
var shape:Array = shapes[i] as Array;
var shapeArray:Array = shape[0] as Array;
var type:String = shape[1] as String;
var color:uint = shape[2] as uint;
var thickness:uint = shape[3] as uint;
var id:String = shape[4] as String;
var status:String = shape[5] as String;
addSegment(shapeArray, type, color, thickness, id, status);
var receivedShapes:Array = new Array();
for (var i:int=0; i < graphicObjs.length-1; i++) {
var graphic:Array = graphicObjs[i] as Array;
var graphicType:String = graphic[0] as String;
if(graphicType == WhiteboardConstants.TYPE_SHAPE) {
var shapeArray:Array = graphic[1] as Array;
var type:String = graphic[2] as String;
var color:uint = graphic[3] as uint;
var thickness:uint = graphic[4] as uint;
var fill:Boolean = graphic[5] as Boolean;
var fillColor:uint = graphic[6] as uint;
var transparent:Boolean = graphic[7] as Boolean;
var id:String = graphic[8] as String;
var status:String = graphic[9] as String;
var dobj:DrawObject = new DrawObject(type, shapeArray, color, thickness, fill, fillColor, transparent);
dobj.setGraphicID(id);
receivedShapes.push(dobj);
addSegment(graphicType, shapeArray, type, color, thickness, fill, fillColor, transparent, id, status, true);
} else if(graphicType == WhiteboardConstants.TYPE_TEXT) {
var text:String = (graphic[1] as String);
var textColor:uint = (graphic[2] as uint);
var bgColor:uint = (graphic[3] as uint);
var bgColorVisible:Boolean = (graphic[4] as Boolean);
var x:Number = (graphic[5] as Number);
var y:Number = (graphic[6] as Number);
var textSize:Number = (graphic[7] as Number);
var id_other:String = (graphic[8] as String);
var status_other:String = (graphic[9] as String);
var tobj:TextObject = new TextObject(text, textColor, bgColor, bgColorVisible,
x, y, textSize);
tobj.status = status_other
tobj.setGraphicID(id_other);
receivedShapes.push(tobj);
addText(graphicType, text, textColor, bgColor, bgColorVisible, x, y, textSize, id_other, status_other, true);
}
}
}
var isGrid:Boolean = graphicObjs[graphicObjs.length-1][0] as Boolean;
if(isGrid) {
LogUtil.debug("Contacted server and server says grid mode is on for the current page. :D");
toggleGridCallback();
}
}
}
}
}

View File

@ -0,0 +1,147 @@
package org.bigbluebutton.modules.whiteboard.business.shapes
{
import flash.display.Sprite;
/**
* ...
* @author : Sandeep Vallabaneni
* @link : http://flexstreamer.com
* @version : 0.1
* @Date : 20 January 2011
*/
public class DrawGrid extends Sprite
{
private var _xLineHolder:Sprite = new Sprite(); // Horizontal line holder
private var _yLineHolder:Sprite = new Sprite(); // Vertical line holder
private var _lineColor:uint = 0x000000; // Default Color
private var _gridAlpha:Number = .3; // Default Visibility/Alpha
private var _numXDivs:Number = 10; // Horizontal Gap
private var _numYDivs:Number = 10; // Vertical Gap
private var _gridWidth:Number = 100; // Grid Width
private var _gridHeight:Number = 100; // Grid Height
/** @usage :
* var grid:DrawGrid = new DrawGrid(600, 400, 10, 10);
* addChild(grid);
*/
public function DrawGrid(w:int=100, h:int=100, xDistance:int=10, yDistance:int=10)
{
addChild(_xLineHolder);
addChild(_yLineHolder);
this._gridWidth = w;
this._gridHeight = h;
this._numXDivs = xDistance;
this._numYDivs = yDistance;
this.updateGrid();
}
// To Create Grid
private function updateGrid():void
{
var spaceXDiv:Number = _gridWidth/_numXDivs;
var spaceYDiv:Number = _gridHeight/_numYDivs;
_xLineHolder.graphics.clear();
_yLineHolder.graphics.clear();
_xLineHolder.graphics.lineStyle(1, _lineColor, _gridAlpha);
_yLineHolder.graphics.lineStyle(1, _lineColor, _gridAlpha);
for(var i:int = 0; i <= spaceXDiv; i++){
_xLineHolder.graphics.moveTo(i * _numXDivs, 0);
_xLineHolder.graphics.lineTo(i * _numXDivs, _gridHeight);
}
for(var j:int = 0; j <= spaceYDiv; j++){
_yLineHolder.graphics.moveTo( 0, j * _numYDivs);
_yLineHolder.graphics.lineTo(_gridWidth, j * _numYDivs);
}
}
//--------------------------------------------------------------------------------------------------------
//************************************* SETTERS AND GETTERS***********************************************
//************************************* GRID COLOR********************************************************
/** @usage :
* var grid:DrawGrid = new DrawGrid(600, 400, 10, 10);
* addChild(grid);
* grid.setlineColor = 0xff0000;
*/
public function set setlineColor(clr:Number):void
{
this._lineColor = clr;
this.updateGrid();
}
public function get getlineColor():Number
{
return this._lineColor;
}
//*************************************HORIZONTAL GAP********************************************************
/** @usage :
* var grid:DrawGrid = new DrawGrid(600, 400, 10, 10);
* addChild(grid);
* grid.hGap = 5;
*/
public function set hGap(val:Number):void
{
this._numXDivs = val;
this.updateGrid();
}
public function get hGap():Number
{
return this._numXDivs;
}
//*************************************VERTICAL GAP***********************************************************
/** @usage :
* var grid:DrawGrid = new DrawGrid(600, 400, 10, 10);
* addChild(grid);
* grid.vGap = 5;
*/
public function set vGap(val:Number):void
{
this._numYDivs = val;
this.updateGrid();
}
public function get vGap():Number
{
return this._numYDivs;
}
//*************************************LINE ALPHA*************************************************************
/** @usage :
* var grid:DrawGrid = new DrawGrid(600, 400, 10, 10);
* addChild(grid);
* grid.gridAlpha = .5;
*/
public function set gridAlpha(val:Number):void
{
this._gridAlpha = val;
this.updateGrid();
}
public function get gridAlpha():Number
{
return this._gridAlpha;
}
//*************************************GRID SIZE*************************************************************
/** @usage :
* var grid:DrawGrid = new DrawGrid(600, 400, 10, 10);
* addChild(grid);
* grid.setSize(300,200);
*/
public function setSize(w:Number, h:Number):void
{
this._gridWidth = w;
this._gridHeight = h;
this.updateGrid();
}
//--------------------------------------------------------------------------------------------------------
}
}

View File

@ -17,7 +17,13 @@
*
*/
package org.bigbluebutton.modules.whiteboard.business.shapes
<<<<<<< HEAD
{
=======
{
import flash.display.DisplayObject;
import flash.display.Shape;
>>>>>>> ajay/bbb-whiteboard-additions
import flash.display.Sprite;
/**
@ -30,22 +36,27 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
* @author dzgonjan
*
*/
public class DrawObject {
public class DrawObject extends Sprite implements GraphicObject {
public static const PENCIL:String = "pencil";
public static const HIGHLIGHTER:String = "highlighter";
public static const ERASER:String = "eraser";
public static const RECTANGLE:String = "rectangle";
public static const ELLIPSE:String = "ellipse";
<<<<<<< HEAD
public static const TEXT:String = "text";
=======
public static const TRIANGLE:String = "triangle";
public static const LINE:String = "line";
>>>>>>> ajay/bbb-whiteboard-additions
protected var type:String;
protected var shape:Array;
protected var color:uint;
protected var fillColor:uint;
protected var thickness:uint;
/**
* Id we can use to match the feedback shape in the presenter's view so we can
* remove it.
*/
public var id:String = null;
protected var fill:Boolean;
protected var transparent:Boolean;
/**
* Status = [START, UPDATE, END]
@ -55,23 +66,57 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
public static const DRAW_START:String = "DRAW_START";
public var status:String = DRAW_START;
<<<<<<< HEAD
protected var _shape:Sprite = new Sprite();
=======
>>>>>>> ajay/bbb-whiteboard-additions
protected var _segment:Array;
/**
* ID we can use to match the shape in the client's view
* so we can use modify it; a unique identifier of each GraphicObject
*/
private var ID:String = WhiteboardConstants.ID_UNASSIGNED;
/**
* The default constructor for the DrawObject
*
*/
public function DrawObject(type:String, segment:Array, color:uint, thickness:uint) {
public function DrawObject(type:String, segment:Array, color:uint, thickness:uint,
fill:Boolean, fillColor:uint, trans:Boolean) {
this.type = type;
this.shape = segment;
this.color = color;
this.thickness = thickness;
this.fill = fill;
this.fillColor = fillColor;
this.transparent = trans;
this.optimize();
}
<<<<<<< HEAD
public function getShape():Sprite {
return _shape;
=======
public function getGraphicType():String {
return WhiteboardConstants.TYPE_SHAPE;
}
public function getGraphicID():String {
return ID;
}
public function setGraphicID(id:String):void {
this.ID = id;
}
public function denormalize(val:Number, side:Number):Number {
return (val*side)/100.0;
}
public function normalize(val:Number, side:Number):Number {
return (val*100.0)/side;
>>>>>>> ajay/bbb-whiteboard-additions
}
/**
@ -101,6 +146,15 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
return this.color;
}
/**
* Returns the fillColor of the DrawObject
* @return The fillColor, represented as a uint
*
*/
public function getFillColor():uint{
return this.fillColor;
}
/**
* Returns the thickness of the DrawObject
* @return The thickness, represented as a uint
@ -110,6 +164,34 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
return this.thickness;
}
/**
* Returns the fill of the DrawObject
* @return The thickness, represented as a Boolean
*
*/
public function getFill():Boolean{
return this.fill;
}
/**
* Returns the transparency of the DrawObject
* @return The transparency, represented as a Boolean
*
*/
public function getTransparency():Boolean{
return this.transparent;
}
/**
* Returns the alpha transparnecy of the DrawObject
* @return The alpha transparency, represented as a Number
*
*/
public function getTransparencyLevel():Number{
return transparent ? 0.6 : 1.0;
}
protected function optimize():void{
// do nothing
}
@ -117,17 +199,13 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
protected function readyToSend():Boolean {
return false;
}
public function makeShape(width:Number, height:Number):void {
public function makeGraphic(pW:Number, pH:Number):void {
return;
}
protected function denormalize(val:Number, side:Number):Number {
return (val*side)/100.0;
}
protected function normalize(val:Number, side:Number):Number {
return (val*100.0)/side;
public function getProperties():Array {
return null;
}
}
}

View File

@ -42,16 +42,20 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
* @param shape The array holding the different points needed to create the DrawObject
* @param color The color of the DrawObject to be created
* @param thickness The thickness of the DrawObject to be created
* @param fill Whether or not the DrawObject should be filled or not. Doesn't apply for Pencil/Line tools.
* @param trans Whether or not the DrawObject should be transparent.
* @return the DrawObject created from the parameters
*
*/
public function makeDrawObject(type:String, shape:Array, color:uint, thickness:uint):DrawObject{
public function makeDrawObject(type:String, shape:Array, color:uint, thickness:uint,
fill:Boolean, fillColor:uint, trans:Boolean):DrawObject{
var d:DrawObject = null;
if (type == DrawObject.PENCIL){
d = makePencil(shape, color, thickness);
d = makePencil(shape, color, thickness, trans);
} else if (type == DrawObject.RECTANGLE){
d = makeRectangle(shape, color, thickness);
d = makeRectangle(shape, color, thickness, fill, fillColor, trans);
} else if (type == DrawObject.ELLIPSE){
<<<<<<< HEAD
d = makeEllipse(shape, color, thickness);
} else if (type == DrawObject.TEXT){
d = makeText(shape, color, thickness);
@ -59,6 +63,18 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
d.getShapeArray().push(d.getShape().height);
}
=======
d = makeEllipse(shape, color, thickness, fill, fillColor, trans);
} else if (type == DrawObject.TRIANGLE){
d = makeTriangle(shape, color, thickness, fill, fillColor, trans);
} else if (type == DrawObject.LINE){
d = makeLine(shape, color, thickness, trans);
} else if (type == DrawObject.HIGHLIGHTER){
d = makeHighlighter(shape, color, thickness, trans);
} else if (type == DrawObject.ERASER){
d = makeEraser(shape, color, thickness, trans);
}
>>>>>>> ajay/bbb-whiteboard-additions
return d;
}
@ -69,12 +85,18 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
* @param shape The array holding the different points needed to create the DrawObject
* @param color The color of the DrawObject to be created
* @param thickness The thickness of the DrawObject to be created
* @param trans Whether or not the DrawObject should be transparent.
* @return the Pencil DrawObject created from the parameters
*
*/
<<<<<<< HEAD
public function makePencil(shape:Array, color:uint, thickness:uint):DrawObject{
return new Pencil(shape, color, thickness);
=======
public function makePencil(shape:Array, color:uint, thickness:uint, trans:Boolean):DrawObject{
return new Pencil(shape, color, thickness, trans);
>>>>>>> ajay/bbb-whiteboard-additions
}
/**
@ -84,11 +106,14 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
* @param shape The array holding the different points needed to create the DrawObject
* @param color The color of the DrawObject to be created
* @param thickness The thickness of the DrawObject to be created
* @param fill Whether or not the DrawObject should be filled or not.
* @param fillColor if fill is true, the color to fill the DrawObject
* @param trans Whether or not the DrawObject should be transparent.
* @return the Rectangle DrawObject created from the parameters
*
*/
public function makeRectangle(shape:Array, color:uint, thickness:uint):DrawObject{
return new Rectangle(shape, color, thickness);
public function makeRectangle(shape:Array, color:uint, thickness:uint, fill:Boolean, fillColor:uint, trans:Boolean):DrawObject{
return new Rectangle(shape, color, thickness, fill, fillColor, trans);
}
/**
@ -98,11 +123,80 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
* @param shape The array holding the different points needed to create the DrawObject
* @param color The color of the DrawObject to be created
* @param thickness The thickness of the DrawObject to be created
* @param fill Whether or not the DrawObject should be filled or not.
* @param fillColor if fill is true, the color to fill the DrawObject
* @param trans Whether or not the DrawObject should be transparent.
* @return the Ellipse DrawObject created from the parameters
*
*/
public function makeEllipse(shape:Array, color:uint, thickness:uint):DrawObject{
return new Ellipse(shape, color, thickness);
public function makeEllipse(shape:Array, color:uint, thickness:uint, fill:Boolean, fillColor:uint,trans:Boolean):DrawObject{
return new Ellipse(shape, color, thickness, fill, fillColor, trans);
}
/**
* A helper method for the makeDrawObject method whitch creates a Line DrawObject
* <p>
* Even though it is a helper method it is made public for testing purposes
* @param shape The array holding the different points needed to create the DrawObject
* @param color The color of the DrawObject to be created
* @param thickness The thickness of the DrawObject to be created
* @param trans Whether or not the DrawObject should be transparent.
* @return the Line DrawObject created from the parameters
*
*/
public function makeLine(shape:Array, color:uint, thickness:uint, trans:Boolean):DrawObject{
return new Line(shape, color, thickness, trans);
}
/**
* A helper method for the makeDrawObject method whitch creates a Highlighter DrawObject
* <p>
* Even though it is a helper method it is made public for testing purposes
* @param shape The array holding the different points needed to create the DrawObject
* @param color The color of the DrawObject to be created
* @param thickness The thickness of the DrawObject to be created
* @param trans Whether or not the DrawObject should be transparent.
* @return the Highlighter DrawObject created from the parameters
*
*/
public function makeHighlighter(shape:Array, color:uint, thickness:uint, trans:Boolean):DrawObject{
return new Highlighter(shape, color, thickness, trans);
}
/**
* A helper method for the makeDrawObject method whitch creates an Eraser DrawObject
* <p>
* Even though it is a helper method it is made public for testing purposes
* @param shape The array holding the different points needed to create the DrawObject
* @param color The color of the DrawObject to be created
* @param thickness The thickness of the DrawObject to be created
* @param trans Whether or not the DrawObject should be transparent.
* @return the Eraser DrawObject created from the parameters
*
*/
public function makeEraser(shape:Array, color:uint, thickness:uint, trans:Boolean):DrawObject{
return new Eraser(shape, color, thickness, trans);
}
/**
* A helper method for the makeDrawObject method whitch creates a Triangle DrawObject
* <p>
* Even though it is a helper method it is made public for testing purposes
* @param shape The array holding the different points needed to create the DrawObject
* @param color The color of the DrawObject to be created
* @param thickness The thickness of the DrawObject to be created
* @param fill Whether or not the DrawObject should be filled or not.
* @param fillColor if fill is true, the color to fill the DrawObject
* @param trans Whether or not the DrawObject should be transparent.
* @return the Triangle DrawObject created from the parameters
*
*/
public function makeTriangle(shape:Array, color:uint, thickness:uint, fill:Boolean, fillColor:uint, trans:Boolean):DrawObject{
return new Triangle(shape, color, thickness, fill, fillColor, trans);
}
public function makeText(shape:Array, color:uint, thickness:uint):DrawObject{

View File

@ -34,12 +34,14 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
* unnecessary data
* @param segment the array representing the points needed to create this Ellipse
* @param color the Color of this Ellipse
* @param fill the fill of this Ellipse
* @param trans the transparency of this Ellipse
* @param thickness the thickness of this Ellipse
*
*/
public function Ellipse(segment:Array, color:uint, thickness:uint)
public function Ellipse(segment:Array, color:uint, thickness:uint, fill:Boolean, fillColor:uint, trans:Boolean)
{
super(DrawObject.ELLIPSE, segment, color, thickness);
super(DrawObject.ELLIPSE, segment, color, thickness, fill, fillColor, trans);
}
/**
@ -60,20 +62,37 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
this.shape.push(y2);
}
<<<<<<< HEAD
override public function makeShape(parentWidth:Number, parentHeight:Number):void {
var newShape:Sprite = new Sprite();
newShape.graphics.lineStyle(getThickness(), getColor());
=======
override public function makeGraphic(parentWidth:Number, parentHeight:Number):void {
if(!fill)
this.graphics.lineStyle(getThickness(), getColor(), getTransparencyLevel());
else this.graphics.lineStyle(getThickness(), getColor());
>>>>>>> ajay/bbb-whiteboard-additions
var arrayEnd:Number = getShapeArray().length;
var x:Number = denormalize(getShapeArray()[0], parentWidth);
var y:Number = denormalize(getShapeArray()[1], parentHeight);
var width:Number = denormalize(getShapeArray()[arrayEnd-2], parentWidth) - x;
var height:Number = denormalize(getShapeArray()[arrayEnd-1], parentHeight) - y;
newShape.graphics.drawEllipse(x, y, width, height);
if (getColor() == 0x000000 || getColor() == 0xFFFFFF) newShape.alpha = 1.0;
else newShape.alpha = 0.6;
_shape = newShape;
var startX:Number = denormalize(getShapeArray()[0], parentWidth);
var startY:Number = denormalize(getShapeArray()[1], parentHeight);
var width:Number = denormalize(getShapeArray()[arrayEnd-2], parentWidth) - startX;
var height:Number = denormalize(getShapeArray()[arrayEnd-1], parentHeight) - startY;
if(fill) this.graphics.beginFill(getFillColor(), getTransparencyLevel());
this.graphics.drawEllipse(startX, startY, width, height);
}
override public function getProperties():Array {
var props:Array = new Array();
props.push(this.type);
props.push(this.shape);
props.push(this.color);
props.push(this.thickness);
props.push(this.fill);
props.push(this.fillColor);
props.push(this.transparent);
props.push(this.width);
props.push(this.height);
return props;
}
}
}

View File

@ -0,0 +1,87 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.business.shapes
{
import flash.display.Shape;
public class Eraser extends DrawObject
{
/**
* The dafault constructor. Creates a Eraser DrawObject
* @param segment the array representing the points needed to create this Eraser
* @param color the Color of this Eraser
* @param thickness the thickness of this Eraser
* @param trans the transparency of this Eraser
*/
public function Eraser(segment:Array, color:uint, thickness:uint, trans:Boolean)
{
super(DrawObject.ERASER, segment, 0xFFFFFF, thickness, false, 0x000000, false);
}
/**
* Gets rid of the unnecessary data in the segment array, so that the object can be more easily passed to
* the server
*
*/
override protected function optimize():void{
var x1:Number = this.shape[0];
var y1:Number = this.shape[1];
var x2:Number = this.shape[this.shape.length - 2];
var y2:Number = this.shape[this.shape.length - 1];
this.shape = new Array();
this.shape.push(x1);
this.shape.push(y1);
this.shape.push(x2);
this.shape.push(y2);
}
override public function makeGraphic(parentWidth:Number, parentHeight:Number):void {
this.graphics.lineStyle(getThickness(), 0xFFFFFF);
var graphicsCommands:Vector.<int> = new Vector.<int>();
graphicsCommands.push(1);
var coordinates:Vector.<Number> = new Vector.<Number>();
coordinates.push(denormalize(getShapeArray()[0], parentWidth), denormalize(getShapeArray()[1], parentHeight));
for (var i:int = 2; i < getShapeArray().length; i += 2){
graphicsCommands.push(2);
coordinates.push(denormalize(getShapeArray()[i], parentWidth), denormalize(getShapeArray()[i+1], parentHeight));
}
this.graphics.drawPath(graphicsCommands, coordinates);
this.alpha = 1;
}
override public function getProperties():Array {
var props:Array = new Array();
props.push(this.type);
props.push(this.shape);
props.push(0xFFFFFF);
props.push(this.thickness);
props.push(false);
props.push(false);
props.push(this.width);
props.push(this.height);
return props;
}
}
}

View File

@ -0,0 +1,43 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.business.shapes
{
import flash.display.DisplayObject;
public class GraphicFactory
{
public static const SHAPE_FACTORY:String = "SHAPE_FACTORY";
public static const TEXT_FACTORY:String = "TEXT_FACTORY";
public var factory_type:String;
public function GraphicFactory(type:String) {
this.factory_type = type;
}
public static function denormalize(val:Number, side:Number):Number {
return (val*side)/100.0;
}
public static function normalize(val:Number, side:Number):Number {
return (val*100.0)/side;
}
}
}

View File

@ -0,0 +1,42 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.business.shapes
{
import flash.display.DisplayObject;
import org.bigbluebutton.common.LogUtil;
public interface GraphicObject {
function getGraphicType():String;
function getGraphicID():String;
function setGraphicID(id:String):void;
function denormalize(val:Number, side:Number):Number;
function normalize(val:Number, side:Number):Number;
function makeGraphic(parentWidth:Number, parentHeight:Number):void;
function getProperties():Array;
}
}

View File

@ -0,0 +1,83 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.business.shapes
{
import flash.display.Shape;
public class Highlighter extends DrawObject
{
/**
* The dafault constructor. Creates a Highlighter DrawObject
* @param segment the array representing the points needed to create this Highlighter
* @param color the Color of this Highlighter
* @param thickness the thickness of this Highlighter
* @param trans the transparency of this Highlighter
*/
public function Highlighter(segment:Array, color:uint, thickness:uint, trans:Boolean)
{
super(DrawObject.HIGHLIGHTER, segment, color, thickness, false, 0x000000, true);
}
/**
* Gets rid of the unnecessary data in the segment array, so that the object can be more easily passed to
* the server
*
*/
override protected function optimize():void{
var x1:Number = this.shape[0];
var y1:Number = this.shape[1];
var x2:Number = this.shape[this.shape.length - 2];
var y2:Number = this.shape[this.shape.length - 1];
this.shape = new Array();
this.shape.push(x1);
this.shape.push(y1);
this.shape.push(x2);
this.shape.push(y2);
}
override public function makeGraphic(parentWidth:Number, parentHeight:Number):void {
if(thickness < 10) thickness = 10;
this.graphics.lineStyle(getThickness(), getColor(), getTransparencyLevel());
var arrayEnd:Number = getShapeArray().length;
var startX:Number = denormalize(getShapeArray()[0], parentWidth);
var startY:Number = denormalize(getShapeArray()[1], parentHeight);
var endX:Number = denormalize(getShapeArray()[arrayEnd-2], parentWidth);
var endY:Number = denormalize(getShapeArray()[arrayEnd-1], parentHeight);
this.x = startX;
this.y = startY;
this.graphics.lineTo(endX-startX, endY-startY);
}
override public function getProperties():Array {
var props:Array = new Array();
props.push(this.type);
props.push(this.shape);
props.push(this.color);
props.push(this.thickness);
props.push(false);
props.push(true);
props.push(this.width);
props.push(this.height);
return props;
}
}
}

View File

@ -0,0 +1,83 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.business.shapes
{
import flash.display.Shape;
public class Line extends DrawObject
{
/**
* The dafault constructor. Creates a Line DrawObject
* @param segment the array representing the points needed to create this Line
* @param color the Color of this Line
* @param thickness the thickness of this Line
* @param trans the transparency of this Line
*/
public function Line(segment:Array, color:uint, thickness:uint, trans:Boolean)
{
super(DrawObject.LINE, segment, color, thickness, false, 0x000000, false);
}
/**
* Gets rid of the unnecessary data in the segment array, so that the object can be more easily passed to
* the server
*
*/
override protected function optimize():void{
var x1:Number = this.shape[0];
var y1:Number = this.shape[1];
var x2:Number = this.shape[this.shape.length - 2];
var y2:Number = this.shape[this.shape.length - 1];
this.shape = new Array();
this.shape.push(x1);
this.shape.push(y1);
this.shape.push(x2);
this.shape.push(y2);
}
override public function makeGraphic(parentWidth:Number, parentHeight:Number):void {
this.graphics.lineStyle(getThickness(), getColor());
var arrayEnd:Number = getShapeArray().length;
var startX:Number = denormalize(getShapeArray()[0], parentWidth);
var startY:Number = denormalize(getShapeArray()[1], parentHeight);
var endX:Number = denormalize(getShapeArray()[arrayEnd-2], parentWidth);
var endY:Number = denormalize(getShapeArray()[arrayEnd-1], parentHeight);
this.alpha = 1;
this.x = startX;
this.y = startY;
this.graphics.lineTo(endX-startX, endY-startY);
}
override public function getProperties():Array {
var props:Array = new Array();
props.push(this.type);
props.push(this.shape);
props.push(this.color);
props.push(this.thickness);
props.push(false);
props.push(false);
props.push(this.width);
props.push(this.height);
return props;
}
}
}

View File

@ -32,16 +32,21 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
* @param segment the array representing the points needed to create this Pencil
* @param color the Color of this Pencil
* @param thickness the thickness of this Pencil
*
* @param trans the transparency of this Pencil
*/
public function Pencil(segment:Array, color:uint, thickness:uint)
public function Pencil(segment:Array, color:uint, thickness:uint, trans:Boolean)
{
super(DrawObject.PENCIL, segment, color, thickness);
super(DrawObject.PENCIL, segment, color, thickness, false, 0x000000, false);
}
<<<<<<< HEAD
override public function makeShape(parentWidth:Number, parentHeight:Number):void {
var newShape:Sprite = new Sprite();
newShape.graphics.lineStyle(getThickness(), getColor());
=======
override public function makeGraphic(parentWidth:Number, parentHeight:Number):void {
this.graphics.lineStyle(getThickness(), getColor());
>>>>>>> ajay/bbb-whiteboard-additions
var graphicsCommands:Vector.<int> = new Vector.<int>();
graphicsCommands.push(1);
@ -53,12 +58,21 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
coordinates.push(denormalize(getShapeArray()[i], parentWidth), denormalize(getShapeArray()[i+1], parentHeight));
}
newShape.graphics.drawPath(graphicsCommands, coordinates);
if (getColor() == 0x000000 || getColor() == 0xFFFFFF) newShape.alpha = 1;
else newShape.alpha = 0.6;
_shape = newShape;
this.graphics.drawPath(graphicsCommands, coordinates);
this.alpha = 1;
}
override public function getProperties():Array {
var props:Array = new Array();
props.push(this.type);
props.push(this.shape);
props.push(this.color);
props.push(this.thickness);
props.push(false);
props.push(false);
props.push(this.width);
props.push(this.height);
return props;
}
}
}

View File

@ -32,11 +32,12 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
* @param segment the array representing the points needed to create this Rectangle
* @param color the Color of this Rectangle
* @param thickness the thickness of this Rectangle
*
* @param fill the fill of this Rectangle
* @param trans the transparency of this Rectangle
*/
public function Rectangle(segment:Array, color:uint, thickness:uint)
public function Rectangle(segment:Array, color:uint, thickness:uint, fill:Boolean, fillColor:uint, trans:Boolean)
{
super(DrawObject.RECTANGLE, segment, color, thickness);
super(DrawObject.RECTANGLE, segment, color, thickness, fill, fillColor, trans);
}
/**
@ -57,21 +58,37 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
this.shape.push(y2);
}
<<<<<<< HEAD
override public function makeShape(parentWidth:Number, parentHeight:Number):void {
var newShape:Sprite = new Sprite();
newShape.graphics.lineStyle(getThickness(), getColor());
=======
override public function makeGraphic(parentWidth:Number, parentHeight:Number):void {
if(!fill)
this.graphics.lineStyle(getThickness(), getColor(), getTransparencyLevel());
else this.graphics.lineStyle(getThickness(), getColor());
>>>>>>> ajay/bbb-whiteboard-additions
var arrayEnd:Number = getShapeArray().length;
var x:Number = denormalize(getShapeArray()[0], parentWidth);
var y:Number = denormalize(getShapeArray()[1], parentHeight);
var width:Number = denormalize(getShapeArray()[arrayEnd-2], parentWidth) - x;
var height:Number = denormalize(getShapeArray()[arrayEnd-1], parentHeight) - y;
newShape.graphics.drawRect(x,y,width,height);
if (getColor() == 0x000000 || getColor() == 0xFFFFFF) newShape.alpha = 1.0;
else newShape.alpha = 0.6;
_shape = newShape;
var startX:Number = denormalize(getShapeArray()[0], parentWidth);
var startY:Number = denormalize(getShapeArray()[1], parentHeight);
var width:Number = denormalize(getShapeArray()[arrayEnd-2], parentWidth) - startX;
var height:Number = denormalize(getShapeArray()[arrayEnd-1], parentHeight) - startY;
if(fill) this.graphics.beginFill(getFillColor(), getTransparencyLevel());
this.graphics.drawRect(startX,startY,width,height);
}
override public function getProperties():Array {
var props:Array = new Array();
props.push(this.type);
props.push(this.shape);
props.push(this.color);
props.push(this.thickness);
props.push(this.fill);
props.push(this.fillColor);
props.push(this.transparent);
props.push(this.width);
props.push(this.height);
return props;
}
}
}

View File

@ -0,0 +1,32 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.business.shapes
{
public class SelectObject {
public static const SELECT_TOOL:String = "selector";
public static const DELETE_TOOL:String = "deletor";
public var selection_type:String;
public function SelectObject(type:String) {
this.selection_type = type;
}
}
}

View File

@ -28,13 +28,14 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
* @author dzgonjan
*
*/
public class ShapeFactory
public class ShapeFactory extends GraphicFactory
{
private var drawFactory:DrawObjectFactory;
private var _parentWidth:Number = 0;
private var _parentHeight:Number = 0;
public function ShapeFactory() {
super(GraphicFactory.SHAPE_FACTORY);
drawFactory = new DrawObjectFactory();
}
@ -49,6 +50,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
* @return
*
*/
<<<<<<< HEAD
public function makeShape(shape:DrawObject):DrawObject{
if (shape.getType() == DrawObject.PENCIL){
return makePencil(shape as Pencil);
@ -59,24 +61,40 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
} else if (shape.getType() == DrawObject.TEXT){
return makeText(shape as Text);
}
=======
public function makeShape(graphic:DrawObject):DrawObject{
if (graphic.getType() == DrawObject.PENCIL){
return makePencil(graphic as Pencil);
} else if (graphic.getType() == DrawObject.RECTANGLE){
return makeRectangle(graphic as Rectangle);
} else if (graphic.getType() == DrawObject.ELLIPSE){
return makeEllipse(graphic as Ellipse);
} else if (graphic.getType() == DrawObject.TRIANGLE){
return makeTriangle(graphic as Triangle);
} else if (graphic.getType() == DrawObject.LINE){
return makeLine(graphic as Line);
} else if (graphic.getType() == DrawObject.HIGHLIGHTER){
return makeHighlighter(graphic as Highlighter);
} else if (graphic.getType() == DrawObject.ERASER){
return makeEraser(graphic as Eraser);
}
>>>>>>> ajay/bbb-whiteboard-additions
return null;
}
private function denormalize(val:Number, side:Number):Number {
return (val*side)/100.0;
}
private function normalize(val:Number, side:Number):Number {
return (val*100.0)/side;
}
public function createDrawObject(type:String, segment:Array, color:uint, thickness:uint):DrawObject {
public function createDrawObject(type:String, segment:Array, color:uint, thickness:uint,
fill:Boolean, fillColor:uint, transparency:Boolean):DrawObject {
var normSegment:Array = new Array();
for (var i:int = 0; i < segment.length; i += 2) {
normSegment[i] = normalize(segment[i] , _parentWidth);
normSegment[i+1] = normalize(segment[i+1], _parentHeight);
<<<<<<< HEAD
}
return makeShape(drawFactory.makeDrawObject(type, normSegment, color, thickness));
=======
}
return makeShape(drawFactory.makeDrawObject(type, normSegment, color, thickness, fill, fillColor, transparency));
>>>>>>> ajay/bbb-whiteboard-additions
}
/**
@ -85,11 +103,14 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
* @param type
* @param color
* @param thickness
* @param fill
* @param fillColor
* @param trans
* @return A Flash Shape object
*
*/
public function makeFeedback(type:String, segment:Array, color:uint, thickness:uint):DrawObject{
return makeShape(drawFactory.makeDrawObject(type, segment, color, thickness));
public function makeFeedback(type:String, segment:Array, color:uint, thickness:uint, fill:Boolean, fillColor:uint, trans:Boolean):DrawObject{
return makeShape(drawFactory.makeDrawObject(type, segment, color, thickness, fill, fillColor, trans));
}
@ -101,7 +122,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
*
*/
private function makePencil(p:Pencil):DrawObject{
p.makeShape(_parentWidth, _parentHeight);
p.makeGraphic(_parentWidth, _parentHeight);
return p;
}
@ -112,7 +133,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
*
*/
private function makeRectangle(r:Rectangle):DrawObject{
r.makeShape(_parentWidth, _parentHeight);
r.makeGraphic(_parentWidth, _parentHeight);
return r;
}
@ -123,13 +144,60 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
*
*/
private function makeEllipse(e:Ellipse):DrawObject{
e.makeShape(_parentWidth, _parentHeight);
e.makeGraphic(_parentWidth, _parentHeight);
return e;
}
/**
* Creates a Flash Shape from an Line DrawObject
* @param e an Line DrawObject
* @return a Shape
*
*/
private function makeLine(e:Line):DrawObject{
e.makeGraphic(_parentWidth, _parentHeight);
return e;
}
/**
* Creates a Flash Shape from an Highlighter DrawObject
* @param e an Highlighter DrawObject
* @return a Shape
*
*/
private function makeHighlighter(e:Highlighter):DrawObject{
e.makeGraphic(_parentWidth, _parentHeight);
return e;
}
/**
* Creates a Flash Shape from an Eraser DrawObject
* @param e an Eraser DrawObject
* @return a Shape
*
*/
private function makeEraser(e:Eraser):DrawObject{
e.makeGraphic(_parentWidth, _parentHeight);
return e;
}
/**
* Creates a Flash Shape from an Triangle DrawObject
* @param e an Triangle DrawObject
* @return a Shape
*
*/
private function makeTriangle(e:Triangle):DrawObject{
e.makeGraphic(_parentWidth, _parentHeight);
return e;
}
<<<<<<< HEAD
private function makeText(e:Text):DrawObject{
e.makeShape(_parentWidth, _parentHeight);
return e;
}
=======
>>>>>>> ajay/bbb-whiteboard-additions
}
}

View File

@ -0,0 +1,65 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.business.shapes
{
public class TextFactory extends GraphicFactory
{
private var _parentWidth:Number = 0;
private var _parentHeight:Number = 0;
public function TextFactory() {
super(GraphicFactory.TEXT_FACTORY);
}
public function setParentDim(width:Number, height:Number):void {
_parentWidth = width;
_parentHeight = height;
}
public function createTextObject(txt:String, txtColor:uint,
bgColor:uint, bgColorVisible:Boolean,
x:Number, y:Number, textSize:Number):TextObject {
var newX:Number = normalize(x,_parentWidth);
var newY:Number = normalize(y,_parentHeight);
var tobj:TextObject = new TextObject(txt, txtColor, bgColor, bgColorVisible,
newX, newY, textSize);
tobj.makeGraphic(_parentWidth,_parentHeight);
return tobj;
}
/* convenience method for above method, takes a TextObject and returns one
with "normalized" coordinates
*/
public function makeTextObject(t:TextObject):TextObject {
return createTextObject(t.text, t.textColor, t.backgroundColor, t.background,
t.x, t.y, t.textSize);
}
public function getParentWidth():Number {
return _parentWidth;
}
public function getParentHeight():Number {
return _parentHeight;
}
}
}

View File

@ -0,0 +1,163 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.business.shapes
{
import com.asfusion.mate.core.GlobalDispatcher;
import flash.display.DisplayObject;
import flash.display.Shape;
import flash.display.Stage;
import flash.events.Event;
import flash.events.FocusEvent;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.events.TextEvent;
import flash.text.AntiAliasType;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFormat;
import flashx.textLayout.edit.SelectionManager;
import flexlib.scheduling.scheduleClasses.utils.Selection;
import mx.controls.Text;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.modules.whiteboard.WhiteboardCanvasModel;
public class TextObject extends TextField implements GraphicObject {
public static const TYPE_NOT_EDITABLE:String = "dynamic";
public static const TYPE_EDITABLE:String = "editable";
public static const TEXT_CREATED:String = "textCreated";
public static const TEXT_UPDATED:String = "textEdited";
public static const TEXT_PUBLISHED:String = "textPublished";
public static const TEXT_TOOL:String = "textTool";
/**
* Status = [CREATED, UPDATED, PUBLISHED]
*/
public var status:String = TEXT_CREATED;
private var _editable:Boolean;
/**
* ID we can use to match the shape in the client's view
* so we can use modify it; a unique identifier of each GraphicObject
*/
private var ID:String = WhiteboardConstants.ID_UNASSIGNED;
public var textSize:Number;
public function TextObject(text:String, textColor:uint, bgColor:uint,
bgColorVisible:Boolean, x:Number, y:Number, textSize:Number) {
this.text = text;
this.textColor = textColor;
this.backgroundColor = bgColor;
this.background = bgColorVisible;
this.x = x;
this.y = y;
this.textSize = textSize;
}
public function getGraphicType():String {
return WhiteboardConstants.TYPE_TEXT;
}
public function getGraphicID():String {
return ID;
}
public function setGraphicID(id:String):void {
this.ID = id;
}
public function denormalize(val:Number, side:Number):Number {
return (val*side)/100.0;
}
public function normalize(val:Number, side:Number):Number {
return (val*100.0)/side;
}
public function applyTextFormat(size:Number):void {
this.textSize = size;
var tf:TextFormat = new TextFormat();
tf.size = size;
tf.font = "arial";
this.defaultTextFormat = tf;
this.setTextFormat(tf);
}
public function makeGraphic(parentWidth:Number, parentHeight:Number):void {
var startX:Number = denormalize(this.x, parentWidth);
var startY:Number = denormalize(this.y, parentHeight);
this.x = startX;
this.y = startY;
this.antiAliasType = AntiAliasType.ADVANCED;
// ensure typing doesn't go off of whiteboard
this.width = 250;
}
public function getProperties():Array {
var props:Array = new Array();
props.push(this.text);
props.push(this.textColor);
props.push(this.backgroundColor);
props.push(this.background);
props.push(this.x);
props.push(this.y);
return props;
}
public function makeEditable(editable:Boolean):void {
if(editable) {
this.type = TextFieldType.INPUT;
} else {
this.type = TextFieldType.DYNAMIC;
}
this._editable = editable;
}
public function registerListeners(textObjGainedFocus:Function,
textObjLostFocus:Function,
textObjTextListener:Function,
textObjDeleteListener:Function):void {
this.addEventListener(FocusEvent.FOCUS_IN, textObjGainedFocus);
this.addEventListener(FocusEvent.FOCUS_OUT, textObjLostFocus);
this.addEventListener(TextEvent.TEXT_INPUT, textObjTextListener);
this.addEventListener(KeyboardEvent.KEY_DOWN, textObjDeleteListener);
}
public function deregisterListeners(textObjGainedFocus:Function,
textObjLostFocus:Function,
textObjTextListener:Function,
textObjDeleteListener:Function):void {
this.removeEventListener(FocusEvent.FOCUS_IN, textObjGainedFocus);
this.removeEventListener(FocusEvent.FOCUS_OUT, textObjLostFocus);
this.removeEventListener(TextEvent.TEXT_INPUT, textObjTextListener);
this.removeEventListener(KeyboardEvent.KEY_DOWN, textObjDeleteListener);
}
}
}

View File

@ -0,0 +1,90 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.business.shapes
{
import flash.display.Shape;
import org.bigbluebutton.common.LogUtil;
public class Triangle extends DrawObject
{
/**
* The dafault constructor. Creates a Triangle DrawObject
* @param segment the array representing the points needed to create this Triangle
* @param color the Color of this Triangle
* @param thickness the thickness of this Triangle
* @param trans the transparency of this Triangle
*/
public function Triangle(segment:Array, color:uint, thickness:uint, fill:Boolean, fillColor:uint, trans:Boolean)
{
super(DrawObject.TRIANGLE, segment, color, thickness, fill, fillColor, trans);
}
/**
* Gets rid of the unnecessary data in the segment array, so that the object can be more easily passed to
* the server
*
*/
override protected function optimize():void{
var x1:Number = this.shape[0];
var y1:Number = this.shape[1];
var x2:Number = this.shape[this.shape.length - 2];
var y2:Number = this.shape[this.shape.length - 1];
this.shape = new Array();
this.shape.push(x1);
this.shape.push(y1);
this.shape.push(x2);
this.shape.push(y2);
}
override public function makeGraphic(parentWidth:Number, parentHeight:Number):void {
if(!fill)
this.graphics.lineStyle(getThickness(), getColor(), getTransparencyLevel());
else this.graphics.lineStyle(getThickness(), getColor());
var arrayEnd:Number = getShapeArray().length;
var startX:Number = denormalize(getShapeArray()[0], parentWidth);
var startY:Number = denormalize(getShapeArray()[1], parentHeight);
var triangleWidth:Number = denormalize(getShapeArray()[arrayEnd-2], parentWidth) - startX;
var triangleHeight:Number = denormalize(getShapeArray()[arrayEnd-1], parentHeight) - startY;
LogUtil.debug(startX + " " + startY + " " + triangleWidth + " " + triangleHeight);
if(fill) this.graphics.beginFill(getFillColor(), getTransparencyLevel());
this.graphics.moveTo(startX+triangleWidth/2, startY);
this.graphics.lineTo(startX+triangleWidth, startY+triangleHeight);
this.graphics.lineTo(startX, triangleHeight+startY);
this.graphics.lineTo(startX+triangleWidth/2, startY);
}
override public function getProperties():Array {
var props:Array = new Array();
props.push(this.type);
props.push(this.shape);
props.push(this.color);
props.push(this.thickness);
props.push(this.fill);
props.push(this.fillColor);
props.push(this.transparent);
props.push(this.width);
props.push(this.height);
return props;
}
}
}

View File

@ -0,0 +1,29 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.business.shapes
{
public class WhiteboardConstants {
public static const TYPE_SHAPE:String = "SHAPE";
public static const TYPE_TEXT:String = "TEXT";
public static const TYPE_SELECTION:String = "SELECTION";
public static const ID_UNASSIGNED:String = "unassigned";
}
}

View File

@ -0,0 +1,37 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.events
{
import flash.events.Event;
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
public class GraphicObjectFocusEvent extends Event
{
public static const OBJECT_SELECTED:String = "objSelect";
public static const OBJECT_DESELECTED:String = "objDeselect";
public var data:GraphicObject;
public function GraphicObjectFocusEvent(type:String) {
super(type, true, false);
}
}
}

View File

@ -28,7 +28,8 @@ package org.bigbluebutton.modules.whiteboard.events
public static const LOAD_PAGE:String = "LoadPage";
public var pageNum:Number;
public var shapes:ArrayCollection;
public var graphicObjs:ArrayCollection;
public var isGrid:Boolean;
public function PageEvent(type:String)
{

View File

@ -0,0 +1,34 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.events
{
import flash.events.Event;
public class ToggleGridEvent extends Event
{
public static const TOGGLE_GRID:String = "toggleGrid";
public static const GRID_TOGGLED:String = "gridToggled";
public function ToggleGridEvent(type:String)
{
super(type, true, false);
}
}
}

View File

@ -21,14 +21,16 @@ package org.bigbluebutton.modules.whiteboard.events
import flash.events.Event;
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
public class WhiteboardDrawEvent extends Event
{
public static const SEND_SHAPE:String = "sendShape";
public static const SEND_TEXT:String = "sendText";
public static const CLEAR_BOARD:String = "clearBoard";
public static const UNDO_SHAPE:String = "undoShape"
public static const UNDO_GRAPHIC:String = "undoGraphic"
public var message:DrawObject;
public var message:GraphicObject;
public function WhiteboardDrawEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = false)
{

View File

@ -0,0 +1,36 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.events
{
import flash.events.Event;
public class WhiteboardSettingResetEvent extends Event
{
public static const FILL_CHANGED:String = "FILL_CHANGED";
public static const TRANSPARENCY_CHANGED:String = "TRANSPARENCY_CHANGED";
public static const GRID_CHANGED:String = "GRID_CHANGED";
public var value:Boolean;
public function WhiteboardSettingResetEvent(type:String)
{
super(type,true,false);
}
}
}

View File

@ -21,17 +21,20 @@ package org.bigbluebutton.modules.whiteboard.events
import flash.events.Event;
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
public class WhiteboardUpdate extends Event
{
public static const BOARD_UPDATED:String = "boardUpdated";
public static const BOARD_CLEARED:String = "boardClear";
public static const SHAPE_UNDONE:String = "shapeUndone";
public static const BOARD_ENABLED:String = "boardEnabled";
public static const GRAPHIC_UNDONE:String = "graphicUndone";
public var data:DrawObject;
public var data:GraphicObject;
public var recvdShapes:Boolean;
public var boardEnabled:Boolean;
public function WhiteboardUpdate(type:String)
{
super(type, true, false);

View File

@ -0,0 +1,97 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
*
* This program 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 2.1 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, see <http://www.gnu.org/licenses/>.
*
* Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
*/
package org.bigbluebutton.modules.whiteboard.managers
{
import mx.collections.ArrayCollection;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.TextObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.WhiteboardConstants;
public class Page extends ArrayCollection
{
private var isGrid:Boolean = false;;
public function Page(source:Array=null)
{
super(source);
}
public function toggleGrid():void {
isGrid = !isGrid;
}
public function isGridToggled():Boolean {
return isGrid;
}
public function addToPage(gobj:GraphicObject):void {
/*if(gobj.getGraphicType() == WhiteboardConstants.TYPE_SHAPE) {
if ((gobj as DrawObject).status != DrawObject.DRAW_END) return
} else if(gobj.getGraphicType() == WhiteboardConstants.TYPE_TEXT) {
if ((gobj as TextObject).status != TextObject.TEXT_PUBLISHED) return
}*/
if(!containsUniqueInPage(gobj.getGraphicID()))
this.addItem(gobj);
//else //LogUtil.error("Adding previously existing item to page: " + gobj.getGraphicID());
}
public function removeFromPage(gobj:GraphicObject):void {
this.removeItemAt(getIndexOf(gobj));
}
private function getIndexOf(gobj:GraphicObject):int {
var thisID:String = gobj.getGraphicID();
for(var i:int = 0; i < this.length; i++) {
var currObj:GraphicObject = this[i];
if(thisID == currObj.getGraphicID()) return i;
}
return -1;
}
private function getIndexOfID(id:String):int {
for(var i:int = 0; i < this.length; i++) {
var currObj:GraphicObject = this[i];
if(id == currObj.getGraphicID()) return i;
}
return -1;
}
public function modifyInPage(modifyingGobj:GraphicObject):void {
var indexToModify:int = getIndexOf(modifyingGobj);
this[indexToModify] = modifyingGobj;
}
public function containsUniqueInPage(id:String):Boolean {
for(var i:int = 0; i < this.length; i++) {
var currObj:GraphicObject = this[i];
if(id == currObj.getGraphicID()) return true;
}
return false;
}
public function containsInPage(modifyingGobj:GraphicObject):Boolean {
return this.contains(modifyingGobj);
}
}
}

View File

@ -25,41 +25,83 @@ package org.bigbluebutton.modules.whiteboard.managers
import mx.collections.ArrayCollection;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
import org.bigbluebutton.modules.whiteboard.events.PageEvent;
import org.bigbluebutton.modules.present.events.NavigationEvent;
import org.bigbluebutton.modules.present.events.PresentationEvent;
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.WhiteboardConstants;
import org.bigbluebutton.modules.whiteboard.events.PageEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
public class PageManager
{
private var pageNum:int;
private var pages:ArrayCollection;
private var dispatcher:Dispatcher;
public function PageManager()
{
public function PageManager() {
pageNum = 0;
pages = new ArrayCollection();
dispatcher = new Dispatcher();
}
<<<<<<< HEAD
public function addShapeToPage(e:WhiteboardUpdate):void {
(pages.getItemAt(pageNum) as ArrayCollection).addItem(e.data);
}
public function undoShapeFromPage():void {
var page:ArrayCollection = pages.getItemAt(pageNum) as ArrayCollection;
=======
public function addGraphicToPage(e:WhiteboardUpdate):void {
var gobjToAdd:GraphicObject = e.data as GraphicObject;
var currPage:Page = pages.getItemAt(pageNum) as Page;
if(gobjToAdd.getGraphicType() == WhiteboardConstants.TYPE_TEXT) {
if(checkIfModifiedText(currPage, gobjToAdd)) {
currPage.modifyInPage(gobjToAdd);
} else {
currPage.addToPage(gobjToAdd);
}
return;
}
currPage.addToPage(gobjToAdd);
}
public function checkIfModifiedText(pageToCheck:Page, gobj:GraphicObject):Boolean {
if(pageToCheck.containsUniqueInPage(gobj.getGraphicID())) return true;
return false;
}
public function undoGraphicFromPage():void {
var page:Page = pages.getItemAt(pageNum) as Page;
>>>>>>> ajay/bbb-whiteboard-additions
if (page.length > 0) page.removeItemAt(page.length - 1);
}
public function clearPage():void {
<<<<<<< HEAD
var page:ArrayCollection = pages.getItemAt(pageNum) as ArrayCollection;
page.removeAll();
}
=======
var page:Page = pages.getItemAt(pageNum) as Page;
page.removeAll();
}
public function toggleGrid():void {
var page:Page = pages.getItemAt(pageNum) as Page;
page.toggleGrid();
}
public function isGridToggled():Boolean {
var page:Page = pages.getItemAt(pageNum) as Page;
return page.isGridToggled();
}
>>>>>>> ajay/bbb-whiteboard-additions
public function loadPage(e:PageEvent):void {
if (pages.length ==0 ) return;
if ((pages.getItemAt(e.pageNum) as ArrayCollection).length == 0) return;
if ((pages.getItemAt(e.pageNum) as Page).length == 0) return;
var timer:Timer = new Timer(300, 1);
timer.addEventListener(TimerEvent.TIMER, defferedLoad);
@ -80,14 +122,15 @@ package org.bigbluebutton.modules.whiteboard.managers
var event:PageEvent = new PageEvent(PageEvent.CHANGE_PAGE);
event.pageNum = pageNumber;
this.pageNum = pageNumber;
event.shapes = this.pages.getItemAt(pageNumber) as ArrayCollection;
event.graphicObjs = this.pages.getItemAt(pageNumber) as Page;
event.isGrid = isGridToggled();
dispatcher.dispatchEvent(event);
}
public function createPages(e:PresentationEvent):void {
pages.removeAll();
for (var i:int = 0; i<e.numberOfSlides; i++){
pages.addItem(new ArrayCollection());
pages.addItem(new Page());
}
}

View File

@ -23,6 +23,7 @@ package org.bigbluebutton.modules.whiteboard.managers
import flash.events.TimerEvent;
import flash.utils.Timer;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.common.events.AddUIComponentToMainCanvas;
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.main.model.users.Conference;
@ -31,10 +32,12 @@ package org.bigbluebutton.modules.whiteboard.managers
import org.bigbluebutton.modules.present.events.AddOverlayCanvasEvent;
import org.bigbluebutton.modules.whiteboard.WhiteboardCanvasModel;
import org.bigbluebutton.modules.whiteboard.events.PageEvent;
import org.bigbluebutton.modules.whiteboard.events.ToggleGridEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
import org.bigbluebutton.modules.whiteboard.views.WhiteboardButton;
import org.bigbluebutton.modules.whiteboard.views.WhiteboardCanvas;
import org.bigbluebutton.modules.whiteboard.views.WhiteboardTextToolbar;
import org.bigbluebutton.modules.whiteboard.views.WhiteboardToolbar;
public class WhiteboardManager
@ -42,6 +45,7 @@ package org.bigbluebutton.modules.whiteboard.managers
private var globalDispatcher:Dispatcher;
private var highlighterCanvas:WhiteboardCanvas;
private var highlighterToolbar:WhiteboardToolbar;
private var textToolbar:WhiteboardTextToolbar;
private var whiteboardButton:WhiteboardButton;
private var model:WhiteboardCanvasModel = new WhiteboardCanvasModel();
@ -53,13 +57,17 @@ package org.bigbluebutton.modules.whiteboard.managers
if (highlighterCanvas != null) return;
highlighterCanvas = new WhiteboardCanvas();
highlighterCanvas.model = model;
model.wbCanvas = highlighterCanvas;
model.wbCanvas = highlighterCanvas;
if (highlighterToolbar != null) return;
highlighterToolbar = new WhiteboardToolbar();
highlighterToolbar.canvas = highlighterCanvas;
if (textToolbar != null) return;
textToolbar = new WhiteboardTextToolbar();
textToolbar.canvas = highlighterCanvas;
textToolbar.init();
highlighterCanvas.textToolbar = textToolbar;
if (whiteboardButton != null) return;
whiteboardButton = new WhiteboardButton();
//Necessary now because of module loading race conditions
var t:Timer = new Timer(1000, 1);
t.addEventListener(TimerEvent.TIMER, addHighlighterCanvas);
@ -74,27 +82,45 @@ package org.bigbluebutton.modules.whiteboard.managers
private function addHighlighterToolbar(e:TimerEvent):void{
// if (UserManager.getInstance().getConference().amIPresenter()) {
whiteboardButton.setVisible(true);
<<<<<<< HEAD
// }
PresentationAPI.getInstance().addButtonToToolbar(whiteboardButton);
=======
}
PresentationAPI.getInstance().addButtonToToolbar(whiteboardButton);
//highlighterCanvas.addRawChild(textToolbar);
>>>>>>> ajay/bbb-whiteboard-additions
}
public function positionToolbar(e:WhiteboardButtonEvent):void{
// add text toolbar for allowing customization of text
var addUIEvent:AddUIComponentToMainCanvas = new AddUIComponentToMainCanvas(AddUIComponentToMainCanvas.ADD_COMPONENT);
addUIEvent.component = highlighterToolbar;
globalDispatcher.dispatchEvent(addUIEvent);
highlighterToolbar.positionToolbar(e.window);
highlighterToolbar.stage.focus = highlighterToolbar;
var addTextToolbarEvent:AddUIComponentToMainCanvas = new AddUIComponentToMainCanvas(AddUIComponentToMainCanvas.ADD_COMPONENT);
addTextToolbarEvent.component = textToolbar;
globalDispatcher.dispatchEvent(addTextToolbarEvent);
textToolbar.positionToolbar(e.window);
}
public function drawSegment(event:WhiteboardUpdate):void{
model.drawSegment(event);
public function drawGraphic(event:WhiteboardUpdate):void{
model.drawGraphic(event);
}
public function clearBoard(event:WhiteboardUpdate = null):void{
model.clearBoard();
}
public function undoShape(event:WhiteboardUpdate):void{
model.undoShape();
public function undoGraphic(event:WhiteboardUpdate):void{
model.undoGraphic();
}
public function toggleGrid(event:ToggleGridEvent = null):void{
model.toggleGrid();
}
public function changePage(e:PageEvent):void{
@ -109,4 +135,4 @@ package org.bigbluebutton.modules.whiteboard.managers
highlighterCanvas.disableWhiteboard(e);
}
}
}
}

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
BigBlueButton open source conferencing system - http://www.bigbluebutton.org
Copyright (c) 2010 BigBlueButton Inc. and by respective authors (see below).
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 2.1 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, see <http://www.gnu.org/licenses/>.
$Id: $
-->
<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 mx.events.FlexEvent;
import org.bigbluebutton.main.events.ModuleStartedEvent;
import org.bigbluebutton.modules.present.events.AddButtonToPresentationEvent;
import org.bigbluebutton.modules.present.events.AddOverlayCanvasEvent;
import org.bigbluebutton.modules.present.events.NavigationEvent;
import org.bigbluebutton.modules.present.events.PresentationEvent;
import org.bigbluebutton.modules.present.events.WindowResizedEvent;
import org.bigbluebutton.modules.whiteboard.business.DrawProxy;
import org.bigbluebutton.modules.whiteboard.events.PageEvent;
import org.bigbluebutton.modules.whiteboard.events.StartWhiteboardModuleEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
import org.bigbluebutton.modules.whiteboard.managers.PageManager;
import org.bigbluebutton.modules.whiteboard.managers.WhiteboardManager;
import org.bigbluebutton.modules.whiteboard.views.WhiteboardCanvas;
private function dummyMethod():void{
}
]]>
</mx:Script>
<EventHandlers type="{FlexEvent.PREINITIALIZE}">
<ObjectBuilder generator="{WhiteboardManager}" cache="global" />
<ObjectBuilder generator="{DrawProxy}" cache="global" />
<ObjectBuilder generator="{PageManager}" cache="global" />
</EventHandlers>
<EventHandlers type="{WhiteboardPresenterEvent.MODIFY_ENABLED}" >
<MethodInvoker generator="{DrawProxy}" method="modifyEnabled" arguments="{event}" />
</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}" />
<MethodInvoker generator="{DrawProxy}" method="setActivePresentation" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{StartWhiteboardModuleEvent.START_HIGHLIGHTER_MODULE_EVENT}">
<MethodInvoker generator="{WhiteboardManager}" method="handleStartModuleEvent" />
<MethodInvoker generator="{DrawProxy}" method="connect" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{WhiteboardDrawEvent.CLEAR_BOARD}" >
<MethodInvoker generator="{DrawProxy}" method="clearBoard" />
</EventHandlers>
<EventHandlers type="{WhiteboardDrawEvent.SEND_SHAPE}">
<MethodInvoker generator="{DrawProxy}" method="sendShape" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{WhiteboardDrawEvent.SEND_TEXT}">
<MethodInvoker generator="{DrawProxy}" method="sendText" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{WhiteboardDrawEvent.UNDO_GRAPHIC}" >
<MethodInvoker generator="{DrawProxy}" method="undoGraphic" />
</EventHandlers>
<EventHandlers type="{ToggleGridEvent.TOGGLE_GRID}" >
<MethodInvoker generator="{DrawProxy}" method="toggleGrid" />
</EventHandlers>
<EventHandlers type="{WhiteboardUpdate.BOARD_UPDATED}">
<MethodInvoker generator="{PageManager}" method="addGraphicToPage" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{WhiteboardUpdate.GRAPHIC_UNDONE}" >
<MethodInvoker generator="{PageManager}" method="undoGraphicFromPage" />
</EventHandlers>
<EventHandlers type="{WhiteboardUpdate.BOARD_CLEARED}" >
<MethodInvoker generator="{PageManager}" method="clearPage" />
</EventHandlers>
<EventHandlers type="{PageEvent.CHANGE_PAGE}" >
<MethodInvoker generator="{DrawProxy}" method="getPageHistory" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{PageEvent.LOAD_PAGE}" >
<MethodInvoker generator="{PageManager}" method="loadPage" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{WhiteboardButtonEvent.WHITEBOARD_ADDED_TO_PRESENTATION}" >
<MethodInvoker generator="{WhiteboardManager}" method="positionToolbar" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{AddOverlayCanvasEvent.ADD_OVERLAY_CANVAS}" >
<InlineInvoker method="dummyMethod" />
</EventHandlers>
<EventHandlers type="{WindowResizedEvent.PRESENTATION_WINDOW_RESIZED_EVENT}">
<InlineInvoker method="dummyMethod" />
</EventHandlers>
<EventHandlers type="{AddButtonToPresentationEvent.ADD_BUTTON}">
<InlineInvoker method="dummyMethod" />
</EventHandlers>
<EventHandlers type="{NavigationEvent.GOTO_PAGE}">
<InlineInvoker method="dummyMethod" />
</EventHandlers>
<EventHandlers type="{PresentationEvent.PRESENTATION_LOADED}">
<InlineInvoker method="dummyMethod" />
</EventHandlers>
</EventMap>

View File

@ -35,6 +35,7 @@
import org.bigbluebutton.modules.whiteboard.business.DrawProxy;
import org.bigbluebutton.modules.whiteboard.events.PageEvent;
import org.bigbluebutton.modules.whiteboard.events.StartWhiteboardModuleEvent;
import org.bigbluebutton.modules.whiteboard.events.ToggleGridEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
@ -83,22 +84,34 @@
<MethodInvoker generator="{DrawProxy}" method="sendShape" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{WhiteboardDrawEvent.UNDO_SHAPE}" >
<MethodInvoker generator="{DrawProxy}" method="undoShape" />
<EventHandlers type="{WhiteboardDrawEvent.SEND_TEXT}">
<MethodInvoker generator="{DrawProxy}" method="sendText" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{WhiteboardDrawEvent.UNDO_GRAPHIC}" >
<MethodInvoker generator="{DrawProxy}" method="undoGraphic" />
</EventHandlers>
<EventHandlers type="{ToggleGridEvent.TOGGLE_GRID}" >
<MethodInvoker generator="{DrawProxy}" method="toggleGrid" />
</EventHandlers>
<EventHandlers type="{WhiteboardUpdate.BOARD_UPDATED}">
<MethodInvoker generator="{PageManager}" method="addShapeToPage" arguments="{event}" />
<MethodInvoker generator="{PageManager}" method="addGraphicToPage" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{WhiteboardUpdate.SHAPE_UNDONE}" >
<MethodInvoker generator="{PageManager}" method="undoShapeFromPage" />
<EventHandlers type="{WhiteboardUpdate.GRAPHIC_UNDONE}" >
<MethodInvoker generator="{PageManager}" method="undoGraphicFromPage" />
</EventHandlers>
<EventHandlers type="{WhiteboardUpdate.BOARD_CLEARED}" >
<MethodInvoker generator="{PageManager}" method="clearPage" />
</EventHandlers>
<EventHandlers type="{ToggleGridEvent.GRID_TOGGLED}" >
<MethodInvoker generator="{PageManager}" method="toggleGrid" />
</EventHandlers>
<EventHandlers type="{PageEvent.CHANGE_PAGE}" >
<MethodInvoker generator="{DrawProxy}" method="getPageHistory" arguments="{event}" />
</EventHandlers>
@ -135,10 +148,13 @@
<MethodInvoker generator="{WhiteboardManager}" method="clearBoard" arguments="{event}"/>
</EventHandlers>
<EventHandlers type="{WhiteboardUpdate.BOARD_UPDATED}" >
<MethodInvoker generator="{WhiteboardManager}" method="drawSegment" arguments="{event}"/>
<MethodInvoker generator="{WhiteboardManager}" method="drawGraphic" arguments="{event}"/>
</EventHandlers>
<EventHandlers type="{WhiteboardUpdate.SHAPE_UNDONE}" >
<MethodInvoker generator="{WhiteboardManager}" method="undoShape" arguments="{event}" />
<EventHandlers type="{WhiteboardUpdate.GRAPHIC_UNDONE}" >
<MethodInvoker generator="{WhiteboardManager}" method="undoGraphic" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{ToggleGridEvent.GRID_TOGGLED}" >
<MethodInvoker generator="{WhiteboardManager}" method="toggleGrid" arguments="{event}" />
</EventHandlers>
<EventHandlers type="{PageEvent.CHANGE_PAGE}" >
<MethodInvoker generator="{WhiteboardManager}" method="changePage" arguments="{event}" />

View File

@ -0,0 +1,186 @@
// taken from newtriks' GitHub Gist
// at https://gist.github.com/505255
package org.bigbluebutton.modules.whiteboard.views
{
import flash.display.DisplayObject;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.ui.Keyboard;
import mx.controls.PopUpButton;
import mx.core.UIComponent;
import mx.core.UIComponentGlobals;
import mx.core.mx_internal;
import mx.effects.Tween;
import mx.events.InterManagerRequest;
import mx.managers.ISystemManager;
import mx.managers.PopUpManager;
use namespace mx_internal;
public class PopUpCombo extends PopUpButton
{
public var isOpen:Boolean = false;
protected var _inTween:Boolean = false;
protected var _tween:Tween;
private var _specificOpenDirection:String;
public static const OPEN_UP:String = "OPEN_UP";
public static const OPEN_DOWN:String = "OPEN_DOWN";
public function PopUpCombo()
{
super();
}
public function get specificOpenDirection():String
{
if(!_specificOpenDirection) _specificOpenDirection = PopUpCombo.OPEN_DOWN;
return _specificOpenDirection;
}
public function set specificOpenDirection(value:String):void
{
_specificOpenDirection = value;
}
override protected function clickHandler(event:MouseEvent):void
{
event.stopImmediatePropagation();
displayPopUp();
}
override protected function keyDownHandler(event:KeyboardEvent):void
{
super.keyDownHandler(event);
if (event.ctrlKey && event.keyCode == Keyboard.DOWN)
{
event.stopImmediatePropagation();
displayPopUp();
}
}
public function displayPopUp():void
{
var show:Boolean = !isOpen;
var popUpGap:Number = getStyle("popUpGap");
var point:Point = new Point(0, unscaledHeight + popUpGap);
point = localToGlobal(point);
var initY:Number;
var endY:Number;
var easingFunction:Function;
var duration:Number;
if (popUp.parent == null)
{
PopUpManager.addPopUp(popUp, this, false);
popUp.owner = this;
}
else
PopUpManager.bringToFront(popUp);
if(show)
{
if(specificOpenDirection == PopUpCombo.OPEN_UP)
{
point.y -= (unscaledHeight + popUp.height + 2*popUpGap);
initY = -popUp.height;
}
else
{
initY = popUp.height;
}
point.x = Math.min( point.x, visibleScreen.right - popUp.getExplicitOrMeasuredWidth());
point.x = Math.max( point.x, 0);
point = popUp.parent.globalToLocal(point);
if (popUp.x != point.x || popUp.y != point.y)
popUp.move(point.x, point.y);
popUp.scrollRect = new Rectangle(0, initY,
popUp.width, popUp.height);
if (!popUp.visible)
popUp.visible = true;
endY = 0;
isOpen = show;
duration = getStyle("openDuration");
easingFunction = getStyle("openEasingFunction") as Function;
}
else
{
isOpen = show;
if (popUp.parent == null)
return;
point = popUp.parent.globalToLocal(point);
endY = (specificOpenDirection == PopUpCombo.OPEN_UP) ? -popUp.height - 2 : popUp.height + 2;
initY = 0;
duration = getStyle("closeDuration")
easingFunction = getStyle("closeEasingFunction") as Function;
}
_inTween = true;
UIComponentGlobals.layoutManager.validateNow();
// Block all layout, responses from web service, and other background
// processing until the tween finishes executing.
UIComponent.suspendBackgroundProcessing();
_tween = new Tween(this, initY, endY, duration);
if (easingFunction != null)
_tween.easingFunction = easingFunction;
}
protected function get visibleScreen():Rectangle
{
var sm:ISystemManager = systemManager.topLevelSystemManager;
var sbRoot:DisplayObject = sm.getSandboxRoot();
var _screen:Rectangle;
if (sm != sbRoot)
{
var request:InterManagerRequest = new InterManagerRequest(InterManagerRequest.SYSTEM_MANAGER_REQUEST,
false, false,
"getVisibleApplicationRect");
sbRoot.dispatchEvent(request);
_screen = Rectangle(request.value);
}
else
_screen = sm.getVisibleApplicationRect();
return _screen;
}
override mx_internal function onTweenUpdate(value:Number):void
{
popUp.scrollRect =
new Rectangle(0, value, popUp.width, popUp.height);
}
override mx_internal function onTweenEnd(value:Number):void
{
popUp.scrollRect =
new Rectangle(0, value, popUp.width, popUp.height);
_inTween = false;
UIComponent.resumeBackgroundProcessing();
if (!isOpen)
{
popUp.visible = false;
popUp.scrollRect = null;
}
}
}
}

View File

@ -29,10 +29,11 @@
import mx.core.Application;
import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.modules.present.ui.views.PresentationWindow;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
import org.bigbluebutton.modules.present.ui.views.PresentationWindow;
import org.bigbluebutton.util.i18n.ResourceUtil;
private var images:Images = new Images();
@ -97,6 +98,10 @@
public function presenterChanged(isPresenter:Boolean, presenterName:String):void{
setComponentEnabled(isPresenter);
this.isPresenter = isPresenter;
if(isPresenter) {
LogUtil.debug("MADE PRESENTER ENABLING WHITEBOARD");
sendEnableWhiteboardEvent();
}
}
]]>

View File

@ -21,6 +21,7 @@
-->
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%" xmlns:mate="http://mate.asfusion.com/"
<<<<<<< HEAD
creationComplete="init()" visible="false"
implements="org.bigbluebutton.common.IBbbCanvas">
<mx:Script>
@ -29,30 +30,44 @@
// mouseDown="doMouseDown()" mouseMove="doMouseMove()" mouseUp="doMouseUp()" mouseOver="setCursor()" mouseOut="removeCursor()"
import mx.collections.ArrayCollection;
import mx.core.Application;
=======
mouseDown="doMouseDown()" mouseMove="doMouseMove()" mouseUp="doMouseUp()" creationComplete="init()" visible="false"
mouseOver="setCursor(toolType)" mouseOut="removeCursor()" doubleClickEnabled="true" doubleClick="doMouseDoubleClick()" implements="org.bigbluebutton.common.IBbbCanvas">
<mx:Script>
<![CDATA[
>>>>>>> ajay/bbb-whiteboard-additions
import mx.managers.CursorManager;
import org.bigbluebutton.common.IBbbCanvas;
import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.modules.present.events.WindowResizedEvent;
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.modules.whiteboard.WhiteboardCanvasModel;
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObjectFactory;
import org.bigbluebutton.modules.whiteboard.business.shapes.ShapeFactory;
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.SelectObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.TextObject;
import org.bigbluebutton.modules.whiteboard.events.PageEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardUpdate;
import org.bigbluebutton.modules.whiteboard.maps.WhiteboardEventMap;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardSettingResetEvent;
public var model:WhiteboardCanvasModel;
public var model:WhiteboardCanvasModel;
public var textToolbar:WhiteboardTextToolbar;
private var bbbCanvas:IBbbCanvas;
private var _xPosition:int;
private var _yPosition:int;
private var images:Images = new Images();
[Bindable] private var select_icon:Class = images.select_icon;
[Bindable] private var pencil_icon:Class = images.pencil_icon;
[Bindable] private var rectangle_icon:Class = images.square_icon;
[Bindable] private var triangle_icon:Class = images.triangle_icon;
[Bindable] private var ellipse_icon:Class = images.circle_icon;
[Bindable] private var line_icon:Class = images.line_icon;
[Bindable] private var text_icon:Class = images.text_icon;
[Bindable] private var eraser_icon:Class = images.eraser_icon;
[Bindable] private var highlighter_icon:Class = images.highlighter_icon;
private var toolType:String = DrawObject.PENCIL;
private var whiteboardEnabled:Boolean = false;
private var showWhiteboard:Boolean = true;
@ -77,8 +92,17 @@
private function doMouseUp(event:Event):void {
model.doMouseUp();
}
<<<<<<< HEAD
private function doMouseDown(event:Event):void {
=======
private function doMouseDoubleClick():void{
model.doMouseDoubleClick(this.mouseX, this.mouseY);
}
private function doMouseDown():void{
>>>>>>> ajay/bbb-whiteboard-additions
model.doMouseDown(this.mouseX, this.mouseY);
}
@ -86,6 +110,7 @@
model.doMouseMove(this.mouseX, this.mouseY);
}
<<<<<<< HEAD
public function sendShapeToServer(dobj:DrawObject):void {
var event:WhiteboardDrawEvent = new WhiteboardDrawEvent(WhiteboardDrawEvent.SEND_SHAPE);
event.message = dobj;
@ -101,9 +126,44 @@
}
public function changeThickness(e:Event):void {
=======
public function sendGraphicToServer(gobj:GraphicObject, type:String):void{
var event:WhiteboardDrawEvent =
new WhiteboardDrawEvent(type);
event.message = gobj;
dispatchEvent(event);
}
public function setGraphicType(type:String):void{
model.setGraphicType(type);
}
public function setTool(s:String):void{
model.setTool(s);
toolType = s;
}
public function changeColor(e:Event):void{
model.changeColor(e.target.selectedColor);
}
public function changeFillColor(e:Event):void{
model.changeFillColor(e.target.selectedColor);
}
public function changeThickness(e:Event):void{
>>>>>>> ajay/bbb-whiteboard-additions
model.changeThickness(e.target.value);
}
public function toggleFill():void {
model.toggleFill();
}
public function toggleTransparency():void {
model.toggleTransparency();
}
public function get xPosition():int {
return _xPosition;
}
@ -119,16 +179,53 @@
public function set yPosition(y:int):void {
_yPosition = y;
}
public function modifySelectedTextObject(fgColor:uint, bgColorVisible:Boolean, backgroundColor:uint, textSize:Number):void {
model.modifySelectedTextObject(fgColor, bgColorVisible, backgroundColor, textSize);
}
public function makeTextObjectsEditable(e:MadePresenterEvent):void {
model.makeTextObjectsEditable(e);
}
public function makeTextObjectsUneditable(e:MadePresenterEvent):void {
model.makeTextObjectsUneditable(e);
}
private function setWhiteboardVisibility():void{
if (this.whiteboardEnabled && this.showWhiteboard) this.visible = true;
else this.visible = false;
}
private function setCursor():void{
/* added this functionality in WhiteboardToolbar.mxml
instead to allow a variety of cursors */
public function setCursorPencil():void{
CursorManager.setCursor(pencil_icon);
}
public function setCursor(toolType:String):void{
if(toolType == DrawObject.ELLIPSE) {
CursorManager.setCursor(ellipse_icon);
} else if(toolType == DrawObject.RECTANGLE) {
CursorManager.setCursor(rectangle_icon);
} else if(toolType == DrawObject.TRIANGLE) {
CursorManager.setCursor(triangle_icon);
} else if(toolType == DrawObject.PENCIL) {
CursorManager.setCursor(pencil_icon);
} else if(toolType == DrawObject.LINE) {
CursorManager.setCursor(line_icon);
} else if(toolType == DrawObject.HIGHLIGHTER) {
CursorManager.setCursor(highlighter_icon);
} else if(toolType == DrawObject.ERASER) {
CursorManager.setCursor(eraser_icon);
} else if(toolType == TextObject.TEXT_TOOL) {
CursorManager.setCursor(text_icon);
} else if(toolType == SelectObject.SELECT_TOOL) {
CursorManager.setCursor(select_icon);
}
}
private function removeCursor():void{
CursorManager.removeCursor(CursorManager.currentCursorID);
doMouseUp(null);
@ -164,20 +261,21 @@
return [this.mouseX, this.mouseY];
}
public function removeShape(child:DisplayObject):void {
public function removeGraphic(child:DisplayObject):void {
if (bbbCanvas == null) return;
if (doesContain(child)) removeRawChild(child);
}
public function addShape(child:DisplayObject):void {
public function addGraphic(child:DisplayObject):void {
if (bbbCanvas == null) return;
addRawChild(child);
}
public function zoomCanvas(width:Number, height:Number):void {
this.width = width;
this.height = height;
model.zoomCanvas(width, height);
textToolbar.adjustForZoom(width, height);
}
public function showCanvas(show:Boolean):void{

View File

@ -0,0 +1,317 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
BigBlueButton open source conferencing system - http://www.bigbluebutton.org
Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
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 2.1 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, see <http://www.gnu.org/licenses/>.
Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
-->
<mx:HBox xmlns="flexlib.containers.*" xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:mate="http://mate.asfusion.com/" visible="false" backgroundColor="0xCCCCCC"
cornerRadius="5" borderStyle="solid"
paddingBottom="3" paddingTop="3" paddingLeft="3" paddingRight="3" alpha="0"
xmlns:views="org.bigbluebutton.modules.whiteboard.views.*" xmlns:local="*">
<mate:Listener type="{MadePresenterEvent.SWITCH_TO_PRESENTER_MODE}" method="presenterMode" />
<mate:Listener type="{MadePresenterEvent.SWITCH_TO_VIEWER_MODE}" method="viewerMode" />
<mate:Listener type="{WhiteboardButtonEvent.DISABLE_WHITEBOARD}" method="disableTextToolbar" />
<mate:Listener type="{StopWhiteboardModuleEvent.STOP_HIGHLIGHTER_MODULE_EVENT}" method="closeToolbar" />
<mate:Listener type="{GraphicObjectFocusEvent.OBJECT_SELECTED}" method="handleObjSelected" />
<mate:Listener type="{GraphicObjectFocusEvent.OBJECT_DESELECTED}" method="handleObjDeselected" />
<!--<mx:Style>
.colorPickerStyle {
backgroundColor:#E5E6E7;
columnCount:12;
horizontalGap:0;
previewHeight:22;
previewWidth:45;
swatchGridBackgroundColor:#000000;
swatchGridBorderSize:0;
swatchHeight:60;
swatchHighlightColor:#FFFFFF;
swatchHighlightSize:1;
swatchWidth:12;
textFieldWidth:72;
verticalGap:0;
}
</mx:Style>-->
<mx:Script>
<![CDATA[
import mx.controls.Menu;
import mx.events.MenuEvent;
import mx.events.MoveEvent;
import mx.events.ResizeEvent;
import mx.managers.FocusManager;
import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.modules.present.ui.views.PresentationWindow;
import org.bigbluebutton.modules.whiteboard.business.shapes.TextObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.WhiteboardConstants;
import org.bigbluebutton.modules.whiteboard.events.GraphicObjectFocusEvent;
import org.bigbluebutton.modules.whiteboard.events.StopWhiteboardModuleEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
import org.bigbluebutton.util.i18n.ResourceUtil;
import org.hamcrest.object.nullValue;
public var canvas:WhiteboardCanvas;
public var textColor:uint;
public var bgColor:uint;
public var textSize:Number;
public var backgroundVisible:Boolean;
private var images:Images = new Images();
[Bindable] private var toggle_text_background_icon:Class = images.toggle_text_background_icon;
private var currentlySelectedTextObject:TextObject = null;
private var presentationWindow:PresentationWindow;
private var normalAlpha:Number = 0.55;
private var focusedAlpha:Number = 1.0;
private var hasFocus:Boolean;
public function init():void {
this.alpha = normalAlpha;
this.visible = true;
this.addEventListener(MouseEvent.ROLL_OVER, makeFocused);
this.addEventListener(MouseEvent.ROLL_OUT, makeDim);
/* WARNING: enabling the following code caused some nasty issues with the whiteboard
It is kept here for reference
*/
/*this.textColor = ctextpik.selectedColor = 0x000000;
this.bgColor = cbackpik.selectedColor = 0x000000;
this.backgroundVisible = btnToggleBackground.selected = false;
this.textSizeMenu.label = "14";
this.textSize = Number(textSizeMenu.label);*/
}
/* Following two methods are used for aesthetics when mouse hovers over TextToolbar
and when it hovers out of it
*/
public function makeDim(event:MouseEvent):void {
this.alpha = normalAlpha;
}
public function makeFocused(event:MouseEvent):void {
this.alpha = focusedAlpha;
}
private function initTextSizeMenu(): void {
var m:Menu = new Menu();
m.variableRowHeight = true;
var textSizeMenuData:Object = [
{label: "12"},
{label: "14"},
{label: "16"},
{label: "18"},
{label: "22"},
{label: "24"},
{label: "32"},
{label: "36"}
];
m.dataProvider = textSizeMenuData;
m.addEventListener(MenuEvent.CHANGE, textSizeMenuClick);
m.showRoot = false;
textSizeMenu.popUp = m;
}
// Define the event listener for the Menu control's change event.
private function textSizeMenuClick(event:MenuEvent):void {
enableTextToolbar();
textSizeMenu.displayPopUp();
var newTextSize:Number = Number(event.label);
setTextSize(newTextSize);
}
/**
* Sets the text color of the selected text object
* @param e The event
*
*/
protected function setTextColor(e:Event):void{
enableTextToolbar();
this.textColor = e.target.selectedColor;
canvas.modifySelectedTextObject(textColor, backgroundVisible, bgColor, textSize);
canvas.stage.focus = currentlySelectedTextObject;
}
/**
* Sets the background color of the selected text object
* @param e The event
*
*/
protected function changeTextBackgroundColor(e:Event):void{
enableTextToolbar();
this.bgColor = e.target.selectedColor;
canvas.modifySelectedTextObject(textColor, backgroundVisible, bgColor, textSize);
canvas.stage.focus = currentlySelectedTextObject;
}
/**
* Sets the background color visible of the selected text object
* @param e The event
*
*/
protected function setBackgroundVisible(e:Event):void{
enableTextToolbar();
this.backgroundVisible = e.target.selected;
canvas.modifySelectedTextObject(textColor, backgroundVisible, bgColor, textSize);
canvas.stage.focus = currentlySelectedTextObject;
}
/**
* Sets the text size of the selected text object
* @param size the size to set for the selected text object
*
*/
protected function setTextSize(size:Number):void {
enableTextToolbar();
this.textSize = size;
LogUtil.debug("Text size set to: " + size);
textSizeMenu.label = String(this.textSize);
canvas.modifySelectedTextObject(textColor, backgroundVisible, bgColor, textSize);
}
private function presenterMode(e:MadePresenterEvent):void{
}
private function viewerMode(e:MadePresenterEvent):void{
disableTextToolbar();
}
private function enableTextToolbar():void{
this.visible = true;
}
private function disableTextToolbar():void{
this.visible = false;
}
private function closeToolbar(e:StopWhiteboardModuleEvent):void{
parent.removeChild(this);
}
public function syncPropsWith(tobj:TextObject):void{
if(tobj == null) return;
currentlySelectedTextObject = tobj;
this.textColor = ctextpik.selectedColor = tobj.textColor;
this.bgColor = cbackpik.selectedColor = tobj.backgroundColor;
this.backgroundVisible = btnToggleBackground.selected = tobj.background;
this.textSizeMenu.label = String(tobj.textSize);
this.textSize = tobj.textSize;
}
// invoked by WhiteboardManager when the TextToolbar is first loaded
public function positionToolbar(window:PresentationWindow):void{
this.presentationWindow = window;
presentationWindow.addEventListener(ResizeEvent.RESIZE, repositionToolbarByWindow);
presentationWindow.addEventListener(MouseEvent.CLICK, repositionToolbarByWindow);
presentationWindow.addEventListener(MoveEvent.MOVE, repositionToolbarByWindow);
disableTextToolbar();
this.x = 0;
this.y = 0;
parent.setChildIndex(this, parent.numChildren-1);
}
/* required for repositioning the TextToolbar when an event occurs
on the presentation window
*/
public function repositionToolbarByWindow(event:Event = null):void {
repositionToolbar();
}
public function repositionToolbar(tobj:TextObject = null):void {
// translate TextObject's coords to stage coords because TextToolbar is added to stage
if(tobj == null) tobj = currentlySelectedTextObject;
if(textSizeMenu.isOpen) {
LogUtil.debug("Text size menu is open...trying to close");
textSizeMenu.displayPopUp();
}
var loc:Point = canvas.localToGlobal(new Point(tobj.x, tobj.y));
this.x = loc.x;
this.y = loc.y - this.height - 45;
parent.setChildIndex(this, parent.numChildren-1);
}
// repositions the toolbar when canvas is zoomed
public function adjustForZoom(x:Number, y:Number):void {
if(currentlySelectedTextObject == null) return;
repositionToolbar(currentlySelectedTextObject);
}
private function handleObjSelected(event:GraphicObjectFocusEvent):void {
if(event.data.getGraphicType() != WhiteboardConstants.TYPE_TEXT) return;
var tobj:TextObject = event.data as TextObject;
repositionToolbar(tobj);
syncPropsWith(tobj);
enableTextToolbar();
LogUtil.debug("!!!!SELECTED:" + " " + tobj.getProperties());
}
private function handleObjDeselected(event:GraphicObjectFocusEvent):void {
if(event.data.getGraphicType() != WhiteboardConstants.TYPE_TEXT) return;
var tobj:TextObject = event.data as TextObject;
/* checks if the new focus of the stage is not the TextToolbar, and if not,
hide the text toolbar. This is to prevent the TextToolbar from disappearing as
soon as the user changes focus.
*/
if(!containsFocus(this)) {
disableTextToolbar();
textSizeMenu.close();
}
LogUtil.debug("!!!!DESELECTED:" + " " + tobj.getProperties());
}
/* used to check whether or not the TextToolbar and its children have focus when
checking whether or not it should be made visible=false. see handleObjDeselected().
*/
private function containsFocus(obj:DisplayObjectContainer):Boolean {
if(obj.stage.focus == obj) return true;
for (var i:int = 0; i < obj.numChildren; i++) {
var currObj:DisplayObject = obj.getChildAt(i);
if(obj.stage.focus == currObj) return true;
}
return false;
}
]]>
</mx:Script>
<mx:ColorPicker width="20" height="20" change="setTextColor(event)" id="ctextpik" selectedColor="0x000000"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.texttoolbar.textColorPicker')}"/>
<mx:Spacer width="3" />
<mx:Button width="20" height="20" id="btnToggleBackground" click="setBackgroundVisible(event)" icon="{toggle_text_background_icon}"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.texttoolbar.backColorVisible')}" toggle="true"/>
<mx:ColorPicker width="20" height="20" change="changeTextBackgroundColor(event)" id="cbackpik" selectedColor="0x000000"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.texttoolbar.backColorPicker')}"/>
<views:PopUpCombo id="textSizeMenu" creationComplete="initTextSizeMenu()"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.texttoolbar.textSizeMenu')}"
openAlways="true" specificOpenDirection="{PopUpCombo.OPEN_UP}" />
</mx:HBox>

View File

@ -30,6 +30,11 @@
<mate:Listener type="{WhiteboardButtonEvent.ENABLE_WHITEBOARD}" method="enableWhiteboard" />
<mate:Listener type="{StopWhiteboardModuleEvent.STOP_HIGHLIGHTER_MODULE_EVENT}" method="closeToolbar" />
<mate:Listener type="{WhiteboardButtonEvent.CHANGE_TO_PENCIL}" method="setShapeToPencil" />
<mate:Listener type="{WhiteboardSettingResetEvent.FILL_CHANGED}" method="resetFill" />
<mate:Listener type="{WhiteboardSettingResetEvent.TRANSPARENCY_CHANGED}" method="resetTransparent" />
<mate:Listener type="{WhiteboardSettingResetEvent.GRID_CHANGED}" method="resetGrid" />
<mate:Listener type="{GraphicObjectFocusEvent.OBJECT_SELECTED}" method="graphicObjSelected" />
<mate:Listener type="{GraphicObjectFocusEvent.OBJECT_DESELECTED}" method="graphicObjDeselected" />
<mx:Style>
.colorPickerStyle {
@ -52,6 +57,7 @@
<mx:Script>
<![CDATA[
<<<<<<< HEAD
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.MoveEvent;
@ -67,6 +73,31 @@
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
import org.bigbluebutton.util.i18n.ResourceUtil;
=======
import mx.controls.Alert;
import mx.events.MoveEvent;
import mx.events.ResizeEvent;
import mx.managers.CursorManager;
import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.modules.present.events.PresentationEvent;
import org.bigbluebutton.modules.present.ui.views.PresentationWindow;
import org.bigbluebutton.modules.whiteboard.business.shapes.DrawObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.GraphicObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.SelectObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.TextObject;
import org.bigbluebutton.modules.whiteboard.business.shapes.WhiteboardConstants;
import org.bigbluebutton.modules.whiteboard.events.GraphicObjectFocusEvent;
import org.bigbluebutton.modules.whiteboard.events.StopWhiteboardModuleEvent;
import org.bigbluebutton.modules.whiteboard.events.ToggleGridEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardButtonEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardDrawEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardPresenterEvent;
import org.bigbluebutton.modules.whiteboard.events.WhiteboardSettingResetEvent;
import org.bigbluebutton.util.i18n.ResourceUtil;
>>>>>>> ajay/bbb-whiteboard-additions
private var images:Images = new Images();
[Bindable] private var hand_icon:Class = images.hand_icon;
@ -77,21 +108,37 @@
[Bindable] private var ellipse_icon:Class = images.circle_icon;
[Bindable] private var thick_icon:Class = images.whiteboard_thick;
[Bindable] private var thin_icon:Class = images.whiteboard_thin;
<<<<<<< HEAD
[Bindable] private var scribble_icon:Class = images.scribble_icon;
[Bindable] private var text_icon:Class = images.text_icon;
=======
[Bindable] private var triangle_icon:Class = images.triangle_icon;
[Bindable] private var line_icon:Class = images.line_icon;
[Bindable] private var fill_icon:Class = images.fill_icon;
[Bindable] private var transparency_icon:Class = images.transparency_icon;
[Bindable] private var text_icon:Class = images.text_icon;
[Bindable] private var eraser_icon:Class = images.eraser_icon;
[Bindable] private var highlighter_icon:Class = images.highlighter_icon;
[Bindable] private var select_icon:Class = images.select_icon;
[Bindable] private var grid_icon:Class = images.grid_icon;
>>>>>>> ajay/bbb-whiteboard-additions
public var canvas:WhiteboardCanvas;
private var presentationWindow:PresentationWindow;
[Bindable] private var colorPickerColours:Array = ['0x000000', '0xFFFFFF' , '0xFF0000', '0xFF8800',
'0xCCFF00', '0x00FF00', '0x00FF88', '0x00FFFF',
'0x0088FF', '0x0000FF', '0x8800FF', '0xFF00FF'];
'0x0088FF', '0x0000FF', '0x8800FF', '0xFF00FF',
'0xC0C0C0'
];
/**
* Sets the type of shape we're drawing (pencil, rectangle, etc...)
* @param s The type
*
*/
<<<<<<< HEAD
protected function setShape(s:String):void{
canvas.setShape(s);
@ -121,10 +168,138 @@
btnText.selected = true;
break;
}
=======
protected function setTool(gType:String, toolType:String):void{
if(gType == WhiteboardConstants.TYPE_SHAPE) {
canvas.setGraphicType(gType);
canvas.setTool(toolType);
if(!btnToggleTransparency.enabled)
btnToggleTransparency.enabled = true;
if(!btnToggleFill.enabled)
btnToggleFill.enabled = true;
switch(toolType){
case DrawObject.PENCIL:
btnSelect.selected = false;
btnPenc.selected = true;
btnEllipse.selected = false;
btnRectangle.selected = false;
btnTriangle.selected = false;
btnLine.selected = false;
btnText.selected = false;
btnHighl.selected = false;
btnEraser.selected = false;
btnToggleFill.enabled = false;
btnToggleTransparency.enabled = false;
break;
case DrawObject.HIGHLIGHTER:
btnSelect.selected = false;
btnPenc.selected = false;
btnEllipse.selected = false;
btnRectangle.selected = false;
btnTriangle.selected = false;
btnLine.selected = false;
btnText.selected = false;
btnHighl.selected = true;
btnEraser.selected = false;
btnToggleFill.enabled = false;
btnToggleTransparency.enabled = false;
break;
case DrawObject.ELLIPSE:
btnSelect.selected = false;
btnPenc.selected = false;
btnEllipse.selected = true;
btnRectangle.selected = false;
btnTriangle.selected = false;
btnLine.selected = false;
btnText.selected = false;
btnHighl.selected = false;
btnEraser.selected = false;
break;
case DrawObject.RECTANGLE:
btnSelect.selected = false;
btnPenc.selected = false;
btnEllipse.selected = false;
btnRectangle.selected = true;
btnTriangle.selected = false;
btnLine.selected = false;
btnText.selected = false;
btnHighl.selected = false;
btnEraser.selected = false;
break;
case DrawObject.TRIANGLE:
btnSelect.selected = false;
btnPenc.selected = false;
btnEllipse.selected = false;
btnRectangle.selected = false;
btnTriangle.selected = true;
btnLine.selected = false;
btnText.selected = false;
btnHighl.selected = false;
btnEraser.selected = false;
break;
case DrawObject.LINE:
btnSelect.selected = false;
btnPenc.selected = false;
btnEllipse.selected = false;
btnRectangle.selected = false;
btnTriangle.selected = false;
btnLine.selected = true;
btnText.selected = false;
btnHighl.selected = false;
btnEraser.selected = false;
btnToggleFill.enabled = false;
break;
case DrawObject.ERASER:
btnSelect.selected = false;
btnPenc.selected = false;
btnEllipse.selected = false;
btnRectangle.selected = false;
btnTriangle.selected = false;
btnLine.selected = false;
btnText.selected = false;
btnHighl.selected = false;
btnEraser.selected = true;
btnToggleFill.enabled = false;
btnToggleTransparency.enabled = false;
break;
}
} else if (gType == WhiteboardConstants.TYPE_TEXT) {
btnSelect.selected = false;
btnPenc.selected = false;
btnEllipse.selected = false;
btnRectangle.selected = false;
btnTriangle.selected = false;
btnLine.selected = false;
btnText.selected = true;
btnHighl.selected = false;
btnEraser.selected = false;
btnToggleFill.enabled = false;
btnToggleTransparency.enabled = false;
canvas.setGraphicType(gType);
canvas.setTool(toolType);
} else if (gType == WhiteboardConstants.TYPE_SELECTION) {
switch(toolType) {
case SelectObject.SELECT_TOOL:
btnSelect.selected = true;
btnPenc.selected = false;
btnEllipse.selected = false;
btnRectangle.selected = false;
btnLine.selected = false;
btnText.selected = false;
btnHighl.selected = false;
btnEraser.selected = false;
btnToggleFill.enabled = false;
btnToggleTransparency.enabled = false;
break;
}
canvas.setGraphicType(gType);
canvas.setTool(toolType);
}
>>>>>>> ajay/bbb-whiteboard-additions
}
private function setShapeToPencil(e:WhiteboardButtonEvent):void{
this.setShape(DrawObject.PENCIL);
this.setTool(WhiteboardConstants.TYPE_SHAPE, DrawObject.PENCIL);
}
/**
@ -136,6 +311,15 @@
canvas.changeColor(e);
}
/**
* Sets the fill color
* @param e event containing the color (e.target.selectedColor)
*
*/
protected function changeFillColor(e:Event):void{
canvas.changeFillColor(e);
}
/**
* Sets the thickness
* @param e event containing the thickness (e.target.value)
@ -145,14 +329,32 @@
canvas.changeThickness(e);
}
protected function toggleFill():void{
canvas.toggleFill();
}
protected function toggleTransparency():void{
canvas.toggleTransparency();
}
protected function resetFill(e:WhiteboardSettingResetEvent):void{
btnToggleFill.enabled = e.value;
}
protected function resetTransparent(e:WhiteboardSettingResetEvent):void{
btnToggleTransparency.selected = e.value;
}
protected function resetGrid(e:WhiteboardSettingResetEvent):void{
btnToggleGrid.selected = e.value;
}
private function presenterMode(e:MadePresenterEvent):void{
//this.visible = true;
canvas.makeTextObjectsEditable(e);
}
private function viewerMode(e:MadePresenterEvent):void{
//this.visible = false;
//disableWhiteboard();
canvas.makeTextObjectsUneditable(e);
}
private function showToolbar(e:PresentationEvent):void{
@ -160,21 +362,16 @@
}
private function sendUndoCommand():void{
if (!canvas.isPageEmpty()) dispatchEvent(new WhiteboardDrawEvent(WhiteboardDrawEvent.UNDO_SHAPE));
if (!canvas.isPageEmpty())
dispatchEvent(new WhiteboardDrawEvent(WhiteboardDrawEvent.UNDO_GRAPHIC));
}
private function enableWhiteboard(event:WhiteboardButtonEvent = null):void{
this.visible = true;
/*var e:HighlighterPresenterEvent = new HighlighterPresenterEvent(HighlighterPresenterEvent.MODIFY_ENABLED);
e.enabled = true;
dispatchEvent(e);*/
}
private function disableWhiteboard(event:WhiteboardButtonEvent = null):void{
this.visible = false;
/*var e:HighlighterPresenterEvent = new HighlighterPresenterEvent(HighlighterPresenterEvent.MODIFY_ENABLED);
e.enabled = false;
dispatchEvent(e);*/
}
public function positionToolbar(window:PresentationWindow):void{
@ -182,20 +379,21 @@
presentationWindow.addEventListener(MoveEvent.MOVE, setPositionAndDepth);
presentationWindow.addEventListener(ResizeEvent.RESIZE, setPositionAndDepth);
presentationWindow.addEventListener(MouseEvent.CLICK, setPositionAndDepth);
this.x = presentationWindow.x + presentationWindow.width + 3;
this.y = presentationWindow.y + 30;
this.x = presentationWindow.x - this.width - 3;
this.y = presentationWindow.y;
parent.setChildIndex(this, parent.numChildren-1);
}
private function setPositionAndDepth(e:Event = null):void{
this.x = presentationWindow.x + presentationWindow.width + 3;
this.y = presentationWindow.y + 30;
this.x = presentationWindow.x - this.width - 3;
this.y = presentationWindow.y;
parent.setChildIndex(this, parent.numChildren-1);
}
private function closeToolbar(e:StopWhiteboardModuleEvent):void{
parent.removeChild(this);
}
<<<<<<< HEAD
[Bindable]
public var cards:ArrayCollection = new ArrayCollection(
@ -253,6 +451,83 @@
<!--
<mx:ColorPicker change="changeColor(event)" id="cpik" swatchPanelStyleName="colorPickerStyle" dataProvider="{colorPickerColours}" selectedColor="0x000000"
=======
private function buttonSettingToggle(buttonEvt:Event):void {
if(buttonEvt.target == btnToggleFill) {
toggleFill();
} else if(buttonEvt.target == btnToggleTransparency) {
toggleTransparency();
}
}
private function graphicObjSelected(event:GraphicObjectFocusEvent):void {
var gobj:GraphicObject = event.data;
LogUtil.debug("!!!!SELECTED:" + " " + gobj.getProperties());
}
private function graphicObjDeselected(event:GraphicObjectFocusEvent):void {
var gobj:GraphicObject = event.data;
LogUtil.debug("!!!!DESELECTED:" + " " + gobj.getProperties());
}
]]>
</mx:Script>
<!-- Now, every 'tool' has two types of identifiers, one is found in WhiteboardConstants
that identifies the "category" of the tool (ex. shape vs text), and the other specifies the
tool itself (ex. line tool vs triangle tool, even though both are "shapes")
-->
<mx:Button width="20" height="20" id="btnSelect" click="setTool(WhiteboardConstants.TYPE_SELECTION, SelectObject.SELECT_TOOL)" icon="{select_icon}"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.toolbar.select')}" toggle="true"/>
<mx:Button width="20" height="20" id="btnPenc" click="setTool(WhiteboardConstants.TYPE_SHAPE, DrawObject.PENCIL)" icon="{pencil_icon}"
toolTip="{ResourceUtil.getInstance().getString('bbb.highlighter.toolbar.pencil')}" toggle="true" selected="true" />
<mx:Button width="20" height="20" id="btnHighl" click="setTool(WhiteboardConstants.TYPE_SHAPE, DrawObject.HIGHLIGHTER)" icon="{highlighter_icon}"
toolTip="{ResourceUtil.getInstance().getString('bbb.highlighter.toolbar.highlighter')}" toggle="true"/>
<mx:Button width="20" height="20" id="btnRectangle" click="setTool(WhiteboardConstants.TYPE_SHAPE, DrawObject.RECTANGLE)" icon="{rectangle_icon}"
toolTip="{ResourceUtil.getInstance().getString('bbb.highlighter.toolbar.rectangle')}" toggle="true" />
<mx:Button width="20" height="20" id="btnEllipse" click="setTool(WhiteboardConstants.TYPE_SHAPE, DrawObject.ELLIPSE)" icon="{ellipse_icon}"
toolTip="{ResourceUtil.getInstance().getString('bbb.highlighter.toolbar.ellipse')}" toggle="true" />
<mx:Button width="20" height="20" id="btnTriangle" click="setTool(WhiteboardConstants.TYPE_SHAPE, DrawObject.TRIANGLE)" icon="{triangle_icon}"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.toolbar.triangle')}" toggle="true" />
<mx:Button width="20" height="20" id="btnLine" click="setTool(WhiteboardConstants.TYPE_SHAPE, DrawObject.LINE)" icon="{line_icon}"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.toolbar.line')}" toggle="true" />
<mx:Button width="20" height="20" id="btnText" click="setTool(WhiteboardConstants.TYPE_TEXT, TextObject.TEXT_TOOL)" icon="{text_icon}"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.toolbar.text')}" toggle="true" />
<mx:Button width="20" height="20" id="btnEraser" click="setTool(WhiteboardConstants.TYPE_SHAPE, DrawObject.ERASER)" icon="{eraser_icon}"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.toolbar.eraser')}" toggle="true" />
<mx:Button width="20" height="20" id="btnToggleGrid" click="dispatchEvent(new ToggleGridEvent(ToggleGridEvent.TOGGLE_GRID));" icon="{grid_icon}"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.texttoolbar.toggleGrid')}" toggle="true" />
<mx:Spacer height="5" />
<mx:Button width="20" height="20" id="btnToggleFill" click="buttonSettingToggle(event)" icon ="{fill_icon}"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.toolbar.toggleFill')}" toggle="true"/>
<mx:ColorPicker change="changeFillColor(event)" id="cfillpik" selectedColor="0x000000"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.toolbar.fillColorPicker')}"/>
<mx:Button width="20" height="20" id="btnToggleTransparency" click="buttonSettingToggle(event)" icon ="{transparency_icon}"
toolTip="{ResourceUtil.getInstance().getString('ltbcustom.bbb.highlighter.toolbar.toggleTransparency')}" toggle="true"/>
<mx:Spacer height="5" />
<mx:Button width="20" height="20" id="btnClear" click="dispatchEvent(new WhiteboardDrawEvent(WhiteboardDrawEvent.CLEAR_BOARD))" icon="{delete_icon}"
toolTip="{ResourceUtil.getInstance().getString('bbb.highlighter.toolbar.clear')}" />
<mx:Button width="20" height="20" id="btnUndo" click="sendUndoCommand()" icon="{undo_icon}"
toolTip="{ResourceUtil.getInstance().getString('bbb.highlighter.toolbar.undo')}" />
<mx:Spacer height="5" />
<!--
Properties that were removed from original color picker:
swatchPanelStyleName="colorPickerStyle"
dataProvider="{colorPickerColours}"
-->
<!-- Layout is really bad right now, and is confusing. Basically, there are two
of ColorPickers, one for the "line" color for the outlines of shapes, and the other for
the "fill" color that is used only if "fill" is enabled in WhiteboardCanvasModel
-->
<mx:ColorPicker change="changeColor(event)" id="cpik" selectedColor="0x000000"
>>>>>>> ajay/bbb-whiteboard-additions
toolTip="{ResourceUtil.getInstance().getString('bbb.highlighter.toolbar.color')}"/>
<mx:Spacer height="3" />

View File

@ -5,3 +5,4 @@ lib
web-app/demo/bbb_api_conf.jsp
target
plugins/*
logfile

View File

@ -1,7 +1,7 @@
#utf-8
#Fri Jun 10 11:32:20 EDT 2011
#Sat Jun 23 11:11:43 EDT 2012
app.version=0.70dev
app.servlet.version=2.4
app.grails.version=1.1.1
app.name=bigbluebutton
plugins.jsecurity=0.4.1
app.name=bigbluebutton

View File

@ -86,7 +86,7 @@ disableRecordingDefault=false
#----------------------------------------------------
# This URL is where the BBB client is accessible. When a user sucessfully
# enters a name and password, she is redirected here to load the client.
bigbluebutton.web.serverURL=http://192.168.0.235
bigbluebutton.web.serverURL=http://50.116.13.217
#----------------------------------------------------
# Assign URL where the logged-out participant will be redirected after sign-out.
@ -100,7 +100,7 @@ defaultClientUrl=${bigbluebutton.web.serverURL}/client/BigBlueButton.html
apiVersion=0.8
# Salt which is used by 3rd-party apps to authenticate api calls
securitySalt=18f6865fe37717aa5a8baaf76b598e13
securitySalt=5952641a16e8437374ef363a8c9dbbc3
# Directory where we drop the <meeting-id-recorded>.done file
recordStatusDir=/var/bigbluebutton/recording/status/recorded

View File