Explorar o código

remove old gui code

David Rose %!s(int64=24) %!d(string=hai) anos
pai
achega
e870a0a2b2
Modificáronse 51 ficheiros con 3 adicións e 9186 borrados
  1. 1 1
      panda/metalibs/panda/Sources.pp
  2. 2 4
      panda/src/audio/Sources.pp
  3. 0 1
      panda/src/audio/audio.h
  4. 0 44
      panda/src/audio/audio_gui_functor.cxx
  5. 0 63
      panda/src/audio/audio_gui_functor.h
  6. 0 3
      panda/src/audio/config_audio.cxx
  7. 0 54
      panda/src/gui/Sources.pp
  8. 0 59
      panda/src/gui/config_gui.cxx
  9. 0 32
      panda/src/gui/config_gui.h
  10. 0 36
      panda/src/gui/guiBackground.I
  11. 0 154
      panda/src/gui/guiBackground.cxx
  12. 0 84
      panda/src/gui/guiBackground.h
  13. 0 20
      panda/src/gui/guiBehavior.I
  14. 0 75
      panda/src/gui/guiBehavior.cxx
  15. 0 93
      panda/src/gui/guiBehavior.h
  16. 0 306
      panda/src/gui/guiButton.I
  17. 0 829
      panda/src/gui/guiButton.cxx
  18. 0 168
      panda/src/gui/guiButton.h
  19. 0 31
      panda/src/gui/guiChooser.I
  20. 0 368
      panda/src/gui/guiChooser.cxx
  21. 0 135
      panda/src/gui/guiChooser.h
  22. 0 19
      panda/src/gui/guiCollection.I
  23. 0 164
      panda/src/gui/guiCollection.cxx
  24. 0 80
      panda/src/gui/guiCollection.h
  25. 0 99
      panda/src/gui/guiFrame.I
  26. 0 468
      panda/src/gui/guiFrame.cxx
  27. 0 166
      panda/src/gui/guiFrame.h
  28. 0 94
      panda/src/gui/guiItem.I
  29. 0 128
      panda/src/gui/guiItem.cxx
  30. 0 102
      panda/src/gui/guiItem.h
  31. 0 166
      panda/src/gui/guiLabel.I
  32. 0 831
      panda/src/gui/guiLabel.cxx
  33. 0 165
      panda/src/gui/guiLabel.h
  34. 0 19
      panda/src/gui/guiListBox.I
  35. 0 446
      panda/src/gui/guiListBox.cxx
  36. 0 130
      panda/src/gui/guiListBox.h
  37. 0 48
      panda/src/gui/guiManager.I
  38. 0 287
      panda/src/gui/guiManager.cxx
  39. 0 86
      panda/src/gui/guiManager.h
  40. 0 62
      panda/src/gui/guiRollover.I
  41. 0 225
      panda/src/gui/guiRollover.cxx
  42. 0 99
      panda/src/gui/guiRollover.h
  43. 0 20
      panda/src/gui/guiSign.I
  44. 0 114
      panda/src/gui/guiSign.cxx
  45. 0 78
      panda/src/gui/guiSign.h
  46. 0 9
      panda/src/gui/gui_composite1.cxx
  47. 0 9
      panda/src/gui/gui_composite2.cxx
  48. 0 28
      panda/src/testbed/Sources.pp
  49. 0 630
      panda/src/testbed/deadrec_rec.cxx
  50. 0 606
      panda/src/testbed/deadrec_send.cxx
  51. 0 1248
      panda/src/testbed/gui_demo.cxx

+ 1 - 1
panda/metalibs/panda/Sources.pp

@@ -16,7 +16,7 @@
     parametrics pnm \
     pnmimagetypes pnmimage sgattrib sgmanip sgraph sgraphutil \
     switchnode text tform tiff lerp loader putil effects \
-    audio gui pgui pandabase 
+    audio pgui pandabase 
 
 
 

+ 2 - 4
panda/src/audio/Sources.pp

@@ -3,15 +3,14 @@
 
 #begin lib_target
   #define TARGET audio
-  #define LOCAL_LIBS putil gui
+  #define LOCAL_LIBS putil
 
   #define SOURCES \
     config_audio.cxx config_audio.h \
     audioManager.I audioManager.cxx audioManager.h \
     audioSound.cxx audioSound.h \
     nullAudioManager.cxx nullAudioManager.h \
-    nullAudioSound.cxx nullAudioSound.h \
-    audio_gui_functor.h audio_gui_functor.cxx
+    nullAudioSound.cxx nullAudioSound.h
 
   #define INSTALL_HEADERS \
     config_audio.h \
@@ -20,7 +19,6 @@
     audioSound.h \
     nullAudioManager.h \
     nullAudioSound.h \
-    audio_gui_functor.h
 
   #define IGATESCAN audio.h
 #end lib_target

+ 0 - 1
panda/src/audio/audio.h

@@ -21,6 +21,5 @@
 
 #include "audioSound.h"
 #include "audioManager.h"
-#include "audio_gui_functor.h"
 
 #endif /* __AUDIO_H__ */

+ 0 - 44
panda/src/audio/audio_gui_functor.cxx

@@ -1,44 +0,0 @@
-// Filename: audio_gui_functor.cxx
-// Created by:  cary (19Apr01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "audio_gui_functor.h"
-
-TypeHandle AudioGuiFunctor::_type_handle;
-
-AudioGuiFunctor::
-AudioGuiFunctor(AudioSound* sound,
-    GuiBehavior::BehaviorFunctor* prev)
-    : GuiBehavior::BehaviorFunctor(), _prev(prev), _sound(sound) {
-}
-
-AudioGuiFunctor::
-~AudioGuiFunctor() {
-  _prev.clear();
-}
-
-#include "audioManager.h"
-
-void AudioGuiFunctor::
-doit(GuiBehavior* b) {
-  if (_sound) {
-    _sound->play();
-  }
-  if (_prev) {
-    _prev->doit(b);
-  }
-}

+ 0 - 63
panda/src/audio/audio_gui_functor.h

@@ -1,63 +0,0 @@
-// Filename: audio_gui_functor.h
-// Created by:  cary (19Apr01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __AUDIO_GUI_FUNCTOR_H__
-#define __AUDIO_GUI_FUNCTOR_H__
-
-#include <guiBehavior.h>
-#include "audioSound.h"
-
-class EXPCL_PANDA AudioGuiFunctor : public GuiBehavior::BehaviorFunctor {
-protected:
-  PT(GuiBehavior::BehaviorFunctor) _prev;
-  PT(AudioSound) _sound;
-
-public:
-  virtual ~AudioGuiFunctor();
-  virtual void doit(GuiBehavior*);
-
-PUBLISHED:
-  AudioGuiFunctor(AudioSound* = (AudioSound*)0L,
-                  GuiBehavior::BehaviorFunctor* =
-                  (GuiBehavior::BehaviorFunctor*)0L);
-  INLINE AudioSound* get_sound() const { return _sound; }
-  INLINE GuiBehavior::BehaviorFunctor* get_prev() const { return _prev; }
-
-public:
-  // type interface
-  static TypeHandle get_class_type() {
-    return _type_handle;
-  }
-  static void init_type() {
-    GuiBehavior::BehaviorFunctor::init_type();
-    register_type(_type_handle, "AudioGuiFunctor",
-                  GuiBehavior::BehaviorFunctor::get_class_type());
-  }
-  virtual TypeHandle get_type() const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type() {
-    init_type();
-    return get_class_type();
-  }
-
-private:
-  static TypeHandle _type_handle;
-};
-
-#endif /* __AUDIO_GUI_FUNCTOR_H__ */

+ 0 - 3
panda/src/audio/config_audio.cxx

@@ -17,7 +17,6 @@
 ////////////////////////////////////////////////////////////////////
 
 #include "config_audio.h"
-#include "audio_gui_functor.h"
 #include <dconfig.h>
 
 Configure(config_audio);
@@ -57,8 +56,6 @@ string* audio_library_name;
 
 
 ConfigureFn(config_audio) {
-  AudioGuiFunctor::init_type();
-
   audio_dls_file = new string(
       config_audio.GetString("audio-dls-file", ""));
 

+ 0 - 54
panda/src/gui/Sources.pp

@@ -1,54 +0,0 @@
-#define OTHER_LIBS interrogatedb:c dconfig:c dtoolconfig:m \
-                   dtoolutil:c dtoolbase:c dtool:m
-
-#begin lib_target
-  #define TARGET gui
-
-  #define LOCAL_LIBS \
-    putil display tform device pandabase dgraph sgattrib light gobj text
-    
-  #define COMBINED_SOURCES $[TARGET]_composite1.cxx $[TARGET]_composite2.cxx    
-
-  #define SOURCES \
-     config_gui.h guiManager.h guiManager.I guiLabel.h guiLabel.I \
-     guiItem.h guiItem.I guiRollover.h guiRollover.I guiButton.h \
-     guiButton.I guiFrame.h guiFrame.I guiSign.h guiSign.I \
-     guiListBox.h guiListBox.I guiBackground.h guiBackground.I \
-     guiBehavior.h guiBehavior.I guiChooser.h guiChooser.I \
-     guiCollection.h guiCollection.I 
-    
-  #define INCLUDED_SOURCES \
-     config_gui.cxx guiManager.cxx guiLabel.cxx guiItem.cxx \
-     guiRollover.cxx guiButton.cxx guiFrame.cxx guiSign.cxx \
-     guiListBox.cxx guiBackground.cxx guiBehavior.cxx \
-     guiChooser.cxx guiCollection.cxx 
-
-  #define INSTALL_HEADERS \
-    guiManager.h guiManager.I \
-    guiLabel.h guiLabel.I \
-    guiItem.h guiItem.I \
-    guiRollover.h guiRollover.I \
-    guiButton.h guiButton.I \
-    guiFrame.h guiFrame.I \
-    guiSign.h guiSign.I \
-    guiListBox.h guiListBox.I \
-    guiBackground.h guiBackground.I \
-    guiBehavior.h guiBehavior.I \
-    guiChooser.h guiChooser.I \
-    guiCollection.h guiCollection.I
-
-  #define IGATESCAN \
-    guiManager.h guiManager.I \
-    guiLabel.h guiLabel.I \
-    guiItem.h guiItem.I \
-    guiRollover.h guiRollover.I \
-    guiButton.h guiButton.I \
-    guiFrame.h guiFrame.I \
-    guiSign.h guiSign.I \
-    guiListBox.h guiListBox.I \
-    guiBackground.h guiBackground.I \
-    guiBehavior.h guiBehavior.I \
-    guiChooser.h guiChooser.I \
-    guiCollection.h guiCollection.I
-
-#end lib_target

+ 0 - 59
panda/src/gui/config_gui.cxx

@@ -1,59 +0,0 @@
-// Filename: config_gui.cxx
-// Created by:  cary (26Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "config_gui.h"
-#include "guiLabel.h"
-#include "guiItem.h"
-#include "guiSign.h"
-#include "guiRollover.h"
-#include "guiButton.h"
-#include "guiFrame.h"
-#include "guiListBox.h"
-#include "guiBehavior.h"
-#include "guiBackground.h"
-#include "guiChooser.h"
-#include "guiCollection.h"
-
-#include <dconfig.h>
-
-Configure(config_gui);
-NotifyCategoryDef(gui, "");
-
-ConfigureFn(config_gui) {
-  GuiLabel::init_type();
-  GuiItem::init_type();
-  GuiBehavior::init_type();
-  GuiBehavior::BehaviorFunctor::init_type();
-  GuiSign::init_type();
-  GuiRollover::init_type();
-  GuiButton::init_type();
-  GuiFrame::init_type();
-  GuiListBox::init_type();
-  GuiBackground::init_type();
-  GuiChooser::init_type();
-  GuiCollection::init_type();
-}
-
-float simple_text_margin_top =
-  config_gui.GetFloat("simple-text-margin-top", 0.02);
-float simple_text_margin_bottom =
-  config_gui.GetFloat("simple-text-margin-bottom", 0.05);
-float simple_text_margin_left =
-  config_gui.GetFloat("simple-text-margin-left", 0.02);
-float simple_text_margin_right =
-  config_gui.GetFloat("simple-text-margin-right", 0.02);

+ 0 - 32
panda/src/gui/config_gui.h

@@ -1,32 +0,0 @@
-// Filename: config_gui.h
-// Created by:  cary (26Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __CONFIG_GUI_H__
-#define __CONFIG_GUI_H__
-
-#include <pandabase.h>
-#include <notifyCategoryProxy.h>
-
-NotifyCategoryDecl(gui, EXPCL_PANDA, EXPTP_PANDA);
-
-extern float simple_text_margin_top;
-extern float simple_text_margin_bottom;
-extern float simple_text_margin_left;
-extern float simple_text_margin_right;
-
-#endif /* __CONFIG_GUI_H__ */

+ 0 - 36
panda/src/gui/guiBackground.I

@@ -1,36 +0,0 @@
-// Filename: guiBackground.I
-// Created by:  cary (05Feb01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-INLINE GuiBackground::GuiBackground(void) {
-}
-
-INLINE void GuiBackground::set_color(float r, float g, float b, float a) {
-  _bg->set_foreground_color(r, g, b, a);
-}
-
-INLINE void GuiBackground::set_color(const Colorf& c) {
-  _bg->set_foreground_color(c);
-}
-
-INLINE Colorf GuiBackground::get_color(void) const {
-  return _bg->get_foreground_color();
-}
-
-INLINE void GuiBackground::reassert(void) {
-  _item->set_priority(_bg, P_High);
-}

+ 0 - 154
panda/src/gui/guiBackground.cxx

@@ -1,154 +0,0 @@
-// Filename: guiBackground.cxx
-// Created by:  cary (05Feb01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "guiBackground.h"
-#include "config_gui.h"
-
-TypeHandle GuiBackground::_type_handle;
-
-void GuiBackground::recompute_frame(void) {
-  _item->recompute();
-  _bg->set_width(_item->get_width());
-  _bg->set_height(_item->get_height());
-  _bg->set_pos(LVector3f::rfu((_item->get_left() + _item->get_right())*0.5, 0.,
-                              (_item->get_bottom() + _item->get_top())*0.5));
-  _bg->recompute();
-  GuiItem::recompute_frame();
-  this->adjust_region();
-}
-
-void GuiBackground::set_priority(GuiLabel* l, const GuiItem::Priority p) {
-  _bg->set_priority(l, ((p==P_Low)?GuiLabel::P_LOWER:GuiLabel::P_HIGHER));
-}
-
-GuiBackground::GuiBackground(const string& name, GuiItem* item)
-  : GuiItem(name), _item(item) {
-  _bg = GuiLabel::make_simple_card_label();
-  _bg->set_width(_item->get_width());
-  _bg->set_height(_item->get_height());
-  _bg->set_pos(LVector3f::rfu((_item->get_left() + _item->get_right())*0.5, 0.,
-                              (_item->get_bottom() + _item->get_top())*0.5));
-  item->set_priority(_bg, P_High);
-}
-
-GuiBackground::GuiBackground(const string& name, GuiItem* item, Texture* tex)
-  : GuiItem(name), _item(item) {
-  _bg = GuiLabel::make_simple_texture_label(tex);
-  _bg->set_width(_item->get_width());
-  _bg->set_height(_item->get_height());
-  _bg->set_pos(LVector3f::rfu((_item->get_left() + _item->get_right())*0.5, 0.,
-                              (_item->get_bottom() + _item->get_top())*0.5));
-  item->set_priority(_bg, P_High);
-}
-
-GuiBackground::GuiBackground(const string& name, GuiItem* item, GuiLabel* l)
-  : GuiItem(name), _bg(l), _item(item) {
-  _bg->set_width(_item->get_width());
-  _bg->set_height(_item->get_height());
-  _bg->set_pos(LVector3f::rfu((_item->get_left() + _item->get_right())*0.5, 0.,
-                              (_item->get_bottom() + _item->get_top())*0.5));
-  item->set_priority(_bg, P_High);
-}
-
-GuiBackground::~GuiBackground(void) {
-  this->unmanage();
-}
-
-void GuiBackground::manage(GuiManager* mgr, EventHandler& eh) {
-  if (_mgr == (GuiManager*)0L) {
-    mgr->add_label(_bg);
-    _item->manage(mgr, eh);
-    GuiItem::manage(mgr, eh);
-  } else
-    gui_cat->warning() << "tried to manage background (0x" << (void*)this
-                       << ") thta is already managed" << endl;
-}
-
-void GuiBackground::manage(GuiManager* mgr, EventHandler& eh, Node* n) {
-  if (_mgr == (GuiManager*)0L) {
-    mgr->add_label(_bg, n);
-    _item->manage(mgr, eh, n);
-    GuiItem::manage(mgr, eh, n);
-  } else
-    gui_cat->warning() << "tried to manage background (0x" << (void*)this
-                       << ") thta is already managed" << endl;
-}
-
-void GuiBackground::unmanage(void) {
-  if (_mgr != (GuiManager*)0L) {
-    _mgr->remove_label(_bg);
-    _item->unmanage();
-  }
-  GuiItem::unmanage();
-}
-
-int GuiBackground::freeze(void) {
-  _bg->freeze();
-  return _item->freeze();
-}
-
-int GuiBackground::thaw(void) {
-  _bg->thaw();
-  return _item->thaw();
-}
-
-void GuiBackground::set_scale(float f) {
-  _bg->set_scale(f);
-  _item->set_scale(f);
-  GuiItem::set_scale(f);
-  recompute_frame();
-}
-
-void GuiBackground::set_scale(float x, float y, float z) {
-  _bg->set_scale(x, y, z);
-  _item->set_scale(x, y, z);
-  GuiItem::set_scale(x, y, z);
-  recompute_frame();
-}
-
-void GuiBackground::set_pos(const LVector3f& p) {
-  _bg->set_pos(p);
-  _item->set_pos(p);
-  GuiItem::set_pos(p);
-  recompute_frame();
-}
-
-void GuiBackground::set_priority(GuiItem* it, const GuiItem::Priority p) {
-  _item->set_priority(it, p);
-  if (p == P_Highest)
-    _bg->set_priority(_bg, GuiLabel::P_HIGHEST);
-  else if (p == P_Lowest)
-    _bg->set_priority(_bg, GuiLabel::P_LOWEST);
-  else
-    it->set_priority(_bg, ((p==P_Low)?P_High:P_Low));
-  GuiItem::set_priority(it, p);
-}
-
-int GuiBackground::set_draw_order(int v) {
-  int o = _bg->set_draw_order(v);
-  o = _item->set_draw_order(o);
-  return GuiItem::set_draw_order(o);
-}
-
-void GuiBackground::output(ostream& os) const {
-  GuiItem::output(os);
-  os << "  Background data:" << endl;
-  os << "    bg - 0x" << (void*)_bg << endl;
-  os << "    item - 0x" << (void*)_item << endl;
-  os << *_item;
-}

+ 0 - 84
panda/src/gui/guiBackground.h

@@ -1,84 +0,0 @@
-// Filename: guiBackground.h
-// Created by:  cary (05Feb01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __GUIBACKGROUND_H__
-#define __GUIBACKGROUND_H__
-
-#include "guiItem.h"
-#include "guiManager.h"
-
-class EXPCL_PANDA GuiBackground : public GuiItem {
-private:
-  PT(GuiLabel) _bg;
-  PT(GuiItem) _item;
-
-  INLINE GuiBackground(void);
-  virtual void recompute_frame(void);
-PUBLISHED:
-  GuiBackground(const string&, GuiItem*);
-  GuiBackground(const string&, GuiItem*, Texture*);
-  GuiBackground(const string&, GuiItem*, GuiLabel*);
-  ~GuiBackground(void);
-
-  virtual void manage(GuiManager*, EventHandler&);
-  virtual void manage(GuiManager*, EventHandler&, Node*);
-  virtual void unmanage(void);
-
-  virtual int freeze(void);
-  virtual int thaw(void);
-
-  virtual void set_scale(float);
-  virtual void set_scale(float, float, float);
-  virtual void set_pos(const LVector3f&);
-  virtual void set_priority(GuiLabel*, const Priority);
-  virtual void set_priority(GuiItem*, const Priority);
-
-  INLINE void set_color(float, float, float, float);
-  INLINE void set_color(const Colorf&);
-  INLINE Colorf get_color(void) const;
-
-  virtual int set_draw_order(int);
-
-  virtual void output(ostream&) const;
-
-  INLINE void reassert(void);
-
-public:
-  // type interface
-  static TypeHandle get_class_type(void) {
-    return _type_handle;
-  }
-  static void init_type(void) {
-    GuiItem::init_type();
-    register_type(_type_handle, "GuiBackground",
-                  GuiItem::get_class_type());
-  }
-  virtual TypeHandle get_type(void) const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type(void) {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "guiBackground.I"
-
-#endif /* __GUIBACKGROUND_H__ */

+ 0 - 20
panda/src/gui/guiBehavior.I

@@ -1,20 +0,0 @@
-// Filename: guiBehavior.I
-// Created by:  cary (07Feb01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-GuiBehavior::GuiBehavior(void) {
-}

+ 0 - 75
panda/src/gui/guiBehavior.cxx

@@ -1,75 +0,0 @@
-// Filename: guiBehavior.cxx
-// Created by:  cary (07Feb01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "guiBehavior.h"
-
-TypeHandle GuiBehavior::_type_handle;
-TypeHandle GuiBehavior::BehaviorFunctor::_type_handle;
-
-GuiBehavior::BehaviorFunctor::BehaviorFunctor(void) : TypedReferenceCount() {
-}
-
-GuiBehavior::BehaviorFunctor::~BehaviorFunctor(void) {
-}
-
-void GuiBehavior::BehaviorFunctor::doit(GuiBehavior*) {
-}
-
-GuiBehavior::GuiBehavior(const string& name) : GuiItem(name),
-                                               _eh((EventHandler*)0L),
-                                               _behavior_running(false) {
-}
-
-GuiBehavior::~GuiBehavior(void) {
-}
-
-void GuiBehavior::manage(GuiManager* mgr, EventHandler& eh) {
-  _eh = &eh;
-  GuiItem::manage(mgr, eh);
-}
-
-void GuiBehavior::manage(GuiManager* mgr, EventHandler& eh, Node* n) {
-  _eh = &eh;
-  GuiItem::manage(mgr, eh, n);
-}
-
-void GuiBehavior::unmanage(void) {
-  if (_behavior_running)
-    this->stop_behavior();
-  _eh = (EventHandler*)0L;
-  GuiItem::unmanage();
-}
-
-void GuiBehavior::start_behavior(void) {
-  _behavior_running = true;
-}
-
-void GuiBehavior::stop_behavior(void) {
-  _behavior_running = false;
-}
-
-void GuiBehavior::reset_behavior(void) {
-}
-
-void GuiBehavior::output(ostream& os) const {
-  GuiItem::output(os);
-  os << "  Behavior Data:" << endl;
-  os << "    behavior is " << (_behavior_running?"":"not ") << "running"
-     << endl;
-  os << "    eh - 0x" << (void*)_eh << endl;
-}

+ 0 - 93
panda/src/gui/guiBehavior.h

@@ -1,93 +0,0 @@
-// Filename: guiBehavior.h
-// Created by:  cary (07Feb01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __GUIBEHAVIOR_H__
-#define __GUIBEHAVIOR_H__
-
-#include "guiItem.h"
-
-class EXPCL_PANDA GuiBehavior : public GuiItem {
-protected:
-  EventHandler* _eh;
-  bool _behavior_running;
-
-  INLINE GuiBehavior(void);
-PUBLISHED:
-  class EXPCL_PANDA BehaviorFunctor : public TypedReferenceCount {
-  public:
-    virtual void doit(GuiBehavior*) = 0;
-  PUBLISHED:
-    BehaviorFunctor(void);
-    virtual ~BehaviorFunctor(void);
-  public:
-    // type interface
-    static TypeHandle get_class_type(void) {
-      return _type_handle;
-    }
-    static void init_type(void) {
-      TypedReferenceCount::init_type();
-      register_type(_type_handle, "GuiBehavior::BehaviorFunctor",
-                    TypedReferenceCount::get_class_type());
-    }
-    virtual TypeHandle get_type(void) const {
-      return get_class_type();
-    }
-    virtual TypeHandle force_init_type(void) {
-      init_type();
-      return get_class_type();
-    }
-  private:
-    static TypeHandle _type_handle;
-  };
-PUBLISHED:
-  GuiBehavior(const string&);
-  virtual ~GuiBehavior(void);
-
-  virtual void manage(GuiManager*, EventHandler&) = 0;
-  virtual void manage(GuiManager*, EventHandler&, Node*) = 0;
-  virtual void unmanage(void) = 0;
-
-  virtual void start_behavior(void) = 0;
-  virtual void stop_behavior(void) = 0;
-  virtual void reset_behavior(void) = 0;
-
-  virtual void output(ostream&) const = 0;
-public:
-  // type interface
-  static TypeHandle get_class_type(void) {
-    return _type_handle;
-  }
-  static void init_type(void) {
-    GuiItem::init_type();
-    register_type(_type_handle, "GuiBehavior",
-                  GuiItem::get_class_type());
-  }
-  virtual TypeHandle get_type(void) const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type(void) {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "guiBehavior.I"
-
-#endif /* __GUIBEHAVIOR_H__ */

+ 0 - 306
panda/src/gui/guiButton.I

@@ -1,306 +0,0 @@
-// Filename: guiButton.I
-// Created by:  cary (30Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-INLINE GuiButton::GuiButton(void) {
-}
-
-INLINE bool GuiButton::owns_region(const MouseWatcherRegion* rgn) const {
-  return (_rgn == rgn);
-}
-
-INLINE void GuiButton::enter(void) {
-  switch (_state) {
-  case UP:
-    switch_state(UP_ROLLOVER);
-    break;
-  case DOWN:
-    switch_state(DOWN_ROLLOVER);
-    break;
-  case INACTIVE:
-    switch_state(INACTIVE_ROLLOVER);
-    break;
-  default:
-    break;
-  }
-}
-
-INLINE void GuiButton::exit(void) {
-  switch (_state) {
-  case UP_ROLLOVER:
-    switch_state(UP);
-    break;
-  case DOWN_ROLLOVER:
-    switch_state(DOWN);
-    break;
-  case INACTIVE_ROLLOVER:
-    switch_state(INACTIVE);
-    break;
-  default:
-    break;
-  }
-}
-
-INLINE void GuiButton::up(void) {
-  switch (_state) {
-  case NONE:
-  case DOWN:
-  case INACTIVE:
-    switch_state(UP);
-    break;
-  case DOWN_ROLLOVER:
-  case INACTIVE_ROLLOVER:
-    switch_state(UP_ROLLOVER);
-    break;
-  case UP:
-  case UP_ROLLOVER:
-    break;
-  default:
-    gui_cat->warning() << "got up from invalid state (" << (int)_state << "),"
-                       << " button '" << this->get_name() << "'" << endl;
-  }
-}
-
-INLINE void GuiButton::down(void) {
-  switch (_state) {
-  case NONE:
-  case UP:
-  case INACTIVE:
-    switch_state(DOWN);
-    break;
-  case UP_ROLLOVER:
-  case INACTIVE_ROLLOVER:
-    switch_state(DOWN_ROLLOVER);
-    break;
-  case DOWN:
-  case DOWN_ROLLOVER:
-    break;
-  default:
-    gui_cat->warning() << "got down from invalid state (" << (int)_state
-                       << "), button '" << this->get_name() << "'" << endl;
-  }
-}
-
-INLINE void GuiButton::inactive(void) {
-  switch (_state) {
-  case NONE:
-  case UP:
-  case DOWN:
-    switch_state(INACTIVE);
-    break;
-  case UP_ROLLOVER:
-  case DOWN_ROLLOVER:
-    switch_state(INACTIVE_ROLLOVER);
-    break;
-  case INACTIVE:
-  case INACTIVE_ROLLOVER:
-    break;
-  default:
-    gui_cat->warning() << "got inactive from invalid state (" << (int)_state
-                       << "), button '" << this->get_name() << "'" << endl;
-  }
-  this->stop_behavior();
-}
-
-INLINE void GuiButton::click(void) {
-  switch (_state) {
-  case NONE:
-  case UP:
-  case UP_ROLLOVER:
-    down();
-    break;
-  case DOWN:
-  case DOWN_ROLLOVER:
-    up();
-    break;
-  case INACTIVE:
-  case INACTIVE_ROLLOVER:
-    break;
-  default:
-    gui_cat->warning() << "got click from invalid state (" << (int)_state
-                       << "), button '" << this->get_name() << "'" << endl;
-  }
-}
-
-INLINE bool GuiButton::is_up(void) const {
-  if ((_state == UP) || (_state == UP_ROLLOVER))
-    return true;
-  return false;
-}
-
-INLINE bool GuiButton::is_over(void) const {
-  if ((_state == UP_ROLLOVER) || (_state == DOWN_ROLLOVER))
-    return true;
-  return false;
-}
-
-INLINE bool GuiButton::is_active(void) const {
-  if ((_state == INACTIVE) || (_state == NONE))
-    return false;
-  return true;
-}
-
-INLINE void GuiButton::set_up_event(const string& s) {
-  if (_behavior_running)
-    if (_mgr != (GuiManager*)0L)
-      _eh->remove_hook(_up_event, GuiButton::behavior_up);
-  _up_event = s;
-  if (_behavior_running)
-    if (_mgr != (GuiManager*)0L)
-      _eh->add_hook(_up_event, GuiButton::behavior_up);
-}
-
-INLINE void GuiButton::set_up_rollover_event(const string& s) {
-  if (_behavior_running)
-    if (_mgr != (GuiManager*)0L)
-      _eh->remove_hook(_up_rollover_event, GuiButton::behavior_up);
-  _up_rollover_event = s;
-  if (_behavior_running)
-    if (_mgr != (GuiManager*)0L)
-      _eh->add_hook(_up_rollover_event, GuiButton::behavior_up);
-}
-
-INLINE void GuiButton::set_down_event(const string& s) {
-  if (_behavior_running)
-    if (_mgr != (GuiManager*)0L)
-      _eh->remove_hook(_down_event, GuiButton::behavior_up);
-  _down_event = s;
-  if (_behavior_running)
-    if (_mgr != (GuiManager*)0L)
-      _eh->add_hook(_down_event, GuiButton::behavior_up);
-}
-
-INLINE void GuiButton::set_down_rollover_event(const string& s) {
-  if (_behavior_running)
-    if (_mgr != (GuiManager*)0L)
-      _eh->remove_hook(_down_rollover_event, GuiButton::behavior_up);
-  _down_rollover_event = s;
-  if (_behavior_running)
-    if (_mgr != (GuiManager*)0L)
-      _eh->add_hook(_down_rollover_event, GuiButton::behavior_up);
-}
-
-INLINE void GuiButton::set_inactive_event(const string& s) {
-  _inactive_event = s;
-}
-
-INLINE void GuiButton::set_behavior_event(const string& s) {
-  _behavior_event = s;
-}
-
-INLINE const string& GuiButton::get_up_event(void) const {
-  return _up_event;
-}
-
-INLINE const string& GuiButton::get_up_rollover_event(void) const {
-  return _up_rollover_event;
-}
-
-INLINE const string& GuiButton::get_down_event(void) const {
-  return _down_event;
-}
-
-INLINE const string& GuiButton::get_down_rollover_event(void) const {
-  return _down_rollover_event;
-}
-
-INLINE const string& GuiButton::get_inactive_event(void) const {
-  return _inactive_event;
-}
-
-INLINE const string& GuiButton::get_behavior_event(void) const {
-  return _behavior_event;
-}
-
-INLINE void GuiButton::set_up_rollover(GuiLabel* upr) {
-  _up_rollover = upr;
-  if (_up_rollover_event.empty())
-    _up_rollover_event = this->get_name() + "-up-rollover";
-}
-
-INLINE void GuiButton::set_down_rollover(GuiLabel* downr) {
-  _down_rollover = downr;
-  if (_down_rollover_event.empty())
-    _down_rollover_event = this->get_name() + "-down-rollover";
-}
-
-INLINE void GuiButton::set_behavior_functor(GuiBehavior::BehaviorFunctor* f) {
-  _behavior_functor = f;
-}
-
-INLINE GuiBehavior::BehaviorFunctor*
-GuiButton::get_behavior_functor(void) const {
-  return _behavior_functor;
-}
-
-INLINE void GuiButton::set_rollover_functor(GuiBehavior::BehaviorFunctor* f) {
-  _rollover_functor = f;
-}
-
-INLINE GuiBehavior::BehaviorFunctor*
-GuiButton::get_rollover_functor(void) const {
-  return _rollover_functor;
-}
-
-INLINE void GuiButton::set_behavior_event_parameter(int p) {
-  this->_have_event_param = true;
-  this->_event_param = p;
-}
-
-INLINE int GuiButton::get_behavior_event_parameter(void) const {
-  return this->_event_param;
-}
-
-INLINE void GuiButton::set_up_label(GuiLabel* l) {
-  _up = l;
-}
-
-INLINE void GuiButton::set_up_rollover_label(GuiLabel* l) {
-  _up_rollover = l;
-}
-
-INLINE void GuiButton::set_down_label(GuiLabel* l) {
-  _down = l;
-}
-
-INLINE void GuiButton::set_down_rollover_label(GuiLabel* l) {
-  _down_rollover = l;
-}
-
-INLINE void GuiButton::set_inactive_label(GuiLabel* l){
-  _inactive = l;
-}
-
-INLINE GuiLabel* GuiButton::get_up_label(void) const {
-  return _up;
-}
-
-INLINE GuiLabel* GuiButton::get_up_rollover_label(void) const {
-  return _up_rollover;
-}
-
-INLINE GuiLabel* GuiButton::get_down_label(void) const {
-  return _down;
-}
-
-INLINE GuiLabel* GuiButton::get_down_rollover_label(void) const {
-  return _down_rollover;
-}
-
-INLINE GuiLabel* GuiButton::get_inactive_label(void) const {
-  return _inactive;
-}

+ 0 - 829
panda/src/gui/guiButton.cxx

@@ -1,829 +0,0 @@
-// Filename: guiButton.cxx
-// Created by:  cary (30Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "guiButton.h"
-#include "config_gui.h"
-
-#include <throw_event.h>
-
-#include "pmap.h"
-
-typedef pmap<const MouseWatcherRegion*, GuiButton*> ButtonMap;
-static ButtonMap buttons;
-static bool bAddedHooks = false;
-
-TypeHandle GuiButton::_type_handle;
-
-static inline GuiButton *
-find_in_buttons_map(const MouseWatcherRegion* rgn) {
-  ButtonMap::iterator i = buttons.find(rgn);
-  if (i == buttons.end())
-    return (GuiButton*)0L;
-  return (*i).second;
-}
-
-inline void GetExtents(GuiLabel* v, GuiLabel* w, GuiLabel* x, GuiLabel* y,
-               GuiLabel* z, float& l, float& r, float& b, float& t) {
-  float l1, l2, r1, r2, b1, b2, t1, t2;
-  v->get_extents(l1, r1, b1, t1);
-  w->get_extents(l2, r2, b2, t2);
-  l1 = (l1<l2)?l1:l2;
-  r1 = (r1<r2)?r2:r1;
-  b1 = (b1<b2)?b1:b2;
-  t1 = (t1<t2)?t2:t1;
-  if (x != (GuiLabel*)0L) {
-    x->get_extents(l2, r2, b2, t2);
-    l1 = (l1<l2)?l1:l2;
-    r1 = (r1<r2)?r2:r1;
-    b1 = (b1<b2)?b1:b2;
-    t1 = (t1<t2)?t2:t1;
-  }
-  if (y != (GuiLabel*)0L) {
-    y->get_extents(l2, r2, b2, t2);
-    l1 = (l1<l2)?l1:l2;
-    r1 = (r1<r2)?r2:r1;
-    b1 = (b1<b2)?b1:b2;
-    t1 = (t1<t2)?t2:t1;
-  }
-  if (z != (GuiLabel*)0L) {
-    z->get_extents(l2, r2, b2, t2);
-    l = (l1<l2)?l1:l2;
-    r = (r1<r2)?r2:r1;
-    b = (b1<b2)?b1:b2;
-    t = (t1<t2)?t2:t1;
-  }
-}
-
-inline void my_throw(GuiManager* mgr, const string& name,
-             const EventParameter& p) {
-  throw_event(name, p);
-  if (mgr != (GuiManager*)0L)
-    throw_event_directly(*(mgr->get_private_handler()), name, p);
-}
-
-inline void my_throw(GuiManager* mgr, const string& name,
-             const EventParameter& p1,
-             const EventParameter& p2) {
-  throw_event(name, p1, p2);
-  if (mgr != (GuiManager*)0L)
-    throw_event_directly(*(mgr->get_private_handler()), name, p1, p2);
-}
-
-static void enter_button(CPT_Event e) {
-  const MouseWatcherRegion* rgn = DCAST(MouseWatcherRegion, e->get_parameter(0).get_ptr());
-  GuiButton* val = find_in_buttons_map(rgn);
-  if (val == (GuiButton*)0L)
-    return;  // this one wasn't for us
-  val->test_ref_count_integrity();
-  val->enter();
-}
-
-static void exit_button(CPT_Event e) {
-  const MouseWatcherRegion* rgn = DCAST(MouseWatcherRegion, e->get_parameter(0).get_ptr());
-  GuiButton* val = find_in_buttons_map(rgn);
-  if (val == (GuiButton *)0L)
-    return;  // this one wasn't for us
-  val->test_ref_count_integrity();
-  val->exit();
-}
-
-static void click_button_down(CPT_Event e) {
-  const MouseWatcherRegion* rgn = DCAST(MouseWatcherRegion, e->get_parameter(0).get_ptr());
-  string button = e->get_parameter(1).get_string_value();
-  if (!(button == "mouse1" || button == "mouse2" || button == "mouse3"))
-    return;
-  GuiButton* val = find_in_buttons_map(rgn);
-  if (val == (GuiButton *)0L)
-    return;  // this one wasn't for us
-  val->test_ref_count_integrity();
-  val->down();
-}
-
-static void click_button_up(CPT_Event e) {
-  const MouseWatcherRegion* rgn = DCAST(MouseWatcherRegion, e->get_parameter(0).get_ptr());
-  string button = e->get_parameter(1).get_string_value();
-  if (!(button == "mouse1" || button == "mouse2" || button == "mouse3"))
-    return;
-  GuiButton* val = find_in_buttons_map(rgn);
-  if (val == (GuiButton *)0L)
-    return;  // this one wasn't for us
-  val->test_ref_count_integrity();
-  val->up();
-}
-
-void GuiButton::switch_state(GuiButton::States nstate) {
-  if (_mgr == (GuiManager*)0L) {
-    _state = nstate;
-    return;
-  }
-
-  test_ref_count_integrity();
-  States ostate = _state;
-  // cleanup old state
-  switch (_state) {
-  case NONE:
-    break;
-  case UP:
-    if (_mgr->has_label(_up))
-      _mgr->remove_label(_up);
-    break;
-  case UP_ROLLOVER:
-    if (_mgr->has_label(_up_rollover))
-      _mgr->remove_label(_up_rollover);
-    break;
-  case DOWN:
-    if (_mgr->has_label(_down))
-      _mgr->remove_label(_down);
-    break;
-  case DOWN_ROLLOVER:
-    if (_mgr->has_label(_down_rollover))
-      _mgr->remove_label(_down_rollover);
-    break;
-  case INACTIVE:
-    if (_inactive != (GuiLabel*)0L)
-      if (_mgr->has_label(_inactive))
-    _mgr->remove_label(_inactive);
-    break;
-  case INACTIVE_ROLLOVER:
-    if (_inactive != (GuiLabel*)0L)
-      if (_mgr->has_label(_inactive))
-    _mgr->remove_label(_inactive);
-    break;
-  default:
-    gui_cat->warning() << "switching away from invalid state (" << (int)_state
-               << ")" << endl;
-  }
-  _state = nstate;
-  const EventParameter paramthis = EventParameter(this);
-  // deal with new state
-  switch (_state) {
-  case NONE:
-    if (_mgr->has_region(_rgn))
-      _mgr->remove_region(_rgn);
-    _rgn->set_suppress_flags(0);
-    break;
-  case UP:
-    if (!(_mgr->has_region(_rgn)))
-      _mgr->add_region(_rgn);
-    if (_alt_root.is_null()) {
-      if (!(_mgr->has_label(_up)))
-    _mgr->add_label(_up);
-    } else {
-      if (!(_mgr->has_label(_up)))
-    _mgr->add_label(_up, _alt_root);
-    }
-    if (!_up_event.empty()) {
-#ifdef _DEBUG
-      if (gui_cat.is_debug())
-    gui_cat->debug() << "throwing _up_event '" << _up_event << "'" << endl;
-#endif /* _DEBUG */
-      my_throw(_mgr, _up_event, paramthis);
-#ifdef _DEBUG
-    } else if (gui_cat.is_debug())
-    gui_cat->debug() << "_up_event is empty!" << endl;
-#else /* _DEBUG */
-    }
-#endif /* _DEBUG */
-    _rgn->set_suppress_flags(MouseWatcherRegion::SF_mouse_position);
-    break;
-  case UP_ROLLOVER:
-    if (!(_mgr->has_region(_rgn)))
-      _mgr->add_region(_rgn);
-    if (_up_rollover != (GuiLabel*)0L) {
-      if (_alt_root.is_null()) {
-    if (!(_mgr->has_label(_up_rollover)))
-      _mgr->add_label(_up_rollover);
-      } else {
-    if (!(_mgr->has_label(_up_rollover)))
-      _mgr->add_label(_up_rollover, _alt_root);
-      }
-      if (!_up_rollover_event.empty()) {
-#ifdef _DEBUG
-    if (gui_cat.is_debug())
-      gui_cat->debug() << "throwing _up_rollover_event '"
-               << _up_rollover_event << "'" << endl;
-#endif /* _DEBUG */
-    my_throw(_mgr, _up_rollover_event, paramthis);
-#ifdef _DEBUG
-      } else if (gui_cat.is_debug())
-      gui_cat->debug() << "_up_rollover_event is empty!" << endl;
-#else /* _DEBUG */
-      }
-#endif /* _DEBUG */
-    } else {
-      if (_alt_root.is_null()) {
-    if (!(_mgr->has_label(_up)))
-      _mgr->add_label(_up);
-      } else {
-    if (!(_mgr->has_label(_up)))
-      _mgr->add_label(_up, _alt_root);
-      }
-      if (!_up_event.empty()) {
-#ifdef _DEBUG
-    if (gui_cat.is_debug())
-      gui_cat->debug() << "throwing _up_event '" << _up_event << "'"
-               << endl;
-#endif /* _DEBUG */
-    my_throw(_mgr, _up_event, paramthis);
-#ifdef _DEBUG
-      } else if (gui_cat.is_debug())
-    gui_cat->debug() << "_up_event is empty!" << endl;
-#else /* _DEBUG */
-      }
-#endif /* _DEBUG */
-      _state = UP;
-    }
-    _rgn->set_suppress_flags(MouseWatcherRegion::SF_mouse_position);
-    if ((ostate == UP) &&
-    (_rollover_functor != (GuiBehavior::BehaviorFunctor*)0L))
-      _rollover_functor->doit(this);
-    break;
-  case DOWN:
-    if (!(_mgr->has_region(_rgn)))
-      _mgr->add_region(_rgn);
-    if (_alt_root.is_null()) {
-      if (!(_mgr->has_label(_down)))
-    _mgr->add_label(_down);
-    } else {
-      if (!(_mgr->has_label(_down)))
-    _mgr->add_label(_down, _alt_root);
-    }
-    if (!_down_event.empty()) {
-#ifdef _DEBUG
-      if (gui_cat.is_debug())
-    gui_cat->debug() << "throwing _down_event '" << _down_event << "'"
-             << endl;
-#endif /* _DEBUG */
-      my_throw(_mgr, _down_event, paramthis);
-#ifdef _DEBUG
-    } else if (gui_cat.is_debug())
-      gui_cat->debug() << "_down_event is empty!" << endl;
-#else /* _DEBUG */
-    }
-#endif /* _DEBUG */
-    _rgn->set_suppress_flags(MouseWatcherRegion::SF_mouse_position);
-    break;
-  case DOWN_ROLLOVER:
-    if (!(_mgr->has_region(_rgn)))
-      _mgr->add_region(_rgn);
-    if (_down_rollover != (GuiLabel*)0L) {
-      if (_alt_root.is_null()) {
-    if (!(_mgr->has_label(_down_rollover)))
-      _mgr->add_label(_down_rollover);
-      } else {
-    if (!(_mgr->has_label(_down_rollover)))
-      _mgr->add_label(_down_rollover, _alt_root);
-      }
-      if (!_down_rollover_event.empty()) {
-#ifdef _DEBUG
-    if (gui_cat.is_debug())
-      gui_cat->debug() << "throwing _down_rollover_event '"
-               << _down_rollover_event << "'" << endl;
-#endif /* _DEBUG */
-    my_throw(_mgr, _down_rollover_event, paramthis);
-#ifdef _DEBUG
-      } else if (gui_cat.is_debug())
-    gui_cat->debug() << "_down_rollover_event is empty!" << endl;
-#else /* _DEBUG */
-      }
-#endif /* _DEBUG */
-    } else {
-      if (_alt_root.is_null()) {
-    if (!(_mgr->has_label(_down)))
-      _mgr->add_label(_down);
-      } else {
-    if (!(_mgr->has_label(_down)))
-      _mgr->add_label(_down, _alt_root);
-      }
-      if (!_down_event.empty()) {
-#ifdef _DEBUG
-    if (gui_cat.is_debug())
-      gui_cat->debug() << "throwing _down_event '" << _down_event << "'"
-               << endl;
-#endif /* _DEBUG */
-    my_throw(_mgr, _down_event, paramthis);
-#ifdef _DEBUG
-      } else if (gui_cat.is_debug())
-    gui_cat->debug() << "_down_event is empty!" << endl;
-#else /* _DEBUG */
-      }
-#endif /* _DEBUG */
-      _state = DOWN;
-    }
-    _rgn->set_suppress_flags(MouseWatcherRegion::SF_mouse_position);
-    break;
-  case INACTIVE:
-    if (_mgr->has_region(_rgn))
-      _mgr->remove_region(_rgn);
-    if (_inactive != (GuiLabel*)0L) {
-      if (_alt_root.is_null()) {
-    if (!(_mgr->has_label(_inactive)))
-      _mgr->add_label(_inactive);
-      } else {
-    if (!(_mgr->has_label(_inactive)))
-      _mgr->add_label(_inactive, _alt_root);
-      }
-      if (!_inactive_event.empty()) {
-#ifdef _DEBUG
-    if (gui_cat.is_debug())
-      gui_cat->debug() << "throwing _inactive_event '" << _inactive_event
-               << "'" << endl;
-#endif /* _DEBUG */
-    my_throw(_mgr, _inactive_event, paramthis);
-      }
-    }
-    _rgn->set_suppress_flags(0);
-    break;
-  case INACTIVE_ROLLOVER:
-    if (_mgr->has_region(_rgn))
-      _mgr->remove_region(_rgn);
-    if (_inactive != (GuiLabel*)0L) {
-      if (_alt_root.is_null()) {
-    if (!(_mgr->has_label(_inactive)))
-      _mgr->add_label(_inactive);
-      } else {
-    if (!(_mgr->has_label(_inactive)))
-      _mgr->add_label(_inactive, _alt_root);
-      }
-      if (!_inactive_event.empty()) {
-#ifdef _DEBUG
-    if (gui_cat.is_debug())
-      gui_cat->debug() << "throwing _inactive_event '" << _inactive_event
-               << "'" << endl;
-#endif /* _DEBUG */
-    my_throw(_mgr, _inactive_event, paramthis);
-      }
-    }
-    _rgn->set_suppress_flags(0);
-    break;
-  default:
-    gui_cat->warning() << "switched to invalid state (" << (int)_state << ")"
-               << endl;
-  }
-  if (_state != NONE)
-    _mgr->recompute_priorities();
-}
-
-void GuiButton::recompute_frame(void) {
-  GuiBehavior::recompute_frame();
-  _up->recompute();
-  _down->recompute();
-  if (_up_rollover != (GuiLabel*)0L)
-    _up_rollover->recompute();
-  if (_down_rollover != (GuiLabel*)0L)
-    _down_rollover->recompute();
-  if (_inactive != (GuiLabel*)0L)
-    _inactive->recompute();
-  this->adjust_region();
-}
-
-void GuiButton::adjust_region(void) {
-  GetExtents(_up, _down, _up_rollover, _down_rollover, _inactive, _left,
-         _right, _bottom, _top);
-  GuiBehavior::adjust_region();
-  _rgn->set_frame(_left, _right, _bottom, _top);
-}
-
-void GuiButton::set_priority(GuiLabel* l, GuiItem::Priority p) {
-  _up->set_priority(l, ((p==P_Low)?GuiLabel::P_LOWER:GuiLabel::P_HIGHER));
-  _down->set_priority(l, ((p==P_Low)?GuiLabel::P_LOWER:GuiLabel::P_HIGHER));
-  if (_up_rollover != (GuiLabel*)0L)
-    _up_rollover->set_priority(l, ((p==P_Low)?GuiLabel::P_LOWER:
-                   GuiLabel::P_HIGHER));
-  if (_down_rollover != (GuiLabel*)0L)
-    _down_rollover->set_priority(l, ((p==P_Low)?GuiLabel::P_LOWER:
-                     GuiLabel::P_HIGHER));
-  if (_inactive != (GuiLabel*)0L)
-    _inactive->set_priority(l, ((p==P_Low)?GuiLabel::P_LOWER:
-                GuiLabel::P_HIGHER));
-  GuiItem::set_priority(l, p);
-}
-
-void GuiButton::behavior_up(CPT_Event e) {
-  const GuiButton* button = DCAST(GuiButton, e->get_parameter(0).get_ptr());
-#ifdef _DEBUG
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "behavior_up (0x" << (void*)button << ")" << endl;
-#endif /* _DEBUG */
-  button->run_button_up();
-}
-
-void GuiButton::behavior_down(CPT_Event e) {
-  const GuiButton* button = DCAST(GuiButton, e->get_parameter(0).get_ptr());
-#ifdef _DEBUG
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "behavior_down (0x" << (void*)button << ")" << endl;
-#endif /* _DEBUG */
-  button->run_button_down();
-}
-
-void GuiButton::run_button_up(void) const {
-#ifdef _DEBUG
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "run_button_up (0x" << (void*)this << " '"
-             << this->get_name() << "')" << endl;
-#endif /* _DEBUG */
-  if ((_eh == (EventHandler*)0L) || (!(this->_behavior_running)))
-    return;
-#ifdef _DEBUG
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "doing work" << endl;
-#endif /* _DEBUG */
-  _mgr->get_private_handler()->remove_hook(_up_event, GuiButton::behavior_up);
-  _mgr->get_private_handler()->remove_hook(_up_rollover_event,
-                                           GuiButton::behavior_up);
-  const EventParameter paramthis = EventParameter(this);
-  if (!_behavior_event.empty()) {
-    if (_have_event_param) {
-#ifdef _DEBUG
-      if (gui_cat.is_debug())
-    gui_cat->debug() << "throwing behavior event '" << _behavior_event
-             << "' with parameter (" << _event_param << ")"
-             << endl;
-#endif /* _DEBUG */
-      const EventParameter paramparam = EventParameter(_event_param);
-      my_throw(_mgr, _behavior_event, paramthis, paramparam);
-    } else {
-#ifdef _DEBUG
-      if (gui_cat.is_debug())
-    gui_cat->debug() << "throwing behavior event '" << _behavior_event
-             << "'" << endl;
-#endif /* _DEBUG */
-      my_throw(_mgr, _behavior_event, paramthis);
-    }
-  }
-  if (_behavior_functor != (GuiBehavior::BehaviorFunctor*)0L)
-    _behavior_functor->doit((GuiBehavior*)this);
-}
-
-void GuiButton::run_button_down(void) const {
-#ifdef _DEBUG
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "run_button_down (0x" << (void*)this << " '"
-             << this->get_name() << "')" << endl;
-#endif /* _DEBUG */
-  if ((_eh == (EventHandler*)0L) || (!(this->_behavior_running)))
-    return;
-#ifdef _DEBUG
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "doing work, up_event is '" << _up_event << "' '"
-             << _up_rollover_event << "'" << endl;
-#endif /* _DEBUG */
-  _mgr->get_private_handler()->add_hook(_up_event, GuiButton::behavior_up);
-  _mgr->get_private_handler()->add_hook(_up_rollover_event,
-                                        GuiButton::behavior_up);
-}
-
-GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* down)
-  : GuiBehavior(name), _up(up), _up_rollover((GuiLabel*)0L), _down(down),
-    _down_rollover((GuiLabel*)0L), _inactive((GuiLabel*)0L),
-    _up_event("GuiButton-up"), _up_rollover_event(""),
-    _down_event("GuiButton-down"), _down_rollover_event(""),
-    _inactive_event(""), _up_scale(up->get_scale()), _upr_scale(1.),
-    _down_scale(down->get_scale()), _downr_scale(1.), _inactive_scale(1.),
-    _state(GuiButton::NONE), _have_event_param(false), _event_param(0),
-    _behavior_functor((GuiBehavior::BehaviorFunctor*)0L),
-    _rollover_functor((GuiBehavior::BehaviorFunctor*)0L) {
-  GetExtents(up, down, _up_rollover, _down_rollover, _inactive, _left, _right,
-         _bottom, _top);
-  _rgn = new MouseWatcherRegion("button-" + name, _left, _right, _bottom,
-                _top);
-  _rgn->set_suppress_flags(MouseWatcherRegion::SF_mouse_position);
-  buttons[this->_rgn.p()] = this;
-}
-
-GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* down,
-             GuiLabel* inactive)
-  : GuiBehavior(name), _up(up), _up_rollover((GuiLabel*)0L), _down(down),
-    _down_rollover((GuiLabel*)0L), _inactive(inactive),
-    _up_event("GuiButton-up"), _up_rollover_event(""),
-    _down_event("GuiButton-down"), _down_rollover_event(""),
-    _inactive_event("GuiButton-inactive"), _up_scale(up->get_scale()),
-    _upr_scale(1.), _down_scale(down->get_scale()), _downr_scale(1.),
-    _inactive_scale(inactive->get_scale()), _state(GuiButton::NONE),
-    _have_event_param(false), _event_param(0),
-    _behavior_functor((GuiBehavior::BehaviorFunctor*)0L),
-    _rollover_functor((GuiBehavior::BehaviorFunctor*)0L) {
-  GetExtents(up, down, _up_rollover, _down_rollover, inactive, _left, _right,
-         _bottom, _top);
-  _rgn = new MouseWatcherRegion("button-" + name, _left, _right, _bottom,
-                _top);
-  _rgn->set_suppress_flags(MouseWatcherRegion::SF_mouse_position);
-  buttons[this->_rgn.p()] = this;
-}
-
-GuiButton::GuiButton(const string& name, GuiLabel* up, GuiLabel* up_roll,
-             GuiLabel* down, GuiLabel* down_roll, GuiLabel* inactive)
-  : GuiBehavior(name), _up(up), _up_rollover(up_roll), _down(down),
-    _down_rollover(down_roll), _inactive(inactive), _up_event("GuiButton-up"),
-    _up_rollover_event("GuiButton-up-rollover"), _down_event("GuiButton-down"),
-    _down_rollover_event("GuiButton-down-rollover"),
-    _inactive_event("GuiButton-inactive"), _up_scale(up->get_scale()),
-    _upr_scale(up_roll->get_scale()), _down_scale(down->get_scale()),
-    _downr_scale(down_roll->get_scale()),
-    _inactive_scale(inactive->get_scale()), _state(GuiButton::NONE),
-    _have_event_param(false), _event_param(0),
-    _behavior_functor((GuiBehavior::BehaviorFunctor*)0L),
-    _rollover_functor((GuiBehavior::BehaviorFunctor*)0L) {
-  GetExtents(up, down, up_roll, down_roll, inactive, _left, _right, _bottom,
-         _top);
-  _rgn = new MouseWatcherRegion("button-" + name, _left, _right, _bottom,
-                _top);
-  _rgn->set_suppress_flags(MouseWatcherRegion::SF_mouse_position);
-  buttons[this->_rgn.p()] = this;
-}
-
-GuiButton::~GuiButton(void) {
-  this->unmanage();
-
-  // Remove the names from the buttons map, so we don't end up with
-  // an invalid pointer.
-  buttons.erase(this->_rgn.p());
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "erased from button map" << endl;
-  if ((buttons.size() == 0) && bAddedHooks) {
-    /*
-    _eh->remove_hook("gui-enter", enter_button);
-    _eh->remove_hook("gui-exit" + get_name(), exit_button);
-    _eh->remove_hook("gui-button-press", click_button_down);
-    _eh->remove_hook("gui-button-release", click_button_up);
-    bAddedHooks = false;
-    */
-  }
-
-  if (_behavior_functor != (GuiBehavior::BehaviorFunctor*)0L)
-    _behavior_functor.clear();
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "cleared behavior functor" << endl;
-  if (_rollover_functor != (GuiBehavior::BehaviorFunctor*)0L)
-    _rollover_functor.clear();
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "cleared rollover functor" << endl;
-}
-
-void GuiButton::manage(GuiManager* mgr, EventHandler& eh) {
-  if (!bAddedHooks) {
-    mgr->get_private_handler()->add_hook("gui-enter", enter_button);
-    mgr->get_private_handler()->add_hook("gui-exit", exit_button);
-    mgr->get_private_handler()->add_hook("gui-button-press",
-                                         click_button_down);
-    mgr->get_private_handler()->add_hook("gui-button-release",
-                                         click_button_up);
-    bAddedHooks = true;
-  }
-  if (_mgr == (GuiManager*)0L) {
-    GuiBehavior::manage(mgr, eh);
-    if (_behavior_running)
-      this->start_behavior();
-    switch_state(UP);
-  } else
-    gui_cat->warning() << "tried to manage button (0x" << (void*)this
-               << ") that is already managed" << endl;
-}
-
-void GuiButton::manage(GuiManager* mgr, EventHandler& eh, Node* n) {
-  if (!bAddedHooks) {
-    mgr->get_private_handler()->add_hook("gui-enter", enter_button);
-    mgr->get_private_handler()->add_hook("gui-exit", exit_button);
-    mgr->get_private_handler()->add_hook("gui-button-press",
-                                         click_button_down);
-    mgr->get_private_handler()->add_hook("gui-button-release",
-                                         click_button_up);
-    bAddedHooks = true;
-  }
-  if (_mgr == (GuiManager*)0L) {
-    GuiBehavior::manage(mgr, eh, n);
-    if (_behavior_running)
-      this->start_behavior();
-    switch_state(UP);
-  } else
-    gui_cat->warning() << "tried to manage button (0x" << (void*)this
-               << ") that is already managed" << endl;
-}
-
-void GuiButton::unmanage(void) {
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "in GuiButton::unmanage(0x" << (void*)this << ")"
-                     << endl;
-  if (_mgr != (GuiManager*)0L)
-    if (_mgr->has_region(_rgn)) {
-      _mgr->remove_region(_rgn);
-      if (gui_cat.is_debug())
-    gui_cat->debug() << "removed region" << endl;
-    }
-  if (_behavior_running) {
-    this->stop_behavior();
-    if (gui_cat.is_debug())
-      gui_cat->debug() << "behavior stopped" << endl;
-  }
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "switching state to NONE" << endl;
-  _state = NONE;
-  if (_mgr != (GuiManager*)0L) {
-    if (_mgr->has_label(_up))
-      _mgr->remove_label(_up);
-    if (_mgr->has_label(_up_rollover))
-      _mgr->remove_label(_up_rollover);
-    if (_mgr->has_label(_down))
-      _mgr->remove_label(_down);
-    if (_mgr->has_label(_down_rollover))
-      _mgr->remove_label(_down_rollover);
-    if (_mgr->has_label(_inactive))
-      _mgr->remove_label(_inactive);
-  }
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "back from switching state to NONE" << endl;
-  GuiBehavior::unmanage();
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "back from parent unmanage" << endl;
-}
-
-int GuiButton::freeze() {
-  _up->freeze();
-  _down->freeze();
-  if (_up_rollover != (GuiLabel*)0L)
-    _up_rollover->freeze();
-  if (_down_rollover != (GuiLabel*)0L)
-    _down_rollover->freeze();
-  if (_inactive != (GuiLabel*)0L)
-    _inactive->freeze();
-
-  return 0;
-}
-
-int GuiButton::thaw() {
-  _up->thaw();
-  _down->thaw();
-  if (_up_rollover != (GuiLabel*)0L)
-    _up_rollover->thaw();
-  if (_down_rollover != (GuiLabel*)0L)
-    _down_rollover->thaw();
-  if (_inactive != (GuiLabel*)0L)
-    _inactive->thaw();
-
-  return 0;
-}
-
-void GuiButton::set_scale(float f) {
-  _up->set_scale(f * _up_scale);
-  _down->set_scale(f * _down_scale);
-  if (_up_rollover != (GuiLabel*)0L)
-    _up_rollover->set_scale(f * _upr_scale);
-  if (_down_rollover != (GuiLabel*)0L)
-    _down_rollover->set_scale(f * _downr_scale);
-  if (_inactive != (GuiLabel*)0L)
-    _inactive->set_scale(f * _inactive_scale);
-  GuiBehavior::set_scale(f);
-  this->recompute_frame();
-}
-
-void GuiButton::set_scale(float x, float y, float z) {
-  _up->set_scale(x, y, z);
-  _down->set_scale(x, y, z);
-  if (_up_rollover != (GuiLabel*)0L)
-    _up_rollover->set_scale(x, y, z);
-  if (_down_rollover != (GuiLabel*)0L)
-    _down_rollover->set_scale(x, y, z);
-  if (_inactive != (GuiLabel*)0L)
-    _inactive->set_scale(x, y, z);
-  GuiBehavior::set_scale(x, y, z);
-  this->recompute_frame();
-}
-
-void GuiButton::set_pos(const LVector3f& p) {
-  _up->set_pos(p);
-  _down->set_pos(p);
-  if (_up_rollover != (GuiLabel*)0L)
-    _up_rollover->set_pos(p);
-  if (_down_rollover != (GuiLabel*)0L)
-    _down_rollover->set_pos(p);
-  if (_inactive != (GuiLabel*)0L)
-    _inactive->set_pos(p);
-  GuiBehavior::set_pos(p);
-  this->recompute_frame();
-}
-
-void GuiButton::start_behavior(void) {
-  GuiBehavior::start_behavior();
-  if (_mgr == (GuiManager*)0L)
-    return;
-  if (!this->is_active())
-    return;
-  _mgr->get_private_handler()->add_hook(_down_event, GuiButton::behavior_down);
-  _mgr->get_private_handler()->add_hook(_down_rollover_event,
-                                        GuiButton::behavior_down);
-}
-
-void GuiButton::stop_behavior(void) {
-  GuiBehavior::stop_behavior();
-  if (_mgr == (GuiManager*)0L)
-    return;
-  _mgr->get_private_handler()->remove_hook(_up_event, GuiButton::behavior_up);
-  _mgr->get_private_handler()->remove_hook(_up_rollover_event,
-                                           GuiButton::behavior_up);
-}
-
-void GuiButton::reset_behavior(void) {
-  GuiBehavior::reset_behavior();
-  if (_mgr == (GuiManager*)0L)
-    return;
-  this->start_behavior();
-  _mgr->get_private_handler()->remove_hook(_up_event, GuiButton::behavior_up);
-  _mgr->get_private_handler()->remove_hook(_up_rollover_event,
-                                           GuiButton::behavior_up);
-}
-
-void GuiButton::set_priority(GuiItem* i, const GuiItem::Priority p) {
-  if (p == P_Highest) {
-    _up->set_priority(_up, GuiLabel::P_HIGHEST);
-    _down->set_priority(_up, GuiLabel::P_HIGHEST);
-    if (_up_rollover != (GuiLabel*)0L)
-      _up_rollover->set_priority(_up, GuiLabel::P_HIGHEST);
-    if (_down_rollover != (GuiLabel*)0L)
-      _down_rollover->set_priority(_up, GuiLabel::P_HIGHEST);
-    if (_inactive != (GuiLabel*)0L)
-      _inactive->set_priority(_up, GuiLabel::P_HIGHEST);
-  } else if (p == P_Lowest) {
-    _up->set_priority(_up, GuiLabel::P_LOWEST);
-    _down->set_priority(_up, GuiLabel::P_LOWEST);
-    if (_up_rollover != (GuiLabel*)0L)
-      _up_rollover->set_priority(_up, GuiLabel::P_LOWEST);
-    if (_down_rollover != (GuiLabel*)0L)
-      _down_rollover->set_priority(_up, GuiLabel::P_LOWEST);
-    if (_inactive != (GuiLabel*)0L)
-      _inactive->set_priority(_up, GuiLabel::P_LOWEST);
-  } else {
-    i->set_priority(_up, ((p==P_Low)?P_High:P_Low));
-    i->set_priority(_down, ((p==P_Low)?P_High:P_Low));
-    if (_up_rollover != (GuiLabel*)0L)
-      i->set_priority(_up_rollover, ((p==P_Low)?P_High:P_Low));
-    if (_down_rollover != (GuiLabel*)0L)
-      i->set_priority(_down_rollover, ((p==P_Low)?P_High:P_Low));
-    if (_inactive != (GuiLabel*)0L)
-      i->set_priority(_inactive, ((p==P_Low)?P_High:P_Low));
-  }
-  GuiBehavior::set_priority(i, p);
-}
-
-int GuiButton::set_draw_order(int v) {
-  // No two of these labels will ever be drawn simultaneously, so
-  // there's no need to cascade the draw orders.  They can each be
-  // assigned the same value, and the value we return is the maximum
-  // of any of the values returned by the labels.
-  _rgn->set_sort(v);
-  int o = v+1;
-  int o1 = _up->set_draw_order(v);
-  o = max(o, o1);
-  o1 = _down->set_draw_order(v);
-  o = max(o, o1);
-  if (_up_rollover != (GuiLabel*)0L) {
-    o1 = _up_rollover->set_draw_order(v);
-    o = max(o, o1);
-  }
-  if (_down_rollover != (GuiLabel*)0L) {
-    o1 = _down_rollover->set_draw_order(v);
-    o = max(o, o1);
-  }
-  if (_inactive != (GuiLabel*)0L) {
-    o1 = _inactive->set_draw_order(v);
-    o = max(o, o1);
-  }
-  o1 = GuiBehavior::set_draw_order(v);
-  o = max(o, o1);
-  return o;
-}
-
-void GuiButton::output(ostream& os) const {
-  GuiBehavior::output(os);
-  os << "  Button data:" << endl;
-  os << "    up - 0x" << (void*)_up << endl;
-  os << "    up_rollover - 0x" << (void*)_up_rollover << endl;
-  os << "    down - 0x" << (void*)_down << endl;
-  os << "    down_rollover - 0x" << (void*)_down_rollover << endl;
-  os << "    inactive - 0x" << (void*)_inactive << endl;
-  os << "    up event - '" << _up_event << "'" << endl;
-  os << "    up_rollover event - '" << _up_rollover_event << "'" << endl;
-  os << "    down event - '" << _down_event << "'" << endl;
-  os << "    down_rollover event - '" << _down_rollover_event << "'" << endl;
-  os << "    inactive event - '" << _inactive_event << "'" << endl;
-  os << "    behavior event - '" << _behavior_event << "'" << endl;
-  os << "    behavior param - " << _event_param << "'" << endl;
-  os << "    rgn - 0x" << (void*)_rgn << " (" << *_rgn << ")" << endl;
-  os << "      frame - " << _rgn->get_frame() << endl;
-  os << "    state - " << (int)_state << endl;
-}

+ 0 - 168
panda/src/gui/guiButton.h

@@ -1,168 +0,0 @@
-// Filename: guiButton.h
-// Created by:  cary (30Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __GUIBUTTON_H__
-#define __GUIBUTTON_H__
-
-#include "guiBehavior.h"
-#include "guiLabel.h"
-#include "guiManager.h"
-
-#include <mouseWatcherRegion.h>
-
-class EXPCL_PANDA GuiButton : public GuiBehavior {
-private:
-  PT(GuiLabel) _up;
-  PT(GuiLabel) _up_rollover;
-  PT(GuiLabel) _down;
-  PT(GuiLabel) _down_rollover;
-  PT(GuiLabel) _inactive;
-  string _up_event, _up_rollover_event, _down_event, _down_rollover_event;
-  string _inactive_event;
-  PT(MouseWatcherRegion) _rgn;
-
-  float _up_scale;
-  float _upr_scale;
-  float _down_scale;
-  float _downr_scale;
-  float _inactive_scale;
-
-  enum States { NONE, UP, UP_ROLLOVER, DOWN, DOWN_ROLLOVER, INACTIVE,
-                INACTIVE_ROLLOVER };
-  States _state;
-
-  string _behavior_event;
-  bool _have_event_param;
-  int _event_param;
-  PT(GuiBehavior::BehaviorFunctor) _behavior_functor;
-  PT(GuiBehavior::BehaviorFunctor) _rollover_functor;
-
-  INLINE GuiButton(void);
-  void switch_state(States);
-  virtual void recompute_frame(void);
-  virtual void adjust_region(void);
-
-  static void behavior_up(CPT_Event);
-  static void behavior_down(CPT_Event);
-  void run_button_up(void) const;
-  void run_button_down(void) const;
-PUBLISHED:
-  GuiButton(const string&, GuiLabel*, GuiLabel*);
-  GuiButton(const string&, GuiLabel*, GuiLabel*, GuiLabel*);
-  GuiButton(const string&, GuiLabel*, GuiLabel*, GuiLabel*, GuiLabel*,
-            GuiLabel*);
-  virtual ~GuiButton(void);
-
-public:
-  virtual void manage(GuiManager*, EventHandler&);
-  virtual void manage(GuiManager*, EventHandler&, Node*);
-  virtual void unmanage(void);
-
-  INLINE bool owns_region(const MouseWatcherRegion*) const;
-
-PUBLISHED:
-  virtual int freeze();
-  virtual int thaw();
-
-  INLINE void enter(void);
-  INLINE void exit(void);
-  INLINE void up(void);
-  INLINE void down(void);
-  INLINE void inactive(void);
-  INLINE void click(void);
-
-  INLINE bool is_up(void) const;
-  INLINE bool is_over(void) const;
-  INLINE bool is_active(void) const;
-
-  INLINE void set_up_event(const string&);
-  INLINE void set_up_rollover_event(const string&);
-  INLINE void set_down_event(const string&);
-  INLINE void set_down_rollover_event(const string&);
-  INLINE void set_inactive_event(const string&);
-  INLINE void set_behavior_event(const string&);
-
-  INLINE const string& get_up_event(void) const;
-  INLINE const string& get_up_rollover_event(void) const;
-  INLINE const string& get_down_event(void) const;
-  INLINE const string& get_down_rollover_event(void) const;
-  INLINE const string& get_inactive_event(void) const;
-  INLINE const string& get_behavior_event(void) const;
-
-  INLINE void set_up_rollover(GuiLabel*);
-  INLINE void set_down_rollover(GuiLabel*);
-
-  INLINE void set_behavior_functor(GuiBehavior::BehaviorFunctor*);
-  INLINE GuiBehavior::BehaviorFunctor* get_behavior_functor(void) const;
-
-  INLINE void set_rollover_functor(GuiBehavior::BehaviorFunctor*);
-  INLINE GuiBehavior::BehaviorFunctor* get_rollover_functor(void) const;
-
-  INLINE void set_behavior_event_parameter(int);
-  INLINE int get_behavior_event_parameter(void) const;
-
-  INLINE void set_up_label(GuiLabel*);
-  INLINE void set_up_rollover_label(GuiLabel*);
-  INLINE void set_down_label(GuiLabel*);
-  INLINE void set_down_rollover_label(GuiLabel*);
-  INLINE void set_inactive_label(GuiLabel*);
-
-  INLINE GuiLabel* get_up_label(void) const;
-  INLINE GuiLabel* get_up_rollover_label(void) const;
-  INLINE GuiLabel* get_down_label(void) const;
-  INLINE GuiLabel* get_down_rollover_label(void) const;
-  INLINE GuiLabel* get_inactive_label(void) const;
-
-  virtual void set_scale(float);
-  virtual void set_scale(float, float, float);
-  virtual void set_pos(const LVector3f&);
-  virtual void set_priority(GuiLabel*, const Priority);
-  virtual void set_priority(GuiItem*, const Priority);
-
-  virtual void start_behavior(void);
-  virtual void stop_behavior(void);
-  virtual void reset_behavior(void);
-
-  virtual int set_draw_order(int);
-
-  virtual void output(ostream&) const;
-
-public:
-  // type interface
-  static TypeHandle get_class_type(void) {
-    return _type_handle;
-  }
-  static void init_type(void) {
-    GuiBehavior::init_type();
-    register_type(_type_handle, "GuiButton",
-                  GuiBehavior::get_class_type());
-  }
-  virtual TypeHandle get_type(void) const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type(void) {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "guiButton.I"
-
-#endif /* __GUIBUTTON_H__ */

+ 0 - 31
panda/src/gui/guiChooser.I

@@ -1,31 +0,0 @@
-// Filename: guiChooser.I
-// Created by:  cary (08Feb01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-INLINE GuiChooser::GuiChooser(void) {}
-
-INLINE int GuiChooser::get_curr_item(void) const {
-  return _curr;
-}
-
-INLINE void GuiChooser::set_loop(bool b) {
-  _loop = b;
-}
-
-INLINE bool GuiChooser::get_loop(void) const {
-  return _loop;
-}

+ 0 - 368
panda/src/gui/guiChooser.cxx

@@ -1,368 +0,0 @@
-// Filename: guiChooser.cxx
-// Created by:  cary (08Feb01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "guiChooser.h"
-
-TypeHandle GuiChooser::_type_handle;
-TypeHandle GuiChooser::ChooseFunctor::_type_handle;
-
-GuiChooser::ChooseFunctor::ChooseFunctor(GuiChooser* ch,
-                                         GuiBehavior::BehaviorFunctor* func)
-  : GuiBehavior::BehaviorFunctor(), _prev(func), _ch(ch) {
-}
-
-GuiChooser::ChooseFunctor::~ChooseFunctor(void) {
-  _prev.clear();
-}
-
-void GuiChooser::ChooseFunctor::doit(GuiBehavior* b) {
-  if ((b == this->_ch->_prev_button) && this->_ch->_prev_button->is_active())
-    this->_ch->move_prev();
-  if ((b == this->_ch->_next_button) && this->_ch->_next_button->is_active())
-    this->_ch->move_next();
-  if (_prev != (GuiBehavior::BehaviorFunctor*)0L)
-    _prev->doit(b);
-}
-
-void GuiChooser::recompute_frame(void) {
-  float r, l, t, b;
-
-  r = t = -1.;
-  l = b = 1.;
-  for (ItemVector::iterator i=_items.begin(); i!=_items.end(); ++i) {
-    if (r < (*i)->get_right())
-      r = (*i)->get_right();
-    if (l > (*i)->get_left())
-      l = (*i)->get_left();
-    if (b > (*i)->get_bottom())
-      b = (*i)->get_bottom();
-    if (t < (*i)->get_top())
-      t = (*i)->get_top();
-  }
-  if (r < _prev_button->get_right())
-    r = _prev_button->get_right();
-  if (l > _prev_button->get_left())
-    l = _prev_button->get_left();
-  if (b > _prev_button->get_bottom())
-    b = _prev_button->get_bottom();
-  if (t < _prev_button->get_top())
-    t = _prev_button->get_top();
-  if (r < _next_button->get_right())
-    r = _next_button->get_right();
-  if (l > _next_button->get_left())
-    l = _next_button->get_left();
-  if (b > _next_button->get_bottom())
-    b = _next_button->get_bottom();
-  if (t < _next_button->get_top())
-    t = _next_button->get_top();
-
-  _left = l;
-  _right = r;
-  _bottom = b;
-  _top = t;
-
-  GuiBehavior::recompute_frame();
-  this->adjust_region();
-}
-
-void GuiChooser::set_priority(GuiLabel* l, GuiItem::Priority p) {
-  for (ItemVector::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i)->set_priority(l, p);
-  _prev_button->set_priority(l, p);
-  _next_button->set_priority(l, p);
-}
-
-GuiChooser::GuiChooser(const string& name, GuiButton* prev, GuiButton* next)
-  : GuiBehavior(name), _curr(-1), _loop(false), _prev_button(prev),
-    _next_button(next), _prev_functor((GuiChooser::ChooseFunctor*)0L),
-    _next_functor((GuiChooser::ChooseFunctor*)0L) {
-}
-
-GuiChooser::~GuiChooser(void) {
-  this->unmanage();
-}
-
-void GuiChooser::adjust_buttons(void) {
-  if (_curr < 0)
-    return;
-  if (_curr == 0) {
-    _prev_button->exit();
-    _prev_button->inactive();
-  } else {
-    _prev_button->up();
-    if (_behavior_running) {
-      _prev_button->start_behavior();
-      _prev_button->set_behavior_functor(_prev_functor);
-    }
-  }
-  int foo = _items.size() - 1;
-  if (_curr == foo) {
-    _next_button->exit();
-    _next_button->inactive();
-  } else {
-    _next_button->up();
-    if (_behavior_running) {
-      _next_button->start_behavior();
-      _next_button->set_behavior_functor(_next_functor);
-    }
-  }
-}
-
-void GuiChooser::move_prev(void) {
-  if (_curr == -1)
-    return;
-  int tmp = _curr - 1;
-  if (tmp < 0) {
-    if (_loop)
-      tmp += _items.size();
-    else
-      return;
-  }
-  if (_mgr != (GuiManager*)0L) {
-    _items[_curr]->unmanage();
-    if (_alt_root.is_null())
-      _items[tmp]->manage(_mgr, *_eh);
-    else
-      _items[tmp]->manage(_mgr, *_eh, _alt_root);
-    _curr = tmp;
-    this->adjust_buttons();
-    _mgr->recompute_priorities();
-  } else
-    _curr = tmp;
-}
-
-void GuiChooser::move_next(void) {
-  if (_curr == -1)
-    return;
-  int tmp = _curr + 1;
-  int foo = _items.size();
-  if (tmp == foo) {
-    if (_loop)
-      tmp = 0;
-    else
-      return;
-  }
-  if (_mgr != (GuiManager*)0L) {
-    _items[_curr]->unmanage();
-    if (_alt_root.is_null())
-      _items[tmp]->manage(_mgr, *_eh);
-    else
-      _items[tmp]->manage(_mgr, *_eh, _alt_root);
-    _curr = tmp;
-    this->adjust_buttons();
-    _mgr->recompute_priorities();
-  } else
-    _curr = tmp;
-}
-
-void GuiChooser::add_item(GuiItem* item) {
-  _items.push_back(item);
-  if (_curr == -1)
-    _curr = 0;
-  this->recompute_frame();
-}
-
-int GuiChooser::freeze(void) {
-  int result = 0;
-
-  _prev_button->freeze();
-  _next_button->freeze();
-  for (ItemVector::iterator i=_items.begin(); i!=_items.end(); ++i) {
-    int count = (*i)->freeze();
-    result = max(result, count);
-  }
-  return result;
-}
-
-int GuiChooser::thaw(void) {
-  int result = 0;
-
-  _prev_button->thaw();
-  _next_button->thaw();
-  for (ItemVector::iterator i=_items.begin(); i!=_items.end(); ++i) {
-    int count = (*i)->thaw();
-    result = max(result, count);
-  }
-  return result;
-}
-
-void GuiChooser::manage(GuiManager* mgr, EventHandler& eh) {
-  if (_mgr == (GuiManager*)0L) {
-    _prev_button->manage(mgr, eh);
-    _next_button->manage(mgr, eh);
-    if (_curr != -1) {
-      _items[_curr]->manage(mgr, eh);
-      if (_curr == 0)
-        _prev_button->inactive();
-      int foo = _items.size() - 1;
-      if (_curr == foo)
-        _next_button->inactive();
-    } else {
-      _prev_button->inactive();
-      _next_button->inactive();
-    }
-    GuiBehavior::manage(mgr, eh);
-  } else
-    gui_cat->warning() << "tried to manage chooser (0x" << (void*)this
-                       << ") that is already managed" << endl;
-}
-
-void GuiChooser::manage(GuiManager* mgr, EventHandler& eh, Node* n) {
-  if (_mgr == (GuiManager*)0L) {
-    _prev_button->manage(mgr, eh, n);
-    _next_button->manage(mgr, eh, n);
-    if (_curr != -1) {
-      _items[_curr]->manage(mgr, eh, n);
-      if (_curr == 0)
-        _prev_button->inactive();
-      int foo = _items.size() - 1;
-      if (_curr == foo)
-        _next_button->inactive();
-    } else {
-      _prev_button->inactive();
-      _next_button->inactive();
-    }
-    GuiBehavior::manage(mgr, eh, n);
-  } else
-    gui_cat->warning() << "tried to manage chooser (0x" << (void*)this
-                       << ") that is already managed" << endl;
-}
-
-void GuiChooser::unmanage(void) {
-  _prev_button->unmanage();
-  _next_button->unmanage();
-  if (_curr != -1)
-    _items[_curr]->unmanage();
-  GuiBehavior::unmanage();
-}
-
-void GuiChooser::set_scale(float f) {
-  for (ItemVector::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i)->set_scale(f);
-  GuiBehavior::set_scale(f);
-}
-
-void GuiChooser::set_scale(float x, float y, float z) {
-  for (ItemVector::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i)->set_scale(x, y, z);
-  GuiBehavior::set_scale(x, y, z);
-}
-
-void GuiChooser::set_pos(const LVector3f& p) {
-  for (ItemVector::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i)->set_pos(p);
-  GuiBehavior::set_pos(p);
-}
-
-void GuiChooser::start_behavior(void) {
-  GuiBehavior::start_behavior();
-  if (_mgr == (GuiManager*)0L)
-    return;
-  if (_prev_functor != (GuiChooser::ChooseFunctor*)0L) {
-    _prev_button->set_behavior_functor(_prev_functor->get_prev());
-    _prev_functor.clear();
-  }
-  _prev_functor =
-    new GuiChooser::ChooseFunctor(this, _prev_button->get_behavior_functor());
-  _prev_button->set_behavior_functor(_prev_functor);
-  _prev_button->start_behavior();
-  if (_next_functor != (GuiChooser::ChooseFunctor*)0L) {
-    _next_button->set_behavior_functor(_next_functor->get_prev());
-    _next_functor.clear();
-  }
-  _next_functor =
-    new GuiChooser::ChooseFunctor(this, _next_button->get_behavior_functor());
-  _next_button->set_behavior_functor(_next_functor);
-  _next_button->start_behavior();
-}
-
-void GuiChooser::stop_behavior(void) {
-  GuiBehavior::stop_behavior();
-  if (_mgr == (GuiManager*)0L)
-    return;
-  if (_prev_functor != (GuiChooser::ChooseFunctor*)0L) {
-    _prev_button->set_behavior_functor(_prev_functor->get_prev());
-    _prev_functor.clear();
-    _prev_button->stop_behavior();
-  }
-  if (_next_functor != (GuiChooser::ChooseFunctor*)0L) {
-    _next_button->set_behavior_functor(_next_functor->get_prev());
-    _next_functor.clear();
-    _next_button->stop_behavior();
-  }
-}
-
-void GuiChooser::reset_behavior(void) {
-  GuiBehavior::reset_behavior();
-  if (_mgr == (GuiManager*)0L)
-    return;
-  if (_prev_functor != (GuiChooser::ChooseFunctor*)0L)
-    _prev_button->reset_behavior();
-  if (_next_functor != (GuiChooser::ChooseFunctor*)0L)
-    _next_button->reset_behavior();
-}
-
-void GuiChooser::set_priority(GuiItem* it, const GuiItem::Priority p) {
-  for (ItemVector::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i)->set_priority(it, p);
-  _prev_button->set_priority(it, p);
-  _next_button->set_priority(it, p);
-}
-
-int GuiChooser::set_draw_order(int v) {
-  int o = _prev_button->set_draw_order(v);
-  o = _next_button->set_draw_order(o);
-  for (ItemVector::iterator i=_items.begin(); i!=_items.end(); ++i)
-    o = (*i)->set_draw_order(o);
-  return GuiBehavior::set_draw_order(o);
-}
-
-void GuiChooser::set_curr_item(int i) {
-  int foo = _items.size();
-  int ctmp = i;
-  if (i < 0)
-    return;
-  if (i > foo) {
-    if (_loop)
-      ctmp = i % foo;
-    else
-      return;
-  }
-  if (_mgr != (GuiManager*)0L) {
-    _items[_curr]->unmanage();
-    if (_alt_root.is_null())
-      _items[ctmp]->manage(_mgr, *_eh);
-    else
-      _items[ctmp]->manage(_mgr, *_eh, _alt_root);
-    _curr = ctmp;
-    this->adjust_buttons();
-    _mgr->recompute_priorities();
-  } else
-    _curr = ctmp;
-}
-
-void GuiChooser::output(ostream& os) const {
-  GuiBehavior::output(os);
-  os << "  Chooser data:" << endl;
-  os << "    prev button - 0x" << (void*)_prev_button << endl;
-  os << "    next button - 0x" << (void*)_next_button << endl;
-  os << "    current - " << _curr << endl;
-  os << "    items (" << _items.size() << "):" << endl;
-  for (ItemVector::const_iterator i=_items.begin(); i!=_items.end(); ++i)
-    os << "      0x" << (void*)(*i) << endl;
-}

+ 0 - 135
panda/src/gui/guiChooser.h

@@ -1,135 +0,0 @@
-// Filename: guiChooser.h
-// Created by:  cary (08Feb01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __GUICHOOSER_H__
-#define __GUICHOOSER_H__
-
-#include "guiBehavior.h"
-#include "guiButton.h"
-
-#include "pvector.h"
-
-// Only shows one item at a time.  Has two buttons that move back and forth
-// over the list of things it has.  Can do both circular and linear lists.
-class EXPCL_PANDA GuiChooser : public GuiBehavior {
-private:
-  typedef pvector< PT(GuiItem) > ItemVector;
-
-  class EXPCL_PANDA ChooseFunctor : public GuiBehavior::BehaviorFunctor {
-  protected:
-    PT(GuiBehavior::BehaviorFunctor) _prev;
-    GuiChooser* _ch;
-  public:
-    ChooseFunctor(GuiChooser*, GuiBehavior::BehaviorFunctor*);
-    virtual ~ChooseFunctor(void);
-    virtual void doit(GuiBehavior*);
-    INLINE GuiBehavior::BehaviorFunctor* get_prev(void) { return _prev; }
-  public:
-    // type interface
-    static TypeHandle get_class_type(void) {
-      return _type_handle;
-    }
-    static void init_type(void) {
-      GuiBehavior::BehaviorFunctor::init_type();
-      register_type(_type_handle, "ChooseFunctor",
-                    GuiBehavior::BehaviorFunctor::get_class_type());
-    }
-    virtual TypeHandle get_type(void) const {
-      return get_class_type();
-    }
-    virtual TypeHandle force_init_type(void) {
-      init_type();
-      return get_class_type();
-    }
-  private:
-    static TypeHandle _type_handle;
-  };
-
-  friend ChooseFunctor;
-
-  ItemVector _items;
-  int _curr;
-  bool _loop;
-  PT(GuiButton) _prev_button;
-  PT(GuiButton) _next_button;
-
-  PT(ChooseFunctor) _prev_functor;
-  PT(ChooseFunctor) _next_functor;
-
-  INLINE GuiChooser(void);
-  virtual void recompute_frame(void);
-  void adjust_buttons(void);
-PUBLISHED:
-  GuiChooser(const string&, GuiButton*, GuiButton*);
-  ~GuiChooser(void);
-
-  void move_prev(void);
-  void move_next(void);
-  void add_item(GuiItem*);
-
-  INLINE int get_curr_item(void) const;
-  void set_curr_item(int);
-
-  virtual int freeze(void);
-  virtual int thaw(void);
-
-  virtual void manage(GuiManager*, EventHandler&);
-  virtual void manage(GuiManager*, EventHandler&, Node*);
-  virtual void unmanage(void);
-
-  virtual void set_scale(float);
-  virtual void set_scale(float, float, float);
-  virtual void set_pos(const LVector3f&);
-  virtual void set_priority(GuiLabel*, const Priority);
-  virtual void set_priority(GuiItem*, const Priority);
-
-  virtual void start_behavior(void);
-  virtual void stop_behavior(void);
-  virtual void reset_behavior(void);
-
-  virtual int set_draw_order(int);
-
-  virtual void output(ostream&) const;
-
-  INLINE void set_loop(bool);
-  INLINE bool get_loop(void) const;
-public:
-  // type interface
-  static TypeHandle get_class_type(void) {
-    return _type_handle;
-  }
-  static void init_type(void) {
-    GuiBehavior::init_type();
-    register_type(_type_handle, "GuiChooser",
-                  GuiBehavior::get_class_type());
-    ChooseFunctor::init_type();
-  }
-  virtual TypeHandle get_type(void) const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type(void) {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "guiChooser.I"
-
-#endif /* __GUICHOOSER_H__ */

+ 0 - 19
panda/src/gui/guiCollection.I

@@ -1,19 +0,0 @@
-// Filename: guiCollection.I
-// Created by:  cary (07Mar01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-INLINE GuiCollection::GuiCollection(void) {}

+ 0 - 164
panda/src/gui/guiCollection.cxx

@@ -1,164 +0,0 @@
-// Filename: guiCollection.cxx
-// Created by:  cary (07Mar01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "guiCollection.h"
-
-TypeHandle GuiCollection::_type_handle;
-
-void GuiCollection::recompute_frame(void) {
-  GuiItem::recompute_frame();
-
-  freeze();
-
-  for (Items::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i)->recompute();
-
-  this->adjust_region();
-  thaw();
-}
-
-void GuiCollection::set_priority(GuiLabel* l, const GuiItem::Priority p) {
-  for (Items::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i)->set_priority(l, p);
-}
-
-GuiCollection::GuiCollection(const string& name) : GuiItem(name) {
-}
-
-GuiCollection::~GuiCollection(void) {
-  this->unmanage();
-}
-
-int GuiCollection::freeze(void) {
-  int result = 0;
-
-  for (Items::iterator i=_items.begin(); i!=_items.end(); ++i) {
-    int count = (*i)->freeze();
-    result = max(result, count);
-  }
-  return result;
-}
-
-int GuiCollection::thaw(void) {
-  int result = 0;
-
-  for (Items::iterator i=_items.begin(); i!=_items.end(); ++i) {
-    int count = (*i)->thaw();
-    result = max(result, count);
-  }
-  return result;
-}
-
-void GuiCollection::add_item(GuiItem* item) {
-  bool found = false;
-  for (Items::iterator i=_items.begin(); i!=_items.end(); ++i)
-    if ((*i) == item)
-      found = true;
-  if (!found)
-    _items.push_back(item);
-  // this->recompute();
-}
-
-void GuiCollection::remove_item(GuiItem* item) {
-  Items::iterator i;
-  for (i=_items.begin(); i!=_items.end(); ++i)
-    if ((*i) == item)
-      break;
-  if (i == _items.end())
-    return;
-  item->unmanage();
-  _items.erase(i);
-  // this->recompute();
-}
-
-void GuiCollection::manage(GuiManager* mgr, EventHandler& eh) {
-  if (_mgr == (GuiManager*)0L) {
-    for (Items::iterator i=_items.begin(); i!=_items.end(); ++i)
-      (*i)->manage(mgr, eh);
-    GuiItem::manage(mgr, eh);
-  } else
-    gui_cat->warning() << "tried to manage collection (0x" << (void*)this
-                       << ") that is already managed" << endl;
-}
-
-void GuiCollection::manage(GuiManager* mgr, EventHandler& eh, Node* n) {
-  if (_mgr == (GuiManager*)0L) {
-    for (Items::iterator i=_items.begin(); i!=_items.end(); ++i)
-      (*i)->manage(mgr, eh, n);
-    GuiItem::manage(mgr, eh, n);
-  } else
-    gui_cat->warning() << "tried to manage collection (0x" << (void*)this
-                       << ") that is already managed" << endl;
-}
-
-void GuiCollection::unmanage(void) {
-  for (Items::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i)->unmanage();
-  GuiItem::unmanage();
-}
-
-void GuiCollection::set_scale(float f) {
-  for (Items::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i)->set_scale(f * (*i)->get_scale());
-  GuiItem::set_scale(f);
-  this->recompute_frame();
-}
-
-void GuiCollection::set_scale(float x, float y, float z) {
-  for (Items::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i)->set_scale(x * (*i)->get_scale_x(),
-                    y * (*i)->get_scale_y(),
-                    z * (*i)->get_scale_z());
-  GuiItem::set_scale(x, y, z);
-  this->recompute_frame();
-}
-
-void GuiCollection::set_pos(const LVector3f& p) {
-  LVector3f delta = p - this->get_pos();
-  for (Items::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i)->set_pos((*i)->get_pos() + delta);
-  GuiItem::set_pos(p);
-  this->recompute_frame();
-}
-
-void GuiCollection::set_priority(GuiItem* it, const GuiItem::Priority p) {
-  for (Items::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i)->set_priority(it, p);
-}
-
-int GuiCollection::set_draw_order(int v) {
-  bool first = true;
-  int o;
-  for (Items::iterator i=_items.begin(); i!=_items.end(); ++i)
-    if (first) {
-      first = false;
-      o = (*i)->set_draw_order(v);
-    } else
-      o = (*i)->set_draw_order(o);
-  return GuiItem::set_draw_order(o);
-}
-
-void GuiCollection::output(ostream& os) const {
-  GuiItem::output(os);
-  os << "  Collection data:" << endl;
-  Items::const_iterator i;
-  for (i=_items.begin(); i!=_items.end(); ++i)
-    os << "    item - 0x" << (void*)(*i) << endl;
-  for (i=_items.begin(); i!=_items.end(); ++i)
-    os << *(*i);
-}

+ 0 - 80
panda/src/gui/guiCollection.h

@@ -1,80 +0,0 @@
-// Filename: guiCollection.h
-// Created by:  cary (07Mar01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __GUICOLLECTION_H__
-#define __GUICOLLECTION_H__
-
-#include "guiItem.h"
-
-#include "pvector.h"
-
-class EXPCL_PANDA GuiCollection : public GuiItem {
-private:
-  typedef pvector< PT(GuiItem) > Items;
-
-  Items _items;
-
-  INLINE GuiCollection(void);
-  virtual void recompute_frame(void);
-PUBLISHED:
-  GuiCollection(const string&);
-  ~GuiCollection(void);
-
-  virtual int freeze();
-  virtual int thaw();
-
-  void add_item(GuiItem*);
-  void remove_item(GuiItem*);
-
-  virtual void manage(GuiManager*, EventHandler&);
-  virtual void manage(GuiManager*, EventHandler&, Node*);
-  virtual void unmanage(void);
-
-  virtual void set_scale(float);
-  virtual void set_scale(float, float, float);
-  virtual void set_pos(const LVector3f&);
-  virtual void set_priority(GuiLabel*, const Priority);
-  virtual void set_priority(GuiItem*, const Priority);
-
-  virtual int set_draw_order(int);
-
-  virtual void output(ostream&) const;
-public:
-  // type interface
-  static TypeHandle get_class_type(void) {
-    return _type_handle;
-  }
-  static void init_type(void) {
-    GuiItem::init_type();
-    register_type(_type_handle, "GuiCollection",
-                  GuiItem::get_class_type());
-  }
-  virtual TypeHandle get_type(void) const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type(void) {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "guiCollection.I"
-
-#endif /* __GUICOLLECTION_H__ */

+ 0 - 99
panda/src/gui/guiFrame.I

@@ -1,99 +0,0 @@
-// Filename: guiFrame.I
-// Created by:  cary (01Nov00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-INLINE GuiFrame::GuiFrame(void) {}
-
-INLINE bool GuiFrame::is_aligned_left(void) const {
-  return _align_to_left;
-}
-
-INLINE bool GuiFrame::is_aligned_right(void) const {
-  return _align_to_right;
-}
-
-INLINE bool GuiFrame::is_aligned_top(void) const {
-  return _align_to_top;
-}
-
-INLINE bool GuiFrame::is_aligned_bottom(void) const {
-  return _align_to_bottom;
-}
-
-INLINE float GuiFrame::get_left_gap(void) const {
-  return _left_gap;
-}
-
-INLINE float GuiFrame::get_right_gap(void) const {
-  return _right_gap;
-}
-
-INLINE float GuiFrame::get_top_gap(void) const {
-  return _top_gap;
-}
-
-INLINE float GuiFrame::get_bottom_gap(void) const {
-  return _bottom_gap;
-}
-
-INLINE void GuiFrame::clear_left_alignment(void) {
-  _align_to_left = false;
-}
-
-INLINE void GuiFrame::clear_right_alignment(void) {
-  _align_to_right = false;
-}
-
-INLINE void GuiFrame::clear_top_alignment(void) {
-  _align_to_top = false;
-}
-
-INLINE void GuiFrame::clear_bottom_alignment(void) {
-  _align_to_bottom = false;
-}
-
-INLINE void GuiFrame::clear_all_alignment(void) {
-  clear_left_alignment();
-  clear_right_alignment();
-  clear_top_alignment();
-  clear_bottom_alignment();
-}
-
-INLINE void GuiFrame::align_to_left(float g) {
-  _align_to_right = false;
-  _align_to_left = true;
-  _left_gap = g;
-}
-
-INLINE void GuiFrame::align_to_right(float g) {
-  _align_to_left = false;
-  _align_to_right = true;
-  _right_gap = g;
-}
-
-INLINE void GuiFrame::align_to_top(float g) {
-  _align_to_bottom = false;
-  _align_to_top = true;
-  _top_gap = g;
-}
-
-INLINE void GuiFrame::align_to_bottom(float g) {
-  _align_to_top = false;
-  _align_to_bottom = true;
-  _bottom_gap = g;
-}
-

+ 0 - 468
panda/src/gui/guiFrame.cxx

@@ -1,468 +0,0 @@
-// Filename: guiFrame.cxx
-// Created by:  cary (01Nov00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "guiFrame.h"
-
-TypeHandle GuiFrame::_type_handle;
-
-class PosFrame {
-private:
-  LVector3f _pos;
-  LVector4f _frame;
-public:
-  PosFrame(GuiItem* i) : _pos(i->get_pos()), _frame(i->get_frame()) {}
-  PosFrame(void) {}
-  PosFrame(const PosFrame& c) : _pos(c._pos), _frame(c._frame) {}
-  inline PosFrame& operator=(const PosFrame& c) {
-    _pos = c._pos;
-    _frame = c._frame;
-    return *this;
-  }
-  inline void write(GuiItem* i) { i->set_pos(_pos); }
-  inline LVector3f get_pos(void) const { return _pos; }
-  inline LVector4f get_frame(void) const { return _frame; }
-  inline void set_pos(LVector3f p) {
-    LVector3f d = p - _pos;
-    float du = d.dot(LVector3f::up());
-    float dr = d.dot(LVector3f::right());
-    _frame[0] += dr;
-    _frame[1] += dr;
-    _frame[2] += du;
-    _frame[3] += du;
-    _pos = p;
-  }
-};
-
-typedef pmap<GuiItem*, PosFrame> UtilMap;
-
-GuiFrame::Boxes::iterator GuiFrame::find_box(GuiItem* item) {
-  bool found = false;
-  Boxes::iterator ret = _items.end();
-  Boxes::iterator i;
-  for (i=_items.begin(); (!found)&&(i!=_items.end()); ++i)
-    if ((*i).get_item() == item) {
-      found = true;
-      ret = i;
-    }
-  if (!found)
-    ret = _items.end();
-  return ret;
-}
-
-#include "pmap.h"
-
-void GuiFrame::recompute_frame(void) {
-  GuiItem::recompute_frame();
-
-  freeze();
-
-  Boxes::iterator i;
-  UtilMap _map;
-
-  // go thru and make sure everything is packed correctly.  This is a stupid
-  // and brute-force algorithm.  Hopefully it will be replaced with something
-  // more ellegant later
-  for (i=_items.begin(); i!=_items.end(); ++i) {
-    GuiItem* here = (*i).get_item();
-    here->recompute();
-    _map[here] = PosFrame(here);
-  }
-  for (i=_items.begin(); i!=_items.end(); ++i) {
-    GuiItem* here = (*i).get_item();
-    // here->recompute();
-    int n = (*i).get_num_links();
-    if (n > 0) {
-      UtilMap::iterator ui = _map.find(here);
-      LVector4f ext_h = (*ui).second.get_frame();
-      LVector3f pos_h = (*ui).second.get_pos();
-      for (int j=0; j<n; ++j) {
-        Packing pack = (*i).get_nth_packing(j);
-        if (pack == NONE)
-          continue;
-        GuiItem* to = (*i).get_nth_to(j);
-        LVector4f ext_t = _map[to].get_frame();
-        float gap = (*i).get_nth_gap(j);
-        switch (pack) {
-        case ABOVE:
-          {
-            // to(top) - here(bottom)
-            float diff = ext_t[3] - ext_h[2] + gap;
-            LVector3f move = LVector3f::rfu(0., 0., diff);
-            (*ui).second.set_pos(pos_h + move);
-            ext_h = (*ui).second.get_frame();
-            pos_h = (*ui).second.get_pos();
-          }
-          break;
-        case UNDER:
-          {
-            // to(bottom) - here(top)
-            float diff = ext_t[2] - ext_h[3] - gap;
-            LVector3f move = LVector3f::rfu(0., 0., diff);
-            (*ui).second.set_pos(pos_h + move);
-            ext_h = (*ui).second.get_frame();
-            pos_h = (*ui).second.get_pos();
-          }
-          break;
-        case LEFT:
-          {
-            // to(left) - here(right)
-            float diff = ext_t[0] - ext_h[1] - gap;
-            LVector3f move = LVector3f::rfu(diff, 0., 0.);
-            (*ui).second.set_pos(pos_h + move);
-            ext_h = (*ui).second.get_frame();
-            pos_h = (*ui).second.get_pos();
-          }
-          break;
-        case RIGHT:
-          {
-            // to(right) - here(left)
-            float diff = ext_t[1] - ext_h[0] + gap;
-            LVector3f move = LVector3f::rfu(diff, 0., 0.);
-            (*ui).second.set_pos(pos_h + move);
-            ext_h = (*ui).second.get_frame();
-            pos_h = (*ui).second.get_pos();
-          }
-          break;
-        case ALIGN_ABOVE:
-          {
-            // to(top) - here(top)
-            float diff = ext_t[3] - ext_h[3];
-            LVector3f move = LVector3f::rfu(0., 0., diff);
-            (*ui).second.set_pos(pos_h + move);
-            ext_h = (*ui).second.get_frame();
-            pos_h = (*ui).second.get_pos();
-          }
-          break;
-        case ALIGN_UNDER:
-          {
-            // to(bottom) - here(bottom)
-            float diff = ext_t[2] - ext_h[2];
-            LVector3f move = LVector3f::rfu(0., 0., diff);
-            (*ui).second.set_pos(pos_h + move);
-            ext_h = (*ui).second.get_frame();
-            pos_h = (*ui).second.get_pos();
-          }
-          break;
-        case ALIGN_LEFT:
-          {
-            // to(left) - here(left)
-            float diff = ext_t[0] - ext_h[0];
-            LVector3f move = LVector3f::rfu(diff, 0., 0.);
-            (*ui).second.set_pos(pos_h + move);
-            ext_h = (*ui).second.get_frame();
-            pos_h = (*ui).second.get_pos();
-          }
-          break;
-        case ALIGN_RIGHT:
-          {
-            // to(right) - here(right)
-            float diff = ext_t[1] - ext_h[1];
-            LVector3f move = LVector3f::rfu(diff, 0., 0.);
-            (*ui).second.set_pos(pos_h + move);
-            ext_h = (*ui).second.get_frame();
-            pos_h = (*ui).second.get_pos();
-          }
-          break;
-        default:
-          gui_cat->warning() << "unknown packing type (" << (int)pack << ")"
-                             << endl;
-        }
-      }
-    }
-  }
-  // these should be exactly opposite the max, so they will (hopefully) be
-  // overwritten
-  _left = _bottom = 10000000.;
-  _right = _top = -10000000.;
-  for (i=_items.begin(); i!=_items.end(); ++i) {
-    UtilMap::iterator ui = _map.find((*i).get_item());
-    float tmp = ((*ui).second.get_frame())[0];
-    _left = (_left<tmp)?_left:tmp;
-    tmp = ((*ui).second.get_frame())[1];
-    _right = (_right<tmp)?tmp:_right;
-    tmp = ((*ui).second.get_frame())[2];
-    _bottom = (_bottom<tmp)?_bottom:tmp;
-    tmp = ((*ui).second.get_frame())[3];
-    _top = (_top<tmp)?tmp:_top;
-  }
-  // now put it at the position it is supposed to be
-  float x = (_left + _right) / 2.;
-  float y = (_bottom + _top) / 2.;
-  LVector3f pos = LVector3f::rfu(x, 0., y);
-  LVector3f delta = _pos - pos;
-  for (i=_items.begin(); i!=_items.end(); ++i) {
-    GuiItem* foo = (*i).get_item();
-    UtilMap::iterator ui = _map.find(foo);
-    (*ui).second.set_pos((*ui).second.get_pos() + delta);
-  }
-  // get the bounds again
-  _left = _bottom = 10000000.;
-  _right = _top = -10000000.;
-  for (i=_items.begin(); i!=_items.end(); ++i) {
-    UtilMap::iterator ui = _map.find((*i).get_item());
-    float tmp = ((*ui).second.get_frame())[0];
-    _left = (_left<tmp)?_left:tmp;
-    tmp = ((*ui).second.get_frame())[1];
-    _right = (_right<tmp)?tmp:_right;
-    tmp = ((*ui).second.get_frame())[2];
-    _bottom = (_bottom<tmp)?_bottom:tmp;
-    tmp = ((*ui).second.get_frame())[3];
-    _top = (_top<tmp)?tmp:_top;
-  }
-  // check for alignment to the DisplayRegion
-  LVector3f move_left, move_right, move_top, move_bottom;
-  move_left = move_right = move_top = move_bottom = LVector3f(0., 0., 0.);
-  if (_align_to_left) {
-    float diff = -1. - _left;
-    move_left = LVector3f::rfu(diff, 0., 0.);
-  }
-  if (_align_to_right) {
-    float diff = 1. - _right;
-    move_right = LVector3f::rfu(diff, 0., 0.);
-  }
-  if (_align_to_top) {
-    float diff = 1. - _top;
-    move_top = LVector3f::rfu(0., 0., diff);
-  }
-  if (_align_to_bottom) {
-    float diff = -1. - _bottom;
-    move_bottom = LVector3f::rfu(0., 0., diff);
-  }
-  LVector3f move = move_left + move_right + move_top + move_bottom;
-  for (i=_items.begin(); i!=_items.end(); ++i) {
-    GuiItem* foo = (*i).get_item();
-    UtilMap::iterator ui = _map.find(foo);
-    (*ui).second.set_pos((*ui).second.get_pos() + move);
-  }
-  // lastly, get the finial bounds
-  _left = _bottom = 10000000.;
-  _right = _top = -10000000.;
-  for (i=_items.begin(); i!=_items.end(); ++i) {
-    UtilMap::iterator ui = _map.find((*i).get_item());
-    float tmp = ((*ui).second.get_frame())[0];
-    _left = (_left<tmp)?_left:tmp;
-    tmp = ((*ui).second.get_frame())[1];
-    _right = (_right<tmp)?tmp:_right;
-    tmp = ((*ui).second.get_frame())[2];
-    _bottom = (_bottom<tmp)?_bottom:tmp;
-    tmp = ((*ui).second.get_frame())[3];
-    _top = (_top<tmp)?tmp:_top;
-  }
-  for (i=_items.begin(); i!= _items.end(); ++i) {
-    GuiItem* foo = (*i).get_item();
-    _map[foo].write(foo);
-  }
-  this->adjust_region();
-  thaw();
-}
-
-void GuiFrame::set_priority(GuiLabel* l, const GuiItem::Priority p) {
-  Boxes::iterator i;
-
-  for (i=_items.begin(); i!=_items.end(); ++i) {
-    GuiItem* here = (*i).get_item();
-    here->set_priority(l, p);
-  }
-}
-
-GuiFrame::GuiFrame(const string& name) : GuiItem(name), _align_to_left(false),
-                                         _align_to_right(false),
-                                         _align_to_top(false),
-                                         _align_to_bottom(false) {
-}
-
-GuiFrame::~GuiFrame(void) {
-  this->unmanage();
-}
-
-int GuiFrame::freeze() {
-  int result = 0;
-  Boxes::iterator i;
-
-  for (i=_items.begin(); i!=_items.end(); ++i) {
-    GuiItem* here = (*i).get_item();
-    int count = here->freeze();
-    result = max(result, count);
-  }
-
-  return result;
-}
-
-int GuiFrame::thaw() {
-  int result = 0;
-  Boxes::iterator i;
-
-  for (i=_items.begin(); i!=_items.end(); ++i) {
-    GuiItem* here = (*i).get_item();
-    int count = here->thaw();
-    result = max(result, count);
-  }
-
-  return result;
-}
-
-void GuiFrame::add_item(GuiItem* item) {
-  bool found = false;
-  for (Boxes::iterator i=_items.begin(); (!found)&&(i!=_items.end()); ++i)
-    if ((*i).get_item() == item)
-      found = true;
-  if (!found) {
-    _items.push_back(Box(item));
-    //    this->recompute_frame();
-  }
-}
-
-void GuiFrame::remove_item(GuiItem* item) {
-  Boxes::iterator i = find_box(item);
-  if (i == _items.end())
-    return;
-  item->unmanage();
-  (*i).erase_all_links();
-  // should NEVER link forward in the items, only backward, so it should be
-  // safe to start here, and go to the end
-  for (Boxes::iterator j=i+1; j!=_items.end(); ++j) {
-    bool done;
-    do {
-      done = true;
-      for (int k=0; k<(*j).get_num_links(); ++k)
-        if ((*j).get_nth_to(k) == item) {
-          done = false;
-          (*j).erase_nth_link(k);
-          break;
-        }
-    } while (!done);
-  }
-  // now get rid of the thing itself
-  _items.erase(i);
-  this->recompute();
-}
-
-void GuiFrame::pack_item(GuiItem* item, Packing rel, GuiItem* to, float gap) {
-  Boxes::iterator box = find_box(item);
-  if (box == _items.end()) {
-    gui_cat->warning() << "tried to pack an item we don't have yet" << endl;
-    return;
-  }
-  Boxes::iterator tobox = find_box(to);
-  if (tobox == _items.end()) {
-    gui_cat->warning()
-      << "tried to pack an item relative to something we don't have" << endl;
-    return;
-  }
-  (*box).add_link(Connection(rel, to, gap));
-  //  this->recompute_frame();
-}
-
-void GuiFrame::clear_packing(GuiItem* item) {
-  Boxes::iterator box = find_box(item);
-  (*box).erase_all_links();
-  //  this->recompute_frame();
-}
-
-void GuiFrame::clear_all_packing(void) {
-  for (Boxes::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i).erase_all_links();
-  //  this->recompute_frame();
-}
-
-void GuiFrame::manage(GuiManager* mgr, EventHandler& eh) {
-  if (_mgr == (GuiManager*)0L) {
-    for (Boxes::iterator i=_items.begin(); i!=_items.end(); ++i)
-      (*i).get_item()->manage(mgr, eh);
-    GuiItem::manage(mgr, eh);
-  } else
-    gui_cat->warning() << "tried to manage frame (0x" << (void*)this
-                       << ") that is already managed" << endl;
-}
-
-void GuiFrame::manage(GuiManager* mgr, EventHandler& eh, Node* n) {
-  if (_mgr == (GuiManager*)0L) {
-    for (Boxes::iterator i=_items.begin(); i!=_items.end(); ++i)
-      (*i).get_item()->manage(mgr, eh, n);
-    GuiItem::manage(mgr, eh, n);
-  } else
-    gui_cat->warning() << "tried to manage frame (0x" << (void*)this
-                       << ") that is already managed" << endl;
-}
-
-void GuiFrame::unmanage(void) {
-  for (Boxes::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i).get_item()->unmanage();
-  GuiItem::unmanage();
-}
-
-void GuiFrame::set_scale(float f) {
-  for (Boxes::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i).get_item()->set_scale(f * (*i).get_scale());
-  GuiItem::set_scale(f);
-  //  this->recompute_frame();
-}
-
-void GuiFrame::set_scale(float x, float y, float z) {
-  for (Boxes::iterator i=_items.begin(); i!=_items.end(); ++i)
-    (*i).get_item()->set_scale(x * (*i).get_item()->get_scale_x(),
-                               y * (*i).get_item()->get_scale_y(),
-                               z * (*i).get_item()->get_scale_z());
-  GuiItem::set_scale(x, y, z);
-}
-
-void GuiFrame::set_pos(const LVector3f& p) {
-  //  for (Boxes::iterator i=_items.begin(); i!=_items.end(); ++i)
-  //    (*i).get_item()->set_pos(p);
-  GuiItem::set_pos(p);
-  //  this->recompute_frame();
-}
-
-void GuiFrame::set_priority(GuiItem* it, const GuiItem::Priority p) {
-  Boxes::iterator i;
-
-  for (i=_items.begin(); i!=_items.end(); ++i) {
-    GuiItem* here = (*i).get_item();
-    here->set_priority(it, p);
-  }
-}
-
-int GuiFrame::set_draw_order(int v) {
-  int o = v;
-  bool first = true;
-  for (Boxes::iterator i=_items.begin(); i!=_items.end(); ++i)
-    if (first) {
-      first = false;
-      o = (*i).get_item()->set_draw_order(v);
-    } else
-      o = (*i).get_item()->set_draw_order(o);
-  return GuiItem::set_draw_order(o);
-}
-
-void GuiFrame::output(ostream& os) const {
-  GuiItem::output(os);
-  os << "  Frame data:" << endl;
-  Boxes::const_iterator i;
-  for (i=_items.begin(); i!=_items.end(); ++i) {
-    os << "    box - 0x" << (void*)((*i).get_item()) << endl;
-    int n = (*i).get_num_links();
-    if (n > 0) {
-      for (int j=0; j<n; ++j)
-        os << "      linked by " << (int)((*i).get_nth_packing(j)) << " to 0x"
-           << (void*)((*i).get_nth_to(j)) << endl;
-    }
-  }
-  for (i=_items.begin(); i!=_items.end(); ++i) {
-    os << *((*i).get_item());
-  }
-}

+ 0 - 166
panda/src/gui/guiFrame.h

@@ -1,166 +0,0 @@
-// Filename: guiFrame.h
-// Created by:  cary (01Nov00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __GUIFRAME_H__
-#define __GUIFRAME_H__
-
-#include "guiItem.h"
-
-#include "pvector.h"
-
-class EXPCL_PANDA GuiFrame : public GuiItem {
-PUBLISHED:
-  enum Packing { NONE, ABOVE, UNDER, LEFT, RIGHT, ALIGN_ABOVE, ALIGN_UNDER,
-                 ALIGN_LEFT, ALIGN_RIGHT };
-private:
-  class Connection {
-  private:
-    Packing _how;
-    GuiItem* _who;
-    float _gap;
-  public:
-    inline Connection(void) : _how(NONE), _who((GuiItem*)0L), _gap(0.) {}
-    inline Connection(Packing how, GuiItem* who, float gap) : _how(how),
-                                                              _who(who),
-                                                              _gap(gap) {}
-    inline Connection(const Connection& c) : _how(c._how), _who(c._who),
-                                             _gap(c._gap) {}
-    ~Connection(void) {}
-
-    inline void set_how(Packing how) { _how = how; }
-    inline void set_who(GuiItem* who) { _who = who; }
-    inline void set_gap(float gap) { _gap = gap; }
-
-    inline Packing get_how(void) const { return _how; }
-    inline GuiItem* get_who(void) const { return _who; }
-    inline float get_gap(void) const { return _gap; }
-  };
-  typedef pvector<Connection> Connections;
-  class Box {
-  private:
-    PT(GuiItem) _thing;
-    float _scale;
-    Connections _links;
-  public:
-    inline Box(void) : _thing((GuiItem*)0L), _scale(1.) {}
-    inline Box(GuiItem* i) : _thing(i), _scale(i->get_scale()) {}
-    inline Box(const Box& c) : _thing(c._thing), _scale(c._scale),
-                               _links(c._links) {}
-    ~Box(void) {}
-
-    inline void set_item(GuiItem* i) { _thing = i; }
-    inline void set_scale(float f) { _scale = f; }
-    inline void add_link(Connection c) { _links.push_back(c); }
-
-    inline GuiItem* get_item(void) const { return _thing; }
-    inline float get_scale(void) const { return _scale; }
-    inline int get_num_links(void) const { return _links.size(); }
-    inline Packing get_nth_packing(int n) const { return _links[n].get_how(); }
-    inline GuiItem* get_nth_to(int n) const { return _links[n].get_who(); }
-    inline float get_nth_gap(int n) const { return _links[n].get_gap(); }
-
-    inline void erase_nth_link(int n) { _links.erase(_links.begin() + n); }
-    inline void erase_all_links(void) { _links.clear(); }
-  };
-  typedef pvector<Box> Boxes;
-
-  Boxes _items;
-  bool _align_to_left;
-  bool _align_to_right;
-  bool _align_to_top;
-  bool _align_to_bottom;
-  float _left_gap;
-  float _right_gap;
-  float _top_gap;
-  float _bottom_gap;
-
-  INLINE GuiFrame(void);
-  Boxes::iterator find_box(GuiItem*);
-  virtual void recompute_frame(void);
-
-PUBLISHED:
-  GuiFrame(const string&);
-  ~GuiFrame(void);
-
-  virtual int freeze();
-  virtual int thaw();
-
-  void add_item(GuiItem*);
-  void remove_item(GuiItem*);
-  void pack_item(GuiItem*, Packing, GuiItem*, float = 0.);
-  void clear_packing(GuiItem*);
-  void clear_all_packing(void);
-
-  INLINE bool is_aligned_left(void) const;
-  INLINE bool is_aligned_right(void) const;
-  INLINE bool is_aligned_top(void) const;
-  INLINE bool is_aligned_bottom(void) const;
-
-  INLINE float get_left_gap(void) const;
-  INLINE float get_right_gap(void) const;
-  INLINE float get_top_gap(void) const;
-  INLINE float get_bottom_gap(void) const;
-
-  INLINE void clear_left_alignment(void);
-  INLINE void clear_right_alignment(void);
-  INLINE void clear_top_alignment(void);
-  INLINE void clear_bottom_alignment(void);
-  INLINE void clear_all_alignment(void);
-
-  INLINE void align_to_left(float = 0.);
-  INLINE void align_to_right(float = 0.);
-  INLINE void align_to_top(float = 0.);
-  INLINE void align_to_bottom(float = 0.);
-
-  virtual void manage(GuiManager*, EventHandler&);
-  virtual void manage(GuiManager*, EventHandler&, Node*);
-  virtual void unmanage(void);
-
-  virtual void set_scale(float);
-  virtual void set_scale(float, float, float);
-  virtual void set_pos(const LVector3f&);
-  virtual void set_priority(GuiLabel*, const Priority);
-  virtual void set_priority(GuiItem*, const Priority);
-
-  virtual int set_draw_order(int);
-
-  virtual void output(ostream&) const;
-public:
-  // type interface
-  static TypeHandle get_class_type(void) {
-    return _type_handle;
-  }
-  static void init_type(void) {
-    GuiItem::init_type();
-    register_type(_type_handle, "GuiFrame",
-                  GuiItem::get_class_type());
-  }
-  virtual TypeHandle get_type(void) const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type(void) {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "guiFrame.I"
-
-#endif /* __GUIFRAME_H__ */

+ 0 - 94
panda/src/gui/guiItem.I

@@ -1,94 +0,0 @@
-// Filename: guiItem.I
-// Created by:  cary (01Nov00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-INLINE GuiItem::GuiItem(void) : Namable("fubar"), _scale(1.), _scale_x(1.),
-                                _scale_y(1.), _scale_z(1.), _left(-1.),
-                                _right(1.), _bottom(-1.), _top(1.),
-                                _pri(P_Normal) {}
-
-#include <get_rel_pos.h>
-
-INLINE void GuiItem::get_graph_mat(LMatrix4f& m) {
-  if (_alt_root.is_null()) {
-    m = LMatrix4f::ident_mat();
-    return;
-  }
-  // pass NULL for the 'to' to go to root
-  get_rel_mat(_alt_root, (Node*)0L, m);
-}
-
-INLINE float GuiItem::get_scale(void) const {
-  return _scale;
-}
-
-INLINE float GuiItem::get_scale_x(void) const {
-  return _scale_x;
-}
-
-INLINE float GuiItem::get_scale_y(void) const {
-  return _scale_y;
-}
-
-INLINE float GuiItem::get_scale_z(void) const {
-  return _scale_z;
-}
-
-INLINE LVector3f GuiItem::get_pos(void) const {
-  return _pos;
-}
-
-INLINE float GuiItem::get_left(void) const {
-  return _left;
-}
-
-INLINE float GuiItem::get_right(void) const {
-  return _right;
-}
-
-INLINE float GuiItem::get_bottom(void) const {
-  return _bottom;
-}
-
-INLINE float GuiItem::get_top(void) const {
-  return _top;
-}
-
-INLINE LVector4f GuiItem::get_frame(void) const {
-  return LVector4f(_left, _right, _bottom, _top);
-}
-
-INLINE float GuiItem::get_width(void) const {
-  return _right - _left;
-}
-
-INLINE float GuiItem::get_height(void) const {
-  return _top - _bottom;
-}
-
-INLINE GuiItem::Priority GuiItem::get_priority(void) const {
-  return _pri;
-}
-
-INLINE void GuiItem::recompute(void) {
-  this->recompute_frame();
-}
-
-INLINE ostream& operator<<(ostream& os, GuiItem& item) {
-  item.output(os);
-  return os;
-}

+ 0 - 128
panda/src/gui/guiItem.cxx

@@ -1,128 +0,0 @@
-// Filename: guiItem.cxx
-// Created by:  cary (01Nov00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "guiItem.h"
-
-TypeHandle GuiItem::_type_handle;
-
-void GuiItem::recompute_frame(void) {
-  test_ref_count_integrity();
-}
-
-void GuiItem::adjust_region(void) {
-  test_ref_count_integrity();
-  gui_cat->debug() << "in adjust_region, base values (" << _left << ", "
-           << _right << ", " << _bottom << ", " << _top << ")" << endl;
-  if (!(_alt_root.is_null())) {
-    // adjust for graph transform
-    LMatrix4f m;
-    this->get_graph_mat(m);
-    LPoint3f ul = LVector3f::rfu(_left, 0., _top);
-    LPoint3f lr = LVector3f::rfu(_right, 0., _bottom);
-    ul = ul * m;
-    lr = lr * m ;
-    _left = ul.dot(LVector3f::rfu(1., 0., 0.));
-    _top = ul.dot(LVector3f::rfu(0., 0., 1.));
-    _right = lr.dot(LVector3f::rfu(1., 0., 0.));
-    _bottom = lr.dot(LVector3f::rfu(0., 0., 1.));
-    gui_cat->debug() << "childed to non-default node, current values ("
-             << _left << ", " << _right << ", " << _bottom << ", "
-             << _top << ")" << endl;
-  }
-}
-
-void GuiItem::set_priority(GuiLabel*, const GuiItem::Priority) {
-}
-
-GuiItem::GuiItem(const string& name) : Namable(name), _scale(1.), _scale_x(1.),
-                       _scale_y(1.), _scale_z(1.), _left(-1.),
-                       _right(1.), _bottom(-1.), _top(1.),
-                       _pos(0., 0., 0.), _mgr((GuiManager*)0L),
-                       _pri(P_Normal) {
-
-  if (gui_cat.is_debug())
-    gui_cat->debug()
-      << "creating item '" << get_name() << "' (" << (void *)this << ")\n";
-}
-
-GuiItem::~GuiItem(void) {
-  if (gui_cat.is_debug())
-    gui_cat->debug()
-      << "deleting item '" << get_name() << "' (" << (void *)this << ")\n";
-  //  this->unmanage();
-}
-
-int GuiItem::freeze() {
-  return 0;
-}
-
-int GuiItem::thaw() {
-  gui_cat->debug() << "GuiItem::thaw" << endl;
-  return 0;
-}
-
-void GuiItem::manage(GuiManager* mgr, EventHandler&) {
-  test_ref_count_integrity();
-  _mgr = mgr;
-  _alt_root.clear();
-}
-
-void GuiItem::manage(GuiManager* mgr, EventHandler&, Node* n) {
-  test_ref_count_integrity();
-  _mgr = mgr;
-  _alt_root = n;
-  this->adjust_region();
-}
-
-void GuiItem::unmanage(void) {
-  test_ref_count_integrity();
-  _mgr = (GuiManager*)0L;
-}
-
-void GuiItem::set_scale(float f) {
-  _scale = f;
-}
-
-void GuiItem::set_scale(float x, float y, float z) {
-  _scale_x = x;
-  _scale_y = y;
-  _scale_z = z;
-}
-
-void GuiItem::set_pos(const LVector3f& p) {
-  _pos = p;
-}
-
-void GuiItem::set_priority(GuiItem* i, const GuiItem::Priority p) {
-  if (_mgr != (GuiManager*)0L)
-    _mgr->recompute_priorities();
-}
-
-int GuiItem::set_draw_order(int v) {
-  return v;
-}
-
-void GuiItem::output(ostream& os) const {
-  os << "GuiItem (0x" << (void*)this << ")" << endl;
-  os << "  name - '" << get_name() << "'" << endl;
-  os << "  scale - " << _scale << endl;
-  os << "  pos - " << _pos << endl;
-  os << "  mgr - 0x" << (void*)_mgr << endl;
-  os << "  frame - (" << _left << ", " << _right << ", " << _bottom << ", "
-     << _top << ")" << endl;
-}

+ 0 - 102
panda/src/gui/guiItem.h

@@ -1,102 +0,0 @@
-// Filename: guiItem.h
-// Created by:  cary (01Nov00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __GUIITEM_H__
-#define __GUIITEM_H__
-
-#include "guiManager.h"
-
-#include <eventHandler.h>
-
-class EXPCL_PANDA GuiItem : public TypedReferenceCount, public Namable {
-PUBLISHED:
-  enum Priority { P_Lowest, P_Low, P_Normal, P_High, P_Highest };
-
-protected:
-  float _scale, _scale_x, _scale_y, _scale_z, _left, _right, _bottom, _top;
-  LVector3f _pos;
-  GuiManager* _mgr;
-  Priority _pri;
-  PT_Node _alt_root;
-
-  INLINE GuiItem(void);
-  virtual void recompute_frame(void) = 0;
-  virtual void adjust_region(void);
-
-  INLINE void get_graph_mat(LMatrix4f&);
-
-PUBLISHED:
-  GuiItem(const string&);
-  virtual ~GuiItem(void);
-
-  virtual void manage(GuiManager*, EventHandler&) = 0;
-  virtual void manage(GuiManager*, EventHandler&, Node*) = 0;
-  virtual void unmanage(void) = 0;
-
-  virtual int freeze();
-  virtual int thaw();
-
-  virtual void set_scale(float) = 0;
-  virtual void set_scale(float, float, float) = 0;
-  virtual void set_pos(const LVector3f&) = 0;
-  virtual void set_priority(GuiLabel*, const Priority) = 0;
-  virtual void set_priority(GuiItem*, const Priority) = 0;
-
-  INLINE float get_scale(void) const;
-  INLINE float get_scale_x(void) const;
-  INLINE float get_scale_y(void) const;
-  INLINE float get_scale_z(void) const;
-  INLINE LVector3f get_pos(void) const;
-  INLINE float get_left(void) const;
-  INLINE float get_right(void) const;
-  INLINE float get_bottom(void) const;
-  INLINE float get_top(void) const;
-  INLINE LVector4f get_frame(void) const;
-  INLINE float get_width(void) const;
-  INLINE float get_height(void) const;
-  INLINE Priority get_priority(void) const;
-
-  INLINE void recompute(void);
-
-  virtual int set_draw_order(int) = 0;
-
-  virtual void output(ostream&) const = 0;
-public:
-  // type interface
-  static TypeHandle get_class_type(void) {
-    return _type_handle;
-  }
-  static void init_type(void) {
-    TypedReferenceCount::init_type();
-    register_type(_type_handle, "GuiItem",
-                  TypedReferenceCount::get_class_type());
-  }
-  virtual TypeHandle get_type(void) const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type(void) {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "guiItem.I"
-
-#endif /* __GUIITEM_H__ */

+ 0 - 166
panda/src/gui/guiLabel.I

@@ -1,166 +0,0 @@
-// Filename: guiLabel.I
-// Created by:  cary (26Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-INLINE GuiLabel::GuiLabel(void) : _type(GuiLabel::NONE),
-                                  _arc((RenderRelation*)0L),
-                                  _tex((Texture*)0L),
-                                  _internal((RenderRelation*)0L),
-                                  _gset((Geom*)0L), _model_width(1.),
-                                  _model_height(1.), _scale(1.),
-                                  _scale_x(1.), _scale_y(1.), _scale_z(1.),
-                                  _pos(0., 0., 0.),
-                                  _model_pos(0., 0., 0.),
-                                  _have_foreground(false),
-                                  _foreground(1., 1., 1., 1.),
-                                  _have_background(false),
-                                  _background(0., 0., 0., 0.),
-                                  _have_width(false), _width(0.),
-                                  _have_height(false), _height(0.),
-                                  _mirror_x(false), _mirror_y(false),
-                                  _hard_pri(0), _highest_pri(false),
-                                  _lowest_pri(false), _has_hard_pri(false) {
-}
-
-INLINE Node* GuiLabel::get_geometry(void) const {
-  return _geom;
-}
-
-INLINE void GuiLabel::set_arc(RenderRelation* r) {
-  _arc = r;
-}
-
-INLINE RenderRelation* GuiLabel::get_arc(void) const {
-  return _arc;
-}
-
-INLINE void GuiLabel::set_width(float f) {
-  if (f <= 0.) {
-    _have_width = false;
-    _width = 0.;
-  } else {
-    if (_type == MODEL)
-      _width = f / this->_model_width;
-    else
-      _width = f;
-    _have_width = true;
-  }
-  this->set_properties();
-}
-
-INLINE void GuiLabel::set_height(float f) {
-  if (f <= 0.) {
-    _have_height = false;
-    _height = 0.;
-  } else {
-    if (_type == MODEL)
-      _height = f / this->_model_height;
-    else
-      _height = f;
-    _have_height = true;
-  }
-  this->set_properties();
-}
-
-INLINE void GuiLabel::set_scale(float f) {
-  _scale = f;
-  recompute_transform();
-}
-
-INLINE void GuiLabel::set_scale(float x, float y, float z) {
-  _scale_x = x;
-  _scale_y = y;
-  _scale_z = z;
-  recompute_transform();
-}
-
-INLINE void GuiLabel::set_mirror_x(bool b) {
-  _mirror_x = b;
-}
-
-INLINE void GuiLabel::set_mirror_y(bool b) {
-  _mirror_y = b;
-}
-
-INLINE void GuiLabel::set_pos(float x, float y, float z) {
-  this->set_pos(LVector3f(x, y, z));
-}
-
-INLINE void GuiLabel::set_pos(const LVector3f& p) {
-  _pos = p;
-  recompute_transform();
-}
-
-INLINE float GuiLabel::get_scale(void) const {
-  return _scale;
-}
-
-INLINE bool GuiLabel::get_mirror_x(void) const {
-  return _mirror_x;
-}
-
-INLINE bool GuiLabel::get_mirror_y(void) const {
-  return _mirror_y;
-}
-
-INLINE LVector3f GuiLabel::get_pos(void) const {
-  return _pos;
-}
-
-INLINE void GuiLabel::set_foreground_color(float r, float g, float b,
-                                           float a) {
-  this->_have_foreground = true;
-  this->set_foreground_color(Colorf(r, g, b, a));
-}
-
-INLINE void GuiLabel::set_background_color(float r, float g, float b,
-                                           float a) {
-  this->set_background_color(Colorf(r, g, b, a));
-}
-
-INLINE Colorf GuiLabel::get_foreground_color(void) const {
-  return _foreground;
-}
-
-INLINE Colorf GuiLabel::get_background_color(void) const {
-  return _background;
-}
-
-INLINE void GuiLabel::set_shadow_color(float r, float g, float b, float a) {
-  this->set_shadow_color(Colorf(r, g, b, a));
-}
-
-INLINE void GuiLabel::recompute(void) {
-  this->recompute_transform();
-}
-
-INLINE void GuiLabel::set_priority(GuiLabel* l, const PriorityType t) {
-  if (t == P_HIGHEST)
-    _highest_pri = true;
-  else if (t == P_LOWEST)
-    _lowest_pri = true;
-  else
-    this->_priorities[l] = t;
-}
-
-INLINE bool GuiLabel::has_hard_draw_order(void) const {
-  return _has_hard_pri;
-}
-
-INLINE int GuiLabel::get_draw_order(void) const {
-  return _hard_pri;
-}

+ 0 - 831
panda/src/gui/guiLabel.cxx

@@ -1,831 +0,0 @@
-// Filename: guiLabel.cxx
-// Created by:  cary (26Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "guiLabel.h"
-
-#include <textNode.h>
-#include <transformTransition.h>
-#include <colorTransition.h>
-
-TypeHandle GuiLabel::_type_handle;
-
-void GuiLabel::recompute_transform(void) {
-  this->freeze();
-/*
-    LMatrix4f mat = LMatrix4f::scale_mat(LVector3f::rfu(_scale_x, _scale_y,
-                              _scale_z)) *
-                    LMatrix4f::scale_mat(_scale) *
-                    LMatrix4f::scale_mat(LVector3f::rfu((_mirror_x?-1.0f:1.0f), 1.0f,
-                          (_mirror_y?-1.0f:1.0f))) *
-                    LMatrix4f::translate_mat(_pos);
-*/
-  // optimize the above calculation
-
-  float sx,sy,sz;
-
-  sx = _scale_x*_scale;
-  if(_mirror_x)
-      sx = -sx;
-  sy = _scale_y*_scale;
-  sz = _scale_z*_scale;
-  if(_mirror_y)
-      sz = -sz;
-
-  LVector3f scalevec1 = LVector3f::rfu(sx,sy,sz);
-
-  LMatrix4f mat(scalevec1[0], 0.0f, 0.0f, 0.0f,
-                0.0f, scalevec1[1], 0.0f, 0.0f,
-                0.0f, 0.0f, scalevec1[2], 0.0f,
-                _pos[0], _pos[1], _pos[2], 1.0f);
-
-  switch (_type) {
-  case SIMPLE_TEXT:
-    {
-      TextNode* n = DCAST(TextNode, _geom);
-      n->set_transform(mat);
-    }
-    break;
-  case SIMPLE_TEXTURE:
-  case SIMPLE_CARD:
-  case L_NULL:
-    {
-      _internal->set_transition(new TransformTransition(mat));
-    }
-    break;
-  case MODEL:
-    {
-/*
-      float w=_have_width?_scale*_width:_scale;
-      float h=_have_height?_scale*_height:_scale;
-
-      LMatrix4f mat = LMatrix4f::scale_mat(LVector3f::rfu(_scale_x, _scale_y,
-                              _scale_z)) *
-    LMatrix4f::scale_mat(LVector3f::rfu(w, 1.0f, h)) *
-    LMatrix4f::scale_mat(LVector3f::rfu((_mirror_x?-1.0f:1.0f), 1.0f,
-                        (_mirror_y?-1.0f:1.0f))) *
-    LMatrix4f::translate_mat(_pos + _model_pos);
-*/
-      // optimize above calculation, which was already partially done at start
-
-      if(_have_width || _have_height) {
-          float w=_have_width?_width:1.0f;
-          float h=_have_height?_height:1.0f;
-
-          LVector3f scalevec3 = LVector3f::rfu(w, 1.0f, h);
-
-          mat(0,0) *= scalevec3[0];
-          mat(1,1) *= scalevec3[1];
-          mat(2,2) *= scalevec3[2];
-      }
-
-      mat(3,0) += _model_pos[0];
-      mat(3,1) += _model_pos[1];
-      mat(3,2) += _model_pos[2];
-
-      _internal->set_transition(new TransformTransition(mat));
-    }
-    break;
-  default:
-    gui_cat->warning() << "recompute_transform on invalid label type ("
-               << (int)_type << ")" << endl;
-  }
-  set_properties();
-  this->thaw();
-}
-
-void GuiLabel::set_properties(void) {
-  switch (_type) {
-  case SIMPLE_TEXT:
-    {
-      TextNode* n = DCAST(TextNode, _geom);
-      if (_have_foreground)
-    n->set_text_color(_foreground);
-      n->clear_card();
-      if ((_have_background) || (_tex == (Texture*)0L)) {
-    if (_have_background)
-      n->set_card_color(_background);
-    if (_tex != (Texture*)0L)
-      n->set_card_texture(_tex);
-    if (_have_width || _have_height) {
-      n->set_card_as_margin(simple_text_margin_left,
-                simple_text_margin_right,
-                simple_text_margin_bottom,
-                simple_text_margin_top);
-      LVecBase4f v = n->get_card_actual();
-      float w = v[1] - v[0];
-      float h = v[3] - v[2];
-      if (_have_width) {
-        w = _width - w;
-        w *= 0.5f;
-        v[1] += w;
-        v[0] -= w;
-      } else {
-        v[0] -= simple_text_margin_left;
-        v[1] += simple_text_margin_right;
-      }
-      if (_have_height) {
-        h = _height - h;
-        h *= 0.5f;
-        v[3] += h;
-        v[2] -= h;
-      } else {
-        v[2] -= simple_text_margin_bottom;
-        v[3] += simple_text_margin_top;
-      }
-      n->set_card_actual(v[0], v[1], v[2], v[3]);
-    } else
-      n->set_card_as_margin(simple_text_margin_left,
-                simple_text_margin_right,
-                simple_text_margin_bottom,
-                simple_text_margin_top);
-      }
-    }
-    break;
-  case SIMPLE_TEXTURE:
-  case MODEL:
-  case L_NULL:
-    if (_have_foreground)
-      _internal->set_transition(new ColorTransition(_foreground));
-    break;
-  case SIMPLE_CARD:
-    if (_have_foreground) {
-      _internal->set_transition(new ColorTransition(_foreground));
-      TransparencyProperty::Mode mode;
-      if (_foreground[3] != 1.0f)
-    mode = TransparencyProperty::M_alpha;
-      else
-    mode = TransparencyProperty::M_none;
-      _internal->set_transition(new TransparencyTransition(mode));
-    }
-    {
-      float w, h;
-      w = _have_width?(_width * 0.5f):0.5f;
-      h = _have_height?(_height * 0.5f):0.5f;
-      PTA_Vertexf verts;
-      verts.push_back(Vertexf::rfu(-w, 0.0f, h));
-      verts.push_back(Vertexf::rfu(-w, 0.0f, -h));
-      verts.push_back(Vertexf::rfu(w, 0.0f, h));
-      verts.push_back(Vertexf::rfu(w, 0.0f, -h));
-      _gset->set_coords(verts, G_PER_VERTEX);
-    }
-    break;
-  default:
-    gui_cat->warning() << "set_properties on invalid label type ("
-               << (int)_type << ")" << endl;
-  }
-}
-
-GuiLabel::~GuiLabel(void) {
-#ifdef _DEBUG
-  if (gui_cat.is_debug())
-    gui_cat->debug() << "deleting label (0x" << (void*)this << ")" << endl;
-#endif
-}
-
-#include <textureTransition.h>
-#include <geomTristrip.h>
-
-GuiLabel* GuiLabel::make_simple_texture_label(Texture* texture) {
-  GuiLabel* ret = new GuiLabel();
-  ret->_type = SIMPLE_TEXTURE;
-  ret->_tex = texture;
-  ret->_geom = new NamedNode("GUI label");
-  GeomNode* n2 = new GeomNode();
-  ret->_internal = new RenderRelation(ret->_geom, n2);
-  ret->_internal->set_transition(new TextureTransition(texture));
-  GeomTristrip *geoset = new GeomTristrip;
-  PTA_int lengths(0);
-  lengths.push_back(4);
-  PTA_Vertexf verts;
-  float l, r, b, t;
-  {
-    // compute {l, r, b, t}
-    int xs = texture->_pbuffer->get_xsize();
-    int ys = texture->_pbuffer->get_ysize();
-    float ratio;
-
-    if (xs > ys) {
-      // horizontally dominant
-      ratio = ((float)ys) / ((float)xs);
-      ratio *= 0.5f;
-      l = -0.5f;
-      r = 0.5f;
-      b = -ratio;
-      t = ratio;
-    } else {
-      // vertically dominant
-      ratio = ((float)xs) / ((float)ys);
-      ratio *= 0.5f;
-      l = -ratio;
-      r = ratio;
-      b = -0.5f;
-      t = 0.5f;
-    }
-  }
-  verts.push_back(Vertexf::rfu(l, 0.0f, t));
-  verts.push_back(Vertexf::rfu(l, 0.0f, b));
-  verts.push_back(Vertexf::rfu(r, 0.0f, t));
-  verts.push_back(Vertexf::rfu(r, 0.0f, b));
-  geoset->set_num_prims(1);
-  geoset->set_lengths(lengths);
-  geoset->set_coords(verts, G_PER_VERTEX);
-  PTA_TexCoordf uvs;
-  uvs.push_back(TexCoordf(0.0f, 1.0f));
-  uvs.push_back(TexCoordf(0.0f, 0.0f));
-  uvs.push_back(TexCoordf(1.0f, 1.0f));
-  uvs.push_back(TexCoordf(1.0f, 0.0f));
-  geoset->set_texcoords(uvs, G_PER_VERTEX);
-  n2->add_geom(geoset);
-  ret->_gset = geoset;
-  return ret;
-}
-
-GuiLabel* GuiLabel::make_simple_text_label(const string& text, TextFont* font,
-                       Texture* tex) {
-  GuiLabel* ret = new GuiLabel();
-  ret->_type = SIMPLE_TEXT;
-  TextNode* n = new TextNode("GUI label");
-  ret->_geom = n;
-  ret->_tex = tex;
-
-  // The GuiLabel is initially frozen at the time it is created.
-  n->freeze();
-
-  n->set_font(font);
-  n->set_align(TM_ALIGN_CENTER);
-  n->set_text_color(ret->get_foreground_color());
-  n->set_text(text);
-  if (tex != (Texture*)0L)
-    n->set_card_texture(tex);
-  ret->set_scale(1.0f);
-  ret->set_pos(LVector3f(0.0f, 0.0f, 0.0f));
-  ret->recompute_transform();
-  return ret;
-}
-
-GuiLabel* GuiLabel::make_simple_card_label(void) {
-  GuiLabel* ret = new GuiLabel();
-  ret->_type = SIMPLE_CARD;
-  ret->_geom = new NamedNode("GUI label");
-  GeomNode* n2 = new GeomNode();
-  ret->_internal = new RenderRelation(ret->_geom, n2);
-  ret->_internal->set_transition(
-                new ColorTransition(Colorf(ret->_foreground)));
-  GeomTristrip *geoset = new GeomTristrip;
-  PTA_int lengths(0);
-  lengths.push_back(4);
-  PTA_Vertexf verts;
-  verts.push_back(Vertexf::rfu(-0.5f, 0.0f, 0.5f));
-  verts.push_back(Vertexf::rfu(-0.5f, 0.0f, -0.5f));
-  verts.push_back(Vertexf::rfu(0.5f, 0.0f, 0.5f));
-  verts.push_back(Vertexf::rfu(0.5f, 0.0f, -0.5f));
-  geoset->set_num_prims(1);
-  geoset->set_lengths(lengths);
-  geoset->set_coords(verts, G_PER_VERTEX);
-  n2->add_geom(geoset);
-  ret->_gset = geoset;
-  return ret;
-}
-
-GuiLabel* GuiLabel::make_null_label(void) {
-  GuiLabel* ret = new GuiLabel();
-  ret->_type = L_NULL;
-  ret->_geom = new NamedNode("GUI label");
-  NamedNode* n2 = new NamedNode("dummy");
-  ret->_internal = new RenderRelation(ret->_geom, n2);
-  ret->_internal->set_transition(
-                new ColorTransition(Colorf(ret->_foreground)));
-  return ret;
-}
-
-GuiLabel* GuiLabel::make_model_label(Node* geom, float w, float h) {
-  GuiLabel* ret = new GuiLabel();
-  ret->_type = MODEL;
-  ret->_geom = new NamedNode("GUI label");
-  ret->_model_width = w;
-  ret->_model_height = h;
-  ret->_internal = new RenderRelation(ret->_geom, geom);
-#ifdef _DEBUG
-  gui_cat->debug() << "created model label 0x" << (void*)ret
-           << " from node 0x" << (void*)geom
-           << ", set _type(" << (int)(ret->_type) << ") to MODEL("
-           << (int)MODEL << ")" << endl;
-#endif
-  return ret;
-}
-
-GuiLabel* GuiLabel::make_model_label(Node* geom, float left, float right,
-                     float bottom, float top) {
-  GuiLabel* ret = new GuiLabel();
-  ret->_type = MODEL;
-  ret->_geom = new NamedNode("GUI label");
-  ret->_model_pos = LVector3f::rfu(-(left + right) * 0.5f, 0.0f,
-                   -(bottom + top) * 0.5f);
-  ret->_model_width = right - left;
-  ret->_model_height = top - bottom;
-  ret->_internal = new RenderRelation(ret->_geom, geom);
-#ifdef _DEBUG
-  gui_cat->debug() << "created model label 0x" << (void*)ret
-           << " from node 0x" << (void*)geom
-           << ", set _type(" << (int)(ret->_type) << ") to MODEL("
-           << (int)MODEL << ")" << endl;
-#endif
-  return ret;
-}
-
-int GuiLabel::freeze() {
-  switch (_type) {
-  case SIMPLE_TEXT:
-    {
-#ifdef _DEBUG
-      gui_cat->spam() << "GuiLabel:: freezing text node (0x" << (void*)this
-              << ")" << endl;
-#endif
-      TextNode* n = DCAST(TextNode, _geom);
-      return n->freeze();
-    }
-
-  default:
-    return 0;
-  }
-}
-
-int GuiLabel::thaw() {
-  switch (_type) {
-  case SIMPLE_TEXT:
-    {
-#ifdef _DEBUG
-      gui_cat->spam() << "GuiLabel:: thawing text node (0x" << (void*)this
-              << ")" << endl;
-#endif
-      TextNode* n = DCAST(TextNode, _geom);
-      return n->thaw();
-    }
-
-  default:
-    return 0;
-  }
-}
-
-void GuiLabel::get_extents(float& l, float& r, float& b, float& t) {
-  switch (_type) {
-  case SIMPLE_TEXT:
-    {
-      TextNode* n = DCAST(TextNode, _geom);
-      if (n->has_card()) {
-    LVecBase4f v = n->get_card_transformed();
-    l = v[0];
-    r = v[1];
-    b = v[2];
-    t = v[3];
-      } else {
-    LVector3f ul = n->get_upper_left_3d() - LPoint3f::origin();
-    LVector3f lr = n->get_lower_right_3d() - LPoint3f::origin();
-    LVector3f up = LVector3f::up();
-    LVector3f right = LVector3f::right();
-    l = ul.dot(right);
-    r = lr.dot(right);
-    b = lr.dot(up);
-    t = ul.dot(up);
-      }
-    }
-    break;
-  case SIMPLE_TEXTURE:
-    {
-      float xs = _tex->_pbuffer->get_xsize();
-      float ys = _tex->_pbuffer->get_ysize();
-      float ratio;
-      LVector3f ul, lr;
-
-      if (xs > ys) {
-        // horizontally dominant
-        ratio = ((float)ys) / ((float)xs);
-        ratio *= 0.5f;
-        ul = LVector3f::rfu(-0.5f, 0.0f, ratio);
-        lr = LVector3f::rfu(0.5f, 0.0f, -ratio);
-      } else {
-        // vertically dominant
-        ratio = ((float)xs) / ((float)ys);
-        ratio *= 0.5f;
-        ul = LVector3f::rfu(-ratio, 0.0f, 0.5f);
-        lr = LVector3f::rfu(ratio, 0.0f, -0.5f);
-      }
-
-/*
-      LMatrix4f mat = LMatrix4f::scale_mat(LVector3f::rfu(_scale_x, _scale_y,
-                              _scale_z)) *
-    LMatrix4f::scale_mat(_scale) *
-    LMatrix4f::translate_mat(_pos);
-
-    ul = ul * mat;
-    lr = lr * mat;
-*/
-      // optimize above
-
-      LVector3f scalevec1 = LVector3f::rfu(_scale_x*_scale, _scale_y*_scale, _scale_z*_scale);
-      LVector3f scalevec2 = LVector3f::rfu((_mirror_x?-1.0f:1.0f),
-                                            1.0f,
-                                            (_mirror_y?-1.0f:1.0f));
-
-      scalevec1._v.v._0 *= scalevec2._v.v._0;
-      scalevec1._v.v._1 *= scalevec2._v.v._1;
-      scalevec1._v.v._2 *= scalevec2._v.v._2;
-
-      ul._v.v._0 = scalevec1._v.v._0 * ul._v.v._0 + _pos._v.v._0;
-      ul._v.v._1 = scalevec1._v.v._1 * ul._v.v._1 + _pos._v.v._1;
-      ul._v.v._2 = scalevec1._v.v._2 * ul._v.v._2 + _pos._v.v._2;
-
-      lr._v.v._0 = scalevec1._v.v._0 * lr._v.v._0 + _pos._v.v._0;
-      lr._v.v._1 = scalevec1._v.v._1 * lr._v.v._1 + _pos._v.v._1;
-      lr._v.v._2 = scalevec1._v.v._2 * lr._v.v._2 + _pos._v.v._2;
-
-      l = ul.dot(ul.right());
-      r = lr.dot(lr.right());
-      b = lr.dot(lr.up());
-      t = ul.dot(ul.up());
-    }
-    break;
-  case SIMPLE_CARD:
-    {
-      float x = _pos.dot(LVector3f::rfu(1.0f, 0.0f, 0.0f));
-      float y = _pos.dot(LVector3f::rfu(0.0f, 0.0f, 1.0f));
-      l = _have_width?-(_width*0.5f):-0.5f;
-      r = _have_width?(_width*0.5f):0.5f;
-      l += x;
-      r += x;
-      b = _have_height?-(_height*0.5f):-0.5f;
-      t = _have_height?(_height*0.5f):0.5f;
-      b += y;
-      t += y;
-    }
-    break;
-  case L_NULL:
-    {
-      float x = _pos.dot(LVector3f::rfu(1.0f, 0.0f, 0.0f));
-      float y = _pos.dot(LVector3f::rfu(0.0f, 0.0f, 1.0f));
-      l = _have_width?-(_width*0.5f):-0.000005f;
-      r = _have_width?(_width*0.5f):0.000005f;
-      l += x;
-      r += x;
-      b = _have_height?-(_height*0.5f):-0.000005f;
-      t = _have_height?(_height*0.5f):0.000005f;
-      b += y;
-      t += y;
-    }
-    break;
-  case MODEL:
-    {
-      float x = _pos.dot(LVector3f::rfu(1.0f, 0.0f, 0.0f));
-      float y = _pos.dot(LVector3f::rfu(0.0f, 0.0f, 1.0f));
-      l = _have_width?-(_width*_model_width*0.5f):-(_model_width*0.5f);
-      r = _have_width?(_width*_model_width*0.5f):(_model_width*0.5f);
-      l += x;
-      r += x;
-      b = _have_height?-(_height*_model_height*0.5f):-(_model_height*0.5f);
-      t = _have_height?(_height*_model_height*0.5f):(_model_height*0.5f);
-      b += y;
-      t += y;
-    }
-    break;
-  default:
-    gui_cat->warning()
-      << "trying to get extents from something I don't know how to" << endl;
-    l = b = 0.0f;
-    r = t = 1.0f;
-  }
-}
-
-float GuiLabel::get_width(void) {
-  float w;
-  switch (_type) {
-  case SIMPLE_TEXT:
-    {
-      TextNode* n = DCAST(TextNode, _geom);
-      if (n->has_card()) {
-    LVecBase4f v = n->get_card_actual();
-    w = v[1] - v[0];
-      } else
-    w = n->get_width();
-    }
-    break;
-  case SIMPLE_TEXTURE:
-    gui_cat->warning() << "tried to get width from a texture label" << endl;
-    w = 1.0f;
-    break;
-  case SIMPLE_CARD:
-    w = _have_width?_width:1.0f;
-    break;
-  case MODEL:
-    w = _have_width?(_width*_model_width):_model_width;
-    break;
-  case L_NULL:
-    w = _have_width?_width:0.00001f;
-    break;
-  default:
-    gui_cat->warning()
-      << "trying to get width from something I don't know how to" << endl;
-    w = 1.0f;
-  }
-  return w;
-}
-
-float GuiLabel::get_height(void) {
-  float h;
-  switch (_type) {
-  case SIMPLE_TEXT:
-    {
-      TextNode* n = DCAST(TextNode, _geom);
-      if (n->has_card()) {
-    LVecBase4f v = n->get_card_actual();
-    h = v[3] - v[2];
-      } else
-    h = n->get_width();
-    }
-    break;
-  case SIMPLE_TEXTURE:
-    gui_cat->warning() << "tried to get height from a texture label" << endl;
-    h = 1.0f;
-    break;
-  case SIMPLE_CARD:
-    h = _have_height?_height:1.0f;
-    break;
-  case MODEL:
-    h = _have_height?(_height*_model_height):_model_height;
-    break;
-  case L_NULL:
-    h = _have_height?_height:0.00001;
-    break;
-  default:
-    gui_cat->warning()
-      << "trying to get height from something I don't know how to" << endl;
-    h = 1.0f;
-  }
-  return h;
-}
-
-void GuiLabel::set_foreground_color(const Colorf& color) {
-  _foreground = color;
-  set_properties();
-}
-
-void GuiLabel::set_background_color(const Colorf& color) {
-  static Colorf zero(0.0f, 0.0f, 0.0f, 0.0f);
-
-  _background = color;
-  _have_background = (color != zero);
-  set_properties();
-}
-
-void GuiLabel::set_text(const string& val) {
-  switch (_type) {
-  case SIMPLE_TEXT:
-    {
-      TextNode* n = DCAST(TextNode, _geom);
-      n->set_text(val);
-    }
-    break;
-  case SIMPLE_TEXTURE:
-    gui_cat->warning() << "tried to set text on a texture label" << endl;
-    break;
-  case SIMPLE_CARD:
-    gui_cat->warning() << "tried to set text on a card label" << endl;
-    break;
-  case MODEL:
-    gui_cat->warning() << "tried to set text on a model label" << endl;
-    break;
-  case L_NULL:
-    gui_cat->warning() << "tried to set text on a null label" << endl;
-    break;
-  default:
-    gui_cat->warning() << "trying to set text on an unknown label type ("
-               << (int)_type << ")" << endl;
-  }
-  recompute();
-}
-
-void GuiLabel::set_shadow_color(const Colorf& c) {
-  switch (_type) {
-  case SIMPLE_TEXT:
-    {
-      TextNode* n = DCAST(TextNode, _geom);
-      n->set_shadow_color(c);
-    }
-    break;
-  case SIMPLE_TEXTURE:
-    gui_cat->warning() << "tried to set shadow color on a texture label"
-               << endl;
-    break;
-  case SIMPLE_CARD:
-    gui_cat->warning() << "tried to set shadow color on a card label" << endl;
-    break;
-  case MODEL:
-    gui_cat->warning() << "tried to set shadow color on a model label" << endl;
-    break;
-  case L_NULL:
-    gui_cat->warning() << "tried to set shadow color on a null label" << endl;
-    break;
-  default:
-    gui_cat->warning()
-      << "trying to set shadow color on an unknown label type (" << (int)_type
-      << ")" << endl;
-  }
-  recompute();
-}
-
-void GuiLabel::set_shadow(float x, float y) {
-  switch (_type) {
-  case SIMPLE_TEXT:
-    {
-      TextNode* n = DCAST(TextNode, _geom);
-      n->set_shadow(x, y);
-    }
-    break;
-  case SIMPLE_TEXTURE:
-    gui_cat->warning() << "tried to set shadow on a texture label" << endl;
-    break;
-  case SIMPLE_CARD:
-    gui_cat->warning() << "tried to set shadow on a card label" << endl;
-    break;
-  case MODEL:
-    gui_cat->warning() << "tried to set shadow on a model label" << endl;
-    break;
-  case L_NULL:
-    gui_cat->warning() << "tried to set shadow on a null label" << endl;
-    break;
-  default:
-    gui_cat->warning() << "trying to set shadow on an unknown label type ("
-               << (int)_type << ")" << endl;
-  }
-  recompute();
-}
-
-void GuiLabel::set_align(int a) {
-  switch (_type) {
-  case SIMPLE_TEXT:
-    {
-      TextNode* n = DCAST(TextNode, _geom);
-      n->set_align(a);
-    }
-    break;
-  case SIMPLE_TEXTURE:
-    gui_cat->warning() << "tried to set align on a texture label" << endl;
-    break;
-  case SIMPLE_CARD:
-    gui_cat->warning() << "tried to set align on a card label" << endl;
-    break;
-  case MODEL:
-    gui_cat->warning() << "tried to set align on a model label" << endl;
-    break;
-  case L_NULL:
-    gui_cat->warning() << "tried to set align on a null label" << endl;
-    break;
-  default:
-    gui_cat->warning() << "trying to set align on an unknown label type ("
-               << (int)_type << ")" << endl;
-  }
-  recompute();
-}
-
-bool GuiLabel::operator<(const GuiLabel& c) const {
-  if (_highest_pri)
-    return false;
-  if (c._highest_pri)
-    return true;
-  if (_lowest_pri)
-    return true;
-  if (c._lowest_pri)
-    return false;
-  PriorityMap::const_iterator pi;
-  pi = _priorities.find((GuiLabel*)(&c));
-  if (pi != _priorities.end()) {
-    if ((*pi).second == P_LOWER)
-      return true;
-    else
-      return false;
-  }
-  pi = c._priorities.find((GuiLabel*)this);
-  if (pi != c._priorities.end()) {
-    if ((*pi).second == P_LOWER)
-      return false;
-    else
-      return true;
-  }
-  return ((void*)this) < ((void*)&c);
-}
-
-#include <geomBinTransition.h>
-
-int GuiLabel::set_draw_order(int order) {
-  int ret = order+1;
-  this->freeze();
-  _has_hard_pri = true;
-  _hard_pri = order;
-  switch (_type) {
-  case SIMPLE_TEXT:
-    {
-      TextNode* n = DCAST(TextNode, _geom);
-      n->set_bin("fixed");
-      n->set_draw_order(order);
-      ret += 2;
-    }
-    break;
-  case SIMPLE_TEXTURE:
-  case SIMPLE_CARD:
-  case L_NULL:
-  case MODEL:
-    _internal->set_transition(new GeomBinTransition("fixed", order));
-    break;
-  default:
-    gui_cat->warning() << "trying to set draw order on an unknown label type ("
-               << (int)_type << ")" << endl;
-  }
-  this->thaw();
-  return ret;
-}
-
-int GuiLabel::soft_set_draw_order(int order) {
-  int ret = order+1;
-  this->freeze();
-  _has_hard_pri = false;
-  _hard_pri = order;
-  switch (_type) {
-  case SIMPLE_TEXT:
-    {
-      TextNode* n = DCAST(TextNode, _geom);
-      n->set_bin("fixed");
-      n->set_draw_order(order);
-      ret += 2;
-    }
-    break;
-  case SIMPLE_TEXTURE:
-  case SIMPLE_CARD:
-  case L_NULL:
-  case MODEL:
-    _arc->set_transition(new GeomBinTransition("fixed", order));
-    break;
-  default:
-    gui_cat->warning() << "trying to set draw order on an unknown label type ("
-               << (int)_type << ")" << endl;
-  }
-  this->thaw();
-  return ret;
-}
-
-void GuiLabel::write(ostream& os) const {
-  os << "GuiLabel: (0x" << (void*)this << ")" << endl;
-  os << "  refcount = " << this->get_ref_count() << endl;
-  os << "  _type = ";
-  switch (this->_type) {
-  case NONE:
-    os << "NONE";
-    break;
-  case SIMPLE_TEXTURE:
-    os << "SIMPLE_TEXTURE";
-    break;
-  case SIMPLE_TEXT:
-    os << "SIMPLE_TEXT";
-    break;
-  case SIMPLE_CARD:
-    os << "SIMPLE_CARD";
-    break;
-  case MODEL:
-    os << "MODEL";
-    break;
-  case L_NULL:
-    os << "NULL";
-    break;
-  default:
-    os << "bad";
-  }
-  os << endl << "  _geom = 0x" << (void*)(this->_geom.p()) << endl;
-  os << "  _arc = 0x" << (void*)(this->_arc) << endl;
-  os << "  _tex = 0x" << (void*)(this->_tex.p()) << endl;
-  os << "  _internal = 0x" << (void*)(this->_internal) << endl;
-  os << "  _gset = 0x" << (void*)(this->_gset) << endl;
-  os << "  _model_width = " << this->_model_width << endl;
-  os << "  _model_height = " << this->_model_height << endl;
-  os << "  _scale = " << this->_scale << endl;
-  os << "  _pos = " << this->_pos << endl;
-  os << "  _foreground = " << this->_foreground << endl;
-  if (_have_background)
-    os << "  _background = " << this->_background << endl;
-  if (_have_width)
-    os << "  _width = " << this->_width << endl;
-  if (_have_height)
-    os << "  _height = " << this->_height << endl;
-}

+ 0 - 165
panda/src/gui/guiLabel.h

@@ -1,165 +0,0 @@
-// Filename: guiLabel.h
-// Created by:  cary (26Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __GUILABEL_H__
-#define __GUILABEL_H__
-
-#include "config_gui.h"
-
-#include <pandabase.h>
-#include <node.h>
-#include <pt_Node.h>
-#include <renderRelation.h>
-#include <texture.h>
-#include <typedReferenceCount.h>
-#include <geom.h>
-
-// label-ish behavior for GUI objects (labels, buttons, rollovers)
-
-class GuiManager;
-class TextFont;
-
-class EXPCL_PANDA GuiLabel : public TypedReferenceCount {
-PUBLISHED:
-  enum PriorityType { P_NONE, P_LOWEST, P_LOWER, P_HIGHER, P_HIGHEST };
-private:
-  typedef pmap<GuiLabel*, PriorityType> PriorityMap;
-  enum LabelType { NONE, L_NULL, SIMPLE_TEXTURE, SIMPLE_TEXT, SIMPLE_CARD, MODEL };
-
-  LabelType _type;
-  PT_Node _geom;
-  RenderRelation* _arc;
-  PT(Texture) _tex;
-  RenderRelation* _internal;
-  Geom* _gset;
-  float _model_width, _model_height;
-
-  float _scale;
-  float _scale_x, _scale_y, _scale_z;
-  LVector3f _pos;
-  LVector3f _model_pos;
-  bool _have_foreground;
-  Colorf _foreground;
-  bool _have_background;
-  Colorf _background;
-  bool _have_width;
-  float _width;
-  bool _have_height;
-  float _height;
-  bool _mirror_x;
-  bool _mirror_y;
-
-  PriorityMap _priorities;
-  int _hard_pri;
-  bool _highest_pri;
-  bool _lowest_pri;
-  bool _has_hard_pri;
-
-  INLINE Node* get_geometry(void) const;
-  INLINE void set_arc(RenderRelation*);
-  INLINE RenderRelation* get_arc(void) const;
-
-  friend GuiManager;
-
-  void recompute_transform(void);
-  void set_properties(void);
-
-PUBLISHED:
-  INLINE GuiLabel(void);
-  virtual ~GuiLabel(void);
-
-  static GuiLabel* make_simple_texture_label(Texture*);
-  static GuiLabel* make_simple_text_label(const string&, TextFont*,
-                                          Texture* = (Texture*)0L);
-  static GuiLabel* make_simple_card_label(void);
-  static GuiLabel* make_null_label(void);
-  static GuiLabel* make_model_label(Node*, float, float);
-  static GuiLabel* make_model_label(Node*, float, float, float, float);
-
-  int freeze();
-  int thaw();
-
-  void get_extents(float&, float&, float&, float&);
-  float get_width(void);
-  float get_height(void);
-
-  INLINE void set_width(float);
-  INLINE void set_height(float);
-
-  INLINE void set_scale(float);
-  INLINE void set_scale(float, float, float);
-  INLINE void set_mirror_x(bool);
-  INLINE void set_mirror_y(bool);
-  INLINE void set_pos(float, float, float);
-  INLINE void set_pos(const LVector3f&);
-
-  INLINE float get_scale(void) const;
-  INLINE bool get_mirror_x(void) const;
-  INLINE bool get_mirror_y(void) const;
-  INLINE LVector3f get_pos(void) const;
-
-  INLINE void set_foreground_color(float, float, float, float);
-  void set_foreground_color(const Colorf&);
-  INLINE void set_background_color(float, float, float, float);
-  void set_background_color(const Colorf&);
-
-  INLINE Colorf get_foreground_color(void) const;
-  INLINE Colorf get_background_color(void) const;
-
-  void set_text(const string&);
-  INLINE void set_shadow_color(float, float, float, float);
-  void set_shadow_color(const Colorf&);
-  void set_shadow(float, float);
-  void set_align(int);
-
-  INLINE void recompute(void);
-
-  // used for the priority system
-  bool operator<(const GuiLabel&) const;
-  INLINE void set_priority(GuiLabel*, const PriorityType);
-  int soft_set_draw_order(int);
-  int set_draw_order(int);
-  INLINE bool has_hard_draw_order(void) const;
-  INLINE int get_draw_order(void) const;
-
-  void write(ostream&) const;
-
-public:
-  // type interface
-  static TypeHandle get_class_type(void) {
-    return _type_handle;
-  }
-  static void init_type(void) {
-    TypedReferenceCount::init_type();
-    register_type(_type_handle, "GuiLabel",
-                  TypedReferenceCount::get_class_type());
-  }
-  virtual TypeHandle get_type(void) const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type(void) {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "guiLabel.I"
-
-#endif /* __GUILABEL_H__ */

+ 0 - 19
panda/src/gui/guiListBox.I

@@ -1,19 +0,0 @@
-// Filename: guiListBox.I
-// Created by:  cary (18Jan01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-INLINE GuiListBox::GuiListBox(void) {}

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

@@ -1,446 +0,0 @@
-// Filename: guiListBox.cxx
-// Created by:  cary (18Jan01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "guiListBox.h"
-
-TypeHandle GuiListBox::_type_handle;
-TypeHandle GuiListBox::ListFunctor::_type_handle;
-
-GuiListBox::ListFunctor::ListFunctor(GuiListBox* box,
-                                     GuiBehavior::BehaviorFunctor* func)
-  : GuiBehavior::BehaviorFunctor(), _prev(func), _lb(box) {
-}
-
-GuiListBox::ListFunctor::~ListFunctor(void) {
-  _prev.clear();
-}
-
-void GuiListBox::ListFunctor::doit(GuiBehavior* b) {
-  if ((b == this->_lb->_up_arrow) && this->_lb->_up_arrow->is_active())
-    this->_lb->scroll_up();
-  if ((b == this->_lb->_down_arrow) && this->_lb->_down_arrow->is_active())
-    this->_lb->scroll_down();
-  if (_prev != (GuiBehavior::BehaviorFunctor*)0L)
-    _prev->doit(b);
-}
-
-void GuiListBox::recompute_frame(void) {
-  this->freeze();
-  LVector3f p = _pos;
-  float lft = 100000.;
-  float rgt = -100000.;
-  float tp = -100000.;
-  float btm = 100000.;
-  LVector4f frm;
-  for (ItemVector::iterator i=_visible.begin(); i!=_visible.end();
-       p-=((*i)->get_height() * LVector3f::up()), ++i) {
-    (*i)->set_pos(p);
-    frm = (*i)->get_frame();
-    if (frm[0] < lft)
-      lft = frm[0];
-    if (frm[1] > rgt)
-      rgt = frm[1];
-    if (frm[2] < btm)
-      btm = frm[2];
-    if (frm[3] > tp)
-      tp = frm[3];
-    (*i)->freeze();
-    int lvl = (*i)->thaw();
-#ifdef _DEBUG
-    gui_cat->debug() << "in recompute: freeze lvl (" << (*i)->get_name()
-                     << ") = " << lvl << endl;
-#endif
-  }
-  _left = lft;
-  _right = rgt;
-  _top = tp;
-  _bottom = btm;
-  GuiBehavior::recompute_frame();
-  this->adjust_region();
-  this->thaw();
-  this->deal_with_buttons();
-}
-
-void GuiListBox::deal_with_buttons(void) {
-  // check the state of the up and down buttons
-  if (_bottom_stack.size() == 0) {
-    _down_arrow->exit();
-    _down_arrow->inactive();
-  } else {
-    _down_arrow->up();
-    if (_behavior_running) {
-      _down_arrow->start_behavior();
-      _down_arrow->set_behavior_functor(_down_functor);
-    }
-  }
-  if (_top_stack.size() == 0) {
-    _up_arrow->exit();
-    _up_arrow->inactive();
-  } else {
-    _up_arrow->up();
-    if (_behavior_running) {
-      _up_arrow->start_behavior();
-      _up_arrow->set_behavior_functor(_up_functor);
-    }
-  }
-}
-
-void GuiListBox::set_priority(GuiLabel* l, const GuiItem::Priority p) {
-  ItemVector::iterator i;
-  ItemDeque::iterator j;
-
-  for (i=_top_stack.begin(); i!=_top_stack.end(); ++i)
-    (*i)->set_priority(l, p);
-  for (i=_visible.begin(); i!=_visible.end(); ++i)
-    (*i)->set_priority(l, p);
-  for (j=_bottom_stack.begin(); j!=_bottom_stack.end(); ++j)
-    (*j)->set_priority(l, p);
-  _up_arrow->set_priority(l, p);
-  _down_arrow->set_priority(l, p);
-}
-
-GuiListBox::GuiListBox(const string& name, int N, GuiButton* up,
-                       GuiButton* down)
-  : GuiBehavior(name), _up_arrow(up), _down_arrow(down), _n_visible(N),
-    _up_functor((GuiListBox::ListFunctor*)0L),
-    _down_functor((GuiListBox::ListFunctor*)0L) {
-  if (N < 4) {
-    gui_cat->warning() << "ListBoxes should have at least 4 visible slots"
-                       << endl;
-    _n_visible = 4;
-  }
-}
-
-GuiListBox::~GuiListBox(void) {
-  this->unmanage();
-}
-
-void GuiListBox::scroll_down(void) {
-  if (_bottom_stack.size() == 0)
-    return;   // nothing to scroll
-  // compute what the first and list item in the visible list are
-  int first = 0;
-  int last = _n_visible-1;
-  // first push one off the top onto the top stack
-  _top_stack.push_back(_visible[first]);
-  _visible[first]->unmanage();
-  // then move everything up one
-  for (int i=first; i!=last; ++i)
-    _visible[i] = _visible[i+1];
-  // then add one from the bottom stack to the bottom
-  _visible[last] = *(_bottom_stack.rbegin());
-  if (_mgr != (GuiManager*)0L) {
-    if (_alt_root.is_null())
-      _visible[last]->manage(_mgr, *_eh);
-    else
-      _visible[last]->manage(_mgr, *_eh, _alt_root);
-  }
-  // and pop it off the bottom stack
-  _bottom_stack.pop_back();
-  this->deal_with_buttons();
-  // finally recompute all the possitions
-  this->recompute_frame();
-  if (_mgr != (GuiManager*)0L)
-    _mgr->recompute_priorities();
-}
-
-void GuiListBox::scroll_up(void) {
-  if (_top_stack.size() == 0)
-    return;  // nothing to scroll
-  // compute what the first and last item in the visible list are
-  int first = 0;
-  int last = _n_visible - 1;
-  // first push one off the bottom onto the bottom stack
-  _bottom_stack.push_back(_visible[last]);
-  _visible[last]->unmanage();
-  // then move everything down one
-  for (int i=last; i!=first; --i)
-    _visible[i] = _visible[i-1];
-  // then add one from the top stack to the top
-  _visible[first] = *(_top_stack.rbegin());
-  if (_mgr != (GuiManager*)0L) {
-    if (_alt_root.is_null())
-      _visible[first]->manage(_mgr, *_eh);
-    else
-      _visible[first]->manage(_mgr, *_eh, _alt_root);
-  }
-  // and pop it off the top stack
-  _top_stack.pop_back();
-  this->deal_with_buttons();
-  // finally recompute all the possitions
-  this->recompute_frame();
-  if (_mgr != (GuiManager*)0L)
-    _mgr->recompute_priorities();
-}
-
-void GuiListBox::add_item(GuiItem* item) {
-  if (_bottom_stack.size() > 0)
-    _bottom_stack.push_front(item);
-  else {
-    if (_visible.size() < _n_visible) {
-      _visible.push_back(item);
-      if (_mgr != (GuiManager*)0L) {
-        if (_alt_root.is_null())
-          item->manage(_mgr, *_eh);
-        else
-          item->manage(_mgr, *_eh, _alt_root);
-      }
-    } else
-      _bottom_stack.push_back(item);
-  }
-  this->deal_with_buttons();
-}
-
-int GuiListBox::freeze(void) {
-  int result = 0;
-  ItemVector::iterator i;
-  ItemDeque::iterator j;
-
-  gui_cat->spam() << "GuiListBox::freeze()" << endl;
-  for (i=_top_stack.begin(); i!=_top_stack.end(); ++i) {
-    int count = (*i)->freeze();
-    result = max(result, count);
-  }
-  for (i=_visible.begin(); i!=_visible.end(); ++i) {
-    int count = (*i)->freeze();
-    result = max(result, count);
-  }
-  for (j=_bottom_stack.begin(); j!=_bottom_stack.end(); ++j) {
-    int count = (*j)->freeze();
-    result = max(result, count);
-  }
-  _up_arrow->freeze();
-  _down_arrow->freeze();
-  return result;
-}
-
-int GuiListBox::thaw(void) {
-  int result = 0;
-  ItemVector::iterator i;
-  ItemDeque::iterator j;
-
-  gui_cat->spam() << "GuiListBox::thaw()" << endl;
-  for (i=_top_stack.begin(); i!=_top_stack.end(); ++i) {
-    int count = (*i)->thaw();
-    result = max(result, count);
-  }
-  for (i=_visible.begin(); i!=_visible.end(); ++i) {
-    int count = (*i)->thaw();
-    result = max(result, count);
-  }
-  for (j=_bottom_stack.begin(); j!=_bottom_stack.end(); ++j) {
-    int count = (*j)->thaw();
-    result = max(result, count);
-  }
-  _up_arrow->thaw();
-  _down_arrow->thaw();
-  return result;
-}
-
-void GuiListBox::manage(GuiManager* mgr, EventHandler& eh) {
-  if (_mgr == (GuiManager*)0L) {
-    this->recompute_frame();
-    for (ItemVector::iterator i=_visible.begin(); i!=_visible.end(); ++i)
-      (*i)->manage(mgr, eh);
-    //    _up_arrow->manage(mgr, eh);
-    //    _down_arrow->manage(mgr, eh);
-    this->deal_with_buttons();
-    GuiBehavior::manage(mgr, eh);
-  } else
-    gui_cat->warning() << "tried to manage listbox (0x" << (void*)this
-                       << ") that is already managed" << endl;
-}
-
-void GuiListBox::manage(GuiManager* mgr, EventHandler& eh, Node* n) {
-  if (_mgr == (GuiManager*)0L) {
-    this->recompute_frame();
-    for (ItemVector::iterator i=_visible.begin(); i!=_visible.end(); ++i)
-      (*i)->manage(mgr, eh, n);
-    //    _up_arrow->manage(mgr, eh, n);
-    //    _down_arrow->manage(mgr, eh, n);
-    this->deal_with_buttons();
-    GuiBehavior::manage(mgr, eh, n);
-  } else
-    gui_cat->warning() << "tried to manage listbox (0x" << (void*)this
-                       << ") that is already managed" << endl;
-}
-
-void GuiListBox::unmanage(void) {
-  for (ItemVector::iterator i=_visible.begin(); i!=_visible.end(); ++i)
-    (*i)->unmanage();
-  //  _up_arrow->unmanage();
-  //  _down_arrow->unmanage();
-  GuiBehavior::unmanage();
-}
-
-void GuiListBox::set_scale(float f) {
-  ItemVector::iterator i;
-  for (i=_top_stack.begin(); i!=_top_stack.end(); ++i)
-    (*i)->set_scale(f);
-  for (i=_visible.begin(); i!=_visible.end(); ++i)
-    (*i)->set_scale(f);
-  for (ItemDeque::iterator j=_bottom_stack.begin(); j!=_bottom_stack.end();
-       ++j)
-    (*j)->set_scale(f);
-  /*
-  _up_arrow->set_scale(f);
-  _down_arrow->set_scale(f);
-  */
-  GuiBehavior::set_scale(f);
-  this->recompute_frame();
-}
-
-void GuiListBox::set_scale(float x, float y, float z) {
-  ItemVector::iterator i;
-  for (i=_top_stack.begin(); i!=_top_stack.end(); ++i)
-    (*i)->set_scale(x, y, z);
-  for (i=_visible.begin(); i!=_visible.end(); ++i)
-    (*i)->set_scale(x, y, z);
-  for (ItemDeque::iterator j=_bottom_stack.begin(); j!=_bottom_stack.end();
-       ++j)
-    (*j)->set_scale(x, y, z);
-  /*
-  _up_arrow->set_scale(x, y, z);
-  _down_arrow->set_scale(x, y, z);
-  */
-  GuiBehavior::set_scale(x, y, z);
-  this->recompute_frame();
-}
-
-void GuiListBox::set_pos(const LVector3f& p) {
-  /*
-  ItemVector::iterator i;
-  for (i=_top_stack.begin(); i!=_top_stack.end(); ++i)
-    (*i)->set_pos(p);
-  for (i=_visible.begin(); i!=_visible.end(); ++i)
-    (*i)->set_pos(p);
-  for (ItemDeque::iterator j=_bottom_stack.begin(); j!=_bottom_stack.end();
-       ++j)
-    (*j)->set_pos(p);
-  */
-  /*
-  _up_arrow->set_pos(p);
-  _down_arrow->set_pos(p);
-  */
-  GuiBehavior::set_pos(p);
-  this->recompute_frame();
-}
-
-void GuiListBox::start_behavior(void) {
-  GuiBehavior::start_behavior();
-  if (_mgr == (GuiManager*)0L)
-    return;
-  if (_up_functor != (GuiListBox::ListFunctor*)0L) {
-    _up_arrow->set_behavior_functor(_up_functor->get_prev());
-    _up_functor.clear();
-  }
-  _up_functor =
-    new GuiListBox::ListFunctor(this, _up_arrow->get_behavior_functor());
-  _up_arrow->set_behavior_functor(_up_functor);
-  _up_arrow->start_behavior();
-  if (_down_functor != (GuiListBox::ListFunctor*)0L) {
-    _down_arrow->set_behavior_functor(_down_functor->get_prev());
-    _down_functor.clear();
-  }
-  _down_functor =
-    new GuiListBox::ListFunctor(this, _down_arrow->get_behavior_functor());
-  _down_arrow->set_behavior_functor(_down_functor);
-  _down_arrow->start_behavior();
-}
-
-void GuiListBox::stop_behavior(void) {
-  GuiBehavior::stop_behavior();
-  if (_mgr == (GuiManager*)0L)
-    return;
-  if (_up_functor != (GuiListBox::ListFunctor*)0L) {
-    _up_arrow->set_behavior_functor(_up_functor->get_prev());
-    _up_functor.clear();
-    _up_arrow->stop_behavior();
-  }
-  if (_down_functor != (GuiListBox::ListFunctor*)0L) {
-    _down_arrow->set_behavior_functor(_down_functor->get_prev());
-    _down_functor.clear();
-    _down_arrow->stop_behavior();
-  }
-}
-
-void GuiListBox::reset_behavior(void) {
-  GuiBehavior::reset_behavior();
-  if (_mgr == (GuiManager*)0L)
-    return;
-  if (_up_functor != (GuiListBox::ListFunctor*)0L)
-    _up_arrow->reset_behavior();
-  if (_down_functor != (GuiListBox::ListFunctor*)0L)
-    _down_arrow->reset_behavior();
-}
-
-void GuiListBox::set_priority(GuiItem* it, const GuiItem::Priority p) {
-  ItemVector::iterator i;
-  ItemDeque::iterator j;
-
-  for (i=_top_stack.begin(); i!=_top_stack.end(); ++i)
-    (*i)->set_priority(it, p);
-  for (i=_visible.begin(); i!=_visible.end(); ++i)
-    (*i)->set_priority(it, p);
-  for (j=_bottom_stack.begin(); j!=_bottom_stack.end(); ++j)
-    (*j)->set_priority(it, p);
-  _up_arrow->set_priority(it, p);
-  _down_arrow->set_priority(it, p);
-}
-
-int GuiListBox::set_draw_order(int v) {
-  int o = _up_arrow->set_draw_order(v);
-  o = _down_arrow->set_draw_order(o);
-
-  ItemVector::iterator i;
-  ItemDeque::iterator j;
-
-  for (i=_top_stack.begin(); i!=_top_stack.end(); ++i)
-    o = (*i)->set_draw_order(o);
-  for (i=_visible.begin(); i!=_visible.end(); ++i)
-    o = (*i)->set_draw_order(o);
-  for (j=_bottom_stack.begin(); j!=_bottom_stack.end(); ++j)
-    o = (*j)->set_draw_order(o);
-  return GuiBehavior::set_draw_order(o);
-}
-
-void GuiListBox::output(ostream& os) const {
-  GuiBehavior::output(os);
-  os << "  Listbox data:" << endl;
-  os << "    up_arrow = (0x" << (void*)_up_arrow << ")" << endl;
-  os << "    down_arrow = (0x" << (void*)_down_arrow << ")" << endl;
-  os << "    Top stack (" << _top_stack.size() << "):" << endl;
-  ItemVector::const_iterator i;
-  for (i=_top_stack.begin(); i!=_top_stack.end(); ++i)
-    os << "      0x" << (void*)(*i) << " (" << (*i)->get_name() << ")" << endl;
-  os << "    Visible (" << _visible.size() << "):" << endl;
-  for (i=_visible.begin(); i!=_visible.end(); ++i)
-    os << "      0x" << (void*)(*i) << " (" << (*i)->get_name() << ")" << endl;
-  os << "    Bottom stack (" << _bottom_stack.size() << "):" << endl;
-  ItemDeque::const_iterator j;
-  for (j=_bottom_stack.begin(); j!=_bottom_stack.end(); ++j)
-    os << "      0x" << (void*)(*j) << " (" << (*j)->get_name() << ")" << endl;
-  os << *_up_arrow;
-  os << *_down_arrow;
-  for (i=_top_stack.begin(); i!=_top_stack.end(); ++i)
-    os << *(*i);
-  for (i=_visible.begin(); i!=_visible.end(); ++i)
-    os << *(*i);
-  for (j=_bottom_stack.begin(); j!=_bottom_stack.end(); ++j)
-    os << *(*j);
-}

+ 0 - 130
panda/src/gui/guiListBox.h

@@ -1,130 +0,0 @@
-// Filename: guiListBox.h
-// Created by:  cary (18Jan01)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __GUILISTBOX_H__
-#define __GUILISTBOX_H__
-
-#include "guiBehavior.h"
-#include "guiButton.h"
-
-#include "pvector.h"
-#include "pdeque.h"
-
-class EXPCL_PANDA GuiListBox : public GuiBehavior {
-private:
-  typedef pvector< PT(GuiItem) > ItemVector;
-  typedef pdeque< PT(GuiItem) > ItemDeque;
-
-  class EXPCL_PANDA ListFunctor : public GuiBehavior::BehaviorFunctor {
-  protected:
-    PT(GuiBehavior::BehaviorFunctor) _prev;
-    GuiListBox* _lb;
-  public:
-    ListFunctor(GuiListBox*, GuiBehavior::BehaviorFunctor*);
-    virtual ~ListFunctor(void);
-    virtual void doit(GuiBehavior*);
-    INLINE GuiBehavior::BehaviorFunctor* get_prev(void) { return _prev; }
-  public:
-    // type interface
-    static TypeHandle get_class_type(void) {
-      return _type_handle;
-    }
-    static void init_type(void) {
-      GuiBehavior::BehaviorFunctor::init_type();
-      register_type(_type_handle, "ListFunctor",
-                    GuiBehavior::BehaviorFunctor::get_class_type());
-    }
-    virtual TypeHandle get_type(void) const {
-      return get_class_type();
-    }
-    virtual TypeHandle force_init_type(void) {
-      init_type();
-      return get_class_type();
-    }
-  private:
-    static TypeHandle _type_handle;
-  };
-
-  friend ListFunctor;
-
-  ItemVector _top_stack;
-  ItemDeque _bottom_stack;
-  ItemVector _visible;
-  PT(GuiButton) _up_arrow;
-  PT(GuiButton) _down_arrow;
-  unsigned int _n_visible;
-
-  PT(ListFunctor) _up_functor;
-  PT(ListFunctor) _down_functor;
-
-  INLINE GuiListBox(void);
-  virtual void recompute_frame(void);
-  virtual void deal_with_buttons(void);
-PUBLISHED:
-  GuiListBox(const string&, int, GuiButton*, GuiButton*);
-  ~GuiListBox(void);
-
-  void scroll_up(void);
-  void scroll_down(void);
-  void add_item(GuiItem*);
-
-  virtual int freeze(void);
-  virtual int thaw(void);
-
-  virtual void manage(GuiManager*, EventHandler&);
-  virtual void manage(GuiManager*, EventHandler&, Node*);
-  virtual void unmanage(void);
-
-  virtual void set_scale(float);
-  virtual void set_scale(float, float, float);
-  virtual void set_pos(const LVector3f&);
-  virtual void set_priority(GuiLabel*, const Priority);
-  virtual void set_priority(GuiItem*, const Priority);
-
-  virtual void start_behavior(void);
-  virtual void stop_behavior(void);
-  virtual void reset_behavior(void);
-
-  virtual int set_draw_order(int);
-
-  virtual void output(ostream&) const;
-public:
-  // type interface
-  static TypeHandle get_class_type(void) {
-    return _type_handle;
-  }
-  static void init_type(void) {
-    GuiBehavior::init_type();
-    register_type(_type_handle, "GuiListBox",
-                  GuiBehavior::get_class_type());
-    ListFunctor::init_type();
-  }
-  virtual TypeHandle get_type(void) const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type(void) {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "guiListBox.I"
-
-#endif /* __GUILISTBOX_H__ */

+ 0 - 48
panda/src/gui/guiManager.I

@@ -1,48 +0,0 @@
-// Filename: guiManager.I
-// Created by:  cary (25Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-INLINE GuiManager::GuiManager(MouseWatcher* w, Node* n, EventHandler* h)
-  : _start_draw_order(0), _next_draw_order(0), _root(n), _watcher(w),
-    _eh(h) {
-}
-
-INLINE int GuiManager::get_next_draw_order(void) const {
-  return _next_draw_order;
-}
-
-INLINE void GuiManager::set_next_draw_order(int v) {
-#ifndef NDEBUG
-  if (v < _next_draw_order)
-    gui_cat->warning() << "GuiManager::set_next_draw_order(" << v
-                       << ") is < existing (" << _next_draw_order << ")"
-                       << endl;
-#endif /* NDEBUG */
-  this->_next_draw_order = v;
-}
-
-INLINE int GuiManager::get_start_draw_order(void) const {
-  return _start_draw_order;
-}
-
-INLINE void GuiManager::set_start_draw_order(int v) {
-  this->_start_draw_order = v;
-}
-
-INLINE EventHandler* GuiManager::get_private_handler(void) const {
-  return _eh;
-}

+ 0 - 287
panda/src/gui/guiManager.cxx

@@ -1,287 +0,0 @@
-// Filename: guiManager.cxx
-// Created by:  cary (25Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "guiManager.h"
-#include "config_gui.h"
-
-#include <dataRelation.h>
-#include <renderRelation.h>
-#include <depthTestTransition.h>
-#include <depthWriteTransition.h>
-#include <materialTransition.h>
-#include <cullFaceTransition.h>
-#include <lightTransition.h>
-#include <frustum.h>
-#include <orthoProjection.h>
-#include <eventQueue.h>
-
-GuiManager::GuiMap* GuiManager::_map = (GuiManager::GuiMap*)0L;
-
-GuiManager* GuiManager::get_ptr(GraphicsWindow* w, MouseAndKeyboard* mak,
-                Node *root2d) {
-  GuiManager* ret;
-  if (_map == (GuiMap*)0L) {
-    if (gui_cat.is_debug())
-      gui_cat->debug() << "allocating a manager map" << endl;
-    _map = new GuiMap;
-  }
-  GuiMap::const_iterator gi;
-  gi = _map->find(w);
-  if (gi != _map->end()) {
-    ret = (*gi).second;
-    if (gui_cat.is_debug())
-      gui_cat->debug() << "a manager for this window already exists (0x"
-               << (void*)ret << ")" << endl;
-  } else {
-    // going to allocate a new GuiManager for this window
-    if (gui_cat.is_debug())
-      gui_cat->debug() << "allocating a new manager for this window" << endl;
-    // first see if there is a mouseWatcher already under the MouseAndKeyboard
-    bool has_watcher = false;
-    TypeHandle dgt = DataRelation::get_class_type();
-    MouseWatcher* watcher = (MouseWatcher*)0L;
-    for (int i=0; i<mak->get_num_children(dgt); ++i)
-      if (mak->get_child(dgt, i)->get_child()->get_type() ==
-      MouseWatcher::get_class_type()) {
-    has_watcher = true;
-    watcher = DCAST(MouseWatcher, mak->get_child(dgt, i)->get_child());
-      }
-    if (!has_watcher) {
-      // there isn't already a mousewatcher in the data graph, so we'll make
-      // one and re-parent everything to it.
-      if (gui_cat.is_debug())
-    gui_cat->debug() << "no MouseWatcher found, making one" << endl;
-      watcher = new MouseWatcher("GUI watcher");
-      DataRelation* tmp = new DataRelation(mak, watcher);
-      for (int j=0; j<mak->get_num_children(dgt); ++j) {
-    NodeRelation* rel = mak->get_child(dgt, j);
-    if (rel != tmp)
-      // it's not the node we just created, so reparent it to ours
-      rel->change_parent(watcher);
-      }
-    } else {
-      if (gui_cat.is_debug())
-      gui_cat->debug() << "found a MouseWatcher, don't have to make one"
-               << endl;
-    }
-    // now setup event triggers for the watcher
-#ifdef _DEBUG
-    if (has_watcher && !watcher->get_button_down_pattern().empty())
-      gui_cat->warning() << "overwriting existing button down pattern '"
-             << watcher->get_button_down_pattern()
-             << "' with 'gui-button-press'" << endl;
-    if (has_watcher && !watcher->get_button_up_pattern().empty())
-      gui_cat->warning() << "overwriting existing button up pattern '"
-             << watcher->get_button_up_pattern()
-             << "' with 'gui-button-release'" << endl;
-    if (has_watcher && !watcher->get_enter_pattern().empty())
-      gui_cat->warning() << "overwriting existing enter pattern '"
-             << watcher->get_enter_pattern()
-             << "' with 'gui-enter'" << endl;
-    if (has_watcher && !watcher->get_leave_pattern().empty())
-      gui_cat->warning() << "overwriting existing exit pattern '"
-             << watcher->get_leave_pattern()
-             << "' with 'gui-exit'" << endl;
-#endif /* _DEBUG */
-    watcher->set_button_down_pattern("gui-button-press");
-    watcher->set_button_up_pattern("gui-button-release");
-    watcher->set_enter_pattern("gui-enter");
-    watcher->set_leave_pattern("gui-exit");
-
-    if (root2d == (Node *)NULL) {
-      // If we weren't given a 2-d scene graph, then create one now.
-      // It lives in its own layer.
-
-      Node* root2d_top = new NamedNode("GUI_top");
-      root2d = new NamedNode("GUI");
-      NodeRelation* root2d_arc = new RenderRelation(root2d_top, root2d);
-      root2d_arc->set_transition(new DepthTestTransition(DepthTestProperty::M_none), 1);
-      root2d_arc->set_transition(new DepthWriteTransition(DepthWriteTransition::off()), 1);
-      root2d_arc->set_transition(new LightTransition(LightTransition::all_off()), 1);
-      root2d_arc->set_transition(new MaterialTransition(MaterialTransition::off()), 1);
-      root2d_arc->set_transition(new CullFaceTransition(CullFaceProperty::M_cull_none), 1);
-      PT(Camera) cam = new Camera("GUI_cam");
-      new RenderRelation(root2d, cam);
-      cam->set_scene(root2d_top);
-      Frustumf frust2d;
-      frust2d.make_ortho_2D();
-      cam->set_projection(OrthoProjection(frust2d));
-      GraphicsChannel *chan = w->get_channel(0);  // root/full-window channel
-      nassertr(chan != (GraphicsChannel*)0L, NULL);
-      GraphicsLayer *layer = chan->make_layer();
-      nassertr(layer != (GraphicsLayer*)0L, NULL);
-      DisplayRegion *dr = layer->make_display_region();
-      nassertr(dr != (DisplayRegion*)0L, NULL);
-      dr->set_camera(cam);
-      if (gui_cat.is_debug())
-    gui_cat->debug() << "2D layer created" << endl;
-    }
-
-    // make an event handler for our internal events
-    EventHandler* eh = new EventHandler(new EventQueue());
-    watcher->set_extra_handler(eh);
-
-    // now make the manager for this window
-    ret = new GuiManager(watcher, root2d, eh);
-    if (gui_cat.is_debug())
-      gui_cat->debug() << "new manager allocated (0x" << (void*)ret << ")"
-               << endl;
-    (*_map)[w] = ret;
-  }
-  return ret;
-}
-
-void GuiManager::add_region(MouseWatcherRegion* region) {
-  region->test_ref_count_integrity();
-  RegionSet::const_iterator ri;
-  ri = _regions.find(region);
-  if (ri == _regions.end()) {
-    _watcher->add_region(region);
-    _regions.insert(region);
-  } else
-    gui_cat->warning() << "tried adding region ('" << *region
-               << "') more then once" << endl;
-}
-
-void GuiManager::add_label(GuiLabel* label) {
-  label->test_ref_count_integrity();
-  LabelSet::const_iterator li;
-  li = _labels.find(label);
-  if (li == _labels.end()) {
-    // add it to the scenegraph
-    label->set_arc(new RenderRelation(_root, label->get_geometry()));
-    _labels.insert(label);
-  } else
-    gui_cat->warning() << "tried adding label (0x" << (void*)label
-               << ") more then once" << endl;
-}
-
-void GuiManager::add_label(GuiLabel* label, Node* parent) {
-  label->test_ref_count_integrity();
-  LabelSet::const_iterator li;
-  li = _labels.find(label);
-  if (li == _labels.end()) {
-    // add it to the scenegraph
-    label->set_arc(new RenderRelation(parent, label->get_geometry()));
-    _labels.insert(label);
-  } else
-    gui_cat->warning() << "tried adding label (0x" << (void*)label
-               << ") more then once" << endl;
-}
-
-void GuiManager::remove_region(MouseWatcherRegion* region) {
-  region->test_ref_count_integrity();
-  RegionSet::iterator ri;
-  ri = _regions.find(region);
-  if (ri == _regions.end())
-    gui_cat->warning() << "tried removing region ('" << *region
-               << "') that isn't there" << endl;
-  else {
-    _watcher->remove_region(region);
-    _regions.erase(ri);
-  }
-}
-
-void GuiManager::remove_label(GuiLabel* label) {
-  label->test_ref_count_integrity();
-  LabelSet::iterator li;
-  li = _labels.find(label);
-  if (li == _labels.end())
-    gui_cat->warning() << "label (0x" << (void*)label
-               << ") is not there to be removed" << endl;
-  else {
-    // remove it to the scenegraph
-    remove_arc(label->get_arc());
-    label->set_arc((RenderRelation*)0L);
-    _labels.erase(li);
-  }
-}
-
-bool GuiManager::has_region(MouseWatcherRegion* rgn) {
-  rgn->test_ref_count_integrity();
-  RegionSet::iterator ri;
-  ri = _regions.find(rgn);
-  return (ri != _regions.end());
-}
-
-bool GuiManager::has_label(GuiLabel* lbl) {
-  lbl->test_ref_count_integrity();
-  LabelSet::iterator li;
-  li = _labels.find(lbl);
-  return (li != _labels.end());
-}
-
-void GuiManager::recompute_priorities(void) {
-  _sorts.clear();
-  for (LabelSet::iterator i=_labels.begin(); i!=_labels.end(); ++i)
-    _sorts.insert(*i);
-  int p=this->_start_draw_order;
-  for (SortSet::iterator j=_sorts.begin(); j!=_sorts.end(); ++j) {
-    if ((!((*j)->has_hard_draw_order())) && ((*j)->get_draw_order() != p))
-      p = (*j)->soft_set_draw_order(p);
-  }
-  _next_draw_order = p;
-}
-
-INLINE bool in_range(float x, float a, float b) {
-  return ((x > a) && (x < b));
-}
-
-INLINE bool overlap(MouseWatcherRegion* a, MouseWatcherRegion* b) {
-  LVector4f av = a->get_frame();
-  LVector4f bv = b->get_frame();
-
-  if ((in_range(av[0], bv[0], bv[1]) || in_range(av[1], bv[0], bv[1])) &&
-      (in_range(av[2], bv[2], bv[3]) || in_range(av[3], bv[2], bv[3])))
-    return true;
-  return false;
-}
-
-bool GuiManager::is_sane(void) const {
-  for (RegionSet::const_iterator i=_regions.begin(); i!=_regions.end(); ++i)
-    for (RegionSet::const_iterator j=_regions.begin(); j!=_regions.end(); ++j) {
-      if ((*i) == (*j))
-    continue;
-      if (overlap((*i), (*j)))
-    return false;
-    }
-  return true;
-}
-
-void GuiManager::sanity_check(void) const {
-  for (RegionSet::const_iterator i=_regions.begin(); i!=_regions.end(); ++i)
-    for (RegionSet::const_iterator j=_regions.begin(); j!=_regions.end(); ++j) {
-      if ((*i) == (*j))
-    continue;
-      if (overlap((*i), (*j))) {
-    LVector4f iv = (*i)->get_frame();
-    LVector4f jv = (*j)->get_frame();
-    gui_cat->warning() << "GuiManager::sanity_check: overlapping regions '"
-               << (*i)->get_name() << "' and '" << (*j)->get_name()
-               << "'" << endl << "  (" << iv[0] << ", " << iv[1]
-               << ", " << iv[2] << ", " << iv[3] << ") and ("
-               << jv[0] << ", " << jv[1] << ", " << jv[2] << ", "
-               << jv[3] << ")" << endl;
-
-      }
-      if ((*i)->get_name() == (*j)->get_name())
-    gui_cat->warning() << "GuiManager::sanity_check: regions with same "
-               << "name '" << (*i)->get_name() << " 0x"
-               << (void*)(*i) << " and 0x" << (void*)(*j) << endl;
-    }
-}

+ 0 - 86
panda/src/gui/guiManager.h

@@ -1,86 +0,0 @@
-// Filename: guiManager.h
-// Created by:  cary (25Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __GUIMANAGER_H__
-#define __GUIMANAGER_H__
-
-#include <pandabase.h>
-#include <graphicsWindow.h>
-#include <mouse.h>
-#include <mouseWatcher.h>
-#include <mouseWatcherRegion.h>
-#include <node.h>
-#include "pset.h"
-
-#include "guiLabel.h"
-#include "config_gui.h"
-
-class EXPCL_PANDA GuiManager {
-private:
-  typedef pmap<GraphicsWindow*, GuiManager*> GuiMap;
-  static GuiMap* _map;
-  typedef pset<MouseWatcherRegion*> RegionSet;
-  RegionSet _regions;
-  typedef pset<GuiLabel*> LabelSet;
-  LabelSet _labels;
-  class SortComp {
-  public:
-    inline bool operator()(GuiLabel* a, GuiLabel* b) const {
-      return (*a) < (*b);
-    }
-  };
-  typedef pset<GuiLabel*, SortComp> SortSet;
-  SortSet _sorts;
-
-  int _start_draw_order;
-  int _next_draw_order;
-
-  Node* _root;
-  MouseWatcher* _watcher;
-  EventHandler* _eh;
-
-  INLINE GuiManager(MouseWatcher*, Node*, EventHandler*);
-PUBLISHED:
-  static GuiManager* get_ptr(GraphicsWindow*, MouseAndKeyboard*, Node *root2d);
-
-  void add_region(MouseWatcherRegion*);
-  void add_label(GuiLabel*);
-  void add_label(GuiLabel*, Node*);
-
-  void remove_region(MouseWatcherRegion*);
-  void remove_label(GuiLabel*);
-
-  bool has_region(MouseWatcherRegion*);
-  bool has_label(GuiLabel*);
-
-  void recompute_priorities(void);
-
-  INLINE int get_next_draw_order(void) const;
-  INLINE void set_next_draw_order(int);
-  INLINE int get_start_draw_order(void) const;
-  INLINE void set_start_draw_order(int);
-
-  bool is_sane(void) const;
-  void sanity_check(void) const;
-
-  INLINE EventHandler* get_private_handler(void) const;
-};
-
-#include "guiManager.I"
-
-#endif /* __GUIMANAGER_H__ */

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

@@ -1,62 +0,0 @@
-// Filename: guiRollover.I
-// Created by:  cary (26Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-INLINE GuiRollover::GuiRollover(void) {
-}
-
-INLINE void GuiRollover::enter(void) {
-  if (_state) {
-#ifdef _DEBUG
-    if (gui_cat->is_debug())
-      gui_cat->debug() << "entered '" << *this
-               << "' more then once without exit" << endl;
-#endif
-  } else if (_mgr != (GuiManager*)0L) {
-    _mgr->remove_label(_off);
-    if (_alt_root.is_null())
-      _mgr->add_label(_on);
-    else
-      _mgr->add_label(_on, _alt_root);
-    _state = true;
-  }
-}
-
-INLINE void GuiRollover::exit(void) {
-  if (!_state) {
-#ifdef _DEBUG
-    if (gui_cat.is_debug())
-      gui_cat->debug() << "exited '" << *this
-               << "' more then once without enter" << endl;
-#endif
-  } else if (_mgr != (GuiManager*)0L) {
-    _mgr->remove_label(_on);
-    if (_alt_root.is_null())
-      _mgr->add_label(_off);
-    else
-      _mgr->add_label(_off, _alt_root);
-    _state = false;
-  }
-}
-
-INLINE bool GuiRollover::is_over(void) const {
-  return _state;
-}
-
-INLINE bool GuiRollover::owns_region(const MouseWatcherRegion* rgn) const {
-  return (_rgn == rgn);
-}

+ 0 - 225
panda/src/gui/guiRollover.cxx

@@ -1,225 +0,0 @@
-// Filename: guiRollover.cxx
-// Created by:  cary (26Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "guiRollover.h"
-#include "config_gui.h"
-
-#include "pmap.h"
-
-typedef pmap<const MouseWatcherRegion*, GuiRollover*> RolloverMap;
-static RolloverMap rollovers;
-static bool added_hooks = false;
-
-TypeHandle GuiRollover::_type_handle;
-
-static inline GuiRollover *
-find_in_rollovers_map(const MouseWatcherRegion* rgn) {
-  RolloverMap::iterator i = rollovers.find(rgn);
-  if (i == rollovers.end())
-    return (GuiRollover*)0L;
-  return (*i).second;
-}
-
-inline void GetExtents(GuiLabel* x, GuiLabel* y, float& l, float& r, float& b,
-                       float& t) {
-  float l1, l2, r1, r2, b1, b2, t1, t2;
-  x->get_extents(l1, r1, b1, t1);
-  y->get_extents(l2, r2, b2, t2);
-  l = (l1<l2)?l1:l2;
-  r = (r1<r2)?r2:r1;
-  b = (b1<b2)?b1:b2;
-  t = (t1<t2)?t2:t1;
-}
-
-static void enter_rollover(CPT_Event e) {
-  const MouseWatcherRegion* rgn = DCAST(MouseWatcherRegion, e->get_parameter(0).get_ptr());
-  GuiRollover* val = find_in_rollovers_map(rgn);
-  if (val == (GuiRollover *)0L)
-    return;  // this wasn't for us
-  val->enter();
-}
-
-static void exit_rollover(CPT_Event e) {
-  const MouseWatcherRegion* rgn = DCAST(MouseWatcherRegion, e->get_parameter(0).get_ptr());
-  GuiRollover* val = find_in_rollovers_map(rgn);
-  if (val == (GuiRollover *)0L)
-    return;  // this wasn't for us
-  val->exit();
-}
-
-void GuiRollover::recompute_frame(void) {
-  GuiBehavior::recompute_frame();
-  _off->recompute();
-  _on->recompute();
-  this->adjust_region();
-}
-
-void GuiRollover::adjust_region(void) {
-  GetExtents(_off, _on, _left, _right, _bottom, _top);
-  GuiBehavior::adjust_region();
-  _rgn->set_frame(_left, _right, _bottom, _top);
-}
-
-void GuiRollover::set_priority(GuiLabel* l, const GuiItem::Priority p) {
-  _off->set_priority(l, ((p==P_Low)?GuiLabel::P_LOWER:GuiLabel::P_HIGHER));
-  _on->set_priority(l, ((p==P_Low)?GuiLabel::P_LOWER:GuiLabel::P_HIGHER));
-  GuiBehavior::set_priority(l, p);
-}
-
-GuiRollover::GuiRollover(const string& name, GuiLabel* off, GuiLabel* on)
-  : GuiBehavior(name), _off(off), _on(on), _off_scale(off->get_scale()),
-    _on_scale(on->get_scale()), _state(false) {
-  GetExtents(off, on, _left, _right, _bottom, _top);
-  _rgn = new MouseWatcherRegion("rollover-" + name, _left, _right, _bottom,
-                                _top);
-  _rgn->set_suppress_flags(0);
-  rollovers[this->_rgn.p()] = this;
-}
-
-GuiRollover::~GuiRollover(void) {
-  this->unmanage();
-
-  // Remove the names from the rollovers map, so we don't end up with
-  // an invalid pointer.
-  string name = get_name();
-  rollovers.erase(this->_rgn.p());
-  if ((rollovers.size() == 0) && added_hooks) {
-    /*
-    _eh->remove_hook("gui-enter", enter_rollover);
-    _eh->remove_hook("gui-exit", exit_rollover);
-    added_hooks = false;
-    */
-  }
-}
-
-void GuiRollover::manage(GuiManager* mgr, EventHandler& eh) {
-  if (!added_hooks) {
-    mgr->get_private_handler()->add_hook("gui-enter", enter_rollover);
-    mgr->get_private_handler()->add_hook("gui-exit", exit_rollover);
-    added_hooks = true;
-  }
-  if (_mgr == (GuiManager*)0L) {
-    mgr->add_region(_rgn);
-    _state = false;
-    mgr->add_label(_off);
-    GuiBehavior::manage(mgr, eh);
-  } else
-    gui_cat->warning() << "tried to manage rollover (0x" << (void*)this
-                       << ") that is already managed" << endl;
-}
-
-void GuiRollover::manage(GuiManager* mgr, EventHandler& eh, Node* n) {
-  if (!added_hooks) {
-    mgr->get_private_handler()->add_hook("gui-enter", enter_rollover);
-    mgr->get_private_handler()->add_hook("gui-exit", exit_rollover);
-    added_hooks = true;
-  }
-  if (_mgr == (GuiManager*)0L) {
-    mgr->add_region(_rgn);
-    _state = false;
-    mgr->add_label(_off, n);
-    GuiBehavior::manage(mgr, eh, n);
-  } else
-    gui_cat->warning() << "tried to manage rollover (0x" << (void*)this
-                       << ") that is already managed" << endl;
-}
-
-void GuiRollover::unmanage(void) {
-  if (_mgr != (GuiManager*)0L) {
-    _mgr->remove_region(_rgn);
-    _mgr->remove_label(_off);
-    _mgr->remove_label(_on);
-  }
-  GuiBehavior::unmanage();
-}
-
-int GuiRollover::freeze(void) {
-  _off->freeze();
-  _on->freeze();
-  return 0;
-}
-
-int GuiRollover::thaw(void) {
-  _off->thaw();
-  _on->thaw();
-  return 0;
-}
-
-void GuiRollover::set_scale(float f) {
-  _on->set_scale(f * _on_scale);
-  _off->set_scale(f * _off_scale);
-  GuiBehavior::set_scale(f);
-  recompute_frame();
-}
-
-void GuiRollover::set_scale(float x, float y, float z) {
-  _on->set_scale(x, y, z);
-  _off->set_scale(x, y, z);
-  GuiBehavior::set_scale(x, y, z);
-  recompute_frame();
-}
-
-void GuiRollover::set_pos(const LVector3f& p) {
-  _on->set_pos(p);
-  _off->set_pos(p);
-  GuiBehavior::set_pos(p);
-  recompute_frame();
-}
-
-void GuiRollover::set_priority(GuiItem* i, const GuiItem::Priority p) {
-  if (p == P_Highest) {
-    _off->set_priority(_off, GuiLabel::P_HIGHEST);
-    _on->set_priority(_on, GuiLabel::P_HIGHEST);
-  } else if (p == P_Lowest) {
-    _off->set_priority(_off, GuiLabel::P_LOWEST);
-    _on->set_priority(_on, GuiLabel::P_LOWEST);
-  } else {
-    i->set_priority(_off, ((p==P_Low)?P_High:P_Low));
-    i->set_priority(_on, ((p==P_Low)?P_High:P_Low));
-  }
-  GuiBehavior::set_priority(i, p);
-}
-
-void GuiRollover::start_behavior(void) {
-  return;
-}
-
-void GuiRollover::stop_behavior(void) {
-  return;
-}
-
-void GuiRollover::reset_behavior(void) {
-  return;
-}
-
-int GuiRollover::set_draw_order(int v) {
-  int o = _off->set_draw_order(v);
-  o = _on->set_draw_order(o);
-  _rgn->set_sort(o++);
-  return GuiBehavior::set_draw_order(o);
-}
-
-void GuiRollover::output(ostream& os) const {
-  GuiBehavior::output(os);
-  os << "  Rollover data:" << endl;
-  os << "    off - 0x" << (void*)_off << endl;
-  os << "    on - 0x" << (void*)_on << endl;
-  os << "    region - 0x" << (void*)_rgn << " (" << *_rgn << ")" << endl;
-  os << "      frame - " << _rgn->get_frame() << endl;
-  os << "    state - " << _state << endl;
-}

+ 0 - 99
panda/src/gui/guiRollover.h

@@ -1,99 +0,0 @@
-// Filename: guiRollover.h
-// Created by:  cary (26Oct00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __GUIROLLOVER_H__
-#define __GUIROLLOVER_H__
-
-#include "guiBehavior.h"
-#include "guiLabel.h"
-#include "guiManager.h"
-
-#include <mouseWatcherRegion.h>
-
-class EXPCL_PANDA GuiRollover : public GuiBehavior {
-private:
-  PT(GuiLabel) _off;
-  PT(GuiLabel) _on;
-  PT(MouseWatcherRegion) _rgn;
-
-  float _off_scale;
-  float _on_scale;
-
-  bool _state;
-
-  INLINE GuiRollover(void);
-  virtual void recompute_frame(void);
-  virtual void adjust_region(void);
-
-PUBLISHED:
-  GuiRollover(const string&, GuiLabel*, GuiLabel*);
-  virtual ~GuiRollover(void);
-
-  virtual void manage(GuiManager*, EventHandler&);
-  virtual void manage(GuiManager*, EventHandler&, Node*);
-  virtual void unmanage(void);
-
-  virtual int freeze(void);
-  virtual int thaw(void);
-
-  INLINE void enter(void);
-  INLINE void exit(void);
-
-  INLINE bool is_over(void) const;
-
-  virtual void set_scale(float);
-  virtual void set_scale(float, float, float);
-  virtual void set_pos(const LVector3f&);
-  virtual void set_priority(GuiLabel*, const Priority);
-  virtual void set_priority(GuiItem*, const Priority);
-
-  virtual void start_behavior(void);
-  virtual void stop_behavior(void);
-  virtual void reset_behavior(void);
-
-  virtual int set_draw_order(int);
-
-  virtual void output(ostream&) const;
-
-public:
-  INLINE bool owns_region(const MouseWatcherRegion*) const;
-
-public:
-  // type interface
-  static TypeHandle get_class_type(void) {
-    return _type_handle;
-  }
-  static void init_type(void) {
-    GuiItem::init_type();
-    register_type(_type_handle, "GuiRollover",
-                  GuiBehavior::get_class_type());
-  }
-  virtual TypeHandle get_type(void) const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type(void) {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "guiRollover.I"
-
-#endif /* __GUIROLLOVER_H__ */

+ 0 - 20
panda/src/gui/guiSign.I

@@ -1,20 +0,0 @@
-// Filename: guiSign.I
-// Created by:  cary (06Nov00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-INLINE GuiSign::GuiSign(void) {
-}

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

@@ -1,114 +0,0 @@
-// Filename: guiSign.cxx
-// Created by:  cary (06Nov00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "guiSign.h"
-#include "config_gui.h"
-
-TypeHandle GuiSign::_type_handle;
-
-void GuiSign::recompute_frame(void) {
-  GuiItem::recompute_frame();
-  _sign->recompute();
-  _sign->get_extents(_left, _right, _bottom, _top);
-  this->adjust_region();
-}
-
-void GuiSign::set_priority(GuiLabel* l, const GuiItem::Priority p) {
-  _sign->set_priority(l, ((p==P_Low)?GuiLabel::P_LOWER:GuiLabel::P_HIGHER));
-  GuiItem::set_priority(l, p);
-}
-
-GuiSign::GuiSign(const string& name, GuiLabel* sign)
-  : GuiItem(name), _sign(sign), _sign_scale(sign->get_scale()) {
-  _sign->get_extents(_left, _right, _bottom, _top);
-}
-
-GuiSign::~GuiSign(void) {
-  this->unmanage();
-}
-
-void GuiSign::manage(GuiManager* mgr, EventHandler& eh) {
-  if (_mgr == (GuiManager*)0L) {
-    mgr->add_label(_sign);
-    GuiItem::manage(mgr, eh);
-  } else
-    gui_cat->warning() << "tried to manage sign (0x" << (void*)this
-                       << ") that is already managed" << endl;
-}
-
-void GuiSign::manage(GuiManager* mgr, EventHandler& eh, Node* n) {
-  if (_mgr == (GuiManager*)0L) {
-    mgr->add_label(_sign, n);
-    GuiItem::manage(mgr, eh, n);
-  } else
-    gui_cat->warning() << "tried to manage sign (0x" << (void*)this
-                       << ") that is already managed" << endl;
-}
-
-void GuiSign::unmanage(void) {
-  if (_mgr != (GuiManager*)0L)
-    _mgr->remove_label(_sign);
-  GuiItem::unmanage();
-}
-
-int GuiSign::freeze() {
-  return _sign->freeze();
-}
-
-int GuiSign::thaw() {
-  return _sign->thaw();
-}
-
-void GuiSign::set_scale(float f) {
-  _sign->set_scale(f * _sign_scale);
-  GuiItem::set_scale(f);
-  recompute_frame();
-}
-
-void GuiSign::set_scale(float x, float y, float z) {
-  _sign->set_scale(x, y, z);
-  GuiItem::set_scale(x, y, z);
-  recompute_frame();
-}
-
-void GuiSign::set_pos(const LVector3f& p) {
-  _sign->set_pos(p);
-  GuiItem::set_pos(p);
-  recompute_frame();
-}
-
-void GuiSign::set_priority(GuiItem* i, const GuiItem::Priority p) {
-  if (p == P_Highest)
-    _sign->set_priority(_sign, GuiLabel::P_HIGHEST);
-  else if (p == P_Lowest)
-    _sign->set_priority(_sign, GuiLabel::P_LOWEST);
-  else
-    i->set_priority(_sign, ((p==P_Low)?P_High:P_Low));
-  GuiItem::set_priority(i, p);
-}
-
-int GuiSign::set_draw_order(int v) {
-  int o = _sign->set_draw_order(v);
-  return GuiItem::set_draw_order(o);
-}
-
-void GuiSign::output(ostream& os) const {
-  GuiItem::output(os);
-  os << "  Sign data:" << endl;
-  os << "    sign - 0x" << (void*)_sign << endl;
-}

+ 0 - 78
panda/src/gui/guiSign.h

@@ -1,78 +0,0 @@
-// Filename: guiSign.h
-// Created by:  cary (06Nov00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#ifndef __GUISIGN_H__
-#define __GUISIGN_H__
-
-#include "guiItem.h"
-#include "guiLabel.h"
-#include "guiManager.h"
-
-class EXPCL_PANDA GuiSign : public GuiItem {
-private:
-  PT(GuiLabel) _sign;
-  float _sign_scale;
-
-  INLINE GuiSign(void);
-  virtual void recompute_frame(void);
-
-PUBLISHED:
-  GuiSign(const string&, GuiLabel*);
-  ~GuiSign(void);
-
-  virtual void manage(GuiManager*, EventHandler&);
-  virtual void manage(GuiManager*, EventHandler&, Node*);
-  virtual void unmanage(void);
-
-  virtual int freeze();
-  virtual int thaw();
-
-  virtual void set_scale(float);
-  virtual void set_scale(float, float, float);
-  virtual void set_pos(const LVector3f&);
-  virtual void set_priority(GuiLabel*, const Priority);
-  virtual void set_priority(GuiItem*, const Priority);
-
-  virtual int set_draw_order(int);
-
-  virtual void output(ostream&) const;
-
-public:
-  // type interface
-  static TypeHandle get_class_type(void) {
-    return _type_handle;
-  }
-  static void init_type(void) {
-    GuiItem::init_type();
-    register_type(_type_handle, "GuiSign",
-                  GuiItem::get_class_type());
-  }
-  virtual TypeHandle get_type(void) const {
-    return get_class_type();
-  }
-  virtual TypeHandle force_init_type(void) {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-
-#include "guiSign.I"
-
-#endif /* __GUISIGN_H__ */

+ 0 - 9
panda/src/gui/gui_composite1.cxx

@@ -1,9 +0,0 @@
-
-#include "config_gui.cxx"
-#include "guiSign.cxx"
-#include "guiListBox.cxx"
-#include "guiBehavior.cxx"
-#include "guiButton.cxx"
-#include "guiChooser.cxx"
-#include "guiCollection.cxx"
-

+ 0 - 9
panda/src/gui/gui_composite2.cxx

@@ -1,9 +0,0 @@
-
-#include "guiManager.cxx"
-#include "guiLabel.cxx"
-#include "guiItem.cxx"
-#include "guiRollover.cxx"
-#include "guiFrame.cxx"
-#include "guiBackground.cxx"
-
-

+ 0 - 28
panda/src/testbed/Sources.pp

@@ -151,31 +151,3 @@
     vrpn_demo.cxx
 
 #end test_bin_target
-
-#begin test_bin_target
-  #define TARGET gui_demo
-
-  #define SOURCES \
-    gui_demo.cxx
-
-  #define LOCAL_LIBS $[LOCAL_LIBS] gui
-
-#end test_bin_target
-
-#begin test_bin_target
-  #define TARGET deadrec_rec
-
-  #define SOURCES \
-    deadrec_rec.cxx
-
-  #define LOCAL_LIBS $[LOCAL_LIBS] net gui
-#end test_bin_target
-
-#begin test_bin_target
-  #define TARGET deadrec_send
-
-  #define SOURCES \
-    deadrec_send.cxx
-
-  #define LOCAL_LIBS $[LOCAL_LIBS] net lerp gui
-#end test_bin_target

+ 0 - 630
panda/src/testbed/deadrec_rec.cxx

@@ -1,630 +0,0 @@
-// Filename: deadrec_rec.cxx
-// Created by:  cary (15Nov00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "framework.h"
-#include <renderRelation.h>
-#include <queuedConnectionManager.h>
-#include <queuedConnectionListener.h>
-#include <modelPool.h>
-#include <ipc_thread.h>
-#include <transformTransition.h>
-#include <lerp.h>
-#include <guiFrame.h>
-#include <guiButton.h>
-#include <guiSign.h>
-#include <clockObject.h>
-
-#include <dconfig.h>
-
-NotifyCategoryDeclNoExport(deadrec);
-NotifyCategoryDef(deadrec, "");
-
-Configure(deadrec);
-
-ConfigureFn(deadrec) {
-}
-
-typedef pset< PT(Connection) > Clients;
-
-static PT_Node smiley;
-static RenderRelation* my_arc;
-static LPoint3f my_pos;
-static LPoint3f target_pos;
-static LPoint3f telemetry_pos;
-static LVector3f my_vel;
-static LVector3f target_vel;
-static LVector3f telemetry_vel;
-static int hostport = deadrec.GetInt("deadrec-rec-port", 0xdead);
-static thread* monitor;
-static bool stop_monitoring;
-QueuedConnectionListener* listener;
-QueuedConnectionManager cm;
-Clients clients;
-QueuedConnectionReader* reader;
-static float clock_skew = 0.;
-static bool doing_sync = false;
-static float my_time, target_time, telemetry_time;
-static bool new_telemetry;
-static bool reinit_correction, reinit_prediction;
-
-enum TelemetryToken { T_End = 1, T_Pos, T_Vel, T_Num, T_Time, T_Sync };
-enum PredictToken { P_Null, P_Linear };
-enum CorrectToken { C_Pop, C_Lerp, C_Spline };
-
-PT(AutonomousLerp) curr_lerp;
-PredictToken curr_pred, pred_switch;
-CorrectToken curr_corr, corr_switch;
-PT(GuiButton) pnullButton;
-PT(GuiButton) plinearButton;
-PT(GuiButton) cpopButton;
-PT(GuiButton) clerpButton;
-PT(GuiButton) csplineButton;
-
-static inline unsigned char* get_uint8(unsigned char* b, unsigned char& v) {
-  v = b[0];
-  return ++b;
-}
-
-static inline unsigned char* get_float64(unsigned char* b, float& f) {
-  unsigned char t[8]; // 64-bits
-  memcpy(t, b, 8);
-  if (sizeof(float)==8) {
-    memcpy(&f, t, 8);
-  } else if (sizeof(double)==8) {
-    double d;
-    memcpy(&d, t, 8);
-    f = d;
-  } else {
-    deadrec_cat->error() << "neither float or double are 64-bit" << endl;
-    f = 0.;
-  }
-  return b+8;
-}
-
-static void* internal_monitor(void*) {
-  if (deadrec_cat->is_debug())
-    deadrec_cat->debug() << "internal monitoring thread started" << endl;
-  while (!stop_monitoring) {
-    // check for new clients
-    while (listener->new_connection_available()) {
-      PT(Connection) rv;
-      NetAddress address;
-      PT(Connection) new_connection;
-      if (listener->get_new_connection(rv, address, new_connection)) {
-        if (deadrec_cat->is_debug())
-          deadrec_cat->debug() << "Got connection from " << address << endl;
-        reader->add_connection(new_connection);
-        clients.insert(new_connection);
-      }
-    }
-    // check for reset clients
-    while (cm.reset_connection_available()) {
-      PT(Connection) connection;
-      if (cm.get_reset_connection(connection)) {
-        if (deadrec_cat->is_debug())
-          deadrec_cat->debug() << "Lost connection from "
-                               << connection->get_address() << endl;
-        clients.erase(connection);
-        cm.close_connection(connection);
-      }
-    }
-    // process all available datagrams
-    while (reader->data_available()) {
-      NetDatagram datagram;
-      if (reader->get_data(datagram)) {
-        unsigned char* buff = (unsigned char*)(datagram.get_data());
-        unsigned char byte;
-        TelemetryToken t;
-        buff = get_uint8(buff, byte);
-        t = (TelemetryToken)byte;
-        while (t != T_End) {
-          switch (t) {
-          case T_Pos:
-            {
-              float x, y, z;
-              buff = get_float64(get_float64(get_float64(buff, x), y), z);
-              telemetry_pos = LPoint3f(x, y, z);
-            }
-            break;
-          case T_Vel:
-            if (deadrec_cat->is_debug())
-              deadrec_cat->debug() << "got T_Num" << endl;
-            break;
-          case T_Num:
-            if (deadrec_cat->is_debug())
-              deadrec_cat->debug() << "got T_Num" << endl;
-            break;
-          case T_Time:
-            {
-              float x;
-              buff = get_float64(buff, x);
-              if (doing_sync) {
-                clock_skew = ClockObject::get_global_clock()->get_frame_time() - x;
-                doing_sync = false;
-                cerr << "setting clock skew to: " << clock_skew << endl;
-              } else
-                telemetry_time = x + clock_skew;
-            }
-            break;
-          case T_Sync:
-            doing_sync = true;
-            break;
-          default:
-            deadrec_cat->warning() << "got bad token in datagram (" << (int)t
-                                   << ")" << endl;
-          }
-          buff = get_uint8(buff, byte);
-          t = (TelemetryToken)byte;
-        }
-        new_telemetry = true;
-      }
-    }
-    // sleep for about 100 milliseconds
-    ipc_traits::sleep(0, 100000);
-  }
-  if (deadrec_cat->is_debug())
-    deadrec_cat->debug() << "internal monitoring thread exiting" << endl;
-  return (void*)0L;
-}
-
-static void predict_event_up(CPT_Event e) {
-  string s = e->get_name();
-  s = s.substr(0, s.find("-up"));
-  event_handler.remove_hook(s + "-up", predict_event_up);
-  event_handler.remove_hook(s + "-up-rollover", predict_event_up);
-  switch (curr_pred) {
-  case P_Null:
-    pnullButton->up();
-    break;
-  case P_Linear:
-    plinearButton->up();
-    break;
-  }
-  curr_pred = pred_switch;
-  switch (curr_pred) {
-  case P_Null:
-    pnullButton->inactive();
-    break;
-  case P_Linear:
-    plinearButton->inactive();
-    break;
-  default:
-    deadrec_cat->error() << "switching predictor to invalid type ("
-                         << (int)curr_pred << ")" << endl;
-  }
-  reinit_prediction = true;
-}
-
-static void predict_event(CPT_Event e) {
-  string s = e->get_name();
-  s = s.substr(0, s.find("-down"));
-  if (s == "null") {
-    if (curr_pred != P_Null) {
-      pred_switch = P_Null;
-      event_handler.add_hook(s + "-up", predict_event_up);
-      event_handler.add_hook(s + "-up-rollover", predict_event_up);
-    }
-  } else if (s == "linear") {
-    if (curr_pred != P_Linear) {
-      pred_switch = P_Linear;
-      event_handler.add_hook(s + "-up", predict_event_up);
-      event_handler.add_hook(s + "-up-rollover", predict_event_up);
-    }
-  } else {
-    deadrec_cat->error() << "got invalid button event '" << s << "'" << endl;
-  }
-}
-
-static void correct_event_up(CPT_Event e) {
-  string s = e->get_name();
-  s = s.substr(0, s.find("-up"));
-  event_handler.remove_hook(s + "-up", correct_event_up);
-  event_handler.remove_hook(s + "-up-rollover", correct_event_up);
-  switch (curr_corr) {
-  case C_Pop:
-    cpopButton->up();
-    break;
-  case C_Lerp:
-    clerpButton->up();
-    break;
-  case C_Spline:
-    csplineButton->up();
-    break;
-  }
-  curr_corr = corr_switch;
-  switch (curr_corr) {
-  case C_Pop:
-    cpopButton->inactive();
-    break;
-  case C_Lerp:
-    clerpButton->inactive();
-    break;
-  case C_Spline:
-    csplineButton->inactive();
-    break;
-  default:
-    deadrec_cat->error() << "switching corrector to invalid type ("
-                         << (int)curr_corr << ")" << endl;
-  }
-  reinit_correction = true;
-}
-
-static void correct_event(CPT_Event e) {
-  string s = e->get_name();
-  s = s.substr(0, s.find("-down"));
-  if (s == "pop") {
-    if (curr_corr != C_Pop) {
-      corr_switch = C_Pop;
-      event_handler.add_hook(s + "-up", correct_event_up);
-      event_handler.add_hook(s + "-up-rollover", correct_event_up);
-    }
-  } else if (s == "lerp") {
-    if (curr_corr != C_Lerp) {
-      corr_switch = C_Lerp;
-      event_handler.add_hook(s + "-up", correct_event_up);
-      event_handler.add_hook(s + "-up-rollover", correct_event_up);
-    }
-  } else if (s == "spline") {
-    if (curr_corr != C_Spline) {
-      corr_switch = C_Spline;
-      event_handler.add_hook(s + "-up", correct_event_up);
-      event_handler.add_hook(s + "-up-rollover", correct_event_up);
-    }
-  } else {
-    deadrec_cat->error() << "got invalid button event '" << s << "'" << endl;
-  }
-}
-
-typedef void (*event_func)(CPT_Event);
-
-static inline GuiButton* make_button(const string& name, Node* font,
-                                     EventHandler& eh, event_func func) {
-  GuiLabel* l1 = GuiLabel::make_simple_text_label(name, font);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label(name, font);
-  GuiLabel* l3 = GuiLabel::make_simple_text_label(name, font);
-  GuiLabel* l4 = GuiLabel::make_simple_text_label(name, font);
-  GuiLabel* l5 = GuiLabel::make_simple_text_label(name, font);
-  // up
-  l1->set_background_color(1., 1., 1., 0.);
-  // up-rollover
-  l2->set_background_color(1., 1., 1., 0.5);
-  // down
-  l3->set_background_color(1., 1., 1., 0.);
-  // down-rollover
-  l4->set_background_color(1., 1., 1., 0.5);
-  // 'inactive'
-  l5->set_background_color(1., 0., 0., 0.7);
-  GuiButton* b1 = new GuiButton(name, l1, l2, l3, l4, l5);
-  eh.add_hook(name + "-down", func);
-  eh.add_hook(name + "-down-rollover", func);
-  return b1;
-}
-
-static void deadrec_setup(EventHandler& eh) {
-  static bool done = false;
-  if (done)
-    return;
-  // load smiley and put it in the scenegraph
-  smiley = ModelPool::load_model("smiley");
-  nassertv(smiley != (Node*)0L);
-  my_arc = new RenderRelation(render, smiley);
-  // prepair to get a connection
-  PT(Connection) rendezvous = cm.open_TCP_server_rendezvous(hostport, 5);
-  if (rendezvous.is_null()) {
-    deadrec_cat->fatal() << "cannot get port " << hostport << endl;
-    exit(0);
-  }
-  if (deadrec_cat->is_debug())
-    deadrec_cat->debug() << "Listening for connections on port " << hostport
-                         << endl;
-  listener = new QueuedConnectionListener(&cm, 0);
-  listener->add_connection(rendezvous);
-  reader = new QueuedConnectionReader(&cm, 1);
-  stop_monitoring = false;
-  monitor = thread::create(internal_monitor, (void*)0L,
-                           thread::PRIORITY_NORMAL);
-  // create an interface
-  GuiManager* mgr = GuiManager::get_ptr(main_win, mak);
-  PT_Node font = ModelPool::load_model("ttf-comic");
-  GuiFrame* f1 = new GuiFrame("predicters");
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("predicter:", font);
-  l1->set_background_color(1., 1., 1., 0.);
-  GuiSign* s1 = new GuiSign("predicter", l1);
-  s1->set_scale(0.08);
-  f1->add_item(s1);
-  pnullButton = make_button("null", font, eh, predict_event);
-  pnullButton->set_scale(0.08);
-  f1->add_item(pnullButton);
-  plinearButton = make_button("linear", font, eh, predict_event);
-  plinearButton->set_scale(0.08);
-  f1->add_item(plinearButton);
-  f1->pack_item(pnullButton, GuiFrame::UNDER, s1);
-  f1->pack_item(pnullButton, GuiFrame::ALIGN_LEFT, s1);
-  f1->pack_item(plinearButton, GuiFrame::UNDER, s1);
-  f1->pack_item(plinearButton, GuiFrame::RIGHT, pnullButton, 0.02);
-  f1->align_to_left(0.05);
-  f1->align_to_top(0.05);
-  f1->recompute();
-  f1->manage(mgr, eh);
-  GuiFrame* f2 = new GuiFrame("correctors");
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("corrector:", font);
-  l2->set_background_color(1., 1., 1., 0.);
-  GuiSign* s2 = new GuiSign("corrector", l2);
-  s2->set_scale(0.08);
-  f2->add_item(s2);
-  cpopButton = make_button("pop", font, eh, correct_event);
-  cpopButton->set_scale(0.08);
-  f2->add_item(cpopButton);
-  clerpButton = make_button("lerp", font, eh, correct_event);
-  clerpButton->set_scale(0.08);
-  f2->add_item(clerpButton);
-  csplineButton = make_button("spline", font, eh, correct_event);
-  csplineButton->set_scale(0.08);
-  f2->add_item(csplineButton);
-  f2->pack_item(cpopButton, GuiFrame::UNDER, s2);
-  f2->pack_item(cpopButton, GuiFrame::ALIGN_LEFT, s2);
-  f2->pack_item(clerpButton, GuiFrame::UNDER, s2);
-  f2->pack_item(clerpButton, GuiFrame::RIGHT, cpopButton, 0.02);
-  f2->pack_item(csplineButton, GuiFrame::UNDER, s2);
-  f2->pack_item(csplineButton, GuiFrame::RIGHT, clerpButton, 0.02);
-  f2->align_to_left(0.05);
-  f2->align_to_bottom(0.05);
-  f2->recompute();
-  f2->manage(mgr, eh);
-  curr_pred = P_Null;
-  pnullButton->inactive();
-  curr_corr = C_Pop;
-  cpopButton->inactive();
-  reinit_correction = true;
-  reinit_prediction = true;
-}
-
-inline static void predict_null(void) {
-  static bool have_vel = false;
-
-  if (reinit_prediction) {
-    have_vel = false;
-    target_vel = LVector3f(0., 0., 0.);
-    reinit_prediction = false;
-  }
-  if (have_vel) {
-    if (new_telemetry)
-      target_vel = target_pos - telemetry_pos;
-  } else {
-    if (new_telemetry)
-      have_vel = true;
-  }
-  target_pos = telemetry_pos;
-}
-
-inline static void predict_linear(void) {
-  static int state = 0;
-  static LPoint3f A, B;
-  static LVector3f V;
-  static float A_time, B_time;
-  static float time = 0.;
-
-  if (reinit_prediction) {
-    state = 0;
-    reinit_prediction = false;
-  }
-  switch (state) {
-  case 0:
-    if (new_telemetry) {
-      A = telemetry_pos;
-      A_time = telemetry_time;
-      V = LVector3f(0., 0., 0.);
-      state = 1;
-    }
-    break;
-  case 1:
-    if (new_telemetry) {
-      B = telemetry_pos;
-      B_time = telemetry_time;
-      V = B - A;
-      V *= 1. / (B_time - A_time);
-      time = 0.5;
-      state = 2;
-    }
-    target_pos = A;
-    target_vel = V;
-    break;
-  case 2:
-    if (new_telemetry) {
-      if (telemetry_time < A_time) {
-        // before our two samples, ignore it
-      } else if (telemetry_time > B_time) {
-        // a sample in brave new territory
-        A = B;
-        A_time = B_time;
-        B = telemetry_pos;
-        B_time = telemetry_time;
-        V = B - A;
-        V *= 1. / (B_time - A_time);
-        time = 0.;
-      } else {
-        // is between our two samples
-        A = telemetry_pos;
-        A_time = telemetry_time;
-        V = B - A;
-        V *= 1. / (B_time - A_time);
-        time = 0.;
-      }
-    }
-    if (time <= 0.) {
-      float rtime = ClockObject::get_global_clock()->get_frame_time() - A_time;
-      target_pos = (rtime * V) + A;
-      target_vel = V;
-      time = 0.5;
-    }
-    time -= ClockObject::get_global_clock()->get_dt();
-    break;
-  default:
-    deadrec_cat->error() << "got in invalid state in linear predictor ("
-                         << state << ")" << endl;
-  }
-}
-
-inline static void run_predict(void) {
-  switch (curr_pred) {
-  case P_Null:
-    predict_null();
-    break;
-  case P_Linear:
-    predict_linear();
-    break;
-  default:
-    deadrec_cat->error() << "bad prediction type (" << (int)curr_pred << ")"
-                         << endl;
-  }
-}
-
-inline static void correction_pop(void) {
-  my_pos = target_pos;
-  reinit_correction = false;
-}
-
-inline static void correction_lerp(void) {
-  static LPoint3f prev_pos, save_pos;
-  static bool have_both = false;
-  static float time;
-
-  if (reinit_correction) {
-    if (save_pos != target_pos) {
-      prev_pos = save_pos = target_pos;
-      reinit_correction = false;
-      have_both = false;
-    }
-  } else {
-    if (have_both) {
-      if (save_pos != target_pos) {
-        time = 0.;
-        prev_pos = my_pos;
-        save_pos = target_pos;
-      } else {
-        if (time < 0.5) {
-          // half second lerp
-          float tmp = time * 2.;
-          LVector3f vtmp = save_pos - prev_pos;
-          my_pos = (tmp * vtmp) + prev_pos;
-          time += ClockObject::get_global_clock()->get_dt();
-        }
-      }
-    } else {
-      if (save_pos != target_pos) {
-        save_pos = target_pos;
-        my_pos = prev_pos;
-        time = 0.;
-        have_both = true;
-      }
-    }
-  }
-}
-
-inline static void correction_spline(void) {
-  static LPoint3f A, B, C, D;
-  static bool have_both = false;
-  static LPoint3f prev_pos, save_pos;
-  static LVector3f prev_vel, save_vel;
-  static float time;
-
-  if (reinit_correction) {
-    if (save_pos != target_pos) {
-      prev_pos = save_pos = target_pos;
-      prev_vel = save_vel = target_vel;
-      reinit_correction = false;
-      have_both = false;
-    }
-  } else {
-    if (have_both) {
-      if (save_pos != target_pos) {
-        time = 0.;
-        prev_pos = my_pos;
-        prev_vel = my_vel;
-        save_pos = target_pos;
-        save_vel = target_vel;
-        A = (2. * (prev_pos - save_pos)) + prev_vel + save_vel;
-        B = (3. * (save_pos - prev_pos)) - (2. * prev_vel) - save_vel;
-        C = prev_vel;
-        D = prev_pos;
-      } else {
-        if (time < 0.5) {
-          // half second lerp
-          float tmp = time * 2.;
-          my_pos = (tmp * tmp * tmp * A) + (tmp * tmp * B) + (tmp * C) + D;
-          my_vel = (3. * tmp * tmp * A) + (2. * tmp * B) + C;
-          time += ClockObject::get_global_clock()->get_dt();
-        }
-      }
-    } else {
-      if (save_pos != target_pos) {
-        save_pos = target_pos;
-        save_vel = target_vel;
-        my_pos = prev_pos;
-        my_vel = prev_vel;
-        time = 0.;
-        A = (2. * (prev_pos - save_pos)) + prev_vel + save_vel;
-        B = (3. * (save_pos - prev_pos)) - (2. * prev_vel) - save_vel;
-        C = prev_vel;
-        D = prev_pos;
-        have_both = true;
-      }
-    }
-  }
-}
-
-inline static void run_correct(void) {
-  switch (curr_corr) {
-  case C_Pop:
-    correction_pop();
-    break;
-  case C_Lerp:
-    correction_lerp();
-    break;
-  case C_Spline:
-    correction_spline();
-    break;
-  default:
-    deadrec_cat->error() << "bad correction type (" << (int)curr_corr << ")"
-                         << endl;
-  }
-}
-
-inline static void update_smiley(void) {
-  LMatrix4f mat = LMatrix4f::translate_mat(my_pos);
-  my_arc->set_transition(new TransformTransition(mat));
-}
-
-static void event_frame(CPT_Event) {
-  run_predict();
-  run_correct();
-  update_smiley();
-  if (new_telemetry)
-    new_telemetry = false;
-}
-
-static void deadrec_keys(EventHandler& eh) {
-  deadrec_setup(eh);
-
-  eh.add_hook("NewFrame", event_frame);
-}
-
-int main(int argc, char* argv[]) {
-  define_keys = &deadrec_keys;
-  return framework_main(argc, argv);
-}

+ 0 - 606
panda/src/testbed/deadrec_send.cxx

@@ -1,606 +0,0 @@
-// Filename: deadrec_send.cxx
-// Created by:  cary (15Nov00)
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "framework.h"
-#include <renderRelation.h>
-#include <queuedConnectionManager.h>
-#include <modelPool.h>
-#include <transformTransition.h>
-#include <lerp.h>
-#include <guiFrame.h>
-#include <guiButton.h>
-#include <guiSign.h>
-#include <clockObject.h>
-
-#include <dconfig.h>
-
-NotifyCategoryDeclNoExport(deadrec);
-NotifyCategoryDef(deadrec, "");
-
-Configure(deadrec);
-
-ConfigureFn(deadrec) {
-}
-
-static PT_Node smiley;
-static RenderRelation* my_arc;
-static LPoint3f my_pos;
-static LVector3f my_vel;
-string hostname = deadrec.GetString("deadrec-rec", "localhost");
-int hostport = deadrec.GetInt("deadrec-rec-port", 0xdead);
-
-static QueuedConnectionManager cm;
-PT(Connection) conn;
-ConnectionWriter* writer;
-
-enum TelemetryToken { T_End = 1, T_Pos, T_Vel, T_Num, T_Time, T_Sync };
-
-static inline NetDatagram& add_time(NetDatagram& d) {
-  d.add_uint8(T_Time);
-  d.add_float64(ClockObject::get_global_clock()->get_frame_time());
-  return d;
-}
-
-static inline NetDatagram& add_pos(NetDatagram& d) {
-  d.add_uint8(T_Pos);
-  d.add_float64(my_pos[0]);
-  d.add_float64(my_pos[1]);
-  d.add_float64(my_pos[2]);
-  return d;
-}
-
-static inline NetDatagram& add_vel(NetDatagram& d) {
-  d.add_uint8(T_Vel);
-  d.add_float64(my_vel[0]);
-  d.add_float64(my_vel[1]);
-  d.add_float64(my_vel[2]);
-  return d;
-}
-
-static inline void send(NetDatagram& d) {
-  d.add_uint8(T_End);
-  writer->send(d, conn);
-}
-
-static void sync_clock(void) {
-  NetDatagram d;
-  d.add_uint8(T_Sync);
-  send(add_time(d));
-}
-
-static bool verify_connection(void) {
-  static float time = 0.;
-
-  if (conn.is_null()) {
-    if (time <= 0.) {
-      NetAddress host;
-      if (!host.set_host(hostname, hostport)) {
-        deadrec_cat->warning() << "unknown host: " << hostname << endl;
-        time = 100.;
-        return false;
-      }
-      PT(Connection) local_conn = cm.open_TCP_client_connection(host, 5000);
-      if (local_conn.is_null()) {
-        deadrec_cat->warning() << "no connection" << endl;
-        time = 5.;
-        return false;
-      }
-      conn = local_conn;
-      // sync clock
-      sync_clock();
-      return true;
-    }
-    time -= ClockObject::get_global_clock()->get_dt();
-    return false;
-  }
-  if (cm.reset_connection_available()) {
-    PT(Connection) local_conn;
-    if (cm.get_reset_connection(local_conn)) {
-      if (local_conn == conn) {
-        cm.close_connection(conn);
-        conn = (Connection*)0L;
-        time = 5.;
-        return false;
-      } else
-        deadrec_cat->error()
-          << "got a report of a closed connection that I've never heard of"
-          << endl;
-    } else
-      deadrec_cat->error()
-        << "a closed connection was reported, but none was listed" << endl;
-  }
-  return true;
-}
-
-static void event_frame(CPT_Event) {
-  // send deadrec data
-  if (verify_connection()) {
-    NetDatagram d;
-    send(add_time(add_pos(d)));
-  }
-}
-
-enum MotionType { M_None, M_Line, M_SLine, M_Box, M_SBox, M_Circle, M_SCircle,
-                  M_Random, M_SRandom };
-PT(AutonomousLerp) curr_lerp;
-MotionType curr_type, switching_to;
-PT(GuiButton) lineButton;
-PT(GuiButton) slineButton;
-PT(GuiButton) boxButton;
-PT(GuiButton) sboxButton;
-PT(GuiButton) circleButton;
-PT(GuiButton) scircleButton;
-PT(GuiButton) randomButton;
-PT(GuiButton) srandomButton;
-
-// the various motion generators
-
-void update_smiley(void) {
-  LMatrix4f mat = LMatrix4f::translate_mat(my_pos);
-  my_arc->set_transition(new TransformTransition(mat));
-}
-
-class MyPosFunctor : public LPoint3fLerpFunctor {
-public:
-  MyPosFunctor(LPoint3f start, LPoint3f end) : LPoint3fLerpFunctor(start,
-                                                                   end) {}
-  MyPosFunctor(const MyPosFunctor& p) : LPoint3fLerpFunctor(p) {}
-  virtual ~MyPosFunctor(void) {}
-  virtual void operator()(float t) {
-    LPoint3f p = interpolate(t);
-    my_vel = p - my_pos;
-    my_pos = p;
-    update_smiley();
-  }
-public:
-  // type stuff
-  static TypeHandle get_class_type(void) { return _type_handle; }
-  static void init_type(void) {
-    LPoint3fLerpFunctor::init_type();
-    register_type(_type_handle, "MyPosFunctor",
-                  LPoint3fLerpFunctor::get_class_type());
-  }
-  virtual TypeHandle get_type(void) const { return get_class_type(); }
-  virtual TypeHandle force_init_type(void) {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-TypeHandle MyPosFunctor::_type_handle;
-
-class MyRotFunctor : public FloatLerpFunctor {
-public:
-  MyRotFunctor(float start, float end) : FloatLerpFunctor(start, end) {}
-  MyRotFunctor(const MyRotFunctor& p) : FloatLerpFunctor(p) {}
-  virtual ~MyRotFunctor(void) {}
-  virtual void operator()(float t) {
-    float p = interpolate(t);
-    LVector3f tmp = my_pos;
-    float x, y;
-    x = 10. * cos(p);
-    y = 10. * sin(p);
-    my_pos = LVector3f::rfu(x, 0., y);
-    my_vel = my_pos - tmp;
-    update_smiley();
-  }
-public:
-  // type stuff
-  static TypeHandle get_class_type(void) { return _type_handle; }
-  static void init_type(void) {
-    FloatLerpFunctor::init_type();
-    register_type(_type_handle, "MyRotFunctor",
-                  FloatLerpFunctor::get_class_type());
-  }
-  virtual TypeHandle get_type(void) const { return get_class_type(); }
-  virtual TypeHandle force_init_type(void) {
-    init_type();
-    return get_class_type();
-  }
-private:
-  static TypeHandle _type_handle;
-};
-TypeHandle MyRotFunctor::_type_handle;
-
-inline float unit_rand(void) {
-  return ((float)rand() / (float)RAND_MAX);
-}
-
-static void init_funcs(void) {
-  static bool inited = false;
-  if (!inited) {
-    MyPosFunctor::init_type();
-    MyRotFunctor::init_type();
-    inited = true;
-  }
-}
-
-static void run_line(bool smooth) {
-  static bool where = false;
-  LerpBlendType* blend;
-
-  init_funcs();
-  if (smooth)
-    blend = new EaseInOutBlendType();
-  else
-    blend = new NoBlendType();
-  if (where) {
-    curr_lerp =
-      new AutonomousLerp(new MyPosFunctor(my_pos, LPoint3f::rfu(10., 0., 0.)),
-                         5., blend, &event_handler);
-    curr_lerp->set_end_event("lerp_done");
-    curr_lerp->start();
-  } else {
-    curr_lerp =
-      new AutonomousLerp(new MyPosFunctor(my_pos, LPoint3f::rfu(-10., 0., 0.)),
-                         5., blend, &event_handler);
-    curr_lerp->set_end_event("lerp_done");
-    curr_lerp->start();
-  }
-  where = !where;
-}
-
-static void run_box(bool smooth) {
-  static int where = 0;
-  LerpBlendType* blend;
-
-  init_funcs();
-  if (smooth)
-    blend = new EaseInOutBlendType();
-  else
-    blend = new NoBlendType();
-  switch (where) {
-  case 0:
-    curr_lerp =
-      new AutonomousLerp(new MyPosFunctor(my_pos,
-                                          LPoint3f::rfu(-10., 0., 10.)),
-                         5., blend, &event_handler);
-    where = 1;
-    break;
-  case 1:
-    curr_lerp =
-      new AutonomousLerp(new MyPosFunctor(my_pos, LPoint3f::rfu(10., 0., 10.)),
-                         5., blend, &event_handler);
-    where = 2;
-    break;
-  case 2:
-    curr_lerp =
-      new AutonomousLerp(new MyPosFunctor(my_pos,
-                                          LPoint3f::rfu(10., 0., -10.)),
-                         5., blend, &event_handler);
-    where = 3;
-    break;
-  case 3:
-    curr_lerp =
-      new AutonomousLerp(new MyPosFunctor(my_pos,
-                                          LPoint3f::rfu(-10., 0., -10.)),
-                         5., blend, &event_handler);
-    where = 0;
-    break;
-  default:
-    deadrec_cat->error() << "I'm a tard and box::where got out of range ("
-                         << where << ")" << endl;
-    where = 0;
-    run_box(smooth);
-  }
-  curr_lerp->set_end_event("lerp_done");
-  curr_lerp->start();
-}
-
-static void run_circle(bool smooth) {
-  LerpBlendType* blend;
-
-  init_funcs();
-  if (smooth)
-    blend = new EaseInOutBlendType();
-  else
-    blend = new NoBlendType();
-  curr_lerp = new AutonomousLerp(new MyRotFunctor(0., 6.283185), 5., blend,
-                                 &event_handler);
-  curr_lerp->set_end_event("lerp_done");
-  curr_lerp->start();
-}
-
-static void run_random(bool smooth) {
-  LerpBlendType* blend;
-
-  init_funcs();
-  if (smooth)
-    blend = new EaseInOutBlendType();
-  else
-    blend = new NoBlendType();
-  float x = (20. * unit_rand()) - 10.;
-  float y = (20. * unit_rand()) - 10.;
-  LVector3f p = LVector3f::rfu(x, 0., y);
-  curr_lerp = new AutonomousLerp(new MyPosFunctor(my_pos, p), 5., blend,
-                                 &event_handler);
-  curr_lerp->set_end_event("lerp_done");
-  curr_lerp->start();
-}
-
-static void handle_lerp(void) {
-  if (curr_lerp != (AutonomousLerp*)0L)
-    curr_lerp->stop();
-  curr_lerp = (AutonomousLerp*)0L;
-  switch (curr_type) {
-  case M_None:
-    break;
-  case M_Line:
-    run_line(false);
-    break;
-  case M_SLine:
-    run_line(true);
-    break;
-  case M_Box:
-    run_box(false);
-    break;
-  case M_SBox:
-    run_box(true);
-    break;
-  case M_Circle:
-    run_circle(false);
-    break;
-  case M_SCircle:
-    run_circle(true);
-    break;
-  case M_Random:
-    run_random(false);
-    break;
-  case M_SRandom:
-    run_random(true);
-    break;
-  default:
-    deadrec_cat->error() << "unknown motion type (" << (int)curr_type << ")"
-                         << endl;
-  }
-}
-
-static void make_active(void) {
-  switch (curr_type) {
-  case M_None:
-    break;
-  case M_Line:
-    lineButton->up();
-    break;
-  case M_SLine:
-    slineButton->up();
-    break;
-  case M_Box:
-    boxButton->up();
-    break;
-  case M_SBox:
-    sboxButton->up();
-    break;
-  case M_Circle:
-    circleButton->up();
-    break;
-  case M_SCircle:
-    scircleButton->up();
-    break;
-  case M_Random:
-    randomButton->up();
-    break;
-  case M_SRandom:
-    srandomButton->up();
-    break;
-  default:
-    deadrec_cat->error() <<" unknown motion type (" << (int)curr_type << ")"
-                         << endl;
-  }
-}
-
-static void event_button_up(CPT_Event e) {
-  string s = e->get_name();
-  s = s.substr(0, s.find("-up"));
-  event_handler.remove_hook(s + "-up", event_button_up);
-  event_handler.remove_hook(s + "-up-rollover", event_button_up);
-  make_active();
-  switch (switching_to) {
-  case M_Line:
-    lineButton->inactive();
-    break;
-  case M_SLine:
-    slineButton->inactive();
-    break;
-  case M_Box:
-    boxButton->inactive();
-    break;
-  case M_SBox:
-    sboxButton->inactive();
-    break;
-  case M_Circle:
-    circleButton->inactive();
-    break;
-  case M_SCircle:
-    scircleButton->inactive();
-    break;
-  case M_Random:
-    randomButton->inactive();
-    break;
-  case M_SRandom:
-    srandomButton->inactive();
-    break;
-  default:
-    deadrec_cat->error() << "switching to invalid motion type ("
-                         << (int)switching_to << ")" << endl;
-  }
-  curr_type = switching_to;
-  handle_lerp();
-}
-
-static void event_button_down(CPT_Event e) {
-  string s = e->get_name();
-  s = s.substr(0, s.find("-down"));
-  if (s == "line") {
-    if (curr_type != M_Line) {
-      switching_to = M_Line;
-      event_handler.add_hook(s + "-up", event_button_up);
-      event_handler.add_hook(s + "-up-rollover", event_button_up);
-    }
-  } else if (s == "s-line") {
-    if (curr_type != M_SLine) {
-      switching_to = M_SLine;
-      event_handler.add_hook(s + "-up", event_button_up);
-      event_handler.add_hook(s + "-up-rollover", event_button_up);
-    }
-  } else if (s == "box") {
-    if (curr_type != M_Box) {
-      switching_to = M_Box;
-      event_handler.add_hook(s + "-up", event_button_up);
-      event_handler.add_hook(s + "-up-rollover", event_button_up);
-    }
-  } else if (s == "s-box") {
-    if (curr_type != M_SBox) {
-      switching_to = M_SBox;
-      event_handler.add_hook(s + "-up", event_button_up);
-      event_handler.add_hook(s + "-up-rollover", event_button_up);
-    }
-  } else if (s == "circle") {
-    if (curr_type != M_Circle) {
-      switching_to = M_Circle;
-      event_handler.add_hook(s + "-up", event_button_up);
-      event_handler.add_hook(s + "-up-rollover", event_button_up);
-    }
-  } else if (s == "s-circle") {
-    if (curr_type != M_SCircle) {
-      switching_to = M_SCircle;
-      event_handler.add_hook(s + "-up", event_button_up);
-      event_handler.add_hook(s + "-up-rollover", event_button_up);
-    }
-  } else if (s == "random") {
-    if (curr_type != M_Random) {
-      switching_to = M_Random;
-      event_handler.add_hook(s + "-up", event_button_up);
-      event_handler.add_hook(s + "-up-rollover", event_button_up);
-    }
-  } else if (s == "s-random") {
-    if (curr_type != M_SRandom) {
-      switching_to = M_SRandom;
-      event_handler.add_hook(s + "-up", event_button_up);
-      event_handler.add_hook(s + "-up-rollover", event_button_up);
-    }
-  } else {
-    deadrec_cat->error() << "got invalid button event '" << s << "'" << endl;
-  }
-}
-
-static inline GuiButton* make_button(const string& name, Node* font,
-                                     EventHandler& eh) {
-  GuiLabel* l1 = GuiLabel::make_simple_text_label(name, font);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label(name, font);
-  GuiLabel* l3 = GuiLabel::make_simple_text_label(name, font);
-  GuiLabel* l4 = GuiLabel::make_simple_text_label(name, font);
-  GuiLabel* l5 = GuiLabel::make_simple_text_label(name, font);
-  // up
-  l1->set_background_color(1., 1., 1., 0.);
-  // up-rollover
-  l2->set_background_color(1., 1., 1., 0.5);
-  // down
-  l3->set_background_color(1., 1., 1., 0.);
-  // down-rollover
-  l4->set_background_color(1., 1., 1., 0.5);
-  // 'inactive'
-  l5->set_background_color(1., 0., 0., 0.7);
-  GuiButton* b1 = new GuiButton(name, l1, l2, l3, l4, l5);
-  eh.add_hook(name + "-down", event_button_down);
-  eh.add_hook(name + "-down-rollover", event_button_down);
-  return b1;
-}
-
-static void deadrec_setup(EventHandler& eh) {
-  static bool done = false;
-  if (done)
-    return;
-  // load smiley and put it in the scenegraph
-  smiley = ModelPool::load_model("smiley");
-  nassertv(smiley != (Node*)0L);
-  my_arc = new RenderRelation(render, smiley);
-
-  writer = new ConnectionWriter(&cm, 0);
-
-  // create an interface
-  GuiManager* mgr = GuiManager::get_ptr(main_win, mak);
-  PT_Node font = ModelPool::load_model("ttf-comic");
-  GuiFrame* f1 = new GuiFrame("motions");
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("motion:", font);
-  l1->set_background_color(1., 1., 1., 0.);
-  GuiSign* s1 = new GuiSign("motion", l1);
-  s1->set_scale(0.08);
-  f1->add_item(s1);
-  lineButton = make_button("line", font, eh);
-  lineButton->set_scale(0.08);
-  f1->add_item(lineButton);
-  slineButton = make_button("s-line", font, eh);
-  slineButton->set_scale(0.08);
-  f1->add_item(slineButton);
-  boxButton = make_button("box", font, eh);
-  boxButton->set_scale(0.08);
-  f1->add_item(boxButton);
-  sboxButton = make_button("s-box", font, eh);
-  sboxButton->set_scale(0.08);
-  f1->add_item(sboxButton);
-  circleButton = make_button("circle", font, eh);
-  circleButton->set_scale(0.08);
-  f1->add_item(circleButton);
-  scircleButton = make_button("s-circle", font, eh);
-  scircleButton->set_scale(0.08);
-  f1->add_item(scircleButton);
-  randomButton = make_button("random", font, eh);
-  randomButton->set_scale(0.08);
-  f1->add_item(randomButton);
-  srandomButton = make_button("s-random", font, eh);
-  srandomButton->set_scale(0.08);
-  f1->add_item(srandomButton);
-  f1->pack_item(lineButton, GuiFrame::UNDER, s1);
-  f1->pack_item(lineButton, GuiFrame::ALIGN_LEFT, s1);
-  f1->pack_item(slineButton, GuiFrame::UNDER, s1);
-  f1->pack_item(slineButton, GuiFrame::RIGHT, lineButton, 0.02);
-  f1->pack_item(boxButton, GuiFrame::UNDER, s1);
-  f1->pack_item(boxButton, GuiFrame::RIGHT, slineButton, 0.02);
-  f1->pack_item(sboxButton, GuiFrame::UNDER, s1);
-  f1->pack_item(sboxButton, GuiFrame::RIGHT, boxButton, 0.02);
-  f1->pack_item(circleButton, GuiFrame::UNDER, s1);
-  f1->pack_item(circleButton, GuiFrame::RIGHT, sboxButton, 0.02);
-  f1->pack_item(scircleButton, GuiFrame::UNDER, s1);
-  f1->pack_item(scircleButton, GuiFrame::RIGHT, circleButton, 0.02);
-  f1->pack_item(randomButton, GuiFrame::UNDER, s1);
-  f1->pack_item(randomButton, GuiFrame::RIGHT, scircleButton, 0.02);
-  f1->pack_item(srandomButton, GuiFrame::UNDER, s1);
-  f1->pack_item(srandomButton, GuiFrame::RIGHT, randomButton, 0.02);
-  f1->align_to_left(0.05);
-  f1->align_to_top(0.05);
-  f1->recompute();
-  f1->manage(mgr, eh);
-}
-
-static void event_lerp(CPT_Event) {
-  handle_lerp();
-}
-
-static void deadrec_keys(EventHandler& eh) {
-  deadrec_setup(eh);
-
-  eh.add_hook("NewFrame", event_frame);
-  eh.add_hook("lerp_done", event_lerp);
-}
-
-int main(int argc, char* argv[]) {
-  define_keys = &deadrec_keys;
-  return framework_main(argc, argv);
-}

+ 0 - 1248
panda/src/testbed/gui_demo.cxx

@@ -1,1248 +0,0 @@
-// Filename: gui_demo.cxx
-// Created by:  
-//
-////////////////////////////////////////////////////////////////////
-//
-// PANDA 3D SOFTWARE
-// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
-//
-// All use of this software is subject to the terms of the Panda 3d
-// Software license.  You should have received a copy of this license
-// along with this source code; you will also find a current copy of
-// the license at http://www.panda3d.org/license.txt .
-//
-// To contact the maintainers of this program write to
-// [email protected] .
-//
-////////////////////////////////////////////////////////////////////
-
-#include "framework.h"
-
-#include <eventHandler.h>
-#include <chancfg.h>
-#include <string>
-#include <renderModeTransition.h>
-#include <colorTransition.h>
-#include <colorBlendTransition.h>
-#include <cullFaceTransition.h>
-#include <depthTestTransition.h>
-#include <depthWriteTransition.h>
-#include <textureTransition.h>
-#include <textureApplyTransition.h>
-#include <lightTransition.h>
-#include <materialTransition.h>
-#include <transformTransition.h>
-#include <transparencyTransition.h>
-#include <drawBoundsTransition.h>
-#include <pruneTransition.h>
-#include <get_rel_pos.h>
-#include <boundingSphere.h>
-#include <geomSphere.h>
-#include <geomNode.h>
-#include <notify.h>
-#include <directionalLight.h>
-#include <renderRelation.h>
-#include <camera.h>
-#include <frustum.h>
-#include <orthoProjection.h>
-#include <perspectiveProjection.h>
-#include <textNode.h>
-#include <shaderTransition.h>
-#include <colorMatrixTransition.h>
-#include <alphaTransformTransition.h>
-#include <lensFlareNode.h>
-#include <texture.h>
-#include <texturePool.h>
-#include <spotlight.h>
-#include <nodePath.h>
-#include <pta_Colorf.h>
-#include <pta_float.h>
-#include <pt_Node.h>
-#include <modelPool.h>
-
-#include <guiManager.h>
-#include <guiRollover.h>
-#include <guiButton.h>
-#include <guiFrame.h>
-#include <guiSign.h>
-#include <guiListBox.h>
-#include <guiChooser.h>
-#include <guiBackground.h>
-
-//From framework
-extern PT(GeomNode) geomnode;
-extern RenderRelation* first_arc;
-
-// static PT(GuiFrame) global_frame;
-
-static void test1(GuiManager* mgr, Node* font) {
-  //  mgr->add_region(new GuiRegion("test1", 0., 0.25, 0., 0.25));
-  //  mgr->add_label(GuiLabel::make_simple_text_label("test2", font));
-}
-
-static void test2(GuiManager* mgr, Node* font) {
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("off", font);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("on", font);
-  GuiRollover* r1 = new GuiRollover("test2", l1, l2);
-  r1->set_scale(0.1);
-  r1->set_pos(LVector3f::rfu(0.25, 0., 0.25));
-  r1->thaw();
-  r1->manage(mgr, event_handler);
-}
-
-static void test3(GuiManager* mgr, Node* font) {
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("up", font);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("upr", font);
-  GuiLabel* l3 = GuiLabel::make_simple_text_label("down", font);
-  GuiLabel* l4 = GuiLabel::make_simple_text_label("downr", font);
-  GuiLabel* l5 = GuiLabel::make_simple_text_label("none", font);
-  GuiButton* b1 = new GuiButton("test3", l1, l2, l3, l4, l5);
-  b1->set_scale(0.1);
-  b1->set_pos(LVector3f::rfu(-0.25, 0., 0.25));
-  l2->set_foreground_color(1., 1., 0., 1.);
-  l4->set_foreground_color(1., 1., 0., 1.);
-  l3->set_background_color(1., 1., 1., 0.5);
-  l4->set_background_color(1., 1., 1., 0.5);
-  b1->thaw();
-  b1->manage(mgr, event_handler);
-  GuiLabel* ll1 = GuiLabel::make_simple_text_label("lup", font);
-  GuiLabel* ll2 = GuiLabel::make_simple_text_label("lupr", font);
-  GuiLabel* ll3 = GuiLabel::make_simple_text_label("ldown", font);
-  GuiLabel* ll4 = GuiLabel::make_simple_text_label("ldownr", font);
-  GuiLabel* ll5 = GuiLabel::make_simple_text_label("lnone", font);
-  GuiButton* b2 = new GuiButton("test3_2", ll1, ll2, ll3, ll4, ll5);
-  b2->set_scale(0.1);
-  b2->set_pos(LVector3f::rfu(0.25, 0., 0.25));
-  ll2->set_foreground_color(1., 1., 0., 1.);
-  ll4->set_foreground_color(1., 1., 0., 1.);
-  ll3->set_background_color(1., 1., 1., 0.5);
-  ll4->set_background_color(1., 1., 1., 0.5);
-  b2->thaw();
-  b2->manage(mgr, event_handler);
-}
-
-static void test4(GuiManager* mgr, Node* font) {
-  GuiRollover* r1 = new GuiRollover("r1",
-                                    GuiLabel::make_simple_text_label("1",
-                                                                     font),
-                                    GuiLabel::make_simple_text_label("!",
-                                                                     font));
-  GuiRollover* r2 = new GuiRollover("r2",
-                                    GuiLabel::make_simple_text_label("2",
-                                                                     font),
-                                    GuiLabel::make_simple_text_label("@",
-                                                                     font));
-  GuiRollover* r3 = new GuiRollover("r3",
-                                    GuiLabel::make_simple_text_label("3",
-                                                                     font),
-                                    GuiLabel::make_simple_text_label("#",
-                                                                     font));
-  GuiRollover* r4 = new GuiRollover("r4",
-                                    GuiLabel::make_simple_text_label("4",
-                                                                     font),
-                                    GuiLabel::make_simple_text_label("$",
-                                                                     font));
-  GuiRollover* r5 = new GuiRollover("r5",
-                                    GuiLabel::make_simple_text_label("5",
-                                                                     font),
-                                    GuiLabel::make_simple_text_label("%",
-                                                                     font));
-  GuiRollover* r6 = new GuiRollover("r6",
-                                    GuiLabel::make_simple_text_label("6",
-                                                                     font),
-                                    GuiLabel::make_simple_text_label("^",
-                                                                     font));
-  GuiRollover* r7 = new GuiRollover("r7",
-                                    GuiLabel::make_simple_text_label("7",
-                                                                     font),
-                                    GuiLabel::make_simple_text_label("&",
-                                                                     font));
-  GuiRollover* r8 = new GuiRollover("r8",
-                                    GuiLabel::make_simple_text_label("8",
-                                                                     font),
-                                    GuiLabel::make_simple_text_label("*",
-                                                                     font));
-  GuiRollover* r9 = new GuiRollover("r9",
-                                    GuiLabel::make_simple_text_label("9",
-                                                                     font),
-                                    GuiLabel::make_simple_text_label("(",
-                                                                     font));
-  GuiRollover* r0 = new GuiRollover("r0",
-                                    GuiLabel::make_simple_text_label("0",
-                                                                     font),
-                                    GuiLabel::make_simple_text_label(")",
-                                                                     font));
-  GuiFrame* f1 = new GuiFrame("test4");
-  f1->add_item(r1);
-  f1->add_item(r2);
-  f1->pack_item(r2, GuiFrame::UNDER, r1);
-  f1->pack_item(r2, GuiFrame::RIGHT, r1);
-  f1->add_item(r3);
-  f1->pack_item(r3, GuiFrame::UNDER, r2);
-  f1->pack_item(r3, GuiFrame::RIGHT, r2);
-  f1->add_item(r4);
-  f1->pack_item(r4, GuiFrame::UNDER, r3);
-  f1->pack_item(r4, GuiFrame::RIGHT, r2);
-  f1->add_item(r5);
-  f1->pack_item(r5, GuiFrame::UNDER, r4);
-  f1->pack_item(r5, GuiFrame::LEFT, r4);
-  f1->add_item(r6);
-  f1->pack_item(r6, GuiFrame::UNDER, r5);
-  f1->pack_item(r6, GuiFrame::LEFT, r5);
-  f1->add_item(r7);
-  f1->pack_item(r7, GuiFrame::ABOVE, r6);
-  f1->pack_item(r7, GuiFrame::LEFT, r6);
-  f1->add_item(r8);
-  f1->pack_item(r8, GuiFrame::ABOVE, r7);
-  f1->pack_item(r8, GuiFrame::LEFT, r7);
-  f1->add_item(r9);
-  f1->pack_item(r9, GuiFrame::ABOVE, r8);
-  f1->pack_item(r9, GuiFrame::LEFT, r7);
-  f1->add_item(r0);
-  f1->pack_item(r0, GuiFrame::ABOVE, r9);
-  f1->pack_item(r0, GuiFrame::RIGHT, r9);
-  f1->set_scale(0.1);
-  f1->set_pos(LVector3f::rfu(0., 0., -0.25));
-  f1->thaw();
-  f1->manage(mgr, event_handler);
-  //  cerr << *f1;
-}
-
-// PT(GuiFrame) global_frame;
-
-static void test5(GuiManager* mgr, Node* font) {
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("on", font);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("off", font);
-  GuiLabel* l3 = GuiLabel::make_simple_text_label("over", font);
-  GuiLabel* l4 = GuiLabel::make_simple_text_label("easy", font);
-  l1->set_background_color(1., 1., 1., 0.3);
-  l2->set_background_color(1., 1., 1., 0.3);
-  l3->set_background_color(1., 1., 1., 0.3);
-  l4->set_background_color(1., 1., 1., 0.3);
-  GuiRollover* r1 = new GuiRollover("r1", l1, l2);
-  GuiRollover* r2 = new GuiRollover("r2", l3, l4);
-  GuiFrame* f1 = new GuiFrame("test5");
-  f1->add_item(r1);
-  f1->add_item(r2);
-  f1->pack_item(r2, GuiFrame::UNDER, r1);
-  f1->set_scale(0.1);
-  float w1, w2, w3, w4, w;
-  w1 = l1->get_width();
-  w2 = l2->get_width();
-  w3 = l3->get_width();
-  w4 = l4->get_width();
-  w = (w1>w2)?w1:w2;
-  w = (w>w3)?w:w3;
-  w = (w>w4)?w:w4;
-  l1->set_width(w);
-  l2->set_width(w);
-  l3->set_width(w);
-  l4->set_width(w);
-  f1->thaw();
-  f1->manage(mgr, event_handler);
-  //  global_frame = f1;
-}
-
-static void test6(GuiManager* mgr, Node* font) {
-  // the greg test
-  GuiFrame* f1 = new GuiFrame("canids");
-  GuiLabel* b1l1 = GuiLabel::make_simple_text_label("dingo", font);
-  b1l1->set_foreground_color(0., 0., 0., 1.);
-  b1l1->set_background_color(1., 1., 1., 1.);
-  GuiLabel* b1l2 = GuiLabel::make_simple_text_label("dingo", font);
-  b1l2->set_foreground_color(0., 0., 0., 1.);
-  b1l2->set_background_color(1., 1., 0., 1.);
-  GuiLabel* b1l3 = GuiLabel::make_simple_text_label("dingo", font);
-  b1l3->set_foreground_color(1., 1., 1., 1.);
-  b1l3->set_background_color(0., 0., 0., 1.);
-  GuiButton* b1 = new GuiButton("dingo", b1l1, b1l2, b1l3, b1l3, b1l1);
-  b1->set_scale(0.1);
-  f1->add_item(b1);
-  GuiLabel* b2l1 = GuiLabel::make_simple_text_label("jackel", font);
-  b2l1->set_foreground_color(0., 0., 0., 1.);
-  b2l1->set_background_color(1., 1., 1., 1.);
-  GuiLabel* b2l2 = GuiLabel::make_simple_text_label("jackel", font);
-  b2l2->set_foreground_color(0., 0., 0., 1.);
-  b2l2->set_background_color(1., 1., 0., 1.);
-  GuiLabel* b2l3 = GuiLabel::make_simple_text_label("jackel", font);
-  b2l3->set_foreground_color(1., 1., 1., 1.);
-  b2l3->set_background_color(0., 0., 0., 1.);
-  GuiButton* b2 = new GuiButton("jackel", b2l1, b2l2, b2l3, b2l3, b2l1);
-  b2->set_scale(0.1);
-  f1->add_item(b2);
-  GuiLabel* b3l1 = GuiLabel::make_simple_text_label("hyena", font);
-  b3l1->set_foreground_color(0., 0., 0., 1.);
-  b3l1->set_background_color(1., 1., 1., 1.);
-  GuiLabel* b3l2 = GuiLabel::make_simple_text_label("hyena", font);
-  b3l2->set_foreground_color(0., 0., 0., 1.);
-  b3l2->set_background_color(1., 1., 0., 1.);
-  GuiLabel* b3l3 = GuiLabel::make_simple_text_label("hyena", font);
-  b3l3->set_foreground_color(1., 1., 1., 1.);
-  b3l3->set_background_color(0., 0., 0., 1.);
-  GuiButton* b3 = new GuiButton("hyena", b3l1, b3l2, b3l3, b3l3, b3l1);
-  b3->set_scale(0.1);
-  f1->add_item(b3);
-  GuiLabel* b4l1 = GuiLabel::make_simple_text_label("wolf", font);
-  b4l1->set_foreground_color(0., 0., 0., 1.);
-  b4l1->set_background_color(1., 1., 1., 1.);
-  GuiLabel* b4l2 = GuiLabel::make_simple_text_label("wolf", font);
-  b4l2->set_foreground_color(0., 0., 0., 1.);
-  b4l2->set_background_color(1., 1., 0., 1.);
-  GuiLabel* b4l3 = GuiLabel::make_simple_text_label("wolf", font);
-  b4l3->set_foreground_color(1., 1., 1., 1.);
-  b4l3->set_background_color(0., 0., 0., 1.);
-  GuiButton* b4 = new GuiButton("wolf", b4l1, b4l2, b4l3, b4l3, b4l1);
-  b4->set_scale(0.1);
-  f1->add_item(b4);
-  GuiLabel* b5l1 = GuiLabel::make_simple_text_label("fox", font);
-  b5l1->set_foreground_color(0., 0., 0., 1.);
-  b5l1->set_background_color(1., 1., 1., 1.);
-  GuiLabel* b5l2 = GuiLabel::make_simple_text_label("fox", font);
-  b5l2->set_foreground_color(0., 0., 0., 1.);
-  b5l2->set_background_color(1., 1., 0., 1.);
-  GuiLabel* b5l3 = GuiLabel::make_simple_text_label("fox", font);
-  b5l3->set_foreground_color(1., 1., 1., 1.);
-  b5l3->set_background_color(0., 0., 0., 1.);
-  GuiButton* b5 = new GuiButton("fox", b5l1, b5l2, b5l3, b5l3, b5l1);
-  b5->set_scale(0.1);
-  f1->add_item(b5);
-  f1->pack_item(b2, GuiFrame::UNDER, b1, 0.05);
-  f1->pack_item(b2, GuiFrame::ALIGN_LEFT, b1);
-  f1->pack_item(b3, GuiFrame::UNDER, b2, 0.05);
-  f1->pack_item(b3, GuiFrame::ALIGN_LEFT, b2);
-  f1->pack_item(b4, GuiFrame::UNDER, b3, 0.05);
-  f1->pack_item(b4, GuiFrame::ALIGN_LEFT, b3);
-  f1->pack_item(b5, GuiFrame::UNDER, b4, 0.05);
-  f1->pack_item(b5, GuiFrame::ALIGN_LEFT, b4);
-  float w, w1, w2;
-  w1 = b1l1->get_width();
-  w2 = b2l1->get_width();
-  w = (w1>w2)?w1:w2;
-  w2 = b3l1->get_width();
-  w = (w>w2)?w:w2;
-  w2 = b4l1->get_width();
-  w = (w>w2)?w:w2;
-  w2 = b5l1->get_width();
-  w = (w>w2)?w:w2;
-  b1l1->set_width(w);
-  b1l2->set_width(w);
-  b1l3->set_width(w);
-  b2l1->set_width(w);
-  b2l2->set_width(w);
-  b2l3->set_width(w);
-  b3l1->set_width(w);
-  b3l2->set_width(w);
-  b3l3->set_width(w);
-  b4l1->set_width(w);
-  b4l2->set_width(w);
-  b4l3->set_width(w);
-  b5l1->set_width(w);
-  b5l2->set_width(w);
-  b5l3->set_width(w);
-  f1->recompute();
-  f1->thaw();
-  f1->manage(mgr, event_handler);
-}
-
-/*
-GuiManager* g_mgr;
-PT(GuiButton) b1;
-PT(GuiButton) b4;
-PT(GuiButton) b5;
-PT(GuiFrame) f1;
-static bool frame_state = true;
-
-static void test7(GuiManager* mgr, Node* font) {
-  f1 = new GuiFrame("canids");
-  GuiLabel* b1l1 = GuiLabel::make_simple_text_label("dingo", font);
-  b1l1->set_foreground_color(0., 0., 0., 1.);
-  b1l1->set_background_color(1., 1., 1., 1.);
-  GuiLabel* b1l2 = GuiLabel::make_simple_text_label("dingo", font);
-  b1l2->set_foreground_color(0., 0., 0., 1.);
-  b1l2->set_background_color(1., 1., 0., 1.);
-  GuiLabel* b1l3 = GuiLabel::make_simple_text_label("dingo", font);
-  b1l3->set_foreground_color(1., 1., 1., 1.);
-  b1l3->set_background_color(0., 0., 0., 1.);
-  b1 = new GuiButton("dingo", b1l1, b1l2, b1l3, b1l3, b1l1);
-  b1->set_scale(0.1);
-  f1->add_item(b1);
-  GuiLabel* b2l1 = GuiLabel::make_simple_text_label("jackel", font);
-  b2l1->set_foreground_color(0., 0., 0., 1.);
-  b2l1->set_background_color(1., 1., 1., 1.);
-  GuiLabel* b2l2 = GuiLabel::make_simple_text_label("jackel", font);
-  b2l2->set_foreground_color(0., 0., 0., 1.);
-  b2l2->set_background_color(1., 1., 0., 1.);
-  GuiLabel* b2l3 = GuiLabel::make_simple_text_label("jackel", font);
-  b2l3->set_foreground_color(1., 1., 1., 1.);
-  b2l3->set_background_color(0., 0., 0., 1.);
-  GuiButton* b2 = new GuiButton("jackel", b2l1, b2l2, b2l3, b2l3, b2l1);
-  b2->set_scale(0.1);
-  f1->add_item(b2);
-  GuiLabel* b3l1 = GuiLabel::make_simple_text_label("hyena", font);
-  b3l1->set_foreground_color(0., 0., 0., 1.);
-  b3l1->set_background_color(1., 1., 1., 1.);
-  GuiLabel* b3l2 = GuiLabel::make_simple_text_label("hyena", font);
-  b3l2->set_foreground_color(0., 0., 0., 1.);
-  b3l2->set_background_color(1., 1., 0., 1.);
-  GuiLabel* b3l3 = GuiLabel::make_simple_text_label("hyena", font);
-  b3l3->set_foreground_color(1., 1., 1., 1.);
-  b3l3->set_background_color(0., 0., 0., 1.);
-  GuiButton* b3 = new GuiButton("hyena", b3l1, b3l2, b3l3, b3l3, b3l1);
-  b3->set_scale(0.1);
-  f1->add_item(b3);
-  GuiLabel* b4l1 = GuiLabel::make_simple_text_label("wolf", font);
-  b4l1->set_foreground_color(0., 0., 0., 1.);
-  b4l1->set_background_color(1., 1., 1., 1.);
-  GuiLabel* b4l2 = GuiLabel::make_simple_text_label("wolf", font);
-  b4l2->set_foreground_color(0., 0., 0., 1.);
-  b4l2->set_background_color(1., 1., 0., 1.);
-  GuiLabel* b4l3 = GuiLabel::make_simple_text_label("wolf", font);
-  b4l3->set_foreground_color(1., 1., 1., 1.);
-  b4l3->set_background_color(0., 0., 0., 1.);
-  b4 = new GuiButton("wolf", b4l1, b4l2, b4l3, b4l3, b4l1);
-  b4->set_scale(0.1);
-  f1->add_item(b4);
-  GuiLabel* b5l1 = GuiLabel::make_simple_text_label("fox", font);
-  b5l1->set_foreground_color(0., 0., 0., 1.);
-  b5l1->set_background_color(1., 1., 1., 1.);
-  GuiLabel* b5l2 = GuiLabel::make_simple_text_label("fox", font);
-  b5l2->set_foreground_color(0., 0., 0., 1.);
-  b5l2->set_background_color(1., 1., 0., 1.);
-  GuiLabel* b5l3 = GuiLabel::make_simple_text_label("fox", font);
-  b5l3->set_foreground_color(1., 1., 1., 1.);
-  b5l3->set_background_color(0., 0., 0., 1.);
-  b5 = new GuiButton("fox", b5l1, b5l2, b5l3, b5l3, b5l1);
-  b5->set_scale(0.1);
-  f1->pack_item(b2, GuiFrame::UNDER, b1);
-  f1->pack_item(b2, GuiFrame::LEFT, b1);
-  f1->pack_item(b3, GuiFrame::UNDER, b1);
-  f1->pack_item(b3, GuiFrame::RIGHT, b1);
-  f1->pack_item(b4, GuiFrame::UNDER, b1);
-  f1->pack_item(b4, GuiFrame::ALIGN_LEFT, b1);
-  float w, w1, w2;
-  w1 = b1l1->get_width();
-  w2 = b2l1->get_width();
-  w = (w1>w2)?w1:w2;
-  w2 = b3l1->get_width();
-  w = (w>w2)?w:w2;
-  w2 = b4l1->get_width();
-  w = (w>w2)?w:w2;
-  w2 = b5l1->get_width();
-  w = (w>w2)?w:w2;
-  b1l1->set_width(w);
-  b1l2->set_width(w);
-  b1l3->set_width(w);
-  b2l1->set_width(w);
-  b2l2->set_width(w);
-  b2l3->set_width(w);
-  b3l1->set_width(w);
-  b3l2->set_width(w);
-  b3l3->set_width(w);
-  b4l1->set_width(w);
-  b4l2->set_width(w);
-  b4l3->set_width(w);
-  b5l1->set_width(w);
-  b5l2->set_width(w);
-  b5l3->set_width(w);
-  f1->recompute();
-  f1->thaw();
-  b5->thaw();
-  f1->manage(mgr, event_handler);
-}
-*/
-
-/*
-GuiManager* g_mgr;
-PT(GuiSign) s1;
-PT(GuiSign) s4;
-PT(GuiSign) s5;
-PT(GuiFrame) f1;
-static bool frame_state = true;
-
-static void test8(GuiManager* mgr, Node* font) {
-  f1 = new GuiFrame("canids");
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("dingo", font);
-  l1->set_foreground_color(0., 0., 0., 1.);
-  l1->set_background_color(1., 1., 1., 1.);
-  s1 = new GuiSign("dingo", l1);
-  s1->set_scale(0.1);
-  f1->add_item(s1);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("jackel", font);
-  l2->set_foreground_color(0., 0., 0., 1.);
-  l2->set_background_color(1., 1., 1., 1.);
-  GuiSign* s2 = new GuiSign("jackel", l2);
-  s2->set_scale(0.1);
-  f1->add_item(s2);
-  GuiLabel* l3 = GuiLabel::make_simple_text_label("hyena", font);
-  l3->set_foreground_color(0., 0., 0., 1.);
-  l3->set_background_color(1., 1., 1., 1.);
-  GuiSign* s3 = new GuiSign("jackel", l3);
-  s3->set_scale(0.1);
-  f1->add_item(s3);
-  GuiLabel* l4 = GuiLabel::make_simple_text_label("wolf", font);
-  l4->set_foreground_color(0., 0., 0., 1.);
-  l4->set_background_color(1., 1., 1., 1.);
-  s4 = new GuiSign("wolf", l4);
-  s4->set_scale(0.1);
-  f1->add_item(s4);
-  GuiLabel* l5 = GuiLabel::make_simple_text_label("fox", font);
-  l5->set_foreground_color(0., 0., 0., 1.);
-  l5->set_background_color(1., 1., 1., 1.);
-  s5 = new GuiSign("fox", l5);
-  s5->set_scale(0.1);
-  f1->pack_item(s2, GuiFrame::UNDER, s1);
-  f1->pack_item(s2, GuiFrame::LEFT, s1);
-  f1->pack_item(s3, GuiFrame::UNDER, s1);
-  f1->pack_item(s3, GuiFrame::RIGHT, s1);
-  f1->pack_item(s4, GuiFrame::UNDER, s1);
-  f1->pack_item(s4, GuiFrame::ALIGN_LEFT, s1);
-  float w, w1, w2;
-  w1 = l1->get_width();
-  w2 = l2->get_width();
-  w = (w1>w2)?w1:w2;
-  w2 = l3->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l4->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l5->get_width();
-  w = (w>w2)?w:w2;
-  l1->set_width(w);
-  l2->set_width(w);
-  l3->set_width(w);
-  l4->set_width(w);
-  l5->set_width(w);
-  f1->recompute();
-  f1->thaw();
-  s5->thaw();
-  f1->manage(mgr, event_handler);
-}
-*/
-
-/*
-GuiManager* g_mgr;
-PT(GuiLabel) l4;
-PT(GuiFrame) f1;
-static bool frame_state = true;
-
-static void test9(GuiManager* mgr, Node* font) {
-  f1 = new GuiFrame("canids");
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("dingo", font);
-  l1->set_foreground_color(0., 0., 0., 1.);
-  l1->set_background_color(1., 1., 1., 1.);
-  GuiSign* s1 = new GuiSign("dingo", l1);
-  s1->set_scale(0.1);
-  f1->add_item(s1);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("jackel", font);
-  l2->set_foreground_color(0., 0., 0., 1.);
-  l2->set_background_color(1., 1., 1., 1.);
-  GuiSign* s2 = new GuiSign("jackel", l2);
-  s2->set_scale(0.1);
-  f1->add_item(s2);
-  GuiLabel* l3 = GuiLabel::make_simple_text_label("hyena", font);
-  l3->set_foreground_color(0., 0., 0., 1.);
-  l3->set_background_color(1., 1., 1., 1.);
-  GuiSign* s3 = new GuiSign("jackel", l3);
-  s3->set_scale(0.1);
-  f1->add_item(s3);
-  l4 = GuiLabel::make_simple_text_label("wolf", font);
-  l4->set_foreground_color(0., 0., 0., 1.);
-  l4->set_background_color(1., 1., 1., 1.);
-  GuiSign* s4 = new GuiSign("wolf", l4);
-  s4->set_scale(0.1);
-  f1->add_item(s4);
-  f1->pack_item(s2, GuiFrame::UNDER, s1);
-  f1->pack_item(s2, GuiFrame::LEFT, s1);
-  f1->pack_item(s3, GuiFrame::UNDER, s1);
-  f1->pack_item(s3, GuiFrame::RIGHT, s1);
-  f1->pack_item(s4, GuiFrame::UNDER, s1);
-  f1->pack_item(s4, GuiFrame::ALIGN_LEFT, s1);
-  float w, w1, w2;
-  w1 = l1->get_width();
-  w2 = l2->get_width();
-  w = (w1>w2)?w1:w2;
-  w2 = l3->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l4->get_width();
-  w = (w>w2)?w:w2;
-  l1->set_width(w);
-  l2->set_width(w);
-  l3->set_width(w);
-  l4->set_width(w);
-  f1->recompute();
-  f1->thaw();
-  s4->thaw();
-  f1->manage(mgr, event_handler);
-}
-*/
-
-/*
-PT(GuiSign) s1;
-PT(GuiSign) s2;
-PT(GuiSign) s3;
-static bool prior_state = true;
-
-static void test10(GuiManager* mgr, Node* font) {
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("A", font);
-  l1->set_foreground_color(0., 0., 0., 1.);
-  l1->set_background_color(1., 0., 0., 1.);
-  s1 = new GuiSign("A", l1);
-  s1->set_scale(0.1);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("B", font);
-  l2->set_foreground_color(0., 0., 0., 1.);
-  l2->set_background_color(0., 1., 0., 1.);
-  s2 = new GuiSign("B", l2);
-  s2->set_scale(0.1);
-  s2->set_pos(LVector3f::rfu(0.05, 0., 0.05));
-  GuiLabel* l3 = GuiLabel::make_simple_text_label("C", font);
-  l3->set_foreground_color(0., 0., 0., 1.);
-  l3->set_background_color(0., 0., 1., 1.);
-  s3 = new GuiSign("C", l3);
-  s3->set_scale(0.1);
-  s3->set_pos(LVector3f::rfu(0.1, 0., 0.1));
-  s1->set_priority(s2, GuiItem::P_Low);
-  s1->thaw();
-  s2->set_priority(s3, GuiItem::P_Low);
-  s2->thaw();
-  //  s3->set_priority(GuiItem::P_High);
-  s3->thaw();
-  s1->manage(mgr, event_handler);
-  s2->manage(mgr, event_handler);
-  s3->manage(mgr, event_handler);
-}
-*/
-
-PT(GuiListBox) lb1;
-
-/*
-static void test11(GuiManager* mgr, Node* font) {
-  GuiLabel* ul = GuiLabel::make_simple_text_label("upup", font);
-  GuiSign* us = new GuiSign("up_arrow", ul);
-  us->set_scale(0.1);
-  GuiLabel* dl = GuiLabel::make_simple_text_label("dndn", font);
-  GuiSign* ds = new GuiSign("down_arrow", dl);
-  ds->set_scale(0.1);
-  lb1 = new GuiListBox("list_box", 4, us, ds);
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("hyena", font);
-  GuiSign* s1 = new GuiSign("hyena", l1);
-  s1->set_scale(0.1);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("dingo", font);
-  GuiSign* s2 = new GuiSign("dingo", l2);
-  s2->set_scale(0.1);
-  GuiLabel* l3 = GuiLabel::make_simple_text_label("jackal", font);
-  GuiSign* s3 = new GuiSign("jackal", l3);
-  s3->set_scale(0.1);
-  GuiLabel* l4 = GuiLabel::make_simple_text_label("wolf", font);
-  GuiSign* s4 = new GuiSign("wolf", l4);
-  s4->set_scale(0.1);
-  GuiLabel* l5 = GuiLabel::make_simple_text_label("fox", font);
-  GuiSign* s5 = new GuiSign("fox", l5);
-  s5->set_scale(0.1);
-  float w, w1, w2;
-  w1 = l1->get_width();
-  w2 = l2->get_width();
-  w = (w1>w2)?w1:w2;
-  w2 = l3->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l4->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l5->get_width();
-  w = (w>w2)?w:w2;
-  l1->set_width(w);
-  l2->set_width(w);
-  l3->set_width(w);
-  l4->set_width(w);
-  l5->set_width(w);
-  ul->set_background_color(0., 0., 0., 1.);
-  dl->set_background_color(0., 0., 0., 1.);
-  l1->set_background_color(0., 0., 0., 1.);
-  l2->set_background_color(0., 0., 0., 1.);
-  l3->set_background_color(0., 0., 0., 1.);
-  l4->set_background_color(0., 0., 0., 1.);
-  l5->set_background_color(0., 0., 0., 1.);
-  lb1->add_item(s1);
-  lb1->add_item(s2);
-  lb1->add_item(s3);
-  lb1->add_item(s4);
-  lb1->add_item(s5);
-  lb1->thaw();
-  lb1->manage(mgr, event_handler);
-  cout << *lb1;
-}
-*/
-
-PT(GuiButton) gb1;
-
-static void test12(GuiManager* mgr, Node* font) {
-  /*
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("up", font);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("upr", font);
-  GuiLabel* l3 = GuiLabel::make_simple_text_label("down", font);
-  GuiLabel* l4 = GuiLabel::make_simple_text_label("downr", font);
-  GuiLabel* l5 = GuiLabel::make_simple_text_label("none", font);
-  */
-  PT_Node smile = ModelPool::load_model("smiley");
-  GuiLabel* l1 = GuiLabel::make_model_label(smile, 0.25, 0.25);
-  GuiLabel* l2 = GuiLabel::make_model_label(smile, 0.25, 0.25);
-  GuiLabel* l3 = GuiLabel::make_model_label(smile, 0.25, 0.25);
-  GuiLabel* l4 = GuiLabel::make_model_label(smile, 0.25, 0.25);
-  GuiLabel* l5 = GuiLabel::make_model_label(smile, 0.25, 0.25);
-  gb1 = new GuiButton("test12", l1, l2, l3, l4, l5);
-  gb1->set_scale(0.1);
-  gb1->set_pos(LVector3f::rfu(-0.25, 0., 0.25));
-  l2->set_foreground_color(1., 1., 0., 1.);
-  l4->set_foreground_color(1., 1., 0., 1.);
-  l1->set_background_color(0., 0., 0., 1.);
-  l2->set_background_color(0., 0., 0., 1.);
-  l3->set_background_color(1., 1., 1., 0.5);
-  l4->set_background_color(1., 1., 1., 0.5);
-  gb1->thaw();
-  gb1->manage(mgr, event_handler);
-  gb1->set_behavior_event("demo-event-thing");
-  gb1->start_behavior();
-}
-
-static void test13(GuiManager* mgr, Node* font) {
-  GuiLabel* ul1 = GuiLabel::make_simple_text_label("upup", font);
-  GuiLabel* ul2 = GuiLabel::make_simple_text_label("upup", font);
-  GuiLabel* ul3 = GuiLabel::make_simple_text_label("upup", font);
-  GuiButton* ub = new GuiButton("up_arrow", ul1, ul2, ul3);
-  ub->set_scale(0.1);
-  GuiLabel* dl1 = GuiLabel::make_simple_text_label("dndn", font);
-  GuiLabel* dl2 = GuiLabel::make_simple_text_label("dndn", font);
-  GuiLabel* dl3 = GuiLabel::make_simple_text_label("dndn", font);
-  GuiButton* db = new GuiButton("down_arrow", dl1, dl2, dl3);
-  db->set_scale(0.1);
-  // ub->set_behavior_event("demo-event-thing");
-  // db->set_behavior_event("demo-event-thing");
-  ub->set_pos(LVector3f::rfu(0.0, 0.0, 0.8));
-  db->set_pos(LVector3f::rfu(0.0, 0.0, -0.8));
-  lb1 = new GuiListBox("list_box", 4, ub, db);
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("hyena", font);
-  GuiSign* s1 = new GuiSign("hyena", l1);
-  s1->set_scale(0.1);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("dingo", font);
-  GuiSign* s2 = new GuiSign("dingo", l2);
-  s2->set_scale(0.1);
-  GuiLabel* l3 = GuiLabel::make_simple_text_label("jackal", font);
-  GuiSign* s3 = new GuiSign("jackal", l3);
-  s3->set_scale(0.1);
-  GuiLabel* l4 = GuiLabel::make_simple_text_label("wolf", font);
-  GuiSign* s4 = new GuiSign("wolf", l4);
-  s4->set_scale(0.1);
-  GuiLabel* l5 = GuiLabel::make_simple_text_label("fox", font);
-  GuiSign* s5 = new GuiSign("fox", l5);
-  s5->set_scale(0.1);
-  float w, w1, w2;
-  w1 = l1->get_width();
-  w2 = l2->get_width();
-  w = (w1>w2)?w1:w2;
-  w2 = l3->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l4->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l5->get_width();
-  w = (w>w2)?w:w2;
-  l1->set_width(w);
-  l2->set_width(w);
-  l3->set_width(w);
-  l4->set_width(w);
-  l5->set_width(w);
-  ul1->set_background_color(0., 0., 0., 1.);
-  ul2->set_background_color(0., 0., 0., 1.);
-  ul3->set_background_color(0., 0., 0., 1.);
-  ul2->set_foreground_color(1., 0., 0., 1.);
-  ul3->set_foreground_color(1., 1., 1., 0.5);
-  dl1->set_background_color(0., 0., 0., 1.);
-  dl2->set_background_color(0., 0., 0., 1.);
-  dl3->set_background_color(0., 0., 0., 1.);
-  dl2->set_foreground_color(1., 0., 0., 1.);
-  dl3->set_foreground_color(1., 1., 1., 0.5);
-  l1->set_background_color(0., 0., 0., 1.);
-  l2->set_background_color(0., 0., 0., 1.);
-  l3->set_background_color(0., 0., 0., 1.);
-  l4->set_background_color(0., 0., 0., 1.);
-  l5->set_background_color(0., 0., 0., 1.);
-  lb1->add_item(s1);
-  lb1->add_item(s2);
-  lb1->add_item(s3);
-  lb1->add_item(s4);
-  lb1->add_item(s5);
-  lb1->thaw();
-  ub->manage(mgr, event_handler);
-  db->manage(mgr, event_handler);
-  lb1->manage(mgr, event_handler);
-  lb1->start_behavior();
-}
-
-PT(GuiChooser) ch1;
-
-static void test14(GuiManager* mgr, Node* font) {
-  GuiLabel* nl1 = GuiLabel::make_simple_text_label("next", font);
-  GuiLabel* nl2 = GuiLabel::make_simple_text_label("next", font);
-  GuiLabel* nl3 = GuiLabel::make_simple_text_label("next", font);
-  GuiButton* nb = new GuiButton("next_button", nl1, nl2, nl3);
-  nb->set_scale(0.1);
-  nb->set_pos(LVector3f::rfu(0.25, 0., -0.25));
-  GuiLabel* pl1 = GuiLabel::make_simple_text_label("prev", font);
-  GuiLabel* pl2 = GuiLabel::make_simple_text_label("prev", font);
-  GuiLabel* pl3 = GuiLabel::make_simple_text_label("prev", font);
-  GuiButton* pb = new GuiButton("prev_button", pl1, pl2, pl3);
-  pb->set_scale(0.1);
-  pb->set_pos(LVector3f::rfu(-0.25, 0., -0.25));
-  nb->set_behavior_event("demo-event-thing");
-  pb->set_behavior_event("demo-event-thing");
-  ch1 = new GuiChooser("chooser", pb, nb);
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("hyena", font);
-  GuiSign* s1 = new GuiSign("hyena", l1);
-  s1->set_scale(0.1);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("dingo", font);
-  GuiSign* s2 = new GuiSign("dingo", l2);
-  s2->set_scale(0.1);
-  GuiLabel* l3 = GuiLabel::make_simple_text_label("jackal", font);
-  GuiSign* s3 = new GuiSign("jackal", l3);
-  s3->set_scale(0.1);
-  GuiLabel* l4 = GuiLabel::make_simple_text_label("wolf", font);
-  GuiSign* s4 = new GuiSign("wolf", l4);
-  s4->set_scale(0.1);
-  GuiLabel* l5 = GuiLabel::make_simple_text_label("fox", font);
-  GuiSign* s5 = new GuiSign("fox", l5);
-  s5->set_scale(0.1);
-  float w, w1, w2;
-  w1 = l1->get_width();
-  w2 = l2->get_width();
-  w = (w1>w2)?w1:w2;
-  w2 = l3->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l4->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l5->get_width();
-  w = (w>w2)?w:w2;
-  l1->set_width(w);
-  l2->set_width(w);
-  l3->set_width(w);
-  l4->set_width(w);
-  l5->set_width(w);
-  nl1->set_background_color(0., 0., 0., 1.);
-  nl2->set_background_color(0., 0., 0., 1.);
-  nl3->set_background_color(0., 0., 0., 1.);
-  nl2->set_foreground_color(1., 0., 0., 1.);
-  nl3->set_foreground_color(1., 1., 1., 0.5);
-  pl1->set_background_color(0., 0., 0., 1.);
-  pl2->set_background_color(0., 0., 0., 1.);
-  pl3->set_background_color(0., 0., 0., 1.);
-  pl2->set_foreground_color(1., 0., 0., 1.);
-  pl3->set_foreground_color(1., 1., 1., 0.5);
-  l1->set_background_color(0., 0., 0., 1.);
-  l2->set_background_color(0., 0., 0., 1.);
-  l3->set_background_color(0., 0., 0., 1.);
-  l4->set_background_color(0., 0., 0., 1.);
-  l5->set_background_color(0., 0., 0., 1.);
-  ch1->add_item(s1);
-  ch1->add_item(s2);
-  ch1->add_item(s3);
-  ch1->add_item(s4);
-  ch1->add_item(s5);
-  ch1->thaw();
-  ch1->manage(mgr, event_handler);
-}
-
-static void test15(GuiManager* mgr, Node* font) {
-  GuiLabel* nl1 = GuiLabel::make_simple_text_label("next", font);
-  GuiLabel* nl2 = GuiLabel::make_simple_text_label("next", font);
-  GuiLabel* nl3 = GuiLabel::make_simple_text_label("next", font);
-  GuiButton* nb = new GuiButton("next_button", nl1, nl2, nl3);
-  nb->set_scale(0.1);
-  nb->set_pos(LVector3f::rfu(0.25, 0., -0.25));
-  GuiLabel* pl1 = GuiLabel::make_simple_text_label("prev", font);
-  GuiLabel* pl2 = GuiLabel::make_simple_text_label("prev", font);
-  GuiLabel* pl3 = GuiLabel::make_simple_text_label("prev", font);
-  GuiButton* pb = new GuiButton("prev_button", pl1, pl2, pl3);
-  pb->set_scale(0.1);
-  pb->set_pos(LVector3f::rfu(-0.25, 0., -0.25));
-  nb->set_behavior_event("demo-event-thing");
-  pb->set_behavior_event("demo-event-thing");
-  ch1 = new GuiChooser("chooser", pb, nb);
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("hyena", font);
-  GuiSign* s1 = new GuiSign("hyena", l1);
-  s1->set_scale(0.1);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("dingo", font);
-  GuiSign* s2 = new GuiSign("dingo", l2);
-  s2->set_scale(0.1);
-  GuiLabel* l3 = GuiLabel::make_simple_text_label("jackal", font);
-  GuiSign* s3 = new GuiSign("jackal", l3);
-  s3->set_scale(0.1);
-  GuiLabel* l4 = GuiLabel::make_simple_text_label("wolf", font);
-  GuiSign* s4 = new GuiSign("wolf", l4);
-  s4->set_scale(0.1);
-  GuiLabel* l5 = GuiLabel::make_simple_text_label("fox", font);
-  GuiSign* s5 = new GuiSign("fox", l5);
-  s5->set_scale(0.1);
-  float w, w1, w2;
-  w1 = l1->get_width();
-  w2 = l2->get_width();
-  w = (w1>w2)?w1:w2;
-  w2 = l3->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l4->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l5->get_width();
-  w = (w>w2)?w:w2;
-  l1->set_width(w);
-  l2->set_width(w);
-  l3->set_width(w);
-  l4->set_width(w);
-  l5->set_width(w);
-  nl1->set_background_color(0., 0., 0., 1.);
-  nl2->set_background_color(0., 0., 0., 1.);
-  nl3->set_background_color(0., 0., 0., 1.);
-  nl2->set_foreground_color(1., 0., 0., 1.);
-  nl3->set_foreground_color(1., 1., 1., 0.5);
-  pl1->set_background_color(0., 0., 0., 1.);
-  pl2->set_background_color(0., 0., 0., 1.);
-  pl3->set_background_color(0., 0., 0., 1.);
-  pl2->set_foreground_color(1., 0., 0., 1.);
-  pl3->set_foreground_color(1., 1., 1., 0.5);
-  l1->set_background_color(0., 0., 0., 1.);
-  l2->set_background_color(0., 0., 0., 1.);
-  l3->set_background_color(0., 0., 0., 1.);
-  l4->set_background_color(0., 0., 0., 1.);
-  l5->set_background_color(0., 0., 0., 1.);
-  ch1->add_item(s1);
-  ch1->add_item(s2);
-  ch1->add_item(s3);
-  ch1->add_item(s4);
-  ch1->add_item(s5);
-  ch1->thaw();
-  ch1->manage(mgr, event_handler);
-  ch1->start_behavior();
-}
-
-static void test16(GuiManager* mgr, Node* font) {
-  GuiLabel* nl1 = GuiLabel::make_simple_text_label("next", font);
-  GuiLabel* nl2 = GuiLabel::make_simple_text_label("next", font);
-  GuiLabel* nl3 = GuiLabel::make_simple_text_label("next", font);
-  GuiButton* nb = new GuiButton("next_button", nl1, nl2, nl3);
-  nb->set_scale(0.1);
-  nb->set_pos(LVector3f::rfu(0.25, 0., -0.25));
-  GuiLabel* pl1 = GuiLabel::make_simple_text_label("prev", font);
-  GuiLabel* pl2 = GuiLabel::make_simple_text_label("prev", font);
-  GuiLabel* pl3 = GuiLabel::make_simple_text_label("prev", font);
-  GuiButton* pb = new GuiButton("prev_button", pl1, pl2, pl3);
-  pb->set_scale(0.1);
-  pb->set_pos(LVector3f::rfu(-0.25, 0., -0.25));
-  nb->set_behavior_event("demo-event-thing");
-  pb->set_behavior_event("demo-event-thing");
-  ch1 = new GuiChooser("chooser", pb, nb);
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("hyena", font);
-  GuiSign* s1 = new GuiSign("hyena", l1);
-  s1->set_scale(0.1);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("dingo", font);
-  GuiSign* s2 = new GuiSign("dingo", l2);
-  s2->set_scale(0.1);
-  GuiLabel* l3 = GuiLabel::make_simple_text_label("jackal", font);
-  GuiSign* s3 = new GuiSign("jackal", l3);
-  s3->set_scale(0.1);
-  GuiLabel* l4 = GuiLabel::make_simple_text_label("wolf", font);
-  GuiSign* s4 = new GuiSign("wolf", l4);
-  s4->set_scale(0.1);
-  GuiLabel* l5 = GuiLabel::make_simple_text_label("fox", font);
-  GuiSign* s5 = new GuiSign("fox", l5);
-  s5->set_scale(0.1);
-  float w, w1, w2;
-  w1 = l1->get_width();
-  w2 = l2->get_width();
-  w = (w1>w2)?w1:w2;
-  w2 = l3->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l4->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l5->get_width();
-  w = (w>w2)?w:w2;
-  l1->set_width(w);
-  l2->set_width(w);
-  l3->set_width(w);
-  l4->set_width(w);
-  l5->set_width(w);
-  nl1->set_background_color(0., 0., 0., 1.);
-  nl2->set_background_color(0., 0., 0., 1.);
-  nl3->set_background_color(0., 0., 0., 1.);
-  nl2->set_foreground_color(1., 0., 0., 1.);
-  nl3->set_foreground_color(1., 1., 1., 0.5);
-  pl1->set_background_color(0., 0., 0., 1.);
-  pl2->set_background_color(0., 0., 0., 1.);
-  pl3->set_background_color(0., 0., 0., 1.);
-  pl2->set_foreground_color(1., 0., 0., 1.);
-  pl3->set_foreground_color(1., 1., 1., 0.5);
-  l1->set_background_color(0., 0., 0., 1.);
-  l2->set_background_color(0., 0., 0., 1.);
-  l3->set_background_color(0., 0., 0., 1.);
-  l4->set_background_color(0., 0., 0., 1.);
-  l5->set_background_color(0., 0., 0., 1.);
-  ch1->add_item(s1);
-  ch1->add_item(s2);
-  ch1->add_item(s3);
-  ch1->add_item(s4);
-  ch1->add_item(s5);
-  GuiBackground *bg = new GuiBackground("bg", ch1);
-  bg->set_color(1., 0., 1., 1.);
-  bg->thaw();
-  bg->manage(mgr, event_handler);
-  mgr->recompute_priorities();
-  ch1->start_behavior();
-}
-
-static void test17(GuiManager* mgr, Node* font) {
-  GuiLabel* nl1 = GuiLabel::make_simple_text_label("next", font);
-  GuiLabel* nl2 = GuiLabel::make_simple_text_label("next", font);
-  GuiLabel* nl3 = GuiLabel::make_simple_text_label("next", font);
-  GuiButton* nb = new GuiButton("next_button", nl1, nl2, nl3);
-  nb->set_scale(0.1);
-  nb->set_pos(LVector3f::rfu(0.25, 0., -0.25));
-  GuiLabel* pl1 = GuiLabel::make_simple_text_label("prev", font);
-  GuiLabel* pl2 = GuiLabel::make_simple_text_label("prev", font);
-  GuiLabel* pl3 = GuiLabel::make_simple_text_label("prev", font);
-  GuiButton* pb = new GuiButton("prev_button", pl1, pl2, pl3);
-  pb->set_scale(0.1);
-  pb->set_pos(LVector3f::rfu(-0.25, 0., -0.25));
-  nb->set_behavior_event("demo-event-thing");
-  pb->set_behavior_event("demo-event-thing");
-  ch1 = new GuiChooser("chooser", pb, nb);
-  GuiLabel* l1 = GuiLabel::make_simple_text_label("hyena", font);
-  GuiSign* s1 = new GuiSign("hyena", l1);
-  s1->set_scale(0.1);
-  GuiLabel* l2 = GuiLabel::make_simple_text_label("dingo", font);
-  GuiSign* s2 = new GuiSign("dingo", l2);
-  s2->set_scale(0.1);
-  GuiLabel* l3 = GuiLabel::make_simple_text_label("jackal", font);
-  GuiSign* s3 = new GuiSign("jackal", l3);
-  s3->set_scale(0.1);
-  GuiLabel* l4 = GuiLabel::make_simple_text_label("wolf", font);
-  GuiSign* s4 = new GuiSign("wolf", l4);
-  s4->set_scale(0.1);
-  GuiLabel* l5 = GuiLabel::make_simple_text_label("fox", font);
-  GuiSign* s5 = new GuiSign("fox", l5);
-  s5->set_scale(0.1);
-  float w, w1, w2;
-  w1 = l1->get_width();
-  w2 = l2->get_width();
-  w = (w1>w2)?w1:w2;
-  w2 = l3->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l4->get_width();
-  w = (w>w2)?w:w2;
-  w2 = l5->get_width();
-  w = (w>w2)?w:w2;
-  l1->set_width(w);
-  l2->set_width(w);
-  l3->set_width(w);
-  l4->set_width(w);
-  l5->set_width(w);
-  nl1->set_background_color(0., 0., 0., 1.);
-  nl2->set_background_color(0., 0., 0., 1.);
-  nl3->set_background_color(0., 0., 0., 1.);
-  nl2->set_foreground_color(1., 0., 0., 1.);
-  nl3->set_foreground_color(1., 1., 1., 0.5);
-  pl1->set_background_color(0., 0., 0., 1.);
-  pl2->set_background_color(0., 0., 0., 1.);
-  pl3->set_background_color(0., 0., 0., 1.);
-  pl2->set_foreground_color(1., 0., 0., 1.);
-  pl3->set_foreground_color(1., 1., 1., 0.5);
-  l1->set_background_color(0., 0., 0., 1.);
-  l2->set_background_color(0., 0., 0., 1.);
-  l3->set_background_color(0., 0., 0., 1.);
-  l4->set_background_color(0., 0., 0., 1.);
-  l5->set_background_color(0., 0., 0., 1.);
-  ch1->add_item(s1);
-  ch1->add_item(s2);
-  ch1->add_item(s3);
-  ch1->add_item(s4);
-  ch1->add_item(s5);
-  PT_Node panel = ModelPool::load_model("phase_3/models/props/panel");
-  GuiLabel* bgl = GuiLabel::make_model_label(panel, 0.1, 0.1);
-  GuiBackground *bg = new GuiBackground("bg", ch1, bgl);
-  bg->set_color(1., 0., 1., 1.);
-  bg->thaw();
-  bg->manage(mgr, event_handler);
-  mgr->recompute_priorities();
-  ch1->start_behavior();
-}
-
-static void setup_gui(void) {
-  GuiManager* mgr = GuiManager::get_ptr(main_win, mak, (Node*)0L);
-  PT_Node font = ModelPool::load_model("ttf-comic");
-  // test 1
-  //  test1(mgr, font);
-  // test 2
-  //  test2(mgr, font);
-  // test 3
-  //  test3(mgr, font);
-  // test 4
-  //  test4(mgr, font);
-  // test 5
-  //  test5(mgr, font);
-  // test 6
-  //  test6(mgr, font);
-  // test 7
-  //  test7(mgr, font);
-  //  g_mgr = mgr;
-  // test 8
-  //  test8(mgr, font);
-  //  g_mgr = mgr;
-  // test 9
-  //  test9(mgr, font);
-  //  g_mgr = mgr;
-  // test 10
-  //  test10(mgr, font);
-  // test 11
-  //  test11(mgr, font);
-  // test 12
-  //  test12(mgr, font);
-  // test 13
-  test13(mgr, font);
-  // test 14
-  //  test14(mgr, font);
-  // test 15
-  //  test15(mgr, font);
-  // test 16
-  //  test16(mgr, font);
-  // test 17
-    //  test17(mgr, font);
-}
-
-static void event_2(CPT_Event) {
-  static bool is_setup = false;
-  if (!is_setup) {
-    setup_gui();
-    is_setup = true;
-  }
-}
-
-/*
-// for test 7
-static void event_3(CPT_Event) {
-  if (frame_state) {
-    f1->remove_item(b4);
-    f1->add_item(b5);
-    f1->pack_item(b5, GuiFrame::UNDER, b1);
-    f1->pack_item(b5, GuiFrame::ALIGN_LEFT, b1);
-    b5->manage(g_mgr, event_handler);
-  } else {
-    f1->remove_item(b5);
-    f1->add_item(b4);
-    f1->pack_item(b4, GuiFrame::UNDER, b1);
-    f1->pack_item(b4, GuiFrame::ALIGN_LEFT, b1);
-    b4->manage(g_mgr, event_handler);
-  }
-  f1->recompute();
-  frame_state = !frame_state;
-}
-*/
-
-/*
-// for test 8
-static void event_3(CPT_Event) {
-  if (frame_state) {
-    f1->remove_item(s4);
-    f1->add_item(s5);
-    f1->pack_item(s5, GuiFrame::UNDER, s1);
-    f1->pack_item(s5, GuiFrame::ALIGN_LEFT, s1);
-    s5->manage(g_mgr, event_handler);
-  } else {
-    f1->remove_item(s5);
-    f1->add_item(s4);
-    f1->pack_item(s4, GuiFrame::UNDER, s1);
-    f1->pack_item(s4, GuiFrame::ALIGN_LEFT, s1);
-    s4->manage(g_mgr, event_handler);
-  }
-  f1->recompute();
-  frame_state = !frame_state;
-}
-*/
-
-/*
-// for test 9
-static void event_3(CPT_Event) {
-  if (frame_state) {
-    l4->set_text("fox");
-  } else {
-    l4->set_text("wolf");
-  }
-  f1->recompute();
-  frame_state = !frame_state;
-}
-*/
-
-/*
-// for test 10
-static void event_3(CPT_Event) {
-  if (prior_state) {
-    s1->set_priority(s2, GuiItem::P_High);
-    s2->set_priority(s3, GuiItem::P_High);
-  } else {
-    s1->set_priority(s2, GuiItem::P_Low);
-    s2->set_priority(s3, GuiItem::P_Low);
-  }
-  prior_state = !prior_state;
-}
-*/
-
-// for test 11, 13
-static void event_3(CPT_Event) {
-  lb1->scroll_up();
-  cout << *lb1;
-}
-
-/*
-// for test 12
-static void event_3(CPT_Event) {
-  gb1->inactive();
-}
-*/
-
-/*
-// for test 14-17
-static void event_3(CPT_Event) {
-  ch1->move_prev();
-}
-*/
-
-// for test11, 13
-static void event_4(CPT_Event) {
-  lb1->scroll_down();
-  cout << *lb1;
-}
-
-/*
-// for test 12
-static void event_4(CPT_Event) {
-  gb1->up();
-}
-*/
-
-/*
-// for test 14-17
-static void event_4(CPT_Event) {
-  ch1->move_next();
-}
-*/
-
-static void event_demo(CPT_Event) {
-  cout << "got demo-event-thing event!" << endl;
-}
-
-void gui_keys(EventHandler&) {
-  new RenderRelation( lights, dlight );
-  have_dlight = true;
-
-  event_handler.add_hook("2", event_2);
-  // for tests 7-17
-  event_handler.add_hook("3", event_3);
-  // for test 11-17
-  event_handler.add_hook("4", event_4);
-  event_handler.add_hook("demo-event-thing", event_demo);
-}
-
-int main(int argc, char *argv[]) {
-  define_keys = &gui_keys;
-  return framework_main(argc, argv);
-}