Exemple #1
0
        public Editor(
            IControlHostService controlHostService,
            ICommandService commandService,
            IContextRegistry contextRegistry,
            IDocumentRegistry documentRegistry,
            IDocumentService documentService,
            SchemaLoader schemaLoader,
            PrototypeLister prototypeLister)
        {
            m_controlHostService = controlHostService;
            m_commandService     = commandService;
            m_contextRegistry    = contextRegistry;
            m_documentRegistry   = documentRegistry;
            m_documentService    = documentService;

            m_schemaLoader = schemaLoader;

            m_diagramTheme = new D2dDiagramTheme();

            D2dGradientStop[] gradStops =
            {
                new D2dGradientStop(Color.WhiteSmoke, 0),
                new D2dGradientStop(Color.LightGray, 1)
            };
            m_diagramTheme.FillGradientBrush = D2dFactory.CreateLinearGradientBrush(gradStops);
            m_diagramTheme.FillBrush         = D2dFactory.CreateSolidBrush(Color.WhiteSmoke);
            m_statechartRenderer             = new D2dStatechartRenderer <StateBase, Transition>(m_diagramTheme);

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

            EditorInfo.InitialDirectory = initialDirectory;
        }
Exemple #2
0
 /// <summary>
 /// Constructor</summary>
 /// <param name="theme">Diagram theme for node</param>
 public D2dDigraphRenderer(D2dDiagramTheme theme)
 {
     m_theme = theme;
     m_theme.TextFormat.ParagraphAlignment = D2dParagraphAlignment.Center;
     m_theme.TextFormat.TextAlignment      = D2dTextAlignment.Center;
     m_theme.Redraw += theme_Redraw;
 }
Exemple #3
0
        public Editor(
            IControlHostService controlHostService,
            ICommandService commandService,
            IContextRegistry contextRegistry,
            IDocumentRegistry documentRegistry,
            IDocumentService documentService,
            PrototypeLister prototypeLister,
            SchemaLoader schemaLoader,
            DiagramTheme diagramTheme)
        {
            m_controlHostService = controlHostService;
            m_commandService     = commandService;
            m_contextRegistry    = contextRegistry;
            m_documentRegistry   = documentRegistry;
            m_documentService    = documentService;
            m_prototypeLister    = prototypeLister;

            m_schemaLoader = schemaLoader;

            m_theme       = new D2dDiagramTheme();
            m_fsmRenderer = new D2dDigraphRenderer <State, Transition>(m_theme);

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

            EditorInfo.InitialDirectory = initialDirectory;
        }
Exemple #4
0
        public Editor(
            IControlHostService controlHostService,
            ICommandService commandService,
            IContextRegistry contextRegistry,
            IDocumentRegistry documentRegistry,
            IDocumentService documentService,
            PrototypeLister prototypeLister,
            SchemaLoader schemaLoader,
            DiagramTheme diagramTheme)
        {
            m_controlHostService = controlHostService;
            m_commandService = commandService;
            m_contextRegistry = contextRegistry;
            m_documentRegistry = documentRegistry;
            m_documentService = documentService;
            m_prototypeLister = prototypeLister;

            m_schemaLoader = schemaLoader;

            m_theme = new D2dDiagramTheme();
            m_fsmRenderer = new D2dDigraphRenderer<State, Transition>(m_theme);

            string initialDirectory = Path.Combine(Directory.GetCurrentDirectory(), "..\\..\\..\\..\\components\\wws_atf\\Samples\\FsmEditor\\data");
            EditorInfo.InitialDirectory = initialDirectory;
        }
Exemple #5
0
        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);
        }
 /// <summary>
 /// Constructor</summary>
 /// <param name="theme">Theme for rendering state chart</param>
 public D2dStatechartRenderer(D2dDiagramTheme theme)
 {
     m_theme = theme;
     UpdateToTheme();
     m_theme.Redraw     += theme_Redraw;
     m_stateRect.RadiusX = CornerRadius;
     m_stateRect.RadiusY = CornerRadius;
 }
Exemple #7
0
        /// <summary>
        /// Draws a graph node</summary>
        /// <param name="element">Element to draw</param>
        /// <param name="style">Diagram drawing style</param>
        /// <param name="g">Graphics object</param>
        public override void Draw(ScriptNode element, DiagramDrawingStyle style, D2dGraphics g)
        {
            // Use the "disabled" theme when drawing disabled circuit elements.
            if (!((ScriptNodeElementInfo)element.ElementInfo).Enabled)
            {
                D2dDiagramTheme defaultTheme = Theme;
                Theme = m_disabledTheme;
                base.Draw(element, style, g);
                Theme = defaultTheme;
                return;
            }

            base.Draw(element, style, g);
        }
Exemple #8
0
        /// <summary>
        /// Initializes a new instance of this class</summary>
        /// <param name="theme">Diagram theme for rendering graph</param>
        /// <param name="documentRegistry">An optional document registry, used to clear the internal
        /// element type cache when a document is removed</param>
        public ScriptRenderer(D2dDiagramTheme theme, IDocumentRegistry documentRegistry) :
            base(theme, documentRegistry)
        {
            m_disabledTheme           = new D2dDiagramTheme();
            m_disabledTheme.FillBrush = D2dFactory.CreateSolidBrush(SystemColors.ControlDark);
            m_disabledTheme.TextBrush = D2dFactory.CreateSolidBrush(SystemColors.InactiveCaption);
            D2dGradientStop[] gradstops =
            {
                new D2dGradientStop(Color.DarkGray,    0),
                new D2dGradientStop(Color.DimGray,  1.0f),
            };
            m_disabledTheme.FillGradientBrush = D2dFactory.CreateLinearGradientBrush(gradstops);

            // Set the pin colors
            m_disabledTheme.RegisterCustomBrush("boolean", D2dFactory.CreateSolidBrush(Color.LightGray));
        }
Exemple #9
0
        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);
        }
Exemple #10
0
        /// <summary>
        /// Constructor</summary>
        /// <param name="defaultTheme">Diagram theme for rendering graph</param>
        /// <param name="documentRegistry">An optional document registry, used to clear the internal
        /// element type cache when a document is removed</param>
        public D2dSubCircuitRenderer(D2dDiagramTheme defaultTheme, IDocumentRegistry documentRegistry = null)
            : base(defaultTheme, documentRegistry)
        {
            m_fakeInputLinkPen   = D2dFactory.CreateSolidBrush(Color.DarkOrchid);
            m_fakeOutputLinkPen  = D2dFactory.CreateSolidBrush(Color.SlateGray);
            m_subGraphPinNodePen = D2dFactory.CreateSolidBrush(Color.SandyBrown);
            m_subGraphPinPen     = D2dFactory.CreateSolidBrush(Color.DeepSkyBlue);
            m_pinBrush           = D2dFactory.CreateSolidBrush(SystemColors.ControlDarkDark);
            m_visiblePinBrush    = D2dFactory.CreateSolidBrush(Color.Black);
            m_hiddrenPinBrush    = D2dFactory.CreateSolidBrush(Color.Gray);

            var props = new D2dStrokeStyleProperties();

            props.EndCap             = D2dCapStyle.Round;
            props.StartCap           = D2dCapStyle.Round;
            props.DashStyle          = D2dDashStyle.DashDot;
            m_VirtualLinkStrokeStyle = D2dFactory.CreateD2dStrokeStyle(props);
        }
 /// <summary>
 /// Constructor</summary>
 /// <param name="theme">Diagram rendering theme</param>
 public D2dAnnotationAdapter(D2dDiagramTheme theme)
 {
     m_theme = theme;
     m_theme.Redraw += theme_Redraw;
 }
Exemple #12
0
 /// <summary>
 /// Constructor</summary>
 /// <param name="theme">Diagram rendering theme</param>
 public D2dAnnotationAdapter(D2dDiagramTheme theme)
 {
     m_theme = theme;
     m_theme.Redraw += theme_Redraw;
     m_solidBrush = D2dFactory.CreateSolidBrush(Color.FromArgb(128, 120, 120, 120));                
 }