Exemple #1
0
        public CommentNodeControl(ExperimentNode node, ApplicationContext applicationContext)
            : base(node, applicationContext)
        {
            // HERZUM SPRINT 2.4: TLAB-156

            /*
             * info = this.ExperimentNode.Data as SerializedVertexDataWithSize;
             * double widthMeta = info.Width;
             * double heightMeta = info.Height;
             *
             * PaddingTop = 7.0;
             * PaddingLeft= widthMeta/2;
             * PaddingRight= widthMeta/2;
             * PaddingBottom= heightMeta;
             * MoveTo (info.X, info.Y);
             */
            // END HERZUM SPRINT 2.4: TLAB-156


            // HERZUM SPRINT 1.0
            cw.Comment = ((CommentMetadata)node.Data.Metadata).Comment;

            cw.ExposeEvent += delegate {
                ((CommentMetadata)node.Data.Metadata).Comment = cw.Comment;
            };
            // END HERZUM SPRINT 1.0

            //HERZUM SPRINT 2.0 TLAB-136
            ecp = ExperimentCanvasPadFactory.GetExperimentCanvasPad(m_applicationContext, this);
            //END HERZUM SPRINT 2.0 TLAB-136
        }
        private void AddScopeInDecisionComponent()
        {
            // HERZUM SPRINT 2.0: TLAB-148
            // m_applicationContext.MainWindow.ExperimentCanvasPad.AddScopeInDecisionComponent(this);
            ExperimentCanvasPad experimentCanvasPad = ExperimentCanvasPadFactory.GetExperimentCanvasPad(m_applicationContext, this);

            experimentCanvasPad.AddScopeInDecisionComponent(this);
            // END HERZUM SPRINT 2.0: TLAB-148
        }
Exemple #3
0
 // HERZUM SPRINT 2.0: TLAB-136-2
 public virtual void CompositeComponentNoSelected(BasicNodeControl focusControl)
 {
     if (!this.Equals(focusControl))
     {
         ExperimentCanvasPad pad  = ExperimentCanvasPadFactory.GetExperimentCanvasPad(m_applicationContext, this);
         ExperimentCanvasPad pad2 = ExperimentCanvasPadFactory.GetExperimentCanvasPad(m_applicationContext, focusControl);
         if (!pad.Equals(pad2))
         {
             pad.ExperimentCanvasWidget.ExperimentCanvas.View.RemoveFromSelection(this);
             this.IsSelected = false;
         }
     }
 }
Exemple #4
0
        /*
         * private ScopeNodeBase GetScopeUp(ExperimentNode experimentNode, BaseExperiment experiment, double x, double y){
         *  BasicNodeControl componentControl;
         *  ScopeNodeBase scopeUp = null;
         *  ExperimentCanvasPad pad = null;
         *  if (experiment == null)
         *      return null;
         *  foreach (ExperimentNode node in experiment.Vertices)
         *      if (node is ScopeNodeBase && !node.Equals(experimentNode))
         *          if(m_applicationContext.NodeControlFactory.TryGetNodeControl(node, out componentControl)){
         *              ScopeBaseMetadata  scopeBaseMetadata  = node.Data.Metadata as ScopeBaseMetadata;
         *              int xMouse = 0;
         *              int yMouse = 0;
         *              BasicNodeControl internalComponentControl = null;
         *              foreach (ExperimentNode internalNode in scopeBaseMetadata.ComponentGraph.Vertices){
         *                  m_applicationContext.NodeControlFactory.TryGetNodeControl(internalNode, out internalComponentControl) ;
         *                  break;
         *              }
         *              if (internalComponentControl == null)
         *                  return null;
         *                  pad = ExperimentCanvasPadFactory.GetExperimentCanvasPad (m_applicationContext, componentControl);
         *              if (pad == null)
         *                  return null;
         *              pad.ExperimentCanvasWidget.GetPointer(out xMouse, out yMouse);
         *              scopeUp = GetScopeUp(experimentNode, scopeBaseMetadata.ComponentGraph as BaseExperiment, xMouse, yMouse);
         *              if (scopeUp != null)
         *                  return scopeUp;
         *              ScopeNodeControl scopeNodeControl = componentControl as ScopeNodeControl;
         *              if (scopeNodeControl.ContainsPoint (x, y))
         *                  return node as ScopeNodeBase;
         *          }
         *  return null;
         * }
         */
        // END HERZUM SPRINT 2.3 TLAB-60


        public override ITool CreateFigureTool(IPrimaryToolDelegator mainTool, IDrawingEditor editor,
                                               ITool defaultTool, MouseEvent ev)
        {
            DragTool dragTool = defaultTool as DragTool;

            if (dragTool != null)
            {
                //when drag is completed update model data
                dragTool.DragCompleted += (object sender, EventArgs e) =>
                {
                    this.ExperimentNode.Data.X = this.DisplayBox.X;
                    this.ExperimentNode.Data.Y = this.DisplayBox.Y;

                    // HERZUM SPRINT 2.3 TLAB-60
                    int           xMouse    = 0;
                    int           yMouse    = 0;
                    ScopeNodeBase scopeNode = GetScopeUp(ExperimentNode, ExperimentNode.Owner as BaseExperiment, ExperimentNode.Data.X, ExperimentNode.Data.Y);
                    if (scopeNode != null)
                    {
                        ScopeBaseMetadata   scopeBaseMetadata = scopeNode.Data.Metadata as ScopeBaseMetadata;
                        BaseExperiment      experimentTarget  = scopeBaseMetadata.ComponentGraph;
                        BasicNodeControl    componentControl  = null;
                        ExperimentCanvasPad pad = null;
                        foreach (ExperimentNode node in scopeBaseMetadata.ComponentGraph.Vertices)
                        {
                            m_applicationContext.NodeControlFactory.TryGetNodeControl(node, out componentControl);
                            break;
                        }
                        if (componentControl != null)
                        {
                            pad = ExperimentCanvasPadFactory.GetExperimentCanvasPad(m_applicationContext, componentControl);
                        }

                        if (pad != null)
                        {
                            pad.ExperimentCanvasWidget.GetPointer(out xMouse, out yMouse);
                            // HERZUM SPRINT 2.4 TLAB-56 TLAB-57 TLAB-58 TLAB-59 CLASS
                            //TraceLab.Core.Experiments.Clipboard.Cut(ExperimentNode.Owner as BaseExperiment);
                            //TraceLab.Core.Experiments.Clipboard.Paste(experimentTarget,xMouse,yMouse);

                            DragClipboard.Cut(m_applicationContext, ExperimentNode.Owner as BaseExperiment);
                            DragClipboard.Paste(m_applicationContext, experimentTarget, xMouse, yMouse);
                            // END HERZUM SPRINT 2.4 TLAB-56 TLAB-57 TLAB-58 TLAB-59 CLASS
                            pad.DisplayAddedSubgraph(experimentTarget);
                        }
                    }
                    // END HERZUM SPRINT 2.3 TLAB-60
                };
            }
            return(base.CreateFigureTool(mainTool, editor, defaultTool, ev));
        }
Exemple #5
0
        public void MaximizeScope()
        {
            if (stateWidget == "normal")
            {
                paddingLeftOriginal   = PaddingLeft;
                paddingRightOriginal  = PaddingRight;
                paddingBottomOriginal = PaddingBottom;
                xOriginal             = rect.X;
                yOriginal             = rect.Y;
            }

            int    xPosInit = 5;
            int    yPosInit = 5;
            double widthMax;
            double heightMax;

            //HERZUM SPRINT 2.3: TLAB-52
            ExperimentCanvasPad ecp = null;

            ecp = ExperimentCanvasPadFactory.GetExperimentCanvasPad(m_applicationContext, this);


            widthMax  = ecp.ExperimentCanvasWidget.ExperimentCanvas.View.VisibleArea.Width - 20;
            heightMax = ecp.ExperimentCanvasWidget.ExperimentCanvas.View.VisibleArea.Height - 40;


            //widthMax = m_applicationContext.MainWindow.ExperimentCanvasPad.ExperimentCanvasWidget.ExperimentCanvas.View.VisibleArea.Width-20;
            //heightMax = m_applicationContext.MainWindow.ExperimentCanvasPad.ExperimentCanvasWidget.ExperimentCanvas.View.VisibleArea.Height-40;
            //HERZUM SPRINT 2.3: TLAB-52

            // HERZUM SPRINT 2.4: TLAB-156
            MoveTo(xPosInit - offsetPanX, yPosInit - offsetPanY);
            // END HERZUM SPRINT 2.4: TLAB-156

            PaddingTop    = 7.0;
            PaddingLeft   = PaddingLeft + (widthMax - (rect.X2 - rect.X)) / 2;
            PaddingRight  = PaddingRight + (widthMax - (rect.X2 - rect.X)) / 2;;
            PaddingBottom = heightMax;

            ResizeCanvasWidget();

            xCur = rect.X;
            yCur = rect.Y;

            stateWidget       = "max";
            info.WidgetStatus = stateWidget;

            ShowWidget();
        }
        // END HERZUM SPRINT 5.0: TLAB-235

        // HERZUM SPRINT 1.1 LOOP
        protected void DrawScope (String start, String end){

            var metadata = this.ExperimentNode.Data.Metadata;
            ScopeBaseMetadata scopeMetadata = metadata as ScopeBaseMetadata;

            //componentGraph might be null if component metadata definition is not existing in the library 
            if(scopeMetadata.ComponentGraph != null)
            {
                // HERZUM SPRINT 1.1 CANVAS
                // return;
                // END HERZUM SPRINT 1.1 CANVAS

                if (m_scopeCanvasWidget == null)
                {
                    // HERZUM SPRINT 1.0
                    //scopeCanvasPad = new ExperimentCanvasPad(m_applicationContext);
                    //scopeCanvasPad = new  ScopeCanvasPad(m_applicationContext);
                    // END HERZUM SPRINT 1.0

                    //HERZUM SPRINT 2.0 TLAB-136
                    scopeCanvasPad = ExperimentCanvasPadFactory.CreateExperimentCanvasPad (m_applicationContext,this);
                    //END HERZUM SPRINT 2.0 TLAB-136

                    DockFrame m_dockFrame = new DockFrame();
                    Gdk.WindowAttr attributes = new Gdk.WindowAttr();
                    attributes.WindowType = Gdk.WindowType.Child;

                    attributes.X = 100;
                    attributes.Y = 100;
                    attributes.Width = 100;
                    attributes.Height = 100;    

                    Gdk.WindowAttributesType mask = WindowAttributesType.X | WindowAttributesType.Y;
                    m_dockFrame.GdkWindow = new Gdk.Window(null, attributes, (int) mask);
                    scopeCanvasPad.Initialize (m_dockFrame);

                    
                    // HERZUM SPRINT 2.2 TLAB-101 TLAB-102
                    foreach (ExperimentNode node in scopeMetadata.ComponentGraph.GetExperiment().Vertices)
                    {
                        if (node is ExperimentStartNode)
                            // HERZUM SPRINT 5.0: TLAB-235
                            // node.Data.Metadata.Label = "Start";
                            node.Data.Metadata.Label = start;
                        // END HERZUM SPRINT 5.0: TLAB-235

                        if (node is ExperimentEndNode)
                        {
                            // HERZUM SPRINT 5.0: TLAB-235
                            // node.Data.Metadata.Label = "End";
                            node.Data.Metadata.Label = end;
                            // END HERZUM SPRINT 5.0: TLAB-235

                            //HERZUM SPRINT 2.4 TLAB-158
                            // HERZUM SPRINT 5.0: TLAB-235
                            if (scopeMetadata.ComponentGraph.GetExperiment().StartNode.Data.X == 0 && 
                                scopeMetadata.ComponentGraph.GetExperiment().StartNode.Data.Y == 0 &&
                                scopeMetadata.ComponentGraph.GetExperiment().EndNode.Data.X == 0 && 
                                scopeMetadata.ComponentGraph.GetExperiment().EndNode.Data.Y == 0)
                            // END HERZUM SPRINT 5.0: TLAB-235
                                //HERZUM SPRINT 5.3 TLAB-185
                                    node.Data.Y =+ 110;
                               //END HERZUM SPRINT 5.3 TLAB-185
                            //END HERZUM SPRINT 2.4 TLAB-158
                        }
                    }
                    // END HERZUM SPRINT 2.2 TLAB-101 TLAB-102

                    // HERZUM SPRINT 1.0
                    scopeCanvasPad.SetScopeApplicationModel(this, m_applicationContext.Application, scopeMetadata.ComponentGraph);
                    // scopeCanvasPad.SetScopeApplicationModel(m_applicationContext.Application, scopeMetadata.ComponentGraph);
                    // END HERZUM SPRINT 1.0


                    // HERZUM SPRINT 1.0
                    //m_scopeCanvasWidget = scopeCanvasPad.ScopeCanvasWidget;
                    m_scopeCanvasWidget = scopeCanvasPad.ExperimentCanvasWidget;
                    m_scopeCanvasWidget.DestroyVbox1();
                    // END HERZUM SPRINT 1.0

                }

                // HERZUM SPRINT 2.1
                // m_applicationContext.MainWindow.ExperimentCanvasPad.ScopeNodeControlCurrent = this;
                // END HERZUM SPRINT 2.1


                
                //HERZUM SPRINT 2.0 TLAB-136
                ecp = ExperimentCanvasPadFactory.GetExperimentCanvasPad (m_applicationContext, this);
                //END HERZUM SPRINT 2.0 TLAB-136

                valueZoom = ecp.ExperimentCanvasWidget.ExperimentCanvas.View.Scale;

                if (!nodeCreated)
                {

                    xCur=rect.X;
                    yCur=rect.Y;

                    //PRINT 1.2 TLAB-133
                    //HERZUM SPRINT 2.0 TLAB-136
                    // HERZUM SPRINT 2.4: TLAB-156
                    offsetPanX =  ecp.ExperimentCanvasWidget.OffsetPanX;
                    offsetPanY= ecp.ExperimentCanvasWidget.OffsetPanY;

                    // HERZUM SPRINT 5.3: TLAB-185
                    //ecp.DisplayScope (m_scopeCanvasWidget, rect.X+1+offsetPanX, rect2.Y2+1+offsetPanY); 
                    //ecp.DisplayScope (m_scopeCanvasWidget, rect.X+edgeBorder+offsetPanX, rect2.Y2+edgeBorder+offsetPanY); 
                    ecp.DisplayScope (m_scopeCanvasWidget, (int)((rect.X+edgeBorder+offsetPanX)*valueZoom), (int)((rect2.Y2+edgeBorder+offsetPanY)*valueZoom)); 
                    // END HERZUM SPRINT 5.3: TLAB-185

                    // END HERZUM SPRINT 2.4: TLAB-156
                    //END HERZUM SPRINT 2.0 TLAB-136
                    //END HERZUM SPRINT 1.2 TLAB-133

                    m_scopeCanvasWidget.Show();
                    nodeCreated=true;
                } 

                else if (xCur!=rect.X  ||  yCur!=rect.Y) 
                { 
                    //HERZUM SPRINT 1.2 TLAB-133
                    //HERZUM SPRINT 2.0 TLAB-136

                    //HERZUM SPRINT 2: TLAB-156
                    if (valueZoom==zoomPrevious && valueZoom==1)
                        // HERZUM SPRINT 2.4: TLAB-156
                        // HERZUM SPRINT 5.3: TLAB-185
                        //ecp.MoveScope (m_scopeCanvasWidget, rect.X+1+offsetPanX, rect2.Y2+1+offsetPanY);
                        ecp.MoveScope (m_scopeCanvasWidget, rect.X+edgeBorder+offsetPanX, rect2.Y2+edgeBorder+offsetPanY);
                        // END HERZUM SPRINT 5.3: TLAB-185
                        // END HERZUM SPRINT 2.4: TLAB-156
                    //END HERZUM SPRINT 2: TLAB-156

                    //END HERZUM SPRINT 2.0 TLAB-136

                    xCur=rect.X;
                    yCur=rect.Y;

                    //HERZUM SPRINT 2.0 TLAB-135
                    if (IconisationForced)
                    { 
                        NormalizeScope ();
                        IconisationForced = false;
                    } 

                    OverlayScope (m_applicationContext);
                    //END HERZUM SPRINT 2.0 TLAB-135

                } 


                //HERZUM SPRINT 1.2 TLAB-133
                ResizeCanvasWidget ();
                //END HERZUM SPRINT 1.2 TLAB-133

            }

            if (firstDrawScope)
                if (stateWidget=="max")
                { 
                    MaximizeScope();
                    PaddingBottom = PaddingBottom - 20;
                }
                else if (stateWidget=="iconized")
                    IconizeScope();

            if (stateWidget=="iconized")
                m_scopeCanvasWidget.Hide();

            //HERZUM SPRINT 2.0 TLAB-135
            if (firstDrawScope)
            { 
                OverlayScope (m_applicationContext);
                firstDrawScope=false;
            }
            //END HERZUM SPRINT 2.0 TLAB-135


            //HERZUM SPRINT 2.0 TLAB-135
            if (IsResize)
            { 
                OverlayScope (m_applicationContext);
                IsResize=false;
            }
            //END HERZUM SPRINT 2.0 TLAB-135   


            //HERZUM SPRINT 2: TLAB-156
            valueZoom = ecp.ExperimentCanvasWidget.ExperimentCanvas.View.Scale;
            m_scopeCanvasWidget.ExperimentCanvas.View.Scale = valueZoom;   
            SetZoom (valueZoom);
            //HERZUM END SPRINT 2: TLAB-156

            
            // HERZUM SPRINT 2.4: TLAB-156
            //HERZUM SPRINT 5.5 TLAB-216
            point = ecp.ExperimentCanvasWidget.ExperimentCanvas.View.DrawingToView ((int)rect.X / valueZoom, (int)rect2.Y2 / valueZoom);
            offsetPanX = (point.X - rect.X) / valueZoom;
            offsetPanY = (point.Y - rect2.Y - 30) / valueZoom;
            //END HERZUM SPRINT 5.5 TLAB-216 
            if (ecp.ExperimentCanvasWidget.IsPanToolButtonActive ()) {
                //point = ecp.ExperimentCanvasWidget.ExperimentCanvas.View.DrawingToView ((int)rect.X / valueZoom, (int)rect2.Y2 / valueZoom);
                //offsetPanX = (point.X - rect.X) / valueZoom;
                //offsetPanY = (point.Y - rect2.Y - 30) / valueZoom;
                if (valueZoom == 1)
                    // HERZUM SPRINT 5.3: TLAB-185
                    //ecp.MoveScope (m_scopeCanvasWidget, point.X + 1, point.Y);
                    ecp.MoveScope (m_scopeCanvasWidget, point.X + edgeBorder, point.Y + edgeBorder);              
                   // END HERZUM SPRINT 5.3: TLAB-185
            } 
            // END HERZUM SPRINT 2.4: TLAB-156
              

        }