It is currently Wed Oct 23, 2019 7:22 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 58 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: Danilo's toolbar Pro -converted to PB source! (Updated.)
PostPosted: Tue Jan 30, 2007 6:14 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10525
Location: Beyond the pale...
Update: 16 June 2008.
Whilst the library is intended for use as a source code include, it is now compatible with Tailbite. There were problems with those functions taking optional parameters etc.

An important change is that any program using the nxToolbar library in the form of a source code include file must now declare the constant:

Code:
#nxToolbar_USESOURCE


before including the main nxToolbar source file. (See the example program.) This meant that I could keep the optional parameters when using the lib either in source code form or as a Tailbitten library without making any changes to the host program etc.


Update: 10 October 2007.
Large toolbar icons would exhibit a nasty dithering effect. This has been fixed thanks to fangbeast who pointed me in the right direction here!


Bug fix: 27 September 2007.

Fixed a damn cursed bug which took me an age to figure out! :x

The library was inadvertently setting the #CCS_ADJUSTABLE style causing the Windows customising dialogue to show briefly whenever a toolbar was double clicked!


Update: 12 September 2007.
Have added a new command which has no corresponding command in Danilo's original library :

Code:
nxAddTBImage(hTb, hImage)


Basically this library had one real drawback; namely that all images (other than the system icons) used in the toolbars had to reside within a single bitmap. There is one bitmap for the 'normal' button images, one for the 'hot' images and one for the 'disabled' image set. There was no way of adding additional images which were not part of the main image strips.

Hence the addition of the new command.

This command will accept either a SINGLE bitmap image or an icon (both of which can be loaded with Purebasic's LoadImage() etc.) and will add it to the internal lists of images used by the toolbar. In each case the image dimensions must match the toolbar button sizes etc. Use ResizeImage() if you need to.

My advice is to use icons since they usually come armed with a mask for transparency whereas, if you add a bitmap, the library simply uses a 'dummy' mask.

Each new image added with this command is appended to the current list of images and so it's image index will reflect this.

IMPORTANT.
Always add images in the following order :

i) The image strips using the command nxSetTBImage().
ii) Individual custom images (bitmaps or icons) using the command nxAddTBImage().
iii) System icons using the command nxAddTBSysIcons().

Of course, you do not have to add image strips or system icons etc. That is, you can safely leave out any of the above steps i) through iii).

See the example program included with this package which shows how to mix all of the different image types.


Update: 1 feb 2007.
I got fed up with the boring 'standard' tooltips and so have changed the default style and added a function to allow you to change the colours and add a title (with icon) to the tooltips etc. See the 'update 1.2.txt' file for details.


Update: 31 Jan 2007.
Have brought together my original translation and Flype's work into a single package. The download includes full PB source code (ready to use as an 'XincludeFile' etc.) and pre-compiled libraries. Our previous versions were incompatible in that the source code version couldn't readily be Tailbitten and the source attached to the pre-compiled version could not readily be used as an include etc.

Hi,

as a massive fan of Danilo's excellent Toolbar Pro library (written in C, part of the PBOSL package) I use it in just about every application I develop.

However, my latest app, being multithreaded and Unicode compliant, pushed Toolbar Pro to it's limits, and broke it! :)

The problem is that whilst the lack of Unicode support is easy to get around, Toolbar Pro really isn't threadsafe as it relies upon global arrays and of course Danilo is no longer around to update the library.

I've thus taken the source code, ripped out the bits which caused it not to be threadsafe, and converted it to Purebasic source code.

I've tested it a little and it seems to work in my multithreaded app okay.

Apart from the 'threadsafe' alterations, this really is little more than a direct translation from Danilo's original code and so I take no credit for this. The original code was so well written that translation was easy. (Okay, I fixed a couple of memory leaks, so I'll happily take credit for them! :) )

The download (below) includes full source and an example. I've also thrown in a little tool which will happily generate mask images suitable for use with the library.

There's no help manual since you can simply use Danilo's original one which is in the PBOSL package. But, I advise a quick scan through the readme.txt file so that you are aware of the differences between the 2 libraries.

I hope it's useful. Download nxToolbar

_________________
I may look like a mule, but I'm not a complete ass.


Last edited by srod on Mon Jun 16, 2008 11:13 pm, edited 14 times in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 30, 2007 6:22 pm 
Offline
PureBasic Expert
PureBasic Expert
User avatar

Joined: Fri Apr 25, 2003 4:51 pm
Posts: 2808
Location: Portugal, Lisbon
GRATZ!!!!

:lol: :lol: :lol:

_________________
Software: http://xipa.org
Elevator Maintenance: http://central-elevadores.pt
Good web hosting!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 30, 2007 6:34 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10525
Location: Beyond the pale...
I've just uploaded a new version - this time you can extract the zip into the correct folders! :oops:

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 30, 2007 6:40 pm 
Offline
Always Here
Always Here
User avatar

Joined: Thu Jun 24, 2004 2:44 pm
Posts: 5755
Location: Berlin - Germany
thanks for the nice code.

where from you have PureBasic 4.2 :wink:

_________________
PureBasic 5.71 | SpiderBasic 2.21 | Windows 10 Pro (x64) | Linux Mint 19.2 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 30, 2007 6:43 pm 
Offline
PureBasic Bullfrog
PureBasic Bullfrog
User avatar

Joined: Wed Jul 06, 2005 5:42 am
Posts: 8006
Location: Fort Nelson, BC, Canada
Excellent, thanks for this!

_________________
Veni, vidi, vici.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 30, 2007 8:38 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10525
Location: Beyond the pale...
ts-soft wrote:
...where from you have PureBasic 4.2 :wink:


Uhm, seems the smart update is smarter than the average bear!

Doh!

:)

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 30, 2007 9:23 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Jul 22, 2003 5:02 pm
Posts: 1534
Location: In a long distant galaxy
Well done srod. can be really useful.

For the communauty i compiled your translated source code to a tailbite compatible one with a very very very few changes.

I used WinXP/PB4.02/jaPBe/Tailbite environment to provide the following files :

. UserLib
. UserLib Unicode
. UserLib ThreadSafe
. UserLib ThreadSafe + Unicode

. And the associated Resident file.

it's here : UserLib_PB40_nxToolbar.zip

_________________
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer


Last edited by Flype on Tue Jan 30, 2007 9:54 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 30, 2007 9:30 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10525
Location: Beyond the pale...
Nice one.

You could decrease the size of the libraries though by getting each overloaded function to simply call the main function with specific values for the paramaters etc. This means you don't have to duplicate the code for each overloaded function.

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 30, 2007 9:32 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Jul 22, 2003 5:02 pm
Posts: 1534
Location: In a long distant galaxy
that's right. i will do it right now. :)

_________________
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 30, 2007 9:51 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Jul 22, 2003 5:02 pm
Posts: 1534
Location: In a long distant galaxy
ok, it's done :wink:

archive updated.


@srod
you might copy the userlib-link in your first post,
and maybe upload it to your website.

best regards.

_________________
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 30, 2007 10:03 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10525
Location: Beyond the pale...
@Flype: I've linked to your site at the moment. If you'd prefer that I upload to my own site then I will. :)

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 30, 2007 10:07 pm 
Offline
Addict
Addict
User avatar

Joined: Tue Jul 22, 2003 5:02 pm
Posts: 1534
Location: In a long distant galaxy
no pb, it's as you wish :)

_________________
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Jan 30, 2007 10:08 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Mar 25, 2004 2:15 pm
Posts: 701
Location: Spain
:shock: Yes! My new project is needy of this lib!

Very thank you!

_________________
PB 5.7x, PureVision User.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jan 31, 2007 3:51 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Fri Jun 30, 2006 4:30 pm
Posts: 578
Location: Middle East
thank you! :D


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jan 31, 2007 12:26 pm 
Offline
PureBasic Expert
PureBasic Expert

Joined: Wed Oct 29, 2003 4:35 pm
Posts: 10525
Location: Beyond the pale...
You're welcome.

Update: 31 Jan 2007.
Have brought together my original translation and Flype's work into a single package. The download includes full PB source code (ready to use as an 'XincludeFile' etc.) and pre-compiled libraries. Our previous versions were incompatible in that the source code version couldn't readily be Tailbitten and the source attached to the pre-compiled version could not readily be used as an include etc.

Because of certain limitations with Tailbite, however, there is one change in how 'optional paramaters' are used. See the 'update 1.1.txt' file for details.

@Flype: I had to switch all the overloaded functions around so that the 'full version' of each function could be called directly if the lib is used as a source code include file. It means that there is now only one copy of the package to maintain etc. :) I didn't recompile the libs however as these remain unaffected.

_________________
I may look like a mule, but I'm not a complete ass.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 58 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye