Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3423 in orxonox.OLD for orxonox/trunk/src/gui/orxonox_gui_keys.cc


Ignore:
Timestamp:
Feb 27, 2005, 7:11:19 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: merged branches/updater back into the trunk
merged with command: svn merge branches/updater trunk -r 3241:HEAD
resolved conflicts in debug.h in favor of the trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/gui/orxonox_gui_keys.cc

    r3187 r3423  
    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);
     43}
     44
     45/**
     46   \brief Destructs the Keys-stuff
     47*/
     48OrxonoxGuiKeys::~OrxonoxGuiKeys(void)
     49{
     50  // nothing to do here.
    4351}
    4452
     
    4755   \return Returns the Audio-frame
    4856*/
    49 Widget* OrxonoxGuiKeys::getWidget ()
    50 {
    51   return keysFrame;
     57Widget* OrxonoxGuiKeys::getWidget(void)
     58{
     59  return this->keysFrame;
    5260}
    5361
     
    6068Player::Player(char* player)
    6169{
    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    
     70  char* windowName = new char[strlen(player)+25];
     71  strcpy(windowName, "Keyboard settings of ");
     72  strcat(windowName, player);
     73  this->pKeyWindow = new Window(windowName);
     74  this->pKeyFrame = new Frame(windowName);
     75   this->pKeysBox = new Box('v');
     76   this->pKeysBox->setGroupName(player);
     77    this->pKeysBox->fill(addKey(UP, "up"));
     78    this->pKeysBox->fill(addKey(DOWN, "down"));
     79    this->pKeysBox->fill(addKey(LEFT, "left"));
     80    this->pKeysBox->fill(addKey(RIGHT, "right"));
     81    this->pKeysBox->fill(addKey(SHOOT, "shoot"));
     82    delete windowName;
    7483    closeButton = new Button("close");
    7584#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);
     85    this->closeButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowClose);
     86#endif /* HAVE_GTK2 */
     87
     88    this->pKeysBox->fill(this->closeButton);
     89    this->pKeyFrame->fill(this->pKeysBox);
     90   this->pKeyWindow->fill(this->pKeyFrame);
     91   Window::addWindow(this->pKeyWindow);
     92#ifdef HAVE_GTK2
     93   this->pKeyWindow->connectSignal("destroy", this->pKeyWindow, Window::windowClose);
     94   this->pKeyWindow->connectSignal("delete_event", this->pKeyWindow, Window::windowClose);
     95#endif /* HAVE_GTK2 */
     96
     97  this->openButton = new Button(player);
     98#ifdef HAVE_GTK2
     99  this->openButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowOpen);
     100#endif /* HAVE_GTK2 */
     101
     102  this->inputWindow = new Window("inputWindow");
     103
     104  this->inputButton = new Button("test");
     105  this->inputWindow->fill(inputButton);
     106#ifdef HAVE_GTK2
     107  this->inputWindow->connectSignal("destroy",  Widget::doNothingSignal);
     108  this->inputWindow->connectSignal("delete_event", Widget::doNothingSignal);
    100109#endif /* HAVE_GTK2 */
    101110
     
    108117   \returns A widget that has the Key-Box
    109118*/
    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->saveable = true;
     119Widget* Player::addKey(KEYS key, char* name)
     120{
     121  this->inputKey[key] = new InputKey;
     122  this->inputKey[key]->pKeyBox = new Box();
     123  this->inputKey[key]->pKeyButton = new Button(name);
     124  this->inputKey[key]->pKeyOLabel = new OptionLabel(name, name);
     125  this->inputKey[key]->pKeyOLabel->saveability();
    117126
    118127#ifdef HAVE_GTK2
    119128  //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;
     129  this->inputKey[key]->pKeyButton->connectSignal("button_press_event", this->inputKey[key], inputWindowEvent);
     130#endif /* HAVE_GTK2 */
     131  this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyButton);
     132  this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyOLabel);
     133  return this->inputKey[key]->pKeyBox;
    125134}
    126135
     
    128137   \returns the OpenButton of a Player
    129138*/
    130 Button* Player::getOpenButton()
    131 {
    132   return openButton;
    133 }
    134 
    135 /**
    136    \brief sets a new Key (only output)
     139Button* Player::getOpenButton(void)
     140{
     141  return this->openButton;
     142}
     143
     144/**
     145   \brief sets a new Key(only output)
    137146   \param key the new Key.
    138147*/
     
    163172gint Player::key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey)
    164173{
    165   InputKey* inputkey = (InputKey*) inputKey;
     174  InputKey* inputkey =(InputKey*) inputKey;
    166175  char title [20];
    167176
     
    256265      char* tmp;
    257266      sprintf(tmp, "%c", event->keyval);
    258       printf ("other key %s \n", tmp);
     267      printf("other key %s \n", tmp);
    259268      strcpy(title, tmp);
    260269      break;
    261270    }
    262271
    263   inputkey->pKeyOLabel->setValue (title);
     272  inputkey->pKeyOLabel->setValue(title);
    264273  inputButton->disconnectSignal(keySignal);
    265274  inputWindow->close();
Note: See TracChangeset for help on using the changeset viewer.