Esempio n. 1
0
 protected static void SetupTree(BrowserTree tree)
 {
     tree.Dock        = DockStyle.Fill;
     tree.BorderStyle = BorderStyle.None;
     tree.AllowDrop   = true;
     // Sucks, see comment in BrowserTreeNode.PostConstructor
     tree.Font = new Font(tree.Font, FontStyle.Bold);
     tree.UseIntermediateNodes = true;
     // Have to create because this might be updated in the initial
     // creation code
     tree.CreateControl();
 }
Esempio n. 2
0
        internal static void Init()
        {
            _comTree                      = new BrowserTree();
            _comTree.Dock                 = DockStyle.Fill;
            _comTree.BorderStyle          = BorderStyle.None;
            _comTree.UseIntermediateNodes = true;

            // Sucks, see comment in BrowserTreeNode.PostConstructor
            _comTree.Font = new Font(_comTree.Font, FontStyle.Bold);
            _comTabPage   = new TabPage();
            _comTabPage.Controls.Add(_comTree);
            _comTabPage.Text        = "ActiveX/COM";
            _comTabPage.BorderStyle = BorderStyle.None;

            // Favorite/recently accessed typelibs
            _favTypeLibNode      = new BrowserTreeNode();
            _favTypeLibNode.Text = StringParser.Parse("${res:ComponentInspector.ComTreeNode.Text}");
            _favTypeLibNode.ChildrenAlreadyAdded = true;
            _favTypeLibNode.SetPresInfo(PresentationMap.COM_FOLDER_TYPELIB);
            _typeLibNode            = new ComTypeLibRootTreeNode();
            _typeLibNode.NodeOrder  = 1;
            _progIdNode             = new ComProgIdRootTreeNode();
            _progIdNode.NodeOrder   = 2;
            _classCatNode           = new ComCatRootTreeNode();
            _classCatNode.NodeOrder = 3;
            _classNode                           = new ComClassRootTreeNode();
            _classNode.NodeOrder                 = 4;
            _interfaceNode                       = new ComInterfaceRootTreeNode();
            _interfaceNode.NodeOrder             = 5;
            _appIdNode                           = new ComAppIdRootTreeNode();
            _appIdNode.NodeOrder                 = 6;
            _registeredNode                      = new BrowserTreeNode();
            _registeredNode.Text                 = StringParser.Parse("${res:ComponentInspector.Registry.Text}");
            _registeredNode.ChildrenAlreadyAdded = true;
            _registeredNode.SetPresInfo(PresentationMap.FOLDER_CLOSED);
            _comTree.AddNode(_favTypeLibNode);
            _comTree.AddNode(_registeredNode);
            _registeredNode.AddLogicalNode(_typeLibNode);
            _registeredNode.AddLogicalNode(_classNode);
            _registeredNode.AddLogicalNode(_classCatNode);
            _registeredNode.AddLogicalNode(_appIdNode);
            _registeredNode.AddLogicalNode(_interfaceNode);
            _registeredNode.AddLogicalNode(_progIdNode);
            _registeredNode.Expand();
            _typelibs = ComponentInspectorProperties.PreviouslyOpenedTypeLibraries;
        }
Esempio n. 3
0
		internal static void Init()
		{
			_comTree = new BrowserTree();
			_comTree.Dock = DockStyle.Fill;
			_comTree.BorderStyle = BorderStyle.None;
			_comTree.UseIntermediateNodes = true;
			
			// Sucks, see comment in BrowserTreeNode.PostConstructor
			_comTree.Font = new Font(_comTree.Font, FontStyle.Bold);
			_comTabPage = new TabPage();
			_comTabPage.Controls.Add(_comTree);
			_comTabPage.Text = "ActiveX/COM";
			_comTabPage.BorderStyle = BorderStyle.None;
			
			// Favorite/recently accessed typelibs
			_favTypeLibNode = new BrowserTreeNode();
			_favTypeLibNode.Text = StringParser.Parse("${res:ComponentInspector.ComTreeNode.Text}");
			_favTypeLibNode.ChildrenAlreadyAdded = true;
			_favTypeLibNode.SetPresInfo(PresentationMap.COM_FOLDER_TYPELIB);
			_typeLibNode = new ComTypeLibRootTreeNode();
			_typeLibNode.NodeOrder = 1;
			_progIdNode = new ComProgIdRootTreeNode();
			_progIdNode.NodeOrder = 2;
			_classCatNode = new ComCatRootTreeNode();
			_classCatNode.NodeOrder = 3;
			_classNode = new ComClassRootTreeNode();
			_classNode.NodeOrder = 4;
			_interfaceNode = new ComInterfaceRootTreeNode();
			_interfaceNode.NodeOrder = 5;
			_appIdNode = new ComAppIdRootTreeNode();
			_appIdNode.NodeOrder = 6;
			_registeredNode = new BrowserTreeNode();
			_registeredNode.Text = StringParser.Parse("${res:ComponentInspector.Registry.Text}");
			_registeredNode.ChildrenAlreadyAdded = true;
			_registeredNode.SetPresInfo(PresentationMap.FOLDER_CLOSED);
			_comTree.AddNode(_favTypeLibNode);
			_comTree.AddNode(_registeredNode);
			_registeredNode.AddLogicalNode(_typeLibNode);
			_registeredNode.AddLogicalNode(_classNode);
			_registeredNode.AddLogicalNode(_classCatNode);
			_registeredNode.AddLogicalNode(_appIdNode);
			_registeredNode.AddLogicalNode(_interfaceNode);
			_registeredNode.AddLogicalNode(_progIdNode);
			_registeredNode.Expand();
			_typelibs = ComponentInspectorProperties.PreviouslyOpenedTypeLibraries;
		}
Esempio n. 4
0
 internal static void Init()
 {
     _assyTree = new BrowserTree();
     SetupTree(_assyTree);
     _assyRootNode      = new BrowserTreeNode();
     _assyRootNode.Text = StringParser.Parse("${res:ComponentInspector.AssemblyTreeNode.Text}");
     _assyRootNode.ChildrenAlreadyAdded = true;
     _assyRootNode.SetPresInfo(PresentationMap.FOLDER_CLOSED);
     _assyTree.AddNode(_assyRootNode);
     _assyTabPage = new TabPage();
     _assyTabPage.Controls.Add(_assyTree);
     _assyTabPage.Text        = StringParser.Parse("${res:ComponentInspector.FindDialog.AssembliesRadioButton}");
     _assyTabPage.BorderStyle = BorderStyle.None;
     _controlTree             = new ControlTree();
     SetupTree(_controlTree);
     _controlTabPage = new TabPage();
     _controlTabPage.Controls.Add(_controlTree);
     _controlTabPage.Text        = StringParser.Parse("${res:ComponentInspector.ControlsTab}");
     _controlTabPage.BorderStyle = BorderStyle.None;
     _assemblies = ComponentInspectorProperties.PreviouslyOpenedAssemblies;
 }
Esempio n. 5
0
        void InitializeComponent(bool showStatusPanel, bool tabbedLayout)
        {
            SuspendLayout();

            CausesValidation    = false;
            AutoScaleDimensions = new SizeF(6F, 13F);
            AutoScaleMode       = AutoScaleMode.Font;
            Name = "ObjectBrowserControl";
            Size = new Size(800, 700);

            // All of the dimensions are here
            int objTreeWidth  = (int)(ClientSize.Width * 2 / WIDTH_UNITS);
            int assyTreeWidth = (int)(ClientSize.Width * 3 / WIDTH_UNITS);
            int paramsWidth   = (int)(ClientSize.Width * 1 / WIDTH_UNITS);
            int imageWidth    = (int)(ClientSize.Width * 2 / WIDTH_UNITS);
            int topHeight     = (int)(ClientSize.Height * 2.5 / HEIGHT_UNITS);
            int bottomHeight  = (int)(ClientSize.Height * 2.5 / HEIGHT_UNITS);
            int detailHeight  = (int)(ClientSize.Height * 1 / HEIGHT_UNITS);
            int objTreeHeight = ClientSize.Height - detailHeight;

            // Contents of treePanel, on the left
            _objTree = new BrowserTree(TOP_OBJ_NAME);

            // Hook up the routines that get called when preferences change
            ComponentInspectorProperties.ShowPropertyAccessorMethodsChanged += ObjectTreeInvalidated;
            ComponentInspectorProperties.ShowFieldsChanged            += ObjectTreeInvalidated;
            ComponentInspectorProperties.ShowPropertiesChanged        += ObjectTreeInvalidated;
            ComponentInspectorProperties.ShowMethodsChanged           += ObjectTreeInvalidated;
            ComponentInspectorProperties.ShowEventsChanged            += ObjectTreeInvalidated;
            ComponentInspectorProperties.ShowBaseClassesChanged       += ObjectTreeInvalidated;
            ComponentInspectorProperties.ShowPublicMembersOnlyChanged += ObjectTreeInvalidated;
            ComponentInspectorProperties.ShowMemberCategoriesChanged  += ObjectTreePreferencesChanged;
            ComponentInspectorProperties.ShowBaseCategoriesChanged    += ObjectTreePreferencesChanged;
            ComponentInspectorProperties.CategoryThresholdChanged     += ObjectTreePreferencesChanged;
            ComponentInspectorProperties.ShowBaseClassNamesChanged    += ObjectTreeInvalidated;
            ComponentInspectorProperties.DisplayHexChanged            += ObjectTreeInvalidated;
            ComponentInspectorProperties.ShowAssemblyPanelChanged     += TabPanelChanged;
            ComponentInspectorProperties.ShowControlPanelChanged      += TabPanelChanged;
            ComponentInspectorProperties.ShowGacPanelChanged          += TabPanelChanged;
            ComponentInspectorProperties.TypeHandlerChanged           += ObjectTreeInvalidated;

            ColumnHeader ch = new ColumnHeader();

            ch.Text      = StringParser.Parse("${res:ComponentInspector.ObjectBrowser.ValueColumnHeader}");
            ch.TextAlign = HorizontalAlignment.Left;
            _objTree.Columns.Add(ch);
            _objTree.BorderStyle       = BorderStyle.None;
            _objTree.AllowDrop         = true;
            _objTree.IsObjectContainer = true;
            _objTree.IsDropTarget      = true;
            _objTree.UseCompareTo      = true;
            _objTree.GotFocus         += new EventHandler(TreeFocused);
            UpdateObjectTreePreferences();

            _objTree.SetupPanel();
            _objTree.Panel.Dock        = DockStyle.Fill;
            _objTree.Panel.Width       = objTreeWidth;
            _objTree.Panel.Height      = objTreeHeight;
            _objTree.Panel.BorderStyle = BorderStyle.None;

            _objTreePanel       = new Panel();
            _objTreePanel.Dock  = DockStyle.Left;
            _objTreePanel.Width = _objTree.Panel.Width;

            // Note we add the parent, because the tree comes with a
            // panel that's the parent of the tree
            _objTreePanel.Controls.Add(_objTree.Panel);
            _objTreePanel.BorderStyle = BorderStyle.Fixed3D;
            new PanelLabel(_objTreePanel, StringParser.Parse("${res:ComponentInspector.ObjectBrowser.ObjectsTreePanel}"));

            // Image panel
            _imagePanel = NoGoop.ObjBrowser.ImagePanel.CreateImagePanel(objTreeWidth, !tabbedLayout);
            _imagePanel.WrapperPanel.Dock = DockStyle.Fill;

            // For text associated with each tree node
            _detailPanel      = new DetailPanel();
            _detailPanel.Dock = DockStyle.Bottom;

            _params       = new ParamPanel();
            _params.Dock  = DockStyle.Fill;
            _params.Width = paramsWidth;

            _eventLog = new EventLogList(this);

            AssemblySupport.Init();
            AssemblySupport.AssyTree.GotFocus += new EventHandler(TreeFocused);

            // Splitter between main tree and the rest, vertical
            Splitter mainSplitter = new Splitter();

            mainSplitter.Dock  = DockStyle.Left;
            mainSplitter.Width = Utils.SPLITTER_SIZE;

            Panel paramPanel = new Panel();

            paramPanel.Dock  = DockStyle.Left;
            paramPanel.Width = _params.Width;
            paramPanel.Controls.Add(_params);
            paramPanel.BorderStyle = BorderStyle.Fixed3D;
            new PanelLabel(paramPanel, StringParser.Parse("${res:ComponentInspector.ObjectBrowser.ParametersPanel}"));

            Splitter propImageSplitter = new Splitter();

            propImageSplitter.Dock  = DockStyle.Left;
            propImageSplitter.Width = Utils.SPLITTER_SIZE;

            // Contains the property panel and image panel
            Panel propImagePanel = new Panel();

            propImagePanel.Dock   = DockStyle.Top;
            propImagePanel.Height = topHeight;
            propImagePanel.Controls.Add(_imagePanel.WrapperPanel);
            propImagePanel.Controls.Add(propImageSplitter);
            propImagePanel.Controls.Add(paramPanel);

            // Splitter between node details and the rest
            _topTabSplitter        = new Splitter();
            _topTabSplitter.Dock   = DockStyle.Top;
            _topTabSplitter.Height = Utils.SPLITTER_SIZE;

            GacList gacList = new GacList();

            gacList.Width       = assyTreeWidth;
            gacList.Dock        = DockStyle.Fill;
            gacList.BorderStyle = BorderStyle.None;
            _gacTabPage         = new TabPage();
            _gacTabPage.Controls.Add(gacList);
            _gacTabPage.Text        = "GAC";
            _gacTabPage.BorderStyle = BorderStyle.None;

            // Object tab page.
            if (tabbedLayout)
            {
                _objTreeTabPage = new TabPage();
                _objTreeTabPage.Controls.Add(_objTreePanel);
                _objTreeTabPage.Text        = StringParser.Parse("${res:ComponentInspector.ObjectBrowser.ObjectsTreePanel}");
                _objTreeTabPage.BorderStyle = BorderStyle.None;
            }

            // Not presently used
            _outputList             = new OutputList();
            _outputList.Width       = assyTreeWidth;
            _outputList.Dock        = DockStyle.Fill;
            _outputList.BorderStyle = BorderStyle.None;
            TabPage outputTabPage = new TabPage();

            outputTabPage.Controls.Add(_outputList);
            outputTabPage.Text        = StringParser.Parse("${res:ComponentInspector.ObjectBrowser.OutputTab}");
            outputTabPage.BorderStyle = BorderStyle.None;

            _tabControl       = new TabControl();
            _tabControl.Dock  = DockStyle.Fill;
            _tabControl.Width = assyTreeWidth;
            _tabControl.SelectedIndexChanged += new EventHandler(TabIndexChangedHandler);

            // Contains the property panel and image panel
            Panel tabPanel = new Panel();

            tabPanel.Dock = DockStyle.Fill;
            if (tabbedLayout)
            {
                propImagePanel.Dock = DockStyle.Fill;
            }
            else
            {
                tabPanel.Controls.Add(_tabControl);
                tabPanel.Controls.Add(_topTabSplitter);
            }
            tabPanel.Controls.Add(propImagePanel);

            // All of the panels on the top
            _topPanel        = new Panel();
            _topPanel.Dock   = DockStyle.Fill;
            _topPanel.Height = topHeight + bottomHeight;
            _topPanel.Controls.Add(tabPanel);
            _topPanel.Controls.Add(mainSplitter);
            if (tabbedLayout)
            {
                _tabControl.Dock   = DockStyle.Left;
                _objTreePanel.Dock = DockStyle.Fill;
                _topPanel.Controls.Add(_tabControl);
            }
            else
            {
                _topPanel.Controls.Add(_objTreePanel);
            }

            if (!tabbedLayout)
            {
                _topBottomSplitter         = new Splitter();
                _topBottomSplitter.Dock    = DockStyle.Bottom;
                _topBottomSplitter.Height  = Utils.SPLITTER_SIZE;
                _topBottomSplitter.MinSize = detailHeight;
            }

            if (showStatusPanel)
            {
                _statusPanel           = new StatusPanel();
                _statusPanelLabel      = new PanelLabel(_statusPanel);
                _statusPanelLabel.Dock = DockStyle.Top;
            }

            Controls.Add(_topPanel);
            if (showStatusPanel)
            {
                Controls.Add(_statusPanelLabel);
            }
            if (!tabbedLayout)
            {
                Controls.Add(_topBottomSplitter);
                Controls.Add(_detailPanel);
            }

            // To allow file dropping
            DragEnter += new DragEventHandler(DragEnterEvent);
            DragDrop  += new DragEventHandler(DragDropEvent);
            DragOver  += new DragEventHandler(DragOverEvent);
            AllowDrop  = true;

            _objTree.BeginUpdate();

            // Add top level nodes
            ArrayList  tlList  = new ArrayList();
            ObjectInfo objInfo = ObjectInfoFactory.GetObjectInfo(false, tlList);

            objInfo.ObjectName = TOP_OBJ_NAME;
            BrowserTreeNode node = new ObjectTreeNode(false, objInfo);

            // Make sure this is the first node
            node.NodeOrder   = 0;
            node.AllowDelete = false;
            _objTree.Nodes.Add(node);

            // Just for testing
            if (LocalPrefs.Get(LocalPrefs.DEV) != null)
            {
                tlList.Add(this);
            }

            _objTree.EndUpdate();
            ComSupport.Init();
            ComSupport.ComTree.GotFocus += new EventHandler(TreeFocused);

            SetTabPanels();

            ResumeLayout();
        }
Esempio n. 6
0
		// Enable the correct items and assign event handlers
		protected void SetupActionMenu(IMenuTreeNode node, BrowserTree tree, ActionMenuHelper partner)
		{
			// Set up the main action menu first
			// The main menu may not be used (embedded case)
			if (this != _actionMenuHelper && _actionMenuHelper != null) {
				_partner = _actionMenuHelper;
				_actionMenuHelper.SetupActionMenu(node, tree, this);
			} else {
				_partner = partner;
			}
			Disable();
			if (node.HasGetProp()) {
				_menuItem[GETPROP].Enabled = true;
				SetHandler(GETPROP, new EventHandler(tree.TreeNodePopupClick));
			}
			if (node.HasSetProp()) {
				_menuItem[SETPROP].Enabled = true;
				SetHandler(SETPROP, new EventHandler(tree.TreeNodePopupClickSet));
			}
			if (node.HasSetField()) {
				_menuItem[SETFIELD].Enabled = true;
				SetHandler(SETFIELD, new EventHandler(tree.TreeNodePopupClickSet));
			}
			if (node.HasInvokeMeth()) {
				_menuItem[INVOKEMETH].Enabled = true;
				SetHandler(INVOKEMETH, new EventHandler(tree.TreeNodePopupClick));
			}
			if (node.HasCreateObj()) {
				_menuItem[CREATEOBJ].Enabled = true;
				SetHandler(CREATEOBJ, new EventHandler(tree.TreeNodePopupCreateObj));
			}
			if (node.HasCast()) {
				_menuItem[CAST].Enabled = true;
				SetHandler(CAST, new EventHandler(tree.CastClick));
			}
			if (node.HasDesignSurface()) {
				IDesignSurfaceNode dNode = (IDesignSurfaceNode)node;
				_menuItem[DESIGNSURFACE].Checked = dNode.OnDesignSurface;
				_menuItem[DESIGNSURFACE].Enabled = true;
				SetHandler(DESIGNSURFACE, new EventHandler(dNode.DesignSurfaceClick));
			}
			if (node.HasEventLogging()) {
				IEventLoggingMenuNode dNode = (IEventLoggingMenuNode)node;
				_menuItem[EVENTLOGGING].Checked = 
					dNode.EventLogging;
				_menuItem[EVENTLOGGING].Enabled = true;
				SetHandler(EVENTLOGGING, new EventHandler(dNode.EventLoggingClick));
			}
			if (node.HasCut()) {
				_menuItem[CUT].Enabled = true;
				SetHandler(CUT, new EventHandler(tree.TreeNodePopupCut));
			}
			if (node.HasCopy()) {
				_menuItem[COPY].Enabled = true;
				SetHandler(COPY, new EventHandler(tree.TreeNodePopupCopy));
			}
			if (node.HasCopyText0()) {
				_menuItem[COPY_TEXT].Enabled = true;
				SetHandler(COPY_TEXT, new EventHandler(tree.TreeNodePopupCopyText0));
			}
			if (node.HasCopyText1()) {
				_menuItem[COPY_VALUE].Enabled = true;
				SetHandler(COPY_VALUE, new EventHandler(tree.TreeNodePopupCopyText1));
			}
			if (node.HasPaste()) {
				_menuItem[PASTE].Enabled = true;
				SetHandler(PASTE, new EventHandler(tree.TreeNodePopupPaste));
			}
			if (node.HasDelete()) {
				_menuItem[DELETE].Enabled = true;
				SetHandler(DELETE, new EventHandler(tree.TreeNodePopupDelete));
			}
			if (node.HasClose()) {
				// Close deletes an item from the tree
				if (_closeMenuItem != null)
					_closeMenuItem.Enabled = true;
				_menuItem[CLOSE].Enabled = true;
				SetHandler(CLOSE, new EventHandler(tree.TreeNodePopupDelete));
			} else {
				if (_closeMenuItem != null)
					_closeMenuItem.Enabled = false;
			}
			/****
			if (node.HasRename())
			{
				_menuItem[RENAME].Enabled = true;
				SetHandler(RENAME, 
						   new EventHandler(tree.TreeNodePopupRename));
			}
			****/
				/*
				if (node.HasConvert())
				{
					_menuItem[CONVERT].Enabled = true;
					SetHandler(CONVERT, 
							   new EventHandler(tree.ConvertClick));
				}
				*/
				if (node.HasRegister()) {
					_menuItem[REGISTER].Enabled = true;
					SetHandler(REGISTER, new EventHandler(tree.RegisterClick));
				}
				if (node.HasUnregister()) {
					_menuItem[UNREGISTER].Enabled = true;
					SetHandler(UNREGISTER, new EventHandler(tree.UnregisterClick));
				}
				if (node.HasRemoveFavorite()) {
					_menuItem[REMOVEFAVORITE].Enabled = true;
					SetHandler(REMOVEFAVORITE, new EventHandler(tree.RemoveFavoriteClick));
				}
		}
Esempio n. 7
0
		internal void SetupActionMenu(IMenuTreeNode node, BrowserTree tree)
		{
			SetupActionMenu(node, tree, null);
		}
        // Enable the correct items and assign event handlers
        protected void SetupActionMenu(IMenuTreeNode node, BrowserTree tree, ActionMenuHelper partner)
        {
            // Set up the main action menu first
            // The main menu may not be used (embedded case)
            if (this != _actionMenuHelper && _actionMenuHelper != null)
            {
                _partner = _actionMenuHelper;
                _actionMenuHelper.SetupActionMenu(node, tree, this);
            }
            else
            {
                _partner = partner;
            }
            Disable();
            if (node.HasGetProp())
            {
                _menuItem[GETPROP].Enabled = true;
                SetHandler(GETPROP, new EventHandler(tree.TreeNodePopupClick));
            }
            if (node.HasSetProp())
            {
                _menuItem[SETPROP].Enabled = true;
                SetHandler(SETPROP, new EventHandler(tree.TreeNodePopupClickSet));
            }
            if (node.HasSetField())
            {
                _menuItem[SETFIELD].Enabled = true;
                SetHandler(SETFIELD, new EventHandler(tree.TreeNodePopupClickSet));
            }
            if (node.HasInvokeMeth())
            {
                _menuItem[INVOKEMETH].Enabled = true;
                SetHandler(INVOKEMETH, new EventHandler(tree.TreeNodePopupClick));
            }
            if (node.HasCreateObj())
            {
                _menuItem[CREATEOBJ].Enabled = true;
                SetHandler(CREATEOBJ, new EventHandler(tree.TreeNodePopupCreateObj));
            }
            if (node.HasCast())
            {
                _menuItem[CAST].Enabled = true;
                SetHandler(CAST, new EventHandler(tree.CastClick));
            }
            if (node.HasDesignSurface())
            {
                IDesignSurfaceNode dNode = (IDesignSurfaceNode)node;
                _menuItem[DESIGNSURFACE].Checked = dNode.OnDesignSurface;
                _menuItem[DESIGNSURFACE].Enabled = true;
                SetHandler(DESIGNSURFACE, new EventHandler(dNode.DesignSurfaceClick));
            }
            if (node.HasEventLogging())
            {
                IEventLoggingMenuNode dNode = (IEventLoggingMenuNode)node;
                _menuItem[EVENTLOGGING].Checked =
                    dNode.EventLogging;
                _menuItem[EVENTLOGGING].Enabled = true;
                SetHandler(EVENTLOGGING, new EventHandler(dNode.EventLoggingClick));
            }
            if (node.HasCut())
            {
                _menuItem[CUT].Enabled = true;
                SetHandler(CUT, new EventHandler(tree.TreeNodePopupCut));
            }
            if (node.HasCopy())
            {
                _menuItem[COPY].Enabled = true;
                SetHandler(COPY, new EventHandler(tree.TreeNodePopupCopy));
            }
            if (node.HasCopyText0())
            {
                _menuItem[COPY_TEXT].Enabled = true;
                SetHandler(COPY_TEXT, new EventHandler(tree.TreeNodePopupCopyText0));
            }
            if (node.HasCopyText1())
            {
                _menuItem[COPY_VALUE].Enabled = true;
                SetHandler(COPY_VALUE, new EventHandler(tree.TreeNodePopupCopyText1));
            }
            if (node.HasPaste())
            {
                _menuItem[PASTE].Enabled = true;
                SetHandler(PASTE, new EventHandler(tree.TreeNodePopupPaste));
            }
            if (node.HasDelete())
            {
                _menuItem[DELETE].Enabled = true;
                SetHandler(DELETE, new EventHandler(tree.TreeNodePopupDelete));
            }
            if (node.HasClose())
            {
                // Close deletes an item from the tree
                if (_closeMenuItem != null)
                {
                    _closeMenuItem.Enabled = true;
                }
                _menuItem[CLOSE].Enabled = true;
                SetHandler(CLOSE, new EventHandler(tree.TreeNodePopupDelete));
            }
            else
            {
                if (_closeMenuItem != null)
                {
                    _closeMenuItem.Enabled = false;
                }
            }

            /****
            *  if (node.HasRename())
            *  {
            *       _menuItem[RENAME].Enabled = true;
            *       SetHandler(RENAME,
            *                          new EventHandler(tree.TreeNodePopupRename));
            *  }
            ****/
            /*
             * if (node.HasConvert())
             * {
             *      _menuItem[CONVERT].Enabled = true;
             *      SetHandler(CONVERT,
             *                         new EventHandler(tree.ConvertClick));
             * }
             */
            if (node.HasRegister())
            {
                _menuItem[REGISTER].Enabled = true;
                SetHandler(REGISTER, new EventHandler(tree.RegisterClick));
            }
            if (node.HasUnregister())
            {
                _menuItem[UNREGISTER].Enabled = true;
                SetHandler(UNREGISTER, new EventHandler(tree.UnregisterClick));
            }
            if (node.HasRemoveFavorite())
            {
                _menuItem[REMOVEFAVORITE].Enabled = true;
                SetHandler(REMOVEFAVORITE, new EventHandler(tree.RemoveFavoriteClick));
            }
        }
 internal void SetupActionMenu(IMenuTreeNode node, BrowserTree tree)
 {
     SetupActionMenu(node, tree, null);
 }
Esempio n. 10
0
		void InitializeComponent(bool showStatusPanel, bool tabbedLayout)
		{
			SuspendLayout();
						
			CausesValidation = false;
			AutoScaleDimensions = new SizeF(6F, 13F);
			AutoScaleMode = AutoScaleMode.Font;
			Name = "ObjectBrowserControl";
			Size = new Size(800, 700);
			
			// All of the dimensions are here
			int objTreeWidth = (int)(ClientSize.Width * 2/WIDTH_UNITS);
			int assyTreeWidth = (int)(ClientSize.Width * 3/WIDTH_UNITS);
			int paramsWidth = (int)(ClientSize.Width * 1/WIDTH_UNITS);
			int imageWidth = (int)(ClientSize.Width * 2/WIDTH_UNITS);
			int topHeight = (int)(ClientSize.Height * 2.5/HEIGHT_UNITS);
			int bottomHeight = (int)(ClientSize.Height * 2.5/HEIGHT_UNITS);
			int detailHeight = (int)(ClientSize.Height * 1/HEIGHT_UNITS);
			int objTreeHeight = ClientSize.Height - detailHeight;

			// Contents of treePanel, on the left
			_objTree = new BrowserTree(TOP_OBJ_NAME);

			// Hook up the routines that get called when preferences change
			ComponentInspectorProperties.ShowPropertyAccessorMethodsChanged += ObjectTreeInvalidated;
			ComponentInspectorProperties.ShowFieldsChanged += ObjectTreeInvalidated;
			ComponentInspectorProperties.ShowPropertiesChanged += ObjectTreeInvalidated;
			ComponentInspectorProperties.ShowMethodsChanged += ObjectTreeInvalidated;
			ComponentInspectorProperties.ShowEventsChanged += ObjectTreeInvalidated;
			ComponentInspectorProperties.ShowBaseClassesChanged += ObjectTreeInvalidated;
			ComponentInspectorProperties.ShowPublicMembersOnlyChanged += ObjectTreeInvalidated;
			ComponentInspectorProperties.ShowMemberCategoriesChanged += ObjectTreePreferencesChanged;
			ComponentInspectorProperties.ShowBaseCategoriesChanged += ObjectTreePreferencesChanged;
			ComponentInspectorProperties.CategoryThresholdChanged += ObjectTreePreferencesChanged;
			ComponentInspectorProperties.ShowBaseClassNamesChanged += ObjectTreeInvalidated;
			ComponentInspectorProperties.DisplayHexChanged += ObjectTreeInvalidated;
			ComponentInspectorProperties.ShowAssemblyPanelChanged += TabPanelChanged;
			ComponentInspectorProperties.ShowControlPanelChanged += TabPanelChanged;
			ComponentInspectorProperties.ShowGacPanelChanged += TabPanelChanged;
			ComponentInspectorProperties.TypeHandlerChanged += ObjectTreeInvalidated;
				
			ColumnHeader ch = new ColumnHeader();
			ch.Text = StringParser.Parse("${res:ComponentInspector.ObjectBrowser.ValueColumnHeader}");
			ch.TextAlign = HorizontalAlignment.Left;
			_objTree.Columns.Add(ch);
			_objTree.BorderStyle = BorderStyle.None;
			_objTree.AllowDrop = true;
			_objTree.IsObjectContainer = true;
			_objTree.IsDropTarget = true;
			_objTree.UseCompareTo = true;
			_objTree.GotFocus += new EventHandler(TreeFocused);
			UpdateObjectTreePreferences();

			_objTree.SetupPanel();
			_objTree.Panel.Dock = DockStyle.Fill;
			_objTree.Panel.Width = objTreeWidth;
			_objTree.Panel.Height = objTreeHeight;
			_objTree.Panel.BorderStyle = BorderStyle.None;

			_objTreePanel = new Panel();
			_objTreePanel.Dock = DockStyle.Left;
			_objTreePanel.Width = _objTree.Panel.Width;
			
			// Note we add the parent, because the tree comes with a
			// panel that's the parent of the tree
			_objTreePanel.Controls.Add(_objTree.Panel);
			_objTreePanel.BorderStyle = BorderStyle.Fixed3D;
			new PanelLabel(_objTreePanel, StringParser.Parse("${res:ComponentInspector.ObjectBrowser.ObjectsTreePanel}"));

			// Image panel
			_imagePanel =  NoGoop.ObjBrowser.ImagePanel.CreateImagePanel(objTreeWidth, !tabbedLayout);
			_imagePanel.WrapperPanel.Dock = DockStyle.Fill;

			// For text associated with each tree node
			_detailPanel = new DetailPanel();
			_detailPanel.Dock = DockStyle.Bottom;

			_params = new ParamPanel();
			_params.Dock = DockStyle.Fill;
			_params.Width = paramsWidth;
			
			_eventLog = new EventLogList(this);

			AssemblySupport.Init();
			AssemblySupport.AssyTree.GotFocus += new EventHandler(TreeFocused);
			
			// Splitter between main tree and the rest, vertical
			Splitter mainSplitter = new Splitter();
			mainSplitter.Dock = DockStyle.Left;
			mainSplitter.Width = Utils.SPLITTER_SIZE;

			Panel paramPanel = new Panel();
			paramPanel.Dock = DockStyle.Left;
			paramPanel.Width = _params.Width;
			paramPanel.Controls.Add(_params);
			paramPanel.BorderStyle = BorderStyle.Fixed3D;
			new PanelLabel(paramPanel, StringParser.Parse("${res:ComponentInspector.ObjectBrowser.ParametersPanel}"));

			Splitter propImageSplitter = new Splitter();
			propImageSplitter.Dock = DockStyle.Left;
			propImageSplitter.Width = Utils.SPLITTER_SIZE;

			// Contains the property panel and image panel
			Panel propImagePanel = new Panel();
			propImagePanel.Dock = DockStyle.Top;
			propImagePanel.Height = topHeight;
			propImagePanel.Controls.Add(_imagePanel.WrapperPanel);
			propImagePanel.Controls.Add(propImageSplitter);
			propImagePanel.Controls.Add(paramPanel);

			// Splitter between node details and the rest
			_topTabSplitter = new Splitter();
			_topTabSplitter.Dock = DockStyle.Top;
			_topTabSplitter.Height = Utils.SPLITTER_SIZE;

			GacList gacList = new GacList();
			gacList.Width = assyTreeWidth;
			gacList.Dock = DockStyle.Fill;
			gacList.BorderStyle = BorderStyle.None;
			_gacTabPage = new TabPage();
			_gacTabPage.Controls.Add(gacList);
			_gacTabPage.Text = "GAC";
			_gacTabPage.BorderStyle = BorderStyle.None;
			
			// Object tab page.
			if (tabbedLayout) {
				_objTreeTabPage = new TabPage();
				_objTreeTabPage.Controls.Add(_objTreePanel);
				_objTreeTabPage.Text = StringParser.Parse("${res:ComponentInspector.ObjectBrowser.ObjectsTreePanel}");
				_objTreeTabPage.BorderStyle = BorderStyle.None;
			}

			// Not presently used
			_outputList = new OutputList();
			_outputList.Width = assyTreeWidth;
			_outputList.Dock = DockStyle.Fill;
			_outputList.BorderStyle = BorderStyle.None;
			TabPage outputTabPage = new TabPage();
			outputTabPage.Controls.Add(_outputList);
			outputTabPage.Text = StringParser.Parse("${res:ComponentInspector.ObjectBrowser.OutputTab}");
			outputTabPage.BorderStyle = BorderStyle.None;
			
			_tabControl = new TabControl();
			_tabControl.Dock = DockStyle.Fill;
			_tabControl.Width = assyTreeWidth;
			_tabControl.SelectedIndexChanged += new EventHandler(TabIndexChangedHandler);

			// Contains the property panel and image panel
			Panel tabPanel = new Panel();
			tabPanel.Dock = DockStyle.Fill;
			if (tabbedLayout) {
				propImagePanel.Dock = DockStyle.Fill;
			} else {
				tabPanel.Controls.Add(_tabControl);
				tabPanel.Controls.Add(_topTabSplitter);
			}
			tabPanel.Controls.Add(propImagePanel);

			// All of the panels on the top
			_topPanel = new Panel();
			_topPanel.Dock = DockStyle.Fill;
			_topPanel.Height = topHeight + bottomHeight;
			_topPanel.Controls.Add(tabPanel);
			_topPanel.Controls.Add(mainSplitter);
			if (tabbedLayout) {
				_tabControl.Dock = DockStyle.Left;
				_objTreePanel.Dock = DockStyle.Fill;
				_topPanel.Controls.Add(_tabControl);
			} else {
				_topPanel.Controls.Add(_objTreePanel);
			}

			if (!tabbedLayout) {
				_topBottomSplitter = new Splitter();
				_topBottomSplitter.Dock = DockStyle.Bottom;
				_topBottomSplitter.Height = Utils.SPLITTER_SIZE;
				_topBottomSplitter.MinSize = detailHeight;
			}

			if (showStatusPanel) {
				_statusPanel = new StatusPanel();
				_statusPanelLabel = new PanelLabel(_statusPanel);
				_statusPanelLabel.Dock = DockStyle.Top;
			}

			Controls.Add(_topPanel);
			if (showStatusPanel) {
				Controls.Add(_statusPanelLabel);
			}
			if (!tabbedLayout) {
				Controls.Add(_topBottomSplitter);
				Controls.Add(_detailPanel);
			}
			
			// To allow file dropping
			DragEnter += new DragEventHandler(DragEnterEvent);
			DragDrop += new DragEventHandler(DragDropEvent);
			DragOver += new DragEventHandler(DragOverEvent);
			AllowDrop = true;
			
			_objTree.BeginUpdate();

			// Add top level nodes
			ArrayList tlList = new ArrayList();
			ObjectInfo objInfo = ObjectInfoFactory.GetObjectInfo(false, tlList);
			objInfo.ObjectName = TOP_OBJ_NAME;
			BrowserTreeNode node = new ObjectTreeNode(false, objInfo);

			// Make sure this is the first node
			node.NodeOrder = 0;
			node.AllowDelete = false;
			_objTree.Nodes.Add(node);

			// Just for testing
			if (LocalPrefs.Get(LocalPrefs.DEV) != null)
				tlList.Add(this);

			_objTree.EndUpdate();
			ComSupport.Init();
			ComSupport.ComTree.GotFocus += new EventHandler(TreeFocused);
			
			SetTabPanels();

			ResumeLayout();
		}
Esempio n. 11
0
		internal static void Init()
		{
			_assyTree = new BrowserTree();
			SetupTree(_assyTree);
			_assyRootNode = new BrowserTreeNode();
			_assyRootNode.Text = StringParser.Parse("${res:ComponentInspector.AssemblyTreeNode.Text}");
			_assyRootNode.ChildrenAlreadyAdded = true;
			_assyRootNode.SetPresInfo(PresentationMap.FOLDER_CLOSED);
			_assyTree.AddNode(_assyRootNode);
			_assyTabPage = new TabPage();
			_assyTabPage.Controls.Add(_assyTree);
			_assyTabPage.Text = StringParser.Parse("${res:ComponentInspector.FindDialog.AssembliesRadioButton}");
			_assyTabPage.BorderStyle = BorderStyle.None;
			_controlTree = new ControlTree();
			SetupTree(_controlTree);
			_controlTabPage = new TabPage();
			_controlTabPage.Controls.Add(_controlTree);
			_controlTabPage.Text = StringParser.Parse("${res:ComponentInspector.ControlsTab}");
			_controlTabPage.BorderStyle = BorderStyle.None;
			_assemblies = ComponentInspectorProperties.PreviouslyOpenedAssemblies;
		}
Esempio n. 12
0
		protected static void SetupTree(BrowserTree tree)
		{
			tree.Dock = DockStyle.Fill;
			tree.BorderStyle = BorderStyle.None;
			tree.AllowDrop = true;
			// Sucks, see comment in BrowserTreeNode.PostConstructor
			tree.Font = new Font(tree.Font, FontStyle.Bold);
			tree.UseIntermediateNodes = true;
			// Have to create because this might be updated in the initial
			// creation code
			tree.CreateControl();
		}