Exemple #1
0
        /*
         * public SSHProtocol(TerminalEmulator term)
         * {
         *
         *      m_term = term;
         *      m_firstTime = true;
         * }
         */

        public SSHProtocol(SSHBuffer adapter)
        {
            m_sshTerminal = adapter;
            //m_term = term;
            m_network   = ChameleonNetworking.Instance;
            m_firstTime = true;
        }
        public ChameleonForm()
        {
            InitializeComponent();

            m_templateMenuItems = new List <ToolStripMenuItem>();

            m_compiler = new Compiler();

            this.m_editors = new Chameleon.GUI.EditorContainer();
            this.splitEditorTerminal.Panel1.Controls.Add(this.m_editors);
            this.m_editors.Dock                 = System.Windows.Forms.DockStyle.Fill;
            this.m_editors.Location             = new System.Drawing.Point(0, 0);
            this.m_editors.Name                 = "m_editors";
            this.m_editors.Size                 = new System.Drawing.Size(660, 261);
            this.m_editors.TabIndex             = 4;
            this.m_editors.EditorStatusChanged += new EventHandler(OnEditorStatusChanged);

            addThrowExceptionMenuItem();

            FormFontFixer.Fix(this);

            Options options = App.GlobalSettings;

            // Scintilla provides these already, so we don't need to actually set the keys
            menuEditUndo.ShortcutKeyDisplayString  = "Ctrl+Z";
            menuEditRedo.ShortcutKeyDisplayString  = "Ctrl+Y";
            menuEditCopy.ShortcutKeyDisplayString  = "Ctrl+C";
            menuEditCut.ShortcutKeyDisplayString   = "Ctrl+X";
            menuEditPaste.ShortcutKeyDisplayString = "Ctrl+V";

            toolTextPassword.TextBox.UseSystemPasswordChar = true;

            m_networking = ChameleonNetworking.Instance;

            toolStatusConnected.Text   = "Disconnected";
            toolHostDisconnect.Enabled = false;

            SSHBuffer buffer = new SSHBuffer();

            m_sshProtocol = new SSHProtocol(buffer);
            m_sshProtocol.OnDisconnect += new Action(SetDisconnectedUI);

            m_terminal           = new SwingTerminal(buffer);
            m_terminal.Dock      = DockStyle.Fill;
            m_terminal.ForeColor = Color.White;
            m_terminal.BackColor = Color.Black;
            m_terminal.Parent    = m_tabTerminal;
            m_terminal.Enabled   = false;

            m_terminal.Resize += (sender, e) =>
            {
                m_terminal.ResizeBuffer();

                if (m_networking.IsConnected)
                {
                    int width  = m_terminal.VDUBuffer.Columns;
                    int height = m_terminal.VDUBuffer.Rows;

                    m_sshProtocol._pf.ResizeTerminal(width, height, width, height);
                }
            };

            RemoteFileDialog rfd = Singleton <RemoteFileDialog> .Instance;

            rfd.Networking = ChameleonNetworking.Instance;

            cmw = Singleton <CtagsManagerWrapper> .Instance;

            string indexerPath = Path.GetDirectoryName(Application.ExecutablePath);
            string tagsDBPath  = Path.Combine(Options.DataFolder, "ChameleonTags.db");

            cmw.CodeLiteParserInit(indexerPath, tagsDBPath);
            parserInitialized = true;

            ShowPermittedUI();

            toolTextHost.Text = App.UserSettings.LastHostname;
            toolTextUser.Text = App.UserSettings.LastUsername;

            m_clickedSnippet = false;

            m_zoom = ZoomLevel.Normal;

            m_compiler.CompilerEvent += new EventHandler <CompilerEventArgs>(OnCompilerEvent);

            ImageList compilerErrorIcons = new ImageList();

            compilerErrorIcons.ColorDepth = ColorDepth.Depth32Bit;

            Icon warning = Shell32.IconFromFile("user32.dll", IconSize.Small, 1);
            Icon error   = Shell32.IconFromFile("user32.dll", IconSize.Small, 3);

            compilerErrorIcons.ImageSize = new Size(16, 16);
            compilerErrorIcons.Images.Add(warning);
            compilerErrorIcons.Images.Add(error);

            m_lvCompilerErrors.SmallImageList = compilerErrorIcons;

            UpdateCompileButton();

            UpdateZoomMenu();

            LoadSnippetImages();

            AddSnippetGroups();

            Application.Idle += new EventHandler(OnApplicationIdle);
        }