[comp.sys.amiga] Lattice C Power Windows

tron1@tronsbox.UUCP (HIM) (12/02/89)

Hi net.programmers!


Listen , I am using Power_Windows 2.5 , and Lattice C 5.04 .

I am attempting to render a screen/window combo. These products have worked
well for me together before , but can't seem to get it straight now.

The problem is in custom images for gadgets. I used PW2.5 to set up the
gadgets using DpaintII brushes, and In power windows it looked GREAT.

I generated the source with ALL flags on (including BORDER and LOCAL
STRUCTURES) , and with all off with the same result.

When the Code generated is compiled into the sampole program they give you ,
the gadget images are hopelessly munged. The gadgets ARE there , and If I do
this without the custom imagrey , it works right.

ANyone used this combo and can tell me what the problem is?

****************************************************************************
"Perfume and leather baby , you and me together baby,
  what good is living in paradise, if you don't let yourself once or twice."
 -Tiffany  
 
 Kenneth J. Jamieson ---- THE BOSS at Xanadu Enterprises Inc.
      UUCP: tron1@tronsbox.UUCP  BEST PATH ---> uunet!tronsbox!tron1 
      Sysop, The Penthouse ]I[ BBS - (201)759-8450 / (201)759-8568 
****************************************************************************

bevis@EE.ECN.PURDUE.EDU (Jeff Bevis) (12/03/89)

In article <[2577758d:2917]comp.sys.amiga@tronsbox.UUCP>, tron1@tronsbox.UUCP (HIM) writes:
>I am attempting to render a screen/window combo. These products have worked
>well for me together before , but can't seem to get it straight now.
>
>The problem is in custom images for gadgets. I used PW2.5 to set up the
>gadgets using DpaintII brushes, and In power windows it looked GREAT.
>
>When the Code generated is compiled into the sampole program they give you ,
>the gadget images are hopelessly munged. The gadgets ARE there , and If I do
>this without the custom imagrey , it works right.
>

When PW writes its code for you, it declares all of its image data like this:

USHORT ImageDataXX {
0x0000,0xffff,0x0000,0xffff
};

But for blit'able imagery (as is used in Intuition Image structs), you must
place the image data in chip memory.  Under Lattice 5.04, this is as simple
as modifying the declarations with the addition of the "chip" keyword.

USHORT chip ImageDataXX {
0x0000,0xffff,0x000,0xffff
};

If you've got a huge data file, full of lots of gadgetry (with images), just
use your editor to do a search and replace of

	USHORT ImageData
with
	USHORT chip ImageData

and all will be fine.  It's a nuisance, but workable.  Certainly, it is still
better than designing gadgets & images by hand!!

As an aside, I have found that DPaint III pics cause problems for the
PowerWindows "screen palette" function -- loading a DPIII pic's color set
into the current screen DOES NOT SEEM TO WORK.  Instead, the program will
hang (not crash).  Be forewarned.  PW2.5 is begging to be revised for these
newer, modern times.


+--------------------------------+--------------------------------------------+
| Jeff Bevis 		         | "But I don't like spam!"		      |
| bevis@en.ecn.purdue.edu	 | 	     Give me Amiga or nothing at all. |
+--------------------------------+--------------------------------------------+

brandonl@amadeus.WR.TEK.COM (Brandon G. Lovested) (12/03/89)

Oooops.  Is this true?  - About PW2.5 hanging with DeluxePaint III?
Good thing I haven't bought them yet (I was planning on it next week!).
As someone who is on the immediate verge of buying an A2000 system, and
hearing that PW2.5 is a great program, and so is DPaint-III, I ask...

			PW2.6? or PW3.0?

			When ?
	
	
			*gulp!*



================================================================================
                             |
Brandon G. Lovested          |	"I will not be pushed, filed, stamped,
		             |	 indexed, briefed, debriefed, or numbered!
brandonl@amadeus.WR.TEK.COM  |	 My life is my own."  
                             |
================================================================================

fgd3@jc3b21.UUCP (Fabbian G. Dufoe) (12/04/89)

From article <[2577758d:2917]comp.sys.amiga@tronsbox.UUCP>, by tron1@tronsbox.UUCP (HIM):
> Listen , I am using Power_Windows 2.5 , and Lattice C 5.04 .
> 
> The problem is in custom images for gadgets. I used PW2.5 to set up the
> gadgets using DpaintII brushes, and In power windows it looked GREAT.
> 
> I generated the source with ALL flags on (including BORDER and LOCAL
> STRUCTURES) , and with all off with the same result.
> 
> When the Code generated is compiled into the sampole program they give you ,
> the gadget images are hopelessly munged. The gadgets ARE there , and If I do
> this without the custom imagrey , it works right.
> 
> ANyone used this combo and can tell me what the problem is?

     Power Windows doesn't put the chip keyword in its source.  The
simplest fix is to revise the source generated by Power Windows by adding
"chip" to your image definitions.  For example, Power Windows might
generate:

     USHORT RightArrowImageData[] =
     { ... };

You need to change it to:

     USHORT chip RightArrowImageData[] =
     { ... };

That tells the Lattice compiler to store the image data in chip RAM.  If
you have the Manx compiler you can't use the chip keyword.  With both Manx
and Lattice you can compile the module containing image data separately
with a compiler flag specifying chip RAM.  

--Fabbian Dufoe
  350 Ling-A-Mor Terrace South
  St. Petersburg, Florida  33705
  813-823-2350

UUCP: ...uunet!pdn!jc3b21!fgd3

bevis@EE.ECN.PURDUE.EDU (Jeff Bevis) (12/04/89)

In article <906@wrgate.WR.TEK.COM>, brandonl@amadeus.WR.TEK.COM (Brandon G. Lovested) writes:
>
>Oooops.  Is this true?  - About PW2.5 hanging with DeluxePaint III?

Wait -- hold on!  Don't get all excited just yet.  I DIDN'T say that DPIII
pic's won't load into PW2.5 for gadget render/select imagery;  They do.
I only said (or meant) that I had PW hang every time I tried to load the
screen colors from an ilbm file.  Now, that still leaves PW quite functional
on the whole (although not perfect).  On the other hand,  PW DEFINITELY does
need to be beefed up for Lattice 5.0x (with support of the chip keyword when
declaring image data arrays, and so forth).  It's quite a useful program,
and I don't see how any serious Intuition programmer could get by without 
it.


+--------------------------------+--------------------------------------------+
| Jeff Bevis 		         | "But I don't like spam!"		      |
| bevis@en.ecn.purdue.edu	 | 	     Give me Amiga or nothing at all. |
+--------------------------------+--------------------------------------------+

koshy@abekrd.UUCP (Koshy Abraham) (12/06/89)

tron1@tronsbox.UUCP (HIM) writes:

[Stuff deleted...]

>ANyone used this combo and can tell me what the problem is?

Try putting the images into CHIP RAM.

-- 
Koshy Abraham               NET: koshy@abekrd.co.uk
Abekas Video Systems Ltd.  UUCP: ...!mcvax!ukc!{reading,pyrltd}!abekrd!koshy
12 Portman Rd,   Reading, PHONE: +44 734 585421      //     |<= This looks
Berkshire.       RG3 1EA.   FAX: +44 734 597267  K\A//b     |better when
United Kingdom.           TELEX: 847579            \/       |printed.

mab@druwy.ATT.COM (Alan Bland) (12/10/89)

With all the talk about Power Windows not putting Image data in chip RAM
for Lattice 5.0x, I thought I'd share the makefile I use when I'm programming
with Power Windows 2.5 and Lattice 5.04.  It automagically edits the code
generated by Power Windows to add the chip keyword at the appropropriate
spots, and it also creates a header file containing extern definitions of
some of the PW-generated structures.

I offer this makefile with NO promise to support it (it took me enough time
to figure out how to use Commodore's "edit" program, maybe I should find
"sed" somewhere).  This is a makefile from a specific project that uses
only Windows and Gadgets, I do NOT use the PW-generated driver, I use
the ARP 1.3 Ashell with the BCPL escape char set to a backslash, and
probably a whole bunch of other things that will keep this from working
perfectly for you the first time.  You probably also will not like my
choice of compiler and linker options.  Aside from all that, it's worked
great for me for many different projects.  Enough said.  Here it is.  Enjoy!

##
## TARGET is the name of the final executable file.
## OBJECT is a list of all object files to be included.
## PW is the basename (without extension) of the Power Windows files:
##       $(PW).pw is the PW definition file
##       $(PW).out is the source code generated by PW
##       $(PW).c is the Lattice 5 source code created from $(PW).out
##       $(PW).h is the extern defs created from $(PW).out
##
TARGET = gr
OBJECT = grmain.o grpw.o grwin.o
PW = grpw

all : $(TARGET)

##
## Set CDEBUG and LDEBUG to appropriate debug options for compile and link.
##
# CDEBUG = -d5
# LDEBUG = addsym
CDEBUG =
LDEBUG = nodebug

##
## Default compiler rule.
##
.c.o :
	lc:lc1 -. $(CDEBUG) -cf -cs -oram: $*
	lc:lc2 -. -v -o$*.o ram:$*

##
## Rule to create Lattice 5 Power Windows source and header file.
## For each NewWindowStructure in the file, duplicate the echo line
## listed below to name the structure what you want (or delete it
## if you prefer to use the PW-generated names).  If you use other
## structs that need to be declared extern, modify the appropriate
## edit commands below.
##
$(PW).c : $(PW).out
	copy $(PW).out t:t0
	echo >t:t1 "gb/struct Gadget/extern /;gb/struct NewWindow/extern /;ge/ = {/;/;0(df/extern/;n)"
	edit t:t0 to t:t2 with t:t1 opt w200
	echo >>t:t2 "\#define NewWindowGraph NewWindowStructure1"
	copy t:t2 $(PW).h
	echo >t:t1 "ge/USHORT Image/USHORT chip Image/"
	edit t:t0 to t:t2 with t:t1 opt w200
	echo >$(PW).c "\#include <intuition/intuition.h>"
	type >>$(PW).c t:t2
	delete t:t0 t:t1 t:t2

##
## Rule to create the target.  The first dependency should be $(PW).c
## if Power Windows has been used to create the Intuition structures.
##
$(TARGET) : $(PW).c $(OBJECT)
	lc:blink to $(TARGET) from lib:c.o $(OBJECT) batch $(LDEBUG) \
	lib lib:lcm.lib lib:lc.lib lib:amiga.lib
-- 
-- Alan Bland
-- att!druwy!mab == mab@druwy.ATT.COM
-- AT&T Bell Laboratories, Denver CO
-- (303)538-3510    "Musicians do it in the MIDI of the night"

tron1@tronsbox.UUCP (HIM) (12/21/89)

>With all the talk about Power Windows not putting Image data in chip RAM
>for Lattice 5.0x, I thought I'd share the makefile I use when I'm programming
>with Power Windows 2.5 and Lattice 5.04.  It automagically edits the code

Thanks! I am working out of LSE though .. but think I can change the
compiler options.

For the most part -- I just "FIXHUNK" (remember THAT??) the bugger

****************************************************************************
"Perfume and leather baby , you and me together baby,
  what good is living in paradise, if you don't let yourself once or twice."
 -Tiffany  
 
 Kenneth J. Jamieson ---- THE BOSS at Xanadu Enterprises Inc.
      UUCP: tron1@tronsbox.UUCP  BEST PATH ---> uunet!tronsbox!tron1 
      Sysop, The Penthouse ]I[ BBS - (201)759-8450 / (201)759-8568 
****************************************************************************