internal DetailPanel() : base()
 {
     _detailPanel = this;
     _elements    = new ArrayList();
     AutoScroll   = true;
     BorderStyle  = BorderStyle.Fixed3D;
 }
Ejemplo n.º 2
0
		internal DetailPanel() : base()
		{
			_detailPanel = this;
			_elements = new ArrayList();
			AutoScroll = true;
			BorderStyle = BorderStyle.Fixed3D;
		}
Ejemplo n.º 3
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();
		}