Lazarus

Programming => Widgetset => Other => Topic started by: ROCABDEL on November 23, 2013, 06:38:07 pm

Title: fpgui support full theming ?!!
Post by: ROCABDEL on November 23, 2013, 06:38:07 pm
Hi Graeme, hi all.
I'm trying to create some themes for this nice widgetset, but I still blocking, TfpgStyle does not allow to customize all, most components have their own procedure HandlePaint that handles all or part of the drawing of the component, for creating a full theme i need to rewrite almost all components, and i can not modify images in fpgImages without affecting all other themes ...


sorry for my bad english
Title: Re: fpgui support full theming ?!!
Post by: avra on November 24, 2013, 02:13:35 pm
Only if you can not find a solution for fpGUI theming, maybe some alternatives may be of use:
http://forum.lazarus.freepascal.org/index.php/topic,21911.msg128785.html#msg128785
Title: Re: fpgui support full theming ?!!
Post by: Graeme on November 25, 2013, 02:55:17 pm
@ROCABDEL
I thought I modified all widgets to use the fpgStyle instance to do the actual customised drawing. I'll take another look tonight. In the mean time if you have some specific examples of issues, just let me know and we can come up with some solution.

Are you using the latest fpGUI from the 'develop' branch?
Title: Re: fpgui support full theming ?!!
Post by: Dibo on November 25, 2013, 03:27:15 pm
I have also created "system color" themes for fpGUI (currently only for GTK and Win apps, Qt is in progress). Here are details (with screenshots and source):
http://opensoft.homeip.net/webnews/webnews.cgi?user=Guest;showold=true;group=fpgui.support;sortorder=date;article=1432
Title: Re: fpgui support full theming ?!!
Post by: Fred vS on November 25, 2013, 03:37:09 pm
Quote
I have also created "system color"

Wow, superb  ;)
Title: Re: fpgui support full theming ?!!
Post by: Fred vS on November 25, 2013, 04:01:37 pm
Quote
Are you using the latest fpGUI from the 'develop' branch?

=> https://github.com/graemeg/fpGUI/tree/develop (https://github.com/graemeg/fpGUI/tree/develop)

Click on Download ZIP button, on right side... ;)
Title: Re: fpgui support full theming ?!!
Post by: ROCABDEL on November 25, 2013, 11:50:32 pm
Thank you friends Graeme, Fred vS, avra, Dibo  for the availability  :)

@Graeme
At this moment, I only use fpGUI v1.0 release from the download page, tomorrow I'll take a look at 'develop' branch  ;)
these are some problems I encountered :
-I can not draw a button disabled juste the caption is disabled.
-I would like to draw a customised checkbox or radiobutton
...

this is small program (https://www.dropbox.com/s/06oe1iap9qse1yf/fpgui_test_themes.zip) to test a theme I vien to create not finished yet when I finish I share the code, look good vertical scrollbar ..

I do not speak English well and I have not much temp now tomorrow I'll write you, thank you again  Graeme..

Title: Re: fpgui support full theming ?!!
Post by: ROCABDEL on November 29, 2013, 11:18:30 pm
Hi All.

In Attachments fpg_style_carbon inspired from Carbon delphi style,  with a test programme and compiled exe, you can switch between styles.
 
Title: Re: fpgui support full theming ?!!
Post by: Graeme on November 30, 2013, 07:23:58 pm
In Attachments fpg_style_carbon inspired from Carbon delphi style,  with a test programme and compiled exe, you can switch between styles.
Very nice!  I'll fix the theming issue in fpGUI with the select items for ComboBox and Memo (they have hard-coded BlueCurve selection theme). Then also take a look at some minor issues with your theme.. eg: some widgets have a single rectangle (part of widget border) that aren't painted at all - thus they contain random paint garbage. Easy to fix.

Once done, would you mind if I add this theme as a standard "dark theme" to fpGUI? You'll get credit of course.
Title: Re: fpgui support full theming ?!!
Post by: Fred vS on November 30, 2013, 08:32:50 pm
@ ROCABDEL

Superbissimo.  ;)
Title: Re: fpgui support full theming ?!!
Post by: ROCABDEL on November 30, 2013, 11:41:14 pm
Hi Graeme.
I'm glad you like it, and you want to add it to your great library  :)  :)
you can rename/edit it like you want...


It would be cool if you add to fpgStyle support to draw a custom CheckBox and RadioButton something like :
Code: [Select]
    function    CanDrawCheckBox: boolean; virtual;
    function    CanDrawRadioButton: boolean; virtual;
    procedure   DrawCheckBox(ACanvas: TfpgCanvas; r: TfpgRect; AFlags: TfpgButtonFlags); virtual; abstract;
    procedure   DrawRadioButton(ACanvas: TfpgCanvas; r: TfpgRect; AFlags: TfpgButtonFlags); virtual; abstract;

and in procedure TfpgRadioButton.HandlePaint; and TfpgBaseCheckBox.HandlePaint; something like :
Code: [Select]
  if fpgStyle.CanDrawCheckBox then
    fpgStyle.DrawCheckBox(Canvas, r, lFlags)
  else begin
  img := fpgImages.GetImage('sys.checkboxes');
  Canvas.DrawImagePart(r.Left, r.Top, img, ix*FBoxSize, 0, FBoxSize, FBoxSize);
  end;

...

  if fpgStyle.CanDrawRadioButton then
    fpgStyle.DrawRadioButton(Canvas, r, lFlags)
  else begin
    img := fpgImages.GetImage('sys.radiobuttons');
    Canvas.DrawImagePart(r.Left, r.Top, img, ix*FBoxSize, 0, FBoxSize, FBoxSize);
  end;




Thank you again Graeme, thanks Fred vS  :)
Title: Re: fpgui support full theming ?!!
Post by: Graeme on December 01, 2013, 11:52:57 am
Then also take a look at some minor issues with your theme.. eg: some widgets have a single rectangle (part of widget border) that aren't painted at all - thus they contain random paint garbage. Easy to fix.

@ROCABDEL
  Fixed in the latest "develop" branch of fpGUI.
Title: Re: fpgui support full theming ?!!
Post by: ROCABDEL on December 01, 2013, 10:54:42 pm
Great job Graeme  :D thank you..
Title: Re: fpgui support full theming ?!!
Post by: vfclists on December 03, 2013, 04:28:57 pm
I just downloaded the stable version from sourcefourge and it is compiling fine in Lazarus. But I think fpGUI also as a GUI creator. Does that have to be downloaded separately, or is it somewhere among the files downloaded

You also mention a develop branch in this thread where can it be downloaded - DOH -  that must be Github

Anyway I have see the UIDesigner folder so I will give it a try and see how it goes.

Then also take a look at some minor issues with your theme.. eg: some widgets have a single rectangle (part of widget border) that aren't painted at all - thus they contain random paint garbage. Easy to fix.

@ROCABDEL
  Fixed in the latest "develop" branch of fpGUI.
Title: Re: fpgui support full theming ?!!
Post by: Graeme on December 06, 2013, 03:03:43 pm
I just downloaded the stable version from sourcefourge and it is compiling fine in Lazarus. But I think fpGUI also as a GUI creator. Does that have to be downloaded separately, or is it somewhere among the files downloaded

The GUI designer in fpGUI is known as UI Designer, and is part of the official fpGUI repository in the 'uidesigner' directory.

Please use the 'develop' branch instead of 'master' - it has many critical fixes, and a new v1.2 release is around the corner, so 'develop' is pretty stable. fpGUI code is hosted in a Git repository. There are two official locations: SourceForge and Github, and they are always in sync. If you did a clone from either, you have all branches already ('master' and 'develop'), but git defaults you to the 'master' branch.

So simply switch to the 'develop' branch by doing the following:

 > git branch develop origin/develop
 > git checkout develop

Hope this helps.
Title: Re: fpgui support full theming ?!!
Post by: Fred vS on December 06, 2013, 03:15:46 pm
Hello.

There is also a "extended" version of uidesigner, synchro with original Graeme version at :

https://github.com/fredvs/uidesigner_ext (https://github.com/fredvs/uidesigner_ext)

Title: Re: fpgui support full theming ?!!
Post by: ROCABDEL on December 17, 2013, 08:53:13 pm
Hi All.

Nice Work Fred vS  ;)

In Attachments four others styles for fpgui :   
  - Plastic Dark
  - Plastic Dark Gray
  - Plastic Medium Gray
  - Plastic Light Gray 
+ some modifications on Carbon style
+ compiled exe demo

I hope you will like it  :)
Title: Re: fpgui support full theming ?!!
Post by: airpas on December 17, 2013, 09:30:11 pm
ROCABDEL  wow . looking pretty good . Yourr example completely changed my mind about fpgui
Title: Re: fpgui support full theming ?!!
Post by: Fred vS on December 18, 2013, 02:29:38 pm
@ Rocabdel : waooow, super, please, give it to Graeme...

Hum, there is a new patch for Lazarus.

Now uidesigner_ext is WYSIWYG "vice-verse".

You may try it, it is really awesome (i think).

First, apply the patch for your IDE.

>> https://github.com/fredvs/uidesigner_ext (https://github.com/fredvs/uidesigner_ext)

Explanations how to do is here :
>> http://forum.lazarus.freepascal.org/index.php/topic,12481.msg136323.html#msg136323 (http://forum.lazarus.freepascal.org/index.php/topic,12481.msg136323.html#msg136323)

Now, run Lazarus, load a fpGUI souce file and, in code-editor,
change something in auto-created fpGUI code (in form.AfterCreate).
(There is a template to try in uidesigner_ext/template.)

Press on Ctrl+S, you gonna see that, in uidesigner, the graphic change is
applied.

Also, if you change something in your form with uidesigner (and do not save
with uidesigner) and go back in source editor, if you press Ctrl+S, your form
will become like it was before changes with uidesigner.

All that awesome features of fpGUI announce a future "UNDO" part for
uidesigner (like Delphi does...).

Yep. ;-)
Title: Re: fpgui support full theming ?!!
Post by: Dibo on December 18, 2013, 06:23:14 pm
@ROCABDEL: Respect! :o
And this is done by standard fpGUI render engine. I can't imagine what you could do with fpAgg. Graeme, you should add them into repository
Title: Re: fpgui support full theming ?!!
Post by: Graeme on December 18, 2013, 09:32:40 pm
In Attachments four others styles for fpgui :   
  - Plastic Dark
  - Plastic Dark Gray
  - Plastic Medium Gray
  - Plastic Light Gray 
Fantastic work! I was only going to add the Carbon theme to the fpGUI repository, but do you mind if I add the remaining ones too. They all look really nice!

ps:
Last night I made some more improvements to widget painting by taking the theme settings into consideration - instead of hard-coded values. Last remaining widget is the control frame painting of the treeview widget. Then I'll add the Carbon (and others if you are okay with it).

Cheers,
  Graeme
Title: Re: fpgui support full theming ?!!
Post by: Graeme on December 18, 2013, 09:34:29 pm
Graeme, you should add them into repository
Awaiting approval from ROCABDEL. :)  He is doing a fantastic job - I'm very impressed.
Title: Re: fpgui support full theming ?!!
Post by: ROCABDEL on December 18, 2013, 11:22:12 pm
Hello^

Thank you so much friends. I'm glad you appreciate my work  :) other styles are in developing  ;)

Then I'll add the Carbon (and others if you are okay with it).

Awaiting approval from ROCABDEL. :)  He is doing a fantastic job - I'm very impressed.

Yes you can add them into repository, and you can even change what you want, it will give me great pleasure Graeme  :)

My best regards.
Title: Re: fpgui support full theming ?!!
Post by: Graeme on December 23, 2013, 12:40:16 am
Yes you can add them into repository, and you can even change what you want, it will give me great pleasure Graeme  :)
Thanks. Added to the 'develop' branch as commit b5a9e3c.
Title: Re: fpgui support full theming ?!!
Post by: airpas on December 23, 2013, 09:43:24 am
i think there is a bug somewhere ,  in the example of ROCABDEL  go to TabSheet2 and drag the spliter many time  faster  , you'll get a messy drawing widgets.

like this 
Title: Re: fpgui support full theming ?!!
Post by: Graeme on December 23, 2013, 10:59:07 am
i think there is a bug somewhere ,  in the example of ROCABDEL  go to TabSheet2...
Thanks for reporting your issue. To look at the issue, I would require a bit more information. Are you simply running the executable posted by ROCABDEL, or are you compiling the demo project yourself with the latest fpGUI? Can you also give me as much of the following details please... OS, OS Version, Graphics drivers, FPC version, fpGUI version (v1.0 or latest 'develop' branch) etc.
Title: Re: fpgui support full theming ?!!
Post by: airpas on December 23, 2013, 12:43:04 pm
sure
just runing the exe posted above .
OS : Win7 32bits

i don't think its related to graphic driver , since i can reproduce the problem in 4 different PC's 
to reproduce , as i said drag the splitter right and left (drag until go outside of the form ) . do it quickly many times
Title: Re: fpgui support full theming ?!!
Post by: engkin on December 23, 2013, 04:09:11 pm
I did see what airpas has described. I noticed that the scroll bars start getting black color first then the lines used to connect entries in the tree do not get drawn then the drawing gets missed up the way the pictures showed. I ran Windows Task Manager and when added GDI Objects to the visible columns (View - Select Columns) I noticed that the objects keep increasing and when they reached close to 10000 objects problems started to show up. That is in accordance with the settings in my registry:

Quote
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\GDIProcessHandleQuota = 10000

Moving the splitter faster just gets you quickly to that point but that is not the only way.
Title: Re: fpgui support full theming ?!!
Post by: ROCABDEL on December 25, 2013, 11:39:51 pm
Thanks. Added to the 'develop' branch as commit b5a9e3c.

Thank you Graeme   :)
Title: Re: fpgui support full theming ?!!
Post by: Graeme on December 27, 2013, 01:48:10 am
sure
just runing the exe posted above .
OS : Win7 32bits
Thanks for the feedback. My initial tests show that it is a Windows specific bug - thus in the fpg_gdi.pas backend. Testing under Linux and FreeBSD had no such painting problems. I'll investigate the GDI backend further.
Title: Re: fpgui support full theming ?!!
Post by: Graeme on January 25, 2014, 04:50:45 pm
In Attachments four others styles for fpgui :   
  - Plastic Dark
  - Plastic Dark Gray
  - Plastic Medium Gray
  - Plastic Light Gray 
Can you explain what you tried to achieve by overriding DrawString() in your themes? Your current implementation affects the display of PDF Previewed reports. ie: Say my report has a red title, with the above themes all text are always painted in a light gray. Also your theme overrides the TfpgHyperLink Text and HotText color.

For the latter (hyperlink widget) I introduced a new clHyperLink named color in fpGUI - so that makes it easier to override in themes.

Though I still don't think forcing text color changes in themes (the way you implemented it) is the right way to go. Some users might use colored text in there UI for a specific reason. Your current implementations disallows that.

If the reason for overriding DrawString() was due to some limitation in fpGUI Styles, please let me know so we could try and resolve it accordingly.
Title: Re: fpgui support full theming ?!!
Post by: ROCABDEL on April 13, 2014, 01:51:22 pm
Hi Graeme.

firstly sorry for the delay, I was not available these days.  :-[

Can you explain what you tried to achieve by overriding DrawString() in your themes?
...
If the reason for overriding DrawString() was due to some limitation in fpGUI Styles, please let me know so we could try and resolve it accordingly.

because I can not change the color of text in TfpgPopupCalendar the text are always painted in black.

I introduced a new clHyperLink named color in fpGUI - so that makes it easier to override in themes.

great initiative, I am very impressed for progress "i follow closer the progress in fpgui2  ;)"...



I just sent you a patch to correct the text color and add a custom checkbox for both carbon and plasic themes on your gmail.

Many thanks friends!!

Here's what it looks like

Title: Re: fpgui support full theming ?!!
Post by: engkin on April 14, 2014, 07:31:51 am
GDI leak in TfpgGDIImage (\fpgui-1.0\src\corelib\gdi\fpg_gdi.pas). It does not call DoFreeImage nor does its ancestor class TfpgImageBase in its TfpgImageBase.FreeImage (the call to DoFreeImage is commented out for some reason).
TinyPortal © 2005-2018