チェンジセット 3479

差分発生行の前後
無視リスト:
コミット日時:
2010/03/03 01:35:37 (3 年前)
コミッタ:
hkrn
ログメッセージ:

from DrawModule#commitCommand? to Recorder#commitCommand

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/Recorder.as

    r3434 r3479  
    22{ 
    33    import flash.utils.ByteArray; 
     4     
     5    import org.libspark.gunyarapaint.framework.commands.ICommand; 
    46 
    57    public final class Recorder extends CanvasContext 
     
    1416        } 
    1517         
     18        /** 
     19         * 画像の大きさを設定し、ヘッダーに書き込む 
     20         *  
     21         * @param width 画像の幅 
     22         * @param height 画像の高さ 
     23         * @param undo やり直しできる回数 
     24         */         
    1625        public function prepare(width:int, height:int, undo:int):void 
    1726        { 
     
    2433        } 
    2534         
    26         public function get logger():Logger 
     35        /** 
     36         * コマンドの書き出し及び実行を同時に行う 
     37         *  
     38         * @param command コマンドオブジェクト 
     39         * @param args コマンドに対する引数 
     40         */ 
     41        public function commitCommand(id:uint, args:Object):void 
    2742        { 
    28             return m_logger; 
     43            var command:ICommand = m_logger.getCommand(id); 
     44            command.write(m_logger.bytes, args); 
     45            command.execute(this); 
    2946        } 
    3047         
  • as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/CircleModule.as

    r3471 r3479  
    4242                if (!equalsCoordinate(x, y)) { 
    4343                    storeCircleCoordinate(x, y); 
    44                     commitCommand( 
    45                         m_logger.getCommand(MoveToCommand.ID)
     44                    m_recorder.commitCommand( 
     45                        MoveToCommand.ID
    4646                        getArgumentsFromCoordinate(s_rectangle.x, s_rectangle.y) 
    4747                    ); 
    48                     commitCommand( 
    49                         m_logger.getCommand(DrawCircleCommand.ID)
     48                    m_recorder.commitCommand( 
     49                        DrawCircleCommand.ID
    5050                        { "radius": s_rectangle.width } 
    5151                    ); 
    52                     commitCommand( 
    53                         m_logger.getCommand(CompositeCommand.ID)
     52                    m_recorder.commitCommand( 
     53                        CompositeCommand.ID
    5454                        {} 
    5555                    ); 
  • as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/DrawModule.as

    r3438 r3479  
    44     
    55    import org.libspark.gunyarapaint.framework.LayerBitmap; 
    6     import org.libspark.gunyarapaint.framework.Logger; 
    76    import org.libspark.gunyarapaint.framework.Painter; 
    87    import org.libspark.gunyarapaint.framework.Recorder; 
    98    import org.libspark.gunyarapaint.framework.commands.HorizontalMirrorCommand; 
    10     import org.libspark.gunyarapaint.framework.commands.ICommand; 
    119    import org.libspark.gunyarapaint.framework.commands.PenCommand; 
    1210    import org.libspark.gunyarapaint.framework.commands.RedoCommand; 
     
    2725        { 
    2826            m_recorder = recorder; 
    29             m_logger = recorder.logger; 
    3027        } 
    3128         
    3229        public function undo():void 
    3330        { 
    34             commitCommand(m_logger.getCommand(UndoCommand.ID), {}); 
     31            m_recorder.commitCommand(UndoCommand.ID, {}); 
    3532        } 
    3633         
    3734        public function redo():void 
    3835        { 
    39             commitCommand(m_logger.getCommand(RedoCommand.ID), {}); 
     36            m_recorder.commitCommand(RedoCommand.ID, {}); 
    4037        } 
    4138         
    4239        public function horizontalMirror(index:uint):void 
    4340        { 
    44             commitCommand( 
    45                 m_logger.getCommand(HorizontalMirrorCommand.ID)
     41            m_recorder.commitCommand( 
     42                HorizontalMirrorCommand.ID
    4643                { 
    4744                    "index": index 
     
    5249        public function verticalMirror(index:uint):void 
    5350        { 
    54             commitCommand( 
    55                 m_logger.getCommand(VerticalMirrorCommand.ID)
     51            m_recorder.commitCommand( 
     52                VerticalMirrorCommand.ID
    5653                { 
    5754                    "index": index 
     
    6259        public function copyLayer():void 
    6360        { 
    64             commitCommand(m_logger.getCommand(CopyLayerCommand.ID), {}); 
     61            m_recorder.commitCommand( 
     62                CopyLayerCommand.ID, 
     63                {} 
     64            ); 
    6565        } 
    6666         
    6767        public function createLayer():void 
    6868        { 
    69             commitCommand(m_logger.getCommand(CreateLayerCommand.ID), {}); 
     69            m_recorder.commitCommand( 
     70                CreateLayerCommand.ID, 
     71                {} 
     72            ); 
    7073        } 
    7174         
    7275        public function mergeLayers():void 
    7376        { 
    74             commitCommand(m_logger.getCommand(MergeLayerCommand.ID), {}); 
     77            m_recorder.commitCommand( 
     78                MergeLayerCommand.ID, 
     79                {} 
     80            ); 
    7581        } 
    7682         
    7783        public function removeLayer():void 
    7884        { 
    79             commitCommand(m_logger.getCommand(RemoveLayerCommand.ID), {}); 
     85            m_recorder.commitCommand( 
     86                RemoveLayerCommand.ID, 
     87                {} 
     88            ); 
    8089        } 
    8190         
    8291        public function swapLayers(from:uint, to:uint):void 
    8392        { 
    84             commitCommand( 
    85                 m_logger.getCommand(SwapLayerCommand.ID)
     93            m_recorder.commitCommand( 
     94                SwapLayerCommand.ID
    8695                { 
    8796                    "from": from, 
     
    145154         
    146155        /** 
    147          * コマンドの書き出し及び実行を同時に行う 
    148          *  
    149          * @param command コマンドオブジェクト 
    150          * @param args コマンドに対する引数 
    151          */ 
    152         protected function commitCommand(command:ICommand, args:Object):void 
    153         { 
    154             command.write(m_recorder.logger.bytes, args); 
    155             command.execute(m_recorder); 
    156         } 
    157          
    158         /** 
    159156         * 指定された座標が現在の座標と一致するかを確認する 
    160157         *  
     
    248245        public function set alpha(value:Number):void 
    249246        { 
    250             commitCommand( 
    251                 m_logger.getCommand(PenCommand.ID)
     247            m_recorder.commitCommand( 
     248                PenCommand.ID
    252249                { 
    253250                    "type": PenCommand.ALPHA, 
     
    260257        { 
    261258             
    262             commitCommand( 
    263                 m_logger.getCommand(PenCommand.ID)
     259            m_recorder.commitCommand( 
     260                PenCommand.ID
    264261                { 
    265262                    "type": PenCommand.BLEND_MODE, 
     
    271268        public function set color(value:uint):void 
    272269        { 
    273             commitCommand( 
    274                 m_logger.getCommand(PenCommand.ID)
     270            m_recorder.commitCommand( 
     271                PenCommand.ID
    275272                { 
    276273                    "type": PenCommand.COLOR, 
     
    282279        public function set thickness(value:uint):void 
    283280        { 
    284             commitCommand( 
    285                 m_logger.getCommand(PenCommand.ID)
     281            m_recorder.commitCommand( 
     282                PenCommand.ID
    286283                { 
    287284                    "type": PenCommand.THICKNESS, 
     
    293290        public function set layerAlpha(value:Number):void 
    294291        { 
    295             commitCommand( 
    296                 m_logger.getCommand(SetLayerAlphaCommand.ID)
     292            m_recorder.commitCommand( 
     293                SetLayerAlphaCommand.ID
    297294                { 
    298295                    "alpha": value 
     
    303300        public function set layerBlendMode(value:String):void 
    304301        { 
    305             commitCommand( 
    306                 m_logger.getCommand(SetLayerBlendModeCommand.ID)
     302            m_recorder.commitCommand( 
     303                SetLayerBlendModeCommand.ID
    307304                { 
    308305                    "blendMode": value 
     
    313310        public function set layerIndex(value:uint):void 
    314311        { 
    315             commitCommand( 
    316                 m_logger.getCommand(SetLayerIndexCommand.ID)
     312            m_recorder.commitCommand( 
     313                SetLayerIndexCommand.ID
    317314                { 
    318315                    "index": value 
     
    352349        private static var s_shouldStartAfterDrawing:Boolean = false; 
    353350        protected var m_recorder:Recorder; 
    354         protected var m_logger:Logger; 
    355351        protected var m_drawing:Boolean; 
    356352        protected var m_drawingLine:Boolean; 
  • as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/DropperModule.as

    r3471 r3479  
    3737        private function drop(x:Number, y:Number):void 
    3838        { 
    39             // TODO: implement this 
    40             commitCommand( 
    41                 m_logger.getCommand(PenCommand.ID), 
     39            m_recorder.commitCommand( 
     40                PenCommand.ID, 
    4241                { 
    4342                    "type": PenCommand.COLOR, 
  • as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/FloodFillModule.as

    r3471 r3479  
    1515        { 
    1616            validateLayerState(); 
    17             commitCommand( 
    18                 m_logger.getCommand(MoveToCommand.ID)
     17            m_recorder.commitCommand( 
     18                MoveToCommand.ID
    1919                getArgumentsFromCoordinate(x, y) 
    2020            ); 
    21             commitCommand( 
    22                 m_logger.getCommand(FloodFillCommand.ID)
     21            m_recorder.commitCommand( 
     22                FloodFillCommand.ID
    2323                {} 
    2424            ); 
  • as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/FreeHandModule.as

    r3471 r3479  
    2323            setCoordinate(x, y); 
    2424            m_drawing = true; 
    25             commitCommand( 
    26                 m_logger.getCommand(MoveToCommand.ID)
     25            m_recorder.commitCommand( 
     26                MoveToCommand.ID
    2727                getArgumentsFromCoordinate(x, y) 
    2828            ); 
     
    3232        { 
    3333            if (m_drawing) { 
    34                 commitCommand( 
    35                     m_logger.getCommand(LineToCommand.ID)
     34                m_recorder.commitCommand( 
     35                    LineToCommand.ID
    3636                    getArgumentsFromCoordinate(x, y) 
    3737                ); 
     
    4545                    var pen:Pen = m_recorder.painter.pen; 
    4646                    var tempAlpha:Number = pen.alpha; 
    47                     commitCommand( 
    48                         m_logger.getCommand(PenCommand.ID)
     47                    m_recorder.commitCommand( 
     48                        PenCommand.ID
    4949                        { 
    5050                            "type": PenCommand.ALPHA, 
     
    5252                        } 
    5353                    ); 
    54                     commitCommand( 
    55                         m_logger.getCommand(BeginFillCommand.ID)
     54                    m_recorder.commitCommand( 
     55                        BeginFillCommand.ID
    5656                        { 
    5757                            "color": pen.color, 
     
    5959                        } 
    6060                    ); 
    61                     commitCommand( 
    62                         m_logger.getCommand(DrawCircleCommand.ID)
     61                    m_recorder.commitCommand( 
     62                        DrawCircleCommand.ID
    6363                        { "radius": pen.thickness / 2 } 
    6464                    ); 
    65                     commitCommand(m_logger.getCommand(EndFillCommand.ID), {}); 
    66                     commitCommand( 
    67                         m_logger.getCommand(PenCommand.ID)
     65                    m_recorder.commitCommand(EndFillCommand.ID, {}); 
     66                    m_recorder.commitCommand( 
     67                        PenCommand.ID
    6868                        { 
    6969                            "type": PenCommand.ALPHA, 
     
    7272                    ); 
    7373                } 
    74                 commitCommand( 
    75                     m_logger.getCommand(CompositeCommand.ID)
     74                m_recorder.commitCommand( 
     75                    CompositeCommand.ID
    7676                    {} 
    7777                ); 
  • as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/LineModule.as

    r3471 r3479  
    4444                    var from:Object = getArgumentsFromCurrentCoordinate(); 
    4545                    var to:Object = getArgumentsFromCoordinate(x, y); 
    46                     commitCommand(m_logger.getCommand(MoveToCommand.ID), from); 
    47                     commitCommand(m_logger.getCommand(LineToCommand.ID), to); 
    48                     commitCommand(m_logger.getCommand(CompositeCommand.ID), {}); 
     46                    m_recorder.commitCommand(MoveToCommand.ID, from); 
     47                    m_recorder.commitCommand(LineToCommand.ID, to); 
     48                    m_recorder.commitCommand(CompositeCommand.ID, {}); 
    4949                } 
    5050                m_drawing = false; 
  • as3/gunyarapaint/branches/gunyarapaint/framework/src/org/libspark/gunyarapaint/framework/modules/PixelModule.as

    r3471 r3479  
    3838        private function setPixel(x:Number, y:Number):void 
    3939        { 
    40             commitCommand( 
    41                 m_logger.getCommand(PixelCommand.ID)
     40            m_recorder.commitCommand( 
     41                PixelCommand.ID
    4242                getArgumentsFromCoordinate(x, y) 
    4343            );