forked from len0rd/rockbox
Theme Editor: Added dummy font class and implemented font load tag
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27096 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
168eba1aec
commit
6d6156603c
6 changed files with 116 additions and 2 deletions
30
utils/themeeditor/graphics/rbfont.cpp
Normal file
30
utils/themeeditor/graphics/rbfont.cpp
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Robert Bieber
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "rbfont.h"
|
||||||
|
|
||||||
|
RBFont::RBFont(QString file): filename(file)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
RBFont::~RBFont()
|
||||||
|
{
|
||||||
|
}
|
38
utils/themeeditor/graphics/rbfont.h
Normal file
38
utils/themeeditor/graphics/rbfont.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2010 Robert Bieber
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef RBFONT_H
|
||||||
|
#define RBFONT_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
|
class RBFont
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
RBFont(QString file);
|
||||||
|
virtual ~RBFont();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QString filename;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // RBFONT_H
|
|
@ -67,6 +67,11 @@ RBScreen::~RBScreen()
|
||||||
{
|
{
|
||||||
if(backdrop)
|
if(backdrop)
|
||||||
delete backdrop;
|
delete backdrop;
|
||||||
|
|
||||||
|
QMap<int, RBFont*>::iterator i;
|
||||||
|
for(i = fonts.begin(); i != fonts.end(); i++)
|
||||||
|
if(*i)
|
||||||
|
delete (*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainterPath RBScreen::shape() const
|
QPainterPath RBScreen::shape() const
|
||||||
|
@ -103,6 +108,23 @@ void RBScreen::showViewport(QString name)
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RBScreen::loadFont(int id, RBFont* font)
|
||||||
|
{
|
||||||
|
if(id < 2 || id > 9)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fonts.insert(id, font);
|
||||||
|
}
|
||||||
|
|
||||||
|
RBFont* RBScreen::getFont(int id)
|
||||||
|
{
|
||||||
|
if(fonts.value(id, 0) != 0)
|
||||||
|
return fonts.value(id);
|
||||||
|
else
|
||||||
|
return fonts.value(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void RBScreen::setBackdrop(QString filename)
|
void RBScreen::setBackdrop(QString filename)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "projectmodel.h"
|
#include "projectmodel.h"
|
||||||
#include "rbrenderinfo.h"
|
#include "rbrenderinfo.h"
|
||||||
#include "rbimage.h"
|
#include "rbimage.h"
|
||||||
|
#include "rbfont.h"
|
||||||
|
|
||||||
class RBViewport;
|
class RBViewport;
|
||||||
|
|
||||||
|
@ -58,6 +59,9 @@ public:
|
||||||
}
|
}
|
||||||
RBImage* getImage(QString name){ return images.value(name, 0); }
|
RBImage* getImage(QString name){ return images.value(name, 0); }
|
||||||
|
|
||||||
|
void loadFont(int id, RBFont* font);
|
||||||
|
RBFont* getFont(int id);
|
||||||
|
|
||||||
void setBackdrop(QString filename);
|
void setBackdrop(QString filename);
|
||||||
void makeCustomUI(QString id);
|
void makeCustomUI(QString id);
|
||||||
|
|
||||||
|
@ -77,6 +81,7 @@ private:
|
||||||
QMap<QString, RBViewport*> namedViewports;
|
QMap<QString, RBViewport*> namedViewports;
|
||||||
QMap<QString, RBImage*> images;
|
QMap<QString, RBImage*> images;
|
||||||
QMap<QString, QString>* settings;
|
QMap<QString, QString>* settings;
|
||||||
|
QMap<int, RBFont*> fonts;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -592,6 +592,23 @@ void ParseTreeNode::render(const RBRenderInfo &info, RBViewport* viewport)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'F':
|
||||||
|
|
||||||
|
switch(element->tag->name[1])
|
||||||
|
{
|
||||||
|
|
||||||
|
case 'l':
|
||||||
|
/* %Fl */
|
||||||
|
x = element->params[0].data.numeric;
|
||||||
|
filename = info.settings()->value("themebase", "") + "/fonts/" +
|
||||||
|
element->params[1].data.text;
|
||||||
|
info.screen()->loadFont(x, new RBFont(filename));
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
case 'V':
|
case 'V':
|
||||||
|
|
||||||
switch(element->tag->name[1])
|
switch(element->tag->name[1])
|
||||||
|
|
|
@ -38,7 +38,8 @@ HEADERS += models/parsetreemodel.h \
|
||||||
graphics/rbscreen.h \
|
graphics/rbscreen.h \
|
||||||
graphics/rbviewport.h \
|
graphics/rbviewport.h \
|
||||||
graphics/rbrenderinfo.h \
|
graphics/rbrenderinfo.h \
|
||||||
graphics/rbimage.h
|
graphics/rbimage.h \
|
||||||
|
graphics/rbfont.h
|
||||||
SOURCES += main.cpp \
|
SOURCES += main.cpp \
|
||||||
models/parsetreemodel.cpp \
|
models/parsetreemodel.cpp \
|
||||||
models/parsetreenode.cpp \
|
models/parsetreenode.cpp \
|
||||||
|
@ -53,7 +54,8 @@ SOURCES += main.cpp \
|
||||||
graphics/rbscreen.cpp \
|
graphics/rbscreen.cpp \
|
||||||
graphics/rbviewport.cpp \
|
graphics/rbviewport.cpp \
|
||||||
graphics/rbrenderinfo.cpp \
|
graphics/rbrenderinfo.cpp \
|
||||||
graphics/rbimage.cpp
|
graphics/rbimage.cpp \
|
||||||
|
graphics/rbfont.cpp
|
||||||
OTHER_FILES += README \
|
OTHER_FILES += README \
|
||||||
resources/windowicon.png \
|
resources/windowicon.png \
|
||||||
resources/appicon.xcf \
|
resources/appicon.xcf \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue