public Item CreateItem(Source source) { Item item = SelectedScene.Add(source, source.Name); item.Position = new Vector2(0f, 0f); item.Scale = new Vector2(1.0f, 1.0f); item.SetBounds(new Vector2(1280, 720), ObsBoundsType.ScaleInner, ObsAlignment.Center); return(item); }
/// <summary> /// Deletes the currently selected Scene /// </summary> public void DelScene() { if (SelectedScene == null || Scenes.Count == 1) { return; } SelectedScene.ClearItems(); SelectedScene.Dispose(); int oldindex = Scenes.IndexOf(SelectedScene); Scenes.RemoveAt(oldindex); SelectedScene = oldindex < Scenes.Count ? Scenes[oldindex] : Scenes.Last(); }
/// <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); }
public Item CreateAudioItem(Source source) { Item item = SelectedScene.Add(source, source.Name); return(item); }