Пример #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;
        }
Пример #2
0
        public PToolBox(IXCommand xCommand)
        {
            _xCommand = xCommand;

            // properties
            _emptyFigureGroupBox          = new GroupBox();
            _emptyFigureGroupBox.Parent   = this;
            _emptyFigureGroupBox.Text     = Localization.GetText("properties_text_id");
            _emptyFigureGroupBox.Location = new System.Drawing.Point(0, 0);
            _emptyFigureGroupBox.Size     = new System.Drawing.Size(Width - 5, 490);

            _typeLbl          = new Label();
            _typeLbl.Parent   = _emptyFigureGroupBox;
            _typeLbl.Text     = Localization.GetText("types_text_id");
            _typeLbl.Location = new System.Drawing.Point(10, 20);
            _typeLbl.Size     = new System.Drawing.Size(40, 25);

            _line          = new Button();
            _line.Parent   = _emptyFigureGroupBox;
            _line.Text     = Localization.GetText("line_text_id");
            _line.Location = new System.Drawing.Point(50, 20);
            _line.Size     = new System.Drawing.Size(100, 25);
            _line.Click   += delegate { _xCommand.SetType(Models.XData.FigureType.Line); };

            _rect          = new Button();
            _rect.Parent   = _emptyFigureGroupBox;
            _rect.Text     = Localization.GetText("rectangle_text_id");
            _rect.Location = new System.Drawing.Point(50, 46);
            _rect.Size     = new System.Drawing.Size(100, 25);
            _rect.Click   += delegate { _xCommand.SetType(Models.XData.FigureType.Rectangle); };

            _roundRect          = new Button();
            _roundRect.Parent   = _emptyFigureGroupBox;
            _roundRect.Text     = Localization.GetText("rounded_rectangle_text_id");
            _roundRect.Location = new System.Drawing.Point(50, 72);
            _roundRect.Size     = new System.Drawing.Size(100, 25);
            _roundRect.Click   += delegate { _xCommand.SetType(Models.XData.FigureType.RoundRectangle); };

            _ellipse          = new Button();
            _ellipse.Parent   = _emptyFigureGroupBox;
            _ellipse.Text     = Localization.GetText("ellipse_text_id");
            _ellipse.Location = new System.Drawing.Point(50, 98);
            _ellipse.Size     = new System.Drawing.Size(100, 25);
            _ellipse.Click   += delegate { _xCommand.SetType(Models.XData.FigureType.Ellipse); };

            _colorLbl          = new Label();
            _colorLbl.Parent   = _emptyFigureGroupBox;
            _colorLbl.Text     = Localization.GetText("color_text_id");
            _colorLbl.Location = new System.Drawing.Point(10, 133);
            _colorLbl.Size     = new System.Drawing.Size(40, 25);

            _color          = new Button();
            _color.Parent   = _emptyFigureGroupBox;
            _color.Text     = Localization.GetText("color_text_id");
            _color.Location = new System.Drawing.Point(50, 133);
            _color.Size     = new System.Drawing.Size(100, 25);
            _color.Click   += delegate
            {
                try
                {
                    _xCommand.SetColor(Utilities.GetColor());
                }
                catch { }
            };

            _lineWidthLabel          = new Label();
            _lineWidthLabel.Parent   = _emptyFigureGroupBox;
            _lineWidthLabel.Text     = Localization.GetText("width_text_id");
            _lineWidthLabel.Location = new System.Drawing.Point(10, 168);
            _lineWidthLabel.Size     = new System.Drawing.Size(40, 25);


            _lineWidth        = new ComboBox();
            _lineWidth.Parent = _emptyFigureGroupBox;
            _lineWidth.Items.Add(1);
            _lineWidth.Items.Add(5);
            _lineWidth.Items.Add(10);
            _lineWidth.Items.Add(15);
            _lineWidth.Items.Add(20);
            _lineWidth.SelectedIndex = 0;
            _lineWidth.Text          = Localization.GetText("color_text_id");
            _lineWidth.Location      = new System.Drawing.Point(50, 168);
            _lineWidth.Size          = new System.Drawing.Size(100, 25);
            _lineWidth.Click        += delegate { try { _xCommand.SetLineWidth(Int32.Parse(_lineWidth.SelectedText)); } catch { } };

            // files
            _filesGroupBox          = new GroupBox();
            _filesGroupBox.Parent   = this;
            _filesGroupBox.Text     = Localization.GetText("file_text_id");
            _filesGroupBox.Location = new System.Drawing.Point(0, 492);
            _filesGroupBox.Size     = new System.Drawing.Size(Width - 5, 70);

            _save          = new Button();
            _save.Parent   = _filesGroupBox;
            _save.Text     = Localization.GetText("save_text_id");
            _save.Location = new System.Drawing.Point(10, 20);
            _save.Size     = new System.Drawing.Size(140, 25);
            _save.Click   += delegate { _xCommand.SaveInCloud(); };

            _open          = new Button();
            _open.Parent   = _filesGroupBox;
            _open.Text     = Localization.GetText("open_text_id");
            _open.Location = new System.Drawing.Point(10, 46);
            _open.Size     = new System.Drawing.Size(140, 25);
            _open.Click   += delegate { _xCommand.OpenFromCloud(); };

            Localization.OnLocalChange      += Localization_OnLocalChange;
            _xCommand.OnFigurePluginChanged += _xCommand_OnFigurePluginChanged;
            SkinController.OnSkinChange     += SkinController_OnSkinChange;
        }
Пример #3
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;
        }