Ejemplo n.º 1
0
    static void HandleButtonPress(object o, ButtonPressEventArgs args)
    {
        Actor c = (Stage.Default as Stage).GetActorAtPos (args.Event.X, args.Event.Y);

         	if (c != null)
         	 	c.Hide ();
    }
Ejemplo n.º 2
0
 public void Popup(ButtonPressEventArgs args)
 {
     if (args != null)
         Popup (null, null, null, args.Event.Button, args.Event.Time);
     else
         Popup (null, null, null, 0, Gtk.Global.CurrentEventTime);
 }
Ejemplo n.º 3
0
		protected override void OnMouseDown (DrawingArea canvas, ButtonPressEventArgs args, Cairo.PointD point)
		{
			// Ignore extra button clicks while drawing
			if (is_drawing)
				return;

			Document doc = PintaCore.Workspace.ActiveDocument;
			hist = new SelectionHistoryItem(Icon, Name);
			hist.TakeSnapshot();

			reset_origin = args.Event.GetPoint();

            active_control = HandleResize (point);
			if (!active_control.HasValue)
			{
				combine_mode = PintaCore.Workspace.SelectionHandler.DetermineCombineMode(args);

				double x = Utility.Clamp(point.X, 0, doc.ImageSize.Width - 1);
				double y = Utility.Clamp(point.Y, 0, doc.ImageSize.Height - 1);
				shape_origin = new PointD(x, y);

                doc.PreviousSelection.Dispose ();
				doc.PreviousSelection = doc.Selection.Clone();
				doc.Selection.SelectionPolygons.Clear();

                // The bottom right corner should be selected.
                active_control = 3;
			}

            is_drawing = true;
		}
Ejemplo n.º 4
0
 void ButtonPress(object o, ButtonPressEventArgs args)
 {
     CanvasItem item = CreateItem();
     args.View.Canvas.Root.Add (item);
     MoveItem (args.View, args.Button, item);
     //GrabHandle (args.View, args.Button, item);
 }
Ejemplo n.º 5
0
        public void OnButtonPress(object o, ButtonPressEventArgs args)
        {
            Preview.ButtonReleaseEvent += OnButtonRelease;
              Preview.MotionNotifyEvent += OnMotionNotify;

              OnPress(new IntCoordinate((int) args.Event.X, (int) args.Event.Y));
        }
Ejemplo n.º 6
0
		void OnUpdateClicked (object s, ButtonPressEventArgs args)
		{
			if (args.Event.Button == 1) {
				HideAlert ();
				AddinManagerWindow.Run (IdeApp.Workbench.RootWindow);
			}
		}
Ejemplo n.º 7
0
	protected void OnUpEventboxButtonPressEvent (object o, ButtonPressEventArgs args)
	{
		upImage.Pixbuf = new global::Gdk.Pixbuf (global::System.IO.Path.Combine (global::System.AppDomain.CurrentDomain.BaseDirectory, "./Images/EV3-multibrick_11_P.png"));
		upImageSmall1.Pixbuf = new global::Gdk.Pixbuf (global::System.IO.Path.Combine (global::System.AppDomain.CurrentDomain.BaseDirectory, "./Images/EV3-multibrick_16_P.png"));
		upImageSmall2.Pixbuf = new global::Gdk.Pixbuf (global::System.IO.Path.Combine (global::System.AppDomain.CurrentDomain.BaseDirectory, "./Images/EV3-multibrick_18_P.png"));
		buttonsStub.UpPressed ();
	}
    private void OnButtonPressed(object o, ButtonPressEventArgs args)
    {
        TreePath path;
        if(!GetPathAtPos((int) args.Event.X, (int) args.Event.Y, out path))
            return;

        TreeIter iter;
        if(!Model.GetIter(out iter, path))
            return;

        object obj = Model.GetValue(iter, 0);
        if(obj is Tilemap) {
            if(obj != currentTilemap) {
                currentTilemap = (Tilemap) obj;
                application.EditProperties(currentTilemap, "Tilemap (" + currentTilemap.ZPos + ")");
                application.ChangeCurrentTilemap(currentTilemap);
            }
        } else {
            currentTilemap = null;
        // TODO: clear properties window?
            application.ChangeCurrentTilemap(currentTilemap);
        }

        if((args.Event.Button == 3) && (obj is Tilemap)) {
            ShowPopupMenu();
        }
    }
Ejemplo n.º 9
0
 public void onButtonPress(object o, ButtonPressEventArgs args)
 {
     if (state == MyState.AddingPoints){
         demo.points.Add(new PointD (args.Event.X, args.Event.Y));
         Logger.Log ("Added point in keypress ");
     }
 }
Ejemplo n.º 10
0
        void menu_IM_ButtonPressEvent(object o, ButtonPressEventArgs args)
        {
            Gtk.TreeModel mod;
            Gtk.TreeIter iter;

            TreePath[] paths = treeview_members.Selection.GetSelectedRows(out mod);

            if (paths.Length == 1)
            {
                store.GetIter(out iter,paths[0]);
                UUID target = ((ChatSessionMember)store.GetValue(iter, 1)).AvatarKey;
                MainClass.win.startIM(target);
            }
            else if (paths.Length > 1)
            {
                List <UUID> targets=new List<UUID>();
                foreach(Gtk.TreePath path in paths)
                {
                      store.GetIter(out iter,path);
                      UUID target=((ChatSessionMember)store.GetValue(iter,1)).AvatarKey;
                      targets.Add(target);
                }

                MainClass.win.startConfrenceIM(targets);
            }
        }
Ejemplo n.º 11
0
        // Method that describe what happen when a tile is clicked
        private void onTileClicked(object obj, ButtonPressEventArgs args)
        {
            if (((Gdk.EventButton)args.Event).Type == Gdk.EventType.ButtonPress) {
            TileWidget tile = (TileWidget)obj;
            //Console.WriteLine (tile.position.x + ", " + tile.position.y + " " + tile.color + " " + tile.figure);
            if (!this.clicked) {
              this.clickedPosition = new coord (tile.position.x, tile.position.y);

              if (this.callback (this.clickedPosition, this.clickedPosition)) {
            this.clicked = true;
            Fixed f = (Fixed)(tile.Child);
            Image circle = tile.loadCircle (this.tileSize);
            f.Add (circle);
            f.ShowAll ();
              }
            } else {
              //remove the ring whenn the user clicks agen on the same tile
              if (this.callback (this.clickedPosition, tile.position) &&
              this.clickedPosition.Equals (tile.position)) {
            Fixed f = (Fixed)(tile.Child);
            if (f.Children.Length > 1)
              f.Remove (f.Children [1]);
              }
              this.clicked = false;
            }
              }
        }
Ejemplo n.º 12
0
        protected override void OnMouseDown(DrawingArea canvas, ButtonPressEventArgs args, Cairo.PointD point)
        {
            shape_origin = point;
            is_drawing = true;

            hist = new SelectionHistoryItem (Icon, Name);
            hist.TakeSnapshot ();
        }
Ejemplo n.º 13
0
 public void ProcessPressEvent(ButtonPressEventArgs args)
 {
     if (args.Event.Button == 1) {
         swiping = true;
         swipeStart = new Point((int) args.Event.X, (int) args.Event.Y);
         swipeTest = swipeStart;
     }
 }
Ejemplo n.º 14
0
		static void ButtonPressEvent (object obj, ButtonPressEventArgs args)
		{
			Gdk.EventButton ev = args.Event;
			if (ev.Button == 1 && pixmap != null)
				DrawBrush (ev.X, ev.Y, true);
			else if (ev.Button == 3 && pixmap != null)
				DrawBrush (ev.X, ev.Y, false);
			args.RetVal = true;
		}
Ejemplo n.º 15
0
 private void TIconClicked(object sender, ButtonPressEventArgs args)
 {
     Gdk.EventButton eb = args.Event;
     if (eb.Button == 3)
     {
     menu.ShowAll ();
     menu.Popup (null, null, null, IntPtr.Zero, args.Event.Button, args.Event.Time);
     }
 }
Ejemplo n.º 16
0
 public void MemoContentPressHandler(object obj, ButtonPressEventArgs args)
 {
     if (args.Event.Type == EventType.ButtonPress) {
         this.SwitchContentView(true);
     }
     if (args.Event.Type == EventType.TwoButtonPress) {
         this.SwitchContentView(false);
     }
 }
Ejemplo n.º 17
0
 public static void OnButtonDragPress(object o, ButtonPressEventArgs args)
 {
     Gdk.Window w = ((Gtk.Widget)o).GdkWindow.Toplevel;
     if (((Gdk.EventButton)args.Event).Type == Gdk.EventType.TwoButtonPress) {
     } else {
         int x, y;
         Gdk.Display.Default.GetPointer (out x, out y);
         w.BeginMoveDrag (1, x, y, 0);
     }
 }
Ejemplo n.º 18
0
        void OnScheduleButtonPress(object o, ButtonPressEventArgs args)
        {
            if ( args.Event.Type == EventType.TwoButtonPress )
            {
                ScheduleItem si = sg.GetItemAtPosition( args.Event.X, args.Event.Y );
                DateTime dtClicked = sg.GetTimeAtPosition( args.Event.X, args.Event.Y );

                ScheduleItemWindow siw = new ScheduleItemWindow( si, dtClicked );

                siw.Show();
            }
        }
Ejemplo n.º 19
0
 // Method that describe the reaction of a tile when it is clicked
 private void onTileClicked(object obj, ButtonPressEventArgs args)
 {
     TileWidget tile = (TileWidget)obj;
       bool found = false;
       for (int i = 0; i < ((HBox)tile.Parent).Children.Length && !found; i++) {
     if (((HBox)tile.Parent).Children [i].Equals (tile)) {
       found = true;
       this.callback (this.figures [i], tile.position);
     }
       }
       close ();
 }
Ejemplo n.º 20
0
		protected void OnItemButtonPressed(object sender, ButtonPressEventArgs e)
		{
			if (e.Event.Button == 3) /* right click */
			{
				Menu m = new Menu();
				MenuItem deleteItem = new MenuItem("Разорвать соединение");
				deleteItem.ButtonPressEvent += new ButtonPressEventHandler(OnDeleteItemButtonPressed);
				m.Add(deleteItem);
				m.ShowAll();
				m.Popup();
			}
		}
Ejemplo n.º 21
0
        protected override void OnMouseDown(DrawingArea canvas, ButtonPressEventArgs args, Cairo.PointD point)
        {
            // Ignore extra button clicks while drawing
            if (is_drawing)
                return;

            shape_origin = point;
            is_drawing = true;

            hist = new SelectionHistoryItem (Icon, Name);
            hist.TakeSnapshot ();
        }
Ejemplo n.º 22
0
    protected void onDAButtonPress(object o, ButtonPressEventArgs args)
    {
        if (circuit == null)
            return;

        mouseButton = args.Event.Button;

        switch (mouseButton) {

            case 1: // bouton 1
                clickCell(args.Event.X, args.Event.Y);

                break;

        }
    }
    private void OnButtonPressed(object o, ButtonPressEventArgs args)
    {
        TreePath path = GetPathAtPos((int) args.Event.X, (int) args.Event.Y);
            if (path == null) return;

            TreeIter iter;
            if(!Model.GetIter(out iter, path))
                return;

            currentObject = (IGameObject) Model.GetValue(iter, COL_OBJECT);
            application.EditProperties(currentObject, currentObject.GetType().Name);

            if(args.Event.Button == 3) {
                ShowPopupMenu();
            }
    }
Ejemplo n.º 24
0
        protected override void OnMouseDown(DrawingArea canvas, ButtonPressEventArgs args, Cairo.PointD point)
        {
            // Ignore extra button clicks while drawing
            if (is_drawing)
                return;

            Document doc = PintaCore.Workspace.ActiveDocument;

            // Selection is around the pixel selection so add 1 pixel
            double x = Utility.Clamp (point.X, 0, doc.ImageSize.Width);
            double y = Utility.Clamp (point.Y, 0, doc.ImageSize.Height);
            shape_origin = new PointD (x, y);

            is_drawing = true;

            hist = new SelectionHistoryItem (Icon, Name);
            hist.TakeSnapshot ();
        }
Ejemplo n.º 25
0
    protected void OnGraphEventsButtonPressEvent(object o, ButtonPressEventArgs args)
    {
        try
        {
            //left button = 1
            if (args.Event.Button == 1)
            {
                double x = args.Event.X;
                double y = args.Event.Y;
                GCurves.GCurve tmp;
                AllCurves.Curves.TryGetValue(CurveSelectBox.ActiveText, out tmp);
                List<PointF> tmpGPoints = new List<PointF>();
                for (int i = 0; i < tmp.Points.Count; i++)
                {
                    tmpGPoints.Add(GetGraphXY(tmp.Points[i].Value));
                }

                for (int i = 0; i < tmp.Points.Count; i++)
                {
                    if (x > tmpGPoints[i].X - 5 && x < tmpGPoints[i].X + 5 && y > tmpGPoints[i].Y - 5 && y < tmpGPoints[i].Y + 5 && !tmp.Points[i].Key)
                    {
                        //hit point:
                        MovePoint = new KeyValuePair<int, bool>(i, true);
                        tmp.SelectedPoint = i;
                        //Fill the Valueboxes with the current value
                        XValBox.Text = (tmp.Points[tmp.SelectedPoint].Value.X + 1).ToString();
                        YValBox.Text = tmp.Points[tmp.SelectedPoint].Value.Y.ToString();
                        RefreshGraph(false);
                        return;
                    }
                    else if (x > tmpGPoints[i].X - 5 && x < tmpGPoints[i].X + 5 && tmp.Points[i].Key) { return; }
                }

                if (x > GrBorLeft + 3 && x < tmpGPoints[tmpGPoints.Count - 1].X - 3 && y < GraphArea.Allocation.Height - GrBor && y > GrBor)
                {
                    tmp.AddPoint(GetValueFromXY((float)x, GraphArea.Allocation.Height - (float)y));
                    MovePoint = new KeyValuePair<int, bool>(tmp.SelectedPoint, true);
                    RefreshGraph(false);
                }
            }
        }
        catch (Exception ex) { ReportError("Graph Mouse Down", ex); }
    }
Ejemplo n.º 26
0
        protected void OnEventVolumeButtonPressEvent(object o, ButtonPressEventArgs args)
        {
            int width;
            int height;
            drawVolume.GdkWindow.GetSize(out width, out height);

            int x = (int) args.Event.X;
            int startInside = 36;
            int endInside = width - 36;
            if (x < startInside) {
                Percentage = 0;
            } else if (x > endInside) {
                Percentage = 100;
            } else {
                Percentage = (x - startInside) * 100 / (endInside - startInside);
            }

            QueueDraw();
        }
Ejemplo n.º 27
0
		void OnMouseClick(object o, ButtonPressEventArgs args)
		{
			var x =  args.Event.X;
			var y = args.Event.Y;
			if (Surface == null)
			{
				return;
			}

			var segment = Surface.Get ().FirstOrDefault (seg => 
				x >= seg.Position.GeometryXStart
				&& x <= seg.Position.GeometryXEnd 
				&& y >= seg.Position.GeometryYStart
				&& y <= seg.Position.GeometryYEnd);

			if (segment == null)
			{
				return;
			}

			if (!segment.Surface.IsButton) {
				AppController.Instance.PrevSegment = AppController.Instance.ClearSelection ();
				segment.Selected = true;
				AppController.Instance.NewSegment = segment;

				AppController.Instance.SetCurrentState ((x - segment.Position.GeometryXStart) < (segment.Position.GeometryWidth / 2));
			} else {
				if (segment.Type == ElementType.Create && CreateCode != null) {
					CreateCode (this, EventArgs.Empty);
				}

				segment.Selected = true;
				QueueDraw ();

				var timer = new Timer(obj => 
					{ 
						segment.Selected = false;
						QueueDraw (); 
					}, null, 150, System.Threading.Timeout.Infinite);
			}

		}
Ejemplo n.º 28
0
    public static void HandleActorButtonPress(object sender, ButtonPressEventArgs args)
    {
        int new_no;

        if (args.Event.Button == 1)
         	new_no = current_shader + 1;
        else
         	new_no = current_shader - 1;

        if (new_no >= 0 & new_no < shader_sources.Length)
        {
            current_shader = new_no;

            Shader shader = new Shader ();

            shader.FragmentSource = shader_sources[current_shader];
            shader.Compile ();

            Actor actor = sender as Actor;
            actor.SetShader (shader);
            actor.SetShaderParam ("radius", 3.0f);
        }
    }
Ejemplo n.º 29
0
 protected void OnConfigListTreeviewButtonPressEvent(object o, ButtonPressEventArgs args)
 {
     if (args.Event.Button == 3)
     {
         Menu m = new Menu();
         MenuItem ViewInfo = new MenuItem("View Config Pack Information");
         ViewInfo.ButtonPressEvent += (sender, argss) =>
             {
                 TreeSelection selection = (o as TreeView).Selection;
                 TreeModel model;
                 TreeIter iter;
                 if(selection.GetSelected(out model, out iter))
                 {
                     var match = ConfigList.FirstOrDefault(x => x.FriendlyName.Equals(model.GetValue(iter, 0).ToString()));
                     ViewPackInfoWindow vpi = new ViewPackInfoWindow(ReadPackInformation(match));
                     vpi.Show();
                 }
             };
         m.Add(ViewInfo);
         m.ShowAll();
         m.Popup();
     }
 }
Ejemplo n.º 30
0
        // handler for mouse click
        private void OnImageClick(object o, ButtonPressEventArgs args)
        {
            if (args.Event.Button == 3) //right click
               		{
                Menu popupMenu = new Menu (); // creates the menu
              		ImageMenuItem menuPopup1 = new ImageMenuItem ("Quit");
              		Image appimg = new Image (Stock.Quit, IconSize.Menu);
              		menuPopup1.Image = appimg; // sets the menu item's image
              		popupMenu.Add (menuPopup1); // adds the menu item to the menu

              		menuPopup1.Activated += new EventHandler (this.OnPopupClick); // event when the user clicks the icon
                popupMenu.ShowAll (); // shows everything
                // pops up the actual menu when the user right clicks
              		popupMenu.Popup (null, null, null, IntPtr.Zero, args.Event.Button, args.Event.Time);
               		}
               		else
               		{
               			Menu mainPopupMenu = new Menu ();

               			ImageMenuItem menuPopupReload = new ImageMenuItem ("Reload");
               			ImageMenuItem menuPopupAbout = new ImageMenuItem ("About");

               			Image reloadimg = new Image (Stock.Refresh, IconSize.Menu);
               			Image aboutimg = new Image (Stock.About, IconSize.Menu);

               			menuPopupReload.Image = reloadimg;
               			menuPopupAbout.Image = aboutimg;

               			mainPopupMenu.Add (menuPopupReload);
               			mainPopupMenu.Add (menuPopupAbout);

               			menuPopupReload.Activated += new EventHandler (this.OnPopupReloadClick);
               			menuPopupAbout.Activated += new EventHandler (this.OnPopupAboutClick);
               			mainPopupMenu.ShowAll ();
               			mainPopupMenu.Popup (null, null, null, IntPtr.Zero, args.Event.Button, args.Event.Time);
               		}
        }
Ejemplo n.º 31
0
 //
 // Events
 //
 private void RyujinxButton_Pressed(object sender, ButtonPressEventArgs args)
 {
     OpenHelper.OpenUrl("https://ryujinx.org");
 }
Ejemplo n.º 32
0
 private void PatreonButton_Pressed(object sender, ButtonPressEventArgs args)
 {
     OpenHelper.OpenUrl("https://www.patreon.com/ryujinx");
 }
Ejemplo n.º 33
0
 private void AmiiboApiButton_Pressed(object sender, ButtonPressEventArgs args)
 {
     OpenHelper.OpenUrl("https://amiiboapi.com");
 }
Ejemplo n.º 34
0
 private void DiscordButton_Pressed(object sender, ButtonPressEventArgs args)
 {
     OpenHelper.OpenUrl("https://discordapp.com/invite/N2FmfVc");
 }
Ejemplo n.º 35
0
 private void GitHubButton_Pressed(object sender, ButtonPressEventArgs args)
 {
     OpenHelper.OpenUrl("https://github.com/Ryujinx/Ryujinx");
 }
Ejemplo n.º 36
0
    protected void OnWorldEventBoxButtonPressEvent(object o, ButtonPressEventArgs args)
    {
        X0 = Convert.ToInt32(args.Event.X);
        Y0 = Convert.ToInt32(args.Event.Y);

        X1 = X0;
        Y1 = Y0;

        if (!Paused)
        {
            return;
        }

        if (args.Event.Button == 3)
        {
            IsDragging = false;

            for (int i = 0; i < Turmites.Count; i++)
            {
                var minX = Turmites[i].MinX;
                var minY = Turmites[i].MinY;
                var maxX = Turmites[i].MaxX;
                var maxY = Turmites[i].MaxY;

                var box = new Box(minX, minY, maxX, maxY);

                var cx = X1 + WorldParameters.CursorX;
                var cy = Y1 + WorldParameters.CursorY;

                if (GtkSelection.Selection.InBox(cx, cy, box))
                {
                    World.ClearWindow(Turmites[i].MinX, Turmites[i].MinY, Turmites[i].MaxX, Turmites[i].MaxY);

                    Turmites.RemoveAt(i);

                    Refresh();

                    System.GC.Collect();
                    System.GC.WaitForPendingFinalizers();

                    break;
                }
            }

            if (Turmites.Count <= 0)
            {
                TurmitesList.Clear();
            }

            UpdateTurmitesList(TurmitesList, Turmites);
        }
        else
        {
            if (args.Event.Button == 1)
            {
                Selected = 0;

                for (int i = 0; i < Turmites.Count; i++)
                {
                    var minX = Turmites[i].MinX;
                    var minY = Turmites[i].MinY;
                    var maxX = Turmites[i].MaxX;
                    var maxY = Turmites[i].MaxY;

                    var box = new Box(minX, minY, maxX, maxY);

                    var cx = X1 + WorldParameters.CursorX;
                    var cy = Y1 + WorldParameters.CursorY;

                    if (GtkSelection.Selection.InBox(cx, cy, box))
                    {
                        IsDragging = true;

                        prevX = X0;
                        prevY = Y0;

                        Selected = i + 1;

                        InitializeSelected();

                        break;
                    }
                }
            }
        }
    }
Ejemplo n.º 37
0
 private void TwitterButton_Pressed(object sender, ButtonPressEventArgs args)
 {
     OpenHelper.OpenUrl("https://twitter.com/RyujinxEmu");
 }
Ejemplo n.º 38
0
 private void Evt_ButtonPressEvent(object o, ButtonPressEventArgs args)
 {
     buttonsPressed[args.Event.Button] = true;
 }
Ejemplo n.º 39
0
        protected override void OnMouseDown(DrawingArea canvas, ButtonPressEventArgs args, Cairo.PointD point)
        {
            ctrlKey = (args.Event.State & ModifierType.ControlMask) != 0;

            //Store the mouse position.
            Point pt = point.ToGdkPoint();

            // Grab focus so we can get keystrokes
            canvas.GrabFocus();

            if (selection != null)
            {
                selection.Dispose();
            }
            selection = PintaCore.Workspace.ActiveDocument.Selection.Clone();

            // A right click allows you to move the text around
            if (args.Event.Button == 3)
            {
                //The user is dragging text with the right mouse button held down, so track the mouse as it moves.
                tracking = true;

                //Remember the position of the mouse before the text is dragged.
                startMouseXY    = point;
                startClickPoint = clickPoint;

                //Change the cursor to indicate that the text is being dragged.
                SetCursor(cursor_hand);

                return;
            }

            // The user clicked the left mouse button
            if (args.Event.Button == 1)
            {
                // If the user is [editing or holding down Ctrl] and clicked
                //within the text, move the cursor to the click location
                if ((is_editing || ctrlKey) && CurrentTextBounds.ContainsCorrect(pt))
                {
                    StartEditing();

                    //Change the position of the cursor to where the mouse clicked.
                    TextPosition p = CurrentTextLayout.PointToTextPosition(pt);
                    CurrentTextEngine.SetCursorPosition(p, true);

                    //Redraw the text with the new cursor position.
                    RedrawText(true, true);

                    return;
                }

                // We're already editing and the user clicked outside the text,
                // commit the user's work, and start a new edit
                switch (CurrentTextEngine.State)
                {
                // We were editing, save and stop
                case TextMode.Uncommitted:
                    StopEditing(true);
                    break;

                // We were editing, but nothing had been
                // keyed. Stop editing.
                case TextMode.Unchanged:
                    StopEditing(false);
                    break;
                }

                if (ctrlKey)
                {
                    //Go through every UserLayer.
                    foreach (UserLayer ul in PintaCore.Workspace.ActiveDocument.UserLayers)
                    {
                        //Check each UserLayer's editable text boundaries to see if they contain the mouse position.
                        if (ul.textBounds.ContainsCorrect(pt))
                        {
                            //The mouse clicked on editable text.

                            //Change the current UserLayer to the Layer that contains the text that was clicked on.
                            PintaCore.Workspace.ActiveDocument.SetCurrentUserLayer(ul);

                            //The user is editing text now.
                            is_editing = true;

                            //Set the cursor in the editable text where the mouse was clicked.
                            TextPosition p = CurrentTextLayout.PointToTextPosition(pt);
                            CurrentTextEngine.SetCursorPosition(p, true);

                            //Redraw the editable text with the cursor.
                            RedrawText(true, true);

                            //Don't check any more UserLayers - stop at the first UserLayer that has editable text containing the mouse position.
                            return;
                        }
                    }
                }
                else
                {
                    if (CurrentTextEngine.State == TextMode.NotFinalized)
                    {
                        //The user is making a new text and the old text hasn't been finalized yet.
                        FinalizeText();
                    }

                    if (!is_editing)
                    {
                        // Start editing at the cursor location
                        clickPoint = pt;
                        CurrentTextEngine.Clear();
                        clickPoint.Offset(0, -CurrentTextLayout.FontHeight / 2);
                        CurrentTextEngine.Origin = clickPoint;
                        StartEditing();
                        RedrawText(true, true);
                    }
                }
            }
        }
Ejemplo n.º 40
0
        void TreeView_ButtonPressEvent(object o, ButtonPressEventArgs args)
        {
            for (int i = 0; i < properties.Count; i++)
            {
                var prop = properties[i];

                if (prop.control is ScrolledWindow scroll)
                {
                    if (scroll.Child is TreeView treeView)
                    {
                        if (treeView.GetPathAtPos((int)args.Event.X, (int)args.Event.Y, out var path, out var col, out var ix, out var iy))
                        {
                            var columnIndex = Array.IndexOf(treeView.Columns, col);
                            var columnDesc  = prop.columns[columnIndex];

                            if (columnDesc.Enabled)
                            {
                                if (columnDesc.Type == ColumnType.Slider && args.Event.Button == 1)
                                {
                                    var area = treeView.GetCellArea(path, col);

                                    dragPath          = path;
                                    dragColumn        = col;
                                    dragPropertyIndex = i;
                                    dragRowIndex      = path.Indices[0];
                                    dragColIndex      = columnIndex;

                                    var percent = (int)Utils.Clamp(Math.Round((args.Event.X - area.Left) / (float)area.Width * 100.0f), 0.0f, 100.0f);

                                    if (treeView.Model.GetIter(out var iter, path))
                                    {
                                        treeView.Model.SetValue(iter, columnIndex, percent);
                                    }

                                    var propIdx = GetPropertyIndex(treeView.Parent);
                                    PropertyChanged?.Invoke(this, propIdx, dragRowIndex, dragColIndex, percent);
                                }
                                else if (columnDesc.Type == ColumnType.Button)
                                {
                                    var cellArea   = treeView.GetBackgroundArea(path, col);
                                    var button     = treeView.Columns[columnIndex].CellRenderers[0] as CellRendererButton;
                                    var buttonRect = button.GetButtonRectangle(cellArea);

                                    if (buttonRect.Contains((int)args.Event.X, (int)args.Event.Y))
                                    {
                                        PropertyClicked?.Invoke(this, ClickType.Button, i, path.Indices[0], columnIndex);
                                    }
                                }
                                else if (columnDesc.Type == ColumnType.DropDown)
                                {
                                    // Open the combo box right away, otherwise we need to click twice.
                                    var column = treeView.Columns[columnIndex];
                                    var combo  = column.CellRenderers[0] as CellRendererCombo;
                                    treeView.SetCursorOnCell(path, column, combo, true);
                                }
                                else
                                {
                                    if (args.Event.Type == EventType.TwoButtonPress)
                                    {
                                        PropertyClicked?.Invoke(this, ClickType.Double, i, path.Indices[0], columnIndex);
                                    }
                                    else if (args.Event.Button == 3)
                                    {
                                        PropertyClicked?.Invoke(this, ClickType.Right, i, path.Indices[0], columnIndex);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 41
0
 private void OnCalendarButtonPressed(object o,
                                      ButtonPressEventArgs args)
 {
     args.RetVal = true;
 }
Ejemplo n.º 42
0
 private void OnButtonPressEvent(object o, ButtonPressEventArgs args)
 {
     ((IButtonController)Element)?.SendPressed();
 }
Ejemplo n.º 43
0
 private void OnPanedButtonPressEvent(object o, ButtonPressEventArgs a)
 {
     snap_lock = true;
 }
 void SuppressClick(object o, ButtonPressEventArgs args)
 {
     args.RetVal = true;
 }
Ejemplo n.º 45
0
 /// <summary>
 /// Performs actions whenever a mouse button has been pressed within the scope drawing area.
 /// </summary>
 private void ScopeEventBox_ButtonPressEventHandler(object o, ButtonPressEventArgs args)
 {
     _currentMouseButtons = args.Event.Button;
     _scopeGraphics.FindAndSelectCursorLines(new Cairo.PointD(args.Event.X, args.Event.Y));
     RefreshGraphics();
 }
Ejemplo n.º 46
0
 private void ContributorsButton_Pressed(object sender, ButtonPressEventArgs args)
 {
     OpenHelper.OpenUrl("https://github.com/Ryujinx/Ryujinx/graphs/contributors?type=a");
 }
Ejemplo n.º 47
0
 protected virtual void OnButtonPressEvent(object o, ButtonPressEventArgs args)
 {
     Close();
 }
Ejemplo n.º 48
0
 protected virtual void OnCalendarButtonPressEvent(object o, ButtonPressEventArgs args)
 {
     args.RetVal = true;
 }