|
View:
New views
15 Messages
—
Rating Filter:
Alert me
|
|
|
MacCarbonPrint revisitedMacCarbonPrint updated
I was finally able to make it work on 10.4 (and likely on 10.3 also) using hardware kindly provided by The Electronic Farm. The lack of Apple documentation and the changes of their inner workings of the Printing Manager API didn't help track this down. You will find it all in cvs: http://sourceforge.net/cvs/?group_id=84344 There is a universal dylib built on 10.5 with 10.4 SDK and DEPLOYMENT_TARGET 10.3 contained in cvs. I add an explanation of the problem here to aid future developers: The Quartz coordinate system must be flipped and moved to fit the Tk coords which is made in tkMacOSXDraw.c : TkMacOSXSetupDrawingContext() The coordinate transform is made using: CGContextConcatCTM(dc.context, CGAffineTransformMake(1.0, 0.0, 0.0, 1618 -1.0, 0.0, dc.portBounds.bottom - dc.portBounds.top)); where the portBounds come from r = CGContextGetClipBoundingBox(dc.context); On 10.5 the printing manager sets up its clipping region to the printing device default size, but on 10.4 it doesn't do anything. So CGContextGetClipBoundingBox returned crap resulting in empty pages. Therefore I had to explicitly set its clip region to something reasonable from the printing device, like: // This rectangle describes the sheet we are drawing to. CGContextClipToRect(context, CGRectMake(0, 0, width, height)); (NB: the old QD code also set its CGrafPtr bounds to reasonable values.) I found this in an example project in /Developer/... on my 10.5 box. There are tons of old docs at Apple and it is hard to find any relevant info at all. Enjoy, Mats PS: Only tested printing to pdf files... ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: MacCarbonPrint revisitedMats,
I'm sorry but this one doesn't work for me (10.5 + 8.4.17). The page size is OK but clip region is wrong while it works perfectly with the same code using dylib v0.3 (build 6 Feb). I didn't tried the dylib v0.3 (build 7 Feb) because I thought it was the same as the prevous one (I think you should add a third version number, like 0.3.3 so one can be sure what version he is running). -- David Zolli kroc@... http://www.kroc.tk ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: MacCarbonPrint revisitedAll,
First, I have added a release version number to remove some confusion. My first release of 0.3 is now reiterated and holds number 0.3.0 It is the one that fails to print anything on MacOSX 10.4. Version 0.3.1 is the one that explicitly sets the page format. cvs is updated to reflect this with fresh builds. > Unfortunately, when I print a canvas that contains a text object, I get the error: > TkMacOSXSetupDrawingContext(): no port or context to draw into ! This is expected (although I didn't think about it) since the printing device is always a CGContext (was QD port in 0.2) and text drawing in AquaTk 8.4 is still using QD. This was changed in 8.5 where ATSUI is used, which I believe is using CGContext. I now return an error for text items instead of crashing. Text works OK on 8.5 For 0.3.1 I explicitly set the size and clipping using Apple code I found in /Developer/Examples/Printing/App/CarbonPrintingSample/ where they use PMGetPageFormatPaper() and CGContextClipToRect(). This was the fix that made it print on 10.4. When I use the script examples/macosx/ruler.tcl and print to a pdf I get identical results. See ruler.pdf in cvs. I must admit that I'm a bit lost here and you could help if you find any Apple docs that reveal this mystery. I also tested PMGetAdjustedPageRect() but that gave a bit different result. Mats On 2/8/08, David Zolli <kroc@...> wrote: > Mats, > > I'm sorry but this one doesn't work for me (10.5 + 8.4.17). The page > size is OK but clip region is wrong while it works perfectly with the > same code using dylib v0.3 (build 6 Feb). > > I didn't tried the dylib v0.3 (build 7 Feb) because I thought it was > the same as the prevous one (I think you should add a third version > number, like 0.3.3 so one can be sure what version he is running). > > -- > David Zolli > kroc@... > http://www.kroc.tk > > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: MacCarbonPrint revisitedLe 9 févr. 08 à 09:17, Mats Bengtsson a écrit : > .../... > I must admit that I'm a bit lost here and you could help if you find > any > Apple docs that reveal this mystery. I also tested > PMGetAdjustedPageRect() > but that gave a bit different result. Hi Mats, I think it fails for me because I'm using 8.4.17. I tried ruler.ppdf with 8.5.0 and all seem to be ok. Maybe the solution could be a switch [info patch] using code from v0.3.0 for 8.4 and v0.3.1 for 8.5. -- David Zolli kroc@... http://www.kroc.tk ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: MacCarbonPrint revisitedI'm not fond of supporting 8.4 at all since its inner workings changed
during its release cycle. The QD code was changed to Quartz but some parts still remain QD (images) in 8.5. I think the situation is messy as it is. The reason for this is that I access MacDrawable which is an internal structure. I just checked in a new variant named 0.3.2 where I explicitly use PMPaperGetMargins and do some coordinate operations. This gives an identical ruler.pdf as the old QD based 0.2 MacCarbonPrint. In cvs you'll find ruler02.pdf and ruler032.pdf to compare. ruler.pdf is from 0.3.0/0.3.1. Mats On 2/11/08, David Zolli <kroc@...> wrote: > > Le 9 févr. 08 à 09:17, Mats Bengtsson a écrit : > > > .../... > > I must admit that I'm a bit lost here and you could help if you find > > any > > Apple docs that reveal this mystery. I also tested > > PMGetAdjustedPageRect() > > but that gave a bit different result. > > Hi Mats, > > I think it fails for me because I'm using 8.4.17. I tried ruler.ppdf > with 8.5.0 and all seem to be ok. Maybe the solution could be a switch > [info patch] using code from v0.3.0 for 8.4 and v0.3.1 for 8.5. > > -- > David Zolli > kroc@... > http://www.kroc.tk > > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Command-? Help menu item in wrapped Mac appsHi Tcl-Mac folk,
With my app wrapped in a starpack, there's an entry in the Help menu with the title "${AppName} Help" with an accelerator of "Command-?". How do I either (a) remove it, or, (b) set it so it uses my own Help proc? Thanks. -PC. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Command-? Help menu item in wrapped Mac appsPeter Caffin wrote:
> Hi Tcl-Mac folk, > > With my app wrapped in a starpack, there's an entry in the Help menu with > the title "${AppName} Help" with an accelerator of "Command-?". > > How do I either (a) remove it, or, (b) set it so it uses my own Help proc? > > Thanks. > > > -PC. Peter, Tk-Aqua doesn't install a help menu by default or implement any bindings for it, i.e. "Command-?" You have to add it manually, like so: menu .mb.help -tearoff 0 .mb.help add command -label "PortAuthority Help" -command runHelp .mb.help add command -label "Contact Code by Kevin" -command getHelp .mb add cascade -label "Help" -menu .mb.help This is on Tk-out-of-the-box. f you're using ActiveState's bits, perhaps they hard-code these items in their basekit, but that would surprise me. Have you actually tried setting up the bindings and seeing what happens? --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Command-? Help menu item in wrapped Mac appsHi Kevin, et al,
This is what I'm doing currently... ======================== catch { destroy .menubar } menu .menubar -tearoff 0 -relief groove -borderwidth 1 \ -activebackground #068 -activeforeground white -activeborderwidth 1 \ -selectcolor black [...] menu .menubar.help -tearoff 0 -relief groove -borderwidth 1 \ -activebackground #068 -activeforeground white -activeborderwidth 1 \ -selectcolor black [...] .menubar add cascade -label "Help" -menu .menubar.help -underline 0 [...] .menubar.help add command -label "Documentation" \ -command { urlOpen http://rreplace.autons.net/docs/ } [...] .main configure -menu .menubar ======================== (The [...] bits are just some menu items where the Mac menu's different to the menu for every other OS.) Yep, I'm using ActiveTcl and TDK4. Jeff Hobbs at AS has indicated that their basekits shouldn't be adding that menu item either, but, it's a known issue they've seen before that they worked around... somehow. He wasn't able to find the details and suggested here would be a good place to ask. I remember from experience that merely copying a menu entry simply produced a double-entry when I was sorting out a similar thing re the Apple Preferences menu item. From that, I'm anticipating the solution probably requires some similar Mac-speficic foo like: proc ::tk::mac::ShowPreferences {} { EditPrefs } In testing, if I rename my .menubar.help to .menubar.hlp, I get two Help menus. However, even doing the following doesn't dislodge the rogue menu and item: after 3000 { destroy .menubar.hlp } after 4000 { destroy .menubar.help } after 5000 { destroy .mb.help } How would you set up the bindings you mentioned? This definitely didn't help: bind .main <Control-?> { urlOpen http://rreplace.autons.net/docs/ } -PC. Kevin Walzer wrote: > Peter Caffin wrote: >> Hi Tcl-Mac folk, >> >> With my app wrapped in a starpack, there's an entry in the Help menu >> with the title "${AppName} Help" with an accelerator of "Command-?". >> >> How do I either (a) remove it, or, (b) set it so it uses my own Help >> proc? >> >> Thanks. >> >> >> -PC. > > > Peter, > > Tk-Aqua doesn't install a help menu by default or implement any bindings > for it, i.e. "Command-?" You have to add it manually, like so: > > menu .mb.help -tearoff 0 > .mb.help add command -label "PortAuthority Help" -command runHelp > .mb.help add command -label "Contact Code by Kevin" -command getHelp > .mb add cascade -label "Help" -menu .mb.help > > This is on Tk-out-of-the-box. > > If you're using ActiveState's bits, perhaps they hard-code these items in > their basekit, but that would surprise me. Have you actually tried > setting up the bindings and seeing what happens? > > --Kevin > > > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Command-? Help menu item in wrapped Mac appsPeter Caffin wrote:
> > This is what I'm doing currently... > > ======================== > catch { destroy .menubar } > menu .menubar -tearoff 0 -relief groove -borderwidth 1 \ > -activebackground #068 -activeforeground white -activeborderwidth 1 \ > -selectcolor black > [...] > menu .menubar.help -tearoff 0 -relief groove -borderwidth 1 \ > -activebackground #068 -activeforeground white -activeborderwidth 1 \ > -selectcolor black > [...] > .menubar add cascade -label "Help" -menu .menubar.help -underline 0 > [...] > .menubar.help add command -label "Documentation" \ > -command { urlOpen http://rreplace.autons.net/docs/ } > [...] > .main configure -menu .menubar This should work. I do something similar in my programs. > > Yep, I'm using ActiveTcl and TDK4. Jeff Hobbs at AS has indicated that > their basekits shouldn't be adding that menu item either, but, it's a > known issue they've seen before that they worked around... somehow. He > wasn't able to find the details and suggested here would be a good place > to ask. This bug is very strange. I've never seen it before in my own experience. Have you tested your code against a separate build of Tcl/Tk? Daniel Steffen has a compact Wish app bundle available here: http://rutherglen.ics.mq.edu.au/~steffen/tcltk/TclTkAquaStandalone-8.4.18.dmg I think you need to test this against something other than ActiveState's binaries to make sure the issue is with Tk and not some quirk in AS's basekits. > I remember from experience that merely copying a menu entry simply > produced a double-entry when I was sorting out a similar thing re the > Apple Preferences menu item. From that, I'm anticipating the solution > probably requires some similar Mac-speficic foo like: > > proc ::tk::mac::ShowPreferences {} { EditPrefs } > There's nothing comparable for the help menu. You'll have to implement this yourself. > > How would you set up the bindings you mentioned? This definitely didn't > help: > > bind .main <Control-?> { urlOpen http://rreplace.autons.net/docs/ } > Did you say "Control" or "Command"? On the Mac, the "apple" key (standard command-accelerator) is called via "Command". There is a "ctrl" key that maps to "Control," but it's not a standard place for Mac users. Also, FWIW, I use "bind all" for menu bindings--it works better for me. --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Command-? Help menu item in wrapped Mac appsKevin Walzer wrote:
> Peter Caffin wrote: > I think you need to test this against something other than ActiveState's > binaries to make sure the issue is with Tk and not some quirk in AS's > basekits. It isn't a bug that is particular to the AS basekits. It may have to do with the .app bundling, but it is otherwise yet another magic Mac-ism that we have to deal with (much like the magic search bar in the help menu in Leopard, which fortunately doesn't crash Tk now, but still doesn't accept input). Jeff ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Command-? Help menu item in wrapped Mac appsJeff Hobbs wrote:
> Kevin Walzer wrote: >> Peter Caffin wrote: >> I think you need to test this against something other than >> ActiveState's binaries to make sure the issue is with Tk and not some >> quirk in AS's basekits. > > It isn't a bug that is particular to the AS basekits. It may have to do > with the .app bundling, but it is otherwise yet another magic Mac-ism > that we have to deal with (much like the magic search bar in the help > menu in Leopard, which fortunately doesn't crash Tk now, but still > doesn't accept input). Hmmm, you're right about the help menu not accepting input in the search field--and I actually use Carbon Help API's to display my user docs in the help viewer app. I didn't notice this. Grrr. I still think Peter should test his code with another build of Tk. I've never seen the bug he's reporting. I'm as familiar with the quirks of .app bundling as anyone, and I know there are bugs that can crop up with the help menu (especially if you are using the system help API's), but the particular issue he's reporting baffles me. -- Kevin Walzer Code by Kevin http://www.codebykevin.com ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Command-? Help menu item in wrapped Mac appsJeff Hobbs wrote:
> Kevin Walzer wrote: >> Peter Caffin wrote: >> I think you need to test this against something other than >> ActiveState's binaries to make sure the issue is with Tk and not some >> quirk in AS's basekits. > > It isn't a bug that is particular to the AS basekits. I can confirm that. The issue was still present using tclkits from http://www.equi4.com/tclkit/, using Tcl 8.4 and 8.5. > It may have to do > with the .app bundling, but it is otherwise yet another magic Mac-ism > that we have to deal with (much like the magic search bar in the help > menu in Leopard, which fortunately doesn't crash Tk now, but still > doesn't accept input). That ended up being the key. It's a magic Mac-ism which is triggered when CFBundleHelpBookFolder is present in Info.plist, even if the entry is an empty string {}. Problem resolved. Thanks, everyone :-). -PC. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Command-? Help menu item in wrapped Mac appsPeter Caffin wrote:
> Jeff Hobbs wrote: >> Kevin Walzer wrote: >>> Peter Caffin wrote: >>> I think you need to test this against something other than >>> ActiveState's binaries to make sure the issue is with Tk and not some >>> quirk in AS's basekits. >> >> It isn't a bug that is particular to the AS basekits. > > I can confirm that. The issue was still present using tclkits from > http://www.equi4.com/tclkit/, using Tcl 8.4 and 8.5. > > > It may have to do >> with the .app bundling, but it is otherwise yet another magic Mac-ism >> that we have to deal with (much like the magic search bar in the help >> menu in Leopard, which fortunately doesn't crash Tk now, but still >> doesn't accept input). > > That ended up being the key. It's a magic Mac-ism which is triggered > when CFBundleHelpBookFolder is present in Info.plist, even if the entry > is an empty string {}. > > Problem resolved. Thanks, everyone :-). > Peter, Can you be a bit clearer about what the effect of the CFBundleHelpBookFolder flag has, and how you resolved the problem? Did including the flag in info.plist render your help menu inert? --Kevin -- Kevin Walzer Code by Kevin http://www.codebykevin.com ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Command-? Help menu item in wrapped Mac appsKevin Walzer wrote:
> Peter Caffin wrote: >> Jeff Hobbs wrote: >> > It may have to do >>> with the .app bundling, but it is otherwise yet another magic Mac-ism >>> that we have to deal with (much like the magic search bar in the help >>> menu in Leopard, which fortunately doesn't crash Tk now, but still >>> doesn't accept input). >> >> That ended up being the key. It's a magic Mac-ism which is triggered >> when CFBundleHelpBookFolder is present in Info.plist, even if the >> entry is an empty string {}. > Can you be a bit clearer about what the effect of the > CFBundleHelpBookFolder flag has, and how you resolved the problem? Did > including the flag in info.plist render your help menu inert? The problem is that if CFBundleHelpBookFolder exists in Info.plist, you will get an "${appname} Help" item in your help menu automagically created for you that ideally points to the folder with your HelpBook bits. It does not affect anything else about the menu - this item just gets inserted, and it may do nothing. IOW, just avoid it as a standard rule. Jeff ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
|
|
Re: Command-? Help menu item in wrapped Mac appsJeff Hobbs wrote:
> Kevin Walzer wrote: >> Peter Caffin wrote: >>> Jeff Hobbs wrote: >>> > It may have to do >>>> with the .app bundling, but it is otherwise yet another magic >>>> Mac-ism that we have to deal with (much like the magic search bar in >>>> the help menu in Leopard, which fortunately doesn't crash Tk now, >>>> but still doesn't accept input). >>> >>> That ended up being the key. It's a magic Mac-ism which is triggered >>> when CFBundleHelpBookFolder is present in Info.plist, even if the >>> entry is an empty string {}. > >> Can you be a bit clearer about what the effect of the >> CFBundleHelpBookFolder flag has, and how you resolved the problem? Did >> including the flag in info.plist render your help menu inert? I resolved the problem by removing the CFBundleHelpBookFolder key and value from my Info.plist (via the settings in my TDK4 TPJ file). Without that key present, the menu item isn't inserted. > The problem is that if CFBundleHelpBookFolder exists in Info.plist, you > will get an "${appname} Help" item in your help menu automagically > created for you that ideally points to the folder with your HelpBook > bits. It does not affect anything else about the menu - this item just > gets inserted, and it may do nothing. IOW, just avoid it as a standard > rule. I wouldn't necessarily suggest avoiding using a CFBundleHelpBookFolder key in Info.plist at all costs. If your primary platform is Mac, it'd be a good platform native way of providing users with Helpbook help. However, it's definitely an OS specific quirk that needs documenting, preferably in the same places ::tk::mac::ShowPreferences is mentioned. -PC ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Tcl-mac mailing list tcl-mac@... https://lists.sourceforge.net/lists/listinfo/tcl-mac |
| Free Forum Powered by Nabble | Forum Help |