Skip to content
⌘ NSIS Forum Archive

New plugin VCL Styles for NSIS

40 posts

RRUZ#edited

New plugin VCL Styles for NSIS

I just upload a new plugin for NSIS, called VCL Styles for NSIS you can found more info about this on my blog post http://theroadtodelphi.wordpress.com...yles-for-nsis/ any feedback is welcome.










Rodrigo.
RRUZ#
Originally Posted by Pawel View Post
Hey Rodrigo,
Good job! I made a quick test and it works great.
-Pawel
Thanks, you are welcome.
JasonFriday13#
Cool plugin. One thing I noticed that could be improved is instead of using $TEMP, use $PLUGINSDIR, as it's automatically deleted when the installer closes (great for files that only the installer uses).

Example:
Function .onInit
InitPluginsDir
;Get the skin file to use
File /oname=$PLUGINSDIR\Amakrits.vsf "..\Styles\Amakrits.vsf"
;Load the skin using the LoadVCLStyleA function
NSISVCLStyles::LoadVCLStyleA /NOUNLOAD $PLUGINSDIR\Amakrits.vsf
FunctionEnd
Function un.onInit
InitPluginsDir
File /oname=$PLUGINSDIR\Amakrits.vsf "..\Styles\Amakrits.vsf"
NSISVCLStyles::LoadVCLStyleA /NOUNLOAD $PLUGINSDIR\Amakrits.vsf
FunctionEnd
Also, if you use the plugin api properly, you can automate the unloading of the dll and get rid of the /NOUNLOAD switch, this is relatively easy using C but I see you're using Delphi, so I don't know if it supports the full plugin api that plugins written in C have access to.
RRUZ#
Originally Posted by JasonFriday13 View Post
Cool plugin. One thing I noticed that could be improved is instead of using $TEMP, use $PLUGINSDIR, as it's automatically deleted when the installer closes (great for files that only the installer uses).

Example:

Also, if you use the plugin api properly, you can automate the unloading of the dll and get rid of the /NOUNLOAD switch, this is relatively easy using C but I see you're using Delphi, so I don't know if it supports the full plugin api that plugins written in C have access to.
Thanks for your suggestions. About the /NOUNLOAD switch is need because the Dll must remain in memory (until the installer is closed) in order to hook and skin the controls of the installer.
JasonFriday13#
I had a quick look at 'nsis.pas' and came across this:
...
type
PluginCallbackMessages = (
NSPIM_UNLOAD, // This is the last message a plugin gets, do final cleanup
NSPIM_GUIUNLOAD, // Called after .onGUIEnd
);
TNSPIM = NSPIM_UNLOAD..NSPIM_GUIUNLOAD;
...
TRegisterPluginCallback = function (const DllInstance: HMODULE; const CallbackFunction: Pointer): Integer; stdcall;
...
extrap_t = record
exec_flags: Pointer; // exec_flags_t;
exec_code_segment: Pointer; // TFarProc;
validate_filename: Pointer; // Tvalidate_filename;
RegisterPluginCallback: Pointer; //TRegisterPluginCallback;
end;
...
So it looks like Delphi does support the plugin api fully. I'm just saying that nsis controls plugin unloading, because /NOUNLOAD is now deprecated (it's still supported for backwards compatibility). From the nsis 2.42 docs, 20 December 2008:
F.8.1 Release Notes
Merry Christmas and a happy Hanukkah!
Plug-in developers should check out the new plug-in API in Examples\Plugin and convert their plug-ins, especially in case they require staying loaded.
F.8.2 Changelog
F.8.2.1 Major Changes
Deprecated /NOUNLOAD and SetPluginsUnload to make scripts simpler and safer (patch #1912699)
Useful header functions no longer require usage declaration and different syntax for uninstaller functions
Revamped plug-in API now comes in the form of pluginapi.lib, API version information and more common functions (patch #2359978)
RRUZ#
Originally Posted by JasonFriday13 View Post
I had a quick look at 'nsis.pas' and came across this:

So it looks like Delphi does support the plugin api fully. I'm just saying that nsis controls plugin unloading, because /NOUNLOAD is now deprecated (it's still supported for backwards compatibility). From the nsis 2.42 docs, 20 December 2008:
Ok, I will check that. Thanks very much for the feedback.
ZmAn3#
very nice 🙂 however to those of you that understand C++ and delphi cause I do not I'm looking for a plugin like the linker plugin or a change to nsdialogs that subclasses a static control to detect mouse in a mouse out because you can use static Controls as buttons with the onclick event and and you can also swap the images with a onclick event but it would be nice to be able to swap the images on mouse over and mouse out then you can make buttons look like anything and any size.. just throwing it out there cause i cant figure it out

Edit thats the first time ive seen the progress bar styled any possibility of a plugin just for that?
JasonFriday13#
Also I noticed the installer doesn't fully respect the install directory chosen:
...
Extract: TurquoiseGray.vsf... 100%
Extract: YellowGraphite.vsf... 100%
Output folder: C:\Program Files (x86)\NSIS\Plugins
Extract: NSISVCLStyles.dll... 100%
Output folder: C:\Program Files XP\The Road To Delphi\NSISVCLStyles\Scripts
Extract: example1.nsi... 100%
Extract: example1_SkinUninstaller.nsi... 100%
...
Use this to get the nsis directory (this will set the error flag if the key doesn't exist):
ReadRegStr $0 HKLM "Software\NSIS" ""
Also, I noticed that this plugin supports nsis 3.0a0 and up, just be aware that 3.0a0 natively supports unicode installers and plugins too, and in the future will support 64 bit installers as well.
JasonFriday13#
Originally Posted by ZmAn3 View Post
Edit thats the first time ive seen the progress bar styled any possibility of a plugin just for that?
I've done it as part of one of my plugins (http://nsis.sourceforge.net/SpiderBanner_plug-in), though custom styles will need the painting routine changed to suit, with a source bitmap for the style. I might spin it off to it's own plugin, I'll think about it.
RRUZ#
Originally Posted by JasonFriday13 View Post
I had a quick look at 'nsis.pas' and came across this:

So it looks like Delphi does support the plugin api fully. I'm just saying that nsis controls plugin unloading, because /NOUNLOAD is now deprecated (it's still supported for backwards compatibility). From the nsis 2.42 docs, 20 December 2008:
Ok, I just updated the plugin with support for the new plugin NSIS API, so the /NOUNLOAD is not necessary now. Also I updated the nsis.pas file to make compatible with the new Delphi versions (UNICODE). Thanks again for your advices 🙂
RRUZ#
Originally Posted by ZmAn3 View Post
very nice 🙂 however to those of you that understand C++ and delphi cause I do not I'm looking for a plugin like the linker plugin or a change to nsdialogs that subclasses a static control to detect mouse in a mouse out because you can use static Controls as buttons with the onclick event and and you can also swap the images with a onclick event but it would be nice to be able to swap the images on mouse over and mouse out then you can make buttons look like anything and any size.. just throwing it out there cause i cant figure it out

Edit thats the first time ive seen the progress bar styled any possibility of a plugin just for that?
Sure the plugin source code can be modified to only skin the progress bar, but unfortunately Delphi produces very big binaries, so the final size of the plugin will be too big for only one feature like skin the progress bar.
ZmAn3#
Originally Posted by JasonFriday13 View Post
I've done it as part of one of my plugins (http://nsis.sourceforge.net/SpiderBanner_plug-in), though custom styles will need the painting routine changed to suit, with a source bitmap for the style. I might spin it off to it's own plugin, I'll think about it.
Nice if you do please let me know also i'm thinking I can fake it by preloading bmps before the nsdialogs show and updating the static control
T.Slappy#
Woow, really nice!

This plug-in reminds me Wansis (or something similar) which had the same functionality but your solution looks nice and clear.
stass#
RRUZ
Is it possible to reduce the size of NSISVCLStyles.dll ? Very large ... (compared with the famous SkinH.dll )
Pawel#
Rodrigo,
Your installer still copy the plugin to bad directory. Now, it is copied to:
\NSIS\Plugins

I use not default NSIS installation dir (\NSIS_3)

Installer should copy the plugin to NSIS installation dir, you can grab its location from this registry entry:
HKLM -> Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS -> InstallLocation

However, you should also check if NSIS is 3.0 +, because as you know, there are 2 plugins directories, for ANSI and Unicode. So for:
- NSIS 2.46 and older: NSIS_DIR\Plugins
- NSIS 3.0 and newer: NSIS_DIR\Plugins\x86-ansi and NSIS_DIR\Plugins\x86-unicode

Ps: Your plugin support Unicode?

-Pawel
RRUZ#
Originally Posted by Pawel View Post
Rodrigo,
Your installer still copy the plugin to bad directory. Now, it is copied to:
\NSIS\Plugins

I use not default NSIS installation dir (\NSIS_3)

Installer should copy the plugin to NSIS installation dir, you can grab its location from this registry entry:
HKLM -> Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS -> InstallLocation

However, you should also check if NSIS is 3.0 +, because as you know, there are 2 plugins directories, for ANSI and Unicode. So for:
- NSIS 2.46 and older: NSIS_DIR\Plugins
- NSIS 3.0 and newer: NSIS_DIR\Plugins\x86-ansi and NSIS_DIR\Plugins\x86-unicode

Ps: Your plugin support Unicode?

-Pawel
Pawel, Thanks for your feedback. I just modified the installer to use the proper plugin folder depending of the NSIS version, also I added UNICODE support.
RRUZ#
Originally Posted by stass View Post
RRUZ
Is it possible to reduce the size of NSISVCLStyles.dll ? Very large ... (compared with the famous SkinH.dll )
No for the moment. The plugin was written using Delphi which produces big binaries files 🙁, anyway the plugin only adds 550 Kb to the final installer when is compressed using lzma.
shadowpoa#
Originally Posted by ZmAn3 View Post
very nice 🙂 however to those of you that understand C++ and delphi cause I do not I'm looking for a plugin like the linker plugin or a change to nsdialogs that subclasses a static control to detect mouse in a mouse out because you can use static Controls as buttons with the onclick event and and you can also swap the images with a onclick event but it would be nice to be able to swap the images on mouse over and mouse out then you can make buttons look like anything and any size.. just throwing it out there cause i cant figure it out

Edit thats the first time ive seen the progress bar styled any possibility of a plugin just for that?
Try using WndSubclass, I have posted an example of handling control events (and mouse events to a specific control) at this thread:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.
Pawel#
Rodrigo,
Could you check this behavior?
When I run installer and try to close it using top button (http://www.meggamusic.co.uk/shup/1390594760/buttons.png) it shows a dialog. When I click Cancel, it should close the dialog - but it displays the same dialog again.

Second problem is when I click Minimise button, my installer crashes (displays standard windows error message - > it is with Amakrits.vsf skin, it is not happen with BlueGraphite.vsf - didn't test any other).

-Pawel

Ps: I like the plugin, so I am sure I will post more problems
RRUZ#
Originally Posted by Pawel View Post
Rodrigo,
Could you check this behavior?
When I run installer and try to close it using top button (http://www.meggamusic.co.uk/shup/1390594760/buttons.png) it shows a dialog. When I click Cancel, it should close the dialog - but it displays the same dialog again.

Second problem is when I click Minimise button, my installer crashes (displays standard windows error message - > it is with Amakrits.vsf skin, it is not happen with BlueGraphite.vsf - didn't test any other).

-Pawel

Ps: I like the plugin, so I am sure I will post more problems
Pawel , thanks very much for your feedback. I will check it. Can you please use the issue page of the project to report future issues http://code.google.com/p/vcl-styles-utils/issues/list

Rodrigo.
RRUZ#
Originally Posted by Pawel View Post
Rodrigo,
Could you check this behavior?
When I run installer and try to close it using top button (http://www.meggamusic.co.uk/shup/1390594760/buttons.png) it shows a dialog. When I click Cancel, it should close the dialog - but it displays the same dialog again.

Second problem is when I click Minimise button, my installer crashes (displays standard windows error message - > it is with Amakrits.vsf skin, it is not happen with BlueGraphite.vsf - didn't test any other).

-Pawel

Ps: I like the plugin, so I am sure I will post more problems
Pawel, I just fix the first issue (a new version is available), but I can't reproduce the bug with the minimize button, can you please post more details about how reproduce the problem in the issue page of the project.

Rodrigo.
JasonFriday13#
Also, I noticed that unicode.nsi is utf8. NSIS 3.0a0 supports several source file character encodings (ansi, utf8, utf16le, maybe others too), so the source files can still be ansi and it will produce a unicode installer, provided 'Unicode True' is used in the script. The opposite is true too, a unicode script can produce an ansi installer (with ansi limitations, obviously).
Pawel#
I would like to ask about custom NSIS pages generated using nsDialogs with VCL Styles.

Custom pages may have own text, with different font size, colour etc...
I see that VCL styles disables it all. When I use VCL Styles plugin, it makes my nsdialogs custom page using one font size, colour etc...
Here is an example: http://www.meggamusic.co.uk/shup/1390657070/DIff.png

Is it possible to use nsDialogs with VCL Styles plugin?
How to make text bold, bigger font etc... as it seems the plugin broke it.
-Pawel
RRUZ#
Originally Posted by JasonFriday13 View Post
Also, I noticed that unicode.nsi is utf8. NSIS 3.0a0 supports several source file character encodings (ansi, utf8, utf16le, maybe others too), so the source files can still be ansi and it will produce a unicode installer, provided 'Unicode True' is used in the script. The opposite is true too, a unicode script can produce an ansi installer (with ansi limitations, obviously).
The plugin has no assumptions about the encoding of the script (file), only need to be initialized with the proper function (LoadVCLStyleA or LoadVCLStyleW) depending of the Value of Unicode property.

P.S : I just updated the documentation to avoid confusion about this topic.
RRUZ#
Originally Posted by Pawel View Post
I would like to ask about custom NSIS pages generated using nsDialogs with VCL Styles.

Custom pages may have own text, with different font size, colour etc...
I see that VCL styles disables it all. When I use VCL Styles plugin, it makes my nsdialogs custom page using one font size, colour etc...
Here is an example: http://www.meggamusic.co.uk/shup/1390657070/DIff.png

Is it possible to use nsDialogs with VCL Styles plugin?
How to make text bold, bigger font etc... as it seems the plugin broke it.
-Pawel
Effectively the plugin skin every single control no matter the font or color. This is the way how it works. But soon I will introduce a new feature to disable the skin in a control.

Rodrigo.

P.S : I fixed your reported issue http://code.google.com/p/vcl-styles-...s/detail?id=27
JasonFriday13#
Originally Posted by RRUZ View Post
The plugin has no assumptions about the encoding of the script (file), only need to be initialized with the proper function (LoadVCLStyleA or LoadVCLStyleW) depending of the Value of Unicode property.

P.S : I just updated the documentation to avoid confusion about this topic.
The other way to get round this is to omit the 'A' or 'W' suffix (LoadVCLStyle), because the 3.0a0+ compiler automatically uses the required type based on the Unicode flag (because the directories for 3.0a0+ are separated to ansi and unicode). You can do this in the plugin source by using an 'ifdef, else' tag (example is in C):
#ifdef _UNICODE
__declspec(dllexport) void ShowPBOnly(HWND hwndParent, int string_size, wchar_t *variables, stack_t **stacktop, extra_parameters* xp)
#else
__declspec(dllexport) void ShowPBOnly(HWND hwndParent, int string_size, char *variables, stack_t **stacktop, extra_parameters* xp)
#endif
My plugins use a TCHAR type so I can get away with using one declaration for both ansi and unicode versions. All the plugins included with nsis have single declarations in their source code too. This lets nsis handle the version selection so the script writer doesn't have to change it all the time.

This is a useability suggestion so that the user doesn't have to change the plugin call to compile a unicode version.
RRUZ#
Originally Posted by JasonFriday13 View Post
The other way to get round this is to omit the 'A' or 'W' suffix (LoadVCLStyle), because the 3.0a0+ compiler automatically uses the required type based on the Unicode flag (because the directories for 3.0a0+ are separated to ansi and unicode). You can do this in the plugin source by using an 'ifdef, else' tag (example is in C):

My plugins use a TCHAR type so I can get away with using one declaration for both ansi and unicode versions. All the plugins included with nsis have single declarations in their source code too. This lets nsis handle the version selection so the script writer doesn't have to change it all the time.

This is a useability suggestion so that the user doesn't have to change the plugin call to compile a unicode version.
Thanks for the suggestion. I will make this change ASAP. btw can you tell me how this plugin can be included and listed on the http://nsis.sourceforge.net/Category:Plugins page?

Rodrigo.
RRUZ#
Originally Posted by JasonFriday13 View Post
The other way to get round this is to omit the 'A' or 'W' suffix (LoadVCLStyle), because the 3.0a0+ compiler automatically uses the required type based on the Unicode flag (because the directories for 3.0a0+ are separated to ansi and unicode). You can do this in the plugin source by using an 'ifdef, else' tag (example is in C):

My plugins use a TCHAR type so I can get away with using one declaration for both ansi and unicode versions. All the plugins included with nsis have single declarations in their source code too. This lets nsis handle the version selection so the script writer doesn't have to change it all the time.

This is a useability suggestion so that the user doesn't have to change the plugin call to compile a unicode version.
Thanks for the suggestion, I will make this change ASAP. btw can you tell me how this plugin can be listed (included) in the NSIS plugins page?

Rodrigo.