Making Custom Toolbars For Hotline

From Higher Intellect wiki
Jump to: navigation, search

Original document can be seen at https://cdn.preterhuman.net/texts/computing/hotline_info/Making_Custom_Toolbars.txt


Making Custom Toolbars For Hotline

A custom toolbar is a "Toolbar" file that you put in the same folder as the Hotline client, and when you start it up, the standard toolbar is gone and replaced with your too cool 3D toolbar or whatever.  To make your own toolbar, you'll need ResEdit, Resorcerer, or similiar and something to make the pictures in.

Toolbar files must be named "Toolbar", and must have the creator code set to "HTLC" and the type code set to "HTtb".  You might find it easier to make your own toolbar by modifying an existing one.  The Hotline client will use a toolbar when the file is in the same folder as the application.

The Toolbar file consists of "PICT" resources and one "HPTB" 128 resource.  First you need to make a picture ("PICT") of the entire toolbar Ñ how it looks normally.  This picture should be the entire content of the Toolbar window.  It can be any rectangular shape.

Next, make individual PICTs of the areas of the toolbar that change when you click on them.  For example, if you have a button on your toolbar, the main picture of the entire toolbar shows the button unhilited Ñ as it looks normally.  You then make a PICT that shows the button (and nothing else) hilited/depressed.

Once you've finished making your PICTs, copy them into the Toolbar file and assign them ID numbers.  PICT resources must have IDs in the range 1000 to 2000.  Use "Get Resource Info" under the "Resource" menu to change the IDs.  Mark all of the PICT resources as "purgeable", EXCEPT for the main background one.  Mark the main background PICT as "preload" and "locked".

Next, you need to make a "HPTB" resource.  This describes how the toolbar looks and works.  There is only one HPTB resource, and it is ID 128.  Do NOT make it purgeable.  In order to edit the HPTB resource, you need to have the TMPL (template) resource that describes the format of the HPTB resource.  To activate the template, either open Hotline and the Toolbar both in ResEdit at the same time, or copy the TMPL resource from Hotline to the Toolbar file.

The HPTB Resource Field-By-Field

"HPTB"
Set this field to "HPTB".

Version1
Set this field to 1.

sideTitleBar
If this is set to 1, the titlebar on the toolbar window will appear vertically on the left side of the window.  If it is set to 0, it will appear at the top as normal.  A side titlebar is good for a window that is wider than it is high.

toggleWinVis
If this is set to 1, the behavior for "showing" a window gets changed.  If the window is hidden, it is shown in front of all others.  If the window is visible, it is brought to the front.  If it was already at the front, it gets hidden (normally it stays visible).

(reserved)
It is important that you leave these set to 0.

connectPict
The ID of the PICT to draw when Hotline is connected (or 0 for none).

connectPictR
The rectangle (top,left,bottom,right) in pixels to draw the "connectPict" at.

height
The height of the window in pixels.

width
The width of the window in pixels.

bkgndPict
The ID of the PICT to draw as the background into the window.  This is the main picture Ñ how the toolbar looks normally.

item bounds
The rectangle (top,left,bottom,right) in pixels that encloses this item.  This rectangle is used to determine if the mouse is within the item, and is used to draw the "mDownPict" in the correct location.

item mDownPict
The ID of the PICT to draw while mouse is down in this item (while the button on the mouse is pressed and located within the bounds of this item).

item mWithinPict
The ID of the PICT to draw while mouse is in/over this item (while the mouse is located within the bounds of this item).

item mDownAction
The action to perform when the mouse goes down in this item (when the button on the mouse is pressed and located within the bounds of this item).    See "Action Numbers" following for valid values.

item mUpAction
The action to perform when the mouse is released in this item (when the button on the mouse was pressed and has just been released within the bounds of this item).  See "Action Numbers" following for valid values.

item mDownSound
When the button on the mouse is pressed over this item, play the sound ("snd ") of this ID.  Note that if you add your own "snd " resources, the IDs must be in the range 1000 to 2000.

item mUpSound
When the button on the mouse is released over this item, play the sound ("snd ") of this ID. Note that if you add your own "snd " resources, the IDs must be in the range 1000 to 2000.

item showPicInWin
The ID of the PICT to show in a window with an OK button when this item is clicked.  Good for credits etc.

mDownPictRct
Normally, the "mDownPict" gets drawn in the item bounds.  You can optionally specify a different rectangle here.

mWithinPictR
Normally, the "mWithinPict" gets drawn in the item bounds.  You can optionally specify a different rectangle here.

Action Numbers

0   = do nothing
1   = show options window
2   = show connect window
3   = disconnect
4   = show news window
5   = show post window
6   = show chat window
7   = show files window
8   = show user list window
9   = show tasks window
10  = quit
11  = show about window
12  = show new user window
13  = show open user window
15  = show tracker window

Making Faster Smaller PICTs

First you'll need GraphicConvertor.  You can get it from info-mac (eg, ftp://ftp.amug.org/info-mac/) or similiar.  Drag the ResEdit file containing the PICTs onto GraphicConvertor and it will let you choose which one you want to edit.

When you've got the picture open, choose "Minimise Color Table" from the "Picture" and then "Colors" menu.  This will not lessen the quality of your picture, but can make it smaller.  You may also want to lower the bit depth (eg, "Change to 256 Colors (8-bit)").  This might lessen the quality of your picture.

When you're done, choose "Save As" from the "File" menu.  Select "PICT in resource" as the format.  Click on "Options" and select "Standard (RLE)" as the compression (this is much faster to draw than QuickTime compression).  Save the PICT and open the file in ResEdit.  The PICT 128 resource is the one to use (if there's another, it's the preview). 


Share your opinion