Example #1
0
 public void DragDataHandler(object o, DragDropArgs args)
 {
     if (args.Context.Targets[0].Name == "text/uri-list")
     {
         Gtk.Drag.GetData((Widget)o, args.Context, args.Context.Targets[0], args.Time);
     }
 }
 void TreeView_OnDragDropOutJudged(object sender, DragDropArgs e)
 {
     if (this.OnDragDropOutJudged != null)
     {
         this.OnDragDropOutJudged(this, e);
     }
 }
 private void lstStyles_DragDrop(object sender, DragDropArgs e)
 {
     if (e.Context.Targets.Length != 0)
     {
         Gdk.Atom targ = null;
         foreach (Gdk.Atom t in e.Context.Targets)
         {
             if (t.Name == "STRING")
             {
                 targ = t;
                 lstStyles.DragDataReceived -= lstStyles_DragDataReceived_Motion;
                 lstStyles.DragDataReceived += lstStyles_DragDataReceived_Drop;
                 Gtk.Drag.GetData((Gtk.Widget)sender, e.Context, targ, e.Time);
                 e.RetVal = true;
                 break;
             }
         }
         if (targ == null)
         {
             e.RetVal = false;
         }
     }
     else
     {
         e.RetVal = false;
     }
 }
Example #4
0
        private string CanDragDrop(DragDropArgs e)
        {
            ResourceInfoDragData resourceInfoDragData = e.Context.GetDragData() as ResourceInfoDragData;
            GameProjectFile      gameProjectFile      = Services.ProjectOperations.CurrentSelectedProject.ProjectItem as GameProjectFile;
            string result;

            foreach (ResourceItem current in resourceInfoDragData.Items)
            {
                if (current.FullPath == gameProjectFile.FileName)
                {
                    result = LanguageInfo.MessageBox207_NestedSelfError;
                    return(result);
                }
                Project project = current as Project;
                if (project != null)
                {
                    string text = project.CheckNest(gameProjectFile.Project);
                    if (!string.IsNullOrEmpty(text))
                    {
                        result = text;
                        return(result);
                    }
                }
            }
            result = null;
            return(result);
        }
Example #5
0
 protected void OnDragDropJudgedHandle(object o, DragDropArgs args)
 {
     if (this.OnDragDropOutJudged != null)
     {
         this.OnDragDropOutJudged(o, args);
     }
 }
Example #6
0
 protected override void OnDragDrop(DragDropArgs e)
 {
     using (CompositeTask.Run("ChangeParent"))
     {
         ModelDragData dragData = e.Context.GetDragData() as ModelDragData;
         if (dragData != null && dragData.MetaData != null)
         {
             if (typeof(WidgetObject).IsAssignableFrom(dragData.MetaData.Type))
             {
                 List <VisualObject>     visualObjectList = new List <VisualObject>();
                 NodeObject              nodeObject       = dragData.MetaData.CreateObject();
                 CocoStudio.Model.PointF scene            = SceneTransformHelp.ConvertControlToScene(new CocoStudio.Model.PointF((float)e.X, (float)e.Y));
                 nodeObject.Position = this.TransformToSelf(scene);
                 this.Children.Add(nodeObject);
                 visualObjectList.Add((VisualObject)nodeObject);
                 EventAggregator.Instance.GetEvent <SelectedVisualObjectsChangeEvent>().Publish(new SelectedVisualObjectsChangeEventArgs((IEnumerable <VisualObject>)visualObjectList, (IEnumerable <VisualObject>)visualObjectList, false));
             }
             else
             {
                 LogConfig.Output.Info((object)LanguageInfo.ListViewOutputMessage);
             }
         }
         this.SetObjectState(CSNode.ObjectState.Default);
     }
 }
Example #7
0
        private void GroupsTree_DragDrop(object o, DragDropArgs args)
        {
            Drag.Finish(args.Context, true, true, args.Time);
            if (grid.Selection.Count == 0)
            {
                return;
            }

            TreePath             path;
            TreeViewDropPosition pos;

            groupsPanel.GroupsTree.GetDestRowAtPos(args.X, args.Y, out path, out pos);

            TreeIter row;

            groupsPanel.GroupsTree.Model.GetIter(out row, path);
            G group = (G)groupsPanel.GroupsTree.Model.GetValue(row, 2);

            using (Message messageDialog = GetMovingToGroupMessage(group.Name)) {
                messageDialog.Buttons = MessageButtons.YesNo;
                if (messageDialog.Run() != ResponseType.Yes)
                {
                    return;
                }

                foreach (int selectedIndex in grid.Selection)
                {
                    object entity = grid.Model [selectedIndex];
                    IPersistableEntity <T> persistableEntity = entity as IPersistableEntity <T>;
                    if (persistableEntity == null)
                    {
                        continue;
                    }

                    IHirarchicalEntity hirarchicalEntity = entity as IHirarchicalEntity;
                    if (hirarchicalEntity == null)
                    {
                        continue;
                    }

                    if (group.Id == GroupBase <G> .DeletedGroupId)
                    {
                        hirarchicalEntity.Deleted = true;
                        hirarchicalEntity.GroupId = GroupBase <G> .DefaultGroupId;
                    }
                    else
                    {
                        hirarchicalEntity.Deleted = false;
                        hirarchicalEntity.GroupId = group.Id;
                    }
                    persistableEntity.CommitChanges();
                }
                OnEntitiesChanged(groupsPanel.GetSelectedGroupId());
                OnEntitiesMovedToAGroup();
            }
        }
        public bool CanDrop(DragDropArgs arg)
        {
            if (arg.Data is PostitViewModelA && ((AllowedDataList & AllowedData.A) != 0))
                return true;
            if (arg.Data is PostitViewModelB && ((AllowedDataList & AllowedData.B) != 0))
                return true;
            if (arg.Data is PostitViewModelC && ((AllowedDataList & AllowedData.C) != 0))
                return true; 

            return false;
        }
Example #9
0
        protected override void OnDragDrop(DragDropArgs e)
        {
            if (e.Context.GetDataPresent(typeof(ResourceInfoDragData)))
            {
                string str = this.CanDragDrop(e);
                if (str != null)
                {
                    LogConfig.Output.Error((object)str, (Exception)null);
                    return;
                }
            }
            bool runningCompositeTask = Services.TaskService.IsRunningCompositeTask;

            if (!runningCompositeTask)
            {
                Services.TaskService.BeginCompositeTask("Drag drop GameObject");
            }
            List <VisualObject> visualObjectList = new List <VisualObject>();

            if (e.Context.GetDataPresent(typeof(ResourceInfoDragData)))
            {
                ResourceInfoDragData dragData = (ResourceInfoDragData)e.Context.GetDragData();
                if ((object)dragData == null)
                {
                    return;
                }
                foreach (ResourceItem resourceFile in (IEnumerable <ResourceItem>)dragData.Items)
                {
                    if (!(resourceFile is ResourceFolder))
                    {
                        NodeObject objectFromFile = this.CreateObjectFromFile(resourceFile);
                        if (objectFromFile != null)
                        {
                            this.LoadNodeObject(objectFromFile, new PointF((float)e.X, (float)e.Y));
                            visualObjectList.Add((VisualObject)objectFromFile);
                        }
                    }
                }
            }
            else if (e.Context.GetDataPresent(typeof(ModelDragData)))
            {
                NodeObject gObject = ((ModelDragData)e.Context.GetDragData()).MetaData.CreateObject();
                this.LoadNodeObject(gObject, new PointF((float)e.X, (float)e.Y));
                visualObjectList.Add((VisualObject)gObject);
            }
            this.SetObjectState(CSNode.ObjectState.Default);
            EventAggregator.Instance.GetEvent <SelectedVisualObjectsChangeEvent>().Publish(new SelectedVisualObjectsChangeEventArgs((IEnumerable <VisualObject>)visualObjectList, (IEnumerable <VisualObject>)visualObjectList, false));
            if (runningCompositeTask)
            {
                return;
            }
            Services.TaskService.EndCompositeTask();
        }
Example #10
0
        protected override void OnDragDrop(DragDropArgs e)
        {
            if (e.Context.GetDataPresent(typeof(ResourceInfoDragData)))
            {
                string text = this.CanDragDrop(e);
                if (text != null)
                {
                    LogConfig.Output.Error(text, null);
                    return;
                }
            }
            bool isRunningCompositeTask = Services.TaskService.IsRunningCompositeTask;

            if (!isRunningCompositeTask)
            {
                Services.TaskService.BeginCompositeTask("Drag drop GameObject");
            }
            List <VisualObject> list = new List <VisualObject>();

            if (e.Context.GetDataPresent(typeof(ResourceInfoDragData)))
            {
                ResourceInfoDragData resourceInfoDragData = (ResourceInfoDragData)e.Context.GetDragData();
                if (resourceInfoDragData == null)
                {
                    return;
                }
                foreach (ResourceItem current in resourceInfoDragData.Items)
                {
                    if (!(current is ResourceFolder))
                    {
                        NodeObject nodeObject = this.CreateObjectFromFile(current);
                        if (nodeObject != null)
                        {
                            this.LoadNodeObject(nodeObject, new PointF((float)e.X, (float)e.Y));
                            list.Add(nodeObject);
                        }
                    }
                }
            }
            else if (e.Context.GetDataPresent(typeof(ModelDragData)))
            {
                ModelDragData modelDragData = (ModelDragData)e.Context.GetDragData();
                NodeObject    nodeObject2   = modelDragData.MetaData.CreateObject();
                this.LoadNodeObject(nodeObject2, new PointF((float)e.X, (float)e.Y));
                list.Add(nodeObject2);
            }
            this.SetObjectState(CSNode.ObjectState.Default);
            EventAggregator.Instance.GetEvent <SelectedVisualObjectsChangeEvent>().Publish(new SelectedVisualObjectsChangeEventArgs(list, list, false));
            if (!isRunningCompositeTask)
            {
                Services.TaskService.EndCompositeTask();
            }
        }
Example #11
0
        /// <summary>
        /// Emitted on the drop site when the user drops data on the widget.
        /// </summary>
        void HandleDragDrop(object o, DragDropArgs args)
        {
            args.RetVal = true;
            Gtk.Drag.Finish(args.Context, true, false, args.Time);

            if (drag_data == null)
            {
                return;
            }

            AbstractDockItem item = Owner.HoveredItem;

            if (ItemAcceptsDrop())
            {
                item.AcceptDrop(drag_data);
            }
            else if (providersAcceptDrops)
            {
                AbstractDockItem rightMost = Owner.RightMostItem;
                int newPosition            = rightMost != null ? rightMost.Position : 0;

                foreach (string s in drag_data)
                {
                    AbstractDockItemProvider provider;
                    if (Owner.HoveredProvider != null && Owner.HoveredProvider.CanAcceptDrop(s))
                    {
                        provider = Owner.HoveredProvider;
                    }
                    else if (Owner.Preferences.DefaultProvider.CanAcceptDrop(s))
                    {
                        provider = Owner.Preferences.DefaultProvider;
                    }
                    else
                    {
                        // nothing will take it, continue!
                        continue;
                    }

                    provider.AcceptDrop(s, newPosition);

                    if (FileApplicationProvider.WindowManager != null)
                    {
                        FileApplicationProvider.WindowManager.UpdateTransientItems();
                    }
                }
            }

            ExternalDragActive = false;
        }
Example #12
0
    private static void HandleTargetDragDrop(object sender, DragDropArgs args)
    {
        Console.WriteLine("drop");
        have_drag = false;
        (sender as Gtk.Image).Pixbuf = trashcan_closed_pixbuf;

#if BROKEN                      // Context.Targets is not defined in the bindings
        if (Context.Targets.Length != 0)
        {
            Drag.GetData(sender, context, Context.Targets.Data as Gdk.Atom, args.Time);
            args.RetVal = true;
        }
#endif

        args.RetVal = false;
    }
Example #13
0
        /// <summary>Node has been dropped. Send to presenter.</summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event data.</param>
        private void OnDragDrop(object sender, DragDropArgs e)
        {
            try
            {
                Gdk.Atom target = Drag.DestFindTarget(treeview1, e.Context, null);
                // Get the drop location
                TreePath path;
                TreeIter dest;
                bool     success = false;
                if (treeview1.GetPathAtPos(e.X, e.Y, out path) && treemodel.GetIter(out dest, path) &&
                    target != Gdk.Atom.Intern("GDK_NONE", false))
                {
                    AllowDropArgs args = new AllowDropArgs();
                    args.NodePath = GetFullPath(path);

                    Drag.GetData(treeview1, e.Context, target, e.Time);
                    if (dragDropData != null)
                    {
                        DropArgs dropArgs = new DropArgs();
                        dropArgs.NodePath = GetFullPath(path);

                        dropArgs.DragObject = dragDropData;
                        Gdk.DragAction action = e.Context.SelectedAction;
                        if ((action & Gdk.DragAction.Move) == Gdk.DragAction.Move)
                        {
                            dropArgs.Moved = true;
                        }
                        else if ((action & Gdk.DragAction.Copy) == Gdk.DragAction.Copy)
                        {
                            dropArgs.Copied = true;
                        }
                        else
                        {
                            dropArgs.Linked = true;
                        }
                        Droped(this, dropArgs);
                        success = true;
                    }
                }
                Gtk.Drag.Finish(e.Context, success, e.Context.SelectedAction == Gdk.DragAction.Move, e.Time);
                e.RetVal = success;
            }
            catch (Exception err)
            {
                ShowError(err);
            }
        }
Example #14
0
        private void GroupsTree_DragDrop(object o, DragDropArgs args)
        {
            if (Drag.GetSourceWidget(args.Context) != groupsTree)
            {
                return;
            }

            TreePath             path;
            TreeViewDropPosition pos;

            groupsTree.GetDestRowAtPos(args.X, args.Y, out path, out pos);

            TreeIter row;

            groupsTree.Model.GetIter(out row, path);
            T group = (T)groupsTree.Model.GetValue(row, 2);

            int      insertionIndex = GetInsertionIndex(pos, ref group);
            TreeIter selectedRow;

            if (!groupsTree.Selection.GetSelected(out selectedRow))
            {
                args.RetVal = true;
                Drag.Finish(args.Context, false, false, args.Time);
                return;
            }

            TreePath draggedPath = groupsTree.Model.GetPath(selectedRow);

            if (draggedPath.Equals(path) || draggedPath.IsAncestor(path))
            {
                args.RetVal = true;
                Drag.Finish(args.Context, false, false, args.Time);
                return;
            }

            T draggedGroup = RemoveFromOldPosition(group, selectedRow, ref insertionIndex);

            MoveGroup(draggedGroup, insertionIndex, group);
            args.RetVal = true;
            Drag.Finish(args.Context, true, true, args.Time);
            TreePath movedPath = LoadGroups(false, draggedGroup);

            groupsTree.ExpandToPath(movedPath);
        }
Example #15
0
        /// <summary>Node has been dropped. Send to presenter.</summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event data.</param>
        private void OnDragDrop(object sender, DragDropArgs e)
        {
            Gdk.Atom target = Drag.DestFindTarget(treeview1, e.Context, null);
            // Get the drop location
            TreePath path;
            TreeIter dest;
            bool     success = false;

            if (treeview1.GetPathAtPos(e.X, e.Y, out path) && treemodel.GetIter(out dest, path) &&
                target != Gdk.Atom.Intern("GDK_NONE", false))
            {
                AllowDropArgs Args = new AllowDropArgs();
                Args.NodePath = FullPath(path);

                Drag.GetData(treeview1, e.Context, target, e.Time);
                if (DragDropData != null)
                {
                    DropArgs args = new DropArgs();
                    args.NodePath = FullPath(path);

                    args.DragObject = DragDropData;
                    if (e.Context.Action == Gdk.DragAction.Copy)
                    {
                        args.Copied = true;
                    }
                    else if (e.Context.Action == Gdk.DragAction.Move)
                    {
                        args.Moved = true;
                    }
                    else
                    {
                        args.Linked = true;
                    }
                    Droped(this, args);
                    success = true;
                }
            }
            Gtk.Drag.Finish(e.Context, success, e.Context.Action == Gdk.DragAction.Move, e.Time);
            e.RetVal = success;
        }
Example #16
0
 protected override void OnDragDrop(DragDropArgs e)
 {
     using (CompositeTask.Run("ChangeParent"))
     {
         ModelDragData dragData = e.Context.GetDragData() as ModelDragData;
         if (dragData != null && dragData.MetaData != null)
         {
             if (dragData.MetaData.Type == typeof(PanelObject))
             {
                 NodeObject nodeObject         = dragData.MetaData.CreateObject();
                 CocoStudio.Model.PointF scene = SceneTransformHelp.ConvertControlToScene(new CocoStudio.Model.PointF((float)e.X, (float)e.Y));
                 nodeObject.Position = this.TransformToSelf(scene);
                 this.Children.Add(nodeObject);
             }
             else
             {
                 LogConfig.Output.Error((object)LanguageInfo.OutputMessage);
             }
         }
         this.SetObjectState(CSNode.ObjectState.Default);
     }
 }
Example #17
0
        private string CanDragDrop(DragDropArgs e)
        {
            ResourceInfoDragData dragData    = e.Context.GetDragData() as ResourceInfoDragData;
            GameProjectFile      projectItem = Services.ProjectOperations.CurrentSelectedProject.ProjectItem as GameProjectFile;

            foreach (ResourceItem resourceItem in (IEnumerable <ResourceItem>)dragData.Items)
            {
                if ((FilePath)resourceItem.FullPath == projectItem.FileName)
                {
                    return(LanguageInfo.MessageBox207_NestedSelfError);
                }
                Project project = resourceItem as Project;
                if (project != null)
                {
                    string str = project.CheckNest(projectItem.Project);
                    if (!string.IsNullOrEmpty(str))
                    {
                        return(str);
                    }
                }
            }
            return((string)null);
        }
 public void OnDrop(DragDropArgs args)
 {
     if (args.Source is WorkspaceViewModel sourceWorkspace)
     {
         if (args.Target == app)
         {
             app.SetWorkspaceAsLast(sourceWorkspace);
         }
         else if (args.Target is WorkspaceViewModel targetWorkspace)
         {
             MoveWorkspace(sourceWorkspace, targetWorkspace);
         }
     }
     else if (args.Source is BarcodeViewModel sourceBarcode)
     {
         if (args.Target is BarcodeViewModel targetBarcode)
         {
             MoveBarcode(sourceBarcode, targetBarcode);
         }
         else if (args.Target is WorkspaceViewModel targetWorkspace)
         {
             var sourceBarcodeWorkspace = GetWorkspaceByBarcode(sourceBarcode);
             if (sourceBarcodeWorkspace == targetWorkspace)
             {
                 sourceBarcodeWorkspace.Barcodes.SetAsLast(sourceBarcode);
             }
             else
             {
                 app.MoveBarcodesToWorkspace(new List <BarcodeViewModel> {
                     sourceBarcode
                 }, sourceBarcodeWorkspace, targetWorkspace);
             }
         }
     }
     args.Handled = true;
 }
Example #19
0
 void JisonsTree_DragDrop(object o, DragDropArgs args)
 {
     OnDragDropJudgedHandle(o, args);
 }
Example #20
0
        void Treeview1_DragDrop(object o, DragDropArgs args)
        {
            args.RetVal = true;

            #if GTK3
            if (args.Context.ListTargets().Length > 0)
            {
                Drag.GetData((Widget)o, args.Context, args.Context.ListTargets()[0], args.Time);
            }
            #else
            if (args.Context.Targets.Length > 0)
            {
                Drag.GetData((Widget)o, args.Context, args.Context.Targets[0], args.Time);
            }
            #endif

            var siters = this.siters;
            this.siters = new List <TreeIter>();

            if (siters.Count == 0)
            {
                return;
            }

            TreeViewDropPosition pos;
            TreePath             path;
            TreeIter             iter;

            if (treeview1.GetDestRowAtPos(args.X, args.Y, out path, out pos))
            {
                if (!listStore.GetIter(out iter, path))
                {
                    return;
                }
            }
            else
            {
                iter = GetBaseIter();
                pos  = TreeViewDropPosition.IntoOrAfter;
            }

            if (treeview1.Model.GetValue(iter, 2).ToString() == ID_FILE)
            {
                if (pos == TreeViewDropPosition.IntoOrBefore || pos == TreeViewDropPosition.Before)
                {
                    pos = TreeViewDropPosition.Before;
                }
                else
                {
                    pos = TreeViewDropPosition.After;
                }
            }

            if (pos == TreeViewDropPosition.After || pos == TreeViewDropPosition.Before)
            {
                if (!treeview1.Model.IterParent(out iter, iter))
                {
                    return;
                }
            }

            string dest_folder = (iter.Equals(GetBaseIter())) ? "" : GetPathFromIter(iter) + "/";

            List <string>   sourcedata = new List <string>();
            List <string>   destdata   = new List <string>();
            List <FileType> types      = new List <FileType>();

            foreach (var si in siters)
            {
                string spath = GetPathFromIter(si);
                string dpath = dest_folder + System.IO.Path.GetFileName(spath);

                sourcedata.Add(spath);
                destdata.Add(dpath);

                types.Add((treeview1.Model.GetValue(si, 2).ToString() == ID_FILE) ? FileType.File : FileType.Folder);
            }

            window._controller.Move(sourcedata.ToArray(), destdata.ToArray(), types.ToArray());
            window.UpdateMenus();
        }
 private void OnLinkDrop(UIElement source,UIElement sink,DragDropArgs arg)
 {
     AddLink(source, sink);
 }
 public void OnDrag(DragDropArgs args)
 {
 }
Example #23
0
 protected void OnFileButtonDragDrop(object o, DragDropArgs args)
 {
 }
 private bool OnCanLinkDrop(DragDropArgs arg)
 {
     return true;
 }
Example #25
0
 protected override void OnDragDrop(DragDropArgs e)
 {
     this.CurrentNodeObject.DragDrop(e);
 }
Example #26
0
 protected virtual void OnDragDrop(DragDropArgs e)
 {
 }
Example #27
0
 public void DragDrop(DragDropArgs e)
 {
     this.OnDragDrop(e);
 }
Example #28
0
 void HandleDragDrop(object sender, DragDropArgs args)
 {
     args.RetVal = true;
 }
 void HandleDragDrop1(object o, DragDropArgs args)
 {
 }