home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d5xx
/
d579
/
cass.lha
/
Cass
/
Cass_NTSC.p
< prev
next >
Wrap
Text File
|
1991-12-22
|
25KB
|
731 lines
program CassetteCoverPrinter_NTSC;
{ This program prints out cassette labels either as ASCII-Files or as source
for use with LaTeX.
NTSC Version 1.1
©1991 by Jörn Clausen }
{ Get the right stuff. }
uses Intuition,Graphics;
from Windows uses ArpFilerequester;
{ A few useful things. }
const spaces=" ";
line="+-------------------------------------------------------------------+";
fileIDstandard="CASSDATA"
{ This one needed for all the borders. }
type IntArr10=array [1..10] of integer;
{ Loads of definitions. }
var MyScreen : ^Screen;
MyWindow : ^Window;
Msg : ^IntuiMessage;
Running,success : boolean;
ProjMen,PrinMen : Menu;
Clear,Load,Save,About,Quit,ASCII,LaTeX,
ToFile,ToPrinter : MenuItem;
SongGad : array [1..20] of Gadget;
SongTexInfo : array [1..20] of StringInfo;
SongTex,UndoSongTex : array [1..20] of String[32];
OtherSideTeX : array [1..2,1..20] of String[32];
TitleGad : array [1..4] of Gadget;
TitleTexInfo : array [1..4] of StringInfo;
TitleTex,UndoTitleTex : array [1..4] of String[32];
NRGad,SourceGad,DateGad : array [1..2] of Gadget;
DateTexInfo : array [1..2] of StringInfo;
DateTex,UndoDateTex : array [1..2] of String[11];
LengthGad,PosGad,SwitchGad : Gadget;
TextBord,NRBord,SourceBord,DateBord,
LengthBord,PosBord,SwitchBord : Border;
TextBordXY,NRBordXY,SourceBordXY,
DateBordXY,LengthBordXY,PosBordXY,
SwitchBordXY : IntArr10;
NRGadText,SourceGadText,DateIText,
LengthGadText,PosGadText,SwitchGadText,
ClearIText,LoadIText,SaveIText,AboutIText,
QuitIText,ASCIIIText,LaTeXIText,
ToFileIText,ToPrinterIText : IntuiText;
Side,Length,Pos : integer;
NR,Source : array [1..2] of integer;
NRText : array [1..5] of String[9];
LengthText : array [1..5] of String[4];
PosText : array [1..3] of String[7];
SourceText : array [1..9] of String[9];
Picked,PMenu,PMenuItem,PMenuSubItem : integer;
ClickGad : ^Gadget;
Output : text;
{ This looks rather ugly, but how can I convert integers to strings without
causing too much problems? }
procedure PrintNumbers;
var start,i,j : integer;
NumIText : IntuiText;
Number : String;
begin
for j:=1 to 10 do
begin
start:=Side*10;
i:=j+start;
if i<10 then
Number:=Concat(' ',chr(i+48));
if (i>9) and (i<20) then
Number:=Concat('1',chr(i+38));
if (i>19) and (i<30) then
Number:=Concat('2',chr(i+28));
if i=30 then Number:='30';
NumIText:=IntuiText(1,0,JAM2,0,0,nil,Number,nil);
PrintIText(MyWindow^.RPort,^NumIText,310,11*j+3);
end;
end;
procedure PrintNR(NRSide:integer);
var NRIText : IntuiText;
begin
NRIText:=IntuiText(1,0,JAM2,0,0,nil,NRText[NR[NRSide]],nil);
PrintIText(MyWindow^.RPort,^NRIText,340*(NRSide-1)+62,156);
end;
procedure PrintSource(SourceSide:integer);
var SourceIText : IntuiText;
begin
SourceIText:=IntuiText(1,0,JAM2,0,0,nil,SourceText[Source[SourceSide]],nil);
PrintIText(MyWindow^.RPort,^SourceIText,340*(SourceSide-1)+217,156);
end;
procedure PrintLength;
var LengthIText : IntuiText;
begin
LengthIText:=IntuiText(1,0,JAM2,0,0,nil,LengthText[Length],nil);
PrintIText(MyWindow^.RPort,^LengthIText,164,187);
end;
procedure PrintPos;
var PosIText : IntuiText;
begin
PosIText:=IntuiText(1,0,JAM2,0,0,nil,PosText[Pos],nil);
PrintIText(MyWindow^.RPort,^PosIText,333,187);
end;
{ Define tape sorts, lengths, noise reductions etc. Adjust them according to
your special needs. }
procedure DoVariables;
begin
NR[1]:=4; NR[2]:=4;
NRText[1]:='None '; NRText[2]:='Dolby B '; NRText[3]:='Db B MPX';
NRText[4]:='Dolby C '; NRText[5]:='Db C MPX';
Source[1]:=1; Source[2]:=1;
SourceText[1]:='CD '; SourceText[2]:='Phono ';
SourceText[3]:='Tuner '; SourceText[4]:='DAT ';
SourceText[5]:='Tape '; SourceText[6]:='Video ';
SourceText[7]:='TV '; SourceText[8]:='Computer';
SourceText[9]:=' ';
Length:=4;
LengthText[1]:='30 '; LengthText[2]:='45 '; LengthText[3]:='60 ';
LengthText[4]:='90 '; LengthText[5]:='120';
Pos:=2;
PosText[1]:='Normal'; PosText[2]:='Chrome'; PosText[3]:='Metal ';
Side:=0;
end;
{ Open Screen and Window. OK, OK, I know, this should be done more carefully,
but this is the way described in the handbook. I guess, that Open_Screen and
Open_Window, which are special Kick-Pascal functions, check if they return a
screen or a window. For this reason I don't check it again.}
procedure DoScreen;
begin
MyScreen:=Open_Screen(0,0,640,200,2,0,1,HIRES,'Cassette Cover Printer V1.1');
MyWindow:=Open_Window(0,0,640,200,1,GADGETUP+GADGETDOWN+MENUPICK+_CLOSEWINDOW,WINDOWDEPTH+WINDOWCLOSE+ACTIVATE,'Cassette Cover Printer V1.1',MyScreen,320,640,320,640);
end;
{ Define the pull-down-menus. }
procedure DoMenu;
begin
ProjMen:=Menu(^PrinMen,10,0,90,10,MENUENABLED,'Project',^Load,0,0,0,0);
Load:=MenuItem(^Save,0,0,90,10,ITEMTEXT+ITEMENABLED+HIGHCOMP+COMMSEQ,0,^LoadIText,nil,'O',nil,0);
LoadIText:=IntuiText(0,1,JAM2,1,1,nil,'Open',nil);
Save:=MenuItem(^Clear,0,10,90,10,ITEMTEXT+ITEMENABLED+HIGHCOMP+COMMSEQ,0,^SaveIText,nil,'S',nil,0);
SaveIText:=IntuiText(0,1,JAM2,1,1,nil,'Save',nil);
Clear:=MenuItem(^About,0,20,90,10,ITEMTEXT+ITEMENABLED+HIGHCOMP+COMMSEQ,0,^ClearIText,nil,'C',nil,0);
ClearIText:=IntuiText(0,1,JAM2,1,1,nil,'Clear',nil);
About:=MenuItem(^Quit,0,30,90,10,ITEMTEXT+ITEMENABLED+HIGHCOMP,0,^AboutIText,nil,chr(0),nil,0);
AboutIText:=IntuiText(0,1,JAM2,1,1,nil,'About',nil);
Quit:=MenuItem(nil,0,40,90,10,ITEMTEXT+ITEMENABLED+HIGHCOMP,0,^QuitIText,nil,chr(0),nil,0);
QuitIText:=IntuiText(0,1,JAM2,1,1,nil,'Quit',nil);
PrinMen:=Menu(nil,120,0,90,10,MENUENABLED,'Print',^ASCII,0,0,0,0);
ASCII:=MenuItem(^LaTeX,0,0,90,10,ITEMTEXT+ITEMENABLED+HIGHNONE,0,^ASCIIIText,nil,chr(0),^ToPrinter,0);
ASCIIIText:=IntuiText(0,1,JAM2,1,1,nil,'ASCII',nil);
ToPrinter:=MenuItem(^ToFile,90,0,130,10,ITEMTEXT+ITEMENABLED+HIGHCOMP+COMMSEQ,0,^ToPrinterIText,nil,'P',nil,0);
ToPrinterIText:=IntuiText(0,1,JAM2,1,1,nil,'to Printer',nil);
ToFile:=MenuItem(nil,90,10,130,10,ITEMTEXT+ITEMENABLED+HIGHCOMP+COMMSEQ,0,^ToFileIText,nil,'F',nil,0);
ToFileIText:=IntuiText(0,1,JAM2,1,1,nil,'to File',nil);
LaTeX:=MenuItem(nil,0,10,90,10,ITEMTEXT+ITEMENABLED+HIGHCOMP+COMMSEQ,0,^LaTeXIText,nil,'L',nil,0);
LaTeXIText:=IntuiText(0,1,JAM2,1,1,nil,'LaTeX',nil);
SetMenuStrip(MyWindow,^ProjMen);
end;
{ And define all the gadgets. }
procedure DoGadgets;
var i : integer;
begin
TextBord:=Border(0,0,1,0,JAM1,5,^TextBordXY,nil);
TextBordXY:=IntArr10(-3,-2,258,-2,258,9,-3,9,-3,-2);
for i:=1 to 10 do
begin
SongGad[i]:=Gadget(nil,22,11*i+3,255,8,GADGHCOMP,GADGIMMEDIATE+RELVERIFY,STRGADGET,^TextBord,nil,nil,0,^SongTexInfo[i],i,0);
SongTexInfo[i]:=StringInfo(^SongTex[i],^UndoSongTex[i],0,32,0,0,0,0,0,0,nil,0,nil);
SongTex[i]:=''; UndoSongTex[i]:=''; OtherSideTex[1,i]:=''; OtherSideTex[2,i]:='';
AddGadget(MyWindow,^SongGad[i],nil);
SongGad[i+10]:=Gadget(nil,362,11*i+3,255,8,GADGHCOMP,GADGIMMEDIATE+RELVERIFY,STRGADGET,^TextBord,nil,nil,0,^SongTexInfo[i+10],i+10,0);
SongTexInfo[i+10]:=StringInfo(^SongTex[i+10],^UndoSongTex[i+10],0,32,0,0,0,0,0,0,nil,0,nil);
SongTex[i+10]:=''; UndoSongTex[i+10]:=''; OtherSideTex[1,i+10]:=''; OtherSideTeX[2,i+10]:='';
AddGadget(MyWindow,^SongGad[i+10],nil);
end;
for i:=1 to 2 do
begin
TitleGad[i]:=Gadget(nil,22,11*i+118,255,8,GADGHCOMP,GADGIMMEDIATE+RELVERIFY,STRGADGET,^TextBord,nil,nil,0,^TitleTexInfo[i],i+20,0);
TitleTexInfo[i]:=StringInfo(^TitleTex[i],UndoTitleTex[i],0,32,0,0,0,0,0,0,nil,0,nil);
TitleTex[i]:=''; UndoTitleTex[i]:='';
AddGadget(MyWindow,^TitleGad[i],nil);
TitleGad[i+2]:=Gadget(nil,362,11*i+118,255,8,GADGHCOMP,GADGIMMEDIATE+RELVERIFY,STRGADGET,^TextBord,nil,nil,0,^TitleTexInfo[i+2],i+22,0);
TitleTexInfo[i+2]:=StringInfo(^TitleTex[i+2],UndoTitleTex[i+2],0,32,0,0,0,0,0,0,nil,0,nil);
TitleTex[i+2]:=''; UndoTitleTex[i+2]:='';
AddGadget(MyWindow,^TitleGad[i+2],nil);
end;
NRBord:=Border(0,0,1,0,JAM1,5,^NRBordXY,nil);
NRBordXY:=IntArr10(-4,-2,23,-2,23,9,-4,9,-4,-2);
NRGadText:=IntuiText(1,0,JAM1,2,0,nil,'NR',nil);
for i:=1 to 2 do
begin
NRGad[i]:=Gadget(nil,340*(i-1)+23,156,20,8,GADGHBOX,RELVERIFY,BOOLGADGET,^NRBord,nil,^NRGadText,0,nil,24+i,0);
AddGadget(MyWindow,^NRGad[i],nil);
PrintNR(i);
end;
SourceBord:=Border(0,0,1,0,JAM1,5,^SourceBordXY,nil);
SourceBordXY:=IntArr10(-4,-2,53,-2,53,9,-4,9,-4,-2);
SourceGadText:=IntuiText(1,0,JAM1,1,0,nil,'Source',nil);
for i:=1 to 2 do
begin
SourceGad[i]:=Gadget(nil,340*(i-1)+148,156,50,8,GADGHBOX,RELVERIFY,BOOLGADGET,^SourceBord,nil,^SourceGadText,0,nil,26+i,0);
AddGadget(MyWindow,^SourceGad[i],nil);
PrintSource(i);
end;
DateBord:=Border(0,0,1,0,JAM1,5,^DateBordXY,nil);
DateBordXY:=IntArr10(-3,-2,90,-2,90,9,-3,9,-3,-2);
DateIText:=IntuiText(1,0,JAM1,0,0,nil,'Date',nil);
for i:=1 to 2 do
begin
DateGad[i]:=Gadget(nil,340*(i-1)+69,172,87,8,GADGHCOMP,GADGIMMEDIATE,STRGADGET,^DateBord,nil,nil,0,^DateTexInfo[i],28+i,0);
DateTexInfo[i]:=StringInfo(^DateTex[i],^UndoDateTex[i],0,11,0,0,0,0,0,0,nil,0,nil);
DateTex[i]:=''; UndoDateTex[i]:='';
AddGadget(MyWindow,^DateGad[i],nil);
PrintIText(MyWindow^.RPort,^DateIText,340*(i-1)+20,172);
end;
LengthBord:=Border(0,0,1,0,JAM1,5,^LengthBordXY,nil);
LengthBordXY:=IntArr10(-4,-2,21,-2,21,9,-4,9,-4,-2);
LengthGadText:=IntuiText(1,0,JAM1,5,0,nil,'C',nil);
LengthGad:=Gadget(nil,128,187,18,8,GADGHBOX,RELVERIFY,BOOLGADGET,^LengthBord,nil,^LengthGadText,0,nil,31,0);
AddGadget(MyWindow,^LengthGad,nil);
PrintLength;
PosBord:=Border(0,0,1,0,JAM1,5,^PosBordXY,nil);
PosBordXY:=IntArr10(-4,-2,70,-2,70,9,-4,9,-4,-2);
PosGadText:=IntuiText(1,0,JAM1,2,0,nil,'Position',nil);
PosGad:=Gadget(nil,247,187,67,8,GADGHBOX,RELVERIFY,BOOLGADGET,^PosBord,nil,^PosGadText,0,nil,32,0);
AddGadget(MyWindow,^PosGad,nil);
PrintPos;
SwitchBord:=Border(0,0,1,0,JAM1,5,^SwitchBordXY,nil);
SwitchBordXY:=IntArr10(-4,-2,101,-2,101,9,-4,9,-4,-2);
SwitchGadText:=IntuiText(1,0,JAM1,1,0,nil,'Switch Sides',nil);
SwitchGad:=Gadget(nil,430,187,98,8,GADGHBOX,RELVERIFY,BOOLGADGET,^SwitchBord,nil,^SwitchGadText,0,nil,33,0);
AddGadget(MyWindow,^SwitchGad,nil);
PrintNumbers;
RefreshGadgets(MyWindow^.FirstGadget,MyWindow,nil);
end;
{ Switch to next noise redurction, source, etc. }
procedure NextNR(NRSide:integer);
begin
if NR[NRSide]=5 then
NR[NRSide]:=1
else
NR[NRSide]:=Succ(NR[NRSide]);
PrintNR(NRSide);
end;
procedure NextSource(SourceSide:integer);
begin
if Source[SourceSide]=9 then
Source[SourceSide]:=1
else
Source[SourceSide]:=Succ(Source[SourceSide]);
PrintSource(SourceSide);
end;
procedure NextLength;
begin
if Length=5 then
Length:=1
else
Length:=Succ(Length);
PrintLength;
end;
procedure NextPos;
begin
if Pos=3 then
Pos:=1
else
Pos:=Succ(Pos);
PrintPos;
end;
procedure SwitchSides;
var i : integer;
dummy : String[32];
begin
for i:=1 to 20 do
case Side of
0,2 : begin
dummy:=SongTex[i];
SongTex[i]:=OtherSideTex[1,i];
OtherSideTex[1,i]:=dummy;
end;
1 : begin
dummy:=SongTex[i];
SongTex[i]:=OtherSideTex[2,i];
OtherSideTex[2,i]:=dummy;
end;
end;
if Side=2 then
for i:=1 to 20 do
begin
dummy:=OtherSideTex[1,i];
OtherSideTex[1,i]:=OtherSideTex[2,i];
OtherSideTex[2,i]:=dummy;
end;
RefreshGadgets(MyWindow^.FirstGadget,MyWindow,nil);
if Side=2 then
Side:=0
else
Side:=Side+1;
PrintNumbers;
end;
{ Load data-file. }
procedure LoadData;
var i,j : integer;
filename,fileID : string;
BodyIText,PosIText,NegIText : IntuiText;
loadfile,answer : boolean;
begin
loadfile:=false;
while not loadfile do
begin
filename:=FileReq(MyWindow,'Load Data');
if filename='' then exit;
Reset(Output,filename);
readln(Output,fileID);
if fileID=fileIDstandard then loadfile:=true else
begin
BodyIText:=IntuiText(0,1,JAM2,30,5,nil,'This is no Data-File',nil);
PosIText:=IntuiText(0,1,JAM2,6,3,nil,'Retry',nil);
NegIText:=IntuiText(0,1,JAM2,6,3,nil,'Cancel',nil);
answer:=AutoRequest(MyWindow,^BodyIText,^PosIText,^NegIText,RELVERIFY,RELVERIFY,250,60);
if answer=false then exit;
end;
end;
if Side=1 then SwitchSides;
if Side=2 then SwitchSides;
for i:=1 to 4 do
readln(Output,TitleTex[i]);
for i:=1 to 10 do
readln(Output,SongTex[i]);
for j:=1 to 2 do
for i:=1 to 10 do
readln(Output,OtherSideTex[j,i]);
for i:=11 to 20 do
readln(Output,SongTex[i]);
for j:=1 to 2 do
for i:=11 to 20 do
readln(Output,OtherSideTex[j,i]);
for i:=1 to 2 do
begin
readln(Output,NR[i]);
readln(Output,Source[i]);
readln(Output,DateTex[i]);
end;
readln(Output,Length);
readln(Output,Pos);
Close(Output);
RefreshGadgets(MyWindow^.FirstGadget,MyWindow,nil);
for i:=1 to 2 do
begin
PrintNR(i);
PrintSource(i);
end;
PrintLength;
PrintPos;
end;
{ Save data-file. }
procedure SaveData;
var i,j : integer;
filename : string;
begin
filename:=FileReq(MyWindow,'Save Data');
if filename<>'' then
begin
if Side=1 then SwitchSides;
if Side=2 then SwitchSides;
Rewrite(Output,filename);
writeln(Output,fileIDstandard);
for i:=1 to 4 do
writeln(Output,TitleTex[i]);
for i:=1 to 10 do
writeln(Output,SongTex[i]);
for j:=1 to 2 do
for i:=1 to 10 do
writeln(Output,OtherSideTex[j,i]);
for i:=11 to 20 do
writeln(Output,SongTex[i]);
for j:=1 to 2 do
for i:=11 to 20 do
writeln(Output,OtherSideTex[j,i]);
for i:=1 to 2 do
begin
writeln(Output,NR[i]);
writeln(Output,Source[i]);
writeln(Output,DateTex[i]);
end;
writeln(Output,Length);
writeln(Output,Pos);
Close(Output);
DisplayBeep(MyScreen);
end;
end;
{ Erase present contents of the gadgest. }
procedure ClearData;
var i : integer;
BodyIText,PosIText,NegIText : IntuiText;
answer : boolean;
begin
BodyIText:=IntuiText(0,1,JAM2,7,5,nil,'Data will be lost! Continue?',nil);
PosIText:=IntuiText(0,1,JAM2,6,3,nil,'Yes, Please',nil);
NegIText:=IntuiText(0,1,JAM2,6,3,nil,'Oh, No!',nil);
answer:=AutoRequest(MyWindow,^BodyIText,^PosIText,^NegIText,RELVERIFY,RELVERIFY,260,60);
if answer=false then exit;
for i:=1 to 20 do
begin
SongTex[i]:=''; UndoSongTex[i]:='';
OtherSideTex[1,i]:=''; OtherSideTex[2,i]:='';
end;
for i:=1 to 4 do
begin
TitleTex[i]:=''; UndoTitleTex[i]:='';
end;
DateTex[1]:=''; UndoDateTex[1]:='';
DateTex[2]:=''; UndoDateTex[2]:='';
DoVariables;
RefreshGList(MyWindow^.FirstGadget,MyWindow,nil,-1);
PrintNumbers;
PrintNR(1); PrintNR(2);
PrintSource(1); PrintSource(2);
PrintLength;
PrintPos;
end;
{ Output line to whatever will receive it, either PRT: or a file. }
procedure PrintLine(TexA,TexB:String;Middle:Char);
var PTexA,PTexB : string;
begin
PTexA:=TexA+Copy(spaces,1,31-StrLen(TexA));
PTexB:=TexB+Copy(spaces,1,31-StrLen(TexB));
writeln(Output,"| "+PTexA+" "+Middle+" "+PTexB+" |");
end;
{ Print the cover made out of ASCII-character. }
procedure OutputCover(filename:string);
var i : integer;
Middle : char;
pron,proff : string;
ExtPrint : boolean;
begin
pron:=chr(27)+"[4w"+chr(27)+"[2"+chr(34)+"z"+chr(27)+"(B";
proff:=chr(27)+"[0w"+chr(27)+"[1"+chr(34)+"z";
if Side=1 then SwitchSides;
if Side=2 then SwitchSides;
ExtPrint:=false;
for i:=6 to 10 do
if (OtherSideTex[1,i]<>'') or (OtherSideTex[1,i+10]<>'') then ExtPrint:=true;
for i:=1 to 20 do
if OtherSideTex[2,i]<>'' then ExtPrint:=true;
ReWrite(Output,filename);
write(Output,pron);
writeln(Output,line);
if ExtPrint then
begin
for i:=6 to 10 do
PrintLine(OtherSideTex[1,i],OtherSideTex[1,i+10],"|");
for i:=1 to 10 do
PrintLine(OtherSideTex[2,i],OtherSideTex[2,i+10],"|");
writeln(Output,line);
end;
Middle:="|"
for i:=1 to 10 do
PrintLine(SongTex[i],SongTex[i+10],Middle);
for i:=1 to 5
begin
if ExtPrint and (i=5) then Middle:="V";
PrintLine(OtherSideTex[1,i],OtherSideTex[1,i+10],Middle);
end;
writeln(Output,line);
PrintLine(TitleTex[1],TitleTex[2]," ");
PrintLine(TitleTex[3],TitleTex[4]," ");
writeln(Output,line);
PrintLine("NR: "+NRText[NR[1]]+" Source: "+SourceText[Source[1]],"NR: "+NRText[NR[2]]+" Source: "+SourceText[Source[2]],"|");
PrintLine("Date: "+DateTex[1],"Date: "+DateTex[2],"|");
writeln(Output,"|"+Copy(spaces,1,15)+"C"+LengthText[Length]+Copy(spaces,1,24)+"Position: "+PosText[Pos]+Copy(spaces,1,8)+"|");
writeln(Output,line);
writeln(Output,proff);
Close(Output);
DisplayBeep(MyScreen);
end;
{ Send cover to printer. }
procedure PrintCover;
begin
OutputCover('prt:');
end;
{ Send cover to file. }
procedure SaveCover;
var filename:string;
begin
filename:=FileReq(MyWindow,'Save Cover');
if filename<>'' then OutputCover(filename);
end;
{ Produce LaTeX-file. }
procedure SaveLaTeX;
var i : integer;
filename : string;
ExtPrint : boolean;
begin
filename:=FileReq(MyWindow,'Save LaTeX Source File');
if filename<>'' then
begin
ExtPrint:=false;
if Side=1 then SwitchSides;
if Side=2 then SwitchSides;
for i:=6 to 10 do
if (OtherSideTex[1,i]<>'') or (OtherSideTex[1,i+10]<>'') then ExtPrint:=true;
for i:=1 to 20 do
if OtherSideTex[2,i]<>'' then ExtPrint:=true;
Rewrite(Output,filename);
writeln(Output,'\documentstyle{article}');
writeln(Output,'\begin{document}');
writeln(Output,'\pagestyle{empty}');
writeln(Output,'\unitlength1mm');
writeln(Output);
if ExtPrint then
begin
writeln(Output,'\begin{picture}(102,161)(0,0)');
writeln(Output,' \put(0,0){\framebox(102,161){}}');
writeln(Output,' \put(51,29){\line(0,1){132}}');
writeln(Output,' \put(0,95){\line(1,0){102}}');
end
else
begin
writeln(Output,'\begin{picture}(102,95)(0,0)');
writeln(Output,' \put(0,0){\framebox(102,95){}}');
writeln(Output,' \put(51,29){\line(0,1){66}}');
end;
writeln(Output,' \put(0,16){\framebox(102,13){}}');
writeln(Output,' \put(0,6){\line(1,0){102}}');
writeln(Output,' \put(51,6){\line(0,1){10}}');
writeln(Output);
writeln(Output,' \put(0,1){\makebox(51,5){C'+LengthText[Length]+'}}');
writeln(Output,' \put(51,1){\makebox(51,5){Position: '+PosText[Pos]+'}}');
writeln(Output,' \put(1,6){\makebox(24,5)[l]{Date: '+DateTex[1]+'}}');
writeln(Output,' \put(52,6){\makebox(24,5)[l]{Date: '+DateTex[2]+'}}');
writeln(Output,' \put(1,11){\makebox(21,5)[l]{NR: '+NRText[NR[1]]+'}}');
writeln(Output,' \put(52,11){\makebox(21,5)[l]{NR: '+NRText[NR[2]]+'}}');
writeln(Output,' \put(26,8.5){\makebox(24,5)[r]{Src: '+SourceText[Source[1]]+'}}');
writeln(Output,' \put(77,8.5){\makebox(24,5)[r]{Src: '+SourceText[Source[2]]+'}}');
writeln(Output);
writeln(Output,' \put(1,22.5){\makebox(49,5.5)[l]{\large '+TitleTex[1]+'}}');
writeln(Output,' \put(52,22.5){\makebox(49,5.5)[l]{\large '+TitleTex[2]+'}}');
writeln(Output,' \put(1,17){\makebox(49,5.5)[l]{\large '+TitleTex[3]+'}}');
writeln(Output,' \put(52,17){\makebox(49,5.5)[l]{\large '+TitleTex[4]+'}}');
writeln(Output);
if ExtPrint then
begin
for i:=6 to 10 do
writeln(Output,' \put(1,',182.7-i*4.4,'){\makebox(49,4.1)[tl]{'+OtherSideTex[1,i]+'}}');
for i:=1 to 10 do
writeln(Output,' \put(1,',138.7-i*4.4,'){\makebox(49,4.1)[tl]{'+OtherSideTex[2,i]+'}}');
writeln(Output);
for i:=6 to 10 do
writeln(Output,' \put(52,',182.7-i*4.4,'){\makebox(49,4.1)[tl]{'+OtherSideTex[1,i+10]+'}}');
for i:=1 to 10 do
writeln(Output,' \put(52,',138.7-i*4.4,'){\makebox(49,4.1)[tl]{'+OtherSideTex[2,i+10]+'}}');
writeln(Output);
end;
for i:=1 to 10 do
writeln(Output,' \put(1,',94.7-i*4.4,'){\makebox(49,4.1)[tl]{'+SongTex[i]+'}}');
for i:=1 to 5 do
writeln(Output,' \put(1,',50.7-i*4.4,'){\makebox(49,4.1)[tl]{'+OtherSideTex[1,i]+'}}');
writeln(Output);
for i:=1 to 10 do
writeln(Output,' \put(52,',94.7-i*4.4,'){\makebox(49,4.1)[tl]{'+SongTex[i+10]+'}}');
for i:=1 to 5 do
writeln(Output,' \put(52,',50.7-i*4.4,'){\makebox(49,4.1)[tl]{'+OtherSideTex[1,i+10]+'}}');
writeln(Output);
writeln(Output,'\end{picture}');
writeln(Output);
writeln(Output,'\end{document}');
Close(Output);
DisplayBeep(MyScreen);
end;
end;
{ Ahem, well, in case anybody is interested... }
procedure Copyright;
var CopyWindow:^Window;
CopyMsg:^IntuiMessage;
line1,line2,line3:IntuiText;
begin
CopyWindow:=Open_Window(150,48,340,120,1,MOUSEBUTTONS,ACTIVATE,nil,MyScreen,300,160,300,160);
line1:=IntuiText(1,0,JAM2,0,0,nil,'Cassette Cover Printer V1.1',^line2);
line2:=IntuiText(1,0,JAM2,24,28,nil,'©1991 by Jörn Clausen',^line3);
line3:=IntuiText(1,0,JAM2,44,56,nil,'This is Freeware',nil);
PrintIText(CopyWindow^.RPort,^line1,62,28);
while CopyMsg^.Class<>MOUSEBUTTONS do
begin
CopyMsg:=Wait_Port(CopyWindow^.UserPort);
CopyMsg:=Get_Msg(CopyWindow^.UserPort);
end;
Close_Window(CopyWindow);
end;
{ Hope you have enjoyed the program. }
procedure QuitProg;
var BodyIText,PosIText,NegIText : IntuiText;
answer : boolean;
begin
BodyIText:=IntuiText(0,1,JAM2,72,5,nil,'Really Quit?',nil);
PosIText:=IntuiText(0,1,JAM2,6,3,nil,'Yes, Please',nil);
NegIText:=IntuiText(0,1,JAM2,6,3,nil,'Oh, No!',nil);
answer:=AutoRequest(MyWindow,^BodyIText,^PosIText,^NegIText,RELVERIFY,RELVERIFY,260,60);
if answer=true then running:=false;
end;
{ And clean up the mess (although Kick-Pascal promisses to do all this on its
own, I prefer to close the things I used on my own). }
procedure CloseAll;
var dummy : ptr;
begin
dummy:=RemoveGList(MyWindow,MyWindow^.FirstGadget,-1);
ClearMenuStrip(MyWindow);
Close_Window(MyWindow);
Close_Screen(MyScreen);
end;
{ Finally made it to the main loop? Keep on reading. }
begin
DoVariables;
DoScreen;
DoMenu;
DoGadgets;
running:=true;
while running=true do
begin
Msg:=Wait_Port(MyWindow^.UserPort);
Msg:=Get_Msg(MyWindow^.UserPort);
case Msg^.Class of
_CLOSEWINDOW : QuitProg;
GADGETUP : begin
ClickGad:=Msg^.IAddress;
case ClickGad^.GadgetID of
1..9,11..19 : success:=ActivateGadget(^SongGad[ClickGad^.GadgetID+1],MyWindow,nil);
21,23 : success:=ActivateGadget(^TitleGad[ClickGad^.GadgetID-19],MyWindow,nil);
25 : NextNR(1);
26 : NextNR(2);
27 : NextSource(1);
28 : NextSource(2);
31 : NextLength;
32 : NextPos;
33 : SwitchSides;
OTHERWISE;
end;
end;
MENUPICK : begin
Picked:=Msg^.Code;
PMenu:=Picked and $1f;
PMenuItem:=(Picked and $7e0) div 32;
PMenuSubItem:=(Picked and $f800) div 2048;
case PMenu of
0 : case PMenuItem of
0 : LoadData;
1 : SaveData;
2 : ClearData;
3 : Copyright;
4 : QuitProg;
end;
1 : case PMenuItem of
0 : If PMenuSubItem=0 then
PrintCover
else
SaveCover;
1 : SaveLaTeX;
end;
OTHERWISE;
end;
end;
OTHERWISE;
end;
end;
CloseAll;
end.