Example #1
0
        public NlmTreeListView()
        {
            DisabledHandles = new List <UIntPtr>();

            Margin = new Padding(0);
            Dock   = DockStyle.Fill;

            // Apply look from 3ds Max colour scheme and set ImageList.
            MaxLook.ApplyLook(this);
            NodeClassImageList.Apply(this);

            // Set properties.
            AllowDrop                = true;
            IsSimpleDragSource       = true;
            IsSimpleDropSink         = true;
            FullRowSelect            = true;
            UseAlternatingBackColors = true;
            RowHeight                = 20;
            UseCustomSelectionColors = true;
            HideSelection            = false;
            CellEditActivation       = ObjectListView.CellEditActivateMode.DoubleClick;
            UseFiltering             = true;
            BorderStyle              = BorderStyle.FixedSingle;
            View                               = View.Details;
            OwnerDrawnHeader                   = true;
            RevealAfterExpand                  = false; // After expanding, the expand node moves to the top of the listview. It's kinda jarring so turn it off.
            CanUseApplicationIdle              = false; // 3ds Max appears to completley suppress application idle events.
            DisabledItemStyle                  = new DisabledNodeStyle(this);
            SelectColumnsOnRightClick          = true;
            SelectColumnsOnRightClickBehaviour = ColumnSelectBehaviour.InlineMenu;
            ShowCommandMenuOnRightClick        = false;
            ShowFilterMenuOnRightClick         = false;

            // Instance feature expansion classes.
            TreeColumnRenderer   = new NlmTreeColumnRenderer();
            ColumnHeaderRenderer = new ColumnHeaderRenderer(this);
            NlmColumns           = new NlmColumnCollection(this);
            CellEditValidator    = new CellEditValidator(this);
            MouseLeftClick       = new MouseLeftClick(this);
            ModelFilter          = new NlmTreeNodeFilterEngine(this);
            NodeControl          = new NodeController(this);
            ContextMenu          = new NlmContextMenu(this);

            // Load saved state if it exists
            MaxIO.LoadNlmData(this);

            this.CellEditStarting += new CellEditEventHandler(onBeforeLabelEdit);
        }
Example #2
0
        internal NlmTreeColumnRenderer()
        {
            this.Expand      = new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("NestedLayerManager.Resources.Icons.TreeListView.TreeExpanded.png"));
            this.Collapse    = new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("NestedLayerManager.Resources.Icons.TreeListView.TreeCollapsed.png"));
            this.IsShowLines = false;

            // The TreeRenderer inherits a HighlightTextRenderer for filtering.
            // Customise the colours here.

            Color hightlightColor = MaxLook.GetHighlightColor();

            //this.FramePen = new Pen(Color.FromArgb(43, 120, 197));
            //this.FillBrush = new SolidBrush(Color.FromArgb(100, 43, 120, 197));
            this.FramePen  = new Pen(hightlightColor);
            this.FillBrush = new SolidBrush(Color.FromArgb(128, hightlightColor));
        }
Example #3
0
        public NestedLayerManager()
        {
            System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
            stopwatch.Start();

            ListView  = new NlmTreeListView();
            SearchBar = new NlmSearchBar(ListView);

            ButtonPanelLeft  = new NlmButtonPanelLeft(ListView);
            ButtonPanelRight = new NlmButtonPanelRight(ListView);
            ButtonPanelSide  = new NlmButtonPanelSide(ListView);

            MaxLook.ApplyLook(this);

            ColumnCount = 3;
            RowCount    = 3;
            Padding     = new Padding(3);
            Dock        = DockStyle.Fill;

            Controls.Add(ButtonPanelLeft, 1, 0);
            SetColumnSpan(ButtonPanelLeft, 1);

            Controls.Add(ButtonPanelRight, 2, 0);

            Controls.Add(SearchBar, 1, 1);
            SetColumnSpan(SearchBar, 2);

            Controls.Add(ButtonPanelSide, 0, 2);

            Controls.Add(ListView, 1, 2);
            SetColumnSpan(ListView, 2);

            RowStyles.Add(new RowStyle(SizeType.Absolute, ButtonPanelLeft.Controls[0].Height + 2));
            RowStyles.Add(new RowStyle(SizeType.Absolute, SearchBar.Height + 2));
            RowStyles.Add(new RowStyle(SizeType.AutoSize));
            ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, ButtonPanelSide.Controls[0].Width + 2));
            ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, ButtonPanelLeft.Controls.Count * ButtonPanelLeft.Controls[0].Width));
            ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, ButtonPanelRight.Controls.Count * ButtonPanelRight.Controls[0].Width));

            ListView.NodeControl.Create.BuildSceneTree();

            stopwatch.Stop();
            string listenerMessage = "Loaded in " + stopwatch.ElapsedMilliseconds + " milliseconds.";

            MaxListener.PrintToListener(listenerMessage);
        }
Example #4
0
        public NlmSearchBar(NlmTreeListView listView)
        {
            ListView = listView;
            MaxLook.ApplyLook(this);
            Margin             = new Padding(0);
            Dock               = DockStyle.Fill;
            this.BorderStyle   = BorderStyle.FixedSingle;
            this.Height        = 20;
            this.DispatchTimer = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(400)
            };
            this.TextChanged        += new EventHandler(OnTextChanged);
            this.KeyDown            += new KeyEventHandler(OnKeyDown);
            this.KeyPress           += new KeyPressEventHandler(StopThatDing);
            this.DispatchTimer.Tick += new EventHandler(OnTimerTick);
            this.GotFocus           += new EventHandler(onGotFocus);
            this.LostFocus          += new EventHandler(onLostFocus);

            DelayedTextChanged += new EventHandler <SearchBarEventArgs>(KeyEvents.SearchBarTextChanged);
            EnterKeyDown       += new EventHandler <SearchBarEventArgs>(KeyEvents.SearchBarEnterPressed);
        }