| 135 | | |
|---|
| 136 | | // TODO: もう本当に汚い… これのスコープを短くする。 |
|---|
| 137 | | private var baseImg:BitmapData; |
|---|
| 138 | | |
|---|
| 139 | | private function getBaseImgHandler(com:Com):void |
|---|
| 140 | | { |
|---|
| 141 | | baseImg = Bitmap(com.content).bitmapData; |
|---|
| 142 | | /* |
|---|
| 143 | | if (parameters['baseImgInfoUrl']) { |
|---|
| 144 | | new Com().sendGetUrlRequest(parameters['baseImgInfoUrl'], getBaseImgInfoHandler); |
|---|
| 145 | | } else { |
|---|
| 146 | | // 画像のサイズがそのままwidth/height |
|---|
| 147 | | // このロジックは通らなくなっているはずだが、移行措置のため残してある。 |
|---|
| 148 | | // 消してもよい。 |
|---|
| 149 | | baseImgToCanvas(baseImg.width, baseImg.height, parameters['undoBufferSize'], null); |
|---|
| 150 | | } |
|---|
| 151 | | */ |
|---|
| 152 | | } |
|---|
| 153 | | |
|---|
| 154 | | private function getBaseImgInfoHandler(com:Com):void |
|---|
| 155 | | { |
|---|
| 156 | | var info:Object = com.jsonObject; |
|---|
| 157 | | if (!info) { |
|---|
| 158 | | info = {'width': baseImg.width, 'height': baseImg.height}; |
|---|
| 159 | | } |
|---|
| 160 | | //baseImgToCanvas(info['width'], info['height'], parameters['undoBufferSize'], info); |
|---|
| 161 | | } |
|---|
| 162 | | |
|---|
| 163 | | private function baseImgToCanvas(width:uint, height:uint, undoBufferSize:uint, baseInfo:Object):void |
|---|
| 164 | | { |
|---|
| 165 | | /* |
|---|
| 166 | | _logger = GPLogger.createForDraw(width, height, undoBufferSize, |
|---|
| 167 | | baseImg, baseInfo); |
|---|
| 168 | | canvasWindow.logger = _logger; |
|---|
| 169 | | */ |
|---|
| 170 | | enabled = true; |
|---|
| 171 | | } |
|---|
| 172 | | |
|---|
| 173 | | private function commCompleteHandler(com:Com):void |
|---|
| 174 | | { |
|---|
| 175 | | try { |
|---|
| 176 | | if (com.errStr) { |
|---|
| 177 | | // error |
|---|
| 178 | | Alert.show(com.errStr, Application.application.ALERT_TITLE); |
|---|
| 179 | | } |
|---|
| 180 | | else if (com.data.toString() != '') { |
|---|
| 181 | | Alert.show(com.data.toString(), Application.application.ALERT_TITLE); |
|---|
| 182 | | } |
|---|
| 183 | | else { |
|---|
| 184 | | // redirect |
|---|
| 185 | | //Com.redirect(redirectUrl); |
|---|
| 186 | | return; |
|---|
| 187 | | } |
|---|
| 188 | | } |
|---|
| 189 | | catch (e:Error) { |
|---|
| 190 | | Alert.show('何かしらのエラーが起きました…再投稿お願いいたします。', Application.application.ALERT_TITLE); |
|---|
| 191 | | } |
|---|
| 192 | | Application.application.alertOnUnload(true); |
|---|
| 193 | | } |
|---|
| 194 | | |
|---|
| 195 | | private function postOekakiButtonHandler(evt:Event):void |
|---|
| 196 | | { |
|---|
| 197 | | if (titleTextInput.text == '') { |
|---|
| 198 | | Alert.show('絵のタイトルが空です。', Application.application.ALERT_TITLE); |
|---|
| 199 | | } |
|---|
| 200 | | else if (messageTextArea.text == '') { |
|---|
| 201 | | Alert.show('書き込みが空です。', Application.application.ALERT_TITLE); |
|---|
| 202 | | } |
|---|
| 203 | | else if (Application.application.commitCount == 0) { |
|---|
| 204 | | Alert.show('絵が描かれていません。お絵かきしてください。', Application.application.ALERT_TITLE); |
|---|
| 205 | | } |
|---|
| 206 | | else { |
|---|
| 207 | | try { |
|---|
| 208 | | Application.application.alertOnUnload(false); |
|---|
| 209 | | /* |
|---|
| 210 | | var com:Com = new Com(); |
|---|
| 211 | | com.postOekaki(this, |
|---|
| 212 | | parameters['postUrl'], |
|---|
| 213 | | parameters['magic'], |
|---|
| 214 | | parameters['cookie'], |
|---|
| 215 | | fromTextInput.text, |
|---|
| 216 | | titleTextInput.text, |
|---|
| 217 | | messageTextArea.text, |
|---|
| 218 | | watchlistCheckBox.selected, |
|---|
| 219 | | oekakiId, |
|---|
| 220 | | new ByteArray(), //_logger.dataForPost, |
|---|
| 221 | | commCompleteHandler |
|---|
| 222 | | ); |
|---|
| 223 | | */ |
|---|
| 224 | | } |
|---|
| 225 | | catch (e:Error) { |
|---|
| 226 | | Application.application.alertOnUnload(true); |
|---|
| 227 | | Alert.show(e.message, Application.application.ALERT_TITLE); |
|---|
| 228 | | } |
|---|
| 229 | | } |
|---|
| 230 | | } |
|---|
| 233 | | <mx:Label x="12" y="7" text="投稿者名"/> |
|---|
| 234 | | <mx:TextInput id="fromTextInput" x="55" y="3" maxChars="32" fontSize="14" focusThickness="0"/> |
|---|
| 235 | | <mx:Label x="2" y="36" text="絵のタイトル"/> |
|---|
| 236 | | <mx:TextInput id="titleTextInput" x="55" y="32" maxChars="32" fontSize="14" focusThickness="0" width="406"/> |
|---|
| 237 | | <mx:CheckBox id="watchlistCheckBox" x="223" y="7" label="ウォッチリストに登録"/> |
|---|
| 238 | | <mx:Label x="10" y="76" text="書き込み"/> |
|---|
| 239 | | <mx:TextArea id="messageTextArea" x="55" y="61" width="406" height="61" fontSize="14" focusThickness="0"> |
|---|
| 240 | | <mx:text></mx:text> |
|---|
| 241 | | </mx:TextArea> |
|---|
| 242 | | <mx:Button id="rotateResetButton" y="63" label="角度" width="29" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0" height="17" right="204" buttonDown="setRotate(0)"/> |
|---|
| 243 | | <mx:Button id="zoomResetButton" y="81" label="拡大" width="29" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0" height="17" right="204" buttonDown="setZoom(1)"/> |
|---|
| 244 | | <mx:Button id="horizontalMirrorButton" x="117" y="128" label="全レイヤー左右反転" width="120" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0" height="17" buttonDown="IApplication(Application.application).module.horizontalMirror(Painter.ALL_LAYERS)"/> |
|---|
| 245 | | <mx:Button id="verticalMirrorButton" x="245" y="128" label="全レイヤー上下反転" width="120" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0" height="17" buttonDown="IApplication(Application.application).module.verticalMirror(Painter.ALL_LAYERS)"/> |
|---|
| 246 | | <mx:HSlider id="canvasRotate" y="62" width="152" minimum="-180" maximum="180" snapInterval="5" value="0" right="49" showDataTip="false" change="setRotate(event.value)" thumbDrag="setRotate(event.value)"/> |
|---|
| 247 | | <mx:HSlider id="canvasZoom" y="79" width="152" minimum="-4" maximum="19" snapInterval="0.1" value="1" right="49" showDataTip="false" change="setZoom(event.value)" thumbDrag="setZoom(event.value)"/> |
|---|
| 248 | | <mx:TextInput id="canvasRotateValue" y="66" width="32" height="17" right="18" fontSize="8" textAlign="right" text="0" restrict="0-9" maxChars="4" enter="onChangeCanvasRotate(event)"/> |
|---|
| 249 | | <mx:Label y="66" text="°" right="0"/> |
|---|
| 250 | | <mx:TextInput id="canvasZoomValue" y="83" width="32" height="17" right="18" fontSize="8" textAlign="right" text="100" restrict="0-9" maxChars="6" enter="onChangeCanvasZoom(event)"/> |
|---|
| 251 | | <mx:Label y="83" text="%" right="0"/> |
|---|
| 252 | | |
|---|
| 253 | | <mx:Label y="4" text="補助線" right="199"/> |
|---|
| 254 | | <mx:NumericStepper id="additionalNumberStepper" y="4" value="4" minimum="2" maximum="16" stepSize="1" right="143" height="18" fontSize="8" change="onChangeAuxDivideCount(event)"/> |
|---|
| 255 | | <mx:CheckBox id="additionalBoxCheckBox" y="2" label="縦横" right="8" fontSize="9" height="18" change="onChangeAuxBoxVisible(event)"/> |
|---|
| 256 | | <mx:CheckBox id="additionalSkewCheckBox" y="18" label="斜め" right="9" fontSize="9" height="18" change="onChangeAuxSkewVisible(event)"/> |
|---|
| 257 | | <mx:Button id="postOekakiButton" x="353" y="7" label="お絵カキコする!" fillAlphas="[1.0, 1.0, 1.0, 1.0]" fillColors="[#FFFFFF, #FF9999, #FFFFFF, #FFCCCC]" enabled="false" buttonDown="postOekakiButtonHandler(event)"/> |
|---|
| 258 | | <mx:Button id="undoButton" y="38" label="アンドゥ" enabled="false" paddingLeft="3" paddingRight="3" right="89" buttonDown="IApplication(Application.application).module.undo()"/> |
|---|
| 259 | | <mx:Button id="redoButton" y="38" label="リドゥ" enabled="false" paddingLeft="3" paddingRight="3" right="12" buttonDown="IApplication(Application.application).module.redo()"/> |
|---|
| 260 | | <mx:Button id="windowsResetButton" x="10" y="128" label="ウィンドウ初期状態" width="99" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0" height="17" buttonDown="Application.application.resetWindowsPosition()"/> |
|---|
| 261 | | <mx:Button id="passwordButton" x="373" y="128" label="ふっかつのじゅもん" width="99" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0" height="17" buttonDown="onLoad(event)"/> |
|---|
| 262 | | <mx:Button id="logPlayButton" y="105" label="ログプレイ" visible="false" right="99"/> |
|---|
| 263 | | <mx:Button id="checkPngButton" y="105" label="同一check" visible="false" right="10"/> |
|---|
| 264 | | <mx:ComboBox y="4" id="additionalTypeComboBox" right="66" width="70" fontSize="8" height="18" selectedIndex="0" change="onChangeAuxType(event)"> |
|---|
| 265 | | <mx:ArrayCollection id="auxTypes"> |
|---|
| 266 | | <mx:Object label="分割" data="0" /> |
|---|
| 267 | | <mx:Object label="px単位" data="1" /> |
|---|
| 268 | | </mx:ArrayCollection> |
|---|
| 269 | | </mx:ComboBox> |
|---|
| | 135 | <mx:Canvas x="10" y="0" height="163" width="260"> |
|---|
| | 136 | <mx:Button id="rotateResetButton" y="63" label="角度" width="29" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0" height="17" right="204" buttonDown="setRotate(0)"/> |
|---|
| | 137 | <mx:Button id="zoomResetButton" y="81" label="拡大" width="29" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0" height="17" right="204" buttonDown="setZoom(1)"/> |
|---|
| | 138 | <mx:HSlider id="canvasRotate" y="62" width="152" minimum="-180" maximum="180" snapInterval="5" value="0" right="49" showDataTip="false" change="setRotate(event.value)" thumbDrag="setRotate(event.value)"/> |
|---|
| | 139 | <mx:HSlider id="canvasZoom" y="79" width="152" minimum="-4" maximum="19" snapInterval="0.1" value="1" right="49" showDataTip="false" change="setZoom(event.value)" thumbDrag="setZoom(event.value)"/> |
|---|
| | 140 | <mx:TextInput id="canvasRotateValue" y="66" width="32" height="17" right="18" fontSize="8" textAlign="right" text="0" restrict="0-9" maxChars="4" enter="onChangeCanvasRotate(event)"/> |
|---|
| | 141 | <mx:Label y="66" text="°" right="0"/> |
|---|
| | 142 | <mx:TextInput id="canvasZoomValue" y="83" width="32" height="17" right="18" fontSize="8" textAlign="right" text="100" restrict="0-9" maxChars="6" enter="onChangeCanvasZoom(event)"/> |
|---|
| | 143 | <mx:Label y="83" text="%" right="0"/> |
|---|
| | 144 | <mx:Label y="4" text="補助線" right="199"/> |
|---|
| | 145 | <mx:NumericStepper id="additionalNumberStepper" y="4" value="4" minimum="2" maximum="16" stepSize="1" right="143" height="18" fontSize="8" change="onChangeAuxDivideCount(event)"/> |
|---|
| | 146 | <mx:CheckBox id="additionalBoxCheckBox" y="2" label="縦横" right="8" fontSize="9" height="18" change="onChangeAuxBoxVisible(event)"/> |
|---|
| | 147 | <mx:CheckBox id="additionalSkewCheckBox" y="18" label="斜め" right="9" fontSize="9" height="18" change="onChangeAuxSkewVisible(event)"/> |
|---|
| | 148 | <mx:Button id="undoButton" y="38" label="アンドゥ" enabled="false" paddingLeft="3" paddingRight="3" right="89" buttonDown="IApplication(Application.application).module.undo()"/> |
|---|
| | 149 | <mx:Button id="redoButton" y="38" label="リドゥ" enabled="false" paddingLeft="3" paddingRight="3" right="12" buttonDown="IApplication(Application.application).module.redo()"/> |
|---|
| | 150 | <mx:Button id="logPlayButton" y="105" label="ログプレイ" visible="false" right="99"/> |
|---|
| | 151 | <mx:Button id="checkPngButton" y="105" label="同一check" visible="false" right="10"/> |
|---|
| | 152 | <mx:ComboBox y="4" id="additionalTypeComboBox" right="66" width="70" fontSize="8" height="18" selectedIndex="0" change="onChangeAuxType(event)"> |
|---|
| | 153 | <mx:ArrayCollection id="auxTypes"> |
|---|
| | 154 | <mx:Object label="分割" data="0" /> |
|---|
| | 155 | <mx:Object label="px単位" data="1" /> |
|---|
| | 156 | </mx:ArrayCollection> |
|---|
| | 157 | </mx:ComboBox> |
|---|
| | 158 | <mx:Button id="windowsResetButton" x="146" y="136" label="ウィンドウ初期状態" width="104" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0" height="17" buttonDown="Application.application.resetWindowsPosition()"/> |
|---|
| | 159 | <mx:Button id="horizontalMirrorButton" x="10" y="111" label="全レイヤー左右反転" width="120" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0" height="17" buttonDown="IApplication(Application.application).module.horizontalMirror(Painter.ALL_LAYERS)"/> |
|---|
| | 160 | <mx:Button id="verticalMirrorButton" x="10" y="136" label="全レイヤー上下反転" width="120" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0" height="17" buttonDown="IApplication(Application.application).module.verticalMirror(Painter.ALL_LAYERS)"/> |
|---|
| | 161 | <mx:Button id="passwordButton" x="146" y="111" label="ふっかつのじゅもん" width="104" paddingLeft="0" paddingRight="0" paddingTop="0" paddingBottom="0" height="17" buttonDown="onLoad(event)"/> |
|---|
| | 162 | </mx:Canvas> |
|---|