mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 09:21:09 +02:00
colorchooser.cpp/h: add separate init method
If color setup having already been used and after that user has done changed some other settings (e.g. font settings), graphical errors or crashes are possible.
The relocation of the initialization should prevent this.
Origin commit data
------------------
Branch: ni/coolstream
Commit: d2ab30f7af
Author: Thilo Graf <dbt@novatux.de>
Date: 2018-04-11 (Wed, 11 Apr 2018)
Origin message was:
------------------
colorchooser.cpp/h: add separate init method
If color setup having already been used and after that user has done changed some other settings (e.g. font settings), graphical errors or crashes are possible.
The relocation of the initialization should prevent this.
------------------
This commit was generated by Migit
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Based up Neutrino-GUI - Tuxbox-Project
|
||||
|
||||
Copyright (C) 2001 Steffen Hehn 'McClean'
|
||||
Copyright (C) 2018 Thilo Graf
|
||||
|
||||
License: GPL
|
||||
|
||||
@@ -54,14 +55,23 @@ static const neutrino_locale_t colorchooser_names[VALUES] =
|
||||
};
|
||||
|
||||
CColorChooser::CColorChooser(const neutrino_locale_t Name, unsigned char *R, unsigned char *G, unsigned char *B, unsigned char* A, CChangeObserver* Observer)
|
||||
{
|
||||
observer = Observer;
|
||||
name = Name;
|
||||
|
||||
value[VALUE_R] = R;
|
||||
value[VALUE_G] = G;
|
||||
value[VALUE_B] = B;
|
||||
value[VALUE_A] = A;
|
||||
}
|
||||
|
||||
void CColorChooser::Init()
|
||||
{
|
||||
frameBuffer = CFrameBuffer::getInstance();
|
||||
header_height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
|
||||
font = g_Font[SNeutrinoSettings::FONT_TYPE_WINDOW_GENERAL];
|
||||
item_height = font->getHeight();
|
||||
observer = Observer;
|
||||
name = Name;
|
||||
|
||||
|
||||
// calculate max width of locals
|
||||
text_width = 0;
|
||||
for (int i = 0; i < VALUES; i++)
|
||||
@@ -95,11 +105,6 @@ CColorChooser::CColorChooser(const neutrino_locale_t Name, unsigned char *R, uns
|
||||
preview_x = x + text_width + bar_full + 3*OFFSET_INNER_MID;
|
||||
preview_y = y + header_height + OFFSET_INNER_SMALL;
|
||||
|
||||
value[VALUE_R] = R;
|
||||
value[VALUE_G] = G;
|
||||
value[VALUE_B] = B;
|
||||
value[VALUE_A] = A;
|
||||
|
||||
chooser_gradient = gradient_none;
|
||||
}
|
||||
|
||||
@@ -154,6 +159,7 @@ fb_pixel_t CColorChooser::getColor()
|
||||
|
||||
int CColorChooser::exec(CMenuTarget* parent, const std::string &)
|
||||
{
|
||||
Init();
|
||||
neutrino_msg_t msg;
|
||||
neutrino_msg_data_t data;
|
||||
|
||||
|
@@ -2,6 +2,7 @@
|
||||
Based up Neutrino-GUI - Tuxbox-Project
|
||||
|
||||
Copyright (C) 2001 Steffen Hehn 'McClean'
|
||||
Copyright (C) 2018 Thilo Graf
|
||||
|
||||
License: GPL
|
||||
|
||||
@@ -68,6 +69,7 @@ class CColorChooser : public CMenuTarget
|
||||
CChangeObserver* observer;
|
||||
Font * font;
|
||||
|
||||
void Init();
|
||||
void paint();
|
||||
void setColor();
|
||||
void paintSlider(int x, int y, unsigned char *spos, const neutrino_locale_t text, const char * const iconname, const bool selected);
|
||||
|
Reference in New Issue
Block a user