コード例 #1
0
ファイル: viewfile.cs プロジェクト: arg/mc
        public FullView(Stream source)
            : base(0, 0, Application.Cols, Application.Lines)
        {
            view = new ViewWidget (0, 0, Application.Cols, Application.Lines-1, false, source);
            bar = new ButtonBar (bar_labels);
            bar.Action += delegate (int n){
                switch (n){
                case 2:
                    SetWrap (!view.Wrap);
                    break;
                case 3:
                case 10:
                    Running = false;
                    break;
                }
            };

            Add (view);
            Add (bar);
        }
コード例 #2
0
ファイル: mc.cs プロジェクト: txdv/mc
        void SetupGUI()
        {
            left = Panel.Create (this, "left", 4);
            right = Panel.Create (this, "right", 4);
            bar = new ButtonBar (bar_labels);
            menu = new MenuBar (mc_menu);
            prompt = new Label (0, Application.Lines-2, "bash$ ") {
                Color = Application.ColorBasic
            };
            entry = new Entry (prompt.Text.Length, Application.Lines-2, Application.Cols - prompt.Text.Length, "") {
                Color = Application.ColorBasic,
                CanFocus = false,
            };

            bar.Action += delegate (int n) {
                switch (n) {
                case 5:
                    CurrentPanel.Copy (OtherPanel.CurrentPath);
                    break;

                case 9:
                    menu.Activate (0);
                    break;

                case 10:
                    var r = MessageBox.Query (56, 7, "Midnight Commander NG", "Do you really want to quit?", "Yes", "No");
                    if (r == 0)
                        Running = false;
                    break;

                default:
                    break;
                }
            };

            Add (left);
            Add (right);
            Add (bar);
            Add (menu);
            Add (prompt);
            Add (entry);

            SetFocus (left);
        }
コード例 #3
0
        void SetupGUI()
        {
            var height = Application.Lines - 4;

            left   = Panel.Create(this, "left", 4);
            right  = Panel.Create(this, "right", 4);
            bar    = new ButtonBar(bar_labels);
            menu   = new MenuBar(mc_menu);
            prompt = new Label(0, Application.Lines - 2, "bash$ acción ")
            {
                Color = Application.ColorBasic
            };
            entry = new Entry(prompt.Text.Length, Application.Lines - 2, Application.Cols - prompt.Text.Length, "")
            {
                Color    = Application.ColorBasic,
                CanFocus = false,
            };

            bar.Action += delegate(int n){
                switch (n)
                {
                case 3:
                    var selected = CurrentPanel.SelectedNode;
                    if (selected is Listing.DirNode)
                    {
                        CurrentPanel.ChangeDir(selected as Listing.DirNode);
                    }
                    else
                    {
                        Stream stream;
                        try {
                            stream = File.OpenRead(CurrentPanel.SelectedPath);
                        } catch (IOException ioe) {
                            Message.Error(ioe, "Could not open file", CurrentPanel.SelectedPath);
                            return;
                        }
                        FullView.Show(stream);

                        stream.Dispose();
                    }
                    break;

                case 5:
                    CurrentPanel.Copy(OtherPanel.CurrentPath);
                    break;

                case 9:
                    menu.Activate(0);
                    break;

                case 10:
                    var r = MessageBox.Query(56, 7, "Midnight Commander NG", "Do you really want to quit?", "Yes", "No");
                    if (r == 0)
                    {
                        Running = false;
                    }
                    break;

                default:
                    break;
                }
            };

            Add(left);
            Add(right);
            Add(bar);
            Add(menu);
            Add(prompt);
            Add(entry);

            SetFocus(left);
        }
コード例 #4
0
ファイル: mc.cs プロジェクト: arg/mc
        void SetupGUI()
        {
            var height = Application.Lines - 4;

            left = Panel.Create (this, "left", 4);
            right = Panel.Create (this, "right", 4);
            bar = new ButtonBar (bar_labels);
            menu = new MenuBar (mc_menu);
            prompt = new Label (0, Application.Lines-2, "bash$ acción ") {
                Color = Application.ColorBasic
            };
            entry = new Entry (prompt.Text.Length, Application.Lines-2, Application.Cols - prompt.Text.Length, "") {
                Color = Application.ColorBasic,
                CanFocus = false,
            };

            bar.Action += delegate (int n){
                switch (n){
                case 3:
                    var selected = CurrentPanel.SelectedNode;
                    if (selected is Listing.DirNode)
                        CurrentPanel.ChangeDir (selected as Listing.DirNode);
                    else {
                        Stream stream;
                        try {
                            stream = File.OpenRead (CurrentPanel.SelectedPath);
                        } catch (IOException ioe) {
                            Message.Error (ioe, "Could not open file", CurrentPanel.SelectedPath);
                            return;
                        }
                        FullView.Show (stream);

                        stream.Dispose ();
                    }
                    break;
                case 5:
                    CurrentPanel.Copy (OtherPanel.CurrentPath);
                    break;

                case 9:
                    menu.Activate (0);
                    break;

                case 10:
                    var r = MessageBox.Query (56, 7, "Midnight Commander NG", "Do you really want to quit?", "Yes", "No");
                    if (r == 0)
                        Running = false;
                    break;

                default:
                    break;
                }
            };

            Add (left);
            Add (right);
            Add (bar);
            Add (menu);
            Add (prompt);
            Add (entry);

            SetFocus (left);
        }