blam r683 - trunk/src
- From: cmartin svn gnome org
- To: svn-commits-list gnome org
- Subject: blam r683 - trunk/src
- Date: Tue, 10 Mar 2009 16:14:22 +0000 (UTC)
Author: cmartin
Date: Tue Mar 10 16:14:22 2009
New Revision: 683
URL: http://svn.gnome.org/viewvc/blam?rev=683&view=rev
Log:
Be more generous accepting channels into groups.
If we drop a channel on or around a channel inside a group, the source
channel will get added to the destination's group.
Modified:
trunk/src/ChannelList.cs
Modified: trunk/src/ChannelList.cs
==============================================================================
--- trunk/src/ChannelList.cs (original)
+++ trunk/src/ChannelList.cs Tue Mar 10 16:14:22 2009
@@ -119,37 +119,59 @@
tmp_iter = src.Iter;
GetDestRowAtPos(args.X, args.Y, out path, out pos);
Model.GetIter(out iter, path);
- IChannel dst = Model.GetValue(iter, 0) as ChannelGroup;
+ IChannel dst = Model.GetValue(iter, 0) as IChannel;
- /* We wan't to take a channel out of a group. */
+ /* Not directly over a channel. */
if(pos == TreeViewDropPosition.After || pos == TreeViewDropPosition.Before){
TreePath tmp_path = path.Copy();
tmp_path.Up();
TreePath tmp_path_src = Model.GetPath(src.Iter).Copy();
tmp_path_src.Up();
- if(Model.GetPath(src.Iter).Depth == 1 || // Outside any group.
- tmp_path == tmp_path_src){ // Same parent.
+ if(tmp_path == tmp_path_src){ // Same parent.
+ System.Console.WriteLine("return!");
return;
}
Blam.Application.TheApp.CCollection.Remove(src);
- Blam.Application.TheApp.CCollection.Add(src);
- } else { /* Move into a group or between groups. */
+
+ Model.GetIter(out tmp_iter, tmp_path);
+ IChannel drop_parent = Model.GetValue(tmp_iter, 0) as IChannel;
+ //System.Console.WriteLine("dp: {0} depth:{1}", drop_parent.GetType(), path.Depth);
+ if(path.Depth == 2 && drop_parent is ChannelGroup){ // Dropped inside a group.
+ Blam.Application.TheApp.CCollection.Add(drop_parent as ChannelGroup, src);
+ } else{
+ Blam.Application.TheApp.CCollection.Add(src);
+ }
+ /* Directly over a channel. */
+ } else {
+ TreePath tmp_path_src = Model.GetPath(src.Iter).Copy();
+ tmp_path_src.Up();
+ TreePath dst_path_parent = path.Copy();
+ dst_path_parent.Up();
+
/*
* A channel can't become a group and a group can't be
* inside another group and it doesn't make sense to move
* it into the same group.
* FIXME: Make it possible for a group to be inside another group.
*/
- TreePath tmp_path_src = Model.GetPath(src.Iter).Copy();
- tmp_path_src.Up();
- if(dst is Channel || src is ChannelGroup || dst == null ||
+ if((dst is Channel && path.Depth == 1) || src is ChannelGroup ||
path == tmp_path_src){ // Move to the same group
return;
}
Blam.Application.TheApp.CCollection.Remove(src);
+ /*
+ * If we drop on a channel which is inside a group, we add that channel to
+ * the group.
+ */
+
+ if(dst is Channel && path.Depth == 2){ // Channel inside a group.
+ Model.GetIter(out tmp_iter, dst_path_parent);
+ dst = Model.GetValue(tmp_iter, 0) as ChannelGroup;
+ }
+
Blam.Application.TheApp.CCollection.Add(dst as ChannelGroup, src);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]