[gimp/soc-2009-siox-drb] 7.1.2_drb



commit 236a8f0e69b51a47a42a010cb903b544c6277ab5
Author: Jie Ding <jieding src gnome org>
Date:   Wed Jul 1 19:29:20 2009 +0800

    7.1.2_drb

 app/base/base-enums.h                      |   15 +-
 app/core/gimpdrawable-foreground-extract.c |  164 ++++++------------
 app/core/gimpdrawable-foreground-extract.h |   40 ++---
 app/tools/gimpforegroundselectoptions.h    |    3 +-
 app/tools/gimpforegroundselecttool.c       |  256 +++++++++++-----------------
 app/tools/gimpforegroundselecttool.h       |   13 +--
 6 files changed, 180 insertions(+), 311 deletions(-)
---
diff --git a/app/base/base-enums.h b/app/base/base-enums.h
index 72a6536..36426c5 100644
--- a/app/base/base-enums.h
+++ b/app/base/base-enums.h
@@ -130,17 +130,16 @@ typedef enum  /*< pdb-skip, skip >*/
   SIOX_REFINEMENT_CHANGE_SENSITIVITY = (1 << 2),
   SIOX_REFINEMENT_CHANGE_SMOOTHNESS  = (1 << 3),
   SIOX_REFINEMENT_CHANGE_MULTIBLOB   = (1 << 4),
-  SIOX_REFINEMENT_CHANGE_THRESHOLD   = (1 << 5),//(new) 
+  SIOX_REFINEMENT_CHANGE_THRESHOLD   = (1 << 5),/* threshold  */
   SIOX_REFINEMENT_RECALCULATE        = 0xFF
 } SioxRefinementType;
-
 typedef enum  /*< pdb-skip, skip >*///(new)
 {
-  SIOX_DRB_NO_CHANGE                 = 0,//(new)
-  SIOX_DRB_ADD                       = (1 << 0),//(new)
-  SIOX_DRB_SUBTRACT                  = (1 << 1),//(new)
-  SIOX_DRB_RECALCULATE               = 0xFF//(new)
-} SioxDRBType;//(new)
+  SIOX_DRB_NO_CHANGE                 = 0,
+  SIOX_DRB_ADD                       = (1 << 0),
+  SIOX_DRB_SUBTRACT                  = (1 << 1),
+  SIOX_DRB_RECALCULATE               = 0xFF
+} SioxDRBType;
 
-#endif /* __BASE_ENUMS_H__ */
 
+#endif /* __BASE_ENUMS_H__ */
diff --git a/app/core/gimpdrawable-foreground-extract.c b/app/core/gimpdrawable-foreground-extract.c
index d58d168..f0b919b 100644
--- a/app/core/gimpdrawable-foreground-extract.c
+++ b/app/core/gimpdrawable-foreground-extract.c
@@ -26,6 +26,9 @@
 #include "base/pixel-region.h"
 #include "base/siox.h"
 #include "base/tile-manager.h"
+#include "/usr/include/gtk-1.2/gdk/gdkkeysyms.h"
+#include "base/base-types.h"
+#include "base/siox.c"
 
 #include "gimpchannel.h"
 #include "gimpdrawable.h"
@@ -34,9 +37,7 @@
 #include "gimpprogress.h"
 
 #include "gimp-intl.h"
-#include "/usr/include/gtk-1.2/gdk/gdkkeysyms.h"
-#include "base/base-types.h"
-#include "base/siox.c"
+
 
 /*  public functions  */
 
@@ -45,7 +46,7 @@ gimp_drawable_foreground_extract (GimpDrawable              *drawable,
                                   GimpForegroundExtractMode  mode,
                                   GimpDrawable              *mask,
                                   GimpProgress              *progress)
-{printf("===========gimp_drawable_foreground_extract \n");
+{
   SioxState    *state;
   const gdouble sensitivity[3] = { SIOX_DEFAULT_SENSITIVITY_L,
                                    SIOX_DEFAULT_SENSITIVITY_A,
@@ -61,7 +62,7 @@ gimp_drawable_foreground_extract (GimpDrawable              *drawable,
                                                 gimp_item_get_height (GIMP_ITEM (mask)));
 
   if (state)
-    { printf("===========gimp_drawable_foreground_extract_statu \n");
+    {
       gimp_drawable_foreground_extract_siox (mask, state,
                                              SIOX_REFINEMENT_RECALCULATE,
                                              SIOX_DEFAULT_SMOOTHNESS,
@@ -79,7 +80,7 @@ gimp_drawable_foreground_extract_siox_init (GimpDrawable *drawable,
                                             gint          y,
                                             gint          width,
                                             gint          height)
-{printf("===========gimp_drawable_foreground_extract_siox_init  \n");
+{
   const guchar *colormap = NULL;
   gboolean      intersect;
   gint          offset_x;
@@ -120,14 +121,10 @@ gimp_drawable_foreground_extract_siox (GimpDrawable       *mask,
                                        const gdouble       sensitivity[3],
                                        gboolean            multiblob,
                                        GimpProgress       *progress)
-{printf("===========gimp_drawable_foreground_extract_siox   \n");
-	
+{
   gint x1, y1;
   gint x2, y2;
 
-  
-  
-  
   g_return_if_fail (GIMP_IS_DRAWABLE (mask));
   g_return_if_fail (gimp_drawable_bytes (mask) == 1);
 
@@ -155,126 +152,73 @@ gimp_drawable_foreground_extract_siox (GimpDrawable       *mask,
                            smoothness, sensitivity, multiblob,
                            (SioxProgressFunc) gimp_progress_set_value,
                            progress);
-  
-	if (progress)
+
+  if (progress)
     gimp_progress_end (progress);
 
   gimp_drawable_update (mask, x1, y1, x2, y2);
 }
 
-
- 
-
-
 void
 gimp_drawable_foreground_extract_siox_done (SioxState *state)
-{printf("===========gimp_drawable_foreground_extract_siox_done  \n");
+{
   g_return_if_fail (state != NULL);
 
   siox_done (state);
 }
 
-
-
-
 void                                                   //(new)
-gimp_drawable_foreground_extract_siox_drb(GimpDrawable       *mask,
-										  SioxState         *state,
-										  gboolean          optionsrefinement,
-										    gint		    optionsthreshold,//( �为float)
-										    gint            radius,
-											GimpProgress       *progress)
-{  printf("===========gimp_drawable_foreground_extract_siox_drb\n");
-
-	 gint x = (state->x);
-	 gint y = (state->y);
-	g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
-	if (progress)
-    gimp_progress_start (progress, _("Detail Refinement Brush"), FALSE);
-
-      siox_forefound_drb(state,gimp_drawable_get_tiles(mask),
-						 optionsrefinement,x,y,//(ç±»å??ä¸?å?¹é??)
-						 radius,optionsthreshold);
-	if (progress)
+gimp_drawable_foreground_extract_siox_drb(GimpDrawable      *mask,
+					  SioxState         *state,
+			        	  gboolean          optionsrefinement,
+					  gint		    optionsthreshold,//( should be float)
+					  gint              radius,
+					  GimpProgress       *progress)
+{
+    gint x = (state->x);
+    gint y = (state->y);
+    g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
+    if (progress)
+	gimp_progress_start (progress, _("Detail Refinement Brush"), FALSE);
+    siox_forefound_drb(state,gimp_drawable_get_tiles(mask),
+		       optionsrefinement,x,y,
+		       radius,optionsthreshold);
+    if (progress)
     gimp_progress_end (progress);
 
 }
 
 
-/*
-void printstate(SioxState *state)
-{
-	gint x = state->x;
-	gint y = 1;
-	printf("state->x=:%d",x);	
-	printf("state->y=:%d",y);
-	
-}
-*/
+
 
 void
 siox_forefound_drb (SioxState    *state,
-                                TileManager  *mask,
-                                gboolean     options,
-								gint		 x,
-								gint		 y,
-								gint         brushradius,
-								gfloat       threshold)//
- {printf("===========siox_forefound_drb \n");
-	SioxDRBType drbbrush_mode;//
-
-	gint sioxdrboptions = options;
-	TileManager *drbmask = mask; 
-	SioxState  *drbstate = state;
-	gfloat drbthreshold = threshold; 
-	gint  drbbrush_radius = brushradius;
-	gint drbx = x;
-	gint drby = y; 
-	 
-	if(sioxdrboptions == 0)//
-		 drbbrush_mode = (1<<0);//
-	else if(sioxdrboptions == 1)//
-		 drbbrush_mode = (1<<1);//
-	 
-	 siox_drb(drbstate,//
-				  drbmask,//
-				  drbx,drby,
-				  drbbrush_radius,
-				  drbbrush_mode,  //
-				  drbthreshold);
+		    TileManager  *mask,
+		    gboolean     options,
+		    gint         x,
+		    gint	 y,
+		    gint         brushradius,
+		    gfloat       threshold)//
+ {
+     SioxDRBType drbbrush_mode;//
+     gint sioxdrboptions = options;
+     TileManager *drbmask = mask;
+     SioxState  *drbstate = state;
+     gfloat drbthreshold = threshold;
+     gint  drbbrush_radius = brushradius;
+     gint drbx = x;
+     gint drby = y;
+
+     if(sioxdrboptions == 0)//
+	 drbbrush_mode = (1<<0);//
+     else if(sioxdrboptions == 1)//
+	 drbbrush_mode = (1<<1);//
+     siox_drb(drbstate,//
+	      drbmask,//
+	      drbx,drby,
+	      drbbrush_radius,
+	      drbbrush_mode,  //
+	      drbthreshold);
 	 
  }
  
-  /* GimpForegroundSelectTool *fg_select;
-  GimpImage *image; 
-
-  gint x;
-  gint y;	
-  gfloat threshold;	
-  GimpChannel  *mask;
-  TileManager   *maskdrb; 
-  GimpFreeSelectTool *free_sel;
-  GimpForegroundSelectOptions *options;	 
-  SioxState    *state;
-
-  fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
-  state = fg_select->state;	
-  image = display->image;	
-  	
- // free_sel = fg_select->parent_instance;	
-  
-  options  = GIMP_FOREGROUND_SELECT_TOOL_GET_OPTIONS (tool);
-  //sioxdrbdate.options = options->refinement;
-  printf("=========soptions=%d",options->refinement);
-  mask = gimp_channel_new(image,gimp_image_get_width(image),gimp_image_get_height(image),"foreground-extraction",NULL);	 
-  maskdrb = gimp_drawable_get_tiles(mask);	
-  x = 45;//state.x ;
-  y = 56;//state.y;
-  threshold = options->threshold;	
-	/*GimpDisplayShell   *shell = GIMP_DISPLAY_SHELL (draw_tool->display->shell);
-      gint                x     = fg_select->last_coords.x;
-      gint                y     = fg_select->last_coords.y;
-      gdouble             radius;
-	  radius = (options->stroke_width / shell->scale_y) / 2;
-*/
-
diff --git a/app/core/gimpdrawable-foreground-extract.h b/app/core/gimpdrawable-foreground-extract.h
index 1fd88d5..9426153 100644
--- a/app/core/gimpdrawable-foreground-extract.h
+++ b/app/core/gimpdrawable-foreground-extract.h
@@ -17,13 +17,8 @@
 
 #ifndef  __GIMP_DRAWABLE_FOREGROUND_EXTRACT_H__
 #define  __GIMP_DRAWABLE_FOREGROUND_EXTRACT_H__
-/*typedef struct _GimpSioxDrb//(new)
-{
-	SioxState        *state;//(new)
-	gboolean          options;//(new)
-	GimpDrawable     *mask;//(new)
-}SioxDrbState;//(new)
-*/
+
+
 /*  general API (as seen from the PDB)  */
 
 void       gimp_drawable_foreground_extract (GimpDrawable              *drawable,
@@ -41,31 +36,24 @@ SioxState * gimp_drawable_foreground_extract_siox_init   (GimpDrawable *drawable
 void        gimp_drawable_foreground_extract_siox  (GimpDrawable       *mask,
                                                     SioxState          *state,
                                                     SioxRefinementType  refinemane,
-                                                    //GArray             *stroke,//(new) 
-                                                    //gboolean			sioxdrboption,//(new)   
                                                     gint                smoothness,
                                                     const gdouble       sensitivity[3],
                                                     gboolean            multiblob,
                                                     GimpProgress       *progress);
 void        gimp_drawable_foreground_extract_siox_done (SioxState      *state);
 
-                                                    
-void gimp_drawable_foreground_extract_siox_drb(GimpDrawable       *mask,//(new)
-										  SioxState         *state,
-										  gboolean          optionsrefinement,
-										    gint		    optionsthreshold,//(should be  float)
-										    gint            radius,
-											GimpProgress       *progress);
+void gimp_drawable_foreground_extract_siox_drb(GimpDrawable      *mask,//(new)
+					       SioxState         *state,
+					       gboolean           optionsrefinement,
+					       gint               optionsthreshold,//( should be float)
+					       gint               radius,
+					       GimpProgress      *progress);
 
 void siox_forefound_drb (SioxState    *state,//(new)
-                                TileManager  *mask,
-                                gboolean     options,
-								gint		 x,
-								gint		 y,
-								gint         brushradius,
-								gfloat       threshold);//(new)
-
-void printstate(SioxState *state);
+			 TileManager  *mask,
+			 gboolean      options,
+			 gint          x,
+			 gint          y,
+			 gint          brushradius,
+			 gfloat        threshold);//(new)
 #endif  /*  __GIMP_DRAWABLE_FOREGROUND_EXTRACT_H__  */
-
-
diff --git a/app/tools/gimpforegroundselectoptions.h b/app/tools/gimpforegroundselectoptions.h
index 59cde8b..83ac781 100644
--- a/app/tools/gimpforegroundselectoptions.h
+++ b/app/tools/gimpforegroundselectoptions.h
@@ -42,7 +42,7 @@ struct _GimpForegroundSelectOptions
   gboolean              refinement;//(new)
   gint                  stroke_width;
   gint                  smoothness;
-  gdouble                threshold;//(new)
+  gdouble                threshold;//(new should be float)
   GimpChannelType       mask_color;
   gboolean              expanded;
   gdouble               sensitivity[3];
@@ -55,4 +55,3 @@ GtkWidget * gimp_foreground_select_options_gui      (GimpToolOptions *tool_optio
 
 
 #endif /* __GIMP_FOREGROUND_SELECT_OPTIONS_H__ */
-
diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c
index 24789d8..ca098fd 100644
--- a/app/tools/gimpforegroundselecttool.c
+++ b/app/tools/gimpforegroundselecttool.c
@@ -52,8 +52,7 @@
 
 #include "gimp-intl.h"
 #include "base/siox.h"
-#include "gdk/gdkkeysyms.h"//
-
+#include "gdk/gdkkeysyms.h"
 
 typedef struct
 {
@@ -93,6 +92,7 @@ static void   gimp_foreground_select_tool_button_press   (GimpTool         *tool
                                                           const GimpCoords *coords,
                                                           guint32           time,
                                                           GdkModifierType   state,
+                                                          GimpButtonPressType press_type,
                                                           GimpDisplay      *display);
 static void   gimp_foreground_select_tool_button_release (GimpTool         *tool,
                                                           const GimpCoords *coords,
@@ -109,8 +109,7 @@ static void   gimp_foreground_select_tool_motion         (GimpTool         *tool
 static void   gimp_foreground_select_tool_draw           (GimpDrawTool     *draw_tool);
 
 static void   gimp_foreground_select_tool_select   (GimpFreeSelectTool *free_sel,
-                                                    GimpDisplay        *display);//,
-													//GdkEventKey         *kevent);
+                                                    GimpDisplay        *display);
 
 static void   gimp_foreground_select_tool_set_mask (GimpForegroundSelectTool *fg_select,
                                                     GimpDisplay              *display,
@@ -128,16 +127,18 @@ static void   gimp_foreground_select_tool_push_stroke (GimpForegroundSelectTool
 static void   gimp_foreground_select_options_notify (GimpForegroundSelectOptions *options,
                                                      GParamSpec                  *pspec,
                                                      GimpForegroundSelectTool    *fg_select);
+
 /*----new 2009-6-28*/
 //static void   gimp_foreground_select_siox_drb(GimpTool         *tool,
-//					        GimpDisplay      *display);
-
+//                                             GimpDisplay      *display);
+ 
 static gboolean gimp_forground_select_tool_drbsignal(gboolean drbsignal);
-
+ 
 static gboolean mark_drb = FALSE;
 static GimpFreeSelectTool *free_sel_drb; 
 static GimpDisplay        *display_drb;
 /*----end*/
+
 G_DEFINE_TYPE (GimpForegroundSelectTool, gimp_foreground_select_tool,
                GIMP_TYPE_FREE_SELECT_TOOL)
 
@@ -158,7 +159,6 @@ gimp_foreground_select_tool_register (GimpToolRegisterCallback  callback,
                 N_("F_oreground Select"), NULL,
                 NULL, GIMP_HELP_TOOL_FOREGROUND_SELECT,
                 GIMP_STOCK_TOOL_FOREGROUND_SELECT,
-				//GIMP_TYPE_FREE_SELECT_TOOL,//(new)
                 data);
 }
 
@@ -209,7 +209,7 @@ gimp_foreground_select_tool_init (GimpForegroundSelectTool *fg_select)
   fg_select->stroke  = NULL;
   fg_select->strokes = NULL;
   fg_select->mask    = NULL;
-  fg_select->drbsignal = NULL;	//(new)
+  fg_select->drbsignal = NULL; //(new)  	
 }
 
 static GObject *
@@ -259,13 +259,13 @@ gimp_foreground_select_tool_control (GimpTool       *tool,
   GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
 
   switch (action)
-    {printf("===========action\n");
+    {
     case GIMP_TOOL_ACTION_PAUSE:
     case GIMP_TOOL_ACTION_RESUME:
       break;
 
     case GIMP_TOOL_ACTION_HALT:
-      {printf("===========action_halt\n");
+      {
         GList *list;
 
         gimp_foreground_select_tool_set_mask (fg_select, display, NULL);
@@ -324,7 +324,7 @@ gimp_foreground_select_tool_oper_update (GimpTool         *tool,
         case SELECTION_MOVE_COPY:
         case SELECTION_ANCHOR:
           if (fg_select->strokes)
-			{
+            {
 				if(!fg_select->drbsignal)//(new)
 				    status = _("Add more strokes or press Shift to drb");
 				else
@@ -352,43 +352,35 @@ gimp_foreground_select_tool_oper_update (GimpTool         *tool,
   if (proximity)
     {
       if (status)
-	  gimp_tool_replace_status (tool, display, "%s", status);
-	
+        gimp_tool_replace_status (tool, display, "%s", status);
+
       gimp_draw_tool_start (draw_tool, display);
     }
 }
 
-
 static void
 gimp_foreground_select_tool_modifier_key (GimpTool        *tool,
                                           GdkModifierType  key,
                                           gboolean         press,
                                           GdkModifierType  state,
                                           GimpDisplay     *display)
-{printf("===============shift\n");
+{
   if (key == GDK_CONTROL_MASK)
     {
       GimpForegroundSelectOptions *options;
 
       options = GIMP_FOREGROUND_SELECT_TOOL_GET_OPTIONS (tool);
-	
-	  
+
       g_object_set (options,
                     "background", ! options->background,
                     NULL);
     }
-	  /*----new----
-		GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
-		gimp_forground_select_tool_drbsignal(fg_select->drbsignal);
-		printf("fg_select->drbsignal=%d\n",fg_select->drbsignal);
-		----end----*/
-	if (key == GDK_SHIFT_MASK)
-	  {
-	    mark_drb = TRUE;
+  if (key == GDK_SHIFT_MASK)
+	{
+	  mark_drb = TRUE;
 	   // gimp_foreground_select_tool_select (free_sel_drb, display_drb);//(alter)
-	//	gimp_foreground_select_tool_select (GIMP_FREE_SELECT_TOOL (tool), display);//(alter)  
-	  }
-	
+	  //gimp_foreground_select_tool_select (GIMP_FREE_SELECT_TOOL (tool), display);//(alter)  
+	}
 }
 
 static void
@@ -428,11 +420,10 @@ gimp_foreground_select_tool_key_press (GimpTool    *tool,
                                        GimpDisplay *display)
 {
   GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
- 
-	
+
   if (display != tool->display)
     return FALSE;
-  
+
   if (fg_select->state)
     {
       switch (kevent->keyval)
@@ -446,49 +437,42 @@ gimp_foreground_select_tool_key_press (GimpTool    *tool,
         case GDK_Escape:
           gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
           return TRUE;
-	   /*---------------add*
-		case GDK_SHIFT_MASK:
-			mark_drb = TRUE;
-	    case GDK_Shift_L:	
-		case GDK_Shift_R:	
-			mark_drb = TRUE;
-           /*-----------------end*/
-		 
+
         default:
           return FALSE;
         }
-    }	
+    }
   else
+    {
       return GIMP_TOOL_CLASS (parent_class)->key_press (tool,
                                                         kevent,
                                                         display);
+    }
 }
 
 static void
-gimp_foreground_select_tool_button_press (GimpTool         *tool,
-                                          const GimpCoords *coords,
-                                          guint32           time,
-                                          GdkModifierType   state,
-                                          GimpDisplay      *display)
-{printf("===========tool_button_press\n");
+gimp_foreground_select_tool_button_press (GimpTool            *tool,
+                                          const GimpCoords    *coords,
+                                          guint32              time,
+                                          GdkModifierType      state,
+                                          GimpButtonPressType  press_type,
+                                          GimpDisplay         *display)
+{
   GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
   GimpDrawTool             *draw_tool = GIMP_DRAW_TOOL (tool);
 
-  if (fg_select->mask && (!fg_select->drbsignal))//(new)
-    {printf("===========3\n");
+  if (fg_select->mask && (!fg_select->drbsignal))
+    {
       GimpVector2 point = gimp_vector2_new (coords->x, coords->y);
 
       gimp_draw_tool_pause (draw_tool);
 
       if (gimp_draw_tool_is_active (draw_tool) && draw_tool->display != display)
-		{ gimp_draw_tool_stop (draw_tool);
-			printf("===========4\n");
-		}
+        gimp_draw_tool_stop (draw_tool);
 
       if (! gimp_tool_control_is_active (tool->control))
-		{  gimp_tool_control_activate (tool->control);
-		printf("===========5\n");
-		}
+        gimp_tool_control_activate (tool->control);
+
       fg_select->last_coords = *coords;
 
       g_return_if_fail (fg_select->stroke == NULL);
@@ -497,12 +481,10 @@ gimp_foreground_select_tool_button_press (GimpTool         *tool,
       g_array_append_val (fg_select->stroke, point);
 
       if (! gimp_draw_tool_is_active (draw_tool))
-		{ gimp_draw_tool_start (draw_tool, display);
-		printf("===========6\n");
-		}
+        gimp_draw_tool_start (draw_tool, display);
+
       gimp_draw_tool_resume (draw_tool);
     }
-	/*---------------add*/   //alter
   else if (fg_select->drbsignal)
 	{
 		GimpVector2 point = gimp_vector2_new (coords->x, coords->y);
@@ -529,11 +511,10 @@ gimp_foreground_select_tool_button_press (GimpTool         *tool,
       gimp_draw_tool_resume (draw_tool);
 		
 	}
-	/*---------------end*/	
-  else		
+  else
     {
-      GIMP_TOOL_CLASS (parent_class)->button_press (tool,
-                                                    coords, time, state, display);
+      GIMP_TOOL_CLASS (parent_class)->button_press (tool, coords, time, state,
+                                                    press_type, display);
     }
 }
 
@@ -544,11 +525,11 @@ gimp_foreground_select_tool_button_release (GimpTool              *tool,
                                             GdkModifierType        state,
                                             GimpButtonReleaseType  release_type,
                                             GimpDisplay           *display)
-{printf("===========tool_button_release\n");
+{
   GimpForegroundSelectTool *fg_select = GIMP_FOREGROUND_SELECT_TOOL (tool);
 
-  if (fg_select->mask && (!fg_select->drbsignal))//
-    {printf("===========0\n");
+  if (fg_select->mask && (!fg_select->drbsignal))
+    {
       GimpForegroundSelectOptions *options;
 
       options = GIMP_FOREGROUND_SELECT_TOOL_GET_OPTIONS (tool);
@@ -560,11 +541,10 @@ gimp_foreground_select_tool_button_release (GimpTool              *tool,
       gimp_foreground_select_tool_push_stroke (fg_select, display, options);
 
       gimp_free_select_tool_select (GIMP_FREE_SELECT_TOOL (tool), display);
-    printf("===========1\n");
+
       gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
     }
-	/*-------------add*/
-   else if (fg_select->drbsignal)
+  else if (fg_select->drbsignal)
 	{
 	  GimpForegroundSelectOptions *options;
 
@@ -577,12 +557,11 @@ gimp_foreground_select_tool_button_release (GimpTool              *tool,
       gimp_foreground_select_tool_push_stroke (fg_select, display, options);
 
       gimp_free_select_tool_select (GIMP_FREE_SELECT_TOOL (tool), display);
-    printf("===========1\n");
+   
       gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
 	}
-	/*--------------end*/	
-  else	
-    {printf("===========2\n");
+  else
+    {
       GIMP_TOOL_CLASS (parent_class)->button_release (tool,
                                                       coords, time, state,
                                                       release_type,
@@ -631,7 +610,7 @@ gimp_foreground_select_tool_get_area (GimpChannel *mask,
                                       gint        *y1,
                                       gint        *x2,
                                       gint        *y2)
-{printf("===========tool_get_area\n");
+{
   gint width;
   gint height;
 
@@ -706,9 +685,8 @@ gimp_foreground_select_tool_draw (GimpDrawTool *draw_tool)
 
 static void
 gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
-                                    GimpDisplay      *display)//,
-									//GdkEventKey        *kevent)
-{printf("===========gimp_foreground_select_tool_select\n");
+                                    GimpDisplay        *display)
+{
   GimpForegroundSelectTool    *fg_select;
   GimpForegroundSelectOptions *options;
   GimpImage                   *image = display->image;
@@ -718,27 +696,25 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
   const GimpVector2           *points;
   gint                         n_points;
   gint                         radius;
-
-		drawable  = gimp_image_get_active_drawable (image);	
-		fg_select = GIMP_FOREGROUND_SELECT_TOOL (free_sel);
-		options   = GIMP_FOREGROUND_SELECT_TOOL_GET_OPTIONS (free_sel);
-	 
-/*-----new-----*/	
 	
+  drawable  = gimp_image_get_active_drawable (image);
+  fg_select = GIMP_FOREGROUND_SELECT_TOOL (free_sel);
+  options   = GIMP_FOREGROUND_SELECT_TOOL_GET_OPTIONS (free_sel);
+
+/*-----new-----*/		
   GimpTool *tool =GIMP_TOOL(fg_select);	
   GimpDisplayShell   *shell = GIMP_DISPLAY_SHELL (display->shell);
   radius = (options->stroke_width / shell->scale_y) / 2;
 /*----end----*/	
   if (fg_select->idle_id)
-    {printf("===========7\n");
+    {
       g_source_remove (fg_select->idle_id);
       fg_select->idle_id = 0;
     }
 
   if (! drawable)
-	{printf("===========return\n");
-		return;
-	}
+    return;
+
   scan_convert = gimp_scan_convert_new ();
 
   gimp_free_select_tool_get_points (free_sel,
@@ -759,50 +735,37 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
                                   gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
                                   0, 0, 128);
   gimp_scan_convert_free (scan_convert);
-	/*==new===*/
-  if(fg_select->strokes)
-  {
-      /*
-
-	fg_select->drbsignal = gimp_foreground_select_tool_modifier_key(tool,//(åº?该æ??ä¹?å??ï¼?)
-
-	GDK_SHIFT_MASK,
-                                          TRUE,
-                                          GDK_SHIFT_MASK,
-                                          display)*/
-			//if((kevent->keyval == GDK_Shift_L) || (kevent->keyval == GDK_Shift_R )) 
-			  
-	      //	fg_select->drbsignal= TRUE;
-      fg_select->drbsignal = mark_drb;
-  }
-  
-  
-   if (fg_select->strokes && (!fg_select->drbsignal))
-      {printf("===========8\n");
-	  GList *list;
-	  gimp_set_busy (image->gimp);
+  if (fg_select->strokes)
+    {
+	  fg_select->drbsignal = mark_drb;//(should be a function to push)
+    }
+	
+  if (fg_select->strokes && (!fg_select->drbsignal))
+    {
+      GList *list;
+
+      gimp_set_busy (image->gimp);
 
       /*  apply foreground and background markers  */
-	  for (list = fg_select->strokes; list; list = list->next)
-	      gimp_foreground_select_tool_stroke (mask, list->data);
-	  if (fg_select->state)
-	    {gimp_drawable_foreground_extract_siox (GIMP_DRAWABLE (mask),
-						  fg_select->state,
-						  fg_select->refinement,
-						  options->smoothness,
-						  options->sensitivity,
-						  ! options->contiguous,
-						  GIMP_PROGRESS (display));
-		printf("===========tool_select_extract_siox\n");
-	  
-			fg_select->refinement = SIOX_REFINEMENT_NO_CHANGE;
-			gimp_unset_busy (image->gimp);
-		}
-	  }
-   else if (fg_select->drbsignal)
-      {
-	  printf("===========9\n");
-		//gtk_widget_set_sensitive (,FALSE);
+      for (list = fg_select->strokes; list; list = list->next)
+        gimp_foreground_select_tool_stroke (mask, list->data);
+
+      if (fg_select->state)
+        gimp_drawable_foreground_extract_siox (GIMP_DRAWABLE (mask),
+                                               fg_select->state,
+                                               fg_select->refinement,
+                                               options->smoothness,
+                                               options->sensitivity,
+                                               ! options->contiguous,
+                                               GIMP_PROGRESS (display));
+
+      fg_select->refinement = SIOX_REFINEMENT_NO_CHANGE;
+
+      gimp_unset_busy (image->gimp);
+    }
+  else if (fg_select->drbsignal)
+    {
+	  //gtk_widget_set_sensitive (,FALSE);
 	  gimp_set_busy (image->gimp);
 	  gimp_drawable_foreground_extract_siox_drb(GIMP_DRAWABLE (mask),
 						    fg_select->state,
@@ -812,11 +775,9 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
 						    GIMP_PROGRESS (display));
 	  options->refinement = SIOX_DRB_NO_CHANGE ;
 	  gimp_unset_busy (image->gimp);
-      }
-	/*------end-------*/
-      else
-      {
-	  printf("===========10\n");
+     }
+  else
+    {
       gint x1, y1;
       gint x2, y2;
 
@@ -830,30 +791,18 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
       fg_select->state =
         gimp_drawable_foreground_extract_siox_init (drawable,
                                                     x1, y1, x2 - x1, y2 - y1);
-      }
-  
-
+    }
 
   gimp_foreground_select_tool_set_mask (fg_select, display, mask);
 
   g_object_unref (mask);
-    /*------add----*
-	free_sel_drb = free_sel;
-	display_drb = display_drb;	
-	/*-------end---*/
 }
 
-/*----new *
-static gboolean gimp_forground_select_tool_drbsignal(gboolean drbsignal) 
-{
-	return drbsignal = TRUE;
-}
-/*----new end*/
 static void
 gimp_foreground_select_tool_set_mask (GimpForegroundSelectTool *fg_select,
                                       GimpDisplay              *display,
                                       GimpChannel              *mask)
-{printf("===========tool_set_mask\n");
+{
   GimpTool                    *tool = GIMP_TOOL (fg_select);
   GimpForegroundSelectOptions *options;
 
@@ -897,7 +846,7 @@ gimp_foreground_select_tool_set_mask (GimpForegroundSelectTool *fg_select,
 static void
 gimp_foreground_select_tool_apply (GimpForegroundSelectTool *fg_select,
                                    GimpDisplay              *display)
-{printf("===========select_tool_apply\n");
+{
   GimpTool             *tool    = GIMP_TOOL (fg_select);
   GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
 
@@ -919,7 +868,7 @@ gimp_foreground_select_tool_apply (GimpForegroundSelectTool *fg_select,
 static void
 gimp_foreground_select_tool_stroke (GimpChannel    *mask,
                                     FgSelectStroke *stroke)
-{printf("===========select_tool_stroke\n");
+{
   GimpScanConvert *scan_convert = gimp_scan_convert_new ();
 
   if (stroke->num_points == 1)
@@ -954,7 +903,7 @@ static void
 gimp_foreground_select_tool_push_stroke (GimpForegroundSelectTool    *fg_select,
                                          GimpDisplay                 *display,
                                          GimpForegroundSelectOptions *options)
-{printf("===========select_tool_push_stroke\n");
+{
   GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
   FgSelectStroke   *stroke;
 
@@ -993,7 +942,7 @@ static void
 gimp_foreground_select_options_notify (GimpForegroundSelectOptions *options,
                                        GParamSpec                  *pspec,
                                        GimpForegroundSelectTool    *fg_select)
-{printf("===========select_options_notify\n");
+{
   SioxRefinementType refinement = 0;
 
   if (! fg_select->mask)
@@ -1015,7 +964,6 @@ gimp_foreground_select_options_notify (GimpForegroundSelectOptions *options,
     {
       refinement = SIOX_REFINEMENT_CHANGE_THRESHOLD;
     }
-
   if (refinement)
     {
       fg_select->refinement |= refinement;
@@ -1039,6 +987,7 @@ gimp_foreground_select_options_notify (GimpForegroundSelectOptions *options,
                                      options->mask_color);
     }
 }
+
 /*static void
 gimp_foreground_select_tool_push_drbsignal (GimpForegroundSelectTool    *fg_select,
                                             GimpDisplay                 *display,
@@ -1046,4 +995,3 @@ gimp_foreground_select_tool_push_drbsignal (GimpForegroundSelectTool    *fg_sele
 {
 	
 }*/
-
diff --git a/app/tools/gimpforegroundselecttool.h b/app/tools/gimpforegroundselecttool.h
index 09bd3b0..88b8bbb 100644
--- a/app/tools/gimpforegroundselecttool.h
+++ b/app/tools/gimpforegroundselecttool.h
@@ -30,11 +30,8 @@
 #define GIMP_FOREGROUND_SELECT_TOOL_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_FOREGROUND_SELECT_TOOL, GimpForegroundSelectToolClass))
 
 #define GIMP_FOREGROUND_SELECT_TOOL_GET_OPTIONS(t)  (GIMP_FOREGROUND_SELECT_OPTIONS (gimp_tool_get_options (GIMP_TOOL (t))))
-/*--------new
-#define GIMP_TYPE_FREE_SELECT_TOOL                  (gimp_free_select_tool_get_type ())
-#define GIMP_FREE_SELECT_TOOL(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_FREE_SELECT_TOOL, GimpFreeSelectTool))
-#define GIMP_IS_FREE_SELECT_TOOL(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_FREE_SELECT_TOOL))
-/*---------------end*/
+
+
 typedef struct _GimpForegroundSelectTool      GimpForegroundSelectTool;
 typedef struct _GimpForegroundSelectToolClass GimpForegroundSelectToolClass;
 
@@ -60,14 +57,8 @@ struct _GimpForegroundSelectToolClass
 
 void    gimp_foreground_select_tool_register (GimpToolRegisterCallback  callback,
                                               gpointer                  data);
-                                              
-/*static void                                                            //(new)
-gimp_foreground_select_siox_drb (GimpTool         *tool,//(new)
-				 GimpDisplay      *display);    */                                          
 
 GType   gimp_foreground_select_tool_get_type (void) G_GNUC_CONST;
 
-static gboolean gimp_forground_select_tool_drbsignal(gboolean drbsignal); //
 
 #endif  /*  __GIMP_FOREGROUND_SELECT_TOOL_H__  */
-



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]