Esempio n. 1
0
        /// <summary>
        /// Finishes initializing component by setting up scripting service and initializing curve editor settings</summary>
        void IInitializable.Initialize()
        {
            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.ImportAllTypes("DomTreeEditorSample");
                m_scriptingService.ImportAllTypes("Sce.Atf.Controls.Adaptable.Graphs");
                m_scriptingService.SetVariable("editor", this);
                m_scriptingService.SetVariable("treeLister", m_treeLister);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    EditingContext  editingContext = m_contextRegistry.GetActiveContext <EditingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("hist", hist);
                };
            }

            if (m_curveEditor != null)
            {
                m_curveEditor.Control.AutoComputeCurveLimitsEnabled = false;
                m_curveEditor.Control.OnlyEditSelectedCurves        = true;
                m_curveEditor.Control.CurvesChanged += (sender, e) => m_curveEditor.Control.FitAll();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Finishes initializing component by setting up scripting service</summary>
        void IInitializable.Initialize()
        {
            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.ImportAllTypes("StatechartEditorSample");
                m_scriptingService.ExecuteStatement("from Sce.Atf.Controls.Adaptable.Graphs import *");
                m_scriptingService.SetVariable("editor", this);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    EditingContext  editingContext = m_contextRegistry.GetActiveContext <EditingContext>();
                    ViewingContext  viewContext    = m_contextRegistry.GetActiveContext <ViewingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("stateChart", editingContext != null ? editingContext.Statechart : null);
                    m_scriptingService.SetVariable("view", viewContext);
                    m_scriptingService.SetVariable("hist", hist);
                };
            }

            if (m_singleInstanceService != null)
            {
                m_singleInstanceService.CommandLineChanged += m_singleInstanceService_CommandLineChanged;
            }
        }
Esempio n. 3
0
        void IInitializable.Initialize()
        {
            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.ImportAllTypes("CircuitEditorSample");
                m_scriptingService.ImportAllTypes("Sce.Atf.Controls.Adaptable.Graphs");

                m_scriptingService.SetVariable("editor", this);
                m_scriptingService.SetVariable("layerLister", m_layerLister);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    var             editingContext = m_contextRegistry.GetActiveContext <DiagramEditingContext>();
                    var             viewContext    = m_contextRegistry.GetActiveContext <Controls.ViewingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("view", viewContext);
                    m_scriptingService.SetVariable("hist", hist);
                };

                // attach tweakable bridge for accessing console variables
                m_scriptingService.SetVariable("cv", new GUILayer.TweakableBridge());
            }

            if (m_settingsService != null)
            {
                // var settings = new[]
                // {
                //   new BoundPropertyDescriptor(typeof (CircuitDefaultStyle),
                //         () => CircuitDefaultStyle.EdgeStyle,
                //         "Wire Style".Localize(), "Circuit Editor".Localize(),
                //         "Default Edge Style".Localize()),
                // };
                // m_settingsService.RegisterUserSettings("Circuit Editor", settings);
                // m_settingsService.RegisterSettings(this, settings);
            }

            // We need to make sure there is a material set to the active
            // material context... If there is none, we must create a new
            // untitled material, and set that...
            if (_activeMaterialContext.MaterialName == null)
            {
                _activeMaterialContext.MaterialName = GUILayer.RawMaterial.CreateUntitled().Initializer;
            }
        }
Esempio n. 4
0
File: Editor.cs Progetto: zparr/ATF
 /// <summary>
 /// Finishes initializing component by setting up scripting service</summary>
 void IInitializable.Initialize()
 {
     if (m_scriptingService != null)
     {
         // load this assembly into script domain.
         m_scriptingService.LoadAssembly(GetType().Assembly);
         m_scriptingService.ImportAllTypes("SimpleDomEditorSample");
         m_scriptingService.SetVariable("editor", this);
     }
 }
Esempio n. 5
0
File: Editor.cs Progetto: zparr/ATF
        /// <summary>
        /// Finishes initializing component by setting up the scripting service</summary>
        void IInitializable.Initialize()
        {
            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.ImportAllTypes("FsmEditorSample");
                m_scriptingService.ImportAllTypes("Sce.Atf.Controls.Adaptable.Graphs");

                m_scriptingService.SetVariable("editor", this);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    EditingContext  editingContext = m_contextRegistry.GetActiveContext <EditingContext>();
                    ViewingContext  viewContext    = m_contextRegistry.GetActiveContext <ViewingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("fsm", editingContext != null ? editingContext.Fsm : null);
                    m_scriptingService.SetVariable("view", viewContext);
                    m_scriptingService.SetVariable("hist", hist);
                };
            }
        }
Esempio n. 6
0
File: Editor.cs Progetto: zparr/ATF
        void IInitializable.Initialize()
        {
            // Set the application icon. We need to convert the reource from
            // System.Drawing.Image to System.Windows.Media.ImageSource.
            System.Drawing.Image atfIcon = ResourceUtil.GetImage(Sce.Atf.Resources.AtfIconImage);
            MemoryStream         stream  = new MemoryStream();

            atfIcon.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);

            BitmapImage bitmapImage = new BitmapImage();

            bitmapImage.BeginInit();
            bitmapImage.StreamSource = new MemoryStream(stream.ToArray());
            bitmapImage.EndInit();

            System.Windows.Application.Current.MainWindow.Icon = bitmapImage;

            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(typeof(WinGuiCommon.EditorBase).Assembly);
                m_scriptingService.ImportAllTypes("WinGuiCommon");

                m_scriptingService.SetVariable("editor", this);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    EditingContext  editingContext = m_contextRegistry.GetActiveContext <EditingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("hist", hist);
                };
            }

            if (m_controlHostService != null)
            {
                m_eventView.DataContext = m_eventViewModel;
                m_controlHostService.RegisterControl(new ControlDef
                {
                    Name        = "Event Viewer".Localize(),
                    Description = "Viewer for event details".Localize(),
                    Id          = "wpfApp1",
                    Group       = StandardControlGroup.Bottom
                }, m_eventView, this);

                m_documentRegistry.ActiveDocumentChanged += ContextSelectionChanged;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Finishes initializing component by setting up scripting service</summary>
        void IInitializable.Initialize()
        {
            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.ImportAllTypes("WinGuiCommon");

                m_scriptingService.SetVariable("editor", this);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    EditingContext  editingContext = m_contextRegistry.GetActiveContext <EditingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("hist", hist);
                };
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Finishes initializing component by setting up scripting service and setting service</summary>
        void IInitializable.Initialize()
        {
            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.ImportAllTypes("CircuitEditorSample");
                m_scriptingService.ImportAllTypes("Sce.Atf.Controls.Adaptable.Graphs");

                m_scriptingService.SetVariable("editor", this);
                m_scriptingService.SetVariable("schemaLoader", m_schemaLoader);
                m_scriptingService.SetVariable("layerLister", m_layerLister);

                m_contextRegistry.ActiveContextChanged += delegate
                {
                    var             editingContext = m_contextRegistry.GetActiveContext <CircuitEditingContext>();
                    ViewingContext  viewContext    = m_contextRegistry.GetActiveContext <ViewingContext>();
                    IHistoryContext hist           = m_contextRegistry.GetActiveContext <IHistoryContext>();
                    m_scriptingService.SetVariable("editingContext", editingContext);
                    m_scriptingService.SetVariable("circuitContainer", editingContext != null ? editingContext.CircuitContainer : null);
                    m_scriptingService.SetVariable("view", viewContext);
                    m_scriptingService.SetVariable("hist", hist);
                };
            }

            if (m_settingsService != null)
            {
                var settings = new[]
                {
                    new BoundPropertyDescriptor(this, () => SnapToGridEnabled,
                                                "Snap to grid".Localize(), "Circuit Editor".Localize(),
                                                "Snaps circuit element to grid when dragging".Localize(),
                                                new BoolEditor(), null),


                    new BoundPropertyDescriptor(typeof(CircuitDefaultStyle),
                                                () => CircuitDefaultStyle.EdgeStyle,
                                                "Wire Style".Localize(), "Circuit Editor".Localize(),
                                                "Default Edge Style".Localize()),
                    new BoundPropertyDescriptor(typeof(CircuitDefaultStyle),
                                                () => CircuitDefaultStyle.ShowExpandedGroupPins,
                                                "Show Expanded Group Pins".Localize(), "Circuit Editor".Localize(),
                                                "Show group pins when a group is expanded".Localize()),
                    new BoundPropertyDescriptor(typeof(CircuitDefaultStyle),
                                                () => CircuitDefaultStyle.ShowVirtualLinks,
                                                "Show Virtual links".Localize(), "Circuit Editor".Localize(),
                                                "Show virtual links between group pin and its associated subnodes when a group is expanded".Localize()),
                    new BoundPropertyDescriptor(this, () => InitialDirectory,
                                                "Initial Directory".Localize(), "Circuit Editor".Localize(),
                                                "The initial directory for documents".Localize(),
                                                new System.Windows.Forms.Design.FolderNameEditor(), null),
                };
                m_settingsService.RegisterUserSettings("Circuit Editor", settings);
                m_settingsService.RegisterSettings(this, settings);
            }

            if (m_modulePlugin != null)
            {
                // define pin/connection pens
                var pen = D2dFactory.CreateSolidBrush(Color.LightSeaGreen);
                Theme.RegisterCustomBrush(m_modulePlugin.BooleanPinTypeName, pen);
                pen = D2dFactory.CreateSolidBrush(Color.LightSeaGreen);
                Theme.RegisterCustomBrush(m_modulePlugin.FloatPinTypeName, pen);
            }

            D2dGradientStop[] gradstops =
            {
                new D2dGradientStop(Color.White,              0),
                new D2dGradientStop(Color.MediumVioletRed, 1.0f),
            };
            Theme.RegisterCustomBrush(MissingModule.MissingTypeName, D2dFactory.CreateLinearGradientBrush(gradstops));

            CircuitEditingContext.CircuitFormat = CircuitFormat;
        }