Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3746 in orxonox.OLD for orxonox/branches/levelloader/src/lib/gui


Ignore:
Timestamp:
Apr 7, 2005, 3:54:49 PM (20 years ago)
Author:
chris
Message:

orxonox/branches/levelloader: Merged trunk into branch… still not working though…

Location:
orxonox/branches/levelloader/src/lib/gui
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/levelloader/src/lib/gui/Makefile.in

    r3605 r3746  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.2 from Makefile.am.
    22# @configure_input@
    33
     
    179179          esac; \
    180180        done; \
    181         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/Makefile'; \
     181        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/Makefile'; \
    182182        cd $(top_srcdir) && \
    183           $(AUTOMAKE) --foreign  src/lib/gui/Makefile
     183          $(AUTOMAKE) --gnu  src/lib/gui/Makefile
    184184.PRECIOUS: Makefile
    185185Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    274274        tags=; \
    275275        here=`pwd`; \
    276         if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
     276        if (etags --etags-include --version) >/dev/null 2>&1; then \
    277277          include_option=--etags-include; \
    278           empty_fix=.; \
    279278        else \
    280279          include_option=--include; \
    281           empty_fix=; \
    282280        fi; \
    283281        list='$(SUBDIRS)'; for subdir in $$list; do \
    284282          if test "$$subdir" = .; then :; else \
    285             test ! -f $$subdir/TAGS || \
     283            test -f $$subdir/TAGS && \
    286284              tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
    287285          fi; \
     
    293291          $(AWK) '    { files[$$0] = 1; } \
    294292               END { for (i in files) print i; }'`; \
    295         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    296           test -n "$$unique" || unique=$$empty_fix; \
    297           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    298             $$tags $$unique; \
    299         fi
     293        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     294          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     295             $$tags $$unique
    300296ctags: CTAGS
    301297CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
  • orxonox/branches/levelloader/src/lib/gui/console/Makefile.in

    r3605 r3746  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.2 from Makefile.am.
    22# @configure_input@
    33
     
    5050CONFIG_HEADER = $(top_builddir)/config.h
    5151CONFIG_CLEAN_FILES =
    52 am__installdirs = "$(DESTDIR)$(bindir)"
     52am__installdirs = $(DESTDIR)$(bindir)
    5353binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
    5454PROGRAMS = $(bin_PROGRAMS)
     
    205205          esac; \
    206206        done; \
    207         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/console/Makefile'; \
     207        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/console/Makefile'; \
    208208        cd $(top_srcdir) && \
    209           $(AUTOMAKE) --foreign  src/lib/gui/console/Makefile
     209          $(AUTOMAKE) --gnu  src/lib/gui/console/Makefile
    210210.PRECIOUS: Makefile
    211211Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    227227install-binPROGRAMS: $(bin_PROGRAMS)
    228228        @$(NORMAL_INSTALL)
    229         test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
     229        $(mkdir_p) $(DESTDIR)$(bindir)
    230230        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    231231          p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
     
    233233          ; then \
    234234            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
    235            echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
    236            $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
     235           echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
     236           $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
    237237          else :; fi; \
    238238        done
     
    242242        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    243243          f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
    244           echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
    245           rm -f "$(DESTDIR)$(bindir)/$$f"; \
     244          echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
     245          rm -f $(DESTDIR)$(bindir)/$$f; \
    246246        done
    247247
     
    299299          $(AWK) '    { files[$$0] = 1; } \
    300300               END { for (i in files) print i; }'`; \
    301         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    302           test -n "$$unique" || unique=$$empty_fix; \
    303           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    304             $$tags $$unique; \
    305         fi
     301        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     302          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     303             $$tags $$unique
    306304ctags: CTAGS
    307305CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     
    358356all-am: Makefile $(PROGRAMS) $(HEADERS)
    359357installdirs:
    360         for dir in "$(DESTDIR)$(bindir)"; do \
    361           test -z "$$dir" || $(mkdir_p) "$$dir"; \
    362         done
     358        $(mkdir_p) $(DESTDIR)$(bindir)
    363359install: install-am
    364360install-exec: install-exec-am
  • orxonox/branches/levelloader/src/lib/gui/gui/Makefile.am

    r3499 r3746  
    2121
    2222#AM_LDFLAGS=$(GTK2_LIBS)   $(GTHREAD_LIBS)
    23 LIBS=$(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
     23AM_LDFLAGS=$(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
    2424
    2525bin_PROGRAMS=gui
  • orxonox/branches/levelloader/src/lib/gui/gui/Makefile.in

    r3605 r3746  
    1 # Makefile.in generated by automake 1.8.5 from Makefile.am.
     1# Makefile.in generated by automake 1.8.2 from Makefile.am.
    22# @configure_input@
    33
     
    5050CONFIG_HEADER = $(top_builddir)/config.h
    5151CONFIG_CLEAN_FILES =
    52 am__installdirs = "$(DESTDIR)$(bindir)"
     52am__installdirs = $(DESTDIR)$(bindir)
    5353binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
    5454PROGRAMS = $(bin_PROGRAMS)
     
    131131LDFLAGS = @LDFLAGS@
    132132LIBOBJS = @LIBOBJS@
    133 
    134 #AM_LDFLAGS=$(GTK2_LIBS)   $(GTHREAD_LIBS)
    135 LIBS = $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
     133LIBS = @LIBS@
    136134LTLIBOBJS = @LTLIBOBJS@
    137135MAKEINFO = @MAKEINFO@
     
    195193MAINSRCDIR = ../../..
    196194AM_CXXFLAGS = $(GTK2_CFLAGS) $(GTHREAD_CFLAGS) $(CURL_CFLAGS) $(MSBITFIELDS) -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/gaphics -I$(MAINSRCDIR)/lib/graphics/font -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai
     195
     196#AM_LDFLAGS=$(GTK2_LIBS)   $(GTHREAD_LIBS)
     197AM_LDFLAGS = $(GTK2_LIBS) $(GTHREAD_LIBS) $(CURL_LIBS)
    197198gui_SOURCES = orxonox_gui.cc \
    198199            orxonox_gui_gtk.cc \
     
    238239          esac; \
    239240        done; \
    240         echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  src/lib/gui/gui/Makefile'; \
     241        echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  src/lib/gui/gui/Makefile'; \
    241242        cd $(top_srcdir) && \
    242           $(AUTOMAKE) --foreign  src/lib/gui/gui/Makefile
     243          $(AUTOMAKE) --gnu  src/lib/gui/gui/Makefile
    243244.PRECIOUS: Makefile
    244245Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
     
    260261install-binPROGRAMS: $(bin_PROGRAMS)
    261262        @$(NORMAL_INSTALL)
    262         test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)"
     263        $(mkdir_p) $(DESTDIR)$(bindir)
    263264        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    264265          p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
     
    266267          ; then \
    267268            f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
    268            echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
    269            $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
     269           echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
     270           $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
    270271          else :; fi; \
    271272        done
     
    275276        @list='$(bin_PROGRAMS)'; for p in $$list; do \
    276277          f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
    277           echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
    278           rm -f "$(DESTDIR)$(bindir)/$$f"; \
     278          echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
     279          rm -f $(DESTDIR)$(bindir)/$$f; \
    279280        done
    280281
     
    338339          $(AWK) '    { files[$$0] = 1; } \
    339340               END { for (i in files) print i; }'`; \
    340         if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
    341           test -n "$$unique" || unique=$$empty_fix; \
    342           $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
    343             $$tags $$unique; \
    344         fi
     341        test -z "$(ETAGS_ARGS)$$tags$$unique" \
     342          || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
     343             $$tags $$unique
    345344ctags: CTAGS
    346345CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
     
    397396all-am: Makefile $(PROGRAMS) $(HEADERS)
    398397installdirs:
    399         for dir in "$(DESTDIR)$(bindir)"; do \
    400           test -z "$$dir" || $(mkdir_p) "$$dir"; \
    401         done
     398        $(mkdir_p) $(DESTDIR)$(bindir)
    402399install: install-am
    403400install-exec: install-exec-am
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui.cc

    r3499 r3746  
    9595
    9696  // Reading Values from File
    97   exec->setFilename("~/.orxonox.conf");
     97  exec->setConfFile("~/.orxonox/orxonox.conf");
    9898  exec->readFromFile(orxonoxGUI);
    9999  // Merging changes to the Options from appended flags.
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_exec.cc

    r3499 r3746  
    2525
    2626#include "orxonox_gui_exec.h"
     27
    2728#include <iostream>
    2829#include <string>
     30
     31#include <sys/stat.h>
     32#include <sys/types.h>
     33
    2934
    3035HashTable* orxonoxFlagHash;
     
    5055  this->saveSettings->saveability();
    5156  this->execBox->fill(this->saveSettings);
    52   this->verboseMode = new Menu("verbose mode", "no output", "error", "warning", "info", "lastItem");
     57  this->verboseMode = new Menu("verbose mode", "nothing", "error", "warning", "info", "lastItem");
    5358  this->verboseMode->setFlagName("verbose", "v", 0);
    5459  this->verboseMode->saveability();
     
    9095
    9196/**
     97   \brief sets the confDir and File-name out of an input-string
     98*/
     99void OrxonoxGuiExec::setConfFile(char* confFile)
     100{
     101  char splitter =
     102#ifdef __WIN32__
     103    '\\';
     104#else
     105  '/';
     106#endif
     107  char* tmpConfFile = new char[strlen(confFile)+1];
     108  strcpy(tmpConfFile, confFile);
     109  char* tmp = strrchr(tmpConfFile, splitter);
     110  if (tmp)
     111    {
     112      tmp[0] = '\0';
     113      this->setConfDir(tmpConfFile);
     114      this->setFileName(tmp+1);
     115    }
     116  else
     117    {
     118      this->setConfDir("~/");
     119      this->setFileName(tmpConfFile);
     120    }
     121  delete []tmp;
     122  delete []tmpConfFile;
     123}
     124
     125/**
     126   \brief sets the Directory of the configuration files
     127   \param confDir the Directory for the configuration files
     128*/
     129void OrxonoxGuiExec::setConfDir(char* confDir)
     130{
     131  if (!strncmp(confDir, "~/", 2))
     132    {
     133      char tmp[500];
     134#ifdef __WIN32__
     135      strcpy(tmp, getenv("USERPROFILE"));
     136#else
     137      strcpy(tmp, getenv("HOME"));
     138#endif
     139      this->confDir = new char[strlen(tmp)+strlen(confDir)];
     140      sprintf(this->confDir, "%s%s", tmp, confDir+1);
     141    }
     142  else
     143    {
     144      this->confDir = new char[strlen(confDir)+1];
     145      strcpy(this->confDir, confDir);
     146    }
     147  PRINTF(3)("Config Directory is: %s.\n", this->confDir);
     148  mkdir(this->confDir, 0755);
     149}
     150
     151/**
    92152   \brief Sets the location of the configuration File.
    93    \param filename the location of the configFile
     153   \param fileName the location of the configFile
    94154
    95155   \todo: memory allocation could be better.
     
    97157   The name will be parsed from ~/ to /home/[username] on unix and c:/Documents and Settings/username/Settings/ on Windows
    98158*/
    99 void OrxonoxGuiExec::setFilename(char* filename)
    100 {
    101   char* buffer = (char*)malloc(2048*sizeof(char));
    102   sprintf(buffer, "%s", filename);
    103   if(!strncmp(buffer, "~/", 2))
    104   {
    105 #ifdef __WIN32__
    106     sprintf(configFile, "%s/%s", getenv("USERPROFILE"), buffer+2);
    107 #else
    108     sprintf(configFile, "%s/%s", getenv("HOME"), buffer+2);
    109 #endif
    110   }
    111   else if(buffer)
    112     strcpy(this->configFile, buffer);
    113   free (buffer);
     159void OrxonoxGuiExec::setFileName(char* fileName)
     160{
     161  if (!this->confDir)
     162    this->setConfDir("~/");
     163  this->configFile = new char[strlen(this->confDir)+strlen(fileName)+2];
     164  sprintf(this->configFile, "%s/%s", this->confDir, fileName);
     165  PRINTF(3)("ConfigurationFile is %s.\n", this->configFile);
    114166}
    115167
     
    117169   \returns The name of the Configuration-File
    118170*/
    119 char* OrxonoxGuiExec::getConfigFile(void)
     171char* OrxonoxGuiExec::getConfigFile(void) const
    120172{
    121173  return this->configFile;
     
    190242            space2under[0] = '_';
    191243          }
    192         if(widget->isOption <=3)
    193           fprintf(CONFIG_FILE, "%s = %d\n", Buffer, static_cast<Option*>(widget)->value);
    194         else if(widget->isOption == 5)
    195           fprintf(CONFIG_FILE, "%s = %s\n", Buffer, static_cast<OptionLabel*>(widget)->cValue);
     244          fprintf(CONFIG_FILE, "%s = %s\n", Buffer, static_cast<Option*>(widget)->save());
    196245      }
    197246
     
    259308    {
    260309      PRINT(3)("Located Option %s.\n", widget->title);
    261       if(widget->isOption >= 1 && widget->isOption <= 3)
    262         {
    263           static_cast<Option*>(widget)->value = atoi(info->variableValue);
    264           static_cast<Option*>(widget)->redraw(); //!< \todo change this to setValue.
    265         }
    266       else if(widget->isOption == 5)
    267         static_cast<OptionLabel*>(widget)->setValue(info->variableValue);
     310      if(widget->isOption >= 1)
     311          static_cast<Option*>(widget)->load(info->variableValue);
    268312    }
    269313}
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_exec.h

    r3499 r3746  
    2222  CheckButton* alwaysShow;     //!< A CheckButton, for if orxonox should start with or without gui.
    2323  Button* quit;                //!< A Button to quit the Gui without starting orxonox.
     24  char* confDir;               //!< The directory of the orxonox-configuration-files.
    2425  char* configFile;            //!< The name of the .orxonox.conf(ig)-file.
    2526  FILE* CONFIG_FILE;           //!< Filehandler for reading and writing.
     
    3738 
    3839  Widget* getWidget(void);
    39  
    40   void setFilename(char* filename);
    41   char* getConfigFile(void);
     40
     41  void setConfFile(char* confFile);
     42  void setConfDir(char* confDir);
     43  void setFileName(char* fileName);
     44  char* getConfigFile(void) const;
    4245  int shouldsave(void);
    4346  void writeToFile(Widget* widget);
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.cc

    r3499 r3746  
    2525
    2626
     27#include "orxonox_gui_gtk.h"
     28
     29#include <stdarg.h>
    2730#include <iostream>
    28 
    29 #include "orxonox_gui_gtk.h"
    3031
    3132
     
    6869#else /* HAVE_GTK2 */
    6970  char boolAns = 'y';
    70   char ans[10];
     71  char ans[10];
     72  PRINT(0)("================================\n");
     73  PRINT(0)("= ORXONOX CONFIGURATION WIZARD =\n");
     74  PRINT(0)("================================    - version:" PACKAGE_VERSION "\n");
     75
    7176  while(true)
    7277    {
    73       PRINT(0)(" Listing all the Orxonox Options: \n");
     78      PRINT(0)("\n Listing all the Orxonox Options: \n");
    7479      PRINT(0)("  #############################\n");
    7580      Window::mainWindow->walkThrough(Widget::listOptionsAndGroups, 1);
     
    122127      //! \todo move this into the gui-gtk-file
    123128      //! \todo finish it.
     129      //! \todo memory leek at save(); and save is a BAD word, use saveString instead, or something like it.
    124130    }
    125131#endif /* HAVE_GTK2 */
     
    133139
    134140/* WIDGET */
    135 
    136 /**
    137    \brief deletes any given Widget
    138    This is still pretty crappy.
    139 */
    140 Widget::~Widget(void)
    141 {
    142   this->destroy();
    143 }
    144 
    145 /**
    146    \brief Initializes a widget.
    147    Initializes the next Pointer and the other Widget-specific Defaults.
    148 */
    149 void Widget::init(void)
     141/**
     142   \brief constructs a Widget
     143*/
     144Widget::Widget(void)
    150145{
    151146  next = NULL;
     
    155150
    156151/**
    157    \brief Destroys a Widget
    158 */
    159 void Widget::destroy(void)
    160 {
    161   if (this->title)
     152   \brief deletes any given Widget
     153   This is still pretty crappy.
     154*/
     155Widget::~Widget(void)
     156{
     157    if (this->title)
    162158    {
    163159      delete []this->title;
     
    172168    delete this->next;
    173169  this->next = NULL;
    174 
    175170  //!  \todo not hiding widget, deleting.
    176171  //  this->hide();
    177172  //  delete this->widget;
     173}
     174
     175/**
     176   \brief sets a new Title to a Widget
     177   \param title The new Title to set to the Widget
     178*/
     179void Widget::setTitle(const char* title)
     180{
     181  if (this->title)
     182    delete []this->title;
     183  this->title = new char[strlen(title)+1];
     184  strcpy(this->title, title);
    178185}
    179186
     
    273280{
    274281  if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
    275     cout << "[" << static_cast<Packer*>(widget)->groupName << "]\n";
    276   if (widget->isOption >= 1 && widget->isOption <= 3)
    277     cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;
    278   else if (widget->isOption == 5)
    279     cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;
     282    PRINT(0)("[%s]\n", static_cast<Packer*>(widget)->groupName);
     283  if (widget->isOption >= 1)
     284    {
     285      Widget::listOptions(widget);
     286    }
    280287}
    281288
     
    286293void Widget::listOptions(Widget* widget)
    287294{
    288   if (widget->isOption >= 1 && widget->isOption <= 3)
    289     cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;
    290   else if (widget->isOption == 5)
    291     cout << "  " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;
     295  if(widget->isOption >= 1)
     296    PRINT(0)("  %s is %s\n", static_cast<Option*>(widget)->title, static_cast<Option*>(widget)->save());
    292297}
    293298
     
    300305{
    301306 
    302   if (widget->isOption >= 1 && widget->isOption <= 3)
     307  if (widget->isOption >= 1)
    303308    {
    304309      int* count =(int*)data;
    305310      *count = *count +1;
    306       cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;
    307     }
    308   else if (widget->isOption == 5)
    309     {
    310       int* count =(int*)data;
    311       *count = *count +1;
    312       cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;
     311      PRINT(0)(" %d:%s is %s\n", *count, static_cast<Option*>(widget)->title, static_cast<Option*>(widget)->save());
    313312    }
    314313}
     
    513512
    514513/* PACKERS */
    515 
    516 /**
    517    \brief Initializes a Packer.
    518 
    519    Sets the down-pinter to NULL and other PackerSpecific-values to their defaults.
    520 */
    521 void Packer::init(void)
     514/**
     515   \brief Constructs a Packer
     516*/
     517Packer::Packer(void)
    522518{
    523519  this->down = NULL;
    524520  this->groupName = NULL;
    525 
    526 
    527   static_cast<Widget*>(this)->init();
    528   return;
    529521}
    530522
     
    532524   \brief Destroys a Packer.
    533525*/
    534 void Packer::destroy(void)
     526Packer::~Packer(void)
    535527{
    536528  PRINTF(4)("deleting the Packer part.\n");
     
    543535    delete this->down;
    544536  this->down = NULL;
    545 
    546   static_cast<Widget*>(this)->destroy();
    547537}
    548538
     
    575565   sets the Container-Specific defaults.
    576566*/
    577 void Container::init(void)
     567Container::Container(void)
    578568{
    579569  this->isOption = -1;
    580 
    581   static_cast<Packer*>(this)->init();
    582 
    583   return;
    584570}
    585571
     
    587573   \brief Destroys a Container.
    588574*/
    589 void Container::destroy(void)
     575Container::~Container(void)
    590576{
    591577  PRINTF(4)("deleting the Container part.\n");
    592 
    593   static_cast<Packer*>(this)->destroy();
    594578}
    595579
     
    665649Window::~Window(void)
    666650{
    667   this->destroy();
     651  if (this->title)
     652    PRINTF(3)("deleting the Window: %s\n", this->title);
     653  else
     654    PRINTF(3)("deleting the Window.\n");
     655  //  this->hide();
    668656}
    669657
     
    677665 
    678666  isOpen = false;
    679 
    680   static_cast<Container*>(this)->init();
    681667
    682668#ifdef HAVE_GTK2
     
    691677
    692678/**
    693    \brief Destroys a Window.
    694 */
    695 void Window::destroy(void)
    696 {
    697   if (this->title)
    698     PRINTF(3)("deleting the Window: %s\n", this->title);
    699   else
    700     PRINTF(3)("deleting the Window.\n");
    701   //  this->hide();
    702   static_cast<Container*>(this)->destroy();
    703  
    704 }
    705 
    706 /**
    707679   \brief Shows all Widgets that are included within this->widget.
    708680*/
     
    730702   \param title title the Window should get.
    731703*/
    732 void Window::setTitle(char* title)
     704void Window::setTitle(const char* title)
    733705{
    734706  if (this->title)
     
    823795Frame::~Frame(void)
    824796{
    825   this->destroy();
    826 }
    827 
    828 /**
    829     \brief Initializes a new Frame with default settings
    830 */
    831 void Frame::init(void)
    832 {
    833   static_cast<Container*>(this)->init();
    834 
    835 #ifdef HAVE_GTK2
    836   this->widget = gtk_frame_new("");
    837   gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
    838 #endif /* HAVE_GTK2 */
    839 }
    840 
    841 /**
    842    \brief Destroys a Frame.
    843 */
    844 void Frame::destroy(void)
    845 {
    846797  if (this->title)
    847798    PRINTF(3)("deleting the Frame: %s\n", this->title);
    848799  else
    849800    PRINTF(3)("deleting the Frame.\n");
    850 
    851    static_cast<Container*>(this)->destroy();
     801}
     802
     803/**
     804    \brief Initializes a new Frame with default settings
     805*/
     806void Frame::init(void)
     807{
     808#ifdef HAVE_GTK2
     809  this->widget = gtk_frame_new("");
     810  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
     811#endif /* HAVE_GTK2 */
    852812}
    853813
     
    856816   \param title The title the Frame should get.
    857817*/
    858 void Frame::setTitle(char* title)
     818void Frame::setTitle(const char* title)
    859819{
    860820  if (this->title)
     
    892852EventBox::~EventBox(void)
    893853{
    894   this->destroy();
    895 
    896 }
    897 
    898 /**
    899    \brief Initializes a new EventBox
    900 */
    901 void EventBox::init(void)
    902 {
    903   this->isOption = -1;
    904 
    905   static_cast<Container*>(this)->init();
    906 
    907 #ifdef HAVE_GTK2
    908   this->widget = gtk_event_box_new();
    909   gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
    910 #endif /* HAVE_GTK2 */
    911 }
    912 
    913 /**
    914    \brief Destroys an EventBox.
    915 */
    916 void EventBox::destroy(void)
    917 {
    918854  if (this->title)
    919855    PRINTF(3)("deleting the EventBox: %s\n", this->title);
    920856  else
    921857    PRINTF(3)("deleting the EventBox.\n");
    922 
    923   static_cast<Container*>(this)->destroy();
    924 }
    925 
    926 /**
    927    \brief Sets the Title of the EventBox(not implemented)
    928    \param title Name the EventBox should get(only datastructure-internal).
    929 */
    930 void EventBox::setTitle(char* title)
    931 {
    932   if (this->title)
    933     delete []this->title;
    934   this->title = new char[strlen(title)+1];
    935   strcpy(this->title, title);
     858}
     859
     860/**
     861   \brief Initializes a new EventBox
     862*/
     863void EventBox::init(void)
     864{
     865  this->isOption = -1;
     866
     867#ifdef HAVE_GTK2
     868  this->widget = gtk_event_box_new();
     869  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
     870#endif /* HAVE_GTK2 */
    936871}
    937872
     
    960895Box::~Box(void)
    961896{
    962   this->destroy();
    963 }
    964 
    965 /**
    966    \brief Initializes a new Box with type boxtype
    967    \param boxtype see Box(char boxtype)
    968 */
    969 void Box::init(char boxtype)
    970 {
    971   this->isOption = -2;
    972 
    973   static_cast<Packer*>(this)->init();
    974 #ifdef HAVE_GTK2
    975   if (boxtype == 'v')
    976     {
    977       this->widget = gtk_vbox_new(FALSE, 0);
    978     }
    979   else
    980     {
    981       this->widget = gtk_hbox_new(FALSE, 0);
    982     }
    983 #endif /* HAVE_GTK2 */
    984 }
    985 
    986 /**
    987    \brief Destroys a Box.
    988 */
    989 void Box::destroy(void)
    990 {
    991897  if (this->title)
    992898    PRINTF(3)("deleting the Box: %s\n", this->title);
     
    994900    PRINTF(3)("deleting the Box.\n");
    995901
    996   static_cast<Packer*>(this)->destroy();
     902}
     903
     904/**
     905   \brief Initializes a new Box with type boxtype
     906   \param boxtype see Box(char boxtype)
     907*/
     908void Box::init(char boxtype)
     909{
     910  this->isOption = -2;
     911
     912#ifdef HAVE_GTK2
     913  if (boxtype == 'v')
     914    {
     915      this->widget = gtk_vbox_new(FALSE, 0);
     916    }
     917  else
     918    {
     919      this->widget = gtk_hbox_new(FALSE, 0);
     920    }
     921#endif /* HAVE_GTK2 */
    997922}
    998923
     
    1022947}
    1023948
    1024 /**
    1025    \brief Sets the Title of a Box.
    1026    \param title the new Title to set.
    1027 */
    1028 void Box::setTitle(char* title)
    1029 {
    1030   if (this->title)
    1031     delete []this->title;
    1032   this->title = new char[strlen(title)+1];
    1033   strcpy(this->title, title);
    1034 }
    1035 
    1036949/* OPTION */
    1037950
     
    1040953   sets all Option-Specific-Values to their defaults.
    1041954*/
    1042 void Option::init(void)
     955Option::Option(void)
    1043956{
    1044957  this->value = 0;
     
    1047960  this->saveable = false;
    1048961  this->defaultValue = 0;
    1049 
    1050   static_cast<Widget*>(this)->init();
    1051 
    1052   return;
    1053962}
    1054963
     
    1056965   \brief Destroys an Option.
    1057966*/
    1058 void Option::destroy(void)
     967Option::~Option(void)
    1059968{
    1060969  PRINTF(4)("deleting the Option Part.\n");
     
    1063972  if (this->flagNameShort)
    1064973    delete []this->flagNameShort;
    1065 
    1066   static_cast<Widget*>(this)->destroy();
    1067974}
    1068975
     
    11231030
    11241031/**
     1032   \brief saves an Option
     1033   \returns the String that should be saved.
     1034
     1035   this is a default Option save
     1036*/
     1037char* Option::save(void)
     1038{
     1039  char* value = new char [10];
     1040  sprintf (value, "%d", this->value);
     1041  return value;
     1042}
     1043
     1044/**
     1045   \brief loads an Option from of its loadString
     1046   \param loadString the string from which to load the data from
     1047*/
     1048void Option::load(char* loadString)
     1049{
     1050  this->value = atoi(loadString);
     1051  PRINT(3)("Loading %s: %s %d\n", this->title, loadString, value);
     1052  this->redraw();
     1053}
     1054
     1055/**
    11251056   \returns The saveable-state.
    11261057*/
     
    11611092Button::~Button(void)
    11621093{
    1163   this->destroy();
    1164 }
    1165 
    1166 /**
    1167    \brief Initializes a new Button
    1168 */
    1169 void Button::init(void)
    1170 {
    1171   isOption = 0;
    1172 
    1173   static_cast<Option*>(this)->init();
    1174 
    1175 #ifdef HAVE_GTK2
    1176   widget = gtk_button_new_with_label("");
    1177 #endif /* HAVE_GTK2 */
    1178 }
    1179 
    1180 /**
    1181    \brief Destroys a Button.
    1182 */
    1183 void Button::destroy(void)
    1184 {
    11851094  if (this->title)
    11861095    PRINTF(3)("deleting the Label: %s\n", this->title);
     
    11881097    PRINTF(3)("deleting the Label.\n");
    11891098
    1190   static_cast<Option*>(this)->destroy();
     1099}
     1100
     1101/**
     1102   \brief Initializes a new Button
     1103*/
     1104void Button::init(void)
     1105{
     1106  isOption = 0;
     1107
     1108#ifdef HAVE_GTK2
     1109  widget = gtk_button_new_with_label("");
     1110#endif /* HAVE_GTK2 */
    11911111}
    11921112
     
    11951115   \param title The name the Button should get
    11961116*/
    1197 void Button::setTitle(char *title)
     1117void Button::setTitle(const char *title)
    11981118{
    11991119  if (this->title)
     
    12451165CheckButton::~CheckButton(void)
    12461166{
    1247   this->destroy();
    1248 }
    1249 
    1250 /**
    1251    \brief Initialize a new CheckButton with default settings
    1252 */
    1253 void CheckButton::init(void)
    1254 {
    1255   this->isOption = 1;
    1256 
    1257   static_cast<Option*>(this)->init();
    1258 
    1259 #ifdef HAVE_GTK2
    1260   this->widget = gtk_check_button_new_with_label("");
    1261 #endif /* HAVE_GTK2 */
    1262 }
    1263 
    1264 /**
    1265    \brief Destroys a CheckButton.
    1266 */
    1267 void CheckButton::destroy(void)
    1268 {
    12691167  if (this->title)
    12701168    PRINTF(3)("deleting the CheckButton: %s\n", this->title);
    12711169  else
    12721170    PRINTF(3)("deleting the CheckButton.\n");
    1273 
    1274   static_cast<Option*>(this)->destroy();
     1171}
     1172
     1173/**
     1174   \brief Initialize a new CheckButton with default settings
     1175*/
     1176void CheckButton::init(void)
     1177{
     1178  this->isOption = 1;
     1179
     1180#ifdef HAVE_GTK2
     1181  this->widget = gtk_check_button_new_with_label("");
     1182#endif /* HAVE_GTK2 */
    12751183}
    12761184
     
    12791187   \param title The new Name the CheckButton should display.
    12801188*/
    1281 void CheckButton::setTitle(char* title)
     1189void CheckButton::setTitle(const char* title)
    12821190{
    12831191  if (this->title)
     
    13061214#else /* HAVE_GTK2 */
    13071215  char tmpChar[20];
    1308   cout << "\nPlease give me a new value for " << this->title << " [0,1](defualt:" << this->defaultValue << "): ";
     1216  cout << "\nPlease give me a new value for " << this->title << " [0,1](default:" << this->defaultValue << "): ";
    13091217  cin >> tmpChar;
    13101218
     
    13501258Slider::~Slider(void)
    13511259{
    1352   this->destroy();
    1353 }
    1354 
    1355 /**
    1356    \brief Initializes a Slider with start and end Values
    1357    params: see Slider::Slider(char* slidername, int start, int end)
    1358 */
    1359 void Slider::init(int start, int end)
    1360 {
    1361   this->isOption = 2;
    1362 
    1363   static_cast<Option*>(this)->init();
    1364 
    1365   this->start = start;
    1366   this->end = end;
    1367 #ifdef HAVE_GTK2
    1368  widget = gtk_hscale_new_with_range(this->start, this->end, 5);
    1369 #endif /* HAVE_GTK2 */
    1370 }
    1371 
    1372 /**
    1373    \brief Destroys a Slider.
    1374 */
    1375 void Slider::destroy(void)
    1376 {
    13771260  if (this->title)
    13781261    PRINTF(3)("deleting the Slider: %s\n", this->title);
    13791262  else
    13801263    PRINTF(3)("deleting the Slider.\n");
    1381 
    1382   static_cast<Option*>(this)->destroy();
    1383 
    1384 }
    1385 
    1386 /**
    1387    \brief Sets a new Title to the Slider
    1388    \param title The new Name of the slider
    1389 */
    1390 void Slider::setTitle(char* title)
    1391 {
    1392   if (this->title)
    1393     delete []this->title;
    1394   this->title = new char[strlen(title)+1];
    1395   strcpy(this->title, title);
     1264}
     1265
     1266/**
     1267   \brief Initializes a Slider with start and end Values
     1268   params: see Slider::Slider(char* slidername, int start, int end)
     1269*/
     1270void Slider::init(int start, int end)
     1271{
     1272  this->isOption = 2;
     1273
     1274  this->start = start;
     1275  this->end = end;
     1276#ifdef HAVE_GTK2
     1277 widget = gtk_hscale_new_with_range(this->start, this->end, 5);
     1278#endif /* HAVE_GTK2 */
    13961279}
    13971280
     
    14251308#else /* HAVE_GTK2 */
    14261309  char tmpChar[20];
    1427   cout << "\nPlease give me a new value for " << this->title << " [" <<this->start << "-" << this->end << "](defualt:" << this->defaultValue << "): ";
     1310  cout << "\nPlease give me a new value for " << this->title << " [" <<this->start << "-" << this->end << "](default:" << this->defaultValue << "): ";
    14281311  cin >> tmpChar;
    14291312
     
    14371320
    14381321/* MENU */
     1322
     1323/**
     1324   \brief constructs a new Menu, without adding any items to it.
     1325   \param menuName the Name the Menu gets.
     1326*/
     1327Menu::Menu(const char* menuName)
     1328{
     1329  this->init();
     1330  this->setTitle(menuName);
     1331}
    14391332
    14401333/**
     
    14481341  this->init();
    14491342  this->setTitle(menuname);
    1450    
     1343  va_list itemlist;                     //!< The list to readin multiple Options.
     1344
    14511345  char *itemName;
    14521346
    1453 #ifdef HAVE_GTK2             /////////////////////// REINPLEMENT
    14541347  va_start(itemlist, menuname);
    14551348  while(strcmp(itemName = va_arg(itemlist, char*), "lastItem"))
     
    14581351    }
    14591352  va_end(itemlist);
    1460 #endif /* HAVE_GTK2 */
    1461 
    1462 #ifdef HAVE_GTK2
    1463   gtk_option_menu_set_menu(GTK_OPTION_MENU(this->widget), menu);
    1464   this->connectSignal("changed", this->OptionChange);
    1465 #endif /* HAVE_GTK2 */
    14661353}
    14671354
     
    14711358Menu::~Menu(void)
    14721359{
    1473   this->destroy();
    1474 }
    1475 
    1476 /**
    1477    \brief Initializes a new Menu with no items
    1478 */
    1479 void Menu::init(void)
    1480 {
    1481   this->isOption = 2;
    1482 
    1483   static_cast<Option*>(this)->init();
    1484 
    1485 #ifdef HAVE_GTK2
    1486   this->widget = gtk_option_menu_new();
    1487   this->menu = gtk_menu_new();
    1488 #endif /* HAVE_GTK2 */
    1489 
    1490 }
    1491 
    1492 /**
    1493    \brief Destroys a Menu.
    1494 */
    1495 void Menu::destroy(void)
    1496 {
    14971360  if (this->title)
    14981361    PRINTF(3)("deleting the Menu: %s\n", this->title);
     
    15001363    PRINTF(3)("deleting the Menu.\n");
    15011364  //! \todo destroy menu
    1502  
    1503   static_cast<Option*>(this)->destroy();
    1504 }
    1505 
    1506 
    1507 /**
    1508  * Sets the Database-Name of this Menu
    1509  \param title Database-Name to be set.
    1510 */
    1511 void Menu::setTitle(char* title)
    1512 {
    1513   if (this->title)
    1514     delete []this->title;
    1515   this->title = new char[strlen(title)+1];
    1516   strcpy(this->title, title);
     1365  this->currItem = this->firstItem;
     1366  while(this->currItem)
     1367    {
     1368      delete []this->currItem->name;
     1369      /*
     1370        #ifdef HAVE_GTK2
     1371        free(this->currItem->item);
     1372        #endif /* HAVE_GTK2 */
     1373      MenuItem* tmpItem = this->currItem;
     1374      this->currItem = this->currItem->next;
     1375      delete tmpItem;
     1376    }
     1377}
     1378
     1379/**
     1380   \brief Initializes a new Menu with no items
     1381*/
     1382void Menu::init(void)
     1383{
     1384  this->isOption = 2;
     1385  this->firstItem = NULL;
     1386
     1387#ifdef HAVE_GTK2
     1388  this->widget = gtk_option_menu_new();
     1389  this->menu = gtk_menu_new();
     1390  gtk_option_menu_set_menu(GTK_OPTION_MENU(this->widget), menu);
     1391  this->connectSignal("changed", this->OptionChange);
     1392#endif /* HAVE_GTK2 */
     1393}
     1394
     1395/**
     1396   \brief saves the Label of the Menu
     1397   \returns the name of the selected Menu-Item
     1398*/
     1399char* Menu::save(void)
     1400{
     1401  MenuItem* tmpItem = this->firstItem;
     1402  for (int i = 0; i<this->value; i++)
     1403    tmpItem = tmpItem->next;
     1404     
     1405  return tmpItem->name;
     1406}
     1407
     1408/**
     1409   \brief loads a Menu from of its loadString
     1410   \param loadString the string from which to load the data from
     1411*/
     1412void Menu::load(char* loadString)
     1413{
     1414  MenuItem* tmpItem = firstItem;
     1415  bool foundItem = false;
     1416  while (tmpItem)
     1417    {
     1418      if (!strcmp(loadString, tmpItem->name))
     1419        {foundItem = true; break;}
     1420      tmpItem = tmpItem->next;
     1421    }
     1422  if (foundItem)
     1423    this->value = tmpItem->itemNumber;
     1424  else
     1425    {
     1426      this->value = 0;
     1427      PRINTF(2)("Sorry, but %s has not been found in the Itemlist of %s\n", loadString, this->title);
     1428    }
     1429  PRINTF(3)( "Loading %s: setting to %d\n", this->title, this->value);
     1430  this->redraw();
    15171431}
    15181432
     
    15201434   \brief appends a new Item to the Menu-List.
    15211435   \param itemName the itemName to be appendet.
    1522 
    1523    \todo make the item-list readable without GTK
    15241436*/
    15251437void Menu::addItem(char* itemName)
    15261438{
    1527 #ifdef HAVE_GTK2
    1528   this->item = gtk_menu_item_new_with_label(itemName);
    1529   gtk_menu_shell_append(GTK_MENU_SHELL(this->menu), this->item);
    1530 #endif /* HAVE_GTK2 */
     1439  if (!this->firstItem)
     1440    {
     1441      this->firstItem = this->currItem = new MenuItem;
     1442      this->currItem->itemNumber = 0;
     1443    }
     1444  else
     1445    {
     1446      int tmpI = this->currItem->itemNumber;
     1447      this->currItem = this->currItem->next = new MenuItem;
     1448      this->currItem->itemNumber = tmpI+1;
     1449    }
     1450
     1451  this->currItem->name = new char[strlen(itemName)+1];
     1452  strcpy(this->currItem->name, itemName);
     1453
     1454#ifdef HAVE_GTK2
     1455  this->currItem->item = gtk_menu_item_new_with_label(itemName);
     1456  gtk_menu_shell_append(GTK_MENU_SHELL(this->menu), this->currItem->item);
     1457#endif /* HAVE_GTK2 */
     1458  this->currItem->next = NULL;
    15311459}
    15321460
     
    15511479#else /* HAVE_GTK2 */
    15521480  char tmpChar[20];
    1553   cout << "\nPlease give me a new value for " << this->title << "(defualt:" << this->defaultValue << "): ";
     1481  cout << "\nPlease give me a new value for " << this->title << "(default:" << this->defaultValue << "): ";
    15541482  cin >> tmpChar;
    15551483  this->value = atoi(tmpChar);
     
    15781506OptionLabel::~OptionLabel(void)
    15791507{
    1580   this->destroy();
    1581 }
    1582 
    1583 /**
    1584    \brief Initializes an OptionLabel
    1585 */
    1586 void OptionLabel::init(void)
    1587 {
    1588   this->isOption = 5;
    1589   static_cast<Option*>(this)->init();
    1590 
    1591   cValue = NULL;
    1592 
    1593 #ifdef HAVE_GTK2
    1594   this->widget = gtk_label_new("");
    1595 #endif /* HAVE_GTK2 */
    1596 }
    1597 
    1598 /**
    1599    \brief Destroys a OptionLabel.
    1600 */
    1601 void OptionLabel::destroy(void)
    1602 {
    16031508  if (this->title)
    16041509    PRINTF(3)("deleting the OptionLabel: %s\n", this->title);
     
    16071512  if (this->cValue)
    16081513    delete []this->cValue;
    1609 
    1610   static_cast<Option*>(this)->destroy();
    1611 }
    1612 
     1514}
     1515
     1516/**
     1517   \brief Initializes an OptionLabel
     1518*/
     1519void OptionLabel::init(void)
     1520{
     1521  this->isOption = 5;
     1522  cValue = NULL;
     1523
     1524#ifdef HAVE_GTK2
     1525  this->widget = gtk_label_new("");
     1526#endif /* HAVE_GTK2 */
     1527}
    16131528
    16141529/**
     
    16281543
    16291544/**
    1630    \brief Sets a ned Title to the OptionLabel.
    1631    \param title The now title of the OptionLabel.
    1632 */
    1633 void OptionLabel::setTitle(char* title)
    1634 {
    1635   if (this->title)
    1636     delete []this->title;
    1637   this->title = new char [strlen(title)+1];
    1638   strcpy(this->title, title);
    1639   this->redraw();
    1640 }
    1641 
    1642 /**
    16431545   \brief Redraws an OptionLabel(not implemented yet, but it works).
    16441546*/
     
    16661568
    16671569/**
     1570   \brief creates the Optionlabel save-string
     1571   \returns the String to save.
     1572*/
     1573char* OptionLabel::save(void)
     1574{
     1575  return cValue;
     1576}
     1577
     1578/**
     1579   \brief loads an Option from of its loadString
     1580   \param loadString the string from which to load the data from
     1581*/
     1582void OptionLabel::load(char* loadString)
     1583{
     1584  PRINTF(3)( "Loading %s: setting to %s\n", this->title, loadString);
     1585  this->setValue(loadString);
     1586}
     1587
     1588/**
    16681589   \brief Creates a new default Label with no Text.
    16691590   You migth consider adding Label::setTitle with this.
     
    16891610Label::~Label(void)
    16901611{
    1691   this->destroy();
    1692 }
    1693 
    1694 /**
    1695    \brief initializes a new Label
    1696 */
    1697 void Label::init(void)
    1698 {
    1699   this->isOption = 0;
    1700 
    1701   static_cast<Widget*>(this)->init();
    1702 
    1703 #ifdef HAVE_GTK2
    1704   this->widget = gtk_label_new("");
    1705   gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE);
    1706 #endif /* HAVE_GTK2 */
    1707 }
    1708 
    1709 /**
    1710    \brief Destroys a Label.
    1711 */
    1712 void Label::destroy(void)
    1713 {
    17141612  if (this->title)
    17151613    PRINTF(3)("deleting the Label: %s\n", this->title);
    17161614  else
    17171615    PRINTF(3)("deleting the Label.\n");
    1718 
    1719   static_cast<Widget*>(this)->destroy();
     1616}
     1617
     1618/**
     1619   \brief initializes a new Label
     1620*/
     1621void Label::init(void)
     1622{
     1623  this->isOption = 0;
     1624
     1625#ifdef HAVE_GTK2
     1626  this->widget = gtk_label_new("");
     1627  gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE);
     1628#endif /* HAVE_GTK2 */
    17201629}
    17211630
     
    18131722ProgressBar::~ProgressBar(void)
    18141723{
    1815   this->destroy();
     1724  if (this->title)
     1725    PRINTF(3)("deleting the ProgressBar: %s\n", this->title);
     1726  else
     1727    PRINTF(3)("deleting the ProgressBar.\n");
    18161728}
    18171729
     
    18251737  this->totalSize = 0.0;
    18261738
    1827   static_cast<Widget*>(this)->init();
    18281739#ifdef HAVE_GTK2
    18291740  this->adjustment =(GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0);
    18301741  this->widget = gtk_progress_bar_new_with_adjustment(this->adjustment);
    18311742#endif /* HAVE_GTK2 */
    1832 }
    1833 
    1834 /**
    1835    \brief Destroys a ProgressBar.
    1836 */
    1837 void ProgressBar::destroy(void)
    1838 {
    1839   if (this->title)
    1840     PRINTF(3)("deleting the ProgressBar: %s\n", this->title);
    1841   else
    1842     PRINTF(3)("deleting the ProgressBar.\n");
    1843 
    1844   static_cast<Widget*>(this)->destroy();
    1845 }
    1846 
    1847 /**
    1848    \brief Sets a ned Title to the ProgressBar.
    1849    \param title The now title of the ProgressBar.
    1850 */
    1851 void ProgressBar::setTitle(char* title)
    1852 {
    1853   if (this->title)
    1854     delete []this->title;
    1855   this->title = new char [strlen(title)+1];
    1856   strcpy(this->title, title);
    18571743}
    18581744
     
    19131799Image::~Image(void)
    19141800{
    1915   this->destroy();
    1916 }
    1917 
    1918 /**
    1919     \brief Initializes a new Image
    1920 */
    1921 void Image::init(void)
    1922 {
    1923   isOption = 0;
    1924 
    1925   static_cast<Widget*>(this)->init();
    1926 }
    1927 
    1928 /**
    1929    \brief Destroys a Image.
    1930 */
    1931 void Image::destroy(void)
    1932 {
    19331801  if (this->title)
    19341802    PRINTF(3)("deleting the Image: %s\n", this->title);
    19351803  else
    19361804    PRINTF(3)("deleting the Image.\n");
    1937 
    1938   static_cast<Widget*>(this)->destroy();
    1939 }
    1940 
    1941 /**
    1942    \brief Sets a ned Title to the Image.
    1943    \param title The now title of the OptionLabel.
    1944 */
    1945 void Image::setTitle(char* title)
    1946 {
    1947   if (this->title)
    1948     delete []this->title;
    1949   this->title = new char [strlen(title)+1];
    1950   strcpy(this->title, title);
    1951 }
     1805}
     1806
     1807/**
     1808    \brief Initializes a new Image
     1809*/
     1810void Image::init(void)
     1811{
     1812  isOption = 0;
     1813}
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_gtk.h

    r3605 r3746  
    3939
    4040 public:
     41  Widget(void);
    4142  virtual ~Widget(void);
    42   void init(void);
    43   void destroy(void);
    4443
    4544  void show(void);
    4645  void hide(void);
    4746  void setSize(int width, int height);
    48   virtual void setTitle(char* title) = 0;  //!< An abstract Function, that sets the title of Widgets.
     47  virtual void setTitle(const char* title);  //!< An abstract Function, that sets the title of Widgets.
    4948
    5049  Widget* findWidgetByName(char* name, unsigned int depth);
     
    9089{
    9190 public:
     91  Packer(void);
     92  virtual ~Packer(void);
     93
    9294  Widget* down; //!< this points to the Widget below this.
    9395  char* groupName; //!< For each Packer you can specify a Groupname under which the lowerWidgets will be saved.
    94 
    95   void init(void);
    96   void destroy(void);
    9796
    9897  void setGroupName(char* name);
     
    115114 
    116115 public:
    117   void init(void);
    118   void destroy(void);
    119 
     116  Container(void);
     117  virtual ~Container(void);
    120118  //  void setBorderWidth(int borderwidth);
    121   //  virtual void setTitle(char* title) = 0;
    122119  void fill(Widget* lowerWidget);
    123120};
     
    138135  Window(void);
    139136  Window(char* windowName);
    140   ~Window(void);
    141   void init(void);
    142   void destroy(void);
    143  
    144   void setTitle(char* title);
     137  virtual ~Window(void);
     138  void init(void);
     139 
     140  void setTitle(const char* title);
    145141  void showall(void);
    146142  void open(void);
     
    164160  Frame(void);
    165161  Frame(char* frameName);
    166   ~Frame(void);
    167   void init(void);
    168   void destroy(void);
    169  
    170   void setTitle(char* title);
     162  virtual ~Frame(void);
     163  void init(void);
     164
     165  void setTitle(const char* title);
    171166};
    172167
     
    180175  EventBox(void);
    181176  EventBox(char* eventBoxName);
    182   ~EventBox(void);
    183   void init(void);
    184   void destroy(void);
    185  
    186   void setTitle(char* title);
     177  virtual ~EventBox(void);
     178  void init(void);
    187179};
    188180
     
    198190  Box(void);
    199191  Box(char boxtype);
    200   ~Box(void);
     192  virtual ~Box(void);
    201193  void init(char boxtype);
    202   void destroy(void);
    203194 
    204195  void fill(Widget* lowerWidget);
    205 
    206   void setTitle(char* title);
    207196};
    208197
     
    217206 
    218207 public:
    219   void init(void);
    220   void destroy(void);
     208  Option(void);
     209  virtual ~Option(void);
     210  void init(void);
    221211
    222212  int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume
     
    227217  void saveability(void);
    228218  void saveability(bool isSaveable);
     219  virtual char* save(void);
     220  virtual void load(char* loadString);
     221
    229222  bool isSaveable(void);
    230223  void setFlagName(char* flagname, int defaultvalue);
     
    246239 public:
    247240  Button(char* buttonname);
    248   ~Button(void);
    249   void init(void);
    250   void destroy(void);
    251 
    252   void setTitle(char* title);
     241  virtual ~Button(void);
     242  void init(void);
     243
     244  void setTitle(const char* title);
    253245  void redraw(void);
    254246  void changeOption(void);
     
    262254 public:
    263255  CheckButton(char* buttonname);
    264   ~CheckButton(void);
    265   void init(void);
    266   void destroy(void);
    267 
    268   void setTitle(char* title);
     256  virtual ~CheckButton(void);
     257  void init(void);
     258
     259  void setTitle(const char* title);
    269260  bool isActive(void);           //!< a Bool value to see, if this CheckButton is active.
    270261  void redraw(void);
     
    283274 public:
    284275  Slider(char* slidername, int start, int end);
    285   ~Slider(void);
     276  virtual ~Slider(void);
    286277  void init(int start, int end);
    287   void destroy(void);
    288 
    289   void setTitle(char* title);
     278
    290279  void setValue(int value);
    291280  void redraw(void);
     
    299288#ifdef HAVE_GTK2
    300289  GtkWidget* menu;                      //!< The menu That will hold the Options.
    301   GtkWidget* item;                      //!< One Item From a Menu.
    302 #endif /* HAVE_GTK2 */
    303   va_list itemlist;                     //!< The list to readin multiple Options.
    304  
    305  public:
     290#endif /* HAVE_GTK2 */
     291
     292  //! A struct to handle the MenuItems
     293  struct MenuItem
     294  {
     295    char* name;                         //!< The name of this entry.
     296    int itemNumber;                     //!< The n'th entry of this menu;
     297#ifdef HAVE_GTK2
     298    GtkWidget* item;                    //!< One Item From a Menu.
     299#endif /* HAVE_GTK2 */
     300    MenuItem* next;                     //!< Pointer to the next MenuItem.
     301  };
     302  MenuItem* firstItem;                  //!< Pointer to the first Item.
     303  MenuItem* currItem;                   //!< Pointer to the current Item.
     304 
     305 public:
     306  Menu(const char* menuName);
    306307  Menu(char* menuname, ...);
    307   ~Menu(void);
    308   void init(void);
    309   void destroy(void);
    310  
    311   void setTitle(char* title);
     308  virtual ~Menu(void);
     309  void init(void);
     310
     311  virtual char* save(void);
     312  virtual void load(char* loadString);
     313 
    312314  void addItem(char* itemName);
    313315  void redraw(void);
     
    322324 public:
    323325  OptionLabel(char* label, char* value);
    324   ~OptionLabel(void);
    325   void init(void);
    326   void destroy(void);
    327  
     326  virtual ~OptionLabel(void);
     327  void init(void);
    328328 
    329329  void setValue(char* newValue);
    330   void setTitle(char* title);
     330
     331  virtual char* save(void);
     332  virtual void load(char* loadString);
     333
    331334  void redraw(void);
    332335  void changeOption(void);
     
    342345  Label(void);
    343346  Label(char* text);
    344   ~Label(void);
    345   void init(void);
    346   void destroy(void);
     347  virtual ~Label(void);
     348  void init(void);
    347349 
    348350  void setTitle(char* text);
     
    359361  ProgressBar(void);
    360362  ProgressBar(char* label);
    361   ~ProgressBar(void);
    362   void init(void);
    363   void destroy(void);
    364 
    365   void setTitle(char* title);
     363  virtual ~ProgressBar(void);
     364  void init(void);
     365
    366366  void setProgress(double progress);
    367367  void setTotalSize(double totalSize);
     
    385385 public:
    386386  Image(char* imgaename);
    387   ~Image(void);
    388   void init(void);
    389   void destroy(void);
    390 
    391   void setTitle(char* title);
     387  virtual ~Image(void);
     388  void init(void);
    392389};
    393390
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.cc

    r3499 r3746  
    2727#include "orxonox_gui_video.h"
    2828
     29#include "glincl.h"
     30
    2931/**
    3032   \brief Creates the Video-Option-Frame
     
    4042  this->fullscreen->saveability();
    4143  this->videoBox->fill(this->fullscreen);
    42   this->resolution = new Menu("Resolution", "640x480", "800x600", "1024x768", "1280x1024", "1400x1050", "1600x1200", "1920x1200", "lastItem");
     44  this->resolution = new Menu("Resolution");
     45  this->getResolutions(this->resolution);
    4346  this->resolution->saveability();
    4447  this->videoBox->fill(this->resolution);
     
    146149}
    147150
     151void OrxonoxGuiVideo::getResolutions(Menu* menu)
     152{
     153  SDL_Init(SDL_INIT_VIDEO);
     154  SDL_Rect **modes;
     155  int i;
     156  int x = 0,y =0; // check for difference
     157  char tmpChar[100];
     158 
     159  /* Get available fullscreen/hardware modes */
     160  modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
     161 
     162  /* Check is there are any modes available */
     163  if(modes == (SDL_Rect **)0){
     164    PRINTF(2)("No video-modes available!\n");
     165    exit(-1);
     166  }
     167 
     168  /* Check if our resolution is restricted */
     169  if(modes == (SDL_Rect **)-1){
     170    PRINTF(2)("All resolutions available.\n");
     171  }
     172  else{
     173    /* Print valid modes */
     174    PRINT(4)("Available Modes\n");
     175    for(i = 0; modes[i] ;++i)
     176      {
     177        if (x != modes[i]->w || y != modes[i]->h)
     178          {
     179            PRINT(4)("  %d x %d\n", modes[i]->w, modes[i]->h);
     180            sprintf(tmpChar, "%dx%d", modes[i]->w, modes[i]->h);
     181            menu->addItem(tmpChar);
     182            x = modes[i]->w; y = modes[i]->h;
     183          }
     184      }
     185  }
     186  SDL_Quit();
     187}
  • orxonox/branches/levelloader/src/lib/gui/gui/orxonox_gui_video.h

    r3499 r3746  
    4545  OrxonoxGuiVideo(void);
    4646  ~OrxonoxGuiVideo(void);
     47
     48  Widget* getWidget(void);
     49
     50  void getResolutions(Menu* menu);
    4751 
    48   Widget* getWidget(void);
     52
    4953};
    5054#endif /* _ORXONOX_GUI_VIDEO_H */
Note: See TracChangeset for help on using the changeset viewer.