Search results

  1. Crutch

    ThinkC Mixing the text feedback immediacy of ANSI projects and toolbox graphics from MacTraps

    Sure, a couple things. If you want to add something to a long, you want addi.l. Your initial code had just “addi”, which defaults to addi.w. Looks like you fixed that. It seems you are trying to advance at the end of each line by 512 pixels = 64 bytes = 0x40. (Addresses are counted in bytes...
  2. Crutch

    68k Determining if screen is set to color vs b&w at runtime in Sys 7

    The ‘data’ parameter definitely works for me. This code displays “foo” right next to the ResEdit icon (only changes are replacing NULL as last argument to PlotIconMethod with “\pfoo” and adding MoveTo and DrawString calls to my IconGetter). Try starting from my code and modifying it to fit...
  3. Crutch

    68k Determining if screen is set to color vs b&w at runtime in Sys 7

    You mean PlotIconMethod right (not GetIconMethod)? Yes, THINK Reference documents (some of) the Icon Utilities routines as not existing in the then-current MPW Universal Headers, so I got this info from Tech Note #306. (The .h files, if they included these routines, would just have the...
  4. Crutch

    ThinkC Mixing the text feedback immediacy of ANSI projects and toolbox graphics from MacTraps

    Nice. Also, great image - does that mean you found out how to get MindJourney to generate 512x342 black and white pixel art? If so, I would love to know how!
  5. Crutch

    ThinkC Mixing the text feedback immediacy of ANSI projects and toolbox graphics from MacTraps

    THINK’s console innards are incredibly complex and hard to read. I will play around with this too, I agree with your desired use case.
  6. Crutch

    ThinkC Mixing the text feedback immediacy of ANSI projects and toolbox graphics from MacTraps

    Cool, glad that worked! I wonder why THINK didn’t do that from the start. Yes I think those numbers look reasonable. (And of course you could draw that picture faster by coping it to a bitmap first, but that’s not your point here I gather.) How do you get these gorgeous screendumps from your...
  7. Crutch

    ThinkC Mixing the text feedback immediacy of ANSI projects and toolbox graphics from MacTraps

    Oh, I do see a weird thing. In the THINK standard library C file console.c, you can see that in the InitConsole() routine, ANSI calls InitGraf() and gives it a random pointer that doesn’t get saved anywhere. The result is that when you call InitGraf, you are setting up a separate set of...
  8. Crutch

    ThinkC Mixing the text feedback immediacy of ANSI projects and toolbox graphics from MacTraps

    Your code works fine for me (Mini vMac, 7.5.5), I again set the resource ID to -16503 which is the MacOS logo in the System file under 7.5.5. I think you are doing almost* everything right. The resource not showing up in ResEdit in System 6 is a bit weird, any chance there is something goofy...
  9. Crutch

    ThinkC Mixing the text feedback immediacy of ANSI projects and toolbox graphics from MacTraps

    You only need to lock a handle if the Memory Manager might be invoked while it is dereferenced (normally because you call a trap listed as possibly moving or purging memory). Just copying the bounds doesn’t move any memory, so no locking is needed.
  10. Crutch

    ThinkC Mixing the text feedback immediacy of ANSI projects and toolbox graphics from MacTraps

    I will look at your code a little later. Btw you don’t need to lock that handle.
  11. Crutch

    ThinkC Mixing the text feedback immediacy of ANSI projects and toolbox graphics from MacTraps

    This worked for me? #include <stdio.h> void main(void) { InitGraf(&thePort); InitFonts(); InitWindows(); InitMenus(); printf("foo\n"); SetPort(FrontWindow()); { const Rect r = {60, 30, 350, 250}; const PicHandle pic = GetPicture(-16503)...
  12. Crutch

    ThinkC Mixing the text feedback immediacy of ANSI projects and toolbox graphics from MacTraps

    The console window is just a window, you should be able to draw anything into it after a simple SetPort(FrontWindow()); You do of course need to call InitGraf() etc first. Can you post a minimal failing example of your code?
  13. Crutch

    68k Determining if screen is set to color vs b&w at runtime in Sys 7

    (Of course an alternative would be to skip the desktop DB and just do what the Finder does: open the application’s resource fork, access its BNDL resource to get the resource ID for the icon suite for type APPL, and then use PlotIconID as I suggested before. But the desktop DB is the “right”...
  14. Crutch

    68k Determining if screen is set to color vs b&w at runtime in Sys 7

    Actually you can save a step with PlotIconMethod. This code works for me. (‘Check’ is my own macro to shout if the argument is nonzero, you can replace with your own.) pascal OSErr MakeIconCache (Handle *theCache, ProcPtr GetAnIcon, Ptr yourDataPtr ) = {0x303C, 0x0604, 0xABC9}...
  15. Crutch

    68k Determining if screen is set to color vs b&w at runtime in Sys 7

    Here’s how I would do it using the Icon Utilities routines (Inside Macintosh: More Macintosh Toolbox) — there may be a better way to avoid the explicit resource type mapping in my step 1 below: - call MakeIconCache, passing it a pointer to a custom icon getter function. Icon getters are handed...
  16. Crutch

    68k Determining if screen is set to color vs b&w at runtime in Sys 7

    By the way, as a general point of coding philosophy, System 7 is a really old dev platform, but it wasn’t awful. If one is writing code and you get stuck and find yourself thinking something like “I need to manually check all the various bit depths of icons that exist for this application vs...
  17. Crutch

    68k Determining if screen is set to color vs b&w at runtime in Sys 7

    No — again this shouldn’t be necessary if MacOfAllTrades uses the icon utilities I suggested above — but if it’s really necessary, you use TestDeviceAttribute(GetMainDevice(), gdDevType). If it returns TRUE, the device is set to color — otherwise grayscale.
  18. Crutch

    68k Determining if screen is set to color vs b&w at runtime in Sys 7

    Yes, that last link is TN306 (later remembered QD18) which I referenced above and explains the use of PlotIconID, which is the routine I suggested.
  19. Crutch

    68k Determining if screen is set to color vs b&w at runtime in Sys 7

    And yes sorry, device.gdPMap is of course a PixMapHandle which must be double-dereferenced to get to the data, in particular pixelSize.
  20. Crutch

    68k Determining if screen is set to color vs b&w at runtime in Sys 7

    Oh, you shouldn’t need all this for that. If you just want to plot an application’s icon in the correct bit depth, the routine to use is PlotIconID. It automatically grabs the right ICN#/icl4/icl8 etc for you, and plots it appropriately given the bit depth. You can look it up in THINK...