Exemple #1
0
 private void ViewerItemClick(Object sender, System.EventArgs e)
 {
     if (Tree.SelectedNode != null)
     {
         if (viewerForm == null)
         {
             viewerForm = new ViewerForm();
             viewerForm.StartPosition = FormStartPosition.Manual;
         }
         DataNode node = Tree.SelectedNode.Tag as DataNode;
         viewerForm.Exp   = node.Text;
         viewerForm.Value = node.Value;
         Form mainform = (PluginBase.MainForm as Form);
         viewerForm.Left = mainform.Left + mainform.Width / 2 - viewerForm.Width / 2;
         viewerForm.Top  = mainform.Top + mainform.Height / 2 - viewerForm.Height / 2;
         viewerForm.ShowDialog();
     }
 }
 public DataTreeControl(bool watchMode)
 {
     InitializeComponent();
     this.ValueNodeTextBox.ToolTipProvider = this;
     this.watchMode = watchMode;
     _model = new DataTreeModel();
     _tree.Model = _model;
     this.Controls.Add(_tree);
     _tree.Expanding += new EventHandler<TreeViewAdvEventArgs>(TreeExpanding);
     _tree.SelectionChanged += new EventHandler(TreeSelectionChanged);
     _tree.LoadOnDemand = true;
     _tree.AutoRowHeight = true;
     NameNodeTextBox.IsEditEnabledValueNeeded += new EventHandler<NodeControlValueEventArgs>(NameNodeTextBox_IsEditEnabledValueNeeded);
     ValueNodeTextBox.DrawText += new EventHandler<DrawEventArgs>(ValueNodeTextBox_DrawText);
     ValueNodeTextBox.IsEditEnabledValueNeeded += new EventHandler<NodeControlValueEventArgs>(ValueNodeTextBox_IsEditEnabledValueNeeded);
     ValueNodeTextBox.EditorShowing += new System.ComponentModel.CancelEventHandler(ValueNodeTextBox_EditorShowing);
     ValueNodeTextBox.EditorHided += new EventHandler(ValueNodeTextBox_EditorHided);
     _tree.NodeMouseDoubleClick += new EventHandler<TreeNodeAdvMouseEventArgs>(_tree_NodeMouseDoubleClick);
     _contextMenuStrip = new ContextMenuStrip();
     if (PluginBase.MainForm != null && PluginBase.Settings != null)
     {
         _contextMenuStrip.Font = PluginBase.Settings.DefaultFont;
         _contextMenuStrip.Renderer = new DockPanelStripRenderer(false);
     }
     _tree.ContextMenuStrip = _contextMenuStrip;
     this.NameTreeColumn.Header = TextHelper.GetString("Label.Name");
     this.ValueTreeColumn.Header = TextHelper.GetString("Label.Value");
     copyMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Copy"), null, new EventHandler(this.CopyItemClick));
     viewerMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Viewer"), null, new EventHandler(this.ViewerItemClick));
     _contextMenuStrip.Items.AddRange(new ToolStripMenuItem[] { copyMenuItem, viewerMenuItem});
     if (watchMode)
     {
         watchMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Unwatch"), null, new EventHandler(this.WatchItemClick));
     }
     else
     {
         watchMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Watch"), null, new EventHandler(this.WatchItemClick));
     }
     _contextMenuStrip.Items.Add(watchMenuItem);
     TreeSelectionChanged(null, null);
     viewerForm = new ViewerForm();
     viewerForm.StartPosition = FormStartPosition.Manual;
 }
 public DataTreeControl(bool watchMode)
 {
     InitializeComponent();
     this.ValueNodeTextBox.ToolTipProvider = this;
     this.watchMode = watchMode;
     _model         = new DataTreeModel();
     _tree.Model    = _model;
     this.Controls.Add(_tree);
     _tree.Expanding        += new EventHandler <TreeViewAdvEventArgs>(TreeExpanding);
     _tree.SelectionChanged += new EventHandler(TreeSelectionChanged);
     _tree.LoadOnDemand      = true;
     _tree.AutoRowHeight     = true;
     NameNodeTextBox.IsEditEnabledValueNeeded += new EventHandler <NodeControlValueEventArgs>(NameNodeTextBox_IsEditEnabledValueNeeded);
     ValueNodeTextBox.DrawText += new EventHandler <DrawEventArgs>(ValueNodeTextBox_DrawText);
     ValueNodeTextBox.IsEditEnabledValueNeeded += new EventHandler <NodeControlValueEventArgs>(ValueNodeTextBox_IsEditEnabledValueNeeded);
     ValueNodeTextBox.EditorShowing            += new System.ComponentModel.CancelEventHandler(ValueNodeTextBox_EditorShowing);
     ValueNodeTextBox.EditorHided += new EventHandler(ValueNodeTextBox_EditorHided);
     _tree.NodeMouseDoubleClick   += new EventHandler <TreeNodeAdvMouseEventArgs>(_tree_NodeMouseDoubleClick);
     _contextMenuStrip             = new ContextMenuStrip();
     if (PluginBase.MainForm != null && PluginBase.Settings != null)
     {
         _contextMenuStrip.Font     = PluginBase.Settings.DefaultFont;
         _contextMenuStrip.Renderer = new DockPanelStripRenderer(false);
     }
     _tree.ContextMenuStrip      = _contextMenuStrip;
     this.NameTreeColumn.Header  = TextHelper.GetString("Label.Name");
     this.ValueTreeColumn.Header = TextHelper.GetString("Label.Value");
     copyMenuItem   = new ToolStripMenuItem(TextHelper.GetString("Label.Copy"), null, new EventHandler(this.CopyItemClick));
     viewerMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Viewer"), null, new EventHandler(this.ViewerItemClick));
     _contextMenuStrip.Items.AddRange(new ToolStripMenuItem[] { copyMenuItem, viewerMenuItem });
     if (watchMode)
     {
         watchMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Unwatch"), null, new EventHandler(this.WatchItemClick));
     }
     else
     {
         watchMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Watch"), null, new EventHandler(this.WatchItemClick));
     }
     _contextMenuStrip.Items.Add(watchMenuItem);
     TreeSelectionChanged(null, null);
     viewerForm = new ViewerForm();
     viewerForm.StartPosition = FormStartPosition.Manual;
 }
        private void ViewerItemClick(Object sender, System.EventArgs e)
        {
            if (Tree.SelectedNode != null)
            {
                if (viewerForm == null)
                {
                    viewerForm = new ViewerForm();
                    viewerForm.StartPosition = FormStartPosition.Manual;
                }
                DataNode node = Tree.SelectedNode.Tag as DataNode;
                viewerForm.Exp = node.Text;
				viewerForm.Value = node.Value;
                Form mainform = (PluginBase.MainForm as Form);
                viewerForm.Left = mainform.Left + mainform.Width / 2 - viewerForm.Width / 2;
                viewerForm.Top = mainform.Top + mainform.Height / 2 - viewerForm.Height / 2;
                viewerForm.ShowDialog();
            }
        }
Exemple #5
0
        public DataTreeControl(bool watchMode)
        {
            InitializeComponent();
            ValueNodeTextBox.EditEnabled     = true;
            ValueNodeTextBox.EditOnClick     = true;
            ValueNodeTextBox.ToolTipProvider = this;
            if (watchMode)
            {
                this.watchMode = true;
                NameNodeTextBox.EditEnabled               = true;
                NameNodeTextBox.EditorShowing            += NameNodeTextBox_EditorShowing;
                NameNodeTextBox.EditorHided              += NameNodeTextBox_EditorHided;
                NameNodeTextBox.IsEditEnabledValueNeeded += NameNodeTextBox_IsEditEnabledValueNeeded;
                NameNodeTextBox.LabelChanged             += NameNodeTextBox_LabelChanged;
                _tree.KeyDown        += Tree_KeyDown;
                _tree.NodeMouseClick += Tree_NameNodeMouseClick;
            }
            _model              = new DataTreeModel();
            _tree.Model         = _model;
            _tree.FullRowSelect = true;
            Controls.Add(_tree);
            _tree.Expanding            += TreeExpanding;
            _tree.NodeMouseDoubleClick += Tree_NodeMouseDoubleClick;
            _tree.LoadOnDemand          = true;
            _tree.AutoHeaderHeight      = true;
            _tree.AutoRowHeight         = true;
            _tree.HideSelection         = true;

            _tree.CustomDrawHeaders       = PluginBase.MainForm.GetThemeColor("ColumnHeader.BorderColor") != Color.Empty;
            _tree.ColumnHeaderBackColor   = PluginBase.MainForm.GetThemeColor("ColumnHeader.BackColor", SystemColors.Control);
            _tree.ColumnHeaderTextColor   = PluginBase.MainForm.GetThemeColor("ColumnHeader.TextColor", SystemColors.ControlText);
            _tree.ColumnHeaderBorderColor = PluginBase.MainForm.GetThemeColor("ColumnHeader.BorderColor", SystemColors.ActiveBorder);
            _tree.LineColor         = PluginBase.MainForm.GetThemeColor("DataTreeControl.LineColor", SystemColors.ActiveBorder);
            _tree.LineColor2        = PluginBase.MainForm.GetThemeColor("DataTreeControl.LineColor", SystemColors.ActiveBorder);
            _tree.DragDropMarkColor = PluginBase.MainForm.GetThemeColor("DataTreeControl.ForeColor", SystemColors.WindowText);
            _tree.ForeColor         = PluginBase.MainForm.GetThemeColor("TreeViewAdv.ForeColor", SystemColors.ControlText);
            _tree.BackColor         = PluginBase.MainForm.GetThemeColor("TreeViewAdv.BackColor", SystemColors.Control);

            NameNodeTextBox.DrawText  += NameNodeTextBox_DrawText;
            ValueNodeTextBox.DrawText += ValueNodeTextBox_DrawText;
            ValueNodeTextBox.IsEditEnabledValueNeeded += ValueNodeTextBox_IsEditEnabledValueNeeded;
            ValueNodeTextBox.EditorShowing            += ValueNodeTextBox_EditorShowing;
            ValueNodeTextBox.EditorHided  += ValueNodeTextBox_EditorHided;
            ValueNodeTextBox.LabelChanged += ValueNodeTextBox_LabelChanged;
            _contextMenuStrip              = new ContextMenuStrip();
            if (PluginBase.MainForm != null && PluginBase.Settings != null)
            {
                _contextMenuStrip.Font     = PluginBase.Settings.DefaultFont;
                _contextMenuStrip.Renderer = new DockPanelStripRenderer(false);
            }
            _tree.ContextMenuStrip = _contextMenuStrip;
            NameTreeColumn.Header  = TextHelper.GetString("Label.Name");
            ValueTreeColumn.Header = TextHelper.GetString("Label.Value");
            copyMenuItem           = new ToolStripMenuItem(TextHelper.GetString("Label.Copy"), null, CopyItemClick);
            copyValueMenuItem      = new ToolStripMenuItem(TextHelper.GetString("Label.CopyValue"), null, CopyItemValueClick);
            copyIdMenuItem         = new ToolStripMenuItem(TextHelper.GetString("Label.CopyID"), null, CopyItemIdClick);
            viewerMenuItem         = new ToolStripMenuItem(TextHelper.GetString("Label.Viewer"), null, ViewerItemClick);
            _contextMenuStrip.Items.AddRange(new ToolStripItem[]
            {
                copyMenuItem, copyIdMenuItem, copyValueMenuItem, viewerMenuItem
            });
            if (watchMode)
            {
                watchMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Unwatch"), null, WatchItemClick);
            }
            else
            {
                watchMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Watch"), null, WatchItemClick);
            }
            _contextMenuStrip.Items.Add(watchMenuItem);
            _contextMenuStrip.Opening += ContextMenuStrip_Opening;
            viewerForm = new ViewerForm();
            viewerForm.StartPosition = FormStartPosition.Manual;
            // LiveDataTip is created before the settings object. We don't need for it anyway
            if (PluginMain.settingObject != null)
            {
                PluginMain.settingObject.DataTreeDisplayChanged += DataTreeDisplayChanged;
            }
        }
 public DataTreeControl(bool watchMode)
 {
     InitializeComponent();
     ValueNodeTextBox.EditEnabled = true;
     ValueNodeTextBox.EditOnClick = true;
     ValueNodeTextBox.ToolTipProvider = this;
     if (watchMode)
     {
         this.watchMode = true;
         NameNodeTextBox.EditEnabled = true;
         NameNodeTextBox.DrawText += NameNodeTextBox_DrawText;
         NameNodeTextBox.EditorShowing += NameNodeTextBox_EditorShowing;
         NameNodeTextBox.EditorHided += NameNodeTextBox_EditorHided;
         NameNodeTextBox.IsEditEnabledValueNeeded += NameNodeTextBox_IsEditEnabledValueNeeded;
         NameNodeTextBox.LabelChanged += NameNodeTextBox_LabelChanged;
         _tree.KeyDown += Tree_KeyDown;
         _tree.NodeMouseClick += Tree_NameNodeMouseClick;
     }
     _model = new DataTreeModel();
     _tree.Model = _model;
     _tree.FullRowSelect = true;
     Controls.Add(_tree);
     _tree.Expanding += TreeExpanding;
     _tree.NodeMouseDoubleClick += Tree_NodeMouseDoubleClick;
     _tree.LoadOnDemand = true;
     _tree.AutoRowHeight = true;
     ValueNodeTextBox.DrawText += ValueNodeTextBox_DrawText;
     ValueNodeTextBox.IsEditEnabledValueNeeded += ValueNodeTextBox_IsEditEnabledValueNeeded;
     ValueNodeTextBox.EditorShowing += ValueNodeTextBox_EditorShowing;
     ValueNodeTextBox.EditorHided += ValueNodeTextBox_EditorHided;
     ValueNodeTextBox.LabelChanged += ValueNodeTextBox_LabelChanged;
     _contextMenuStrip = new ContextMenuStrip();
     if (PluginBase.MainForm != null && PluginBase.Settings != null)
     {
         _contextMenuStrip.Font = PluginBase.Settings.DefaultFont;
         _contextMenuStrip.Renderer = new DockPanelStripRenderer(false);
     }
     _tree.ContextMenuStrip = _contextMenuStrip;
     NameTreeColumn.Header = TextHelper.GetString("Label.Name");
     ValueTreeColumn.Header = TextHelper.GetString("Label.Value");
     copyMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Copy"), null, CopyItemClick);
     copyValueMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.CopyValue"), null, CopyItemValueClick);
     copyIdMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.CopyID"), null, CopyItemIdClick);
     viewerMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Viewer"), null, ViewerItemClick);
     _contextMenuStrip.Items.AddRange(new ToolStripItem[]
     {
         copyMenuItem, copyIdMenuItem, copyValueMenuItem, viewerMenuItem
     });
     if (watchMode) watchMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Unwatch"), null, WatchItemClick);
     else watchMenuItem = new ToolStripMenuItem(TextHelper.GetString("Label.Watch"), null, WatchItemClick);
     _contextMenuStrip.Items.Add(watchMenuItem);
     _contextMenuStrip.Opening += ContextMenuStrip_Opening;
     viewerForm = new ViewerForm();
     viewerForm.StartPosition = FormStartPosition.Manual;
     // LiveDataTip is created before the settings object. We don't need for it anyway
     if (PluginMain.settingObject != null) PluginMain.settingObject.DataTreeDisplayChanged += DataTreeDisplayChanged;
 }
 private void ViewerItemClick(Object sender, System.EventArgs e)
 {
     if (viewerForm == null)
     {
         viewerForm = new ViewerForm();
         viewerForm.StartPosition = FormStartPosition.Manual;
     }
     DataNode node = Tree.SelectedNode.Tag as DataNode;
     viewerForm.Exp = node.Text;
     if (node is ValueNode)
     {
         var vNode = (ValueNode)node;
         // use IsEditing to get unfiltered value
         bool ed = vNode.IsEditing;
         vNode.IsEditing = true;
         viewerForm.Value = node.Value;
         vNode.IsEditing = ed;
     }
     else
     {
         viewerForm.Value = node.Value;
     }
     Form mainform = (PluginBase.MainForm as Form);
     viewerForm.Left = mainform.Left + mainform.Width / 2 - viewerForm.Width / 2;
     viewerForm.Top = mainform.Top + mainform.Height / 2 - viewerForm.Height / 2;
     viewerForm.ShowDialog();
 }