This commit is contained in:
aNNiMON 2024-03-02 18:42:50 +02:00
parent 732576e85d
commit fc8e376329

View File

@ -5,12 +5,14 @@ program pr;
y_wlcm : integer; {Vsplivayushii text} y_wlcm : integer; {Vsplivayushii text}
i : integer; {Vspomogatelnie peremennye} i : integer; {Vspomogatelnie peremennye}
cur : integer; {Posicia kursora v menu} cur : integer; {Posicia kursora v menu}
y, stry : integer; {Peremennye dlya vyvoda teksta} x,y, stry, th : integer; {Peremennye dlya vyvoda teksta}
ln, ch : integer; {Peremennye dlya chtenia teksta}
nolect : integer; {Nomer lekcii} nolect : integer; {Nomer lekcii}
f : text; {File lekcii}
javame, author, javame, author,
welcome, dtpa, welcome, dtpa, s,
menustatus, menustatus, tmp,
lectstatus : string; lectstatus,path,j: string;
mainmenu : array [1..22] of string; {menu} mainmenu : array [1..22] of string; {menu}
{Procedura inicializacii grafiki} {Procedura inicializacii grafiki}
@ -22,10 +24,13 @@ program pr;
procedure menu ; forward; procedure menu ; forward;
procedure lections(var lect:integer); forward; procedure lections(var lect:integer); forward;
procedure ui(ttitle, tbar : string); forward;
{Procedura inicializacii peremennyh} {Procedura inicializacii peremennyh}
procedure init_variables; procedure init_variables;
begin begin
x := 20;
th := 440; {Vysota svobodnoy oblasti pri vyvode teksta}
y_wlcm := -20; y_wlcm := -20;
cur := 1; cur := 1;
author := 'Author: Victor aNNiMON Melnik'; author := 'Author: Victor aNNiMON Melnik';
@ -34,11 +39,13 @@ program pr;
javame := 'JavaME'; javame := 'JavaME';
lectstatus := 'F1 - Help T - Test ESC - Menu'; lectstatus := 'F1 - Help T - Test ESC - Menu';
menustatus := 'ESC - Vyhod UP,DOWN,LEFT,RIGHT - Peredvijenie kursora ENTER - Perehod'; menustatus := 'ESC - Vyhod UP,DOWN,LEFT,RIGHT - Peredvijenie kursora ENTER - Perehod';
path := 'D:\2PO-07\';
{Menu Lekcii} {Menu Lekcii}
for i:= 1 to 10 do for i:= 1 to 10 do
begin begin
mainmenu[i*2-1] := {chr(47+i)+'. }'Lekcia #'+chr(47+i); str(i, tmp);
mainmenu[i*2] := 'Test #'+chr(47+i) mainmenu[i*2-1] := 'Lekcia #'+tmp;
mainmenu[i*2] := 'Test #'+tmp;
end; end;
mainmenu[21] := 'Author'; mainmenu[21] := 'Author';
mainmenu[22] := 'Exit'; mainmenu[22] := 'Exit';
@ -81,8 +88,9 @@ program pr;
procedure author_screen; procedure author_screen;
begin; begin;
init_screen; init_screen;
setcolor(7); ui('Authors','');
bar(0,0,640,480); {setcolor(7);
bar(0,0,640,480);}
settextstyle(1, 0, 7); settextstyle(1, 0, 7);
settextstyle(3, 0, 4); settextstyle(3, 0, 4);
setcolor(red); setcolor(red);
@ -99,126 +107,127 @@ program pr;
procedure help_screen; procedure help_screen;
begin; begin;
init_screen; init_screen;
{ochistka ekrana} ui('Help','');
setfillstyle(1,9);
bar(0,0,640,480);
{Title}
setfillstyle(1, 1);
bar(0, 0, 640, 18);
setcolor(8);
settextstyle(2,0,6);
outtextxy(300, 0, 'Help');
outtextxy(99, 170, 'B - Smena cveta fona'); outtextxy(99, 170, 'B - Smena cveta fona');
outtextxy(99, 230, 'N - Smena cveta texta'); outtextxy(99, 230, 'N - Smena cveta texta');
repeat until keypressed; repeat until keypressed;
menu; menu;
end; end;
{Procedura otrisovki ekrana}
procedure ui(ttitle, tbar : string);
begin
{ochistka ekrana}
setfillstyle(1,9);
bar(0,0,640,480);
{Title}
setfillstyle(1, 1);
bar(0, 0, 640, 18);
setcolor(13);
settextstyle(2,0,6);
outtextxy(300, 0, ttitle);
{Status}
setfillstyle(1, 7);
settextstyle(2,0,4);
bar(0, 466, 640, 480);
setcolor(24);
outtextxy(10, 468, tbar);
end;
{Procedura chtenia lectii} {Procedura chtenia lectii}
procedure lections(var lect:integer); procedure lections(var lect:integer);
begin begin
init_screen; init_screen;
nolect := lect div 2; nolect := lect div 2;
repeat p1:=readkey; str(nolect, tmp);
{Obrabotka klavish upravlenia} assign(f, path+'lect'+tmp+'.txt');
if p1=#72 then cur:=cur-2 {UP} reset(f);
else if p1=#75 then cur:=cur-1 {LEFT} {Schityvaem nazvanie lekcii}
else if p1=#80 then cur:=cur+2 {DOWN} readln(f,tmp);
else if p1=#77 then cur:=cur+1; {RIGHT} ch := TextHeight(tmp)+8; {Vysota teksta}
{else if(p=#13) then cur:=cur-1; ln := 1;
else if(p=#72) then cur:=cur-1; stry := 0;
else if(p=#72) then cur:=cur-1; } repeat p1:=readkey;
TextWidth('defe'); {Obrabotka klavish upravlenia}
{Proverka peremennyh} if p1=#72 then cur:=cur-2 {UP}
if(cur<2) then cur:=2; else if p1=#75 then x:=x-10 {LEFT}
if(cur>23) then cur:=23; else if p1=#80 then cur:=cur+2 {DOWN}
{ochistka ekrana} else if p1=#77 then x:=x+10; {RIGHT}
setfillstyle(1,9); {else if(p=#13) then cur:=cur-1;
bar(0,0,640,480); else if(p=#72) then cur:=cur-1;
{Title} else if(p=#72) then cur:=cur-1; }
setfillstyle(1, 1); {Proverka peremennyh}
bar(0, 0, 640, 18); if(cur<2) then cur:=2
setcolor(13); else if(cur>23) then cur:=23;
settextstyle(2,0,6); ui(tmp,lectstatus);
outtextxy(300, 0, 'Lekcia #'+chr(47+nolect)); {Otrisovka teksta}
{Status} setcolor(14);
setfillstyle(1, 7); settextstyle(4,0,3);
settextstyle(2,0,4); while not eof(f) do
bar(0, 466, 640, 480); begin
setcolor(24); readln(f,s);
outtextxy(10, 468, lectstatus); outtextxy(x,20+ln*ch,s);
{Otrisovka menu} inc(ln);
setcolor(14); stry := stry + ch;
settextstyle(1,0,3); if (stry+ch>th) then {Dostignut nijniy kray}
begin
until (p1=#27) or (p1=#116) or (p1=#59) readkey;
ui(tmp,lectstatus);
ln:=1;
stry:=0;
end;
end;
until (p1=#27) or (p1=#116) or (p1=#59)
{ or (p=#80) or (p=#80) or (p=#13)}; { or (p=#80) or (p=#80) or (p=#13)};
if(p1=#116) then menu {T - Test} if(p1=#116) then menu {T - Test}
else if(p1=#59) then help_screen; {F1 - Help} else if(p1=#59) then help_screen; {F1 - Help}
end; end;
{Procedura obrabotki vibrannogo punkta menu} {Procedura obrabotki vibrannogo punkta menu}
procedure choicemenu(var cur:integer); procedure choicemenu(var cur:integer);
begin begin
if(cur=22) then author_screen {AUTHOR} if(cur=22) then author_screen {AUTHOR}
else if(cur=23) then halt {EXIT} else if(cur=23) then halt {EXIT}
else {OTHER} else {OTHER}
begin begin
if cur mod 2=0 then lections(cur) if cur mod 2=0 then lections(cur)
;{else question(cur div 2);} ;{else question(cur div 2);}
end; end;
end; end;
{Procedura vyvoda menu} {Procedura vyvoda menu}
procedure menu; procedure menu;
begin
init_screen;
repeat p:=readkey;
{Obrabotka klavish upravlenia}
if p=#72 then cur:=cur-2 {UP}
else if p=#75 then cur:=cur-1 {LEFT}
else if p=#80 then cur:=cur+2 {DOWN}
else if p=#77 then cur:=cur+1 {RIGHT}
else if p=#13 then choicemenu(cur); {ENTER}
{else if(p=#13) then cur:=cur-1;
else if(p=#72) then cur:=cur-1;
else if(p=#72) then cur:=cur-1; }
{Proverka peremennyh}
if(cur<2) then cur:=2;
if(cur>23) then cur:=23;
{ochistka ekrana}
setfillstyle(1,9);
bar(0,0,640,480);
{Title}
setfillstyle(1, 1);
bar(0, 0, 640, 18);
setcolor(13);
settextstyle(2,0,6);
outtextxy(300, 0, javame);
{Status}
setfillstyle(1, 7);
settextstyle(2,0,4);
bar(0, 466, 640, 480);
setcolor(24);
outtextxy(10, 468, menustatus);
{Otrisovka menu}
setcolor(14);
settextstyle(1,0,3);
for i:= 1 to 11 do
begin begin
if(i=cur div 2) then init_screen;
begin repeat p:=readkey;
setfillstyle(1,3); {Obrabotka klavish upravlenia}
if (cur mod 2=0) then bar(115, 35+i*30, 230, 35+(i+1)*30) if p=#72 then cur:=cur-2 {UP}
else bar(315, 35+i*30, 405, 35+(i+1)*30); else if p=#75 then cur:=cur-1 {LEFT}
setfillstyle(1,7); else if p=#80 then cur:=cur+2 {DOWN}
end; else if p=#77 then cur:=cur+1 {RIGHT}
outtextxy(120, 40+i*30, mainmenu[i*2-1]); else if p=#13 then choicemenu(cur); {ENTER}
outtextxy(320, 40+i*30, mainmenu[i*2]); {Proverka peremennyh}
end; if(cur<2) then cur:=2;
until (p=#27) {or (p=#72) or (p=#75) or (p=#77) if(cur>23) then cur:=23;
ui(javame, menustatus);
{Otrisovka menu}
setcolor(14);
settextstyle(1,0,3);
for i:= 1 to 11 do
begin
if(i=cur div 2) then
begin
setfillstyle(1,3);
if (cur mod 2=0) then bar(115, 35+i*30, TextWidth(mainmenu[i*2-1])+125, 35+(i+1)*30)
else bar(315, 35+i*30, TextWidth(mainmenu[i*2])+325, 35+(i+1)*30);
setfillstyle(1,7);
end;
outtextxy(120, 40+i*30, mainmenu[i*2-1]);
outtextxy(320, 40+i*30, mainmenu[i*2]);
end;
until (p=#27) {or (p=#72) or (p=#75) or (p=#77)
or (p=#80) or (p=#80) or (p=#13)}; or (p=#80) or (p=#80) or (p=#13)};
if(p=#27) then halt; if(p=#27) then halt;
end; end;
{Glavnaya programma} {Glavnaya programma}