[gimp] app: remove the STRICT_TOOL_CHECKS define and ifdefs



commit b04c6889acd0aec72c4c6d4ff221c424e6ed1a15
Author: Michael Natterer <mitch gimp org>
Date:   Sat Apr 16 20:21:52 2011 +0200

    app: remove the STRICT_TOOL_CHECKS define and ifdefs
    
    Tools behave more predictably than before already, and whatever
    remaining warnings will be sorted out before 2.8.

 app/tools/gimpdrawtool.c    |    7 -------
 app/tools/gimptool.c        |   26 --------------------------
 app/tools/gimptool.h        |    3 ---
 app/tools/gimptoolcontrol.c |    5 +----
 4 files changed, 1 insertions(+), 40 deletions(-)
---
diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c
index c001221..77a764e 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -240,12 +240,7 @@ gimp_draw_tool_start (GimpDrawTool *draw_tool,
 {
   g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
   g_return_if_fail (GIMP_IS_DISPLAY (display));
-#ifdef STRICT_TOOL_CHECKS
   g_return_if_fail (gimp_draw_tool_is_active (draw_tool) == FALSE);
-#else
-
-  gimp_draw_tool_stop (draw_tool);
-#endif
 
   draw_tool->display = display;
 
@@ -256,9 +251,7 @@ void
 gimp_draw_tool_stop (GimpDrawTool *draw_tool)
 {
   g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
-#ifdef STRICT_TOOL_CHECKS
   g_return_if_fail (gimp_draw_tool_is_active (draw_tool) == TRUE);
-#endif
 
   gimp_draw_tool_undraw (draw_tool);
 
diff --git a/app/tools/gimptool.c b/app/tools/gimptool.c
index b5b8551..be909f4 100644
--- a/app/tools/gimptool.c
+++ b/app/tools/gimptool.c
@@ -650,9 +650,7 @@ gimp_tool_button_release (GimpTool         *tool,
   g_return_if_fail (GIMP_IS_TOOL (tool));
   g_return_if_fail (coords != NULL);
   g_return_if_fail (GIMP_IS_DISPLAY (display));
-#ifdef STRICT_TOOL_CHECKS
   g_return_if_fail (gimp_tool_control_is_active (tool->control) == TRUE);
-#endif
 
   g_object_ref (tool);
 
@@ -685,21 +683,15 @@ gimp_tool_button_release (GimpTool         *tool,
   GIMP_TOOL_GET_CLASS (tool)->button_release (tool, &my_coords, time, state,
                                               release_type, display);
 
-#ifdef STRICT_TOOL_CHECKS
   g_warn_if_fail (gimp_tool_control_is_active (tool->control) == FALSE);
-#endif
 
   if (tool->active_modifier_state != 0)
     {
-#ifdef STRICT_TOOL_CHECKS
       gimp_tool_control_activate (tool->control);
-#endif
 
       gimp_tool_set_active_modifier_state (tool, 0, display);
 
-#ifdef STRICT_TOOL_CHECKS
       gimp_tool_control_halt (tool->control);
-#endif
     }
 
   tool->button_press_state = 0;
@@ -731,9 +723,7 @@ gimp_tool_set_focus_display (GimpTool    *tool,
 {
   g_return_if_fail (GIMP_IS_TOOL (tool));
   g_return_if_fail (display == NULL || GIMP_IS_DISPLAY (display));
-#ifdef STRICT_TOOL_CHECKS
   g_return_if_fail (gimp_tool_control_is_active (tool->control) == FALSE);
-#endif
 
   GIMP_LOG (TOOL_FOCUS, "tool: %p  focus_display: %p  tool->focus_display: %p",
             tool, display, tool->focus_display);
@@ -744,15 +734,11 @@ gimp_tool_set_focus_display (GimpTool    *tool,
         {
           if (tool->active_modifier_state != 0)
             {
-#ifdef STRICT_TOOL_CHECKS
               gimp_tool_control_activate (tool->control);
-#endif
 
               gimp_tool_set_active_modifier_state (tool, 0, tool->focus_display);
 
-#ifdef STRICT_TOOL_CHECKS
               gimp_tool_control_halt (tool->control);
-#endif
             }
 
           if (tool->modifier_state != 0)
@@ -771,10 +757,8 @@ gimp_tool_key_press (GimpTool    *tool,
   g_return_val_if_fail (GIMP_IS_TOOL (tool), FALSE);
   g_return_val_if_fail (GIMP_IS_DISPLAY (display), FALSE);
   g_return_val_if_fail (display == tool->focus_display, FALSE);
-#ifdef STRICT_TOOL_CHECKS
   g_return_val_if_fail (gimp_tool_control_is_active (tool->control) == FALSE,
                         FALSE);
-#endif
 
   return GIMP_TOOL_GET_CLASS (tool)->key_press (tool, kevent, display);
 }
@@ -787,10 +771,8 @@ gimp_tool_key_release (GimpTool    *tool,
   g_return_val_if_fail (GIMP_IS_TOOL (tool), FALSE);
   g_return_val_if_fail (GIMP_IS_DISPLAY (display), FALSE);
   g_return_val_if_fail (display == tool->focus_display, FALSE);
-#ifdef STRICT_TOOL_CHECKS
   g_return_val_if_fail (gimp_tool_control_is_active (tool->control) == FALSE,
                         FALSE);
-#endif
 
   return GIMP_TOOL_GET_CLASS (tool)->key_release (tool, kevent, display);
 }
@@ -816,9 +798,7 @@ gimp_tool_set_modifier_state (GimpTool        *tool,
 {
   g_return_if_fail (GIMP_IS_TOOL (tool));
   g_return_if_fail (GIMP_IS_DISPLAY (display));
-#ifdef STRICT_TOOL_CHECKS
   g_return_if_fail (gimp_tool_control_is_active (tool->control) == FALSE);
-#endif
 
   GIMP_LOG (TOOL_FOCUS, "tool: %p  display: %p  tool->focus_display: %p",
             tool, display, tool->focus_display);
@@ -871,9 +851,7 @@ gimp_tool_set_active_modifier_state (GimpTool        *tool,
 {
   g_return_if_fail (GIMP_IS_TOOL (tool));
   g_return_if_fail (GIMP_IS_DISPLAY (display));
-#ifdef STRICT_TOOL_CHECKS
   g_return_if_fail (gimp_tool_control_is_active (tool->control) == TRUE);
-#endif
 
   GIMP_LOG (TOOL_FOCUS, "tool: %p  display: %p  tool->focus_display: %p",
             tool, display, tool->focus_display);
@@ -959,9 +937,7 @@ gimp_tool_oper_update (GimpTool         *tool,
   g_return_if_fail (GIMP_IS_TOOL (tool));
   g_return_if_fail (coords != NULL);
   g_return_if_fail (GIMP_IS_DISPLAY (display));
-#ifdef STRICT_TOOL_CHECKS
   g_return_if_fail (gimp_tool_control_is_active (tool->control) == FALSE);
-#endif
 
   GIMP_TOOL_GET_CLASS (tool)->oper_update (tool, coords, state, proximity,
                                            display);
@@ -985,9 +961,7 @@ gimp_tool_cursor_update (GimpTool         *tool,
   g_return_if_fail (GIMP_IS_TOOL (tool));
   g_return_if_fail (coords != NULL);
   g_return_if_fail (GIMP_IS_DISPLAY (display));
-#ifdef STRICT_TOOL_CHECKS
   g_return_if_fail (gimp_tool_control_is_active (tool->control) == FALSE);
-#endif
 
   GIMP_TOOL_GET_CLASS (tool)->cursor_update (tool, coords, state, display);
 }
diff --git a/app/tools/gimptool.h b/app/tools/gimptool.h
index e667e78..10efefa 100644
--- a/app/tools/gimptool.h
+++ b/app/tools/gimptool.h
@@ -22,9 +22,6 @@
 #include "core/gimpobject.h"
 
 
-#define STRICT_TOOL_CHECKS 1
-
-
 #define GIMP_TYPE_TOOL            (gimp_tool_get_type ())
 #define GIMP_TOOL(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_TOOL, GimpTool))
 #define GIMP_TOOL_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_TOOL, GimpToolClass))
diff --git a/app/tools/gimptoolcontrol.c b/app/tools/gimptoolcontrol.c
index 397546e..071dc27 100644
--- a/app/tools/gimptoolcontrol.c
+++ b/app/tools/gimptoolcontrol.c
@@ -107,9 +107,7 @@ void
 gimp_tool_control_activate (GimpToolControl *control)
 {
   g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
-#ifdef STRICT_TOOL_CHECKS
   g_return_if_fail (control->active == FALSE);
-#endif
 
   control->active = TRUE;
 }
@@ -118,9 +116,7 @@ void
 gimp_tool_control_halt (GimpToolControl *control)
 {
   g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
-#ifdef STRICT_TOOL_CHECKS
   g_return_if_fail (control->active == TRUE);
-#endif
 
   control->active = FALSE;
 }
@@ -145,6 +141,7 @@ void
 gimp_tool_control_resume (GimpToolControl *control)
 {
   g_return_if_fail (GIMP_IS_TOOL_CONTROL (control));
+  g_return_if_fail (control->paused_count > 0);
 
   control->paused_count--;
 }



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