Esempio n. 1
0
        /// <summary>
        /// Create a new instance of the form. The form is responsible for retrieving and updating
        /// the tool definition in the build tool collection.
        /// </summary>
        /// <param name="buildTools">The collection of build tools registered with the build system.</param>
        /// <param name="toolId">The build tool to be configured.</param>
        public BuildToolForm(BuildToolCollection buildTools, string toolId)
        {
            InitializeComponent();

            _buildToolManager = BuildToolManager.GetInstance();
            _buildTools       = buildTools;
            _toolId           = toolId;

            List <String> documentTypes =
                _buildToolManager.GetAvailableDocumentTypes();

            if (documentTypes.Count == 0)
            {
                DisableForm();
            }
            else
            {
                foreach (string documentType in documentTypes)
                {
                    _documentTypeComboBox.Items.Add(documentType);
                }

                LoadTool();
            }

            /*
             * Allow client applications to modify the form.
             */

            BuildToolFormProxy.GetInstance().
            UpdateFormControls(Controls);
        }
Esempio n. 2
0
        /// <summary>
        /// Provides access to the BuildToolManager singleton.
        /// </summary>
        /// <returns>A reference to the BuildToolManager.</returns>
        public static BuildToolManager GetInstance()
        {
            if (_singleton == null)
            {
                _singleton = new BuildToolManager();
            }

            return(_singleton);
        }
Esempio n. 3
0
        /// <summary>
        /// Create the options page.
        /// </summary>
        public BuildSettingsOptionsPage()
        {
            _buildToolManager = BuildToolManager.GetInstance();

            Name      = Constants.UI_OPTIONS_BUILD_SETTINGS_PAGE;
            PageText  = Resources.OptionsPageTextSettings;
            GroupText = Resources.OptionsGroupText;

            #region Form Layout

            _settingsGroupBox          = new GroupBox();
            _settingsGroupBox.Location = new Point(0, 0);
            _settingsGroupBox.Name     = m_settingsGroupBox;
            _settingsGroupBox.Size     = new Size(430, 250);
            _settingsGroupBox.TabIndex = 0;
            _settingsGroupBox.TabStop  = false;
            _settingsGroupBox.Text     = Resources.OptionsPageTextSettings;

            _alwaysBuildOnCompileCheckBox          = new CheckBox();
            _alwaysBuildOnCompileCheckBox.AutoSize = true;
            _alwaysBuildOnCompileCheckBox.Location = new Point(19, 22);
            _alwaysBuildOnCompileCheckBox.Name     = m_alwaysBuildOnCompileCheckBox;
            _alwaysBuildOnCompileCheckBox.TabIndex = 0;
            _alwaysBuildOnCompileCheckBox.Text     = Resources.OptionsAlwaysBuildOnCompile;

            _alwaysBuildOnRunCheckBox          = new CheckBox();
            _alwaysBuildOnRunCheckBox.AutoSize = true;
            _alwaysBuildOnRunCheckBox.Location = new Point(19, 45);
            _alwaysBuildOnRunCheckBox.Name     = m_alwaysBuildOnRunCheckBox;
            _alwaysBuildOnRunCheckBox.TabIndex = 1;
            _alwaysBuildOnRunCheckBox.Text     = Resources.OptionsAlwaysBuildOnRun;

            _settingsGroupBox.Controls.Add(_alwaysBuildOnCompileCheckBox);
            _settingsGroupBox.Controls.Add(_alwaysBuildOnRunCheckBox);
            Controls.Add(_settingsGroupBox);

            #endregion

            _alwaysBuildOnCompileCheckBox.Checked =
                _buildToolManager.AllwaysBuildOnCompile;
            _alwaysBuildOnRunCheckBox.Checked =
                _buildToolManager.AllwaysBuildOnRun;
        }
Esempio n. 4
0
        /// <summary>
        /// Create a new instance of the options page.
        /// </summary>
        public BuildToolOptionsPage()
        {
            _buildToolManager = BuildToolManager.GetInstance();

            /*
             * Copy the build tools so we can abandon changes on cancel.
             */

            _buildTools = _buildToolManager.BuildTools.Clone();

            Name      = Constants.UI_OPTIONS_BUILD_TOOLS_PAGE;
            PageText  = Resources.OptionsPageTextTools;
            GroupText = Resources.OptionsGroupText;

            _listView                 = new ListView();
            _typeColumnHeader         = new ColumnHeader();
            _actionColumnHeader       = new ColumnHeader();
            _nameColumnHeader         = new ColumnHeader();
            _listViewContextMenuStrip = new ContextMenuStrip();
            UI_MENU_TOOL_NEW          = new ToolStripMenuItem();
            UI_MENU_TOOL_EDIT         = new ToolStripMenuItem();
            UI_MENU_TOOL_CLONE        = new ToolStripMenuItem();
            UI_MENU_TOOL_DELETE       = new ToolStripMenuItem();

            Controls.Add(this._listView);

            #region Form layout

            _listView.Columns.AddRange(new ColumnHeader[] {
                _typeColumnHeader,
                _actionColumnHeader,
                _nameColumnHeader
            });
            _listView.ContextMenuStrip = _listViewContextMenuStrip;
            _listView.Font             = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)));
            _listView.FullRowSelect    = true;
            _listView.HeaderStyle      = ColumnHeaderStyle.Nonclickable;
            _listView.Location         = new Point(0, 0);
            _listView.MultiSelect      = false;
            _listView.Name             = m_listView;
            _listView.Size             = new Size(430, 250);
            _listView.TabIndex         = 0;
            _listView.UseCompatibleStateImageBehavior = false;
            _listView.View = View.Details;

            _typeColumnHeader.Text  = Resources.ToolColumnType;
            _typeColumnHeader.Name  = m_typeColumnHeader;
            _typeColumnHeader.Width = 45;

            _actionColumnHeader.Text  = Resources.ToolColumnAction;
            _actionColumnHeader.Name  = m_actionColumnHeader;
            _actionColumnHeader.Width = 80;

            _nameColumnHeader.Text  = Resources.ToolColumnName;
            _nameColumnHeader.Name  = m_nameColumnHeader;
            _nameColumnHeader.Width = 280;

            _listViewContextMenuStrip.Items.AddRange(new ToolStripItem[] {
                UI_MENU_TOOL_NEW,
                UI_MENU_TOOL_EDIT,
                UI_MENU_TOOL_CLONE,
                UI_MENU_TOOL_DELETE
            });
            _listViewContextMenuStrip.Name = m_listViewContextMenuStrip;
            _listViewContextMenuStrip.Size = new Size(153, 92);

            UI_MENU_TOOL_NEW.Name = Constants.UI_MENU_TOOL_NEW;
            UI_MENU_TOOL_NEW.Text = Resources.ToolMenuNew;

            UI_MENU_TOOL_EDIT.Name = Constants.UI_MENU_TOOL_EDIT;
            UI_MENU_TOOL_EDIT.Text = Resources.ToolMenuEdit;

            UI_MENU_TOOL_CLONE.Name = Constants.UI_MENU_TOOL_CLONE;
            UI_MENU_TOOL_CLONE.Text = Resources.ToolMenuClone;

            UI_MENU_TOOL_DELETE.Name = Constants.UI_MENU_TOOL_DELETE;
            UI_MENU_TOOL_DELETE.Text = Resources.ToolMenuDelete;

            #endregion

            _listViewContextMenuStrip.Opening += delegate { OpenContextMenu(); };
            UI_MENU_TOOL_NEW.Click            += delegate { CreateTool(); };
            UI_MENU_TOOL_EDIT.Click           += delegate { EditTool(); };
            UI_MENU_TOOL_CLONE.Click          += delegate { CloneTool(); };
            UI_MENU_TOOL_DELETE.Click         += delegate { DeleteTool(); };
            _listView.DoubleClick             += delegate { EditTool(); };

            Load();
        }
Esempio n. 5
0
        private void ActivatePlugin()
        {
            ModuleProxy.GetInstance().Module = this;

            _applicationManager = ApplicationManager.GetInstance();
            _applicationStorage = ApplicationStorage.GetInstance();

            _applicationManager.RegisterOptionsPageFactory(
                delegate { return(new BuildToolOptionsPage()); });

            if (!_applicationManager.ClientProfile.HaveFlag(
                    ClientFlags.BuildToolsDisableBuildSettingsPage))
            {
                _applicationManager.RegisterOptionsPageFactory(
                    delegate { return(new BuildSettingsOptionsPage()); });
            }

            _applicationManager.DocumentFilterHandlers.Add(
                GetSourceFilesFilter);

            #region UI Elements

            bool disableCompilerUI = _applicationManager.ClientProfile.
                                     HaveFlag(ClientFlags.BuildToolsDisableCompilerUI);

            _output = _applicationManager.GetDockedForm(
                QuickSharp.Output.Constants.DOCKED_FORM_KEY)
                      as OutputForm;

            /* Menu items */

            _toolsMenuCompile = MenuTools.CreateMenuItem(
                Constants.UI_TOOLS_MENU_COMPILE,
                Resources.MainToolsMenuCompile,
                Resources.Compile,
                Keys.Shift | Keys.F5, null, UI_TOOLS_MENU_COMPILE_Click);

            _toolsMenuCompileAll = MenuTools.CreateMenuItem(
                Constants.UI_TOOLS_MENU_COMPILE_ALL,
                Resources.MainToolsMenuCompileAll,
                null,
                Keys.F6, null, UI_TOOLS_MENU_COMPILE_ALL_Click,
                true);

            _toolsMenuRun = MenuTools.CreateMenuItem(
                Constants.UI_TOOLS_MENU_RUN,
                Resources.MainToolsMenuRun,
                Resources.Run,
                Keys.Control | Keys.F5, null, UI_TOOLS_MENU_RUN_Click);

            if (disableCompilerUI)
            {
                _toolsMenuRun.Tag = new ToolStripItemTag {
                    IncludeSeparator = true
                }
            }
            ;

            ToolStripMenuItem toolsMenu = _mainForm.GetMenuItemByName(
                QuickSharp.Core.Constants.UI_TOOLS_MENU);

            if (!disableCompilerUI)
            {
                toolsMenu.DropDownItems.Insert(0, _toolsMenuCompileAll);
                toolsMenu.DropDownItems.Insert(0, _toolsMenuCompile);
            }

            toolsMenu.DropDownItems.Insert(0, _toolsMenuRun);
            toolsMenu.DropDownOpening +=
                new EventHandler(ToolsMenu_DropDownOpening);

            /* Toolbar */

            _toolbarCompile = MenuTools.CreateToolbarButton(
                Constants.UI_TOOLBAR_COMPILE,
                Resources.ToolbarCompile,
                Resources.Compile, UI_TOOLBAR_COMPILE_Click,
                true);
            _toolbarCompile.Enabled = false;
            _toolbarCompileSelect   = MenuTools.CreateToolbarDropDownButton(
                Constants.UI_TOOLBAR_COMPILE_SELECT,
                UI_TOOLBAR_COMPILE_SELECT_Click);
            _toolbarCompileSelect.Enabled          = false;
            _toolbarCompileSelect.DropDownOpening +=
                new EventHandler(ToolbarCompileSelect_DropDownOpening);

            _toolbarRun = MenuTools.CreateToolbarButton(
                Constants.UI_TOOLBAR_RUN,
                Resources.ToolbarRun,
                Resources.Run, UI_TOOLBAR_RUN_Click);

            if (disableCompilerUI)
            {
                _toolbarRun.Tag = new ToolStripItemTag {
                    IncludeSeparator = true
                }
            }
            ;

            _toolbarRun.Enabled = false;
            _toolbarRunSelect   = MenuTools.CreateToolbarDropDownButton(
                Constants.UI_TOOLBAR_RUN_SELECT,
                UI_TOOLBAR_RUN_SELECT_Click);
            _toolbarRunSelect.Enabled          = false;
            _toolbarRunSelect.DropDownOpening +=
                new EventHandler(ToolbarRunSelect_DropDownOpening);

            _toolbarPin = MenuTools.CreateToolbarButton(
                Constants.UI_TOOLBAR_PIN,
                Resources.ToolbarPinFile,
                Resources.Pin, UI_TOOLBAR_PIN_Click,
                true);
            _toolbarPin.Enabled = false;
            _toolbarPinSelect   = MenuTools.CreateToolbarDropDownButton(
                Constants.UI_TOOLBAR_PIN_SELECT,
                UI_TOOLBAR_PIN_SELECT_Click);
            _toolbarPinSelect.Enabled = false;

            if (!disableCompilerUI)
            {
                _mainForm.MainToolbar.Items.Add(_toolbarCompile);
                _mainForm.MainToolbar.Items.Add(_toolbarCompileSelect);
            }

            _mainForm.MainToolbar.Items.Add(_toolbarRun);
            _mainForm.MainToolbar.Items.Add(_toolbarRunSelect);
            _mainForm.MainToolbar.Items.Add(_toolbarPin);
            _mainForm.MainToolbar.Items.Add(_toolbarPinSelect);

            #endregion

            _mainForm.ClientWindow.ActiveDocumentChanged +=
                new EventHandler(MainForm_ActiveDocumentChanged);

            _buildToolManager = BuildToolManager.GetInstance();
            _buildToolManager.LoadSettings();
            _buildToolManager.LoadTools();
            _buildToolManager.BuildTools.SortTools();
            _buildToolManager.LoadPinnedFiles();

            _mainForm.FormClosed +=
                new FormClosedEventHandler(MainForm_FormClosed);

            _applicationManager.FileSystemChange +=
                new MessageHandler(UpdatePinFileStatus);

            PluginManager.GetInstance().PluginPostActivate +=
                new MessageHandler(PostActivationHandler);
        }