Ejemplo n.º 1
0
        /// <summary>
        /// Creates and shows a Source context menu at the mouse pointer
        /// </summary>
        public ContextMenuStrip SourceContextMenu()
        {
            var filtermenu = new ContextMenuStrip { Renderer = new AccessKeyMenuStripRenderer() };

            var enabled = new ToolStripBindableMenuItem
            {
                Text = "&Enabled",
                CheckOnClick = true,
            };
            enabled.DataBindings.Add(new Binding("Checked", SelectedSource, "Enabled", false, DataSourceUpdateMode.OnPropertyChanged));

            var muted = new ToolStripBindableMenuItem
            {
                Text = "&Muted",
                CheckOnClick = true,
            };
            muted.DataBindings.Add(new Binding("Checked", SelectedSource, "Muted", false, DataSourceUpdateMode.OnPropertyChanged));

            var filters = new ToolStripMenuItem("Edit Source Filters...");
            filters.Click += (sender, args) =>
            {
                var filterprop = new TestFilter(SelectedSource);
                filterprop.ShowDialog();
            };

            var properties = new ToolStripMenuItem("Edit Source Properties...");
            properties.Click += (sender, args) =>
            {
                var sourceprop = new TestProperties(SelectedSource);
                sourceprop.ShowDialog();
            };

            filtermenu.Items.AddRange(new ToolStripItem[]
                                      {
                                          enabled,
                                          muted,
                                          new ToolStripSeparator(),
                                          filters,
                                          properties
                                      });

            return filtermenu;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates and shows an Item context menu at the mouse pointer
        /// </summary>
        public ContextMenuStrip ItemContextMenu()
        {
            var top = new ToolStripMenuItem("Move to &Top");
            top.Click += (o, args) =>
            {
                SetItem(SelectedScene.MoveItem(SelectedItem, obs_order_movement.OBS_ORDER_MOVE_TOP));
            };

            var up = new ToolStripMenuItem("Move &Up");
            up.Click += (o, args) =>
            {
                SetItem(SelectedScene.MoveItem(SelectedItem, obs_order_movement.OBS_ORDER_MOVE_UP));
            };

            var down = new ToolStripMenuItem("Move &Down");
            down.Click += (o, args) =>
            {
                SetItem(SelectedScene.MoveItem(SelectedItem, obs_order_movement.OBS_ORDER_MOVE_DOWN));
            };

            var bottom = new ToolStripMenuItem("Move to &Bottom");
            bottom.Click += (o, args) =>
            {
                SetItem(SelectedScene.MoveItem(SelectedItem, obs_order_movement.OBS_ORDER_MOVE_BOTTOM));
            };

            var transform = new ToolStripMenuItem("&Edit Transform Options...");
            transform.Click += (o, args) =>
            {
                var transformfrm = new TestTransform(SelectedItem);
                transformfrm.ShowDialog();
            };

            var prop = new ToolStripMenuItem("&Edit Source Properties...");
            prop.Click += (sender, args) =>
            {
                var propfrm = new TestProperties(SelectedItem.GetSource());
                propfrm.ShowDialog();
            };

            var visible = new ToolStripBindableMenuItem
                          {
                              Text = "&Visible",
                              CheckOnClick = true
                          };
            visible.DataBindings.Add(new Binding("Checked", SelectedItem, "Visible", false, DataSourceUpdateMode.OnPropertyChanged));

            var ordermenu = new ContextMenuStrip
                            {
                                Renderer = new AccessKeyMenuStripRenderer()
                            };

            ordermenu.Items.AddRange(new ToolStripItem[]
                                     {
                                         top,
                                         up,
                                         down,
                                         bottom,
                                         new ToolStripSeparator(),
                                         visible,
                                         new ToolStripSeparator(),
                                         transform,
                                         prop
                                     });

            int index = SelectedScene.Items.IndexOf(SelectedItem);
            top.Enabled = up.Enabled = index != 0;
            down.Enabled = bottom.Enabled = index != SelectedScene.Items.Count - 1;
            return ordermenu;
        }