Пример #1
0
        public PropertiesDialog(string caption, IBaseFilter filter)
        {
            InitializeComponent();

            // remove the default panels
            this.Controls.Remove(panel1);
            this.Controls.Remove(panel2);

            // create the PropertyPagePanel
            _properties      = new PropertyPagePanel(true, filter);
            _properties.Dock = DockStyle.Fill;

            // make sure it's wide enough to show all the buttons
            int newwidth  = Math.Max(350, _properties.PageSize.Width);
            int newheight = _properties.PageSize.Height;

            this.ClientSize = new Size(newwidth + 10, newheight + 23);

            this.Controls.Add(_properties);
            _properties.OkButton.DialogResult    = DialogResult.OK;
            _properties.CloseButton.DialogResult = DialogResult.Cancel;
            this.CancelButton = _properties.CloseButton;
            this.AcceptButton = _properties.OkButton;
            Text = caption;
        }
Пример #2
0
        /// <summary>
        /// Add, Remove, and Update Pin property pages in the _properties control
        /// </summary>
        internal void SyncPinPropertyPages(PropertyPagePanel properties)
        {
            if (properties == null)
            {
                properties = _properties;
            }

            if (properties != null)
            {
                // remove any pin property pages that are no longer valid
                List <IPin> pins = (Node as DSFilterNode).GetPins();
                for (int i = properties.TabControl.Controls.Count - 1; i > -1; i--)
                {
                    try
                    {
                        if (properties.TabControl.Controls[i].Tag is IPin)
                        {
                            if (!pins.Contains(_properties.TabControl.Controls[i].Tag as IPin))
                            {
                                properties.TabControl.Controls.RemoveAt(i);
                            }
                        }
                    }
                    catch
                    {
                        // the IPin was removed from the filter before we could sync it
                        // go ahead and remove the property page
                        properties.TabControl.Controls.RemoveAt(i);
                    }
                }

                // find or create a new tabpage for each remaining pin
                foreach (IPin pin in pins)
                {
                    TabPage tp = GetPinPropertyPage(pin);
                    PinPropertiesTextBox tbox = null;
                    if (tp == null)
                    {
                        // we don't have this one yet so create it
                        PinInfo pi;
                        pin.QueryPinInfo(out pi);
                        tp = new TabPage(pi.name);
                        DsUtils.FreePinInfo(pi);
                        tp.Tag = pin;
                        tbox   = new PinPropertiesTextBox(pin);
                        tp.Controls.Add(tbox);
                        properties.TabControl.Controls.Add(tp);
                    }
                    else
                    {
                        // we already have this property page, refresh it's text box
                        tbox = tp.Controls[0] as PinPropertiesTextBox;
                        tbox.RefreshProperties();
                    }
                }
            }
        }
Пример #3
0
        void node_AfterNodeRemoved(DaggerLib.Core.DaggerNode node)
        {
            //get rid of the property pages etc
            if (_properties != null)
            {
                _properties.Apply();
                _properties.Parent = null;
                _properties.CloseInterfaces();
                _properties = null;
            }

            // deinitialize the video window
            if (_videoWindow != null)
            {
                _videoWindow.Dispose();
                _videoWindow = null;
            }
        }
Пример #4
0
        /// <summary>
        /// Toggle Modal Property pages
        /// </summary>
        internal void SetModalProperties()
        {
            if ((this.Parent as DSDaggerUIGraph).ModalProperties && ((_dsfilternode._filter as IDMOWrapperFilter) == null))
            {
                if (_properties != null)
                {
                    // Kill the internal PropertyPagePanel.  Technically our internal PropertyPages
                    // and PropertyPages created with OleCreatePropertyFrame can coexist, but
                    // it's unpredicatable at best.
                    InternalControl.Controls.Remove(_properties);
                    _properties.Dispose();
                    _properties = null;
                    GC.Collect();
                }

                this._expandPropertiesButton.State       = false;
                this._expandPropertiesButton.ToolTipText = "Properties";
                this._expandPropertiesButton.MultiState  = false;
                this._expandPropertiesButton.ButtonImage = _propertiesImageList.Images[2];

                // if it doesn't have a video window embedded in it, there's not reason
                // it should be resizable
                if (_videoWindow == null)
                {
                    this.Resizable = false;
                }
            }
            else
            {
                if (_properties == null)
                {
                    // Create the PropertyPagePanel for the filter
                    _properties = new PropertyPagePanel(false, _dsfilternode._filter);
                    InternalControl.Controls.Add(_properties);
                    InternalControl.AutoScroll = true;
                    _properties.Visible        = false;

                    // if it's a DMO create the dmo properties for it
                    // DMOs always have non-modal properties because OleCreatePropertyFrame doesn't
                    // work on them
                    if ((_dsfilternode._filter as IDMOWrapperFilter) != null)
                    {
                        TabPage dmopage = SetDMOParams();
                        _properties.TabControl.TabPages.Add(dmopage);
                    }

                    SyncPinPropertyPages(null);
                }

                this._expandPropertiesButton.ToolTipText  = "Show/Hide Properties";
                this._expandPropertiesButton.MultiState   = true;
                this._expandPropertiesButton.ButtonImage  = _propertiesImageList.Images[0];
                this._expandPropertiesButton.ButtonImage2 = _propertiesImageList.Images[1];

                // make sure the button is visible
                this._expandPropertiesButton.Visible = true;

                // we want it to be resizable
                this.Resizable = true;
            }
        }