Re: [Patch] Show/Hide Tag Icons
- From: "John Stowers" <john stowers lists gmail com>
- To: "Warren Baird" <photogeekmtl gmail com>
- Cc: F-Spot list <f-spot-list gnome org>
- Subject: Re: [Patch] Show/Hide Tag Icons
- Date: Thu, 25 May 2006 15:19:22 +1200
Hey,
Attached here and to the bug report is an updated patch that lets users set the displayed size of the tag icon in the tag tree sidebar. At the moment this doesnt change the size of the tag icon in the right click menus or other places.
I am working on another patch which updates all of those places to use the same logic so that the tag icon size setting works globally.
You can select between hidden, small (16x16), medium (24x24) and large (48x48).
Applies cleanly to cvs head
John
On 5/25/06, Warren Baird <photogeekmtl gmail com> wrote:
John Stowers wrote:
> At the moment I have another patch which allows the user to set the tag
> icon size in the tag list but doesnt modify the size of the tag icons in
> other contexts such as the attach tag right click menu. Now i see the
> mess if different sizes everywhere I am thinking that I will make the
> patch adjust the tag icon size in all places except for the very small
> tag icons displayed below the picture thumbnails in the main view
>
> Would this be acceptable / a better solution?
Great work! I was just thinking recently that it would be really nice
to be able to turn off the icons, since I also have a huge, deeply
nested tag tree. Having the small icons is even better!
I might slightly prefer if the menu only changed the tag tree -
generally speaking, I'd like to make those tags smaller so that each tag
takes up less vertical space --- I usually work on a laptop with
1024x768, so being able to squeeze more tags into the tag tree is a
great thing. I'd prefer that the icons in other places stay large -
since the vertical space doesn't matter as much for them...
If you want to share your patch that sets the icon sizes, I'd love to
try it out...
Warren
_______________________________________________
F-spot-list mailing list
F-spot-list gnome org
http://mail.gnome.org/mailman/listinfo/f-spot-list
? patches
Index: MainWindow.cs
===================================================================
RCS file: /cvs/gnome/f-spot/src/MainWindow.cs,v
retrieving revision 1.291
diff -u -p -r1.291 MainWindow.cs
--- MainWindow.cs 24 May 2006 06:59:15 -0000 1.291
+++ MainWindow.cs 25 May 2006 03:07:33 -0000
@@ -77,6 +77,11 @@ public class MainWindow {
[Glade.Widget] MenuItem zoom_in;
[Glade.Widget] MenuItem zoom_out;
+ [Glade.Widget] RadioMenuItem tag_icon_hidden;
+ [Glade.Widget] RadioMenuItem tag_icon_small;
+ [Glade.Widget] RadioMenuItem tag_icon_medium;
+ [Glade.Widget] RadioMenuItem tag_icon_large;
+
[Glade.Widget] RadioMenuItem month;
[Glade.Widget] RadioMenuItem directory;
[Glade.Widget] CheckMenuItem reverse_order;
@@ -127,6 +132,7 @@ public class MainWindow {
string last_import_path;
ModeType view_mode;
bool write_metadata = false;
+ int tag_icon_size = 24;
// Drag and Drop
enum TargetType {
@@ -242,6 +248,8 @@ public class MainWindow {
tag_selection_widget.ButtonPressEvent += HandleTagSelectionButtonPressEvent;
tag_selection_widget.PopupMenu += HandleTagSelectionPopupMenu;
+
+ LoadPreference (Preferences.TAG_ICON_SIZE);
info_box = new InfoBox ();
info_box.VersionIdChanged += HandleInfoBoxVersionIdChange;
@@ -1480,6 +1488,30 @@ public class MainWindow {
null, authors, new string [0], translators, null).Show();
}
+ void HandleTagSizeChange (object sender, EventArgs args)
+ {
+ RadioMenuItem choice = sender as RadioMenuItem;
+
+ //Get this callback twice. Once for the active going menuitem,
+ //once for the inactive leaving one. Ignore the inactive.
+ if (!choice.Active)
+ return;
+
+ if (choice == tag_icon_hidden) {
+ tag_icon_size = 0;
+ } else if (choice == tag_icon_small) {
+ tag_icon_size = 16;
+ } else if (choice == tag_icon_medium) {
+ tag_icon_size = 24;
+ } else if (choice == tag_icon_large) {
+ tag_icon_size = 48;
+ } else {
+ return;
+ }
+
+ tag_selection_widget.SetTagIconSize(tag_icon_size);
+ }
+
public void HandleArrangeByTime (object sender, EventArgs args)
{
if (group_selector.Adaptor is TimeAdaptor)
@@ -1569,6 +1601,8 @@ public class MainWindow {
Preferences.Set (Preferences.SIDEBAR_POSITION, main_hpaned.Position);
Preferences.Set (Preferences.ZOOM, icon_view.Zoom);
+
+ Preferences.Set (Preferences.TAG_ICON_SIZE, tag_icon_size);
tag_selection_widget.SaveExpandDefaults ();
@@ -2390,6 +2424,16 @@ public class MainWindow {
case Preferences.SIDEBAR_POSITION:
if (main_hpaned.Position != (int) val)
main_hpaned.Position = (int) val;
+ break;
+
+ case Preferences.TAG_ICON_SIZE:
+ int s = (int) val;
+ tag_icon_hidden.Active = (s == 0);
+ tag_icon_small.Active = (s == 16);
+ tag_icon_medium.Active = (s == 24);
+ tag_icon_large.Active = (s == 48);
+ tag_icon_size = s;
+ tag_selection_widget.SetTagIconSize(tag_icon_size);
break;
case Preferences.ZOOM:
Index: PixbufUtils.cs
===================================================================
RCS file: /cvs/gnome/f-spot/src/PixbufUtils.cs,v
retrieving revision 1.69
diff -u -p -r1.69 PixbufUtils.cs
--- PixbufUtils.cs 28 Feb 2006 17:50:22 -0000 1.69
+++ PixbufUtils.cs 25 May 2006 03:07:35 -0000
@@ -311,7 +311,7 @@ class PixbufUtils {
public static Pixbuf TagIconFromPixbuf (Pixbuf source)
{
// FIXME 50x50 crashes Pixdata.Serialize... what a mess.
- int size = 52;
+ int size = 48;
Pixbuf tmp = null;
Pixbuf icon = null;
Index: Preferences.cs
===================================================================
RCS file: /cvs/gnome/f-spot/src/Preferences.cs,v
retrieving revision 1.13
diff -u -p -r1.13 Preferences.cs
--- Preferences.cs 19 May 2006 16:21:10 -0000 1.13
+++ Preferences.cs 25 May 2006 03:07:35 -0000
@@ -47,6 +47,7 @@ namespace FSpot
public const string SHOW_TAGS = "/apps/f-spot/ui/show_tags";
public const string SHOW_DATES = "/apps/f-spot/ui/show_dates";
public const string EXPANDED_TAGS = "/apps/f-spot/ui/expanded_tags";
+ public const string TAG_ICON_SIZE = "/apps/f-spot/ui/tag_icon_size";
public const string GLASS_POSITION = "/apps/f-spot/ui/glass_position";
public const string GROUP_ADAPTOR = "/apps/f-spot/ui/group_adaptor";
@@ -120,6 +121,9 @@ namespace FSpot
case SHOW_TAGS:
case SHOW_DATES:
return true;
+
+ case TAG_ICON_SIZE:
+ return 24;
case SIDEBAR_POSITION:
case ZOOM:
Index: TagSelectionWidget.cs
===================================================================
RCS file: /cvs/gnome/f-spot/src/TagSelectionWidget.cs,v
retrieving revision 1.37
diff -u -p -r1.37 TagSelectionWidget.cs
--- TagSelectionWidget.cs 2 Mar 2006 02:23:01 -0000 1.37
+++ TagSelectionWidget.cs 25 May 2006 03:07:36 -0000
@@ -43,11 +43,20 @@ public class TagSelectionWidget : TreeVi
private const int IdColumn = 0;
private const int NameColumn = 1;
+ //FIXME: Alot of this tag icon size selection and resize logic should be moved into the tag class
+ int tag_icon_size = 24;
+
// Selection management.
// Hash of the IDs of the selected tags.
private Hashtable selection;
+ public CellRenderer Icons {
+ get {
+ return icon_render;
+ }
+ }
+
public Tag TagAtPosition (int x, int y)
{
TreePath path;
@@ -296,10 +305,17 @@ public class TagSelectionWidget : TreeVi
SetBackground (renderer, tag);
// FIXME I can't set the Pixbuf to null, not sure if it's a GTK# bug...
- if (tag.Icon != null)
- (renderer as CellRendererPixbuf).Pixbuf = tag.Icon;
- else
+ if (tag.Icon != null) {
+ Pixbuf icon = tag.Icon;
+ //Only resize if necessary
+ if (((icon.Width == tag_icon_size) && (icon.Height == tag_icon_size)) || (tag_icon_size == 0)) {
+ (renderer as CellRendererPixbuf).Pixbuf = icon;
+ } else {
+ (renderer as CellRendererPixbuf).Pixbuf = icon.ScaleSimple(tag_icon_size,tag_icon_size,InterpType.Bilinear);
+ }
+ } else {
(renderer as CellRendererPixbuf).Pixbuf = empty_pixbuf;
+ }
}
private void NameDataFunc (TreeViewColumn column,
@@ -624,9 +640,17 @@ public class TagSelectionWidget : TreeVi
return;
}
+ public void SetTagIconSize(int size)
+ {
+ tag_icon_size = size;
+ Icons.Visible = (size != 0);
+ ColumnsAutosize();
+ }
+
TreeViewColumn check_column;
TreeViewColumn icon_column;
TreeViewColumn name_column;
+ CellRendererPixbuf icon_render;
// Constructor.
public TagSelectionWidget (TagStore tag_store)
@@ -641,7 +665,8 @@ public class TagSelectionWidget : TreeVi
check_column = AppendColumn ("check", toggle_renderer, new TreeCellDataFunc (CheckBoxDataFunc));
check_column.SortColumnId = 0;
- icon_column = AppendColumn ("icon", new CellRendererPixbuf (), new TreeCellDataFunc (IconDataFunc));
+ icon_render = new CellRendererPixbuf ();
+ icon_column = AppendColumn ("icon", icon_render, new TreeCellDataFunc (IconDataFunc));
CellRendererText tr = new CellRendererText ();
tr.Editable = true;
Index: f-spot.glade
===================================================================
RCS file: /cvs/gnome/f-spot/src/f-spot.glade,v
retrieving revision 1.161
diff -u -p -r1.161 f-spot.glade
--- f-spot.glade 24 May 2006 05:48:39 -0000 1.161
+++ f-spot.glade 25 May 2006 03:08:08 -0000
@@ -7598,6 +7598,65 @@ Photo Details</property>
<property name="visible">True</property>
</widget>
</child>
+
+ <child>
+ <widget class="GtkMenuItem" id="tag_icon_size">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Tag Icons</property>
+ <property name="use_underline">True</property>
+
+ <child>
+ <widget class="GtkMenu" id="tag_icon_size_menu">
+
+ <child>
+ <widget class="GtkRadioMenuItem" id="tag_icon_hidden">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Hidden</property>
+ <property name="active">False</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="HandleTagSizeChange" last_modification_time="Fri, 20 Aug 2004 22:26:32 GMT"/>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkRadioMenuItem" id="tag_icon_small">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Small</property>
+ <property name="active">False</property>
+ <property name="use_underline">True</property>
+ <property name="group">tag_icon_hidden</property>
+ <signal name="activate" handler="HandleTagSizeChange" last_modification_time="Fri, 20 Aug 2004 22:26:32 GMT"/>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkRadioMenuItem" id="tag_icon_medium">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Medium</property>
+ <property name="active">False</property>
+ <property name="use_underline">True</property>
+ <property name="group">tag_icon_hidden</property>
+ <signal name="activate" handler="HandleTagSizeChange" last_modification_time="Fri, 20 Aug 2004 22:26:32 GMT"/>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkRadioMenuItem" id="tag_icon_large">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Large</property>
+ <property name="active">False</property>
+ <property name="use_underline">True</property>
+ <property name="group">tag_icon_hidden</property>
+ <signal name="activate" handler="HandleTagSizeChange" last_modification_time="Fri, 20 Aug 2004 22:26:32 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkSeparatorMenuItem" id="separator16">
+ <property name="visible">True</property>
+ </widget>
+ </child>
<child>
<widget class="GtkMenuItem" id="arranged_by">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]