
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*									*
*		     * * * *						*
*		    *	  *						*
*		   *     *   _________________________________________	*
*		  *     *   /					     /	*
*		 *     *   /  Code Source Assembleur de AppPP v1.0  /	*
* 		*     *   /					   /	*
*  * * * *     *     *   /  Assembly Source Code of  AppPP v1.0   /	*
*   *     *   *     *	/					 /	*
*    *     * *     *   /         - by BURNAND Patrick -		/	*
*     *     *	  *   /					       /	*
*      *	 *    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯		*
*	* * * * *							*
*									*
*									*
*									*
*   Ce code source est distribué avec le package AppPP et ne doit pas	*
*   être distribué autrement.  Il doit toujours être maintenu dans sa	*
*   forme originale et non-modifiée. Ce fichier est distribué pour l'	*
*   apprentisage et comme example seulement. Vous avez l'autorisation	*
*   d'imprimer  ce  fichier,  mais  vous  n'avez  pas  le droit de le	*
*   distribuer  sous forme d'imprimé.   Si vous voulez faire d'autres	*
*   usages  de ce code source,  contacter l'auteur.    Mon adresse se	*
*   trouve dans la doc de ce programme.					*
*									*
*									*
*   This  source  code  is distributed with the AppPP package and may	*
*   not be distrbuted by another way.    It  must  always  be kept in	*
*   original and unmodifed form.   This file is distributed for lear-	*
*   ning purposes and as example only.  You are allowed to print this	*
*   file but you aren't allowed to distribute it in printed form.  If	*
*   you	 want  to  make others uses of this source code,  contact the	*
*   author.  My adress can be found in the doc file of this program.	*
*									*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *



* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*   Définition des constantes.  (Ne prend pas de place dans le code)  * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 
ExecBase               =          4

OpenScreenTagList      =       -612
OpenWindowTagList      =       -606
CloseScreen            =        -66
CloseWindow            =        -72
PrintIText             =       -216
LockPubScreen          =       -510
UnlockPubScreen        =       -516
SetMenuStrip           =       -264
ClearMenuStrip         =        -54
EasyRequestArgs        =     -$024c
GetVisualInfoA         =       -126
FreeVisualInfo         =       -132
CreateContext          =       -114
CreateGadgetA          =        -30
GT_RefreshWindow       =        -84
FreeGadgets            =        -36
CreateMenusA           =        -48
LayoutMenusA           =        -66
FreeMenus              =        -54
OpenDiskFont           =        -30
CloseFont              =        -78
DrawBevelBoxA          =       -120
FreeClass              =       -714
NewObjectA             =       -636
DisposeObject          =       -642
TextLength             =        -54
CopyMem                =       -624
FindTagItem            =        -30
IntuiTextLength        =       -330
FindTask               =     -$0126
Forbid                 =       -132
Permit                 =       -138
OpenLibrary            =       -552
CloseLibrary           =       -414

AllocFileRequest       =     -$001e
FreeFileRequest        =     -$0024
RequestFile            =     -$002a
AllocAslRequest        =     -$0030
FreeAslRequest         =     -$0036
AslRequest             =     -$003c
WaitPort               =     -$0180
GT_GetIMsg             =     -$0048
GT_ReplyIMsg           =     -$004e
GT_BeginRefresh        =     -$005a
GT_EndRefresh          =     -$0060
GT_SetGadgetAttrsA     =     -$002a
GetDiskObjectNew       =     -$0084
FreeDiskObject         =     -$005a
CreateMsgPort          =     -$029a
DeleteMsgPort          =     -$02a0
AddAppIconA            =     -$003c
RemoveAppIcon          =     -$0042
GetMsg                 =     -$0174
ReplyMsg               =     -$017a
FreeMem                =     -$00d2
AllocMem               =     -$00c6
CurrentDir             =     -$007e
OpenFromLock           =     -$017a
Open                   =     -$001e
Close                  =     -$0024
Read                   =     -$002a
Write                  =     -$0030
DeleteFile             =     -$0048
FPutS                  =     -$0156
FPutC                  =     -$0138
PutStr                 =     -$03b4
Flush                  =     -$0168
AllocDosObject         =     -$00e4
FreeDosObject          =     -$00ea
Examine                =     -$0066
GetProgramDir          =     -$0258
NameFromLock           =     -$0192
AddPart                =     -$0372
Lock                   =     -$0054
UnLock                 =     -$005a
Output                 =     -$003c
Delay                  =     -$00c6

; -- PowerPacker.library --
ppLoadData             =     -$001e
ppDecrunchBuffer       =     -$0024
ppCalcChecksum         =     -$002A
ppCalcPasskey          =     -$0030
ppDecrypt              =     -$0036
ppGetPassword          =     -$003C
ppAllocCrunchInfo      =     -$0060
ppFreeCrunchInfo       =     -$0066
ppCrunchBuffer         =     -$006C
ppWriteDataHeader      =     -$0072
ppEnterPassword        =     -$0078
ppErrorMessage         =     -$0084


;________________________________________________________________________


; -- MenuItem --
CheckIt                =       $0001
ItemText               =       $0002
CommSeq                =       $0004
MenuToggle             =       $0008
ItemEnabled            =       $0010
HighFlags              =       $00c0
HighImage              =       $0000
HighComp               =       $0040
HighBox                =       $0080
HighNone               =       $00c0
Checked                =       $0100
IsDrawn                =       $1000
HighItem               =       $2000
MenuToggled            =       $4000

; -- Requester --
PointRel               =       $0001
PreDrawn               =       $0002
NoisyReq               =       $0004
SimpleReq              =       $0010
UserReqImage           =       $0020
NoReqBackFill          =       $0040
ReqOffWindow           =       $1000
ReqActive              =       $2000
SysRequest             =       $4000
DeferRefresh           =       $8000

; -- Gadget --
GFLG_GadHighBits       =       $0003
GFLG_GadGhComp         =       $0000
GFLG_GadGhBox          =       $0001
GFLG_GadGhImage        =       $0002
GFLG_GadGhNone         =       $0003
GFLG_GadgImage         =       $0004
GFLG_RelBottom         =       $0008
GFLG_RelRight          =       $0010
GFLG_RelWidth          =       $0020
GFLG_RelHeight         =       $0040
GFLG_Selected          =       $0080
GFLG_Disabled          =       $0100
GFLG_LabelMask         =       $3000
GFLG_LabelIText        =       $0000
GFLG_LabelString       =       $1000
GFLG_LabelImage        =       $2000
GFLG_TabCycle          =       $0200
GFLG_StringExtend      =       $0400
GACT_RelVerify         =       $0001
GACT_Immediate         =       $0002
GACT_EndGadget         =       $0004
GACT_FollowMouse       =       $0008
GACT_RightBorder       =       $0010
GACT_LeftBorder        =       $0020
GACT_TopBorder         =       $0040
GACT_BottomBorder      =       $0080
GACT_BorderSniff       =       $8000
GACT_ToggleSelect      =       $0100
GACT_BoolExtend        =       $2000
GACT_StringLeft        =       $0000
GACT_StringCenter      =       $0200
GACT_StringRight       =       $0400
GACT_LongInt           =       $0800
GACT_AltKeymap         =       $1000
GACT_StringExtend      =       $2000
GACT_ActiveGadget      =       $4000
GTYP_GadgetType        =       $fc00
GTYP_SysGadget         =       $8000
GTYP_ScrGadget         =       $4000
GTYP_GzzGadget         =       $2000
GTYP_ReqGadget         =       $1000
GTYP_Sizing            =       $0010
GTYP_WDragging         =       $0020
GTYP_SDragging         =       $0030
GTYP_WUpFront          =       $0040
GTYP_SUpFront          =       $0050
GTYP_WDownBack         =       $0060
GTYP_SDownBack         =       $0070
GTYP_Close             =       $0080
GTYP_BoolGadget        =       $0001
GTYP_Gadget0002        =       $0002
GTYP_PropGadget        =       $0003
GTYP_StrGadget         =       $0004
GTYP_CustomGadget      =       $0005
GTYP_GTYPMask          =       $0004

; -- BoolInfo --
BoolMask               =       $0001

; -- IntuiMessage --
IDCMP_SizeVerify       =   $00000001
IDCMP_NewSize          =   $00000002
IDCMP_RefreshWindow    =   $00000004
IDCMP_MouseButtons     =   $00000008
IDCMP_MouseMove        =   $00000010
IDCMP_GadgetDown       =   $00000020
IDCMP_GadgetUp         =   $00000040
IDCMP_ReqSet           =   $00000080
IDCMP_MenuPick         =   $00000100
IDCMP_CloseWindow      =   $00000200
IDCMP_RawKey           =   $00000400
IDCMP_ReqVerify        =   $00000800
IDCMP_ReqClear         =   $00001000
IDCMP_MenuVerify       =   $00002000
IDCMP_NewPrefs         =   $00004000
IDCMP_DiskInserted     =   $00008000
IDCMP_DiskRemoved      =   $00010000
IDCMP_WBenchMessage    =   $00020000
IDCMP_ActiveWindow     =   $00040000
IDCMP_InactiveWindow   =   $00080000
IDCMP_DeltaMove        =   $00100000
IDCMP_VanillaKey       =   $00200000
IDCMP_Intuiticks       =   $00400000
IDCMP_IDCMPUpdate      =   $00800000
IDCMP_MenuHelp         =   $01000000
IDCMP_ChangeWindow     =   $02000000
IDCMP_LonelyMessage    =   $80000000
MenuHot                =       $0001
MenuCancel             =       $0002
MenuWaiting            =       $0003
OkOk                   =   MenuHot
OkAbort                =       $0004
OkCancel               =   MenuCancel
WBenchOpen             =       $0001
WBenchClose            =       $0002

; -- NewWindow --
WFLG_SizeGadget        =       $0001
WFLG_DragBar           =       $0002
WFLG_DepthGadget       =       $0004
WFLG_CloseGadget       =       $0008
WFLG_SizeBright        =       $0010
WFLG_SizeBottom        =       $0020
WFLG_RefreshBits       =       $00c0
WFLG_Smart_Refresh     =       $0000
WFLG_Simple_Refresh    =       $0040
WFLG_Super_Bitmap      =       $0080
WFLG_Other_Refresh     =       $00c0
WFLG_BackDrop          =       $0100
WFLG_ReportMouse       =       $0200
WFLG_GimmeZeroZero     =       $0400
WFLG_BorderLess        =       $0800
WFLG_Activate          =       $1000
WFLG_WindowActive      =       $2000
WFLG_InRequest         =       $4000
WFLG_MenuState         =       $8000
WFLG_RmbTrap           =   $00010000
WFLG_NoCareRefresh     =   $00020000
WFLG_WindowRefresh     =   $01000000
WFLG_WBenchWindow      =   $02000000
WFLG_WindowTicked      =   $04000000
SuperUnused            =   $fcfc0000
WFLG_NwExtended        =   $00040000
WFLG_Visitor           =   $08000000
WFLG_Zoomed            =   $10000000
WFLG_HasZoom           =   $20000000
DefaultMouseQueue      =           5

; -- IntuiText --
It_LeftEdge            =           4
It_TopEdge             =           6
It_ITextFont           =           8
It_SIZEOF              =          20

;-- RastPort --
rp_Font                =          52


; -- GadTools --
Generic_Kind           =           0
Button_Kind            =           1
CheckBox_Kind          =           2
Integer_Kind           =           3
ListView_Kind          =           4
MX_Kind                =           5
Number_Kind            =           6
Cycle_Kind             =           7
Palette_Kind           =           8
Scroller_Kind          =           9
Slider_Kind            =          11
String_Kind            =          12
Text_Kind              =          13
Num_Kinds              =          14
ButtonIDCMP            =   IDCMP_GadgetUp
CheckBoxIDCMP          =   IDCMP_GadgetUp
IntegerIDCMP           =   IDCMP_GadgetUp
;ListViewIDCMP          =   IDCMP_GadgetUp!IDCMP_GadgetDown!IDCMP_MouseMove!IDCMP_ArrowIDCMP
MxIDCMP                =   IDCMP_GadgetDown
NumberIDCMP            =   0
CycleIDCMP             =   IDCMP_GadgetUp
PaletteIDCMP           =   IDCMP_GadgetUp
ScrollerIDCMP          =   IDCMP_GadgetUp!IDCMP_GadgetDown!IDCMP_MouseMove ;IDCMP_ArrowIDCMP!IDCMP_ScrollerIDCMP
SliderIDCMP            =   IDCMP_GadgetUp!IDCMP_GadgetDown!IDCMP_MouseMove
StringIDCMP            =   IDCMP_GadgetUp
TextIDCMP              =   0
GadToolsBit            =       $8000
PlaceText_Left         =       $0001
PlaceText_Right        =       $0002
PlaceText_Above        =       $0004
PlaceText_Below        =       $0008
PlaceText_In           =       $0010
Ng_HighLabel           =       $0020
Nm_Title               =           1
Nm_Item                =           2
Nm_Sub                 =           3
Nm_End                 =           0
Menu_Image             =         128
Nm_BarLabel            =          -1
GtMX_Labels            =   $80080009
GtBB_Recessed          =   $80080033
GT_VisualInfo          =   $80080034
GTCB_Checked           =   $80080004
GTNM_Number            =   $8008000d
GTNM_Border            =   $8008003a
GTCY_Labels            =   $8008000e
GTCY_Active            =   $8008000f
GTST_MaxChars          =   $8008002e
GTST_String            =   $8008002d
GTTX_Text              =   $8008000b
GTTX_CopyText          =   $8008000c
GTTX_Border            =   $80080039

; -- Intuition --
GA_Disabled            =   $8003000e

; -- Asl --
ASL_Hail               =   $80080001
ASL_Window             =   $80080002
ASL_File               =   $80080008
ASL_Dir                =   $80080009
ASL_OKText             =   $80080012
ASL_CancelText         =   $80080013
ASL_FuncFlags          =   $80080014
ASL_ExtFlags1          =   $80080016

; -- AslRequestStruct --
rf_File                =           4
rf_Dir                 =           8

; -- TagItem --
Tag_Done               =          0
Tag_User               =  $80000000

; -- Screen --
sc_Width               =         12
sc_Height              =         14
sc_WBorTop             =         35
sc_WBorLeft            =         36
sc_WBorRight           =         37
sc_WBorBottom          =         38
sc_Font                =         40
sc_RastPort            =         84

; -- ExtNewWindow --
WA_Left                =  $80000064
WA_Top                 =  $80000065
WA_Width               =  $80000066
WA_Height              =  $80000067
WA_IDCMP               =  $8000006a
WA_Flags               =  $8000006b
WA_Gadgets             =  $8000006c
WA_Title               =  $8000006e
WA_AutoAdjust          =  $80000090

; -- TextAttr --
Ta_Name                =          0
Ta_YSize               =          4
Ta_Style               =          6
Ta_Flags               =          7

; -- TextFont --
tf_YSize               =         20
tf_XSize               =         24

; -- NewGadget --
gng_SizeOf             =         30
gng_LeftEdge           =          0
gng_TopEdge            =          2
gng_Width              =          4
gng_Height             =          6
gng_GadgetText         =          8
gng_TextAttr           =         12
gng_GadgetID           =         16
gng_Flags              =         18
gng_VisualInfo         =         22
gng_UserData           =         26

; -- PowerPacker --
Decr_Col0              =          0
Decr_Col1              =          1
Decr_Pointer           =          2
Decr_Scroll            =          3
Decr_None              =          4
SpeedUp_BuffLarge      =          0
SpeedUp_BuffMedium     =          1
SpeedUp_BuffSmall      =          2
Crun_Fast              =          0
Crun_Mediocre          =          1
Crun_Good              =          2
Crun_VeryGood          =          3
Crun_Best              =          4

; -- Window --
Wd_RPort               =         50
Wd_BorderLeft          =         54
Wd_BorderTop           =         55
Wd_BorderRight         =         56
Wd_BorderBottom        =         57
Wd_BorderRPort         =         58
wd_IFont               =        128

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

GD_Working_Crunch      =   0
GD_Working_Decrunch    =   1
GD_Working_Nothing     =   2
GD_Working_Skip        =   3
GD_Working_Stop        =   4
GD_Working_Status      =   5
GD_Working_Name        =   6
GD_Working_Length      =   7
GD_Working_Dest        =   8

GD_Config_UseAltPath   =   0
GD_Config_Eff          =   1
GD_Config_Buf          =   2
GD_Config_DecrEff      =   3
GD_Config_Save         =   4
GD_Config_Use          =   5
GD_Config_Cancel       =   6
GD_Config_Quit         =   7
GD_Config_AltPath      =   8
GD_Config_Get          =   9
GD_Config_About        =  10

GD_Inter               =   0

Working_CNT            =   9
Config_CNT             =  11
About_CNT              =   1
GadgetMaxNumber        =  11

Working_TNUM           =   0
Config_TNUM            =   0
About_TNUM             =   6

WorkingLeft            =  98
WorkingTop             =  88
WorkingWidth           = 361
WorkingHeight          = 159

Working0_Left          =  12
Working0_Top           =  33
Working0_Width         = 337
Working0_Height        = 115

Working1_Left          =   3
Working1_Top           =   4
Working1_Width         = 353
Working1_Height        = 151

ConfigLeft             =  89
ConfigTop              = 108
ConfigWidth            = 293
ConfigHeight           = 168

Config0_Left           =   4
Config0_Top            =  57
Config0_Width          = 285
Config0_Height         =  81

AboutLeft:             = 209
AboutTop:              =  49
AboutWidth:            = 352
AboutHeight:           = 198

About0_Left            =   5
About0_Top             =   6
About0_Width           = 341
About0_Height          = 155

FileNameBufferL        = 256
ConfigBufferL          = 488

; -- ConfigBuffer --
CP_Config_Version      =   0
CP_Config_UseAltPath   =   1
CP_Config_Efficiency   =   2
CP_Config_Buffer       =   3
CP_Config_Effect       =   4
CP_Config_AltPath      =  14
CP_Config_F            = 488



* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *



	Move.l	A7,Stack		; Sauver le pile
	Jmp	Start


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*   Version d'AppPP.  Cette chaîne s'affiche avec la commande Version.  *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

	dc.b	'$VER:AppPP_1.0',0,0




Start:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  S'occupe de prendre le message du Wb.  * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

	Move.l	ExecBase,a6
	Suba.l	a1,a1			; Notre processus
	Jsr	FindTask(a6)		; Obtenir un pointeur sur processus

	Move.l	d0,a3
	Tst.l	$ac(a3)			; Process->pr_CLI  =?  0
	Bne	End_0 			; Non, lancé depuis le CLI, on quitte

	S_WaitWbMsg:			; Oui, on continue
	Lea	$5c(a3),a0		; Process->pr_MsgPort
	Jsr	WaitPort(a6)		; Attendre l'arrivée d'un message

	Lea	$5c(a3),a0		; Process->pr_MsgPort
	Jsr	GetMSG(a6)		; Prendre le message sur le port
	Move.l	d0,WbMsg
	Beq.s	S_WaitWbMsg


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Ouvrir toutes les librairies dont on a besoin.   * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

	Move.l	ExecBase,a6
	Lea	IconName,a1
	Moveq	#37,d0
	Jsr	OpenLibrary(a6)
	Move.l	d0,IconBase
	Beq	End

	Lea	WorkbenchName,a1
	Moveq	#37,d0
	Jsr	OpenLibrary(a6)
	Move.l	d0,WorkbenchBase
	Beq	End

	Lea	DosName,a1
	Moveq	#36,d0
	Jsr	OpenLibrary(a6)
	Move.l	d0,DosBase
	Beq	End

	Lea	GadtoolsName,a1
	Moveq	#36,d0
	Jsr	OpenLibrary(a6)
	Move.l	d0,GadtoolsBase
	Beq	End

	Lea	IntuitionName,a1
	Moveq	#36,d0
	Jsr	OpenLibrary(a6)
	Move.l	d0,IntuitionBase
	Beq	End

	Lea	ppName,a1
	Moveq	#35,d0
	Jsr	OpenLibrary(a6)
	Move.l	d0,ppBase
	Beq	End


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Installer l'AppIcon dans le WB.  (Utilise l'icône du programme)  * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

	Move.l	ExecBase,a6
	Move.l	#$1,d1			; PublicMem
	Move.l	#FileNameBufferL,d0	; Allouer un tampon pour le nom
	Jsr	AllocMem(a6)
	Move.l	d0,FileNameBuffer
	Beq	End

	Move.l	DosBase,a6
	Jsr	GetProgramDir(a6)	; Obtenir un Lock sur le répertoire
	Move.l	d0,DirLock

	Move.l	DirLock,d1		; Lock sur le répertoire
	Move.l	FileNameBuffer,d2	; Adresse du tampon
	Move.l	#FileNameBufferL,d3	; Longueur
	Jsr	NameFromLock(a6)	; Obtenir le nom du répertoire de démarrage
	Tst.l	d0			; NameFromLock Ok ?
	Bne.s	S_NameFromLock_Ok	; Oui, on continue
	Bsr	FreeFileNameBuffer	; Non, libérer le tampon
	Jmp	End			; Terminer le programme
	S_NameFromLock_Ok:

	Move.l	FileNameBuffer,d1	; DirName
	Move.l	#ProgramName,d2		; FileName
	Move.l	#FileNameBufferL,d3	; Size
	Jsr	AddPart(a6)		; rassembler le dir et le nom de fichier
	Tst.l	d0			; AddPart Ok ?
	Bne.s	S_AddPart_Ok		; Oui, on continue
	Bsr	FreeFileNameBuffer	; Libérer le tampon
	Jmp	End			; Terminer le programme
	S_AddPart_Ok:

	Move.l	IconBase,a6
	Move.l	FileNameBuffer,a0	; Nom du programme
	Jsr	GetDiskObjectNew(a6)	; Obtenir la structure DiskObject
	Move.l	d0,DiskObject
	Bsr	FreeFileNameBuffer	; Libérer le tampon
	Tst.l	DiskObject		; Obtention du DiskObject Ok ?
	Bne.s	S_GetDiskObject_Ok	; Oui, continuer
	Jmp	End			; Non, terminer le programme
	S_GetDiskObject_Ok:
	Move.l	d0,a0
	Move.w	#0,48(a0)		; DiskObject->do_Type = 0


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Créer un port message pour la gestion de l'AppIcon.  * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

	Move.l	ExecBase,a6
	Jsr	CreateMsgPort(a6)	
	Move.l	d0,AppMsgPort
	Beq	End_1


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Installer l'AppIcon dans le WB.  * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

	Move.l	WorkbenchBase,a6
	Moveq	#0,d0
	Moveq	#0,d1
	Lea	AppIconText,a0
	Move.l	AppMsgPort,a1
	Move.l	#0,a2
	Move.l	Diskobject,a3
	Move.l	#0,a4
	Jsr	AddAppIconA(a6)
	Move.l	d0,AppIcon
	Beq	End_2


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Charger le fichier de configuration.   * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

	Move.l	ExecBase,a6
	Move.l	#$10001,d1		; PublicMem
	Move.l	#ConfigBufferL,d0
	Jsr	AllocMem(a6)		; Allouer un tampon pour la config
	Move.l	d0,ConfigBuffer0	; Buffer de config 0
	Bne.s	LC_AllocMem_Ok		; Allocation à échoué ?
	Move.l	DosBase,a6		; Oui, on avertit l'utilisateur
	Move.l	#NoMemory_ErrT,d1
	Jsr	PutStr(a6)
	Jmp	End_3			;  et on quitte
	LC_AllocMem_Ok:			; Non, on continue

	Move.l	DosBase,a6
	Move.l	#1005,d2		; Lecture
	Move.l	#ConfigFileName0,d1	; Se trouve dans Env:
	Jsr	Open(a6)		; Ouvrir le fichier
	Move.l	d0,ConfigFileName0_FH	; Ouverture à échoué ?
	Bne.s	LC_ConfigFileOpen_Ok	; Non, on continue
	Move.b	#0,ReplyMessage_Lock	; Ne pas rendre le message
	Jmp	ConfigPanel		; Oui, pas de Config => ConfigPanel
	LC_ConfigFileOpen_Ok:

	Move.l	d0,d1			;!!  ConfigFileName0_FH
	Move.l	ConfigBuffer0,d2	; Buffer de config 0
	Move.l	#ConfigBufferL,d3	; 488 bytes
	Jsr	Read(a6)		; Lire le Fichier
	Move.l	d0,d4
	Move.l	ConfigFileName0_FH,d1	; Refermer le fichier Config 0
	Jsr	Close(a6)
	Cmp.l	#488,d4			; Le fichier a 488 bytes ?
	Beq.s	LC_ConfigRead_Ok	; Oui, on continue
	Move.b	#0,ReplyMessage_Lock	; Ne pas rendre le message
	Jmp	ConfigPanel		; Non, pas de Config => ConfigPanel
	LC_ConfigRead_Ok:


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  DESCRIPTION:								*
*	WaitAppMsg:							*
*		Attend et prélève l' AppMessage	et prépare le pgm à	*
*		boucler dans NextFile.  AppMessage est ensuite rendu.	*
*	GetAppMessage:							*
*		Prélève le message et prépare le programme à boucler	*
*		dans NextFile.  Si il n'y a pas de message, saut à	*
*		WaitAppMsg.						*
*  INPUT:								*
*		AppMsgPort	=  Port message crée l'AppIcon.		*
*  OUTPUT:								*
*		Msg.l		=  AppMessage				*
*		FileNumer.l	=  Nombre de fichiers  *  8		*
*		ReplyMessage_Lock= 1					*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


WaitAppMsg:
	Move.l	ExecBase,a6
	Move.l	AppMsgPort,a0
	Jsr	WaitPort(a6)		; Attente d'un message

GetAppMessage:
	Move.l	#0,FileCount		; Fichiers Traités  =  0

	Move.l	AppMsgPort,a0
	Move.l	ExecBase,a6
	Jsr	GetMsg(a6)		; On prend le Message
	Move.l	d0,Msg
	Beq.s	WaitAppMsg

	Move.l	d0,a0			;!! AppMessage
	Lea	30(a0),a1		; AppMessage->NumArgs
	Move.l	(a1),d1			;
	Move.b	#1,ReplyMessage_Lock	; Rendre le message à la fin du panel
	Mulu	#8,d1			; Nb de fichiers * 8
	Move.l	d1,FileNumber		; Nb * 8 dans FileNumber.l
	Beq	ConfigPanel		; Nb =? 0    Oui, ConfigPanel

	Move.b	#2,GUI_
	Jsr	SetupScreen_
	Tst.l	d0
	Bne	Crunch_Request_Err	; Erreur
	Move.w	#WorkingLeft,Left
	Move.w	#WorkingTop,Top
	Move.w	#WorkingWidth,Width
	Move.w	#WorkingHeight,Height
	Bsr	OpenWindow_		; Affichage de la Fenêtre "Quoi faire"
	Move.l	Wnd,WorkingWnd
	Tst.l	d0
	Bne	Crunch_Request_Err	; Erreur

	Move.l	#NormalBevelbox,Bevelbox_TagList
	Move.w	#Working0_Top,BevelTop
	Move.w	#Working0_Left,BevelLeft
	Move.w	#Working0_Width,BevelWidth
	Move.w	#Working0_Height,BevelHeight
	Bsr	Render1			; Dessiner la Bevelbox
	Move.l	#InverseBevelbox,Bevelbox_TagList
	Move.w	#Working1_Top,BevelTop
	Move.w	#Working1_Left,BevelLeft
	Move.w	#Working1_Width,BevelWidth
	Move.w	#Working1_Height,BevelHeight
	Bsr	Render1			; Dessiner la Bevelbox

;!!	Move.l	WorkingWnd,Wnd
	Move.b	#$ff,UserResponse
	Bsr	WaitMessages		; Attendre réponse de l'utilisateur
	Move.b	UserResponse,Working_CrunchUserResponse
;!!	Move.l	WorkingWnd,Wnd

	Cmp.b	#3,Working_CrunchUserResponse; L'utilisateur ne veut rien faire ?
	Bne.s	GAM__de_crunch		; Non, Continuer
;!!	Move.l	WorkingWnd,Wnd		; Oui, fermer interface
	Bsr	IMessageLoop
	Bsr	CloseWindow_
	Bsr	CloseDownScreen_
	Jmp	ReplyMessage
	GAM__de_crunch:


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Disabler Crunch, Decrunch et Nothing.  Enabler Skip et Stop.   * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

	Move.l	GadtoolsBase,a6
	Move.l	WorkingWnd,a4
	Lea	WorkingGadgets,a5
	Move.l	a4,a1			; Window Ptr
	Suba.l	a2,a2			; Req  (not implemented)
	Move.l	0*4(a5),a0		; Gadget 0  =  Crunch
	Lea	GAM_WorkingGad0Attrs,a3
	Jsr	GT_SetGadgetAttrsA(a6)

	Move.l	a4,a1			; Window Ptr
	Suba.l	a2,a2			; Req  (not implemented)
	Move.l	1*4(a5),a0		; Gadget 1  =  Decrunch
	Lea	GAM_WorkingGad1Attrs,a3
	Jsr	GT_SetGadgetAttrsA(a6)

	Move.l	a4,a1			; Window Ptr
	Suba.l	a2,a2			; Req  (not implemented)
	Move.l	2*4(a5),a0		; Gadget 2  =  Nothing
	Lea	GAM_WorkingGad2Attrs,a3
	Jsr	GT_SetGadgetAttrsA(a6)

	Move.l	a4,a1			; Window Ptr
	Suba.l	a2,a2			; Req  (not implemented)
	Move.l	3*4(a5),a0		; Gadget 3  =  Skip
	Lea	GAM_WorkingGad3Attrs,a3
	Jsr	GT_SetGadgetAttrsA(a6)
	
	Move.l	a4,a1			; Window Ptr
	Suba.l	a2,a2			; Req  (not implemented)
	Move.l	4*4(a5),a0		; Gadget 4  =  Stop
	Lea	GAM_WorkingGad4Attrs,a3
	Jsr	GT_SetGadgetAttrsA(a6)


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Allouer une structure CrunchInfo en fonction des Prefs.  * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

	Move.l	ConfigBuffer0,a0
	Moveq	#0,d0
	Moveq	#0,d1
	Move.b	CP_Config_Efficiency(a0),d0	
	Move.b	CP_Config_Buffer(a0),d1
	Cmp.b	#2,d1			; Désir Large = 2
	Beq.s	GAM_SetPrefs0
	Cmp.b	#0,d1			; Désir Small = 0
	Beq.s	GAM_SetPrefs1
	Jmp	GAM_SetPrefsF		; Désir Medium = PP Medium = 1
	GAM_SetPrefs0:
	Moveq	#SpeedUp_BuffLarge,d1	; PP Large = 0
	Jmp	GAM_SetPrefsF
	GAM_setPrefs1:
	Moveq	#SpeedUp_BuffSmall,d1	; PP Small = 2
;!!	Jmp	GAM_SetPrefsF
	GAM_SetPrefsF:
	Suba.l	a0,a0			; Allocation de CrunchInfo
	Suba.l	a1,a1			; pour la fonction
	Move.l	ppBase,a6
	Jsr	ppAllocCrunchInfo(a6)	; powerpacker.library/CrunchBuffer()
	Move.l	d0,CrunchInfo
	Tst.l	d0
	Beq	AllocCrunchInfo_Err


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Allouer un tampon pour le nom de fichier pour NextFile.  * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

	Move.l	ExecBase,a6
	Move.l	#FileNameBufferL,d0
	Move.l	#1,d1
	Jsr	AllocMem(a6)		; Allouer un tampon pour le nom du
	Move.l	d0,FileNameBuffer	; fichier
	Beq	AllocMem_Err


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  DESCRIPTION:								*
*	NextFile:							*
*		Traite les fichiers en boucle jusqu'à ce qu'il n'y en	*
*		ait plus à traiter.  S'occupe intégralement des erreurs.*
*		Détermine si le fichier est compacté et se branche à	*
*		ToDataCrunched ou ToDataNotCrunched suivant les cas.	*
*  INPUT:								*
*		Msg		=  AppMessage				*
*		FileNameBuffer	=  Pointeur sur le tampon du nom.	*
*		FileCount	=  Doit être égal à zéro		*
*  OUTPUT:								*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

NextFile:				; Fichier suivant
	Move.l	FileCount,d0
	Move.l	Msg,a0
	Lea	34(a0),a1
	Move.l	(a1),a0
	Adda.l	d0,a0			; Trouver le Lock sur le répertoire
	Move.l	(a0),DirLock

	Move.l	DosBase,a6
	Move.l	DirLock,d1
	Move.l	FileNameBuffer,d2	; Obtenir le nom du Path
	Move.l	#FileNameBufferL,d3	; Le nom est mis dans le tampon
	Jsr	NameFromLock(a6)	; prévu où pointe FileNameBuffer

	Move.l	FileCount,d0
	Move.l	Msg,a0
	Lea	34(a0),a1
	Move.l	(a1),a0
	Adda.l	d0,a0			; Chercher le nom du fichier
	Move.l	4(a0),d2
	Move.l	d2,FileName		; Sauver l'adresse du nom dans FileName
	Move.l	#FileNameBufferL,d3
	Move.l	FileNameBuffer,d1
	Jsr	AddPart(a6)		; Concaténer le nom du dir avec le nom de fichier

	Move.l	FileName,a0
	Move.l	a0,d0
	Calculate_StrLengthB:
	Cmp.b	#0,(a0)+
	Bne.s	Calculate_StrLengthB	; Calculer la longueur de la
	Suba.l	d0,a0			; chaîne FileName
	Move.l	a0,d1
	Move.b	d1,FileName_StrLength

	Cmp.b	#1,FileName_StrLength	; répertoire? -> chaîne de 1 byte
	Beq	NF_NoFileNameWriting	; Oui, ne pas écrire FileName
	Move.l	GadtoolsBase,a6
	Move.l	WorkingWnd,a1		; Struct Window en a1
	Suba.l	a2,a2			; Req = 0
	Lea	WriteTextTags,a3	; Tags en a3
	Move.l	FileName,4(a3)		; Adresse du nom à GTTX_Text
	Lea	WorkingGadgets,a0
	Move.l	6*4(a0),a0		; Name Gadget
	Jsr	GT_SetGadgetAttrsA(a6)	; Afficher nom du fichier
	NF_NoFileNameWriting:

	Move.l	DosBase,a6
	Move.l	FileNameBuffer,d1
	Move.l	#1005,d2		; Obtenir un Lock sur le nom du
	Jsr	Lock(a6)		; fichier avec Path complet
	Move.l	d0,FileLock		; Lock Ok ?
	Bne.s	NF_Lock_Ok			; Oui, on continue
	Lea	NF_LockErr_EasyT,a0
	Bsr	EasyRequest_Com
	Jmp	NoDecrunch
	NF_Lock_Ok:	

	Moveq	#2,d1			; Type de DosObject
	Moveq	#0,d2			; TagList
	Move.l	DosBase,a6
	Jsr	AllocDosObject(a6)	; On alloue une structure pour la
	Move.l	d0,DosObject		; fonction Examine()
	Beq	AllocDosObject_Err

	Move.l	FileLock,d1
	Move.l	DosObject,d2
	Jsr	Examine(a6)		; On Examine() le fichier d'après
	Move.l	DosObject,a0		;  le Lock trouvé précédemment.
	Tst.l	d0
	Bne.s	NF_Examine_Ok		; Examine() est ok, on continue
	Move.l	DosObject,d2
	Moveq	#2,d1			; Libérer la structure DosObject
	Jsr	FreeDosObject(a6)
	Move.l	FileLock,d1
	Jsr	UnLock(a6)		; On délock la fichier
	Lea	NF_ExamineErr_EasyT,a0	; Avertir
	Bsr	EasyRequest_Com
	Jmp	NoDecrunch
	NF_Examine_Ok:
	Move.l	124(a0),FileLength	; FileInfoBlock->fib_Size

	Move.l	FileLock,d1
	Jsr	UnLock(a6)		; On délock le fichier.

	Move.l	DosObject,a0
	Tst.l	4(a0)			; Est-ce un répertoire ?
	Blt.s	IsAFile			; Si non, on le continue.
	Move.l	#Working_DirErrT,WTT_Text; Adresse du nom à GTTX_Text
	Bsr	SetWorkingGad5Attrs	; Oui, afficher DirErrT
	Jmp	NoDecrunch		; Terminer le traitement du fichier
	IsAFile:

	Move.l	DosBase,a6
	Move.l	DosObject,d2
	Moveq	#2,d1
	Jsr	FreeDosObject(a6)	; Libérer la structure DosObject

	Move.l	#0,SBuffer		; On vide le tampon de 4 octets

	Move.l	#1005,d2		; Mode_OldFile
	Move.l	FileNameBuffer,d1
	Jsr	Open(a6)		; On Open() le fichier en question
	Move.l	d0,FileHandle		; Gestionnaire dans FileHandle
	Bne.s	FileOpen_Ok		; Ok, on continue.
	Lea	OpenReadErr_EasyT,a0
	Bsr	EasyRequest_Com		; Erreur, Avertir
	Jmp	NoDecrunch		; Fin du traitement du fichier
	FileOpen_Ok:			; Pas d'erreur, on continue

	Move.l	#Working_ScanningT,WTT_Text; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs	; Ecrire Scanning

	Move.l	GadtoolsBase,a6
	Lea	WorkingGadgets,a0
	Move.l	7*4(a0),a0		; Source Gadget
	Move.l	WorkingWnd,a1		; Struct Window en a1
	Suba.l	a2,a2			; Req = 0
	Lea	WriteNumberTags,a3	; Tags en a3
	Move.l	FileLength,WNT_Number	; Longueur du fichier
	Jsr	GT_SetGadgetAttrsA(a6)	; Afficher longueur du fichier

	Bsr	GetWorkingMessage	; Vérifier si gadget est appuyé
	Cmp.b	#4,Working_UserResponse	; Skip File ?
	Beq	NextFile_Skip1		; Oui, on se branche à la routine
	Cmp.b	#5,Working_UserResponse	; Stop All ?
	Beq	NextFile_Stop1		; Oui, on se branche à la routine

	Move.l	DosBase,a6
	Move.l	FileHandle,d1
	Move.l	#SBuffer,d2		; On lit les 4 premiers octets du
	Move.l	#4,d3			; fichier
	Jsr	Read(a6)		; On écrit dans SBuffer
	Move.l	d0,d4			; Nb de bytes lus
	Move.l	FileHandle,d1		; Fermer le fichier
	Jsr	Close(a6)
	Cmp.l	#4,d4			; Erreur de lecture du fichier ?
	Beq.s	FileNotEmpty		; Non, on continue
	Lea	NF_ReadErr_EasyT,a0
	Bsr	EasyRequest_Com
	Jmp	NoDecrunch		; Passer au fichier suivant
	FileNotEmpty:

	Move.l	SBuffer,d0		; On vérifie le contenu de SBuffer
	Cmp.l	#'PP20',d0		; = 'PP20' => compacté normalement
	Beq	ToDataCrunched
	Cmp.l	#'PX20',d0		; = 'PX20' => compacté avec passe
	Beq	ToDataCrunched
	Jmp	ToDataNotCrunched		; Non Compacté

					; Traitement des stops.
	NextFile_Skip1:			;
	Move.l	DosBase,a6
	Move.l	FileHandle,d1
	Jsr	Close(a6)		; Fermer le fichier
	Move.l	#Working_SkipT,WTT_Text	; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs
	Jmp	NoDecrunch		; Traitement terminé
	NextFile_Stop1:			;
	Move.l	DosBase,a6
	Move.l	FileHandle,d1
	Jsr	Close(a6)		; Fermer le fichier
	Move.l	#Working_StopT,WTT_Text	; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs
	Jmp	FreeBuffers		; Arrêt total
					; Traitement des erreurs graves.
	AllocDosObject_Err:
	Move.l	DosBase,a6
	Move.l	FileLock,d1		; on délock le fichier
	Jsr	UnLock(a6)
	Bsr	FreeFileNameBuffer	; Libérer le tampon FileNameBuffer
	AllocMem_Err:
	Move.l	ppBase,a6
	Move.l	CrunchInfo,a0
	Jsr	ppFreeCrunchInfo(a6)	; Libérer la structure CrunchInfo
	AllocCrunchInfo_Err:
	Crunch_Request_Err:
	Working_Request_Err:
	Move.l	ExecBase,a6
	Move.l	Msg,a1			; Rendre le message AppMessage
	Jsr	ReplyMsg(a6)
	Move.l	DosBase,a6
	Move.l	#NoMemory_ErrT,d1
	Jsr	PutStr(a6)
	Jmp	End_

ToDataCrunched:
	Bsr	DataCrunched		; se Brancher (permet un retour par Rts)
	Jmp	NoDecrunch
ToDataNotCrunched:
	Bsr	DataNotCrunched		; se Brancher (permet un retour par Rts)
;!!	Jmp	NoDecrunch

NoDecrunch:				; Fin du traitement du fichier
	Add.l	#8,FileCount		; On ajoute 8 au nbre de fichiers
	Move.l	FileNumber,d0		; traités (facilite l'accès au message)
	Cmp.l	FileCount,d0		; Nbre traités  =?  Nbre total
	Beq.s	FreeBuffers		; Si oui, traitement terminé
	Jmp	NextFile		; Si non, fichier suivant

FreeBuffers:
	Move.l	DosBase,a6
	Lea	Finished_EasyT,a0
	Bsr	EasyRequest_Com
	Move.l	WorkingWnd,Wnd
	Bsr	IMessageLoop
	Bsr	CloseWindow_		; Fin du traitement _des_ fichiers
	Bsr	CloseDownScreen_	; On ferme l'interface
	Bsr	FreeFileNameBuffer	; Libérer le tampon
	Move.l	ppBase,a6
	Move.l	CrunchInfo,a0		; Libérer la structure CrunchInfo
	Jsr	ppFreeCrunchInfo(a6)

ReplyMessage:
	Move.l	ExecBase,a6
	Move.l	Msg,a1
	Jsr	ReplyMsg(a6)		; Renvoie l'AppMessage au système
	Jmp	GetAppMessage		; On va chercher l'éventuel message suivant


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  DESCRIPTION:								*
*	DataNotCrunched:						*
*		Teste si l'utilisateur veut compacter.  Si oui,		*
*		effectue le compactage et sauve le fichier.		*
*		S'occupe intégralement du traitement des erreurs.	*
*  INPUT:								*
*		Working_CrunchUserResponse=  1 pour compacter		*
*		FileLength		=  Longueur du fichier		*
*		FileNameBuffer		=  APTR sur le nom de fichier	*
*  OUTPUT:								*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


DataNotCrunched:			; Fichier non compacté
	Cmp.b	#1,Working_CrunchUserResponse; Veut-on le compacter ?
	Beq.s	DataNotCrunched_Ok	; Oui, on traite le fichier
	Move.l	#Working_NotCrunchedErrT,WTT_Text; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs
	Jmp	DNC_End			; Fichier suivant
	DataNotCrunched_Ok:

	Move.l	ExecBase,a6
	Move.l	FileLength,d0
	Move.l	#$1,d1			; PublicMem
	Jsr	AllocMem(a6)		; On alloue un tampon de la longueur
	Move.l	d0,FileBuffer		; du fichier
	Bne.s	DNC_AllocMem_Ok		; Allocation Ok, on continue
	Move.l	DosBase,a6
	Lea	DNC_NoMemErr_EasyT,a0
	Bsr	EasyRequest_Com		; Non, avertir
	Jmp	DNC_End			; Pas de compact, Fichier suivant
	DNC_AllocMem_Ok:

	Move.l	DosBase,a6
	Move.l	FileNameBuffer,d1
	Move.l	#1005,d2		; Fichier existant
	Jsr	Open(a6)		; On Open() le fichier
	Move.l	d0,FileHandle
	Bne.s	DNC_Open_Ok		; Ouverture Ok
	Lea	OpenReadErr_EasyT,a0
	Bsr	EasyRequest_Com
	Jmp	DNC_End1
	DNC_Open_Ok:			; On continue

	Move.l	#Working_LoadingT,WTT_Text; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs

	Bsr	GetWorkingMessage	; On vérifie si gadget appuyé.
	Cmp.b	#4,Working_UserResponse
	Beq	DNC_Skip1
	Cmp.b	#5,Working_UserResponse
	Beq	DNC_Stop1

	Move.l	DosBase,a6
	Move.l	FileHandle,d1
	Move.l	FileBuffer,d2		; On remplit le tampon avec le
	Move.l	FileLength,d3		; contenu du fichier qu'on Read()
	Jsr	Read(a6)
	Move.l	d0,d4
	Move.l	FileHandle,d1
	Jsr	Close(a6)		; On referme le fichier
	Cmp.l	FileLength,d4		; Longueur égale ?
	Beq.s	DNC_Read_Ok		; Oui, on continue
	Lea	DNC_ReadErr_EasyT,a0
	Bsr	EasyRequest_Com
	Jmp	DNC_End1
	DNC_Read_Ok:

	Bsr	GetWorkingMessage	; On vérifie si gadget appuyé.
	Cmp.b	#4,Working_UserResponse
	Beq	DNC_Skip2
	Cmp.b	#5,Working_UserResponse
	Beq	DNC_Stop2

	Move.l	#Working_CrunchingT,WTT_Text; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs

	Move.l	ppBase,a6
	Move.l	FileLength,d0		; Length en d0
	Move.l	CrunchInfo,a0		; CrunchInfo en a0
	Move.l	FileBuffer,a1		; Buffer en a1
	Jsr	ppCrunchBuffer(a6)	; On compacte le tampon
	Move.l	d0,ppLength		; Longueur compacté ou code d'erreur
	Cmp.l	#-1,d0			; Buffer OverFlow ?
	Bne.s	DNC_OverFlow_Ok		; Non, on continue
	Move.l	#Working_DNC_OverFlowT,WTT_Text; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs
	Jmp	DNC_End
	DNC_OverFlow_Ok:
	Cmp.l	#0,d0			; Crunch Aborted ?
	Bne.s	DNC_Aborted_Ok		; Non, on continue
	Move.l	#Working_DNC_AbortedT,WTT_Text; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs
	Jmp	DNC_End
	DNC_Aborted_Ok:

	Move.l	GadtoolsBase,a6
	Lea	WorkingGadgets,a0
	Move.l	8*4(a0),a0		; Source Gadget
	Move.l	WorkingWnd,a1		; Struct Window en a1
	Suba.l	a2,a2			; Req = 0
	Lea	WriteNumberTags,a3	; Tags en a3
	Move.l	ppLength,WNT_Number	; Longueur du fichier
	Jsr	GT_SetGadgetAttrsA(a6)	; Afficher longueur compacté

	Bsr	GetWorkingMessage	; On vérifie si gadget appuyé.
	Cmp.b	#4,Working_UserResponse
	Beq	DNC_Skip3
	Cmp.b	#5,Working_UserResponse
	Beq	DNC_Stop3
					; Ouvrir le fichier en écriture
	Bsr	OpenSaveFile		; selon preferences

	Move.l	DosBase,a6
	Cmp.l	#0,FileHandle		; Ouverture réussie ?
	Bne.s	DNC_OpenSaveFile_Ok	; Oui, on continue
	Lea	OpenWriteErr_EasyT,a0
	Bsr	EasyRequest_Com		; Non, on avertit l'utilisateur
	Jmp	DNC_End1		; Libérer la mémoire et continuer
	DNC_OpenSaveFile_Ok:		; Overture Ok, on continue

	Move.l	#Working_SavingT,WTT_Text; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs

	Move.l	FileHandle,d0		; FH en d0
	Moveq	#0,d1
	Move.l	ConfigBuffer0,a0
	Move.b	CP_Config_Efficiency(a0),d1;Efficiency en d1
	Moveq	#0,d2			; Crypt = 0
	Moveq	#0,d3
	Move.l	ppBase,a6
	Jsr	ppWriteDataHeader(a6)	; On écrit l'entête 'PP20'
	Tst.l	d0			; Ecriture à échoué ?
	Bne.s	DNC_DataHeader_Ok	; Non, on continue
	Lea	WriteErr_EasyT,a0
	Bsr	EasyRequest_Com		; Oui, on avertit l'utilisateur
	Jmp	DNC_End2		; Préparer à quitter la routine
	DNC_DataHeader_Ok:

	Move.l	DosBase,a6
	Move.l	FileHandle,d1
	Move.l	FileBuffer,d2		; On écrit le contenu du tampon
	Move.l	ppLength,d3		; On Write() la longueur compact.
	Jsr	Write(a6)
	Move.l	d0,d4
	Move.l	FileHandle,d1
	Jsr	Close(a6)
	Cmp.l	ppLength,d4		; Erreur d'écriture ?
	Beq.s	DNC_Write_Ok		; Non, on continue
	Lea	WriteErr_EasyT,a0
	Bsr	EasyRequest_Com		; Oui, avertir l'utilisateur
	Jmp	DNC_End2		; Préparer à quitter la routine
	DNC_Write_Ok:
;!!	Jmp	DNC_End1

	DNC_End1:
	Move.l	ExecBase,a6
	Move.l	FileBuffer,a1		; Libérer la mémoire du fichier
	Move.l	FileLength,d0
	Jsr	FreeMem(a6)
;!!	Jmp	DNC_End
	DNC_End:
	Rts				; Compacatage terminé
	DNC_End2:
	Move.l	DosBase,a6
	Move.l	FileHandle,d1		; Fermer le fichier
	Jsr	Close(a6)
	Move.l	FileNameBuffer,d1
	Jsr	DeleteFile(a6)		; Effacer le fichier destination
	Jmp	DNC_End1		; Terminer et quitter la routine


	DNC_Skip_Com:
	Move.l	DosBase,a6
	Move.l	FileHandle,d1
	Jsr	Close(a6)
	Rts
	DNC_Stop1:
	Bsr	DNC_Skip_Com
	Jmp	DNC_Stop2		
	DNC_Skip1:
	Bsr	DNC_Skip_Com
;!!	Jmp	DNC_Skip2
	DNC_Skip2:
	DNC_Skip3:
	Move.l	#Working_SkipT,WTT_Text	; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs
	Jmp	DNC_End1		; Traitement terminé
	DNC_Stop2:
	DNC_Stop3:	
	Move.l	#Working_StopT,WTT_Text	; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs
	Move.l	FileNumber,FileCount	; Dernier fichier traité
	Subq.l	#8,FileCount
	Jmp	DNC_End1		; Libérer la mémoire et terminer


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  DESCRIPTION:								*
*	DataCrunched:							*
*		Teste si l'utilisateur veut décompacter.  Si oui,	*
*		effectue le décompactage et sauve le fichier.		*
*		S'occupe intégralement du traitement des erreurs	*
*  INPUT:								*
*		Working_CrunchUserResponse=  2 pour décompacter		*
*		FileNameBuffer		=  APTR sur le nom du fichier	*
*  OUTPUT:								*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


DataCrunched:				; Fichier compacté
	Cmp.b	#2,Working_CrunchUserResponse; Veut-on le décompacter ?
	Beq.s	DataCrunched_Ok		; Oui, on continue
	Move.l	#Working_CrunchedErrT,WTT_Text; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs
	Jmp	DC_End
	DataCrunched_Ok:

	Move.l	#Working_DC_LoadDecrT,WTT_Text; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs

	Bsr	GetWorkingMessage	; On vérifie si gadget appuyé.
	Cmp.b	#4,Working_UserResponse
	Beq	DC_Skip1
	Cmp.b	#5,Working_UserResponse
	Beq	DC_Stop1

	Move.l	ppBase,a6
	Moveq	#0,d0
	Move.l	ConfigBuffer0,a0
	Move.b	CP_Config_Effect(a0),d0	; Decr_Effect en d0
	Move.l	FileNameBuffer,a0	; Buffer sur le nom du fichier
	Move.l	#$1,d1			; MemType: Public
	Lea	Buffer_,a1		; Adresse de la variable du tampon
	Lea	Len_,a2			; Adresse de la variable de la longueur
	Move.l	#0,a3			; Pass Requester: None
	Jsr	ppLoadData(a6)		; On décompacte le fichier
	Tst.b	d0			; Erreur ?
	Beq	ppLoadData_Ok		; Non, on continue
	Cmp.b	#-1,d0
	Beq.s	ppLD_OpenErr
	Cmp.b	#-2,d0
	Beq.s	ppLD_ReadErr		; Oui, suivant le type
	Cmp.b	#-3,d0			; d'erreur, on écrit
	Beq.s	ppLD_NoMemErr		; un message approprié
	Cmp.b	#-4,d0
	Beq.s	ppLD_CryptErr
	Cmp.b	#-5,d0
	Beq.s	ppLD_PassErr
	Cmp.b	#-6,d0
	Beq.s	ppLD_UnknownPP
	Cmp.b	#-7,d0
	Beq.s	ppLD_EmptyErr
	ppLD_OpenErr:
	Lea	OpenReadErr_EasyT,a0
	Jmp	ppLoadData_Err
	ppLD_ReadErr:
	Lea	DC_ReadErr_EasyT,a0
	Jmp	ppLoadData_Err
	ppLD_NoMemErr:
	Lea	DC_NoMemErr_EasyT,a0
	Jmp	ppLoadData_Err
	ppLD_CryptErr:
	Lea	DC_CryptErr_EasyT,a0
	Jmp	ppLoadData_Err
	ppLD_PassErr:
	Lea	DC_PassErr_EasyT,a0
	Jmp	ppLoadData_Err
	ppLD_UnknownPP:
	Lea	DC_UnknownPPErr_EasyT,a0
	Jmp	ppLoadData_Err
	ppLD_EmptyErr:
	Lea	DC_EmptyErr_EasyT,a0
;!!	Jmp	ppLoadData_Err
	ppLoadData_Err:
	Bsr	EasyRequest_Com
	Jmp	DC_End
	ppLoadData_Ok:			; pas d'erreur, on continue

	Move.l	GadtoolsBase,a6
	Lea	WorkingGadgets,a0
	Move.l	8*4(a0),a0		; Source Gadget
	Move.l	WorkingWnd,a1		; Struct Window en a1
	Suba.l	a2,a2			; Req = 0
	Lea	WriteNumberTags,a3	; Tags en a3
	Move.l	Len_,WNT_Number		; Longueur du fichier
	Jsr	GT_SetGadgetAttrsA(a6)	; Afficher longueur décompacté

	Bsr	GetWorkingMessage	; On vérifie si gadget appuyé.
	Cmp.b	#4,Working_UserResponse
	Beq	DC_Skip2
	Cmp.b	#5,Working_UserResponse
	Beq	DC_Stop2

	Bsr	OpenSaveFile		; Ouvrir le fichier pour sauver

	Cmp.l	#0,FileHandle		; Ouverture réussie ?
	Bne.s	DC_OpenSaveFile_Ok	; Oui, on continue
	Lea	OpenWriteErr_EasyT,a0
	Bsr	EasyRequest_Com		; Non, on avertit l'utilisateur
	Move.l	DosBase,a6
	Move.l	FileHandle,d1
	Jsr	Close(a6)
	Move.l	FileNameBuffer,d1
	Jsr	DeleteFile(a6)
	Jmp	DC_End1			; Libérer la mémoire et continuer
	DC_OpenSaveFile_Ok:		; Overture Ok, on continue

	Move.l	#Working_SavingT,WTT_Text; GTTX_Text  =  Adresse du texte
	Bsr	SetWorkingGad5Attrs

	Move.l	DosBase,a6
	Move.l	FileHandle,d1
	Move.l	Buffer_,d2
	Move.l	Len_,d3			; On écrit le contenu du tampon
	Jsr	Write(a6)		; décompacté
	Move.l	d0,d4
	Move.l	FileHandle,d1
	Jsr	Close(a6)		; Fermer le fichier
	Cmp.l	Len_,d4			; Ecriture Ok ?
	Beq.s	DC_Write_Ok		; Oui, continue
	Move.l	FileNameBuffer,d1
	Jsr	DeleteFile(a6)		; Effacer le fichier
	Lea	WriteErr_EasyT,a0
	Bsr	EasyRequest_Com		; On avertit l'utilisateur
;!!	Jmp	DC_End1			; Libérer la mémoire et continuer
	DC_Write_Ok:

	DC_End1:
	Move.l	ExecBase,a6
	Move.l	Buffer_,a1		; Adresse du buffer
	Move.l	Len_,d0			; Longueur décomp
	Jsr	FreeMem(a6)		; Libérer tampon décomp
	DC_End:
	Rts


	DC_Skip_Com:
	Move.l	#Working_StopT,WTT_Text	; GTTX_Text = Adresse du texte
	Bsr	SetWorkingGad5Attrs
	Rts
	DC_Stop_Com:
	Bsr	DC_Skip_Com
	Move.l	FileNumber,FileCount	; Dernier fichier traité
	Subq.l	#8,FileCount
	Rts
	DC_Skip1:
	Bsr	DC_Skip_Com
	Jmp	DC_End			; Fichier suivant
	DC_Stop1:
	Bsr	DC_Stop_Com
	Jmp	DC_End			; Terminer
	DC_Skip2:
	Bsr	DC_Skip_Com
	Jmp	DC_End1			; Traitement terminé
	DC_Stop2:
	Bsr	DC_Stop_Com
	Jmp	DC_End1			; Libérer la mémoire et terminer


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  FUNCTION:								*
*	SetWorkingGad5Attrs:						*
*		Remplace les nombreux appel à SetGadgetsAttrsA pour	*
*		le Gadget 5 de l'interface Working.			*
*  INPUT:								*
*	SetWorkingGad5Attrs:						*
*		WriteTextTags->WTT_Text = APTR sur le texte		*
*		WorkingWnd		= 				*
*		WorkingGadgets		= 				*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


SetWorkingGad5Attrs:
	Move.l	GadtoolsBase,a6
	Lea	WorkingGadgets,a0
	Move.l	5*4(a0),a0		; Status Gadget
	Lea	WriteTextTags,a3	; Tags en a3
	Move.l	WorkingWnd,a1		; Struct Window en a1
	Suba.l	a2,a2			; Req = 0
	Jsr	GT_SetGadgetAttrsA(a6)	; Afficher nom du fichier
	Rts


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  DESCRIPTION:								*
*	FreeFileNameBuffer:						*
*		Remplace les nombreuses routines qui libère le		*
*		tampon FileNameBuffer					*
*  INPUT:								*
*		FileNameBuffer	=  APTR sur le tampon			*
*		FileNameBufferL	=  Longueur du tampon			*
*  OUTPUT:								*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


FreeFileNameBuffer:
	Move.l	ExecBase,a6
	Move.l	FileNameBuffer,a1	; Adresse du tampon
	Move.l	#FileNameBufferL,d0	; Longueur
	Jsr	FreeMem(a6)
	Move.l	#0,FileNameBuffer	; FileNameBuffer vide
	Rts


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  DESCRIPTION:								*
*	OpenSaveFile:							*
*		Ouvre le fichier de sauvegarde.  Tient compte des	*
*		preferences de l'utilisateur.				*
*  INPUT:								*
*		FileNameBuffer	=  APTR sur le nom du fichier avec path	*
*		FileName	=  APTR sur le nom du fichier		*
*  OUTPUT:								*
*		FileHandle	=  Gestionnaire de fichier  ou  0	*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


OpenSaveFile:
	Move.l	ConfigBuffer0,a0
	Tst.b	CP_Config_UseAltPath(a0); Utiliser AltPath ?
	Beq.L	OSF_UseNormalBuf	; Non, on OverWrite le fichier

	Move.l	ExecBase,a6
	Move.l	#FileNameBufferL,d0	; 256 Bytes
	Move.l	#$1,d1			; PublicMem
	Jsr	AllocMem(a6)		; Allouer un tampon
	Move.l	d0,OSF_FileNameBuffer	; Buffer alloué
	Bne.s	OSF_AllocBuffer_Ok	; Oui, on continue
	Move.l	#0,FileHandle		; Non, pas d'ouverture de fichier
	Jmp	OSF_End			; On termine.  Fichier pas ouvert.
	OSF_AllocBuffer_Ok:

	Move.l	ConfigBuffer0,a0	; Source en a0
	Adda.l	#CP_Config_AltPath,a0
	Move.l	d0,a1			;!!  Dest en a1
	Move.l	#FileNameBufferL,d0	; Longueur à copier en d0
	Jsr	CopyMem(a6)

	Move.l	DosBase,a6
	Move.l	OSF_FileNameBuffer,d1	; Dir + destination
	Move.l	FileName,d2		; Fichier
	Move.l	#FileNameBufferL,d3	; Longueur à ne pas dépasser
	Jsr	AddPart(a6)		; Rassembler le dir et le fichier
	Tst.l	d0			; Assemblage Ok ?  (BOOLEAN)
	Bne.s	OSF_AddPart_Ok		; Oui, on continue
	Move.l	#0,FileHandle		; Non, fichier non ouvert
	Jmp	OSF_End1		; Désallouer le buffer et quitter
	OSF_AddPart_Ok:

	Move.l	OSF_FileNameBuffer,d1	; Pointeur sur le nom pour Open()
	Bsr	OSF_OpenFile		; Ouvrir le fichier
	Jmp	OSF_End1		; Désallouer le buffer et quitter

OSF_UseNormalBuf:
	Move.l	FileNameBuffer,d1	; Pointeur sur le nom pour Open()
	Bsr	OSF_OpenFile		; Ouvrir le fichier
	Jmp	OSF_End			; Quitter

	OSF_OpenFile:
	Move.l	DosBase,a6
	Move.l	#1006,d2		; Mode_NewFile
	Jsr	Open(a6)		; Routine d'ouverture du fichier
	Move.l	d0,FileHandle		; en écriture.
	Rts

OSF_End1:
	Move.l	ExecBase,a6
	Move.l	OSF_FileNameBuffer,a1	; Tampon
	Move.l	#FileNameBufferL,d0	; Longueur
	Jsr	FreeMem(a6)		; Libérer le tampon
OSF_End:
	Rts				; Quitter


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  FUNCTION:								*
*	EasyRequest_Com:						*
*		Remplace les fréquents appel à				*
*		Intuition/EasyRequestArgs() avec des valeurs pas défaut	*
*  INPUT:								*
*	EasyRequest_Com:						*
*		a0.l		=  APTR sur le Text du Requester	*
*  OUTPUT:								*
*	EasyRequest_Com:						*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


EasyRequest_Com:
	Move.l	IntuitionBase,a6
	Lea	Def_EasyStruct,a1	; Structure par défaut
	Move.l	a0,12(a1)		; EasyStruct->ES_Text
	Suba.l	a2,a2			; IDCMP_Ptr = 0
	Suba.l	a3,a3			; ArgList = 0
	Suba.l	a0,a0			; Window = Default
	Jsr	EasyRequestArgs(a6)	; Avertir
	Rts


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  DESCRIPTION:								*
*	ConfigPanel:							*
*		S'occupe intégralement de la configuration du pgm	*
*		Sauve les résultats et traite les erreurs.		*
*  INPUT:								*
*	ReplyMessage_Lock	=  1 = Oui pour rendre l'AppMessage	*
*  OUTPUT:								*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


ConfigPanel:
	Move.l	ExecBase,a6
	Move.l	#$10001,d1
	Move.l	#ConfigBufferL,d0	; Allouer un tampon pour la config
	Jsr	AllocMem(a6)
	Move.l	d0,ConfigBuffer		; Buffer ok ?
	Beq.L	ConfigPanel_Err_0	; Non, quitter le ConfigPanel

	Move.l	ConfigBuffer0,a0	; Les deux tampons sont identiques
	Move.l	ConfigBuffer,a1		; Dest
	Move.l	#ConfigBufferL,d0	; Longueur
	Jsr	CopyMem(a6)

	Move.l	ConfigBuffer,a0		; !!!!
	Move.b	#1,CP_Config_Version(a0); Version de AppPP
	Move.b	CP_Config_UseAltPath(a0),CGT_Check; Etat du CHECKBOX
	Move.b	CP_Config_Efficiency(a0),CGT_Efficiency; Modifier la TagValue
	Move.b	CP_Config_Buffer(a0),CGT_Buffer; Modifier la TagValue
	Move.b	CP_Config_Effect(a0),CGT_Effect; Modifier la TagValue
	Adda.l	#CP_Config_AltPath,a0
	Move.l	a0,CGT_TEXT		; TagValue du TEXT  (APTR)

	Move.b	#3,GUI_
	Bsr	SetupScreen_
	Tst.l	d0
	Bne.L	ConfigPanel_Err_1
	Move.w	#ConfigLeft,Left	; Ouvrir l'interface Config.
	Move.w	#ConfigTop,Top
	Move.w	#ConfigWidth,Width
	Move.w	#ConfigHeight,Height
	Bsr	OpenWindow_
	Move.l	Wnd,ConfigWnd
	Tst.l	d0
	Bne.L	ConfigPanel_Err_1

	Move.l	#InverseBevelbox,Bevelbox_Taglist
	Move.w	#Config0_Top,BevelTop
	Move.w	#Config0_Left,BevelLeft
	Move.w	#Config0_Width,BevelWidth
	Move.w	#Config0_Height,BevelHeight
	Bsr	Render1

CP_WaitGadget:
	Move.b	#3,GUI_
	Move.b	#$ff,UserResponse
	Move.l	ConfigWnd,Wnd
	Bsr	WaitMessages		; Attendre pression d'un gadget
	Move.w	Code,d1
	Move.w	d1,Config_Code
	Move.l	ConfigBuffer,a0		; Stockage de code
	Move.b	UserResponse,Config_UserResponse; N° du gadget + 1
	Move.l	ExecBase,a6

	Move.b	Config_UserResponse,d0
	Cmp.b	#1,d0			; CHECKBOX
	Beq.s	CP_Act1
	Cmp.b	#2,d0			; CYCLE Efficiency
	Beq.s	CP_Act2
	Cmp.b	#3,d0			; CYCLE Buffer
	Beq.s	CP_Act3
	Cmp.b	#4,d0			; CYCLE Effect
	Beq.s	CP_Act4
	Cmp.b	#5,d0			; BUTTOM Save
	Beq.s	CP_Act5
	Cmp.b	#6,d0			; BUTTON Use
	Beq.L	CP_Act6
	Cmp.b	#7,d0			; BUTTON Cancel
	Beq.L	CP_Act7
	Cmp.b	#8,d0			; BUTTON Quit
	Beq.L	CP_Act8
	Cmp.b	#9,d0			; TEXT
	Beq.L	CP_Act9
	Cmp.b	#10,d0			; BUTTON Get
	Beq.L	CP_Act10
	Cmp.b	#11,d0			; BUTTON About
	Beq.L	CP_Act11


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*   Utilise-t-on le chemin alternatif?  Ecrit dans le tampon.   * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CP_Act1:			; CHECKBOX
	Eor.b	#%1,CP_Config_UseAltPath(a0); Inverser TRUE/FALSE dans Config
	Eor.b	#%1,CGT_Check		; TRUE/FASLE du TagValue du CHECKBOX
	Jmp	CP_ActF


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*   Choix de l'efficacité. On écrit le n° au bon endroit dans le buffer *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CP_Act2:			; CYCLE Efficiency
	Move.b	d1,CP_Config_Efficiency(a0); Code dans ConfigBuffer
	Jmp	CP_ActF


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*   Choix du tampon. On écrit le n° au bon endroit dans le buffer.  * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CP_Act3:			; CYCLE Buffer
	Move.b	d1,CP_Config_Buffer(a0)	; Code dans ConfigBuffer
	Jmp	CP_ActF


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*   Choix de l'effet. On écrit le n° au bon endroit dans le buffer  * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CP_Act4:			; CYCLE Effect
	Move.b	d1,CP_Config_Effect(a0)	; Code dans ConfigBuffer
	Jmp	CP_ActF


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Sauve les préférences dans Env et Envarc.  * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CP_Act5:			; BUTTON Save
					; Copier le 1er tampon dans le 2ème
;!!	Move.l	ConfigBuffer,a0		; Source
	Move.l	ConfigBuffer0,a1	; Destination
	Move.l	#ConfigBufferL,d0	; Longueur à copier
	Jsr	CopyMem(a6)

	Move.l	DosBase,a6
	Move.l	#ConfigFileName0,d1
	Move.l	#1006,d2
	Jsr	Open(a6)		; Ouvrir le fichier config dans Env:
	Move.l	d0,ConfigFileName0_FH	; Ouverture Ok ?
	Bne.s	CP_Act5_OpenRamConfig_Ok; Oui, on continue
	Lea	SaveEnvConfigErr_EasyT,a0
	Bsr	EasyRequest_Com
	Jmp	CP_Act5_OpenRamConfig_Err; et on ne sauve pas le fichier.
	CP_Act5_OpenRamConfig_Ok:	
	Move.l	d0,d1			;!!
	Move.l	ConfigBuffer0,d2
	Move.l	#ConfigBufferL,d3	; Ecrire le tampon
	Jsr	Write(a6)
	Move.l	d0,d4			; Nb de bytes écrits en d4
	Move.l	ConfigFileName0_FH,d1
	Jsr	Close(a6)		; Fermer le fichier
	Cmp.l	#ConfigBufferL,d4	; Ecriture Ok ?
	Beq.s	CP_Act5_WriteRamConfig_Ok; Oui, on continue
	Move.l	#ConfigFileName0,d1	; Non, Effacer le fichier
	Jsr	DeleteFile(a6)
	Lea	SaveEnvConfigErr_EasyT,a0
	Bsr	EasyRequest_Com
	CP_Act5_WriteRamConfig_Ok:
	CP_Act5_OpenRamConfig_Err:

	Move.l	DosBase,a6
	Move.l	#1006,d2
	Move.l	#ConfigFileName1,d1	; Ouvrir le fichier Config dans EnvArc:
	Jsr	Open(a6)
	Move.l	d0,ConfigFileName0_FH	; Ouverture Ok ?
	Bne.s	CP_Act5_OpenDiskConfig_Ok; Oui, on continue
	Lea	SaveEnvarcConfigErr_EasyT,a0
	Bsr	EasyRequest_Com
	Jmp	CP_Act5_OpenDiskConfig_Err
	CP_Act5_OpenDiskConfig_Ok:
	Move.l	d0,d1			;!!
	Move.l	ConfigBuffer0,d2
	Move.l	#ConfigBufferL,d3
	Jsr	Write(a6)		; Ecrire le tampon dans le fichier
	Move.l	d0,d4			; Nb de bytes écrits en d4
	Move.l	ConfigFileName0_FH,d1	; Fermer le fichier
	Jsr	Close(a6)
	Cmp.l	#ConfigBufferL,d4	; Ecriture Ok ?
	Beq.s	CP_Act5_WriteDiskConfig_Ok; Oui, on continue
	Move.l	#ConfigFileName1,d1	; Non, effacer le fichier
	Jsr	DeleteFile(a6)
	Lea	SaveEnvarcConfigErr_EasyT,a0
	Bsr	EasyRequest_Com
	CP_Act5_WriteDiskConfig_Ok:
	CP_Act5_OpenDiskConfig_Err:

	Move.l	ConfigWnd,Wnd
	Bsr	GM_RepIMessage
	Bsr	IMessageLoop		; Traiter tous les messages
	Bsr	CloseWindow_		; Fermer fenêtre et libérer
	Bsr	CloseDownScreen_	; gadgets
	Bsr	CP_FreeConfigBuffer	; Libérer ConfigBuffer
	Bsr	CP_Evtl_ReplyMessage	; Rendre l'éventuel AppMessage
	Jmp	GetAppMessage		; AppMessage Suivant


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Sauve les préferences dans un tampon. (pas dans un fichier)  * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CP_Act6:			; BUTTON Use
					; Copier le 1er tampon dans le 2ème
;!!	Move.l	ConfigBuffer,a0		; Source
	Move.l	ConfigBuffer0,a1	; Destination
	Move.l	#ConfigBufferL,d0	; Longueur à copier
	Jsr	CopyMem(a6)

	Move.l	ConfigWnd,Wnd
	Bsr	GM_RepIMessage		; Rendre le Message au port
	Bsr	IMessageLoop		; Traiter tous les messages
	Bsr	CloseWindow_		; Fermer fenêtre et libére 
	Bsr	CloseDownScreen_	; gadgets
	Bsr	CP_FreeConfigBuffer	; Libérer ConfigBuffer
	Bsr	CP_Evtl_ReplyMessage	; Rendre l'éventuel AppMessage
	Jmp	GetAppMessage		; AppMessage Suivant


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Ferme l'interface Config sans tenir compte des changements.  * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CP_Act7:			; BUTTON Cancel
	Move.l	ConfigWnd,Wnd
	Bsr	GM_RepIMessage		; Rendre le Message sur le port
	Bsr	IMessageLoop		; Traiter tous les messages
	Bsr	CloseWindow_		; Fermer fenêtre et libérer
	Bsr	CloseDownScreen_	; gadgets
	Bsr	CP_FreeConfigBuffer	; Libérer tampon ConfigBuffer
	Bsr	CP_Evtl_ReplyMessage	; Rendre l'éventuel AppMessage
	Jmp	GetAppMessage		; AppMessage suivant


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Termine le programme.  * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CP_Act8:			; BUTTON Quit
	Move.l	ConfigWnd,Wnd
	Bsr	GM_RepIMessage		; 
	Bsr	IMessageLoop
	Bsr	CloseWindow_		; Fermer fenêtre et libérer
	Bsr	CloseDownScreen_	; gadgets
	Bsr	CP_FreeConfigBuffer	; Libérer le tampon ConfigBuffer
	Bsr	CP_Evtl_ReplyMessage	; Rendre l'éventuel AppMessage
	Jmp	End_			; Terminer le programme


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  On ne peut normalement pas recevoir de message d'un Text.  * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CP_Act9:			; TEXT
	Jmp	CP_ActF


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Execute la requête de fichier pour le chemin AltPath.  * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CP_Act10:			; BUTTON Get
	Lea	AslName,a1	
	Moveq	#36,d0
	Move.l	ExecBase,a6
	Jsr	OpenLibrary(a6)		; Ouvrir la librairie Asl
	Move.l	d0,AslBase	
	Beq.L	CP_NoAsl		; Ouverture a échoué

	Move.l	d0,a6			;!!
	Moveq	#0,d0			; Type = File Requester
	Lea	Config_AslPTags,a1
	Jsr	AllocAslRequest(a6)	; Alloue la structure File Request
	Move.l	d0,AslRequestStruct
	Beq.s	CP_NoRequest		; Structure non-disponible

	Move.l	d0,a0			;!!  Request en a0
	Lea	Config_AslPTags,a1
	Jsr	AslRequest(a6)		; Affiche la requête
	Tst.l	d0			; Résultat ( 0L = Cancel|Fail )
	Beq.s	CP_CancelRequester
					; Utiliser les résultats
	Move.l	AslRequestStruct,a0
	Move.l	rf_Dir(a0),a1		; adresse du nom du répertoire
	Move.l	ConfigBuffer,a0
	Adda.l	#CP_Config_AltPath,a0	; ConfigBuffer->AltPath
	CP_Act10_CopyString:
	Move.b	(a1)+,(a0)+		; Copier la chaîne du nom de fichier
	Tst.b	(a1)			;  jusqu'à 0
	Bne.s	CP_Act10_CopyString
	Move.b	(a1),(a0)		; Copier le 0

	Move.l	GadtoolsBase,a6
	Move.l	ConfigGadgets,a0	; 1er gadget (TEXT)
	Move.l	ConfigWnd,a1
	Move.l	#0,a2
	Lea	WriteTextTags,a3	; Afficher le nouveau Text
	Move.l	a3,a4			; Pointeur sur les Tags
	Addq.l	#4,a4			; Pointeur sur la donnée du tag
	Move.l	ConfigBuffer,a5		; Pointeur sur la config
	Adda.l	#CP_Config_AltPath,a5	; Pointeur sur le nom du fichier
	Move.l	a5,(a4)			; Adresse du nom dans la donnée du Tag
	Jsr	GT_SetGadgetAttrsA(a6)

	CP_CancelRequester:		; Cancel ou Fail
	Move.l	AslBase,a6
	Move.l	AslRequestStruct,a0	; Libère la structure
	Jsr	FreeAslRequest(a6)
	CP_NoRequest:			; Pas de structure Request
	Move.l	ExecBase,a6
	Move.l	AslBase,a1
	Jsr	CloseLibrary(a6)
	CP_NoAsl:			; Ouverture de Asl a échoué
	Jmp	CP_ActF			; Terminer


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Ouvre l'interface About. * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CP_Act11:			; BUTTON About
	Move.b	#4,GUI_
	Move.w	#AboutLeft,Left
	Move.w	#AboutTop,Top
	Move.w	#AboutWidth,Width
	Move.w	#AboutHeight,Height
	Bsr	OpenWindow_
	Move.l	Wnd,AboutWnd

	Move.l	#NormalBevelbox,Bevelbox_Taglist
	Move.w	#About0_Top,BevelTop
	Move.w	#About0_Left,BevelLeft
	Move.w	#About0_Width,BevelWidth
	Move.w	#About0_Height,BevelHeight
	Bsr	Render1

	Move.b	#$ff,UserResponse
;	Move.l	AboutWnd,Wnd
	Bsr	WaitMessages
;	Move.b	UserResponse,About_UserResponse
;	Move.l	AboutWnd,Wnd
	Bsr	IMessageLoop
	Bsr	CloseWindow_
;!!	Jmp	CP_ActF			; Terminer

CP_ActF:
	Bsr	GM_RepIMessage		; 
	Jmp	CP_WaitGadget		; Attendre la pression d'un autre gadget


CP_FreeConfigBuffer:
	Move.l	ExecBase,a6
	Move.l	ConfigBuffer,a1
	Move.l	#ConfigBufferL,d0
	Jsr	FreeMem(a6)
	Rts

CP_Evtl_ReplyMessage:
	Tst.b	ReplyMessage_Lock
	Beq.s	CP_Evtl_ReplyMessageF
	Move.l	ExecBase,a6
	Move.l	Msg,a1
	Jsr	ReplyMsg(a6)
	CP_Evtl_ReplyMessageF:
	Rts

ConfigPanel_Err_1:
	Move.l	ConfigWnd,Wnd
	Bsr	IMessageLoop
	Bsr	CloseWindow_
	Bsr	CloseDownScreen_	; Fermer fenêtre et libérer gadgets
	Bsr	CP_FreeConfigBuffer	; Libérer le tampon de la config

ConfigPanel_Err_0:
	Tst.b	ReplyMessage_Lock
	Beq.s	CPErr_NoReplyMessage
	Move.l	ExecBase,a6
	Move.l	Msg,a1
	Jsr	ReplyMsg(a6)
	CPErr_NoReplyMessage:
	Jmp	GetAppMessage

			; ComputeFont_Lock:	0  ->  Font des gadgets
			;			1  ->  Font des textes


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  DESCRIPTION:								*
*	GetWorkingMessage:						*
*		Vérifie si un gadget de l'interface Working à été	*
*		appyué.							*
*  INPUT:								*
*  OUTPUT:								*
*		UserResponse  =  Numéro du gadget appuyé + 1  ou  $ff	*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


GetWorkingMessage:
	Move.l	WorkingWnd,Wnd
	Move.b	#$ff,UserResponse
	Bsr	GetMessage
	Move.b	UserResponse,Working_UserResponse
	Rts


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  DESCRIPTION:								*
*	WaitMessages:							*
*		Attend que l'utilisateur appuye un gadget et renvoie	*
*		le code correspondant.					*
*	GetMessage:							*
*		Renvoie le gadget appuyé, mais n'attend pas.		*
*		Retourne immédiatement.					*
*	IMessageLoop:							*
*		Va chercher tous les messages sur le port et renvoie	*
*		la réponse immédiatement.				*
*	GM_RepIMessage:							*
*		Renvoie le message au port de la fenêtre		*
*  INPUT:								*
*		Wnd		=  WindowPtr				*
*		UserResponse	=  $ff					*
*	GM_RepIMessage:							*
*		Gt_IMsg.l	=  Message reçu avec Gt_GetIMsg		*
*  OUTPUT:								*
*	WaitMessages:							*
*		UserResponse    =  Numéro du gadget + 1			*
*		Code		=  IMsg->Code				*
*	GetMessage:							*
*		UserResponse    =  Numéro du gadget + 1  ou  $ff	*
*		Code		=  IMsg->Code				*
*	IMessageLoop:							*
*		Message		=  Poiteur sur le port message		*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


WaitMessages:				; Attendre la reponse de l'utilisateur
	Move.b	#0,UserResponse
	Move.l	Wnd,a0
	Move.l	86(a0),a0
	Move.l	ExecBase,a6
	Jsr	WaitPort(a6)		; On Attend un message sur le port
	Move.b	#0,UserResponse		; Wait: UserResponse = 0

GetMessage:
	Move.l	Wnd,a0
	Move.l	86(a0),a0		; L'attente est finie.
	Move.l	GadtoolsBase,a6
	Jsr	GT_GetIMsg(a6)		; On prélève le message
	Move.l	d0,Gt_IMsg		; Message
	Bne.s	TestIMessage_F		; Réponse OK ? --> sauver réponse
					; Réponse pas OK.
	Cmp.b	#$ff,UserResponse	; Message attendu ?
	Bne.s	WaitMessages		; Oui, on retourne attendre.
	Beq.s	GM_IReturn		; Non, on sort.
	TestIMessage_F:			; Le message est OK.

	Move.l	d0,a0			; Structure IMsg
	Move.l	20(a0),d1		; IMsg->Class
	Move.w	24(a0),Code		; IMsg->Code
	Move.l	28(a0),a0		; IMsg->IAdress
	Moveq	#0,d0			
	Move.w	38(a0),d0		; IMsg->IAdress->GadgetID
	Addq.b	#1,d0			; Numéro du gadget  +  1
	Move.b	d0,UserResponse

	Btst	#2,d1			; IDCMP_RefreshWindow
	Beq.s	WM_RefreshF		; Non, on continue
	Move.l	GadToolsBase,a6		; Oui, rafraîchir la fenêtre
	Move.l	Wnd,a0
	Jsr	GT_BeginRefresh(a6)
	Move.l	Wnd,a0
	Moveq	#1,d0			; Complete = TRUE
	Jsr	GT_EndRefresh(a6)
	WM_RefreshF:	

GM_RepIMessage:
	Move.l	GadToolsBase,a6
	Move.l	Gt_IMsg,a1
	Jsr	GT_ReplyIMsg(a6)	; On renvoie le message au port.
	Move.l	#0,Gt_IMsg

	GM_IReturn:
	Rts				; On retourne


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Prend les messages en boucle.  * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

IMessageLoop:				; L'utilisateur a déjà répondu.
	Move.l	GadToolsBase,a6		; On boucle jusqu'à plus de Msg
	Move.l	Wnd,a0
	Move.l	86(a0),a0		; Window->UserPort
	Jsr	Gt_GetIMsg(a6)
	Move.l	d0,a1			; Lorsqu'il y plus de message,
	Beq.s	IML_Return			; on sort de la boucle.
	Jsr	Gt_ReplyIMsg(a6)
	Jmp	IMessageLoop
IML_Return:
	Rts


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  DESCRIPTION:								*
*	End_:								*
*		Termine le programme.  Désalloue tout pour quitter	*
*  INPUT:								*
*  OUTPUT:								*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


End_:					; Fin.

End_4:
	Move.l	ExecBase,a6
	Move.l	ConfigBuffer0,a1
	Move.l	#ConfigBufferL,d0
	Jsr	FreeMem(a6)
End_3:
	Move.l	WorkbenchBase,a6
	Move.l	AppIcon,a0
	Jsr	RemoveAppIcon(a6)	; On enléve l'AppIcon
End_2:
	Move.l	ExecBase,a6
	Move.l	AppMsgPort,a0
	Jsr	DeleteMsgPort(a6)	; On ferme le message-port
End_1:
	Move.l	IconBase,a6
	Move.l	DiskObject,a0		; Libération de la structure
	Jsr	FreeDiskObject(a6)	; DiskObject
End:
	Move.l	ExecBase,a6
	Move.l	ppBase,a1
	Jsr	CloseLibrary(a6)
	Move.l	IntuitionBase,a1	; On ferme toutes les
	Jsr	CloseLibrary(a6)	; libraries.
	Move.l	GadtoolsBase,a1
	Jsr	CloseLibrary(a6)
	Move.l	DosBase,a1
	Jsr	CloseLibrary(a6)
	Move.l	WorkbenchBase,a1
	Jsr	CloseLibrary(a6)
	Move.l	IconBase,a1
	Jsr	CloseLibrary(a6)

	Move.l	WbMsg,a1		; Rendre le Startup-Message
	Jsr	ReplyMsg(a6)
End_0:
	Move.l	Stack,a7
;	Move.l	ReturnCode,d0		; Pour le deboguage seulement.
	Rts				; Fin du programme...


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* *								      * *
* *								      * *
* *		  * * * * * * * * * * * * * * * * * *		      * *
* *		 *  CODE GENERE PAR GADTOOLSBOX 2.0  *		      * *
* *		  * * * * * * * * * * * * * * * * * *		      * *
* *								      * *
* *								      * *
* *	   Il a été largement modifé afin de pouvoir supporter	      * *
* *	 plusieurs interfaces (question d'optimisation)  et pour      * *
* *    enlever un bug (rien de grave, uniquement de la cosmétique)    * *
* *								      * *
* *    Malgré que GadtoolsBox souffre encore de pas mal de défauts    * *
* *   de jeunesse  et que le code source généré souffre de beaucoup   * *
* *	   de manques que j'ai du combler (GadtoolsBox génère	      * *
* *	l'interface au sens pûrement graphique du terme, mais ne      * *
* *	 gère pas les gadgets),  il m'a permit de comprendre le	      * *
* *   fonctionnement de la Gadtools.library  qui est le seul moyen    * *
* *   de programmer convenablement une interface graphique, à part    * *
* *    MUI, qui est vraiment le top (Même sur Macintosh, il n'y a     * *
* *			  rien de comparable!)			      * *
* *								      * *
* *   De toute façon,  un grand Merci à Jan van den Baard, l'auteur   * *
* *  de GadtoolsBox,  pous son immense service rendu à la communauté  * *
* *	 Amiga.  Grâce à lui, donner une interface graphique à un     * *
* *	 n'est, sur Amiga, plus un luxe, ni une perte de temps...     * *
* *								      * *
* *								      * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  DESCRIPTION:								*
*	SetupScreen_:							*
*		Fait un Intuition.library/LockPubScreen() afin		*
*		d'ouvrir la fenêtre sans risque et un			*
*		Gadtools.library/GetVisualInfo()			*
*	OpenWindow_:							*
*		Ouvre la fenêtre en fonction des paramètres d'entrée	*
*		Crée les gadgets, dessine les bevelboxes et écrit les	*
*		textes en fonction des paramétres et d'une manière	*
*		Font-Adaptive						*
*	CloseWindow_:							*
*		Referme la fenêtre et libère les gadgets		*
*	CloseDownSreen_:						*
*		Fait un Intuition.library/UnlockPubscreen()		*
*  INPUT:								*
*	SetupScreen_:							*
*	OpenWindow_:							*
*		Width.w		=  Largeur de la fenêtre		*
*		Height.w	=  Hauteur de la fenêtre		*
*		Top.w		=  Distance du haut			*
*		Left.w		=  Distance de gauche			*
*		GUI_.b		=  Numéro d'interface			*
*		OffX.w		=  Offset de gauche (généralement nul)	*
*		OffY.w		=  Offset du haut (généralement nul)	*
*		Bevelbox_Taglist.l=Pointeur sur une Taglist		*
*	CloseWindow_:							*
*		Wnd.l		=  Pointeur sur Window			*
*		GList.l		=  Pointeur sur la liste de gadget	*
*	CloseDownScreen_:						*
*		VisualInfo.l	=  					*
*		Scr.l		=  Pointeur l'écran locké		*
*  OUTPUT:								*
*	SetupScreen_:							*
*		VisualInfo.l	=  					*
*		Scr.l		=  Pointeur sur l'écran locké		*
*	OpenWindow_:							*
*		Wnd.l		=  Pointeur sur Window			*
*		GList.l		=  NULL					*
*	CloseWindow_:							*
*		Wnd.l		=  0					*
*		GList.l		=  0					*
*	CloseDownScreen_:						*
*		Scr.l		=  0					*
*		VisualInfo.l	=  0					*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


ComputeY:
	move.l	d1,-(sp)
	Cmp.b	#1,ComputeFont_Lock
	Beq.s	ComputeY_UseBuf2
	Move.w	FontY,d1
	Jmp	ComputeY_UseBuf1F
	ComputeY_UseBuf2:
	Move.w	FontY2,d1
	ComputeY_UseBuf1F:
	mulu	d1,d0
	addq.w	#6,d0
	Divu	#12,d0
	move.l	(sp)+,d1
	rts
ComputeX:
	Move.l	d1,-(sp)
	Cmp.b	#1,ComputeFont_Lock
	Beq.s	ComputeX_UseBuf2
	Move.w	FontX,d1
	Jmp	ComputeX_UseBuf1F
	ComputeX_UseBuf2:
	Move.w	FontX2,d1
	ComputeX_UseBuf1F:
	ComputeItX:
	mulu	d1,d0
	addq.w	#4,d0
	Divu	#8,d0
	move.l	(sp)+,d1
	rts

ComputeFont:
	Move.l	Scr,a1
	Lea	sc_RastPort(a1),a1
	Move.l	rp_Font(a1),a1
	Cmp.b	#1,ComputeFont_Lock
	Beq.s	ComputeFont_UseBuf2
	Move.l	#Attr,a0
	Move.l	a0,Font
	Move.w	tf_XSize(a1),FontX
	Move.w	tf_YSize(a1),FontY
	Jmp	ComputeFont_UseBuf1F
	ComputeFont_UseBuf2:
	Move.l	#Attr2,a0
	Move.l	a0,Font2
	Move.w	tf_XSize(a1),FontX2
	Move.w	tf_YSize(a1),FontY2
	ComputeFont_UseBuf1F:
	Move.l	0(a1),ta_Name(a0)		; Remplace LN_NAME	; move.l LN_NAME(a1),ta_Name(a0)
	Move.w	tf_YSize(a1),ta_YSize(a0)
    move.l  Scr,a0
    move.b  sc_WBorLeft(a0),d0
    ext.w   d0
    move.w  d0,OffX
    move.l  sc_Font(a0),a1
    move.w  ta_YSize(a1),d0
    addq.w  #1,d0
    add.b   sc_WBorTop(a0),d0
    move.w  d0,OffY
    tst.w   d2
    beq.s   ComputeFont_F
    tst.w   d3
    beq.s   ComputeFont_F
    move.w  d2,d0
    bsr     ComputeX
    add.w   OffX,d0
    add.b   sc_WBorRight(a0),d0
    cmp.w   sc_Width(a0),d0
    bhi.s   ComputeFont_UseTopaz
    move.w  d3,d0
    bsr     ComputeY
    add.w   OffY,d0
    add.b   sc_WBorBottom(a0),d0
    cmp.w   sc_Height(a0),d0
    bhi.s   ComputeFont_UseTopaz
ComputeFont_F:
    rts
ComputeFont_UseTopaz:
    move.l  Font,a0
    move.l  #TopazName,ta_Name(a0)
    move.w  #8,FontY
    move.w  #8,FontX
    move.w  #8,ta_YSize(a0)
    rts


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  LockPubScreen et alloue VisualInfo.  * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

SetupScreen_:
    movem.l d1-d3/a0-a2/a6,-(sp)
    move.l  IntuitionBase,a6
    move.l  PubScreenName,a0
    jsr     LockPubScreen(a6)		; Empêche la fermeture de l'écran
    move.l  d0,Scr
    tst.l   d0
    beq.s   SError			; Screen Error
    moveq   #0,d2
    moveq   #0,d3
	Move.b	#0,ComputeFont_Lock	; Texte des gadgets
    bsr     ComputeFont
    move.l  Scr,a0
    move.l  GadToolsBase,a6
    lea.l   TD,a1
    jsr     GetVisualInfoA(a6)		; Sert à remplir NewGadget
    move.l  d0,VisualInfo
    tst.l   d0
    beq.s   VError			; Visual Error
    moveq   #0,d0			; 0 = ok, on continue
SetupScreen__Done:
    movem.l (sp)+,d1-d3/a0-a2/a6
    rts
SError:
    moveq   #1,d0			; Screen Error : 1 en d0
    bra.s   SetupScreen__Done
VError:
    moveq   #2,d0			; Visual Error : 2 en d0
    bra.s   SetupScreen__Done


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  UnlockPubScreen et libère la structure VisualInfo  * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CloseDownScreen_:
    movem.l d0-d1/a0-a1/a6,-(sp)
    move.l  IntuitionBase,a6
    move.l  getImage,a0
    cmpa.l  #0,a0
    beq.s   NoObj
    jsr     DisposeObject(a6)
NoObj:
    move.l  getClass,a0
    cmpa.l  #0,a0
    beq.s   NoCls
    jsr     FreeClass(a6)
NoCls:
    move.l  GadToolsBase,a6
    move.l  VisualInfo,a0
    cmpa.l  #0,a0
    beq.s   NoVisualInfo
    jsr     FreeVisualInfo(a6)
    move.l  #0,VisualInfo
NoVisualInfo:
    move.l  IntuitionBase,a6
    suba.l  a0,a0
    move.l  Scr,a1
    cmpa.l  #0,a1
    beq.s   NoScreen
    jsr     UnlockPubScreen(a6)
    move.l  #0,Scr
NoScreen:
    movem.l (sp)+,d0-d1/a0-a1/a6
    rts


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Affiche les textes en boucle.  * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Render0:
    movem.l d0-d5/a0-a2/a6,-(sp)
    move.l  Wnd,a0
    move.w  Width,d2
    move.w  Height,d3
	Move.b	#1,ComputeFont_Lock
    bsr     ComputeFont
    moveq   #0,d3
;	Cmp.b	#1,GUI_
;	Beq.s	Render0GUI_1
;	Cmp.b	#2,GUI_
;	Beq.s	Render0GUI_2
;	Cmp.b	#3,GUI_
;	Beq.s	Render0GUI_3
;	Cmp.b	#4,GUI_
;	Beq.s	Render0GUI_4
;	Render0GUI_1:
;	Lea.l	CrunchText0,a2
;	Jmp	Render0GUI_F
;	Render0GUI_2:
;	Lea.l	WorkingText0,a2
;	Jmp	Render0GUI_F
;	Render0GUI_3:
;	Lea.l	ConfigText0,a2
;	Jmp	Render0GUI_F
	Render0GUI_4:
	Lea.l	AboutText0,a2
;!!	Jmp	Render0GUI_F
	Render0GUI_F:

	CrunchTLoop:
    move.l  ExecBase,a6
    lea.l   BufIText,a1
    move.l  a2,a0
    move.l  d3,d0
    mulu    #it_SIZEOF,d0
    add.l   d0,a0
    moveq   #it_SIZEOF,d0
    jsr     CopyMem(a6)
    lea.l   BufIText,a0
    move.l  IntuitionBase,a6
    move.l  Font2,it_ITextFont(a0)
    jsr     IntuiTextLength(a6)
    asr.l   #1,d0
    move.l  d0,-(sp)
    lea.l   BufIText,a0
    move.w  it_LeftEdge(a0),d0
    bsr     ComputeX
    add.w   OffX,d0
    ext.l   d0
    sub.l   (sp)+,d0
    move.w  d0,it_LeftEdge(a0)
    move.w  it_TopEdge(a0),d0
    bsr     ComputeY
    add.w   OffY,d0
    move.l  Font2,a1
    move.w  ta_YSize(a1),d1
    asr.w   #1,d1
    sub.w   d1,d0
    move.w  d0,it_TopEdge(a0)
    move.l  a0,a1
    move.l  Wnd,a0
    move.l  wd_RPort(a0),a0
    moveq   #0,d0
    moveq   #0,d1
    jsr     PrintIText(a6)
    addq.l  #1,d3
;	Cmp.b	#1,GUI_
;	Beq.s	CrunchTLoopGUI_1
;	Cmp.b	#2,GUI_
;	Beq.s	CrunchTLoopGUI_2
;	Cmp.b	#3,GUI_
;	Beq.s	CrunchTLoopGUI_3
;	Cmp.b	#4,GUI_
;	Beq.s	CrunchTLoopGUI_4
;	CrunchTLoopGUI_1:
;	Cmp.w	#Crunch_TNUM,d3
;	Bmi	CrunchTLoop
;	Jmp	CrunchTLoopGUI_F
;	CrunchTLoopGUI_2:
;	Cmp.w	#Working_TNUM,d3
;	Bmi	CrunchTLoop
;	Jmp	CrunchTLoopGUI_F
;	CrunchTLoopGUI_3:
;	Cmp.w	#Config_TNUM,d3
;	Bmi	CrunchTLoop
;	Jmp	CrunchTLoopGUI_F
;	CrunchTLoopGUI_4:
	Cmp.w	#About_TNUM,d3
	Bmi	CrunchTLoop
;!!	Jmp	CrunchTLoopGUI_F
	CrunchTLoopGUI_F:
    movem.l (sp)+,d0-d5/a0-a2/a6
	Move.b	#0,ComputeFont_Lock
    rts


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*									*
*  FUNCTION:								*
*	Render1:							*
*		Dessine une Bevel Box dans la fenêtre en s'adaptant	*
*		au fontes à la manière GadtoolsBox			*
*  INPUT:								*
*	Render1:							*
*		Wnd.l		=  Pointeur sur Window			*
*		Width.w		=  Dimension avant calculation		*
*		Height.w	=  Dimension avant calculation		*
*		VisualInfo.l	=  Pointeur sur stucture VisualInfo	*
*		Bevelbox_TagList.l=Pointeur sur une TagList		*
*		BevelTop.w	=  Bevelbox Top avant calculation	*
*		BevelLeft.w	=  Bevelbox Left avant calculation	*
*		BevelWidth.w	=  Bevelbox Width avant calculation	*
*		BevelHeight.w	=  Bevelbox Height avant calculation	*
*  OUTPUT:								*
*	Render1:							*
*									*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


Render1:
	Movem.l	d0-d5/a0-a3/a6,-(sp)
    move.l  Wnd,a0
    move.w  Width,d2
    move.w  Height,d3
    jsr     ComputeFont
	Move.l  VisualInfo,NormalBevelbox+4
	Move.l  VisualInfo,InverseBevelbox+4

	Moveq	#0,d0
	Move.w	BevelTop,d0		; Top en d0
	Bsr	ComputeY
	Add.w	OffY,d0			; Ajouter Offset
	Move.l	d0,d1			; Top + Offset  en  d1
	Move.w	BevelWidth,d0		; Width en d0
	Bsr	ComputeX
	Move.l	d0,d2			; Top + Offset  en  d2
	Move.w	BevelHeight,d0		; Height en d0
	Bsr	ComputeY
	Move.l	d0,d3			; Top + Offset  en  d3
	Move.w	BevelLeft,d0		; Left en d0
	Bsr	ComputeX
	Add.w	OffX,d0			; Left + Offset en d0

	Move.l	GadToolsBase,a6
	Move.l	Wnd,a0
	Move.l	wd_RPort(a0),a0		; RastPort en a0
	Move.l	Bevelbox_Taglist,a1	; TagList en a1
	Jsr	DrawBevelBoxA(a6)
	Movem.l	(sp)+,d0-d5/a0-a3/a6
	Rts


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Ouvre la fenêtre et crée les gadgets.  * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

OpenWindow_:
    movem.l d1-d4/a0-a4/a6,-(sp)
    move.l  Scr,a0
    moveq   #0,d3
    moveq   #0,d2
    move.w  Width,d2
    move.w  Height,d3
	Move.b	#0,ComputeFont_Lock	; Texte des gadgets
    bsr     ComputeFont
    move.l  Scr,a0
    move.l  d2,d0
    bsr     ComputeX
    move.l  d0,d4
    move.w  Left,d2
    add.w   d2,d0
    add.w   OffX,d0
	Add.b	sc_WBorRight(a0),d0
    cmp.w   sc_Width(a0),d0
    bls.s   CrunchWindowOk
    move.w  sc_Width(a0),d0
    sub.w   d4,d0
    move.w  d0,d2
CrunchWindowOk:
    move.l  d3,d0
    bsr     ComputeY
    move.l  d0,d4
    move.w  Top,d3
    add.w   d3,d0
    add.w   OffY,d0
	Add.b	sc_WBorBottom(a0),d0
    cmp.w   sc_Height(a0),d0
    bls.s   CrunchHeightOk
    move.w  sc_Height(a0),d0
    sub.w   d4,d0
    move.w  d0,d3
CrunchHeightOk:
	Move.l	GadToolsBase,a6
;	Cmp.b	#1,GUI_
;	Beq.s	CrunchHeightOkGUI_1	; Mettre les bons Tags en a4
	Cmp.b	#2,GUI_
	Beq.s	CrunchHeightOkGUI_2
	Cmp.b	#3,GUI_
	Beq.s	CrunchHeightOkGUI_3
	Cmp.b	#4,GUI_
	Beq.L	CrunchHeightOkGUI_4
	CrunchHeightOk_Com:
	Jsr	CreateContext(a6)	; ContextData en d0
	Move.l	d0,a3
	Tst.l	d0
	Beq	CrunchCError		; Erreur de ContextData
	Rts
;	CrunchHeightOkGUI_1:
;	Lea.l	CrunchGTags,a4
;	Lea.l	CrunchGList,a0
;	Bsr	CrunchHeightOk_Com
;	Movem.l	d2-d3,-(sp)
;	Moveq	#0,d3			; Nb de gadgets crées  =  0
;	Lea	CrunchGTags,a4
;	Jmp	CrunchHeightOkGUI_F
	CrunchHeightOkGUI_2:
	Lea.l	WorkingGTags,a4
	Lea.l	WorkingGList,a0
	Bsr	CrunchHeightOk_Com
	Movem.l	d2-d3,-(sp)
	Moveq	#0,d3			; Nombre de gadgets crées  =  0
	Lea	WorkingGTags,a4
	Jmp	CrunchHeightOkGUI_F
	CrunchHeightOkGUI_3:
	Lea.l	ConfigGTags,a4
	Lea.l	ConfigGList,a0
	Bsr	CrunchHeightOk_Com
	Movem.l	d2-d3,-(sp)
	Moveq	#0,d3			; Nombre de gadgets crées  =  0
	Lea	ConfigGTags,a4
	Jmp	CrunchHeightOkGUI_F
	CrunchHeightOkGUI_4:
	Lea.l	AboutGTags,a4
	Lea.l	AboutGList,a0
	Bsr	CrunchHeightOk_Com
	Movem.l	d2-d3,-(sp)
	Moveq	#0,d3			; Nombre de gadgets crées  =  0
	Lea	AboutGTags,a4
	Jmp	CrunchHeightOkGUI_F
	CrunchHeightOkGUI_F:


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  GadgetLoop: Crée les gadgets en boucle.  * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CrunchGL:				; Gadget Loop
    move.l  ExecBase,a6
;	Cmp.b	#1,GUI_
;	Beq.s	CrunchGl0GUI_1
	Cmp.b	#2,GUI_
	Beq.s	CrunchGl0GUI_2
	Cmp.b	#3,GUI_
	Beq.s	CrunchGl0GUI_3
	Cmp.b	#4,GUI_
	Beq.s	CrunchGl0GUI_4
;	CrunchGl0GUI_1:
;	Lea.l	CrunchNGads,a0
;	Jmp	CrunchGl0GUI_F
	CrunchGl0GUI_2:
	Lea.l	WorkingNGads,a0		; Structure NewGadget en a0
	Jmp	CrunchGl0GUI_F
	CrunchGl0GUI_3:
	Lea.l	ConfigNGads,a0
	Jmp	CrunchGl0GUI_F
	CrunchGl0GUI_4:
	Lea.l	AboutNGads,a0
;!!	Jmp	CrunchGl0GUI_F
	CrunchGl0GUI_F:
    move.l  d3,d0			; Nombre de gadget affichés
    mulu    #gng_SIZEOF,d0		; à copier = Taille gadget * Size
    add.l   d0,a0			; Adresse source en a0
    lea.l   BufNewGad,a1		; Adresse dest en a1
    moveq   #gng_SIZEOF,d0		; Nombre de bytes à copier
    jsr     CopyMem(a6)			; Copier le gadget dans le tampon
    lea.l   BufNewGad,a0
    move.l  VisualInfo,gng_VisualInfo(a0); VisualInfo doit être initialisé
    move.l  Font,gng_TextAttr(a0)	; TextAttr doit ête initialisé
    move.w  gng_LeftEdge(a0),d0
    bsr     ComputeX
    add.w   OffX,d0
    move.w  d0,gng_LeftEdge(a0)
    move.w  gng_TopEdge(a0),d0
    bsr     ComputeY
    add.w   OffY,d0
    move.w  d0,gng_TopEdge(a0)
    move.w  gng_Width(a0),d0
    bsr     ComputeX
    move.w  d0,gng_Width(a0)
    move.w  gng_Height(a0),d0
    bsr     ComputeY
    move.w  d0,gng_Height(a0)
    move.l  GadToolsBase,a6
;	Cmp.b	#1,GUI_
;	Beq.s	CrunchGl1GUI_1
	Cmp.b	#2,GUI_
	Beq.s	CrunchGl1GUI_2
	Cmp.b	#3,GUI_
	Beq.s	CrunchGl1GUI_3
	Cmp.b	#4,GUI_
	Beq.s	CrunchGl1GUI_4
;	CrunchGl1GUI_1:
;	Lea.l	CrunchGTypes,a0
;	Jmp	CrunchGl1GUI_F
	CrunchGl1GUI_2:
	Lea.l	WorkingGTypes,a0	; GadgetType en a0
	Jmp	CrunchGl1GUI_F
	CrunchGl1GUI_3:
	Lea.l	ConfigGTypes,a0
	Jmp	CrunchGl1GUI_F
	CrunchGl1GUI_4:
	Lea.l	AboutGTypes,a0
;!!	Jmp	CrunchGl1GUI_F
	CrunchGl1GUI_F:
    moveq   #0,d0
    move.l  d3,d1			; Nombre de gadget crés en d1
    asl.l   #1,d1			; Multiplier par 2
    add.l   d1,a0			; GadgetType suivant (.w)
    move.w  (a0),d0			; Kind en d0
    move.l  a3,a0			; Context ou Previous en a0
    lea.l   BufNewGad,a1		; Gadget copié en a1 (NewGad)
    move.l  a4,a2			; Taglist en a2
    jsr     CreateGadgetA(a6)		; Créer le gadget
    tst.l   d0				; Création ok ?
    bne.s   CrunchCreateOK		; Oui, continue
    movem.w (sp)+,d2-d3
    bra     CrunchCError		; Non, on se branche à l'erreur
CrunchCreateOK:
    move.l  d0,a3		; Gadget crée devient le précédent
    move.l  d3,d0			; Nombre de gadget crés en d0
    asl.l   #2,d0			; Mulitplier le nb par 4
;	Cmp.b	#1,GUI_
;	Beq.s	CrunchCreateOkGUI_1
	Cmp.b	#2,GUI_
	Beq.s	CrunchCreateOkGUI_2
	Cmp.b	#3,GUI_
	Beq.s	CrunchCreateOkGUI_3
	Cmp.b	#4,GUI_
	Beq.s	CrunchCreateOkGUI_4
;	CrunchCreateOkGUI_1:
;	Lea.l	CrunchGadgets,a0
;	Jmp	CrunchCreateOkGUI_F
	CrunchCreateOkGUI_2:
	Lea.l	WorkingGadgets,a0	; GadgetType en a0
	Jmp	CrunchCreateOkGUI_F
	CrunchCreateOkGUI_3:
	Lea.l	ConfigGadgets,a0
	Jmp	CrunchCreateOkGUI_F
	CrunchCreateOkGUI_4:
	Lea.l	AboutGadgets,a0
;!!	Jmp	CrunchCreateOkGUI_F
	CrunchCreateOkGUI_F:
    add.l   d0,a0			; Avancer du   nb de gadget * 4
    move.l  a3,(a0)			; Sauver le gadget à la bonne place
CrunchTagLoop:
    tst.l   (a4)			; Taglist contient TAG_DONE ?
    beq.s   CrunchDN			; Oui, on continue
    addq.w  #8,a4			; Non, on boucle jusqu'à obtenir
    bra.s   CrunchTagLoop		;  TAG_DONE
CrunchDN:
    addq.w  #4,a4			; Taglist = TAG_DONE + 4
    addq.w  #1,d3			; Nb de gadget crées + 1
;	Cmp.b	#1,GUI_
;	Beq.s	CrunchDn0GUI_1
	Cmp.b	#2,GUI_
	Beq.L	CrunchDn0GUI_2
	Cmp.b	#3,GUI_
	Beq.L	CrunchDn0GUI_3
	Cmp.b	#4,GUI_
	Beq	CrunchDn0GUI_4
	CrunchDn0GUI_Com0:
	Move.l	Scr,a0
	Move.w	Width,d0
	Bsr	ComputeX
	Add.w	OffX,d0
	Add.b	sc_WBorRight(a0),d0
	Rts
	CrunchDn0GUI_Com1:
	Move.w	Height,d0
	Bsr	ComputeY
	Add.w	OffY,d0
	Add.b	sc_WBorBottom(a0),d0
	Rts
;	CrunchDn0GUI_1:
;	Cmp.w	#Crunch_CNT,d3		; Est-ce égal au nombre de gadget total
;	Bmi	CrunchGL		; Inférieur, on crée le gadget suivant
;	Movem.l	(sp)+,d2-d3
;	Ext.l	d2
;	Ext.l	d3
;	Move.l	CrunchGList,CrunchWG+4
;	Move.l	d2,CrunchL+4
;	Move.l	d3,CrunchT+4
;	Bsr	CrunchDn0GUI_Com0
;	Move.l	d0,CrunchW+4
;	Bsr	CrunchDn0GUI_Com1
;	Move.l	d0,CrunchH+4
;	Lea.l	CrunchWindowTags,a1
;	Jmp	CrunchDn0GUI_F2
	CrunchDn0GUI_2:
	Cmp.w	#Working_CNT,d3
	Bmi	CrunchGL
	Movem.l	(sp)+,d2-d3
	Ext.l	d2
	Ext.l	d3
	Move.l	WorkingGlist,WorkingWG+4
	Move.l	d2,WorkingL+4
	Move.l	d3,WorkingT+4
	Bsr	CrunchDn0GUI_Com0
	Move.l	d0,WorkingW+4
	Bsr	CrunchDn0GUI_Com1
	Move.l	d0,WorkingH+4
	Lea.l	WorkingWindowTags,a1
	Jmp	CrunchDn0GUI_F2
	CrunchDn0GUI_3:
	Cmp.w	#Config_CNT,d3
	Bmi	CrunchGL
	Movem.l	(sp)+,d2-d3
	Ext.l	d2
	Ext.l	d3
	Move.l	ConfigGlist,ConfigWG+4
	Move.l	d2,ConfigL+4
	Move.l	d3,ConfigT+4
	Bsr	CrunchDn0GUI_Com0
	Move.l	d0,ConfigW+4
	Bsr	CrunchDn0GUI_Com1
	Move.l	d0,ConfigH+4
	Lea.l	ConfigWindowTags,a1
	Jmp	CrunchDn0GUI_F2
	CrunchDn0GUI_4:
	Cmp.w	#About_CNT,d3
	Bmi	CrunchGL
	Movem.l	(sp)+,d2-d3
	Ext.l	d2
	Ext.l	d3
	Move.l	AboutGList,AboutWG+4
	Move.l	d2,AboutL+4
	Move.l	d3,AboutT+4
	Bsr	CrunchDn0GUI_Com0
	Move.l	d0,AboutW+4
	Bsr	CrunchDn0GUI_Com1
	Move.l	d0,AboutH+4
	Lea.l	AboutWindowTags,a1
	Jmp	CrunchDn0GUI_F2
	CrunchDn0GUI_F1:
	CrunchDn0GUI_F2:
    move.l  IntuitionBase,a6
    suba.l  a0,a0
    jsr     OpenWindowTagList(a6)
    move.l  d0,Wnd
    tst.l   d0
    beq     CrunchWError
    move.l  GadToolsBase,a6
    move.l  Wnd,a0
    suba.l  a1,a1
    jsr     GT_RefreshWindow(a6)
;	Cmp.b	#1,GUI_			; Si pas de texte, se brancher à F2
;	Beq.s	CrunchDn5GUI_F1
	Cmp.b	#2,GUI_
	Beq.s	CrunchDn5GUI_F2
	Cmp.b	#3,GUI_
	Beq.s	CrunchDn5GUI_F2
;	Cmp.b	#4,GUI_
;!!	Beq.s	CrunchDn5GUI_F1
	CrunchDn5GUI_F1:
	Bsr	Render0
	CrunchDn5GUI_F2:
    moveq   #0,d0
CrunchDone:
    movem.l (sp)+,d1-d4/a0-a4/a6
    rts
CrunchCError:
    moveq   #1,d0
    bra.s   CrunchDone
CrunchGError:
    moveq   #2,d0
    bra.s   CrunchDone
CrunchWError:
    moveq   #4,d0
    bra.s   CrunchDone


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Ferme la fenêtre et libère les gadgets * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

CloseWindow_:
    movem.l d0-d1/a0-a2/a6,-(sp)
    move.l  IntuitionBase,a6
    move.l  Wnd,a0
    cmpa.l  #0,a0
    beq.s   CrunchNWnd
    jsr     CloseWindow(a6)
    move.l  #0,Wnd
CrunchNWnd:
	Move.l	GadtoolsBase,a6
;	Cmp.b	#1,GUI_
;	Beq	CrunchNWndGUI1
	Cmp.b	#2,GUI_
	Beq	CrunchNWndGUI2
	Cmp.b	#3,GUI_
	Beq	CrunchNWndGUI3
	Cmp.b	#4,GUI_
	Beq	CrunchNWndGUI4
;	CrunchNWndGUI1:
;	Move.l	CrunchGList,a0	
;	Cmpa.l	#0,a0
;	Beq.l	CrunchNGads
;	Jsr	FreeGadgets(a6)
;	Move.l	#0,CrunchGList
;	Jmp	CrunchNWndGUI_F
	CrunchNWndGUI2:
	Move.l	WorkingGList,a0
	Cmpa.l	#0,a0
	Beq.l	CrunchNGads
	Jsr	FreeGadgets(a6)
	Move.l	#0,WorkingGList
	Jmp	CrunchNWndGUI_F
	CrunchNWndGUI3:
	Move.l	ConfigGList,a0
	Cmpa.l	#0,a0
	Beq.l	CrunchNGads
	Jsr	FreeGadgets(a6)
	Move.l	#0,ConfigGList
	Jmp	CrunchNWndGUI_F
	CrunchNWndGUI4:
	Move.l	AboutGList,a0
	Cmpa.l	#0,a0
	Beq.l	CrunchNGads
	Jsr	FreeGadgets(a6)
	Move.l	#0,AboutGList
;!!	Jmp	CrunchNWndGUI_F
	CrunchNWndGUI_F:
CrunchNGads:
    movem.l (sp)+,d0-d1/a0-a2/a6
    rts


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Textes, TagLists, GadgetTypes, etc...  * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

IconName:		dc.b	'icon.library',0
WorkbenchName:		dc.b	'workbench.library',0
DosName:		dc.b	'dos.library',0
GadtoolsName:		dc.b	'gadtools.library',0
IntuitionName:		dc.b	'intuition.library',0
ppName:			dc.b	'powerpacker.library',0
AslName:		dc.b	'asl.library',0
WorkingWTitle:		dc.b	' AppPP  Working Window ',0
ConfigWTitle:		DC.B	' AppPP  Config Window',0
Config_AslPTagsWndText:	dc.b	' AppPP  File Requester Window',0
AboutWTitle:		DC.B	' AppPP	 About Window',0
Def_EasyStruct_Title:	dc.b	' AppPP Request',0
ProgramName:
AppIconText:		dc.b	'AppPP',0
About_IText0:		DC.B	'- AppPP v1.0 -',0
ConfigFileName0:	dc.b	'Env:AppPP.Prefs',0
ConfigFileName1:	dc.b	'Envarc:AppPP.Prefs',0
Working_CrunchText:	DC.B	'Crunch',0
Working_DecrunchText:	DC.B	'Decrunch',0
Working_NothingText:	DC.B	'Do Nothing',0
Working_SkipText:	DC.B	'Skip File',0
Working_StopText:	DC.B	'Stop All !',0
Working_StatusText:	DC.B	'Status',0
Working_NameText:	DC.B	'Name  ',0
Working_LengthText:	DC.B	'Source',0
Working_DestText:	DC.B	'Dest ',0
Config_AltPathString:	DC.B	'Ram Disk:',0
Config_AltPathText:	dc.b	'Alt Path:',0
Config_UseAltPathText:	DC.B	'Use Alt Path',0
Config_EffText:		DC.B	'Efficiency',0
Config_BufText:		DC.B	'Buffer',0
Config_DecrEffText:	DC.B	'Decr Effect',0
Config_EffLab0:		DC.B	'Fast',0
Config_EffLab1:		DC.B	'Mediocre',0
Config_EffLab3:		DC.B	'Very '
Config_EffLab2:		DC.B	'Good',0
Config_EffLab4:		DC.B	'Best',0
Config_BufLab0:		DC.B	'Small',0
Config_BufLab1:		DC.B	'Medium',0
Config_BufLab2:		DC.B	'Large',0
Config_DecrEffLab0:	DC.B	'Color 0',0
Config_DecrEffLab1:	DC.B	'Color 1',0
Config_DecrEffLab2:	DC.B	'Pointer',0
Config_DecrEffLab3:	DC.B	'Scroll',0
Config_DecrEffLab4:	DC.B	'« None »',0
Config_SaveText:	DC.B	'Save',0
Config_UseText:		DC.B	'Use',0
Config_CancelText:	DC.B	'Cancel',0
Config_QuitText:	DC.B	'Quit',0
Config_GetText:		DC.B	'Get',0
Config_AboutText:	DC.B	'About',0
Config_AslPTagsDirText:	dc.b	'Ram Disk:',0
InterText:		DC.B	'Interesting !',0
About_IText1:		DC.B	'By BURNAND Patrick',0
About_IText2:		DC.B	'A Program to Power(De)Pack',0
About_IText3:		DC.B	'for the Great WB 2.04',0
About_IText4:		DC.B	'Please read the doc !',0
About_IText5:		DC.B	'Enjoy the Space Music !',0
SaveEnvConfigErr_EasyT:	dc.b	" Cannot save",10
			dc.b	"Configuration",10
			dc.b	"   to Env:",0
SaveEnvarcConfigErr_EasyT:dc.b	" Cannot save",10
			dc.b	'Configuration',10
			dc.b	' to  Envarc:',0
NF_LockErr_EasyT:	dc.b	"Can't Lock() file.",0
NF_ExamineErr_EasyT:	dc.b	"Can't Examine() file.",0
OpenReadErr_EasyT:	dc.b	"Can't Open()",10
			dc.b	"source  file",0
OpenWriteErr_EasyT:	dc.b	"Can't Open()",10
			dc.b	" dest file.",0
DC_EmptyErr_EasyT:
NF_ReadErr_EasyT:	dc.b	" File is empty or",10
			dc.b	"less than 4 bytes.",10
			dc.b	' Not  Crunchable.',0
DNC_ReadErr_EasyT:	dc.b	"Error while Reading",10
			dc.b	"file. Can't crunch.",0
DC_ReadErr_EasyT:	dc.b	" Error while Reading",10
			dc.b	"file. Can't decrunch.",0
DNC_NoMemErr_EasyT:	dc.b	"Can't  AllocMem()",10
			dc.b	"to  crunch  File.",0
DC_NoMemErr_EasyT:	dc.b	"Can't  AllocMem()",10
			dc.b	"to decrunch File.",0
DC_UnknownPPErr_EasyT:	dc.b	"  Unknown Powerpacker",10
			dc.b	"Format. Can't decrunch.",0
DC_CryptErr_EasyT:	dc.b	" File is Crypted.  Use",10
			dc.b	"Powerpacker to decrunch",0
DC_PassErr_EasyT:	dc.b	"Wrong PassWord.",10
			dc.b	"Can't decrunch.",0
WriteErr_EasyT:		dc.b	"  Write() Error.  Can't",10
			dc.b	"save.  Dest File deleted.",0
Finished_EasyT:		dc.b	"Work finished.",0
Def_EasyStruct_GadText:	dc.b	'Ok',0
NoMemory_ErrT:		dc.b	"			AppPP  Error Report",10
			dc.b	"			¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯",10
			dc.b	10
			dc.b	"I can't Work because there is probably not enough Memory.",10
			dc.b	"I've tried to quit properly.    Sorry...",10,0
Working_WaitingT:	DC.B	'Waiting',0
Working_ScanningT:	dc.b	'Scanning ',0
Working_LoadingT:	dc.b	"Loading ",0
Working_CrunchingT:	dc.b	'Crunching ',0
Working_DC_LoadDecrT:	dc.b	"Loading & Decrunching",0
Working_SavingT:	dc.b	'Saving',0

WBName:			dc.b	'Workbench',0
TopazName:		dc.b	'topaz.font',0

Working_DirErrT:	dc.b	"Skipping directory ...",0
Working_SkipT:		dc.b	'** Skipping File.',0
Working_StopT:		dc.b	'** Aborting All !',0
Working_NotCrunchedErrT:dc.b	"File is not Crunched.",0
Working_CrunchedErrT:	dc.b	"File is already Crunched.",0
Working_DNC_OverFlowT:	dc.b	"Buffer Overflow",10,0
Working_DNC_AbortedT:	dc.b	"Crunching Aborted.",0
FileName_StrLength:	dc.b	0
UserResponse:		dc.b	0
Working_CrunchUserResponse:dc.b	0
Working_UserResponse:	dc.b	0
Config_UserResponse:	dc.b	0
About_UserResponse:	dc.b	0
GUI_:			dc.b	0
ComputeFont_Lock:	dc.b	0
ReplyMessage_Lock:	dc.b	0

Even

WorkingGTypes:
		DC.W	BUTTON_KIND
		DC.W	BUTTON_KIND
		DC.W	BUTTON_KIND
		DC.W	BUTTON_KIND
		DC.W	BUTTON_KIND
		DC.W	TEXT_KIND
		DC.W	TEXT_KIND
		DC.W	NUMBER_KIND
		DC.W	NUMBER_KIND

ConfigGTypes:	DC.W	TEXT_KIND
		DC.W	CHECKBOX_KIND
		DC.W	CYCLE_KIND
		DC.W	CYCLE_KIND
		DC.W	CYCLE_KIND
		DC.W	BUTTON_KIND
		DC.W	BUTTON_KIND
		DC.W	BUTTON_KIND
		DC.W	BUTTON_KIND
		DC.W	BUTTON_KIND
		DC.W	BUTTON_KIND

AboutGTypes:	DC.W	BUTTON_KIND

WorkingNGads:
		DC.W	12,9,109,19
		DC.L	Working_CrunchText,0
		DC.W	GD_Working_Crunch
		DC.L	PLACETEXT_IN,0,0
		DC.W	124,9,113,19
		DC.L	Working_DecrunchText,0
		DC.W	GD_Working_Decrunch
		DC.L	PLACETEXT_IN,0,0
		DC.W	240,9,109,19
		DC.L	Working_NothingText,0
		DC.W	GD_Working_Nothing
		DC.L	PLACETEXT_IN,0,0
		DC.W	20,39,157,21
		DC.L	Working_SkipText,0
		DC.W	GD_Working_Skip
		DC.L	PLACETEXT_IN,0,0
		DC.W	184,39,157,21
		DC.L	Working_StopText,0
		DC.W	GD_Working_Stop
		DC.L	PLACETEXT_IN,0,0
		DC.W	80,93,261,21
		DC.L	Working_StatusText,0
		DC.W	GD_Working_Status
		DC.L	PLACETEXT_LEFT,0,0
		DC.W	80,67,261,21
		DC.L	Working_NameText,0
		DC.W	GD_Working_Name
		DC.L	PLACETEXT_LEFT,0,0
		DC.W	80,119,97,21
		DC.L	Working_LengthText,0
		DC.W	GD_Working_Length
		DC.L	PLACETEXT_LEFT,0,0
		DC.W	244,119,97,21
		DC.L	Working_DestText,0
		DC.W	GD_Working_Dest
		DC.L	PLACETEXT_LEFT,0,0


ConfigNGads:	DC.W	116,33,173,19
		DC.L	Config_AltPathText,0
		DC.W	GD_Config_AltPath		; Text
		DC.L	PLACETEXT_LEFT,0,0

		DC.W	119,11,26,11
		DC.L	Config_UseAltPathText,0
		DC.W	GD_Config_UseAltPath		; CheckBox
		DC.L	PLACETEXT_LEFT!NG_HIGHLABEL,0,0

		DC.W	116,65,165,17
		DC.L	Config_EffText,0
		DC.W	GD_Config_Eff			; Efficiency
		DC.L	PLACETEXT_LEFT,0,0

		DC.W	116,89,165,17
		DC.L	Config_BufText,0
		DC.W	GD_Config_Buf			; Buffer
		DC.L	PLACETEXT_LEFT,0,0

		DC.W	116,113,165,17
		DC.L	Config_DecrEffText,0
		DC.W	GD_Config_DecrEff		; Effect
		DC.L	PLACETEXT_LEFT,0,0

		DC.W	4,145,69,17
		DC.L	Config_SaveText,0
		DC.W	GD_Config_Save			; Save
		DC.L	PLACETEXT_IN,0,0

		DC.W	76,145,69,17
		DC.L	Config_UseText,0
		DC.W	GD_Config_Use			; Use
		DC.L	PLACETEXT_IN,0,0

		DC.W	148,145,69,17
		DC.L	Config_CancelText,0
		DC.W	GD_Config_Cancel		; Cancel
		DC.L	PLACETEXT_IN,0,0

		DC.W	220,145,69,17
		DC.L	Config_QuitText,0
		DC.W	GD_Config_Quit			; Quit
		DC.L	PLACETEXT_IN,0,0

		DC.W	156,9,65,17
		DC.L	Config_GetText,0
		DC.W	GD_Config_Get			; Get
		DC.L	PLACETEXT_IN,0,0

		DC.W	224,9,65,17
		DC.L	Config_AboutText,0
		DC.W	GD_Config_About			; About
		DC.L	PLACETEXT_IN,0,0

AboutNGads:	DC.W	85,167,181,23
		DC.L	InterText,0
		DC.W	GD_Inter
		DC.L	PLACETEXT_IN,0,0

PubScreenName:		dc.l	WBName


WorkingWindowTags:
	WorkingL:
		DC.L	WA_Left,0
	WorkingT:
		DC.L	WA_Top,0
	WorkingW:
		DC.L	WA_Width,0
	WorkingH:
		DC.L	WA_Height,0
		DC.L	WA_IDCMP,BUTTONIDCMP!TEXTIDCMP!IDCMP_REFRESHWINDOW
		DC.L	WA_Flags,WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_SMART_REFRESH
	WorkingWG:
		DC.L	WA_Gadgets,0
		DC.L	WA_Title,WorkingWTitle
		DC.L	WA_AutoAdjust,1
		DC.L	TAG_DONE

ConfigWindowTags:
	ConfigL:
		DC.L	WA_Left,0
	ConfigT:
		DC.L	WA_Top,0
	ConfigW:
		DC.L	WA_Width,0
	ConfigH:
		DC.L	WA_Height,0
		DC.L	WA_IDCMP,CHECKBOXIDCMP!CYCLEIDCMP!BUTTONIDCMP!IDCMP_GADGETDOWN!IDCMP_REFRESHWINDOW
		DC.L	WA_Flags,WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_SMART_REFRESH!WFLG_ACTIVATE
	ConfigWG:
		DC.L	WA_Gadgets,0
		DC.L	WA_Title,ConfigWTitle
		DC.L	WA_AutoAdjust,1
		DC.L	TAG_DONE

AboutWindowTags:
	AboutL:
		DC.L	WA_Left,0
	AboutT:
		DC.L	WA_Top,0
	AboutW:
		DC.L	WA_Width,0
	AboutH:
		DC.L	WA_Height,0
		DC.L	WA_IDCMP,BUTTONIDCMP!IDCMP_REFRESHWINDOW
		DC.L	WA_Flags,WFLG_DRAGBAR!WFLG_DEPTHGADGET!WFLG_SMART_REFRESH!WFLG_ACTIVATE
	AboutWG:
		DC.L	WA_Gadgets,0
		DC.L	WA_Title,AboutWTitle
		DC.L	WA_AutoAdjust,1
		DC.L	TAG_DONE

WorkingGTags:
		DC.L	TAG_DONE		; Crunch
		DC.L	TAG_DONE		; Decrunch
		DC.L	TAG_DONE		; Do Nothing
		DC.L	GA_Disabled,1
		DC.L	TAG_DONE		; Skip File
		DC.L	GA_Disabled,1
		DC.L	TAG_DONE		; Stop All !
		DC.L	GTTX_Text,Working_WaitingT
		DC.L	GTTX_Border,1
		DC.L	TAG_DONE		; Status
		DC.L	GTTX_Border,1
		DC.L	TAG_DONE		; Name
		DC.L	GTNM_Number,0
		DC.L	GTNM_Border,1
		DC.L	TAG_DONE		; Source
		DC.L	GTNM_Number,0
		DC.L	GTNM_Border,1
		DC.L	TAG_DONE		; Dest

ConfigGTags:	DC.L	GTTX_Text
	CGT_TEXT:			; APTR sur le Text
		dc.l	0
		DC.L	GTTX_CopyText,1
		DC.L	GTTX_Border,1
		DC.L	TAG_DONE
		DC.L	GTCB_Checked
		dc.b	0,0,0
	CGT_Check:			; Etat du CHECKBOX:  1 = Checked
		dc.b	1
		DC.L	TAG_DONE
		DC.L	GTCY_Labels,Config_EffLabels
		DC.L	GTCY_Active
		dc.b	0,0,0
	CGT_Efficiency:			; Etat d' Efficiency:  0, 1, 2, 3, 4 ; Fast, Mediocre, Good, Very Good, Best
		dc.b	4
		DC.L	TAG_DONE
		DC.L	GTCY_Labels,Config_BufLabels
		DC.L	GTCY_Active
		dc.b	0,0,0
	CGT_Buffer:			; Etat de Decrunch:  0, 1, 2 ; Small. Medium. Large 
		dc.b	2
		DC.L	TAG_DONE
		DC.L	GTCY_Labels,Config_DecrEffLabels
		DC.L	GTCY_Active
		dc.b	0,0,0
	CGT_Effect:			; Etat d' Effect: 0, 1, 2, 3, 4 ; Color 0, Color 1, Pointer, Scroll, « None »
		dc.b	4
		DC.L	TAG_DONE
		DC.L	TAG_DONE
		DC.L	TAG_DONE
		DC.L	TAG_DONE
		DC.L	TAG_DONE
		DC.L	TAG_DONE
		DC.L	TAG_DONE

AboutGTags:	DC.L	TAG_DONE

GAM_WorkingGad0Attrs:
GAM_WorkingGad1Attrs:
GAM_WorkingGad2Attrs:
		dc.l	Ga_Disabled,1
		dc.l	Tag_Done
GAM_WorkingGad3Attrs:
GAM_WorkingGad4Attrs:
		dc.l	Ga_Disabled,0
		dc.l	Tag_Done

WriteTextTags:
		dc.l	GTTX_Text
	WTT_Text:
		dc.l	0
		dc.l	Tag_Done

WriteNumberTags:
		dc.l	GTNM_Number
	WNT_Number:
		dc.l	0
		dc.l	Tag_Done

Config_AslPTags:
		dc.l	ASL_Hail,Config_AslPTagsWndText
		dc.l	ASL_Dir,Config_AslPTagsDirText
		dc.l	ASL_ExtFlags1,1
		dc.l	Tag_Done

Def_EasyStruct:
		dc.l	20			;  0  SizeOf
		dc.l	0			;  4  Flags
		dc.l	Def_EasyStruct_Title	;  8  WindowTitle (APTR)
		dc.l	0			; 12  Adresse du texte du requester
		dc.l	Def_EasyStruct_GadText	; 16 Adresse du texte des gadgets

NormalBevelbox:	DC.L	GT_VisualInfo,0,TAG_DONE
InverseBevelBox:DC.L	GT_VisualInfo,0,GTBB_Recessed,1,TAG_DONE

AboutText0:	DC.B	2,0
		DC.B	0
		DC.B	0
		DC.W	175,25
		DC.L	0
		DC.L	About_IText0
		DC.L	0

AboutText1:	DC.B	2,0
		DC.B	0
		DC.B	0
		DC.W	175,41
		DC.L	0
		DC.L	About_IText1
		DC.L	0

AboutText2:	DC.B	2,0
		DC.B	0
		DC.B	0
		DC.W	175,70
		DC.L	0
		DC.L	About_IText2
		DC.L	0

AboutText3:	DC.B	2,0
		DC.B	0
		DC.B	0
		DC.W	175,85
		DC.L	0
		DC.L	About_IText3
		DC.L	0

AboutText4:	DC.B	2,0
		DC.B	0
		DC.B	0
		DC.W	175,113
		DC.L	0
		DC.L	About_IText4
		DC.L	0

AboutText5:	DC.B	2,0
		DC.B	0
		DC.B	0
		DC.W	175,137
		DC.L	0
		DC.L	About_IText5
		DC.L	0

Config_EffLabels:
		DC.L	Config_EffLab0
		DC.L	Config_EffLab1
		DC.L	Config_EffLab2
		DC.L	Config_EffLab3
		DC.L	Config_EffLab4
		DC.L	0

Config_BufLabels:
		DC.L	Config_BufLab0
		DC.L	Config_BufLab1
		DC.L	Config_BufLab2
		DC.L	0

Config_DecrEffLabels:
		DC.L	Config_DecrEffLab0
		DC.L	Config_DecrEffLab1
		DC.L	Config_DecrEffLab2
		DC.L	Config_DecrEffLab3
		DC.L	Config_DecrEffLab4
		DC.L	0

BufNewGad:		dc.w	0,0,0,0
			dc.l	0,0
			dc.w	0
			dc.l	0,0,0
BufIText:		dc.b	0,0,0,0
			dc.w	0,0
			dc.l	0,0,0
Attr:			dc.l	0
			dc.w	0
			dc.b	0,0
Attr2:			dc.l	0
			dc.w	0
			dc.b	0,0
Left:			dc.w	0
Top:			dc.w	0
Width:			dc.w	0
Height:			dc.w	0
BevelLeft:		dc.w	0
BevelTop:		dc.w	0
BevelWidth:		dc.w	0
BevelHeight:		dc.w	0
FontX:			dc.w	0
FontX2:			dc.w	0
FontY:			dc.w	0
FontY2:			dc.w	0
OffX:			dc.w	0
OffY:			dc.w	0
Code:			dc.w	0
Config_Code:		dc.w	0
					; Si il y a simultanément 2 interfaces,
WorkingGList:				; il faut prévoir un tampon par interface
ConfigGList:		dc.l	0	; Sinon, le même tampon est utilisé à
AboutGlist:		dc.l	0	; chaque fois
WorkingGadgets:				; Même remarque que si dessus
ConfigGadgets:		blk.l	GadgetMaxNumber,0
AboutGadgets:		blk.l	About_CNT,0
TD:			dc.l	TAG_DONE
Stack:			dc.l	0
Bevelbox_Taglist:	dc.l	0
IconBase:		dc.l	0
WorkbenchBase:		dc.l	0
DosBase:		dc.l	0
GadtoolsBase:		dc.l	0
IntuitionBase:		dc.l	0
ppBase:			dc.l	0
AslBase:		dc.l	0
DiskObject:		dc.l	0
AppIcon:		dc.l	0
AppMsgPort:		dc.l	0
Msg:			dc.l	0
WbMsg:			dc.l	0
FileCount:		dc.l	0
FileNumber:		dc.l	0
CrunchInfo:		dc.l	0
DirLock:		dc.l	0
FileLock:		dc.l	0
FileName:		dc.l	0
FileNameBuffer:		dc.l	0
OSF_FileNameBuffer:	dc.l	0
ConfigBuffer:		dc.l	0
ConfigBuffer0:		dc.l	0
ConfigFileName0_FH:	dc.l	0
ConfigFileName1_FH:	dc.l	0
DosObject:		dc.l	0
FileLength:		dc.l	0
SBuffer:		dc.l	0
FileHandle:		dc.l	0
FileBuffer:		dc.l	0
ppLength:		dc.l	0
Buffer_:		dc.l	0
Len_:			dc.l	0
Message:		dc.l	0
Gt_IMsg:		dc.l	0
Scr:			dc.l	0
VisualInfo:		dc.l	0
Wnd:			dc.l	0
WorkingWnd:
ConfigWnd:		dc.l	0
AboutWnd:		dc.l	0
Font:			dc.l	0
Font2:			dc.l	0
GetImage:		dc.l	0
GetClass:		dc.l	0
AslRequestStruct:	dc.l	0



* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*  Fin du source.   * * * * * * * * * * * * * * * * * * * * * * * * * * *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

