예제 #1
0
파일: Editor.cs 프로젝트: vincenthamm/ATF
        public Editor(
            IControlHostService controlHostService,
            ICommandService commandService,
            IContextRegistry contextRegistry,
            IDocumentRegistry documentRegistry,
            IDocumentService documentService,
            PrototypeLister prototypeLister,
            LayerLister layerLister,
            SchemaLoader schemaLoader)
        {
            m_controlHostService = controlHostService;
            m_commandService = commandService;
            m_contextRegistry = contextRegistry;
            m_documentRegistry = documentRegistry;
            m_documentService = documentService;
            m_prototypeLister = prototypeLister;
            m_layerLister = layerLister;
            
            m_schemaLoader = schemaLoader;

            string initialDirectory = Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\..\\..\\components\\wws_atf\\Samples\\CircuitEditor\\data");
            EditorInfo.InitialDirectory = initialDirectory;
            m_theme = new D2dDiagramTheme();
            m_circuitRenderer = new D2dCircuitRenderer<Module, Connection, ICircuitPin>(m_theme, documentRegistry);
            m_subGraphRenderer = new D2dSubCircuitRenderer<Module, Connection, ICircuitPin>(m_theme);

            // create d2dcontrol for displaying sub-circuit            
            m_d2dHoverControl = new D2dAdaptableControl();
            m_d2dHoverControl.Dock = DockStyle.Fill;
            var xformAdapter = new TransformAdapter();
            xformAdapter.EnforceConstraints = false;//to allow the canvas to be panned to view negative coordinates
            m_d2dHoverControl.Adapt(xformAdapter, new D2dGraphAdapter<Module, Connection, ICircuitPin>(m_circuitRenderer, xformAdapter));
            m_d2dHoverControl.DrawingD2d += new EventHandler(m_d2dHoverControl_DrawingD2d);
        }
예제 #2
0
파일: ModulePlugin.cs 프로젝트: jethac/ATF
 public ModulePlugin(
     IPaletteService paletteService,
     SchemaLoader schemaLoader)
 {
     m_paletteService = paletteService;
     m_schemaLoader = schemaLoader;
 }
예제 #3
0
 public ModulePlugin(
     IPaletteService paletteService,
     SchemaLoader schemaLoader)
 {
     m_paletteService = paletteService;
     m_schemaLoader   = schemaLoader;
 }
예제 #4
0
 public ModulePlugin(
     IPaletteService paletteService,
     SchemaLoader schemaLoader,
     DiagramTheme diagramTheme)
 {
     m_paletteService = paletteService;
     m_schemaLoader   = schemaLoader;
     m_diagramTheme   = diagramTheme;
 }
예제 #5
0
 public ModulePlugin(
     IPaletteService paletteService,
     SchemaLoader schemaLoader,
     DiagramTheme diagramTheme)
 {
     m_paletteService = paletteService;
     m_schemaLoader = schemaLoader;
     m_diagramTheme = diagramTheme;
 }
예제 #6
0
파일: ModulePlugin.cs 프로젝트: zparr/ATF
        private void DefineModuleType(
            XmlQualifiedName name,
            string displayName,
            string description,
            string imageName,
            ElementType.Pin[] inputs,
            ElementType.Pin[] outputs,
            SchemaLoader loader)
        {
            // turn input pins into attributes on the type
            var attributes = new List <AttributeInfo>();

            foreach (ElementType.Pin pin in inputs)
            {
                attributes.Add(
                    new AttributeInfo(
                        pin.Name,
                        (pin.TypeName == BooleanPinTypeName) ? BooleanPinType : FloatPinType));
            }

            // create the type
            var type = new DomNodeType(
                name.ToString(),
                Schema.moduleType.Type,
                attributes,
                EmptyArray <ChildInfo> .Instance,
                EmptyArray <ExtensionInfo> .Instance);

            // add it to the schema-defined types
            loader.AddNodeType(name.ToString(), type);

            // create an element type and add it to the type metadata
            // For now, let all circuit elements be used as 'connectors' which means
            //  that their pins will be used to create the pins on a master instance.
            bool isConnector = true; //(inputs.Length + outputs.Length) == 1;

            type.SetTag <ICircuitElementType>(
                new ElementType(
                    displayName,
                    isConnector,
                    new Size(),
                    ResourceUtil.GetImage32(imageName),
                    inputs,
                    outputs));

            // add the type to the palette
            m_paletteService.AddItem(
                new NodeTypePaletteItem(
                    type,
                    displayName,
                    description,
                    imageName),
                PaletteCategory,
                this);
        }
예제 #7
0
파일: Editor.cs 프로젝트: zparr/ATF
        public Editor(
            IControlHostService controlHostService,
            ICommandService commandService,
            IContextRegistry contextRegistry,
            IDocumentRegistry documentRegistry,
            IDocumentService documentService,
            PrototypeLister prototypeLister,
            LayerLister layerLister,
            SchemaLoader schemaLoader)
        {
            m_controlHostService = controlHostService;
            m_commandService     = commandService;
            m_contextRegistry    = contextRegistry;
            m_documentRegistry   = documentRegistry;
            m_documentService    = documentService;
            m_prototypeLister    = prototypeLister;
            m_layerLister        = layerLister;

            m_schemaLoader = schemaLoader;

            string initialDirectory = Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\..\\..\\components\\wws_atf\\Samples\\CircuitEditor\\data");

            EditorInfo.InitialDirectory = initialDirectory;
            m_theme            = new D2dDiagramTheme();
            m_circuitRenderer  = new D2dCircuitRenderer <Module, Connection, ICircuitPin>(m_theme, documentRegistry);
            m_subGraphRenderer = new D2dSubCircuitRenderer <Module, Connection, ICircuitPin>(m_theme);

            //// Note: Santa Monica uses following render settings:
            //m_circuitRenderer.TitleBackgroundFilled = true;
            //m_circuitRenderer.RoundedBorder = false;
            //m_circuitRenderer.PinDrawStyle = D2dCircuitRenderer<Module, Connection, ICircuitPin>.PinStyle.OnBorderFilled;

            //m_subGraphRenderer.TitleBackgroundFilled = true;
            //m_subGraphRenderer.RoundedBorder = false;
            //m_subGraphRenderer.PinDrawStyle = D2dCircuitRenderer<Module, Connection, ICircuitPin>.PinStyle.OnBorderFilled;

            // create d2dcontrol for displaying sub-circuit
            m_d2dHoverControl      = new D2dAdaptableControl();
            m_d2dHoverControl.Dock = DockStyle.Fill;
            var xformAdapter = new TransformAdapter();

            xformAdapter.EnforceConstraints = false;//to allow the canvas to be panned to view negative coordinates
            m_d2dHoverControl.Adapt(xformAdapter, new D2dGraphAdapter <Module, Connection, ICircuitPin>(m_circuitRenderer, xformAdapter));
            m_d2dHoverControl.DrawingD2d += new EventHandler(m_d2dHoverControl_DrawingD2d);
        }
예제 #8
0
        /// <summary>
        /// Prepare metadata for the module type, to be used by the palette and circuit drawing engine</summary>
        /// <param name="name"> Schema full name of the DomNodeType for the module type</param>
        /// <param name="displayName">Display name for the module type</param>
        /// <param name="description"></param>
        /// <param name="imageName">Image name </param>
        /// <param name="inputs">Define input pins for the module type</param>
        /// <param name="outputs">Define output pins for the module type</param>
        /// <param name="loader">XML schema loader </param>
        /// <param name="domNodeType">optional DomNode type for the module type</param>
        /// <returns>DomNodeType that was created (or the domNodeType parameter, if it wasn't null)</returns>
        protected DomNodeType DefineModuleType(
            XmlQualifiedName name,
            string displayName,
            string description,
            string imageName,
            ElementType.Pin[] inputs,
            ElementType.Pin[] outputs,
            SchemaLoader loader,
            DomNodeType domNodeType = null)
        {
            if (domNodeType == null)
            {
                // create the type
                domNodeType = new DomNodeType(
                    name.ToString(),
                    Schema.moduleType.Type,
                    EmptyArray <AttributeInfo> .Instance,
                    EmptyArray <ChildInfo> .Instance,
                    EmptyArray <ExtensionInfo> .Instance);
            }

            DefineCircuitType(domNodeType, displayName, imageName, inputs, outputs);

            // add it to the schema-defined types
            loader.AddNodeType(name.ToString(), domNodeType);

            // add the type to the palette
            m_paletteService.AddItem(
                new NodeTypePaletteItem(
                    domNodeType,
                    displayName,
                    description,
                    imageName),
                PaletteCategory,
                this);

            return(domNodeType);
        }
예제 #9
0
파일: ModulePlugin.cs 프로젝트: jethac/ATF
        /// <summary>
        /// Prepare metadata for the module type, to be used by the palette and circuit drawing engine</summary>
        /// <param name="name"> Schema full name of the DomNodeType for the module type</param>
        /// <param name="displayName">Display name for the module type</param>
        /// <param name="description"></param>
        /// <param name="imageName">Image name </param>
        /// <param name="inputs">Define input pins for the module type</param>
        /// <param name="outputs">Define output pins for the module type</param>
        /// <param name="loader">XML schema loader </param>
        /// <param name="domNodeType">optional DomNode type for the module type</param>
        /// <returns>DomNodeType that was created (or the domNodeType parameter, if it wasn't null)</returns>
        protected DomNodeType DefineModuleType(
            XmlQualifiedName name,
            string displayName,
            string description,
            string imageName,
            ElementType.Pin[] inputs,
            ElementType.Pin[] outputs,
            SchemaLoader loader,
            DomNodeType domNodeType = null)
        {
            if (domNodeType == null)
                // create the type
                domNodeType = new DomNodeType(
                name.ToString(),
                Schema.moduleType.Type,
                EmptyArray<AttributeInfo>.Instance,
                EmptyArray<ChildInfo>.Instance,
                EmptyArray<ExtensionInfo>.Instance);

            DefineCircuitType(domNodeType, displayName, imageName, inputs, outputs);

            // add it to the schema-defined types
            loader.AddNodeType(name.ToString(), domNodeType);

            // add the type to the palette
            m_paletteService.AddItem(
                new NodeTypePaletteItem(
                    domNodeType,
                    displayName,
                    description,
                    imageName),
                PaletteCategory,
                this);

            return domNodeType;
        }
예제 #10
0
        private void DefineModuleType(
            XmlQualifiedName name,
            string displayName,
            string description,
            string imageName,
            ElementType.Pin[] inputs,
            ElementType.Pin[] outputs,
            SchemaLoader loader)
        {
            // turn input pins into attributes on the type
            var attributes = new List<AttributeInfo>();
            foreach (ElementType.Pin pin in inputs)
                attributes.Add(
                    new AttributeInfo(
                        pin.Name,
                        (pin.TypeName == BooleanPinTypeName) ? BooleanPinType : FloatPinType));

            // create the type
            var type = new DomNodeType(
                name.ToString(),
                Schema.moduleType.Type,
                attributes,
                EmptyArray<ChildInfo>.Instance,
                EmptyArray<ExtensionInfo>.Instance);

            // add it to the schema-defined types
            loader.AddNodeType(name.ToString(), type);

            // create an element type and add it to the type metadata
            // For now, let all circuit elements be used as 'connectors' which means
            //  that their pins will be used to create the pins on a master instance.
            bool isConnector = true; //(inputs.Length + outputs.Length) == 1;
            type.SetTag<ICircuitElementType>(
                new ElementType(
                    displayName,
                    isConnector,
                    new Size(),
                    ResourceUtil.GetImage32(imageName),
                    inputs,
                    outputs));

            // add the type to the palette
            m_paletteService.AddItem(
                new NodeTypePaletteItem(
                    type,
                    displayName,
                    description,
                    imageName),
                PaletteCategory,
                this);
        }