Old 24th April 2011, 23:24   #1
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
Aero plug-in



Enables Windows Aero glass effect on NSIS (outer) UI.

http://nsis.sf.net/File:Aero.zip

Edit: Worth noting this plug-in does nothing on < Vista or when DWM composition (glass) is disabled on installer init. The plug-in handles theme changes once it has been loaded (i.e. reverts to original UI if glass is disabled).

Stu
Afrow UK is offline   Reply With Quote
Old 25th April 2011, 05:44   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Looks very nice indeed, thanks for sharing!
MSG is offline   Reply With Quote
Old 26th April 2011, 05:57   #3
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 506
Send a message via ICQ to T.Slappy
hah, funny I will try it!

Cool looking skinned Graphical Installers: www.graphical-installer.com
I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsignedsw.com
Develop NSIS projects in Visual Studio 2005-2017: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.2 Tokyo: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 28th April 2011, 11:52   #4
Smurge
Junior Member
 
Join Date: Apr 2008
Posts: 21
nice plug-in, thank you very much!
Smurge is offline   Reply With Quote
Old 28th April 2011, 12:14   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,588
I made a plugin similar to this a while back but I never got around to posting it since I could not find a documented value to use for the text glow size. Did you just make one up or what?

I guess I don't have to complete my version now, thanks Afrow =)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 28th April 2011, 13:05   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
Just used 10. You can actually get the glow size from the current theme using another API so I may change it.

I've had a report of the button text being transparent on one or two machines which doesn't seem to happen on any of mine so I might need to fix that soon. When you use the branding text with glow, it has to paint a black brush where the aero is but that results in the button text being transparent too (looks awful) and therefore I've had to do some simple button drawing myself (using WM_PAINTCLIENT). To fix the button text at the moment I'm just using WM_PAINTCLIENT onto the current DC's HBRUSH (this seems to work fine for me - but I don't really know why lol). However, I may have to use double buffering (BeginBufferedPaint) with a portion with full opacity (BufferedPaintSetAlpha) to fix properly. Will post new version today probably. Other option is owner draw the buttons but I want to avoid that. I'd rather let Windows do it for me (WM_PAINTCLIENT).

Stu
Afrow UK is offline   Reply With Quote
Old 28th April 2011, 21:17   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
New version uploaded which uses the glow size for the current theme and fixes the button text transparency bug on some systems.

FYI to get the glow size (12 by default) you use GetThemeInt with TMT_TEXTGLOWSIZE. The theme I used is "CompositedWindow::Window".

Probably worth mentioning also that if you use /nobranding then because the plug-in does not need to draw any glow text, it doesn't need to use a black brush for the aero (I use magic pink instead with SetLayeredWindowAttributes/LWA_COLORKEY). As a result, the buttons are untouched and therefore you get the proper button glow fade in/out on mouse in/out. Owner-drawn or WM_PAINT handled buttons lose this fade in/out unfortunately and there's nothing one can do about it. Even .NET apps loses this effect if you set UseCompatibleTextRendering=true for buttons. The missing effect is not noticeable though (unless you're me lol) so branding text is on by default .

Stu
Afrow UK is offline   Reply With Quote
Old 2nd May 2011, 23:53   #8
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,588
Is SetLayeredWindowAttributes + DwmExtendFrameIntoClientArea a valid thing to do? IIRC SetLayeredWindowAttributes had problems with the DWM in the early Vista days.


You are using "CompositedWindow::Window" when loading and "Window" in WM_THEMECHANGED, this can't be correct can it?


Also, you are hard-coding a 2px change in what I assume is some sort of button border hack? What about alternative Visual Styles?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd May 2011, 11:58   #9
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
Quote:
Originally Posted by Anders View Post
Is SetLayeredWindowAttributes + DwmExtendFrameIntoClientArea a valid thing to do? IIRC SetLayeredWindowAttributes had problems with the DWM in the early Vista days.


You are using "CompositedWindow::Window" when loading and "Window" in WM_THEMECHANGED, this can't be correct can it?


Also, you are hard-coding a 2px change in what I assume is some sort of button border hack? What about alternative Visual Styles?
1. I've tested on Vista and it seems to work OK. Maybe I shouldn't bother though and just go with the black brush method. Both methods are written about by Microsoft developers though IIRC.

2. Well spotted. Will fix.

3. Yes. I'm having to set the inner part of the button to opaque to fix the black->transparent button text. I originally used 4px but 2px seems to be the minimum. I never thought of other themes. Not sure if there is a better way to do this without having to draw the button myself. Any ideas?

Stu
Afrow UK is offline   Reply With Quote
Old 3rd May 2011, 12:11   #10
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,588
In my plugin I use one of the theme api's to calculate the size of the button IIRC

Also, you are destroying windows you don't own, this is not OK IMHO (In my Aero plugin I hide them and if aero is turned off, I display them again, 100% original layout in classic theme...)

As a final note; I don't really think "_WndProc_" is the best prop name to use, it is a bit generic, I'm using "NSIS:P:Aero", feel free to using something similar (or the same, both plugins should not be used at the same time anyway)

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd May 2011, 12:33   #11
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
So is that how your plug-in does the buttons too or does it owner-draw them?

Stu
Afrow UK is offline   Reply With Quote
Old 3rd May 2011, 13:03   #12
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,588
Quote:
Originally Posted by Afrow UK View Post
So is that how your plug-in does the buttons too or does it owner-draw them?
I use subclassing and WM_PRINT?CLIENT? like you do, but I use one of the GetThemeBackgroundSomething functions to calculate the area to mask off for the round corners.

I was going to look into adding the animation back but got bored and stopped working on the plugin...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd May 2011, 13:38   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
Is it GetThemeBackgroundRegion? How would that be used with BufferedPaintSetAlpha which requires a RECT?

Stu
Afrow UK is offline   Reply With Quote
Old 3rd May 2011, 13:42   #14
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,588
I'm thinking it was GetThemeBackgroundContentRect

But you should be able to get a RECT from HRGN also...

Or you can use the HRGN to mask off the HDC...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd May 2011, 19:36   #15
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
So far so good although I've just remembered why I had to destroy those controls instead of hiding them (at least for MUI). MUI hides/shows them itself when you enter/leave the welcome/finish pages. How did you overcome this or did you not notice this problem?

Stu
Afrow UK is offline   Reply With Quote
Old 3rd May 2011, 21:42   #16
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,588
I probably re-hide them on every page change...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 3rd May 2011, 22:19   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
In response to WM_NOTIFY_OUTER_NEXT? It seems that the show function gets called after that notification and so my attempts fail. Calling the old window procedure first also doesn't seem to work. I guess one option, which would also avoid any potential flickering of the controls being shown/hidden, would be to move them off the UI on plug-in load while saving their original positions...

Stu
Afrow UK is offline   Reply With Quote
Old 4th May 2011, 08:00   #18
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,351
here's what happens when defining MUI_BGCOLOR (mind the background of those buttons)
Attached Thumbnails
Click image for larger version

Name:	pb_aero.jpg
Views:	519
Size:	72.0 KB
ID:	48794  
Yathosho is offline   Reply With Quote
Old 4th May 2011, 08:38   #19
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
I'll look into it thanks.

Stu
Afrow UK is offline   Reply With Quote
Old 4th May 2011, 14:49   #20
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
New plug-in version (.2) uploaded. Still waiting for Yathosho to check his button issue is fixed though (but I can't seem to reproduce so perhaps it is fixed).

Fair number of changes/fixes:
Quote:
1.0.0.2 - 4th May 2011
* Fixed typo Window -> CompositedWindow::Window in WM_THEMECHANGED
(thanks Anders).
* Now uses theme text colour for branding text (but still original
font).
* Improved fall-back drawing if DWM composition is disabled (all drawing
then handled by Windows/NSIS).
* Now re-shows old branding text and horizontal ruler when DWM
composition is disabled.
* Plug-in now loads even if DWM composition is disabled, but could be
enabled.
* Now only handles WM_CTLCOLORBTN for the Back, Next and Cancel buttons.
* Now uses GetThemeBackgroundContentRect to determine the button area
to draw opaque.
Stu

Edit: Oh and I changed the button property names to _StuAeroWndProc_
Afrow UK is offline   Reply With Quote
Old 18th May 2011, 02:51   #21
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Xi'an, China
Posts: 206
Feedback for others:


Chinese charactor didn't display when using this plug-in.

Born in: Xi'an, China
Live in: Shanghai, China
Name: 賈可(zh-Hant, trad.), 贾可(zh-Hans, simp.), Jia Ke (Pinyin).
Email: jiake@vip.qq.com
QQ: 137729898
jiake is offline   Reply With Quote
Old 18th May 2011, 07:27   #22
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 506
Send a message via ICQ to T.Slappy
@jiake: Did you use Unicode NSIS?
I assume ANSI NSIS cannot display them correctly.

Cool looking skinned Graphical Installers: www.graphical-installer.com
I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsignedsw.com
Develop NSIS projects in Visual Studio 2005-2017: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.2 Tokyo: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 18th May 2011, 08:20   #23
jiake
Senior Member
 
jiake's Avatar
 
Join Date: Oct 2007
Location: Xi'an, China
Posts: 206
I have not used the plugin yet, for I am still using Windows XP.
The problem was found by other person, he lets me to feedback.

Born in: Xi'an, China
Live in: Shanghai, China
Name: 賈可(zh-Hant, trad.), 贾可(zh-Hans, simp.), Jia Ke (Pinyin).
Email: jiake@vip.qq.com
QQ: 137729898
jiake is offline   Reply With Quote
Old 18th May 2011, 10:54   #24
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
Currently using MultiByteToWideChar in the ANSI plug-in (DrawThemeTextEx is Unicode only) so this is likely the problem. I will change the code to avoid it when I have time (i.e. call GetWindowTextW).

Stu
Afrow UK is offline   Reply With Quote
Old 19th May 2011, 09:32   #25
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
New version uploaded which should fix your Chinese characters bug (I hope).
Quote:
1.0.0.3 - 19th May 2011
* Now always uses GetWindowTextW for the branding text (as DrawThemeTextEx is Unicode only).
Stu
Afrow UK is offline   Reply With Quote
Old 1st July 2011, 10:26   #26
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
New version:
Quote:
* Fixed transparent button text in some situations for Next/Back/Cancel buttons.
http://nsis.sourceforge.net/File:Aero.zip

Stu
Afrow UK is offline   Reply With Quote
Old 3rd July 2011, 21:23   #27
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,351
no longer got that problem with the latest build
Yathosho is offline   Reply With Quote
Old 4th July 2011, 21:44   #28
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,351
Quote:
Originally Posted by Afrow UK View Post
* Fixed transparent button text in some situations for Next/Back/Cancel buttons.
did anybody say transparency?
Attached Thumbnails
Click image for larger version

Name:	hmm.png
Views:	439
Size:	96.2 KB
ID:	48955  
Yathosho is offline   Reply With Quote
Old 6th July 2011, 05:15   #29
T.Slappy
Major Dude
 
T.Slappy's Avatar
 
Join Date: Jan 2006
Location: Slovakia
Posts: 506
Send a message via ICQ to T.Slappy
@Yathosho: MUI2 contains two dialogs: outer [which is transparent] and inner dialog [that grey area]
There is probably som problem with inner dialog transparency...

Cool looking skinned Graphical Installers: www.graphical-installer.com
I offer NSIS scripting, C/C++/C#/Delphi programming: www.unsignedsw.com
Develop NSIS projects in Visual Studio 2005-2017: www.visual-installer.com
or RAD Studio 2009, 2010, XE-10.2 Tokyo: www.rad-installer.com
T.Slappy is offline   Reply With Quote
Old 6th July 2011, 10:02   #30
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
I'm not sure what you are trying to do but you can't mix Aero with Windows controls without owner drawing them. I had to draw the navigation buttons myself to fix the transparency issue (and it still wasn't perfect until the last release). The problem is that the transparency key is black (and it has to be) and so all black objects (text etc.) will be rendered transparent.

Stu
Afrow UK is offline   Reply With Quote
Old 7th July 2011, 16:48   #31
Yathosho
Forum King
 
Yathosho's Avatar
 
Join Date: Jan 2002
Location: AT-DE
Posts: 3,351
Quote:
Originally Posted by Afrow UK View Post
I'm not sure what you are trying to do but you can't mix Aero with Windows controls without owner drawing them. I had to draw the navigation buttons myself to fix the transparency issue (and it still wasn't perfect until the last release). The problem is that the transparency key is black (and it has to be) and so all black objects (text etc.) will be rendered transparent.

Stu
this made the difference, not the colors
code:
#old code
ShowWindow $HWNDPARENT 2
BringToFront
Aero::Apply ;causes infrequent crashes

#new code
Aero::Apply ;causes infrequent crashes
ShowWindow $HWNDPARENT 2
BringToFront

Yathosho is offline   Reply With Quote
Old 7th July 2011, 19:40   #32
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Just noticed this plug-in. Great stuff. Thanks for sharing

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 8th July 2011, 10:24   #33
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
I haven't experienced any crashes. Please can you post a script which reproduces the problem.

Edit: and what is the minimize and bring to front for?

Stu
Afrow UK is offline   Reply With Quote
Old 8th July 2011, 13:05   #34
isawen
Junior Member
 
Join Date: Jan 2010
Posts: 39
Branding text on WelcomeFinish page

First of all I would like to give you a big for the great work you have made with this plugin.

And my question is ...
The branding text is displayed on WelcomeFinish page when Aero is activated; when Aero is deactivated, the branding text is hidden. I'm used to not have this branding text on the first and last page. Did you intend to have this branding text displayed while Aero is activated or it's a bug? Is there a way to not have it displayed on first&last page?

Thanks
Isawen

isawen is offline   Reply With Quote
Old 8th July 2011, 14:13   #35
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
At the moment the branding text is either drawn or it isn't. It's not a static text control, it is simply drawn where the original static text used to be. Because of this, MUI does not hide/show it. I will fix it when I have time.

Stu
Afrow UK is offline   Reply With Quote
Old 9th July 2011, 01:12   #36
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,588
Quote:
Originally Posted by Afrow UK View Post
Edit: and what is the minimize and bring to front for?

Stu
I'm guessing this fixes some kind of drawing bug...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 9th July 2011, 11:50   #37
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
Quote:
1.0.0.5 - 9th July 2011
* Branding text now hidden when branding text static text control is hidden.
Stu
Afrow UK is offline   Reply With Quote
Old 11th July 2011, 20:19   #38
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Is there any chance to have the branding text centered in "classic" UI?


My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Old 11th July 2011, 20:55   #39
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
Possibly but keep in mind there's a hidden Back button there so even if I do centre it it won't be centred in between Cancel and Close. The original branding text isn't centred IIRC it just happens to fit nicely for classic UI (when you have all 3 buttons).

Edit: It is in fact but still only centred between the 3 buttons.

Stu
Afrow UK is offline   Reply With Quote
Old 11th July 2011, 21:00   #40
LoRd_MuldeR
Major Dude
 
LoRd_MuldeR's Avatar
 
Join Date: Sep 2005
Location: Somewhere over the Slaughterhouse
Posts: 797
Quote:
Originally Posted by Afrow UK View Post
Possibly but keep in mind there's a hidden Back button there so even if I do centre it it won't be centred in between Cancel and Close. The original branding text isn't centred IIRC it just happens to fit nicely for classic UI (when you have all 3 buttons).

Edit: It is in fact but still only centred between the 3 buttons.

Stu
Yup, I know it's centered between the three buttons and still wouldn't be perfectly centered with only two buttons visible. Anyway, I think it looks better than glued to the left button. Also moving the buttons down by a few pixels wouldn't hurt (if possible).

Thanks

My Plugins: StdUtils | NSISList | CPUFeatures | ExecTimeout | KillProc
My source of inspiration: http://youtu.be/lCwY4_0W1YI
LoRd_MuldeR is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump