public OffsetSequenceEditor(SaveableClipboard clipboard, MyGUIViewHost viewHost, OffsetSequenceEditorView view, MedicalController medicalController)
            : base("Medical.GUI.OffsetSequence.OffsetSequenceEditor.layout", viewHost)
        {
            this.clipboard         = clipboard;
            this.medicalController = medicalController;
            this.simObjectMover    = view.SimObjectMover;

            widget.KeyButtonReleased  += new MyGUIEvent(window_KeyButtonReleased);
            widget.RootKeyChangeFocus += new MyGUIEvent(widget_RootKeyChangeFocus);

            //Remove button
            Button removeButton = widget.findWidget("RemoveAction") as Button;

            removeButton.MouseButtonClick += new MyGUIEvent(removeButton_MouseButtonClick);

            //Timeline view
            ScrollView timelineViewScrollView = widget.findWidget("ActionView") as ScrollView;

            timelineView                    = new TimelineView(timelineViewScrollView);
            timelineView.Duration           = Duration;
            timelineView.KeyReleased       += new EventHandler <KeyEventArgs>(timelineView_KeyReleased);
            timelineView.ActiveDataChanged += timelineView_ActiveDataChanged;

            //Properties
            ScrollView timelinePropertiesScrollView = widget.findWidget("ActionPropertiesScrollView") as ScrollView;

            actionProperties         = new TimelineDataProperties(timelinePropertiesScrollView, timelineView);
            actionProperties.Visible = false;
            actionProperties.addPanel("Offset Position", new OffsetKeyframeProperties(timelinePropertiesScrollView, this, view.UICallback));

            //Timeline filter
            ScrollView timelineFilterScrollView = widget.findWidget("ActionFilter") as ScrollView;

            trackFilter = new TrackFilter(timelineFilterScrollView, timelineView);
            trackFilter.AddTrackItem += new AddTrackItemCallback(trackFilter_AddTrackItem);

            numberLine = new NumberLine(widget.findWidget("NumberLine") as ScrollView, timelineView);

            //Add tracks to timeline.
            timelineView.addTrack("Offset Position");

            ViewHost.Context.getModel <EditMenuManager>(EditMenuManager.DefaultName).setMenuProvider(this);

            Button chooseTargetButton = (Button)widget.findWidget("ChooseTargetButton");

            chooseTargetButton.MouseButtonClick += chooseTargetButton_MouseButtonClick;

            targetLabel         = (TextBox)widget.findWidget("TargetLabel");
            targetLabel.Caption = DefaultTargetLabelText;

            CurrentSequence = view.Sequence;
        }
Exemple #2
0
        public MovementSequenceEditor(MovementSequenceController movementSequenceController, SaveableClipboard clipboard, MyGUIViewHost viewHost, MovementSequenceEditorView view)
            : base("Medical.GUI.Editor.MovementSequence.MovementSequenceEditor.layout", viewHost)
        {
            this.clipboard = clipboard;

            widget.KeyButtonReleased  += new MyGUIEvent(window_KeyButtonReleased);
            widget.RootKeyChangeFocus += new MyGUIEvent(widget_RootKeyChangeFocus);

            this.movementSequenceController             = movementSequenceController;
            movementSequenceController.PlaybackStarted += movementSequenceController_PlaybackStarted;
            movementSequenceController.PlaybackStopped += movementSequenceController_PlaybackStopped;
            movementSequenceController.PlaybackUpdate  += movementSequenceController_PlaybackUpdate;

            //Remove button
            Button removeButton = widget.findWidget("RemoveAction") as Button;

            removeButton.MouseButtonClick += new MyGUIEvent(removeButton_MouseButtonClick);

            //Duration Edit
            durationEdit               = new NumericEdit(widget.findWidget("SequenceDuration") as EditBox);
            durationEdit.AllowFloat    = true;
            durationEdit.ValueChanged += new MyGUIEvent(durationEdit_ValueChanged);
            durationEdit.MinValue      = 0.0f;
            durationEdit.MaxValue      = 600;

            //Play Button
            playButton = widget.findWidget("PlayButton") as Button;
            playButton.MouseButtonClick += new MyGUIEvent(playButton_MouseButtonClick);

            //Timeline view
            ScrollView timelineViewScrollView = widget.findWidget("ActionView") as ScrollView;

            timelineView = new TimelineView(timelineViewScrollView);
            timelineView.DurationChanged += new EventHandler(timelineView_DurationChanged);
            timelineView.Duration         = 5.0f;
            timelineView.KeyReleased     += new EventHandler <KeyEventArgs>(timelineView_KeyReleased);

            //Properties
            ScrollView timelinePropertiesScrollView = widget.findWidget("ActionPropertiesScrollView") as ScrollView;

            actionProperties         = new TimelineDataProperties(timelinePropertiesScrollView, timelineView);
            actionProperties.Visible = false;
            actionProperties.addPanel("Muscle Position", new MovementKeyframeProperties(timelinePropertiesScrollView));

            //Timeline filter
            ScrollView timelineFilterScrollView = widget.findWidget("ActionFilter") as ScrollView;

            trackFilter = new TrackFilter(timelineFilterScrollView, timelineView);
            trackFilter.AddTrackItem += new AddTrackItemCallback(trackFilter_AddTrackItem);

            numberLine = new NumberLine(widget.findWidget("NumberLine") as ScrollView, timelineView);

            //Add tracks to timeline.
            timelineView.addTrack("Muscle Position");

            CurrentSequence = view.Sequence;
            if (view.ListenForSequenceChanges)
            {
                movementSequenceController.CurrentSequenceChanged += movementSequenceController_CurrentSequenceChanged;
                if (CurrentSequence == null)
                {
                    CurrentSequence = movementSequenceController.CurrentSequence;
                }
            }

            ViewHost.Context.getModel <EditMenuManager>(EditMenuManager.DefaultName).setMenuProvider(this);
        }