Exemple #1
0
        void RenderArea_MouseUp( object sender, MouseEventArgs e )
        {
            base.OnMouseUp( e );

            // unselect the figure
            MovingElement = null;
            MovingScreen = false;
        }
Exemple #2
0
 public CanvasMouseClickEventArgs(MouseEventArgs mouseClick, CanvasElements hitElement, FxVector2f hitPoint, FxVector2f insidePoint)
 {
     this.mouseClick = mouseClick;
     this.hitElement = hitElement;
     this.hitPoint = hitPoint;
     this.insidePoint = insidePoint;
 }
Exemple #3
0
        private void ChangeSelectedElement(CanvasElements element)
        {
            #if true
            // clean the prev selection
            if (SelectedElement != null)
                SelectedElement.isSelected = false;

            #else
            // protect the element list
            lock (ElementsList)
            {
                // clean all the prev selection
                foreach (CanvasElements element in ElementsList)
                    element.isSelected = false;
            }
            #endif

            // update the selected element
            SelectedElement = element;

            if (element != null)
            {
                // set the flag of the seleceted element
                SelectedElement.isSelected = true;

                // update the link to property grid
                propertyGrid1.SelectedObject = element;

                // update the toolstrip

                // remove the old items
                toolStrip_SelectedItem.Items.Clear();

                // add the toolstrip items of the selectes object
                SelectedElement.FillToolStrip(toolStrip_SelectedItem);
                toolStrip_SelectedItem.Visible = true;
            }
            else
            {
                // update the link to property grid
                propertyGrid1.SelectedObject = this;

                // remove the old items
                toolStrip_SelectedItem.Visible = false;
                toolStrip_SelectedItem.Items.Clear();
            }

            // update the combobox
            ComboBox_elements.SelectedItem = element;
        }
Exemple #4
0
        void RenderArea_MouseDown( object sender, MouseEventArgs e )
        {
            if ( e.Button == System.Windows.Forms.MouseButtons.Left ) {

                // translate the location to the screen and the find the moving element
                MovingElement = HitElement( TranslatePoint( e.Location ) );

                // avoid move lock element
                if (MovingElement != null && MovingElement.lockMoving == true)
                    MovingElement = null;

                // set the current position of the mouse to be able to find the delta
                privMousePosition = new Vector2(e.Location.X, e.Location.Y);

                if ( MovingElement == null ) {
                    // set that we start mouving
                    MovingScreen = true;
                }

            }
        }
Exemple #5
0
        public void RemoveElement(CanvasElements element, Boolean Redraw = true)
        {
            // protect the element list
            lock (ElementsList)
            {
                // remove the element from the internal list
                ElementsList.Remove(element);
            }

            // update element list in form
            if (this.IsHandleCreated)
                this.BeginInvoke((Action)(() =>
                {
                    ComboBox_elements.Items.Clear();
                    ComboBox_elements.Items.AddRange(ElementsList.ToArray());
                }));

            // refresh the image
            if (Redraw)
                ReDraw();
        }
Exemple #6
0
        public void AddElement(CanvasElements element, Boolean Redraw = true, Boolean addToFront = true)
        {
            // set the parent of the new element
            element.Parent = this;

            // load the element before add
            element.Load(RenderVariables);

            // protect the element list
            lock (ElementsList)
            {
                // add the element to the internal list
                if (addToFront)
                    ElementsList.Add(element);
                else
                    ElementsList.Insert(0, element);
            }

            // update element list in form
            if (this.IsHandleCreated)
                this.BeginInvoke((Action)(() =>
                {
                    ComboBox_elements.Items.Clear();
                    ComboBox_elements.Items.AddRange(ElementsList.ToArray());
                }));

            // refresh the image
            if (Redraw)
                ReDraw();
        }
Exemple #7
0
 void depthImageElement_MouseClickEvent(CanvasElements m, FxMaths.Vector.FxVector2f location)
 {
     TesterForm.UIConsole.WriteLine("Depth:" + depthImageMatrix[location.x, location.y].ToString());
     // Console.WriteLine("Depth:" + depthImageMatrix[location.x, location.y].ToString());
 }
Exemple #8
0
 void ImageElement_MouseClickEvent_ShowColor(CanvasElements m, Vector.FxVector2f location)
 {
     int position = (int)(location.x + location.y * this.Width);
     System.Windows.Forms.MessageBox.Show( "Postion : (" + location.x.ToString() + ", " + location.y.ToString() + ")\r\n"+
         "RGBA: (" + this.internalImage[position * 4].ToString() + "," +
         this.internalImage[position * 4 + 1].ToString() + "," +
         this.internalImage[position * 4 + 2].ToString() + "," +
         this.internalImage[position * 4 + 3].ToString() + ")\r\n" +
         "Matrix : " + this.internalMatrix[(int)location.x, (int)location.y]);
 }
Exemple #9
0
 //The event-invoking method that derived classes can override.
 protected void OnMouseClickEvent(CanvasElements m, Vector.FxVector2f location)
 {
     // Make a temporary copy of the event to avoid possibility of
     // a race condition if the last subscriber unsubscribes
     // immediately after the null check and before the event is raised.
     MouseClickEventHandler handler = MouseClickEvent;
     if(handler != null) {
         handler(m, location);
     }
 }