Пример #1
0
        void HandleDragBegin(object sender, DragBeginArgs args)
        {
            Gtk.Drag.SetIconPixbuf (args.Context, image.Pixbuf, 0, 0);

            focusedLiterals.Add (this);

            // Hide the tag and any separators that only exist because of it
            container.Visible = false;
            hiddenWidgets.Add (container);
            foreach (Widget w in LogicWidget.Box.HangersOn (this)) {
                hiddenWidgets.Add (w);
                w.Visible = false;
            }
        }
Пример #2
0
 private void OnDragBegin( object sender, DragBeginArgs args )
 {
     drag_buffer = getSelectedIndexes();
 }
	//
	// IconView Drag Handlers
	//

	void HandleIconViewDragBegin (object sender, DragBeginArgs args)
	{
		Photo [] photos = SelectedPhotos ();
		
		if (photos.Length > 0) {
			int len = Math.Min (photos.Length, 4);
			int size = 48;
			int border  = 2;
			int csize = size/2 + len * size / 2 + 2 * border ;
			
			Pixbuf container = new Pixbuf (Gdk.Colorspace.Rgb, true, 8, csize, csize);
			container.Fill (0x00000000);

			bool use_icon = false;;
			while (len-- > 0) {
				string thumbnail_path = FSpot.ThumbnailGenerator.ThumbnailPath (photos [len].DefaultVersionUri);
				FSpot.PixbufCache.CacheEntry entry = icon_view.Cache.Lookup (thumbnail_path);

				Pixbuf thumbnail = null;
				if (entry != null) {
					if (FSpot.ColorManagement.IsEnabled) {
						//FIXME
						thumbnail = entry.ShallowCopyPixbuf ();
						thumbnail = thumbnail.Copy ();
						FSpot.ColorManagement.ApplyScreenProfile (thumbnail);
					}
					else
						thumbnail = entry.ShallowCopyPixbuf ();
				}
				
				if (thumbnail != null) {
					Pixbuf small = PixbufUtils.ScaleToMaxSize (thumbnail, size, size);				

					int x = border + len * (size/2) + (size - small.Width)/2;
					int y = border + len * (size/2) + (size - small.Height)/2;
					Pixbuf box = new Pixbuf (container, x - border, y - border, 
								 small.Width + 2 * border, small.Height + 2 * border);

					box.Fill (0x000000ff);
					small.CopyArea (0, 0, small.Width, small.Height, container, x, y); 
					
					thumbnail.Dispose ();
					small.Dispose ();
					use_icon = true;
				}
			}
			if (use_icon)
				Gtk.Drag.SetIconPixbuf (args.Context, container, 0, 0);
			container.Dispose ();
		}
	}
	void HandleTagSelectionDragBegin (object sender, DragBeginArgs args)
	{
		Tag [] tags = tag_selection_widget.TagHighlight;
		int len = tags.Length;
		int size = 32;
		int csize = size/2 + len * size / 2 + 2;
		
		Pixbuf container = new Pixbuf (Gdk.Colorspace.Rgb, true, 8, csize, csize);
		container.Fill (0x00000000);
		
		bool use_icon = false;;
		while (len-- > 0) {
			Pixbuf thumbnail = tags[len].Icon;
			
			if (thumbnail != null) {
				Pixbuf small = PixbufUtils.ScaleToMaxSize (thumbnail, size, size);				
				
				int x = len * (size/2) + (size - small.Width)/2;
				int y = len * (size/2) + (size - small.Height)/2;

				small.Composite (container, x, y, small.Width, small.Height, x, y, 1.0, 1.0, Gdk.InterpType.Nearest, 0xff);
				small.Dispose ();

				use_icon = true;
			}
		}
		if (use_icon)
			Gtk.Drag.SetIconPixbuf (args.Context, container, 0, 0);
		container.Dispose ();
	}
Пример #5
0
 void HandleBugsListDragBegin(object o, DragBeginArgs args)
 {
     draggedBugs = GetSelection ();
 }
Пример #6
0
		/// <summary>
		/// Emitted on the drag source when drag is started
		/// </summary>
		void HandleDragBegin (object o, DragBeginArgs args)
		{
			Owner.CursorTracker.RequestHighResolution (this);
			InternalDragActive = true;
			Keyboard.Grab (Owner.GdkWindow, true, Gtk.Global.CurrentEventTime);
			drag_canceled = false;
			
			if (proxy_window != null) {
				EnableDragTo ();
				proxy_window = null;
			}
			
			Gdk.Pixbuf pbuf;
			drag_item = Owner.HoveredItem;
			original_item_pos.Clear ();
			
			// If we are in Reposition Mode or over a non-draggable item
			// dont drag it!
			if (drag_item is INonPersistedItem || RepositionMode)
				drag_item = null;
			
			if (drag_item != null) {
				foreach (AbstractDockItem adi in ProviderForItem (drag_item).Items)
					original_item_pos [adi] = adi.Position;
				
				using (DockySurface surface = new DockySurface ((int) (1.2 * Owner.ZoomedIconSize), (int) (1.2 * Owner.ZoomedIconSize))) {
					pbuf = Owner.HoveredItem.IconSurface (surface, (int) (1.2 * Owner.ZoomedIconSize), Owner.IconSize, 0).LoadToPixbuf ();
				}
			} else {
				pbuf = new Gdk.Pixbuf (Gdk.Colorspace.Rgb, true, 8, 1, 1);
			}
			
			Gtk.Drag.SetIconPixbuf (args.Context, pbuf, pbuf.Width / 2, pbuf.Height / 2);
			pbuf.Dispose ();
			
			// Set up a cursor tracker so we can move the window on the fly
			if (RepositionMode)
				Owner.CursorTracker.CursorPositionChanged += HandleCursorPositionChanged;
		}
Пример #7
0
		protected void HandleDragBegin(object o, DragBeginArgs args)
		{
			Gdk.Pixbuf dragpic = GetDragPixbuf();
			Gtk.Drag.SetIconPixbuf (args.Context, dragpic, 0, 0);
			StoreBuffer();
		}
Пример #8
0
 void HandleDragBegin(object sender, DragBeginArgs args)
 {
     Logger.Debug ("ImagesFileView.HandleDragBegin");
 }
    private void OnDragBegin(object o, DragBeginArgs args)
    {
        if (SelectedObjectNr > -1){
            draggedID = SelectedObjectNr;
            draggedBadguy = badguys[SelectedObjectNr];
            Gtk.Drag.SetIconWidget( args.Context, SpriteViewWidget.CreateWindow(badguySprites[draggedBadguy]), -15, -15);

            dragging = true;
        }
        //update heigth
        SetSizeRequest( -1, ROW_HEIGHT * ((badguys.Count - 1) / TILES_PER_ROW + 1));
        LogManager.Log(LogLevel.Debug, "Dragstart of " + draggedBadguy);
    }
Пример #10
0
 private void BeginDragSetIcon(object o, DragBeginArgs args)
 {
     TreePath path = treeview2.Selection.GetSelectedRows()[0];
       Photo p = GetPhoto(path);
       Drag.SetIconPixbuf(args.Context, p.Thumbnail, 0, 0);
 }
Пример #11
0
 private void OnDragBegin(object o, DragBeginArgs args)
 {
     Gtk.Drag.SetIconWidget( args.Context, SpriteViewWidget.CreateWindow(gameObjectSprites[SelectedObjectNr]), -15, -15);
     LogManager.Log(LogLevel.Debug, "Dragstart");
 }
Пример #12
0
        void Treeview1_DragBegin (object o, DragBeginArgs args)
        {
            List<string> ids;
            GetSelectedTreePath(out siters, out ids);

            if (siters.Contains(GetBaseIter()))
                siters = new List<TreeIter>();
        }
Пример #13
0
 //PREVIEW!!
 private void Drag_Begin(object o, DragBeginArgs args)
 {
     Gdk.Pixbuf icon = MonoUML.IconLibrary.PixbufLoader.GetIconDnD ("unknown_dnd");
     object element = GetSelectedElement();
     object modifiedElement = element;
     DI.Diagram diagram;
     DI.GraphElement graphElement;
     UML.NamedElement umlNamedElement;
     if ((diagram = element as DI.Diagram) != null)
     {
         icon = MonoUML.IconLibrary.PixbufLoader.GetIconDnD ("no_dnd");
         System.Console.WriteLine ("diagram");
     }
     else if ((graphElement = element as DI.GraphElement) != null)
     {
         Uml2SemanticModelBridge bridge = graphElement.SemanticModel as Uml2SemanticModelBridge;
         if (bridge != null)
         {
             if((umlNamedElement = bridge.Element as UML.NamedElement) != null)
             {
                 icon = MonoUML.IconLibrary.PixbufLoader.GetIconDnD ("no_dnd");
                 System.Console.WriteLine ("DI.GraphElement");
                 //umlNamedElement.Name = newName;
                 //modifiedElement = umlNamedElement;
             }
         }
     }
     else if ((umlNamedElement = element as UML.NamedElement) != null)
     {
         string label, elementType, iconName;
         GetLabelAndType (umlNamedElement, out label, out elementType);
         iconName = elementType.ToLower() + "_dnd.png";
         icon = MonoUML.IconLibrary.PixbufLoader.GetIcon (iconName);
         System.Console.WriteLine ("umlNamedElement");
         Hub.Instance.DraggedElement = umlNamedElement;
         //umlNamedElement.Name = newName;
     }
     Gtk.Drag.SetIconPixbuf (args.Context, icon , 0, 0);
 }
Пример #14
0
        protected void OnDrawCupboardDragBegin(object o, DragBeginArgs args)
        {
            int MousePosX, MousePosY;
            drawCupboard.GetPointer(out MousePosX, out MousePosY);

            int CubePosX = (MousePosX - OrderCupboard.CupboardZeroX) / CubePxSize;
            int CubePosY = (MousePosY - OrderCupboard.CupboardZeroY) / CubePxSize;
            Cube cube = OrderCupboard.GetCube(CubePosX, CubePosY);

            if(cube == null) {
                args.RetVal = false;
                Gdk.Drag.Abort(args.Context, args.Context.StartTime);
                return;
            }

            Pixmap pix = new Pixmap(drawCupboard.GdkWindow, cube.CubesH * CubePxSize, cube.CubesV * CubePxSize);

            using (Context cr = Gdk.CairoHelper.Create(pix)) {
                cube.DrawCube(cr, CubePxSize, true);
            }
            Gdk.Pixbuf pixbuf = Gdk.Pixbuf.FromDrawable(pix, Gdk.Colormap.System, 0, 0, 0, 0, cube.CubesH * CubePxSize, cube.CubesV * CubePxSize);
            CurrentDrag.IconPosX = MousePosX - OrderCupboard.CupboardZeroX - (cube.BoardPositionX * CubePxSize);
            CurrentDrag.IconPosY = MousePosY - OrderCupboard.CupboardZeroY - (cube.BoardPositionY * CubePxSize);

            Gtk.Drag.SetIconPixbuf(args.Context, pixbuf, CurrentDrag.IconPosX, CurrentDrag.IconPosY);
            CurrentDrag.FromList = false;
            CurrentDrag.cube = cube;
        }
 private void OnDragBegin(object o, DragBeginArgs args)
 {
     Console.WriteLine("Dragstart");
 }
Пример #16
0
 public void OnDragBegin(object o, DragBeginArgs args)
 {
     Gdk.Pixbuf pb = Pixbuf.LoadFromResource ("text-x-generic.png");
     Gtk.Drag.SetIconPixbuf (args.Context, pb, 0, 0);
 }
Пример #17
0
		public void HandleIconViewDragBegin (object sender, DragBeginArgs args)
		{
			Photo[] photos = SelectedPhotos ();

			if (photos.Length > 0) {
				int len = Math.Min (photos.Length, 4);
				int size = 48;
				int border = 2;
				int csize = size / 2 + len * size / 2 + 2 * border;

				Pixbuf container = new Pixbuf (Gdk.Colorspace.Rgb, true, 8, csize, csize);
				container.Fill (0x00000000);

				bool use_icon = false;
				;
				while (len-- > 0) {
					FSpot.PixbufCache.CacheEntry entry = icon_view.Cache.Lookup (photos [len].DefaultVersion.Uri);

					Pixbuf thumbnail = null;
					if (entry != null) {
						Cms.Profile screen_profile;
						if (FSpot.ColorManagement.Profiles.TryGetValue (Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile)) {
							thumbnail = entry.Pixbuf.Copy ();
							FSpot.ColorManagement.ApplyProfile (thumbnail, screen_profile);
						} else
							thumbnail = entry.ShallowCopyPixbuf ();
					}

					if (thumbnail != null) {
						Pixbuf small = thumbnail.ScaleToMaxSize (size, size);

						int x = border + len * (size / 2) + (size - small.Width) / 2;
						int y = border + len * (size / 2) + (size - small.Height) / 2;
						Pixbuf box = new Pixbuf (container, x - border, y - border,
							             small.Width + 2 * border, small.Height + 2 * border);

						box.Fill (0x000000ff);
						small.CopyArea (0, 0, small.Width, small.Height, container, x, y);

						thumbnail.Dispose ();
						small.Dispose ();
						use_icon = true;
					}
				}
				if (use_icon)
					Gtk.Drag.SetIconPixbuf (args.Context, container, 0, 0);
				container.Dispose ();
			}
		}
Пример #18
0
 /// <summary>Node has begun to be dragged.</summary>
 /// <param name="sender">Event sender.</param>
 /// <param name="e">Event data.</param>
 private void OnDragBegin(object sender, DragBeginArgs e)
 {
     DragStartArgs args = new DragStartArgs();
     args.NodePath = SelectedNode; //  FullPath(e.Item as TreeNode);
     if (DragStarted != null)
     {
         DragStarted(this, args);
         if (args.DragObject != null)
         {
             sourcePathOfItemBeingDragged = args.NodePath;
             dragSourceHandle = GCHandle.Alloc(args.DragObject);
         }
     }
 }
Пример #19
0
 void HandleDragBegin (object o, DragBeginArgs args)
 {
     // Set the drag icon, otherwise it will be a whole page cell rendering,
     // which can be quite large and obscure the drop points
     bool single = SelectedItems.Length == 1;
     Gtk.Drag.SetIconStock (args.Context, single ? Stock.Dnd : Stock.DndMultiple, 0, 0);
 }