Skip to content

Commit

Permalink
- change text color and size
Browse files Browse the repository at this point in the history
  • Loading branch information
ritzalam committed Aug 7, 2012
1 parent f0e5762 commit 3343ab1
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ package org.bigbluebutton.modules.whiteboard
tobj.multiline = true;
tobj.wordWrap = true;
tobj.background = false;
// tobj.backgroundColor = 0x0000FF;
tobj.makeEditable(false);
wbCanvas.addGraphic(tobj);
graphicList.push(tobj);
Expand Down Expand Up @@ -434,7 +433,7 @@ package org.bigbluebutton.modules.whiteboard
}

public function textObjGainedFocusListener(event:FocusEvent):void {
// LogUtil.debug("### GAINED FOCUS ");
LogUtil.debug("### GAINED FOCUS ");
var tf:TextObject = event.currentTarget as TextObject;
wbCanvas.stage.focus = tf;
tf.stage.focus = tf;
Expand All @@ -445,11 +444,11 @@ package org.bigbluebutton.modules.whiteboard
}

public function textObjLostFocusListener(event:FocusEvent):void {
// LogUtil.debug("### LOST FOCUS ");
LogUtil.debug("### LOST FOCUS ");
var tf:TextObject = event.target as TextObject;
sendTextToServer(TextObject.TEXT_PUBLISHED, tf);
// LogUtil.debug("Text published to: " + tf.text);
currentlySelectedTextObject = null;
// currentlySelectedTextObject = null;

tf.border = false;

Expand All @@ -459,6 +458,24 @@ package org.bigbluebutton.modules.whiteboard
/* hide text toolbar because we don't want to show it if there is no text selected */
}


/* 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 {
LogUtil.debug("modifySelectedTextObject = " + textSize);
currentlySelectedTextObject.textColor = textColor;
currentlySelectedTextObject.background = bgColorVisible;
currentlySelectedTextObject.backgroundColor = backgroundColor;
currentlySelectedTextObject.textSize = textSize;
LogUtil.debug("modifySelectedTextObject = " + currentlySelectedTextObject.textSize);
currentlySelectedTextObject.applyFormatting();
sendTextToServer(TextObject.TEXT_PUBLISHED, currentlySelectedTextObject);
}

private function sendTextToServer(status:String, tobj:TextObject):void {
switch (status) {
case TextObject.TEXT_CREATED:
Expand All @@ -472,7 +489,7 @@ package org.bigbluebutton.modules.whiteboard
break;
}

// LogUtil.debug("SENDING TEXT: [" + tobj.text + "]");
LogUtil.debug("SENDING TEXT: [" + tobj.textSize + "]");

var annotation:Object = new Object();
annotation["type"] = "text";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
public function redrawText(origParentWidth:Number, origParentHeight:Number, parentWidth:Number, parentHeight:Number):void {
this.x = denormalize(origX, parentWidth);
this.y = denormalize(origY, parentHeight);



var newFontSize:Number = textSize;
newFontSize = (parentHeight/origParentHeight) * textSize;

Expand Down Expand Up @@ -215,6 +214,18 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
this._editable = editable;
}

public function applyFormatting():void {
var tf:TextFormat = new TextFormat();
tf.size = this.textSize;
tf.font = "arial";
this.defaultTextFormat = tf;
this.setTextFormat(tf);
this.multiline = true;
this.wordWrap = true;
// this.autoSize = TextFieldAutoSize.LEFT;
this.antiAliasType = AntiAliasType.ADVANCED;
}

public function registerListeners(textObjGainedFocus:Function, textObjLostFocus:Function, textObjTextListener:Function, textObjDeleteListener:Function):void {
this.addEventListener(FocusEvent.FOCUS_IN, textObjGainedFocus);
this.addEventListener(FocusEvent.FOCUS_OUT, textObjLostFocus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
creationComplete="init()" visible="false" mouseOver="setCursor(toolType)" mouseOut="removeCursor()" implements="org.bigbluebutton.common.IBbbCanvas">
<mx:Script>
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import com.asfusion.mate.events.Dispatcher;
import mx.managers.CursorManager;
import org.bigbluebutton.common.IBbbCanvas;
import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.LogUtil;
Expand Down Expand Up @@ -160,7 +162,8 @@
}
public function modifySelectedTextObject(fgColor:uint, bgColorVisible:Boolean, backgroundColor:uint, textSize:Number):void {
// displayModel.modifySelectedTextObject(fgColor, bgColorVisible, backgroundColor, textSize);
LogUtil.debug("modifying text size = " + textSize);
displayModel.modifySelectedTextObject(fgColor, bgColorVisible, backgroundColor, textSize);
}
public function makeTextObjectsEditable(e:MadePresenterEvent):void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>
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.bgColor = cbackpik.selectedColor = tobj.backgroundColor;
// this.backgroundVisible = btnToggleBackground.selected = tobj.background;
this.textSizeMenu.label = String(tobj.textSize);
this.textSize = tobj.textSize;
}
Expand Down Expand Up @@ -266,15 +266,16 @@ Author: Ajay Gopinath <ajgopi124(at)gmail(dot)com>

<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}" />
Expand Down

0 comments on commit 3343ab1

Please sign in to comment.