banshee r3944 - in trunk/banshee: . src/Libraries/Hyena.Gui/Hyena.Data.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView
- From: abock svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3944 - in trunk/banshee: . src/Libraries/Hyena.Gui/Hyena.Data.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView
- Date: Wed, 21 May 2008 22:03:07 +0000 (UTC)
Author: abock
Date: Wed May 21 22:03:07 2008
New Revision: 3944
URL: http://svn.gnome.org/viewvc/banshee?rev=3944&view=rev
Log:
2008-05-21 Aaron Bockover <abock gnome org>
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/IInteractiveCell.cs:
Added a PointerLeaveEvent method
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs:
Save last cell reference so it can be sent a pointer leave event when
the pointer focuses on another cell or leaves the widget entirely;
computer proper cell damage rectangles for when Scott fixes area redrawing
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs:
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs:
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListViewTestModule.cs:
Implemented PointerLeaveEvent
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/IInteractiveCell.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListViewTestModule.cs
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs Wed May 21 22:03:07 2008
@@ -71,6 +71,11 @@
return false;
}
+ public bool PointerLeaveEvent ()
+ {
+ return false;
+ }
+
public void GetSize (out int width, out int height)
{
width = 2 * Xpad + Size;
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs Wed May 21 22:03:07 2008
@@ -91,6 +91,13 @@
return true;
}
+ public bool PointerLeaveEvent ()
+ {
+ hover_bound = null;
+ hover_value = MinRating - 1;
+ return true;
+ }
+
public void GetSize (out int width, out int height)
{
width = renderer.Width;
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/IInteractiveCell.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/IInteractiveCell.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/IInteractiveCell.cs Wed May 21 22:03:07 2008
@@ -35,5 +35,6 @@
{
bool ButtonEvent (int x, int y, bool pressed, Gdk.EventButton evnt);
bool MotionEvent (int x, int y, Gdk.EventMotion evnt);
+ bool PointerLeaveEvent ();
}
}
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs Wed May 21 22:03:07 2008
@@ -197,13 +197,56 @@
return base.OnKeyPressEvent (press);
}
+#region Cell Event Proxy
+
+ private IInteractiveCell last_icell;
+ private Gdk.Rectangle last_icell_area;
+
private void ProxyEventToCell (Gdk.Event evnt, bool press)
{
+ IInteractiveCell icell;
+ Gdk.Rectangle [] damage = new Gdk.Rectangle[2];
+ damage[0] = ProxyEventToCellNoDraw (evnt, press, out icell);
+
+ if (last_icell != null && last_icell != icell) {
+ if (last_icell.PointerLeaveEvent ()) {
+ damage[1] = last_icell_area;
+ }
+
+ last_icell = null;
+ last_icell_area = Gdk.Rectangle.Zero;
+ }
+
+ if (damage[0].Equals (damage[1])) {
+ if (damage[0].Equals (Gdk.Rectangle.Zero)) {
+ return;
+ }
+
+ // FIXME: Should be QueueDrawArea (damage[0]...)
+ QueueDraw ();
+ } else {
+ // FIXME: When QueueDrawArea works, use this
+ // foreach (Gdk.Rectangle area in damage) {
+ // if (!area.Equals (Gdk.Rectangle.Zero)) {
+ // QueueDrawArea (area.X, area.Y, area.Width, area.Height);
+ // }
+ // }
+
+ QueueDraw ();
+ }
+ }
+
+ private Gdk.Rectangle ProxyEventToCellNoDraw (Gdk.Event evnt, bool press, out IInteractiveCell icell)
+ {
int evnt_x, evnt_y;
+ Gdk.Rectangle damage = Gdk.Rectangle.Zero;
Gdk.EventButton evnt_button = evnt as Gdk.EventButton;
Gdk.EventMotion evnt_motion = evnt as Gdk.EventMotion;
+ bool redraw = false;
+ icell = null;
+
if (evnt_motion != null) {
evnt_x = (int)evnt_motion.X;
evnt_y = (int)evnt_motion.Y;
@@ -211,7 +254,8 @@
evnt_x = (int)evnt_button.X;
evnt_y = (int)evnt_button.Y;
} else {
- return;
+ // Possibly EventCrossing, for the leave event
+ return damage;
}
int y = evnt_y - list_interaction_alloc.Y;
@@ -219,22 +263,24 @@
int row_index = GetRowAtY (y);
if (row_index < 0 || row_index >= Model.Count) {
- return;
+ return damage;
}
Column column = GetColumnAt (x);
if (column == null) {
- return;
+ return damage;
}
CachedColumn cached_column = GetCachedColumnForColumn (column);
ColumnCell cell = column.GetCell (0);
- IInteractiveCell icell = cell as IInteractiveCell;
+ icell = cell as IInteractiveCell;
if (icell == null) {
- return;
+ return damage;
}
+ last_icell = icell;
+
// Turn the view-absolute coordinates into cell-relative coordinates
x -= cached_column.X1;
int page_offset = (int)vadjustment.Value % RowHeight;
@@ -242,32 +288,31 @@
// Bind the row to the cell and then send it a synthesized input event
cell.BindListItem (model[row_index]);
- bool redraw = false;
if (evnt_motion != null) {
- redraw = icell.MotionEvent (x, y, evnt_motion);
+ redraw |= icell.MotionEvent (x, y, evnt_motion);
} else if (evnt_button != null) {
- redraw = icell.ButtonEvent (x, y, press, evnt_button);
+ redraw |= icell.ButtonEvent (x, y, press, evnt_button);
}
// FIXME: This rectangle might not be correct, but I don't
// think QueueDrawArea works at all... maybe Scott has
// some insight? I smell issues with the blit canvases
// --Aaron
- //
- // Gdk.Rectangle rect = new Gdk.Rectangle ();
- // rect.X = cached_column.X1;
- // rect.Y = (int)GetYAtRow (row_index);
- // rect.Width = cached_column.Width;
- // rect.Height = RowHeight;
- //
- // QueueDrawArea (rect.X, rect.Y, rect.Width, rect.Height);
-
if (redraw) {
- QueueDraw (); // OUCH
+ damage.X = cached_column.X1;
+ damage.Y = (int)GetYAtRow (row_index);
+ damage.Width = cached_column.Width;
+ damage.Height = RowHeight;
+
+ last_icell_area = damage;
}
+
+ return damage;
}
+#endregion
+
#region OnButtonPress
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
@@ -539,9 +584,11 @@
protected override bool OnLeaveNotifyEvent (Gdk.EventCrossing evnt)
{
GdkWindow.Cursor = null;
+ if (evnt.Mode == Gdk.CrossingMode.Normal) {
+ ProxyEventToCell (evnt, false);
+ }
return base.OnLeaveNotifyEvent (evnt);
}
-
protected override bool OnFocusInEvent (Gdk.EventFocus evnt)
{
@@ -565,6 +612,10 @@
protected int GetRowAtY (int y)
{
+ if (y < 0) {
+ return -1;
+ }
+
int page_offset = (int)vadjustment.Value % RowHeight;
int first_row = (int)vadjustment.Value / RowHeight;
int row_offset = (y + page_offset) / RowHeight;
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListViewTestModule.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListViewTestModule.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListViewTestModule.cs Wed May 21 22:03:07 2008
@@ -194,6 +194,12 @@
return false;
}
+ public bool PointerLeaveEvent ()
+ {
+ last_pressed_bound = null;
+ return true;
+ }
+
private List<Gdk.Point> Points {
get { return (List<Gdk.Point>)BoundObject; }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]