Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 16, 2006, 12:22:35 AM (18 years ago)
Author:
bensch
Message:

gui: notifier: outputs stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/gui/gl/specials/glgui_notifier.cc

    r8503 r8509  
    3333    // Element2D and generals
    3434    this->lineSpacing = 0;
     35    this->linesProcessed = 0;
    3536
    36     this->setBufferDisplaySize(10);
     37    this->setDisplayLineCount(10);
    3738  }
    3839
     
    4344  {
    4445    // delete the displayable Buffers
    45     while (!this->bufferText.empty())
     46    /*    while (!this->displayLines.empty())
     47        {
     48          delete this->displayLines.front().text;
     49          this->displayLines.pop_front();
     50        }
     51
     52        while (!this->hiddenText.empty())
     53        {
     54          delete this->hiddenText.top();
     55          this->hiddenText.pop();
     56        }*/
     57  }
     58
     59  void GLGuiNotifier::pushNotifyMessage(const std::string& message)
     60  {
     61    if (!this->hiddenText.empty())
    4662    {
    47       delete this->bufferText.front();
    48       this->bufferText.pop_front();
     63      printf("%s\n", message.c_str());
     64      DisplayLine dl;
     65      dl.text = this->hiddenText.top();
     66
     67      dl.text->setText(message);
     68      this->hiddenText.pop();
     69      dl.age = 0.0f;
     70      this->displayLines.push_back(dl);
     71
     72      this->repositionText();
     73    }
     74    else
     75    {
     76      printf("grumble... must be fixed\n");
    4977    }
    5078  }
    5179
     80
     81  void GLGuiNotifier::setDisplayLineCount(unsigned int count)
     82  {
     83    unsigned int currentCount = displayLines.size() + hiddenText.size();
     84
     85    for (unsigned int i = currentCount; i < count; ++i)
     86    {
     87      MultiLineText* text = new MultiLineText();
     88      this->applyTextSettings(text);
     89      this->hiddenText.push(text);
     90    }
     91    bufferDisplaySize = count;
     92  }
    5293
    5394
     
    5899  {
    59100    int linePos = -1;
    60     std::list<MultiLineText*>::iterator textIt;
    61     for (textIt = this->bufferText.begin() ; textIt != this->bufferText.end(); ++textIt )
     101    std::list<DisplayLine>::iterator textIt;
     102    for (textIt = this->displayLines.begin() ; textIt != this->displayLines.end(); ++textIt )
    62103    {
    63       linePos += (*textIt)->getLineCount();
    64       (*textIt)->setRelCoorSoft2D(this->calculateLinePosition(linePos), 8);
     104      linePos += (*textIt).text->getLineCount();
     105      (*textIt).text->setRelCoorSoft2D(this->calculateLinePosition(linePos), 8);
     106      //      printf("%f %f\n", (*textIt).text->getAbsCoor2D().x, (*textIt).text->getAbsCoor2D().y);
    65107    }
    66108  }
     
    71113   * @param text the Text to apply the settings to.
    72114   */
    73   void GLGuiNotifier::applyTextSettings(Text* text)
     115  void GLGuiNotifier::applyTextSettings(MultiLineText* text)
    74116  {
    75 /*    text->setSize(this->textSize);
    76     text->setFont(this->fontFile, this->textSize);
    77     text->setColor(this->textColor[0], this->textColor[1], this->textColor[2]);
    78     text->setBlending(this->textColor[3]);
    79     text->setLayer(this->getLayer());
     117    text->setSize(this->style().textSize());
     118    text->setLineWidth( 300 );
     119    //text->setFont(this->fontFile, this->textSize);
     120
     121    //text->setColor( Color(1,1,1,1)/*this->style().foregroundColor() */);
    80122    if (text->getParent2D() != this)
    81       text->setParent2D(this);*/
     123      text->setParent2D(this);
    82124  }
    83125
     
    113155  Vector2D GLGuiNotifier::calculateLinePosition(unsigned int lineNumber)
    114156  {
    115 //    return Vector2D(5.0f, (float)(this->textSize + this->lineSpacing)*(float)((int)this->bufferDisplaySize - (int)lineNumber - (int)1));
    116     return Vector2D();
     157    return Vector2D(0.0f, (float)(this->style().textSize() + this->lineSpacing)*(float)((int)this->bufferDisplaySize - (int)lineNumber - (int)1));
    117158  }
    118159
    119160
     161  void GLGuiNotifier::resize()
     162  {}
    120163
    121164  /**
Note: See TracChangeset for help on using the changeset viewer.