Exemplo n.º 1
0
 public void RemoveTrack()
 {
     if (trackType == AudioType.Music)
     {
         if (target.MusicTrack != null)
         {
             //todo localize
             Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(524, "Remove Music"), target.Owner));
             target.MusicTrack.CleanUp();
             target.MusicTrack = null;
             UpdateTrackStatus();
             return;
         }
     }
     else
     {
         if (target.VoiceTrack != null)
         {
             Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(525, "Remove Voiceover"), target.Owner)); UpdateTrackStatus();
             target.VoiceTrack.CleanUp();
             target.VoiceTrack = null;
             //todo localize
             return;
         }
     }
     return;
 }
Exemplo n.º 2
0
        private void CurrentValue_Validating(object sender, CancelEventArgs e)
        {
            if (initializing || CurrentValue.Text == Language.GetLocalizedText(1351, "Multiple") || dirtyEdit == false)
            {
                return;
            }
            bool failed = false;

            double newValue = UiTools.ParseAndValidateDouble(CurrentValue, propValue, ref failed);

            if (newValue != propValue && !failed)
            {
                if (keys != null)
                {
                    Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(1352, "Key Properties Edit"), Earth3d.MainWindow.TourEdit.Tour));
                    foreach (VisibleKey vk in keys.Values)
                    {
                        Key key = vk.Target.GetKey(vk.ParameterIndex, vk.Time);
                        if (key != null)
                        {
                            key.Value = newValue;
                        }
                    }
                }
                TimeLine.RefreshUi(false);
                RefreshTween();
            }
        }
Exemplo n.º 3
0
        private void keyType_SelectionChanged(object sender, EventArgs e)
        {
            if (initializing)
            {
                return;
            }
            Key.KeyType type = (Key.KeyType)Enum.Parse(typeof(Key.KeyType), keyType.SelectedItem.ToString());

            curveEditor1.CurveType = type;

            if (keys != null)
            {
                Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(1352, "Key Properties Edit"), Earth3d.MainWindow.TourEdit.Tour));
                foreach (VisibleKey vk in keys.Values)
                {
                    Key key = vk.Target.GetKey(vk.ParameterIndex, vk.Time);
                    if (key != null)
                    {
                        key.InFunction = type;
                        key.P1         = curveEditor1.P1;
                        key.P2         = curveEditor1.P2;
                        key.P3         = curveEditor1.P3;
                        key.P4         = curveEditor1.P4;
                    }
                }
                TimeLine.RefreshUi(false);
                RefreshTween();
            }
        }
Exemplo n.º 4
0
        private void Browse_Click(object sender, EventArgs e)
        {
            if (target != null)
            {
                if (trackType == AudioType.Music)
                {
                    if (target.MusicTrack != null)
                    {
                        //todo localize
                        Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(524, "Edit Music"), target.Owner));
                        ShowAudioProperties();
                        return;
                    }
                }
                else
                {
                    if (target.VoiceTrack != null)
                    {
                        Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(525, "Edit Voiceover"), target.Owner)); UpdateTrackStatus();
                        ShowAudioProperties();
                        return;
                    }
                }

                OpenFileDialog fileDialog = new OpenFileDialog();
                fileDialog.Filter = Language.GetLocalizedText(526, "Sound/Music(*.MP3;*.WMA)|*.MP3;*.WMA");

                if (fileDialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        string       filename = fileDialog.FileName;
                        AudioOverlay audio    = new AudioOverlay(target, filename);
                        audio.Name = filename.Substring(filename.LastIndexOf("\\") + 1);
                        if (trackType == AudioType.Music)
                        {
                            //todo localize
                            Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(527, "Add Music"), target.Owner));
                            target.MusicTrack = audio;
                        }
                        else
                        {
                            //todo localize
                            Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(528, "Add Voiceover"), target.Owner));
                            target.VoiceTrack = audio;
                        }
                        UpdateTrackStatus();
                        ShowAudioProperties();
                    }
                    catch
                    {
                        MessageBox.Show(Language.GetLocalizedText(131, "Could not load audio file. Check to make sure it is valid, a supported type and of a reasonable size."));
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void Volume_ValueChanged(object sender, EventArgs e)
        {
            ScrollEventArgs eventArgs = (ScrollEventArgs)e;

            if (eventArgs.Type == ScrollEventType.EndScroll)
            {
                //todo localize
                Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(529, "Change Volume"), target.Owner));

                if (Track != null)
                {
                    Track.Volume = Volume.Value;
                }
            }
        }
Exemplo n.º 6
0
 private void DurrationEditor_FormClosed(object sender, FormClosedEventArgs e)
 {
     try
     {
         if (target.Duration != TimeText)
         {
             if (target.KeyFramed)
             {
                 if (TimeText.TotalSeconds < target.Duration.TotalSeconds)
                 {
                     if (UiTools.ShowMessageBox(Language.GetLocalizedText(1361, "Do you want to trim the timeline and delete keys past the new duration (Yes) or scale keys to the new duration (No)?"), Language.GetLocalizedText(1362, "Trim or scale timeline"), MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                     {
                         Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(1365, "Trim Timeline"), target.Owner));
                         target.ExtendTimeline(target.Duration, TimeText);
                     }
                     else
                     {
                         Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(1366, "Scale Timeline"), target.Owner));
                         target.Duration = TimeText;
                     }
                 }
                 else
                 {
                     if (UiTools.ShowMessageBox(Language.GetLocalizedText(1364, "Do you want to extend the timeline (Yes) or scale it (No)?"), Language.GetLocalizedText(1363, "Extend or scale timeline"), MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                     {
                         Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(1367, "Extend Timeline"), target.Owner));
                         target.ExtendTimeline(target.Duration, TimeText);
                     }
                     else
                     {
                         Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(1366, "Scale Timeline"), target.Owner));
                         target.Duration = TimeText;
                     }
                 }
             }
             else
             {
                 Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(1368, "Edit Duration"), target.Owner));
                 target.Duration = TimeText;
             }
         }
         Earth3d.NoStealFocus = false;
     }
     catch
     {
     }
 }
Exemplo n.º 7
0
        private void OK_Click(object sender, EventArgs e)
        {
            //todo localize
            Undo.Push(new UndoTourPropertiesChange(Language.GetLocalizedText(549, "Properties Edit"), editTour));

            editTour.Author          = this.authorNameTextbox.Text;
            editTour.AuthorEmail     = this.authorEmailText.Text;
            editTour.Description     = this.tourDescriptionTextbox.Text;
            editTour.AuthorImage     = (Bitmap)this.authorImagePicturebox.Image;
            editTour.OrganizationUrl = this.orgUrl.Text;
            editTour.OrgName         = this.OrganizationName.Text;
            editTour.Title           = this.tourTitleTextbox.Text;
            editTour.Taxonomy        = ClassificationText.Text;
            editTour.Keywords        = keywords.Text;
            editTour.Level           = GetLevel();
            DialogResult             = DialogResult.OK;
            this.Close();
        }
Exemplo n.º 8
0
        private void Time_Validating(object sender, CancelEventArgs e)
        {
            if (initializing || Time.Text == Language.GetLocalizedText(1351, "Multiple") || dirtyEdit == false)
            {
                return;
            }


            double newValue = ParseTime(Time.Text);

            if (newValue == -1)
            {
                Time.BackColor = Color.Red;
            }
            else
            {
                Time.BackColor = UiTools.TextBackground;
            }

            if (newValue != propTime)
            {
                if (keys != null)
                {
                    Undo.Push(new UndoTourStopChange(Language.GetLocalizedText(1352, "Key Properties Edit"), Earth3d.MainWindow.TourEdit.Tour));
                    foreach (VisibleKey vk in keys.Values)
                    {
                        Key key = vk.Target.GetKey(vk.ParameterIndex, vk.Time);
                        if (key != null)
                        {
                            vk.Target.MoveKey(vk.ParameterIndex, vk.Time, newValue);
                        }
                    }
                }
                TimeLine.RefreshUi(false);
                RefreshTween();
            }
        }
Exemplo n.º 9
0
        private void TourStopList_MouseUp(object sender, MouseEventArgs e)
        {
            dragging  = false;
            mouseDown = false;
            scrolling = false;
            if (dragThumbnail != null)
            {
                if (dragItem > -1 && dragItem != dragDropItemLocation)
                {
                    if (dragDropItemLocation != -1)
                    {
                        if (dragDropItemLocation == -2)
                        {
                            dragDropItemLocation = Items.Count;
                        }

                        List <TourStop> dragItems = new List <TourStop>();
                        foreach (int itemId in SelectedItems.Keys)
                        {
                            dragItems.Add(Items[itemId]);
                        }

                        //TourStop ts = Items[dragItem];
                        if (Control.ModifierKeys != Keys.Control)
                        {
                            Undo.Push(new UndoTourSlidelistChange(Language.GetLocalizedText(550, "Move Slide"), Tour));

                            foreach (TourStop ts in dragItems)
                            {
                                Items.Remove(ts);
                            }

                            int itemCount = 0;
                            foreach (int selIndex in SelectedItems.Keys)
                            {
                                if (dragDropItemLocation > dragItem)
                                {
                                    itemCount++;
                                }
                            }

                            dragDropItemLocation -= itemCount;
                            SelectedItems.Clear();

                            foreach (TourStop ts in dragItems)
                            {
                                Items.Insert(dragDropItemLocation, ts);
                                SelectedItems.Add(dragDropItemLocation, Items[dragDropItemLocation]);
                                dragDropItemLocation++;
                            }
                        }
                        else
                        {
                            Undo.Push(new UndoTourSlidelistChange(Language.GetLocalizedText(539, "Drag Copy"), Tour));
                            SelectedItems.Clear();
                            foreach (TourStop ts in dragItems)
                            {
                                Items.Insert(dragDropItemLocation, ts.Copy());
                                SelectedItems.Add(dragDropItemLocation, Items[dragDropItemLocation]);
                                dragDropItemLocation++;
                            }
                        }

                        Tour.CurrentTourstopIndex = selectedItem = dragDropItemLocation;

                        Refresh();
                    }
                }
                dragThumbnail.Close();
                dragThumbnail.Dispose();
                dragThumbnail = null;
            }
            dragDropItemLocation = -1;
            dragItem             = -1;
        }