PDA

View Full Version : ClanLib 2.2.6 improvements svn patch



user
01-17-2011, 08:14 PM
I created a patch, it contains some improvements, optimizations and new functions, please, check it.

Summary:

[added] Improved CL_LineEdit::set_text(float), now you can specify the number of decimal places to display.

[added] Implemented CL_ProgressBar marquee mode, added set_marquee_box_width(), set_marquee_step_size(), get_marquee_box_width(), get_marquee_step_size() methods.

[fixed] When you disable a checkbox, it becomes unchecked, if it was in indeterminated state.

[fixed] Error when pasting text containing '\n' to CL_LineEdit.

[fixed] Fixed memory leak in CL_MenuBar_Impl.

[fixed] Removed unnecessary timer from CL_Slider.

[fixed] CL_Slider: now callbacks are called only when its actual position changed.

[improved] Now CL_Exception::get_stack_trace() and CL_Exception::get_message_and_stack_trace() methods have const modifier, so all exceptions are now catched as

catch(const CL_Exception& e)
for better optimization.

[improved] added virtual keyword to CL_Exception and CL_WebserviceException classes, as they extend std::exception class, which has a virtual destructor.

[improved] Improved some exception re-throws.

[improved] Improved GUI themes.

[improved] Improved GUI example.


------------------
changes2.patch
------------------

[improved] Improved CL_LineEdit scrolling when there's a lot of text in textbox and the user is deleting it some way.

[fixed] CL_ListView: when some listview field is editable and the user adds a lot of text to it, its width becomes much greater than listview width.

rombust
01-17-2011, 10:01 PM
Very nice. In my opinion, it should all be applied to ClanLib 2.3 SVN

Some of the patches cannot be applied to the 2.2 branch, because it contains breaking changes. Some API function definitions have changed, which would mean the applications would require recompiling (else shared libraries would not link)

See - http://www.rtsoft.com/forums/showthread.php?2893-Unix-library-versioning-scheme

Note, I did break this rule in 2.2.5, because of a critical bug in the API
(... This version is not binary compatible with the Version 2.2.4. Your application will need recompiled. There was a multithreading problem with CL_SharedPtr.... )

Maybe we should not have fixed this. As far as I know, distros currently do not use 2.2.4 or below, so I think that's okay.

One last note....


- ~CL_Exception() throw() {}
+ virtual ~CL_Exception() throw() {}

<--- I thought that in C++, if a base class has a virtual function, it automatically implies that inherited class function, is also virtual

spin
01-17-2011, 10:37 PM
One last note....


- ~CL_Exception() throw() {}
+ virtual ~CL_Exception() throw() {}

<--- I thought that in C++, if a base class has a virtual function, it automatically implies that inherited class function, is also virtual

http://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.7

Note: in a derived class, if your base class has a virtual destructor, your own destructor is automatically virtual. You might need an explicit destructor for other reasons, but there's no need to redeclare a destructor simply to make sure it is virtual. No matter whether you declare it with the virtual keyword, declare it without the virtual keyword, or don't declare it at all, it's still virtual.

user
01-18-2011, 06:10 AM
I memorize, that I catched a bug in my program caused by non-virtual destructor in one of derived classes, but I can't repeat it anymore, probably it was my own mistake... Well, it seems that there is really no need for explicit virtual destructor. But you can add 'virtual' keywords just to let other developers know, that all CL_*** exception classes have virtual destructors :)

rombust
01-18-2011, 09:06 AM
I will apply the patch as it stands to ClanLib 2.3 SVN
Then, apply the non API breaking changes part of the patch to the ClanLib 2.2 SVN.

(Later this week, if I have time)

user
01-18-2011, 05:32 PM
I added two additional changes to the patch, attached and commented in the first post.

sphair
01-18-2011, 05:42 PM
Thanks for yet another nice patch :)

rombust
01-27-2011, 09:16 AM
Patch applied. Many thanks.

For ClanLib 2.3 SVN, the patch was applied exactly (except minor alterations, due to the slightly different codebase)

For ClanLib 2.2 SVN, I did not apply the CL_Exception modifications due to it breaking library binary compatibility when dynamically linking on linux.

Also for ClanLib 2.2 SVN, I modified the GUI lineedit function as follows:
set_text(float number) --> calls set_text(number, 6);
set_text(float number, int num_decimal_places); --> Removed the "=6"