RepaintNow does nothing

I’m still trying to add correct printing code to Juce.
I’ve almost successfully understood it by now, but there is still something I don’t understand.

Why isn’t RepaintNow in Win32RepaintManager implemented (it is commented out???) ?
Where does the repaint take place ?

So far, from my previous patch I’ve made a LowLevelSoftwarePrinter class that cache text to be drawn in a list.
I’ve added WM_PRINTCLIENT message handler in Win32 and it merely does the handlePaintMessage stuff without clip region checking
Now, I don’t understand how to access/create/modify the Graphics object in the repaint code so I can create one that use my LowLevelSoftwarePrinter renderer.

Jules, can you help me with this ?

You don’t want to use the RepaintManager for this - instead, create a Graphics object using the special constructor that takes a LowLevelGraphics object, so something like:

PrintingLowLevelGraphicsContext printContext;
Graphics g (&printContext);

g.drawSomeStuff...

…and if you’re tring to draw a component, you could just call its paint() method with the Graphics object.

Of course… I feel somewhat stupid now.

BTW, I’ll sent you a patch soon :wink:

Just one thing I thought of - if you want to paint a component and all its sub-components too, you’d need to call paintContents(), which is private. I might change that method to be public, and give it a more explanatory name for the next release.

Jules, I’ve finished implementing the printer code.

I still have few questions. I’m sending you an email.

Yea, actually drawing to a surface and such is simple, the difficult part I ran into is setting up the printer properties, calling the windows to select options, all such like that, if you find an easy method for dealing with those I would be interested. :slight_smile:

OvermindDL1, I’ve send the code to you at 3lefties.com.

To print a component, add “getPeer()->printCurrentComponent()”.
This opens the default windows printer dialog, where you can select your printer and stuff (I highly recommend you don’t use more than 150dpi else you’re going to wait for years).
Your component is printed à la PrintScreen, except for text which is printed using Win32 primitives (hence isn’t 1:1 with juce rendering, but quite close)
Text is above everything.

Actually, could you send it to overminddl1 at gmail dot com. 3lefties is just my messenger login, it is not a real email and I cannot get anything from it.

Thanks though. :slight_smile:

Sent. That’s a draft. Jules will not include it, as he is working on a real (understand non hacked) context based on HDC.

BTW, while waiting it is worth having a look.

Thanks much, replied back. Now to get sleep, need to get up in two hours.