Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3315 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Jan 3, 2005, 12:13:38 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/updater: code-standartisation updated in all files.

  1. member → this→member
  2. function (bla) → function(bla)
  3. other small fixes
Location:
orxonox/branches/updater/src/gui
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/updater/src/gui/orxonox_gui.cc

    r3313 r3315  
    4545int verbose = 4;
    4646
    47 int main( int argc, char *argv[] )
     47int main(int argc, char *argv[])
    4848{
    4949  OrxonoxGui* orxonoxgui = new OrxonoxGui(argc, argv);
     
    5656   \brief Initializes the Gui
    5757*/
    58 OrxonoxGui::OrxonoxGui (int argc, char *argv[])
     58OrxonoxGui::OrxonoxGui(int argc, char *argv[])
    5959{
    6060  initGUI(argc, argv);
     
    6767  windowBox->fill (banner->getWidget());
    6868 
    69   Box* optionBox = new Box ('v');
     69  Box* optionBox = new Box('v');
    7070 
    71   Box* avBox = new Box ('h');
     71  Box* avBox = new Box('h');
    7272
    73   video = new OrxonoxGuiVideo ();
    74   avBox->fill (video->getWidget ());
    75   audio = new OrxonoxGuiAudio ();
    76   avBox->fill (audio->getWidget ());
     73  video = new OrxonoxGuiVideo();
     74  avBox->fill(video->getWidget());
     75  audio = new OrxonoxGuiAudio();
     76  avBox->fill(audio->getWidget());
    7777     
    78   optionBox->fill (avBox);
     78  optionBox->fill(avBox);
    7979
    80   keys = new OrxonoxGuiKeys ();
    81   optionBox->fill (keys->getWidget ());
     80  keys = new OrxonoxGuiKeys();
     81  optionBox->fill(keys->getWidget());
    8282
    83   exec = new OrxonoxGuiExec (orxonoxGUI);
    84   optionBox->fill (exec->getWidget ());
     83  exec = new OrxonoxGuiExec();
     84  optionBox->fill(exec->getWidget());
    8585
    86   flags = new OrxonoxGuiFlags (orxonoxGUI);
     86  flags = new OrxonoxGuiFlags();
    8787
    88   optionBox->fill (flags->getWidget ());
    89   windowBox->fill (optionBox);
     88  optionBox->fill(flags->getWidget());
     89  windowBox->fill(optionBox);
    9090
    91   update = new OrxonoxGuiUpdate ();
     91  update = new OrxonoxGuiUpdate();
    9292  optionBox->fill(update->getWidget());
    9393 
    94   orxonoxGUI->fill (windowBox);
    95   flags->setTextFromFlags (orxonoxGUI);
     94  orxonoxGUI->fill(windowBox);
     95  flags->setTextFromFlags(orxonoxGUI);
    9696
    9797  // Reading Values from File
    98   exec->setFilename ("~/.orxonox.conf");
    99   exec->readFromFile (orxonoxGUI);
     98  exec->setFilename("~/.orxonox.conf");
     99  exec->readFromFile(orxonoxGUI);
    100100  // Merging changes to the Options from appended flags.
    101101  for (int optCount = 1; optCount < argc; optCount++)
     
    103103
    104104
    105   orxonoxGUI->showall ();
     105  orxonoxGUI->showall();
    106106
    107107  //// Handling special Cases. ///
     
    124124
    125125}
     126
     127
     128/**
     129   \breif Destructor.
     130*/
     131OrxonoxGui::~OrxonoxGui(void)
     132{
     133 
     134}
  • orxonox/branches/updater/src/gui/orxonox_gui.h

    r3300 r3315  
    2525{
    2626 public:
    27   OrxonoxGui (int argc, char *argv[]);
    28   ~OrxonoxGui ();
     27  OrxonoxGui(int argc, char *argv[]);
     28  ~OrxonoxGui(void);
    2929
    3030};
  • orxonox/branches/updater/src/gui/orxonox_gui_audio.cc

    r3288 r3315  
    2929   \brief Creates an Audio-Frame
    3030*/
    31 OrxonoxGuiAudio::OrxonoxGuiAudio ()
     31OrxonoxGuiAudio::OrxonoxGuiAudio(void)
    3232{
    33   audioFrame = new Frame ("Audio-Options:");
    34   audioBox = new Box ('v');
    35   audioFrame->setGroupName ("audio");
     33  this->audioFrame = new Frame("Audio-Options:");
     34  this->audioBox = new Box('v');
     35  this->audioFrame->setGroupName("audio");
    3636 
    37   enableSound = new CheckButton ("Disable Sound");
    38   enableSound->setFlagName ("no-sound", 0);
    39   enableSound->saveability();
    40   audioBox->fill (enableSound);
    41   Label* musicVolumeLabel = new Label ("Music Volume");
    42   audioBox->fill (musicVolumeLabel);
    43   musicVolume = new Slider ("Music Volume", 0, 100);
    44   musicVolume->setFlagName ("music-volume", "m", 80);
    45   musicVolume->saveability();
    46   audioBox->fill (musicVolume);
     37  this->enableSound = new CheckButton("Disable Sound");
     38  this->enableSound->setFlagName ("no-sound", 0);
     39  this->enableSound->saveability();
     40  this->audioBox->fill(this->enableSound);
     41  Label* musicVolumeLabel = new Label("Music Volume");
     42  this->audioBox->fill(musicVolumeLabel);
     43  this->musicVolume = new Slider("Music Volume", 0, 100);
     44  this->musicVolume->setFlagName("music-volume", "m", 80);
     45  this->musicVolume->saveability();
     46  this->audioBox->fill (this->musicVolume);
    4747  Label* effectsVolumeLabel = new Label ("Effects Volume");
    48   audioBox->fill (effectsVolumeLabel);
    49   effectsVolume = new Slider ("Effects Volume", 0, 100);
    50   effectsVolume->setFlagName ("effects-volume", "e", 80);
    51   effectsVolume->saveability();
    52   audioBox->fill (effectsVolume);
     48  this->audioBox->fill (effectsVolumeLabel);
     49  this->effectsVolume = new Slider ("Effects Volume", 0, 100);
     50  this->effectsVolume->setFlagName ("effects-volume", "e", 80);
     51  this->effectsVolume->saveability();
     52  this->audioBox->fill (this->effectsVolume);
    5353
    54   audioFrame->fill (audioBox);
     54  this->audioFrame->fill (this->audioBox);
    5555}
    5656
     
    5959   \return Returns the Audio-frame
    6060*/
    61 Widget* OrxonoxGuiAudio::getWidget ()
     61Widget* OrxonoxGuiAudio::getWidget(void)
    6262{
    63   return audioFrame;
     63  return this->audioFrame;
    6464}
  • orxonox/branches/updater/src/gui/orxonox_gui_audio.h

    r3187 r3315  
    1919  Slider* effectsVolume;    //!< A Slider for effects volume.
    2020 public:
    21   OrxonoxGuiAudio ();
    22   ~OrxonoxGuiAudio ();
     21  OrxonoxGuiAudio(void);
     22  ~OrxonoxGuiAudio(void);
    2323 
    24   Widget* getWidget ();
     24  Widget* getWidget(void);
    2525};
    2626#endif /* _ORXONOX_GUI_AUDIO_H */
  • orxonox/branches/updater/src/gui/orxonox_gui_banner.cc

    r3287 r3315  
    2929   \brief Creates a new BannerEventBox and its content.
    3030*/
    31 OrxonoxGuiBanner::OrxonoxGuiBanner ()
     31OrxonoxGuiBanner::OrxonoxGuiBanner(void)
    3232{
    3333  // Banner Itself //
    34   bannerEventBox = new EventBox("BannerEventBox");
    35   bannerImage = new Image("banner.xpm");
    36   bannerEventBox->fill(bannerImage);
     34  this->bannerEventBox = new EventBox("BannerEventBox");
     35  this->bannerImage = new Image("banner.xpm");
     36  this->bannerEventBox->fill(this->bannerImage);
    3737
    3838  // Banner Window //
    39   logoWindow = new Window("Logo");
     39  this->logoWindow = new Window("Logo");
    4040
    4141#ifdef HAVE_GTK2
    42   bannerEventBox->connectSignal ("button_press_event", logoWindow, Window::windowOpen);
     42  this->bannerEventBox->connectSignal("button_press_event", this->logoWindow, Window::windowOpen);
    4343
    44   logoWindow->connectSignal("destroy", logoWindow, Window::windowClose);
    45   logoWindow->connectSignal("delete_event", logoWindow, Window::windowClose);
     44  this->logoWindow->connectSignal("destroy", this->logoWindow, Window::windowClose);
     45  this->logoWindow->connectSignal("delete_event", this->logoWindow, Window::windowClose);
    4646#endif /* HAVE_GTK2 */
    47   logoEventBox = new EventBox();
    48   logoBox = new Box('v');
    49   logoLabel = new Label("OrxOnoX, Version: " PACKAGE_VERSION);
    50   logoImage = new Image("banner.xpm");
    51   logoEventBox->fill(logoImage);
     47  this->logoEventBox = new EventBox();
     48  this->logoBox = new Box('v');
     49  this->logoLabel = new Label("OrxOnoX, Version: " PACKAGE_VERSION);
     50  this->logoImage = new Image("banner.xpm");
     51  this->logoEventBox->fill(this->logoImage);
    5252 
    53   logoBox->fill(logoLabel);
    54   logoBox->fill(logoEventBox);
     53  this->logoBox->fill(this->logoLabel);
     54  this->logoBox->fill(this->logoEventBox);
    5555#ifdef HAVE_GTK2
    56   logoEventBox->connectSignal("button_press_event",logoWindow, Window::windowClose);
     56  this->logoEventBox->connectSignal("button_press_event", this->logoWindow, Window::windowClose);
    5757#endif /* HAVE_GTK2 */
    5858
    59   logoWindow->fill (logoBox);
     59  this->logoWindow->fill(this->logoBox);
    6060 
    61   Window::addWindow (logoWindow);
     61  Window::addWindow(this->logoWindow);
    6262}
    6363
     
    6565   \brief Destructs it.
    6666*/
    67 OrxonoxGuiBanner::~OrxonoxGuiBanner ()
     67OrxonoxGuiBanner::~OrxonoxGuiBanner(void)
    6868{
    6969}
     
    7373   \return The EventBox, that holds the Banner.
    7474*/
    75 Widget* OrxonoxGuiBanner::getWidget ()
     75Widget* OrxonoxGuiBanner::getWidget(void)
    7676{
    77   return bannerEventBox;
     77  return this->bannerEventBox;
    7878}
    7979
  • orxonox/branches/updater/src/gui/orxonox_gui_banner.h

    r3187 r3315  
    2929
    3030 public:
    31   OrxonoxGuiBanner ();
    32   ~OrxonoxGuiBanner ();
     31  OrxonoxGuiBanner(void);
     32  ~OrxonoxGuiBanner(void);
    3333
    34   Widget* getWidget ();
     34  Widget* getWidget(void);
    3535
    3636};
  • orxonox/branches/updater/src/gui/orxonox_gui_exec.cc

    r3301 r3315  
    3434    \param orxonoxGUI ExecFrame needs to know where to get the Options from
    3535*/
    36 OrxonoxGuiExec::OrxonoxGuiExec (Window* orxonoxGUI)
    37 {
    38   configFile = (char*)malloc (512*sizeof (char));
    39 
    40   execFrame = new Frame ("Execute-Tags:");
    41   execBox = new Box ('v');
    42   execFrame->setGroupName ("misc");
     36OrxonoxGuiExec::OrxonoxGuiExec(void)
     37{
     38  configFile =(char*)malloc(512*sizeof(char));
     39
     40  this->execFrame = new Frame("Execute-Tags:");
     41  this->execBox = new Box('v');
     42  this->execFrame->setGroupName("misc");
    4343 
    44   start = new Button ("Start");
     44  this->start = new Button("Start");
    4545#ifdef HAVE_GTK2
    46   start->connectSignal ("clicked", this, startOrxonox);
     46  this->start->connectSignal("clicked", this, startOrxonox);
    4747#endif /* HAVE_GTK2 */
    48   execBox->fill (start);
    49   saveSettings = new CheckButton ("Save Settings");
    50   saveSettings->value = 1;
    51   saveSettings->saveability();
    52   execBox->fill (saveSettings);
    53   verboseMode = new Menu ("verbose mode", "no output", "error", "warning", "info", "lastItem");
    54   verboseMode->setFlagName ("verbose", "v", 0);
    55   verboseMode->saveability();
    56   execBox->fill (verboseMode);
    57   alwaysShow = new CheckButton ("Always Show this Menu");
    58   alwaysShow->setFlagName ("gui", "g", 0);
    59   alwaysShow->saveability();
    60   execBox->fill (alwaysShow);
    61   quit = new Button ("Quit");
     48  this->execBox->fill(start);
     49  this->saveSettings = new CheckButton("Save Settings");
     50  this->saveSettings->value = 1;
     51  this->saveSettings->saveability();
     52  this->execBox->fill(this->saveSettings);
     53  this->verboseMode = new Menu("verbose mode", "no output", "error", "warning", "info", "lastItem");
     54  this->verboseMode->setFlagName("verbose", "v", 0);
     55  this->verboseMode->saveability();
     56  this->execBox->fill(this->verboseMode);
     57  this->alwaysShow = new CheckButton("Always Show this Menu");
     58  this->alwaysShow->setFlagName("gui", "g", 0);
     59  this->alwaysShow->saveability();
     60  this->execBox->fill(this->alwaysShow);
     61  this->quit = new Button("Quit");
    6262#ifdef HAVE_GTK2
    63   quit->connectSignal ("clicked", this, OrxonoxGuiExec::quitOrxonox);
    64   orxonoxGUI->connectSignal ("destroy", this, OrxonoxGuiExec::quitOrxonox);
    65   //! orxonoxGUI->connectSignal ("delete_event", this, OrxonoxGuiExec::quitOrxonox); \todo fix this to work.
     63  this->quit->connectSignal("clicked", this, OrxonoxGuiExec::quitOrxonox);
     64  Window::mainWindow->connectSignal("destroy", this, OrxonoxGuiExec::quitOrxonox);
     65  //! orxonoxGUI->connectSignal("delete_event", this, OrxonoxGuiExec::quitOrxonox); \todo fix this to work.
    6666#endif /* HAVE_GTK2 */
    67   execBox->fill (quit);
    68 
    69   execFrame->fill (execBox);
     67  this->execBox->fill(this->quit);
     68
     69  this->execFrame->fill(this->execBox);
    7070}
    7171
     
    7474   \return Returns the Exec-frame
    7575*/
    76 Widget* OrxonoxGuiExec::getWidget ()
     76Widget* OrxonoxGuiExec::getWidget(void)
    7777{
    7878  return execFrame;
     
    8585   \param filename the location of the configFile
    8686
     87   \todo: memory allocation could be better.
     88
    8789   The name will be parsed from ~/ to /home/[username] on unix and c:/Documents and Settings/username/Settings/ on Windows
    8890*/
    89 void OrxonoxGuiExec::setFilename (char* filename)
    90 {
    91   char* buffer = (char*) malloc (512*sizeof(buffer));
    92   sprintf (buffer, "%s", filename);
    93   if (!strncmp (buffer, "~/", 2))
     91void OrxonoxGuiExec::setFilename(char* filename)
     92{
     93  char* buffer = (char*)malloc(2048*sizeof(char));
     94  sprintf(buffer, "%s", filename);
     95  if(!strncmp(buffer, "~/", 2))
    9496  {
    9597#ifdef __WIN32__
    96     sprintf (configFile, "%s/%s", getenv ("USERPROFILE"), buffer+2);
     98    sprintf(configFile, "%s/%s", getenv("USERPROFILE"), buffer+2);
    9799#else
    98     sprintf (configFile, "%s/%s", getenv ("HOME"), buffer+2);
     100    sprintf(configFile, "%s/%s", getenv("HOME"), buffer+2);
    99101#endif
    100102  }
    101   else if (buffer)
    102     sprintf(configFile, "%s", buffer);
    103   delete buffer;
     103  else if(buffer)
     104    strcpy(this->configFile, buffer);
     105  free (buffer);
    104106}
    105107
     
    109111char* OrxonoxGuiExec::getConfigFile(void)
    110112{
    111   return configFile;
     113  return this->configFile;
    112114}
    113115
     
    116118   \return 1 if it should 0 if not/
    117119*/
    118 int OrxonoxGuiExec::shouldsave ()
    119 {
    120   return (static_cast<Option*>(saveSettings)->value);
     120int OrxonoxGuiExec::shouldsave()
     121{
     122  return(static_cast<Option*>(this->saveSettings)->value);
    121123}
    122124
     
    125127    \param widget from which Widget on should be saved.
    126128
    127     this Function only opens and closes the file, in between OrxonoxGuiExec::writeFileText (Widget* widget) will execute the real writing process.
    128 */
    129 void OrxonoxGuiExec::writeToFile (Widget* widget)
    130 {
    131   CONFIG_FILE = fopen (configFile, "w");
    132   if (CONFIG_FILE)
    133     writeFileText (widget, 0);
    134   fclose (CONFIG_FILE);
     129    this Function only opens and closes the file, in between OrxonoxGuiExec::writeFileText(Widget* widget) will execute the real writing process.
     130*/
     131void OrxonoxGuiExec::writeToFile(Widget* widget)
     132{
     133  this->CONFIG_FILE = fopen(configFile, "w");
     134  if(this->CONFIG_FILE)
     135    this->writeFileText(widget, 0);
     136  fclose(this->CONFIG_FILE);
    135137}
    136138
     
    140142   \param depth initially "0", and grows higher, while new Groups are bundeled.
    141143*/
    142 void OrxonoxGuiExec::writeFileText (Widget* widget, int depth)
     144void OrxonoxGuiExec::writeFileText(Widget* widget, int depth)
    143145{
    144146  int counter = 0;
    145   while (counter < depth && ((widget->isOption>0
    146                               && (static_cast<Option*>(widget)->isSaveable()) )
    147                              || (widget->isOption<0
     147  while(counter < depth &&((widget->isOption>0
     148                              &&(static_cast<Option*>(widget)->isSaveable()) )
     149                             ||(widget->isOption<0
    148150                                 && static_cast<Packer*>(widget)->getGroupName())))
    149151    {
    150       fprintf (CONFIG_FILE, "  ", depth);
     152      fprintf(this->CONFIG_FILE, "  ", depth);
    151153      counter++;
    152154    }
    153155 
    154156  // check if it is a Packer, and if it is, check if it has a name and if there is something in it.
    155   if (widget->isOption <0)
    156     {
    157       if (static_cast<Packer*>(widget)->getGroupName())
    158         {
    159           fprintf (CONFIG_FILE, "[%s]\n", static_cast<Packer*>(widget)->getGroupName());
    160           writeFileText (static_cast<Packer*>(widget)->down, depth+1);
     157  if(widget->isOption <0)
     158    {
     159      if(static_cast<Packer*>(widget)->getGroupName())
     160        {
     161          fprintf(CONFIG_FILE, "[%s]\n", static_cast<Packer*>(widget)->getGroupName());
     162          this->writeFileText(static_cast<Packer*>(widget)->down, depth+1);
    161163          fprintf(CONFIG_FILE, "\n");
    162164        }
    163165      else
    164166        {
    165           writeFileText (static_cast<Packer*>(widget)->down, depth);
     167          this->writeFileText(static_cast<Packer*>(widget)->down, depth);
    166168        }
    167169    }
    168   //  if (widget->isOption == 0)
    169   //    printf ("%s\n",widget->title);
    170   if (widget->isOption >= 1)
    171     if  (static_cast<Option*>(widget)->isSaveable())
     170  //  if(widget->isOption == 0)
     171  //    printf("%s\n",widget->title);
     172  if(widget->isOption >= 1)
     173    if (static_cast<Option*>(widget)->isSaveable())
    172174      {
    173175        char Buffer[256];
    174176        char* space2under;
    175         strcpy (Buffer, static_cast<Option*>(widget)->title);
    176         if (strchr (Buffer, '_'))
     177        strcpy(Buffer, static_cast<Option*>(widget)->title);
     178        if(strchr(Buffer, '_'))
    177179          cout << "Warning Optionname" << Buffer << " is not Valid for Saving, because it includes an underscore" << endl;
    178         while (space2under = strchr(Buffer, ' '))
     180        while(space2under = strchr(Buffer, ' '))
    179181          {
    180182            space2under[0] = '_';
    181183          }
    182         if (widget->isOption <=3)
    183           fprintf (CONFIG_FILE, "%s = %d\n", Buffer, static_cast<Option*>(widget)->value);
    184         else if (widget->isOption == 5)
    185           fprintf (CONFIG_FILE, "%s = %s\n", Buffer, static_cast<OptionLabel*>(widget)->cValue);
     184        if(widget->isOption <=3)
     185          fprintf(CONFIG_FILE, "%s = %d\n", Buffer, static_cast<Option*>(widget)->value);
     186        else if(widget->isOption == 5)
     187          fprintf(CONFIG_FILE, "%s = %s\n", Buffer, static_cast<OptionLabel*>(widget)->cValue);
    186188      }
    187189
    188   if (widget->next != NULL)
    189     writeFileText (widget->next, depth);
     190  if(widget->next != NULL)
     191    this->writeFileText(widget->next, depth);
    190192}
    191193
     
    194196   \param widget from which Widget on should be saved.
    195197*/
    196 void OrxonoxGuiExec::readFromFile (Widget* widget)
    197 {
    198   CONFIG_FILE = fopen (configFile, "r");
     198void OrxonoxGuiExec::readFromFile(Widget* widget)
     199{
     200  this->CONFIG_FILE = fopen(configFile, "r");
    199201  VarInfo varInfo;
    200   if (CONFIG_FILE)
     202  if(this->CONFIG_FILE)
    201203    {
    202204      Widget* groupWidget = widget;
     
    204206      char Variable[256]= "";
    205207      char* Value;
    206       while (fscanf (CONFIG_FILE, "%s", Buffer) != EOF)
     208      while(fscanf(this->CONFIG_FILE, "%s", Buffer) != EOF)
    207209        {
    208210          // group-search //
    209           if (!strncmp (Buffer, "[", 1))
     211          if(!strncmp(Buffer, "[", 1))
    210212            {
    211               if ((groupWidget = locateGroup (widget, Buffer, 1))==NULL)
     213              if((groupWidget = locateGroup(widget, Buffer, 1))==NULL)
    212214                {
    213215                  cout << "!!There is no group called " << Buffer << " in this GUI.\n First best Widget will get the Infos assigned.\n Config-File will be updated in next Save\n";
     
    216218            }
    217219          // option-setting //
    218           if (!strcmp (Buffer, "="))
     220          if(!strcmp(Buffer, "="))
    219221            {
    220222              char* under2space;
    221               while (under2space = strchr(Variable, '_'))
     223              while(under2space = strchr(Variable, '_'))
    222224                {
    223                   sprintf (under2space, " %s", under2space+1);
     225                  sprintf(under2space, " %s", under2space+1);
    224226                }
    225227             
    226               fscanf (CONFIG_FILE, "%s", Buffer);
     228              fscanf(this->CONFIG_FILE, "%s", Buffer);
    227229              varInfo.variableName = Variable;
    228230              varInfo.variableValue = Buffer;
    229               groupWidget->walkThrough(readFileText, &varInfo, 0);
    230               sprintf (Variable, "");
     231              groupWidget->walkThrough(this->readFileText, &varInfo, 0);
     232              sprintf(Variable, "");
    231233            }
    232           sprintf (Variable, "%s", Buffer);
     234          sprintf(Variable, "%s", Buffer);
    233235        }
    234236      widget->walkThrough(widget->setOptions, 0);
     
    240242   \param varInfo Information about the Variable to read
    241243*/
    242 void OrxonoxGuiExec::readFileText (Widget* widget, void* varInfo)
    243 {
    244   VarInfo* info = (VarInfo*)varInfo;
    245 
    246   if (widget->isOption >= 1 && widget->isOption <= 3)
    247     {
    248       if (!strcmp (static_cast<Option*>(widget)->title, info->variableName))
     244void OrxonoxGuiExec::readFileText(Widget* widget, void* varInfo)
     245{
     246  VarInfo* info =(VarInfo*)varInfo;
     247
     248  if(widget->isOption >= 1 && widget->isOption <= 3)
     249    {
     250      if(!strcmp(static_cast<Option*>(widget)->title, info->variableName))
    249251        static_cast<Option*>(widget)->value = atoi(info->variableValue);
    250252    }
    251   else if (widget->isOption == 5)
    252     {
    253        if (!strcmp (static_cast<Option*>(widget)->title, info->variableName))
     253  else if(widget->isOption == 5)
     254    {
     255       if(!strcmp(static_cast<Option*>(widget)->title, info->variableName))
    254256        static_cast<OptionLabel*>(widget)->setValue(info->variableValue);
    255257    }
     
    262264   \param depth The Depth of the search seen from the first widget we searched from.
    263265   \returns The Widget that holds the Group, or the NULL if the Group wasn't found.
     266
     267   \todo do this in gui-gtk.
    264268*/
    265269Widget* OrxonoxGuiExec::locateGroup(Widget* widget, char* groupName, int depth)
     
    268272
    269273  // removes the trailing and ending [ ].
    270   if (!strncmp (groupName, "[", 1))
     274  if(!strncmp(groupName, "[", 1))
    271275    {
    272276      groupName = groupName+1;
     
    274278    }
    275279
    276   if (widget->isOption < 0)
    277     {
    278       if (static_cast<Packer*>(widget)->getGroupName() && !strcmp(groupName, static_cast<Packer*>(widget)->getGroupName()))
     280  if(widget->isOption < 0)
     281    {
     282      if(static_cast<Packer*>(widget)->getGroupName() && !strcmp(groupName, static_cast<Packer*>(widget)->getGroupName()))
    279283        {
    280284          return widget;
     
    282286      else
    283287        {
    284           if ((tmp = locateGroup (static_cast<Packer*>(widget)->down, groupName, depth+1)) != NULL)
     288          if((tmp = locateGroup(static_cast<Packer*>(widget)->down, groupName, depth+1)) != NULL)
    285289            return tmp;
    286290        }
    287291    }
    288292 
    289   if (widget->next != NULL && depth != 0)
    290     {
    291       if ((tmp = locateGroup (widget->next, groupName, depth)) != NULL)
     293  if(widget->next != NULL && depth != 0)
     294    {
     295      if((tmp = locateGroup(widget->next, groupName, depth)) != NULL)
    292296        return tmp;
    293297    }
     
    297301#ifdef HAVE_GTK2
    298302/**
    299    \brief Starts ORXONOX. (not really implemented yet, but the function is there.\n
     303   \brief Starts ORXONOX.(not really implemented yet, but the function is there.\n
    300304   \param widget the widget that executed the start command
    301305   \param data additional data
     
    303307   This is a Signal and can be executed through Widget::signal_connect
    304308*/
    305 int OrxonoxGuiExec::startOrxonox (GtkWidget* widget, void* data)
    306 {
    307   OrxonoxGuiExec* exec = (OrxonoxGuiExec*)data;
    308   if (exec->shouldsave())
    309     exec->writeToFile (Window::mainWindow);
     309int OrxonoxGuiExec::startOrxonox(GtkWidget* widget, void* data)
     310{
     311  OrxonoxGuiExec* exec =(OrxonoxGuiExec*)data;
     312  if(exec->shouldsave())
     313    exec->writeToFile(Window::mainWindow);
    310314  cout << "Starting Orxonox" <<endl;
    311315  gtk_main_quit();
    312   system("cd ..;./orxonox"); //!< \todo fix this. should execute orxonox for real (coded not over the shell)
    313 }
    314 
    315 /**
    316    \brief Starts ORXONOX. (not really implemented yet, but the function is there.\n
     316  system("cd ..;./orxonox"); //!< \todo fix this. should execute orxonox for real(coded not over the shell)
     317}
     318
     319/**
     320   \brief Starts ORXONOX.(not really implemented yet, but the function is there.\n
    317321   \param widget the widget that executed the start command
    318322   \param data additional data
     
    320324   This is a Signal and can be executed through Widget::signal_connect
    321325*/
    322 int OrxonoxGuiExec::quitOrxonox (GtkWidget* widget, void* data)
    323 {
    324   OrxonoxGuiExec* exec = (OrxonoxGuiExec*)data;
     326int OrxonoxGuiExec::quitOrxonox(GtkWidget* widget, void* data)
     327{
     328  OrxonoxGuiExec* exec =(OrxonoxGuiExec*)data;
    325329  PRINT(3)( "Quitting Orxonox %p\n", exec);
    326   if (exec->shouldsave())
    327     exec->writeToFile (Window::mainWindow);
     330  if(exec->shouldsave())
     331    exec->writeToFile(Window::mainWindow);
    328332  gtk_main_quit();
    329333}
    330334#else /* HAVE_GTK2 */
    331335/**
    332    \brief Starts ORXONOX. (not really implemented yet, but the function is there.\n
     336   \brief Starts ORXONOX.(not really implemented yet, but the function is there.\n
    333337   \param widget the widget that executed the start command
    334338   \param data additional data
    335339*/
    336 int OrxonoxGuiExec::startOrxonox (void* widget, void* data)
    337 {
    338   OrxonoxGuiExec* exec = (OrxonoxGuiExec*)data;
     340int OrxonoxGuiExec::startOrxonox(void* widget, void* data)
     341{
     342  OrxonoxGuiExec* exec =(OrxonoxGuiExec*)data;
    339343  PRINT(3)("Starting Orxonox\n");
    340   if (exec->shouldsave())
    341     exec->writeToFile (Window::mainWindow);
    342   system("cd ..;./orxonox"); //!< \todo fix this. should execute orxonox for real (coded not over the shell)
     344  if(exec->shouldsave())
     345    exec->writeToFile(Window::mainWindow);
     346  system("cd ..;./orxonox"); //!< \todo fix this. should execute orxonox for real(coded not over the shell)
    343347}
    344348/**
     
    349353   This is a Signal and can be executed through Widget::signal_connect
    350354*/
    351 int OrxonoxGuiExec::quitOrxonox (void* widget, void* data)
    352 {
    353   OrxonoxGuiExec* exec = (OrxonoxGuiExec*)data;
     355int OrxonoxGuiExec::quitOrxonox(void* widget, void* data)
     356{
     357  OrxonoxGuiExec* exec =(OrxonoxGuiExec*)data;
    354358  PRINT(3)("Quiting Orxonox");
    355   if (exec->shouldsave())
    356     exec->writeToFile (Window::mainWindow);
     359  if(exec->shouldsave())
     360    exec->writeToFile(Window::mainWindow);
    357361}
    358362
  • orxonox/branches/updater/src/gui/orxonox_gui_exec.h

    r3300 r3315  
    3333
    3434 public:
    35   OrxonoxGuiExec (Window* orxonoxGUI);
    36   ~OrxonoxGuiExec ();
     35  OrxonoxGuiExec(void);
     36  ~OrxonoxGuiExec(void);
    3737 
    38   Widget* getWidget ();
     38  Widget* getWidget(void);
    3939 
    40   void setFilename (char* filename);
     40  void setFilename(char* filename);
    4141  char* getConfigFile(void);
    42   int shouldsave();
    43   void writeToFile (Widget* widget);
    44   void writeFileText (Widget* widget, int depth);
    45   void readFromFile (Widget* widget);
    46   static void readFileText (Widget* widget, void* varInfo);
     42  int shouldsave(void);
     43  void writeToFile(Widget* widget);
     44  void writeFileText(Widget* widget, int depth);
     45  void readFromFile(Widget* widget);
     46  static void readFileText(Widget* widget, void* varInfo);
    4747  Widget* locateGroup(Widget* widget, char* groupName, int depth);
    4848
    4949#ifdef HAVE_GTK2
    50   static int startOrxonox (GtkWidget *widget, void* data);
    51   static int quitOrxonox (GtkWidget *widget, void* data);
     50  static int startOrxonox(GtkWidget *widget, void* data);
     51  static int quitOrxonox(GtkWidget *widget, void* data);
    5252#else /* HAVE_GTK2 */
    53   static int startOrxonox (void* widget, void* data);
    54   static int quitOrxonox (void* widget, void* data);
     53  static int startOrxonox(void* widget, void* data);
     54  static int quitOrxonox(void* widget, void* data);
    5555#endif /* HAVE_GTK2 */
    5656};
  • orxonox/branches/updater/src/gui/orxonox_gui_flags.cc

    r3300 r3315  
    3030   \param widget The Widget from which the data will be parsed
    3131*/
    32 OrxonoxGuiFlags::OrxonoxGuiFlags (Widget* widget)
     32OrxonoxGuiFlags::OrxonoxGuiFlags(void)
    3333{
    34   this->flagsFrame = new Frame ("Orxonox-Startup-Flags:");
    35   this->flagsBox = new Box ('v');
     34  this->flagsFrame = new Frame("Orxonox-Startup-Flags:");
     35  this->flagsBox = new Box('v');
    3636
    37   this->flagsLabel = new Label ();
    38   this->flagsLabel->setSize (260,60);
    39   this->flagsBox->fill (flagsLabel);
    40   this->shortFlags = new CheckButton ("shortFlags");
    41   this->flagsBox->fill (shortFlags);
     37  this->flagsLabel = new Label();
     38  this->flagsLabel->setSize(260,60);
     39  this->flagsBox->fill(flagsLabel);
     40  this->shortFlags = new CheckButton("shortFlags");
     41  this->flagsBox->fill(shortFlags);
    4242
    43   this->flagsFrame->fill (flagsBox);
     43  this->flagsFrame->fill(flagsBox);
    4444}
    4545
     
    4848   \returns Frame that holds the Flagtext.
    4949*/
    50 Widget* OrxonoxGuiFlags::getWidget ()
     50Widget* OrxonoxGuiFlags::getWidget(void)
    5151{
    5252  return this->flagsFrame;
     
    5757   \param widget the Widget from which on to scan for deeper Options and their settings.
    5858*/
    59 void OrxonoxGuiFlags::setTextFromFlags (Widget* widget)
     59void OrxonoxGuiFlags::setTextFromFlags(Widget* widget)
    6060{
    6161  FlagInfo flagInfo;
     
    7676void OrxonoxGuiFlags::flagsText(Widget* widget, void* flagInfo)
    7777{
    78   FlagInfo* info = (FlagInfo*)flagInfo;
    79   if (widget->isOption >= 1)
    80     if  (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue )
     78  FlagInfo* info =(FlagInfo*)flagInfo;
     79  if(widget->isOption >= 1)
     80    if (static_cast<Option*>(widget)->value != static_cast<Option*>(widget)->defaultValue )
    8181      {
    82         if (info->shortFlags->isActive() && static_cast<Option*>(widget)->flagNameShort)
     82        if(info->shortFlags->isActive() && static_cast<Option*>(widget)->flagNameShort)
    8383          {
    8484            info->flagsLabel->appendText(" -");
    8585            info->flagsLabel->appendText(static_cast<Option*>(widget)->flagNameShort);
    8686          }
    87         else if (!info->shortFlags->isActive() && static_cast<Option*>(widget)->flagName)
     87        else if(!info->shortFlags->isActive() && static_cast<Option*>(widget)->flagName)
    8888          {
    8989            info->flagsLabel->appendText(" --");
     
    9191          }
    9292
    93         if (static_cast<Option*>(widget)->isOption == 2)
     93        if(static_cast<Option*>(widget)->isOption == 2)
    9494          {
    9595            info->flagsLabel->appendText("=");
  • orxonox/branches/updater/src/gui/orxonox_gui_flags.h

    r3299 r3315  
    1919
    2020 public:
    21   OrxonoxGuiFlags (Widget* widget);
    22   ~OrxonoxGuiFlags ();
     21  OrxonoxGuiFlags(void);
     22  ~OrxonoxGuiFlags(void);
    2323
    24   void setTextFromFlags (Widget* widget);
     24  void setTextFromFlags(Widget* widget);
    2525  static void flagsText(Widget* widget, void* flagInfo);
    2626 
     
    3030    Label* flagsLabel;
    3131  };
    32   Widget* getWidget ();
     32  Widget* getWidget(void);
    3333};
    3434#endif /* _ORXONOX_GUI_FLAGS_H */
  • orxonox/branches/updater/src/gui/orxonox_gui_gtk.cc

    r3313 r3315  
    5050  gdk_threads_init();
    5151#endif /* HAVE_GTHREAD */
    52   gtk_init (&argc, &argv);
     52  gtk_init(&argc, &argv);
    5353  gtk_rc_parse( "rc" );
    5454#endif /* HAVE_GTK2 */
     
    138138   This is still pretty crappy.
    139139*/
    140 Widget::~Widget()
     140Widget::~Widget(void)
    141141{
    142142  this->destroy();
     
    147147   Initializes the next Pointer and the other Widget-specific Defaults.
    148148*/
    149 void Widget::init()
     149void Widget::init(void)
    150150{
    151151  next = NULL;
     
    181181   \brief makes the widget visible.
    182182*/
    183 void Widget::show()
    184 {
    185 #ifdef HAVE_GTK2
    186   gtk_widget_show (this->widget);
     183void Widget::show(void)
     184{
     185#ifdef HAVE_GTK2
     186  gtk_widget_show(this->widget);
    187187#endif /* HAVE_GTK2 */
    188188}
     
    191191   \brief hides the widget.
    192192*/
    193 void Widget::hide()
    194 {
    195 #ifdef HAVE_GTK2
    196   gtk_widget_hide (this->widget);
     193void Widget::hide(void)
     194{
     195#ifdef HAVE_GTK2
     196  gtk_widget_hide(this->widget);
    197197#endif /* HAVE_GTK2 */
    198198}
     
    206206{
    207207#ifdef HAVE_GTK2
    208   gtk_widget_set_usize (this->widget, width, height);
     208  gtk_widget_set_usize(this->widget, width, height);
    209209#endif /* HAVE_GTK2 */
    210210}
     
    237237   \param depth the current depth. if > 0 then the next Widget will also be walked through.
    238238*/
    239 void Widget::walkThrough (void (*function)(Widget*), unsigned int depth)
     239void Widget::walkThrough(void(*function)(Widget*), unsigned int depth)
    240240{
    241241  function(this);
    242242  if (this->isOption < 0)
    243243    {
    244       static_cast<Packer*>(this)->down->walkThrough (function, depth+1);
     244      static_cast<Packer*>(this)->down->walkThrough(function, depth+1);
    245245    }
    246246
     
    255255   \param depth the current depth. if > 0 then the next Widget will also be walked through.
    256256*/
    257 void Widget::walkThrough (void (*function)(Widget*, void*), void* data, unsigned int depth)
     257void Widget::walkThrough(void(*function)(Widget*, void*), void* data, unsigned int depth)
    258258{
    259259  function(this, data);
     
    270270    \param widget specifies the widget that should be listed
    271271*/
    272 void Widget::listOptionsAndGroups (Widget* widget)
     272void Widget::listOptionsAndGroups(Widget* widget)
    273273{
    274274  if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
     
    284284    \param widget specifies the widget that should be listed
    285285*/
    286 void Widget::listOptions (Widget* widget)
     286void Widget::listOptions(Widget* widget)
    287287{
    288288  if (widget->isOption >= 1 && widget->isOption <= 3)
     
    297297    \param data A Counter, that always knows how many Options have been found yet.
    298298*/
    299 void Widget::listOptions (Widget* widget, void* data)
     299void Widget::listOptions(Widget* widget, void* data)
    300300{
    301301 
    302302  if (widget->isOption >= 1 && widget->isOption <= 3)
    303303    {
    304       int* count = (int*)data;
     304      int* count =(int*)data;
    305305      *count = *count +1;
    306306      cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<Option*>(widget)->value <<endl;
     
    308308  else if (widget->isOption == 5)
    309309    {
    310       int* count = (int*)data;
     310      int* count =(int*)data;
    311311      *count = *count +1;
    312312      cout << *count << ": " << static_cast<Option*>(widget)->title <<" is : " << static_cast<OptionLabel*>(widget)->cValue <<endl;
     
    315315
    316316/**
    317     \brief Finds an Option by a given number (the n'th option found away from this Widget)
    318     \param number The Count of options to wait (by reference)
     317    \brief Finds an Option by a given number(the n'th option found away from this Widget)
     318    \param number The Count of options to wait(by reference)
    319319    \param depth The depth of the sarch. if 0 it will not search next pointer
    320320   
     
    349349void Widget::listGroups(Widget* widget)
    350350{
    351   if(widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
     351  if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
    352352    cout << "[" << static_cast<Packer*>(widget)->groupName << "]\n";
    353353}
     
    356356    \brief This is for listing the Groups of "widget". It also displays the n'th number found.
    357357    \param widget specifies the widget that should be listed
    358     \param data the Counter, that will show the number (this function will raise it by one if a Group is fount.
     358    \param data the Counter, that will show the number(this function will raise it by one if a Group is fount.
    359359*/
    360360void Widget::listGroups(Widget* widget, void* data)
    361361{
    362   if(widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
    363     {
    364       int* count = (int*)data;
     362  if (widget->isOption < 0 && static_cast<Packer*>(widget)->groupName)
     363    {
     364      int* count =(int*)data;
    365365      *count = *count +1;
    366366      cout << *count <<": [" << static_cast<Packer*>(widget)->groupName << "]\n";
     
    369369
    370370/**
    371     \brief Finds a Group by a given number (the n'th Group found away from this Widget)
    372     \param number The Count of options to wait (by reference)
     371    \brief Finds a Group by a given number(the n'th Group found away from this Widget)
     372    \param number The Count of options to wait(by reference)
    373373    \param depth The depth of the sarch. if 0 it will not search next pointer
    374374*/
     
    399399    \param widget specifies the widget that should be set.
    400400*/
    401 void Widget::setOptions (Widget* widget)
     401void Widget::setOptions(Widget* widget)
    402402{
    403403  if (widget->isOption >= 1)
     
    412412  if (widget->isOption>=1)
    413413    {     
    414       Option* option = (Option*)widget;
    415       char* name = (char*)flagName;
     414      Option* option =(Option*)widget;
     415      char* name =(char*)flagName;
    416416      char* value = NULL;
    417417      bool found = false;
    418418      // check if long flag matches
    419       if ((option->flagName && strlen(name)>2 && !strncmp(name+2, option->flagName, strlen(option->flagName)) && (name[strlen(option->flagName)+2] == '\0' || name[strlen(option->flagName)+2] == '=') ))
     419      if ((option->flagName && strlen(name)>2 && !strncmp(name+2, option->flagName, strlen(option->flagName)) &&(name[strlen(option->flagName)+2] == '\0' || name[strlen(option->flagName)+2] == '=') ))
    420420        {
    421421          found = true;
     
    425425            }
    426426        }
    427       else if (option->flagNameShort && strlen(name)>1 && !strncmp(name+1, option->flagNameShort, strlen(option->flagNameShort))&& (name[strlen(option->flagNameShort)+1] == '\0' || name[strlen(option->flagNameShort)+1] == '=')) // check if short flag matches
     427      else if (option->flagNameShort && strlen(name)>1 && !strncmp(name+1, option->flagNameShort, strlen(option->flagNameShort))&&(name[strlen(option->flagNameShort)+1] == '\0' || name[strlen(option->flagNameShort)+1] == '=')) // check if short flag matches
    428428        {
    429429          found = true;
     
    456456    \brief Connect any signal to any given Sub-widget
    457457*/
    458 gulong Widget::connectSignal (char* event, gint (*signal)(GtkWidget*, GdkEvent*, void *))
    459 {
    460   return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), NULL);
     458gulong Widget::connectSignal(char* event, gint(*signal)(GtkWidget*, GdkEvent*, void *))
     459{
     460  return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), NULL);
    461461}
    462462
     
    464464   \brief Connect a signal with additionally passing the whole Object
    465465*/
    466 gulong Widget::connectSignal (char* event, gint (*signal)( GtkWidget*, Widget *))
    467 {
    468   return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), this);
     466gulong Widget::connectSignal(char* event, gint(*signal)( GtkWidget*, Widget *))
     467{
     468  return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), this);
    469469}
    470470
     
    472472   \brief Connect a signal with additionally passing a whole external Object
    473473*/
    474 gulong Widget::connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEvent*, void *))
    475 {
    476   return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), extObj);
     474gulong Widget::connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEvent*, void *))
     475{
     476  return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), extObj);
    477477}
    478478
     
    480480   \brief Connect a signal with additionally passing a whole external Object
    481481*/
    482 gulong Widget::connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, void *))
    483 {
    484   return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), extObj);
     482gulong Widget::connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, void *))
     483{
     484  return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), extObj);
    485485}
    486486
     
    488488   \brief Connect a signal with additionally passing a whole external Object
    489489*/
    490 gulong Widget::connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEventKey*, void *))
    491 {
    492   return g_signal_connect (G_OBJECT (this->widget), event, G_CALLBACK (signal), extObj);
    493 }
    494 
    495 void Widget::disconnectSignal (gulong signalID)
    496 {
    497   g_signal_handler_disconnect (G_OBJECT (this->widget), signalID);
     490gulong Widget::connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void *))
     491{
     492  return g_signal_connect(G_OBJECT(this->widget), event, G_CALLBACK(signal), extObj);
     493}
     494
     495void Widget::disconnectSignal(gulong signalID)
     496{
     497  g_signal_handler_disconnect(G_OBJECT(this->widget), signalID);
    498498}
    499499
     
    504504   \param nothing nothin.
    505505*/
    506 gint Widget::doNothingSignal (GtkWidget *widget, GdkEvent* event, void* nothing)
     506gint Widget::doNothingSignal(GtkWidget *widget, GdkEvent* event, void* nothing)
    507507{
    508508}
     
    519519   Sets the down-pinter to NULL and other PackerSpecific-values to their defaults.
    520520*/
    521 void Packer::init (void)
    522 {
    523   down = NULL;
    524   groupName = NULL;
     521void Packer::init(void)
     522{
     523  this->down = NULL;
     524  this->groupName = NULL;
    525525
    526526
     
    536536  PRINTF(4)("deleting the Packer part.\n");
    537537 
    538   if (groupName)
    539     delete []groupName;
     538  if (this->groupName)
     539    delete []this->groupName;
    540540
    541541  //deleting recursively.
     
    551551   \param name The name of the group.
    552552*/
    553 void Packer::setGroupName (char* name)
    554 {
    555   if (groupName)
    556     delete groupName;
    557   groupName = new char [strlen(name)+1];
    558   strcpy(groupName, name);
     553void Packer::setGroupName(char* name)
     554{
     555  if (this->groupName)
     556    delete []this->groupName;
     557  this->groupName = new char[strlen(name)+1];
     558  strcpy(this->groupName, name);
    559559}
    560560
     
    563563   \returns name The name of the group.
    564564*/
    565 char* Packer::getGroupName (void)
    566 {
    567   return groupName;
     565char* Packer::getGroupName(void)
     566{
     567  return this->groupName;
    568568}
    569569
     
    575575   sets the Container-Specific defaults.
    576576*/
    577 void Container::init (void)
    578 {
    579   isOption = -1;
     577void Container::init(void)
     578{
     579  this->isOption = -1;
    580580
    581581  static_cast<Packer*>(this)->init();
     
    600600   It does this by filling up the down pointer only if down points to NULL.
    601601*/
    602 void Container::fill (Widget *lowerWidget)
     602void Container::fill(Widget *lowerWidget)
    603603{
    604604  if (this->down == NULL)
    605605    {
    606606#ifdef HAVE_GTK2
    607       gtk_container_add (GTK_CONTAINER (this->widget), lowerWidget->widget);
     607      gtk_container_add(GTK_CONTAINER(this->widget), lowerWidget->widget);
    608608#endif /* HAVE_GTK2 */
    609609      this->down = lowerWidget;
     
    613613}
    614614
    615 // gtk_container_set_border_width (GTK_CONTAINER (widget), 5);
     615// gtk_container_set_border_width(GTK_CONTAINER(widget), 5);
    616616
    617617/* WINDOW */
     
    622622   \brief Adds a new Window Windows to the List of Windows.
    623623   \param windowToAdd The Windows that should be added to the List
    624    \todo this instead of windowToAdd (possibly)
     624   \todo this instead of windowToAdd(possibly)
    625625*/
    626626void Window::addWindow(Window* windowToAdd)
     
    633633
    634634  Widget* tmpWindow = mainWindow;
    635   while (tmpWindow->next)
     635  while(tmpWindow->next)
    636636    tmpWindow = tmpWindow->next;
    637637  tmpWindow->next = windowToAdd;
     
    644644   \brief Creating a new Window without a Name
    645645*/
    646 Window::Window (void)
     646Window::Window(void)
    647647{
    648648  this->init();
     
    654654*/
    655655
    656 Window::Window (char* windowName)
     656Window::Window(char* windowName)
    657657{
    658658  this->init();
    659   this->setTitle (windowName);
     659  this->setTitle(windowName);
    660660}
    661661
     
    671671   \brief initializes a new Window
    672672*/
    673 void Window::init()
     673void Window::init(void)
    674674{
    675675  if (!mainWindow)
     
    681681
    682682#ifdef HAVE_GTK2
    683   widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    684   gtk_window_set_policy (GTK_WINDOW(widget), TRUE, TRUE, TRUE);
     683  widget = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     684  gtk_window_set_policy(GTK_WINDOW(widget), TRUE, TRUE, TRUE);
    685685#if !defined(__WIN32__)
    686   //  gtk_window_set_decorated (GTK_WINDOW (widget), FALSE);
     686  //  gtk_window_set_decorated(GTK_WINDOW(widget), FALSE);
    687687#endif
    688   gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
     688  gtk_container_set_border_width(GTK_CONTAINER(widget), 3);
    689689#endif /* HAVE_GTK2 */
    690690}
     
    708708   \brief Shows all Widgets that are included within this->widget.
    709709*/
    710 void Window::showall ()
    711 {
    712   if (!isOpen)
    713     {
    714       //      printf ("showall\n");
    715 #ifdef HAVE_GTK2
    716       gtk_widget_show_all  (widget);
     710void Window::showall(void)
     711{
     712  if (!this->isOpen)
     713    {
     714      //      printf("showall\n");
     715#ifdef HAVE_GTK2
     716      gtk_widget_show_all(this->widget);
    717717#endif /* HAVE_GTK2 */
    718      isOpen = true;
     718     this->isOpen = true;
    719719    }
    720720  else
    721721    {
    722       //      printf ("showone\n");
    723 #ifdef HAVE_GTK2
    724       gtk_widget_show (widget);
     722      //      printf("showone\n");
     723#ifdef HAVE_GTK2
     724      gtk_widget_show(this->widget);
    725725#endif /* HAVE_GTK2 */
    726726    }
     
    731731   \param title title the Window should get.
    732732*/
    733 void Window::setTitle (char* title)
     733void Window::setTitle(char* title)
    734734{
    735735  if (this->title)
     
    738738  strcpy(this->title, title);
    739739#ifdef HAVE_GTK2
    740   gtk_window_set_title (GTK_WINDOW (widget), title);
     740  gtk_window_set_title(GTK_WINDOW(widget), title);
    741741#endif /* HAVE_GTK2 */
    742742}
     
    745745   \brief opens up a Window and fixes the Focus to it
    746746*/
    747 void Window::open()
     747void Window::open(void)
    748748{
    749749  if (this != mainWindow)
     
    751751      isOpen = true;
    752752#ifdef HAVE_GTK2
    753       gtk_widget_show_all(widget);
    754       gtk_grab_add(widget);
     753      gtk_widget_show_all(this->widget);
     754      gtk_grab_add(this->widget);
    755755#endif /* HAVE_GTK2 */
    756756    }
     
    760760   \brief closes up a Window and removes the Focus from it
    761761*/
    762 void Window::close()
     762void Window::close(void)
    763763{
    764764  if (this != mainWindow)
    765765    {
    766       isOpen = false;
    767 #ifdef HAVE_GTK2
    768       gtk_grab_remove(widget);
    769       gtk_widget_hide (widget);
    770 #endif /* HAVE_GTK2 */
    771     }
    772 }
    773 
    774 #ifdef HAVE_GTK2
    775 /**
    776    \brief opens up a window (not topmost Window).
     766      this->isOpen = false;
     767#ifdef HAVE_GTK2
     768      gtk_grab_remove(this->widget);
     769      gtk_widget_hide(this->widget);
     770#endif /* HAVE_GTK2 */
     771    }
     772}
     773
     774#ifdef HAVE_GTK2
     775/**
     776   \brief opens up a window(not topmost Window).
    777777   this is the Signal that does it. !!SIGNALS ARE STATIC!!
    778778   \param widget the widget that did it.
     
    780780   \param window the Window that should be opened
    781781*/
    782 gint Window::windowOpen (GtkWidget *widget, GdkEvent* event, void* window)
     782gint Window::windowOpen(GtkWidget *widget, GdkEvent* event, void* window)
    783783{
    784784  static_cast<Window*>(window)->open();
     
    786786
    787787/**
    788    \brief closes a window (not topmost Window).
     788   \brief closes a window(not topmost Window).
    789789   this is the Signal that does it. !!SIGNALS ARE STATIC!!
    790790   \param widget the widget that did it!
     
    792792   \param window the Window that should be closed
    793793*/
    794 gint Window::windowClose (GtkWidget *widget, GdkEvent* event, void* window)
     794gint Window::windowClose(GtkWidget *widget, GdkEvent* event, void* window)
    795795{
    796796  static_cast<Window*>(window)->close();
     
    805805    \brief Creates a new Frame without a name
    806806*/
    807 Frame::Frame (void)
     807Frame::Frame(void)
    808808{
    809809  this->init();
     
    813813   \brief Creates a new Frame with name title
    814814*/
    815 Frame::Frame (char* title)
     815Frame::Frame(char* title)
    816816{
    817817  this->init();
     
    822822   \brief destrcucts a Frame
    823823*/
    824 Frame::~Frame()
     824Frame::~Frame(void)
    825825{
    826826  this->destroy();
     
    830830    \brief Initializes a new Frame with default settings
    831831*/
    832 void Frame::init()
     832void Frame::init(void)
    833833{
    834834  static_cast<Container*>(this)->init();
    835835
    836836#ifdef HAVE_GTK2
    837   widget = gtk_frame_new ("");
    838   gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
     837  this->widget = gtk_frame_new("");
     838  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
    839839#endif /* HAVE_GTK2 */
    840840}
     
    857857   \param title The title the Frame should get.
    858858*/
    859 void Frame::setTitle (char* title)
     859void Frame::setTitle(char* title)
    860860{
    861861  if (this->title)
     
    864864  strcpy(this->title, title);
    865865#ifdef HAVE_GTK2
    866   gtk_frame_set_label (GTK_FRAME (widget), title);
     866  gtk_frame_set_label(GTK_FRAME(widget), title);
    867867#endif /* HAVE_GTK2 */
    868868}
     
    873873   \brief Creates a new EventBox with default settings.
    874874*/
    875 EventBox::EventBox (void)
     875EventBox::EventBox(void)
    876876{
    877877  this->init();
     
    880880/**
    881881   \brief Creates a new EventBox with name title
    882    \param title title the Eventbox should get (only data-structure-internal)
    883 */
    884 EventBox::EventBox (char* title)
     882   \param title title the Eventbox should get(only data-structure-internal)
     883*/
     884EventBox::EventBox(char* title)
    885885{
    886886  this->init();
     
    902902void EventBox::init(void)
    903903{
    904   isOption = -1;
     904  this->isOption = -1;
    905905
    906906  static_cast<Container*>(this)->init();
    907907
    908908#ifdef HAVE_GTK2
    909   widget = gtk_event_box_new ();
    910   gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
     909  this->widget = gtk_event_box_new();
     910  gtk_container_set_border_width(GTK_CONTAINER(this->widget), 3);
    911911#endif /* HAVE_GTK2 */
    912912}
     
    926926
    927927/**
    928    \brief Sets the Title of the EventBox (not implemented)
    929    \param title Name the EventBox should get (only datastructure-internal).
    930 */
    931 void EventBox::setTitle (char* title)
     928   \brief Sets the Title of the EventBox(not implemented)
     929   \param title Name the EventBox should get(only datastructure-internal).
     930*/
     931void EventBox::setTitle(char* title)
    932932{
    933933  if (this->title)
     
    942942   \brief Creates a new horizontal Box
    943943*/
    944 Box::Box (void)
     944Box::Box(void)
    945945{
    946946  this->init('h');
     
    951951   \param boxtype if 'v' the Box will be vertically, if 'h' the Box will be horizontally
    952952*/
    953 Box::Box (char boxtype)
     953Box::Box(char boxtype)
    954954{
    955955  this->init(boxtype);
     
    970970void Box::init(char boxtype)
    971971{
    972   isOption = -2;
     972  this->isOption = -2;
    973973
    974974  static_cast<Packer*>(this)->init();
     
    976976  if (boxtype == 'v')
    977977    {
    978       widget = gtk_vbox_new (FALSE, 0);
     978      this->widget = gtk_vbox_new(FALSE, 0);
    979979    }
    980980  else
    981981    {
    982       widget = gtk_hbox_new (FALSE, 0);
     982      this->widget = gtk_hbox_new(FALSE, 0);
    983983    }
    984984#endif /* HAVE_GTK2 */
     
    10041004    It does this by apending the first one to its down-pointer and all its following ones to the preceding next-pointer. The last one will receive a NULL pointer as Next
    10051005*/
    1006 void Box::fill (Widget *lowerWidget)
    1007 {
    1008 #ifdef HAVE_GTK2
    1009   gtk_box_pack_start (GTK_BOX (this->widget), lowerWidget->widget, TRUE, TRUE, 0);
     1006void Box::fill(Widget* lowerWidget)
     1007{
     1008#ifdef HAVE_GTK2
     1009  gtk_box_pack_start(GTK_BOX(this->widget), lowerWidget->widget, TRUE, TRUE, 0);
    10101010#endif /* HAVE_GTK2 */
    10111011  if (this->down == NULL)
     
    10151015      Widget* tmp;
    10161016      tmp = this->down;
    1017       while (tmp->next != NULL)
     1017      while(tmp->next != NULL)
    10181018        {
    10191019          tmp = tmp->next;
     
    10411041   sets all Option-Specific-Values to their defaults.
    10421042*/
    1043 void Option::init()
    1044 {
    1045   value = 0;
    1046   flagName = NULL;
    1047   flagNameShort = NULL;
    1048   saveable = false;
    1049   defaultValue = 0;
     1043void Option::init(void)
     1044{
     1045  this->value = 0;
     1046  this->flagName = NULL;
     1047  this->flagNameShort = NULL;
     1048  this->saveable = false;
     1049  this->defaultValue = 0;
    10501050
    10511051  static_cast<Widget*>(this)->init();
     
    10601060{
    10611061  PRINTF(4)("deleting the Option Part.\n");
    1062   if (flagName)
    1063     delete []flagName;
    1064   if (flagNameShort)
    1065     delete []flagNameShort;
     1062  if (this->flagName)
     1063    delete []this->flagName;
     1064  if (this->flagNameShort)
     1065    delete []this->flagNameShort;
    10661066
    10671067  static_cast<Widget*>(this)->destroy();
     
    10721072   !! Options will be saved if flagname is different from NULL !!
    10731073   \param flagname the Name that will be displayed in the output
    1074    \param defaultvalue the default Value for this Option (see definition of defaultvalue
    1075 */
    1076 void Option::setFlagName (char* flagname, int defaultvalue)
    1077 {
    1078   if (flagName)
    1079     delete flagName;
    1080   flagName = new char [strlen(flagname)+1];
    1081   strcpy(flagName, flagname);
    1082   defaultValue = defaultvalue;
     1074   \param defaultvalue the default Value for this Option(see definition of defaultvalue
     1075*/
     1076void Option::setFlagName(char* flagname, int defaultvalue)
     1077{
     1078  if (this->flagName)
     1079    delete this->flagName;
     1080  this->flagName = new char [strlen(flagname)+1];
     1081  strcpy(this->flagName, flagname);
     1082  this->defaultValue = defaultvalue;
    10831083
    10841084  //  cout << "Set Flagname of " << this->title << " to " << flagname << endl;
     
    10861086
    10871087/**
    1088     \brief see Option::setFlagName (char* flagname, int defaultvalue)
     1088    \brief see Option::setFlagName(char* flagname, int defaultvalue)
    10891089    \param flagname the Name that will be displayed in the output
    1090     \param defaultvalue the default Value for this Option (see definition of defaultvalue
     1090    \param defaultvalue the default Value for this Option(see definition of defaultvalue
    10911091    \param flagnameshort a short flagname to be displayed in the output
    10921092*/
    1093 void Option::setFlagName (char* flagname, char* flagnameshort,  int defaultvalue)
    1094 {
    1095   if (flagName)
    1096     delete flagName;
    1097   flagName = new char [strlen(flagname)+1];
    1098   strcpy(flagName, flagname);
    1099 
    1100   if (flagNameShort)
    1101     delete flagNameShort;
    1102   flagNameShort = new char [strlen(flagnameshort)+1];
    1103   strcpy(flagNameShort, flagnameshort);
    1104   defaultValue = defaultvalue;
     1093void Option::setFlagName(char* flagname, char* flagnameshort,  int defaultvalue)
     1094{
     1095  if (this->flagName)
     1096    delete []this->flagName;
     1097  this->flagName = new char [strlen(flagname)+1];
     1098  strcpy(this->flagName, flagname);
     1099
     1100  if (this->flagNameShort)
     1101    delete []this->flagNameShort;
     1102  this->flagNameShort = new char [strlen(flagnameshort)+1];
     1103  strcpy(this->flagNameShort, flagnameshort);
     1104  this->defaultValue = defaultvalue;
    11051105  //  cout << "Set Flagname of " << this->title << " to " << flagname << endl;
    11061106}
     
    11371137    \param slider the Slider-Object that should receive the change.
    11381138*/
    1139 gint Option::OptionChange (GtkWidget *widget, Widget* option)
     1139gint Option::OptionChange(GtkWidget *widget, Widget* option)
    11401140{
    11411141  static_cast<Option*>(option)->changeOption();
    1142   flags->setTextFromFlags(orxonoxGUI);  //// must be different !!!
     1142  flags->setTextFromFlags(Window::mainWindow);  //// must be different !!!
    11431143}
    11441144#endif /* HAVE_GTK2 */
     
    11751175
    11761176#ifdef HAVE_GTK2
    1177   widget = gtk_button_new_with_label ("");
     1177  widget = gtk_button_new_with_label("");
    11781178#endif /* HAVE_GTK2 */
    11791179}
     
    11961196   \param title The name the Button should get
    11971197*/
    1198 void Button::setTitle (char *title)
     1198void Button::setTitle(char *title)
    11991199{
    12001200  if (this->title)
     
    12031203  strcpy(this->title, title);
    12041204#ifdef HAVE_GTK2
    1205   gtk_button_set_label (GTK_BUTTON(widget), title);
     1205  gtk_button_set_label(GTK_BUTTON(widget), title);
    12061206#endif /* HAVE_GTK2 */
    12071207}
     
    12111211   not implemented yet
    12121212*/
    1213 void Button::redraw (void)
     1213void Button::redraw(void)
    12141214{
    12151215}
     
    12171217/**
    12181218   \brief Button can not be changed, optionChange is empty)
     1219
     1220   \todo Actions for non-GTK-mode
    12191221*/
    12201222void Button::changeOption(void)
     
    12291231   \param buttonname The name the CheckButton should display.
    12301232*/
    1231 CheckButton::CheckButton (char* buttonname)
     1233CheckButton::CheckButton(char* buttonname)
    12321234{
    12331235  this->init();
     
    12351237
    12361238#ifdef HAVE_GTK2
    1237   this->connectSignal ("clicked", this->OptionChange);
     1239  this->connectSignal("clicked", this->OptionChange);
    12381240#endif /* HAVE_GTK2 */
    12391241}
     
    12521254void CheckButton::init(void)
    12531255{
    1254   isOption = 1;
     1256  this->isOption = 1;
    12551257
    12561258  static_cast<Option*>(this)->init();
    12571259
    12581260#ifdef HAVE_GTK2
    1259   widget = gtk_check_button_new_with_label ("");
     1261  this->widget = gtk_check_button_new_with_label("");
    12601262#endif /* HAVE_GTK2 */
    12611263}
     
    12891291}
    12901292
    1291 bool CheckButton::isActive()
     1293bool CheckButton::isActive(void)
    12921294{
    12931295#ifdef HAVE_GTK2
     
    12991301   \brief Changed the Option, call this Function
    13001302*/
    1301 void CheckButton::changeOption()
    1302 {
    1303 #ifdef HAVE_GTK2
    1304   this->value = (int)gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (this->widget));
     1303void CheckButton::changeOption(void)
     1304{
     1305#ifdef HAVE_GTK2
     1306  this->value =(int)gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(this->widget));
    13051307#else /* HAVE_GTK2 */
    13061308  char tmpChar[20];
     
    13161318
    13171319/**
    1318    \brief Redraws the CheckButton (if option has changed).
     1320   \brief Redraws the CheckButton(if option has changed).
    13191321   Example: if new settings are loaded the Button must be redrawn for the GUI to display that Change
    13201322*/
    1321 void CheckButton::redraw ()
    1322 {
    1323 #ifdef HAVE_GTK2
    1324   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);
     1323void CheckButton::redraw(void)
     1324{
     1325#ifdef HAVE_GTK2
     1326  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(this->widget), value);
    13251327#endif /* HAVE_GTK2 */
    13261328}
     
    13341336   \param end The maximal Value of the slider.
    13351337*/
    1336 Slider::Slider (char* slidername, int start, int end)
     1338Slider::Slider(char* slidername, int start, int end)
    13371339{
    13381340  this->init(start, end);
     
    13401342  this->setTitle(slidername);
    13411343#ifdef HAVE_GTK2
    1342   this->connectSignal ("value_changed", this->OptionChange);
     1344  this->connectSignal("value_changed", this->OptionChange);
    13431345#endif /* HAVE_GTK2 */
    13441346}
     
    13541356/**
    13551357   \brief Initializes a Slider with start and end Values
    1356    params: see Slider::Slider (char* slidername, int start, int end)
     1358   params: see Slider::Slider(char* slidername, int start, int end)
    13571359*/
    13581360void Slider::init(int start, int end)
    13591361{
    1360   isOption = 2;
     1362  this->isOption = 2;
    13611363
    13621364  static_cast<Option*>(this)->init();
     
    13651367  this->end = end;
    13661368#ifdef HAVE_GTK2
    1367  widget = gtk_hscale_new_with_range (start, end, 5);
     1369 widget = gtk_hscale_new_with_range(this->start, this->end, 5);
    13681370#endif /* HAVE_GTK2 */
    13691371}
     
    14061408/**
    14071409   \brief Redraws the widget
    1408    Example: see void CheckButton::redraw ()
    1409 */
    1410 void Slider::redraw ()
    1411 {
    1412 #ifdef HAVE_GTK2
    1413   gtk_range_set_value (GTK_RANGE (widget), value);
     1410   Example: see void CheckButton::redraw(void)
     1411*/
     1412void Slider::redraw(void)
     1413{
     1414#ifdef HAVE_GTK2
     1415  gtk_range_set_value(GTK_RANGE(this->widget), value);
    14141416#endif /* HAVE_GTK2 */
    14151417}
     
    14181420   \brief Changed the Option, call this Function
    14191421*/
    1420 void Slider::changeOption()
    1421 {
    1422 #ifdef HAVE_GTK2
    1423   this->value = (int)gtk_range_get_value(GTK_RANGE(this->widget));
     1422void Slider::changeOption(void)
     1423{
     1424#ifdef HAVE_GTK2
     1425  this->value =(int)gtk_range_get_value(GTK_RANGE(this->widget));
    14241426#else /* HAVE_GTK2 */
    14251427  char tmpChar[20];
     
    14431445    \param ... items to be added to this Menu. !! Consider, that the last input argument has to be "lastItem" for this to work!!
    14441446*/
    1445 Menu::Menu (char* menuname, ...)
     1447Menu::Menu(char* menuname, ...)
    14461448{
    14471449  this->init();
     
    14511453
    14521454#ifdef HAVE_GTK2             /////////////////////// REINPLEMENT
    1453   va_start (itemlist, menuname);
    1454   while (strcmp (itemName = va_arg (itemlist, char*), "lastItem"))
     1455  va_start(itemlist, menuname);
     1456  while(strcmp(itemName = va_arg(itemlist, char*), "lastItem"))
    14551457    {
    14561458      this->addItem(itemName);
     
    14601462
    14611463#ifdef HAVE_GTK2
    1462   gtk_option_menu_set_menu (GTK_OPTION_MENU (widget), menu);
    1463   this->connectSignal ("changed", this->OptionChange);
     1464  gtk_option_menu_set_menu(GTK_OPTION_MENU(this->widget), menu);
     1465  this->connectSignal("changed", this->OptionChange);
    14641466#endif /* HAVE_GTK2 */
    14651467}
     
    14781480void Menu::init(void)
    14791481{
    1480   isOption = 2;
     1482  this->isOption = 2;
    14811483
    14821484  static_cast<Option*>(this)->init();
    14831485
    14841486#ifdef HAVE_GTK2
    1485   widget = gtk_option_menu_new ();
    1486   menu = gtk_menu_new ();
     1487  this->widget = gtk_option_menu_new();
     1488  this->menu = gtk_menu_new();
    14871489#endif /* HAVE_GTK2 */
    14881490
     
    15191521   \brief appends a new Item to the Menu-List.
    15201522   \param itemName the itemName to be appendet.
    1521 */
    1522 void Menu::addItem (char* itemName)
    1523 {
    1524 #ifdef HAVE_GTK2
    1525   item = gtk_menu_item_new_with_label (itemName);
    1526   gtk_menu_shell_append(GTK_MENU_SHELL (menu), item);
     1523
     1524   \todo make the item-list readable without GTK
     1525*/
     1526void Menu::addItem(char* itemName)
     1527{
     1528#ifdef HAVE_GTK2
     1529  this->item = gtk_menu_item_new_with_label(itemName);
     1530  gtk_menu_shell_append(GTK_MENU_SHELL(this->menu), this->item);
    15271531#endif /* HAVE_GTK2 */
    15281532}
     
    15301534/**
    15311535   \brief Redraws the widget
    1532    Example: see void CheckButton::redraw ()
    1533 */
    1534 void Menu::redraw ()
    1535 {
    1536 #ifdef HAVE_GTK2
    1537  gtk_option_menu_set_history (GTK_OPTION_MENU (widget), value);
     1536   Example: see void CheckButton::redraw(void)
     1537*/
     1538void Menu::redraw(void)
     1539{
     1540#ifdef HAVE_GTK2
     1541 gtk_option_menu_set_history(GTK_OPTION_MENU(this->widget), this->value);
    15381542#endif /* HAVE_GTK2 */
    15391543}
     
    15421546   \brief Changed the Option, call this Function
    15431547*/
    1544 void Menu::changeOption()
    1545 {
    1546 #ifdef HAVE_GTK2
    1547   this->value = (int)gtk_option_menu_get_history (GTK_OPTION_MENU (this->widget));
     1548void Menu::changeOption(void)
     1549{
     1550#ifdef HAVE_GTK2
     1551  this->value =(int)gtk_option_menu_get_history(GTK_OPTION_MENU(this->widget));
    15481552#else /* HAVE_GTK2 */
    15491553  char tmpChar[20];
    1550   cout << "\nPlease give me a new value for " << this->title << " (defualt:" << this->defaultValue << "): ";
     1554  cout << "\nPlease give me a new value for " << this->title << "(defualt:" << this->defaultValue << "): ";
    15511555  cin >> tmpChar;
    15521556  this->value = atoi(tmpChar);
     
    15611565   \brief Creates a new OptionLabel with a LabelName and a Value.
    15621566   \param label The name of the OptionLabel.
    1563    \param value The Value of the OptionLabel (what will be displayed).
     1567   \param value The Value of the OptionLabel(what will be displayed).
    15641568*/
    15651569OptionLabel::OptionLabel(char* label, char* value)
    15661570{
    1567   init();
    1568   setTitle(label);
    1569   setValue(value);
     1571  this->init();
     1572  this->setTitle(label);
     1573  this->setValue(value);
    15701574}
    15711575
     
    15831587void OptionLabel::init(void)
    15841588{
     1589  this->isOption = 5;
    15851590  static_cast<Option*>(this)->init();
    1586   isOption = 5;
     1591
    15871592  cValue = NULL;
    15881593
    15891594#ifdef HAVE_GTK2
    1590   widget = gtk_label_new ("");
     1595  this->widget = gtk_label_new("");
    15911596#endif /* HAVE_GTK2 */
    15921597}
     
    16011606  else
    16021607    PRINTF(3)("deleting the OptionLabel.\n");
    1603   if (cValue)
    1604     delete []cValue;
     1608  if (this->cValue)
     1609    delete []this->cValue;
    16051610
    16061611  static_cast<Option*>(this)->destroy();
     
    16141619void OptionLabel::setValue(char* newValue)
    16151620{
    1616   if (cValue)
    1617     delete cValue;
    1618   cValue = new char [strlen(newValue)+1];
    1619   strcpy(cValue, newValue);
    1620 #ifdef HAVE_GTK2
    1621   gtk_label_set_text (GTK_LABEL (widget), cValue);
     1621  if (this->cValue)
     1622    delete []this->cValue;
     1623  this->cValue = new char [strlen(newValue)+1];
     1624  strcpy(this->cValue, newValue);
     1625#ifdef HAVE_GTK2
     1626  gtk_label_set_text(GTK_LABEL(this->widget), this->cValue);
    16221627#endif /* HAVE_GTK2 */
    16231628}
     
    16331638  this->title = new char [strlen(title)+1];
    16341639  strcpy(this->title, title);
    1635 #ifdef HAVE_GTK2
    1636   gtk_label_set_text (GTK_LABEL(widget), title);
    1637 #endif /* HAVE_GTK2 */
    1638 }
    1639 
    1640 /**
    1641    \brief Redraws an OptionLabel (not implemented yet, but it works).
     1640  this->redraw();
     1641}
     1642
     1643/**
     1644   \brief Redraws an OptionLabel(not implemented yet, but it works).
    16421645*/
    16431646void OptionLabel::redraw(void)
    16441647{
    1645  
     1648#ifdef HAVE_GTK2
     1649  gtk_label_set_text(GTK_LABEL(widget), title);
     1650#endif /* HAVE_GTK2 */
    16461651}
    16471652
     
    16491654   \brief Changed the Option, call this Function
    16501655*/
    1651 void OptionLabel::changeOption()
    1652 {
    1653 #ifdef HAVE_GTK2
    1654   this->cValue = (char*)gtk_label_get_text (GTK_LABEL(this->widget));
     1656void OptionLabel::changeOption(void)
     1657{
     1658#ifdef HAVE_GTK2
     1659  this->cValue =(char*)gtk_label_get_text(GTK_LABEL(this->widget));
    16551660#else /* HAVE_GTK2 */
    16561661  cout << "\nPlease give me a new input for " << this->title << ": ";
     
    16651670   You migth consider adding Label::setTitle with this.
    16661671*/
    1667 Label::Label ()
     1672Label::Label(void)
    16681673{
    16691674  this->init();
     
    16741679   \param text The text to be displayed.
    16751680*/
    1676 Label:: Label (char* text)
     1681Label:: Label(char* text)
    16771682{
    16781683  this->init();
     
    16931698void Label::init(void)
    16941699{
    1695   isOption = 0;
     1700  this->isOption = 0;
    16961701
    16971702  static_cast<Widget*>(this)->init();
    16981703
    16991704#ifdef HAVE_GTK2
    1700   widget = gtk_label_new ("");
    1701   gtk_label_set_line_wrap (GTK_LABEL(widget), TRUE);
     1705  this->widget = gtk_label_new("");
     1706  gtk_label_set_line_wrap(GTK_LABEL(this->widget), TRUE);
    17021707#endif /* HAVE_GTK2 */
    17031708}
     
    17271732  strcpy(this->title, text);
    17281733#ifdef HAVE_GTK2
    1729   gtk_label_set_text (GTK_LABEL (this->widget), text);
     1734  gtk_label_set_text(GTK_LABEL(this->widget), this->title);
    17301735#endif /* HAVE_GTK2 */
    17311736}
     
    17591764 
    17601765#ifdef HAVE_GTK2
    1761   gtk_label_set_text (GTK_LABEL (this->widget), title);
     1766  gtk_label_set_text(GTK_LABEL(this->widget), title);
    17621767#endif /* HAVE_GTK2 */
    17631768}
     
    17711776void Label::appendInt(int intToAppend)
    17721777{
    1773   char append [20];
     1778  char append [32];
    17741779  sprintf(append, "%d", intToAppend);
    17751780  this->appendText(append);
     
    17811786   \return The Text the Label holds.
    17821787*/
    1783 char* Label::getText ()
     1788char* Label::getText(void)
    17841789{
    17851790  return this->title;
     
    17891794   \brief Creates a new ProgressBar.
    17901795*/
    1791 ProgressBar::ProgressBar (void)
    1792 {
    1793   this->init ();
     1796ProgressBar::ProgressBar(void)
     1797{
     1798  this->init();
    17941799}
    17951800
     
    17981803   \param label The name you want to get the ProgressBar.
    17991804*/
    1800 ProgressBar::ProgressBar (char* label)
     1805ProgressBar::ProgressBar(char* label)
    18011806{
    18021807  this->init();
    1803   this->setTitle (label);
     1808  this->setTitle(label);
    18041809}
    18051810
     
    18071812   \brief destructs a ProgressBar
    18081813*/
    1809 ProgressBar::~ProgressBar ()
     1814ProgressBar::~ProgressBar(void)
    18101815{
    18111816  this->destroy();
     
    18151820   \brief Initializes a ProgressBar
    18161821*/
    1817 void ProgressBar::init (void)
    1818 {
    1819   isOption = 0;
    1820   progress = 0.0;
    1821   totalSize = 0.0;
     1822void ProgressBar::init(void)
     1823{
     1824  this->isOption = 0;
     1825  this->progress = 0.0;
     1826  this->totalSize = 0.0;
    18221827
    18231828  static_cast<Widget*>(this)->init();
    18241829#ifdef HAVE_GTK2
    1825   adjustment = (GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0);
    1826   widget = gtk_progress_bar_new_with_adjustment(adjustment);
     1830  this->adjustment =(GtkAdjustment*)gtk_adjustment_new(0, 0, 100, 0, 0, 0);
     1831  this->widget = gtk_progress_bar_new_with_adjustment(this->adjustment);
    18271832#endif /* HAVE_GTK2 */
    18281833}
     
    18541859
    18551860/**
    1856    \brief Sets the Total size of the Bar. (ex. The maximum one can download)
    1857 */
    1858 void ProgressBar::setTotalSize (double totalSize)
     1861   \brief Sets the Total size of the Bar.(ex. The maximum one can download)
     1862*/
     1863void ProgressBar::setTotalSize(double totalSize)
    18591864{
    18601865  this->totalSize = totalSize;
     
    18641869   \brief Sets the progress maximum is this->totalSize
    18651870*/
    1866 void ProgressBar::setProgress (double progress)
     1871void ProgressBar::setProgress(double progress)
    18671872{
    18681873  this->progress = progress;
     
    18741879  gtk_progress_set_value(GTK_PROGRESS(widget), this->progress*100.0/this->totalSize);
    18751880#endif /* HAVE_GTK2 */
    1876   PRINTF(3)("Progress: %f\n", progress*100.0/totalSize);
     1881  PRINTF(3)("Progress: %f\n", this->progress*100.0/this->totalSize);
    18771882}
    18781883
     
    18801885    \brief returns the Progress Status
    18811886*/
    1882 double ProgressBar::getProgress (void)
     1887double ProgressBar::getProgress(void)
    18831888{
    18841889  return this->progress;
     
    18911896   \param imagename the location of the Image on the Hard Disc
    18921897*/
    1893 Image::Image (char* imagename)
     1898Image::Image(char* imagename)
    18941899{
    18951900  this->init();
     
    19001905
    19011906#ifdef HAVE_GTK2
    1902   widget = gtk_image_new_from_file (imagename);
     1907  widget = gtk_image_new_from_file(imagename);
    19031908#endif /* HAVE_GTK2 */
    19041909}
     
    19151920    \brief Initializes a new Image
    19161921*/
    1917 void Image::init()
     1922void Image::init(void)
    19181923{
    19191924  isOption = 0;
  • orxonox/branches/updater/src/gui/orxonox_gui_gtk.h

    r3312 r3315  
    4242
    4343 public:
    44   virtual ~Widget ();
    45   void init(void);
    46   void destroy(void);
    47 
    48   void show ();
    49   void hide ();
     44  virtual ~Widget(void);
     45  void init(void);
     46  void destroy(void);
     47
     48  void show(void);
     49  void hide(void);
    5050  void setSize(int width, int height);
    5151  virtual void setTitle(char* title) = 0;  //!< An abstract Function, that sets the title of Widgets.
    5252
    5353  Widget* findWidgetByName(char* name, unsigned int depth);
    54   void walkThrough (void (*function)(Widget*), unsigned int depth);
    55   void walkThrough (void (*function)(Widget*, void*), void* data, unsigned int depth);
     54  void walkThrough(void(*function)(Widget*), unsigned int depth);
     55  void walkThrough(void(*function)(Widget*, void*), void* data, unsigned int depth);
    5656  static void listOptionsAndGroups(Widget* widget);
    5757  static void listOptions(Widget* widget);
     
    6767  // Connection - Functions
    6868
    69   gulong connectSignal (char* event, gint (*signal)(GtkWidget*, GdkEvent*, void* ));
    70   gulong connectSignal (char* event, gint (*signal)(GtkWidget*, Widget* ));
    71   gulong connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEvent*, void* ));
    72   gulong connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, void* ));
    73   gulong connectSignal (char* event, void* extObj, gint (*signal)(GtkWidget*, GdkEventKey*, void* ));
    74   void disconnectSignal (gulong signalID);
     69  gulong connectSignal(char* event, gint(*signal)(GtkWidget*, GdkEvent*, void* ));
     70  gulong connectSignal(char* event, gint(*signal)(GtkWidget*, Widget* ));
     71  gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEvent*, void* ));
     72  gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, void* ));
     73  gulong connectSignal(char* event, void* extObj, gint(*signal)(GtkWidget*, GdkEventKey*, void* ));
     74  void disconnectSignal(gulong signalID);
    7575
    7676  // Signals
    77   static gint doNothingSignal (GtkWidget* widget, GdkEvent* event, void* nothing);
     77  static gint doNothingSignal(GtkWidget* widget, GdkEvent* event, void* nothing);
    7878#endif /* HAVE_GTK2 */
    7979
     
    9999  void destroy(void);
    100100
    101   void setGroupName (char* name);
    102   char* getGroupName (void);
    103 
    104   virtual void fill (Widget* lowerWidget) = 0; //!< An abstract function, that fills Packers.
     101  void setGroupName(char* name);
     102  char* getGroupName(void);
     103
     104  virtual void fill(Widget* lowerWidget) = 0; //!< An abstract function, that fills Packers.
    105105};
    106106
     
    121121  void destroy(void);
    122122
    123   //  void setBorderWidth (int borderwidth);
    124   //  virtual void setTitle (char* title) = 0;
    125   void fill (Widget* lowerWidget);
     123  //  void setBorderWidth(int borderwidth);
     124  //  virtual void setTitle(char* title) = 0;
     125  void fill(Widget* lowerWidget);
    126126};
    127127
     
    142142  Window(char* windowName);
    143143  ~Window(void);
    144   void init();
     144  void init(void);
    145145  void destroy(void);
    146146 
     
    166166 public:
    167167  Frame(void);
    168   Frame (char* frameName);
     168  Frame(char* frameName);
    169169  ~Frame(void);
    170170  void init(void);
     
    181181{
    182182 public:
    183   EventBox (void);
    184   EventBox (char* eventBoxName);
     183  EventBox(void);
     184  EventBox(char* eventBoxName);
    185185  ~EventBox(void);
    186186  void init(void);
     
    194194   A Box can Contain multiple Widgets, that are ordered either horizontally or vertically
    195195   I defined the standartbox to be horizontally.
    196    A Box is always filled left->right (horizontally) or up->down (vertically)
     196   A Box is always filled left->right(horizontally) or up->down(vertically)
    197197*/
    198198class Box : public Packer
    199199{
    200200 public:
    201   Box (void);
    202   Box (char boxtype);
     201  Box(void);
     202  Box(char boxtype);
    203203  ~Box(void);
    204204  void init(char boxtype);
    205205  void destroy(void);
    206206 
    207   void fill (Widget* lowerWidget);
     207  void fill(Widget* lowerWidget);
    208208
    209209  void setTitle(char* title);
     
    223223  void destroy(void);
    224224
    225   int value; //!< every option has a value either true or false (0,1) or something else like 25 for 25% of the volume
     225  int value; //!< every option has a value either true or false(0,1) or something else like 25 for 25% of the volume
    226226  char* flagName; //!< options have a flag name that will be appendet if you start the Program from the GUI.
    227227  char* flagNameShort; //!< like flag_name but shorter
    228   int defaultValue; //!< A default value is good, for hiding a option if it is not needed. (hidden if value == default_value)
     228  int defaultValue; //!< A default value is good, for hiding a option if it is not needed.(hidden if value == default_value)
    229229
    230230  void saveability(void);
    231231  void saveability(bool isSaveable);
    232232  bool isSaveable(void);
    233   void setFlagName (char* flagname, int defaultvalue);
    234   void setFlagName (char* flagname, char* flagnameshort, int defaultvalue);
    235   virtual void redraw (void) = 0; //!< A Option must be able to redraw itself.
     233  void setFlagName(char* flagname, int defaultvalue);
     234  void setFlagName(char* flagname, char* flagnameshort, int defaultvalue);
     235  virtual void redraw(void) = 0; //!< A Option must be able to redraw itself.
    236236  virtual void changeOption(void) = 0; //!< What to do, if an Option is Changed. eacht option decides for itself.
    237237#ifdef HAVE_GTK2
    238238    // Signals 
    239   static gint OptionChange (GtkWidget* widget, Widget* option); //!< Signal for Options that change.
     239  static gint OptionChange(GtkWidget* widget, Widget* option); //!< Signal for Options that change.
    240240#endif /* HAVE_GTK2 */
    241241};
     
    248248{
    249249 public:
    250   Button (char* buttonname);
     250  Button(char* buttonname);
    251251  ~Button(void);
    252252  void init(void);
     
    254254
    255255  void setTitle(char* title);
    256   void redraw();
     256  void redraw(void);
    257257  void changeOption(void);
    258258};
     
    264264{
    265265 public:
    266   CheckButton (char* buttonname);
     266  CheckButton(char* buttonname);
    267267  ~CheckButton(void);
    268268  void init(void);
     
    270270
    271271  void setTitle(char* title);
    272   bool isActive();           //!< a Bool value to see, if this CheckButton is active.
    273   void redraw ();
     272  bool isActive(void);           //!< a Bool value to see, if this CheckButton is active.
     273  void redraw(void);
    274274  void changeOption(void);
    275275};
     
    307307 
    308308 public:
    309   Menu (char* menuname, ...);
     309  Menu(char* menuname, ...);
    310310  ~Menu(void);
    311311  void init(void);
     
    332332  void setValue(char* newValue);
    333333  void setTitle(char* title);
    334   void redraw();
    335   void changeOption();
     334  void redraw(void);
     335  void changeOption(void);
    336336
    337337  char* cValue;                          //!< The Value the Label will have. \todo make private
     
    343343{
    344344 public:
    345   Label (void);
    346   Label (char* text);
     345  Label(void);
     346  Label(char* text);
    347347  ~Label(void);
    348348  void init(void);
     
    353353  void appendText(char* textToAppend);
    354354  void appendInt(int intToAppend);
    355   char* getText ();
     355  char* getText(void);
    356356};
    357357
     
    360360{
    361361 public:
    362   ProgressBar (void);
    363   ProgressBar (char* label);
    364   ~ProgressBar (void);
    365   void init(void);
    366   void destroy(void);
    367 
    368   void setTitle(char* title);
    369   void setProgress (double progress);
    370   void setTotalSize (double totalSize);
    371   double getProgress (void);
     362  ProgressBar(void);
     363  ProgressBar(char* label);
     364  ~ProgressBar(void);
     365  void init(void);
     366  void destroy(void);
     367
     368  void setTitle(char* title);
     369  void setProgress(double progress);
     370  void setTotalSize(double totalSize);
     371  double getProgress(void);
    372372
    373373 private:
     
    387387{
    388388 public:
    389   Image (char* imgaename);
     389  Image(char* imgaename);
    390390  ~Image(void);
    391391  void init(void);
     
    395395};
    396396
    397 //gint orxonox_gui_quit (GtkWidget* widget, GdkEvent* event, gpointer data);
     397//gint orxonox_gui_quit(GtkWidget* widget, GdkEvent* event, gpointer data);
    398398
    399399#endif /* _ORXONOX_GUI_GTK_H */
  • orxonox/branches/updater/src/gui/orxonox_gui_keys.cc

    r3288 r3315  
    2929   \brief Creates an Keyboard-Frame
    3030*/
    31 OrxonoxGuiKeys::OrxonoxGuiKeys ()
    32 {
    33   keysFrame = new Frame ("Keyboard-Options:");
     31OrxonoxGuiKeys::OrxonoxGuiKeys(void)
     32{
     33  this->keysFrame = new Frame("Keyboard-Options:");
    3434  //  keysFrame->setGroupName("Keyboard");
    35   keysBox = new Box ('h');
    36   player1 = new Player("player1");
    37   player2 = new Player("player2");
    38 
    39   keysBox->fill(player1->getOpenButton());
    40   keysBox->fill(player2->getOpenButton());
    41 
    42   keysFrame->fill (keysBox);
     35  this->keysBox = new Box('h');
     36  this->player1 = new Player("player1");
     37  this->player2 = new Player("player2");
     38
     39  this->keysBox->fill(this->player1->getOpenButton());
     40  this->keysBox->fill(this->player2->getOpenButton());
     41
     42  this->keysFrame->fill(this->keysBox);
    4343}
    4444
     
    4747   \return Returns the Audio-frame
    4848*/
    49 Widget* OrxonoxGuiKeys::getWidget ()
    50 {
    51   return keysFrame;
     49Widget* OrxonoxGuiKeys::getWidget(void)
     50{
     51  return this->keysFrame;
    5252}
    5353
     
    6060Player::Player(char* player)
    6161{
    62   char windowName[100] = "Keyboard settings of ";
    63   strcat (windowName, player);
    64   pKeyWindow = new Window(windowName);
    65   pKeyFrame = new Frame (windowName);
    66    pKeysBox = new Box('v');
    67    pKeysBox->setGroupName (player);
    68     pKeysBox->fill(addKey(UP, "up"));
    69     pKeysBox->fill(addKey(DOWN, "down"));
    70     pKeysBox->fill(addKey(LEFT, "left"));
    71     pKeysBox->fill(addKey(RIGHT, "right"));
    72     pKeysBox->fill(addKey(SHOOT, "shoot"));
    73    
     62  char* windowName = new char[strlen(player)+25];
     63  strcpy(windowName, "Keyboard settings of ");
     64  strcat(windowName, player);
     65  this->pKeyWindow = new Window(windowName);
     66  this->pKeyFrame = new Frame(windowName);
     67   this->pKeysBox = new Box('v');
     68   this->pKeysBox->setGroupName(player);
     69    this->pKeysBox->fill(addKey(UP, "up"));
     70    this->pKeysBox->fill(addKey(DOWN, "down"));
     71    this->pKeysBox->fill(addKey(LEFT, "left"));
     72    this->pKeysBox->fill(addKey(RIGHT, "right"));
     73    this->pKeysBox->fill(addKey(SHOOT, "shoot"));
     74    delete windowName;
    7475    closeButton = new Button("close");
    7576#ifdef HAVE_GTK2
    76     closeButton->connectSignal("button_press_event", pKeyWindow, Window::windowClose);
    77 #endif /* HAVE_GTK2 */
    78 
    79     pKeysBox->fill(closeButton);
    80     pKeyFrame->fill(pKeysBox);
    81    pKeyWindow->fill(pKeyFrame);
    82    Window::addWindow(pKeyWindow);
    83 #ifdef HAVE_GTK2
    84    pKeyWindow->connectSignal("destroy", pKeyWindow, Window::windowClose);
    85    pKeyWindow->connectSignal("delete_event", pKeyWindow, Window::windowClose);
    86 #endif /* HAVE_GTK2 */
    87 
    88   openButton = new Button (player);
    89 #ifdef HAVE_GTK2
    90   openButton->connectSignal("button_press_event", pKeyWindow, Window::windowOpen);
    91 #endif /* HAVE_GTK2 */
    92 
    93   inputWindow = new Window("inputWindow");
    94 
    95   inputButton = new Button ("test");
    96   inputWindow->fill (inputButton);
    97 #ifdef HAVE_GTK2
    98   inputWindow->connectSignal("destroy",  Widget::doNothingSignal);
    99   inputWindow->connectSignal("delete_event", Widget::doNothingSignal);
     77    this->closeButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowClose);
     78#endif /* HAVE_GTK2 */
     79
     80    this->pKeysBox->fill(this->closeButton);
     81    this->pKeyFrame->fill(this->pKeysBox);
     82   this->pKeyWindow->fill(this->pKeyFrame);
     83   Window::addWindow(this->pKeyWindow);
     84#ifdef HAVE_GTK2
     85   this->pKeyWindow->connectSignal("destroy", this->pKeyWindow, Window::windowClose);
     86   this->pKeyWindow->connectSignal("delete_event", this->pKeyWindow, Window::windowClose);
     87#endif /* HAVE_GTK2 */
     88
     89  this->openButton = new Button(player);
     90#ifdef HAVE_GTK2
     91  this->openButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowOpen);
     92#endif /* HAVE_GTK2 */
     93
     94  this->inputWindow = new Window("inputWindow");
     95
     96  this->inputButton = new Button("test");
     97  this->inputWindow->fill(inputButton);
     98#ifdef HAVE_GTK2
     99  this->inputWindow->connectSignal("destroy",  Widget::doNothingSignal);
     100  this->inputWindow->connectSignal("delete_event", Widget::doNothingSignal);
    100101#endif /* HAVE_GTK2 */
    101102
     
    108109   \returns A widget that has the Key-Box
    109110*/
    110 Widget* Player::addKey (KEYS key, char* name)
    111 {
    112   inputKey[key] = new InputKey;
    113   inputKey[key]->pKeyBox = new Box();
    114   inputKey[key]->pKeyButton = new Button(name);
    115   inputKey[key]->pKeyOLabel = new OptionLabel (name, name);
    116   inputKey[key]->pKeyOLabel->saveability();
     111Widget* Player::addKey(KEYS key, char* name)
     112{
     113  this->inputKey[key] = new InputKey;
     114  this->inputKey[key]->pKeyBox = new Box();
     115  this->inputKey[key]->pKeyButton = new Button(name);
     116  this->inputKey[key]->pKeyOLabel = new OptionLabel(name, name);
     117  this->inputKey[key]->pKeyOLabel->saveability();
    117118
    118119#ifdef HAVE_GTK2
    119120  //inputKey[key]->pKeyButton->connectSignal("key_press_event", inputKey[key]->pKeyButton, key_cb);
    120   inputKey[key]->pKeyButton->connectSignal("button_press_event", inputKey[key], inputWindowEvent);
    121 #endif /* HAVE_GTK2 */
    122   inputKey[key]->pKeyBox->fill(inputKey[key]->pKeyButton);
    123   inputKey[key]->pKeyBox->fill(inputKey[key]->pKeyOLabel);
    124   return inputKey[key]->pKeyBox;
     121  this->inputKey[key]->pKeyButton->connectSignal("button_press_event", this->inputKey[key], inputWindowEvent);
     122#endif /* HAVE_GTK2 */
     123  this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyButton);
     124  this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyOLabel);
     125  return this->inputKey[key]->pKeyBox;
    125126}
    126127
     
    128129   \returns the OpenButton of a Player
    129130*/
    130 Button* Player::getOpenButton()
    131 {
    132   return openButton;
    133 }
    134 
    135 /**
    136    \brief sets a new Key (only output)
     131Button* Player::getOpenButton(void)
     132{
     133  return this->openButton;
     134}
     135
     136/**
     137   \brief sets a new Key(only output)
    137138   \param key the new Key.
    138139*/
     
    163164gint Player::key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey)
    164165{
    165   InputKey* inputkey = (InputKey*) inputKey;
     166  InputKey* inputkey =(InputKey*) inputKey;
    166167  char title [20];
    167168
     
    256257      char* tmp;
    257258      sprintf(tmp, "%c", event->keyval);
    258       printf ("other key %s \n", tmp);
     259      printf("other key %s \n", tmp);
    259260      strcpy(title, tmp);
    260261      break;
    261262    }
    262263
    263   inputkey->pKeyOLabel->setValue (title);
     264  inputkey->pKeyOLabel->setValue(title);
    264265  inputButton->disconnectSignal(keySignal);
    265266  inputWindow->close();
  • orxonox/branches/updater/src/gui/orxonox_gui_keys.h

    r3187 r3315  
    1515   \brief defines the Possible Player Keys
    1616*/
    17 enum KEYS { UP, DOWN, LEFT, RIGHT, SHOOT };
     17enum KEYS {UP, DOWN, LEFT, RIGHT, SHOOT};
    1818
    1919class Player;
     
    2929
    3030 public:
    31   OrxonoxGuiKeys ();
    32   ~OrxonoxGuiKeys ();
     31  OrxonoxGuiKeys(void);
     32  ~OrxonoxGuiKeys(void);
    3333 
    34   Widget* getWidget ();
     34  Widget* getWidget(void);
    3535};
    3636
     
    6464  Player(char* player);
    6565
    66   Widget* addKey (KEYS key, char* name);
     66  Widget* addKey(KEYS key, char* name);
    6767
    68   Button* getOpenButton();
     68  Button* getOpenButton(void);
    6969
    7070#ifdef HAVE_GTK2
  • orxonox/branches/updater/src/gui/orxonox_gui_update.cc

    r3303 r3315  
    11/*
    22   orxonox - the future of 3D-vertical-scrollers
    3 
    43   Copyright (C) 2004 orx
    54
     
    3736   \brief Creates an Audio-Frame
    3837*/
    39 OrxonoxGuiUpdate::OrxonoxGuiUpdate ()
     38OrxonoxGuiUpdate::OrxonoxGuiUpdate(void)
    4039{
    4140  this->getSystemInfo();
    4241
    43   this->updateFrame = new Frame ("Update-Options:");
    44   this->updateFrame->setGroupName ("update");
    45   this->updateBox = new Box ('v');
     42  this->updateFrame = new Frame("Update-Options:");
     43  this->updateFrame->setGroupName("update");
     44  this->updateBox = new Box('v');
    4645#ifdef HAVE_CURL
    4746
    4847  // the Button for autoUpdating
    49   this->autoUpdate = new CheckButton ("auto update");
     48  this->autoUpdate = new CheckButton("auto update");
    5049  this->updateBox->fill(this->autoUpdate);
    51   this->autoUpdate->setFlagName ("update", "u", 0);
     50  this->autoUpdate->setFlagName("update", "u", 0);
    5251  this->autoUpdate->saveability();
    5352
    54   this->updateSourceWindowCreate ();
     53  this->updateSourceWindowCreate();
    5554  this->updateBox->fill(this->updateSourceWindowGetButton());
    5655
    57   this->updateDataWindowCreate ();
     56  this->updateDataWindowCreate();
    5857  this->updateBox->fill(this->updateDataWindowGetButton());
    5958
     
    7069   \return Returns the Audio-frame
    7170*/
    72 Widget* OrxonoxGuiUpdate::getWidget ()
    73 {
    74   return updateFrame;
     71Widget* OrxonoxGuiUpdate::getWidget(void)
     72{
     73  return this->updateFrame;
    7574}
    7675
     
    8180{
    8281  PRINTF(3)("Grabbing system information\n");
    83   tmpDir = getenv("TMPDIR");
    84   if (!tmpDir)
    85     tmpDir = "/tmp";
    86   PRINTF(4)("Temporary directory is: %s\n", tmpDir);
     82  this->tmpDir = getenv("TMPDIR");
     83  if(!tmpDir)
     84    this->tmpDir = "/tmp";
     85  PRINTF(4)("Temporary directory is: %s\n", this->tmpDir);
    8786
    8887#ifdef __WIN32__
    89   homeDir = getenv ("USERPROFILE");
     88  this->homeDir = getenv("USERPROFILE");
    9089#else
    91   homeDir = getenv("HOME");
     90  this->homeDir = getenv("HOME");
    9291#endif
    9392  PRINTF(4)("Home directory is %s\n", homeDir);
    9493
    95   installDataDir = "/usr/share/games/orxonox";
    96   PRINTF(4)("Installation of orxonox-data will go to this directory: %s\n", installDataDir);
    97 
    98   installSourceDir = "/usr/games/bin";
    99   PRINTF(4)("Installation of orxonox-source will go to this directory: %s\n", installSourceDir);
    100 
    101   userName = getenv("USER");
    102   PRINTF(4)("Logged in username is: %s\n", userName);
     94  this->installDataDir = "/usr/share/games/orxonox";
     95  PRINTF(4)("Installation of orxonox-data will go to this directory: %s\n", this->installDataDir);
     96
     97  this->installSourceDir = "/usr/games/bin";
     98  PRINTF(4)("Installation of orxonox-source will go to this directory: %s\n", this->installSourceDir);
     99
     100  this->userName = getenv("USER");
     101  PRINTF(4)("Logged in username is: %s\n", this->userName);
    103102}
    104103
     
    119118   \brief Creates a window, and all it contains for the Data-update.
    120119*/
    121 void OrxonoxGuiUpdate::updateDataWindowCreate (void)
    122 {
    123   updateDataWindow = new Window ("update orxonox::Data");   
    124   updateDataBox = new Box ('v');
     120void OrxonoxGuiUpdate::updateDataWindowCreate(void)
     121{
     122  this->updateDataWindow = new Window("update orxonox::Data");   
     123  this->updateDataBox = new Box('v');
    125124
    126125  // the close-Button of the Update Window.
    127   //  updateWindowClose = new Button ("close");
     126  //  updateWindowClose = new Button("close");
    128127#ifdef HAVE_GTK2
    129128  //  updateWindowClose->connectSignal("button_press_event", updateWindow, Window::windowClose);
     
    131130  //  updateWindowBox->fill(updateWindowClose);
    132131
    133   updateDataBar = new ProgressBar ();
    134   updateDataBox->fill(updateDataBar);
     132  this->updateDataBar = new ProgressBar();
     133  this->updateDataBox->fill(this->updateDataBar);
    135134
    136135  FileInfo* dataInfo = new FileInfo;
    137   dataInfo->bar = updateDataBar;
    138 
    139   updateDataBegin = new Button ("begin.");
    140   dataInfo->stateButton = updateDataBegin;
    141 #ifdef HAVE_GTK2
    142   dataInfo->buttonSignal = updateDataBegin->connectSignal ("button_press_event", dataInfo, updateDataFunc);
    143 #endif /* HAVE_GTK2 */
    144   updateDataBox->fill(updateDataBegin);
    145 
    146   updateDataWindow->fill (updateDataBox);
    147 
    148   updateDataWindowButton = new Button ("update orxonox::Data");
    149 #ifdef HAVE_GTK2
    150   updateDataWindowButton->connectSignal("button_press_event", updateDataWindow, Window::windowOpen);
    151   updateDataWindow->connectSignal("destroy", updateDataWindow, Window::windowClose);
    152   updateDataWindow->connectSignal("delete_event", updateDataWindow, Window::windowClose);
     136  dataInfo->bar = this->updateDataBar;
     137
     138  this->updateDataBegin = new Button("begin.");
     139  dataInfo->stateButton = this->updateDataBegin;
     140#ifdef HAVE_GTK2
     141  dataInfo->buttonSignal = updateDataBegin->connectSignal("button_press_event", dataInfo, updateDataFunc);
     142#endif /* HAVE_GTK2 */
     143  this->updateDataBox->fill(this->updateDataBegin);
     144
     145  this->updateDataWindow->fill(this->updateDataBox);
     146
     147  this->updateDataWindowButton = new Button("update orxonox::Data");
     148#ifdef HAVE_GTK2
     149  this->updateDataWindowButton->connectSignal("button_press_event", this->updateDataWindow, Window::windowOpen);
     150  this->updateDataWindow->connectSignal("destroy", this->updateDataWindow, Window::windowClose);
     151  this->updateDataWindow->connectSignal("delete_event", this->updateDataWindow, Window::windowClose);
    153152#endif /* HAVE_GTK2 */
    154153
     
    160159Button* OrxonoxGuiUpdate::updateDataWindowGetButton(void)
    161160{
    162   return updateDataWindowButton;
     161  return this->updateDataWindowButton;
    163162}
    164163
     
    166165   \brief Creates a window, and all it contains for the Source-update.
    167166*/
    168 void OrxonoxGuiUpdate::updateSourceWindowCreate (void)
     167void OrxonoxGuiUpdate::updateSourceWindowCreate(void)
    169168{
    170169  // the button, that opens this Window.
    171   updateSourceWindowButton = new Button ("update orxonox::Source");
     170  this->updateSourceWindowButton = new Button("update orxonox::Source");
    172171
    173172  // the Window itself
    174   updateSourceWindow = new Window ("update orxonox::Source");
    175 
    176   updateSourceBox = new Box ();
    177 
    178   updateSourceBar = new ProgressBar ();
    179   updateSourceBox->fill(updateSourceBar);
    180   test = new Button ("increment");
     173  this->updateSourceWindow = new Window("update orxonox::Source");
     174
     175  this->updateSourceBox = new Box();
     176
     177  this->updateSourceBar = new ProgressBar();
     178  this->updateSourceBox->fill(this->updateSourceBar);
     179  test = new Button("increment");
    181180
    182181#ifdef HAVE_GTK2
     
    184183#endif /* HAVE_GTK2 */
    185184
    186   updateSourceBox->fill(test);
    187   updateSourceWindow->fill(updateSourceBox);
    188 #ifdef HAVE_GTK2
    189   updateSourceWindowButton->connectSignal("button_press_event", updateSourceWindow, Window::windowOpen);
    190   updateSourceWindow->connectSignal("destroy", updateSourceWindow, Window::windowClose);
    191   updateSourceWindow->connectSignal("delete_event", updateSourceWindow, Window::windowClose);
     185  this->updateSourceBox->fill(test);
     186  this->updateSourceWindow->fill(updateSourceBox);
     187#ifdef HAVE_GTK2
     188  this->updateSourceWindowButton->connectSignal("button_press_event", this->updateSourceWindow, Window::windowOpen);
     189  this->updateSourceWindow->connectSignal("destroy", this->updateSourceWindow, Window::windowClose);
     190  this->updateSourceWindow->connectSignal("delete_event", this->updateSourceWindow, Window::windowClose);
    192191#endif /* HAVE_GTK2 */
    193192
     
    199198Button* OrxonoxGuiUpdate::updateSourceWindowGetButton(void)
    200199{
    201   return updateSourceWindowButton;
     200  return this->updateSourceWindowButton;
    202201}
    203202
     
    212211gint OrxonoxGuiUpdate::updateDataFunc(GtkWidget* w, GdkEventKey* event, void* info)
    213212{
    214   FileInfo* dataInfo = (FileInfo*)info;
     213  FileInfo* dataInfo =(FileInfo*)info;
    215214
    216215  dataInfo->fileName = "02%20orxonox%203.mp3";
     
    242241   \param stream Filehandler to write to.
    243242*/
    244 size_t OrxonoxGuiUpdate::curlWriteFunc (void* ptr, size_t size, size_t nmemb, FILE* stream)
     243size_t OrxonoxGuiUpdate::curlWriteFunc(void* ptr, size_t size, size_t nmemb, FILE* stream)
    245244{
    246245  return fwrite(ptr, size, nmemb, stream);
     
    254253   \param stream Filehandler to get data from.
    255254*/
    256 size_t OrxonoxGuiUpdate::curlReadFunc (void* ptr, size_t size, size_t nmemb, FILE* stream)
     255size_t OrxonoxGuiUpdate::curlReadFunc(void* ptr, size_t size, size_t nmemb, FILE* stream)
    257256{
    258257  return fread(ptr, size, nmemb, stream);
     
    268267   \param upProgress not needed
    269268*/
    270 int OrxonoxGuiUpdate::curlProgressFunc (ProgressBar* Bar, double totalSize, double progress, double upTotal, double upProgress)
    271 {
    272   Bar->setProgress(progress);
    273   Bar->setTotalSize(totalSize);
     269int OrxonoxGuiUpdate::curlProgressFunc(ProgressBar* bar, double totalSize, double progress, double upTotal, double upProgress)
     270{
     271  bar->setProgress(progress);
     272  bar->setTotalSize(totalSize);
    274273#ifdef HAVE_GTK2
    275274#ifndef HAVE_PTHREAD_H
     
    281280
    282281/**
    283    \brief The Curl handle for only one CURL (static).
     282   \brief The Curl handle for only one CURL(static).
    284283*/
    285284CURL* OrxonoxGuiUpdate::curlHandle = NULL;
     
    305304bool OrxonoxGuiUpdate::download(void* fileInfo)
    306305{
    307   if (isDownloading)
     306  if(isDownloading)
    308307    {
    309308      PRINTF(2)("unable to Download. already getting some file\n");
     
    311310    }
    312311  PRINTF(3)("Downloading.\n");
    313   FileInfo* info = (FileInfo*)fileInfo;
     312  FileInfo* info =(FileInfo*)fileInfo;
    314313  CURLcode res;
    315314  CURL* localCurl;
    316315  localCurl = curl_easy_init();
    317316  char* fileOnNet = new char [strlen(info->webRoot)+strlen(info->fileName)+2];
    318   strcpy (fileOnNet, info->webRoot);
    319   if (fileOnNet[strlen(fileOnNet)] != '/') //!< \todo windows-shit
    320     strcat (fileOnNet, "/");
    321   strcat (fileOnNet, info->fileName);
     317  strcpy(fileOnNet, info->webRoot);
     318  if(fileOnNet[strlen(fileOnNet)] != '/') //!< \todo windows-shit
     319    strcat(fileOnNet, "/");
     320  strcat(fileOnNet, info->fileName);
    322321  char* fileOnDisk = new char [strlen(info->localRoot)+strlen(info->fileName)+2];
    323   strcpy (fileOnDisk, info->localRoot);
    324   if (fileOnDisk[strlen(fileOnDisk)] != '/') //!< \todo windows-shit
    325     strcat (fileOnDisk, "/");
    326   strcat (fileOnDisk, info->fileName);
     322  strcpy(fileOnDisk, info->localRoot);
     323  if(fileOnDisk[strlen(fileOnDisk)] != '/') //!< \todo windows-shit
     324    strcat(fileOnDisk, "/");
     325  strcat(fileOnDisk, info->fileName);
    327326 
    328327  if(localCurl)
     
    340339
    341340      curl_easy_cleanup(localCurl);
    342       fclose (info->fileHandle);
     341      fclose(info->fileHandle);
    343342    }
    344343}
     
    353352bool OrxonoxGuiUpdate::downloadWithStyle(void* fileInfo)
    354353{
    355   if (isDownloading)
     354  if(isDownloading)
    356355    {
    357356      PRINTF(2)("unable to Download. already getting some file\n");
     
    359358    }
    360359  PRINTF(3)("Downloading.\n");
    361   FileInfo* info = (FileInfo*)fileInfo;
     360  FileInfo* info =(FileInfo*)fileInfo;
    362361  CURLcode res;
    363362  curlHandle = curl_easy_init();
    364363  char* fileOnNet = new char [strlen(info->webRoot)+strlen(info->fileName)+1];
    365   strcpy (fileOnNet, info->webRoot);
    366   strcat (fileOnNet, info->fileName);
     364  strcpy(fileOnNet, info->webRoot);
     365  strcat(fileOnNet, info->fileName);
    367366  char* fileOnDisk = new char [strlen(info->localRoot)+strlen(info->fileName)+1];
    368   strcpy (fileOnDisk, info->localRoot);
    369   strcat (fileOnDisk, info->fileName);
     367  strcpy(fileOnDisk, info->localRoot);
     368  strcat(fileOnDisk, info->fileName);
    370369
    371370  if(curlHandle)
     
    382381      curl_easy_setopt(curlHandle, CURLOPT_PROGRESSDATA, info->bar);
    383382
    384       if (!isDownloading)
     383      if(!isDownloading)
    385384        {
    386385#ifdef HAVE_PTHREAD_H     
     
    418417
    419418/**
    420    \brief The downloading process (either threaded or not).
     419   \brief The downloading process(either threaded or not).
    421420   \param fileInfo the FileInfo.
    422421
     
    435434void* OrxonoxGuiUpdate::downloadThreadFinished(void* fileInfo)
    436435{
    437   FileInfo* info = (FileInfo*)fileInfo;
    438 #ifdef HAVE_PTHREAD_H
    439   pthread_join (*downloadThreadID, NULL);
     436  FileInfo* info =(FileInfo*)fileInfo;
     437#ifdef HAVE_PTHREAD_H
     438  pthread_join(*downloadThreadID, NULL);
    440439#ifdef HAVE_GTK2
    441440  gdk_threads_enter();
    442441#endif /* HAVE_GTK2 */
    443442#endif /* HAVE_PTHREAD_H */
    444   if (curlHandle)
     443  if(curlHandle)
    445444    curl_easy_cleanup(curlHandle);
    446445 
     
    448447  fclose(info->fileHandle);
    449448
    450   if (isDownloading)
     449  if(isDownloading)
    451450    info->stateButton->setTitle("go on");
    452451  //  else
  • orxonox/branches/updater/src/gui/orxonox_gui_update.h

    r3298 r3315  
    3131  char* userName;                       //!< The user logged in.
    3232
    33   bool getSystemInfo();
     33  bool getSystemInfo(void);
    3434 
    3535  // Window creation.
     
    5353
    5454#ifdef HAVE_GTK2
    55   static gint updateDataFunc (GtkWidget* w, GdkEventKey* event, void* info);
    56   static gint updateSourceFunc (GtkWidget* w, GdkEventKey* event, void* info);
     55  static gint updateDataFunc(GtkWidget* w, GdkEventKey* event, void* info);
     56  static gint updateSourceFunc(GtkWidget* w, GdkEventKey* event, void* info);
    5757#endif /* HAVE_GTK2 */
    5858
     
    7171  };
    7272
    73   static size_t curlWriteFunc (void* ptr, size_t size, size_t nmemb, FILE* stream);
    74   static size_t curlReadFunc (void* ptr, size_t size, size_t nmemb, FILE* stream);
    75   static int curlProgressFunc (ProgressBar* Bar, double totalSize, double progress, double upTotal, double upProgress);
     73  static size_t curlWriteFunc(void* ptr, size_t size, size_t nmemb, FILE* stream);
     74  static size_t curlReadFunc(void* ptr, size_t size, size_t nmemb, FILE* stream);
     75  static int curlProgressFunc(ProgressBar* bar, double totalSize, double progress, double upTotal, double upProgress);
    7676
    7777  static CURL* curlHandle;
     
    8585  static bool isDownloading;
    8686
    87   static bool download (void* fileInfo);
    88   static bool downloadWithStyle (void* fileInfo);
    89   static void* downloadThread (void* fileInfo);
     87  static bool download(void* fileInfo);
     88  static bool downloadWithStyle(void* fileInfo);
     89  static void* downloadThread(void* fileInfo);
    9090  static void* downloadThreadFinished(void* fileInfo);
    9191
     
    9494
    9595 public:
    96   OrxonoxGuiUpdate ();
    97   ~OrxonoxGuiUpdate ();
     96  OrxonoxGuiUpdate(void);
     97  ~OrxonoxGuiUpdate(void);
    9898 
    99   Widget* getWidget ();
     99  Widget* getWidget(void);
    100100#ifdef HAVE_CURL   
    101   void updateDataWindowCreate (void);
     101  void updateDataWindowCreate(void);
    102102  Button* updateDataWindowGetButton(void);
    103103
    104   void updateSourceWindowCreate (void);
     104  void updateSourceWindowCreate(void);
    105105  Button* updateSourceWindowGetButton(void);
    106106
    107   bool* checkForUpdates();
     107  bool* checkForUpdates(void);
    108108 
    109109#endif /* HAVE_CURL */
  • orxonox/branches/updater/src/gui/orxonox_gui_video.cc

    r3288 r3315  
    3030   \brief Creates the Video-Option-Frame
    3131*/
    32 OrxonoxGuiVideo::OrxonoxGuiVideo ()
     32OrxonoxGuiVideo::OrxonoxGuiVideo(void)
    3333{
    34   videoFrame = new Frame ("Video-Options:");
    35   videoBox = new Box ('v');
    36   videoFrame->setGroupName("video");
     34  this->videoFrame = new Frame("Video-Options:");
     35  this->videoBox = new Box('v');
     36  this->videoFrame->setGroupName("video");
    3737 
    38   fullscreen = new CheckButton ("Fullscreen-mode");
    39   fullscreen->setFlagName ("windowed", "q", 1);
    40   fullscreen->saveability();
    41   videoBox->fill (fullscreen);
    42   wireframe = new CheckButton ("WireFrame-mode");
    43   wireframe->setFlagName ("wireframe", "w", 0);
    44   wireframe->saveability();
    45   videoBox->fill (wireframe);
     38  this->fullscreen = new CheckButton("Fullscreen-mode");
     39  this->fullscreen->setFlagName("windowed", "q", 1);
     40  this->fullscreen->saveability();
     41  this->videoBox->fill(fullscreen);
     42  this->wireframe = new CheckButton("WireFrame-mode");
     43  this->wireframe->setFlagName("wireframe", "w", 0);
     44  this->wireframe->saveability();
     45  this->videoBox->fill(wireframe);
    4646
    47   videoFrame->fill (videoBox);
     47  this->videoFrame->fill(videoBox);
    4848}
    4949
     
    5151   \return Returns the Video-frame
    5252*/
    53 Widget* OrxonoxGuiVideo::getWidget ()
     53Widget* OrxonoxGuiVideo::getWidget(void)
    5454{
    55   return videoFrame;
     55  return this->videoFrame;
    5656}
  • orxonox/branches/updater/src/gui/orxonox_gui_video.h

    r3187 r3315  
    1717  CheckButton* wireframe;   //!< CheckButton for wireframe Mode.
    1818 public:
    19   OrxonoxGuiVideo ();
    20   ~OrxonoxGuiVideo ();
     19  OrxonoxGuiVideo(void);
     20  ~OrxonoxGuiVideo(void);
    2121 
    22   Widget* getWidget ();
     22  Widget* getWidget(void);
    2323};
    2424#endif /* _ORXONOX_GUI_VIDEO_H */
Note: See TracChangeset for help on using the changeset viewer.