Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Look and Chameleon Technology » A little theming
Re: A little theming [message #18826 is a reply to message #18820] Sat, 25 October 2008 11:31 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

unodgs wrote on Fri, 24 October 2008 15:53

Quote:


PS: How's your Oxygen style progressing? With two high quality custom themes, and one reproducing the “modern” Windows look (like in ToolKit Pro), we will have great eye-candy possibilities.


The problem is I have no time right now, as always (one commercial project is almost finished the next is coming..), but I'll try to get back to it ASAP.


ASAP? Why?
Will not be greater for make in u++ this functionality?
Automation evidense of firm we can integrate in U++ with PostGres SQL!
John.
Re: A little theming [message #18827 is a reply to message #18818] Sat, 25 October 2008 11:40 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

cbpporter wrote on Fri, 24 October 2008 12:01

tojocky wrote on Fri, 24 October 2008 08:59

What about to create a visual theme editor mechanism?
I thing that will be greater!

That would be great, but I don't know how it could be possible. When I started doing this theme, I thought that all that working with the images and fiddling to get shadows perfect would be horrible. But instead, that was the easies part. Figuring out how to set thing inn Chameleon so that it looks the same under all platforms was/is the hard part. It would be even harder to incorporate that into a visual editor. But it is something to think about. If you have any ideas, please share.

OTOH, I've been thinking a lot about the previous idea with an achieve with and XML and a bunch of pictures. It would make the theme more editable by the non technical people. Sure, TheIDE's image editor is quite excellent after you get used tot it (but I did manage to crash it once), but you have to write code to apply those images and extra information to a theme and export it as a shareable binary. With and XML, people could edit it easily and use their favorite image editing program. Yet, U++ theming engine is not really targeted by anybody else than us, and I think we can handle a little code Smile.




I thing that will be great to save style theme in the extern file! About visual theme to meke an interface that can set style of ctrls (form, button, edit field, ...). It is in the start!
Re: A little theming [message #18828 is a reply to message #18820] Sat, 25 October 2008 12:01 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1391
Registered: September 2007
Senior Contributor
I have a new problem: the style for DropChoice overrides the style for DropList. I need them to be different. Under Vista and a lot of Gtk styles they are different, so it can be done. The question is how?

I set the style of DropList by DropList::StyleDefault().Write() = smth and of DropChoice by DropChoice::StyleDefault().Write() = smthelse. After this, both controls will have the smthelse style.
Re: A little theming [message #18908 is a reply to message #18828] Fri, 31 October 2008 14:34 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12020
Registered: November 2005
Ultimate Member
MultiButton (which is a baseclass for DropList) has two styles:

static const Style& StyleDefault();
static const Style& StyleFrame();

DropChoice is using second one. Anyway, unless written something else, its values default to the first one...

Mirek
Re: A little theming [message #18909 is a reply to message #18818] Fri, 31 October 2008 14:40 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 12020
Registered: November 2005
Ultimate Member
cbpporter wrote on Fri, 24 October 2008 05:01

OTOH, I've been thinking a lot about the previous idea with an achieve with and XML and a bunch of pictures. It would make the theme more editable by the non technical people. Sure, TheIDE's image editor is quite excellent after you get used tot it (but I did manage to crash it once), but you have to write code to apply those images and extra information to a theme and export it as a shareable binary. With and XML, people could edit it easily and use their favorite image editing program. Yet, U++ theming engine is not really targeted by anybody else than us, and I think we can handle a little code Smile.



Not a bad idea. IMO, it should be possible to do this on top of existing chameleon.

In fact, the most simple thing to do (about 20 lines of code) is to add import/export of Ctrls.iml (to/from directory with .png files). Add one .png, put hotspots in the name somehow and you are quite configurable... (minus those pesky details....)

Mirek
Re: A little theming [message #20287 is a reply to message #18820] Fri, 06 March 2009 21:01 Go to previous messageGo to next message
Infausto is currently offline  Infausto
Messages: 28
Registered: June 2008
Promising Member
what happend with this mini-project?. The skulpture theme will be integrated with the next version of TheIde??
Re: A little theming [message #20310 is a reply to message #20287] Mon, 09 March 2009 08:30 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1391
Registered: September 2007
Senior Contributor
Infausto wrote on Fri, 06 March 2009 22:01

what happend with this mini-project?. The skulpture theme will be integrated with the next version of TheIde??

The next version of both the theme and the theming mechanism is work in progress. I will commit to Bazaar soon.

I don't know about inclusion in TheIDE, but since new theme is going to be an externally loadable file, you will be able to add this theme to any project.
Re: A little theming [message #21410 is a reply to message #20310] Tue, 19 May 2009 05:13 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1391
Registered: September 2007
Senior Contributor
I've committed the new version of Skulpture to Bazaar. It is yet a little bit experimental, but if everything goes OK this is the path the project is going to follow from now on, so consider old version as no longer supported.

This new version uses a plain ini file with some simple commands and plain png files stored on the disk. The advantages are that one can edit the theme without TheIDE or any programming skill. One can also edit the theme and apply the changes without restarting or recompiling your application. The disadvantage is that you no longer have a single file, disadvantage that can be fully offset by using an achieve (though this is not implemented yet).

It also features two reskinned widgets and a number of small tweaks and bugfixes.

There is also a new color scheme called Stone which is WIP right now, but once it is ready I think I'm going to use this one as a default. While old color scheme is great, it really does not mix that well with the cheap low end poor contrast LCDs that seem to populate every office.

The API is the same, but for now the ability to apply only a subset of the theme is lost:
Theme m;
m.Load("c:\\Skulpture\\Default");


There is still a lot of work. Next I'm going to skin ProgressIndicator and SliderCtrl. SliderCtrl is going to be more work, because I need to patch CtrlLib so that it accepts styles for this control.
Re: A little theming [message #21464 is a reply to message #21410] Thu, 21 May 2009 19:37 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1391
Registered: September 2007
Senior Contributor
Wow, really nice. I can't get it to compile under MINGW. Sorry about that. I'll look into it.
Re: A little theming [message #21465 is a reply to message #21464] Thu, 21 May 2009 20:02 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 916
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Could you please post a pair of screenshots of new themes?
Re: A little theming [message #21518 is a reply to message #21465] Sun, 24 May 2009 10:58 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1391
Registered: September 2007
Senior Contributor
Mindtraveller wrote on Thu, 21 May 2009 21:02

Could you please post a pair of screenshots of new themes?

Sure!

EDIT: old image removed, see new one

As you can see Stone (the second one) is not quite ready yet, while the first one looks IMO quite mature. There are some colors I'm going to tweak in Default (need better name) and I'll finish Stone in 1-2 updates.

I still need to re skin DropList and Drop choice according to latest style. Is anybody a big fan of the difference between DropChoice and DropList skin? Because it may be eliminated.

ProgressIndicator is also done. (BTW: Why such a long name? How about ProgressCtrl?)

Next I was going to do SliderCtrl, but since it doesn't have a style, it raises some interesting problems. I can add the style very easily and know how it's going to look. That's not the problem. The problem is that the Style is going to be present only in SVN version of CtrlLib. And I can't use non-official releases for the only application where Skulpture is the default look. So I would have to maintain two versions of Skulpture. I'll post the Style here after it is ready and once it is included in 20xx.1 I'll update Skulpture.

So I'll do ArrayCtrl next. More people are probably using ArrayCtrl vs. SliderCtrl anyway.

[Updated on: Tue, 26 May 2009 19:29]

Report message to a moderator

Re: A little theming [message #21519 is a reply to message #21518] Sun, 24 May 2009 11:02 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1391
Registered: September 2007
Senior Contributor
Almost forget: yes, I know it still won't compile with MINGW. I don't know why SetIfNotNull doesn't compile. Maybe someone has some ideas. Thanks!
Re: A little theming [message #21520 is a reply to message #21519] Sun, 24 May 2009 11:33 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 486
Registered: November 2008
Location: France
Senior Member
The compile problem is not only on MINGW, there is the same problem on linux ==> the "problem" comes from the compiler GCC.

Here is a valid correction but it needs to be optimised (on point 2):

In Theme.cpp
------------
1 - I removed the second template parameter: V is supposed to be a Value type since you use ' v.Is<Upp::String> ' just let C++ inheritance do it's work.

//template <typename T, typename V>
template <typename T>
inline void SetIfNotNull(T& t, Value v)
{
	if ( v.Is<Upp::String>() && ((String)v == "null") )
		t = Null;
	else
		if (!IsNull(v))
	    	t = v;
}


2 - You have to add a temporary object:
Image imag
because problems when using temporary references: It is not excluded that
ImageBuffer img( imag );
will use the address of the passed object which would be completely false for a temporary reference. Even though the problem is still here after correction (img is a temporary to the scope) at least it is visible while reading the code and not left to compiler will.

Value Theme::StringToObject(const String& s, const String& def) {
	Vector<String> v = Split(s, ' ');
	if (v.GetCount() == 0)
		return Null;
	if (v[0] == "png") {
		Image imag = PNGRaster().LoadFileAny(AppendFileName(dir, def));
		ImageBuffer img( imag );
		if (img.IsEmpty())



In Theme.h
----------
3 - remove the
 Theme:: 
from the following line
	void Theme::LoadEditField(EditField::Style& d, const VectorMap<String, String>& set, const String& dir, const String& file);




Question:
---------
1 - Is there some documentation for the 'theme.ini' file syntax ?
2 - Can I use several themes in one application (like have two tabs not using same theme) or add in 'theme.ini' several different versions of skin for a ctrl ?


Skulpture looks good on linux Cool

Re: A little theming [message #21521 is a reply to message #21520] Sun, 24 May 2009 11:57 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1391
Registered: September 2007
Senior Contributor
Hi Didier!

Thanks for point number one! Maybe sometimes using too much features like templates is not that good. I wonder if GCC is not being 100% compliant here, or is there an issue with the code I've written (except the obvious us of V instead of const V& in the parameter list Smile ).

Sorry about points 2 and 3. I've corrected them after first noticing MINGW problems, but missed on my commit because I was accidentally using and editing Theme from MyApps instead from bazaar nest. I've corrected this and there shouldn't be any more source synchronization issues. But not being able to repeat the class name in a definition is really silly. I wish GCC would allow this.

Quote:

1 - Is there some documentation for the 'theme.ini' file syntax ?
2 - Can I use several themes in one application (like have two tabs not using same theme) or add in 'theme.ini' several different versions of skin for a ctrl ?


1. No, there is not documentation yet. Maybe after it gets more stable. But it is pretty straightforward. Every section name corresponds more or less to a widget. Values from the sections correspond to the same named field in the appropriate style structure. Values can be simple values or commands:
color r g b             // simple rgb value
null                    // null look
png                     // loads a png from correct folder and name determined by what the image is going to be used for
png hot i1 i2 i3 i4     // loads a png and sets hot spots

I'll add a name parameter to png in the future for custom file names and maybe other formats, but png is IMO best for this purpose: small, loose less and portable.

2. This was a feature in previous version of Theme and I'll bring it back. It got lost since I've rewritten the them class from scratch and it is a little poor on features right now because I'm focusing on the look. Themes are applied now once loaded, but you will be able to keep several loaded in memory and apply only a widget at a time to mix and match.
Re: A little theming [message #21522 is a reply to message #18450] Sun, 24 May 2009 12:11 Go to previous messageGo to next message
Didier is currently offline  Didier
Messages: 486
Registered: November 2008
Location: France
Senior Member
Thanks Smile

In fact I don't know what a hot-spot is (I don't usualy do GUI's)

Re: A little theming [message #21554 is a reply to message #21522] Tue, 26 May 2009 12:13 Go to previous messageGo to next message
chickenk is currently offline  chickenk
Messages: 168
Registered: May 2007
Location: Grenoble, France
Experienced Member
Hi,

a quick fix to make this nice package cross-platform (there are cleaner ways but anyway)

Use the attached Theme.cpp file, and rename all .PNG to .png. Taking care of filenames case is important and sometime difficult on Windows...

For anyone on a Unix platform, the fix consists in that:

$ cd <path_to_bazaar>
$ sed -i -e 's/"\\\\"/DIR_SEP/g' Theme/Theme.cpp
$ for f in $(find Themes -name "*.PNG") ; do mv $f ${f/PNG/png} ; done

Enjoy !

regards,
Lionel
  • Attachment: Theme.cpp
    (Size: 12.68KB, Downloaded 400 times)
Re: A little theming [message #21559 is a reply to message #21554] Tue, 26 May 2009 19:29 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1391
Registered: September 2007
Senior Contributor
New update features:
- Stone has almost caught up with Default
- unified DropList and DropChoice skins
- style for TriState options added (still needs a little more work on contrast)
- fixed bugs with single tab TabCtrl
- fixed hopefully problems under Linux with file names (though I must admit I still haven't gotten around to test it under Linux).

So now would be a good moment for people who where using previous versions and people who would like to maybe use it from now on to test the thing. I accept bug reports and reasonable requests (maybe we'll have pink Skulpture Razz ). There are still some small issues and features to be added (selective themeing, hooks for widgets from different packages), but Ill try to reach a point of stability and enter maintenance mode.


index.php?t=getfile&id=1751&private=0
Re: A little theming [message #21563 is a reply to message #21559] Wed, 27 May 2009 07:25 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1391
Registered: September 2007
Senior Contributor
A skin for ArrayCtrl has been added.

In anticipation for selective themeing there is a change in the API: you need to call Theme::Apply for the visual changes to take effect. Theme::Load only loads theme info (not the resources) into memory.
Re: A little theming [message #21631 is a reply to message #21563] Sat, 30 May 2009 10:02 Go to previous messageGo to next message
cbpporter is currently offline  cbpporter
Messages: 1391
Registered: September 2007
Senior Contributor
New update here and this one is a big one:
- ProgressIndicator has a vertical skin now
- LeftEdgeStyle skinned for Button
- ViewEdge is now a separate entity
- added almost all properties of style structures to Theme. The idea is that now Theme.ini can be edited to tweak almost every aspect of style structure, except for font and font related fields. Chameleon is very complex and styles often have some interactions and until now Skulpture worked but it took advantage of the sensible defaults provided by the system. I'm migrating to a self contained structure, where a theme relies only on itself and works and looks exactly the same on all platforms disregarding defaults.
- code has been refactored and it is now very easy to add or remove a property
- mix and match is partially implemented. Not all widgets can be disabled yet, but for the ones you can, if you apply the theme with e.g. Button skinning disabled, you will get your theme except the Button skin. The final Button skin will be your original skin, like Windows default or a previous custom skin you loaded before. If you load a second theme and disable all except Button, you have basically combined two themes. In next update I'll finish this feature.

PS: Stone is allays lagging behind, and after this update you'll see a lot of bugs. Will fix ASAP.
Re: A little theming [message #22218 is a reply to message #21631] Thu, 25 June 2009 04:30 Go to previous messageGo to previous message
cbpporter is currently offline  cbpporter
Messages: 1391
Registered: September 2007
Senior Contributor
I added a new style which replicates art/BlueBar. It can be found in bazaar/Themes/BlueBar.

PS: You may get a compile error stating that Crc32 can't be found. This is an issue with plugin/Zip. Change Crc32 to Crc32Stream and it will compile. Something to fix in U++.

index.php?t=getfile&id=1815&private=0


  • Attachment: Untitled.PNG
    (Size: 29.86KB, Downloaded 972 times)
Previous Topic: The problem with the operation of the buffer.
Next Topic: Set fields side to other fields and fields width to text width
Goto Forum:
  


Current Time: Thu Sep 19 00:16:04 CEST 2019

Total time taken to generate the page: 0.01399 seconds