Exemple #1
0
 public override void OnPropertyGridPopupContextMenu(object sender, EventArgs e)
 {
     base.OnPropertyGridPopupContextMenu(sender, e);
     MenuItem menuItem2 = new IconMenuItem("Add &File", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
     menuItem2.Click += new EventHandler(OnAddFilePropertyGridItem);
     CurrentGridContextMenu.MenuItems.Add(1, menuItem2);
 }
Exemple #2
0
 /// <summary>
 /// Runs when the user displays the context menu for an item in 
 /// the tree control on the Features panel.
 /// 
 /// Adds the "Add components" menu item if the selected node is
 /// a feature
 /// </summary>
 /// <param name="node">The selected node</param>
 /// <param name="currTreeViewContextMenu">The context menu to extend</param>
 protected override void AddCustomTreeViewContextMenuItems(XmlNode node, ContextMenu currTreeViewContextMenu)
 {
     if (node.Name == "Feature")
     {
         IconMenuItem item = new IconMenuItem("Select Components to add");
         item.Click += new EventHandler(mnuAddComponents_Click);
         currTreeViewContextMenu.MenuItems.Add(2, new IconMenuItem("-")); // "separator"
         currTreeViewContextMenu.MenuItems.Add(3, item);
     }
 }
Exemple #3
0
        protected override void PopupPanelContextMenu(System.Object sender, System.EventArgs e)
        {
            // clear menu and add import menu
            base.PopupPanelContextMenu(sender, e);

            // add custom menu, index has to be used!!!
            IconMenuItem subMenuItem = new IconMenuItem("New Feature", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));

            subMenuItem.Click += new EventHandler(NewCustomElement_Click);
            PanelContextMenu.MenuItems.Add(0, subMenuItem);
        }
Exemple #4
0
        public SearchPanel(EditorForm editorForm, IconMenuItem editMenu)
        {
            this.editorForm = editorForm;
            this.editMenu = editMenu;

            cancelMenuItem = new IconMenuItem();
            cancelMenuItem.Text = "Cancel Find";
            cancelMenuItem.Click += new EventHandler(cancelMenuItem_Click);
            cancelMenuItem.Shortcut = Shortcut.CtrlC;
            cancelMenuItem.ShowShortcut = true;

            InitializeComponent();
        }
Exemple #5
0
 protected override void AddCustomTreeViewContextMenuItems(XmlNode node, ContextMenu treeViewContextMenu)
 {
     if (node.Name == "Component")
     {
         IconMenuItem importFilesMenu = new IconMenuItem("&Import Files", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp")));
         importFilesMenu.Click += new System.EventHandler(ImportFiles_Click);
         treeViewContextMenu.MenuItems.Add(1, importFilesMenu);
     }
     else if (node.Name == "Directory")
     {
         IconMenuItem importFolderMenu = new IconMenuItem("&Import Folder", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp")));
         importFolderMenu.Click += new System.EventHandler(ImportFolder_Click);
         treeViewContextMenu.MenuItems.Add(1, importFolderMenu);
     }
 }
Exemple #6
0
        public OutputTextbox() : base()
        {
            SetStyle(ControlStyles.StandardClick, true);
            this.BackColor     = Color.White;
            this.ReadOnly      = true;
            this.HideSelection = false;
            this.DetectUrls    = false;
            this.WordWrap      = false;

            copyMenuItem        = new IconMenuItem("&Copy");
            copyMenuItem.Click += new EventHandler(copyMenuItem_Click);

            selectAllMenuItem        = new IconMenuItem("Select &All");
            selectAllMenuItem.Click += new EventHandler(selectAllMenuItem_Click);

            wordWrapMenuItem        = new IconMenuItem("&Word Wrap");
            wordWrapMenuItem.Click += new EventHandler(wordWrapMenuItem_Click);

            contextMenu        = new ContextMenu(new IconMenuItem[] { copyMenuItem, selectAllMenuItem, wordWrapMenuItem });
            contextMenu.Popup += new EventHandler(contextMenu_Popup);

            this.ContextMenu = contextMenu;
        }
Exemple #7
0
        public OutputPanel(EditorForm editorForm, IconMenuItem buildMenu)
        {
            this.editorForm = editorForm;
            this.buildMenu = buildMenu;

            TabStop = true;

            outputTextBox = new OutputTextbox();

            outputTextBox.Dock = DockStyle.Fill;
            outputTextBox.ScrollBars = RichTextBoxScrollBars.Both;
            outputTextBox.WordWrap = WixEditSettings.Instance.WordWrapInResultsPanel;
            outputTextBox.AllowDrop = false;

            Controls.Add(outputTextBox);

            outputTextBox.TabStop = true;
            outputTextBox.HideSelection = false;

            outputTextBox.MouseUp += new MouseEventHandler(outputTextBox_MouseDown);

            doubleClickTimer.Interval = 100;
            doubleClickTimer.Tick += new EventHandler(doubleClickTimer_Tick);

            cancelMenuItem = new IconMenuItem();
            cancelMenuItem.Text = "Cancel Action";
            cancelMenuItem.Click += new EventHandler(cancelMenuItem_Click);
            cancelMenuItem.Shortcut = Shortcut.CtrlC;
            cancelMenuItem.ShowShortcut = true;

            invokeClearRTF = new DelegateClearRtf(ClearRtf);
            invokeOutput = new DelegateOutput(Output);
            invokeOutputLine = new DelegateOutputLine(OutputLine);
            invokeOutputStart = new DelegateOutputStart(OutputStart);
            invokeOutputDone = new DelegateOutputDone(OutputDone);
            invokeProcessDone = new DelegateProcessDone(ProcessDone);
        }
Exemple #8
0
        public OutputTextbox()
            : base()
        {
            SetStyle(ControlStyles.StandardClick, true);
            this.BackColor = Color.White;
            this.ReadOnly = true;
            this.HideSelection = false;
            this.DetectUrls = false;
            this.WordWrap = false;

            copyMenuItem = new IconMenuItem("&Copy");
            copyMenuItem.Click += new EventHandler(copyMenuItem_Click);

            selectAllMenuItem = new IconMenuItem("Select &All");
            selectAllMenuItem.Click += new EventHandler(selectAllMenuItem_Click);

            wordWrapMenuItem = new IconMenuItem("&Word Wrap");
            wordWrapMenuItem.Click += new EventHandler(wordWrapMenuItem_Click);

            contextMenu = new ContextMenu(new IconMenuItem[] { copyMenuItem, selectAllMenuItem, wordWrapMenuItem });
            contextMenu.Popup += new EventHandler(contextMenu_Popup);

            this.ContextMenu = contextMenu;
        }
Exemple #9
0
        public FileSheet(WizardForm creator)
            : base(creator)
        {
            this.AutoScroll = true;

            titleLabel = new Label();
            titleLabel.Text = "Add files and folders to install.";
            titleLabel.Dock = DockStyle.Top;
            titleLabel.Height = 20;
            titleLabel.Left = 0;
            titleLabel.Top = 0;
            titleLabel.Padding = new Padding(5, 5, 5, 0);
            titleLabel.Font = new Font("Verdana",
                        10,
                        FontStyle.Bold,
                        GraphicsUnit.Point
                    );
            titleLabel.BackColor = Color.White;

            descriptionLabel = new Label();
            descriptionLabel.Text = "Select Files and Directories you want to add to the installer";
            descriptionLabel.Dock = DockStyle.Top;
            descriptionLabel.Height = 50 - titleLabel.Height;
            descriptionLabel.Left = 0;
            descriptionLabel.Top = titleLabel.Height;
            descriptionLabel.Padding = new Padding(8, 3, 5, 0);
            descriptionLabel.BackColor = Color.White;

            this.Controls.Add(descriptionLabel);

            this.Controls.Add(titleLabel);

            lineLabel = new Label();
            lineLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            lineLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            lineLabel.Location = new Point(0, titleLabel.Height + descriptionLabel.Height);
            lineLabel.Size = new Size(this.Width, 2);

            this.Controls.Add(lineLabel);

            tree = new TreeView();
            tree.HideSelection = false;
            tree.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
            tree.Location = new Point(4, titleLabel.Height + descriptionLabel.Height + lineLabel.Height + 5);
            tree.Width = this.Width - 8 - 100 - 8;
            tree.Height = this.Height - tree.Top - 7;
            tree.ImageList = ImageListFactory.GetImageList();
            tree.MouseDown += new MouseEventHandler(tree_MouseDown);

            this.Controls.Add(tree);

            newFolderButton = new Button();
            newFolderButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            newFolderButton.Location = new Point(tree.Location.X + tree.Width + 8, tree.Top);
            newFolderButton.Width = 100;
            newFolderButton.Height = 23;
            newFolderButton.Text = "New folder";
            newFolderButton.Click += new EventHandler(newFolderButton_Click);

            this.Controls.Add(newFolderButton);

            removeButton = new Button();
            removeButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            removeButton.Location = new Point(tree.Location.X + tree.Width + 8, newFolderButton.Bottom + 8);
            removeButton.Width = 100;
            removeButton.Height = 23;
            removeButton.Text = "Remove folder";
            removeButton.Click += new EventHandler(removeButton_Click);

            this.Controls.Add(removeButton);

            importDirectoryButton = new Button();
            importDirectoryButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            importDirectoryButton.Location = new Point(tree.Location.X + tree.Width + 8, removeButton.Bottom + 8);
            importDirectoryButton.Width = 100;
            importDirectoryButton.Height = 23;
            importDirectoryButton.Text = "Import directory";
            importDirectoryButton.Click += new EventHandler(importDirectoryButton_Click);

            this.Controls.Add(importDirectoryButton);

            importFilesButton = new Button();
            importFilesButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;
            importFilesButton.Location = new Point(tree.Location.X + tree.Width + 8, importDirectoryButton.Bottom + 8);
            importFilesButton.Width = 100;
            importFilesButton.Height = 23;
            importFilesButton.Text = "Import files";
            importFilesButton.Click += new EventHandler(importFilesButton_Click);

            this.Controls.Add(importFilesButton);

            contextMenu = new ContextMenu();
            contextMenu.Popup += new EventHandler(contextMenu_Popup);
            // tree.ContextMenu = contextMenu;

            importFilesMenuItem = new IconMenuItem("&Import Files", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp")));
            importFilesMenuItem.Click += new System.EventHandler(importFilesMenuItem_Click);
            contextMenu.MenuItems.Add(importFilesMenuItem);

            newFolderMenuItem = new IconMenuItem("&New Folder", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
            newFolderMenuItem.Click += new System.EventHandler(newFolderMenuItem_Click);
            contextMenu.MenuItems.Add(newFolderMenuItem);

            importFolderMenuItem = new IconMenuItem("&Import Folder", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp")));
            importFolderMenuItem.Click += new System.EventHandler(importFolderMenuItem_Click);
            contextMenu.MenuItems.Add(importFolderMenuItem);

            newSpecialFolderMenuItem = new IconMenuItem("New Special Folder", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
            foreach (string specialFolder in specialFolders)
            {
                IconMenuItem subItem = new IconMenuItem(specialFolder);
                subItem.Click += new EventHandler(specialFolderSubItem_Click);
                newSpecialFolderMenuItem.MenuItems.Add(subItem);
            }
            contextMenu.MenuItems.Add(newSpecialFolderMenuItem);

            newComponentMenuItem = new IconMenuItem("New Component", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
            newComponentMenuItem.Click += new EventHandler(newComponentMenuItem_Click);
            contextMenu.MenuItems.Add(newComponentMenuItem);

            deleteMenuItem = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp")));
            deleteMenuItem.Click += new EventHandler(deleteMenuItem_Click);
            contextMenu.MenuItems.Add(deleteMenuItem);

            XmlDocument wxsDoc = Wizard.WixFiles.WxsDocument;
            XmlNamespaceManager wxsNsmgr = Wizard.WixFiles.WxsNsmgr;

            XmlNodeList dirNodes = wxsDoc.SelectNodes("/wix:Wix/*/wix:Directory", wxsNsmgr);
            TreeNodeCollection treeNodes = tree.Nodes;

            InitTreeView(dirNodes);
        }
Exemple #10
0
        private void InitializeComponent()
        {
            formInstances.Add(this);

            Text = "WiX Edit";
            Icon = new Icon(WixFiles.GetResourceStream("dialog.source.ico"));
            ClientSize = new Size(800, 600);
            MinimumSize = new Size(250, 200);

            //allow drag&drop of files
            this.AllowDrop = true;
            this.DragEnter += new DragEventHandler(EditorForm_DragEnter);
            this.DragDrop += new DragEventHandler(EditorForm_DragDrop);

            openWxsFileDialog = new OpenFileDialog();

            mainMenu = new MainMenu();
            fileMenu = new IconMenuItem();
            fileNew = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
            fileNewEmpty = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
            fileLoad = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.open.bmp")));
            fileRecent = new IconMenuItem();
            fileRecentEmpty = new IconMenuItem();
            fileRecentClean = new IconMenuItem();
            fileRecentClear = new IconMenuItem();
            fileSave = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.save.bmp")));
            fileSaveAs = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.saveas.bmp")));
            fileClose = new IconMenuItem();
            fileSeparator = new IconMenuItem("-");
            fileExit = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.exit.bmp")));

            fileNew.Text = "&New";
            fileNew.Click += new EventHandler(fileNew_Click);
            fileNew.Shortcut = Shortcut.CtrlN;
            fileNew.ShowShortcut = true;

            fileNewEmpty.Text = "New empty file";
            fileNewEmpty.Click += new EventHandler(fileNewEmpty_Click);
            fileNewEmpty.ShowShortcut = true;

            fileLoad.Text = "&Open";
            fileLoad.Click += new EventHandler(fileLoad_Click);
            fileLoad.Shortcut = Shortcut.CtrlO;
            fileLoad.ShowShortcut = true;

            fileRecentEmpty.Text = "Empty";
            fileRecentEmpty.Enabled = false;
            fileRecentEmpty.ShowShortcut = true;

            fileRecent.Text = "&Reopen";
            fileRecent.Popup += new EventHandler(fileRecent_Popup);
            fileRecent.ShowShortcut = true;
            fileRecent.MenuItems.Add(0, fileRecentEmpty);

            fileRecentClean.Text = "Remove obsolete";
            fileRecentClean.Click += new EventHandler(recentFileClean_Click);
            fileRecentClean.ShowShortcut = true;

            fileRecentClear.Text = "Remove all";
            fileRecentClear.Click += new EventHandler(recentFileClear_Click);
            fileRecentClear.ShowShortcut = true;

            fileSave.Text = "&Save";
            fileSave.Click += new EventHandler(fileSave_Click);
            fileSave.Enabled = false;
            fileSave.Shortcut = Shortcut.CtrlS;
            fileSave.ShowShortcut = true;

            fileSaveAs.Text = "Save &As";
            fileSaveAs.Click += new EventHandler(fileSaveAs_Click);
            fileSaveAs.Enabled = false;
            fileSaveAs.ShowShortcut = false;

            fileIsDirty = false;

            fileClose.Text = "&Close";
            fileClose.Click += new EventHandler(fileClose_Click);
            fileClose.Enabled = false;
            fileClose.Shortcut = Shortcut.CtrlW;
            fileClose.ShowShortcut = true;

            fileExit.Text = "&Exit";
            fileExit.Click += new EventHandler(fileExit_Click);
            fileExit.ShowShortcut = true;

            fileMenu.Text = "&File";
            fileMenu.Popup += new EventHandler(fileMenu_Popup);
            fileMenu.MenuItems.Add(0, fileNew);
            fileMenu.MenuItems.Add(1, fileNewEmpty);
            fileMenu.MenuItems.Add(2, fileLoad);
            fileMenu.MenuItems.Add(3, fileRecent);
            fileMenu.MenuItems.Add(4, fileSave);
            fileMenu.MenuItems.Add(5, fileSaveAs);
            fileMenu.MenuItems.Add(6, fileClose);
            fileMenu.MenuItems.Add(7, fileSeparator);
            fileMenu.MenuItems.Add(8, fileExit);

            mainMenu.MenuItems.Add(0, fileMenu);

            editMenu = new IconMenuItem();
            editUndo = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.undo.bmp")));
            editRedo = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.redo.bmp")));
            editFind = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.find.bmp")));
            editFindNext = new IconMenuItem();
            editFindPrev = new IconMenuItem();
            editWizard = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.wizard.bmp")));

            if (wixFiles == null ||
                WixEditSettings.Instance.ExternalXmlEditor == null ||
                File.Exists(WixEditSettings.Instance.ExternalXmlEditor) == false)
            {
                toolsExternal = new IconMenuItem();
            }
            else
            {
                Icon ico = FileIconFactory.GetFileIcon(WixEditSettings.Instance.ExternalXmlEditor);
                toolsExternal = new IconMenuItem(ico);
            }

            editUndo.Text = "&Undo";
            editUndo.Click += new EventHandler(editUndo_Click);
            editUndo.Shortcut = Shortcut.CtrlZ;
            editUndo.ShowShortcut = true;

            editRedo.Text = "&Redo";
            editRedo.Click += new EventHandler(editRedo_Click);
            editRedo.Shortcut = Shortcut.CtrlY;
            editRedo.ShowShortcut = true;

            editFind.Text = "&Find";
            editFind.Click += new EventHandler(editFind_Click);
            editFind.Shortcut = Shortcut.CtrlF;
            editFind.ShowShortcut = true;

            editFindNext.Text = "Find &Next";
            editFindNext.Click += new EventHandler(editFindNext_Click);
            editFindNext.Shortcut = Shortcut.F3;
            editFindNext.ShowShortcut = true;

            editFindPrev.Text = "Find &Previous";
            editFindPrev.Click += new EventHandler(editFindPrev_Click);
            editFindPrev.Shortcut = Shortcut.ShiftF3;
            editFindPrev.ShowShortcut = true;

            editWizard.Text = "Add Functionality";
            editWizard.Click += new EventHandler(editWizard_Click);
            editWizard.ShowShortcut = true;

            editMenu.Text = "&Edit";
            editMenu.Popup += new EventHandler(editMenu_Popup);
            editMenu.MenuItems.Add(0, editUndo);
            editMenu.MenuItems.Add(1, editRedo);
            editMenu.MenuItems.Add(2, new IconMenuItem("-"));
            editMenu.MenuItems.Add(3, editFind);
            editMenu.MenuItems.Add(4, editFindNext);
            editMenu.MenuItems.Add(5, editFindPrev);
            editMenu.MenuItems.Add(6, new IconMenuItem("-"));
            editMenu.MenuItems.Add(7, editWizard);

            mainMenu.MenuItems.Add(1, editMenu);

            toolsMenu = new IconMenuItem();
            toolsOptions = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.options.bmp")));
            buildProjectSettings = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.settings.bmp")));
            buildWixCompile = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("compile.compile.bmp")));
            buildWixInstall = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("compile.uninstall.bmp")));
            buildWixUninstall = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("compile.install.bmp")));
            buildMenu = new IconMenuItem();

            buildWixCompile.Text = "&Build MSI setup package";
            buildWixCompile.Click += new EventHandler(buildWixCompile_Click);
            buildWixCompile.Enabled = false;
            buildWixCompile.Shortcut = Shortcut.CtrlB;
            buildWixCompile.ShowShortcut = true;

            buildWixInstall.Text = "&Install MSI setup package";
            buildWixInstall.Click += new EventHandler(buildWixInstall_Click);
            buildWixInstall.Enabled = false;
            buildWixInstall.Shortcut = Shortcut.F5;
            buildWixInstall.ShowShortcut = true;

            buildWixUninstall.Text = "&Uninstall MSI setup package";
            buildWixUninstall.Click += new EventHandler(buildWixUninstall_Click);
            buildWixUninstall.Enabled = false;
            buildWixUninstall.Shortcut = Shortcut.ShiftF5;
            buildWixUninstall.ShowShortcut = true;

            buildProjectSettings.Text = "&Build Settings";
            buildProjectSettings.Click += new EventHandler(buildProjectSettings_Click);
            buildProjectSettings.Enabled = false;

            buildMenu.Text = "&Build";
            buildMenu.Popup += new EventHandler(buildMenu_Popup);
            buildMenu.MenuItems.Add(0, buildWixCompile);
            buildMenu.MenuItems.Add(1, new IconMenuItem("-"));
            buildMenu.MenuItems.Add(2, buildWixInstall);
            buildMenu.MenuItems.Add(3, buildWixUninstall);
            buildMenu.MenuItems.Add(4, new IconMenuItem("-"));
            buildMenu.MenuItems.Add(5, buildProjectSettings);

            mainMenu.MenuItems.Add(2, buildMenu);

            toolsOptions.Text = "&Options";
            toolsOptions.Click += new EventHandler(toolsOptions_Click);

            toolsExternal.Text = "Launch &External Editor";
            toolsExternal.Click += new EventHandler(toolsExternal_Click);
            toolsExternal.Shortcut = Shortcut.CtrlE;
            toolsExternal.ShowShortcut = true;

            toolsMenu.Text = "&Tools";
            toolsMenu.Popup += new EventHandler(toolsMenu_Popup);
            toolsMenu.MenuItems.Add(0, toolsExternal);
            toolsMenu.MenuItems.Add(1, new IconMenuItem("-"));
            toolsMenu.MenuItems.Add(2, toolsOptions);

            mainMenu.MenuItems.Add(3, toolsMenu);

            helpMenu = new IconMenuItem();
            helpTutorial = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.web.bmp")));
            helpMSIReference = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.web.bmp")));
            helpWiXReference = new IconMenuItem(new Bitmap(WixFiles.GetResourceStream("bmp.wix.bmp")));
            helpAbout = new IconMenuItem(new Icon(WixFiles.GetResourceStream("dialog.source.ico"), 16, 16));
            helpStateBrowser = new IconMenuItem();

            helpTutorial.Text = "WiX Tutorial";
            helpTutorial.Click += new EventHandler(helpTutorial_Click);

            helpMSIReference.Text = "Windows Installer Reference";
            helpMSIReference.Click += new EventHandler(helpMSIReference_Click);

            helpWiXReference.Text = "WiX Reference";
            helpWiXReference.Click += new EventHandler(helpWiXReference_Click);

            helpAbout.Text = "&About";
            helpAbout.Click += new EventHandler(helpAbout_Click);

            helpMenu.Text = "&Help";
            helpMenu.MenuItems.Add(helpTutorial);
            helpMenu.MenuItems.Add(helpMSIReference);
            string xsdDir = WixEditSettings.Instance.WixBinariesDirectory.Xsds;
            if (xsdDir != String.Empty &&
                File.Exists(Path.Combine(xsdDir, "WiX.chm")))
            {
                helpMenu.MenuItems.Add(helpWiXReference);
            }
            helpMenu.MenuItems.Add(new IconMenuItem("-"));
            helpMenu.MenuItems.Add(helpAbout);

            mainMenu.MenuItems.Add(helpMenu);

            // Object browser for debug purposes, just drop the statebrowser assembly next to
            // the WixEdit assembly and select the "Browse Application State" in the help menu.
            // See http://sliver.com/dotnet/statebrowser/
            try
            {
                string location = Assembly.GetExecutingAssembly().Location;
                FileInfo wixEditExe = new FileInfo(location);
                string tryPath = Path.Combine(wixEditExe.Directory.Parent.FullName, @"tools\StateBrowser\sliver.Windows.Forms.StateBrowser.dll");
                if (!File.Exists(tryPath))
                {
                    tryPath = Path.Combine(wixEditExe.Directory.Parent.Parent.FullName, @"tools\StateBrowser\sliver.Windows.Forms.StateBrowser.dll");
                }

                if (!File.Exists(tryPath))
                {
                    stateBrowserAssm = Assembly.Load("sliver.windows.forms.statebrowser, Version=1.5.0.0, Culture=neutral, PublicKeyToken=34afe62596d00324, Custom=null");
                }
                else
                {
                    stateBrowserAssm = Assembly.LoadFile(tryPath);
                }
            }
            catch (Exception) { }

            if (stateBrowserAssm != null)
            {
                helpStateBrowser.Text = "&Browse Application State";
                helpStateBrowser.Click += new EventHandler(helpStateBrowser_Click);

                helpMenu.MenuItems.Add(new IconMenuItem("-"));
                helpMenu.MenuItems.Add(helpStateBrowser);
            }

            Menu = mainMenu;

            mainPanel = new Panel();
            mainPanel.Dock = DockStyle.Fill;
            Controls.Add(mainPanel);

            resultsSplitter = new Splitter();
            resultsSplitter.Dock = DockStyle.Bottom;
            resultsSplitter.Height = 2;
            Controls.Add(resultsSplitter);

            outputPanel = new OutputPanel(this, buildMenu);
            outputPanel.Text = "Output";
            searchPanel = new SearchPanel(this, editMenu);
            searchPanel.Text = "Search Results";

            resultsPanel = new ResultsPanel(new Panel[] { outputPanel, searchPanel });
            resultsPanel.CloseClicked += new EventHandler(ResultsPanelCloseClick);
            resultsPanel.Dock = DockStyle.Bottom;
            resultsPanel.Height = 100;
            resultsPanel.Size = new Size(200, 216);

            Controls.Add(resultsPanel);

            resultsPanel.Visible = false;
            resultsSplitter.Visible = false;

            splashScreenHandler = new EventHandler(EditorForm_Activated);
            this.Activated += splashScreenHandler;
            if (formInstances.Count > 1)
            {
                splashIsDone = true;
            }
        }
Exemple #11
0
        //I am not sure if we should impelement Import function in this panel.
        //if yes it should be implemented either new function.
        protected override void PopupPanelContextMenu(System.Object sender, System.EventArgs e)
        {
            //clear menu and add import menu
            base.PopupPanelContextMenu(sender, e);

            if (currTreeView.Nodes.Count == 0)
            {
                //add custom menu, index has to be used!!!
                IconMenuItem subMenuItem = new IconMenuItem("New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
                IconMenuItem subSubMenuItem1 = new IconMenuItem("Product");
                IconMenuItem subSubMenuItem2 = new IconMenuItem("Module");

                subSubMenuItem1.Click += new EventHandler(NewCustomElement_Click);
                subSubMenuItem2.Click += new EventHandler(NewCustomElement_Click);

                subMenuItem.MenuItems.Add(subSubMenuItem1);
                subMenuItem.MenuItems.Add(subSubMenuItem2);

                PanelContextMenu.MenuItems.Add(0, subMenuItem);
            }
        }
        public virtual void OnPropertyGridPopupContextMenu(object sender, EventArgs e)
        {
            if (CurrentGrid.SelectedObject == null)
            {
                return;
            }

            MenuItem menuItemSeparator = new IconMenuItem("-");
            MenuItem menuItem1 = new IconMenuItem("Add &New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
            MenuItem menuItem3 = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp")));
            MenuItem menuItem4 = new IconMenuItem("&Rename");
            MenuItem menuItem5 = new IconMenuItem("&Import XML", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp")));

            menuItem1.Click += new EventHandler(OnNewPropertyGridItem);
            menuItem3.Click += new EventHandler(OnDeletePropertyGridItem);
            menuItem4.Click += new EventHandler(OnRenamePropertyGridItem);
            menuItem5.Click += new EventHandler(OnImportPropertyGridItem);

            CurrentGridContextMenu.MenuItems.Clear();
            CurrentGridContextMenu.MenuItems.Add(menuItem1);
            if (CurrentGrid.SelectedGridItem.PropertyDescriptor != null)
            {
                CurrentGridContextMenu.MenuItems.Add(menuItem3);
                CurrentGridContextMenu.MenuItems.Add(menuItem4);
            }

            CurrentGridContextMenu.MenuItems.Add(menuItem5);
        }
Exemple #13
0
        public void OnWxsDialogsPopupContextMenu(object sender, EventArgs e)
        {
            MenuItem menuItem1 = new IconMenuItem("&New Dialog", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
            MenuItem menuItemCopy = new IconMenuItem("&Copy Dialog", new Bitmap(WixFiles.GetResourceStream("bmp.paste.bmp")));
            MenuItem menuItem2 = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp")));
            MenuItem menuItem3 = new IconMenuItem("&Import XML", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp")));

            menuItem1.Click += new EventHandler(OnNewWxsDialogsItem);
            menuItem3.Click += new EventHandler(OnImportWxsDialogsItem);

            wxsDialogsContextMenu.MenuItems.Clear();

            wxsDialogsContextMenu.MenuItems.Add(menuItem1);
            wxsDialogsContextMenu.MenuItems.Add(menuItem3);

            if (wxsDialogs.SelectedItems.Count > 0 && wxsDialogs.SelectedItems[0] != null)
            {
                menuItem2.Click += new EventHandler(OnDeleteWxsDialogsItem);
                wxsDialogsContextMenu.MenuItems.Add(menuItem2);
                menuItemCopy.Click += new EventHandler(OnCopyWxsDialogsItem);
                wxsDialogsContextMenu.MenuItems.Add(menuItemCopy);
            }
        }
Exemple #14
0
        protected void PopupDialogTreeViewContextMenu(Object sender, EventArgs e)
        {
            dialogTreeViewContextMenu.MenuItems.Clear();

            if (dialogTreeView.SelectedNode == null)
            {
                return;
            }

            XmlNode node = dialogTreeView.SelectedNode.Tag as XmlNode;
            if (node == null)
            {
                return;
            }

            switch (node.Name)
            {
                case "Dialog":
                    dialogTreeViewContextMenu.MenuItems.Add(newControlElementMenu);
                    break;
                case "Control":
                    newControlSubElementsMenu.MenuItems.Clear();
                    dialogTreeViewContextMenu.MenuItems.Add(newControlSubElementsMenu);
                    ArrayList newControlSubElementStrings = WixFiles.GetXsdSubElements(node.Name);
                    newControlSubElementStrings.Sort();

                    string typeAttributeValue = null;
                    XmlAttribute typeAttribute = node.Attributes["Type"];
                    if (typeAttribute != null)
                    {
                        typeAttributeValue = typeAttribute.Value;
                    }

                    foreach (string newControlSubElementString in newControlSubElementStrings)
                    {
                        // Do not show properties and binaries.
                        // There is a separate place to add those.
                        if (newControlSubElementString == "Binary" ||
                            newControlSubElementString == "Property")
                        {
                            continue;
                        }

                        IconMenuItem subMenuItem = null;
                        switch (newControlSubElementString)
                        {
                            case "Text":
                                subMenuItem = new IconMenuItem("Text", new Bitmap(WixFiles.GetResourceStream("elements.text.bmp")));
                                break;
                            case "Publish":
                                subMenuItem = new IconMenuItem("Publish", new Bitmap(WixFiles.GetResourceStream("elements.publish.bmp")));
                                break;
                            case "Condition":
                                subMenuItem = new IconMenuItem("Condition", new Bitmap(WixFiles.GetResourceStream("elements.condition.bmp")));
                                break;
                            case "Subscribe":
                                subMenuItem = new IconMenuItem("Subscribe", new Bitmap(WixFiles.GetResourceStream("elements.subscribe.bmp")));
                                break;
                            default:
                                string resourceName = "elements." + newControlSubElementString.ToLower() + ".bmp";
                                if (WixFiles.HasResource(resourceName))
                                {
                                    subMenuItem = new IconMenuItem(newControlSubElementString, new Bitmap(WixFiles.GetResourceStream(resourceName)));
                                }
                                else
                                {
                                    subMenuItem = new IconMenuItem(newControlSubElementString);
                                }
                                break;
                        }

                        subMenuItem.Click += new EventHandler(NewSubElement_Click);
                        newControlSubElementsMenu.MenuItems.Add(subMenuItem);
                    }

                    if (typeAttributeValue != null)
                    {
                        ArrayList newElementStrings = WixFiles.GetXsdSubElements(typeAttributeValue);
                        if (newControlSubElementStrings.Count > 0 &&
                            newElementStrings.Count > 0)
                        {
                            newElementStrings.Sort();

                            newControlSubElementsMenu.MenuItems.Add(new IconMenuItem("-"));
                        }

                        bool isExtention = false;
                        foreach (string newElementString in newElementStrings)
                        {
                            if (!isExtention && newElementString.Contains(":"))
                            {
                                newControlSubElementsMenu.MenuItems.Add(new IconMenuItem("-"));
                                isExtention = true;
                            }

                            IconMenuItem subMenuItem = new IconMenuItem(newElementString);
                            subMenuItem.Click += new EventHandler(NewControlElement_Click);
                            newControlSubElementsMenu.MenuItems.Add(subMenuItem);
                        }
                    }
                    break;
                default:
                    break;
            }

            if (node.Name != "Dialog")
            {
                dialogTreeViewContextMenu.MenuItems.Add(deleteCurrentElementMenu);
            }

            XmlAttributeAdapter attAdapter = (XmlAttributeAdapter)CurrentGrid.SelectedObject;

            XmlDocumentationManager docManager = new XmlDocumentationManager(WixFiles);
            if (docManager.HasDocumentation(attAdapter.XmlNodeDefinition))
            {
                dialogTreeViewContextMenu.MenuItems.Add(new IconMenuItem("-"));
                dialogTreeViewContextMenu.MenuItems.Add(infoAboutCurrentElementMenu);
            }
        }
Exemple #15
0
        public void OnPropertyGridPopupContextMenu(object sender, EventArgs e)
        {
            if (CurrentGrid.SelectedObject == null)
            {
                return;
            }

            XmlAttributeAdapter attAdapter = (XmlAttributeAdapter)CurrentGrid.SelectedObject;

            // Need to change "Delete" to "Clear" for required items.
            bool isRequired = false;

            // Get the XmlAttribute from the PropertyDescriptor
            XmlAttributePropertyDescriptor desc = CurrentGrid.SelectedGridItem.PropertyDescriptor as XmlAttributePropertyDescriptor;
            if (desc != null)
            {
                XmlAttribute att = desc.Attribute;
                XmlNode xmlAttributeDefinition = attAdapter.XmlNodeDefinition.SelectSingleNode(String.Format("xs:attribute[@name='{0}']", att.Name), WixFiles.XsdNsmgr);

                if (xmlAttributeDefinition.Attributes["use"] != null &&
                    xmlAttributeDefinition.Attributes["use"].Value == "required")
                {
                    isRequired = true;
                }
            }

            MenuItem menuItemSeparator = new IconMenuItem("-");

            // Define the MenuItem objects to display for the TextBox.
            MenuItem menuItem1 = new IconMenuItem("&New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
            MenuItem menuItem3 = new IconMenuItem("Description");

            menuItem3.Checked = CurrentGrid.HelpVisible;

            menuItem1.Click += new EventHandler(OnNewPropertyGridItem);
            menuItem3.Click += new EventHandler(OnToggleDescriptionPropertyGrid);

            // Clear all previously added MenuItems.
            CurrentGridContextMenu.MenuItems.Clear();

            CurrentGridContextMenu.MenuItems.Add(menuItem1);

            MenuItem menuItem2 = null;
            if (CurrentGrid.SelectedGridItem.PropertyDescriptor != null &&
                !(CurrentGrid.SelectedGridItem.PropertyDescriptor is InnerTextPropertyDescriptor))
            {
                if (isRequired)
                {
                    menuItem2 = new IconMenuItem("&Clear", new Bitmap(WixFiles.GetResourceStream("bmp.clear.bmp")));
                }
                else
                {
                    menuItem2 = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp")));
                }
                menuItem2.Click += new EventHandler(OnDeletePropertyGridItem);

                CurrentGridContextMenu.MenuItems.Add(menuItem2);
            }

            CurrentGridContextMenu.MenuItems.Add(menuItemSeparator);
            CurrentGridContextMenu.MenuItems.Add(menuItem3);
        }
Exemple #16
0
        private void InitializeComponent()
        {
            PropertyGrid propertyGrid;
            ContextMenu propertyGridContextMenu;

            viewMenu = new IconMenuItem();
            Opacity100 = new IconMenuItem();
            Opacity75 = new IconMenuItem();
            Opacity50 = new IconMenuItem();
            Opacity25 = new IconMenuItem();
            Separator = new IconMenuItem("-");
            AlwaysOnTop = new IconMenuItem();
            SnapToGrid = new IconMenuItem();
            DialogScale = new IconMenuItem();
            dialogTreeView = new TreeView();
            propertyGrid = new CustomPropertyGrid();
            propertyGridContextMenu = new ContextMenu();
            wxsDialogs = new ListView();
            wxsDialogsContextMenu = new ContextMenu();
            splitter1 = new Splitter();
            splitter2 = new Splitter();
            panel1 = new Panel();
            panel1.SuspendLayout();
            SuspendLayout();

            viewMenu.MenuItems.AddRange(new MenuItem[] {
                                                              Opacity100,
                                                              Opacity75,
                                                              Opacity50,
                                                              Opacity25,
                                                              Separator,
                                                              AlwaysOnTop,
                                                              SnapToGrid,
                                                              DialogScale});
            viewMenu.Text = "&Dialogs";
            //
            // Opacity100
            //
            Opacity100.Index = 0;
            Opacity100.Text = "Set Opacity 100%";
            Opacity100.Click += new EventHandler(Opacity_Click);
            //
            // Opacity75
            //
            Opacity75.Index = 1;
            Opacity75.Text = "Set Opacity 75%";
            Opacity75.Click += new EventHandler(Opacity_Click);
            //
            // Opacity50
            //
            Opacity50.Index = 2;
            Opacity50.Text = "Set Opacity 50%";
            Opacity50.Click += new EventHandler(Opacity_Click);
            //
            // Opacity25
            //
            Opacity25.Index = 3;
            Opacity25.Text = "Set Opacity 25%";
            Opacity25.Click += new EventHandler(Opacity_Click);
            //
            // Separator
            //
            Separator.Index = 4;
            //
            // AlwaysOnTop
            //
            AlwaysOnTop.Index = 5;
            AlwaysOnTop.Text = "Always on top";
            AlwaysOnTop.Click += new EventHandler(AlwaysOnTop_Click);
            AlwaysOnTop.Checked = WixEditSettings.Instance.AlwaysOnTop;
            //
            // SnapToGrid
            //
            SnapToGrid.Index = 6;
            SnapToGrid.Text = "Snap to grid";
            SnapToGrid.Click += new EventHandler(SnapToGrid_Click);
            //
            // Scale
            //
            DialogScale.Index = 6;
            DialogScale.Text = "Scale Dialog";
            DialogScale.Click += new EventHandler(DialogScale_Click);
            //
            // dialogTreeView
            //
            dialogTreeView.HideSelection = false;
            dialogTreeView.Dock = DockStyle.Left;
            dialogTreeView.ImageIndex = -1;
            dialogTreeView.Location = new Point(0, 0);
            dialogTreeView.Name = "dialogTreeView";
            dialogTreeView.SelectedImageIndex = -1;
            dialogTreeView.Size = new Size(170, 266);
            dialogTreeView.TabIndex = 6;
            dialogTreeView.AfterSelect += new TreeViewEventHandler(OnAfterSelect);
            dialogTreeViewContextMenu = new ContextMenu();
            dialogTreeViewContextMenu.Popup += new EventHandler(PopupDialogTreeViewContextMenu);
            dialogTreeView.MouseDown += new MouseEventHandler(TreeViewMouseDown);
            dialogTreeView.KeyDown += new KeyEventHandler(TreeViewKeyDown);

            dialogTreeView.ImageList = ImageListFactory.GetImageList();

            newControlElementMenu = new IconMenuItem("New Control", new Bitmap(WixFiles.GetResourceStream("elements.control.bmp")));

            foreach (string controlType in controlTypes)
            {
                MenuItem menuItem = new MenuItem(controlType);
                menuItem.Click += new EventHandler(NewControlElement_Click);
                newControlElementMenu.MenuItems.Add(menuItem);
            }

            MenuItem dashMenuItem = new MenuItem("-");
            newControlElementMenu.MenuItems.Add(dashMenuItem);

            otherMenuItem = new MenuItem("Other...");
            otherMenuItem.Click += new EventHandler(NewControlElement_Click);
            newControlElementMenu.MenuItems.Add(otherMenuItem);

            newControlSubElementsMenu = new IconMenuItem("New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));

            deleteCurrentElementMenu = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp")));
            deleteCurrentElementMenu.Click += new EventHandler(DeleteElement_Click);

            infoAboutCurrentElementMenu = new IconMenuItem("&Info", new Bitmap(WixFiles.GetResourceStream("bmp.info.bmp")));
            infoAboutCurrentElementMenu.Click += new EventHandler(InfoAboutCurrentElement_Click);

            //
            // propertyGridContextMenu
            //
            propertyGridContextMenu.Popup += new EventHandler(OnPropertyGridPopupContextMenu);
            //
            // propertyGrid
            //
            propertyGrid.Dock = DockStyle.Fill;
            propertyGrid.Font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((Byte)(0)));
            propertyGrid.Location = new Point(140, 0);
            propertyGrid.Name = "propertyGrid";
            propertyGrid.Size = new Size(250, 266);
            propertyGrid.TabIndex = 1;
            propertyGrid.PropertySort = PropertySort.Alphabetical;
            propertyGrid.ToolbarVisible = false;
            propertyGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(OnPropertyValueChanged);
            propertyGrid.ContextMenu = propertyGridContextMenu;

            //
            // wxsDialogs
            //
            wxsDialogs.Dock = DockStyle.Left;
            wxsDialogs.Font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((Byte)(0)));
            wxsDialogs.Location = new Point(0, 0);
            wxsDialogs.Name = "wxsDialogs";
            wxsDialogs.Size = new Size(140, 264);
            wxsDialogs.TabIndex = 0;
            wxsDialogs.View = View.Details;
            wxsDialogs.MultiSelect = false;
            wxsDialogs.HideSelection = false;
            wxsDialogs.FullRowSelect = true;
            wxsDialogs.GridLines = false;
            wxsDialogs.SelectedIndexChanged += new EventHandler(OnSelectedDialogChanged);
            wxsDialogs.KeyDown += new KeyEventHandler(OnDialogKeyDown);
            wxsDialogs.ContextMenu = wxsDialogsContextMenu;

            wxsDialogsContextMenu.Popup += new EventHandler(OnWxsDialogsPopupContextMenu);
            //
            // splitter1
            //
            splitter1.Location = new Point(140, 0);
            splitter1.Name = "splitter1";
            splitter1.Size = new Size(2, 266);
            splitter1.TabIndex = 7;
            splitter1.TabStop = false;
            //
            // panel1
            //
            panel1.Controls.Add(splitter2);
            panel1.Controls.Add(propertyGrid);
            panel1.Controls.Add(dialogTreeView);
            panel1.Dock = DockStyle.Fill;
            panel1.Location = new Point(142, 0);
            panel1.Name = "panel1";
            panel1.Size = new Size(409, 266);
            panel1.TabIndex = 9;
            //
            // splitter2
            //
            splitter2.Location = new Point(140, 0);
            splitter2.Name = "splitter2";
            splitter2.Size = new Size(2, 266);
            splitter2.TabIndex = 7;
            splitter2.TabStop = false;
            //
            // EditorForm
            //
            //AutoScaleBaseSize = new Size(5, 14);
            ClientSize = new Size(553, 266);
            Controls.Add(panel1);
            Controls.Add(splitter1);
            Controls.Add(wxsDialogs);
            Font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((Byte)(0)));

            Name = "EditorForm";
            Text = "Wix Dialog Editor";
            panel1.ResumeLayout(false);
            ResumeLayout(false);

            double opacity = WixEditSettings.Instance.Opacity;
            if (opacity == 1.00)
            {
                Opacity100.Checked = true;
            }
            else if (opacity == 0.75)
            {
                Opacity75.Checked = true;
            }
            else if (opacity == 0.50)
            {
                Opacity50.Checked = true;
            }
            else if (opacity == 0.25)
            {
                Opacity25.Checked = true;
            }
            else
            {
                Opacity100.Checked = true;
            }

            wxsDialogs.Columns.Add("Item Column", -2, HorizontalAlignment.Left);
            wxsDialogs.HeaderStyle = ColumnHeaderStyle.None;
            wxsDialogs.Resize += new EventHandler(OnResizeWxsDialogs);

            CurrentGrid = propertyGrid;
            CurrentGridContextMenu = propertyGridContextMenu;

            LoadData();

            CurrentGrid.PropertyValueChanged += new PropertyValueChangedEventHandler(OnPropertyGridValueChanged);
        }
Exemple #17
0
        protected void PopupTreeViewContextMenu(System.Object sender, System.EventArgs e)
        {
            currTreeViewContextMenu.MenuItems.Clear();
            if (currTreeView.SelectedNode == null)
            {
                return;
            }

            XmlNode node = currTreeView.SelectedNode.Tag as XmlNode;
            if (node == null)
            {
                return;
            }

            IconMenuItem item1 = new IconMenuItem("&New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
            IconMenuItem item2 = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp")));
            item2.Click += new System.EventHandler(DeleteElement_Click);
            IconMenuItem item3 = new IconMenuItem("&Info", new Bitmap(WixFiles.GetResourceStream("bmp.info.bmp")));
            item3.Click += new System.EventHandler(InfoAboutCurrentElement_Click);

            ArrayList newElementStrings = WixFiles.GetXsdSubElements(node.Name, SkipElements);

            bool isExtention = false;
            foreach (string newElementString in newElementStrings)
            {
                if (!isExtention && newElementString.Contains(":"))
                {
                    item1.MenuItems.Add(new MenuItem("-"));
                    isExtention = true;
                }

                MenuItem subMenuItem = new MenuItem(newElementString);
                subMenuItem.Click += new EventHandler(NewElement_Click);
                item1.MenuItems.Add(subMenuItem);
            }

            if (item1.MenuItems.Count > 0)
            {
                currTreeViewContextMenu.MenuItems.Add(item1);
            }

            currTreeViewContextMenu.MenuItems.Add(item2);

            XmlAttributeAdapter attAdapter = (XmlAttributeAdapter)CurrentGrid.SelectedObject;
            if (attAdapter != null)
            {
                XmlDocumentationManager docManager = new XmlDocumentationManager(WixFiles);
                if (docManager.HasDocumentation(attAdapter.XmlNodeDefinition))
                {
                    currTreeViewContextMenu.MenuItems.Add(new IconMenuItem("-"));
                    currTreeViewContextMenu.MenuItems.Add(item3);
                }
            }

            AddCustomTreeViewContextMenuItems(node, currTreeViewContextMenu);
        }
Exemple #18
0
        public void OnPropertyGridPopupContextMenu(object sender, EventArgs e)
        {
            elementPropertyGridContextMenu.MenuItems.Clear();

            if (elementPropertyGrid.SelectedObject == null) {
                return;
            }

            XmlAttributeAdapter attAdapter = (XmlAttributeAdapter) elementPropertyGrid.SelectedObject;
            if (attAdapter.XmlNodeDefinition == null) {
                // Don't know, but can not show the context menu.
                return;
            }

            // Need to change "Delete" to "Clear" for required items.
            bool isRequired = false;

            // Get the XmlAttribute from the PropertyDescriptor
            XmlAttributePropertyDescriptor desc = elementPropertyGrid.SelectedGridItem.PropertyDescriptor as XmlAttributePropertyDescriptor;
            if (desc != null) {
                XmlAttribute att = desc.Attribute;
                XmlNode xmlAttributeDefinition = attAdapter.XmlNodeDefinition.SelectSingleNode(String.Format("xs:attribute[@name='{0}']", att.Name), wixFiles.XsdNsmgr);

                if (xmlAttributeDefinition.Attributes["use"] != null &&
                    xmlAttributeDefinition.Attributes["use"].Value == "required") {
                    isRequired = true;
                }
            }

            MenuItem menuItemSeparator = new IconMenuItem("-");

            // See if new menu item should be shown.
            bool canCreateNew = false;

            XmlNodeList xmlAttributes = attAdapter.XmlNodeDefinition.SelectNodes("xs:attribute", wixFiles.XsdNsmgr);
            foreach (XmlNode at in xmlAttributes) {
                string attName = at.Attributes["name"].Value;
                if (attAdapter.XmlNode.Attributes[attName] == null) {
                    canCreateNew = true;
                }
            }

            if (canCreateNew) {
                // Define the MenuItem objects to display for the TextBox.
                MenuItem menuItem1 = new IconMenuItem("&New", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
                menuItem1.Click += new EventHandler(OnNewPropertyGridItem);
                elementPropertyGridContextMenu.MenuItems.Add(menuItem1);
            }

            // Add the clear or delete menu item
            MenuItem menuItem2 = null;
            if (elementPropertyGrid.SelectedGridItem.PropertyDescriptor != null &&
                !(elementPropertyGrid.SelectedGridItem.PropertyDescriptor is InnerTextPropertyDescriptor)) {
                if (isRequired) {
                    menuItem2 = new IconMenuItem("&Clear", new Bitmap(WixFiles.GetResourceStream("bmp.clear.bmp")));
                } else {
                    menuItem2 = new IconMenuItem("&Delete", new Bitmap(WixFiles.GetResourceStream("bmp.delete.bmp")));
                }
                menuItem2.Click += new EventHandler(OnDeletePropertyGridItem);
                elementPropertyGridContextMenu.MenuItems.Add(menuItem2);
            }

            if (elementPropertyGridContextMenu.MenuItems.Count > 0) {
                elementPropertyGridContextMenu.MenuItems.Add(menuItemSeparator);
            }

            MenuItem menuItem3 = new IconMenuItem("Description");
            menuItem3.Click += new EventHandler(OnToggleDescriptionPropertyGrid);
            menuItem3.Checked = elementPropertyGrid.HelpVisible;

            elementPropertyGridContextMenu.MenuItems.Add(menuItem3);
        }
Exemple #19
0
        public override void OnPropertyGridPopupContextMenu(object sender, EventArgs e)
        {
            if (CurrentGrid.SelectedObject == null)
            {
                return;
            }

            base.OnPropertyGridPopupContextMenu(sender, e);

            if (CurrentGrid.SelectedGridItem.PropertyDescriptor != null)
            {
                XmlNode selectedElement = GetSelectedGridObject();
                XmlNodeList selectedSubElements = selectedElement.SelectNodes("*", WixFiles.WxsNsmgr);

                MenuItem menuItemSeparator1 = new IconMenuItem("-");
                CurrentGridContextMenu.MenuItems.Add(1, menuItemSeparator1);

                if (selectedSubElements.Count == 0)
                {
                    MenuItem subMenuItem = new IconMenuItem("Insert", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
                    CurrentGridContextMenu.MenuItems.Add(1, subMenuItem);

                    XmlNode definition = WixFiles.GetXsdElementNode("Property");
                    XmlNodeList subElements = definition.SelectNodes("xs:complexType/xs:sequence/xs:element", WixFiles.XsdNsmgr);
                    foreach (XmlNode sub in subElements)
                    {
                        string subName = sub.Attributes["ref"].Value;

                        MenuItem subSubMenuItem = new IconMenuItem(subName);
                        subSubMenuItem.Click += new EventHandler(OnNewSubPropertyGridItem);

                        subMenuItem.MenuItems.Add(subSubMenuItem);
                    }
                }
                else if (selectedSubElements.Count == 1)
                {
                    MenuItem subMenuItem = new IconMenuItem("Remove " + selectedSubElements[0].Name, new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
                    CurrentGridContextMenu.MenuItems.Add(1, subMenuItem);
                    subMenuItem.Click += new EventHandler(OnRemoveSubPropertyGridItem);
                }
                else
                {
                    MenuItem subMenuItem = new IconMenuItem("Multiple subitems in property are unsupported!", new Bitmap(WixFiles.GetResourceStream("bmp.new.bmp")));
                    subMenuItem.Enabled = false;
                    CurrentGridContextMenu.MenuItems.Add(1, subMenuItem);
                }

                MenuItem menuItemSeparator2 = new IconMenuItem("-");
                CurrentGridContextMenu.MenuItems.Add(1, menuItemSeparator2);
            }
        }
Exemple #20
0
        private void fileRecent_Popup(object sender, System.EventArgs e)
        {
            // Clear the menu
            fileRecent.MenuItems.Clear();

            string[] recentFiles = WixEditSettings.Instance.GetRecentlyUsedFiles();
            if (recentFiles.Length == 0)
            {
                fileRecent.MenuItems.Add(0, fileRecentEmpty);
            }
            else
            {
                bool hasObsolete = false;

                int i = 0;
                foreach (string recentFile in recentFiles)
                {
                    string recentFileText = recentFile;
                    if (recentFile.Length > 100)
                    {
                        recentFileText = "..." + recentFile.Substring(recentFile.Length - 98, 98);
                    }

                    IconMenuItem recentFileMenuItem = new IconMenuItem();
                    recentFileMenuItem.Text = String.Format("&{0} {1}", i + 1, recentFileText);
                    recentFileMenuItem.Click += new EventHandler(recentFile_Click);

                    if (File.Exists(recentFile))
                    {
                        Icon ico = FileIconFactory.GetFileIcon(recentFile);
                        recentFileMenuItem.Bitmap = ico.ToBitmap();
                    }
                    else
                    {
                        recentFileMenuItem.Enabled = false;
                        hasObsolete = true;
                    }

                    fileRecent.MenuItems.Add(i, recentFileMenuItem);

                    i++;
                }

                fileRecent.MenuItems.Add(i++, new IconMenuItem("-"));

                // only show clean if there are obsolete files
                if (hasObsolete)
                {
                    fileRecent.MenuItems.Add(i++, fileRecentClean);
                }

                fileRecent.MenuItems.Add(i, fileRecentClear);
            }
        }
Exemple #21
0
        protected virtual void PopupPanelContextMenu(System.Object sender, System.EventArgs e)
        {
            //clear menu
            panelContextMenu.MenuItems.Clear();

            //add import menu
            IconMenuItem itemImport = new IconMenuItem("&Import XML", new Bitmap(WixFiles.GetResourceStream("bmp.import.bmp")));
            itemImport.Click += new System.EventHandler(ImportElement_Click);

            panelContextMenu.MenuItems.Add(new IconMenuItem("-"));
            panelContextMenu.MenuItems.Add(itemImport);
        }