Problems converting to 1.51


#1

Hello,

I am new to Juce, and am writing an application that has a large number of controls on multiple tabs. When I converted from 1.50 to 1.51, I encountered several problems.

  1. The tab switch slowed dramatically. It was nearly instant in 1.50 and goes to over 1 second (!) per tab switch in 1.51. This happens in both Debug and Release builds in Windows. Obviously I’m not doing something correctly, but since it worked great in 1.50 I have no idea where to start looking. Most of the code I’m using right now was generated by Jucer, so go figure.

  2. The String::printf function has been removed and I don’t see a simple replacement. Any reason why this was removed? Here is the code I’m using now.
    szTitle.printf( T("%s %02ld"), bPlay ? T(“Play”) : T(“Record”), nItem+1 );
    String::formatted isn’t a drop-in replacement. Any suggestions?

  3. Graphics::getClipBounds() seems to have changed dramatically. I am creating a VU meter type bar-graph control, and want to fill it with horizontal lines representing the levels. The start of my paint code looks like:

Rectangle rectWindow = g.getClipBounds();
g.setColour( Colours::black );
g.fillRoundedRectangle( rectWindow, 5.0f );

In 1.50 this works perfectly. 1.51 chokes all over it. Rectangle now must be Rectangle, which is fine. However fillRoundedRectangle only rounds the lower right corner. g.getClipBounds() returns negative numbers for x and y with 1.51 and zero for 1.50. To me this should either be very well documented, or is simply a bug that needs to be corrected. Since the rest of my paint code uses the numbers returned from getClipBounds(), the rest of my code goes horribly wrong.

Thanks in advance for any help you can provide.

David


#2

I’d be interested to know more about your tab-switching problem - obviously I use lots of tabs myself and they’re all perfectly ok, but if you do a bit of debugging and find a way to reproduce it, let me know.

As for printf, the only reason that I kept String::formatted was because so many people moaned about me removing it! I hate printfs myself, but I don’t understand why you’d find String::formatted to not be equivalent to printf?

As for that graphics code, I’m amazed that you ever thought it worked ok! You can’t treat the clipping region as if it’s your component size! The clipping region will be whatever sub-region of the window the OS wants repainted - it could be anywhere at all!


#3

Jules, Thanks for the fast reply.

Well, I did say I was new to Juce, didn’t I? :slight_smile:

I have changed my graphics code to a much more reasonable (and simpler):

g.setColour( Colours::black );
g.fillRoundedRectangle( 0, 0, (float)getWidth(), (float)getHeight(), 5.0f );

I guess I am still stuck in Windows GDI land (have been for something like 25 years) so old habits die hard.

Since printf takes parameters directly, and formatted acts like a vsprintf, there is quite a difference. In my example the only thing that is slightly more difficult is the “%02ld”, since that requires some formatting. I’m taking already working code for another project (not Juce) so having to make basic (hum, C++) changes like this all over the code is time-consuming and I’m trying to not waste too much time on the little stuff.

Once I get the rest of the stuff going, I’ll go back to 1.51 and see what is up with the tab switching speed.

Thanks,

David


#4

That’s better!

Don’t understand your printf thing… Surely “n.printf (“xyz”)” would just become “n = String::formatted (“xyz”)”? You could do that with a simple search-and-replace.