banshee r3398 - in trunk/banshee: . src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3398 - in trunk/banshee: . src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView
- Date: Sat, 8 Mar 2008 00:12:06 +0000 (GMT)
Author: abock
Date: Sat Mar 8 00:12:06 2008
New Revision: 3398
URL: http://svn.gnome.org/viewvc/banshee?rev=3398&view=rev
Log:
2008-03-07 Aaron Bockover <abock gnome org>
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs:
Calculate the row index for reordering
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:
Render a line to indicate the row reordering index
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs Sat Mar 8 00:12:06 2008
@@ -104,6 +104,8 @@
private uint drag_scroll_timeout_duration = 50;
private double drag_scroll_velocity;
private double drag_scroll_velocity_max = 100.0;
+ private int drag_reorder_row_index = -1;
+ private int drag_reorder_motion_y = -1;
private void StopDragScroll ()
{
@@ -119,10 +121,16 @@
{
if (!Reorderable) {
StopDragScroll ();
+ drag_reorder_row_index = -1;
+ drag_reorder_motion_y = -1;
+ InvalidateListWindow ();
return false;
}
- double scroll_threshold = Allocation.Height * 0.2;
+ drag_reorder_motion_y = y;
+ DragReorderUpdateRow ();
+
+ double scroll_threshold = Allocation.Height * 0.3;
if (y < scroll_threshold) {
drag_scroll_velocity = -1.0 + (y / scroll_threshold);
@@ -148,12 +156,24 @@
protected override void OnDragEnd (Gdk.DragContext context)
{
StopDragScroll ();
+ drag_reorder_row_index = -1;
+ drag_reorder_motion_y = -1;
}
private bool OnDragScrollTimeout ()
{
ScrollTo (vadjustment.Value + (drag_scroll_velocity * drag_scroll_velocity_max));
+ DragReorderUpdateRow ();
return true;
}
+
+ private void DragReorderUpdateRow ()
+ {
+ int row = GetRowAtY (drag_reorder_motion_y + list_alloc.Y) - 1;
+ if (row != drag_reorder_row_index) {
+ drag_reorder_row_index = row;
+ InvalidateListWindow ();
+ }
+ }
}
}
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs Sat Mar 8 00:12:06 2008
@@ -231,6 +231,17 @@
single_list_alloc.Width, single_list_alloc.Height);
}
+ if (ri == drag_reorder_row_index && Reorderable) {
+ list_cr.Save ();
+ list_cr.LineWidth = 1.0;
+ list_cr.Antialias = Antialias.None;
+ list_cr.MoveTo (single_list_alloc.Left, single_list_alloc.Top);
+ list_cr.LineTo (single_list_alloc.Right, single_list_alloc.Top);
+ list_cr.Color = Theme.Colors.GetWidgetColor (GtkColorClass.Text, StateType.Normal);
+ list_cr.Stroke ();
+ list_cr.Restore ();
+ }
+
if (focused_row_index == ri && !Selection.Contains (ri) && HasFocus) {
CairoCorners corners = CairoCorners.All;
@@ -325,7 +336,7 @@
list_cr.Save ();
list_cr.Translate (clip.X, clip.Y);
cell.Render (new CellContext (list_cr, list_pango_layout, this, list_window, theme, area),
- dragging? StateType.Normal : state, area.Width, area.Height);
+ dragging ? StateType.Normal : state, area.Width, area.Height);
list_cr.Restore ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]