diff --git a/src/sbbs3/ctrl/SpyFormUnit.cpp b/src/sbbs3/ctrl/SpyFormUnit.cpp index 2be1b2dface9b182cfa6343dbe41b1d293952ab6..fd48f7141a25dd2a59ae4b92c578a54a93b55ae6 100644 --- a/src/sbbs3/ctrl/SpyFormUnit.cpp +++ b/src/sbbs3/ctrl/SpyFormUnit.cpp @@ -38,7 +38,6 @@ #include "MainFormUnit.h" #include "SpyFormUnit.h" -#include "sbbsdefs.h" #define SPYBUF_LEN 10000 //--------------------------------------------------------------------------- @@ -58,60 +57,7 @@ __fastcall TSpyForm::TSpyForm(TComponent* Owner) Terminal->Align=alClient; Terminal->OnKeyPress=FormKeyPress; Terminal->OnMouseUp=FormMouseUp; -} -bool strip_ansi(char* str) -{ - char* p=str; - char newstr[SPYBUF_LEN]; - int newlen=0; - bool ff=false; - - for(p=str;*p && newlen<(sizeof(newstr)-1);) { - - switch(*p) { - case BEL: /* bell */ - Beep(); - break; - case BS: /* backspace */ - if(newlen) - newlen--; - break; - case FF: /* form feed */ - newlen=0; - ff=true; - break; - case ESC: - if(*(p+1)=='[') { /* ANSI */ - p+=2; - if(!strncmp(p,"2J",2)) { - newlen=0; - ff=true; - } - while(*p && !isalpha(*p)) p++; - } - break; - case CR: - if(*(p+1)!=LF) { - while(newlen) { - newlen--; - if(newstr[newlen]==LF) { - newlen++; - break; - } - } - break; - } /* Fall through */ - default: - newstr[newlen++]=*p; - break; - } - if(*p==0) - break; - p++; - } - newstr[newlen]=0; - strcpy(str,newstr); - return(ff); + ActiveControl=Terminal; } //--------------------------------------------------------------------------- void __fastcall TSpyForm::SpyTimerTick(TObject *Sender) @@ -124,19 +70,10 @@ void __fastcall TSpyForm::SpyTimerTick(TObject *Sender) rd=RingBufRead(*outbuf,buf,sizeof(buf)-1); if(rd) { -#if 0 - buf[rd]=0; - if(strip_ansi(buf)) - Log->Lines->Clear(); - Log->SelLength=0; - Log->SelStart=Log->Lines->Text.Length(); - Log->SelText=AnsiString(buf); -#else Terminal->WriteBuffer(buf,rd); -#endif - Timer->Interval=100; + Timer->Interval=1; } else - Timer->Interval=500; + Timer->Interval=250; } //--------------------------------------------------------------------------- void __fastcall TSpyForm::FormShow(TObject *Sender) @@ -153,6 +90,7 @@ void __fastcall TSpyForm::FormShow(TObject *Sender) Terminal->Clear(); Terminal->WriteStr("*** Synchronet Local Spy ***\r\n\r\n"); Terminal->WriteStr("ANSI Terminal Emulation:"+CopyRight+"\r\n\r\n"); + KeyboardActiveClick(Sender); } //--------------------------------------------------------------------------- @@ -187,12 +125,17 @@ void __fastcall TSpyForm::FormKeyPress(TObject *Sender, char &Key) { if(KeyboardActive->Checked && inbuf!=NULL && *inbuf!=NULL) RingBufWrite(*inbuf,&Key,1); + } //--------------------------------------------------------------------------- void __fastcall TSpyForm::KeyboardActiveClick(TObject *Sender) { KeyboardActive->Checked=!KeyboardActive->Checked; + if(KeyboardActive->Checked) + Terminal->Cursor=crIBeam; + else + Terminal->Cursor=crDefault; } //--------------------------------------------------------------------------- diff --git a/src/sbbs3/ctrl/SpyFormUnit.dfm b/src/sbbs3/ctrl/SpyFormUnit.dfm index f887c61b77b505ef81d0a8da5d0b8df628d9bba1..d6c351ed29f9bc564a8e7fa1ae5447d11de11bca 100644 --- a/src/sbbs3/ctrl/SpyFormUnit.dfm +++ b/src/sbbs3/ctrl/SpyFormUnit.dfm @@ -37,7 +37,6 @@ object SpyForm: TSpyForm 000FF800000FFC00001FFE00001FE0000001C000000180000001800000018000 00018000000180000001FC00001FFC00001FFE00001FFC00000FF800000FF800 001FF800003FFC180C7FFE380EFFFFF80FFFFFF80FFFFFF80FFFFFFFFFFF} - Menu = SpyMenu OldCreateOrder = False Position = poDefaultPosOnly OnClose = FormClose @@ -46,6 +45,31 @@ object SpyForm: TSpyForm OnShow = FormShow PixelsPerInch = 96 TextHeight = 13 + object ToolBar: TPanel + Left = 0 + Top = 0 + Width = 576 + Height = 21 + Align = alTop + BevelOuter = bvNone + TabOrder = 0 + object FontButton: TSpeedButton + Left = 128 + Top = 0 + Width = 81 + Height = 19 + Action = ChangeFont + Flat = True + end + object KeyboardActiveCheckBox: TCheckBox + Left = 8 + Top = 0 + Width = 113 + Height = 19 + Action = KeyboardActive + TabOrder = 0 + end + end object Timer: TTimer Enabled = False Interval = 500 @@ -196,19 +220,6 @@ object SpyForm: TSpyForm FFFFFFFF00000000FFFFFFFF905C3F0300000000000000000000000000000000 000000000000} end - object SpyMenu: TMainMenu - Left = 288 - Top = 24 - object SettingsMenuItem: TMenuItem - Caption = 'Settings' - object KeyboardActiveMenuItem: TMenuItem - Action = KeyboardActive - end - object FontMenuItem: TMenuItem - Action = ChangeFont - end - end - end object PopupMenu: TPopupMenu Left = 80 Top = 104 @@ -223,11 +234,13 @@ object SpyForm: TSpyForm Left = 328 Top = 24 object KeyboardActive: TAction - Caption = 'Keyboard Active' + Caption = 'Active Keyboard' + Hint = 'Activate Local Keyboard' OnExecute = KeyboardActiveClick end object ChangeFont: TAction - Caption = 'Font...' + Caption = 'Change Font' + Hint = 'Change Font' OnExecute = ChangeFontClick end end diff --git a/src/sbbs3/ctrl/SpyFormUnit.h b/src/sbbs3/ctrl/SpyFormUnit.h index b29ad7836989dd56d989e9f0a58522541a85e312..99c4780f8bbae997c83544d60cd3c3370f7f3c68 100644 --- a/src/sbbs3/ctrl/SpyFormUnit.h +++ b/src/sbbs3/ctrl/SpyFormUnit.h @@ -49,22 +49,22 @@ #include <ToolWin.hpp> #include <Menus.hpp> #include <ActnList.hpp> +#include <Buttons.hpp> //--------------------------------------------------------------------------- class TSpyForm : public TForm { __published: // IDE-managed Components TTimer *Timer; TImageList *ImageList; - TMainMenu *SpyMenu; - TMenuItem *SettingsMenuItem; - TMenuItem *KeyboardActiveMenuItem; - TMenuItem *FontMenuItem; TPopupMenu *PopupMenu; TMenuItem *KeyboardActivePopupMenuItem; TActionList *ActionList; TAction *KeyboardActive; TAction *ChangeFont; TMenuItem *FontPopupMenuItem; + TPanel *ToolBar; + TSpeedButton *FontButton; + TCheckBox *KeyboardActiveCheckBox; void __fastcall SpyTimerTick(TObject *Sender); void __fastcall FormShow(TObject *Sender); void __fastcall FormClose(TObject *Sender, TCloseAction &Action);