[comp.sys.mac.programmer] WDEF editor ?

jww502@anu.oz.au ("John W White") (04/28/91)

Hello  (always the best way to start off I always say :-))
	
	Since there are so many (well OK, a few) alternative WDEF inits around, I was wondering if there was an editor or something so that I (and possibly others :-)) can create my own.  If there isn't then how do you work out the resource ?  Hmmmmmmmmm ? :-)
	Also what about the same sort of thing for buttons (a la Olivers Buttons)  and which resource is used for that ?

Any answers to these ("AND OTHER" :-)) questions will be appreciated as they should be and treasured for the rest of my life (or until I get bored with fiddling with my Mac - I think the first option is more likely :-)

Dave "Vizard" White

--
 |   Dave White             |  This is the part where I say that when I    |
 |   jww502@csc2.anu.edu.au |  say what I say, I say what I say without    |
 |__________________________|  meaning that I say anything for the	   |
 |  Computer Services Centre or that I say anything for John W. White.     |

rang@cs.wisc.edu (Anton Rang) (04/29/91)

In article <1991Apr28.060530.22536@newshost.anu.edu.au> jww502@anu.oz.au ("John W White") writes:

>	Since there are so many (well OK, a few) alternative WDEF
>inits around, I was wondering if there was an editor or something so
>that I (and possibly others :-)) can create my own.  If there isn't
>then how do you work out the resource ?  Hmmmmmmmmm ? :-)

  A WDEF resource is just a chunk of 68000 code.  See Inside Mac for
details.  There are probably disassemblers around for it; the source
for the standard WDEF is available on apple.com.  To create one, you
can just use your favorite compiler--MPW, THINK Pascal, and THINK C
all make this easy.  (OK, "easy" is relative.  Fairly easy?)

>	Also what about the same sort of thing for buttons (a la
>Olivers Buttons) and which resource is used for that ?

  This is a CDEF resource, and the same answers as above apply.

	Anton
   
+---------------------------+------------------+-------------+----------------+
| Anton Rang (grad student) | rang@cs.wisc.edu | UW--Madison | "VMS Forever!" |
+---------------------------+------------------+-------------+----------------+

jtsweet@uokmax.ecn.uoknor.edu (Jonathan Thoma Sweet) (04/29/91)

rang@cs.wisc.edu (Anton Rang) writes:
 
>In article <1991Apr28.060530.22536@newshost.anu.edu.au> jww502@anu.oz.au ("John
 W White") writes:
 
>>      Since there are so many (well OK, a few) alternative WDEF
>>inits around, I was wondering if there was an editor or something so
>>that I (and possibly others :-)) can create my own.  If there isn't
>>then how do you work out the resource ?  Hmmmmmmmmm ? :-)
 
>  A WDEF resource is just a chunk of 68000 code.  See Inside Mac for
>details.  There are probably disassemblers around for it; the source
>for the standard WDEF is available on apple.com.  To create one, you
>can just use your favorite compiler--MPW, THINK Pascal, and THINK C
>all make this easy.  (OK, "easy" is relative.  Fairly easy?)
 
Yes but there must be some sort of a program that would be able to
generate the code.  I've looked in the Res. of a QuickChange document
(a cdev that changes your cursors, windows, buttons, and sounds) and
the only thing that defines the windows is the WDEF resource.  It's
not a huge resource and I'm sure there could be some kind of utility
to create a new recourse.
 
>>      Also what about the same sort of thing for buttons (a la
>>Olivers Buttons) and which resource is used for that ?
 
Maybe the editor could do both.
 
+-------------------------------+--------------------------------------+
| jtsweet@uokmax.ecn.uoknor.edu | "I'll get all the rest I need when   |
+-------------------------------+-----+    I die." - Road House        |
| "Oh God, I'm so depressed" - Marvin +--------------------------------+
| "Fully functional..." - DATA        |
+-------------------------------------+

hairston@henry.ece.cmu.edu (David Hairston) (04/29/91)

[jww502@anu.oz.au ("John W White") writes:]
[]       Since there are so many (well OK, a few) alternative WDEF
[] inits around, I was wondering if there was an editor or something so
[] that I (and possibly others :-)) can create my own.  If there isn't
[] then how do you work out the resource ?  Hmmmmmmmmm ? :-)

[rang@cs.wisc.edu (Anton Rang) writes:]
[]  A WDEF resource is just a chunk of 68000 code.  See Inside Mac for
[] details.  There are probably disassemblers around for it; the source
[] for the standard WDEF is available on apple.com.  To create one, you
[] can just use your favorite compiler--MPW, THINK Pascal, and THINK C
[] all make this easy.  (OK, "easy" is relative.  Fairly easy?)

[jtsweet@uokmax.ecn.uoknor.edu (Jonathan Thoma Sweet) writes:]
[] Yes but there must be some sort of a program that would be able to
[] generate the code.  I've looked in the Res. of a QuickChange document

WDEF's, CDEF's, LDEF's, etc. are _code_ resources, which are distinctly
different than data resources where you can simply plug and chug with
the numbers.  the program you need to generate code resources is a
compiler (unless you're an excellent hacker, then a hex editor is all
you need ... :)

consider the similar situation of writing applications (basically code
resources).  you don't normally expect to do this with a utility of
some sort (and if you can do this with a utility then your range of
possibilities would, most likely, be severely limited).

writing an xDEF is fairly simple (there's example code at apple.com
in pub/dts/mac/defprocs), however, except for a few simple cases,
writing one _correctly_ is non-trivial.  give it a try.  when/if you
master it, you'll understand your mac so much better ...

  -dave-  
hairston@henry.ece.cmu.edu

neeri@iis.ethz.ch (Matthias Ulrich Neeracher) (04/29/91)

In article <1991Apr28.232759.13768@uokmax.ecn.uoknor.edu>, jtsweet@uokmax.ecn.uoknor.edu (Jonathan Thoma Sweet) writes:
>rang@cs.wisc.edu (Anton Rang) writes:
>>  A WDEF resource is just a chunk of 68000 code.  See Inside Mac for
>>details.  There are probably disassemblers around for it; the source
>>for the standard WDEF is available on apple.com.  To create one, you
>>can just use your favorite compiler--MPW, THINK Pascal, and THINK C
>>all make this easy.  (OK, "easy" is relative.  Fairly easy?)
> 
>Yes but there must be some sort of a program that would be able to
>generate the code.  I've looked in the Res. of a QuickChange document
                                                  ^^^^^ ClickChange ?
>(a cdev that changes your cursors, windows, buttons, and sounds) and
>the only thing that defines the windows is the WDEF resource.  It's
>not a huge resource and I'm sure there could be some kind of utility
>to create a new recourse.

There are *lots* of such utilities. They are called "compilers" or
"assemblers". The reasons why the resource is small could be:

- The programmer and/or the compiler were clever.
- The task of a WDEF is relatively simple (especially in black & white)

Anyway, WDEF and CDEF resources are 100% pure 68000 binary code. 

>>>      Also what about the same sort of thing for buttons (a la
>>>Olivers Buttons) and which resource is used for that ?
> 
>Maybe the editor could do both.

Sure. Any compiler or assembler. Get the picture ? :-)

-- 
Matthias Neeracher                                      neeri@iis.ethz.ch
   "These days, though, you have to be pretty technical before you can 
    even aspire to crudeness." -- William Gibson, _Johnny Mnemonic_

Lawson.English@p88.f15.n300.z1.fidonet.org (Lawson English) (05/02/91)

Matthias Ulrich Neeracher writes in a message to All

MUN>Anyway, WDEF and CDEF resources are 100% pure 68000 binary code. 

>>>>      Also what about the same sort of thing for buttons (a la
>>>>Olivers Buttons) and which resource is used for that ?
>> 
>>Maybe the editor could do both.
MUN>  Sure. Any compiler or assembler. Get the picture ? :-

Is there any reason why the Drawing of a button CDEF couldn't be defined using
PICTs? A WDEF as a PICT seems unreasonable, but a drawing program that records
PICTs could have a shell that simply specifies which PICT is drawn for each
CDEF. IE, get a DrawCntl msgCode and use PICT id 3386 for unhilited, 3387 for
hilited, etc.


This would be a generic button CDEF editor. WDEF's might be a bit trickier,
but some enterprising soul could do it: maybe have a default rectangle (or circle
or whatever) that all parts of the WDEF must lie inside of and treat the drawing
and updating, etc. as a series of DrawPict calls... Maybe even irregular regions
could be specified for the frame. A zooming irregular window would be a bit
tricky, but no doubt someone could work it out... Maybe successive calls to
InsetRgn, DrawRgn with XOR could do it for generic irregular windows...

Comments, criticism, flames (lots of those, no doubt!)?


Lawson
 

--  
Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!300!15.88!Lawson.English
Internet: Lawson.English@p88.f15.n300.z1.fidonet.org

mxmora@unix.SRI.COM (Matt Mora) (05/02/91)

In article <1991Apr29.082930.26902@bernina.ethz.ch> neeri@iis.ethz.ch (Matthias Ulrich Neeracher) writes:

[stuff deleted about WDEF and CDEF.]
>Sure. Any compiler or assembler. Get the picture ? :-)
>

I think a Wdef editor could be done. Earle Horton wrote a configurable
WDEF. In his wdef you could change the drag region size, position, font & 
fontsize of the title bar text. Size of the scrollbars could also be changed.

I don't think it would be too hard to write a cdev to let you edit these 
parameters on the fly in the control panel. So it is posible. But it would
require Earle's wdef or something similar. You couldn't do it with Apple's
wdef. At least not very easily.

Matt



-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________

neeri@iis.ethz.ch (Matthias Ulrich Neeracher) (05/03/91)

In article <23843@unix.SRI.COM>, mxmora@unix.SRI.COM (Matt Mora) writes:
>I think a Wdef editor could be done. Earle Horton wrote a configurable
>WDEF. In his wdef you could change the drag region size, position, font & 
>fontsize of the title bar text. Size of the scrollbars could also be changed.

What I had in mind was a WDEF editor offering the variety of, say, ClickChange,
without having the different WDEFs hardcoded. I don't believe THAT could
be reasonably done.

Matthias

-- 
Matthias Neeracher                                      neeri@iis.ethz.ch
   "These days, though, you have to be pretty technical before you can 
    even aspire to crudeness." -- William Gibson, _Johnny Mnemonic_