banshee r3870 - 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 r3870 - in trunk/banshee: . src/Libraries/Hyena.Gui/Hyena.Data.Gui src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView
- Date: Sat, 3 May 2008 02:01:04 +0100 (BST)
Author: abock
Date: Sat May 3 01:01:04 2008
New Revision: 3870
URL: http://svn.gnome.org/viewvc/banshee?rev=3870&view=rev
Log:
2008-05-02 Aaron Bockover <abock gnome org>
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:
Set the sensitive property on the cell context
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs: Render
insensitive rows by changing the normal text color's alpha
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/CellContext.cs: Added a
Sensitive property since Gtk.StateType sucks and we care to preserve
the selection state for insensitive rows
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/CellContext.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/CellContext.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/CellContext.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/CellContext.cs Sat May 3 01:01:04 2008
@@ -42,6 +42,7 @@
private Gdk.Rectangle area;
private Gdk.Rectangle clip;
private bool text_as_foreground = false;
+ private bool sensitive = true;
public Cairo.Context Context {
get { return context; }
@@ -82,5 +83,10 @@
get { return text_as_foreground; }
set { text_as_foreground = value; }
}
+
+ public bool Sensitive {
+ get { return sensitive; }
+ set { sensitive = value; }
+ }
}
}
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs Sat May 3 01:01:04 2008
@@ -37,14 +37,6 @@
{
public class ColumnCellText : ColumnCell
{
- private static bool use_cairo_pango;
-
- static ColumnCellText ()
- {
- use_cairo_pango = String.IsNullOrEmpty (Environment.GetEnvironmentVariable ("USE_GTK_PANGO"));
- Log.DebugFormat ("Text renderer: {0}", use_cairo_pango ? "Cairo" : "GTK");
- }
-
public delegate string DataHandler ();
private Pango.Weight font_weight = Pango.Weight.Normal;
@@ -65,16 +57,14 @@
context.Layout.SetText (Text);
context.Layout.GetPixelSize (out text_width, out text_height);
- if (use_cairo_pango) {
- context.Context.MoveTo (4, ((int)cellHeight - text_height) / 2);
- context.Context.Color = context.Theme.Colors.GetWidgetColor (
- context.TextAsForeground ? GtkColorClass.Foreground : GtkColorClass.Text, state);
- PangoCairoHelper.ShowLayout (context.Context, context.Layout);
- } else {
- Style.PaintLayout (context.Widget.Style, context.Drawable, state, !context.TextAsForeground,
- context.Clip, context.Widget, "text", context.Area.X + 4,
- context.Area.Y + (((int)cellHeight - text_height) / 2), context.Layout);
+ context.Context.MoveTo (4, ((int)cellHeight - text_height) / 2);
+ Cairo.Color color = context.Theme.Colors.GetWidgetColor (
+ context.TextAsForeground ? GtkColorClass.Foreground : GtkColorClass.Text, state);
+ if (!context.Sensitive) {
+ color.A = 0.3;
}
+ context.Context.Color = color;
+ PangoCairoHelper.ShowLayout (context.Context, context.Layout);
}
protected virtual string Text {
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 May 3 01:01:04 2008
@@ -188,6 +188,7 @@
cairo_context.Translate (area.X, area.Y);
cell_context.Area = area;
cell_context.Clip = clip;
+ cell_context.Sensitive = true;
cell.Render (cell_context, StateType.Normal, area.Width, area.Height);
cairo_context.Restore ();
}
@@ -410,17 +411,17 @@
cell_area.Width = column_cache[ci].Width;
cell_area.X = column_cache[ci].X1 + area.X;
- PaintCell (item, ci, row_index, cell_area, sensitive ? state : StateType.Insensitive, false);
+ PaintCell (item, ci, row_index, cell_area, sensitive, state, false);
}
if (pressed_column_is_dragging && pressed_column_index >= 0) {
cell_area.Width = column_cache[pressed_column_index].Width;
cell_area.X = pressed_column_x_drag - list_interaction_alloc.X;
- PaintCell (item, pressed_column_index, row_index, cell_area, state, true);
+ PaintCell (item, pressed_column_index, row_index, cell_area, sensitive, state, true);
}
}
- private void PaintCell (object item, int column_index, int row_index, Rectangle area,
+ private void PaintCell (object item, int column_index, int row_index, Rectangle area, bool sensitive,
StateType state, bool dragging)
{
ColumnCell cell = column_cache[column_index].Column.GetCell (0);
@@ -437,6 +438,7 @@
cairo_context.Save ();
cairo_context.Translate (area.X, area.Y);
cell_context.Area = area;
+ cell_context.Sensitive = sensitive;
cell.Render (cell_context, dragging ? StateType.Normal : state, area.Width, area.Height);
cairo_context.Restore ();
}
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs Sat May 3 01:01:04 2008
@@ -84,7 +84,7 @@
protected override void OnUnrealized ()
{
- WidgetFlags ^= WidgetFlags.Realized;
+ WidgetFlags &= ~WidgetFlags.Realized;
event_window.UserData = IntPtr.Zero;
event_window.Destroy ();
@@ -103,7 +103,7 @@
protected override void OnUnmapped ()
{
- WidgetFlags ^= WidgetFlags.Mapped;
+ WidgetFlags &= ~WidgetFlags.Mapped;
event_window.Hide ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]