Changing the default window size in SimpleText

PB170

Well-known member
Anyone up for some reverse engineering? :)

As some of you may know, I'm using my PowerBook 170 more or less daily (last time I checked, my usage clocked in at 4 h 18 min / day over the past year and a half which probably is more than I spend on my MacBook and phone combined :D)

Anyway, being the standard text editor on classic Mac OS, I often open smaller text documents in SimpleText (version 1.4). However, since all documents open to the default window size, which covers most of the screen, and I usually work with multiple documents, I constantly find myself resizing windows on open. It has now come to a point where I *really* wish I could modify the default window size with ResEdit :) Unfortunately, I'm not really up to the task myself.

So, anyone who would be interested in helping me out? :)

As a starting point, the code appears to work like this (tested on multiple systems and monitor resolutions):
  • The top left spacing is always 4, 40 px
  • The bottom spacing is always 34 px
  • If the display resolution is wide enough (actual threshold unknown), the window opens to 600 px wide, if not it opens with 80 px spacing to the right

SimpleText.png
 

PB170

Well-known member
What size would you like it to open to instead?
If it could determined where in the program code the window size is defined, any size should be possible. But in general smaller :) Would have to try out and tweak the ultimate size for my needs 🙂
 
Last edited:

PB170

Well-known member
By the way, Mac OS 8/9 could also benefit from a slight adjustment:

Squished.png

(Although the total lack of spacing doesn't stick out all that much among all the other things that broke visually post-System 7… 🤪)
 

nathall

Well-known member
By the way, Mac OS 8/9 could also benefit from a slight adjustment:



(Although the total lack of spacing doesn't stick out all that much among all the other things that broke visually post-System 7… 🤪)

I’m actually so irritated by this that I manually reposition the window under OS 8/9 to more closely match the spacing under 7 every time I open a SimpleText document. I’ve been doing it for so many years that it’s become a muscle memory thing.
 

adespoton

Well-known member
I thought that spacing had been an intentional thing under OS 8/9? I seem to recall reading a tech note on it at the time -- it covers Letter and 24 character layout, and leaves a column down the right for easy access to desktop icons in their default locations?
 

David Cook

Well-known member
I thought that spacing had been an intentional thing under OS 8/9? I seem to recall reading a tech note on it at the time -- it covers Letter and 24 character layout, and leaves a column down the right for easy access to desktop icons in their default locations?

I believe they are referring to the left side of the window appearing to get cut off, because the boarders are now wider.

I've analyzed the code, and made progress with a patch, but it is complicated. SimpleText has one routine for creating the window, but then calls out to other routines (and looks at some booleans) depending on the type of content ('TEXT', 'PICT', QuickDraw 3D, QuickTime, etc). If they had made separate routines for different types of content, each routine would be much simpler to modify.

At present, I can position the window anywhere and make it smaller, but I can't yet make it larger. There is a call towards the end that adjusts the width and height based on the content. I need to patch that.
 

PB170

Well-known member
I’m actually so irritated by this that I manually reposition the window under OS 8/9 to more closely match the spacing under 7 every time I open a SimpleText document. I’ve been doing it for so many years that it’s become a muscle memory thing.
Haha, sorry to hear that! 😂 Glad to know I'm not the only one who notices it though 🙂
 

PB170

Well-known member
I've analyzed the code, and made progress with a patch, but it is complicated. SimpleText has one routine for creating the window, but then calls out to other routines (and looks at some booleans) depending on the type of content ('TEXT', 'PICT', QuickDraw 3D, QuickTime, etc). If they had made separate routines for different types of content, each routine would be much simpler to modify.

At present, I can position the window anywhere and make it smaller, but I can't yet make it larger. There is a call towards the end that adjusts the width and height based on the content. I need to patch that.
Oh that's wonderful 🙌✨ Thanks a lot for having a look at it! 🙂

Have you been able to identify the routine that gets called when a TEXT document is opened? TEXT should be different from all the others in that it doesn't have a predefined size (and it's the only one I'm interested in changing). This should also apply for all new documents (since they're always text documents).

Were you able to find any values in the routines that correspond to the default values I identified above? I'm mainly interested in increasing the bottom value (34) and decreasing the default width (600), although tweaking the position could be nice as well.

Will a wide patch be required, or is it something that could be changed in Resedit by finding the right offsets in the code resource?

Many questions 😊 Anyway, big thanks again!
 

David Cook

Well-known member
Attached is the beta version of SimpleText that allows users to define window sizes.

1. First expand the attached .hqx file into the application using Tiny Transfer, BinHex, or StuffIt.
2. Using ResEdit, open the application
3. You'll see a resource called WSzT (for Window Size Text). Double click on it.

1762233411141.png

Here you'll see a list of screen sizes (such as 512x384) followed by a rectangle (top, left, bottom, right). To override the default text window size for a particular screen size, make sure that screen size is enabled and then edit the rectangle that you desire. You can add your own screen sizes if I missed any. You can even add duplicates and the first enabled will be used.

1762233380404.png

Caveats:
1. The "Window Content Size" rectangle represents the content area, not including the window borders. This is just how the Macintosh toolbox was programmed. So, if you make the rectangle match the screen dimensions, you wouldn't see any window borders or drag bars, because they'd be off the screen. Just play with the numbers until you like the results.

2. Don't use the Set button. It is some weird thing ResEdit includes so you can drag to create a rectangle.

3. Because the patched code now ignores all the corrections that SimpleText makes, it means it no longer overrides the window size for thick menu bars or to provide a row of icons on the right side. You can create a window completely offscreen now. If you don't like that, change the values.

4. You can add additional screen dimensions if I missed any. Click on any ***** thing and choose Insert New Fields(s) from the Resource menu.

5. I have had ResEdit corrupt the file a couple of times. I think ResEdit might have a bug with templates. So, make a backup copy as soon as you get a nice layout the way you like it.

Let me know what you discover.

David
 

Attachments

  • SimpleText UserWindow.hqx
    146.6 KB · Views: 1

David Cook

Well-known member
I wrote up the technical details over here:

 

PB170

Well-known member
Attached is the beta version of SimpleText that allows users to define window sizes.

1. First expand the attached .hqx file into the application using Tiny Transfer, BinHex, or StuffIt.
2. Using ResEdit, open the application
3. You'll see a resource called WSzT (for Window Size Text). Double click on it.

View attachment 92284

Here you'll see a list of screen sizes (such as 512x384) followed by a rectangle (top, left, bottom, right). To override the default text window size for a particular screen size, make sure that screen size is enabled and then edit the rectangle that you desire. You can add your own screen sizes if I missed any. You can even add duplicates and the first enabled will be used.

View attachment 92283

Caveats:
1. The "Window Content Size" rectangle represents the content area, not including the window borders. This is just how the Macintosh toolbox was programmed. So, if you make the rectangle match the screen dimensions, you wouldn't see any window borders or drag bars, because they'd be off the screen. Just play with the numbers until you like the results.

2. Don't use the Set button. It is some weird thing ResEdit includes so you can drag to create a rectangle.

3. Because the patched code now ignores all the corrections that SimpleText makes, it means it no longer overrides the window size for thick menu bars or to provide a row of icons on the right side. You can create a window completely offscreen now. If you don't like that, change the values.

4. You can add additional screen dimensions if I missed any. Click on any ***** thing and choose Insert New Fields(s) from the Resource menu.

5. I have had ResEdit corrupt the file a couple of times. I think ResEdit might have a bug with templates. So, make a backup copy as soon as you get a nice layout the way you like it.

Let me know what you discover.

David
Oh, wow! I'm not sure how you accomplished this, but this is far more than I had imagined or wished for!

I'm using the Swedish version of SimpleText (just used the default version above for clarity), but I copied over CODE resource #1 ("Main") along with the TMPL and WSzT resources, and it works like a charm! (Just out of curiosity, I tried to copy over only the CODE resource and expected the app to crash, but it gracefully just reverted back to the original behavior – very neat!)

Thank you so much for this! Finally no more constant window resizing. Love it! 🙌 Like I said, I'm using my PowerBook and SimpleText daily, so this will see instant use!

Would you mind elaborating a bit on how this works under the hood and what modifications you did? Did you implement new routines altogether, and redirect the present code? Seriously impressive in that case!
 

PB170

Well-known member
I wrote up the technical details over here:

Oh, I didn't see your update before I posed my reply. Wonderful! :D I considered maybe giving it a try myself, so I'll definitely give it thorough read. Thanks for sharing the process!
 

PB170

Well-known member
As a (highly irrelevant) aside, and to properly answer your first question ;):) — during the past weeks, in anticipation for a possible solution, I've taken screenshots of the windows I've resized, and overlapped the outlines to find the golden average :)
Window sizes.png

Turns out that my very personal preference is a nice and even 450 by 290 pixels :)
The golden average.png
Finally.png

I also took the opportunity to nudge the top down one pixel which I think look more balanced. Such a novel feeling to suddenly see SimpleText open windows just like I've set all my other apps to do.

Again, amazing work!
 

David Cook

Well-known member
Such a novel feeling to suddenly see SimpleText open windows just like I've set all my other apps to do.

Again, amazing work!

I am so glad this works for you. Definitely makes it worth the hack.

(Just out of curiosity, I tried to copy over only the CODE resource and expected the app to crash, but it gracefully just reverted back to the original behavior – very neat!)

Yup. I always go to the trouble of checking return values and nil pointers. Thank you for appreciating my work. : )

- David
 
Top