Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5248 in orxonox.OLD for trunk/src/lib/shell


Ignore:
Timestamp:
Sep 24, 2005, 10:30:08 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: moving up and down through the buffer with [PageUp] and [PageDown] enabled

Location:
trunk/src/lib/shell
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/shell/shell.cc

    r5247 r5248  
    6969  this->bufferDisplaySize = 10;
    7070  this->bufferOffset = 0;
     71  this->bufferIterator = ShellBuffer::getInstance()->getBuffer()->getIterator();
    7172
    7273  // INPUT LINE
     
    8687    delete this->bufferText[i];
    8788  delete[] this->bufferText;
     89  delete this->bufferIterator;
    8890
    8991  // delete the inputLine
     
    136138  }
    137139  delete bufferIT;
     140
     141  this->bufferOffset = 0;
    138142}
    139143
     
    246250 * moves the Display buffer (up or down)
    247251 * @param lineCount the count by which to shift the InputBuffer.
     252 *
     253 * @todo
    248254 */
    249255void Shell::moveDisplayBuffer(int lineCount)
    250256{
    251 
    252 
     257  if (!this->bufferIterator->compareListPointer(ShellBuffer::getInstance()->getBuffer()))
     258  {
     259    delete this->bufferIterator;
     260    this->bufferIterator = ShellBuffer::getInstance()->getBuffer()->getIterator();
     261  }
     262
     263  if (this->bufferOffset == 0)
     264   {
     265     this->bufferIterator->lastElement();
     266//     for (unsigned int i = 0; i < this->bufferDisplaySize; i++)
     267//       this->bufferIterator->prevStep();
     268   }
     269
     270  // boundraries
     271  if (this->bufferOffset + lineCount > (int)ShellBuffer::getInstance()->getBuffer()->getSize())
     272    lineCount = (int)ShellBuffer::getInstance()->getBuffer()->getSize()- this->bufferOffset;
     273  else if (this->bufferOffset + lineCount < 0)
     274    lineCount = -bufferOffset;
     275  this->bufferOffset += lineCount;
     276
     277  // moving the iterator to the right position
     278  int move = 0;
     279  while (move != lineCount)
     280  {
     281    if (move < lineCount)
     282    {
     283      ++move;
     284      this->bufferIterator->prevStep();
     285    }
     286    else
     287    {
     288      --move;
     289      this->bufferIterator->nextStep();
     290    }
     291  }
     292  // redisplay the buffers
     293  tIterator<char> it = *this->bufferIterator;
     294  for (unsigned int i = 0; i < this->bufferDisplaySize; i++)
     295  {
     296    this->bufferText[i]->setText(it.getCurrent(), false);
     297    it.prevStep();
     298  }
    253299}
    254300
     
    279325    else if (event.type == SDLK_PAGEUP)
    280326    {
    281 
     327      this->moveDisplayBuffer(+this->bufferDisplaySize-1);
    282328    }
    283329    else if (event.type == SDLK_PAGEDOWN)
    284330    {
    285 
     331      this->moveDisplayBuffer(-this->bufferDisplaySize+1);
    286332    }
    287333  }
  • trunk/src/lib/shell/shell.h

    r5247 r5248  
    44 *
    55 * @todo Buffer Display in different Colors for different debug mode.
    6  * @todo move up and down in Buffer
    76 */
    87
  • trunk/src/lib/shell/shell_input.cc

    r5245 r5248  
    285285  {
    286286    PRINT(0)("Help for the most important Shell-commands\n");
    287     PRINT(0)("F1 - HELP; F2 - DEBUG; ` - open/close shell\n");
     287    PRINT(0)("F1 - HELP; F2 - DEBUG; '`' - open/close shell\n");
    288288    PRINT(0)("input order:\n");
    289289    PRINT(0)("ClassName [objectName] function [parameter1, [parameter2 ...]]  or\n");
     
    328328      this->help();
    329329    else if (event.type == SDLK_F2)
    330       this->debug();
     330      ;//this->debug();
    331331    else if (event.type == SDLK_UP)
    332332      this->historyMoveUp();
Note: See TracChangeset for help on using the changeset viewer.