
Property changes on: src
___________________________________________________________________
Name: svn:ignore
   - Defines.cs
AssemblyInfo.cs
f-spot
f-spot.exe.config
Cms.dll.config
Makefile
Makefile.in
f-spot.exe
f-spot.exe.mdb
*.dll
*.dll.mdb

   + Defines.cs
AssemblyInfo.cs
f-spot
f-spot.exe.config
Cms.dll.config
Makefile
Makefile.in
f-spot.exe
f-spot.exe.mdb
*.dll
*.dll.mdb
F-Spot.pidb


Index: src/PhotoPopup.cs
===================================================================
--- src/PhotoPopup.cs	(revision 3849)
+++ src/PhotoPopup.cs	(working copy)
@@ -13,6 +13,7 @@
 
 using Mono.Addins;
 
+using Mono.Unix;
 using FSpot.Extensions;
 
 namespace FSpot
@@ -24,10 +25,37 @@
 		{
 		}
 
-		public PhotoPopup () : base ()
+		public PhotoPopup (bool context) : base ()
 		{
+			MenuItem remove_tagarea = new MenuItem(Catalog.GetString ("Remove Tagged Area"));
+			MenuItem tagarea = new MenuItem(Catalog.GetString ("Assign New Tag to Area"));
+			
+			if (context) {
+				if (MainWindow.Toplevel.IsTaggedArea() && (bool)Preferences.Get(Preferences.SHOW_TAGGED_AREAS) == true) {
+					Tag areatag = MainWindow.Toplevel.TaggedArea();
+					MenuItem tag_name = new MenuItem(areatag.Name);
+					tag_name.Sensitive = false;
+					
+					remove_tagarea.Activated += MainWindow.Toplevel.HandleRemoveTagAreaCommand;
+					tagarea.Activated += MainWindow.Toplevel.HandleAttachTagAreaCommand;
+					if (MainWindow.Toplevel.IsTaggedArea()) {
+						Append(tag_name);
+						Append(new SeparatorMenuItem ());
+					}
+				}
+			}
+			
 			foreach (MenuNode node in AddinManager.GetExtensionNodes ("/FSpot/Menus/PhotoPopup"))
 				Append (node.GetMenuItem ());
+			
+			if (context) {
+				if (MainWindow.Toplevel.IsTaggedArea() && (bool)Preferences.Get(Preferences.SHOW_TAGGED_AREAS) == true) {
+					Append(new SeparatorMenuItem ());
+					Append(remove_tagarea);
+					Append(tagarea);
+				}
+			}
+			
 			ShowAll ();
 		}
 
Index: src/f-spot.glade
===================================================================
--- src/f-spot.glade	(revision 3849)
+++ src/f-spot.glade	(working copy)
@@ -413,9 +413,6 @@
                   </packing>
                 </child>
               </widget>
-              <packing>
-                <property name="tab_expand">False</property>
-              </packing>
             </child>
             <child>
               <widget class="GtkLabel" id="label12">
@@ -424,7 +421,6 @@
               </widget>
               <packing>
                 <property name="type">tab</property>
-                <property name="tab_expand">False</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>
@@ -439,7 +435,6 @@
               <packing>
                 <property name="type">tab</property>
                 <property name="position">1</property>
-                <property name="tab_expand">False</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>
@@ -454,7 +449,6 @@
               <packing>
                 <property name="type">tab</property>
                 <property name="position">2</property>
-                <property name="tab_expand">False</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>
@@ -704,8 +698,8 @@
         <child>
           <widget class="GtkHBox" id="hbox4">
             <property name="visible">True</property>
-	    <property name="border_width">12</property>
-	    <property name="spacing">6</property>
+            <property name="border_width">12</property>
+            <property name="spacing">6</property>
             <child>
               <widget class="GtkFrame" id="frame1">
                 <property name="visible">True</property>
@@ -754,16 +748,16 @@
               </packing>
             </child>
             <child>
-              <widget class="GtkFrame" id="frame2">
+              <widget class="GtkFrame" id="frame3">
                 <property name="visible">True</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">GTK_SHADOW_NONE</property>
                 <child>
-                  <widget class="GtkAlignment" id="alignment4">
+                  <widget class="GtkAlignment" id="alignment5">
                     <property name="visible">True</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <widget class="GnomeDateEdit" id="end_dateedit">
+                      <widget class="GnomeDateEdit" id="start_dateedit">
                         <property name="visible">True</property>
                         <property name="dateedit_flags">GNOME_DATE_EDIT_24_HR</property>
                       </widget>
@@ -771,10 +765,11 @@
                   </widget>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label18">
+                  <widget class="GtkLabel" id="label19">
                     <property name="visible">True</property>
-                    <property name="label" translatable="yes">&lt;b&gt;End Date&lt;/b&gt;</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Start Date&lt;/b&gt;</property>
                     <property name="use_markup">True</property>
+                    <property name="wrap_mode">PANGO_WRAP_WORD_CHAR</property>
                   </widget>
                   <packing>
                     <property name="type">label_item</property>
@@ -784,20 +779,20 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">3</property>
+                <property name="position">2</property>
               </packing>
             </child>
             <child>
-              <widget class="GtkFrame" id="frame3">
+              <widget class="GtkFrame" id="frame2">
                 <property name="visible">True</property>
                 <property name="label_xalign">0</property>
                 <property name="shadow_type">GTK_SHADOW_NONE</property>
                 <child>
-                  <widget class="GtkAlignment" id="alignment5">
+                  <widget class="GtkAlignment" id="alignment4">
                     <property name="visible">True</property>
                     <property name="left_padding">12</property>
                     <child>
-                      <widget class="GnomeDateEdit" id="start_dateedit">
+                      <widget class="GnomeDateEdit" id="end_dateedit">
                         <property name="visible">True</property>
                         <property name="dateedit_flags">GNOME_DATE_EDIT_24_HR</property>
                       </widget>
@@ -805,11 +800,10 @@
                   </widget>
                 </child>
                 <child>
-                  <widget class="GtkLabel" id="label19">
+                  <widget class="GtkLabel" id="label18">
                     <property name="visible">True</property>
-                    <property name="label" translatable="yes">&lt;b&gt;Start Date&lt;/b&gt;</property>
+                    <property name="label" translatable="yes">&lt;b&gt;End Date&lt;/b&gt;</property>
                     <property name="use_markup">True</property>
-                    <property name="wrap_mode">PANGO_WRAP_WORD_CHAR</property>
                   </widget>
                   <packing>
                     <property name="type">label_item</property>
@@ -819,7 +813,7 @@
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
           </widget>
@@ -2542,9 +2536,6 @@
                               </packing>
                             </child>
                           </widget>
-                          <packing>
-                            <property name="tab_expand">False</property>
-                          </packing>
                         </child>
                         <child>
                           <widget class="GtkLabel" id="gallery">
@@ -2554,7 +2545,6 @@
                           </widget>
                           <packing>
                             <property name="type">tab</property>
-                            <property name="tab_expand">False</property>
                             <property name="tab_fill">False</property>
                           </packing>
                         </child>
@@ -2741,7 +2731,6 @@
                           </widget>
                           <packing>
                             <property name="position">1</property>
-                            <property name="tab_expand">False</property>
                           </packing>
                         </child>
                         <child>
@@ -2753,7 +2742,6 @@
                           <packing>
                             <property name="type">tab</property>
                             <property name="position">1</property>
-                            <property name="tab_expand">False</property>
                             <property name="tab_fill">False</property>
                           </packing>
                         </child>
@@ -2968,7 +2956,6 @@
                           </widget>
                           <packing>
                             <property name="position">2</property>
-                            <property name="tab_expand">False</property>
                           </packing>
                         </child>
                         <child>
@@ -2980,7 +2967,6 @@
                           <packing>
                             <property name="type">tab</property>
                             <property name="position">2</property>
-                            <property name="tab_expand">False</property>
                             <property name="tab_fill">False</property>
                           </packing>
                         </child>
@@ -3269,7 +3255,7 @@
                         <property name="label" translatable="yes">_Sharpen...</property>
                         <property name="use_underline">True</property>
                         <signal name="activate" handler="HandleSharpen"/>
-                        <accelerator key="s" signal="activate"/>
+                        <accelerator key="s" modifiers="" signal="activate"/>
                       </widget>
                     </child>
                     <child>
@@ -3439,36 +3425,36 @@
                         <property name="use_underline">True</property>
                         <child>
                           <widget class="GtkMenu" id="tag_icon_size_menu">
-			    <child>
-			      <widget class="GtkCheckMenuItem" id="display_dates_menu_item">
-				<property name="visible">True</property>
-				<property name="label" translatable="yes">_Dates</property>
-				<property name="use_underline">True</property>
-				<property name="active">True</property>
-				<signal name="activate" handler="HandleDisplayDates"/>
-			      </widget>
-			    </child>
-			    <child>
-			      <widget class="GtkCheckMenuItem" id="display_tags_menu_item">
-				<property name="visible">True</property>
-				<property name="label" translatable="yes">T_ags</property>
-				<property name="use_underline">True</property>
-				<property name="active">True</property>
-				<signal name="activate" handler="HandleDisplayTags"/>
-			      </widget>
-			    </child>
-			  <child>
-			    <widget class="GtkCheckMenuItem" id="display_ratings_menu_item">
-			      <property name="visible">True</property>
-			      <property name="label" translatable="yes">_Ratings</property>
-			      <property name="use_underline">True</property>
-			      <property name="active">True</property>
-			      <signal name="activate" handler="HandleDisplayRatings"/>
-			    </widget>
-			  </child>
-			  </widget>
-			</child>
-		      </widget>
+                            <child>
+                              <widget class="GtkCheckMenuItem" id="display_dates_menu_item">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Dates</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <signal name="activate" handler="HandleDisplayDates"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkCheckMenuItem" id="display_tags_menu_item">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">T_ags</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <signal name="activate" handler="HandleDisplayTags"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkCheckMenuItem" id="display_ratings_menu_item">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Ratings</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <signal name="activate" handler="HandleDisplayRatings"/>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
                     </child>
                     <child>
                       <widget class="GtkMenuItem" id="components_menu">
@@ -3477,48 +3463,47 @@
                         <property name="use_underline">True</property>
                         <child>
                           <widget class="GtkMenu" id="tag_icon_size_menu">
-			    <child>
-			      <widget class="GtkCheckMenuItem" id="display_sidebar">
-				<property name="visible">True</property>
-				<property name="label" translatable="yes">Side_bar</property>
-				<property name="use_underline">True</property>
-				<property name="active">True</property>
-				<signal name="activate" handler="HandleDisplayInfoSidebar"/>
-				<accelerator key="F9" modifiers="" signal="activate"/>
-			      </widget>
-			    </child>
-			    <child>
-			      <widget class="GtkCheckMenuItem" id="display_timeline">
-				<property name="visible">True</property>
-				<property name="label" translatable="yes">_Timeline</property>
-				<property name="use_underline">True</property>
-				<property name="active">True</property>
-                        	<property name="sensitive">True</property>
-				<signal name="activate" handler="HandleDisplayGroupSelector"/>
-			      </widget>
-			    </child>
-			    <child>
-			      <widget class="GtkCheckMenuItem" id="display_filmstrip">
-				<property name="visible">True</property>
-				<property name="label" translatable="yes">_Filmstrip</property>
-				<property name="use_underline">True</property>
-				<property name="active">True</property>
-                        	<property name="sensitive">False</property>
-				<signal name="activate" handler="HandleDisplayFilmstrip"/>
-			      </widget>
-			    </child>
                             <child>
-			      <widget class="GtkCheckMenuItem" id="display_toolbar">
-				<property name="visible">True</property>
-				<property name="label" translatable="yes">Too_lbar</property>
-				<property name="use_underline">True</property>
-				<property name="active">True</property>
-				<signal name="activate" handler="HandleDisplayToolbar"/>
-			      </widget>
-			    </child>
-			  </widget>
-			</child>
-		      </widget>
+                              <widget class="GtkCheckMenuItem" id="display_sidebar">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Side_bar</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <signal name="activate" handler="HandleDisplayInfoSidebar"/>
+                                <accelerator key="F9" modifiers="" signal="activate"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkCheckMenuItem" id="display_timeline">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Timeline</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <signal name="activate" handler="HandleDisplayGroupSelector"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkCheckMenuItem" id="display_filmstrip">
+                                <property name="visible">True</property>
+                                <property name="sensitive">False</property>
+                                <property name="label" translatable="yes">_Filmstrip</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <signal name="activate" handler="HandleDisplayFilmstrip"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkCheckMenuItem" id="display_toolbar">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">Too_lbar</property>
+                                <property name="use_underline">True</property>
+                                <property name="active">True</property>
+                                <signal name="activate" handler="HandleDisplayToolbar"/>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
                     </child>
                     <child>
                       <widget class="GtkSeparatorMenuItem" id="separator17">
@@ -3610,6 +3595,14 @@
                       </widget>
                     </child>
                     <child>
+                      <widget class="GtkCheckMenuItem" id="show_tagged">
+                        <property name="visible">True</property>
+                        <property name="label" translatable="yes">Show Tagged _Areas</property>
+                        <property name="use_underline">True</property>
+                        <signal name="activate" handler="HandleShowTaggedAreas"/>
+                      </widget>
+                    </child>
+                    <child>
                       <widget class="GtkSeparatorMenuItem" id="separator16">
                         <property name="visible">True</property>
                       </widget>
@@ -3704,8 +3697,6 @@
                         <property name="visible">True</property>
                       </widget>
                     </child>
-
-
                     <child>
                       <widget class="GtkMenuItem" id="rate_submenu">
                         <property name="visible">True</property>
@@ -3713,30 +3704,26 @@
                         <property name="use_underline">True</property>
                         <child>
                           <widget class="GtkMenu" id="rate_find_menu">
-
-				  <child>
-				    <widget class="GtkMenuItem" id="set_rating_filter1">
-				      <property name="visible">True</property>
-				      <property name="label" translatable="yes">_Set Rating filter...</property>
-				      <property name="use_underline">True</property>
-				      <signal name="activate" handler="HandleSetRatingFilter"/>
-				    </widget>
-				  </child>
-
-				  <child>
-				    <widget class="GtkMenuItem" id="clear_rating_filter">
-				      <property name="visible">True</property>
-				      <property name="label" translatable="yes">_Clear Rating Filter</property>
-				      <property name="use_underline">True</property>
-				      <signal name="activate" handler="HandleClearRatingFilter"/>
-				    </widget>
-				  </child>
-
-			  </widget>
-			</child>
-		      </widget>
+                            <child>
+                              <widget class="GtkMenuItem" id="set_rating_filter1">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Set Rating filter...</property>
+                                <property name="use_underline">True</property>
+                                <signal name="activate" handler="HandleSetRatingFilter"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkMenuItem" id="clear_rating_filter">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Clear Rating Filter</property>
+                                <property name="use_underline">True</property>
+                                <signal name="activate" handler="HandleClearRatingFilter"/>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
                     </child>
-
                     <child>
                       <widget class="GtkMenuItem" id="date_submenu">
                         <property name="visible">True</property>
@@ -3744,29 +3731,27 @@
                         <property name="use_underline">True</property>
                         <child>
                           <widget class="GtkMenu" id="date_find_menu">
-
-			    <child>
-			      <widget class="GtkMenuItem" id="set_date_range1">
-				<property name="visible">True</property>
-				<property name="label" translatable="yes">_Set Date Range...</property>
-				<property name="use_underline">True</property>
-				<signal name="activate" handler="HandleSetDateRange"/>
-			      </widget>
-			    </child>
-			    <child>
-			      <widget class="GtkMenuItem" id="clear_date_range">
-				<property name="visible">True</property>
-				<property name="sensitive">False</property>
-				<property name="label" translatable="yes">_Clear Date Range</property>
-				<property name="use_underline">True</property>
-				<signal name="activate" handler="HandleClearDateRange"/>
-			      </widget>
-			    </child>
-			  </widget>
-			</child>
-		      </widget>
+                            <child>
+                              <widget class="GtkMenuItem" id="set_date_range1">
+                                <property name="visible">True</property>
+                                <property name="label" translatable="yes">_Set Date Range...</property>
+                                <property name="use_underline">True</property>
+                                <signal name="activate" handler="HandleSetDateRange"/>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkMenuItem" id="clear_date_range">
+                                <property name="visible">True</property>
+                                <property name="sensitive">False</property>
+                                <property name="label" translatable="yes">_Clear Date Range</property>
+                                <property name="use_underline">True</property>
+                                <signal name="activate" handler="HandleClearDateRange"/>
+                              </widget>
+                            </child>
+                          </widget>
+                        </child>
+                      </widget>
                     </child>
-
                     <child>
                       <widget class="GtkImageMenuItem" id="rolls_submenu">
                         <property name="visible">True</property>
@@ -4056,9 +4041,6 @@
                               <placeholder/>
                             </child>
                           </widget>
-                          <packing>
-                            <property name="tab_expand">False</property>
-                          </packing>
                         </child>
                         <child>
                           <widget class="GtkLabel" id="label2">
@@ -4067,7 +4049,6 @@
                           </widget>
                           <packing>
                             <property name="type">tab</property>
-                            <property name="tab_expand">False</property>
                             <property name="tab_fill">False</property>
                           </packing>
                         </child>
@@ -4080,7 +4061,6 @@
                           </widget>
                           <packing>
                             <property name="position">1</property>
-                            <property name="tab_expand">False</property>
                           </packing>
                         </child>
                         <child>
@@ -4091,7 +4071,6 @@
                           <packing>
                             <property name="type">tab</property>
                             <property name="position">1</property>
-                            <property name="tab_expand">False</property>
                             <property name="tab_fill">False</property>
                           </packing>
                         </child>
@@ -8051,8 +8030,9 @@
   </widget>
   <widget class="GtkDialog" id="customratio_dialog">
     <property name="border_width">5</property>
+    <property name="title" translatable="yes">Selection Constraints</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
     <property name="has_separator">False</property>
-    <property name="title" translatable="yes">Selection Constraints</property>
     <child internal-child="vbox">
       <widget class="GtkVBox" id="dialog-vbox26">
         <property name="visible">True</property>
@@ -8095,6 +8075,7 @@
                         <property name="visible">True</property>
                         <property name="label">gtk-add</property>
                         <property name="use_stock">True</property>
+                        <property name="response_id">0</property>
                       </widget>
                     </child>
                     <child>
@@ -8102,6 +8083,7 @@
                         <property name="visible">True</property>
                         <property name="label">gtk-delete</property>
                         <property name="use_stock">True</property>
+                        <property name="response_id">0</property>
                       </widget>
                       <packing>
                         <property name="position">1</property>
@@ -8112,6 +8094,7 @@
                         <property name="visible">True</property>
                         <property name="label">gtk-go-up</property>
                         <property name="use_stock">True</property>
+                        <property name="response_id">0</property>
                       </widget>
                       <packing>
                         <property name="position">2</property>
@@ -8122,6 +8105,7 @@
                         <property name="visible">True</property>
                         <property name="label">gtk-go-down</property>
                         <property name="use_stock">True</property>
+                        <property name="response_id">0</property>
                       </widget>
                       <packing>
                         <property name="position">3</property>
@@ -8155,6 +8139,7 @@
                 <property name="visible">True</property>
                 <property name="label">gtk-close</property>
                 <property name="use_stock">True</property>
+                <property name="response_id">0</property>
               </widget>
             </child>
           </widget>
@@ -8166,4 +8151,108 @@
       </widget>
     </child>
   </widget>
+  <widget class="GtkDialog" id="attach_tag_dialog">
+    <property name="border_width">6</property>
+    <property name="modal">True</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+    <property name="has_separator">False</property>
+    <child internal-child="vbox">
+      <widget class="GtkVBox" id="dialog-vbox28">
+        <property name="visible">True</property>
+        <property name="spacing">2</property>
+        <child>
+          <widget class="GtkTable" id="table3">
+            <property name="visible">True</property>
+            <property name="n_rows">1</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">6</property>
+            <property name="row_spacing">6</property>
+            <child>
+              <widget class="GtkLabel" id="tag_label">
+                <property name="visible">True</property>
+                <property name="xalign">0</property>
+                <property name="label" translatable="yes">_Tag:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">category_option_menu</property>
+              </widget>
+              <packing>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkOptionMenu" id="tag_option_menu">
+                <property name="width_request">150</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="response_id">0</property>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options"></property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkAlignment" id="alignment13">
+            <property name="visible">True</property>
+            <property name="xalign">0</property>
+            <property name="xscale">0</property>
+            <child>
+              <widget class="GtkLabel" id="already_in_use_label2">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">&lt;small&gt;&lt;/small&gt;</property>
+                <property name="use_markup">True</property>
+              </widget>
+            </child>
+          </widget>
+          <packing>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child internal-child="action_area">
+          <widget class="GtkHButtonBox" id="dialog-action_area28">
+            <property name="visible">True</property>
+            <property name="layout_style">GTK_BUTTONBOX_END</property>
+            <child>
+              <widget class="GtkButton" id="cancel_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">gtk-cancel</property>
+                <property name="use_stock">True</property>
+                <property name="response_id">-6</property>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkButton" id="create_button">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="label">_Attach</property>
+                <property name="use_underline">True</property>
+                <property name="response_id">-5</property>
+              </widget>
+              <packing>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="padding">2</property>
+            <property name="pack_type">GTK_PACK_END</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>
Index: src/PhotoImageView.cs
===================================================================
--- src/PhotoImageView.cs	(revision 3849)
+++ src/PhotoImageView.cs	(working copy)
@@ -218,6 +218,11 @@
 
 			if (prev != this.Pixbuf && prev != null)
 				prev.Dispose ();
+
+			Photo photo = (Photo)Item.Current;
+			if ((bool)Preferences.Get(Preferences.SHOW_TAGGED_AREAS) == true) {
+				this.SetBoxes(photo.Tags);
+			}
 		}
 		
 		private bool ShowProgress {
@@ -306,6 +311,7 @@
 		private void PhotoItemChanged (BrowsablePointer item, BrowsablePointerChangedArgs args) 
 		{
 			System.Console.WriteLine ("item changed");
+			this.ClearBoxes();
 			// If it is just the position that changed fall out
 			if (args != null && 
 			    args.PreviousItem != null &&
Index: src/Widgets/IconView.cs
===================================================================
--- src/Widgets/IconView.cs	(revision 3849)
+++ src/Widgets/IconView.cs	(working copy)
@@ -955,15 +955,15 @@
 
 			if (DisplayTags) {
 				Tag [] tags = photo.Tags;
+				int tag_length = photo.TagCount;
 				Gdk.Rectangle tag_bounds;
-
-				tag_bounds.X = bounds.X + (bounds.Width  + tag_icon_hspacing - tags.Length * (tag_icon_size + tag_icon_hspacing)) / 2;
+				
+				tag_bounds.X = bounds.X + (bounds.Width  + tag_icon_hspacing - tag_length * (tag_icon_size + tag_icon_hspacing)) / 2;				
 				tag_bounds.Y = bounds.Y + bounds.Height - cell_border_width - tag_icon_size + tag_icon_vspacing;
 				tag_bounds.Width = tag_icon_size;
 				tag_bounds.Height = tag_icon_size;
-
 				foreach (Tag t in tags) {
-					if (t == null)
+					if (t == null || t is PhotoTag)
 						continue;
 
 					Pixbuf icon = t.Icon;
@@ -998,9 +998,9 @@
 						}
 					}
 					tag_bounds.X += tag_bounds.Width + tag_icon_hspacing;
+					tag_length++;
 				}
 			}
-
 		}
 
 		private void DrawAllCells (Gdk.Rectangle area)
Index: src/Widgets/QueryView.cs
===================================================================
--- src/Widgets/QueryView.cs	(revision 3849)
+++ src/Widgets/QueryView.cs	(working copy)
@@ -13,14 +13,14 @@
 	
 		protected override bool OnPopupMenu ()
 		{
-			PhotoPopup popup = new PhotoPopup ();
+			PhotoPopup popup = new PhotoPopup (false);
 			popup.Activate ();
 			return true;
 		}
 	
 		protected override void ContextMenu (Gtk.ButtonPressEventArgs args, int cell_num)
 		{
-			PhotoPopup popup = new PhotoPopup ();
+			PhotoPopup popup = new PhotoPopup (false);
 			popup.Activate (this.Toplevel, args.Event);
 		}
 	}
Index: src/Widgets/TagView.cs
===================================================================
--- src/Widgets/TagView.cs	(revision 3849)
+++ src/Widgets/TagView.cs	(working copy)
@@ -30,7 +30,7 @@
 			photo = value;
 
 			if (photo != null && photo.Tags != null) {
-				SetSizeRequest ((thumbnail_size + TAG_ICON_VSPACING) * photo.Tags.Length,
+				SetSizeRequest ((thumbnail_size + TAG_ICON_VSPACING) * photo.TagCount,
 						thumbnail_size);
 			} else {
 				SetSizeRequest (0, thumbnail_size);	
@@ -58,7 +58,7 @@
 		if (tags == null)
 			return base.OnExposeEvent (args);
 
-		SetSizeRequest ((thumbnail_size + TAG_ICON_VSPACING) * tags.Length,
+		SetSizeRequest ((thumbnail_size + TAG_ICON_VSPACING) * photo.TagCount,
 				thumbnail_size);
 
 		int tag_x = Allocation.X;
@@ -67,6 +67,8 @@
 		string [] names = new string [tags.Length];
 		int i = 0;
 		foreach (Tag t in tags) {
+			if (t is PhotoTag)
+					continue;
 			names [i++] = t.Name;
 			
 			Pixbuf icon = t.Icon;
Index: src/PhotoStore.cs
===================================================================
--- src/PhotoStore.cs	(revision 3849)
+++ src/PhotoStore.cs	(working copy)
@@ -127,8 +127,12 @@
 
 		Database.ExecuteNonQuery (
 			"CREATE TABLE photo_tags (     " +
-			"	photo_id      INTEGER, " +
-			"       tag_id        INTEGER  " +
+			"	photo_id          INTEGER, " +
+			"       tag_id        INTEGER, " +
+		    "       x             INTEGER, " +
+		    "       y             INTEGER, " +
+		    "       width         INTEGER, " +
+		    "       height        INTEGER  " +
 			")");
 
 
@@ -210,12 +214,20 @@
 
 	private void GetTags (Photo photo)
 	{
-		SqliteDataReader reader = Database.Query(new DbCommand("SELECT tag_id FROM photo_tags WHERE photo_id = :id", "id", photo.Id));
+		SqliteDataReader reader = Database.Query(new DbCommand("SELECT tag_id, x, y, width, height FROM photo_tags WHERE photo_id = :id", "id", photo.Id));
 
 		while (reader.Read ()) {
 			uint tag_id = Convert.ToUInt32 (reader [0]);
+			int x = Convert.ToInt32(reader [1]);
+			int y = Convert.ToInt32(reader [2]);
+			int width = Convert.ToInt32(reader [3]);
+			int height = Convert.ToInt32(reader [4]);
 			Tag tag = Core.Database.Tags.Get (tag_id) as Tag;
-			photo.AddTagUnsafely (tag);
+			if (width == 0 && height == 0) {
+				photo.AddTagUnsafely ( tag );
+			} else {
+				photo.AddTagUnsafely ( new PhotoTag(tag.Category, tag.Id, tag.Name, new TagCoordinates(x, y, width, height)));
+			}
 		}
 		reader.Close();
 	}		
@@ -260,10 +272,14 @@
 	}
 
 	private void GetAllTags () {
-		SqliteDataReader reader = Database.Query("SELECT photo_id, tag_id FROM photo_tags");
+		SqliteDataReader reader = Database.Query("SELECT photo_id, tag_id, x, y, width, height FROM photo_tags");
 
 		while (reader.Read ()) {
 			uint id = Convert.ToUInt32 (reader [0]);
+			int x = Convert.ToInt32(reader [2]);
+			int y = Convert.ToInt32(reader [3]);
+			int width = Convert.ToInt32(reader [4]);
+			int height = Convert.ToInt32(reader [5]);
 			Photo photo = LookupInCache (id) as Photo;
 				
 			if (photo == null) {
@@ -279,7 +295,11 @@
 		        if (reader [1] != null) {
 				uint tag_id = Convert.ToUInt32 (reader [1]);
 				Tag tag = Core.Database.Tags.Get (tag_id) as Tag;
-				photo.AddTagUnsafely (tag);
+				if (width == 0 && height == 0) {
+					photo.AddTagUnsafely (tag);
+				} else {
+					photo.AddTagUnsafely (new PhotoTag(tag.Category, tag.Id, tag.Name, new TagCoordinates(x, y, width, height)));
+				}
 			}
 		}
 		reader.Close();
@@ -435,13 +455,24 @@
 		// Update tags.
 
 		Database.ExecuteNonQuery (new DbCommand ("DELETE FROM photo_tags WHERE photo_id = :id", "id", photo.Id));
-
 		foreach (Tag tag in photo.Tags) {
-			Database.ExecuteNonQuery (new DbCommand ("INSERT INTO photo_tags (photo_id, tag_id) " +
-                                         " VALUES (:photo_id, :tag_id)",
-                                         "photo_id", photo.Id, "tag_id", tag.Id));
+			int x, y, width, height;
+			if (tag is PhotoTag) {
+				PhotoTag pTag = (PhotoTag) tag;
+				x = pTag.getCoordinates.getX;
+				y = pTag.getCoordinates.getY;
+				width = pTag.getCoordinates.getWidth; 
+				height = pTag.getCoordinates.getHeight;
+			} else {
+				x = 0;
+				y = 0;
+				width = 0;
+				height = 0;
+			};
+			Database.ExecuteNonQuery (new DbCommand ("INSERT INTO photo_tags (photo_id, tag_id, x, y, width, height) " +
+                                         " VALUES (:photo_id, :tag_id, :x, :y, :width, :height)",
+                                         "photo_id", photo.Id, "tag_id", tag.Id, "x", x, "y", y, "width", width, "height", height));
 		}
-
 		// Update versions.
 
 		Database.ExecuteNonQuery (new DbCommand ("DELETE FROM photo_versions WHERE photo_id = :id", "id", photo.Id));
Index: src/FileBrowsableItem.cs
===================================================================
--- src/FileBrowsableItem.cs	(revision 3849)
+++ src/FileBrowsableItem.cs	(working copy)
@@ -48,6 +48,10 @@
 				return null;
 			}
 		}
+		
+		public int TagCount {
+			get { return 0; }
+		}
 
 		public DateTime Time {
 			get {
Index: src/TagCommands.cs
===================================================================
--- src/TagCommands.cs	(revision 3849)
+++ src/TagCommands.cs	(working copy)
@@ -551,5 +551,80 @@
 			this.parent_window = parent_window;
 		}
 	}
+	public class Attach : FSpot.GladeDialog {
+		TagStore tag_store;
 
+
+		[Glade.Widget] private Button create_button;
+		[Glade.Widget] private Label tag_label;
+		[Glade.Widget] private OptionMenu tag_option_menu;
+
+		Gtk.Widget parent_window;
+
+		private ArrayList categories;
+
+		private void PopulateCategories (ArrayList categories, Category parent)
+		{
+			foreach (Tag tag in parent.Children) {
+				if (!(tag is PhotoTag)) {
+					categories.Add (tag);
+					if (tag is Category) {
+						PopulateCategories (categories, tag as Category);
+					}
+				}
+			}
+		}
+
+		private void PopulateCategoryOptionMenu ()
+		{
+			categories = new ArrayList ();
+			categories.Add (tag_store.RootCategory);
+			PopulateCategories (categories, tag_store.RootCategory);
+
+			Menu menu = new Menu ();
+
+			foreach (Tag category in categories) {
+				if (category is Category) {
+					menu.Append (TagMenu.TagMenuItem.IndentedItem (category));
+				} else {
+					menu.Append (new TagMenu.TagMenuItem (category));
+				}
+			}
+
+			tag_option_menu.Sensitive = true;
+
+			menu.ShowAll ();
+			tag_option_menu.Menu = menu;
+		}		
+		
+		public Tag Execute (Tag tag)
+		{
+			this.CreateDialog ("attach_tag_dialog");
+
+			this.Dialog.DefaultResponse = ResponseType.Ok;
+
+			this.Dialog.Title = "Attach New Tag";
+
+			PopulateCategoryOptionMenu ();
+			ResponseType response = (ResponseType) this.Dialog.Run ();
+
+			Tag new_tag = null;
+			if (response == ResponseType.Ok) {
+				if (tag_option_menu.History != 0) {
+					Console.WriteLine("History wasn't 0: " + tag_option_menu.History);
+					new_tag = tag_store.GetTagById((int)((Tag)categories[tag_option_menu.History]).Id);
+				}
+			}
+
+			this.Dialog.Destroy ();
+			return new_tag;
+		}
+
+		public Attach (TagStore tag_store, Gtk.Window parent_window)
+		{
+			this.tag_store = tag_store;
+			this.parent_window = parent_window;
+		}
+	}
+
 }
Index: src/FullScreenView.cs
===================================================================
--- src/FullScreenView.cs	(revision 3849)
+++ src/FullScreenView.cs	(working copy)
@@ -282,7 +282,7 @@
 		{
 			if (args.Event.Type == Gdk.EventType.ButtonPress
 			    && args.Event.Button == 3) {
-				PhotoPopup popup = new PhotoPopup ();
+				PhotoPopup popup = new PhotoPopup (false);
 				popup.Activate (this.Toplevel, args.Event);
 			}
 		}
Index: src/Core/Tag.cs
===================================================================
--- src/Core/Tag.cs	(revision 3849)
+++ src/Core/Tag.cs	(working copy)
@@ -153,4 +153,40 @@
 			return false;
 		}
 	}
+	public class TagCoordinates {
+		int x, y, width, height;
+		
+		public TagCoordinates(int x, int y, int width, int height)
+		{
+			this.x = x;
+			this.y = y;
+			this.width = width;
+			this.height = height;
+		}
+		
+		public int getX {
+			get { return x; }
+		}
+		public int getY {
+			get { return y; }
+		}
+		public int getWidth {
+			get { return width; }
+		}
+		public int getHeight {
+			get { return height; }
+		}
+	}
+	public class PhotoTag : Tag {
+		TagCoordinates tagCoordinates;
+		
+		public PhotoTag(Category category, uint id, string name, TagCoordinates tagCoordinates) : base (category, id, name) {
+			this.tagCoordinates = tagCoordinates;
+		}
+		
+		public TagCoordinates getCoordinates {
+			get { return tagCoordinates; }
+		}
+
+	}
 }
Index: src/Core/PhotoVersion.cs
===================================================================
--- src/Core/PhotoVersion.cs	(revision 3849)
+++ src/Core/PhotoVersion.cs	(working copy)
@@ -26,6 +26,10 @@
 		public Tag [] Tags {
 			get { return photo.Tags; }
 		}
+		
+		public int TagCount {
+			get { return photo.TagCount; }
+		}
 	
 		public System.Uri DefaultVersionUri {
 			get { return uri; }
Index: src/Core/IBrowsableItem.cs
===================================================================
--- src/Core/IBrowsableItem.cs	(revision 3849)
+++ src/Core/IBrowsableItem.cs	(working copy)
@@ -18,6 +18,10 @@
 			get;
 		}
 
+		int TagCount {
+			get;
+		}
+		
 		System.Uri DefaultVersionUri {
 			get;
 		}
Index: src/Core/Photo.cs
===================================================================
--- src/Core/Photo.cs	(revision 3849)
+++ src/Core/Photo.cs	(working copy)
@@ -147,6 +147,21 @@
 				return (Tag []) tags.ToArray (typeof (Tag));
 			}
 		}
+		
+		public int TagCount {
+			get
+			{
+				int x = 0;
+				if (tags == null)
+					return 0;
+				foreach (Tag t in tags) {
+					if (!(t is PhotoTag)) {
+						x++;
+					}
+				}
+				return x;
+			}
+		}
 	
 		private bool loaded = false;
 		public bool Loaded {
@@ -486,6 +501,14 @@
 		// Tag management.
 	
 		// This doesn't check if the tag is already there, use with caution.
+		public void AddTagUnsafely (PhotoTag tag)
+		{
+			if (tags == null)
+				tags = new ArrayList ();
+	
+			tags.Add (tag);
+		}
+		
 		public void AddTagUnsafely (Tag tag)
 		{
 			if (tags == null)
@@ -495,12 +518,28 @@
 		}
 	
 		// This on the other hand does, but is O(n) with n being the number of existing tags.
+		public void AddTag (PhotoTag tag)
+		{
+			if (!HasTag (tag))
+				AddTagUnsafely (tag);
+		}
+		
 		public void AddTag (Tag tag)
 		{
 			if (!HasTag (tag))
 				AddTagUnsafely (tag);
 		}
 	
+		public void AddTag (PhotoTag []taglist)
+		{
+			/*
+			 * FIXME need a better naming convention here, perhaps just
+			 * plain Add.
+			 */
+			foreach (PhotoTag tag in taglist)
+				AddTag (tag);
+		}
+		
 		public void AddTag (Tag []taglist)
 		{
 			/*
@@ -509,19 +548,31 @@
 			 */
 			foreach (Tag tag in taglist)
 				AddTag (tag);
-		}	
+		}
 	
+		public void RemoveTag (PhotoTag tag)
+		{
+			if (HasTag (tag))
+				tags.Remove (tag);
+		}
+		
 		public void RemoveTag (Tag tag)
 		{
 			if (HasTag (tag))
 				tags.Remove (tag);
 		}
 	
+		public void RemoveTag (PhotoTag []taglist)
+		{	
+			foreach (PhotoTag tag in taglist)
+				RemoveTag (tag);
+		}
+		
 		public void RemoveTag (Tag []taglist)
 		{	
 			foreach (Tag tag in taglist)
 				RemoveTag (tag);
-		}	
+		}
 	
 		public void RemoveCategory (Tag []taglist)
 		{
@@ -535,6 +586,14 @@
 			}
 		}
 	
+		public bool HasTag (PhotoTag tag)
+		{
+			if (tags == null)
+				return false;
+	
+			return tags.Contains (tag);
+		}
+		
 		public bool HasTag (Tag tag)
 		{
 			if (tags == null)
Index: src/Preferences.cs
===================================================================
--- src/Preferences.cs	(revision 3849)
+++ src/Preferences.cs	(working copy)
@@ -32,6 +32,7 @@
 		public const string VIEWER_TRANSPARENCY = "/apps/f-spot/viewer/transparency";
 		public const string CUSTOM_CROP_RATIOS = "/apps/f-spot/viewer/custom_crop_ratios";
 		
+		public const string SHOW_TAGGED_AREAS = "/apps/f-spot/ui/show_tagged_areas";
 		public const string SHOW_TOOLBAR = "/apps/f-spot/ui/show_toolbar";
 		public const string SHOW_SIDEBAR = "/apps/f-spot/ui/show_sidebar";
 		public const string SHOW_TIMELINE = "/apps/f-spot/ui/show_timeline";
@@ -130,6 +131,7 @@
 			case GLASS_POSITION:
 				return null;
 
+			case SHOW_TAGGED_AREAS:
 			case SHOW_TOOLBAR:
 			case SHOW_SIDEBAR:
 			case SHOW_TIMELINE:
Index: src/PhotoTagMenu.cs
===================================================================
--- src/PhotoTagMenu.cs	(revision 3849)
+++ src/PhotoTagMenu.cs	(working copy)
@@ -57,7 +57,7 @@
 		if (photos != null) {
 			foreach (Photo p in photos) {
 				foreach (Tag t in p.Tags) {
-					if (!hash.Contains (t.Id)) {
+					if (!hash.Contains (t.Id) && (!(t is PhotoTag))) {
 						hash.Add (t.Id, t);
 					}
 				}
Index: src/MainWindow.cs
===================================================================
--- src/MainWindow.cs	(revision 3849)
+++ src/MainWindow.cs	(working copy)
@@ -1728,6 +1728,14 @@
 
 	}
 
+	public bool IsTaggedArea() {
+		return photo_view.IsTaggedArea();
+	}
+	
+	public Tag TaggedArea() {
+		return photo_view.TaggedArea();
+	}	
+	
 	// Called when the user clicks the X button	
 	void HandleDeleteEvent (object sender, DeleteEventArgs args)
 	{
@@ -2292,6 +2300,42 @@
 		}
 	}
 
+	public void HandleRemoveTagAreaCommand (object sender, EventArgs args)
+	{
+		Tag tag = photo_view.TaggedArea();
+		Photo photo = (Photo)photo_view.Item.Current;
+		photo.RemoveTag(tag);
+		query.Commit(photo_view.Item.Index);
+	}
+	//
+	public void HandleAttachTagAreaCommand(object sender, EventArgs args) {
+		Tag nTag = null;
+		Tag eTag = photo_view.TaggedArea();
+		Photo photo = (Photo)photo_view.Item.Current;
+		TagCommands.Attach attach = new TagCommands.Attach (db.Tags, GetToplevel (sender)); 
+		nTag = attach.Execute (eTag);
+		if (nTag != null) {
+			Console.WriteLine("Got a tag: " + nTag.Id);
+			TagCoordinates coords = ((PhotoTag)eTag).getCoordinates;
+			photo.RemoveTag((PhotoTag)eTag);
+			photo.AddTag(new PhotoTag(nTag.Category, nTag.Id, nTag.Name, coords));
+			query.Commit(photo_view.Item.Index);
+		} else {
+			Console.WriteLine("Didn't get a tag??");
+		}
+	}	
+	
+	public void HandleShowTaggedAreas(object sender, EventArgs args)
+	{
+		Gtk.CheckMenuItem item = sender as Gtk.CheckMenuItem;
+		Preferences.Set(Preferences.SHOW_TAGGED_AREAS, item.Active);		
+		if (ViewMode == ModeType.PhotoView) {
+			Photo photo = (Photo)photo_view.Item.Current;
+			//photo_view.View.SetFaces(photo.Faces, photo.nFaces);
+			photo_view.Reload();
+		}
+	}
+	
 	public void HandleRemoveCommand (object sender, EventArgs args)
 	{
    		Photo[] photos = SelectedPhotos();
Index: src/ImageView.cs
===================================================================
--- src/ImageView.cs	(revision 3849)
+++ src/ImageView.cs	(working copy)
@@ -22,6 +22,20 @@
 	[DllImport ("libfspot")]
 	static extern IntPtr f_image_view_new ();
 
+	[DllImport ("libfspot")]
+	static extern void f_image_view_clear_boxes (IntPtr obj);		
+		
+		
+	[DllImport ("libfspot")]
+	static extern void f_image_view_set_boxes (IntPtr obj, IntPtr x, IntPtr y, IntPtr w, IntPtr h, IntPtr color, int count);
+		
+	[DllImport ("libfspot")]
+	static extern int f_image_view_get_mouse_x (IntPtr obj);
+		
+	[DllImport ("libfspot")]
+	static extern int f_image_view_get_mouse_y (IntPtr obj);
+		
+		
 	[DllImport ("libgobject-2.0-0.dll")]
 	static extern uint g_signal_connect_data (IntPtr obj, String name, SelectionChangedDelegate cb, int key, IntPtr p, int flags);
 
@@ -41,6 +55,53 @@
 				       IntPtr.Zero, 0);
 	}
 
+	public void ClearBoxes() {
+		Console.WriteLine("Clearing boxes");
+		f_image_view_clear_boxes(Raw);
+	}
+		
+	public void SetBoxes(Tag[] tags) {
+			System.IntPtr x, y, w, h, color;
+			f_image_view_clear_boxes(Raw);
+			int[] iX = new int[tags.Length];
+			int[] iY = new int[tags.Length];
+			int[] iW = new int[tags.Length]; 
+			int[] iH = new int[tags.Length];
+			int[] iColor  = new int[tags.Length];
+			int nAreas = 0;
+			foreach (Tag tag in tags) {
+				if (tag is PhotoTag) {
+					PhotoTag pTag = (PhotoTag) tag;
+					iX[nAreas] = pTag.getCoordinates.getX;
+					iY[nAreas] = pTag.getCoordinates.getY;
+					iW[nAreas] = pTag.getCoordinates.getWidth;
+					iH[nAreas] = pTag.getCoordinates.getHeight;
+					nAreas++;
+				}
+			}
+			//Console.WriteLine("Going to set faces, option is: " + Global.ShowFaces);
+			if (nAreas > 0) {
+				x = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(sizeof(int) * nAreas);
+				y = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(sizeof(int) * nAreas);
+				w = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(sizeof(int) * nAreas);
+				h = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(sizeof(int) * nAreas);
+				color = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(sizeof(int) * nAreas);
+				System.Runtime.InteropServices.Marshal.Copy(iX, 0, x, nAreas);
+				System.Runtime.InteropServices.Marshal.Copy(iY, 0, y, nAreas);
+				System.Runtime.InteropServices.Marshal.Copy(iW, 0, w, nAreas);
+				System.Runtime.InteropServices.Marshal.Copy(iH, 0, h, nAreas);
+				System.Runtime.InteropServices.Marshal.Copy(iColor, 0, color, nAreas);
+				f_image_view_set_boxes(Raw, x, y, w, h, color, nAreas);
+			}
+			
+	}
+	public int GetMouseX() {
+		return f_image_view_get_mouse_x(Raw);
+	}
+	public int GetMouseY() {
+		return f_image_view_get_mouse_y(Raw);
+	}
+		
 	protected override void OnDestroyed ()
 	{
 		if (selection_holder != null)
Index: src/PhotoView.cs
===================================================================
--- src/PhotoView.cs	(revision 3849)
+++ src/PhotoView.cs	(working copy)
@@ -47,6 +47,7 @@
 		private Gtk.ToolButton color_button;	
 		private Gtk.ToolButton desaturate_button;
 		private Gtk.ToolButton sepia_button;
+		private Gtk.ToolButton marktag_button;
 		
 		private TreeStore constraints_store;
 		private ComboBox constraints_combo = new ComboBox ();
@@ -68,7 +69,14 @@
 			AddCustom,
 			SameAsPhoto
 		}
+		
+		private enum ProcessType {
+			Crop,
+			RedEye,
+			TagArea
+		};
 
+
 		private List<SelectionRatioDialog.SelectionConstraint> custom_constraints;
 	
 		private static SelectionRatioDialog.SelectionConstraint [] default_constraints = {
@@ -125,9 +133,11 @@
 			if (valid && has_selection) {
 				crop_button.SetTooltip (tips, Catalog.GetString ("Crop photo to selected area"), String.Empty);
 				redeye_button.SetTooltip (tips, Catalog.GetString ("Remove redeye from selected area"), String.Empty);
+				marktag_button.SetTooltip(tips, Catalog.GetString ("Tag selected area"), String.Empty);
 			} else {
 				crop_button.SetTooltip (tips, Catalog.GetString ("Select an area to crop"), null);
 				redeye_button.SetTooltip (tips, Catalog.GetString ("Select an area to remove redeye"), null);
+				marktag_button.SetTooltip(tips, Catalog.GetString ("Selected an area to mark with a tag"), String.Empty);
 			}
 			
 			crop_button.Sensitive = valid;
@@ -135,6 +145,7 @@
 			color_button.Sensitive = valid;
 			desaturate_button.Sensitive = valid;
 			sepia_button.Sensitive = valid;
+			marktag_button.Sensitive = valid;
 		}
 	
 		private void UpdateCountLabel ()
@@ -208,14 +219,14 @@
 		{
 			if (args.Event.Type == EventType.ButtonPress
 			    && args.Event.Button == 3) {
-				PhotoPopup popup = new PhotoPopup ();
+				PhotoPopup popup = new PhotoPopup (true);
 				popup.Activate (this.Toplevel, args.Event);
 			}
 		}
 	
 		protected override bool OnPopupMenu ()
 		{
-			PhotoPopup popup = new PhotoPopup ();
+			PhotoPopup popup = new PhotoPopup (true);
 			popup.Activate (this.Toplevel);
 			return true;
 		}
@@ -232,13 +243,50 @@
 	
 		private void HandleRedEyeButtonClicked (object sender, EventArgs args)
 		{
-			ProcessImage (true);
+			ProcessImage (ProcessType.RedEye);
 		}
 		
 		private void HandleCropButtonClicked (object sender, EventArgs args)
 		{
-			ProcessImage (false);
+			ProcessImage (ProcessType.Crop);
 		}
+		
+		private void HandleMarktagButtonClicked (object sender, EventArgs args)
+		{
+			ProcessImage(ProcessType.TagArea);
+		}
+		
+		public bool IsTaggedArea() {
+			Photo photo = (Photo)View.Item.Current;
+			int x = photo_view.GetMouseX();
+			int y = photo_view.GetMouseY();
+			foreach (Tag tag in photo.Tags) {
+				if (tag is PhotoTag) {
+					PhotoTag pTag = (PhotoTag) tag;
+					TagCoordinates coords = pTag.getCoordinates;
+					if (x >= coords.getX && x <= (coords.getX + coords.getWidth) && y >= coords.getY && y <= (coords.getY + coords.getWidth)) {
+						return true;
+					}
+				}
+			}
+			return false;
+		}
+		
+		public Tag TaggedArea() {
+			Photo photo = (Photo)View.Item.Current;
+			int x = photo_view.GetMouseX();
+			int y = photo_view.GetMouseY();
+			foreach (Tag tag in photo.Tags) {
+				if (tag is PhotoTag) {
+					PhotoTag pTag = (PhotoTag) tag;
+					TagCoordinates coords = pTag.getCoordinates;
+					if (x >= coords.getX && x <= (coords.getX + coords.getWidth) && y >= coords.getY && y <= (coords.getY + coords.getWidth)) {
+						return tag;
+					}
+				}
+			}
+			return null;
+		}
 	
 		private void ShowError (System.Exception e, Photo photo)
 		{
@@ -290,7 +338,7 @@
 	
 		// FIXME this design sucks, I'm just doing it this way while
 		// I redesign the editing system.
-		private void ProcessImage (bool redeye)
+		private void ProcessImage (ProcessType operation)
 		{
 			int x, y, width, height;
 			if (! photo_view.GetSelection (out x, out y, out width, out height)) {
@@ -314,18 +362,31 @@
 					return;
 				}
 				
-				Pixbuf edited;
-				if (redeye) {
+				Pixbuf edited = null;
+				switch (operation) {
+				case ProcessType.RedEye:
 					Gdk.Rectangle area = new Gdk.Rectangle (x, y, width, height);
 					edited = PixbufUtils.RemoveRedeye (original_pixbuf, 
 									   area,
 									   (int) Preferences.Get (Preferences.EDIT_REDEYE_THRESHOLD));
-				} else { // Crop (I told you it was ugly)
+					break;
+				case ProcessType.Crop:
 					edited = new Pixbuf (original_pixbuf.Colorspace, 
 							     original_pixbuf.HasAlpha, original_pixbuf.BitsPerSample,
 							     width, height);
 					
 					original_pixbuf.CopyArea (x, y, width, height, edited, 0, 0);
+					break;
+				case ProcessType.TagArea:
+					TagCoordinates coords = new TagCoordinates(x, y, width, height);
+					TagCommands.Attach attach = new TagCommands.Attach (FSpot.Core.Database.Tags, (Gtk.Window)this.Toplevel);
+					Tag	tag = attach.Execute (null);
+					if (tag != null) {
+						photo.AddTag(new PhotoTag(tag.Category, tag.Id, tag.Name, coords));
+						((PhotoQuery)query).Commit(Item.Index);
+					}
+					return;
+					break;
 				}
 				
 				bool create_version = photo.DefaultVersion.IsProtected;
@@ -524,7 +585,11 @@
 			redeye_button = GtkUtil.ToolButtonFromTheme ("red-eye-remove", Catalog.GetString ("Reduce Red-Eye"), false);
 			toolbar.Insert (redeye_button, -1);
 			redeye_button.Clicked += new EventHandler (HandleRedEyeButtonClicked);
-	
+
+			marktag_button = GtkUtil.ToolButtonFromTheme ("marktag", "Tag Area", false);
+			toolbar.Insert (marktag_button, -1);
+			marktag_button.Clicked += new EventHandler (HandleMarktagButtonClicked);
+			
 			color_button = GtkUtil.ToolButtonFromTheme ("adjust-colors", Catalog.GetString ("Adjust Colors"), false);
 			toolbar.Insert (color_button, -1);
 			color_button.SetTooltip (tips, Catalog.GetString ("Adjust the photo colors"), String.Empty);
Index: src/TagMenu.cs
===================================================================
--- src/TagMenu.cs	(revision 3849)
+++ src/TagMenu.cs	(working copy)
@@ -96,15 +96,17 @@
         public void PopulateFlat (Category cat, Gtk.Menu parent)
 	{
 		foreach (Tag t in cat.Children) {
-			TagMenuItem item = TagMenuItem.IndentedItem (t);
-			parent.Append (item);
-			item.ShowAll ();
+			if (!(t is PhotoTag)) {
+				TagMenuItem item = TagMenuItem.IndentedItem (t);
+				parent.Append (item);
+				item.ShowAll ();
 
-			Category subcat = t as Category;
-			if (subcat != null && subcat.Children.Length != 0) {
-				PopulateFlat (t as Category, parent);
-			} else {
-				item.Activated += HandleActivate;
+				Category subcat = t as Category;
+				if (subcat != null && subcat.Children.Length != 0) {
+					PopulateFlat (t as Category, parent);
+				} else {
+					item.Activated += HandleActivate;
+				}
 			}
 		} 
 	}
@@ -116,27 +118,29 @@
 			dead_pool [i].Destroy ();
 
 		foreach (Tag t in cat.Children) {
-			TagMenuItem item = new TagMenuItem (t);
-			parent.Append (item);
-			item.ShowAll ();
+			if (!(t is PhotoTag)) { 
+				TagMenuItem item = new TagMenuItem (t);
+				parent.Append (item);
+				item.ShowAll ();
 
-			Category subcat = t as Category;
-			if (subcat != null && subcat.Children.Length != 0) {
-				Gtk.Menu submenu = new Menu ();
-				Populate (t as Category, submenu);
+				Category subcat = t as Category;
+				if (subcat != null && subcat.Children.Length != 0) {
+					Gtk.Menu submenu = new Menu ();
+					Populate (t as Category, submenu);
 
-				Gtk.SeparatorMenuItem sep = new Gtk.SeparatorMenuItem ();
-				submenu.Prepend (sep);
-				sep.ShowAll ();
+					Gtk.SeparatorMenuItem sep = new Gtk.SeparatorMenuItem ();
+					submenu.Prepend (sep);
+					sep.ShowAll ();
 
-				TagMenuItem subitem = new TagMenuItem (t);
-				subitem.Activated += HandleActivate;
-				submenu.Prepend (subitem);
-				subitem.ShowAll ();
+					TagMenuItem subitem = new TagMenuItem (t);
+					subitem.Activated += HandleActivate;
+					submenu.Prepend (subitem);
+					subitem.ShowAll ();
 
-				item.Submenu = submenu;
-			} else {
-				item.Activated += HandleActivate;
+					item.Submenu = submenu;
+				} else {
+					item.Activated += HandleActivate;
+				}
 			}
 		} 
 	}

Property changes on: extensions/DevelopInUFraw
___________________________________________________________________
Name: svn:ignore
   - *.dll
*.mpack

   + *.dll
*.mpack
Makefile


Index: extensions/DevelopInUFraw/Makefile
===================================================================
--- extensions/DevelopInUFraw/Makefile	(revision 3849)
+++ extensions/DevelopInUFraw/Makefile	(working copy)
@@ -1,29 +0,0 @@
-all: DevelopInUFRaw.dll
-
-PACKAGES = \
-	-pkg:f-spot \
-	-pkg:gnome-vfs-sharp-2.0
-
-ASSEMBLIES = \
-	-r:Mono.Posix
-
-RESOURCES = \
-	-resource:DevelopInUFRaw.addin.xml
-
-SOURCES = \
-	DevelopInUFRaw.cs
-
-install: all
-	cp *.dll ~/.gnome2/f-spot/addins/
-
-mpack: DevelopInUFraw.dll
-	mautil p DevelopInUFRaw.dll
-
-%.dll: $(SOURCES) DevelopInUFRaw.addin.xml
-	gmcs -target:library $(SOURCES) $(PACKAGES) $(ASSEMBLIES) $(RESOURCES)
-
-clean:
-	rm -f *.dll *~ *.bak .mpack
-
-PHONY:
-	install clean all mpack

Property changes on: extensions/RawPlusJpeg
___________________________________________________________________
Name: svn:ignore
   - RawPlusJpeg.dll
*.mpack
*.pidb

   + RawPlusJpeg.dll
*.mpack
*.pidb
Makefile


Index: extensions/RawPlusJpeg/Makefile
===================================================================
--- extensions/RawPlusJpeg/Makefile	(revision 3849)
+++ extensions/RawPlusJpeg/Makefile	(working copy)
@@ -1,30 +0,0 @@
-ADDIN = RawPlusJpeg
-
-all: $(ADDIN).dll
-
-PACKAGES = \
-	-pkg:gtk-sharp-2.0	\
-	-pkg:f-spot
-
-ASSEMBLIES =
-
-RESOURCES = \
-	-resource:$(ADDIN).addin.xml
-
-SOURCES = \
-	$(ADDIN).cs
-
-$(ADDIN).dll: $(SOURCES) $(ADDIN).addin.xml
-	gmcs -target:library $(SOURCES) $(PACKAGES) $(ASSEMBLIES) $(RESOURCES)
-
-clean:
-	rm -f *.dll *~ *.bak *.mpack
-
-install:
-	cp $(ADDIN).dll ~/.gnome2/f-spot/addins/
-
-mpack: $(ADDIN).dll
-	mautil p $(ADDIN).dll
-
-PHONY:
-	install clean all mpack

Property changes on: extensions/SyncCatalog
___________________________________________________________________
Name: svn:ignore
   - *.dll
*.mpack
*.pidb

   + *.dll
*.mpack
*.pidb
Makefile


Index: extensions/SyncCatalog/Makefile
===================================================================
--- extensions/SyncCatalog/Makefile	(revision 3849)
+++ extensions/SyncCatalog/Makefile	(working copy)
@@ -1,30 +0,0 @@
-ADDIN = SyncCatalog
-
-all: $(ADDIN).dll
-
-PACKAGES = \
-	-pkg:gtk-sharp-2.0	\
-	-pkg:f-spot
-
-ASSEMBLIES =
-
-RESOURCES = \
-	-resource:$(ADDIN).addin.xml
-
-SOURCES = \
-	$(ADDIN).cs
-
-$(ADDIN).dll: $(SOURCES) $(ADDIN).addin.xml
-	gmcs -target:library $(SOURCES) $(PACKAGES) $(ASSEMBLIES) $(RESOURCES)
-
-clean:
-	rm -f *.dll *~ *.bak *.mpack
-
-install: $(ADDIN).dll
-	cp $(ADDIN).dll ~/.gnome2/f-spot/addins/
-
-mpack: $(ADDIN).dll
-	mautil p $(ADDIN).dll
-
-PHONY:
-	install clean all mpack

Property changes on: extensions/FacebookExport
___________________________________________________________________
Name: svn:ignore
   - *.mpack
*.dll

   + *.mpack
*.dll
Makefile


Index: extensions/FacebookExport/Makefile
===================================================================
--- extensions/FacebookExport/Makefile	(revision 3849)
+++ extensions/FacebookExport/Makefile	(working copy)
@@ -1,57 +0,0 @@
-NAME = FacebookExport
-
-SOURCES = \
-	FacebookExport.cs 
-
-PACKAGES = \
-	-pkg:glade-sharp-2.0 \
-	-pkg:gtk-sharp-2.0 \
-	-pkg:f-spot
-
-ASSEMBLIES = \
-	-r:Mono.Posix			\
-	-r:Mono.Facebook.dll
-
-RESOURCES = \
-	-resource:$(NAME).glade \
-	-resource:$(NAME).addin.xml
-
-ASSEMBLY = $(NAME).dll
-
-FACEBOOK_SOURCES =				\
-	Mono.Facebook/Album.cs			\
-	Mono.Facebook/AssemblyInfo.cs		\
-	Mono.Facebook/Error.cs			\
-	Mono.Facebook/Event.cs			\
-	Mono.Facebook/FacebookException.cs	\
-	Mono.Facebook/FacebookParam.cs		\
-	Mono.Facebook/FacebookSession.cs	\
-	Mono.Facebook/Friend.cs			\
-	Mono.Facebook/FriendInfo.cs		\
-	Mono.Facebook/Group.cs			\
-	Mono.Facebook/Location.cs		\
-	Mono.Facebook/Notification.cs		\
-	Mono.Facebook/PeopleList.cs		\
-	Mono.Facebook/Photo.cs			\
-	Mono.Facebook/Responses.cs		\
-	Mono.Facebook/SessionWrapper.cs		\
-	Mono.Facebook/Tag.cs			\
-	Mono.Facebook/User.cs			\
-	Mono.Facebook/Util.cs			
-
-all: $(ASSEMBLY)
-
-Mono.Facebook.dll: $(FACEBOOK_SOURCES)
-	gmcs -target:library -out:$@ $(FACEBOOK_SOURCES) 
-
-install: all
-	cp *.dll ~/.gnome2/f-spot/addins/
-
-mpack: $(ASSEMBLY)
-	mautil p $(ASSEMBLY)
-
-$(ASSEMBLY): $(SOURCES) $(NAME).addin.xml Mono.Facebook.dll
-	gmcs -target:library -out:$@ $(SOURCES) $(PACKAGES) $(ASSEMBLIES) $(RESOURCES) 
-
-clean:
-	rm -f $(ASSEMBLY) *~ *.bak *.mpack *.gladep *.dll
Index: libeog/image-view.c
===================================================================
--- libeog/image-view.c	(revision 3849)
+++ libeog/image-view.c	(working copy)
@@ -700,7 +700,7 @@
 					      pixels,
 					      rowstride,
 					      d.x0 - xofs, d.y0 - yofs);
-
+		paint_extra (view, &r);
 		return;
 	}
 
Index: libfspot/f-image-view.c
===================================================================
--- libfspot/f-image-view.c	(revision 3849)
+++ libfspot/f-image-view.c	(working copy)
@@ -88,6 +88,14 @@
 	int button_press_x, button_press_y;
 	int drag_x_offset, drag_y_offset;
 
+	int *boxesX;
+	int *boxesY;
+	int *boxesW;
+	int *boxesH;
+	int *boxesC;
+	int boxesCount;
+
+	int curX, curY;
 	/* The current selection.  */
 	Selection selection;
 
@@ -239,9 +247,49 @@
 	gdk_cursor_unref (cursor);
 }
 
+void f_draw_box(FImageView *image_view, int x, int y, int width, int height, int color) {
+	int x1 = x;
+	int x2 = x1 + width;
+	int y1 = y;
+	int y2 = y1 + height;
+	float r,g,b;
+	r = 0;
+	g = 1;
+	b = 0;
+	GdkRectangle zone;
+	cairo_t *ctx;
+	GdkRegion *other = gdk_region_new ();
+	GdkRegion *sub;
+	GdkPixbuf *pixbuf = image_view_get_pixbuf (IMAGE_VIEW(image_view));
+	if (pixbuf != NULL) {
+		image_coords_to_window(image_view, x1, y1, &x1, &y1);
+	    image_coords_to_window(image_view, x2, y2, &x2, &y2);
+	
+		zone.x = x1;
+		zone.y = y1;
+		zone.width = x2 - x1;
+		zone.height = y2 - y1;
+		gdk_region_union_with_rect(other, &zone);
+		
+		zone.x = x1 + 2;
+		zone.y = y1 + 2;
+		zone.width = (x2 - x1) - 4;
+		zone.height = (y2 - y1) - 4;
+		sub = gdk_region_rectangle(&zone);
+		gdk_region_subtract(other, sub);
+		gdk_region_destroy (sub);
 
+		ctx = gdk_cairo_create (GTK_WIDGET (image_view)->window);
+		cairo_set_source_rgba (ctx, r, g, b, 1);
+		gdk_cairo_region (ctx, other);
+	    cairo_fill (ctx);
+	    cairo_destroy (ctx);
+	    gdk_region_destroy (other);
+	}
+}
 
 
+
 /* Utilty functions for selection handling.  */
 
 /* This uses GDK_INVERT so if called a second time without the selection
@@ -544,9 +592,13 @@
 impl_paint_extra (ImageView *iv,
 		  GdkRectangle *area)
 {
-#if FALSE
+	int i;
 	FImageView *image_view = (FImageView *) iv;
 	FImageViewPrivate *priv = image_view->priv;
+	for (i = 0; i < priv->boxesCount; i++) {
+		f_draw_box(image_view, priv->boxesX[i], priv->boxesY[i], priv->boxesW[i], priv->boxesH[i], priv->boxesC[i]);
+	}
+	#if FALSE
 	int x1, y1, x2, y2;
 	cairo_t *ctx;
 	GdkRegion *selection;
@@ -655,6 +707,8 @@
 	FImageViewPrivate *priv = image_view->priv;
 	Mode mode;
 
+	int tx, ty;
+
 	if (priv->pointer_mode == F_IMAGE_VIEW_POINTER_MODE_SCROLL)
 		return (* GTK_WIDGET_CLASS (parent_class)->button_press_event) (widget, button_event);
 	else if (priv->pointer_mode == F_IMAGE_VIEW_POINTER_MODE_NONE)
@@ -666,6 +720,15 @@
 		return FALSE;
 	}
 
+	if (button_event->type == GDK_BUTTON_PRESS && button_event->button == 3) {
+		f_image_view_window_coords_to_image (image_view,
+						     button_event->x, button_event->y,
+						     &tx, &ty);
+		priv->curX = tx;
+		priv->curY = ty;
+		return FALSE;
+	}
+
 	if (button_event->type != GDK_BUTTON_PRESS || button_event->button != 1 || priv->mode != MODE_IDLE)
 		return FALSE;
 
@@ -906,6 +969,13 @@
 	priv->mode         = MODE_IDLE;
 	priv->pointer_mode = F_IMAGE_VIEW_POINTER_MODE_SELECT;
 
+	priv->boxesX = NULL;
+	priv->boxesY = NULL;
+	priv->boxesW = NULL;
+	priv->boxesH = NULL;
+	priv->boxesC = NULL;
+	priv->boxesCount = 0;
+
 	image_view->priv = priv;
 }
 
@@ -980,7 +1050,48 @@
 	return TRUE;
 }
 
+void f_image_view_set_boxes (FImageView *image_view, int *x, int *y, int *w, int *h, int *c, int count)
+{
+	image_view->priv->boxesX = x;
+	image_view->priv->boxesY = y;
+	image_view->priv->boxesW = w;
+	image_view->priv->boxesH = h;
+	image_view->priv->boxesC = c;
+	image_view->priv->boxesCount = count;
+}
 
+void f_image_view_clear_boxes (FImageView *image_view) {
+	if (image_view->priv->boxesX != NULL) {
+		free(image_view->priv->boxesX);
+		image_view->priv->boxesX = NULL;
+	}
+	if (image_view->priv->boxesY != NULL) {
+		free(image_view->priv->boxesY);
+		image_view->priv->boxesY = NULL;
+	}
+	if (image_view->priv->boxesW != NULL) {
+		free(image_view->priv->boxesW);
+		image_view->priv->boxesW = NULL;
+	}
+	if (image_view->priv->boxesH != NULL) {
+		free(image_view->priv->boxesH);
+		image_view->priv->boxesH = NULL;
+	}
+	if (image_view->priv->boxesC != NULL) {
+		free(image_view->priv->boxesC);
+		image_view->priv->boxesC = NULL;
+	}
+	image_view->priv->boxesCount = 0;
+}
+
+int f_image_view_get_mouse_x (FImageView *image_view) {
+	return image_view->priv->curX;
+}
+
+int f_image_view_get_mouse_y (FImageView *image_view) {
+	return image_view->priv->curY;
+}
+
 void
 f_image_view_unset_selection (FImageView *image_view)
 {
Index: libfspot/f-image-view.h
===================================================================
--- libfspot/f-image-view.h	(revision 3849)
+++ libfspot/f-image-view.h	(working copy)
@@ -78,4 +78,6 @@
 
 void  f_image_view_unset_selection  (FImageView *image_view);
 
+void f_draw_box(FImageView *image_view, int x, int y, int width, int height, int color);
+
 #endif /* _F_IMAGE_VIEW_H_ */
Index: icons/Makefile.am
===================================================================
--- icons/Makefile.am	(revision 3849)
+++ icons/Makefile.am	(working copy)
@@ -19,6 +19,9 @@
 	actions,color-sepia-22.png		\
 	actions,crop-16.png			\
 	actions,crop-22.png			\
+	actions,marktag-16.png	\
+	actions,marktag-22.png	\
+	actions,marktag-24.png	\
 	actions,filter-soft-focus-16.png	\
 	actions,filter-soft-focus-22.png	\
 	actions,filter-soft-focus-24.png	\
