Пример #1
0
Файл: VEd.cs Проект: AVert/fcmd
        KeyboardHelpButton[] KeybHelpButtons = new KeyboardHelpButton[11];         //одна лишняя, которая [0]

        public VEd()
        {
            for (int i = 1; i < 11; i++)
            {
                KeybHelpButtons[i]             = new KeyboardHelpButton();
                KeybHelpButtons[i].FKey        = "F" + i;
                KeybHelpButtons[i].Text        = Locale.GetString("FCVE_F" + i);
                KeybHelpButtons[i].CanGetFocus = false;
                KeyBoardHelp.PackStart(KeybHelpButtons[i], true, Xwt.WidgetPlacement.Fill, Xwt.WidgetPlacement.Fill, 0, 1, 0, 1);
            }

            this.Title   = Locale.GetString("File Commander VE");
            this.Content = Layout;

            CommandBox.KeyReleased += new EventHandler <Xwt.KeyEventArgs>(CommandBox_KeyReleased);

            mnuFile.Label   = Locale.GetString("FCVE_mnuFile");
            mnuFile.SubMenu = new Xwt.Menu();
            mnuFile.SubMenu.Items.Add(mnuFileNew);
            mnuFile.SubMenu.Items.Add(mnuFileOpen);
            mnuFile.SubMenu.Items.Add(mnuFileReload);
            mnuFile.SubMenu.Items.Add(mnuFileSave);
            mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuFile.SubMenu.Items.Add(mnuFilePrint);
            mnuFile.SubMenu.Items.Add(mnuFilePrintPreview);
            mnuFile.SubMenu.Items.Add(mnuFilePrintSettings);
            mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuFile.SubMenu.Items.Add(mnuFileClose);
            TranslateMenu(mnuFile.SubMenu);

            mnuEdit.Label   = Locale.GetString("FCVE_mnuEdit");
            mnuEdit.SubMenu = new Xwt.Menu();
            mnuEdit.SubMenu.Items.Add(mnuEditCut);
            mnuEdit.SubMenu.Items.Add(mnuEditCopy);
            mnuEdit.SubMenu.Items.Add(mnuEditPaste);
            mnuEdit.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuEdit.SubMenu.Items.Add(mnuEditSelectAll);
            mnuEdit.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuEdit.SubMenu.Items.Add(mnuEditFindReplace);
            mnuEdit.SubMenu.Items.Add(mnuEditFindNext);
            TranslateMenu(mnuEdit.SubMenu);

            mnuView.Label            = Locale.GetString("FCVE_mnuView");
            mnuViewSettings.Clicked += (o, ea) => {
                new VEsettings().Run();
                Plugin.ShowToolbar   = fcmd.Properties.Settings.Default.VE_ShowToolbar;
                KeyBoardHelp.Visible = Properties.Settings.Default.ShowKeybrdHelp;
                CommandBox.Visible   = Properties.Settings.Default.VE_ShowCmdBar;
            };
            mnuView.SubMenu = new Xwt.Menu();
            mnuView.SubMenu.Items.Add(mnuViewSettings);
            TranslateMenu(mnuView.SubMenu);

            mnuFormat.Label = Locale.GetString("FCVE_mnuFormat");

            mnuHelp.Label   = Locale.GetString("FCVE_mnuHelp");
            mnuHelp.SubMenu = new Xwt.Menu();
            mnuHelp.SubMenu.Items.Add(mnuHelpHelpme);
            mnuHelp.SubMenu.Items.Add(mnuHelpAbout);
            TranslateMenu(mnuHelp.SubMenu);

            this.MainMenu = new Xwt.Menu();
            this.MainMenu.Items.Add(mnuFile);
            this.MainMenu.Items.Add(mnuEdit);
            this.MainMenu.Items.Add(mnuView);
            this.MainMenu.Items.Add(mnuFormat);
            this.MainMenu.Items.Add(mnuHelp);

            mnuFileOpen.Clicked          += (o, ea) => { OpenFile(); };
            mnuFilePrint.Clicked         += (o, ea) => { SendCommand("print"); };
            mnuFilePrintSettings.Clicked += (o, ea) => { SendCommand("pagesetup"); };
            mnuFilePrintPreview.Clicked  += (o, ea) => { SendCommand("print preview"); };
            mnuFileClose.Clicked         += (o, ea) => { Exit(); };
            mnuEditCut.Clicked           += (o, ea) => { SendCommand("cut selected"); };
            mnuEditCopy.Clicked          += (o, ea) => { SendCommand("copy selected"); };
            mnuEditPaste.Clicked         += (o, ea) => { SendCommand("paste clipboard"); };
            mnuEditSelectAll.Clicked     += (o, ea) => { SendCommand("select *"); };
            mnuEditFindReplace.Clicked   += (o, ea) => { SendCommand("findreplace"); };
            mnuEditFindNext.Clicked      += (o, ea) => { SendCommand("findreplace last"); };
            mnuHelpAbout.Clicked         += new EventHandler(mnuHelpAbout_Clicked);

            this.CloseRequested += VEd_CloseRequested;
            this.Shown          += new EventHandler(VEd_Shown);

#if !MONO
            PluginBody = new Xwt.Spinner()
            {
                Animate = true
            };
#else
            PluginBody = new Xwt.HBox();             //"workaround" for xwt/XWT bug https://github.com/mono/xwt/issues/283
#endif

            BuildLayout();
        }
Пример #2
0
        public VEd()
        {
            for (int i = 1; i < 11; i++)
            {
                KeybHelpButtons[i] = new KeyboardHelpButton();
                KeybHelpButtons[i].FKey = "F" + i;
                KeybHelpButtons[i].Text = Localizator.GetString("FCVE_F" + i);
                KeybHelpButtons[i].CanGetFocus = false;
                KeybHelpButtons[i].Clicked += KeyboardHelpButton_Clicked;
                KeybHelpButtons[i].Tag = i;
                KeyBoardHelp.PackStart(KeybHelpButtons[i], true, WidgetPlacement.Fill, WidgetPlacement.Fill, 0,1,0,1);
            }

            Title = "File Commander VE";
            Content = Layout;

            CommandBox.KeyReleased += CommandBox_KeyReleased;
            Layout.KeyReleased += Layout_KeyReleased;

            mnuFile.SubMenu = new Menu();
            mnuFile.SubMenu.Items.Add(mnuFileNew);
            mnuFile.SubMenu.Items.Add(mnuFileOpen);
            mnuFile.SubMenu.Items.Add(mnuFileReload);
            mnuFile.SubMenu.Items.Add(mnuFileSave);
            mnuFile.SubMenu.Items.Add(new SeparatorMenuItem());
            mnuFile.SubMenu.Items.Add(mnuFilePrint);
            mnuFile.SubMenu.Items.Add(mnuFilePrintPreview);
            mnuFile.SubMenu.Items.Add(mnuFilePrintSettings);
            mnuFile.SubMenu.Items.Add(new SeparatorMenuItem());
            mnuFile.SubMenu.Items.Add(mnuFileClose);

            mnuEdit.SubMenu = new Menu();
            mnuEdit.SubMenu.Items.Add(mnuEditCut);
            mnuEdit.SubMenu.Items.Add(mnuEditCopy);
            mnuEdit.SubMenu.Items.Add(mnuEditPaste);
            mnuEdit.SubMenu.Items.Add(new SeparatorMenuItem());
            mnuEdit.SubMenu.Items.Add(mnuEditSelectAll);
            mnuEdit.SubMenu.Items.Add(new SeparatorMenuItem());
            mnuEdit.SubMenu.Items.Add(mnuEditFindReplace);
            mnuEdit.SubMenu.Items.Add(mnuEditFindNext);

            mnuViewSettings.Clicked += (o, ea) => {
                new VEsettings().Run();
                Plugin.ShowToolbar = Settings.Default.VE_ShowToolbar;
                KeyBoardHelp.Visible = Settings.Default.ShowKeybrdHelp;
                CommandBox.Visible = Settings.Default.VE_ShowCmdBar;
            };
            mnuView.SubMenu = new Menu();
            mnuView.SubMenu.Items.Add(mnuViewSettings);

            mnuHelp.SubMenu = new Menu();
            mnuHelp.SubMenu.Items.Add(mnuHelpHelpme);
            mnuHelp.SubMenu.Items.Add(mnuHelpAbout);

            MainMenu = new Menu();
            MainMenu.Items.Add(mnuFile);
            MainMenu.Items.Add(mnuEdit);
            MainMenu.Items.Add(mnuView);
            MainMenu.Items.Add(mnuFormat);
            MainMenu.Items.Add(mnuHelp);

            mnuFileOpen.Clicked += (o, ea) => { OpenFile(); };
            mnuFilePrint.Clicked += (o, ea) => { SendCommand("print"); };
            mnuFilePrintSettings.Clicked += (o, ea) => { SendCommand("pagesetup"); };
            mnuFilePrintPreview.Clicked += (o, ea) => { SendCommand("print preview"); };
            mnuFileClose.Clicked += (o, ea) => { Exit(); };
            mnuEditCut.Clicked += (o, ea) => { SendCommand("cut selected"); };
            mnuEditCopy.Clicked += (o, ea) => { SendCommand("copy selected"); };
            mnuEditPaste.Clicked += (o, ea) => { SendCommand("paste clipboard"); };
            mnuEditSelectAll.Clicked += (o, ea) => { SendCommand("select *"); };
            mnuEditFindReplace.Clicked += (o, ea) => { SendCommand("findreplace"); };
            mnuEditFindNext.Clicked += (o, ea) => { SendCommand("findreplace last"); };
            mnuHelpAbout.Clicked += mnuHelpAbout_Clicked;

            CloseRequested += VEd_CloseRequested;

            Localizator.LocalizationChanged += (o, ea) => Localize();

            PluginBody = new Spinner { Animate = true };
            BuildLayout();
            Localize();
        }
Пример #3
0
        public VEd()
        {
            for (int i = 1; i < 11; i++)
            {
                KeybHelpButtons[i] = new KeyboardHelpButton();
                KeybHelpButtons[i].FKey = "F" + i;
                KeybHelpButtons[i].Text = Locale.GetString("FCVE_F" + i);
                KeybHelpButtons[i].CanGetFocus = false;
                KeyBoardHelp.PackStart(KeybHelpButtons[i], true, Xwt.WidgetPlacement.Fill, Xwt.WidgetPlacement.Fill, 0,1,0,1);
            }

            this.Title = Locale.GetString("File Commander VE");
            this.Content = Layout;

            CommandBox.KeyReleased += new EventHandler<Xwt.KeyEventArgs>(CommandBox_KeyReleased);

            mnuFile.Label = Locale.GetString("FCVE_mnuFile");
            mnuFile.SubMenu = new Xwt.Menu();
            mnuFile.SubMenu.Items.Add(mnuFileNew);
            mnuFile.SubMenu.Items.Add(mnuFileOpen);
            mnuFile.SubMenu.Items.Add(mnuFileReload);
            mnuFile.SubMenu.Items.Add(mnuFileSave);
            mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuFile.SubMenu.Items.Add(mnuFilePrint);
            mnuFile.SubMenu.Items.Add(mnuFilePrintPreview);
            mnuFile.SubMenu.Items.Add(mnuFilePrintSettings);
            mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuFile.SubMenu.Items.Add(mnuFileClose);
            TranslateMenu(mnuFile.SubMenu);

            mnuEdit.Label = Locale.GetString("FCVE_mnuEdit");
            mnuEdit.SubMenu = new Xwt.Menu();
            mnuEdit.SubMenu.Items.Add(mnuEditCut);
            mnuEdit.SubMenu.Items.Add(mnuEditCopy);
            mnuEdit.SubMenu.Items.Add(mnuEditPaste);
            mnuEdit.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuEdit.SubMenu.Items.Add(mnuEditSelectAll);
            mnuEdit.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuEdit.SubMenu.Items.Add(mnuEditFindReplace);
            mnuEdit.SubMenu.Items.Add(mnuEditFindNext);
            TranslateMenu(mnuEdit.SubMenu);

            mnuView.Label = Locale.GetString("FCVE_mnuView");
            mnuViewSettings.Clicked += (o, ea) => {
                new VEsettings().Run();
                Plugin.ShowToolbar = fcmd.Properties.Settings.Default.VE_ShowToolbar;
                KeyBoardHelp.Visible = Properties.Settings.Default.ShowKeybrdHelp;
                CommandBox.Visible = Properties.Settings.Default.VE_ShowCmdBar;
            };
            mnuView.SubMenu = new Xwt.Menu();
            mnuView.SubMenu.Items.Add(mnuViewSettings);
            TranslateMenu(mnuView.SubMenu);

            mnuFormat.Label = Locale.GetString("FCVE_mnuFormat");

            mnuHelp.Label = Locale.GetString("FCVE_mnuHelp");
            mnuHelp.SubMenu = new Xwt.Menu();
            mnuHelp.SubMenu.Items.Add(mnuHelpHelpme);
            mnuHelp.SubMenu.Items.Add(mnuHelpAbout);
            TranslateMenu(mnuHelp.SubMenu);

            this.MainMenu = new Xwt.Menu();
            this.MainMenu.Items.Add(mnuFile);
            this.MainMenu.Items.Add(mnuEdit);
            this.MainMenu.Items.Add(mnuView);
            this.MainMenu.Items.Add(mnuFormat);
            this.MainMenu.Items.Add(mnuHelp);

            mnuFileOpen.Clicked += (o, ea) => { OpenFile(); };
            mnuFilePrint.Clicked += (o, ea) => { SendCommand("print"); };
            mnuFilePrintSettings.Clicked += (o, ea) => { SendCommand("pagesetup"); };
            mnuFilePrintPreview.Clicked += (o, ea) => { SendCommand("print preview"); };
            mnuFileClose.Clicked += (o, ea) => { Exit(); };
            mnuEditCut.Clicked += (o, ea) => { SendCommand("cut selected"); };
            mnuEditCopy.Clicked += (o, ea) => { SendCommand("copy selected"); };
            mnuEditPaste.Clicked += (o, ea) => { SendCommand("paste clipboard"); };
            mnuEditSelectAll.Clicked += (o, ea) => { SendCommand("select *"); };
            mnuEditFindReplace.Clicked += (o, ea) => { SendCommand("findreplace"); };
            mnuEditFindNext.Clicked += (o, ea) => { SendCommand("findreplace last"); };
            mnuHelpAbout.Clicked += new EventHandler(mnuHelpAbout_Clicked);

            this.CloseRequested += VEd_CloseRequested;
            this.Shown += new EventHandler(VEd_Shown);

            #if !MONO
            PluginBody = new Xwt.Spinner() { Animate = true };
            #else
            PluginBody = new Xwt.HBox(); //"workaround" for xwt/XWT bug https://github.com/mono/xwt/issues/283
            #endif

            BuildLayout();
        }
Пример #4
0
        public MainWindow(string[] argv)
        {
            this.Title = "File Commander";
            this.MainMenu = WindowMenu;

            //build user interface
            MainMenu.Items.Add(mnuFile);
            MainMenu.Items.Add(mnuView);
            MainMenu.Items.Add(mnuNavigate);
            MainMenu.Items.Add(mnuTools);
            MainMenu.Items.Add(mnuHelp);

            mnuFile.SubMenu = new Xwt.Menu();
            mnuFile.SubMenu.Items.Add(mnuFileUserMenu);
            mnuFile.SubMenu.Items.Add(mnuFileView);
            mnuFile.SubMenu.Items.Add(mnuFileEdit);
            mnuFile.SubMenu.Items.Add(mnuFileCompare);
            mnuFile.SubMenu.Items.Add(mnuFileCopy);
            mnuFile.SubMenu.Items.Add(mnuFileMove);
            mnuFile.SubMenu.Items.Add(mnuFileNewDir);
            mnuFile.SubMenu.Items.Add(mnuFileRemove);
            mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuFile.SubMenu.Items.Add(mnuFileAtributes);
            mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuFile.SubMenu.Items.Add(mnuFileQuickSelect);
            mnuFile.SubMenu.Items.Add(mnuFileQuickUnselect);
            mnuFile.SubMenu.Items.Add(mnuFileSelectAll);
            mnuFile.SubMenu.Items.Add(mnuFileUnselect);
            mnuFile.SubMenu.Items.Add(mnuFileInvertSelection);
            mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuFile.SubMenu.Items.Add(mnuFileExit);

            mnuView.SubMenu = new Xwt.Menu();
            mnuView.SubMenu.Items.Add(mnuViewShort);
            mnuView.SubMenu.Items.Add(mnuViewDetails);
            mnuView.SubMenu.Items.Add(mnuViewIcons);
            mnuView.SubMenu.Items.Add(mnuViewThumbs);
            mnuView.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuView.SubMenu.Items.Add(mnuViewQuickView);
            mnuView.SubMenu.Items.Add(mnuViewTree);
            mnuView.SubMenu.Items.Add(mnuViewPCPCconnect);
            mnuView.SubMenu.Items.Add(mnuViewPCNETPCconnect);
            mnuView.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuView.SubMenu.Items.Add(mnuViewByName);
            mnuView.SubMenu.Items.Add(mnuViewByType);
            mnuView.SubMenu.Items.Add(mnuViewByDate);
            mnuView.SubMenu.Items.Add(mnuViewBySize);
            mnuView.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuView.SubMenu.Items.Add(mnuViewNoFilter);
            mnuView.SubMenu.Items.Add(mnuViewWithFilter);
            mnuView.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuView.SubMenu.Items.Add(mnuViewKeybrdHelp); //these checkboxes are don't work, because no code was written
            mnuView.SubMenu.Items.Add(mnuViewInfobar);
            mnuView.SubMenu.Items.Add(mnuViewDiskButtons);

            mnuNavigate.SubMenu = new Xwt.Menu();
            mnuNavigate.SubMenu.Items.Add(mnuNavigateTree);
            mnuNavigate.SubMenu.Items.Add(mnuNavigateHistory);
            mnuNavigate.SubMenu.Items.Add(mnuNavigateFind);
            mnuNavigate.SubMenu.Items.Add(mnuNavigateReload);

            mnuTools.SubMenu = new Xwt.Menu();
            mnuTools.SubMenu.Items.Add(mnuToolsOptions);
            mnuTools.SubMenu.Items.Add(mnuToolsPluginManager);
            mnuTools.SubMenu.Items.Add(mnuToolsEditUserMenu);
            mnuTools.SubMenu.Items.Add(mnuToolsKeychains);
            mnuTools.SubMenu.Items.Add(mnuToolsConfigEdit);
            mnuTools.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuTools.SubMenu.Items.Add(mnuToolsDiskLabel);
            mnuTools.SubMenu.Items.Add(mnuToolsFormat);
            mnuTools.SubMenu.Items.Add(mnuToolsSysInfo);

            mnuHelp.SubMenu = new Xwt.Menu();
            mnuHelp.SubMenu.Items.Add(mnuHelpHelpMe);
            mnuHelp.SubMenu.Items.Add(mnuHelpDebug);
            mnuHelp.SubMenu.Items.Add(mnuHelpAbout);

            TranslateMenu(MainMenu);

            this.CloseRequested += new Xwt.CloseRequestedHandler(MainWindow_CloseRequested);
            PanelLayout.KeyReleased += new EventHandler<Xwt.KeyEventArgs>(PanelLayout_KeyReleased);
            mnuFileView.Clicked += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.F3, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileEdit.Clicked += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.F4, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileCopy.Clicked += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.F5, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileMove.Clicked += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.F6, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileNewDir.Clicked += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.F7, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileRemove.Clicked += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.F8, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileSelectAll.Clicked += (o, ea) => { ActivePanel.ListingView.Select(null); };
            mnuFileUnselect.Clicked += (o, ea) => { ActivePanel.ListingView.Unselect(); };
            mnuFileInvertSelection.Clicked += (o, ea) => { ActivePanel.ListingView.InvertSelection(); };
            mnuFileQuickSelect.Clicked += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.NumPadAdd, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileQuickUnselect.Clicked += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.NumPadSubtract, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileExit.Clicked += (o, ea) => { this.Close(); };
            mnuViewNoFilter.Clicked += (o, ea) => { ActivePanel.LoadDir(); };
            mnuViewWithFilter.Clicked += new EventHandler(mnuViewWithFilter_Clicked);
            mnuNavigateReload.Clicked += new EventHandler(mnuNavigateReload_Clicked);
            mnuToolsOptions.Clicked += new EventHandler(mnuToolsOptions_Clicked);
            mnuHelpDebug.Clicked += ShowDebugInfo;
            mnuHelpAbout.Clicked += new EventHandler(mnuHelpAbout_Clicked);

            Layout.PackStart(PanelLayout, true, Xwt.WidgetPlacement.Fill, Xwt.WidgetPlacement.Fill, -12, -6, -12,12);
            Layout.PackStart(KeyBoardHelp, false,Xwt.WidgetPlacement.End,Xwt.WidgetPlacement.Fill,-12,-12,-12);

            this.Content = Layout;

            //check settings
            if (fcmd.Properties.Settings.Default.UserTheme != null)
            {
                if (fcmd.Properties.Settings.Default.UserTheme != "")
                {
                    if (File.Exists(fcmd.Properties.Settings.Default.UserTheme))
                        stylist = new pluginner.Stylist(fcmd.Properties.Settings.Default.UserTheme);
                    else
                    {
                        Xwt.MessageDialog.ShowError(Locale.GetString("ThemeNotFound"), fcmd.Properties.Settings.Default.UserTheme);
                        Xwt.Application.Exit();
                    }
                }
            }

            //load bookmarks
            string BookmarksStore = null;
            if (fcmd.Properties.Settings.Default.BookmarksFile != null && fcmd.Properties.Settings.Default.BookmarksFile.Length > 0)
            {
                BookmarksStore = File.ReadAllText(fcmd.Properties.Settings.Default.BookmarksFile, Encoding.UTF8);
            }

            //build panels
            PanelLayout.Panel1.Content = new pluginner.FileListPanel(BookmarksStore, fcmd.Properties.Settings.Default.UserTheme, Properties.Settings.Default.InfoBarContent1, Properties.Settings.Default.InfoBarContent2); //Левая, правая где сторона? Улица, улица, ты, брат, пьяна!
            PanelLayout.Panel2.Content = new pluginner.FileListPanel(BookmarksStore, fcmd.Properties.Settings.Default.UserTheme, Properties.Settings.Default.InfoBarContent1, Properties.Settings.Default.InfoBarContent2);

            p1 = (PanelLayout.Panel1.Content as pluginner.FileListPanel);
            p2 = (PanelLayout.Panel2.Content as pluginner.FileListPanel);
            p1.OpenFile += new pluginner.TypedEvent<string>(Panel_OpenFile);
            p2.OpenFile += new pluginner.TypedEvent<string>(Panel_OpenFile);

            List<pluginner.ListView2.CollumnInfo> LVCols = new List<pluginner.ListView2.CollumnInfo>();
            LVCols.Add(new pluginner.ListView2.CollumnInfo() { Title = "", Tag = "Icon", Width = 16, Visible = true });
            LVCols.Add(new pluginner.ListView2.CollumnInfo() { Title = "URL", Tag = "Path", Width = 0, Visible = false });
            LVCols.Add(new pluginner.ListView2.CollumnInfo() { Title = Locale.GetString("FName"), Tag = "FName", Width = 100, Visible = true });
            LVCols.Add(new pluginner.ListView2.CollumnInfo() { Title = Locale.GetString("FSize"), Tag = "FSize", Width = 50, Visible = true });
            LVCols.Add(new pluginner.ListView2.CollumnInfo() { Title = Locale.GetString("FDate"), Tag = "FDate", Width = 50, Visible = true });

            p1.FS = new base_plugins.fs.localFileSystem();

            p1.ListingView.Collumns = LVCols.ToArray();

            p2.FS = new base_plugins.fs.localFileSystem();
            p2.ListingView.Collumns = LVCols.ToArray();

            p1.GotFocus += (o, ea) => { SwitchPanel(p1); };
            p2.GotFocus += (o, ea) => { SwitchPanel(p2); };

            //build keyboard help bar
            for (int i = 1; i < 11; i++)
            {
                KeybHelpButtons[i] = new KeyboardHelpButton();
                KeybHelpButtons[i].FKey = "F" + i;
                KeybHelpButtons[i].Text = Locale.GetString("FCF" + i);
                KeybHelpButtons[i].CanGetFocus = false;
                KeyBoardHelp.PackStart(KeybHelpButtons[i],true,Xwt.WidgetPlacement.Fill,Xwt.WidgetPlacement.Fill,0,-6,0,-3);
            }
            KeybHelpButtons[1].Clicked += (o, ea) => { this.PanelLayout_KeyReleased(this,new Xwt.KeyEventArgs(Xwt.Key.F1,Xwt.ModifierKeys.None,false,0)); };
            KeybHelpButtons[2].Clicked += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F2, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[3].Clicked += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F3, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[4].Clicked += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F4, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[5].Clicked += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F5, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[6].Clicked += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F6, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[7].Clicked += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F7, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[8].Clicked += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F8, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[9].Clicked += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F9, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[10].Clicked += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F10, Xwt.ModifierKeys.None, false, 0)); };
            //todo: replace this shit-code with huge using of KeybHelpButtons[n].Tag property (note that it's difficult to be realized due to c# restrictions)

            //apply user's settings
            //milliseconds for double click
            pluginner.ListView2.MillisecondsForDoubleClick = Winforms.SystemInformation.DoubleClickTime;
            //window size
            this.Width = fcmd.Properties.Settings.Default.WinWidth;
            this.Height = fcmd.Properties.Settings.Default.WinHeight;
            //file size display policy
            char[] Policies = fcmd.Properties.Settings.Default.SizeShorteningPolicy.ToCharArray();

            //load last directory or the current directory if the last directory hasn't remembered
            if (Properties.Settings.Default.Panel1URL.Length != 0)
                p1.LoadDir(Properties.Settings.Default.Panel1URL, ConvertSDP(Policies[0]), ConvertSDP(Policies[1]), ConvertSDP(Policies[2]));
            else
                p1.LoadDir("file://" + System.IO.Directory.GetCurrentDirectory(), ConvertSDP(Policies[0]), ConvertSDP(Policies[1]), ConvertSDP(Policies[2]));

            if (Properties.Settings.Default.Panel2URL.Length != 0)
                p2.LoadDir(Properties.Settings.Default.Panel2URL, ConvertSDP(Policies[0]), ConvertSDP(Policies[1]), ConvertSDP(Policies[2]));
            else
                p2.LoadDir("file://" + System.IO.Directory.GetCurrentDirectory(), ConvertSDP(Policies[0]), ConvertSDP(Policies[1]), ConvertSDP(Policies[2]));

            //default panel
            switch (fcmd.Properties.Settings.Default.LastActivePanel)
            {
                case 1:
                    p1.ListingView.SetFocus();
                    ActivePanel = p1; PassivePanel = p2;
                    if(argv.Count() == 1) p1.LoadDir(argv[0]);
                    break;
                case 2:
                    p2.ListingView.SetFocus();
                    ActivePanel = p2; PassivePanel = p1;
                    if (argv.Count() == 1) p2.LoadDir(argv[0]);
                    break;
                default:
                    p1.ListingView.SetFocus();
                    ActivePanel = p1; PassivePanel = p2;
                    if (argv.Count() == 1) p1.LoadDir(argv[0]);
                    break;
            }
            #if DEBUG
            Console.WriteLine("DEBUG: MainWindow initialization has been completed.");
            #endif
        }
Пример #5
0
        KeyboardHelpButton[] KeybHelpButtons = new KeyboardHelpButton[11];        //одна лишняя, которая нумбер [0]


        public MainWindow()
        {
            this.Title    = "File Commander";
            this.MainMenu = WindowMenu;

            //build user interface
            MainMenu.Items.Add(mnuFile);
            MainMenu.Items.Add(mnuView);
            MainMenu.Items.Add(mnuNavigate);
            MainMenu.Items.Add(mnuTools);
            MainMenu.Items.Add(mnuHelp);

            mnuFile.SubMenu = new Xwt.Menu();
            mnuFile.SubMenu.Items.Add(mnuFileUserMenu);
            mnuFile.SubMenu.Items.Add(mnuFileView);
            mnuFile.SubMenu.Items.Add(mnuFileEdit);
            mnuFile.SubMenu.Items.Add(mnuFileCompare);
            mnuFile.SubMenu.Items.Add(mnuFileCopy);
            mnuFile.SubMenu.Items.Add(mnuFileMove);
            mnuFile.SubMenu.Items.Add(mnuFileNewDir);
            mnuFile.SubMenu.Items.Add(mnuFileRemove);
            mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuFile.SubMenu.Items.Add(mnuFileAtributes);
            mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuFile.SubMenu.Items.Add(mnuFileQuickSelect);
            mnuFile.SubMenu.Items.Add(mnuFileQuickUnselect);
            mnuFile.SubMenu.Items.Add(mnuFileSelectAll);
            mnuFile.SubMenu.Items.Add(mnuFileUnselect);
            mnuFile.SubMenu.Items.Add(mnuFileInvertSelection);
            mnuFile.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuFile.SubMenu.Items.Add(mnuFileExit);

            mnuView.SubMenu = new Xwt.Menu();
            mnuView.SubMenu.Items.Add(mnuViewShort);
            mnuView.SubMenu.Items.Add(mnuViewDetails);
            mnuView.SubMenu.Items.Add(mnuViewIcons);
            mnuView.SubMenu.Items.Add(mnuViewThumbs);
            mnuView.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuView.SubMenu.Items.Add(mnuViewQuickView);
            mnuView.SubMenu.Items.Add(mnuViewTree);
            mnuView.SubMenu.Items.Add(mnuViewPCPCconnect);
            mnuView.SubMenu.Items.Add(mnuViewPCNETPCconnect);
            mnuView.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuView.SubMenu.Items.Add(mnuViewByName);
            mnuView.SubMenu.Items.Add(mnuViewByType);
            mnuView.SubMenu.Items.Add(mnuViewByDate);
            mnuView.SubMenu.Items.Add(mnuViewBySize);
            mnuView.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuView.SubMenu.Items.Add(mnuViewNoFilter);
            mnuView.SubMenu.Items.Add(mnuViewWithFilter);
            mnuView.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuView.SubMenu.Items.Add(mnuViewKeybrdHelp);             //these checkboxes are don't work, because no code was written
            mnuView.SubMenu.Items.Add(mnuViewInfobar);
            mnuView.SubMenu.Items.Add(mnuViewDiskButtons);

            mnuNavigate.SubMenu = new Xwt.Menu();
            mnuNavigate.SubMenu.Items.Add(mnuNavigateTree);
            mnuNavigate.SubMenu.Items.Add(mnuNavigateHistory);
            mnuNavigate.SubMenu.Items.Add(mnuNavigateFind);
            mnuNavigate.SubMenu.Items.Add(mnuNavigateReload);

            mnuTools.SubMenu = new Xwt.Menu();
            mnuTools.SubMenu.Items.Add(mnuToolsOptions);
            mnuTools.SubMenu.Items.Add(mnuToolsPluginManager);
            mnuTools.SubMenu.Items.Add(mnuToolsEditUserMenu);
            mnuTools.SubMenu.Items.Add(mnuToolsKeychains);
            mnuTools.SubMenu.Items.Add(mnuToolsConfigEdit);
            mnuTools.SubMenu.Items.Add(new Xwt.SeparatorMenuItem());
            mnuTools.SubMenu.Items.Add(mnuToolsDiskLabel);
            mnuTools.SubMenu.Items.Add(mnuToolsFormat);
            mnuTools.SubMenu.Items.Add(mnuToolsSysInfo);

            mnuHelp.SubMenu = new Xwt.Menu();
            mnuHelp.SubMenu.Items.Add(mnuHelpHelpMe);
            mnuHelp.SubMenu.Items.Add(mnuHelpDebug);
            mnuHelp.SubMenu.Items.Add(mnuHelpAbout);

            TranslateMenu(MainMenu);

            this.CloseRequested            += new Xwt.CloseRequestedHandler(MainWindow_CloseRequested);
            PanelLayout.KeyReleased        += new EventHandler <Xwt.KeyEventArgs>(PanelLayout_KeyReleased);
            mnuFileView.Clicked            += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.F3, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileEdit.Clicked            += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.F4, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileCopy.Clicked            += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.F5, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileMove.Clicked            += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.F6, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileNewDir.Clicked          += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.F7, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileRemove.Clicked          += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.F8, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileSelectAll.Clicked       += (o, ea) => { ActivePanel.ListingView.Select(null); };
            mnuFileUnselect.Clicked        += (o, ea) => { ActivePanel.ListingView.Unselect(); };
            mnuFileInvertSelection.Clicked += (o, ea) => { ActivePanel.ListingView.InvertSelection(); };
            mnuFileQuickSelect.Clicked     += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.NumPadAdd, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileQuickUnselect.Clicked   += (o, ea) => { PanelLayout_KeyReleased(o, new Xwt.KeyEventArgs(Xwt.Key.NumPadSubtract, Xwt.ModifierKeys.None, false, 0)); };
            mnuFileExit.Clicked            += (o, ea) => { this.Close(); };
            mnuViewNoFilter.Clicked        += (o, ea) => { ActivePanel.LoadDir(); };
            mnuViewWithFilter.Clicked      += new EventHandler(mnuViewWithFilter_Clicked);
            mnuNavigateReload.Clicked      += new EventHandler(mnuNavigateReload_Clicked);
            mnuToolsOptions.Clicked        += new EventHandler(mnuToolsOptions_Clicked);
            mnuHelpDebug.Clicked           += ShowDebugInfo;
            mnuHelpAbout.Clicked           += new EventHandler(mnuHelpAbout_Clicked);

            Layout.PackStart(PanelLayout, true, Xwt.WidgetPlacement.Fill, Xwt.WidgetPlacement.Fill, -12, -6, -12, 12);
            Layout.PackStart(KeyBoardHelp, false, Xwt.WidgetPlacement.End, Xwt.WidgetPlacement.Fill, -12, -12, -12);

            this.Content = Layout;

            //check settings
            if (fcmd.Properties.Settings.Default.UserTheme != null)
            {
                if (fcmd.Properties.Settings.Default.UserTheme != "")
                {
                    if (File.Exists(fcmd.Properties.Settings.Default.UserTheme))
                    {
                        stylist = new pluginner.Stylist(fcmd.Properties.Settings.Default.UserTheme);
                    }
                    else
                    {
                        Xwt.MessageDialog.ShowError(Locale.GetString("ThemeNotFound"), fcmd.Properties.Settings.Default.UserTheme);
                        Xwt.Application.Exit();
                    }
                }
            }

            //load bookmarks
            string BookmarksStore = null;

            if (fcmd.Properties.Settings.Default.BookmarksFile != null && fcmd.Properties.Settings.Default.BookmarksFile.Length > 0)
            {
                BookmarksStore = File.ReadAllText(fcmd.Properties.Settings.Default.BookmarksFile, Encoding.UTF8);
            }

            //build panels
            PanelLayout.Panel1.Content = new pluginner.FileListPanel(BookmarksStore, fcmd.Properties.Settings.Default.UserTheme, Properties.Settings.Default.InfoBarContent1, Properties.Settings.Default.InfoBarContent2);             //Левая, правая где сторона? Улица, улица, ты, брат, пьяна!
            PanelLayout.Panel2.Content = new pluginner.FileListPanel(BookmarksStore, fcmd.Properties.Settings.Default.UserTheme, Properties.Settings.Default.InfoBarContent1, Properties.Settings.Default.InfoBarContent2);

            p1           = (PanelLayout.Panel1.Content as pluginner.FileListPanel);
            p2           = (PanelLayout.Panel2.Content as pluginner.FileListPanel);
            p1.OpenFile += new pluginner.TypedEvent <string>(Panel_OpenFile);
            p2.OpenFile += new pluginner.TypedEvent <string>(Panel_OpenFile);

            List <pluginner.ListView2.CollumnInfo> LVCols = new List <pluginner.ListView2.CollumnInfo>();

            LVCols.Add(new pluginner.ListView2.CollumnInfo()
            {
                Title = "", Tag = "Icon", Width = 16, Visible = true
            });
            LVCols.Add(new pluginner.ListView2.CollumnInfo()
            {
                Title = "URL", Tag = "Path", Width = 0, Visible = false
            });
            LVCols.Add(new pluginner.ListView2.CollumnInfo()
            {
                Title = Locale.GetString("FName"), Tag = "FName", Width = 100, Visible = true
            });
            LVCols.Add(new pluginner.ListView2.CollumnInfo()
            {
                Title = Locale.GetString("FSize"), Tag = "FSize", Width = 50, Visible = true
            });
            LVCols.Add(new pluginner.ListView2.CollumnInfo()
            {
                Title = Locale.GetString("FDate"), Tag = "FDate", Width = 50, Visible = true
            });

            p1.FS = new base_plugins.fs.localFileSystem();
            p1.ListingView.Collumns = LVCols.ToArray();

            p2.FS = new base_plugins.fs.localFileSystem();
            p2.ListingView.Collumns = LVCols.ToArray();

            p1.GotFocus += (o, ea) => { SwitchPanel(p1); };
            p2.GotFocus += (o, ea) => { SwitchPanel(p2); };

            //build keyboard help bar
            for (int i = 1; i < 11; i++)
            {
                KeybHelpButtons[i]             = new KeyboardHelpButton();
                KeybHelpButtons[i].FKey        = "F" + i;
                KeybHelpButtons[i].Text        = Locale.GetString("FCF" + i);
                KeybHelpButtons[i].CanGetFocus = false;
                KeyBoardHelp.PackStart(KeybHelpButtons[i], true, Xwt.WidgetPlacement.Fill, Xwt.WidgetPlacement.Fill, 0, -6, 0, -3);
            }
            KeybHelpButtons[1].Clicked  += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F1, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[2].Clicked  += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F2, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[3].Clicked  += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F3, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[4].Clicked  += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F4, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[5].Clicked  += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F5, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[6].Clicked  += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F6, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[7].Clicked  += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F7, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[8].Clicked  += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F8, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[9].Clicked  += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F9, Xwt.ModifierKeys.None, false, 0)); };
            KeybHelpButtons[10].Clicked += (o, ea) => { this.PanelLayout_KeyReleased(this, new Xwt.KeyEventArgs(Xwt.Key.F10, Xwt.ModifierKeys.None, false, 0)); };
            //todo: replace this shit-code with huge using of KeybHelpButtons[n].Tag property (note that it's difficult to be realized due to c# restrictions)

            //apply user's settings
            //window size
            this.Width  = fcmd.Properties.Settings.Default.WinWidth;
            this.Height = fcmd.Properties.Settings.Default.WinHeight;
            //file size display policy
            char[] Policies = fcmd.Properties.Settings.Default.SizeShorteningPolicy.ToCharArray();

            //default directories
            if (Properties.Settings.Default.Panel1URL.Length != 0)
            {
                p1.LoadDir(Properties.Settings.Default.Panel1URL, ConvertSDP(Policies[0]), ConvertSDP(Policies[1]), ConvertSDP(Policies[2]));
            }
            else
            {
                p1.LoadDir("file://" + System.Windows.Forms.Application.StartupPath, ConvertSDP(Policies[0]), ConvertSDP(Policies[1]), ConvertSDP(Policies[2]));
            }

            if (Properties.Settings.Default.Panel2URL.Length != 0)
            {
                p2.LoadDir(Properties.Settings.Default.Panel2URL, ConvertSDP(Policies[0]), ConvertSDP(Policies[1]), ConvertSDP(Policies[2]));
            }
            else
            {
                p2.LoadDir("file://" + System.Windows.Forms.Application.StartupPath, ConvertSDP(Policies[0]), ConvertSDP(Policies[1]), ConvertSDP(Policies[2]));
            }

            //default panel
            switch (fcmd.Properties.Settings.Default.LastActivePanel)
            {
            case 1:
                p1.ListingView.SetFocus();
                ActivePanel = p1; PassivePanel = p2;
                break;

            case 2:
                p2.ListingView.SetFocus();
                ActivePanel = p2; PassivePanel = p1;
                break;

            default:
                p1.ListingView.SetFocus();
                ActivePanel = p1; PassivePanel = p2;
                break;
            }
            //this.Show();
        }