void HandleButtonRelease(object o, ButtonReleaseEventArgs args) { int x = (int) args.Event.X; int y = (int) args.Event.Y; if (moving_button == null || project == null || project.Buttons.Count <= 0) return; Logger.Debug ("AuthoringPaneView.HandleButtonRelease"); if (x + x_delta < 0 || y + y_delta < 0) return; if (x + x_delta + project.Buttons[button].Width > project.Details.Width || y + y_delta + project.Buttons[button].Height > project.Details.Height) return; Logger.Debug ("AuthoringPaneView.HandleButtonRelease. True"); GdkWindow.Cursor = null; project.Buttons[button].X = (int) args.Event.X + x_delta; project.Buttons[button].Y = (int) args.Event.Y + y_delta; moving_button = null; QueueDraw (); }
void HandleButtonPress(object o, ButtonPressEventArgs args) { Logger.Debug ("AuthoringPaneView.HandleButtonPress"); if (project == null) return; if (args.Event.Type == EventType.TwoButtonPress) { DoubleClick (o, args); return; } int x = (int) args.Event.X; int y = (int) args.Event.Y; int b = ButtonIDFromCoordinates (x, y); if (b == -1) return; if (args.Event.Button == 3) { active_item = b; ExtendedMenu menu = new ExtendedMenu (); menu.AddItem (Catalog.GetString ("Element properties"), OnShowElementProperties); menu.AddItem (Catalog.GetString ("Delete element from project"), OnDeleteElement); menu.Popup (args); } button = b; x_delta = x >= project.Buttons[b].X ? project.Buttons[b].X - x: x - project.Buttons[b].X; y_delta = y >= project.Buttons[b].Y ? project.Buttons[b].Y - y: y - project.Buttons[b].Y; moving_button = new Core.Button (x + x_delta, y + y_delta, project.Buttons[b].LinkedId); GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Hand1); QueueDraw (); Logger.Debug ("AuthoringPaneView.HandleButtonPress. Button {0}", project.Buttons[b].LinkedId); }