Browse Source

Noch ein fehler behoben

Kolja Strohm 5 years ago
parent
commit
bc90007fff
1 changed files with 26 additions and 18 deletions
  1. 26 18
      Schrift.cpp

+ 26 - 18
Schrift.cpp

@@ -101,7 +101,7 @@ Buchstabe *Buchstabe::release()
 // Inhalt der Alphabet Klasse aus Schrift.h
 // Konstruktor 
 Alphabet::Alphabet()
-    : zeichen( new Buchstabe*[ 256 ] ),
+    : zeichen( new Buchstabe * [ 256 ] ),
     schriftSize( 12 ),
     ref( 1 )
 {
@@ -132,7 +132,7 @@ void Alphabet::NeuAlphabet() // Initialisierung
         zeichen[ i ] = 0;
 }
 
-void Alphabet::setBuchstabe( unsigned char i, Buchstabe *buchstabe ) // setzt einen Buchstaben
+void Alphabet::setBuchstabe( unsigned char i, Buchstabe * buchstabe ) // setzt einen Buchstaben
 {
     if( zeichen[ i ] )
         zeichen[ i ]->release();
@@ -207,7 +207,7 @@ AlphabetArray::~AlphabetArray()
 }
 
 // nicht constant 
-bool AlphabetArray::addAlphabet( Alphabet *alphabet ) // Fügt ein Alphabet hinzu
+bool AlphabetArray::addAlphabet( Alphabet * alphabet ) // Fügt ein Alphabet hinzu
 {
     if( This )
     {
@@ -284,7 +284,7 @@ Alphabet *AlphabetArray::getAlphabetI( int index, int count ) const
     return 0;
 }
 
-Alphabet *AlphabetArray::zAlphabetI( int index, int count ) const
+Alphabet * AlphabetArray::zAlphabetI( int index, int count ) const
 {
     if( count == index )
         return This;
@@ -293,7 +293,7 @@ Alphabet *AlphabetArray::zAlphabetI( int index, int count ) const
     return 0;
 }
 
-AlphabetArray *AlphabetArray::getNext() const // gibt das nächste Alphabet zurück
+AlphabetArray * AlphabetArray::getNext() const // gibt das nächste Alphabet zurück
 {
     return next;
 }
@@ -312,7 +312,7 @@ Schrift::~Schrift()
     delete alphabet;
 }
 
-bool Schrift::addAlphabet( Alphabet *alphabet ) // Fügt der Schrift ein Alphabet hinzu
+bool Schrift::addAlphabet( Alphabet * alphabet ) // Fügt der Schrift ein Alphabet hinzu
 {
     if( this->alphabet->addAlphabet( alphabet ) )
     {
@@ -347,7 +347,7 @@ Alphabet *Schrift::getAlphabet( int sg ) const
     return drawAlphabet->getThis();
 }
 
-Alphabet *Schrift::zAlphabet( int sg ) const
+Alphabet * Schrift::zAlphabet( int sg ) const
 {
     Alphabet *drawAlphabet = alphabet->zAlphabet( (unsigned char)sg );
     if( !drawAlphabet )
@@ -365,7 +365,7 @@ Alphabet *Schrift::zAlphabet( int sg ) const
     return drawAlphabet;
 }
 
-Alphabet *Schrift::getAlphabetI( int index ) const
+Alphabet * Schrift::getAlphabetI( int index ) const
 {
     return alphabet->getAlphabetI( index, 0 );
 }
@@ -400,7 +400,7 @@ TextRenderer::TextRenderer()
     : TextRenderer( 0 )
 {}
 
-TextRenderer::TextRenderer( Schrift *schrift )
+TextRenderer::TextRenderer( Schrift * schrift )
 {
     s = schrift;
     schriftSize = 12;
@@ -416,7 +416,7 @@ TextRenderer::~TextRenderer()
 }
 
 
-void TextRenderer::setSchriftZ( Schrift *schrift )
+void TextRenderer::setSchriftZ( Schrift * schrift )
 {
     if( s )
         s->release();
@@ -459,7 +459,7 @@ void TextRenderer::setZeichenAbstand( int za )
 // Fügt Zeilenumbrüche in den Text ein, so dass er bei einer vorgegebenen Breite follständig angezeigt wird
 //  zText: Der text, in den die Zeilenumbrüche eingefügt werden sollen
 //  maxBreite: Die Breite in Pixeln auf der der Text follständig angezeigt werden soll
-void TextRenderer::textFormatieren( Text *zTxt, int maxBreite )
+void TextRenderer::textFormatieren( Text * zTxt, int maxBreite )
 {
     int lastPos = -1;
     int x = 0;
@@ -508,7 +508,7 @@ void TextRenderer::textFormatieren( Text *zTxt, int maxBreite )
 //  fbeg: Die Position des Zeichens im Text, wo die Einfärbung beginnen soll. Der Text wird von dort bis zur Cursorposition eingefärbt
 //  ff: Die Hintergrund Farbe des eingefärbten Textes
 //  f: Eine Funktion die für jeden Buchstaben aufgerufen wird und seine Farbe zurückgibt
-void TextRenderer::renderText( int x, int y, const char *txt, Bild &zRObj, std::function< int( int, int, int ) > f, int cpos, int cf, int fbeg, int ff )
+void TextRenderer::renderText( int x, int y, const char *txt, Bild & zRObj, std::function< int( int, int, int ) > f, int cpos, int cf, int fbeg, int ff )
 {
     if( !s )
         return;
@@ -567,7 +567,7 @@ void TextRenderer::renderText( int x, int y, const char *txt, Bild &zRObj, std::
 //  fbeg: Die Position des Zeichens im Text, wo die Einfärbung beginnen soll. Der Text wird von dort bis zur Cursorposition eingefärbt
 //  ff: Die Hintergrund Farbe des eingefärbten Textes
 //  f: Die Farbe, in der der Text gezeichnet werden soll
-void TextRenderer::renderText( int x, int y, const char *txt, Bild &zRObj, int f, int cpos, int cf, int fbeg, int ff )
+void TextRenderer::renderText( int x, int y, const char *txt, Bild & zRObj, int f, int cpos, int cf, int fbeg, int ff )
 {
     return renderText( x, y, txt, zRObj, [ f ]( int a, int b, int c ) { return f; }, cpos, cf, fbeg, ff );
 }
@@ -582,7 +582,7 @@ void TextRenderer::renderText( int x, int y, const char *txt, Bild &zRObj, int f
 //  underlined: 1, falls der Text unterstrichen sein soll
 //  selected: 1, falls das zeichen eingefärbt sein soll
 //  selectedBackgroundColor: Die Hintergrund Farbe des eingefärbten Textes
-void TextRenderer::renderChar( int &x, int y, char c, Bild &zRObj, int color, bool underlined, bool selected, int selectedBackgroundColor )
+void TextRenderer::renderChar( int &x, int y, char c, Bild & zRObj, int color, bool underlined, bool selected, int selectedBackgroundColor )
 {
     if( !s )
         return;
@@ -764,12 +764,16 @@ void TextRenderer::renderChar( int &x, int y, char c, Bild &zRObj, int color, bo
     {
         if( selected )
             zRObj.alphaRegion( x, y, schriftSize / 2 + zeichenAbstand, getZeilenHeight(), selectedBackgroundColor );
+        if( underlined )
+            zRObj.drawLinieHAlpha( x - (int)( zeichenAbstand / 2.0 + 0.5 ), y + getZeilenHeight() + getZeichenAbstand() / 2, schriftSize / 2 + zeichenAbstand + (int)( zeichenAbstand / 2.0 + 0.5 ), 0xFF000000 | color );
         x += schriftSize / 2 + zeichenAbstand;
     }
     else if( c == '\t' )
     {
         if( selected )
             zRObj.alphaRegion( x, y, schriftSize + zeichenAbstand, getZeilenHeight(), selectedBackgroundColor );
+        if( underlined )
+            zRObj.drawLinieHAlpha( x - (int)( zeichenAbstand / 2.0 + 0.5 ), y + getZeilenHeight() + getZeichenAbstand() / 2, schriftSize + zeichenAbstand + (int)( zeichenAbstand / 2.0 + 0.5 ), 0xFF000000 | color );
         x += schriftSize + zeichenAbstand;
     }
 }
@@ -907,7 +911,7 @@ int TextRenderer::textPos( const char *txt, int mausX, int mausY ) const
     return -1;
 }
 
-TextRenderer *TextRenderer::getThis()
+TextRenderer * TextRenderer::getThis()
 {
     ref++;
     return this;
@@ -925,7 +929,7 @@ GravurTextRenderer::GravurTextRenderer()
     : GravurTextRenderer( 0 )
 {}
 
-GravurTextRenderer::GravurTextRenderer( Schrift *schrift )
+GravurTextRenderer::GravurTextRenderer( Schrift * schrift )
     : TextRenderer( schrift )
 {}
 
@@ -942,7 +946,7 @@ GravurTextRenderer::~GravurTextRenderer()
 //  underlined: 1, falls der Text unterstrichen sein soll
 //  selected: 1, falls das zeichen eingefärbt sein soll
 //  selectedBackgroundColor: Die Hintergrund Farbe des eingefärbten Textes
-void GravurTextRenderer::renderChar( int &x, int y, char c, Bild &zRObj, int color, bool underlined, bool selected, int selectedBackgroundColor )
+void GravurTextRenderer::renderChar( int &x, int y, char c, Bild & zRObj, int color, bool underlined, bool selected, int selectedBackgroundColor )
 {
     if( !s )
         return;
@@ -1033,12 +1037,16 @@ void GravurTextRenderer::renderChar( int &x, int y, char c, Bild &zRObj, int col
     {
         if( selected )
             zRObj.alphaRegion( x, y, schriftSize / 2 + zeichenAbstand, getZeilenHeight(), selectedBackgroundColor );
+        if( underlined )
+            zRObj.drawLinieHAlpha( x - (int)( zeichenAbstand / 2.0 + 0.5 ), y + getZeilenHeight() + getZeichenAbstand() / 2, schriftSize / 2 + zeichenAbstand + (int)( zeichenAbstand / 2.0 + 0.5 ), 0xFF000000 | color );
         x += schriftSize / 2 + zeichenAbstand;
     }
     else if( c == '\t' )
     {
         if( selected )
             zRObj.alphaRegion( x, y, schriftSize + zeichenAbstand, getZeilenHeight(), selectedBackgroundColor );
+        if( underlined )
+            zRObj.drawLinieHAlpha( x - (int)( zeichenAbstand / 2.0 + 0.5 ), y + getZeilenHeight() + getZeichenAbstand() / 2, schriftSize + zeichenAbstand + (int)( zeichenAbstand / 2.0 + 0.5 ), 0xFF000000 | color );
         x += schriftSize + zeichenAbstand;
     }
 }
@@ -1071,7 +1079,7 @@ int GravurTextRenderer::getCharHeight( const char c ) const
 
 // Verringert den Reference Counting Zähler. Wenn der Zähler 0 erreicht, wird das Objekt automatisch gelöscht.
 //  return: 0.
-TextRenderer *GravurTextRenderer::release()
+TextRenderer * GravurTextRenderer::release()
 {
     if( !--ref )
         delete this;