2015-02-12 18:50:58 +01:00
|
|
|
#include "viewgrid.h"
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
cViewGrid::cViewGrid(cTemplateViewGrid *tmplGrid) {
|
|
|
|
this->tmplGrid = tmplGrid;
|
|
|
|
}
|
|
|
|
|
|
|
|
cViewGrid::~cViewGrid() {
|
|
|
|
Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void cViewGrid::SetGrid(long gridID,
|
|
|
|
double x, double y, double width, double height,
|
|
|
|
map<string,int> *intTokens, map<string,string> *stringTokens) {
|
|
|
|
map < long, cGrid* >::iterator hit = grids.find(gridID);
|
|
|
|
cGrid *grid;
|
|
|
|
if (hit == grids.end()) {
|
|
|
|
grid = new cGrid(tmplGrid);
|
|
|
|
grid->Set(x, y, width, height, intTokens, stringTokens);
|
|
|
|
grids.insert(pair<long,cGrid*>(gridID, grid));
|
|
|
|
} else {
|
|
|
|
(hit->second)->Set(x, y, width, height, intTokens, stringTokens);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cViewGrid::SetCurrent(long gridID, bool current) {
|
|
|
|
map<long,cGrid*>::iterator hit = grids.find(gridID);
|
|
|
|
if (hit != grids.end())
|
|
|
|
(hit->second)->SetCurrent(current);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cViewGrid::Delete(long gridID) {
|
|
|
|
map<long,cGrid*>::iterator hit = grids.find(gridID);
|
|
|
|
if (hit == grids.end())
|
|
|
|
return;
|
|
|
|
delete (hit->second);
|
|
|
|
grids.erase(gridID);
|
|
|
|
}
|
|
|
|
|
|
|
|
void cViewGrid::Clear(void) {
|
|
|
|
for (map < long, cGrid* >::iterator it = grids.begin(); it != grids.end(); it++)
|
|
|
|
delete it->second;
|
|
|
|
grids.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void cViewGrid::Render(void) {
|
|
|
|
for (map < long, cGrid* >::iterator it = grids.begin(); it != grids.end(); it++) {
|
|
|
|
cGrid *grid = it->second;
|
|
|
|
if (grid->Dirty()) {
|
|
|
|
if (grid->Moved()) {
|
2015-03-12 17:28:35 +01:00
|
|
|
grid->Move();
|
2015-02-12 18:50:58 +01:00
|
|
|
}
|
2015-03-12 17:28:35 +01:00
|
|
|
grid->Clear();
|
|
|
|
//esyslog("skindesigner: rendering grid %ld", it->first);
|
2015-02-12 18:50:58 +01:00
|
|
|
grid->Draw();
|
|
|
|
} else if (grid->Resized()) {
|
2015-03-12 17:28:35 +01:00
|
|
|
//esyslog("skindesigner: resizing grid %ld", it->first);
|
2015-02-12 18:50:58 +01:00
|
|
|
grid->DeletePixmaps();
|
|
|
|
grid->Draw();
|
|
|
|
} else if (grid->Moved()) {
|
2015-03-12 17:28:35 +01:00
|
|
|
//esyslog("skindesigner: moving grid %ld", it->first);
|
|
|
|
grid->Move();
|
2015-02-12 18:50:58 +01:00
|
|
|
} else {
|
2015-03-12 17:28:35 +01:00
|
|
|
//esyslog("skindesigner: skipping grid %ld", it->first);
|
2015-02-12 18:50:58 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-12 17:28:35 +01:00
|
|
|
void cViewGrid::Hide(void) {
|
|
|
|
for (map < long, cGrid* >::iterator it = grids.begin(); it != grids.end(); it++) {
|
|
|
|
cGrid *grid = it->second;
|
|
|
|
grid->HidePixmaps();
|
2015-06-20 06:30:26 +02:00
|
|
|
grid->HideAnimations();
|
2015-03-12 17:28:35 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void cViewGrid::Show(void) {
|
|
|
|
for (map < long, cGrid* >::iterator it = grids.begin(); it != grids.end(); it++) {
|
|
|
|
cGrid *grid = it->second;
|
|
|
|
grid->ShowPixmaps();
|
2015-06-20 06:30:26 +02:00
|
|
|
grid->ShowAnimations();
|
2015-03-12 17:28:35 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-12 18:50:58 +01:00
|
|
|
void cViewGrid::Debug(void) {
|
|
|
|
|
|
|
|
}
|