2010-06-18 21:10:01 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* 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 RBVIEWPORT_H
|
|
|
|
#define RBVIEWPORT_H
|
|
|
|
|
|
|
|
#include "skin_parser.h"
|
2010-06-25 05:14:13 +00:00
|
|
|
#include "rbfont.h"
|
2010-08-03 22:29:26 +00:00
|
|
|
#include "rbmovable.h"
|
2010-06-18 21:10:01 +00:00
|
|
|
|
|
|
|
class RBScreen;
|
|
|
|
class RBRenderInfo;
|
2010-08-04 09:16:52 +00:00
|
|
|
class ParseTreeNode;
|
2010-06-18 21:10:01 +00:00
|
|
|
|
|
|
|
#include <QGraphicsItem>
|
|
|
|
|
2010-08-04 09:16:52 +00:00
|
|
|
class SkinDocument;
|
|
|
|
|
2010-08-03 22:29:26 +00:00
|
|
|
class RBViewport : public RBMovable
|
2010-06-18 21:10:01 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-06-30 07:00:05 +00:00
|
|
|
enum Alignment
|
|
|
|
{
|
|
|
|
Left,
|
|
|
|
Center,
|
|
|
|
Right
|
|
|
|
};
|
|
|
|
|
2010-07-07 22:25:42 +00:00
|
|
|
static const double scrollRate;
|
|
|
|
|
2010-08-04 09:16:52 +00:00
|
|
|
RBViewport(skin_element* node, const RBRenderInfo& info,
|
|
|
|
ParseTreeNode* pNode);
|
2010-06-18 21:10:01 +00:00
|
|
|
virtual ~RBViewport();
|
|
|
|
|
|
|
|
QPainterPath shape() const;
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|
|
|
QWidget *widget);
|
|
|
|
|
2010-06-23 19:41:30 +00:00
|
|
|
void setBGColor(QColor color){ background = color; }
|
2010-07-02 00:20:36 +00:00
|
|
|
QColor getBGColor(){ return background; }
|
2010-06-23 19:41:30 +00:00
|
|
|
void setFGColor(QColor color){ foreground = color; }
|
2010-07-02 00:20:36 +00:00
|
|
|
QColor getFGColor(){ return foreground; }
|
2010-06-23 19:41:30 +00:00
|
|
|
void makeCustomUI(){ customUI = true; }
|
|
|
|
void clearCustomUI(){ customUI = false; }
|
|
|
|
|
2010-07-01 20:30:19 +00:00
|
|
|
void newLine();
|
2010-06-25 05:14:13 +00:00
|
|
|
void write(QString text);
|
2010-06-30 07:00:05 +00:00
|
|
|
void alignText(Alignment align){ textAlign = align; }
|
2010-07-02 00:20:36 +00:00
|
|
|
int getTextOffset(){ return textOffset.y(); }
|
|
|
|
void addTextOffset(int height){ textOffset.setY(textOffset.y() + height); }
|
2010-07-07 08:41:36 +00:00
|
|
|
void flushText()
|
|
|
|
{
|
2010-07-11 04:36:05 +00:00
|
|
|
if(textOffset.x() < 0)
|
|
|
|
return;
|
2010-07-07 08:41:36 +00:00
|
|
|
alignLeft();
|
|
|
|
alignRight();
|
|
|
|
alignCenter();
|
|
|
|
}
|
2010-07-07 22:25:42 +00:00
|
|
|
void scrollText(double time){ scrollTime = time; }
|
2010-06-18 21:10:01 +00:00
|
|
|
|
2010-06-30 21:28:11 +00:00
|
|
|
void enableStatusBar(){ showStatusBar = true; }
|
|
|
|
|
2010-08-15 02:04:06 +00:00
|
|
|
void showPlaylist(const RBRenderInfo& info, int start,
|
|
|
|
ParseTreeNode* lines);
|
2010-07-01 21:49:55 +00:00
|
|
|
|
2010-08-09 19:37:23 +00:00
|
|
|
void makeFullScreen();
|
|
|
|
|
2010-08-03 08:42:30 +00:00
|
|
|
protected:
|
2010-08-03 22:29:26 +00:00
|
|
|
void saveGeometry();
|
2010-08-03 08:42:30 +00:00
|
|
|
|
2010-06-18 21:10:01 +00:00
|
|
|
private:
|
2010-06-25 05:14:13 +00:00
|
|
|
|
2010-06-30 07:00:05 +00:00
|
|
|
void alignLeft();
|
|
|
|
void alignCenter();
|
|
|
|
void alignRight();
|
|
|
|
|
2010-06-25 05:14:13 +00:00
|
|
|
RBFont* font;
|
2010-06-26 05:18:21 +00:00
|
|
|
QColor foreground;
|
|
|
|
QColor background;
|
2010-06-18 21:10:01 +00:00
|
|
|
|
2010-06-26 05:51:07 +00:00
|
|
|
bool debug;
|
2010-06-21 20:11:58 +00:00
|
|
|
bool customUI;
|
2010-06-25 05:14:13 +00:00
|
|
|
QPoint textOffset;
|
|
|
|
int lineHeight;
|
2010-06-18 21:10:01 +00:00
|
|
|
|
2010-06-25 05:14:13 +00:00
|
|
|
RBScreen* screen;
|
2010-06-30 07:00:05 +00:00
|
|
|
|
2010-07-07 06:50:30 +00:00
|
|
|
QString leftText;
|
|
|
|
QString centerText;
|
|
|
|
QString rightText;
|
2010-06-30 07:00:05 +00:00
|
|
|
Alignment textAlign;
|
2010-06-30 21:28:11 +00:00
|
|
|
|
|
|
|
bool showStatusBar;
|
|
|
|
QPixmap statusBarTexture;
|
2010-07-07 06:50:30 +00:00
|
|
|
|
|
|
|
RBText* leftGraphic;
|
|
|
|
RBText* centerGraphic;
|
|
|
|
RBText* rightGraphic;
|
2010-07-07 22:25:42 +00:00
|
|
|
|
|
|
|
double scrollTime;
|
2010-08-04 09:16:52 +00:00
|
|
|
|
|
|
|
int baseParam;
|
|
|
|
ParseTreeNode* node;
|
|
|
|
SkinDocument* doc;
|
2010-08-12 23:05:53 +00:00
|
|
|
|
|
|
|
bool mirrored;
|
2010-06-18 21:10:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RBVIEWPORT_H
|