Show
Ignore:
Timestamp:
02/28/08 18:25:10 (5 years ago)
Author:
frsyuki
Message:

lang/actionscript/FxTerm: added ansi color selector

Location:
lang/actionscript/FxTerm/trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/actionscript/FxTerm/trunk/FxTerm.as

    r7237 r7245  
    213213         * @param color  RGB color code 
    214214         */ 
    215         public function setForegroundColor(n:uint, color:uint):uint 
    216         { 
    217                 return ansiForegroundColors[n] = color; 
     215        public function setForegroundColor(n:uint, color:uint):void 
     216        { 
     217                ansiForegroundColors[n] = color; 
     218                refresh(true);  // force refresh 
    218219        } 
    219220 
     
    232233         * @param color  RGB color code 
    233234         */ 
    234         public function setBackgroundColor(n:uint, color:uint):uint 
    235         { 
    236                 return ansiBackgroundColors[n] = color; 
     235        public function setBackgroundColor(n:uint, color:uint):void 
     236        { 
     237                ansiBackgroundColors[n] = color; 
     238                refresh(true);  // force refresh 
    237239        } 
    238240 
  • lang/actionscript/FxTerm/trunk/TelnetPanel.mxml

    r7237 r7245  
    7575        <Terminal id="terminal" col="80" row="25" dataProvider="{telnet}"/> 
    7676        <mx:ControlBar><mx:VBox width="100%" horizontalAlign="center"> 
     77 
    7778                <mx:LinkBar id="terminalControlLink" styleName="terminalControlLink" 
    7879                        dataProvider="terminalControl"/> 
    79                 <mx:ViewStack id="terminalControl" width="100%" minWidth="400"> 
     80 
     81                <mx:ViewStack id="terminalControl" width="100%" minWidth="450"> 
     82 
    8083                        <mx:HBox label="Command" width="100%"> 
    8184                                <mx:TextInput width="100%" id="commandLine" 
     
    8487                                        /> 
    8588                        </mx:HBox> 
     89 
    8690                        <mx:HBox label="Size" horizontalAlign="center"> 
    8791                                <mx:Label text="Colmuns" styleName="terminalControlLabel"/> 
     
    100104                                        styleName="terminalControl"/> 
    101105                        </mx:HBox> 
    102                         <mx:HBox label="Color" width="100%"> 
     106 
     107                        <mx:HBox label="Color" horizontalAlign="center"> 
     108                                <mx:ColorPicker id="fgcolorNormal" showTextField="true" 
     109                                        close="{terminal.ansiForegroundNormal=fgcolorNormal.selectedColor}" 
     110                                        selectedColor="{terminal.ansiForegroundNormal}"/> 
     111                                <mx:ColorPicker id="fgcolorRed" showTextField="true" 
     112                                        close="{terminal.ansiForegroundRed=fgcolorRed.selectedColor}" 
     113                                        selectedColor="{terminal.ansiForegroundRed}"/> 
     114                                <mx:ColorPicker id="fgcolorGreen" showTextField="true" 
     115                                        close="{terminal.ansiForegroundGreen=fgcolorGreen.selectedColor}" 
     116                                        selectedColor="{terminal.ansiForegroundGreen}"/> 
     117                                <mx:ColorPicker id="fgcolorYellow" showTextField="true" 
     118                                        close="{terminal.ansiForegroundYellow=fgcolorYellow.selectedColor}" 
     119                                        selectedColor="{terminal.ansiForegroundYellow}"/> 
     120                                <mx:ColorPicker id="fgcolorBlue" showTextField="true" 
     121                                        close="{terminal.ansiForegroundBlue=fgcolorBlue.selectedColor}" 
     122                                        selectedColor="{terminal.ansiForegroundBlue}"/> 
     123                                <mx:ColorPicker id="fgcolorMagenta" showTextField="true" 
     124                                        close="{terminal.ansiForegroundMagenta=fgcolorMagenta.selectedColor}" 
     125                                        selectedColor="{terminal.ansiForegroundMagenta}"/> 
     126                                <mx:ColorPicker id="fgcolorWhite" showTextField="true" 
     127                                        close="{terminal.ansiForegroundWhite=fgcolorWhite.selectedColor}" 
     128                                        selectedColor="{terminal.ansiForegroundWhite}"/> 
     129                                <mx:VRule/> 
     130                                <mx:ColorPicker id="bgcolorNormal" showTextField="true" 
     131                                        close="{terminal.ansiBackgroundNormal=bgcolorNormal.selectedColor; this.setStyle('backgroundColor', bgcolorNormal.selectedColor)}" 
     132                                        selectedColor="{terminal.ansiBackgroundNormal}"/> 
     133                                <mx:ColorPicker id="bgcolorRed" showTextField="true" 
     134                                        close="{terminal.ansiBackgroundRed=bgcolorRed.selectedColor}" 
     135                                        selectedColor="{terminal.ansiBackgroundRed}"/> 
     136                                <mx:ColorPicker id="bgcolorGreen" showTextField="true" 
     137                                        close="{terminal.ansiBackgroundGreen=bgcolorGreen.selectedColor}" 
     138                                        selectedColor="{terminal.ansiBackgroundGreen}"/> 
     139                                <mx:ColorPicker id="bgcolorYellow" showTextField="true" 
     140                                        close="{terminal.ansiBackgroundYellow=bgcolorYellow.selectedColor}" 
     141                                        selectedColor="{terminal.ansiBackgroundYellow}"/> 
     142                                <mx:ColorPicker id="bgcolorBlue" showTextField="true" 
     143                                        close="{terminal.ansiBackgroundBlue=bgcolorBlue.selectedColor}" 
     144                                        selectedColor="{terminal.ansiBackgroundBlue}"/> 
     145                                <mx:ColorPicker id="bgcolorMagenta" showTextField="true" 
     146                                        close="{terminal.ansiBackgroundMagenta=bgcolorMagenta.selectedColor}" 
     147                                        selectedColor="{terminal.ansiBackgroundMagenta}"/> 
     148                                <mx:ColorPicker id="bgcolorWhite" showTextField="true" 
     149                                        close="{terminal.ansiBackgroundWhite=bgcolorWhite.selectedColor}" 
     150                                        selectedColor="{terminal.ansiBackgroundWhite}"/> 
    103151                        </mx:HBox> 
     152 
     153                        <mx:HBox label="Display" horizontalAlign="center"> 
     154                                <mx:Script> 
     155                                <![CDATA[ 
     156                                        [Bindable] 
     157                                        private var charsets:Array = new Array( 
     158                                                "utf-8", 
     159                                                "euc-jp", 
     160                                                "shift_jis", 
     161                                                "big5", 
     162                                                "gb2312", 
     163                                                "KSC5601", 
     164                                                "euc-kr" 
     165                                        ); 
     166                                ]]> 
     167                                </mx:Script> 
     168                                <mx:Label text="Encoding" styleName="terminalControlLabel"/> 
     169                                <mx:ComboBox dataProvider="{charsets}" width="100" id="charSetSelector" 
     170                                        close="terminal.charSet=String(charSetSelector.selectedItem)" 
     171                                        styleName="terminalControl" 
     172                                        /> 
     173                        </mx:HBox> 
     174 
    104175                </mx:ViewStack> 
     176 
    105177        </mx:VBox></mx:ControlBar> 
    106178</mx:Panel> 
  • lang/actionscript/FxTerm/trunk/Terminal.as

    r7237 r7245  
    8383        public function set backgroundColors(color8:Array):void 
    8484                { _term.backgroundColors = color8; } 
    85         public function setForegroundColor(n:uint, color:uint):uint 
    86                 { return _term.setForegroundColor(n, color); } 
    87         public function setBackgroundColor(n:uint, color:uint):uint 
    88                 { return _term.setBackgroundColor(n, color); } 
     85        public function setForegroundColor(n:uint, color:uint):void 
     86                { _term.setForegroundColor(n, color); } 
     87        public function setBackgroundColor(n:uint, color:uint):void 
     88                { _term.setBackgroundColor(n, color); } 
    8989 
    9090        [Bindable] 
     
    111111 
    112112        public function set ansiForegroundNormal(color:uint):void 
    113                 { _term.setForegroundColor(0, color); } 
     113                { _term.setForegroundColor(0, color); changed(); } 
    114114        public function set ansiForegroundRed(color:uint):void 
    115                 { _term.setForegroundColor(1, color); } 
     115                { _term.setForegroundColor(1, color); changed(); } 
    116116        public function set ansiForegroundGreen(color:uint):void 
    117                 { _term.setForegroundColor(2, color); } 
     117                { _term.setForegroundColor(2, color); changed(); } 
    118118        public function set ansiForegroundYellow(color:uint):void 
    119                 { _term.setForegroundColor(3, color); } 
     119                { _term.setForegroundColor(3, color); changed(); } 
    120120        public function set ansiForegroundBlue(color:uint):void 
    121                 { _term.setForegroundColor(4, color); } 
     121                { _term.setForegroundColor(4, color); changed(); } 
    122122        public function set ansiForegroundMagenta(color:uint):void 
    123                 { _term.setForegroundColor(5, color); } 
     123                { _term.setForegroundColor(5, color); changed(); } 
    124124        public function set ansiForegroundWhite(color:uint):void 
    125                 { _term.setForegroundColor(6, color); } 
     125                { _term.setForegroundColor(6, color); changed(); } 
     126 
     127        [Bindable] 
     128        public function get ansiBackgroundNormal():uint 
     129                { return _term.getBackgroundColor(0); } 
     130        [Bindable] 
     131        public function get ansiBackgroundRed():uint 
     132                { return _term.getBackgroundColor(1); } 
     133        [Bindable] 
     134        public function get ansiBackgroundGreen():uint 
     135                { return _term.getBackgroundColor(2); } 
     136        [Bindable] 
     137        public function get ansiBackgroundYellow():uint 
     138                { return _term.getBackgroundColor(3); } 
     139        [Bindable] 
     140        public function get ansiBackgroundBlue():uint 
     141                { return _term.getBackgroundColor(4); } 
     142        [Bindable] 
     143        public function get ansiBackgroundMagenta():uint 
     144                { return _term.getBackgroundColor(5); } 
     145        [Bindable] 
     146        public function get ansiBackgroundWhite():uint 
     147                { return _term.getBackgroundColor(6); } 
     148 
     149        public function set ansiBackgroundNormal(color:uint):void 
     150                { _term.setBackgroundColor(0, color); changed(); } 
     151        public function set ansiBackgroundRed(color:uint):void 
     152                { _term.setBackgroundColor(1, color); changed(); } 
     153        public function set ansiBackgroundGreen(color:uint):void 
     154                { _term.setBackgroundColor(2, color); changed(); } 
     155        public function set ansiBackgroundYellow(color:uint):void 
     156                { _term.setBackgroundColor(3, color); changed(); } 
     157        public function set ansiBackgroundBlue(color:uint):void 
     158                { _term.setBackgroundColor(4, color); changed(); } 
     159        public function set ansiBackgroundMagenta(color:uint):void 
     160                { _term.setBackgroundColor(5, color); changed(); } 
     161        public function set ansiBackgroundWhite(color:uint):void 
     162                { _term.setBackgroundColor(6, color); changed(); } 
    126163 
    127164        public function resize(cols:uint, rows:uint):void