wansis

Introduction

wansis is a NSIS plugin which allows you to skin your NSIS installer like in Winamp.

Picture of wansis in action Picture of wansis in action (w/ Modern UI)

wansis uses the same skins that Winamp uses except it only uses the gen.bmp and genex.bmp bitmaps. It also adds two new functionalities to the installer:

  • Installer has a Opacity submenu in the system menu (or window menu).
    Here you can choose the opacity of the installer.
  • The installer frame snaps to the screen edges when it is within 10 pixels of reach.

How to use

This does not try to be a tutorial. It only gives you the facts about wansis.

Using the included macro system, it should be a walk in the park to skin your NSIS installer.

Macro system

!include "wansis.nsh"

Rigging it

In your .onInit callback function, extract the skin bitmaps using the INCLUDESKIN macro.

Function .onInit
  ; This includes the skin bitmaps.
  ; You only need to pass the skin name.
  ; The macro appends _gen.bmp and _genex.bmp to it.
  ${INCLUDESKIN} nonstep
FunctionEnd

If you got the skin bitmaps located outside you script dir, then you must !define INCLUDESKIN_PATH with the path.

!define INCLUDESKIN_PATH myskins

Making it shine

In the .onGUIInit callback function it is time to let wansis do the work.

Function .onGUIInit
  ${SKINIT} nonstep
FunctionEnd

Tweaking it

If you don't want to put an Opacity submenu on the system menu of the installer and/or let the installer snap to the screen edges you can use the SKINCONFIG macro.

; Leave Oapcity menu as it is but don't snap to edges of screen
  ${SKINCONFIG} 1 0
; No snapping and no opacity submenu
  ${SKINCONFIG} 0 0

If you still didn't figure this out, here goes:

  ${SKINCONFIG} [opacity submenu flag] [snap flag]

Shutting down

In the .onGUIEnd callback function it is time to kill wansis.
You must do this in order for the temporary directory to be deleted.

Function .onGUIEnd
  ${UNSKINIT}
FunctionEnd

Skin specs

  1. gen.bmp has a generic window frame for plugins to use. its format is similar to the minibrowser's. In addition gen.bmp includes a font for the titlebar, in both highlight and no-highlight modes. The font is variable width, and it uses the first color before the letter A as the delimiter. The no-highlight form of letter must be the same width as the highlight form.
  2. genex.bmp has button and scrollbar images, as well as some individual pixels that describe the colors for the dialog. The button and scrollbar images should be self explanatory (note that the buttons have 4 pixel sized edges that are not stretched, and the center is stretched), and the scrollbars do something similar. The colors start at (48,0) and run every other pixel. The meaning of each pixel is:
    • x=48: item background (background to edits, listviews etc)
    • x=50: item foreground (text color of edit/listview, etc)
    • x=52: window background (used to set the bg color for the dialog)
    • x=54: button text color
    • x=56: window text color
    • x=58: color of dividers and sunken borders
    • x=60: selection color for playlists
    • x=62: listview header background color
    • x=64: listview header text color
    • x=66: listview header frame top color
    • x=68: listview header frame middle color
    • x=70: listview header frame bottom color
    • x=72: listview header empty color
    • x=74: scrollbar foreground color
    • x=76: scrollbar background color
    • x=78: inverse scrollbar foreground color
    • x=80: inverse scrollbar background color
    • x=82: scrollbar dead area color
    • x=84: listview/treeview selection bar text color (active)
    • x=86: listview/treeview selection bar back color (active)
    • x=88: listview/treeview selection bar text color (inactive)
    • x=90: listview/treeview selection bar back color (inactive)

Included skins

When you installed wansis, you could choose whether to install a skin pack or not.
The skins are located in the NSIS\3rdparty\wansis\skins folder.
The included skins are (click to display its gen.bmp):

ZmAn3 also contributed some themes (includes matching wizard, header bitmaps and icons as well):

I reserved the right to extract the gen.bmp and genex.bmp bitmaps from the Winamp 2.x skins with the same names. All honour to the respective authors.

Skin selection dialog

Using the LangDLL's LangDialog function you can present a nice dialog to the user where he/she can select a skin.

  ; Using the powers of LangDLL to select skin. Whoaw!!
  LangDLL::LangDialog "Select skin???" \
  "Select the skin you would like the installer \
   to have (leave empty to use no skin):" \
  A \
  "NSIS"                   "nsis" \
  "Winamp 2.x style"       "winamp" \
  "Nucleo N-Log"           "nlog" \
  "Majestic"               "majestic" \
  "Nonstep"                "nonstep" \
  "Linkin Park (Blue)"     "linkinpark" \
  "Nemish"                 "nemish" \
  "GG Error"               "ggerror" \
  "Akura Isotanium"        "akuraisotanium" \
  "Kyaela"                 "kyaela" \
  "Steel"                  "steel" \
  "Do not skin"            "none" \
  "" ;end

  Pop $0
  StrCmp $0 "cancel" 0 +3
    Abort
  StrCmp $0 "" end 0
  StrCmp $0 "none" end 0

  ${SKINIT} $0

  end:

The code above must be place in the .onGUIInit function. You must ofcourse use the INCLUDESKIN macro to include all the skins in your installer.

Download

Download wansis here: http://saivertweb.no-ip.com/nsis/wansis/wansis.7z

Version history

  • Version 1.3 (Fri. 7/19/2005)
    • Fixed: Install button on instfiles page now stays skinned even after using the browse button.
    • Fixed: Documentation cleaned and updated. Removed comments on top.
    • Fixed: wansis now unloads properly so $PLUGINSDIR directory can be deleted when installer quits.
    • Added: ZmAn3's themes are now bundled with wansis
  • Version 1.2 (Fri. 7/15/2005)
    • Finally implemented skinned scrollbars. Uses CoolSB_detours.lib for this and the NM_COOLSB_CUSTOMDRAW handler from Safai Ma's Album List 2 plug-in for Winamp.
  • Version 1.1 (Tue. 13/4/2003)
    • Need to include a lot more skins. Package may become very large eventually, and I need to provide a skin site (maybe involve DeviantArt and others).
    • I'm wokring on code that copies system menu items from NSIS installer dialog, to the skinned frame window.
    • Do you got any ideas of your own??
  • Version 1.0 (Mon. 12/4/2003)
    • First public release!
    • Still need to fine-tune some parts.
    • I have used "AgressiveOptimize.h" to combine code segments but, if someone have any ideas how to shrink DLL size more than this, send me an e-mail.

Known bugs list

  • Scroll bars are currently not skinned. I have tried the Flat Scrollbar APIs, but that didn't do the trick.
  • If another NSIS plug-in modifies the system menu of the installer (adds its own items). It will not show up in the system menu of the skinned installer because the NSIS installer dialog (hwndParent) is made child window of a new frame window created by wansis. I'm working on a solution for this. Maybe clone the system menu and pass WM_SYSCOMMAND messages to NSIS dialog.

Credits

Written by Saivert
Uses wa_dlg.h courtesy of Nullsoft, Inc.
Thanks to Joost Verburg for readme HTML page design.

License

Portions Copyright © 2002-2003:
- Nullsoft, Inc.

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented;
   you must not claim that you wrote the original software.
   If you use this software in a product, an acknowledgment in the
   product documentation would be appreciated but is not required.
2. Altered versions must be plainly marked as such,
   and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any distribution.