Пример #1
0
        private void ColorPalette_Load(object sender, EventArgs e)
        {
            colorFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vixen", "ColorPalette.xml");

            if (File.Exists(colorFilePath))
            {
                Load_ColorPaletteFile();
                PopulateColors();
            }

            _curveLibrary = ApplicationServices.Get <IAppModuleInstance>(CurveLibraryDescriptor.ModuleID) as CurveLibrary;
            if (_curveLibrary != null)
            {
                Populate_Curves();
                _curveLibrary.CurveChanged += CurveLibrary_CurveChanged;
            }

            _colorGradientLibrary = ApplicationServices.Get <IAppModuleInstance>(ColorGradientLibraryDescriptor.ModuleID) as ColorGradientLibrary;
            if (_colorGradientLibrary != null)
            {
                Populate_Gradients();
                _colorGradientLibrary.GradientChanged += GradientLibrary_GradientChanged;
            }

            comboBoxGradientHandling.SelectedIndex = 0;
        }
Пример #2
0
        private void ColorPalette_Load(object sender, EventArgs e)
        {
            _colorFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vixen", "ColorPalette.xml");

            if (File.Exists(_colorFilePath))
            {
                Load_ColorPaletteFile();
                PopulateColors();
            }
            else
            {
                //VIX-2163
                listViewColors.LargeImageList = new ImageList {
                    ColorDepth = ColorDepth.Depth32Bit, ImageSize = _imageSize
                };
            }

            _curveLibrary = ApplicationServices.Get <IAppModuleInstance>(CurveLibraryDescriptor.ModuleID) as CurveLibrary;
            if (_curveLibrary != null)
            {
                Populate_Curves();
                _curveLibrary.CurveChanged += CurveLibrary_CurveChanged;
            }

            _colorGradientLibrary = ApplicationServices.Get <IAppModuleInstance>(ColorGradientLibraryDescriptor.ModuleID) as ColorGradientLibrary;
            if (_colorGradientLibrary != null)
            {
                Populate_Gradients();
                _colorGradientLibrary.GradientChanged += GradientLibrary_GradientChanged;
            }
        }
Пример #3
0
 private void ColorPalette_Load(object sender, EventArgs e)
 {
     _curveLibrary = ApplicationServices.Get <IAppModuleInstance>(CurveLibraryDescriptor.ModuleID) as CurveLibrary;
     if (_curveLibrary != null)
     {
         Populate_Curves();
         _curveLibrary.CurveChanged += CurveLibrary_CurveChanged;
     }
 }
Пример #4
0
 private static void ExportRecordsToFile(IEnumerable<CurveLibraryRecord> records, string filePath)
 {
     if (File.Exists(filePath)) {
         File.Delete(filePath);
     }
     using (var library = new CurveLibrary(filePath)) {
         foreach (var record in records) {
             library.Import(record);
         }
         library.Save();
     }
 }
Пример #5
0
 private static void ExportRecordsToFile(IEnumerable <CurveLibraryRecord> records, string filePath)
 {
     if (File.Exists(filePath))
     {
         File.Delete(filePath);
     }
     using (var library = new CurveLibrary(filePath)) {
         foreach (var record in records)
         {
             library.Import(record);
         }
         library.Save();
     }
 }
Пример #6
0
        public Form_CurveLibrary(TimelineControl timelineControl)
        {
            InitializeComponent();
            TimelineControl = timelineControl;
            Icon            = Resources.Icon_Vixen3;
            ThemeUpdateControls.UpdateControls(this);
            toolStripCurves.Renderer = new ThemeToolStripRenderer();
            int iconSize = (int)(16 * ScalingTools.GetScaleFactor());

            toolStripCurves.ImageScalingSize = new Size(iconSize, iconSize);

            toolStripButtonEditCurve.DisplayStyle    = ToolStripItemDisplayStyle.Image;
            toolStripButtonEditCurve.Image           = Tools.GetIcon(Resources.configuration, iconSize);
            toolStripButtonNewCurve.DisplayStyle     = ToolStripItemDisplayStyle.Image;
            toolStripButtonNewCurve.Image            = Tools.GetIcon(Resources.addItem, iconSize);
            toolStripButtonDeleteCurve.DisplayStyle  = ToolStripItemDisplayStyle.Image;
            toolStripButtonDeleteCurve.Image         = Tools.GetIcon(Resources.delete_32, iconSize);
            toolStripButtonExportCurves.DisplayStyle = ToolStripItemDisplayStyle.Image;
            toolStripButtonExportCurves.Image        = Tools.GetIcon(Resources.folder_go, iconSize);
            toolStripButtonImportCurves.DisplayStyle = ToolStripItemDisplayStyle.Image;
            toolStripButtonImportCurves.Image        = Tools.GetIcon(Resources.folder_open, iconSize);

            listViewCurves.AllowDrop = true;

            var xml = new XMLProfileSettings();

            _curveLibraryImageScale = Convert.ToDouble(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/CurveLibraryImageScale", Name), "1"), CultureInfo.InvariantCulture);
            _curveLibraryTextScale  = Convert.ToDouble(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/CurveLibraryTextScale", Name), "1"), CultureInfo.InvariantCulture);

            if (_curveLibraryImageScale < 0.1)
            {
                _curveLibraryImageScale = 0.1;
            }
            if (_curveLibraryTextScale < 0.2)
            {
                _curveLibraryTextScale = 0.2;
            }
            ImageSetup();

            ForeColor = ThemeColorTable.ForeColor;
            BackColor = ThemeColorTable.BackgroundColor;
            ThemeUpdateControls.UpdateControls(this);
            //Over-ride the auto theme listview back color
            listViewCurves.BackColor = ThemeColorTable.BackgroundColor;

            listViewCurves.Alignment = ListViewAlignment.Top;
            _curveLibrary            = ApplicationServices.Get <IAppModuleInstance>(CurveLibraryDescriptor.ModuleID) as CurveLibrary;
        }
 public CurveLibraryRecordEditDialog(CurveLibraryRecord clr)
 {
     InitializeComponent();
     Icon = common.Resources.VixenPlus;
     LibraryRecord = clr;
     _curveLibrary = new CurveLibrary();
     textBoxManufacturer.AutoCompleteCustomSource.AddRange(_curveLibrary.GetAllManufacturers());
     textBoxController.AutoCompleteCustomSource.AddRange(_curveLibrary.GetAllControllers());
     if (LibraryRecord == null) {
         return;
     }
     textBoxManufacturer.Text = LibraryRecord.Manufacturer;
     textBoxLightCount.Text = LibraryRecord.LightCount;
     buttonColor.BackColor = Color.FromArgb(LibraryRecord.Color);
     textBoxController.Text = LibraryRecord.Controller;
 }
 public CurveLibraryRecordEditDialog(CurveLibraryRecord clr)
 {
     InitializeComponent();
     Icon          = common.Resources.VixenPlus;
     LibraryRecord = clr;
     _curveLibrary = new CurveLibrary();
     textBoxManufacturer.AutoCompleteCustomSource.AddRange(_curveLibrary.GetAllManufacturers());
     textBoxController.AutoCompleteCustomSource.AddRange(_curveLibrary.GetAllControllers());
     if (LibraryRecord == null)
     {
         return;
     }
     textBoxManufacturer.Text = LibraryRecord.Manufacturer;
     textBoxLightCount.Text   = LibraryRecord.LightCount;
     buttonColor.BackColor    = Color.FromArgb(LibraryRecord.Color);
     textBoxController.Text   = LibraryRecord.Controller;
 }
Пример #9
0
 public CurveLibraryDialog()
 {
     InitializeComponent();
     Icon = Resources.VixenPlus;
     listViewRecords.Columns[0].Name = CurveLibrary.ManufacturerCol;
     listViewRecords.Columns[1].Name = CurveLibrary.LightCountCol;
     listViewRecords.Columns[2].Name = CurveLibrary.ColorCol;
     listViewRecords.Columns[3].Name = CurveLibrary.ControllerCol;
     _curveLibrary = new CurveLibrary();
     _isInternal = true;
     comboBoxManufacturer.SelectedIndex = 0;
     comboBoxCount.SelectedIndex = 0;
     comboBoxColor.SelectedIndex = 0;
     comboBoxController.SelectedIndex = 0;
     _isInternal = false;
     comboBoxSource.SelectedIndex = 0;
     listViewRecords.ListViewItemSorter = new ListViewItemSorter();
     ListViewSortIcons.SetSortIcon(listViewRecords, 0, SortOrder.Ascending);
 }
Пример #10
0
 public CurveLibraryDialog()
 {
     InitializeComponent();
     Icon = Resources.VixenPlus;
     listViewRecords.Columns[0].Name = CurveLibrary.ManufacturerCol;
     listViewRecords.Columns[1].Name = CurveLibrary.LightCountCol;
     listViewRecords.Columns[2].Name = CurveLibrary.ColorCol;
     listViewRecords.Columns[3].Name = CurveLibrary.ControllerCol;
     _curveLibrary = new CurveLibrary();
     _isInternal   = true;
     comboBoxManufacturer.SelectedIndex = 0;
     comboBoxCount.SelectedIndex        = 0;
     comboBoxColor.SelectedIndex        = 0;
     comboBoxController.SelectedIndex   = 0;
     _isInternal = false;
     comboBoxSource.SelectedIndex       = 0;
     listViewRecords.ListViewItemSorter = new ListViewItemSorter();
     ListViewSortIcons.SetSortIcon(listViewRecords, 0, SortOrder.Ascending);
 }
Пример #11
0
        private void LoadRecords(string fileName, ListView listView)
        {
            CurveLibrary library = null;

            Cursor = Cursors.WaitCursor;
            listView.BeginUpdate();
            listView.Items.Clear();
            try {
                Exception exception;
                library = fileName == null ? new CurveLibrary() : new CurveLibrary(fileName);
                try {
                    library.Load(false);
                }
                catch (Exception exception1) {
                    exception = exception1;
                    throw new Exception(Resources.ErrorLoadingCurveFile + exception.Message);
                }
                var num = 1;
                try {
                    foreach (var record in library.Read())
                    {
                        listView.Items.Add(
                            new ListViewItem(new[]
                                             { record.Manufacturer, record.LightCount, record.Color.ToString(CultureInfo.InvariantCulture), record.Controller })).Tag =
                            record;
                        num++;
                    }
                }
                catch (Exception exception2) {
                    exception = exception2;
                    throw new Exception(string.Format(Resources.ErrorInCurveFile, num, exception.Message));
                }
            }
            finally {
                listView.EndUpdate();
                Cursor = Cursors.Default;
                if (library != null)
                {
                    library.Dispose();
                }
            }
        }
Пример #12
0
 private void buttonExportToLibrary_Click(object sender, EventArgs e)
 {
     if (comboBoxExport.SelectedIndex == 0)
     {
         using (var library = new CurveLibrary()) {
             var dialog = new CurveLibraryRecordEditDialog(null);
             if (dialog.ShowDialog() == DialogResult.OK)
             {
                 var libraryRecord = dialog.LibraryRecord;
                 libraryRecord.CurveData = _points;
                 library.Import(libraryRecord);
                 library.Save();
             }
             dialog.Dispose();
         }
     }
     else
     {
         var dialog2 = new CurveFileImportExportDialog(CurveFileImportExportDialog.ImportExport.Export);
         dialog2.ShowDialog();
         dialog2.Dispose();
     }
 }
Пример #13
0
		private void ColorPalette_Load(object sender, EventArgs e)
		{
			_colorFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vixen", "ColorPalette.xml");

			if (File.Exists(_colorFilePath))
			{
				Load_ColorPaletteFile();
				PopulateColors();
			}

			_curveLibrary = ApplicationServices.Get<IAppModuleInstance>(CurveLibraryDescriptor.ModuleID) as CurveLibrary;
			if (_curveLibrary != null)
			{
				Populate_Curves();
				_curveLibrary.CurveChanged += CurveLibrary_CurveChanged;
			}

			_colorGradientLibrary = ApplicationServices.Get<IAppModuleInstance>(ColorGradientLibraryDescriptor.ModuleID) as ColorGradientLibrary;
			if (_colorGradientLibrary != null)
			{
				Populate_Gradients();
				_colorGradientLibrary.GradientChanged += GradientLibrary_GradientChanged;
			}
			
		}
Пример #14
0
        private void TimedSequenceEditorForm_Load(object sender, EventArgs e)
        {
            settingsPath =
                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vixen",
                               "TimedSequenceEditorForm.xml");
            ColorCollectionsPath =
                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vixen",
                               "ColorCollections.xml");

            if (File.Exists(settingsPath))
            {
                dockPanel.LoadFromXml(settingsPath, new DeserializeDockContent(DockingPanels_GetContentFromPersistString));
            }
            else
            {
                GridForm.Show(dockPanel);
                ToolsForm.Show(dockPanel, DockState.DockLeft);
                MarksForm.Show(dockPanel, DockState.DockLeft);
                EffectsForm.Show(dockPanel, DockState.DockLeft);
            }

            XMLProfileSettings xml = new XMLProfileSettings();

            //Get preferences
            _autoSaveTimer.Interval = xml.GetSetting(XMLProfileSettings.SettingType.Preferences, string.Format("{0}/AutoSaveInterval", Name), 300000);

            //Restore App Settings
            dockPanel.DockLeftPortion = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockLeftPortion", Name), 150);
            dockPanel.DockRightPortion = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockRightPortion", Name), 150);
            autoSaveToolStripMenuItem.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/AutoSaveEnabled", Name), true);
            toolStripButton_SnapTo.Checked = toolStripMenuItem_SnapTo.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SnapToSelected", Name), true);
            PopulateSnapStrength(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings,	string.Format("{0}/SnapStrength", Name), 2));
            toolStripMenuItem_ResizeIndicator.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorEnabled", Name),false);
            toolStripButton_DrawMode.Checked = TimelineControl.grid.EnableDrawMode = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DrawModeSelected", Name), false);
            toolStripButton_SelectionMode.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SelectionModeSelected", Name), true);
            ToolsForm.LinkCurves = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkCurves", Name), false);
            ToolsForm.LinkGradients = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkGradients", Name), false);
            cADStyleSelectionBoxToolStripMenuItem.Checked = TimelineControl.grid.aCadStyleSelectionBox = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/CadStyleSelectionBox", Name), false);
            CheckRiColorMenuItem(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorColor", Name), "Red"));

            foreach (ToolStripItem toolStripItem in toolStripDropDownButton_SnapToStrength.DropDownItems)
            {
                var toolStripMenuItem = toolStripItem as ToolStripMenuItem;
                if (toolStripMenuItem != null)
                {
                    if(TimelineControl.grid.SnapStrength.Equals(Convert.ToInt32(toolStripMenuItem.Tag)))
                    {
                        toolStripMenuItem.PerformClick();
                        break;
                    }
                }
            }

            WindowState = FormWindowState.Normal;

            if (xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowState", Name),
                "Normal").Equals("Maximized"))
            {
                WindowState = FormWindowState.Maximized;
            }
            else
            {
                var desktopBounds = new Rectangle(new Point(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationX", Name), Location.X),
                                xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationY", Name), Location.Y)),new Size(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowWidth", Name), Size.Width),
                            xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowHeight", Name), Size.Height)));
                if (IsVisibleOnAnyScreen(desktopBounds))
                {
                    DesktopBounds = desktopBounds;
                }
            }

            _effectNodeToElement = new Dictionary<EffectNode, Element>();
            _elementNodeToRows = new Dictionary<ElementNode, List<Row>>();

            TimelineControl.grid.RenderProgressChanged += OnRenderProgressChanged;

            TimelineControl.ElementChangedRows += ElementChangedRowsHandler;
            TimelineControl.ElementsMovedNew += timelineControl_ElementsMovedNew;
            TimelineControl.ElementDoubleClicked += ElementDoubleClickedHandler;
            TimelineControl.DataDropped += timelineControl_DataDropped;
            TimelineControl.ColorDropped += timelineControl_ColorDropped;
            TimelineControl.CurveDropped += timelineControl_CurveDropped;
            TimelineControl.GradientDropped += timelineControl_GradientDropped;

            TimelineControl.PlaybackCurrentTimeChanged += timelineControl_PlaybackCurrentTimeChanged;

            TimelineControl.RulerClicked += timelineControl_RulerClicked;
            TimelineControl.RulerBeginDragTimeRange += timelineControl_RulerBeginDragTimeRange;
            TimelineControl.RulerTimeRangeDragged += timelineControl_TimeRangeDragged;

            TimelineControl.MarkMoved += timelineControl_MarkMoved;
            TimelineControl.DeleteMark += timelineControl_DeleteMark;

            EffectsForm.EscapeDrawMode += EscapeDrawMode;

            MarksForm.MarkCollectionChecked += MarkCollection_Checked;
            MarksForm.EditMarkCollection += MarkCollection_Edit;
            MarksForm.ChangedMarkCollection += MarkCollection_Changed;

            ToolsForm.StartColorDrag += ToolPalette_ColorDrag;
            ToolsForm.StartCurveDrag += ToolPalette_CurveDrag;
            ToolsForm.StartGradientDrag += ToolPalette_GradientDrag;

            TimelineControl.SelectionChanged += TimelineControlOnSelectionChanged;
            TimelineControl.grid.MouseDown += TimelineControl_MouseDown;
            TimeLineSequenceClipboardContentsChanged += TimelineSequenceTimeLineSequenceClipboardContentsChanged;
            TimelineControl.CursorMoved += CursorMovedHandler;
            TimelineControl.ElementsSelected += timelineControl_ElementsSelected;
            TimelineControl.ContextSelected += timelineControl_ContextSelected;
            TimelineControl.SequenceLoading = false;
            TimelineControl.TimePerPixelChanged += TimelineControl_TimePerPixelChanged;
            TimelineControl.grid.SelectedElementsCloneDelegate = CloneElements;
            TimelineControl.grid.StartDrawMode += DrawElement;

            _virtualEffectLibrary =
                ApplicationServices.Get<IAppModuleInstance>(VirtualEffectLibraryDescriptor.Guid) as
                VirtualEffectLibrary;

            _curveLibrary = ApplicationServices.Get<IAppModuleInstance>(CurveLibraryDescriptor.ModuleID) as CurveLibrary;
            if (_curveLibrary != null)
            {
                _curveLibrary.CurveChanged += CurveLibrary_CurveChanged;
            }

            _colorGradientLibrary = ApplicationServices.Get<IAppModuleInstance>(ColorGradientLibraryDescriptor.ModuleID) as ColorGradientLibrary;
            if (_colorGradientLibrary != null)
            {
                _colorGradientLibrary.GradientChanged += ColorGradientLibrary_CurveChanged;
            }

            LoadAvailableEffects();
            PopulateDragBoxFilterDropDown();
            InitUndo();
            updateButtonStates();
            UpdatePasteMenuStates();
            LoadVirtualEffects();
            LoadColorCollections();

            _library = ApplicationServices.Get<IAppModuleInstance>(LipSyncMapDescriptor.ModuleID) as LipSyncMapLibrary;

            #if DEBUG
            ToolStripButton b = new ToolStripButton("[Debug Break]");
            b.Click += b_Click;
            toolStripOperations.Items.Add(b);
            #endif
        }
Пример #15
0
        private void TimedSequenceEditorForm_Load(object sender, EventArgs e)
        {
            _settingsPath =
                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vixen",
                    "TimedSequenceEditorForm.xml");
            _colorCollectionsPath =
                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Vixen",
                    "ColorCollections.xml");

            if (File.Exists(_settingsPath))
            {
                try
                {
                    //Try to load the dock settings fro ma file. Somehow users manage to corrupt this file, so if it can be used
                    //Then just reconfigure to the defaults.
                    dockPanel.LoadFromXml(_settingsPath, DockingPanels_GetContentFromPersistString);
                }
                catch (Exception ex)
                {
                    DestroyAndRecreateDockPanel(ex);
                }
            }
            else
            {
                SetDockDefaults();
            }

            if (GridForm.IsHidden)
            {
                GridForm.DockState = DockState.Document;
            }

            if (EffectEditorForm.DockState == DockState.Unknown)
            {
                EffectEditorForm.Show(dockPanel, DockState.DockRight);
            }

            if (LayerEditor.DockState == DockState.Unknown)
            {
                LayerEditor.Show(dockPanel, DockState.DockRight);
            }

            XMLProfileSettings xml = new XMLProfileSettings();

            //Get preferences
            _autoSaveTimer.Interval = xml.GetSetting(XMLProfileSettings.SettingType.Preferences, string.Format("{0}/AutoSaveInterval", Name), 300000);

            //Restore App Settings
            dockPanel.DockLeftPortion = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockLeftPortion", Name), 150);
            dockPanel.DockRightPortion = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DockRightPortion", Name), 150);
            autoSaveToolStripMenuItem.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/AutoSaveEnabled", Name), true);
            toolStripButton_SnapTo.Checked = toolStripMenuItem_SnapTo.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SnapToSelected", Name), true);
            PopulateSnapStrength(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SnapStrength", Name), 2));
            TimelineControl.grid.CloseGap_Threshold = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/CloseGapThreshold", Name), ".100");
            AlignTo_Threshold = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/AlignToThreshold", Name), ".800");
            toolStripMenuItem_ResizeIndicator.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorEnabled", Name), false);
            toolStripButton_DrawMode.Checked = TimelineControl.grid.EnableDrawMode = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/DrawModeSelected", Name), false);
            toolStripButton_SelectionMode.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/SelectionModeSelected", Name), true);
            ToolsForm.LinkCurves = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkCurves", Name), false);
            ToolsForm.LinkGradients = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ToolPaletteLinkGradients", Name), false);
            cADStyleSelectionBoxToolStripMenuItem.Checked = TimelineControl.grid.aCadStyleSelectionBox = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/CadStyleSelectionBox", Name), false);
            CheckRiColorMenuItem(xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ResizeIndicatorColor", Name), "Red"));
            zoomUnderMousePositionToolStripMenuItem.Checked = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/ZoomUnderMousePosition", Name), false);
            TimelineControl.waveform.Height = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WaveFormHeight", Name), 50);
            TimelineControl.ruler.Height = xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/RulerHeight", Name), 50);

            foreach (ToolStripItem toolStripItem in toolStripDropDownButton_SnapToStrength.DropDownItems)
            {
                var toolStripMenuItem = toolStripItem as ToolStripMenuItem;
                if (toolStripMenuItem != null)
                {
                    if (TimelineControl.grid.SnapStrength.Equals(Convert.ToInt32(toolStripMenuItem.Tag)))
                    {
                        toolStripMenuItem.PerformClick();
                        break;
                    }
                }
            }

            foreach (ToolStripItem toolStripItem in toolStripSplitButton_CloseGaps.DropDownItems)
            {
                var toolStripMenuItem = toolStripItem as ToolStripMenuItem;
                if (toolStripMenuItem != null)
                {
                    if (TimelineControl.grid.CloseGap_Threshold.Equals(toolStripMenuItem.Tag))
                    {
                        toolStripMenuItem.PerformClick();
                        break;
                    }
                }
            }

            foreach (ToolStripItem toolStripItem in toolStripDropDownButton_AlignTo.DropDownItems)
            {
                var toolStripMenuItem = toolStripItem as ToolStripMenuItem;
                if (toolStripMenuItem != null)
                {
                    if (AlignTo_Threshold.Equals(toolStripMenuItem.ToString()))
                    {
                        toolStripMenuItem.PerformClick();
                        break;
                    }
                }
            }

            WindowState = FormWindowState.Normal;

            var desktopBounds =
                new Rectangle(
                    new Point(
                        xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationX", Name), Location.X),
                        xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowLocationY", Name), Location.Y)),
                    new Size(
                        xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowWidth", Name), Size.Width),
                        xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowHeight", Name), Size.Height)));

            var windowState =
                    xml.GetSetting(XMLProfileSettings.SettingType.AppSettings, string.Format("{0}/WindowState", Name), "Normal");

            if (IsVisibleOnAnyScreen(desktopBounds))
            {
                StartPosition = FormStartPosition.Manual;
                DesktopBounds = desktopBounds;

                if (windowState.Equals("Maximized"))
                {
                    WindowState = FormWindowState.Maximized;
                }

            }
            else
            {
                // this resets the upper left corner of the window to windows standards
                StartPosition = FormStartPosition.WindowsDefaultLocation;

                if (windowState.Equals("Minimized"))
                {
                    //Somehow we were closed in a minimized state. All bets are off, so put use back in some sensible default.
                    WindowState = FormWindowState.Normal;
                    // this resets the upper left corner of the window to windows standards
                    StartPosition = FormStartPosition.WindowsDefaultLocation;
                    Size = new Size(800, 600);
                }
                else
                {
                    // we can still apply the saved size
                    Size = new Size(desktopBounds.Width, desktopBounds.Height);
                }
            }

            _effectNodeToElement = new Dictionary<EffectNode, Element>();
            _elementNodeToRows = new Dictionary<ElementNode, List<Row>>();

            TimelineControl.grid.RenderProgressChanged += OnRenderProgressChanged;

            TimelineControl.ElementChangedRows += ElementChangedRowsHandler;
            TimelineControl.ElementsMovedNew += timelineControl_ElementsMovedNew;
            TimelineControl.ElementDoubleClicked += ElementDoubleClickedHandler;
            //TimelineControl.DataDropped += timelineControl_DataDropped;

            TimelineControl.PlaybackCurrentTimeChanged += timelineControl_PlaybackCurrentTimeChanged;

            TimelineControl.RulerClicked += timelineControl_RulerClicked;
            TimelineControl.RulerBeginDragTimeRange += timelineControl_RulerBeginDragTimeRange;
            TimelineControl.RulerTimeRangeDragged += timelineControl_TimeRangeDragged;

            TimelineControl.MarkMoved += timelineControl_MarkMoved;
            TimelineControl.DeleteMark += timelineControl_DeleteMark;

            TimelineControl.SelectionChanged += TimelineControlOnSelectionChanged;
            TimelineControl.grid.MouseDown += TimelineControl_MouseDown;
            TimeLineSequenceClipboardContentsChanged += TimelineSequenceTimeLineSequenceClipboardContentsChanged;
            TimelineControl.CursorMoved += CursorMovedHandler;
            TimelineControl.ElementsSelected += timelineControl_ElementsSelected;
            TimelineControl.ContextSelected += timelineControl_ContextSelected;
            TimelineControl.SequenceLoading = false;
            TimelineControl.TimePerPixelChanged += TimelineControl_TimePerPixelChanged;
            TimelineControl.VisibleTimeStartChanged += TimelineControl_VisibleTimeStartChanged;
            TimelineControl.grid.SelectedElementsCloneDelegate = CloneElements;
            TimelineControl.grid.StartDrawMode += DrawElement;
            TimelineControl.grid.DragOver += TimelineControlGrid_DragOver;
            TimelineControl.grid.DragEnter += TimelineControlGrid_DragEnter;
            TimelineControl.grid.DragDrop += TimelineControlGrid_DragDrop;
            Row.RowHeightChanged += TimeLineControl_Row_RowHeightChanged;

            _curveLibrary = ApplicationServices.Get<IAppModuleInstance>(CurveLibraryDescriptor.ModuleID) as CurveLibrary;
            if (_curveLibrary != null)
            {
                _curveLibrary.CurveChanged += CurveLibrary_CurveChanged;
            }

            _colorGradientLibrary =
                ApplicationServices.Get<IAppModuleInstance>(ColorGradientLibraryDescriptor.ModuleID) as ColorGradientLibrary;
            if (_colorGradientLibrary != null)
            {
                _colorGradientLibrary.GradientChanged += ColorGradientLibrary_CurveChanged;
            }

            LoadAvailableEffects();
            PopulateDragBoxFilterDropDown();
            InitUndo();
            UpdateButtonStates();
            UpdatePasteMenuStates();
            LoadColorCollections();

            _library = ApplicationServices.Get<IAppModuleInstance>(LipSyncMapDescriptor.ModuleID) as LipSyncMapLibrary;
            Cursor.Current = Cursors.Default;
            if (_sequence.DefaultSplitterDistance != 0)
            {
                TimelineControl.splitContainer.SplitterDistance = _sequence.DefaultSplitterDistance;
            }
            else
            {
                TimelineControl.splitContainer.SplitterDistance = (int) (TimelineControl.DefaultSplitterDistance*_scaleFactor);
            }

            if (_sequence.DefaultPlaybackEndTime != TimeSpan.Zero)
            {
                _mPrevPlaybackStart = TimelineControl.PlaybackStartTime = _sequence.DefaultPlaybackStartTime;
                _mPrevPlaybackEnd = TimelineControl.PlaybackEndTime = _sequence.DefaultPlaybackEndTime;
            }

            #if DEBUG
            ToolStripButton b = new ToolStripButton("[Debug Break]");
            b.Click += b_Click;
            toolStripOperations.Items.Add(b);
            #endif
        }
Пример #16
0
 private void buttonExportToLibrary_Click(object sender, EventArgs e)
 {
     if (comboBoxExport.SelectedIndex == 0) {
         using (var library = new CurveLibrary()) {
             var dialog = new CurveLibraryRecordEditDialog(null);
             if (dialog.ShowDialog() == DialogResult.OK) {
                 var libraryRecord = dialog.LibraryRecord;
                 libraryRecord.CurveData = _points;
                 library.Import(libraryRecord);
                 library.Save();
             }
             dialog.Dispose();
         }
     }
     else {
         var dialog2 = new CurveFileImportExportDialog(CurveFileImportExportDialog.ImportExport.Export);
         dialog2.ShowDialog();
         dialog2.Dispose();
     }
 }