|
|
@@ -99,8 +99,8 @@ char LTDBPixel::addByte(
|
|
|
{
|
|
|
#ifdef WIN32
|
|
|
MessageBox(NULL,
|
|
|
- "Fehler, die Bilddatei ist beschädigt",
|
|
|
- "Fehler",
|
|
|
+ "Error, the image file is corrupted",
|
|
|
+ "Error",
|
|
|
MB_ICONERROR);
|
|
|
#endif
|
|
|
exit(0);
|
|
|
@@ -118,70 +118,67 @@ char LTDBPixel::addByte(
|
|
|
if (!changeA) A = davor->getA();
|
|
|
maxIndex = (char)(maxIndex
|
|
|
+ (changeR + changeG + changeB + changeA)
|
|
|
- * (8 - komp)); // Bestimmung der Laenge
|
|
|
- // des Pixels in Bits. Jede Farbe hat von grund auf 8 Bits,
|
|
|
- // durch komprimierung kanns kleiner sein
|
|
|
+ * (8 - komp)); // Determine the length
|
|
|
+ // of the pixel in bits. Each color has 8 bits by default,
|
|
|
+ // compression can make it smaller
|
|
|
}
|
|
|
else
|
|
|
- maxIndex = (char)(maxIndex + 7); // Da der Pixel nicht die Werte
|
|
|
- // des vorherigen uebernimmt,
|
|
|
- // wird er um 7 Bits groesser
|
|
|
- break;
|
|
|
- case 1: // Das zweite Bit eines Pixels speichert entweder die
|
|
|
- // Komprimierungsart, oder schon die Farbe
|
|
|
- if (change) // Das Bit gehoert zu den 7 Komprimierungsbits
|
|
|
+ maxIndex
|
|
|
+ = (char)(maxIndex + 7); // Since the pixel doesn't inherit
|
|
|
+ // values from the previous one,
|
|
|
+ // it is 7 bits larger
|
|
|
+ break;
|
|
|
+ case 1: // The second bit of a pixel stores either the
|
|
|
+ // compression type or already the color
|
|
|
+ if (change) // The bit belongs to the 7 compression bits
|
|
|
changeR = (bool)((byte >> (7 - i)) & 0x1);
|
|
|
else
|
|
|
{
|
|
|
if (!addBitZuFarbe(
|
|
|
- (unsigned char)(byte
|
|
|
- >> (7
|
|
|
- - i)))) // Das Bit gehoert zur Farbe
|
|
|
+ (unsigned char)(byte >> (7 - i)))) // The bit belongs to
|
|
|
+ // the color
|
|
|
return (unsigned char)i;
|
|
|
}
|
|
|
break;
|
|
|
- case 2: // Das dritte Bit eines Pixels speichert entweder die
|
|
|
- // Komprimierungsart, oder schon die Farbe
|
|
|
- if (change) // Das Bit gehoert zu den 7 Komprimierungsbits
|
|
|
+ case 2: // The third bit of a pixel stores either the
|
|
|
+ // compression type or already the color
|
|
|
+ if (change) // The bit belongs to the 7 compression bits
|
|
|
changeG = (bool)((byte >> (7 - i)) & 0x1);
|
|
|
else
|
|
|
{
|
|
|
if (!addBitZuFarbe(
|
|
|
- (unsigned char)(byte
|
|
|
- >> (7
|
|
|
- - i)))) // Das Bit gehoert zur Farbe
|
|
|
+ (unsigned char)(byte >> (7 - i)))) // The bit belongs to
|
|
|
+ // the color
|
|
|
return (unsigned char)i;
|
|
|
}
|
|
|
break;
|
|
|
- case 3: // Das vierte Bit eines Pixels speichert entweder die
|
|
|
- // Komprimierungsart, oder schon die Farbe
|
|
|
- if (change) // Das Bit gehoert zu den 7 Komprimierungsbits
|
|
|
+ case 3: // The fourth bit of a pixel stores either the
|
|
|
+ // compression type or already the color
|
|
|
+ if (change) // The bit belongs to the 7 compression bits
|
|
|
changeB = (bool)((byte >> (7 - i)) & 0x1);
|
|
|
else
|
|
|
{
|
|
|
if (!addBitZuFarbe(
|
|
|
- (unsigned char)(byte
|
|
|
- >> (7
|
|
|
- - i)))) // Das Bit gehoert zur Farbe
|
|
|
+ (unsigned char)(byte >> (7 - i)))) // The bit belongs to
|
|
|
+ // the color
|
|
|
return (unsigned char)i;
|
|
|
}
|
|
|
break;
|
|
|
- case 4: // Das fuenfte Bit eines Pixels speichert entweder die
|
|
|
- // Komprimierungsart, oder schon die Farbe
|
|
|
- if (change) // Das Bit gehoert zu den 7 Komprimierungsbits
|
|
|
+ case 4: // The fifth bit of a pixel stores either the
|
|
|
+ // compression type or already the color
|
|
|
+ if (change) // The bit belongs to the 7 compression bits
|
|
|
changeA = (bool)((byte >> (7 - i)) & 0x1);
|
|
|
else
|
|
|
{
|
|
|
if (!addBitZuFarbe(
|
|
|
- (unsigned char)(byte
|
|
|
- >> (7
|
|
|
- - i)))) // Das Bit gehoert zur Farbe
|
|
|
+ (unsigned char)(byte >> (7 - i)))) // The bit belongs to
|
|
|
+ // the color
|
|
|
return (unsigned char)i;
|
|
|
}
|
|
|
break;
|
|
|
- case 5: // Das sechste Bit eines Pixels speichert entweder die
|
|
|
- // Komprimierungsart, oder schon die Farbe
|
|
|
- if (change) // Das Bit gehoert zu den 7 Komprimierungsbits
|
|
|
+ case 5: // The sixth bit of a pixel stores either the
|
|
|
+ // compression type or already the color
|
|
|
+ if (change) // The bit belongs to the 7 compression bits
|
|
|
komp = (unsigned char)(komp
|
|
|
| ((unsigned char)((byte >> (7 - i))
|
|
|
& 0x1)
|
|
|
@@ -190,15 +187,14 @@ char LTDBPixel::addByte(
|
|
|
else
|
|
|
{
|
|
|
if (!addBitZuFarbe(
|
|
|
- (unsigned char)(byte
|
|
|
- >> (7
|
|
|
- - i)))) // Das Bit gehoert zur Farbe
|
|
|
+ (unsigned char)(byte >> (7 - i)))) // The bit belongs to
|
|
|
+ // the color
|
|
|
return (unsigned char)i;
|
|
|
}
|
|
|
break;
|
|
|
- case 6: // Das siebte Bit eines Pixels speichert entweder die
|
|
|
- // Komprimierungsart, oder schon die Farbe
|
|
|
- if (change) // Das Bit gehoert zu den 7 Komprimierungsbits
|
|
|
+ case 6: // The seventh bit of a pixel stores either the
|
|
|
+ // compression type or already the color
|
|
|
+ if (change) // The bit belongs to the 7 compression bits
|
|
|
komp = (unsigned char)(komp
|
|
|
| ((unsigned char)((byte >> (7 - i))
|
|
|
& 0x1)
|
|
|
@@ -207,42 +203,41 @@ char LTDBPixel::addByte(
|
|
|
else
|
|
|
{
|
|
|
if (!addBitZuFarbe(
|
|
|
- (unsigned char)(byte
|
|
|
- >> (7
|
|
|
- - i)))) // Das Bit gehoert zur Farbe
|
|
|
+ (unsigned char)(byte >> (7 - i)))) // The bit belongs to
|
|
|
+ // the color
|
|
|
return (unsigned char)i;
|
|
|
}
|
|
|
break;
|
|
|
- case 7: // Das achte Bit eines Pixels speichert entweder die
|
|
|
- // Komprimierungsart, oder schon die Farbe
|
|
|
- if (change) // Das Bit gehoert zu den 7 Komprimierungsbits
|
|
|
+ case 7: // The eighth bit of a pixel stores either the
|
|
|
+ // compression type or already the color
|
|
|
+ if (change) // The bit belongs to the 7 compression bits
|
|
|
{
|
|
|
komp = (unsigned char)(komp | ((byte >> (7 - i)) & 0x1)) & 7;
|
|
|
- // Das war das letzte Komprimierungsbit
|
|
|
- // Komprimierung auswerten
|
|
|
+ // That was the last compression bit
|
|
|
+ // Evaluate compression
|
|
|
miR = (char)(miR - komp), miG = (char)(miG - komp),
|
|
|
miB = (char)(miB - komp), miA = (char)(miA - komp);
|
|
|
if (!changeR) R = davor->getR();
|
|
|
if (!changeG) G = davor->getG();
|
|
|
if (!changeB) B = davor->getB();
|
|
|
if (!changeA) A = davor->getA();
|
|
|
- maxIndex = (char)(maxIndex
|
|
|
- + (changeR + changeG + changeB + changeA)
|
|
|
- * (8 - komp)); // Bitlaenge des Pixels
|
|
|
+ maxIndex
|
|
|
+ = (char)(maxIndex
|
|
|
+ + (changeR + changeG + changeB + changeA)
|
|
|
+ * (8 - komp)); // Bit length of the pixel
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (!addBitZuFarbe(
|
|
|
- (unsigned char)(byte
|
|
|
- >> (7
|
|
|
- - i)))) // Das Bit gehoert zur Farbe
|
|
|
+ (unsigned char)(byte >> (7 - i)))) // The bit belongs to
|
|
|
+ // the color
|
|
|
return (unsigned char)i;
|
|
|
}
|
|
|
break;
|
|
|
- default: // Die restlichen Bits speichern alle die Farbwerte des Pixels
|
|
|
- if (!addBitZuFarbe(
|
|
|
- (unsigned char)(byte
|
|
|
- >> (7 - i)))) // Das Bit gehoert zur Farbe
|
|
|
+ default: // The remaining bits all store the color values of the pixel
|
|
|
+ if (!addBitZuFarbe((
|
|
|
+ unsigned char)(byte
|
|
|
+ >> (7 - i)))) // The bit belongs to the color
|
|
|
return (unsigned char)i;
|
|
|
break;
|
|
|
}
|
|
|
@@ -263,27 +258,25 @@ char LTDBPixel::addByte(
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
-void LTDBPixel::setFarbe(int f) // setzt die Farbe des Pixels
|
|
|
-{ // Da diese Funktion aufgerufen wird, moechte man die Klasse nun zum speichern
|
|
|
- // verwenden
|
|
|
- // Werte zuruecksetzen, fals mit der Klasse schon geladen oder gespeichert
|
|
|
- // wurde
|
|
|
+void LTDBPixel::setFarbe(int f) // sets the color of the pixel
|
|
|
+{ // Since this function is called, the class is now to be used for saving
|
|
|
+ // Reset values in case the class was already used for loading or saving
|
|
|
index = 0, maxIndex = 1;
|
|
|
change = 0, changeR = 0, changeG = 0, changeB = 0, changeA = 0, komp = 0;
|
|
|
iR = 0, iG = 0, iB = 0, iA = 0;
|
|
|
miR = 8, miG = 8, miB = 8, miA = 8;
|
|
|
- // Farbwerte setzen
|
|
|
+ // Set color values
|
|
|
R = (unsigned char)(f >> 16);
|
|
|
G = (unsigned char)(f >> 8);
|
|
|
B = (unsigned char)f;
|
|
|
A = (unsigned char)(f >> 24);
|
|
|
}
|
|
|
|
|
|
-void LTDBPixel::komprimieren() // Komprimiert den Pixel
|
|
|
+void LTDBPixel::komprimieren() // Compresses the pixel
|
|
|
{
|
|
|
maxIndex = 1;
|
|
|
if (!davor)
|
|
|
- { // Das ist der erste Pixel
|
|
|
+ { // This is the first pixel
|
|
|
change = 1;
|
|
|
changeR = 1;
|
|
|
changeG = 1;
|
|
|
@@ -296,7 +289,7 @@ void LTDBPixel::komprimieren() // Komprimiert den Pixel
|
|
|
miA = (char)getBits(A);
|
|
|
}
|
|
|
else
|
|
|
- { // Es wird die differenz zum vorrigen Pixel gespeichert
|
|
|
+ { // The difference to the previous pixel is stored
|
|
|
miR = (char)getBits((char)(R - davor->getR()));
|
|
|
miG = (char)getBits((char)(G - davor->getG()));
|
|
|
miB = (char)getBits((char)(B - davor->getB()));
|
|
|
@@ -305,7 +298,7 @@ void LTDBPixel::komprimieren() // Komprimiert den Pixel
|
|
|
changeG = G != davor->getG();
|
|
|
changeB = B != davor->getB();
|
|
|
changeA = A != davor->getA();
|
|
|
- } // Pruefen ob sich etwas aendert
|
|
|
+ } // Check if something changes
|
|
|
if (!miR && changeR) ++miR;
|
|
|
if (!miG && changeG) ++miG;
|
|
|
if (!miB && changeB) ++miB;
|
|
|
@@ -321,19 +314,19 @@ void LTDBPixel::komprimieren() // Komprimiert den Pixel
|
|
|
if (changeR != davor->getChangeR() || changeG != davor->getChangeG()
|
|
|
|| changeB != davor->getChangeB() || changeA != davor->getChangeA()
|
|
|
|| komp != davor->getKomp())
|
|
|
- { // Es aendert sich etwas
|
|
|
+ { // Something changes
|
|
|
change = 1;
|
|
|
maxIndex = (char)(maxIndex + 7);
|
|
|
}
|
|
|
else
|
|
|
- { // Es aendert sich nichts
|
|
|
+ { // Nothing changes
|
|
|
change = 0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
bool LTDBPixel::getNextFarbeBit(
|
|
|
- char& byte, int i) // Speichert das naechste Farbbit in byte
|
|
|
+ char& byte, int i) // Stores the next color bit in byte
|
|
|
{
|
|
|
unsigned char RR = R;
|
|
|
unsigned char GG = G;
|
|
|
@@ -346,110 +339,110 @@ bool LTDBPixel::getNextFarbeBit(
|
|
|
BB = (unsigned char)(BB - davor->getB());
|
|
|
AA = (unsigned char)(AA - davor->getA());
|
|
|
}
|
|
|
- if (changeR && iR != miR) // Das Bit gehoert zu Rot
|
|
|
+ if (changeR && iR != miR) // The bit belongs to red
|
|
|
{
|
|
|
byte |= (char)(((RR >> (7 - komp - iR)) & 0x1) << (7 - i));
|
|
|
++iR;
|
|
|
}
|
|
|
- else if (changeG && iG != miG) // Das Bit gehoert zu Gruen
|
|
|
+ else if (changeG && iG != miG) // The bit belongs to green
|
|
|
{
|
|
|
byte |= (char)(((GG >> (7 - komp - iG)) & 0x1) << (7 - i));
|
|
|
++iG;
|
|
|
}
|
|
|
- else if (changeB && iB != miB) // Das Bit gehoert zu Blau
|
|
|
+ else if (changeB && iB != miB) // The bit belongs to blue
|
|
|
{
|
|
|
byte |= (char)(((BB >> (7 - komp - iB)) & 0x1) << (7 - i));
|
|
|
++iB;
|
|
|
}
|
|
|
- else if (changeA && iA != miA) // Das Bit gehoert zu Alpha
|
|
|
+ else if (changeA && iA != miA) // The bit belongs to alpha
|
|
|
{
|
|
|
byte |= (char)(((AA >> (7 - komp - iA)) & 0x1) << (7 - i));
|
|
|
++iA;
|
|
|
}
|
|
|
- else // Der Pixel ist bereits zu ende
|
|
|
+ else // The pixel is already finished
|
|
|
return false;
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
char LTDBPixel::getNextByte(
|
|
|
- char& byte, int begin) // Gibt die naechsten Bits Zurueck, -1 wenn der Pixel
|
|
|
- // nicht zu ende ist
|
|
|
+ char& byte, int begin) // Returns the next bits, -1 if the pixel
|
|
|
+ // is not finished
|
|
|
{
|
|
|
- // bbegin gibt an wohin in die byte-variable geschrieben werden soll
|
|
|
- // die Funktion gibt das ende des Pixels in der byte-variable zurueck
|
|
|
- // -1 heisst, dass der Pixel nicht zu ende ist
|
|
|
+ // begin specifies where to write in the byte variable
|
|
|
+ // the function returns the end of the pixel in the byte variable
|
|
|
+ // -1 means the pixel is not finished
|
|
|
for (int i = begin; i < 8; ++i)
|
|
|
{
|
|
|
switch (index)
|
|
|
{
|
|
|
- case 0: // Das erste Bit des Pixels speichert, ob sich etwas an der
|
|
|
- // Komprimierung aendert
|
|
|
+ case 0: // The first bit of the pixel stores whether the
|
|
|
+ // compression changes
|
|
|
byte |= (char)(((int)change & 0x1) << (7 - i));
|
|
|
break;
|
|
|
- case 1: // Das zweite Bit des Pixels speichert entweder schon die Farbe
|
|
|
- // oder die Komprimierung
|
|
|
- if (change) // Komprimierung
|
|
|
+ case 1: // The second bit of the pixel stores either the color
|
|
|
+ // or the compression
|
|
|
+ if (change) // Compression
|
|
|
byte |= (char)(((int)changeR & 0x1) << (7 - i));
|
|
|
- else // Farbe
|
|
|
+ else // Color
|
|
|
{
|
|
|
if (!getNextFarbeBit(byte, i)) return (char)i;
|
|
|
}
|
|
|
break;
|
|
|
- case 2: // Das dritte Bit des Pixels speichert entweder schon die Farbe
|
|
|
- // oder die Komprimierung
|
|
|
- if (change) // Komprimierung
|
|
|
+ case 2: // The third bit of the pixel stores either the color
|
|
|
+ // or the compression
|
|
|
+ if (change) // Compression
|
|
|
byte |= (char)(((int)changeG & 0x1) << (7 - i));
|
|
|
- else // Farbe
|
|
|
+ else // Color
|
|
|
{
|
|
|
if (!getNextFarbeBit(byte, i)) return (char)i;
|
|
|
}
|
|
|
break;
|
|
|
- case 3: // Das vierte Bit des Pixels speichert entweder schon die Farbe
|
|
|
- // oder die Komprimierung
|
|
|
- if (change) // Komprimierung
|
|
|
+ case 3: // The fourth bit of the pixel stores either the color
|
|
|
+ // or the compression
|
|
|
+ if (change) // Compression
|
|
|
byte |= (char)(((int)changeB & 0x1) << (7 - i));
|
|
|
- else // Farbe
|
|
|
+ else // Color
|
|
|
{
|
|
|
if (!getNextFarbeBit(byte, i)) return (char)i;
|
|
|
}
|
|
|
break;
|
|
|
- case 4: // Das fuenfte Bit des Pixels speichert entweder schon die Farbe
|
|
|
- // oder die Komprimierung
|
|
|
- if (change) // Komprimierung
|
|
|
+ case 4: // The fifth bit of the pixel stores either the color
|
|
|
+ // or the compression
|
|
|
+ if (change) // Compression
|
|
|
byte |= (char)(((int)changeA & 0x1) << (7 - i));
|
|
|
- else // Farbe
|
|
|
+ else // Color
|
|
|
{
|
|
|
if (!getNextFarbeBit(byte, i)) return (char)i;
|
|
|
}
|
|
|
break;
|
|
|
- case 5: // Das sechste Bit des Pixels speichert entweder schon die Farbe
|
|
|
- // oder die Komprimierung
|
|
|
- if (change) // Komprimierung
|
|
|
+ case 5: // The sixth bit of the pixel stores either the color
|
|
|
+ // or the compression
|
|
|
+ if (change) // Compression
|
|
|
byte |= (char)(((komp >> 2) & 0x1) << (7 - i));
|
|
|
- else // Farbe
|
|
|
+ else // Color
|
|
|
{
|
|
|
if (!getNextFarbeBit(byte, i)) return (char)i;
|
|
|
}
|
|
|
break;
|
|
|
- case 6: // Das siebte Bit des Pixels speichert entweder schon die Farbe
|
|
|
- // oder die Komprimierung
|
|
|
- if (change) // Komprimierung
|
|
|
+ case 6: // The seventh bit of the pixel stores either the color
|
|
|
+ // or the compression
|
|
|
+ if (change) // Compression
|
|
|
byte |= (char)(((komp >> 1) & 0x1) << (7 - i));
|
|
|
- else // Farbe
|
|
|
+ else // Color
|
|
|
{
|
|
|
if (!getNextFarbeBit(byte, i)) return (char)i;
|
|
|
}
|
|
|
break;
|
|
|
- case 7: // Das sechste Bit des Pixels speichert entweder schon die Farbe
|
|
|
- // oder die Komprimierung
|
|
|
- if (change) // Komprimierung
|
|
|
+ case 7: // The eighth bit of the pixel stores either the color
|
|
|
+ // or the compression
|
|
|
+ if (change) // Compression
|
|
|
byte |= (char)((komp & 0x1) << (7 - i));
|
|
|
- else // Farbe
|
|
|
+ else // Color
|
|
|
{
|
|
|
if (!getNextFarbeBit(byte, i)) return (char)i;
|
|
|
}
|
|
|
break;
|
|
|
- default: // Die restlichen Bits speichern die Farbe des Pixels
|
|
|
+ default: // The remaining bits store the color of the pixel
|
|
|
if (!getNextFarbeBit(byte, i)) return (char)i;
|
|
|
break;
|
|
|
}
|
|
|
@@ -464,7 +457,7 @@ char LTDBPixel::getNextByte(
|
|
|
}
|
|
|
|
|
|
// constant
|
|
|
-int LTDBPixel::zuFarbe() const // gibt den Pixel als Farbe zurueck
|
|
|
+int LTDBPixel::zuFarbe() const // returns the pixel as color
|
|
|
{
|
|
|
return (((int)R << 16) | ((int)G << 8) | (int)B | ((int)A << 24));
|
|
|
}
|
|
|
@@ -494,28 +487,28 @@ unsigned char LTDBPixel::getKomp() const
|
|
|
return komp;
|
|
|
}
|
|
|
|
|
|
-unsigned char LTDBPixel::getR() const // gibt Rot zurueck
|
|
|
+unsigned char LTDBPixel::getR() const // returns red
|
|
|
{
|
|
|
return R;
|
|
|
}
|
|
|
|
|
|
-unsigned char LTDBPixel::getG() const // gibt Gruen zurueck
|
|
|
+unsigned char LTDBPixel::getG() const // returns green
|
|
|
{
|
|
|
return G;
|
|
|
}
|
|
|
|
|
|
-unsigned char LTDBPixel::getB() const // gibt Blau zurueck
|
|
|
+unsigned char LTDBPixel::getB() const // returns blue
|
|
|
{
|
|
|
return B;
|
|
|
}
|
|
|
|
|
|
-unsigned char LTDBPixel::getA() const // gibt Alpha zurueck
|
|
|
+unsigned char LTDBPixel::getA() const // returns alpha
|
|
|
{
|
|
|
return A;
|
|
|
}
|
|
|
|
|
|
-// Inhalt der LTDBDateiKopf Klasse aus Dateisystem.h
|
|
|
-// konstructor
|
|
|
+// Content of the LTDBDateiKopf class from Dateisystem.h
|
|
|
+// Constructor
|
|
|
LTDBDateiKopf::LTDBDateiKopf()
|
|
|
: ReferenceCounter(),
|
|
|
bilder(new RCArray<Text>()),
|
|
|
@@ -523,14 +516,14 @@ LTDBDateiKopf::LTDBDateiKopf()
|
|
|
bAnzahl(0)
|
|
|
{}
|
|
|
|
|
|
-// destructor
|
|
|
+// Destructor
|
|
|
LTDBDateiKopf::~LTDBDateiKopf()
|
|
|
{
|
|
|
bilder->release();
|
|
|
pos->release();
|
|
|
}
|
|
|
|
|
|
-// nicht constant
|
|
|
+// non-constant
|
|
|
void LTDBDateiKopf::removeBild(int i)
|
|
|
{
|
|
|
if (i >= bAnzahl) return;
|
|
|
@@ -608,12 +601,12 @@ void LTDBDateiKopf::laden(FBalken* f, std::ifstream* inF)
|
|
|
for (int i = 0; i < bAnzahl; ++i)
|
|
|
{
|
|
|
LTDBKopf* kpf = new LTDBKopf();
|
|
|
- kpf->laden(inF); // bildname und halbe datei position
|
|
|
- bilder->add(kpf->getTitel()); // setzt titel
|
|
|
+ kpf->laden(inF); // image name and half file position
|
|
|
+ bilder->add(kpf->getTitel()); // sets title
|
|
|
Punkt gr = kpf->getSize();
|
|
|
kpf->release();
|
|
|
char p[5];
|
|
|
- inF->read((char*)p, 5); // andere haelfte der Dateiposition
|
|
|
+ inF->read((char*)p, 5); // other half of the file position
|
|
|
unsigned __int64 position
|
|
|
= (((__int64)gr.x << 52) & 0xFFF0000000000000)
|
|
|
| (((__int64)gr.y << 40) & 0xFFF0000000000)
|
|
|
@@ -621,7 +614,7 @@ void LTDBDateiKopf::laden(FBalken* f, std::ifstream* inF)
|
|
|
| (((__int64)p[1] << 24) & 0xFF000000)
|
|
|
| (((__int64)p[2] << 16) & 0xFF0000)
|
|
|
| (((__int64)p[3] << 8) & 0xFF00) | ((__int64)p[4] & 0xFF);
|
|
|
- pos->add(position, i); // setzt position
|
|
|
+ pos->add(position, i); // sets position
|
|
|
#ifdef WIN32
|
|
|
if (f) f->aktionPlus();
|
|
|
#endif
|
|
|
@@ -714,14 +707,14 @@ RCArray<Text>* LTDBDateiKopf::zBildListe() const
|
|
|
return bilder;
|
|
|
}
|
|
|
|
|
|
-// Inhalt der LTDBKopf Klasse aus DateiSystem.h
|
|
|
-// Konstruktor
|
|
|
+// Content of the LTDBKopf class from DateiSystem.h
|
|
|
+// Constructor
|
|
|
LTDBKopf::LTDBKopf()
|
|
|
: ReferenceCounter()
|
|
|
{}
|
|
|
|
|
|
-// nicht constant
|
|
|
-void LTDBKopf::laden(std::ifstream* f) // Laet die Daten aus einer Datei
|
|
|
+// non-constant
|
|
|
+void LTDBKopf::laden(std::ifstream* f) // Loads data from a file
|
|
|
{
|
|
|
if (f->is_open())
|
|
|
{
|
|
|
@@ -744,7 +737,7 @@ void LTDBKopf::laden(std::ifstream* f) // Laet die Daten aus einer Datei
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-int LTDBKopf::Init(Text* t, const Punkt& g) // Befuellt die Daten
|
|
|
+int LTDBKopf::Init(Text* t, const Punkt& g) // Fills the data
|
|
|
{
|
|
|
a = 0;
|
|
|
b = 0;
|
|
|
@@ -760,13 +753,16 @@ int LTDBKopf::Init(Text* t, const Punkt& g) // Befuellt die Daten
|
|
|
titel[i - skipped] = (char)(titel[i - skipped] - 96);
|
|
|
else if (titel[i - skipped] > 64 && titel[i - skipped] < 91)
|
|
|
titel[i - skipped] = (char)(titel[i - skipped] - 64);
|
|
|
- else if (titel[i - skipped] == 'ü' || titel[i - skipped] == 'Ü')
|
|
|
+ else if (titel[i - skipped] == SpecialCharacters::SMALL_UE
|
|
|
+ || titel[i - skipped] == SpecialCharacters::BIG_UE)
|
|
|
titel[i - skipped] = 27;
|
|
|
- else if (titel[i - skipped] == 'ö' || titel[i - skipped] == 'Ö')
|
|
|
+ else if (titel[i - skipped] == SpecialCharacters::SMALL_OE
|
|
|
+ || titel[i - skipped] == SpecialCharacters::BIG_OE)
|
|
|
titel[i - skipped] = 28;
|
|
|
- else if (titel[i - skipped] == 'ä' || titel[i - skipped] == 'Ä')
|
|
|
+ else if (titel[i - skipped] == SpecialCharacters::SMALL_AE
|
|
|
+ || titel[i - skipped] == SpecialCharacters::BIG_AE)
|
|
|
titel[i - skipped] = 29;
|
|
|
- else if (titel[i - skipped] == 'ß')
|
|
|
+ else if (titel[i - skipped] == SpecialCharacters::SZ)
|
|
|
titel[i - skipped] = 30;
|
|
|
else if (titel[i - skipped] == '.')
|
|
|
titel[i - skipped] = 31;
|
|
|
@@ -781,54 +777,54 @@ int LTDBKopf::Init(Text* t, const Punkt& g) // Befuellt die Daten
|
|
|
switch (i)
|
|
|
{
|
|
|
case 0:
|
|
|
- a |= (__int64)(titel[i] & 31) << 55; // ersten Buchstaben speichern
|
|
|
+ a |= (__int64)(titel[i] & 31) << 55; // store 1st character
|
|
|
break;
|
|
|
case 1:
|
|
|
- a |= (__int64)(titel[i] & 31) << 50; // zweiten Buchstaben speichern
|
|
|
+ a |= (__int64)(titel[i] & 31) << 50; // store 2nd character
|
|
|
break;
|
|
|
case 2:
|
|
|
- a |= (__int64)(titel[i] & 31) << 45; // dritten Buchstaben speichern
|
|
|
+ a |= (__int64)(titel[i] & 31) << 45; // store 3rd character
|
|
|
break;
|
|
|
case 3:
|
|
|
- a |= (__int64)(titel[i] & 31) << 40; // vierten Buchstaben speichern
|
|
|
+ a |= (__int64)(titel[i] & 31) << 40; // store 4th character
|
|
|
break;
|
|
|
case 4:
|
|
|
a |= (__int64)(titel[i] & 31)
|
|
|
- << 35; // fuenften Buchstaben speichern
|
|
|
+ << 35; // store 5th character
|
|
|
break;
|
|
|
case 5:
|
|
|
a |= (__int64)(titel[i] & 31)
|
|
|
- << 30; // sechsten Buchstaben speichern
|
|
|
+ << 30; // store 6th character
|
|
|
break;
|
|
|
case 6:
|
|
|
- a |= (__int64)(titel[i] & 31) << 25; // siebten Buchstaben speichern
|
|
|
+ a |= (__int64)(titel[i] & 31) << 25; // store 7th character
|
|
|
break;
|
|
|
case 7:
|
|
|
- a |= (__int64)(titel[i] & 31) << 20; // achten Buchstaben speichern
|
|
|
+ a |= (__int64)(titel[i] & 31) << 20; // store 8th character
|
|
|
break;
|
|
|
case 8:
|
|
|
- a |= (__int64)(titel[i] & 31) << 15; // neunten Buchstaben speichern
|
|
|
+ a |= (__int64)(titel[i] & 31) << 15; // store 9th character
|
|
|
break;
|
|
|
case 9:
|
|
|
- a |= (__int64)(titel[i] & 31) << 10; // zenten Buchstaben speichern
|
|
|
+ a |= (__int64)(titel[i] & 31) << 10; // store 10th character
|
|
|
break;
|
|
|
case 10:
|
|
|
- a |= (__int64)(titel[i] & 31) << 5; // elften Buchstaben speichern
|
|
|
+ a |= (__int64)(titel[i] & 31) << 5; // store 11th character
|
|
|
break;
|
|
|
case 11:
|
|
|
- a |= (__int64)(titel[i] & 31); // zwoelften Buchstaben speichern
|
|
|
+ a |= (__int64)(titel[i] & 31); // store 12th character
|
|
|
break;
|
|
|
case 12:
|
|
|
b |= (__int32)(titel[i] & 31)
|
|
|
- << 27; // dreizenten Buchstaben speichern
|
|
|
+ << 27; // store 13th character
|
|
|
break;
|
|
|
case 13:
|
|
|
b |= (__int32)(titel[i] & 31)
|
|
|
- << 22; // vierzenten Buchstaben speichern
|
|
|
+ << 22; // store 14th character
|
|
|
break;
|
|
|
case 14:
|
|
|
b |= (__int32)(titel[i] & 31)
|
|
|
- << 17; // fuenfzenten Buchstaben speichern
|
|
|
+ << 17; // store 15th character
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
@@ -886,13 +882,13 @@ void LTDBKopf::setBits(int BeginBit, int EndBit, __int16 bits)
|
|
|
|
|
|
// constant
|
|
|
void LTDBKopf::speichern(
|
|
|
- std::ofstream* f) const // Speichert die Daten in eine Datei
|
|
|
+ std::ofstream* f) const // Saves data to a file
|
|
|
{
|
|
|
if (f->is_open())
|
|
|
{
|
|
|
- int bits = 4 /*Titellaenge*/ + getTitelLength() * 5 /*Titel*/
|
|
|
- + 24 /*Bildgroesse*/;
|
|
|
- int bytes = bits / 8; // Bytelaenge des Dateikopfes
|
|
|
+ int bits = 4 /*title length*/ + getTitelLength() * 5 /*title*/
|
|
|
+ + 24 /*image size*/;
|
|
|
+ int bytes = bits / 8; // byte length of the file header
|
|
|
if (((float)bits / 8.0f) != (float)bytes) ++bytes;
|
|
|
char c = 0;
|
|
|
for (int i = 0; i < bytes; ++i)
|
|
|
@@ -903,13 +899,13 @@ void LTDBKopf::speichern(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-int LTDBKopf::getTitelLength() const // gibt die laenge des Bildnamens zurueck
|
|
|
+int LTDBKopf::getTitelLength() const // returns the length of the image name
|
|
|
{
|
|
|
- return (int)(a >> 60 & Bits(4)); // Die Laenge des Titels wird in den ersten
|
|
|
- // 4 Bits der Tatei gespeichert
|
|
|
+ return (int)(a >> 60 & Bits(4)); // The title length is stored in the first
|
|
|
+ // 4 bits of the file
|
|
|
}
|
|
|
|
|
|
-Text* LTDBKopf::getTitel() const // gibt den Namen des Bildes zurueck
|
|
|
+Text* LTDBKopf::getTitel() const // returns the name of the image
|
|
|
{
|
|
|
Text* ret = new Text("");
|
|
|
char c[2];
|
|
|
@@ -921,49 +917,49 @@ Text* LTDBKopf::getTitel() const // gibt den Namen des Bildes zurueck
|
|
|
switch (i)
|
|
|
{
|
|
|
case 0:
|
|
|
- c[0] = (a >> 55) & 31; // ersten Buchstaben holen
|
|
|
+ c[0] = (a >> 55) & 31; // get 1st character
|
|
|
break;
|
|
|
case 1:
|
|
|
- c[0] = (a >> 50) & 31; // zweiten Buchstaben holen
|
|
|
+ c[0] = (a >> 50) & 31; // get 2nd character
|
|
|
break;
|
|
|
case 2:
|
|
|
- c[0] = (a >> 45) & 31; // dritten Buchstaben holen
|
|
|
+ c[0] = (a >> 45) & 31; // get 3rd character
|
|
|
break;
|
|
|
case 3:
|
|
|
- c[0] = (a >> 40) & 31; // vierten Buchstaben holen
|
|
|
+ c[0] = (a >> 40) & 31; // get 4th character
|
|
|
break;
|
|
|
case 4:
|
|
|
- c[0] = (a >> 35) & 31; // fuenften Buchstaben holen
|
|
|
+ c[0] = (a >> 35) & 31; // get 5th character
|
|
|
break;
|
|
|
case 5:
|
|
|
- c[0] = (a >> 30) & 31; // sechsten Buchstaben holen
|
|
|
+ c[0] = (a >> 30) & 31; // get 6th character
|
|
|
break;
|
|
|
case 6:
|
|
|
- c[0] = (a >> 25) & 31; // siebten Buchstaben holen
|
|
|
+ c[0] = (a >> 25) & 31; // get 7th character
|
|
|
break;
|
|
|
case 7:
|
|
|
- c[0] = (a >> 20) & 31; // achten Buchstaben holen
|
|
|
+ c[0] = (a >> 20) & 31; // get 8th character
|
|
|
break;
|
|
|
case 8:
|
|
|
- c[0] = (a >> 15) & 31; // neunten Buchstaben holen
|
|
|
+ c[0] = (a >> 15) & 31; // get 9th character
|
|
|
break;
|
|
|
case 9:
|
|
|
- c[0] = (a >> 10) & 31; // zenten Buchstaben holen
|
|
|
+ c[0] = (a >> 10) & 31; // get 10th character
|
|
|
break;
|
|
|
case 10:
|
|
|
- c[0] = (a >> 5) & 31; // elften Buchstaben holen
|
|
|
+ c[0] = (a >> 5) & 31; // get 11th character
|
|
|
break;
|
|
|
case 11:
|
|
|
- c[0] = a & 31; // zwoelften Buchstaben holen
|
|
|
+ c[0] = a & 31; // get 12th character
|
|
|
break;
|
|
|
case 12:
|
|
|
- c[0] = (char)((b >> 27) & 31); // dreizenten Buchstaben holen
|
|
|
+ c[0] = (char)((b >> 27) & 31); // get 13th character
|
|
|
break;
|
|
|
case 13:
|
|
|
- c[0] = (char)((b >> 22) & 31); // vierzenten Buchstaben holen
|
|
|
+ c[0] = (char)((b >> 22) & 31); // get 14th character
|
|
|
break;
|
|
|
case 14:
|
|
|
- c[0] = (char)((b >> 17) & 31); // fuenfzenten Buchstaben holen
|
|
|
+ c[0] = (char)((b >> 17) & 31); // get 15th character
|
|
|
break;
|
|
|
}
|
|
|
if (c[0] == 27)
|
|
|
@@ -983,9 +979,9 @@ Text* LTDBKopf::getTitel() const // gibt den Namen des Bildes zurueck
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-Punkt LTDBKopf::getSize() const // gibt die Groesse des Bildes zurueck
|
|
|
+Punkt LTDBKopf::getSize() const // returns the size of the image
|
|
|
{
|
|
|
- int BeginBit = 4 /*Titellaenge*/ + getTitelLength() * 5 /*Titel*/;
|
|
|
+ int BeginBit = 4 /*title length*/ + getTitelLength() * 5 /*title*/;
|
|
|
int EndBit = BeginBit + 24;
|
|
|
__int16 grx = getBits(BeginBit, EndBit - 12);
|
|
|
__int16 gry = getBits(BeginBit + 12, EndBit);
|
|
|
@@ -993,7 +989,7 @@ Punkt LTDBKopf::getSize() const // gibt die Groesse des Bildes zurueck
|
|
|
}
|
|
|
|
|
|
__int16 LTDBKopf::getBits(int begin,
|
|
|
- int ende) const // gibt die Bits von begin bis ende zurueck( ohne ende );
|
|
|
+int ende) const // returns the bits from begin to ende (excluding ende)
|
|
|
{
|
|
|
if (ende < begin) return 0;
|
|
|
if (ende - begin > 16) ende = begin + 16;
|
|
|
@@ -1037,15 +1033,15 @@ __int16 LTDBKopf::getBits(int begin,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-// Inhalt der LTDBKoerper Klasse aus Dateisystem.h
|
|
|
-// Konstruktor
|
|
|
+// Content of the LTDBBody class from Dateisystem.h
|
|
|
+// Constructor
|
|
|
LTDBBody::LTDBBody()
|
|
|
: ReferenceCounter(),
|
|
|
gr(0, 0),
|
|
|
b(new Bild())
|
|
|
{}
|
|
|
|
|
|
-LTDBBody::LTDBBody(LTDBKopf* k) // ruft Init auf
|
|
|
+LTDBBody::LTDBBody(LTDBKopf* k) // calls init
|
|
|
: ReferenceCounter(),
|
|
|
gr(0, 0),
|
|
|
b(new Bild())
|
|
|
@@ -1053,14 +1049,14 @@ LTDBBody::LTDBBody(LTDBKopf* k) // ruft Init auf
|
|
|
init(k);
|
|
|
}
|
|
|
|
|
|
-// Destruktor
|
|
|
+// Destructor
|
|
|
LTDBBody::~LTDBBody()
|
|
|
{
|
|
|
b->release();
|
|
|
}
|
|
|
|
|
|
-// nicht constant
|
|
|
-void LTDBBody::init(LTDBKopf k) // Initialisiert, wird vor dem laden benoetigt
|
|
|
+// non-constant
|
|
|
+void LTDBBody::init(LTDBKopf k) // Initializes, required before loading
|
|
|
{
|
|
|
gr = k.getSize();
|
|
|
int l = k.getTitelLength();
|
|
|
@@ -1068,7 +1064,7 @@ void LTDBBody::init(LTDBKopf k) // Initialisiert, wird vor dem laden benoetigt
|
|
|
dateiSize = (l / 8.0 == l) ? (l / 8) : (l / 8 + 1);
|
|
|
}
|
|
|
|
|
|
-void LTDBBody::init(LTDBKopf* k) // Initialisiert, wird vor dem laden benoetigt
|
|
|
+void LTDBBody::init(LTDBKopf* k) // Initializes, required before loading
|
|
|
{
|
|
|
gr = k->getSize();
|
|
|
int l = k->getTitelLength();
|
|
|
@@ -1077,16 +1073,16 @@ void LTDBBody::init(LTDBKopf* k) // Initialisiert, wird vor dem laden benoetigt
|
|
|
k->release();
|
|
|
}
|
|
|
|
|
|
-void LTDBBody::laden(FBalken* zF, std::ifstream* inF) // laed das Bild
|
|
|
+void LTDBBody::laden(FBalken* zF, std::ifstream* inF) // loads the image
|
|
|
{
|
|
|
- b->neuBild(gr.x, gr.y, 0xFF000000); // neues Bild erstellen
|
|
|
+ b->neuBild(gr.x, gr.y, 0xFF000000); // create new image
|
|
|
int* buff = b->getBuffer();
|
|
|
int breite = b->getBreite();
|
|
|
char byte = 0;
|
|
|
int index = 0;
|
|
|
- LTDBPixel* davor = 0; // zuletzt geladener Pixel
|
|
|
- LTDBPixel* dieser = new LTDBPixel(0); // momentan zu ladener Pixel
|
|
|
- int begin = 0; // Pixelbegin, endposition in der byte variable
|
|
|
+ LTDBPixel* davor = 0; // last loaded pixel
|
|
|
+ LTDBPixel* dieser = new LTDBPixel(0); // pixel currently being loaded
|
|
|
+ int begin = 0; // pixel start, end position in the byte variable
|
|
|
#ifdef WIN32
|
|
|
if (zF)
|
|
|
{
|
|
|
@@ -1094,15 +1090,15 @@ void LTDBBody::laden(FBalken* zF, std::ifstream* inF) // laed das Bild
|
|
|
zF->setAktionAnzahl(gr.x * gr.y);
|
|
|
}
|
|
|
#endif
|
|
|
- while (index < gr.x * gr.y) // fuer jeden Pixel
|
|
|
+ while (index < gr.x * gr.y) // for each pixel
|
|
|
{
|
|
|
- if (!dieser) // wenn es nicht der erste Pixel ist
|
|
|
+ if (!dieser) // if it is not the first pixel
|
|
|
dieser = new LTDBPixel(dynamic_cast<LTDBPixel*>(davor->getThis()));
|
|
|
int ende = -1;
|
|
|
- while (ende < 0) // Pixel laden
|
|
|
+ while (ende < 0) // load pixel
|
|
|
{
|
|
|
if (begin == 0) inF->read(&byte, 1);
|
|
|
- ende = dieser->addByte(byte, (char)begin); // byte auswerten
|
|
|
+ ende = dieser->addByte(byte, (char)begin); // evaluate byte
|
|
|
begin = 0;
|
|
|
}
|
|
|
begin = ende;
|
|
|
@@ -1119,7 +1115,7 @@ void LTDBBody::laden(FBalken* zF, std::ifstream* inF) // laed das Bild
|
|
|
if (davor) davor = (LTDBPixel*)davor->release();
|
|
|
}
|
|
|
|
|
|
-void LTDBBody::setBild(Bild* b) // setzt das zu speichernde Bild
|
|
|
+void LTDBBody::setBild(Bild* b) // sets the image to be saved
|
|
|
{
|
|
|
this->b->release();
|
|
|
this->b = b;
|
|
|
@@ -1127,16 +1123,16 @@ void LTDBBody::setBild(Bild* b) // setzt das zu speichernde Bild
|
|
|
|
|
|
// constant
|
|
|
void LTDBBody::speichern(
|
|
|
- FBalken* zF, std::ofstream* outF) const // speichert Bild
|
|
|
+ FBalken* zF, std::ofstream* outF) const // saves image
|
|
|
{
|
|
|
if (outF->is_open())
|
|
|
{
|
|
|
- LTDBPixel* letzter = 0; // Letzter gespeicherter Pixel
|
|
|
+ LTDBPixel* letzter = 0; // Last saved pixel
|
|
|
LTDBPixel* dieser
|
|
|
- = new LTDBPixel(0); // Der momentan zu speichernde Pixel
|
|
|
+ = new LTDBPixel(0); // The pixel currently being saved
|
|
|
int begin = 0,
|
|
|
- ende = 0; // Pixelbeginn, endposition in der byte variable
|
|
|
- char byte = 0; // Der naechste byte der Datei
|
|
|
+ ende = 0; // pixel start, end position in the byte variable
|
|
|
+ char byte = 0; // The next byte of the file
|
|
|
bool w = 0;
|
|
|
#ifdef WIN32
|
|
|
if (zF)
|
|
|
@@ -1146,31 +1142,31 @@ void LTDBBody::speichern(
|
|
|
}
|
|
|
#endif
|
|
|
int* pBuff = b->getBuffer();
|
|
|
- for (int i = 0; i < gr.x * gr.y; ++i) // fuer jeden Pixel
|
|
|
+ for (int i = 0; i < gr.x * gr.y; ++i) // for each pixel
|
|
|
{
|
|
|
- if (!dieser) // wenn es nicht der erste Pixel ist
|
|
|
+ if (!dieser) // if it is not the first pixel
|
|
|
dieser = new LTDBPixel(
|
|
|
dynamic_cast<LTDBPixel*>(letzter->getThis()));
|
|
|
- dieser->setFarbe(pBuff[i]); // Farbe des Pixels setzen
|
|
|
- dieser->komprimieren(); // Pixel komprimieren
|
|
|
+ dieser->setFarbe(pBuff[i]); // set pixel color
|
|
|
+ dieser->komprimieren(); // compress pixel
|
|
|
ende = -1;
|
|
|
- while (ende < 0) // byte befuellen
|
|
|
+ while (ende < 0) // fill byte
|
|
|
{
|
|
|
ende = dieser->getNextByte(byte, begin);
|
|
|
begin = 0;
|
|
|
w = 0;
|
|
|
- if (ende == -1 || ende == 8) // byte speichern
|
|
|
+ if (ende == -1 || ende == 8) // save byte
|
|
|
{
|
|
|
outF->write(&byte, 1);
|
|
|
w = 1;
|
|
|
byte = 0;
|
|
|
}
|
|
|
- } // Pixel fertig
|
|
|
+ } // pixel finished
|
|
|
begin = ende;
|
|
|
if (begin == 8) begin = 0;
|
|
|
if (letzter) letzter->release();
|
|
|
letzter = dynamic_cast<LTDBPixel*>(
|
|
|
- dieser->getThis()); // dieser wird zu letzter
|
|
|
+ dieser->getThis()); // dieser becomes letzter
|
|
|
dieser = (LTDBPixel*)dieser->release();
|
|
|
#ifdef WIN32
|
|
|
if (zF) zF->aktionPlus();
|
|
|
@@ -1179,47 +1175,47 @@ void LTDBBody::speichern(
|
|
|
if (letzter) letzter = (LTDBPixel*)letzter->release();
|
|
|
if (!w)
|
|
|
{
|
|
|
- outF->write(&byte, 1); // Das letzte byte speichern
|
|
|
+ outF->write(&byte, 1); // save the last byte
|
|
|
}
|
|
|
- outF->flush(); // dateistream speichern
|
|
|
+ outF->flush(); // flush file stream
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-Bild* LTDBBody::getBild() const // gibt das geladene Bild zurueck
|
|
|
+Bild* LTDBBody::getBild() const // returns the loaded image
|
|
|
{
|
|
|
return dynamic_cast<Bild*>(b->getThis());
|
|
|
}
|
|
|
|
|
|
-const Punkt& LTDBBody::getSize() const // gibt die groesse des Bildes zurueck
|
|
|
+const Punkt& LTDBBody::getSize() const // returns the size of the image
|
|
|
{
|
|
|
return gr;
|
|
|
}
|
|
|
|
|
|
-// Inhalt det LTDBDatei Klasse aus Dateisystem.h
|
|
|
-// Konstruktor
|
|
|
+// Content of the LTDBDatei class from Dateisystem.h
|
|
|
+// Constructor
|
|
|
LTDBDatei::LTDBDatei()
|
|
|
: ReferenceCounter(),
|
|
|
pfad(new Text()),
|
|
|
datKpf(0)
|
|
|
{}
|
|
|
|
|
|
-// Destruktor
|
|
|
+// Destructor
|
|
|
LTDBDatei::~LTDBDatei()
|
|
|
{
|
|
|
if (pfad) pfad->release();
|
|
|
if (datKpf) datKpf->release();
|
|
|
}
|
|
|
|
|
|
-// nicht constant
|
|
|
-void LTDBDatei::setDatei(Text* pfad) // Setzt den Pfad zur Datei
|
|
|
-{ // Werte der eventuellen vorherigen Datei loeschen
|
|
|
+// non-constant
|
|
|
+void LTDBDatei::setDatei(Text* pfad) // Sets the path to the file
|
|
|
+{ // Delete values of any previous file
|
|
|
if (datKpf) datKpf = (LTDBDateiKopf*)datKpf->release();
|
|
|
- // Pfad setzen
|
|
|
+ // Set path
|
|
|
this->pfad->setText(*pfad);
|
|
|
pfad->release();
|
|
|
}
|
|
|
|
|
|
-void LTDBDatei::erstellen() // Erstellt die Datei
|
|
|
+void LTDBDatei::erstellen() // Creates the file
|
|
|
{
|
|
|
DateiPfadErstellen(dynamic_cast<Text*>(pfad->getThis()));
|
|
|
std::ofstream* outF = new std::ofstream(pfad->getText(), std::ios::binary);
|
|
|
@@ -1229,10 +1225,10 @@ void LTDBDatei::erstellen() // Erstellt die Datei
|
|
|
}
|
|
|
|
|
|
void LTDBDatei::leseDaten(
|
|
|
- FBalken* f) // Die Klasse liesst alle Bilder kurz ein, und merkt sich, an
|
|
|
- // welcher stelle in der Datei was ist
|
|
|
-{ // Diese Funktion wird ein wenig Zeit in Anspruch nemen, dafueraber danach die
|
|
|
- // anderen schneller machen
|
|
|
+ FBalken* f) // The class briefly reads all images and remembers
|
|
|
+ // where in the file each one is located
|
|
|
+{ // This function will take some time, but will make
|
|
|
+ // the other functions faster afterwards
|
|
|
if (DateiExistiert(dynamic_cast<Text*>(pfad->getThis())))
|
|
|
{
|
|
|
if (datKpf) datKpf->release();
|
|
|
@@ -1244,7 +1240,7 @@ void LTDBDatei::leseDaten(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void LTDBDatei::remove() // Loescht die Datei
|
|
|
+void LTDBDatei::remove() // Deletes the file
|
|
|
{
|
|
|
if (DateiExistiert(dynamic_cast<Text*>(pfad->getThis())))
|
|
|
{
|
|
|
@@ -1253,24 +1249,24 @@ void LTDBDatei::remove() // Loescht die Datei
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void LTDBDatei::remove(FBalken* f, Text* name) // Loescht ein Bild aus der Datei
|
|
|
+void LTDBDatei::remove(FBalken* f, Text* name) // Deletes an image from the file
|
|
|
{
|
|
|
if (DateiExistiert(dynamic_cast<Text*>(pfad->getThis())) && name)
|
|
|
{
|
|
|
- if (!datKpf) leseDaten(0); // Daten einlesen
|
|
|
- // Pruefen, ob Datei nicht vorhanden
|
|
|
+ if (!datKpf) leseDaten(0); // read data
|
|
|
+ // Check if file is not present
|
|
|
if (!datKpf)
|
|
|
{
|
|
|
name->release();
|
|
|
return;
|
|
|
}
|
|
|
int index = datKpf->getBildIndex(dynamic_cast<Text*>(name->getThis()));
|
|
|
- if (index == -1) // das bild existiert nicht
|
|
|
+ if (index == -1) // the image does not exist
|
|
|
{
|
|
|
name->release();
|
|
|
return;
|
|
|
}
|
|
|
- // Zwischenspeicherpfad ermitteln
|
|
|
+ // Determine temporary file path
|
|
|
Text* pf_tmp = new Text(pfad->getText());
|
|
|
char c = '0';
|
|
|
pf_tmp->append("0");
|
|
|
@@ -1285,12 +1281,12 @@ void LTDBDatei::remove(FBalken* f, Text* name) // Loescht ein Bild aus der Datei
|
|
|
c);
|
|
|
}
|
|
|
std::ifstream* inF = new std::ifstream(
|
|
|
- pfad->getText(), std::ios::binary); // Alte Datei oeffnen
|
|
|
+ pfad->getText(), std::ios::binary); // open old file
|
|
|
inF->seekg(0, std::ios::end);
|
|
|
__int64 datlen = inF->tellg();
|
|
|
inF->seekg(0, std::ios::beg);
|
|
|
std::ofstream* outF = new std::ofstream(
|
|
|
- pf_tmp->getText(), std::ios::binary); // Neue Datei oeffnen
|
|
|
+ pf_tmp->getText(), std::ios::binary); // open new file
|
|
|
if (inF->is_open() && outF->is_open())
|
|
|
{
|
|
|
__int64 position = datKpf->getBildPosition(index);
|
|
|
@@ -1303,19 +1299,19 @@ void LTDBDatei::remove(FBalken* f, Text* name) // Loescht ein Bild aus der Datei
|
|
|
__int64 pos_minus = inF->tellg() - outF->tellp();
|
|
|
for (int i = 0; i < index; ++i)
|
|
|
datKpf->setBildPos(i, datKpf->getBildPosition(i) - pos_minus);
|
|
|
- // Bytes bis zur Datei kopieren
|
|
|
+ // Copy bytes up to the file
|
|
|
for (__int64 i = inF->tellg(); i < position; ++i)
|
|
|
{
|
|
|
inF->read(&byte, 1);
|
|
|
outF->write(&byte, 1);
|
|
|
- } // zu loeschendes Bild ueberspringen
|
|
|
+ } // skip image to be deleted
|
|
|
LTDBKopf* delkpf = new LTDBKopf();
|
|
|
delkpf->laden(inF);
|
|
|
LTDBBody* delkpr
|
|
|
= new LTDBBody(dynamic_cast<LTDBKopf*>(delkpf->getThis()));
|
|
|
delkpr->laden(f, inF);
|
|
|
delkpf = (LTDBKopf*)delkpf->release();
|
|
|
- delkpr = (LTDBBody*)delkpr->release(); // restliche bytes kopieren
|
|
|
+ delkpr = (LTDBBody*)delkpr->release(); // copy remaining bytes
|
|
|
pos_minus = inF->tellg() - outF->tellp();
|
|
|
for (__int64 i = (__int64)inF->tellg(); i < datlen; ++i)
|
|
|
{
|
|
|
@@ -1339,7 +1335,7 @@ void LTDBDatei::remove(FBalken* f, Text* name) // Loescht ein Bild aus der Datei
|
|
|
if (name) name = (Text*)name->release();
|
|
|
}
|
|
|
|
|
|
-Bild* LTDBDatei::laden(FBalken* f, Text* name) // Laed ein Bild aus der Datei
|
|
|
+Bild* LTDBDatei::laden(FBalken* f, Text* name) // Loads an image from the file
|
|
|
{
|
|
|
if (name)
|
|
|
{
|
|
|
@@ -1354,42 +1350,42 @@ Bild* LTDBDatei::laden(FBalken* f, Text* name) // Laed ein Bild aus der Datei
|
|
|
int index = datKpf->getBildIndex(k_tmp->getTitel());
|
|
|
k_tmp->release();
|
|
|
if (index == -1)
|
|
|
- { // Fehlermeldung
|
|
|
- Text* fehler = new Text("Das Bild ");
|
|
|
+ { // Error message
|
|
|
+ Text* fehler = new Text("The image ");
|
|
|
fehler->append(*name);
|
|
|
- fehler->append(" wurde nicht in der Datei\n");
|
|
|
+ fehler->append(" was not found in the file\n");
|
|
|
fehler->append(*pfad);
|
|
|
- fehler->append(" gefunden!");
|
|
|
+ fehler->append("!");
|
|
|
Logging::error() << fehler << "\n";
|
|
|
name->release();
|
|
|
return 0;
|
|
|
}
|
|
|
std::ifstream* inF
|
|
|
= new std::ifstream(pfad->getText(), std::ios::binary);
|
|
|
- // Begin der zu ladenden Datei ermitteln
|
|
|
+ // Determine start of the file to load
|
|
|
__int64 position = datKpf->getBildPosition(index);
|
|
|
inF->seekg(position, std::ios::beg);
|
|
|
LTDBKopf* kpf = new LTDBKopf();
|
|
|
kpf->laden(inF);
|
|
|
Text* t = kpf->getTitel();
|
|
|
if (!t->istGleich(*name))
|
|
|
- { // Fehlermeldung
|
|
|
+ { // Error message
|
|
|
t->release();
|
|
|
kpf->release();
|
|
|
inF->close();
|
|
|
delete inF;
|
|
|
- Text* fehler = new Text("Die Datei ");
|
|
|
+ Text* fehler = new Text("The file ");
|
|
|
fehler->append(*pfad);
|
|
|
- fehler->append(" ist ist keine gültige LTDB Datei!");
|
|
|
+ fehler->append(" is not a valid LTDB file!");
|
|
|
#ifdef WIN32
|
|
|
- WMessageBox(0, new Text("Fehler"), fehler, MB_ICONERROR);
|
|
|
+ WMessageBox(0, new Text("Error"), fehler, MB_ICONERROR);
|
|
|
#endif
|
|
|
name->release();
|
|
|
return 0;
|
|
|
}
|
|
|
t->release();
|
|
|
LTDBBody* kpr = new LTDBBody(dynamic_cast<LTDBKopf*>(kpf->getThis()));
|
|
|
- kpr->laden(f, inF); // Bild laden
|
|
|
+ kpr->laden(f, inF); // load image
|
|
|
Bild* ret = kpr->getBild();
|
|
|
kpr->release();
|
|
|
kpf->release();
|
|
|
@@ -1402,7 +1398,7 @@ Bild* LTDBDatei::laden(FBalken* f, Text* name) // Laed ein Bild aus der Datei
|
|
|
}
|
|
|
|
|
|
int LTDBDatei::speichern(
|
|
|
- FBalken* f, Bild* bild, Text* name) // Speichert ein Bild in die Datei
|
|
|
+FBalken* f, Bild* bild, Text* name) // Saves an image to the file
|
|
|
{
|
|
|
int warn = -1;
|
|
|
if (name && bild)
|
|
|
@@ -1421,13 +1417,13 @@ int LTDBDatei::speichern(
|
|
|
if (datKpf->getBildIndex(kpf->getTitel()) != -1)
|
|
|
{
|
|
|
Logging::error()
|
|
|
- << "Es existiert bereits ein Bild mit diesem Namen!\n";
|
|
|
+ << "An image with this name already exists!\n";
|
|
|
bild->release();
|
|
|
name->release();
|
|
|
kpf->release();
|
|
|
return -1;
|
|
|
}
|
|
|
- // zwischendateipfad suchen
|
|
|
+ // find temporary file path
|
|
|
Text* pf_tmp = new Text(pfad->getText());
|
|
|
char c = '0';
|
|
|
pf_tmp->append("0");
|
|
|
@@ -1468,11 +1464,11 @@ int LTDBDatei::speichern(
|
|
|
inF->read(&byte, 1);
|
|
|
outF->write(&byte, 1);
|
|
|
}
|
|
|
- kpf->speichern(outF); // Bild Kopf speichern
|
|
|
+ kpf->speichern(outF); // save image header
|
|
|
LTDBBody* kpr
|
|
|
= new LTDBBody(dynamic_cast<LTDBKopf*>(kpf->getThis()));
|
|
|
kpr->setBild(dynamic_cast<Bild*>(bild->getThis()));
|
|
|
- kpr->speichern(f, outF); // Bild speichern
|
|
|
+ kpr->speichern(f, outF); // save image
|
|
|
kpf->release();
|
|
|
kpr->release();
|
|
|
inF->close();
|
|
|
@@ -1490,7 +1486,7 @@ int LTDBDatei::speichern(
|
|
|
return warn;
|
|
|
}
|
|
|
|
|
|
-RCArray<Text>* LTDBDatei::zBildListe() // Listet alle Bilder in der datei auf
|
|
|
+RCArray<Text>* LTDBDatei::zBildListe() // Lists all images in the file
|
|
|
{
|
|
|
if (!datKpf) leseDaten(0);
|
|
|
if (datKpf) return datKpf->zBildListe();
|
|
|
@@ -1498,7 +1494,7 @@ RCArray<Text>* LTDBDatei::zBildListe() // Listet alle Bilder in der datei auf
|
|
|
}
|
|
|
|
|
|
// constant
|
|
|
-Text* LTDBDatei::getPfad() const // Gibt den Pfad zur Datei zurueck
|
|
|
+Text* LTDBDatei::getPfad() const // Returns the path to the file
|
|
|
{
|
|
|
return dynamic_cast<Text*>(pfad->getThis());
|
|
|
}
|
|
|
@@ -1509,15 +1505,15 @@ int LTDBDatei::getBildAnzahl() const
|
|
|
return datKpf->getbAnzahl();
|
|
|
}
|
|
|
|
|
|
-bool LTDBDatei::istOffen() const // Prueft, ob die Datei geoeffnet ist
|
|
|
+bool LTDBDatei::istOffen() const // Checks if the file is open
|
|
|
{
|
|
|
if (!pfad) return 0;
|
|
|
return DateiExistiert(dynamic_cast<Text*>(pfad->getThis()));
|
|
|
}
|
|
|
#ifdef WIN32
|
|
|
-// LTDS Dateivormat
|
|
|
-// Inhalt der LTDSPixel Klasse aus DateiSystem.h
|
|
|
-// Konstruktor
|
|
|
+// LTDS File format
|
|
|
+// Content of the LTDSPixel class from DateiSystem.h
|
|
|
+// Constructor
|
|
|
LTDSPixel::LTDSPixel(LTDSPixel* davor)
|
|
|
: ReferenceCounter(),
|
|
|
index(0),
|
|
|
@@ -1531,28 +1527,28 @@ LTDSPixel::LTDSPixel(LTDSPixel* davor)
|
|
|
davor(davor)
|
|
|
{}
|
|
|
|
|
|
-// Destruktor
|
|
|
+// Destructor
|
|
|
LTDSPixel::~LTDSPixel()
|
|
|
{
|
|
|
if (davor) davor->release();
|
|
|
}
|
|
|
|
|
|
-// nicht constant
|
|
|
-// zum Laden gedacht
|
|
|
+// non-constant
|
|
|
+// intended for loading
|
|
|
bool LTDSPixel::addBitZuFarbe(unsigned char bit)
|
|
|
{
|
|
|
- if (aenderA && iA != miA) // Das Bit gehoert zu Alpha
|
|
|
+ if (aenderA && iA != miA) // The bit belongs to alpha
|
|
|
{
|
|
|
alpha |= ((bit & Bits(1))) << (7 - komp - iA);
|
|
|
++iA;
|
|
|
}
|
|
|
- else // Das Bit gehoert zum naechsten Pixel
|
|
|
+ else // The bit belongs to the next pixel
|
|
|
return false;
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
char LTDSPixel::addByte(char byte,
|
|
|
- char begin) // gibt ende des Pixels zurueck, -1 wenn nicht zu ende
|
|
|
+char begin) // returns end of pixel, -1 if not finished
|
|
|
{
|
|
|
if (begin >= 8 || begin < 0) return -1;
|
|
|
for (int i = begin; i < 8; ++i)
|
|
|
@@ -1560,18 +1556,18 @@ char LTDSPixel::addByte(char byte,
|
|
|
switch (index)
|
|
|
{
|
|
|
case 0:
|
|
|
- // Das erste Bit eines Pixels speichert, ob sich an der
|
|
|
- // Komprimierung etwas aenderte
|
|
|
+ // The first bit of a pixel stores whether the
|
|
|
+ // compression changed
|
|
|
aender = ((byte >> (7 - i)) & Bits(1)) == 1;
|
|
|
- if (!aender) // AEndert sich nichts an der Komprimierung, so werden
|
|
|
- // die Werte vom vorherigen Pixel uebernommen
|
|
|
+ if (!aender) // If compression doesn't change, the values
|
|
|
+ // from the previous pixel are inherited
|
|
|
{
|
|
|
- if (!davor) // Die Datei ist beschaedigt ( Der erste Pixel kann
|
|
|
- // nicht von dem davor UEbernemen )
|
|
|
+ if (!davor) // The file is corrupted (the first pixel cannot
|
|
|
+ // inherit from the previous one)
|
|
|
{
|
|
|
MessageBox(NULL,
|
|
|
- "Fehler, die Bilddatei ist beschädigt",
|
|
|
- "Fehler",
|
|
|
+ "Error, the image file is corrupted",
|
|
|
+ "Error",
|
|
|
MB_ICONERROR);
|
|
|
exit(0);
|
|
|
}
|
|
|
@@ -1579,67 +1575,67 @@ char LTDSPixel::addByte(char byte,
|
|
|
komp = davor->getKomp();
|
|
|
miA -= komp;
|
|
|
if (!aenderA) alpha = davor->getA();
|
|
|
- maxIndex += aenderA * (8 - komp); // Bestimmung der Laenge
|
|
|
- // des Pixels in Bits. Jede Farbe hat von grund auf 8 Bits,
|
|
|
- // durch komprimierung kanns kleiner sein
|
|
|
+ maxIndex += aenderA * (8 - komp); // Determine the length
|
|
|
+ // of the pixel in bits. Each color has 8 bits by default,
|
|
|
+ // compression can make it smaller
|
|
|
}
|
|
|
else
|
|
|
- maxIndex += 4; // Da der Pixel nicht die Werte des vorherigen
|
|
|
- // uebernimmt, wird er um 4 Bits groesser
|
|
|
+ maxIndex += 4; // Since the pixel doesn't inherit values from
|
|
|
+ // the previous one, it is 4 bits larger
|
|
|
break;
|
|
|
- case 1: // Das zweite Bit eines Pixels speichert entweder die
|
|
|
- // Komprimierungsart, oder schon die Farbe
|
|
|
- if (aender) // Das Bit gehoert zu den 4 Komprimierungsbits
|
|
|
+ case 1: // The second bit of a pixel stores either the
|
|
|
+ // compression type or already the color
|
|
|
+ if (aender) // The bit belongs to the 4 compression bits
|
|
|
aenderA = ((byte >> (7 - i)) & Bits(1)) == 1;
|
|
|
else
|
|
|
{
|
|
|
if (!addBitZuFarbe(
|
|
|
- byte >> (7 - i))) // Das Bit gehoert zur Farbe
|
|
|
+ byte >> (7 - i))) // The bit belongs to the color
|
|
|
return i;
|
|
|
}
|
|
|
break;
|
|
|
- case 2: // Das sechste Bit eines Pixels speichert entweder die
|
|
|
- // Komprimierungsart, oder schon die Farbe
|
|
|
- if (aender) // Das Bit gehoert zu den 4 Komprimierungsbits
|
|
|
+ case 2: // The sixth bit of a pixel stores either the
|
|
|
+ // compression type or already the color
|
|
|
+ if (aender) // The bit belongs to the 4 compression bits
|
|
|
komp |= (unsigned char)((byte >> (7 - i)) & Bits(1)) << 2;
|
|
|
else
|
|
|
{
|
|
|
if (!addBitZuFarbe(
|
|
|
- byte >> (7 - i))) // Das Bit gehoert zur Farbe
|
|
|
+ byte >> (7 - i))) // The bit belongs to the color
|
|
|
return i;
|
|
|
}
|
|
|
break;
|
|
|
- case 3: // Das siebte Bit eines Pixels speichert entweder die
|
|
|
- // Komprimierungsart, oder schon die Farbe
|
|
|
- if (aender) // Das Bit gehoert zu den 4 Komprimierungsbits
|
|
|
+ case 3: // The seventh bit of a pixel stores either the
|
|
|
+ // compression type or already the color
|
|
|
+ if (aender) // The bit belongs to the 4 compression bits
|
|
|
komp |= (unsigned char)((byte >> (7 - i)) & Bits(1)) << 1;
|
|
|
else
|
|
|
{
|
|
|
if (!addBitZuFarbe(
|
|
|
- byte >> (7 - i))) // Das Bit gehoert zur Farbe
|
|
|
+ byte >> (7 - i))) // The bit belongs to the color
|
|
|
return i;
|
|
|
}
|
|
|
break;
|
|
|
- case 4: // Das achte Bit eines Pixels speichert entweder die
|
|
|
- // Komprimierungsart, oder schon die Farbe
|
|
|
- if (aender) // Das Bit gehoert zu den 4 Komprimierungsbits
|
|
|
+ case 4: // The eighth bit of a pixel stores either the
|
|
|
+ // compression type or already the color
|
|
|
+ if (aender) // The bit belongs to the 4 compression bits
|
|
|
{
|
|
|
komp |= (unsigned char)((byte >> (7 - i)) & Bits(1));
|
|
|
- // Das war das letzte Komprimierungsbit
|
|
|
- // Komprimierung auswerten
|
|
|
+ // That was the last compression bit
|
|
|
+ // Evaluate compression
|
|
|
miA -= komp;
|
|
|
if (!aenderA) alpha = davor->getA();
|
|
|
- maxIndex += aenderA * (8 - komp); // Bitlaenge des Pixels
|
|
|
+ maxIndex += aenderA * (8 - komp); // bit length of the pixel
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (!addBitZuFarbe(
|
|
|
- byte >> (7 - i))) // Das Bit gehoert zur Farbe
|
|
|
+ byte >> (7 - i))) // The bit belongs to the color
|
|
|
return i;
|
|
|
}
|
|
|
break;
|
|
|
- default: // Die restlichen Bits speichern alle die Farbwerte des Pixels
|
|
|
- if (!addBitZuFarbe(byte >> (7 - i))) // Das Bit gehoert zur Farbe
|
|
|
+ default: // The remaining bits all store the color values of the pixel
|
|
|
+ if (!addBitZuFarbe(byte >> (7 - i))) // The bit belongs to the color
|
|
|
return i;
|
|
|
break;
|
|
|
}
|
|
|
@@ -1657,42 +1653,42 @@ char LTDSPixel::addByte(char byte,
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
-// zum speichern gedacht
|
|
|
-void LTDSPixel::setAlpha(unsigned char alpha) // setzt die Farbe des Pixels
|
|
|
+// intended for saving
|
|
|
+void LTDSPixel::setAlpha(unsigned char alpha) // sets the color of the pixel
|
|
|
{
|
|
|
this->alpha = alpha;
|
|
|
}
|
|
|
|
|
|
-void LTDSPixel::Komp() // Komprimiert den Pixel
|
|
|
+void LTDSPixel::Komp() // Compresses the pixel
|
|
|
{
|
|
|
maxIndex = 1;
|
|
|
if (!davor)
|
|
|
- { // Das ist der erste Pixel
|
|
|
+ { // This is the first pixel
|
|
|
aender = 1;
|
|
|
aenderA = 1;
|
|
|
maxIndex += 4;
|
|
|
miA = getBits(alpha);
|
|
|
}
|
|
|
else
|
|
|
- { // Es wird die differenz zum vorrigen Pixel gespeichert
|
|
|
+ { // The difference to the previous pixel is stored
|
|
|
miA = getBits(alpha - davor->getA());
|
|
|
if (alpha != davor->getA())
|
|
|
aenderA = 1;
|
|
|
else
|
|
|
aenderA = 0;
|
|
|
- } // Pruefen ob sich etwas aendert
|
|
|
+ } // Check if something changes
|
|
|
if (!miA && aenderA) ++miA;
|
|
|
komp = 8 - miA;
|
|
|
maxIndex += aenderA * miA;
|
|
|
if (davor)
|
|
|
{
|
|
|
if (aenderA != davor->getAEnderA() || komp != davor->getKomp())
|
|
|
- { // Es aendert sich etwas
|
|
|
+ { // Something changes
|
|
|
aender = 1;
|
|
|
maxIndex += 4;
|
|
|
}
|
|
|
else
|
|
|
- { // Es aendert sich nichts
|
|
|
+ { // Nothing changes
|
|
|
aender = 0;
|
|
|
}
|
|
|
}
|
|
|
@@ -1705,68 +1701,68 @@ bool LTDSPixel::getNextFarbeBit(char& byte, int i)
|
|
|
{
|
|
|
AA -= davor->getA();
|
|
|
}
|
|
|
- if (aenderA && iA != miA) // Das Bit gehoert zu Alpha
|
|
|
+ if (aenderA && iA != miA) // The bit belongs to alpha
|
|
|
{
|
|
|
byte |= ((AA >> (7 - komp - iA)) & Bits(1)) << (7 - i);
|
|
|
++iA;
|
|
|
}
|
|
|
- else // Der Pixel ist bereits zu ende
|
|
|
+ else // The pixel is already finished
|
|
|
return false;
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
char LTDSPixel::getNextByte(
|
|
|
- char& byte, int bbegin) // Gibt die naechsten Bits Zurueck, -1 wenn der
|
|
|
- // Pixel nicht zu ende ist
|
|
|
+ char& byte, int bbegin) // Returns the next bits, -1 if the pixel
|
|
|
+ // is not finished
|
|
|
{
|
|
|
- // bbegin gibt an wohin in die byte-variable geschrieben werden soll
|
|
|
- // die Funktion gibt das ende des Pixels in der byte-variable zurueck
|
|
|
- // -1 heisst, dass der Pixel nicht zu ende ist
|
|
|
+ // bbegin specifies where to write in the byte variable
|
|
|
+ // the function returns the end of the pixel in the byte variable
|
|
|
+ // -1 means the pixel is not finished
|
|
|
for (int i = bbegin; i < 8; ++i)
|
|
|
{
|
|
|
switch (index)
|
|
|
{
|
|
|
- case 0: // Das erste Bit des Pixels speichert, ob sich etwas an der
|
|
|
- // Komprimierung aendert
|
|
|
+ case 0: // The first bit of the pixel stores whether the
|
|
|
+ // compression changes
|
|
|
byte |= ((int)aender & Bits(1)) << (7 - i);
|
|
|
break;
|
|
|
- case 1: // Das zweite Bit des Pixels speichert entweder schon die Farbe
|
|
|
- // oder die Komprimierung
|
|
|
- if (aender) // Komprimierung
|
|
|
+ case 1: // The second bit of the pixel stores either the color
|
|
|
+ // or the compression
|
|
|
+ if (aender) // Compression
|
|
|
byte |= ((int)aenderA & Bits(1)) << (7 - i);
|
|
|
- else // Farbe
|
|
|
+ else // Color
|
|
|
{
|
|
|
if (!getNextFarbeBit(byte, i)) return i;
|
|
|
}
|
|
|
break;
|
|
|
- case 2: // Das zweite Bit des Pixels speichert entweder schon die Farbe
|
|
|
- // oder die Komprimierung
|
|
|
- if (aender) // Komprimierung
|
|
|
+ case 2: // The second bit of the pixel stores either the color
|
|
|
+ // or the compression
|
|
|
+ if (aender) // Compression
|
|
|
byte |= ((komp >> 2) & Bits(1)) << (7 - i);
|
|
|
- else // Farbe
|
|
|
+ else // Color
|
|
|
{
|
|
|
if (!getNextFarbeBit(byte, i)) return i;
|
|
|
}
|
|
|
break;
|
|
|
- case 3: // Das dritte Bit des Pixels speichert entweder schon die Farbe
|
|
|
- // oder die Komprimierung
|
|
|
- if (aender) // Komprimierung
|
|
|
+ case 3: // The third bit of the pixel stores either the color
|
|
|
+ // or the compression
|
|
|
+ if (aender) // Compression
|
|
|
byte |= ((komp >> 1) & Bits(1)) << (7 - i);
|
|
|
- else // Farbe
|
|
|
+ else // Color
|
|
|
{
|
|
|
if (!getNextFarbeBit(byte, i)) return i;
|
|
|
}
|
|
|
break;
|
|
|
- case 4: // Das vierte Bit des Pixels speichert entweder schon die Farbe
|
|
|
- // oder die Komprimierung
|
|
|
- if (aender) // Komprimierung
|
|
|
+ case 4: // The fourth bit of the pixel stores either the color
|
|
|
+ // or the compression
|
|
|
+ if (aender) // Compression
|
|
|
byte |= (komp & Bits(1)) << (7 - i);
|
|
|
- else // Farbe
|
|
|
+ else // Color
|
|
|
{
|
|
|
if (!getNextFarbeBit(byte, i)) return i;
|
|
|
}
|
|
|
break;
|
|
|
- default: // Die restlichen Bits speichern die Farbe des Pixels
|
|
|
+ default: // The remaining bits store the color of the pixel
|
|
|
if (!getNextFarbeBit(byte, i)) return i;
|
|
|
break;
|
|
|
}
|
|
|
@@ -1781,24 +1777,24 @@ char LTDSPixel::getNextByte(
|
|
|
}
|
|
|
|
|
|
// constant
|
|
|
-unsigned char LTDSPixel::getKomp() const // hat sich die Komprimierung geaendert
|
|
|
+unsigned char LTDSPixel::getKomp() const // has the compression changed
|
|
|
{
|
|
|
return komp;
|
|
|
}
|
|
|
|
|
|
bool LTDSPixel::getAEnderA()
|
|
|
- const // gibt zurueck, ob sich der alphawert aendert
|
|
|
+ const // returns whether the alpha value changes
|
|
|
{
|
|
|
return aenderA;
|
|
|
}
|
|
|
|
|
|
-unsigned char LTDSPixel::getA() const // gibt Alpha zurueck
|
|
|
+unsigned char LTDSPixel::getA() const // returns alpha
|
|
|
{
|
|
|
return alpha;
|
|
|
}
|
|
|
|
|
|
-// Inhalt der LTDSDateiKopf Klasse aus Dateisystem.h
|
|
|
-// Konstruktor
|
|
|
+// Content of the LTDSDateiKopf class from Dateisystem.h
|
|
|
+// Constructor
|
|
|
LTDSDateiKopf::LTDSDateiKopf()
|
|
|
: ReferenceCounter(),
|
|
|
sganzahl(0),
|
|
|
@@ -1806,15 +1802,15 @@ LTDSDateiKopf::LTDSDateiKopf()
|
|
|
pos(0)
|
|
|
{}
|
|
|
|
|
|
-// Destruktor
|
|
|
+// Destructor
|
|
|
LTDSDateiKopf::~LTDSDateiKopf()
|
|
|
{
|
|
|
delete[] gr;
|
|
|
delete[] pos;
|
|
|
}
|
|
|
|
|
|
-// nicht constant
|
|
|
-void LTDSDateiKopf::laden(std::ifstream* inF) // Laet aus inF
|
|
|
+// non-constant
|
|
|
+void LTDSDateiKopf::laden(std::ifstream* inF) // Loads from inF
|
|
|
{
|
|
|
if (inF->good() && inF->is_open())
|
|
|
{
|
|
|
@@ -1833,7 +1829,7 @@ void LTDSDateiKopf::laden(std::ifstream* inF) // Laet aus inF
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void LTDSDateiKopf::addSG(char sg) // Schriftgroesse hinzufuegen
|
|
|
+void LTDSDateiKopf::addSG(char sg) // Add font size
|
|
|
{
|
|
|
++sganzahl;
|
|
|
unsigned char* gr_tmp = gr;
|
|
|
@@ -1853,7 +1849,7 @@ void LTDSDateiKopf::addSG(char sg) // Schriftgroesse hinzufuegen
|
|
|
gr[sganzahl - 1] = sg;
|
|
|
}
|
|
|
|
|
|
-void LTDSDateiKopf::removeSG(char sg) // Schriftgroesse entfernen
|
|
|
+void LTDSDateiKopf::removeSG(char sg) // Remove font size
|
|
|
{
|
|
|
bool hatsg = 0;
|
|
|
int sgpos = 0;
|
|
|
@@ -1888,7 +1884,7 @@ void LTDSDateiKopf::removeSG(char sg) // Schriftgroesse entfernen
|
|
|
}
|
|
|
|
|
|
// constant
|
|
|
-void LTDSDateiKopf::speichern(std::ofstream* outF) const // Speichert nach outF
|
|
|
+void LTDSDateiKopf::speichern(std::ofstream* outF) const // Saves to outF
|
|
|
{
|
|
|
if (outF->is_open() && outF->good())
|
|
|
{
|
|
|
@@ -1902,25 +1898,25 @@ void LTDSDateiKopf::speichern(std::ofstream* outF) const // Speichert nach outF
|
|
|
}
|
|
|
|
|
|
unsigned char* LTDSDateiKopf::getSchriftGroesseList()
|
|
|
- const // gibt eine Liste mit gespeicherten Schriftgroessen zurueck
|
|
|
+const // returns a list of stored font sizes
|
|
|
{
|
|
|
return gr;
|
|
|
}
|
|
|
|
|
|
int* LTDSDateiKopf::getPositionList()
|
|
|
- const // gibt eine Positionsliste der gespeicherten Schriftgroessen zurueck
|
|
|
+const // returns a position list of stored font sizes
|
|
|
{
|
|
|
return pos;
|
|
|
}
|
|
|
|
|
|
int LTDSDateiKopf::getSchriftGroesseAnzahl()
|
|
|
- const // gibt die Anzahl der gespeicherten Schriftgroessen zurueck
|
|
|
+const // returns the number of stored font sizes
|
|
|
{
|
|
|
return sganzahl;
|
|
|
}
|
|
|
|
|
|
-// Inhalt der LTDSSchriftKopf Klasse aus Dateisystem.h
|
|
|
-// Konstruktor
|
|
|
+// Content of the LTDSSchriftKopf class from Dateisystem.h
|
|
|
+// Constructor
|
|
|
LTDSSchriftKopf::LTDSSchriftKopf()
|
|
|
: ReferenceCounter(),
|
|
|
schriftSize(0),
|
|
|
@@ -1929,15 +1925,15 @@ LTDSSchriftKopf::LTDSSchriftKopf()
|
|
|
zeichenAnzahl(0)
|
|
|
{}
|
|
|
|
|
|
-// Destruktor
|
|
|
+// Destructor
|
|
|
LTDSSchriftKopf::~LTDSSchriftKopf()
|
|
|
{
|
|
|
delete[] pos;
|
|
|
delete[] zeichen;
|
|
|
}
|
|
|
|
|
|
-// nicht constant
|
|
|
-void LTDSSchriftKopf::laden(std::ifstream* inF) // laeht von inF
|
|
|
+// non-constant
|
|
|
+void LTDSSchriftKopf::laden(std::ifstream* inF) // loads from inF
|
|
|
{
|
|
|
if (inF->good() && inF->is_open())
|
|
|
{
|
|
|
@@ -1957,13 +1953,13 @@ void LTDSSchriftKopf::laden(std::ifstream* inF) // laeht von inF
|
|
|
}
|
|
|
|
|
|
void LTDSSchriftKopf::setSchriftgroesse(
|
|
|
- unsigned char gr) // setze schriftgroesse
|
|
|
+unsigned char gr) // set font size
|
|
|
{
|
|
|
schriftSize = gr;
|
|
|
}
|
|
|
|
|
|
void LTDSSchriftKopf::setZeichenAlphabet(
|
|
|
- Alphabet* alphabet) // setzt die Zeichen von alphabet
|
|
|
+Alphabet* alphabet) // sets the characters from alphabet
|
|
|
{
|
|
|
int count = 0;
|
|
|
for (int i = 0; i < 256; ++i)
|
|
|
@@ -1993,7 +1989,7 @@ void LTDSSchriftKopf::setZeichenAlphabet(
|
|
|
alphabet->release();
|
|
|
}
|
|
|
|
|
|
-void LTDSSchriftKopf::addZeichen(unsigned char zeichen) // Zeichen hinzufuegen
|
|
|
+void LTDSSchriftKopf::addZeichen(unsigned char zeichen) // Add character
|
|
|
{
|
|
|
++zeichenAnzahl;
|
|
|
unsigned char* zeichen_tmp = this->zeichen;
|
|
|
@@ -2012,7 +2008,7 @@ void LTDSSchriftKopf::addZeichen(unsigned char zeichen) // Zeichen hinzufuegen
|
|
|
pos[zeichenAnzahl] = 0;
|
|
|
}
|
|
|
|
|
|
-void LTDSSchriftKopf::removeZeichen(unsigned char zeich) // Zeichen entfernen
|
|
|
+void LTDSSchriftKopf::removeZeichen(unsigned char zeich) // Remove character
|
|
|
{
|
|
|
bool hatZ = 0;
|
|
|
int zPos = 0;
|
|
|
@@ -2047,7 +2043,7 @@ void LTDSSchriftKopf::removeZeichen(unsigned char zeich) // Zeichen entfernen
|
|
|
|
|
|
// constant
|
|
|
void LTDSSchriftKopf::speichern(
|
|
|
- std::ofstream* outF) const // speichert nach outF
|
|
|
+std::ofstream* outF) const // saves to outF
|
|
|
{
|
|
|
if (outF->good() && outF->is_open())
|
|
|
{
|
|
|
@@ -2062,38 +2058,38 @@ void LTDSSchriftKopf::speichern(
|
|
|
}
|
|
|
|
|
|
unsigned char
|
|
|
-LTDSSchriftKopf::getSchriftGroesse() const // gibt die Schriftgroesse zurueck
|
|
|
+LTDSSchriftKopf::getSchriftGroesse() const // returns the font size
|
|
|
{
|
|
|
return schriftSize;
|
|
|
}
|
|
|
|
|
|
unsigned char
|
|
|
-LTDSSchriftKopf::getZeichenAnzahl() const // gibt die Zeichenanzahl zurueck
|
|
|
+LTDSSchriftKopf::getZeichenAnzahl() const // returns the character count
|
|
|
{
|
|
|
return zeichenAnzahl;
|
|
|
}
|
|
|
|
|
|
int* LTDSSchriftKopf::getPositionen()
|
|
|
- const // gibt die Zeichenpositionen zurueck
|
|
|
+const // returns the character positions
|
|
|
{
|
|
|
return pos;
|
|
|
}
|
|
|
|
|
|
-unsigned char* LTDSSchriftKopf::getZeichen() const // gibt die zeichen zurueck
|
|
|
+unsigned char* LTDSSchriftKopf::getZeichen() const // returns the characters
|
|
|
{
|
|
|
return zeichen;
|
|
|
}
|
|
|
|
|
|
-// Inhalt der LTDSBuchstabenKopf Klasse aus Dateisystem.h
|
|
|
-// Konstruktor
|
|
|
+// Content of the LTDSBuchstabenKopf class from Dateisystem.h
|
|
|
+// Constructor
|
|
|
LTDSBuchstabenKopf::LTDSBuchstabenKopf()
|
|
|
: ReferenceCounter(),
|
|
|
zeichen(0),
|
|
|
size(0, 0)
|
|
|
{}
|
|
|
|
|
|
-// nicht constant
|
|
|
-void LTDSBuchstabenKopf::laden(std::ifstream* inF) // laet aus inF
|
|
|
+// non-constant
|
|
|
+void LTDSBuchstabenKopf::laden(std::ifstream* inF) // loads from inF
|
|
|
{
|
|
|
if (inF->good() && inF->is_open())
|
|
|
{
|
|
|
@@ -2104,7 +2100,7 @@ void LTDSBuchstabenKopf::laden(std::ifstream* inF) // laet aus inF
|
|
|
}
|
|
|
|
|
|
void LTDSBuchstabenKopf::init(unsigned char zeichen,
|
|
|
- const Punkt& groesse) // initialisierung( fuer speichern )
|
|
|
+const Punkt& groesse) // initialization (for saving)
|
|
|
{
|
|
|
this->zeichen = zeichen;
|
|
|
this->size = groesse;
|
|
|
@@ -2118,7 +2114,7 @@ void LTDSBuchstabenKopf::init(unsigned char zeichen, int br, int hoe)
|
|
|
|
|
|
// constant
|
|
|
void LTDSBuchstabenKopf::speichern(
|
|
|
- std::ofstream* outF) const // speichertn nach outF
|
|
|
+std::ofstream* outF) const // saves to outF
|
|
|
{
|
|
|
if (outF->good() && outF->is_open())
|
|
|
{
|
|
|
@@ -2128,28 +2124,28 @@ void LTDSBuchstabenKopf::speichern(
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-unsigned char LTDSBuchstabenKopf::getZeichen() const // gibt das Zeichen zurueck
|
|
|
+unsigned char LTDSBuchstabenKopf::getZeichen() const // returns the character
|
|
|
{
|
|
|
return zeichen;
|
|
|
}
|
|
|
|
|
|
-int LTDSBuchstabenKopf::getBreite() const // gibt die Breite zurueck
|
|
|
+int LTDSBuchstabenKopf::getBreite() const // returns the width
|
|
|
{
|
|
|
return size.x;
|
|
|
}
|
|
|
|
|
|
-int LTDSBuchstabenKopf::getHoehe() const // gibt die hoehe zurueck
|
|
|
+int LTDSBuchstabenKopf::getHoehe() const // returns the height
|
|
|
{
|
|
|
return size.y;
|
|
|
}
|
|
|
|
|
|
-const Punkt& LTDSBuchstabenKopf::getGroesse() const // gibt die Groesse zurueck
|
|
|
+const Punkt& LTDSBuchstabenKopf::getGroesse() const // returns the size
|
|
|
{
|
|
|
return size;
|
|
|
}
|
|
|
|
|
|
-// Inhalt der LTDSBuchstabenKoerper Klasse aus Dateisystem.h
|
|
|
-// Konstruktor
|
|
|
+// Content of the LTDSBuchstabenKoerper class from Dateisystem.h
|
|
|
+// Constructor
|
|
|
LTDSBuchstabenKoerper::LTDSBuchstabenKoerper(LTDSBuchstabenKopf* kopf)
|
|
|
: ReferenceCounter(),
|
|
|
size(kopf->getGroesse()),
|
|
|
@@ -2160,21 +2156,21 @@ LTDSBuchstabenKoerper::LTDSBuchstabenKoerper(LTDSBuchstabenKopf* kopf)
|
|
|
kopf->release();
|
|
|
}
|
|
|
|
|
|
-// Destruktor
|
|
|
+// Destructor
|
|
|
LTDSBuchstabenKoerper::~LTDSBuchstabenKoerper()
|
|
|
{
|
|
|
if (buchstabe) buchstabe->release();
|
|
|
}
|
|
|
|
|
|
-// nicht constant
|
|
|
+// non-constant
|
|
|
void LTDSBuchstabenKoerper::setBuchstabe(
|
|
|
- Buchstabe* zeichen) // setzt den Buchstaben
|
|
|
+ Buchstabe* zeichen) // sets the character
|
|
|
{
|
|
|
if (buchstabe) buchstabe->release();
|
|
|
buchstabe = zeichen;
|
|
|
}
|
|
|
|
|
|
-void LTDSBuchstabenKoerper::laden(std::ifstream* inF) // Laeht aus inF
|
|
|
+void LTDSBuchstabenKoerper::laden(std::ifstream* inF) // Loads from inF
|
|
|
{
|
|
|
if (inF->good() && inF->is_open())
|
|
|
{
|
|
|
@@ -2185,14 +2181,14 @@ void LTDSBuchstabenKoerper::laden(std::ifstream* inF) // Laeht aus inF
|
|
|
int ende = -1;
|
|
|
for (int i = 0; i < size.x * size.y; ++i)
|
|
|
{
|
|
|
- if (!jetzt) // wenn es nicht der erste Pixel ist
|
|
|
+ if (!jetzt) // if it is not the first pixel
|
|
|
jetzt = new LTDSPixel(
|
|
|
dynamic_cast<LTDSPixel*>(vorher->getThis()));
|
|
|
int ende = -1;
|
|
|
- while (ende < 0) // Pixel laden
|
|
|
+ while (ende < 0) // load pixel
|
|
|
{
|
|
|
if (beg == 0) inF->read(&byte, 1);
|
|
|
- ende = jetzt->addByte(byte, beg); // byte auswerten
|
|
|
+ ende = jetzt->addByte(byte, beg); // evaluate byte
|
|
|
beg = 0;
|
|
|
}
|
|
|
beg = ende;
|
|
|
@@ -2209,90 +2205,90 @@ void LTDSBuchstabenKoerper::laden(std::ifstream* inF) // Laeht aus inF
|
|
|
|
|
|
// constant
|
|
|
void LTDSBuchstabenKoerper::speichern(
|
|
|
- std::ofstream* outF) const // speichert nach outF
|
|
|
+std::ofstream* outF) const // saves to outF
|
|
|
{
|
|
|
if (outF->good() && outF->is_open())
|
|
|
{
|
|
|
- LTDSPixel* vorher = 0; // Letzter gespeicherter Pixel
|
|
|
+ LTDSPixel* vorher = 0; // Last saved pixel
|
|
|
LTDSPixel* jetzt
|
|
|
- = new LTDSPixel(0); // Der momentan zu speichernde Pixel
|
|
|
+ = new LTDSPixel(0); // The pixel currently being saved
|
|
|
int begin = 0,
|
|
|
- ende = 0; // Pixelbeginn, endposition in der byte variable
|
|
|
- char byte = 0; // Der naechste byte der Datei
|
|
|
+ ende = 0; // pixel start, end position in the byte variable
|
|
|
+ char byte = 0; // The next byte of the file
|
|
|
bool w = 0;
|
|
|
unsigned char* alphaBuff = buchstabe->getBuff();
|
|
|
- for (int i = 0; i < size.x * size.y; ++i) // fuer jeden Pixel
|
|
|
+ for (int i = 0; i < size.x * size.y; ++i) // for each pixel
|
|
|
{
|
|
|
- if (!jetzt) // wenn es nicht der erste Pixel ist
|
|
|
+ if (!jetzt) // if it is not the first pixel
|
|
|
jetzt = new LTDSPixel(
|
|
|
dynamic_cast<LTDSPixel*>(vorher->getThis()));
|
|
|
- jetzt->setAlpha(alphaBuff[i]); // Farbe des Pixels setzen
|
|
|
- jetzt->Komp(); // Pixel komprimieren
|
|
|
+ jetzt->setAlpha(alphaBuff[i]); // set pixel color
|
|
|
+ jetzt->Komp(); // compress pixel
|
|
|
ende = -1;
|
|
|
- while (ende < 0) // byte befuellen
|
|
|
+ while (ende < 0) // fill byte
|
|
|
{
|
|
|
ende = jetzt->getNextByte(byte, begin);
|
|
|
begin = 0;
|
|
|
w = 0;
|
|
|
- if (ende == -1 || ende == 8) // byte speichern
|
|
|
+ if (ende == -1 || ende == 8) // save byte
|
|
|
{
|
|
|
outF->write(&byte, 1);
|
|
|
w = 1;
|
|
|
byte = 0;
|
|
|
}
|
|
|
- } // Pixel fertig
|
|
|
+ } // pixel finished
|
|
|
begin = ende;
|
|
|
if (begin == 8) begin = 0;
|
|
|
if (vorher) vorher->release();
|
|
|
vorher = dynamic_cast<LTDSPixel*>(
|
|
|
- jetzt->getThis()); // dieser wird zu letzter
|
|
|
+ jetzt->getThis()); // jetzt becomes vorher
|
|
|
jetzt = (LTDSPixel*)jetzt->release();
|
|
|
}
|
|
|
if (vorher) vorher = (LTDSPixel*)vorher->release();
|
|
|
if (!w)
|
|
|
{
|
|
|
- outF->write(&byte, 1); // Das letzte byte speichern
|
|
|
+ outF->write(&byte, 1); // save the last byte
|
|
|
}
|
|
|
- outF->flush(); // dateistream speichern
|
|
|
+ outF->flush(); // flush file stream
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Buchstabe*
|
|
|
-LTDSBuchstabenKoerper::getBuchstabe() const // gibt den Buchstaben zurueck
|
|
|
+LTDSBuchstabenKoerper::getBuchstabe() const // returns the character
|
|
|
{
|
|
|
return dynamic_cast<Buchstabe*>(buchstabe->getThis());
|
|
|
}
|
|
|
|
|
|
unsigned char
|
|
|
-LTDSBuchstabenKoerper::getZeichen() const // gibt das Zeichen zurueck
|
|
|
+LTDSBuchstabenKoerper::getZeichen() const // returns the character
|
|
|
{
|
|
|
return zeichen;
|
|
|
}
|
|
|
|
|
|
-// Inhalt der LTDSDatei Klasse aus DAteisystem.h
|
|
|
-// Konstruktor
|
|
|
+// Content of the LTDSDatei class from Dateisystem.h
|
|
|
+// Constructor
|
|
|
LTDSDatei::LTDSDatei()
|
|
|
: ReferenceCounter(),
|
|
|
pfad(new Text()),
|
|
|
dateiKopf(0)
|
|
|
{}
|
|
|
|
|
|
-// Destruktor
|
|
|
+// Destructor
|
|
|
LTDSDatei::~LTDSDatei()
|
|
|
{
|
|
|
if (dateiKopf) dateiKopf->release();
|
|
|
pfad->release();
|
|
|
}
|
|
|
|
|
|
-// nicht constant
|
|
|
-void LTDSDatei::setPfad(Text* txt) // setzt den Pfad zur Datei
|
|
|
+// non-constant
|
|
|
+void LTDSDatei::setPfad(Text* txt) // sets the path to the file
|
|
|
{
|
|
|
if (dateiKopf) dateiKopf = (LTDSDateiKopf*)dateiKopf->release();
|
|
|
pfad->setText(txt->getText());
|
|
|
txt->release();
|
|
|
}
|
|
|
|
|
|
-void LTDSDatei::leseDaten() // liesst den Dateikopf
|
|
|
+void LTDSDatei::leseDaten() // reads the file header
|
|
|
{
|
|
|
if (!DateiExistiert(dynamic_cast<Text*>(pfad->getThis()))) return;
|
|
|
if (dateiKopf) dateiKopf->release();
|
|
|
@@ -2304,24 +2300,24 @@ void LTDSDatei::leseDaten() // liesst den Dateikopf
|
|
|
}
|
|
|
|
|
|
void LTDSDatei::addSchriftgroesse(
|
|
|
- Alphabet* alphabet) // fuegt eine Schriftgroesse hinzu
|
|
|
+ Alphabet* alphabet) // adds a font size
|
|
|
{
|
|
|
if (!DateiExistiert(dynamic_cast<Text*>(
|
|
|
- pfad->getThis()))) // pruefen, ob die Datei existiert
|
|
|
+ pfad->getThis()))) // check if the file exists
|
|
|
return;
|
|
|
- if (!dateiKopf) // pruefen, ob der Dateikopf schon gelesen wurde
|
|
|
+ if (!dateiKopf) // check if the file header has been read
|
|
|
leseDaten();
|
|
|
int sgroesse
|
|
|
= alphabet
|
|
|
- ->getSchriftSize(); // Schriftgroesse die hinzugefuegt werden soll
|
|
|
+ ->getSchriftSize(); // font size to be added
|
|
|
unsigned char* sglist
|
|
|
- = dateiKopf->getSchriftGroesseList(); // Liste von bereits vorhandenen
|
|
|
- // Schriftgroessen
|
|
|
+ = dateiKopf->getSchriftGroesseList(); // list of already existing
|
|
|
+ // font sizes
|
|
|
unsigned char sganzahl
|
|
|
- = dateiKopf->getSchriftGroesseAnzahl(); // Anzahl der bereits
|
|
|
- // vorhandenen Schriftgroessen
|
|
|
+ = dateiKopf->getSchriftGroesseAnzahl(); // number of already
|
|
|
+ // existing font sizes
|
|
|
for (int i = 0; i < sganzahl;
|
|
|
- ++i) // pruefen, ob die Schriftgroesse bereits existiert
|
|
|
+ ++i) // check if the font size already exists
|
|
|
{
|
|
|
if (sglist[i] == sgroesse)
|
|
|
{
|
|
|
@@ -2329,39 +2325,39 @@ void LTDSDatei::addSchriftgroesse(
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- dateiKopf->addSG(sgroesse); // Schriftgroesse dem Dateikopf hinzufuegen
|
|
|
+ dateiKopf->addSG(sgroesse); // add font size to file header
|
|
|
int* sgPosList
|
|
|
= dateiKopf
|
|
|
- ->getPositionList(); // Liste mit positionen der Schriftgroessen
|
|
|
- sglist = dateiKopf->getSchriftGroesseList(); // Liste von bereits
|
|
|
- // vorhandenen Schriftgroessen
|
|
|
+ ->getPositionList(); // list of font size positions
|
|
|
+ sglist = dateiKopf->getSchriftGroesseList(); // list of already
|
|
|
+ // existing font sizes
|
|
|
std::ifstream* inF
|
|
|
- = new std::ifstream(pfad->getText(), std::ios::binary); // alte Datei
|
|
|
+ = new std::ifstream(pfad->getText(), std::ios::binary); // old file
|
|
|
pfad->append("0");
|
|
|
std::ofstream* outF
|
|
|
- = new std::ofstream(pfad->getText(), std::ios::binary); // neue Datei
|
|
|
- dateiKopf->speichern(outF); // Dateikopf in neue datei speichern
|
|
|
+ = new std::ofstream(pfad->getText(), std::ios::binary); // new file
|
|
|
+ dateiKopf->speichern(outF); // save file header to new file
|
|
|
inF->seekg(1 + 5 * sganzahl,
|
|
|
- std::ios::beg); // Position der ersten Schriftgroesse in der alten Datei
|
|
|
+ std::ios::beg); // position of the first font size in the old file
|
|
|
for (int i = 0; i < sganzahl;
|
|
|
- ++i) // Buchstabenpositionen aller Schriftgroessen aktualisieren
|
|
|
+ ++i) // update character positions of all font sizes
|
|
|
{
|
|
|
LTDSSchriftKopf* sgKpf_tmp
|
|
|
- = new LTDSSchriftKopf(); // Schriftgroessen Kopf
|
|
|
- sgKpf_tmp->laden(inF); // aus alter Datei laden
|
|
|
+ = new LTDSSchriftKopf(); // font size header
|
|
|
+ sgKpf_tmp->laden(inF); // load from old file
|
|
|
int* zeichP_tmp
|
|
|
= sgKpf_tmp
|
|
|
- ->getPositionen(); // Zeichenpositionen der Schriftgroesse
|
|
|
+ ->getPositionen(); // character positions of the font size
|
|
|
unsigned char zeichA_tmp
|
|
|
= sgKpf_tmp
|
|
|
- ->getZeichenAnzahl(); // Anzahl von Zeichen der Schriftgroesse
|
|
|
+ ->getZeichenAnzahl(); // number of characters in the font size
|
|
|
for (int i1 = 0; i1 < zeichA_tmp; ++i1)
|
|
|
- zeichP_tmp[i1] += 5; // Buchstabenpositionen aktualisieren
|
|
|
+ zeichP_tmp[i1] += 5; // update character positions
|
|
|
sgKpf_tmp->speichern(
|
|
|
- outF); // Schriftgroesse Kopf in neue Datei speichern
|
|
|
+ outF); // save font size header to new file
|
|
|
int beginByte
|
|
|
- = (int)inF->tellg(); // Die restlichen bytes bis zur naechsten
|
|
|
- // Schriftgroesse in neue Datei kopieren
|
|
|
+ = (int)inF->tellg(); // copy remaining bytes until the next
|
|
|
+ // font size to new file
|
|
|
int endByte = sgPosList[i + 1];
|
|
|
if (!endByte)
|
|
|
{
|
|
|
@@ -2370,28 +2366,28 @@ void LTDSDatei::addSchriftgroesse(
|
|
|
inF->seekg(beginByte, std::ios::beg);
|
|
|
}
|
|
|
char byte;
|
|
|
- for (int i1 = beginByte; i1 < endByte; ++i1) // Kopiervorgang
|
|
|
+ for (int i1 = beginByte; i1 < endByte; ++i1) // copy operation
|
|
|
{
|
|
|
inF->read(&byte, 1);
|
|
|
outF->write(&byte, 1);
|
|
|
}
|
|
|
sgKpf_tmp->release();
|
|
|
}
|
|
|
- inF->close(); // Alte datei schliessen
|
|
|
+ inF->close(); // close old file
|
|
|
sgPosList[sganzahl] = (int)outF->tellp();
|
|
|
outF->seekp(0, std::ios::beg);
|
|
|
- for (int i = 0; i < sganzahl; ++i) // Positionen im Dateikopf aktualisieren
|
|
|
+ for (int i = 0; i < sganzahl; ++i) // update positions in file header
|
|
|
sgPosList[i] += 5;
|
|
|
- dateiKopf->speichern(outF); // aktualisierter Dateikopf speichern
|
|
|
+ dateiKopf->speichern(outF); // save updated file header
|
|
|
outF->seekp(sgPosList[sganzahl], std::ios::beg);
|
|
|
LTDSSchriftKopf* sgkopf
|
|
|
- = new LTDSSchriftKopf(); // Kopf der neuen Schriftgroesse
|
|
|
+ = new LTDSSchriftKopf(); // header of the new font size
|
|
|
sgkopf->setZeichenAlphabet(dynamic_cast<Alphabet*>(
|
|
|
- alphabet->getThis())); // Kopf der Schriftgroesse initialisieren
|
|
|
- sgkopf->speichern(outF); // Kopf der Schriftgroesse speichern
|
|
|
+ alphabet->getThis())); // initialize font size header
|
|
|
+ sgkopf->speichern(outF); // save font size header
|
|
|
int* BuchstabenPosList
|
|
|
- = sgkopf->getPositionen(); // positionen der verschiedenen Zeichen in
|
|
|
- // der Datei( nuch 0 )
|
|
|
+ = sgkopf->getPositionen(); // positions of the different characters
|
|
|
+ // in the file (still 0)
|
|
|
int count = 0;
|
|
|
for (int i = 0; i < 256; ++i)
|
|
|
{
|
|
|
@@ -2399,33 +2395,33 @@ void LTDSDatei::addSchriftgroesse(
|
|
|
if (zeich)
|
|
|
{
|
|
|
BuchstabenPosList[count]
|
|
|
- = (int)outF->tellp(); // position des Zeichens setzen
|
|
|
+ = (int)outF->tellp(); // set character position
|
|
|
LTDSBuchstabenKopf* zeichKpf
|
|
|
- = new LTDSBuchstabenKopf(); // Zeichenkopf
|
|
|
+ = new LTDSBuchstabenKopf(); // character header
|
|
|
zeichKpf->init(i, zeich->getBreite(), zeich->getHeight());
|
|
|
- zeichKpf->speichern(outF); // Zeichenkopf speichern
|
|
|
+ zeichKpf->speichern(outF); // save character header
|
|
|
LTDSBuchstabenKoerper* zeichKoerp
|
|
|
= new LTDSBuchstabenKoerper(dynamic_cast<LTDSBuchstabenKopf*>(
|
|
|
- zeichKpf->getThis())); // Zeichenkoerper
|
|
|
+ zeichKpf->getThis())); // character body
|
|
|
zeichKpf->release();
|
|
|
zeichKoerp->setBuchstabe(
|
|
|
dynamic_cast<Buchstabe*>(zeich->getThis()));
|
|
|
- zeichKoerp->speichern(outF); // Zeichenkoerper speichern
|
|
|
+ zeichKoerp->speichern(outF); // save character body
|
|
|
zeich->release();
|
|
|
++count;
|
|
|
}
|
|
|
}
|
|
|
outF->seekp(sgPosList[sganzahl], std::ios::beg);
|
|
|
- sgkopf->speichern(outF); // aktualisierter Schriftgroessen Kopf speichern
|
|
|
+ sgkopf->speichern(outF); // save updated font size header
|
|
|
outF->close();
|
|
|
Text* pfad2 = new Text();
|
|
|
pfad2->setText(pfad->getText());
|
|
|
pfad->remove(pfad->getLength() - 1, pfad->getLength());
|
|
|
- DateiRemove(dynamic_cast<Text*>(pfad->getThis())); // Alte datei Loeschen
|
|
|
+ DateiRemove(dynamic_cast<Text*>(pfad->getThis())); // delete old file
|
|
|
DateiUmbenennen(dynamic_cast<Text*>(pfad2->getThis()),
|
|
|
dynamic_cast<Text*>(
|
|
|
- pfad->getThis())); // neue Datei nach alte umbenennen
|
|
|
- pfad2->release(); // Speicher freigeben
|
|
|
+ pfad->getThis())); // rename new file to old
|
|
|
+ pfad2->release(); // free memory
|
|
|
sgkopf->release();
|
|
|
delete inF;
|
|
|
delete outF;
|
|
|
@@ -2434,27 +2430,27 @@ void LTDSDatei::addSchriftgroesse(
|
|
|
|
|
|
void LTDSDatei::addBuchstabe(int gr,
|
|
|
Buchstabe* zeich,
|
|
|
- unsigned char zeichen) // Fuegt einer Schriftgroesse einen Buchstaben hinzu
|
|
|
+ unsigned char zeichen) // Adds a character to a font size
|
|
|
{
|
|
|
if (!DateiExistiert(
|
|
|
- dynamic_cast<Text*>(pfad->getThis()))) // pruefen ob Datei existiert
|
|
|
+ dynamic_cast<Text*>(pfad->getThis()))) // check if file exists
|
|
|
{
|
|
|
zeich->release();
|
|
|
return;
|
|
|
}
|
|
|
- if (!dateiKopf) // pruefen, ob der DAteikopf geladen wurde
|
|
|
+ if (!dateiKopf) // check if the file header was loaded
|
|
|
leseDaten();
|
|
|
unsigned char* sgList
|
|
|
- = dateiKopf->getSchriftGroesseList(); // Liste mit Schriftgroessen aus
|
|
|
- // der Datei
|
|
|
- int* sgPosList = dateiKopf->getPositionList(); // Liste mit Schriftgroessen
|
|
|
- // positionen aus Datei
|
|
|
+ = dateiKopf->getSchriftGroesseList(); // list of font sizes from
|
|
|
+ // the file
|
|
|
+ int* sgPosList = dateiKopf->getPositionList(); // list of font size
|
|
|
+ // positions from file
|
|
|
unsigned char sgAnzahl
|
|
|
- = dateiKopf->getSchriftGroesseAnzahl(); // Anzahl von Schriftgroessen
|
|
|
- // aus der Datei
|
|
|
+ = dateiKopf->getSchriftGroesseAnzahl(); // number of font sizes
|
|
|
+ // from the file
|
|
|
int sgNum = -1;
|
|
|
for (int i = 0; i < sgAnzahl;
|
|
|
- ++i) // Position der richtigen Schriftgroesse ermitteln
|
|
|
+ ++i) // find the position of the correct font size
|
|
|
{
|
|
|
if (sgList[i] == gr)
|
|
|
{
|
|
|
@@ -2463,40 +2459,40 @@ void LTDSDatei::addBuchstabe(int gr,
|
|
|
}
|
|
|
}
|
|
|
std::ifstream* inF
|
|
|
- = new std::ifstream(pfad->getText(), std::ios::binary); // Alte Datei
|
|
|
+ = new std::ifstream(pfad->getText(), std::ios::binary); // old file
|
|
|
pfad->append("0");
|
|
|
std::ofstream* outF
|
|
|
- = new std::ofstream(pfad->getText(), std::ios::binary); // Neue Datei
|
|
|
+ = new std::ofstream(pfad->getText(), std::ios::binary); // new file
|
|
|
inF->seekg(1 + 5 * sgAnzahl, std::ios::beg);
|
|
|
if (sgNum
|
|
|
- == -1) // Die Schriftgroesse existiert noch nicht und wird erstellt
|
|
|
+ == -1) // The font size does not exist yet and will be created
|
|
|
{
|
|
|
- dateiKopf->addSG(gr); // Schriftgroesse dem Dateikopf hinzufuegen
|
|
|
+ dateiKopf->addSG(gr); // add font size to file header
|
|
|
sgPosList = dateiKopf->getPositionList();
|
|
|
sgList = dateiKopf->getSchriftGroesseList();
|
|
|
- dateiKopf->speichern(outF); // Dateikopf speichern
|
|
|
+ dateiKopf->speichern(outF); // save file header
|
|
|
inF->seekg(1 + 5 * sgAnzahl,
|
|
|
- std::ios::beg); // Position der ersten
|
|
|
- // Schriftgroesse in der alten Datei
|
|
|
+ std::ios::beg); // position of the first
|
|
|
+ // font size in the old file
|
|
|
for (int i = 0; i < sgAnzahl;
|
|
|
- ++i) // Buchstabenpositionen aller Schriftgroessen aktualisieren
|
|
|
+ ++i) // update character positions of all font sizes
|
|
|
{
|
|
|
LTDSSchriftKopf* sgKpf_tmp
|
|
|
- = new LTDSSchriftKopf(); // Schriftgroessen Kopf
|
|
|
- sgKpf_tmp->laden(inF); // aus alter Datei laden
|
|
|
+ = new LTDSSchriftKopf(); // font size header
|
|
|
+ sgKpf_tmp->laden(inF); // load from old file
|
|
|
int* zeichP_tmp
|
|
|
= sgKpf_tmp
|
|
|
- ->getPositionen(); // Zeichenpositionen der Schriftgroesse
|
|
|
+ ->getPositionen(); // character positions of the font size
|
|
|
unsigned char zeichA_tmp
|
|
|
- = sgKpf_tmp->getZeichenAnzahl(); // Anzahl von Zeichen der
|
|
|
- // Schriftgroesse
|
|
|
+ = sgKpf_tmp->getZeichenAnzahl(); // number of characters in
|
|
|
+ // the font size
|
|
|
for (int i1 = 0; i1 < zeichA_tmp; ++i1)
|
|
|
- zeichP_tmp[i1] += 5; // Buchstabenpositionen aktualisieren
|
|
|
+ zeichP_tmp[i1] += 5; // update character positions
|
|
|
sgKpf_tmp->speichern(
|
|
|
- outF); // Schriftgroesse Kopf in neue Datei speichern
|
|
|
+ outF); // save font size header to new file
|
|
|
int beginByte
|
|
|
- = (int)inF->tellg(); // Die restlichen bytes bis zur naechsten
|
|
|
- // Schriftgroesse in neue Datei kopieren
|
|
|
+ = (int)inF->tellg(); // copy remaining bytes until the next
|
|
|
+ // font size to new file
|
|
|
int endByte = sgPosList[i + 1];
|
|
|
if (i + 1 >= sgAnzahl)
|
|
|
{
|
|
|
@@ -2505,7 +2501,7 @@ void LTDSDatei::addBuchstabe(int gr,
|
|
|
inF->seekg(beginByte, std::ios::beg);
|
|
|
}
|
|
|
char byte;
|
|
|
- for (int i1 = beginByte; i1 < endByte; ++i1) // Kopiervorgang
|
|
|
+ for (int i1 = beginByte; i1 < endByte; ++i1) // copy operation
|
|
|
{
|
|
|
inF->read(&byte, 1);
|
|
|
outF->write(&byte, 1);
|
|
|
@@ -2515,50 +2511,50 @@ void LTDSDatei::addBuchstabe(int gr,
|
|
|
sgPosList[sgAnzahl] = (int)outF->tellp();
|
|
|
outF->seekp(0, std::ios::beg);
|
|
|
for (int i = 0; i < sgAnzahl;
|
|
|
- ++i) // Positionen im Dateikopf aktualisieren
|
|
|
+ ++i) // update positions in file header
|
|
|
sgPosList[i] += 5;
|
|
|
- dateiKopf->speichern(outF); // aktualisierter Dateikopf speichern
|
|
|
+ dateiKopf->speichern(outF); // save updated file header
|
|
|
outF->seekp(sgPosList[sgAnzahl], std::ios::beg);
|
|
|
LTDSSchriftKopf* sgKpf
|
|
|
- = new LTDSSchriftKopf(); // Schriftgroesse Kopf initialisiern
|
|
|
+ = new LTDSSchriftKopf(); // initialize font size header
|
|
|
sgKpf->setSchriftgroesse(gr);
|
|
|
sgKpf->addZeichen(zeichen);
|
|
|
sgKpf->getPositionen()[0] = (int)outF->tellp() + 7;
|
|
|
- sgKpf->speichern(outF); // Schriftgroesse Kopf speichern
|
|
|
+ sgKpf->speichern(outF); // save font size header
|
|
|
sgKpf->release();
|
|
|
LTDSBuchstabenKopf* zeichKpf
|
|
|
- = new LTDSBuchstabenKopf(); // Buchstabenkopf
|
|
|
+ = new LTDSBuchstabenKopf(); // character header
|
|
|
zeichKpf->init(zeichen, zeich->getSize());
|
|
|
- zeichKpf->speichern(outF); // Buchstabenkopf speichern
|
|
|
+ zeichKpf->speichern(outF); // save character header
|
|
|
LTDSBuchstabenKoerper* zeichKoerp
|
|
|
= new LTDSBuchstabenKoerper(dynamic_cast<LTDSBuchstabenKopf*>(
|
|
|
- zeichKpf->getThis())); // Buchstabenkoerper
|
|
|
+ zeichKpf->getThis())); // character body
|
|
|
zeichKpf->release();
|
|
|
zeichKoerp->setBuchstabe(dynamic_cast<Buchstabe*>(zeich->getThis()));
|
|
|
- zeichKoerp->speichern(outF); // Buchstabenkoerper speichern
|
|
|
+ zeichKoerp->speichern(outF); // save character body
|
|
|
zeichKoerp->release();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- dateiKopf->speichern(outF); // Dateikopf speichern
|
|
|
+ dateiKopf->speichern(outF); // save file header
|
|
|
int beginByte
|
|
|
- = 1 + 5 * sgAnzahl; // Die restlichen bytes bis zur naechsten
|
|
|
- // Schriftgroesse in neue Datei kopieren
|
|
|
+ = 1 + 5 * sgAnzahl; // copy remaining bytes until the next
|
|
|
+ // font size to new file
|
|
|
int endByte = sgPosList[sgNum];
|
|
|
char byte;
|
|
|
for (int i1 = beginByte; i1 < endByte;
|
|
|
- ++i1) // Kopiervorgang bis zur angegebenen groesse
|
|
|
+ ++i1) // copy operation up to the specified size
|
|
|
{
|
|
|
inF->read(&byte, 1);
|
|
|
outF->write(&byte, 1);
|
|
|
}
|
|
|
- LTDSSchriftKopf* sgKpf = new LTDSSchriftKopf(); // Schriftgroesse Kopf
|
|
|
+ LTDSSchriftKopf* sgKpf = new LTDSSchriftKopf(); // font size header
|
|
|
sgKpf->laden(inF);
|
|
|
for (int i = 0; i < sgKpf->getZeichenAnzahl(); ++i)
|
|
|
sgKpf->getPositionen()[i] += 5;
|
|
|
sgKpf->addZeichen(zeichen);
|
|
|
int indexPlus = 5;
|
|
|
- int zeichenPos = sgPosList[sgNum + 1]; // position des neuen Zeichens
|
|
|
+ int zeichenPos = sgPosList[sgNum + 1]; // position of the new character
|
|
|
if (sgNum + 1 >= sgAnzahl)
|
|
|
{
|
|
|
int tmp = (int)inF->tellg();
|
|
|
@@ -2568,51 +2564,51 @@ void LTDSDatei::addBuchstabe(int gr,
|
|
|
}
|
|
|
zeichenPos += indexPlus;
|
|
|
sgKpf->getPositionen()[sgKpf->getZeichenAnzahl() - 1] = zeichenPos;
|
|
|
- sgKpf->speichern(outF); // Schriftgroesse Kopf speichern
|
|
|
+ sgKpf->speichern(outF); // save font size header
|
|
|
sgKpf->release();
|
|
|
for (int i = (int)inF->tellg() + indexPlus; i < zeichenPos;
|
|
|
- ++i) // Kopiervorgang bis zum Zeichenbeginn
|
|
|
+ ++i) // copy operation up to the character start
|
|
|
{
|
|
|
inF->read(&byte, 1);
|
|
|
outF->write(&byte, 1);
|
|
|
}
|
|
|
- LTDSBuchstabenKopf* zeichKpf = new LTDSBuchstabenKopf(); // Zeichenkopf
|
|
|
+ LTDSBuchstabenKopf* zeichKpf = new LTDSBuchstabenKopf(); // character header
|
|
|
zeichKpf->init(zeichen, zeich->getSize());
|
|
|
- zeichKpf->speichern(outF); // Zeichenkopf speichern
|
|
|
+ zeichKpf->speichern(outF); // save character header
|
|
|
LTDSBuchstabenKoerper* zeichKoerp
|
|
|
= new LTDSBuchstabenKoerper(dynamic_cast<LTDSBuchstabenKopf*>(
|
|
|
- zeichKpf->getThis())); // Zeichenkoerper
|
|
|
+ zeichKpf->getThis())); // character body
|
|
|
zeichKpf->release();
|
|
|
zeichKoerp->setBuchstabe(dynamic_cast<Buchstabe*>(zeich->getThis()));
|
|
|
- zeichKoerp->speichern(outF); // Zeichenkoerper speichern
|
|
|
+ zeichKoerp->speichern(outF); // save character body
|
|
|
zeichKoerp->release();
|
|
|
int nowPos = (int)outF->tellp();
|
|
|
indexPlus += nowPos - zeichenPos;
|
|
|
- for (int i = sgNum + 1; i < sgAnzahl; ++i) // Dateikopf aktualisieren
|
|
|
+ for (int i = sgNum + 1; i < sgAnzahl; ++i) // update file header
|
|
|
sgPosList[i] += indexPlus;
|
|
|
outF->seekp(0, std::ios::beg);
|
|
|
- dateiKopf->speichern(outF); // Dateikopf speichern
|
|
|
+ dateiKopf->speichern(outF); // save file header
|
|
|
outF->seekp(nowPos, std::ios::beg);
|
|
|
for (int i = sgNum + 1; i < sgAnzahl;
|
|
|
- ++i) // Restliche Schriftgroessen aktualisieren
|
|
|
+ ++i) // update remaining font sizes
|
|
|
{
|
|
|
LTDSSchriftKopf* sgKpf_tmp
|
|
|
- = new LTDSSchriftKopf(); // Schriftgroessen Kopf
|
|
|
- sgKpf_tmp->laden(inF); // aus alter Datei laden
|
|
|
+ = new LTDSSchriftKopf(); // font size header
|
|
|
+ sgKpf_tmp->laden(inF); // load from old file
|
|
|
int* zeichP_tmp
|
|
|
= sgKpf_tmp
|
|
|
- ->getPositionen(); // Zeichenpositionen der Schriftgroesse
|
|
|
+ ->getPositionen(); // character positions of the font size
|
|
|
unsigned char zeichA_tmp
|
|
|
- = sgKpf_tmp->getZeichenAnzahl(); // Anzahl von Zeichen der
|
|
|
- // Schriftgroesse
|
|
|
+ = sgKpf_tmp->getZeichenAnzahl(); // number of characters in
|
|
|
+ // the font size
|
|
|
for (int i1 = 0; i1 < zeichA_tmp; ++i1)
|
|
|
zeichP_tmp[i1]
|
|
|
- += indexPlus; // Buchstabenpositionen aktualisieren
|
|
|
+ += indexPlus; // update character positions
|
|
|
sgKpf_tmp->speichern(
|
|
|
- outF); // Schriftgroesse Kopf in neue Datei speichern
|
|
|
+ outF); // save font size header to new file
|
|
|
int beginByte
|
|
|
- = (int)inF->tellg(); // Die restlichen bytes bis zur naechsten
|
|
|
- // Schriftgroesse in neue Datei kopieren
|
|
|
+ = (int)inF->tellg(); // copy remaining bytes until the next
|
|
|
+ // font size to new file
|
|
|
int endByte = sgPosList[i + 1];
|
|
|
if (i + 1 >= sgAnzahl)
|
|
|
{
|
|
|
@@ -2621,7 +2617,7 @@ void LTDSDatei::addBuchstabe(int gr,
|
|
|
inF->seekg(beginByte, std::ios::beg);
|
|
|
}
|
|
|
char byte;
|
|
|
- for (int i1 = beginByte; i1 < endByte; ++i1) // Kopiervorgang
|
|
|
+ for (int i1 = beginByte; i1 < endByte; ++i1) // copy operation
|
|
|
{
|
|
|
inF->read(&byte, 1);
|
|
|
outF->write(&byte, 1);
|
|
|
@@ -2633,29 +2629,29 @@ void LTDSDatei::addBuchstabe(int gr,
|
|
|
outF->close();
|
|
|
Text* pfad2 = new Text(pfad->getText());
|
|
|
pfad->remove(pfad->getLength() - 1, pfad->getLength());
|
|
|
- DateiRemove(dynamic_cast<Text*>(pfad->getThis())); // Alte Datei loeschen
|
|
|
+ DateiRemove(dynamic_cast<Text*>(pfad->getThis())); // delete old file
|
|
|
DateiUmbenennen(dynamic_cast<Text*>(pfad2->getThis()),
|
|
|
- dynamic_cast<Text*>(pfad->getThis())); // Neue Datei in alte umbenennen
|
|
|
- pfad2->release(); // Speicher freigeben
|
|
|
+ dynamic_cast<Text*>(pfad->getThis())); // rename new file to old
|
|
|
+ pfad2->release(); // free memory
|
|
|
delete inF;
|
|
|
delete outF;
|
|
|
zeich->release();
|
|
|
}
|
|
|
|
|
|
void LTDSDatei::loescheSchrifrGroesse(
|
|
|
- int gr) // Loescht eine Schriftgroesse aus der Datei
|
|
|
+ int gr) // Deletes a font size from the file
|
|
|
{
|
|
|
if (!DateiExistiert(dynamic_cast<Text*>(
|
|
|
- pfad->getThis()))) // pruefen, ob Datei existiert
|
|
|
+ pfad->getThis()))) // check if file exists
|
|
|
return;
|
|
|
- if (!dateiKopf) // pruefen, ob der Dateikopf geladen wurde
|
|
|
+ if (!dateiKopf) // check if the file header was loaded
|
|
|
leseDaten();
|
|
|
unsigned char* sgList
|
|
|
- = dateiKopf->getSchriftGroesseList(); // Liste mit Schriftgroessen
|
|
|
+ = dateiKopf->getSchriftGroesseList(); // list of font sizes
|
|
|
unsigned char sgAnzahl
|
|
|
- = dateiKopf->getSchriftGroesseAnzahl(); // Anzahl der Schriftgroessen
|
|
|
+ = dateiKopf->getSchriftGroesseAnzahl(); // number of font sizes
|
|
|
int sgNum = -1;
|
|
|
- for (int i = 0; i < sgAnzahl; ++i) // zu loeschende Schriftgroesse suchen
|
|
|
+ for (int i = 0; i < sgAnzahl; ++i) // search for font size to delete
|
|
|
{
|
|
|
if (sgList[i] == gr)
|
|
|
{
|
|
|
@@ -2663,34 +2659,34 @@ void LTDSDatei::loescheSchrifrGroesse(
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- if (sgNum == -1) // Die Schriftgroesse ist nicht vorhanden
|
|
|
+ if (sgNum == -1) // the font size is not present
|
|
|
return;
|
|
|
int* sgPosList
|
|
|
= dateiKopf
|
|
|
- ->getPositionList(); // Liste von Positionen der Schriftgroessen
|
|
|
+ ->getPositionList(); // list of font size positions
|
|
|
std::ifstream* inF
|
|
|
- = new std::ifstream(pfad->getText(), std::ios::binary); // alte Datei
|
|
|
+ = new std::ifstream(pfad->getText(), std::ios::binary); // old file
|
|
|
pfad->append("0");
|
|
|
std::ofstream* outF
|
|
|
- = new std::ofstream(pfad->getText(), std::ios::binary); // neue Datei
|
|
|
+ = new std::ofstream(pfad->getText(), std::ios::binary); // new file
|
|
|
outF->seekp(1 + 5 * (sgAnzahl - 1), std::ios::beg);
|
|
|
inF->seekg(1 + 5 * sgAnzahl, std::ios::beg);
|
|
|
- for (int i = 0; i < sgNum; ++i) // Schriftgroessen vor der zu loeschenden
|
|
|
- // Schriftgroesse aktualisieren
|
|
|
+ for (int i = 0; i < sgNum; ++i) // update font sizes before the one
|
|
|
+ // being deleted
|
|
|
{
|
|
|
LTDSSchriftKopf* sgKpf_tmp
|
|
|
- = new LTDSSchriftKopf(); // Schriftgroessen Kopf
|
|
|
- sgKpf_tmp->laden(inF); // Schriftgroessen Kopf laden
|
|
|
- int* zeichPosLTmp = sgKpf_tmp->getPositionen(); // Zeichenpositionen
|
|
|
+ = new LTDSSchriftKopf(); // font size header
|
|
|
+ sgKpf_tmp->laden(inF); // load font size header
|
|
|
+ int* zeichPosLTmp = sgKpf_tmp->getPositionen(); // character positions
|
|
|
unsigned char zeichATmp
|
|
|
- = sgKpf_tmp->getZeichenAnzahl(); // Zeichenanzahl
|
|
|
+ = sgKpf_tmp->getZeichenAnzahl(); // character count
|
|
|
for (int i1 = 0; i1 < zeichATmp;
|
|
|
- ++i1) // Position der Zeichen um 5 bytes zuruecksetzen
|
|
|
+ ++i1) // move character positions back by 5 bytes
|
|
|
zeichPosLTmp[i1] -= 5;
|
|
|
- sgKpf_tmp->speichern(outF); // speichern in Neue Datei
|
|
|
+ sgKpf_tmp->speichern(outF); // save to new file
|
|
|
char byte = 0;
|
|
|
for (int i1 = (int)inF->tellg(); i1 < sgPosList[i + 1];
|
|
|
- ++i1) // Den Koerper des Zeichens Kopieren
|
|
|
+ ++i1) // copy the character body
|
|
|
{
|
|
|
inF->read(&byte, 1);
|
|
|
outF->write(&byte, 1);
|
|
|
@@ -2700,18 +2696,18 @@ void LTDSDatei::loescheSchrifrGroesse(
|
|
|
int indexMinus = 5 + sgPosList[sgNum + 1] - (int)inF->tellg();
|
|
|
inF->seekg(sgPosList[sgNum + 1], std::ios::beg);
|
|
|
for (int i = sgNum + 1; i < sgAnzahl;
|
|
|
- ++i) // Die Schriftgroesse nach der zu loeschenden Schriftgroesse
|
|
|
+ ++i) // font sizes after the one being deleted
|
|
|
{
|
|
|
LTDSSchriftKopf* sgKpf_tmp
|
|
|
- = new LTDSSchriftKopf(); // Schriftgroessen Kopf
|
|
|
- sgKpf_tmp->laden(inF); // Schriftgroessen Kopf laden
|
|
|
- int* zeichPosLTmp = sgKpf_tmp->getPositionen(); // Zeichenpositionen
|
|
|
+ = new LTDSSchriftKopf(); // font size header
|
|
|
+ sgKpf_tmp->laden(inF); // load font size header
|
|
|
+ int* zeichPosLTmp = sgKpf_tmp->getPositionen(); // character positions
|
|
|
unsigned char zeichATmp
|
|
|
- = sgKpf_tmp->getZeichenAnzahl(); // Zeichenanzahl
|
|
|
+ = sgKpf_tmp->getZeichenAnzahl(); // character count
|
|
|
for (int i1 = 0; i1 < zeichATmp;
|
|
|
- ++i1) // Position der Zeichen aktualisieren
|
|
|
+ ++i1) // update character positions
|
|
|
zeichPosLTmp[i1] -= indexMinus;
|
|
|
- sgKpf_tmp->speichern(outF); // speichern in Neue Datei
|
|
|
+ sgKpf_tmp->speichern(outF); // save to new file
|
|
|
char byte = 0;
|
|
|
int BeginByte = (int)inF->tellg();
|
|
|
int EndByte = sgPosList[i + 1];
|
|
|
@@ -2722,48 +2718,48 @@ void LTDSDatei::loescheSchrifrGroesse(
|
|
|
inF->seekg(BeginByte, std::ios::beg);
|
|
|
}
|
|
|
for (int i1 = BeginByte; i1 < EndByte;
|
|
|
- ++i1) // Den Koerper des Zeichens Kopieren
|
|
|
+ ++i1) // copy the character body
|
|
|
{
|
|
|
inF->read(&byte, 1);
|
|
|
outF->write(&byte, 1);
|
|
|
}
|
|
|
}
|
|
|
- for (int i = 0; i < sgNum; ++i) // Dateikopf aktualisieren
|
|
|
+ for (int i = 0; i < sgNum; ++i) // update file header
|
|
|
sgPosList[i] -= 5;
|
|
|
for (int i = sgNum + 1; i < sgAnzahl; ++i)
|
|
|
sgPosList[i] -= indexMinus;
|
|
|
dateiKopf->removeSG(gr);
|
|
|
outF->seekp(0, std::ios::beg);
|
|
|
- dateiKopf->speichern(outF); // Dateikopf speichern
|
|
|
+ dateiKopf->speichern(outF); // save file header
|
|
|
inF->close();
|
|
|
outF->close();
|
|
|
Text* pfad2 = new Text(pfad->getText());
|
|
|
pfad->remove(pfad->getLength() - 1, pfad->getLength());
|
|
|
- DateiRemove(dynamic_cast<Text*>(pfad->getThis())); // alte Datei loeschen
|
|
|
+ DateiRemove(dynamic_cast<Text*>(pfad->getThis())); // delete old file
|
|
|
DateiUmbenennen(dynamic_cast<Text*>(pfad2->getThis()),
|
|
|
- dynamic_cast<Text*>(pfad->getThis())); // neue Datei zu alter umbenennen
|
|
|
+ dynamic_cast<Text*>(pfad->getThis())); // rename new file to old
|
|
|
pfad2->release();
|
|
|
delete inF;
|
|
|
delete outF;
|
|
|
}
|
|
|
|
|
|
void LTDSDatei::loescheBuchstabe(
|
|
|
- int gr, unsigned char zeichen) // Loescht einen Buchstaben aus der Datei
|
|
|
+ int gr, unsigned char zeichen) // Deletes a character from the file
|
|
|
{
|
|
|
if (!DateiExistiert(dynamic_cast<Text*>(
|
|
|
- pfad->getThis()))) // pruefen, ob die Datei existiert
|
|
|
+ pfad->getThis()))) // check if the file exists
|
|
|
return;
|
|
|
- if (!dateiKopf) // pruefen, ob der Dateikopf gelesen wurde
|
|
|
+ if (!dateiKopf) // check if the file header was read
|
|
|
leseDaten();
|
|
|
unsigned char* sgList
|
|
|
- = dateiKopf->getSchriftGroesseList(); // Liste mit Schriftgroessen
|
|
|
+ = dateiKopf->getSchriftGroesseList(); // list of font sizes
|
|
|
unsigned char sgAnzahl
|
|
|
- = dateiKopf->getSchriftGroesseAnzahl(); // Anzahl der Schriftgroessen
|
|
|
+ = dateiKopf->getSchriftGroesseAnzahl(); // number of font sizes
|
|
|
int* sgPosList
|
|
|
= dateiKopf
|
|
|
- ->getPositionList(); // Liste mit Positionen der Schriftgroessen
|
|
|
+ ->getPositionList(); // list of font size positions
|
|
|
int sgNum = -1;
|
|
|
- for (int i = 0; i < sgAnzahl; ++i) // Schriftgroesse suchen
|
|
|
+ for (int i = 0; i < sgAnzahl; ++i) // search for font size
|
|
|
{
|
|
|
if (sgList[i] == gr)
|
|
|
{
|
|
|
@@ -2771,28 +2767,28 @@ void LTDSDatei::loescheBuchstabe(
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- if (sgNum == -1) // Schriftgroesse nicht gefunden
|
|
|
+ if (sgNum == -1) // font size not found
|
|
|
return;
|
|
|
std::ifstream* inF
|
|
|
- = new std::ifstream(pfad->getText(), std::ios::binary); // alte Datei
|
|
|
+ = new std::ifstream(pfad->getText(), std::ios::binary); // old file
|
|
|
pfad->append("0");
|
|
|
std::ofstream* outF
|
|
|
- = new std::ofstream(pfad->getText(), std::ios::binary); // neue Datei
|
|
|
+ = new std::ofstream(pfad->getText(), std::ios::binary); // new file
|
|
|
int indexMinus = 0;
|
|
|
inF->seekg(1 + 5 * sgAnzahl, std::ios::beg);
|
|
|
- dateiKopf->speichern(outF); // DateiKopf peichern
|
|
|
+ dateiKopf->speichern(outF); // save file header
|
|
|
for (int i = 0; i < sgAnzahl; ++i)
|
|
|
{
|
|
|
- LTDSSchriftKopf* sgKopf = new LTDSSchriftKopf(); // Schriftkopf
|
|
|
- sgKopf->laden(inF); // Schriftkopf laden
|
|
|
+ LTDSSchriftKopf* sgKopf = new LTDSSchriftKopf(); // font header
|
|
|
+ sgKopf->laden(inF); // load font header
|
|
|
unsigned char sgZeichAnzahl
|
|
|
- = sgKopf->getZeichenAnzahl(); // Zeichenanzahl
|
|
|
- unsigned char* sgZeichenList = sgKopf->getZeichen(); // Zeichen Liste
|
|
|
- int* sgZPosList = sgKopf->getPositionen(); // Positions Liste
|
|
|
- if (i == sgNum) // Zeichen befindet sich in dieser Schriftgroesse
|
|
|
+ = sgKopf->getZeichenAnzahl(); // character count
|
|
|
+ unsigned char* sgZeichenList = sgKopf->getZeichen(); // character list
|
|
|
+ int* sgZPosList = sgKopf->getPositionen(); // position list
|
|
|
+ if (i == sgNum) // character is in this font size
|
|
|
{
|
|
|
int sgZNum = -1;
|
|
|
- for (int i1 = 0; i1 < sgZeichAnzahl; ++i1) // Zeichen suchen
|
|
|
+ for (int i1 = 0; i1 < sgZeichAnzahl; ++i1) // search for character
|
|
|
{
|
|
|
if (sgZeichenList[i1] == zeichen)
|
|
|
{
|
|
|
@@ -2800,7 +2796,7 @@ void LTDSDatei::loescheBuchstabe(
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- if (sgZNum == -1) // Zeichen nicht gefunden
|
|
|
+ if (sgZNum == -1) // character not found
|
|
|
{
|
|
|
sgKopf->release();
|
|
|
inF->close();
|
|
|
@@ -2809,22 +2805,22 @@ void LTDSDatei::loescheBuchstabe(
|
|
|
delete outF;
|
|
|
DateiRemove(dynamic_cast<Text*>(pfad->getThis()));
|
|
|
pfad->remove(pfad->getLength() - 1, pfad->getLength());
|
|
|
- return; // abbruch
|
|
|
+ return; // abort
|
|
|
}
|
|
|
outF->seekp(2 + 5 * (sgZeichAnzahl - 1), std::ios::cur);
|
|
|
indexMinus += 5;
|
|
|
for (int i1 = 0; i1 < sgZNum;
|
|
|
- ++i1) // Zeichen vor dem zu loeschenden Zeichen
|
|
|
+ ++i1) // characters before the one being deleted
|
|
|
{
|
|
|
char byte = 0;
|
|
|
for (int i2 = sgZPosList[i1]; i2 < sgZPosList[i1 + 1];
|
|
|
- ++i2) // Kopieren
|
|
|
+ ++i2) // copy
|
|
|
{
|
|
|
inF->read(&byte, 1);
|
|
|
outF->write(&byte, 1);
|
|
|
}
|
|
|
sgZPosList[i1]
|
|
|
- -= indexMinus; // Schriftgroesse Kopf aktualisieren
|
|
|
+ -= indexMinus; // update font size header
|
|
|
}
|
|
|
if (!sgZPosList[sgZNum + 1])
|
|
|
{
|
|
|
@@ -2843,7 +2839,7 @@ void LTDSDatei::loescheBuchstabe(
|
|
|
if (sgZNum + 1 < sgZeichAnzahl)
|
|
|
inF->seekg(sgZPosList[sgZNum + 1], std::ios::beg);
|
|
|
for (int i1 = sgZNum + 1; i1 < sgZeichAnzahl;
|
|
|
- ++i1) // Zeichen nach dem geloeschten Zeichen
|
|
|
+ ++i1) // characters after the deleted character
|
|
|
{
|
|
|
int beginByte = (int)inF->tellg();
|
|
|
int endByte = sgZPosList[i1 + 1];
|
|
|
@@ -2854,22 +2850,22 @@ void LTDSDatei::loescheBuchstabe(
|
|
|
inF->seekg(beginByte, std::ios::beg);
|
|
|
}
|
|
|
char byte = 0;
|
|
|
- for (int i2 = beginByte; i2 < endByte; ++i2) // Kopieren
|
|
|
+ for (int i2 = beginByte; i2 < endByte; ++i2) // copy
|
|
|
{
|
|
|
inF->read(&byte, 1);
|
|
|
outF->write(&byte, 1);
|
|
|
}
|
|
|
sgZPosList[i1]
|
|
|
- -= indexMinus; // Schriftgroesse Kopf aktualisieren
|
|
|
+ -= indexMinus; // update font size header
|
|
|
}
|
|
|
sgKopf->removeZeichen(zeichen);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
for (int i1 = 0; i1 < sgZeichAnzahl;
|
|
|
- ++i1) // Schriftgroesse Kopf aktualisieren
|
|
|
+ ++i1) // update font size header
|
|
|
sgZPosList[i] -= indexMinus;
|
|
|
- sgKopf->speichern(outF); // Schriftgroesse Kopf speichern
|
|
|
+ sgKopf->speichern(outF); // save font size header
|
|
|
int beginByte = (int)inF->tellg();
|
|
|
int endByte = sgPosList[i + 1];
|
|
|
if (!endByte)
|
|
|
@@ -2879,7 +2875,7 @@ void LTDSDatei::loescheBuchstabe(
|
|
|
inF->seekg(beginByte, std::ios::beg);
|
|
|
}
|
|
|
char byte;
|
|
|
- for (int i1 = beginByte; i1 < endByte; ++i1) // Kopieren
|
|
|
+ for (int i1 = beginByte; i1 < endByte; ++i1) // copy
|
|
|
{
|
|
|
inF->read(&byte, 1);
|
|
|
outF->write(&byte, 1);
|
|
|
@@ -2887,7 +2883,7 @@ void LTDSDatei::loescheBuchstabe(
|
|
|
sgPosList[i] -= indexMinus;
|
|
|
}
|
|
|
outF->seekp(sgPosList[i], std::ios::beg);
|
|
|
- sgKopf->speichern(outF); // Schriftgroesse Kopf speichern
|
|
|
+ sgKopf->speichern(outF); // save font size header
|
|
|
outF->seekp(sgPosList[i + 1], std::ios::beg);
|
|
|
sgKopf->release();
|
|
|
}
|
|
|
@@ -2895,23 +2891,23 @@ void LTDSDatei::loescheBuchstabe(
|
|
|
outF->close();
|
|
|
Text* pfad2 = new Text(pfad->getText());
|
|
|
pfad->remove(pfad->getLength() - 1, pfad->getLength());
|
|
|
- DateiRemove(dynamic_cast<Text*>(pfad->getThis())); // alte Datei loeschen
|
|
|
+ DateiRemove(dynamic_cast<Text*>(pfad->getThis())); // delete old file
|
|
|
DateiUmbenennen(dynamic_cast<Text*>(pfad2->getThis()),
|
|
|
dynamic_cast<Text*>(
|
|
|
- pfad->getThis())); // neue Datei nach alte umbenennen
|
|
|
- pfad2->release(); // Speicher freigeben
|
|
|
+ pfad->getThis())); // rename new file to old
|
|
|
+ pfad2->release(); // free memory
|
|
|
delete inF;
|
|
|
delete outF;
|
|
|
}
|
|
|
|
|
|
-void LTDSDatei::loescheDatei() // Loescht die gesamte Datei
|
|
|
+void LTDSDatei::loescheDatei() // Deletes the entire file
|
|
|
{
|
|
|
if (!DateiExistiert(dynamic_cast<Text*>(pfad->getThis()))) return;
|
|
|
if (!dateiKopf) leseDaten();
|
|
|
DateiRemove(dynamic_cast<Text*>(pfad->getThis()));
|
|
|
}
|
|
|
|
|
|
-void LTDSDatei::erstelleDatei() // erstellt die Datei
|
|
|
+void LTDSDatei::erstelleDatei() // creates the file
|
|
|
{
|
|
|
DateiPfadErstellen(dynamic_cast<Text*>(pfad->getThis()));
|
|
|
if (dateiKopf) dateiKopf->release();
|
|
|
@@ -2923,7 +2919,7 @@ void LTDSDatei::erstelleDatei() // erstellt die Datei
|
|
|
}
|
|
|
|
|
|
void LTDSDatei::speicherSchrift(
|
|
|
- Schrift* schrift) // Speichert die uebergebene Schrift
|
|
|
+Schrift* schrift) // Saves the provided font
|
|
|
{
|
|
|
if (!DateiExistiert(dynamic_cast<Text*>(pfad->getThis())))
|
|
|
{
|
|
|
@@ -2987,7 +2983,7 @@ void LTDSDatei::speicherSchrift(
|
|
|
}
|
|
|
|
|
|
// constant
|
|
|
-Schrift* LTDSDatei::ladeSchrift() // gibt die geladene Schrift zurueck
|
|
|
+Schrift* LTDSDatei::ladeSchrift() // returns the loaded font
|
|
|
{
|
|
|
if (!DateiExistiert(dynamic_cast<Text*>(pfad->getThis()))) return 0;
|
|
|
if (!dateiKopf) return 0;
|
|
|
@@ -3022,8 +3018,8 @@ Schrift* LTDSDatei::ladeSchrift() // gibt die geladene Schrift zurueck
|
|
|
}
|
|
|
|
|
|
Alphabet* LTDSDatei::ladeAlphabet(
|
|
|
- int schriftgroesse) // gibt eine geladene Schrift nur mit der angegebenen
|
|
|
- // Schriftgroesse zurueck
|
|
|
+int schriftgroesse) // returns a loaded font with only the specified
|
|
|
+ // font size
|
|
|
{
|
|
|
if (!DateiExistiert(dynamic_cast<Text*>(pfad->getThis()))) return 0;
|
|
|
if (!dateiKopf) return 0;
|
|
|
@@ -3063,7 +3059,7 @@ Alphabet* LTDSDatei::ladeAlphabet(
|
|
|
}
|
|
|
|
|
|
Buchstabe* LTDSDatei::ladeBuchstabe(int schriftgroesse,
|
|
|
- unsigned char zeichen) // Laed einen bestimmten Buchstaben
|
|
|
+unsigned char zeichen) // Loads a specific character
|
|
|
{
|
|
|
if (!DateiExistiert(dynamic_cast<Text*>(pfad->getThis()))) return 0;
|
|
|
if (!dateiKopf) return 0;
|
|
|
@@ -3113,13 +3109,13 @@ Buchstabe* LTDSDatei::ladeBuchstabe(int schriftgroesse,
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-Text* LTDSDatei::getPfad() const // gibt den Dateipfad zurueck
|
|
|
+Text* LTDSDatei::getPfad() const // returns the file path
|
|
|
{
|
|
|
return dynamic_cast<Text*>(pfad->getThis());
|
|
|
}
|
|
|
|
|
|
int LTDSDatei::getAnzahlSchriftgroessen()
|
|
|
- const // gibt die Anzahl der Schriftgroessen aus der Datei zurueck
|
|
|
+const // returns the number of font sizes from the file
|
|
|
{
|
|
|
if (!DateiExistiert(dynamic_cast<Text*>(pfad->getThis()))) return 0;
|
|
|
if (!dateiKopf) return 0;
|
|
|
@@ -3127,7 +3123,7 @@ int LTDSDatei::getAnzahlSchriftgroessen()
|
|
|
}
|
|
|
|
|
|
unsigned char* LTDSDatei::getSchriftGroessen()
|
|
|
- const // gibt einen Array von Schriftgroessen zurueck
|
|
|
+const // returns an array of font sizes
|
|
|
{
|
|
|
if (!DateiExistiert(dynamic_cast<Text*>(pfad->getThis()))) return 0;
|
|
|
if (!dateiKopf) return 0;
|
|
|
@@ -3135,8 +3131,7 @@ unsigned char* LTDSDatei::getSchriftGroessen()
|
|
|
}
|
|
|
|
|
|
unsigned char LTDSDatei::getAnzahlBuchstaben(
|
|
|
- int sg) // gibt die anzahl gespeicherter Buchstaben einer Schriftgroesse
|
|
|
- // zurueck
|
|
|
+int sg) // returns the number of stored characters for a font size
|
|
|
{
|
|
|
if (!DateiExistiert(dynamic_cast<Text*>(pfad->getThis()))) return 0;
|
|
|
if (!dateiKopf) return 0;
|
|
|
@@ -3169,7 +3164,7 @@ unsigned char LTDSDatei::getAnzahlBuchstaben(
|
|
|
}
|
|
|
|
|
|
unsigned char* LTDSDatei::getBuchstaben(
|
|
|
- int sg) // gibt einen Array von Buchstaben einer Schriftgroesse zurueck
|
|
|
+int sg) // returns an array of characters for a font size
|
|
|
{
|
|
|
if (!DateiExistiert(dynamic_cast<Text*>(pfad->getThis()))) return 0;
|
|
|
if (!dateiKopf) return 0;
|
|
|
@@ -3204,8 +3199,8 @@ unsigned char* LTDSDatei::getBuchstaben(
|
|
|
return ret;
|
|
|
}
|
|
|
#endif
|
|
|
-// Bit Funktionen
|
|
|
-int Framework::Bits(int a) // gibt 1-bits in gewinschter anzahl zurueck
|
|
|
+// Bit functions
|
|
|
+int Framework::Bits(int a) // returns 1-bits in the desired count
|
|
|
{
|
|
|
int ret = 0;
|
|
|
for (int i = 0; i < a; ++i)
|
|
|
@@ -3216,7 +3211,7 @@ int Framework::Bits(int a) // gibt 1-bits in gewinschter anzahl zurueck
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
-int Framework::getBits(char c) // gibt zurueck, wie viele Bits c benoetigt
|
|
|
+int Framework::getBits(char c) // returns how many bits c requires
|
|
|
{
|
|
|
int ret = 0;
|
|
|
for (int i = 0; (c & (char)Bits(i)) != c; ++i)
|