Beispiel #1
0
        private void SelectionFindRegion()
        {
            try
            {
                //Options.ScriptOptionCollection options = Options.GetOptions("Find Region");
                var myPrompt = new FormSimplePrompt
                {
                    tbUserData     = { Text = ScriptOptions.GetValue(SelectionStrings.FindRegionKeyName, SelectionStrings.FindRegionLastString, "") },
                    Text           = "Find Region",
                    lblPrompt      = { Text = "Search for:" },
                    lblDescription = { Text = "Partial name of region to find" }
                };

                if (myPrompt.ShowDialog() == DialogResult.OK)
                {
                    Region   selRegion  = myVegas.GetSelectedRegion();
                    Timecode startTime  = (selRegion != null) ? selRegion.Position : Timecode.FromSeconds(0);
                    Region   bestRegion = myVegas.Project.FindRegion(myPrompt.tbUserData.Text, startTime);

                    if (bestRegion == null)
                    {
                        return;
                    }

                    myVegas.Transport.SelectionStart  = bestRegion.Position;
                    myVegas.Transport.SelectionLength = bestRegion.Length;

                    ScriptOptions.SetValue(SelectionStrings.FindRegionKeyName, SelectionStrings.FindRegionLastString, myPrompt.tbUserData.Text);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
        /// Implementation
        ///
        ///
        private void RegionsNudge(Timecode Time, bool Cumulative)
        {
            Timecode ZeroTime   = myVegas.Project.Ruler.StartTime;
            Timecode Adjustment = Time;

            if (Cumulative)
            {
                Adjustment = Timecode.FromSeconds(0);
            }

            var Groups = myVegas.GetRegionGroups();

            using (var undo = new UndoBlock("Nudge regions by " + Time))
            {
                foreach (var group in Groups)
                {
                    Timecode newTime         = group.Region.Position + Adjustment;
                    Timecode localAdjustment = Timecode.FromSeconds(0);

                    // zero time detection
                    if (newTime < ZeroTime)
                    {
                        if (ScriptOptions.GetValue(Strings.ScriptName, "ShowZeroTimeWarning", true))
                        {
                            myVegas.ShowError("Cannot move beyond start of timeline",
                                              "Your operation was aborted to avoid moving events outside the timeline");
                        }
                        return;
                    }

                    // collision detection
                    foreach (var grp in Groups)
                    {
                        if (!grp.Equals(@group))
                        {
                            if (newTime <= grp.Region.End && newTime >= grp.Region.Position)
                            {
                                localAdjustment = newTime - grp.Region.End;
                                break;
                            }
                        }
                    }
                    group.MoveTo(newTime - localAdjustment);
                    if (Cumulative)
                    {
                        Adjustment += Time;
                    }
                }
            }
        }
Beispiel #3
0
		private void btnTargetDirBrowse_Click(object sender, EventArgs e)
		{
			string lastTargetDir = ScriptOptions.GetValue(RegionRenderStrings.ScriptName, RegionRenderStrings.LastTargetDir, RegionRenderStrings.LastTargetDirDefault);
			string initialDir = Path.GetDirectoryName(lastTargetDir);
			if (string.IsNullOrEmpty(initialDir) || !Directory.Exists(initialDir))
				initialDir = @"C:\";

			var dlg = new FolderBrowserDialog();
			dlg.RootFolder = Environment.SpecialFolder.MyComputer;
			dlg.SelectedPath = initialDir;
			dlg.Description = "Choose target directory";
			if (dlg.ShowDialog() != DialogResult.OK)
				return;
			ScriptOptions.SetValue(RegionRenderStrings.ScriptName, RegionRenderStrings.LastTargetDir, dlg.SelectedPath);
			tbTargetDir.Text = dlg.SelectedPath;
		}
Beispiel #4
0
        private void SelectionFindAgain()
        {
            string searchString = ScriptOptions.GetValue(SelectionStrings.FindRegionKeyName, SelectionStrings.FindRegionLastString, "");

            if (!string.IsNullOrEmpty(searchString))
            {
                Region selectedRegion = myVegas.GetSelectedRegion();
                var    bestRegion     = myVegas.Project.FindRegion(searchString, (selectedRegion != null) ? selectedRegion.Position : Timecode.FromSeconds(0));

                if (bestRegion == null)
                {
                    return;
                }

                myVegas.Transport.SelectionStart  = bestRegion.Position;
                myVegas.Transport.SelectionLength = bestRegion.Length;
            }
        }
Beispiel #5
0
 private void Init()
 {
     renderItemViewBindingSource.DataSource = _renderViews;
     _renderSet.ReportProgressInvoke        = SetProgress;
     _renderSet.SetProgressBoundsInvoke     = SetProgressBounds;
     _renderSet.SetProgressStatusInvoke     = SetStatus;
     _renderSet.ErrorLogInvoke = ErrorLogInvoke;
     if (myVegas.GetSelectedRegions() == null || myVegas.GetSelectedRegions().Count == 0)
     {
         cbSelection.Enabled = false;
     }
     else
     {
         cbSelection.Checked     = ScriptOptions.GetValue(RegionRenderStrings.ScriptName, RegionRenderStrings.SelectionOnlyOptionName, false);
         _renderSet.UseSelection = cbSelection.Checked;
     }
     PopulateRenderItems();
 }
Beispiel #6
0
		private void InitCustomTags()
		{
			FavoritesConfFile = ScriptOptions.GetValue(RegionRenderStrings.ScriptName, RegionRenderStrings.CustomTagConfigFile, RegionRenderStrings.CustomTagConfigFileDefault);
			var dirs = new RenderRootDirSet(FavoritesConfFile);
		}