|
|
Home » U++ Library support » Slider&ProgressIndicator » Please, add SetColor function to ProgressIndicator
|
|
Re: Please, add SetColor function to ProgressIndicator [message #12294 is a reply to message #12289] |
Tue, 23 October 2007 20:08   |
spidertp
Messages: 16 Registered: October 2007 Location: Poland
|
Promising Member |
|
|
Thank you Mirek.
Quote: | Yes, but that does not really work in XP (where chameleonized value is used to draw it using ChPaint)
|
Well, I use XP and it works for me, but I don't use chameleon technology for now... mainly because I don't understand what is a "chameleon technology"
Can you direct me to a manual about it?
Maybe you say, that I can change it by "chameleonized value"?
One personal question - have you made UPP mainly by yourself? It's quite huge amount of work! Great job!
Best regards,
Tomek
[Updated on: Tue, 23 October 2007 20:09] Report message to a moderator
|
|
|
Re: Please, add SetColor function to ProgressIndicator [message #12296 is a reply to message #12294] |
Tue, 23 October 2007 21:29   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
spidertp wrote on Tue, 23 October 2007 14:08 | Thank you Mirek.
Quote: | Yes, but that does not really work in XP (where chameleonized value is used to draw it using ChPaint)
|
Well, I use XP and it works for me, but I don't use chameleon technology for now... mainly because I don't understand what is a "chameleon technology"
|
Interesting, do you use XP ("Luna") theme or classic look?
Quote: |
Can you direct me to a manual about it?
|
I guess just see the code carefully 
OTOH, it can be easily fixed to show the color you want.
Quote: |
Maybe you say, that I can change it by "chameleonized value"?
|
Well, that is another possibility...
Quote: |
One personal question - have you made UPP mainly by yourself? It's quite huge amount of work! Great job!
|
See the About in TheIDE. There is a lot of people involved over years.
Mirek
|
|
|
|
|
|
Re: Please, add SetColor function to ProgressIndicator [message #12307 is a reply to message #12304] |
Wed, 24 October 2007 14:04   |
spidertp
Messages: 16 Registered: October 2007 Location: Poland
|
Promising Member |
|
|
Quote: | Well, anyway, ProgressIndicator now supports SetColor (fallbacks to "classic" look if color is set).
|
Thanks. Do I understand it correctly, that in a function SetColor you change style to classic automatically? If yes, that's good.
Quote: |
That is OK, but try your patch with Luna (And yes, I think these things should work no matter what 
|
So, as far I can see, I need to make my own pictures for:
hlook = CtrlsImg::PI();
hchunk = CtrlsImg::PIC();
vlook = CtrlsImg::VPI();
vchunk = CtrlsImg::VPIC();
in every color?? Pfffff...
Or write a function to copy image and change color palette to desired color?
Well, I've copied CtrlsImg::VPIC() and changed pallete to blue, but...
I changed style of ProgressIndicator and it looks ugly...
I made it with:
ProgressIndicator::Style style; // in main class declaration
style.hlook = CtrlsImg::PI();
style.hchunk = CtrlsImg::PIC();
style.vlook = CtrlsImg::VPI();
style.vchunk = Images::VPICblue();
Prog1.SetStyle(style);
What's the problem?
Best regards,
Tomek
[Updated on: Fri, 26 October 2007 12:37] Report message to a moderator
|
|
|
|
Re: Please, add SetColor function to ProgressIndicator [message #12327 is a reply to message #12315] |
Thu, 25 October 2007 08:16   |
spidertp
Messages: 16 Registered: October 2007 Location: Poland
|
Promising Member |
|
|
Quote: | ChPaint uses two 'HotSpots' to determine how to stretch the image. These can be set in the image editor by selecting the little orange dot on the second row of tools, then using the right and left mouse buttons to place them. If you duplicate the positioning in the original image it should work.
Also, you can set styles more easily if you copy the default style and just change what you need:
style = ProgressIndicator::DefaultStyle();
style.vchunk = Images::VPICblue();
This method will also addapt better to different global Chameleon styles.
|
Thanks James. Without your help I think I would be not able to find the meaning of those hotspots.
But I still don't understand the difference between blue hotspot and orange one (e.g. why the blue one is before the orange one?).
I copied the hotspots from Ctrls.iml but ProgressIndicator doesn't look equally.
Can anybody explain to me the use of hotspots a little bit more (especially, how can I change their position by code)?
Best regards,
Tomek
[Updated on: Fri, 26 October 2007 12:38] Report message to a moderator
|
|
|
|
Re: Please, add SetColor function to ProgressIndicator [message #12356 is a reply to message #12278] |
Fri, 26 October 2007 11:07   |
spidertp
Messages: 16 Registered: October 2007 Location: Poland
|
Promising Member |
|
|
So, I changed a little bit the ProgressIndicator class to change the color even in Xp Style.
The changes are?
1) in Progress.h
1a) added two more variables in protected:
Style XPstyle;
Image img;
1b) i made only the declaration of SetColor
void SetColor(Color& color);
1c) added two more functions in protected
void ChangeVChunk(Color& color);
void ChangeHChunk(Color& color);
2) in Progress.cpp
2a) added definition of SetColor:
if(GUI_GlobalStyle() >= GUISTYLE_XP && !percent) {
Size sz = GetSize();
if(sz.cy > sz.cx) {
ChangeVChunk(color);
}
else {
ChangeHChunk(color);
}
SetStyle(XPstyle);
}
else {
SColor = color;
}
2b) added definition of ChangeVChunk
void ProgressIndicator::ChangeVChunk(Color& color)
{
ImageBuffer ib(11,8);
// draw points in an ImageBuffer with specified color
for(int y=0; y<8; y++)
{
RGBA *l = ib[y];
for(int x=0; x<11; x++)
{
// the first and the last row must be white
if(y == 0 || y == 7)
{
*l = SWhite();
}
else if(x == 0 || x == 10) // the first and the last column must have alfa = 150
{
*l = color;
l->a = 150;
}
else // everything else must be set to user color with alfa = 200
{
*l = color;
l->a = 200;
}
l++;
}
}
// HotSpots - coordinates best for me
ib.SetHotSpot(Point(0,7));
ib.Set2ndSpot(Point(10,0));
// changing vchunk
Premultiply(ib);
img = ib;
XPstyle = ProgressIndicator::StyleDefault();
XPstyle.vchunk = img;
}
2c) added definition of ChangeHChunk
void ProgressIndicator::ChangeHChunk(Color& color)
{
ImageBuffer ib(8,11);
// draw points in an ImageBuffer with specified color
for(int y=0; y<11; y++)
{
RGBA *l = ib[y];
for(int x=0; x<8; x++)
{
// the first and the last row must be white
if(x == 0 || x == 7)
{
*l = SWhite();
}
else if(y == 0 || y == 10) // the first and the last column must have alfa = 150
{
*l = color;
l->a = 150;
}
else // everything else must be set to user color with alfa = 200
{
*l = color;
l->a = 200;
}
l++;
}
}
// HotSpots - coordinates best for me
ib.SetHotSpot(Point(7,0));
ib.Set2ndSpot(Point(0,10));
// changing hchunk
Premultiply(ib);
img = ib;
XPstyle = ProgressIndicator::StyleDefault();
XPstyle.hchunk = img;
}
The only thing is that bars are still too thin for me. Also, differences between ChangeVChunk and ChangeHChunk are very small and they can be merged.
What do you think?
Best regards,
Tomek
[Updated on: Fri, 26 October 2007 11:35] Report message to a moderator
|
|
|
Re: Please, add SetColor function to ProgressIndicator [message #12364 is a reply to message #12356] |
Fri, 26 October 2007 13:07   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
spidertp wrote on Fri, 26 October 2007 05:07 |
What do you think?
|
Well, I think you are really quite good 
Anyway, this thing is supposed to work (and indeed does work) even if you switch the theme in XP (e.g. to make XP look like MacOS X). And on linux too (where, admitedly, the real meat is now still missing). And in Vista.
I know, adding SetColor slightly spoils it anyway, but IMO simple uniform color bar is acceptable everywhere.
In the same time, I think your code could easily be turned in external function (or utility class). No need to change uppsrc.
Which reminds me the persistent topic, to introduce "art" or "theme" package group that would contain all visual enhancements...
Mirek
|
|
|
Re: Please, add SetColor function to ProgressIndicator [message #12365 is a reply to message #12364] |
Fri, 26 October 2007 13:19   |
spidertp
Messages: 16 Registered: October 2007 Location: Poland
|
Promising Member |
|
|
luzr wrote on Fri, 26 October 2007 13:07 |
spidertp wrote on Fri, 26 October 2007 05:07 |
What do you think?
|
Anyway, this thing is supposed to work (and indeed does work) even if you switch the theme in XP (e.g. to make XP look like MacOS X). And on linux too (where, admitedly, the real meat is now still missing). And in Vista.
I know, adding SetColor slightly spoils it anyway, but IMO simple uniform color bar is acceptable everywhere.
In the same time, I think your code could easily be turned in external function (or utility class). No need to change uppsrc.
Which reminds me the persistent topic, to introduce "art" or "theme" package group that would contain all visual enhancements...
Mirek
|
Well, I still need to learn a lot. But I admit, that UPP gives me a real programming pleasure 
I'm trying to make a little visualization for automation process and I'd to enhance ProgressIndicator a little bit.
Concerning new packages, maybe it's a good idea.
If you doesn't want to include my enhancements to UPPsrc, then tell me the name of a new utility class, and I wil make it.
I don't want to change my code every new version of UPP...
Best regards 
Tomek
|
|
|
Re: Please, add SetColor function to ProgressIndicator [message #12369 is a reply to message #12365] |
Fri, 26 October 2007 14:18   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
spidertp wrote on Fri, 26 October 2007 07:19 |
luzr wrote on Fri, 26 October 2007 13:07 |
spidertp wrote on Fri, 26 October 2007 05:07 |
What do you think?
|
Anyway, this thing is supposed to work (and indeed does work) even if you switch the theme in XP (e.g. to make XP look like MacOS X). And on linux too (where, admitedly, the real meat is now still missing). And in Vista.
I know, adding SetColor slightly spoils it anyway, but IMO simple uniform color bar is acceptable everywhere.
In the same time, I think your code could easily be turned in external function (or utility class). No need to change uppsrc.
Which reminds me the persistent topic, to introduce "art" or "theme" package group that would contain all visual enhancements...
Mirek
|
Well, I still need to learn a lot. But I admit, that UPP gives me a real programming pleasure 
I'm trying to make a little visualization for automation process and I'd to enhance ProgressIndicator a little bit.
Concerning new packages, maybe it's a good idea.
If you doesn't want to include my enhancements to UPPsrc, then tell me the name of a new utility class, and I wil make it.
I don't want to change my code every new version of UPP...
Best regards 
Tomek
|
Do you need a class for it?
I am not 100% sure, but I think it should be possible to make simple
void SetProgressXPColor(ProgressIndicator& pi, Color c);
function (perhaps with some static ArrayMap<Color, ProgressIndicator::Style> inside).
Mirek
|
|
|
|
|
Goto Forum:
Current Time: Tue Apr 29 00:25:42 CEST 2025
Total time taken to generate the page: 0.01564 seconds
|
|
|