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 » Developing U++ » U++ TheIDE and Library: Releases and ChangeLogs » GTK theming a reality
GTK theming a reality [message #6742] Sun, 26 November 2006 01:20 Go to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
After a couple of weeks of pretty messy development, kick-off of GTK chameleon is now in main sources.

At the moment, it just reads system colors and font and "chameleonises" Button, Option and Switch, but obviously, even so little makes a huge difference...

Please test! And test with as many themes as possible...

BTW, you do not have to have GTK development headers installed to develop with U++ - GTK is loaded at runtime. Actually, it does not have to be even present either - in that case, U++ default theme is used (after an attempt to read KDE colors and font...))

Mirek
Re: GTK theming a reality [message #6764 is a reply to message #6742] Sun, 26 November 2006 18:30 Go to previous messageGo to next message
fallingdutch is currently offline  fallingdutch
Messages: 258
Registered: July 2006
Experienced Member
great work, Mirek!

it realy looks much better!

Bas
Re: GTK theming a reality [message #6766 is a reply to message #6764] Sun, 26 November 2006 21:33 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
ScrollBar theming ("chameleonization") in GTK is now finished as well.

We really start to look native Smile

Mirek
Re: GTK theming a reality [message #6769 is a reply to message #6766] Sun, 26 November 2006 22:01 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
Hi,

we have the problem of upper and lower case includes once again.
Had to change include definitions of DLIHEADER from draw/*.dli to Draw/*.dli in Draw.h and DrawX11.cpp since my directory is uppercase.

Matthias
Re: GTK theming a reality [message #6771 is a reply to message #6769] Sun, 26 November 2006 22:07 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Sorry, already fixed... (I hope).

I know this is stupid problem, but for me it is very convenient (almost the only possibility) to share the disk partition with sources between Win and Linux.

Mirek
Re: GTK theming a reality [message #6772 is a reply to message #6769] Sun, 26 November 2006 22:20 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
No problm, if all problems would have been so simple to solve Smile.

Another problem is missing implementation of CtrlFrame::OverPaint.
I simply copied Ctrl::OverPaint (which seems to basically be a placeholder) and it worked.
But after starting new ide, I get DLL not found, investigating ...

Matthias


931b81e7ea53320dccc37375b34b38c3
Re: GTK theming a reality [message #6774 is a reply to message #6772] Sun, 26 November 2006 23:05 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Already fixed, just sync new version. A lot was done today.

Mirek
Re: GTK theming a reality [message #6775 is a reply to message #6772] Sun, 26 November 2006 23:27 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
masu wrote on Sun, 26 November 2006 22:20

But after starting new ide, I get DLL not found, investigating ...

I did not activate "use shared libs" for building Rolling Eyes .

Matthias
Re: GTK theming a reality [message #6791 is a reply to message #6775] Tue, 28 November 2006 13:56 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
I noticed in "Output mode ..." that three-state checkbox is also missing from within GTK.
Are you going to emulate it somehow like in Win?

Matthias
Re: GTK theming a reality [message #6813 is a reply to message #6742] Wed, 29 November 2006 11:47 Go to previous messageGo to next message
guido is currently offline  guido
Messages: 169
Registered: April 2006
Experienced Member
luzr wrote on Sun, 26 November 2006 01:20

After a couple of weeks of pretty messy development, kick-off of GTK chameleon is now in main sources.

At the moment, it just reads system colors and font and "chameleonises" Button, Option and Switch, but obviously, even so little makes a huge difference...

Please test! And test with as many themes as possible...

BTW, you do not have to have GTK development headers installed to develop with U++ - GTK is loaded at runtime. Actually, it does not have to be even present either - in that case, U++ default theme is used (after an attempt to read KDE colors and font...))

Mirek


Congratulations!

Already working on icon theming? Cool

Currently it shares a problem I got with Firefox 2.0 (1.5 was OK) in that application font is two points too big. I can make it smaller by increasing the Xserver DPI setting from 72 to 120, but than the other GTK apps have tiny fonts.
Could you please tell me, how the font size is retreived?

Guido
Re: GTK theming a reality [message #6814 is a reply to message #6813] Wed, 29 November 2006 11:57 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
guido wrote on Wed, 29 November 2006 05:47



Congratulations!

Already working on icon theming? Cool



That is the next step. Actually, there is not too many icons import now (only for message boxes and OK Cancel buttons).

Well, I can also import "common" icons for Cut/Copy/Paste, but maybe I will do so rather on "app demand". There is also a problem with icon size...

Quote:


Currently it shares a problem I got with Firefox 2.0 (1.5 was OK) in that application font is two points too big. I can make it smaller by increasing the Xserver DPI setting from 72 to 120, but than the other GTK apps have tiny fonts.
Could you please tell me, how the font size is retreived?



Sure:

	char *font_name = "";
	GOBJ().g_object_get(GTK().gtk_settings_get_default(), "gtk-font-name", &font_name, NULL);

	const char *q = strrchr(font_name, ' ');
	if(q) {
		int h = atoi(q);
		String face(font_name, q);
		int ii = Font::FindFaceNameIndex(face);
		if(ii < 0)
			if(ToUpper(face[0]) == 'M')
				ii = Font::COURIER;
			else
			if(ToUpper(face[0]) == 'S' && ToUpper(face[1]) == 'e')
				ii = Font::ROMAN;
			else
				ii = Font::ARIAL;
		Draw::SetStdFont(Font(ii, h ? h * 96 / 72 : 13));
	}


(in short, it expects h * 96 / 72 converts retrieved point size to 96dpi screen pixels).

For me, font is exactly as big as in other gnome apps. But as you already noted, I tend to oversimplify things, maybe this simple height retrieval needs to take into account more factors?

Mirek
Re: GTK theming a reality [message #6826 is a reply to message #6814] Wed, 29 November 2006 20:12 Go to previous messageGo to next message
guido is currently offline  guido
Messages: 169
Registered: April 2006
Experienced Member
luzr wrote on Wed, 29 November 2006 11:57



Sure:

	char *font_name = "";
	GOBJ().g_object_get(GTK().gtk_settings_get_default(), "gtk-font-name", &font_name, NULL);

	const char *q = strrchr(font_name, ' ');
	if(q) {
		int h = atoi(q);
		String face(font_name, q);
		int ii = Font::FindFaceNameIndex(face);
		if(ii < 0)
			if(ToUpper(face[0]) == 'M')
				ii = Font::COURIER;
			else
			if(ToUpper(face[0]) == 'S' && ToUpper(face[1]) == 'e')
				ii = Font::ROMAN;
			else
				ii = Font::ARIAL;
		Draw::SetStdFont(Font(ii, h ? h * 96 / 72 : 13));
	}


(in short, it expects h * 96 / 72 converts retrieved point size to 96dpi screen pixels).

For me, font is exactly as big as in other gnome apps. But as you already noted, I tend to oversimplify things, maybe this simple height retrieval needs to take into account more factors?

Mirek




From the GTK2 docs:
"""
The "gtk-xft-dpi" property

"gtk-xft-dpi" gint : Read / Write

Resolution for Xft, in 1024 * dots/inch. -1 to use default value.

Allowed values: [-1,1048576]

Default value: -1
"""

Maybe use that in your formula?

Guido
Re: GTK theming a reality [message #6827 is a reply to message #6826] Wed, 29 November 2006 20:29 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Will you try? I think should be relatively easy (CtrlLib/ChGtk.cpp)

Mirek
Re: GTK theming a reality [message #6830 is a reply to message #6827] Thu, 30 November 2006 20:52 Go to previous messageGo to next message
guido is currently offline  guido
Messages: 169
Registered: April 2006
Experienced Member
luzr wrote on Wed, 29 November 2006 20:29

Will you try? I think should be relatively easy (CtrlLib/ChGtk.cpp)

Mirek



Ok. Here my take:


	char *font_name = "";
	GOBJ().g_object_get(GTK().gtk_settings_get_default(), "gtk-font-name", &font_name, NULL);
	int xdpi;
	GOBJ().g_object_get(GTK().gtk_settings_get_default(), "gtk-xft-dpi", &xdpi, NULL);

	int fontname = Font::ARIAL;
	int fontheight = 13;
	
	const char *q = strrchr(font_name, ' ');
	if(q) {
		int h = atoi(q);
		if(h)
			fontheight = h;
		String face(font_name, q);
		if(Font::FindFaceNameIndex(face) < 0)
			if(ToUpper(face[0]) == 'M')
				fontname = Font::COURIER;
			else
			if(ToUpper(face[0]) == 'S' && ToUpper(face[1]) == 'e')
				fontname = Font::ROMAN;
	}
		
	Draw::SetStdFont(Font(fontname, (fontheight * xdpi) / (1024*72)));	

	ChLookFn(GtkLookFn);


I looked at the GDK docs, and that's the math there.


Incidentally, I fixed a allocation bug, which I noticed GTK complain about, when starting a sample app from a terminal.

The last line, is the fixed one:
ChSet("ScrollBarOverThumb", m != GetGTK(w, 0, 0, "slider", GTK_SLIDER|GTK_VAL1, 16, 32));
	GTK().gtk_widget_destroy(w);
	GTK().gtk_object_sink(adj);


Add to gtk.dli:
FN(void, gtk_object_sink, (G_obj *widget))


Re: GTK theming a reality [message #6831 is a reply to message #6830] Thu, 30 November 2006 20:58 Go to previous messageGo to next message
guido is currently offline  guido
Messages: 169
Registered: April 2006
Experienced Member
Addendum:

Should better be

int xdpi = 96*1024;


I suppose.

Guido
Re: GTK theming a reality [message #6833 is a reply to message #6831] Thu, 30 November 2006 21:04 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
guido wrote on Thu, 30 November 2006 20:58

Addendum:

Should better be

int xdpi = 96*1024;


I suppose.

Guido

Why?
My dpi setting is 75, so this would not work.
Your first solution seems to be right.

Matthias
Re: GTK theming a reality [message #6835 is a reply to message #6833] Thu, 30 November 2006 21:24 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
masu wrote on Thu, 30 November 2006 15:04

guido wrote on Thu, 30 November 2006 20:58

Addendum:

Should better be

int xdpi = 96*1024;


I suppose.

Guido

Why?
My dpi setting is 75, so this would not work.
Your first solution seems to be right.

Matthias


I think Guido just assigns a default value so it does not crash if retrieval from gtk fails.

Mirek
Re: GTK theming a reality [message #6836 is a reply to message #6833] Thu, 30 November 2006 21:27 Go to previous messageGo to next message
guido is currently offline  guido
Messages: 169
Registered: April 2006
Experienced Member
masu wrote on Thu, 30 November 2006 21:04

guido wrote on Thu, 30 November 2006 20:58

Addendum:

Should better be

int xdpi = 96*1024;


I suppose.

Guido

Why?
My dpi setting is 75, so this would not work.
Your first solution seems to be right.

Matthias


Only used as default, in case Gtk doesn't return a dpi value (although I doubt that can happen). 96dpi is the GTK default anyway, according to the docs, and Mirek used it as default too.

Guido
Re: GTK theming a reality [message #6837 is a reply to message #6835] Thu, 30 November 2006 21:29 Go to previous messageGo to next message
guido is currently offline  guido
Messages: 169
Registered: April 2006
Experienced Member
Mirek beat me to it Very Happy
Watching UEFA-Cup, that's my excuse Cool

Guido
Re: GTK theming a reality [message #6838 is a reply to message #6837] Thu, 30 November 2006 21:37 Go to previous messageGo to previous message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
Yes, now I see it Rolling Eyes .
By the way, thanks Guido for fixing the other problem Smile .

Matthias
Previous Topic: TrayIcon Win32 fixed some misbehaviour....
Next Topic: New Vector optimization reduces Linux executable size by 0.8%
Goto Forum:
  


Current Time: Thu Mar 28 13:30:13 CET 2024

Total time taken to generate the page: 0.01215 seconds