Exemple #1
0
        public PMainMenu(IXCommand xCommand)
        {
            _xCommand = xCommand;

            // MainMenu
            _fileBtn          = new ToolStripMenuItem(Localization.GetText("file_text_id"));
            _figureBtn        = new ToolStripMenuItem(Localization.GetText("figure_text_id"));
            _viewBtn          = new ToolStripMenuItem(Localization.GetText("view_text_id"));
            _tabBtn           = new ToolStripMenuItem(Localization.GetText("tab_text_id"));
            _pagesBtn         = new ToolStripMenuItem(Localization.GetText("pages_text_id"));
            _languageBtn      = new ToolStripMenuItem(Localization.GetText("language_text_id"));
            _figurePluginsBtn = new ToolStripMenuItem(Localization.GetText("figure_plugins_text_id"));
            _formatPluginsBtn = new ToolStripMenuItem(Localization.GetText("format_plugins_text_id"));
            _cloudBtn         = new ToolStripMenuItem(Localization.GetText("cloud_text_id"));
            _skinsBtn         = new ToolStripMenuItem(Localization.GetText("skins_text_id"));
            _helpBtn          = new ToolStripMenuItem(Localization.GetText("help_text_id"));

            // MainMenu: File
            _saveBtn = new ToolStripMenuItem(Localization.GetText("save_text_id"), null, delegate { _xCommand.FileSave(); });
            _openBtn = new ToolStripMenuItem(Localization.GetText("open_text_id"), null, delegate { _xCommand.FileOpen(); });
            _exitBtn = new ToolStripMenuItem(Localization.GetText("exit_text_id"), null, delegate { _xCommand.Exit(); });

            // MainMenu: Figure
            _typeBtn  = new ToolStripMenuItem(Localization.GetText("types_text_id"));
            _colorBtn = new ToolStripMenuItem(Localization.GetText("color_text_id"), null, delegate
            {
                try
                {
                    _xCommand.SetColor(Utilities.GetColor());
                }
                catch { }
            });
            _widthBtn = new ToolStripMenuItem(Localization.GetText("width_text_id"));

            // MainMenu: Figure: Type
            _lineBtn             = new ToolStripMenuItem(Localization.GetText("line_text_id"), null, delegate { _xCommand.SetType(XData.FigureType.Line); });
            _rectangleBtn        = new ToolStripMenuItem(Localization.GetText("rectangle_text_id"), null, delegate { _xCommand.SetType(XData.FigureType.Rectangle); });
            _roundedRectangleBtn = new ToolStripMenuItem(Localization.GetText("rounded_rectangle_text_id"), null, delegate { _xCommand.SetType(XData.FigureType.RoundRectangle); });
            _ellipseBtn          = new ToolStripMenuItem(Localization.GetText("ellipse_text_id"), null, delegate { _xCommand.SetType(XData.FigureType.Ellipse); });

            // MainMenu: Figure: Width
            _width1Btn  = new ToolStripMenuItem("1", null, delegate { _xCommand.SetLineWidth(1); });
            _width5Btn  = new ToolStripMenuItem("5", null, delegate { _xCommand.SetLineWidth(5); });
            _width10Btn = new ToolStripMenuItem("10", null, delegate { _xCommand.SetLineWidth(10); });
            _width15Btn = new ToolStripMenuItem("15", null, delegate { _xCommand.SetLineWidth(15); });
            _width20Btn = new ToolStripMenuItem("20", null, delegate { _xCommand.SetLineWidth(20); });

            // MainMenu: View
            _toolBarBtn    = new ToolStripMenuItem(Localization.GetText("tool_bar_text_id"), null, delegate { _xCommand.AddToolBar(); });
            _propertiesBtn = new ToolStripMenuItem(Localization.GetText("properties_text_id"), null, delegate { _xCommand.AddProperties(); });

            // MainMenu: Tab
            _newTabBtn    = new ToolStripMenuItem(Localization.GetText("new_tab_text_id"), null, delegate { _xCommand.NewTab(); });
            _renameTabBtn = new ToolStripMenuItem(Localization.GetText("rename_tab_text_id"), null, delegate { _xCommand.RenameTab(); });
            _closeTabBtn  = new ToolStripMenuItem(Localization.GetText("close_tab_text_id"), null, delegate { _xCommand.CloseTab(); });

            // MainMenu: Language
            _russianBtn   = new ToolStripMenuItem(Localization.GetText("russian_text_id"), null, delegate { _xCommand.RussianLanguage(); });
            _englishBtn   = new ToolStripMenuItem(Localization.GetText("english_text_id"), null, delegate { _xCommand.EnglishLanguage(); });
            _ukrainianBtn = new ToolStripMenuItem(Localization.GetText("ukrainian_text_id"), null, delegate { _xCommand.UkrainianLanguage(); });

            // MainMenu: Figure Plugins
            _simpleFigureBtn = new ToolStripMenuItem(Localization.GetText("simple_figure_text_id"), null, delegate { _xCommand.SimpleFigure(); });

            // MainMenu: Format Plugins
            //_jsonFormatBtn = new ToolStripMenuItem(Localization.GetText("json_text_id"), null, delegate { _xCommand.AddJSON(); });
            //_xmlFormatBtn = new ToolStripMenuItem(Localization.GetText("xml_text_id"), null, delegate { _xCommand.AddXML(); });
            //_yamlFormatBtn = new ToolStripMenuItem(Localization.GetText("yaml_text_id"), null, delegate { _xCommand.AddYAML(); });

            // MainMenu: Cloud
            _saveInCloudBtn   = new ToolStripMenuItem(Localization.GetText("save_text_id"), null, delegate { _xCommand.SaveInCloud(); });
            _loadFromCloudBtn = new ToolStripMenuItem(Localization.GetText("load_from_cloud_text_id"), null, delegate { _xCommand.OpenFromCloud(); });

            // MainMenu: Skins
            _skin1Btn = new ToolStripMenuItem(Localization.GetText("skin1_text_id"), null, delegate { _xCommand.Skin1(); });
            _skin2Btn = new ToolStripMenuItem(Localization.GetText("skin2_text_id"), null, delegate { _xCommand.Skin2(); });
            _skin3Btn = new ToolStripMenuItem(Localization.GetText("skin2_text_id"), null, delegate { _xCommand.Skin3(); });

            // MainMenu: Help
            _faqBtn   = new ToolStripMenuItem(Localization.GetText("faq_text_id"), null, delegate { _xCommand.ShowFAQ(); });
            _aboutBtn = new ToolStripMenuItem(Localization.GetText("about_text_id"), null, delegate { _xCommand.ShowAbout(); });

            FillMenu();

            Localization.OnLocalChange      += Localization_OnLocalChange;
            _xCommand.OnFigurePluginChanged += _xCommand_OnFigurePluginChanged;
            SkinController.OnSkinChange     += SkinController_OnSkinChange;
        }