Origin commit data
------------------
Branch: ni/coolstream
Commit: d6b3754c6f
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-05-19 (Thu, 19 May 2016)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2016-05-19 22:59:54 +02:00
parent 464a234940
commit a86bc779b4
251 changed files with 26673 additions and 443 deletions

View File

@@ -39,6 +39,12 @@
#define GREEN 0x00FF00
#define YELLOW 0xFFFF00
//NI graphic
#include <sstream>
#include <unistd.h>
#include <gui/pictureviewer.h>
extern CPictureViewer * g_PicViewer;
CProgressBar::CProgressBar( const int x_pos,
const int y_pos,
const int w,
@@ -80,6 +86,8 @@ CProgressBar::CProgressBar( const int x_pos,
pb_value = 0;
pb_max_value = 0;
graphic_file = "progressbar"; //NI graphic
// init start positions x/y active bar
pb_x = x + fr_thickness;
pb_y = y + fr_thickness;
@@ -463,13 +471,23 @@ void CProgressBar::paintProgress(bool do_save_bg)
//progress
bool pb_invert = (pb_type == PB_REDRIGHT) || ((pb_type == PB_TIMESCALE) && g_settings.progressbar_timescale_invert);
if (cc_allow_paint){
if (!is_painted || (pb_active_width != pb_last_width)) {
//NI start
if(pb_type == PB_STARBAR) {
paintStarBar();
is_painted = true;
}
else if(*pb_design == PB_GRAPHIC) {
paintGraphic();
is_painted = true;
}
else {
CProgressBarCache *pbc = CProgressBarCache::pbcLookup(pb_height, pb_max_width, pb_active_col, pb_passive_col, *pb_design, pb_invert, *pb_gradient, pb_red, pb_yellow, pb_green);
if (pbc)
pbc->pbcPaint(pb_x, pb_y, pb_active_width, pb_passive_width);
is_painted = true;
}
}
}
@@ -486,6 +504,73 @@ void CProgressBar::paintProgress(bool do_save_bg)
}
//NI graphic
void CProgressBar::paintGraphic()
{
std::ostringstream buf;
buf.str("");
buf << ICONSDIR_VAR << "/" << graphic_file << ".png";
if (access(buf.str().c_str(), F_OK) != 0) {
buf.str("");
buf << ICONSDIR << "/" << graphic_file << ".png";
}
std::string pb_active_graphic(buf.str());
buf.str("");
buf << ICONSDIR_VAR << "/" << graphic_file << "_passive.png";
if (access(buf.str().c_str(), F_OK) != 0) {
buf.str("");
buf << ICONSDIR << "/" << graphic_file << "_passive.png";
}
std::string pb_passive_graphic(buf.str());
//printf("**** %04d::%04d: pb_last_width: %d, pb_active_width: %d, pb_max_width %d\n", pb_x, pb_y, pb_last_width, pb_active_width, pb_max_width);
if (pb_last_width == -1 ) {
if (pb_active_width <= pb_max_width && pb_passive_width > 0)
g_PicViewer->DisplayImage(pb_passive_graphic, pb_start_x_passive, pb_y, pb_passive_width, pb_height); // passive bar
}
if (pb_active_width > pb_last_width) {
// we have to paint the passive graphic in all cases to satisfy the CProgresswindow
if (pb_passive_width > 0)
g_PicViewer->DisplayImage(pb_passive_graphic, pb_start_x_passive, pb_y, pb_passive_width, pb_height); // passive bar
if (pb_active_width > 0)
g_PicViewer->DisplayImage(pb_active_graphic, pb_x, pb_y, pb_active_width, pb_height); // active bar
}
else if (pb_active_width <= pb_max_width && pb_passive_width > 0)
g_PicViewer->DisplayImage(pb_passive_graphic, pb_start_x_passive, pb_y, pb_passive_width, pb_height); // passive bar
}
//NI starbar
void CProgressBar::paintStarBar()
{
std::ostringstream buf;
graphic_file = "stars";
buf.str("");
buf << ICONSDIR_VAR << "/" << graphic_file << ".png";
if (access(buf.str().c_str(), F_OK) != 0) {
buf.str("");
buf << ICONSDIR << "/" << graphic_file << ".png";
}
std::string pb_active_graphic(buf.str());
buf.str("");
buf << ICONSDIR_VAR << "/" << graphic_file << "_bg.png";
if (access(buf.str().c_str(), F_OK) != 0) {
buf.str("");
buf << ICONSDIR << "/" << graphic_file << "_bg.png";
}
std::string pb_passive_graphic(buf.str());
int stars_w = 0, stars_h = 0;
g_PicViewer->getSize(pb_passive_graphic.c_str(), &stars_w, &stars_h);
g_PicViewer->DisplayImage(pb_passive_graphic, pb_x, pb_y, stars_w, stars_h); // background
g_PicViewer->DisplayImage_unscaled(pb_active_graphic, pb_x, pb_y, pb_active_width, stars_h); // aktiv bar
}
void CProgressBar::paint(bool do_save_bg)
{
paintProgress(do_save_bg);