Beispiel #1
0
        private void filtertree_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            TreeNode nd = filtertree.SelectedNode;

            if (nd == null)
            {
                return;
            }
            while (nd.Parent != null && nd.Tag == null)
            {
                nd = nd.Parent;
            }
            FilterProps fp = (FilterProps)nd.Tag;

            if (fp != null)
            {
                string catname = catcombo.SelectedItem.ToString();
                if (catguids[catname] == FilterCategory.ActiveMovieCategories)
                {
                    SelectCategory(fp.Name);
                }
                else
                {
                    GraphForm gf = Program.mainform.ActiveGraphForm;
                    if (gf != null)
                    {
                        gf.AddFilter(fp);
                    }
                }
            }
        }
Beispiel #2
0
        public FilterProps MkFilterProps()
        {
            FilterProps fp = new FilterProps(name, longname, guid, catguid);

            fp.MakeFileName();
            return(fp);
        }
Beispiel #3
0
        public void AddFilter(FilterProps fp, Point?desired_pos)  //create new IBaseFilter, add it to DS graph and this graph
        {
            Filter f;

            try
            {
                f = new Filter(fp);
                int hr = graphBuilder.AddFilter(f.BaseFilter, fp.Name);
                DsError.ThrowExceptionForHR(hr);
            }
            catch (COMException e)
            {
                ShowCOMException(e, "Error creating filter " + fp.Name);
                return;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Error adding filter");
                return;
            }
            string srcfn = null, dstfn = null;

            if ((f.BaseFilter as IFileSourceFilter) != null)
            {
                srcfn = f.ChooseSrcFileName();
            }

            if ((f.BaseFilter as IFileSinkFilter) != null)
            {
                dstfn = f.ChooseDstFileName();
            }

            AddFilterHere(f, true, desired_pos);
            history.AddFilter(fp, f.Name, srcfn, dstfn, f);
        }
Beispiel #4
0
 bool SelectNode(string dispname)
 {
     foreach (TreeNode nd in filtertree.Nodes)
     {
         FilterProps fp = (FilterProps)nd.Tag;
         if (fp.DisplayName == dispname)
         {
             filtertree.SelectedNode = nd;
             return(true);
         }
     }
     return(false);
 }
Beispiel #5
0
        public Filter(IBaseFilter ibf)
        {
            basefilter = ibf;
            Guid clsid;

            ibf.GetClassID(out clsid);
            FilterInfo fi;

            ibf.QueryFilterInfo(out fi);
            string strGuid    = Graph.GuidToString(clsid);
            string strCatguid = Graph.GuidToString(FilterCategory.LegacyAmFilterCategory);

            filterProps = new FilterProps(fi.achName, "", strGuid, strCatguid);
            filterProps.MakeFileName();
            filterProps.SetFilter(this);
        }
Beispiel #6
0
        private void filtertree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode nd = filtertree.SelectedNode;

            while (nd.Parent != null && nd.Tag == null)
            {
                nd = nd.Parent;
            }
            FilterProps fp = (FilterProps)nd.Tag;

            if (fp != null)
            {
                fp.Prepare();
            }
            Program.mainform.propform.SetObject(fp);
        }
Beispiel #7
0
        static public List <FilterProps> GetFiltersFromEnum(IEnumMoniker emon, Guid cg)
        {
            List <FilterProps> list = new List <FilterProps>();

            if (emon != null)
            {
                IMoniker[] mon = new IMoniker[1];
                while (0 == emon.Next(1, mon, IntPtr.Zero))
                {
                    object bagObj        = null;
                    Guid   propertyBagId = typeof(IPropertyBag).GUID;
                    mon[0].BindToStorage(null, null, ref propertyBagId, out bagObj);
                    IPropertyBag bag = (IPropertyBag)bagObj;
                    object       nameObj;
                    bag.Read("FriendlyName", out nameObj, null);
                    string name = nameObj as string;

                    string dispname;
                    mon[0].GetDisplayName(null, null, out dispname);
                    bag.Read("CLSID", out nameObj, null);
                    string clsid = nameObj as string;
                    if (clsid == null && dispname.Contains(":dmo:"))
                    {
                        int st = dispname.IndexOf('{');
                        int ed = dispname.IndexOf('}');
                        if (st >= 0 && ed >= 0)
                        {
                            clsid = dispname.Substring(st, ed - st + 1);
                        }
                    }
                    if (clsid != null && !friendlyNames.ContainsKey(clsid))
                    {
                        friendlyNames.Add(clsid, name);
                    }

                    FilterProps fp = new FilterProps(name, dispname, clsid, Graph.GuidToString(cg));
                    list.Add(fp);

                    Marshal.ReleaseComObject(bagObj);
                    Marshal.ReleaseComObject(mon[0]);
                }
            }
            return(list);
        }
Beispiel #8
0
 private void OnDragDrop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) {
         TreeNode nd = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode", false);
         if (nd == null)
             return;
         while (nd.Parent != null && nd.Tag == null)
             nd = nd.Parent;
         FilterProps fp = (FilterProps)nd.Tag;
         if (fp != null)
         {
             Point p = PointToClient(new Point(e.X, e.Y));                    
             p.X += hScrollBar.Value;
             p.Y += vScrollBar.Value - toolStripHeight;
             if (p.Y < 0) p.Y = 0;
             AddFilter(fp, new Point(p.X / graph.cellsize, p.Y / graph.cellsize));
         }
     }
 }
Beispiel #9
0
        public void AddToFavorites(FilterProps fp)
        {
            foreach (ToolStripItem it in favoritesToolStripMenuItem.DropDownItems)
            {
                if (it.Text == fp.Name)
                {
                    return;
                }
            }
            ToolStripMenuItem item = new ToolStripMenuItem();

            item.Text   = fp.Name;
            item.Click += delegate {
                if (activeGraphForm != null)
                {
                    activeGraphForm.AddFilter(fp);
                }
            };
            favoritesToolStripMenuItem.DropDownItems.Add(item);
            favlist.Add(fp.Kernel());
        }
Beispiel #10
0
        private void OnEdit(object sender, EventArgs e)
        {
            TreeNode nd = filtertree.SelectedNode;

            if (nd == null)
            {
                return;
            }
            while (nd.Parent != null && nd.Tag == null)
            {
                nd = nd.Parent;
            }
            FilterProps fp = (FilterProps)nd.Tag;

            if (fp != null)
            {
                EditFilterForm ef = new EditFilterForm(fp);
                ef.MdiParent = MdiParent;
                ef.Show();
            }
        }
Beispiel #11
0
        static Dictionary <string, string> dispnames = new Dictionary <string, string>(); //orgname => display name

        public Filter(FilterProps fp)
        {
            filterProps = fp;

            IBindCtx bindCtx = null;
            IMoniker moniker = null;

            basefilter = null;
            try
            {
                int hr = NativeMethods.CreateBindCtx(0, out bindCtx);
                Marshal.ThrowExceptionForHR(hr);
                int eaten;
                hr = NativeMethods.MkParseDisplayName(bindCtx, fp.DisplayName, out eaten, out moniker);
                Marshal.ThrowExceptionForHR(hr);
                Guid   guid = typeof(IBaseFilter).GUID;
                object obj;
                moniker.BindToObject(bindCtx, null, ref guid, out obj);
                basefilter = obj as IBaseFilter;
            }
            finally
            {
                if (bindCtx != null)
                {
                    Marshal.ReleaseComObject(bindCtx);
                }
                if (moniker != null)
                {
                    Marshal.ReleaseComObject(moniker);
                }
            }

            if (basefilter == null)
            {
                throw new Exception("Can't create filter");
            }

            fp.SetFilter(this);
        }
Beispiel #12
0
        private void treeView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            TreeNode nd = treeView.SelectedNode;

            if (nd == null)
            {
                return;
            }
            while (nd.Parent != null && nd.Tag == null)
            {
                nd = nd.Parent;
            }
            FilterProps fp = (FilterProps)nd.Tag;

            if (fp != null)
            {
                GraphForm gf = Program.mainform.ActiveGraphForm;
                if (gf != null)
                {
                    gf.AddFilter(fp);
                }
            }
        }
Beispiel #13
0
 public void AddFilter(FilterProps fp)
 {
     AddFilter(fp, null);
 }
Beispiel #14
0
 private void AddFilter(FilterProps fp, Point? desired_pos)
 {
     graph.AddFilter(fp, desired_pos);
     RecalcScrolls();
     Invalidate();
 }
Beispiel #15
0
 public EditFilterForm(FilterProps _fp)
 {
     InitializeComponent();
     fp = _fp;
 }