private string _username; // maybe

        #endregion Fields

        #region Constructors

        public TerminalEmulator()
        {
            this.ScrollbackBufferSize = 3000;
            this.ScrollbackBuffer = new StringCollection();

            // set the display options
            this.SetStyle (ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer, true);

            this.Keyboard       = new uc_Keyboard (this);
            this.Parser         = new uc_Parser   ();
            this.NvtParser      = new uc_TelnetParser   ();
            this.Caret          = new uc_Caret    ();
            this.Modes          = new uc_Mode ();
            this.TabStops       = new uc_TabStops ();
            this.SavedCarets    = new System.Collections.ArrayList ();

            //this.Name       = "ACK-TERM";
            //this.Text       = "ACK-TERM";

            this.Caret.Pos  = new System.Drawing.Point (0, 0);
            this.CharSize   = new System.Drawing.Size ();
            this.Font       = new System.Drawing.Font (this.TypeFace, this.TypeSize, this.TypeStyle);
            //this.Font       = new System.Drawing.Font(FontFamily.GenericMonospace, 8.5F);

            //this.FGColor      = System.Drawing.Color.FromArgb (200, 200, 200);
            this.FGColor      = System.Drawing.Color.GreenYellow;
            this.BackColor    = System.Drawing.Color.FromArgb (0, 0, 160);
            this.BoldColor    = System.Drawing.Color.FromArgb (255, 255, 255);
            this.BlinkColor   = System.Drawing.Color.Red;

            this.G0 = new uc_Chars (uc_Chars.Sets.ASCII);
            this.G1 = new uc_Chars (uc_Chars.Sets.ASCII);
            this.G2 = new uc_Chars (uc_Chars.Sets.DECSG);
            this.G3 = new uc_Chars (uc_Chars.Sets.DECSG);

            this.CharAttribs.GL = G0;
            this.CharAttribs.GR = G2;
            this.CharAttribs.GS = null;

            this.GetFontInfo ();

            // Create and initialize contextmenu
            this.contextMenu1 = new ContextMenu();
            this.mnuCopy = new MenuItem("Copy");
            this.mnuPaste = new MenuItem("Paste");
            this.mnuCopyPaste = new MenuItem("Copy and Paste");
            this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
                                                                                         this.mnuCopyPaste,
                                                                                         this.mnuPaste,
                                                                                         this.mnuCopy});
            this.mnuCopy.Index = 0;
            this.mnuPaste.Index = 1;
            this.mnuCopyPaste.Index = 2;
            this.ContextMenu = this.contextMenu1;
            this.mnuCopy.Click += new System.EventHandler(this.mnuCopy_Click);
            this.mnuPaste.Click += new System.EventHandler(this.mnuPaste_Click);
            this.mnuCopyPaste.Click += new System.EventHandler(this.mnuCopyPaste_Click);

            // Create and initialize a VScrollBar.
            VertScrollBar = new uc_VertScrollBar();
            VertScrollBar.Scroll += new System.Windows.Forms.ScrollEventHandler(this.HandleScroll);

            // Dock the scroll bar to the right side of the form.
            VertScrollBar.Dock = System.Windows.Forms.DockStyle.Right;

            // Add the scroll bar to the form.
            Controls.Add (VertScrollBar);

            // create the character grid (rows by columns). This is a shadow of what's displayed
            // Set the window size to match
            this.SetSize (24, 80);

            this.Parser.ParserEvent       += new ParserEventHandler    (CommandRouter);
            this.Keyboard.KeyboardEvent   += new KeyboardEventHandler  (DispatchMessage);
            this.NvtParser.NvtParserEvent += new NvtParserEventHandler (TelnetInterpreter);
            this.RefreshEvent             += new RefreshEventHandler   (ShowBuffer);
            this.CaretOffEvent            += new CaretOffEventHandler  (this.CaretOff);
            this.CaretOnEvent             += new CaretOnEventHandler   (this.CaretOn);
            this.RxdTextEvent             += new RxdTextEventHandler   (this.NvtParser.ParseString);

            this.BeginDrag = new System.Drawing.Point();
            this.EndDrag   = new System.Drawing.Point();

            this.ConnectionType = ConnectionTypes.Telnet; // default
        }
        public TerminalEmulator()
        {
            this.ScrollbackBuffer = new ScrollBackBuffer();

            // set the display options
            this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer,
                          true);

            this.Keyboard = new uc_Keyboard(this);
            this.Parser = new uc_Parser();
            this.Caret = new uc_Caret();
            this.Modes = new uc_Mode();
            this.TabStops = new uc_TabStops();
            this.SavedCarets = new ArrayList();

            ////this.Name = "ACK-TERM";
            ////this.Text = "ACK-TERM";

            this.Caret.Pos = new Point(0, 0);
            this.CharSize = new Size();

            this.AssignDefaultColors();

            this.G0 = new uc_Chars(uc_Chars.Sets.ASCII);
            this.G1 = new uc_Chars(uc_Chars.Sets.ASCII);
            this.G2 = new uc_Chars(uc_Chars.Sets.DECSG);
            this.G3 = new uc_Chars(uc_Chars.Sets.DECSG);

            this.CharAttribs.GL = this.G0;
            this.CharAttribs.GR = this.G2;
            this.CharAttribs.GS = null;

            this.GetFontInfo();

            // Create and initialize contextmenu
            ////this.contextMenu1 = new ContextMenu();
            ////this.mnuCopy = new MenuItem("Copy");
            ////this.mnuPaste = new MenuItem("Paste");
            ////this.mnuCopyPaste = new MenuItem("Copy and Paste");
            ////this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
            ////                                                                            this.mnuCopyPaste,
            ////                                                                            this.mnuPaste,
            ////                                                                            this.mnuCopy
            ////                                                                          });
            ////this.mnuCopy.Index = 0;
            ////this.mnuPaste.Index = 1;
            ////this.mnuCopyPaste.Index = 2;
            ////this.ContextMenu = this.contextMenu1;
            ////this.mnuCopy.Click += new System.EventHandler(this.mnuCopy_Click);
            ////this.mnuPaste.Click += new System.EventHandler(this.mnuPaste_Click);
            ////this.mnuCopyPaste.Click += new System.EventHandler(this.mnuCopyPaste_Click);

            this.InitializeVerticalScrollBar();

            // create the character grid (rows by columns). This is a shadow of what's displayed
            // Set the window size to match
            this.SetSize(24, 80);

            this.Parser.ParserEvent += this.CommandRouter;
            this.Keyboard.KeyboardEvent += this.DispatchMessage;
            this.RefreshEvent += this.ShowBuffer;
            this.CaretOffEvent += this.CaretOff;
            this.CaretOnEvent += this.CaretOn;
            this.RxdTextEvent += this.Parser.ParseString;
            this.FontChanged += this.OnFontChanged;
            this.MouseWheel += this.OnMouseWheel;

            this.BeginDrag = new Point();
            this.EndDrag = new Point();

            // Enable autowrap when reaching the end of columnwidth
            this.Modes.Flags = this.Modes.Flags | uc_Mode.AutoWrap;

            this.Cursor = Cursors.IBeam;
        }
Beispiel #3
0
        public TermWindow()
        {
            m_KeyboardHookManager = new MouseKeyboardActivityMonitor.KeyboardHookListener(new MouseKeyboardActivityMonitor.WinApi.GlobalHooker());
            m_KeyboardHookManager.Enabled = true;

            ////prntSome.printSome("TermWindow");
            // set the display options
            this.SetStyle (
                System.Windows.Forms.ControlStyles.UserPaint |
                System.Windows.Forms.ControlStyles.AllPaintingInWmPaint|
                System.Windows.Forms.ControlStyles.OptimizedDoubleBuffer,
                true);

            this.settingsFrm    = new WindowsFormsApplication1.settings();
            this.runOffline     = true;
            this.Keyboard       = new uc_Keyboard (this);
            this.Parser         = new uc_Parser   ();
            this.NvtParser      = new uc_TelnetParser   ();
            this.Caret          = new uc_Caret    ();
            this.Modes          = new uc_Mode ();
            this.TabStops       = new uc_TabStops ();
            this.SavedCarets    = new System.Collections.Generic.List<uc_CaretAttribs> ();

            this.Name       = this.frmTitleRDB;
            this.Text       = this.frmTitleRDB;

            this.Caret.Pos  = new System.Drawing.Point (0, 0);
            this.CharSize   = new System.Drawing.Size ();
            this.rdbFont    = new System.Drawing.Font(this.TypeFace, this.TypeSize, this.TypeStyle);
            this.Font       = this.rdbFont;
            this.mousepnt   = new System.Drawing.Point();

            this.FGColor      = System.Drawing.Color.FromArgb (200, 200, 200);
            this.BackColor = System.Drawing.Color.FromArgb(0, 0, 0);//(0,0,160);
            this.BoldColor    = System.Drawing.Color.FromArgb (255, 255, 255);
            this.BlinkColor   = System.Drawing.Color.Red;

            this.G0 = new uc_Chars (uc_Chars.Sets.ASCII);
            this.G1 = new uc_Chars (uc_Chars.Sets.ASCII);
            this.G2 = new uc_Chars (uc_Chars.Sets.DECSG);
            this.G3 = new uc_Chars (uc_Chars.Sets.DECSG);

            this.CharAttribs.GL = G0;
            this.CharAttribs.GR = G2;
            this.CharAttribs.GS = null;

            this.GetFontInfo ();

            // Create and initialize a VScrollBar.
            VertScrollBar = new uc_VertScrollBar();

            // Dock the scroll bar to the right side of the form.
            VertScrollBar.Dock = System.Windows.Forms.DockStyle.Right;

            // Add the scroll bar to the form.
            //Controls.Add (VertScrollBar);

            this.CreateMenu ();

            // create the character grid (rows by columns). This is a shadow of what's displayed
            // Set the window size to match
            this.SetSize (25, 80);

            this.rdbAutoProcess = new uc_autoprocess(this.Rows, this.Columns, this);

            this.Parser.ParserEvent       += new ParserEventHandler    (CommandRouter);
            this.Keyboard.KeyboardEvent   += new KeyboardEventHandler  (DispatchMessage);
            this.NvtParser.NvtParserEvent += new NvtParserEventHandler (TelnetInterpreter);
            this.RefreshEvent             += new RefreshEventHandler   (ShowBuffer);
            this.RxdDataLoaded            += new RxdDataLoadedHander   (StartAutoProcess);
            this.CaretOffEvent            += new CaretOffEventHandler  (this.CaretOff);
            this.CaretOnEvent             += new CaretOnEventHandler   (this.CaretOn);
            this.RxdTextEvent             += new RxdTextEventHandler   (this.NvtParser.ParseString);

            //rdb
            //this.OnClickConnect (new System.Object (), new System.EventArgs ());
            //endrdb
            this.rbdlg = new System.Windows.Forms.OpenFileDialog();
            this.rbdlg.Multiselect = false;

            this.scrnwidth = this.CharSize.Width * this.Columns;
            this.scrnheight = (this.CharSize.Height * this.Rows) + this.CharSize.Height;

            /*this._rdbitems = new System.Collections.Generic.List<string>();
            this._rdbitems.Add("aaa");
            this._rdbitems.Add("bbb");
            this._rdbitems.Add("ccc");
            this.rdbListBox = new System.Windows.Forms.ListBox();
            this.rdbListBox.Top = 500;
            this.rdbListBox.Left = 500;
            this.rdbListBox.DataSource = this._rdbitems;
            this.Controls.Add(this.rdbListBox);

            this.rdbNextBtn = new System.Windows.Forms.Button();
            this.rdbNextBtn.Text = "Next";
            this.rdbNextBtn.Location = new System.Drawing.Point(600, 500);

            this.Controls.Add(this.rdbNextBtn);*/
            //this.GotFocus += MainWindow_GotFocus;
            //this.LostFocus += MainWindow_LostFocus;
            this.CenterToScreen();
        }