Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4338 in orxonox.OLD for orxonox/trunk/src/lib/gui/gui


Ignore:
Timestamp:
May 27, 2005, 9:16:53 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged branches/physics back to the trunk
merged with command
svn merge -r 3866:HEAD . ../../trunk/
many conflict that i tried to resolv
@patrick: i hope i did not interfere with your stuff :/

Location:
orxonox/trunk/src/lib/gui/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/gui/gui/Makefile.am

    r4266 r4338  
    2525noinst_LIBRARIES = libORXgui.a
    2626
    27 libORXgui_a_CPPFLAGS=$(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS)
     27libORXgui_a_CPPFLAGS = -DBUILD_ORXONOX \
     28                        $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS)
    2829
    2930libORXgui_a_SOURCES = gui.cc \
  • orxonox/trunk/src/lib/gui/gui/Makefile.in

    r4276 r4338  
    200200AM_LDFLAGS = $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
    201201noinst_LIBRARIES = libORXgui.a
    202 libORXgui_a_CPPFLAGS = $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS)
     202libORXgui_a_CPPFLAGS = -DBUILD_ORXONOX \
     203                        $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS)
     204
    203205libORXgui_a_SOURCES = gui.cc \
    204206                      gui_gtk.cc \
  • orxonox/trunk/src/lib/gui/gui/gui_gtk.cc

    r4134 r4338  
    4747bool initGUI(int argc, char *argv[])
    4848{
    49   executable = new char[strlen(argv[0])+1];
    50   strcpy(executable, argv[0]);
     49  if (argv)
     50    {
     51      executable = new char[strlen(argv[0])+1];
     52      strcpy(executable, argv[0]);
     53    }
     54  else
     55    executable = NULL;
    5156
    5257#ifdef HAVE_GTK2
     
    10731078#ifdef HAVE_GTK2
    10741079/**
    1075     \brief Signal OptionChange writes the Value from the Slider to its Object-Database.
    1076     \param widget The widget(Slider) that has a changed Value
    1077     \param slider the Slider-Object that should receive the change.
     1080    \brief Signal OptionChange writes the Value from the Option to its Object-Database.
     1081    \param widget The widget(Option) that has a changed Value
     1082    \param option the Option-Object that should receive the change.
    10781083*/
    10791084gint Option::OptionChange(GtkWidget *widget, Widget* option)
    10801085{
    10811086  static_cast<Option*>(option)->changeOption();
    1082   flags->setTextFromFlags(Window::mainWindow);  //// must be different !!!
     1087#ifdef BUILD_ORXONOX
     1088  flags->setTextFromFlags(Window::mainWindow);
     1089#endif
    10831090}
    10841091#endif /* HAVE_GTK2 */
     
    12421249   \param end The maximal Value of the slider.
    12431250*/
    1244 Slider::Slider(const char* slidername, int start, int end)
    1245 {
    1246   this->optionType = GUI_INT;
     1251Slider::Slider(const char* slidername, float start, float end)
     1252{
     1253  this->optionType = GUI_FLOAT;
    12471254
    12481255  this->start = start;
     
    12681275
    12691276/**
     1277   \brief sets the exactness of the widget
     1278   \param exactness count of digits after the dot
     1279*/
     1280void Slider::setExactness(int exactness)
     1281{
     1282#ifdef HAVE_GTK2
     1283 gtk_scale_set_digits(GTK_SCALE(this->widget), exactness);
     1284#endif /* HAVE_GTK2 */
     1285}
     1286
     1287/**
    12701288   \brief Setting a new value to the Slider.
    12711289   Maybe you also require a Slider::redraw() for this to display
    12721290*/
    1273 void Slider::setValue(int value)
    1274 {
    1275   this->value = value;
     1291void Slider::setValue(float value)
     1292{
     1293  this->fValue = value;
    12761294}
    12771295
     
    12831301{
    12841302#ifdef HAVE_GTK2
    1285   gtk_range_set_value(GTK_RANGE(this->widget), this->value);
     1303  gtk_range_set_value(GTK_RANGE(this->widget), this->fValue);
    12861304#endif /* HAVE_GTK2 */
    12871305}
     
    12931311{
    12941312#ifdef HAVE_GTK2
    1295   this->value =(int)gtk_range_get_value(GTK_RANGE(this->widget));
     1313  this->fValue = gtk_range_get_value(GTK_RANGE(this->widget));
    12961314#else /* HAVE_GTK2 */
    12971315  char tmpChar[20];
     
    12991317  scanf("%s", tmpChar);
    13001318
    1301   if ((this->value = atoi(tmpChar))> this->end)
    1302     this->value = this->end;
    1303   if (this->value <= this->start)
    1304     this->value = this->start;
    1305 
    1306   PRINT(0)("%s set to: %d\n",this->title, this->value);
    1307 #endif /* HAVE_GTK2 */
    1308 }
     1319  if ((this->fValue = atof(tmpChar))> this->end)
     1320    this->fValue = this->end;
     1321  if (this->fValue <= this->start)
     1322    this->fValue = this->start;
     1323
     1324  PRINT(0)("%s set to: %d\n",this->title, this->fValue);
     1325#endif /* HAVE_GTK2 */
     1326}
     1327
     1328char* Slider::save(void)
     1329{
     1330  char* value = new char [30];
     1331  sprintf (value, "%f", this->fValue);
     1332  return value;
     1333}
     1334void Slider::load(char* loadString)
     1335{
     1336  this->fValue = atof(loadString);
     1337  PRINT(5)("Loading %s: %s %f\n", this->title, loadString, fValue);
     1338  this->redraw();
     1339}
     1340
    13091341
    13101342//////////
     
    13871419{
    13881420  MenuItem* tmpItem = this->firstItem;
    1389   for (int i = 0; i<this->value; i++)
    1390     tmpItem = tmpItem->next;
    1391      
    1392   return tmpItem->name;
     1421  for (int i = 0; i < this->value; i++)
     1422    if (tmpItem)
     1423      tmpItem = tmpItem->next;
     1424    else
     1425      break;
     1426  if (tmpItem)
     1427    {
     1428      char* tmpName = new char[strlen(tmpItem->name)+1];
     1429      strcpy(tmpName, tmpItem->name);
     1430      return tmpName;
     1431    }
     1432  else
     1433    return NULL;
    13931434}
    13941435
     
    14711512
    14721513#endif /* HAVE_GTK2 */
    1473   PRINT(5)("%s set to: %d\n", this->title, this->value);
     1514  PRINT(1)("%s set to: %d\n", this->title, this->value);
    14741515}
    14751516
  • orxonox/trunk/src/lib/gui/gui/gui_gtk.h

    r4132 r4338  
    6161
    6262  virtual void setTitle(const char* title);  //!< An abstract Function, that sets the title of Widgets.
     63  virtual const char* getTitle(void) const { return this->title; };
    6364
    6465  Widget* findWidgetByName(char* name, unsigned int depth);
     
    296297{
    297298 private:
    298   int start;                            //!< The beginning of the Slider-range.
    299   int end;                              //!< The end of the Slider-range.
    300  public:
    301   Slider(const char* slidername, int start, int end);
     299  float start;                            //!< The beginning of the Slider-range.
     300  float end;                              //!< The end of the Slider-range.
     301  float fValue;                           //!< a value for the slider
     302 public:
     303  Slider(const char* slidername, float start, float end);
    302304  virtual ~Slider(void);
    303305
    304   void setValue(int value);
    305   virtual void redraw(void);
    306   virtual void changeOption(void);
     306  void setExactness(int exactness);
     307  void setValue(float value);
     308  virtual void redraw(void);
     309  virtual void changeOption(void);
     310
     311  virtual char* save(void);
     312  virtual void load(char* loadString);
    307313};
    308314
Note: See TracChangeset for help on using the changeset viewer.