Ejemplo n.º 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;
        }
Ejemplo n.º 2
0
        public PToolBar(IXCommand xCommand)
        {
            _xCommand = xCommand;

            //File
            _fileLbl             = new ToolStripLabel(Localization.GetText("file_text_id"));
            _saveBtn             = new ToolStripButton(Localization.GetText("save_text_id"), null, delegate { _xCommand.FileSave(); });
            _saveBtn.ToolTipText = Localization.GetText("save_text_id");
            _loadBtn             = new ToolStripButton(Localization.GetText("load_text_id"), null, delegate { _xCommand.FileOpen(); });
            _loadBtn.ToolTipText = Localization.GetText("load_text_id");

            //Tab
            _tabLbl                   = new ToolStripLabel(Localization.GetText("tab_text_id"));
            _newTabBtn                = new ToolStripButton(Localization.GetText("new_text_id"), null, delegate { _xCommand.NewTab(); });
            _delTabBtn                = new ToolStripButton(Localization.GetText("del_text_id"), null, delegate { _xCommand.CloseTab(); });
            _renameTabBtn             = new ToolStripButton(Localization.GetText("rename_text_id"), null, delegate { _xCommand.RenameTab(); });
            _newTabBtn.ToolTipText    = Localization.GetText("new_text_id");
            _delTabBtn.ToolTipText    = Localization.GetText("del_text_id");
            _renameTabBtn.ToolTipText = Localization.GetText("rename_text_id");

            //Figure
            _figureLbl = new ToolStripLabel(Localization.GetText("figure_text_id"));
            _typeCbx   = new ToolStripComboBox();

            _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); });


            _widthCbx = new ToolStripComboBox();

            _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); });


            _colorBtn = new ToolStripButton(Localization.GetText("color_text_id"), null, delegate
            {
                try
                {
                    _xCommand.SetColor(Utilities.GetColor());
                }
                catch { }
            });

            Items.Add(_fileLbl);
            Items.Add(_saveBtn);
            Items.Add(_loadBtn);
            Items.Add(new ToolStripSeparator());
            Items.Add(_tabLbl);
            Items.Add(_newTabBtn);
            Items.Add(_delTabBtn);
            Items.Add(_renameTabBtn);
            Items.Add(new ToolStripSeparator());

            Items.Add(_figureLbl);
            Items.Add(_typeCbx);
            _typeCbx.Items.Add(_lineBtn);
            _typeCbx.Items.Add(_rectangleBtn);
            _typeCbx.Items.Add(_roundedRectangleBtn);
            _typeCbx.Items.Add(_ellipseBtn);
            _typeCbx.SelectedItem = _lineBtn;

            Items.Add(_widthCbx);
            _widthCbx.Items.Add(_width1Btn);
            _widthCbx.Items.Add(_width5Btn);
            _widthCbx.Items.Add(_width10Btn);
            _widthCbx.Items.Add(_width15Btn);
            _widthCbx.Items.Add(_width20Btn);
            //_widthCbx.Items.Add(1);
            //_widthCbx.Items.Add(5);
            //_widthCbx.Items.Add(10);
            //_widthCbx.Items.Add(15);
            //_widthCbx.Items.Add(20);
            _widthCbx.SelectedItem = _width1Btn;
            // _widthCbx.Click += delegate { try { _xCommand.SetLineWidth(Int32.Parse(_widthCbx.SelectedText)); } catch { } };

            Items.Add(_colorBtn);

            Localization.OnLocalChange  += Localization_OnLocalChange;
            SkinController.OnSkinChange += SkinController_OnSkinChange;
        }