X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Ffontlist.cpp;fp=src%2Fbase%2Ffontlist.cpp;h=2c1b7423c4d46f24c3eeb748e021af5e4750602e;hb=16354e0421b316a62c6b9f7b0b4f3b8cf6f06284;hp=80527a48738f59f2986c34c46f7f3b916735e4a3;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/base/fontlist.cpp b/src/base/fontlist.cpp index 80527a4..2c1b742 100644 --- a/src/base/fontlist.cpp +++ b/src/base/fontlist.cpp @@ -22,12 +22,12 @@ //[DONE] #warning "!!! NEED TO FIX ITERATORS IN THIS CLASS !!!" -RS_FontList * RS_FontList::uniqueInstance = NULL; +FontList * FontList::uniqueInstance = NULL; /** * Default constructor. */ -RS_FontList::RS_FontList(): fontIterator(fonts) +FontList::FontList(): fontIterator(fonts) { //Dealt with here... //#warning "!!! Need to deal with setAutoDelete() Qt3->Qt4 !!!" @@ -35,61 +35,61 @@ RS_FontList::RS_FontList(): fontIterator(fonts) //fontListListeners.setAutoDelete(false); } -/*static*/ RS_FontList * RS_FontList::instance() +/*static*/ FontList * FontList::instance() { if (uniqueInstance == NULL) - uniqueInstance = new RS_FontList(); + uniqueInstance = new FontList(); return uniqueInstance; } -RS_FontList::~RS_FontList() +FontList::~FontList() { clearFonts(); } /** - * Initializes the font list by creating empty RS_Font + * Initializes the font list by creating empty Font * objects, one for each font that could be found. */ -void RS_FontList::init() +void FontList::init() { - RS_DEBUG->print("RS_FontList::initFonts"); + DEBUG->print("FontList::initFonts"); - QStringList list = RS_SYSTEM->getFontList(); + QStringList list = SYSTEM->getFontList(); // Q3Dict added; //used to remeber added fonts (avoid duplication) QMultiHash added; //used to remeber added fonts (avoid duplication) for(QStringList::Iterator it=list.begin(); it!=list.end(); ++it) { - RS_DEBUG->print("font: %s:", (*it).toLatin1().data()); -//printf("RS_FontList::init(): font: %s:\n", (*it).toLatin1().data()); + DEBUG->print("font: %s:", (*it).toLatin1().data()); +//printf("FontList::init(): font: %s:\n", (*it).toLatin1().data()); QFileInfo fi(*it); // if (!added[fi.baseName()]) if (added.value(fi.baseName()) == 0) { - RS_Font * font = new RS_Font(fi.baseName()); + Font * font = new Font(fi.baseName()); fonts.append(font); added.insert(fi.baseName(), (char *)1); } - RS_DEBUG->print("base: %s", fi.baseName().toLatin1().data()); + DEBUG->print("base: %s", fi.baseName().toLatin1().data()); } } /** * Removes all fonts in the fontlist. */ -void RS_FontList::clearFonts() +void FontList::clearFonts() { // fonts.clear(); while (!fonts.isEmpty()) delete fonts.takeFirst(); } -int RS_FontList::countFonts() +int FontList::countFonts() { return fonts.count(); } @@ -99,9 +99,9 @@ int RS_FontList::countFonts() * Listeners are notified after the font was removed from * the list but before it gets deleted. */ -void RS_FontList::removeFont(RS_Font * font) +void FontList::removeFont(Font * font) { - RS_DEBUG->print("RS_FontList::removeFont()"); + DEBUG->print("FontList::removeFont()"); // here the font is removed from the list but not deleted // fonts.remove(font); @@ -113,7 +113,7 @@ void RS_FontList::removeFont(RS_Font * font) delete fonts.takeAt(i); //for (uint i=0; ifontRemoved(font); //} } @@ -123,12 +123,12 @@ void RS_FontList::removeFont(RS_Font * font) * \p NULL if no such font was found. The font will be loaded into * memory if it's not already. */ -RS_Font * RS_FontList::requestFont(const QString & name) +Font * FontList::requestFont(const QString & name) { - RS_DEBUG->print("RS_FontList::requestFont %s", name.toLatin1().data()); + DEBUG->print("FontList::requestFont %s", name.toLatin1().data()); QString name2 = name.toLower(); - RS_Font * foundFont = NULL; + Font * foundFont = NULL; // QCad 1 compatibility: if (name2.contains('#') && name2.contains('_')) @@ -138,13 +138,13 @@ RS_Font * RS_FontList::requestFont(const QString & name) // name2 = name2.left(name2.find('#')); name2 = name2.left(name2.indexOf('#')); - RS_DEBUG->print("name2: %s", name2.toLatin1().data()); + DEBUG->print("name2: %s", name2.toLatin1().data()); // Search our list of available fonts: -// for(RS_Font * f=fonts.first(); f!=NULL; f=fonts.next()) +// for(Font * f=fonts.first(); f!=NULL; f=fonts.next()) for(int i=0; igetFileName() == name2) { @@ -162,7 +162,7 @@ RS_Font * RS_FontList::requestFont(const QString & name) } //! @return First font of the list. -RS_Font * RS_FontList::firstFont() +Font * FontList::firstFont() { // return fonts.first(); // fontIterator.toFront(); @@ -176,7 +176,7 @@ RS_Font * RS_FontList::firstFont() * @return Next font from the list after * calling firstFont() or nextFont(). */ -RS_Font * RS_FontList::nextFont() +Font * FontList::nextFont() { // return fonts.next(); // return fontIterator.next(); @@ -186,11 +186,11 @@ RS_Font * RS_FontList::nextFont() /** * Dumps the fonts to stdout. */ -std::ostream & operator<<(std::ostream & os, RS_FontList & l) +std::ostream & operator<<(std::ostream & os, FontList & l) { os << "Fontlist: \n"; - for(RS_Font * f=l.firstFont(); f!=NULL; f=l.nextFont()) + for(Font * f=l.firstFont(); f!=NULL; f=l.nextFont()) os << *f << "\n"; return os;