Пример #1
0
        /// <summary>
        /// Finishes initializing component by setting up scripting service, subscribing to document
        /// events, and creating PropertyDescriptors for settings</summary>
        void IInitializable.Initialize()
        {
            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.ImportAllTypes("TimelineEditorSample");
                m_scriptingService.ImportAllTypes("TimelineEditorSample.DomNodeAdapters");
                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_fileWatcherService != null)
            {
                m_fileWatcherService.FileChanged += fileWatcherService_FileChanged;
            }

            m_documentService.DocumentOpened += documentService_DocumentOpened;
            if (m_liveConnectService != null)
            {
                m_liveConnectService.MessageReceived += liveConnectService_MessageReceived;
            }

            var settings = new BoundPropertyDescriptor[] {
                new BoundPropertyDescriptor(typeof(D2dTimelineRenderer),
                                            () => D2dTimelineRenderer.GlobalHeaderWidth,
                                            "Header Width", "Appearance", "Width of Group/Track Header"),
                new BoundPropertyDescriptor(typeof(D2dTimelineRenderer),
                                            () => D2dTimelineRenderer.GlobalKeySize, "Key Size", "Appearance", "Size of Keys"),
                new BoundPropertyDescriptor(typeof(D2dTimelineRenderer),
                                            () => D2dTimelineRenderer.GlobalMajorTickSpacing, "Major Tick Spacing", "Appearance", "Pixels between major ticks"),
                new BoundPropertyDescriptor(typeof(D2dTimelineRenderer),
                                            () => D2dTimelineRenderer.GlobalPickTolerance, "Pick Tolerance", "Behavior", "Picking tolerance, in pixels"),
                new BoundPropertyDescriptor(typeof(D2dTimelineRenderer),
                                            () => D2dTimelineRenderer.GlobalTrackHeight, "Track Height", "Appearance", "Height of track, relative to units of time"),

                //manipulator settings
                new BoundPropertyDescriptor(typeof(D2dSnapManipulator), () => D2dSnapManipulator.SnapTolerance, "Snap Tolerance", "Behavior",
                                            "The maximum number of pixels that a selected object will be snapped"),
                new BoundPropertyDescriptor(typeof(D2dSnapManipulator), () => D2dSnapManipulator.Color, "Snap Indicator Color", "Appearance",
                                            "The color of the indicator to show that a snap will take place"),
                new BoundPropertyDescriptor(typeof(D2dScaleManipulator), () => D2dScaleManipulator.Color, "Scale Manipulator Color", "Appearance",
                                            "The color of the scale manipulator")
            };

            m_settingsService.RegisterUserSettings("Timeline Editor", settings);
            m_settingsService.RegisterSettings(this, settings);
        }
Пример #2
0
 public LegacyBindManager(IHistoryContext db)
 {
     this.db = db;
     binders = new List <IBinder>()
     {
         new PrimitiveTranslator(),
         new GuidTranslator(),
         new DateTimeTranslator(legacyMode: true),
         new NullableBinder(this),
         new CollectionTranslator(this, null, db),
     };
 }
Пример #3
0
        public void Initialize()
        {
            RegisterSettings();

            // Register palette items based on the schema file's annotations.
            foreach (DomNodeType nodeType in m_schemaLoader.TypeCollection.GetNodeTypes())
            {
                NodeTypePaletteItem item = nodeType.GetTagLocal <NodeTypePaletteItem>();
                if (item != null)
                {
                    Console.WriteLine("reg: " + nodeType.Name);
                    m_paletteService.AddItem(nodeType, item.Category, this);
                }
            }

            m_mainWindow.Loaded += delegate
            {
                if (ResourceRoot == null)
                {
                    ResourceRoot = Application.StartupPath + "\\";
                }
            };


            if (m_scriptingService != null)
            {
                // load this assembly into script domain.
                m_scriptingService.LoadAssembly(GetType().Assembly);
                m_scriptingService.LoadAssembly(Assembly.GetAssembly(typeof(LevelEditorCore.IDesignView)));
                m_scriptingService.LoadAssembly(Assembly.GetAssembly(typeof(RenderingInterop.RenderCommands)));
                m_scriptingService.LoadAssembly(Assembly.GetAssembly(typeof(LevelEditorXLE.Patches)));
                m_scriptingService.ImportAllTypes("LevelEditor");
                m_scriptingService.ImportAllTypes("LevelEditor.DomNodeAdapters");
                m_scriptingService.ImportAllTypes("LevelEditorCore");
                m_scriptingService.ImportAllTypes("Sce.Atf.Controls.Adaptable.Graphs");
                m_scriptingService.ImportAllTypes("RenderingInterop");

                m_scriptingService.SetVariable("editor", this);
                m_scriptingService.SetVariable("bookmarkLister", m_bookmarkLister);

                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);
                };
            }
        }
Пример #4
0
        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;
            }
        }
Пример #5
0
 public ValueTranslationManager(IHistoryContext db)
 {
     this.db     = db;
     translators = new List <IValueTranslator>()
     {
         new PrimitiveTranslator(),
         new GuidTranslator(),
         new DateTimeTranslator(),
         new DateTimeOffsetTranslator(),
         new TimeSpanTranslator(),
         new EnumTranslator(),
         new BinaryBlobTranslator(),
         new NullableBinder(this),
         new CollectionTranslator(this, this, db),
     };
 }
Пример #6
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;
            }
        }
Пример #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);
                };
            }
        }
Пример #8
0
        /// <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);
                };
            }
        }
Пример #9
0
 public HistoryExplorer(IHistoryContext <TChangeSet, TPrincipal> db)
 {
     this.db = db;
 }
Пример #10
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;
        }
Пример #11
0
 public HistoryRepository(IHistoryContext context)
 {
     _context = context;
 }
Пример #12
0
 public HistoryUow(IHistoryContext context, IRepositoryProvider repositoryProvider) : base(context, repositoryProvider)
 {
 }
Пример #13
0
 public HistoryRepo(IHistoryContext context)
 {
     this.context = context;
 }
 public CalculatorFunctionsCommandHandler(IHistoryContext _historyContext)
 {
     historyContext = _historyContext;
 }