Browse Source

ifdef out spam for release

cxgeorge 25 years ago
parent
commit
e944ceebfe

+ 34 - 9
panda/src/gui/guiButton.cxx

@@ -61,10 +61,11 @@ inline void GetExtents(GuiLabel* v, GuiLabel* w, GuiLabel* x, GuiLabel* y,
 static void enter_button(CPT_Event e) {
 static void enter_button(CPT_Event e) {
   GuiButton* val = find_in_buttons_map(e->get_name());
   GuiButton* val = find_in_buttons_map(e->get_name());
   if (val == (GuiButton *)NULL) {
   if (val == (GuiButton *)NULL) {
-    if (gui_cat.is_debug()) {
+#ifdef _DEBUG
+    if (gui_cat.is_debug())
       gui_cat.debug()
       gui_cat.debug()
 	<< "Ignoring event " << e->get_name() << " for deleted button\n";
 	<< "Ignoring event " << e->get_name() << " for deleted button\n";
-    }
+#endif
     return;
     return;
   }
   }
   val->test_ref_count_integrity();
   val->test_ref_count_integrity();
@@ -74,10 +75,11 @@ static void enter_button(CPT_Event e) {
 static void exit_button(CPT_Event e) {
 static void exit_button(CPT_Event e) {
   GuiButton* val = find_in_buttons_map(e->get_name());
   GuiButton* val = find_in_buttons_map(e->get_name());
   if (val == (GuiButton *)NULL) {
   if (val == (GuiButton *)NULL) {
-    if (gui_cat.is_debug()) {
+#ifdef _DEBUG
+    if (gui_cat.is_debug())
       gui_cat.debug()
       gui_cat.debug()
 	<< "Ignoring event " << e->get_name() << " for deleted button\n";
 	<< "Ignoring event " << e->get_name() << " for deleted button\n";
-    }
+#endif
     return;
     return;
   }
   }
   val->test_ref_count_integrity();
   val->test_ref_count_integrity();
@@ -87,10 +89,11 @@ static void exit_button(CPT_Event e) {
 static void click_button_down(CPT_Event e) {
 static void click_button_down(CPT_Event e) {
   GuiButton* val = find_in_buttons_map(e->get_name());
   GuiButton* val = find_in_buttons_map(e->get_name());
   if (val == (GuiButton *)NULL) {
   if (val == (GuiButton *)NULL) {
-    if (gui_cat.is_debug()) {
+#ifdef _DEBUG
+    if (gui_cat.is_debug())
       gui_cat.debug()
       gui_cat.debug()
 	<< "Ignoring event " << e->get_name() << " for deleted button\n";
 	<< "Ignoring event " << e->get_name() << " for deleted button\n";
-    }
+#endif
     return;
     return;
   }
   }
   val->test_ref_count_integrity();
   val->test_ref_count_integrity();
@@ -100,10 +103,12 @@ static void click_button_down(CPT_Event e) {
 static void click_button_up(CPT_Event e) {
 static void click_button_up(CPT_Event e) {
   GuiButton* val = find_in_buttons_map(e->get_name());
   GuiButton* val = find_in_buttons_map(e->get_name());
   if (val == (GuiButton *)NULL) {
   if (val == (GuiButton *)NULL) {
+#ifdef _DEBUG
     if (gui_cat.is_debug()) {
     if (gui_cat.is_debug()) {
       gui_cat.debug()
       gui_cat.debug()
 	<< "Ignoring event " << e->get_name() << " for deleted button\n";
 	<< "Ignoring event " << e->get_name() << " for deleted button\n";
     }
     }
+#endif
     return;
     return;
   }
   }
   val->test_ref_count_integrity();
   val->test_ref_count_integrity();
@@ -162,10 +167,12 @@ void GuiButton::switch_state(GuiButton::States nstate) {
     else
     else
       _mgr->add_label(_up, _alt_root);
       _mgr->add_label(_up, _alt_root);
     if (!_up_event.empty()) {
     if (!_up_event.empty()) {
+#ifdef _DEBUG
       gui_cat->debug() << "throwing _up_event '" << _up_event << "'" << endl;
       gui_cat->debug() << "throwing _up_event '" << _up_event << "'" << endl;
+#endif
       throw_event(_up_event);
       throw_event(_up_event);
-    } else
-      gui_cat->debug() << "_up_event is empty!" << endl;
+    } else 
+	gui_cat->debug() << "_up_event is empty!" << endl;
     _rgn->trap_clicks(true);
     _rgn->trap_clicks(true);
     if ((ostate == INACTIVE) || (ostate == INACTIVE_ROLLOVER))
     if ((ostate == INACTIVE) || (ostate == INACTIVE_ROLLOVER))
       _mgr->add_region(_rgn);
       _mgr->add_region(_rgn);
@@ -177,10 +184,12 @@ void GuiButton::switch_state(GuiButton::States nstate) {
       else
       else
 	_mgr->add_label(_up_rollover, _alt_root);
 	_mgr->add_label(_up_rollover, _alt_root);
       if (!_up_rollover_event.empty()) {
       if (!_up_rollover_event.empty()) {
+#ifdef _DEBUG
 	gui_cat->debug() << "throwing _up_rollover_event '"
 	gui_cat->debug() << "throwing _up_rollover_event '"
 			 << _up_rollover_event << "'" << endl;
 			 << _up_rollover_event << "'" << endl;
+#endif
 	throw_event(_up_rollover_event);
 	throw_event(_up_rollover_event);
-      } else
+      } else 
 	gui_cat->debug() << "_up_rollover_event is empty!" << endl;
 	gui_cat->debug() << "_up_rollover_event is empty!" << endl;
     } else {
     } else {
       if (_alt_root.is_null())
       if (_alt_root.is_null())
@@ -188,7 +197,9 @@ void GuiButton::switch_state(GuiButton::States nstate) {
       else
       else
 	_mgr->add_label(_up, _alt_root);
 	_mgr->add_label(_up, _alt_root);
       if (!_up_event.empty()) {
       if (!_up_event.empty()) {
+#ifdef _DEBUG
 	gui_cat->debug() << "throwing _up_event '" << _up_event << "'" << endl;
 	gui_cat->debug() << "throwing _up_event '" << _up_event << "'" << endl;
+#endif
 	throw_event(_up_event);
 	throw_event(_up_event);
       } else
       } else
 	gui_cat->debug() << "_up_event is empty!" << endl;
 	gui_cat->debug() << "_up_event is empty!" << endl;
@@ -306,22 +317,30 @@ void GuiButton::set_priority(GuiLabel* l, GuiItem::Priority p) {
 
 
 void GuiButton::behavior_up(CPT_Event, void* data) {
 void GuiButton::behavior_up(CPT_Event, void* data) {
   GuiButton* button = (GuiButton*)data;
   GuiButton* button = (GuiButton*)data;
+#ifdef _DEBUG
   gui_cat->debug() << "behavior_up (0x" << data << ")" << endl;
   gui_cat->debug() << "behavior_up (0x" << data << ")" << endl;
+#endif
   button->run_button_up();
   button->run_button_up();
 }
 }
 
 
 void GuiButton::behavior_down(CPT_Event, void* data) {
 void GuiButton::behavior_down(CPT_Event, void* data) {
   GuiButton* button = (GuiButton*)data;
   GuiButton* button = (GuiButton*)data;
+#ifdef _DEBUG
   gui_cat->debug() << "behavior_down (0x" << data << ")" << endl;
   gui_cat->debug() << "behavior_down (0x" << data << ")" << endl;
+#endif
   button->run_button_down();
   button->run_button_down();
 }
 }
 
 
 void GuiButton::run_button_up(void) {
 void GuiButton::run_button_up(void) {
+#ifdef _DEBUG
   gui_cat->debug() << "run_button_up (0x" << (void*)this << " '" << this->get_name()
   gui_cat->debug() << "run_button_up (0x" << (void*)this << " '" << this->get_name()
        << "')" << endl;
        << "')" << endl;
+#endif
   if (_eh == (EventHandler*)0L)
   if (_eh == (EventHandler*)0L)
     return;
     return;
+#ifdef _DEBUG
   gui_cat->debug() << "doing work" << endl;
   gui_cat->debug() << "doing work" << endl;
+#endif
   _eh->remove_hook(_up_event, GuiButton::behavior_up, (void*)this);
   _eh->remove_hook(_up_event, GuiButton::behavior_up, (void*)this);
   _eh->remove_hook(_up_rollover_event, GuiButton::behavior_up, (void*)this);
   _eh->remove_hook(_up_rollover_event, GuiButton::behavior_up, (void*)this);
   if (!_behavior_event.empty()) {
   if (!_behavior_event.empty()) {
@@ -335,12 +354,16 @@ void GuiButton::run_button_up(void) {
 }
 }
 
 
 void GuiButton::run_button_down(void) {
 void GuiButton::run_button_down(void) {
+#ifdef _DEBUG
   gui_cat->debug() << "run_button_down (0x" << (void*)this << " '" << this->get_name()
   gui_cat->debug() << "run_button_down (0x" << (void*)this << " '" << this->get_name()
        << "')" << endl;
        << "')" << endl;
+#endif
   if (_eh == (EventHandler*)0L)
   if (_eh == (EventHandler*)0L)
     return;
     return;
+#ifdef _DEBUG
   gui_cat->debug() << "doing work, up_event is '" << _up_event << "' '"
   gui_cat->debug() << "doing work, up_event is '" << _up_event << "' '"
        << _up_rollover_event << "'" << endl;
        << _up_rollover_event << "'" << endl;
+#endif
   _eh->add_hook(_up_event, GuiButton::behavior_up, (void*)this);
   _eh->add_hook(_up_event, GuiButton::behavior_up, (void*)this);
   _eh->add_hook(_up_rollover_event, GuiButton::behavior_up, (void*)this);
   _eh->add_hook(_up_rollover_event, GuiButton::behavior_up, (void*)this);
 }
 }
@@ -579,7 +602,9 @@ void GuiButton::stop_behavior(void) {
 }
 }
 
 
 void GuiButton::reset_behavior(void) {
 void GuiButton::reset_behavior(void) {
+#ifdef _DEBUG
   gui_cat->debug() << this->get_name() << "::reset_behavior()" << endl;
   gui_cat->debug() << this->get_name() << "::reset_behavior()" << endl;
+#endif
   GuiBehavior::reset_behavior();
   GuiBehavior::reset_behavior();
   if (_mgr == (GuiManager*)0L)
   if (_mgr == (GuiManager*)0L)
     return;
     return;

+ 2 - 0
panda/src/gui/guiListBox.cxx

@@ -44,8 +44,10 @@ void GuiListBox::recompute_frame(void) {
       tp = frm[3];
       tp = frm[3];
     (*i)->freeze();
     (*i)->freeze();
     int lvl = (*i)->thaw();
     int lvl = (*i)->thaw();
+#ifdef _DEBUG
     gui_cat->debug() << "in recompute: freeze lvl (" << (*i)->get_name()
     gui_cat->debug() << "in recompute: freeze lvl (" << (*i)->get_name()
 		     << ") = " << lvl << endl;
 		     << ") = " << lvl << endl;
+#endif
   }
   }
   _left = lft;
   _left = lft;
   _right = rgt;
   _right = rgt;

+ 29 - 8
panda/src/gui/guiManager.cxx

@@ -22,21 +22,27 @@ GuiManager* GuiManager::get_ptr(GraphicsWindow* w, MouseAndKeyboard* mak,
 				Node *root2d) {
 				Node *root2d) {
   GuiManager* ret;
   GuiManager* ret;
   if (_map == (GuiMap*)0L) {
   if (_map == (GuiMap*)0L) {
+#ifdef _DEBUG
     if (gui_cat->is_debug())
     if (gui_cat->is_debug())
       gui_cat->debug() << "allocating a manager map" << endl;
       gui_cat->debug() << "allocating a manager map" << endl;
+#endif
     _map = new GuiMap;
     _map = new GuiMap;
   }
   }
   GuiMap::const_iterator gi;
   GuiMap::const_iterator gi;
   gi = _map->find(w);
   gi = _map->find(w);
   if (gi != _map->end()) {
   if (gi != _map->end()) {
     ret = (*gi).second;
     ret = (*gi).second;
+#ifdef _DEBUG
     if (gui_cat->is_debug())
     if (gui_cat->is_debug())
       gui_cat->debug() << "a manager for this window already exists (0x"
       gui_cat->debug() << "a manager for this window already exists (0x"
 		       << (void*)ret << ")" << endl;
 		       << (void*)ret << ")" << endl;
+#endif
   } else {
   } else {
     // going to allocate a new GuiManager for this window
     // going to allocate a new GuiManager for this window
+#ifdef _DEBUG
     if (gui_cat->is_debug())
     if (gui_cat->is_debug())
       gui_cat->debug() << "allocating a new manager for this window" << endl;
       gui_cat->debug() << "allocating a new manager for this window" << endl;
+#endif
     // first see if there is a mouseWatcher already under the MouseAndKeyboard
     // first see if there is a mouseWatcher already under the MouseAndKeyboard
     bool has_watcher = false;
     bool has_watcher = false;
     TypeHandle dgt = DataRelation::get_class_type();
     TypeHandle dgt = DataRelation::get_class_type();
@@ -50,8 +56,10 @@ GuiManager* GuiManager::get_ptr(GraphicsWindow* w, MouseAndKeyboard* mak,
     if (!has_watcher) {
     if (!has_watcher) {
       // there isn't already a mousewatcher in the data graph, so we'll make
       // there isn't already a mousewatcher in the data graph, so we'll make
       // one and re-parent everything to it.
       // one and re-parent everything to it.
+#ifdef _DEBUG
       if (gui_cat->is_debug())
       if (gui_cat->is_debug())
 	gui_cat->debug() << "no MouseWatcher found, making one" << endl;
 	gui_cat->debug() << "no MouseWatcher found, making one" << endl;
+#endif
       watcher = new MouseWatcher("GUI watcher");
       watcher = new MouseWatcher("GUI watcher");
       DataRelation* tmp = new DataRelation(mak, watcher);
       DataRelation* tmp = new DataRelation(mak, watcher);
       for (int j=0; j<mak->get_num_children(dgt); ++j) {
       for (int j=0; j<mak->get_num_children(dgt); ++j) {
@@ -60,29 +68,38 @@ GuiManager* GuiManager::get_ptr(GraphicsWindow* w, MouseAndKeyboard* mak,
 	  // it's not the node we just created, so reparent it to ours
 	  // it's not the node we just created, so reparent it to ours
 	  rel->change_parent(watcher);
 	  rel->change_parent(watcher);
       }
       }
-    } else if (gui_cat->is_debug())
+    } else {
+      if (gui_cat->is_debug())
       gui_cat->debug() << "found a MouseWatcher, don't have to make one"
       gui_cat->debug() << "found a MouseWatcher, don't have to make one"
 		       << endl;
 		       << endl;
+    }
     // now setup event triggers for the watcher
     // now setup event triggers for the watcher
-    if (has_watcher && !watcher->get_button_down_pattern().empty())
+#ifdef _DEBUG
+    if (has_watcher && !watcher->get_button_down_pattern().empty()) {
       gui_cat->warning() << "overwriting existing button down pattern '"
       gui_cat->warning() << "overwriting existing button down pattern '"
 			 << watcher->get_button_down_pattern()
 			 << watcher->get_button_down_pattern()
 			 << "' with 'gui-%r-%b'" << endl;
 			 << "' with 'gui-%r-%b'" << endl;
-    watcher->set_button_down_pattern("gui-%r-%b");
-    if (has_watcher && !watcher->get_button_up_pattern().empty())
+    }
+    if (has_watcher && !watcher->get_button_up_pattern().empty()) {
       gui_cat->warning() << "overwriting existing button up pattern '"
       gui_cat->warning() << "overwriting existing button up pattern '"
 			 << watcher->get_button_up_pattern()
 			 << watcher->get_button_up_pattern()
 			 << "' with 'gui-%r-%b-up'" << endl;
 			 << "' with 'gui-%r-%b-up'" << endl;
-    watcher->set_button_up_pattern("gui-%r-%b-up");
-    if (has_watcher && !watcher->get_enter_pattern().empty())
+    }
+    if (has_watcher && !watcher->get_enter_pattern().empty()) {
       gui_cat->warning() << "overwriting existing enter pattern '"
       gui_cat->warning() << "overwriting existing enter pattern '"
 			 << watcher->get_enter_pattern()
 			 << watcher->get_enter_pattern()
 			 << "' with 'gui-in-%r'" << endl;
 			 << "' with 'gui-in-%r'" << endl;
-    watcher->set_enter_pattern("gui-in-%r");
-    if (has_watcher && !watcher->get_leave_pattern().empty())
+    }
+
+    if (has_watcher && !watcher->get_leave_pattern().empty()) {
       gui_cat->warning() << "overwriting existing exit pattern '"
       gui_cat->warning() << "overwriting existing exit pattern '"
 			 << watcher->get_leave_pattern()
 			 << watcher->get_leave_pattern()
 			 << "' with 'gui-out-%r'" << endl;
 			 << "' with 'gui-out-%r'" << endl;
+    }
+#endif
+    watcher->set_button_down_pattern("gui-%r-%b");
+    watcher->set_button_up_pattern("gui-%r-%b-up");
+    watcher->set_enter_pattern("gui-in-%r");
     watcher->set_leave_pattern("gui-out-%r");
     watcher->set_leave_pattern("gui-out-%r");
 
 
     if (root2d == (Node *)NULL) {
     if (root2d == (Node *)NULL) {
@@ -110,15 +127,19 @@ GuiManager* GuiManager::get_ptr(GraphicsWindow* w, MouseAndKeyboard* mak,
       DisplayRegion *dr = layer->make_display_region();
       DisplayRegion *dr = layer->make_display_region();
       nassertr(dr != (DisplayRegion*)0L, NULL);
       nassertr(dr != (DisplayRegion*)0L, NULL);
       dr->set_camera(cam);
       dr->set_camera(cam);
+#ifdef _DEBUG
       if (gui_cat->is_debug())
       if (gui_cat->is_debug())
 	gui_cat->debug() << "2D layer created" << endl;
 	gui_cat->debug() << "2D layer created" << endl;
+#endif
     }
     }
 
 
     // now make the manager for this window
     // now make the manager for this window
     ret = new GuiManager(watcher, root2d);
     ret = new GuiManager(watcher, root2d);
+#ifdef _DEBUG
     if (gui_cat->is_debug())
     if (gui_cat->is_debug())
       gui_cat->debug() << "new manager allocated (0x" << (void*)ret << ")"
       gui_cat->debug() << "new manager allocated (0x" << (void*)ret << ")"
 		       << endl;
 		       << endl;
+#endif
     (*_map)[w] = ret;
     (*_map)[w] = ret;
   }
   }
   return ret;
   return ret;

+ 2 - 0
panda/src/gui/guiRegion.cxx

@@ -9,6 +9,8 @@
 TypeHandle GuiRegion::_type_handle;
 TypeHandle GuiRegion::_type_handle;
 
 
 GuiRegion::~GuiRegion(void) {
 GuiRegion::~GuiRegion(void) {
+#ifdef _DEBUG
   if (gui_cat->is_debug())
   if (gui_cat->is_debug())
     gui_cat->debug() << "deleting region '" << *this << "'" << endl;
     gui_cat->debug() << "deleting region '" << *this << "'" << endl;
+#endif
 }
 }

+ 4 - 0
panda/src/gui/guiRollover.I

@@ -8,9 +8,11 @@ INLINE GuiRollover::GuiRollover(void) {
 
 
 INLINE void GuiRollover::enter(void) {
 INLINE void GuiRollover::enter(void) {
   if (_state) {
   if (_state) {
+#ifdef _DEBUG
     if (gui_cat->is_debug())
     if (gui_cat->is_debug())
       gui_cat->debug() << "entered '" << *this
       gui_cat->debug() << "entered '" << *this
 		       << "' more then once without exit" << endl;
 		       << "' more then once without exit" << endl;
+#endif
   } else if (_mgr != (GuiManager*)0L) {
   } else if (_mgr != (GuiManager*)0L) {
     _mgr->remove_label(_off);
     _mgr->remove_label(_off);
     if (_alt_root.is_null())
     if (_alt_root.is_null())
@@ -23,9 +25,11 @@ INLINE void GuiRollover::enter(void) {
 
 
 INLINE void GuiRollover::exit(void) {
 INLINE void GuiRollover::exit(void) {
   if (!_state) {
   if (!_state) {
+#ifdef _DEBUG
     if (gui_cat->is_debug())
     if (gui_cat->is_debug())
       gui_cat->debug() << "exited '" << *this
       gui_cat->debug() << "exited '" << *this
 		       << "' more then once without enter" << endl;
 		       << "' more then once without enter" << endl;
+#endif
   } else if (_mgr != (GuiManager*)0L) {
   } else if (_mgr != (GuiManager*)0L) {
     _mgr->remove_label(_on);
     _mgr->remove_label(_on);
     if (_alt_root.is_null())
     if (_alt_root.is_null())

+ 6 - 4
panda/src/gui/guiRollover.cxx

@@ -38,10 +38,11 @@ inline void GetExtents(GuiLabel* x, GuiLabel* y, float& l, float& r, float& b,
 static void enter_rollover(CPT_Event e) {
 static void enter_rollover(CPT_Event e) {
   GuiRollover* val = find_in_rollovers_map(e->get_name());
   GuiRollover* val = find_in_rollovers_map(e->get_name());
   if (val == (GuiRollover *)NULL) {
   if (val == (GuiRollover *)NULL) {
-    if (gui_cat.is_debug()) {
+#ifdef _DEBUG
+    if (gui_cat.is_debug())
       gui_cat.debug()
       gui_cat.debug()
 	<< "Ignoring event " << e->get_name() << " for deleted rollover\n";
 	<< "Ignoring event " << e->get_name() << " for deleted rollover\n";
-    }
+#endif
     return;
     return;
   }
   }
   val->enter();
   val->enter();
@@ -50,10 +51,11 @@ static void enter_rollover(CPT_Event e) {
 static void exit_rollover(CPT_Event e) {
 static void exit_rollover(CPT_Event e) {
   GuiRollover* val = find_in_rollovers_map(e->get_name());
   GuiRollover* val = find_in_rollovers_map(e->get_name());
   if (val == (GuiRollover *)NULL) {
   if (val == (GuiRollover *)NULL) {
-    if (gui_cat.is_debug()) {
+#ifdef _DEBUG
+    if (gui_cat.is_debug())
       gui_cat.debug()
       gui_cat.debug()
 	<< "Ignoring event " << e->get_name() << " for deleted rollover\n";
 	<< "Ignoring event " << e->get_name() << " for deleted rollover\n";
-    }
+#endif
     return;
     return;
   }
   }
   val->exit();
   val->exit();

+ 4 - 0
panda/src/gui/guiSign.cxx

@@ -58,12 +58,16 @@ void GuiSign::unmanage(void) {
 }
 }
 
 
 int GuiSign::freeze() {
 int GuiSign::freeze() {
+#ifdef _DEBUG
   gui_cat->spam() << "GuiSign::freeze (" << this->get_name() << ")" << endl;
   gui_cat->spam() << "GuiSign::freeze (" << this->get_name() << ")" << endl;
+#endif
   return _sign->freeze();
   return _sign->freeze();
 }
 }
 
 
 int GuiSign::thaw() {
 int GuiSign::thaw() {
+#ifdef _DEBUG
   gui_cat->spam() << "GuiSign::thaw (" << this->get_name() << ")" << endl;
   gui_cat->spam() << "GuiSign::thaw (" << this->get_name() << ")" << endl;
+#endif
   return _sign->thaw();
   return _sign->thaw();
 }
 }