uses crt, graph,dos;
type
  CommandType = (moveup, movedown, moveleft, moveright, penup,
  pendown,help, changewindows, null,
  over,gridon,dotup,dotdown,dotleft,dotright,getshape,cir,rect,
  ell,ac,dia,dia2,dia3,dia4,dotdia,dotdia2,dotdia3,dotdia4,C0,C1,C2,
  C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14,C15,time,tri,poly,
  changeBK,helpfile,filer,edit,shapes,options,hotkeys,
  fullscreen,tips,about,troubleshooting,sizeChange);
     {null for incorrect commands}
var
  device, mode, x,y,z,c,i,x1,y1 : integer;
  readyToDraw : boolean;
  Command : commandType;
  color,wincolor:word;
  anykey,key,ans,size,s,l :char;
  Gd, Gm : Integer;
  v,v1:string;
   prevcmd:char;
   cmdCh : char;
  buttonchanged:boolean;
 {--------------------------------------------------------------------------}
procedure DrawDate;
   var
   s:string[4];
   date:string[8];
   year,month,day,dayofweek:word;
  begin
    getdate(year,month,day,dayofweek);
    str(day,s);
    date:=s+'/';
    str(month,s);
    if month>9
      then
        date:=date+s
      else
        date:=date+'0'+s;
    str(year,s);
    date:=date+'/'+copy(s,3,2);
    setcolor(blue);
    outtextxy(483,430,date);
  end;

{--------------------------------------------------------------------------}
procedure DrawTime;
      var
    s:string[2];
    ampm:string[3];
    time:string[8];
    hour,minute,second,sec100:word;
  begin
    setfillstyle(solidfill,lightgray);
    bar(483,430,550,440);
    gettime(hour,minute,second,sec100);
    if hour>12
      then
        begin
          ampm:=' PM';
          hour:=hour-12;
        end
      else
        ampm:=' AM';
    str(hour,s);
    if hour>9
      then
        time:=s+':'
      else
        time:='0'+s+':';
    str(minute,s);
    if minute>9
      then
        time:=time+s
      else
        time:=time+'0'+s;
    time:=time+ampm;
    setcolor(blue);
    outtextxy(483,430,time);
    for i:=1 to 250 do
      begin
        if keypressed
          then
            begin
              setfillstyle(solidfill,lightgray);
              bar(483,430,550,440);
              DrawDate;
              repeat
                key:=readkey;
              until key<>chr(0);
              exit;
            end
          else
            delay(10);
      end;
    setfillstyle(solidfill,lightgray);
    bar(483,430,550,440);
    DrawDate;
  end;


 {===================================        DrawWindow   ++++++++++++}
    procedure DrawWindow(x,y,width,height:integer);
  begin
    setfillstyle(solidfill,wincolor);
    bar(x,y,x+width,y+height);
    setcolor(white);
    line(x+1,y+1,x+width-2,y+1);
    line(x+1,y+1,x+1,y+height-2);
    setcolor(darkgray);
    line(x+1,y+height-1,x+width-1,y+height-1);
    line(x+width-1,y+1,x+width-1,y+height-1);
    setcolor(black);
    line(x,y+height,x+width,y+height);
    line(x+width,y,x+width,y+height);
  end;
  {=========================                     DRAW BUTTON   }
  procedure DrawButton(x,y,width,height:integer;raised:boolean);
  begin
    setfillstyle(solidfill,wincolor);
    bar(x,y,x+width,y+height);
    if raised
      then
        begin
          setcolor(white);
          line(x,y,x+width-1,y);
          line(x,y,x,y+height-1);
          setcolor(darkgray);
          line(x+1,y+height-1,x+width-1,y+height-1); { make button look up }
          line(x+width-1,y+1,x+width-1,y+height-1);
          setcolor(black);
          line(x,y+height,x+width,y+height);
          line(x+width,y,x+width,y+height);
        end
      else
        begin
          setcolor(black);
          line(x,y,x+width-1,y);
          line(x,y,x,y+height-1);
          setcolor(darkgray);
          line(x+1,y+1,x+width-2,y+1);       { make button look down }
          line(x+1,y+1,x+1,y+height-2);
          setcolor(white);
          line(x,y+height,x+width,y+height);
          line(x+width,y,x+width,y+height);
        end;
 end;
     procedure DrawWinFlag(x,y:integer);
  begin
    setcolor(black);
    setfillstyle(solidfill,black);
    line(x,y+1,x,y+2);
    line(x+7,y+1,x+11,y+1);
    line(x+2,y+2,x+2,y+3);
    line(x+4,y+2,x+12,y+2);
    line(x+3,y+3,x+4,y+3);
    bar(x+5,y+3,x+13,y+10);
    line(x,y+10,x,y+11);
    line(x+2,y+11,x+2,y+12);
    line(x+4,y+11,x+7,y+11);
    line(x+11,y+11,x+12,y+11);
    line(x+3,y+12,x+5,y+12);
    line(x+13,y+11,x+13,y+12);
    setcolor(lightred);
    line(x,y+4,x,y+5);
    line(x+2,y+5,x+2,y+6);
    line(x+4,y+5,x+4,y+6);
    putpixel(x+3,y+6,lightred);
    line(x+7,y+4,x+7,y+5);
    line(x+8,y+3,x+8,y+4);
    setcolor(lightgreen);
    line(x+10,y+3,x+10,y+4);
    line(x+11,y+4,x+11,y+5);
    setcolor(lightblue);
    line(x,y+7,x,y+8);
    line(x+2,y+8,x+2,y+9);
    line(x+4,y+8,x+4,y+9);
    putpixel(x+3,y+9,lightblue);
    line(x+7,y+8,x+7,y+9);
    line(x+8,y+7,x+8,y+8);
    setcolor(yellow);
    line(x+10,y+7,x+10,y+8);
    line(x+11,y+8,x+11,y+9);
  end;
 { ++++++++++++++++++++++++++++++++ Top icons ++++++++++++++++++++++++++++}
  procedure icons2;
    begin
    setcolor(red);
    SetTextStyle(gothicFont, horizdir,2 );  { help icon}
    outtextxy(282,66,'?');

    setcolor(10);
    SetTextStyle(4, horizdir,2 );  { tips icon }
    outtextxy(233,66,'t');

    setcolor(blue);
    outtextxy(100,63,'x');    { exit icon }
    setfillstyle(solidfill,white);   { new sheet icon }
    bar(74,74,83,85);

    drawwinflag(254,73);  { winflag on button 10 -top }

   { drawbutton(199,70,20,20,true);}
    setcolor(black);
    setfillstyle(gothicfont,2);
    outtextxy(204,65,'h');

    setcolor(1);             line(126,74,135,74);    {change back round icon }
    setcolor(2);             line(126,75,135,75);
    setcolor(3);             line(126,76,135,76);
    setcolor(0);             line(126,77,135,77);
    setcolor(5);             line(126,78,135,78);
    setcolor(15);            line(126,79,135,79);
    setcolor(7);             line(126,80,135,80);
    setcolor(10);            line(126,81,135,81);
    setcolor(11);            line(126,82,135,82);
    setcolor(14);            line(126,83,135,83);
    setcolor(9);             line(126,84,135,84);
    setcolor(6);             line(126,85,135,85);
    setcolor(0);             line(126,86,135,86);

    setfillstyle(solidfill,white);
    bar(152,74,161,85);                   { fullscreen icon }
    setcolor(0);
    line(152,74,161,74);
    line(161,74,161,85);
    putpixel(152,75,black);
    putpixel(153,75,black);
    putpixel(153,76,black);
    putpixel(160,85,black);
    putpixel(160,84,black);
    putpixel(159,84,black);

   setcolor(blue);
   circle(183,80,5);                  { start over icon }
   circle(182,80,5);
   setfillstyle(solidfill,lightgray);
   bar(180,75,185,76);

   putpixel(185,76,1);
   putpixel(185,77,1);
   putpixel(185,78,1);
   putpixel(185,79,1);
   putpixel(186,78,1);
   SetTextStyle(defaultFont, horizdir,1 );
end;
{===================================================TopbuttonsDown++++++++}
 procedure topbuttonsup;
  begin
  drawbutton(69,70,20,20,true);   { icon buttons from  1 to } {new sheet }
  drawbutton(95,70,20,20,true);  {exit}
  drawbutton(121,70,20,20,true); {  startover}
  drawbutton(147,70,20,20,true);   {fullscreen}
  drawbutton(173,70,20,20,true);  {startover}
  drawbutton(199,70,20,20,true);  {hotkeys}
  drawbutton(225,70,20,20,true);  { tip }
  drawbutton(251,70,20,20,true); { about }
  drawbutton(277,70,20,20,true); { help }

  drawbutton(310,70,20,20,true); {        Change Pen size button}
  drawbutton(335,70,20,20,true);
  drawbutton(360,70,20,20,true);
  drawbutton(385,70,20,20,true);


  {13  on top}
 end;

{=========================================================================}
                                                   { icons icons icons }
    procedure icons;
 begin
  setcolor(yellow);
  line(505,137,505,127);
  line(506,137,506,127);
  line(507,137,507,127);
  putpixel(505,127,brown);
  putpixel(506,127,brown);             { icon pencil hor,vert- solid }
  putpixel(507,127,brown);
  putpixel(506,126,brown);
  setcolor(red);
  line(505,137,507,137);
  line(505,138,507,138);
  setcolor(0);
  line(497,135,497,129);
  line(494,132,500,132);


  setcolor(yellow);
  line(535,137,535,128);
  line(536,137,536,128);
  line(537,137,537,128);
  putpixel(535,128,brown);
  putpixel(536,128,brown);
  putpixel(537,128,brown);
  putpixel(536,127,brown);              { icon # 2 pencil hor,vert - dotted }
  setcolor(red);
  line(535,137,537,137);
  line(535,138,537,138);
  putpixel(527,132,0);
  putpixel(527,130,0);
  putpixel(527,134,0);
  putpixel(527,136,0);
  putpixel(527,128,0);
  putpixel(529,132,0);
  putpixel(525,132,0);
  putpixel(523,132,0);
  putpixel(531,132,0);

  setcolor(11);
  rectangle(495,155,510,167);           {3}
  rectangle(495,155,501,167);
  rectangle(495,155,504,167);        { grid icon }
  rectangle(495,155,498,167);
  rectangle(495,155,507,167);
  line(495,158,510,158);
  line(495,161,510,161);
  line(495,164,510,164);

  setcolor(yellow);         {4}
  line(527,165,530,159);
  line(528,165,530,160);     { penup / pendown icon }
  line(529,165,531,161);
  line(533,159,537,165);
  line(534,160,538,167);
  line(535,159,539,166);
  putpixel(538,168,brown);
  putpixel(539,167,brown);
  putpixel(539,168,brown);
  setcolor(red);
  line(527,165,528,166);
  line(527,166,528,167);
  line(527,167,528,167);

  setcolor(yellow);          { diagonal solid line icon }
  line(505,187,505,195);
  line(506,187,506,195);
  line(507,187,507,195);
  putpixel(505,187,brown);
  putpixel(506,187,brown);
  putpixel(507,187,brown);
  putpixel(506,186,brown);
  setcolor(red);
  line(505,196,507,196);
  line(505,197,507,197);
  setcolor(black);
  line(495,190,500,196);
  line(495,196,500,190);


  setcolor(yellow);          { diagonal dotted line icon }
  line(535,187,535,195);
  line(536,187,536,195);
  line(537,187,537,195);
  putpixel(535,187,brown);
  putpixel(536,187,brown);
  putpixel(537,187,brown);
  putpixel(536,186,brown);
  setcolor(red);
  line(535,196,537,196);
  line(535,197,537,197);
  setcolor(black);
  line(525,190,530,196);
  line(525,196,530,190);
  putpixel(526,191,7);
  putpixel(526,195,7);
  putpixel(529,191,7);
  putpixel(529,195,7);

  circle(502,221,6);      { Circle icon }

  rectangle(526,216,538,227);    { rectangle icon }

  arc(501,252,330,220,5);      { arc icon }

  ellipse(532,252,0,360,5,8);   { ellipse icon }


   line(501,276,494,287);
   line(501,276,508,287);      { triangle icon }
   line(495,287,507,287);

   line(530,276,525,283);        { poly icon }
   line(525,283,537,288);
   line(530,276,537,288);


  end;



     { the buttons on the right stay up unless indicated by this procedure }

 procedure rightbuttonsup;
 begin
  drawbutton(490,120,24,24,true);                                  {1}
  drawbutton(520,120,24,24,true);                                 { 2 }
  drawbutton(490,150,24,24,true);                                 { 3 }
  drawbutton(520,150,24,24,true);                                 { 4 }
  drawbutton(490,180,24,24,true);                                 { 5 }
  drawbutton(520,180,24,24,true);                                 { 6 }
  drawbutton(490,210,24,24,true);                                 { 7 }
  drawbutton(520,210,24,24,true);                                 { 8 }
  drawbutton(490,240,24,24,true);                                 { 9 }
  drawbutton(520,240,24,24,true);                                 { 10 }
  drawbutton(490,270,24,24,true);                                 { 11 }
  drawbutton(520,270,24,24,true);                                 { 12 }
end;

  { ======================================== procedure colors ++++++++++++++++}
 procedure colors;
 begin
  drawbutton(490,400,15,15,true);
  setfillstyle(solidfill,1);                { C1 }
  bar(492,402,503,414);
  drawbutton(510,400,15,15,true);
  setfillstyle(solidfill,2);                { C2 }
  bar(512,402,523,414);
  drawbutton(530,400,15,15,true);
  setfillstyle(solidfill,3);                { C3 }
  bar(532,402,543,414);

  drawbutton(490,380,15,15,true);
  setfillstyle(solidfill,4);            { C4 }
  bar(492,382,503,394);                         { set of color}
  drawbutton(510,380,15,15,true);
  setfillstyle(solidfill,5);           { C5 }
  bar(512,382,523,394);
  drawbutton(530,380,15,15,true);
  setfillstyle(solidfill,6);            { C6 }
  bar(532,382,543,394);

  drawbutton(490,360,15,15,true);
  setfillstyle(solidfill,7);           { C7 }
  bar(492,362,503,374);
  drawbutton(510,360,15,15,true);          {set of color}
  setfillstyle(solidfill,8);          { C8 }
  bar(512,362,523,374);
  drawbutton(530,360,15,15,true);
  setfillstyle(solidfill,9);           { C9 }
  bar(532,362,543,374);

  drawbutton(490,340,15,15,true);
  setfillstyle(solidfill,10);            { C 10 }
  bar(492,342,503,354);                       {set  of color}
  drawbutton(510,340,15,15,true);
   setfillstyle(solidfill,11);             { C11 }
  bar(512,342,523,354);
  drawbutton(530,340,15,15,true);
  setfillstyle(solidfill,12);            { C12 }
  bar(532,342,543,354);

  drawbutton(490,320,15,15,true);
  setfillstyle(solidfill,13);            { C13 }
  bar(492,322,503,334);
  drawbutton(510,320,15,15,true);
  setfillstyle(solidfill,14);           { C14 }        { set of color }
  bar(512,322,523,334);
  drawbutton(530,320,15,15,true);
  setfillstyle(solidfill,15);            { C15 }
  bar(532,322,543,334);
  end;


{---------------------------Getcommand Procedure----------------------------}
procedure getcommand (var cmd : commandType);
 begin
   cmdch := readkey;
   cmdch:=upcase(cmdch);

   if cmdCh in ['8', '2', '4', '6', 'P', 'Q','E',
   'S','G','9','7','1','3','C','R','L','A','N','M',
   'V','!','!','@','#','$','%','^','&','*','(',')','_',
   '+','{','}','|','Z','T','Y','U','I','M',',','.','/',
   'O','D','S','K','H','F','~',':','"','?','H','[',']','\','W','Z','`'] then
    case cmdCh of
       '8' :begin
         cmd := moveup;
          if cmdCh<>prevcmd then
          begin
             buttonchanged:=true;
             topbuttonsup;
             icons2;
             rightbuttonsUp;
             icons;
             end
            else
            buttonchanged:=false;
                        prevcmd:='8';
            end;
     '2' :
        begin

            cmd := movedown;
          if cmdCh<>prevcmd then
           begin
            buttonchanged:=true ;
              topbuttonsup;
             icons2;
             rightbuttonsUp;
             icons
            end
                        else
            buttonchanged:=false;
            prevcmd:='2';

           end;
     '4' :begin
            cmd := moveleft;
           if cmdCh<>prevcmd then
           begin
            buttonchanged:=true  ;
              topbuttonsup;
             icons2;
             rightbuttonsUp;
             icons;
             end
                        else
            buttonchanged:=false;
                prevcmd:='4';
           end;
     '6' :begin
          cmd := moveright;
                if cmdCh<>prevcmd then
                begin
               buttonchanged:=true;
                topbuttonsup;
                icons2;
               rightbuttonsUp;
                icons;
             end
                        else
            buttonchanged:=false;
                 prevcmd:='6';
           end;

      '9' :begin
         cmd := dotright;
          if cmdCh<>prevcmd then
          begin
             buttonchanged:=true;
             topbuttonsup;
             icons2;
             rightbuttonsUp;
             icons;
             end
            else
            buttonchanged:=false;
                        prevcmd:='9';
            end;
     '7' :
        begin

            cmd := dotleft;
          if cmdCh<>prevcmd then
           begin
            buttonchanged:=true ;
              topbuttonsup;
             icons2;
             rightbuttonsUp;
             icons
            end
                        else
            buttonchanged:=false;
            prevcmd:='7';

           end;
     '1' :begin
            cmd := dotup;
           if cmdCh<>prevcmd then
           begin
            buttonchanged:=true  ;
              topbuttonsup;
             icons2;
             rightbuttonsUp;
             icons;
             end
                        else
            buttonchanged:=false;
                prevcmd:='1';
           end;

     '3' :begin
          cmd := dotdown;
                if cmdCh<>prevcmd then
                begin
               buttonchanged:=true;
                topbuttonsup;
                icons2;
                rightbuttonsUp;
                icons;
             end
                        else
            buttonchanged:=false;
               prevcmd:='3';

           end;
    'M' :begin
        cmd := dotdia;
          if cmdCh<>prevcmd then
          begin
             buttonchanged:=true;
             topbuttonsup;
             icons2;
             rightbuttonsUp;
             icons;
             end
            else
            buttonchanged:=false;
                        prevcmd:='M';
            end;
     ',' :
        begin

            cmd := dotdia2;
          if cmdCh<>prevcmd then
           begin
            buttonchanged:=true ;
              topbuttonsup;
             icons2;
             rightbuttonsUp;
             icons
            end
                        else
            buttonchanged:=false;
            prevcmd:=',';

           end;
     '.' :begin
            cmd := dotdia3;
           if cmdCh<>prevcmd then
           begin
            buttonchanged:=true  ;
              topbuttonsup;
             icons2;
             rightbuttonsUp;
             icons;
             end
                        else
            buttonchanged:=false;
                prevcmd:='.';
           end;

     '/' :begin
          cmd := dotdia4;
                if cmdCh<>prevcmd then
                begin
               buttonchanged:=true;
                topbuttonsup;
                icons2;
                rightbuttonsUp;
                icons;
             end
                        else
            buttonchanged:=false;
               prevcmd:='/';

           end;

            'T' :begin
        cmd := dia;
          if cmdCh<>prevcmd then
          begin
             buttonchanged:=true;
             topbuttonsup;
             icons2;
             rightbuttonsUp;
             icons;
             end
            else
            buttonchanged:=false;
                        prevcmd:='T';
            end;
     'U' :
        begin

            cmd := dia2;
          if cmdCh<>prevcmd then
           begin
            buttonchanged:=true ;
              topbuttonsup;
             icons2;
             rightbuttonsUp;
             icons
            end
                        else
            buttonchanged:=false;
            prevcmd:='U';

           end;
     'Y' :begin
            cmd := dia3;
           if cmdCh<>prevcmd then
           begin
            buttonchanged:=true  ;
              topbuttonsup;
             icons2;
             rightbuttonsUp;
             icons;
             end
                        else
            buttonchanged:=false;
                prevcmd:='Y';
           end;

     'I' :begin
          cmd := dia4;
                if cmdCh<>prevcmd then
                begin
               buttonchanged:=true;
                topbuttonsup;
                icons2;
                rightbuttonsUp;
                icons;
             end
                        else
            buttonchanged:=false;
               prevcmd:='I';

           end;
     'P' : cmd := penup;      'Q' : cmd := pendown;
     'E' : cmd := changewindows;
     'N' : cmd := over;       'G' : cmd := Gridon;
     'C' : cmd := cir;        'R' : cmd := rect;
     'L' : cmd := ell;        'A' : cmd := ac;
     '~':cmd:=C0;              '!':cmd:=C1;
     '@':cmd:=C2;
     '#':cmd:=C3;               '$':cmd:=C4;
     '%':cmd:=C5;               '^':cmd:=C6;
     '&':cmd:=C7;               '*':cmd:=C8;
     '(':cmd:=C9;               ')':cmd:=C10;
     '_':cmd:=C11;              '+':cmd:=C12;
     '{':cmd:=C13;              '}':cmd:=C14;
     '|':cmd:=C15;              'O':cmd:=time;
     'D':cmd:=tri;              'S':cmd:=poly;
     'H':cmd:=hotkeys;          '[':cmd:=fullscreen;
     'F':cmd:=Filer;            ']':cmd:=about;
     'K':cmd:=changeBK;         '\':cmd:=tips;
     '`':cmd:=edit;             'W':cmd:=troubleshooting;
     ':':cmd:=shapes;           'Z' :cmd:=sizeChange;
     '"':cmd:=options;
     '?':cmd:=helpfile;

         end
  else
    cmd := null
end;
procedure grids;
  begin

   setcolor(11);
   line(82,129,455,129);     line(82,136,455,136);     line(82,143,455,143);     line(82,150,455,150);
   line(82,157,455,157);     line(82,164,455,164);     line(82,171,455,171);     line(82,178,455,178);
   line(82,185,455,185);     line(82,192,455,192);     line(82,199,455,199);     line(82,206,455,206);
   line(82,213,455,213);     line(82,220,455,220);     line(82,227,455,227);     line(82,234,455,234);
   line(82,241,455,241);     line(82,248,455,248);     line(82,255,455,255);     line(82,262,455,262);
   line(82,269,455,269);     line(82,276,455,276);     line(82,283,455,283);     line(82,290,455,290);
   line(82,297,455,297);     line(82,304,455,304);     line(82,311,455,311);     line(82,318,455,318);
   line(82,325,455,325);     line(82,332,455,332);     line(82,339,455,339);     line(82,346,455,346);
   line(82,353,455,353);     line(82,360,455,360);     line(82,367,455,367);     line(82,374,455,374);
   line(82,381,455,381);     line(82,388,455,388);     line(82,395,455,395);     line(82,402,455,402);
   line(88,122,88,402);      line(95,122,95,402);      line(102,122,102,402);    line(109,122,109,402);
   line(116,122,116,402);    line(123,122,123,402);    line(130,122,130,402);    line(137,122,137,402);
   line(144,122,144,402);    line(151,122,151,402);    line(158,122,158,402);    line(165,122,165,402);
   line(172,122,172,402);    line(179,122,179,402);    line(186,122,186,402);    line(193,122,193,402);
   line(200,122,200,402);    line(207,122,207,402);    line(214,122,214,402);    line(221,122,221,402);
   line(228,122,228,402);    line(235,122,235,402);    line(242,122,242,402);    line(249,122,249,402);
   line(256,122,256,402);    line(263,122,263,402);    line(270,122,270,402);    line(277,122,277,402);
   line(284,122,284,402);    line(291,122,291,402);    line(298,122,298,402);    line(305,122,305,402);
   line(312,122,312,402);    line(319,122,319,402);    line(326,122,326,402);    line(333,122,333,402);
   line(340,122,340,402);    line(347,122,347,402);    line(354,122,354,402);    line(361,122,361,402);
   line(368,122,368,402);    line(375,122,375,402);    line(382,122,382,402);    line(389,122,389,402);
   line(396,122,396,402);    line(403,122,403,402);    line(410,122,410,402);    line(417,122,417,402);
   line(424,122,424,402);    line(431,122,431,402);    line(438,122,438,402);    line(445,122,445,402);
   line(452,122,452,402);
   end;

{                             the window inwhich is drawn in}
procedure drawingwindow;
  begin
    drawbutton(71,97,397,317,true);{ for now draw window}
    setfillstyle(solidfill,blue);
    bar(76,100,462,112);
    setcolor(white);
    outtextxy(80,103,'NoName00');
    drawbutton(80,120,377,284,false);
    setfillstyle(solidfill,white);
    bar(82,122,455,402);
    SetTextStyle(defaultfont, vertdir,1);
    setcolor(lightblue);
    outtextxy(80,125,'125');
    outtextxy(80,175,'175');
    outtextxy(80,225,'225');
    outtextxy(80,275,'275');
    outtextxy(80,325,'325');
    outtextxy(80,375,'375');
    outtextxy(467,125,'125');
    outtextxy(467,175,'175');
    outtextxy(467,225,'225');
    outtextxy(467,275,'275');
    outtextxy(467,325,'325');
    outtextxy(467,375,'375');
    settextstyle(defaultfont, horizdir,1);

    outtextxy(85,406,'85');
    outtextxy(115,406,'115');
    outtextxy(155,406,'155');
    outtextxy(195,406,'195');
    outtextxy(235,406,'235');
    outtextxy(275,406,'275');
    outtextxy(315,406,'315');
    outtextxy(355,406,'355');
    outtextxy(395,406,'395');
    outtextxy(435,406,'415');
    SetTextStyle(defaultfont, horizdir,1);
   end;


{--------------------------Startover Procedure------------------------------}
procedure startover;
 begin
   topbuttonsup;
   icons2;
    drawbutton(173,70,20,20,false);
    icons2;
   drawbutton(69,425,400,15,false);  { user info panal }
   setcolor(black);
   outtextxy(72,430,'Are you sure you want to start over v= N or b = Y');
   anykey:=readkey;
   if anykey = 'v' then
      begin
        drawbutton(69,425,400,15,false);      { user info panal }
        setcolor(black);
        outtextxy(72,430,'Continue');
     end
   else
     if anykey = 'b' then
     begin
     drawbutton(69,425,400,15,false);      { user info panal }
     drawbutton(69,95,400,320,false); { drawing panal (blank)}
     x := 268;
     y := 262;
    drawingwindow;
    drawbutton(69,425,400,15,false);  { user info panal }
    setcolor(0);
    outtextxy(77,429,'New Sheet');
     end;
 end;
{ ==============================================draw LINE +++++++}
procedure drawline(x,y,width,height:integer);
begin
  setcolor(8);
 line(x,y,width,height);
 setcolor(white);
  line(x+1,y+1,width+1,height+1);
  end;

Procedure MAINWINDOW;
 begin
  DrawWindow(60,20,500,430);{ main window}
  setfillstyle(solidfill,blue);
  bar(67,25,550,38);  { top (blue) bar)  }
  drawbutton(535,27,10,10,true);  { close button}
  line(537,29,542,34);           { close line x}
  line(537,34,542,29);            {close line x}
  drawline(480,65,480,414); { line beside colors }
  setcolor(white);
  outtextxy(72,28,'DOODLE II v0.02                   Assman_2@hotmail.com');
  drawline(67,42,550,42); {line under top (blue) bar)}
  setcolor(0);
  outtextxy(68,50,'File  Edit [`] Shapes [:] Opitons ["] Help [?]');
   outtextxy(67,51,'_ ');
  setcolor(red);
  outtextxy(68,50,'                                                Beta Version');
  drawline(67,64,550,64);{ line under file }
  topbuttonsup;
  drawline(303,70,303,90);
  icons2; { top set of icons}
  drawbutton(485,117,73,180,false);  { box under icons}
  rightbuttonsup;
  icons; {redraws all icons}
  drawbutton(490,70,52,44,false);
  SetTextStyle(7, horizdir,5);  {logo}
  setcolor(blue);
  outtextxy(500,65,'D');
  settextstyle(0,horizdir,0);
  outtextxy(525,103,'2');
  drawbutton(69,95,400,320,false);{ drawing panal (blank)}
  drawbutton(69,425,400,15,false);  { user info panal }
end;
procedure pensize;
begin
  drawbutton(420,73,15,15,false);   { identifing pen size }
  drawbutton(445,73,15,15,true);    { identifing pen size by buttons }
end;
procedure pensizeicons;
 begin
   setcolor(black);
   line(427,76,427,85);
   setfillstyle(solidfill,0);
   bar(452,85,453,76);
 end;

  {=========================================================================}
 {==========================================================================}
{-------------------------PerformCommand Procedure--------------------------}
procedure performCommand (Cmd : CommandType; var x,y : integer;
  var readyToDraw : boolean);
    begin
      case command of
        SizeChange :
           begin
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(0);
            outtextxy(77,429,'What Size of Pen [l]arge [s]mall <enter>');
            key:=readkey;
            if key = 'l' then
              begin
                 size:='l' ;
                 drawbutton(420,73,15,15,true);   { identifing pen size }
                 drawbutton(445,73,15,15,false);
                 pensizeicons;
                 end
             else
              begin
                 size:='s';
                 drawbutton(420,73,15,15,false);   { identifing pen size }
                 drawbutton(445,73,15,15,true);
                 pensizeicons;
                end;
          end;
              MoveUp :
         begin
             if size = 'l'then
               begin
                y:=y-1;
                setcolor(color);
                Circle(X,Y-1,3); {  brush }
              if y = 125 then   { these few lines avoids them form passing borders}
                  y:= 402;
                end
            else
              Y := y-1; { normal  pencil }
            if y = 121 then   { these few lines avoids them form passing borders}
            y:= 402;
           drawbutton(490,120,24,24,false);
           icons;
            if buttonchanged then begin
          drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
          outtextxy(77,429,'Drawing line Upwards');
          end;
            end;
        MoveDown :
          begin

            if size = 'l'then
               begin
                y:=y+1;
                setcolor(color);
                  Circle(X,Y+1,3); {  brush }
               if y = 398 then
                y:=123;
                end
            else
              Y := y+1; { normal  pencil }
           if y = 402 then
           y:=121;
           drawbutton(490,120,24,24,false);
           icons;
                   if buttonchanged then begin
            drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
          outtextxy(77,429,'Drawing line Downwards');
          end;
       end;
       MoveLeft :begin

            if size = 'l'then
               begin
                x:=x-1;
                setcolor(color);
                Circle(X-1,Y,3); {  brush }
                   if x = 85 then
              x := 453;
                end
            else
              x := x-1; { normal  pencil }
            if x = 80 then
              x := 455;
                drawbutton(490,120,24,24,false);
              icons;

        if buttonchanged then begin
           drawbutton(69,425,400,15,false);  { user info panal }

          setcolor(0);
          outtextxy(77,429,'Drawing line to the left');
          buttonchanged:=false;
          end;
        end;
        MoveRight :
            begin
           if size = 'l'then
             begin
            x:=x+1;
               setcolor(color);
               Circle(X+1,Y,3); {  brush }
                  if x = 452 then
               x := 82;
                end
            else
              x := x+1; { normal  pencil }
             if x = 455 then
               x := 80;
               drawbutton(490,120,24,24,false);
               icons;
           if buttonchanged then begin
             drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
          outtextxy(77,429,'Drawing line to the right');
               end;
           end;
        dotright :
           begin
           if size = 'l'then
               begin
             X := x+10;
            if x > 452 then
              x := 83;
                setcolor(color);
                Circle(X,Y-1,3); {  brush }
                end
            else
             X := x+3;
            if x > 455 then
              x := 80;
             drawbutton(520,120,24,24,false);
             icons;
                if buttonchanged then begin
           drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
          outtextxy(77,429,'Drawing dotted line to the right');
           end ;
           end;
        dotleft :
         begin

           if size = 'l'then
               begin
             X := x-10;
                 if x < 83 then
              x := 452;
                setcolor(color);
                Circle(X,Y-1,3); {  brush }
                end
            else
           X := x-3;
           if x < 80 then
              x := 455;
                 drawbutton(520,120,24,24,false);
             icons;
                if buttonchanged then begin
              drawbutton(69,425,400,15,false);  { user info panal }
              setcolor(0);
          outtextxy(77,429,'Drawing dotted line to the left');
            end;
            end;

        dotup :
         begin

           if size = 'l'then
               begin
              Y := y-10;
              if y < 123 then
                y:= 400;
                setcolor(color);
                Circle(X,Y-1,3); {  brush }
                end
            else
             Y := y-3;
              if y < 121 then
                y:= 402;
             drawbutton(520,120,24,24,false);
             icons;
                if buttonchanged then begin
           drawbutton(69,425,400,15,false);  { user info panal }
           setcolor(0);
           outtextxy(77,429,'Drawing dotted line Upwards');
           end;
           end;
        dotdown :
         begin

           if size = 'l'then
               begin
             Y := y+10;
           if y > 400 then
              y:=125;
               setcolor(color);
                Circle(X,Y-1,3); {  brush }
                end
            else
         Y := y+3;
           if y > 402 then
          y:=121;
             drawbutton(520,120,24,24,false);
             icons;
                if buttonchanged then begin
            drawbutton(69,425,400,15,false);  { user info panal }
           setcolor(0);
           outtextxy(77,429,'Drawing dotted line Downwards');

          end;
          end;
        Penup :begin
            readyToDraw := false;
            topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
            drawbutton(520,150,24,24,false);       { 4 th button }
            icons;
           if buttonchanged then begin
           drawbutton(69,425,400,15,false);  { user info panal }
           setcolor(0);
           outtextxy(77,429,'PenUp Activated (Press [Q] to return) ');
            end;
            end;
        PenDown :
         begin
          readyToDraw :=true;
          topbuttonsup;
          icons2;
          rightbuttonsup;
          drawbutton(520,150,24,24,false);
          icons;
          drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
          outtextxy(77,429,'PenDown - PenUp Deactivated');
        end;

       ChangeWindows :
         begin
           drawbutton(69,425,400,15,false);  { user info panal }
           setcolor(0);
           outtextxy(77,429,'Change Windows Appearence [y] or [n]');
           anykey:=readkey;
           if anykey  = 'y' then
            begin
              wincolor:=color;
              setfillstyle(solidfill,wincolor);
              Mainwindow;
              drawingwindow;
              colors;
              drawdate;
              drawbutton(69,425,400,15,false);  { user info panal }
              setcolor(wincolor+1);
              outtextxy(77,429,'Windows Appearence has been changed :*)');
           end
           else
           begin
              Drawbutton(69,425,400,15,false);  { user info panal }
              setcolor(0);
              outtextxy(77,429,'Contiune Drawing :*)');
           end;
        end;
        over : startover;
      gridOn:
        begin
          topbuttonsup;
          icons2;
          rightbuttonsup;
          icons;
          drawbutton(490,150,24,24,false);
          icons;
          grids;
          drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
          outtextxy(77,429,'Grid has been Activated :-) ');
         end;
        cir :
          begin
            topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
            drawbutton(490,210,24,24,false);    {cirle button down}
            icons;                              { redraw icons }
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(black);
           outtextxy(72,430,'Are you sure you want to draw a circle [y]or[n]');
           anykey:=readkey;
          if anykey = 'n' then
         begin
            drawbutton(69,425,400,15,false);      { user info panal }
            setcolor(black);
            outtextxy(72,430,'Continue');
            exit;
        end
       else
          if anykey = 'y' then
           begin
              drawbutton(69,425,400,15,false);  { user info panal }
              setcolor(0);
              outtextxy(77,429,'Enter the radius of the circle (integer)');
              gotoxy(1,1);
              readln(z);
              gotoxy(1,1);
              setfillstyle(solidfill,0);
              bar(0,0,58,440);
            end;
            if (z < 0) or ( z > 51 ) then
             begin
              repeat
                drawbutton(69,425,400,15,false);  { user info panal }
                setcolor(0);
                outtextxy(77,429,'Enter radius within pixels 0-50, integer');
                gotoxy(1,1);
                 readln(z);
                 gotoxy(1,1);
                setfillstyle(solidfill,0);
                bar(0,0,58,440);
              until  (z > 0) and ( z < 51 );
            end;
              drawbutton(69,425,400,15,false);  { user info panal }
              setcolor(0);
              outtextxy(77,429,'Filled or Non-filled [Y] or [N]');
              anykey:=readkey;
              if anykey = 'n' then
                 begin
                  setcolor(color);
                  circle(x,y,z );
                  drawbutton(69,425,400,15,false);  { user info panal }
                  setcolor(0);
                  outtextxy(77,429,'Drawing a Circle (NON-FILLED)');
                  exit;
                 end
                  else
                   begin
                   setcolor(0);
                   circle(x,y,z );
                   setfillstyle(solidfill,color);
                   floodfill(x,y,0);
                   drawbutton(69,425,400,15,false);  { user info panal }
                   setcolor(0);
                   outtextxy(77,429,'Drawing a Circle (FILLED)');
                   exit;
                   end;
                   end;
           ac:begin
            topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
            drawbutton(490,240,24,24,false);
            icons;
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(black);
           outtextxy(72,430,'Are you sure you want to draw an arc [y]or[n]');
           anykey:=readkey;
          if anykey = 'n' then
         begin
            drawbutton(69,425,400,15,false);      { user info panal }
            setcolor(black);
            outtextxy(72,430,'Continue');
            exit;
        end
       else
          if anykey = 'y' then
           begin
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(0);
            outtextxy(77,429,'Enter the radius (integer)');
               gotoxy(1,1);
            readln(z);
               gotoxy(1,1);
            setfillstyle(solidfill,0);
            bar(0,0,58,440);
            if (z > 101) or (z < 0) then
             begin
              repeat
                drawbutton(69,425,400,15,false);  { user info panal }
                setcolor(0);
                outtextxy(77,429,'Enter a X radius within pixels (0-100)');
                   gotoxy(1,1);
                readln(z);
                   gotoxy(1,1);
                setfillstyle(solidfill,0);
                bar(0,0,58,440);
             until (z < 101) and (z > 0)
             end;
             setcolor(color);
             arc(x,y , 0 , 90 , z);
             drawbutton(69,425,400,15,false);  { user info panal }
             setcolor(0);
             outtextxy(77,429,'Drawing an Arc');
            end;
        end;
        ell:
          begin
            begin
            topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
             drawbutton(520,240,24,24,false);
             icons;
             drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(black);
           outtextxy(72,430,'Do you want to draw an ellipse [y]or[n]');
           anykey:=readkey;
          if anykey = 'n' then
         begin
            drawbutton(69,425,400,15,false);      { user info panal }
            setcolor(black);
            outtextxy(72,430,'Continue');
            exit;
        end
       else
          if anykey = 'y' then
           begin
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(0);
            outtextxy(77,429,'Enter the X radius (integer)');
               gotoxy(1,1);
            readln(z);
               gotoxy(1,1);
            setfillstyle(solidfill,0);
            bar(0,0,58,440);
            if (z > 101) or (z < 0) then
             begin
              repeat
                drawbutton(69,425,400,15,false);  { user info panal }
                setcolor(0);
                outtextxy(77,429,'Enter a X radius within pixels(0-100)');
                   gotoxy(1,1);
                readln(z);
                   gotoxy(1,1);
                setfillstyle(solidfill,0);
                bar(0,0,58,440);
              until (z < 101) and (z > 0)
            end;
          drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(black);
          outtextxy(77,429,'Enter the Y Radius (integer)');
             gotoxy(1,1);
          readln(c);
             gotoxy(1,1);
          setfillstyle(solidfill,0);
          bar(0,0,58,440);
          if (c > 101) or (c < 0)  then
            repeat
              drawbutton(69,425,400,15,false);  { user info panal }
              setcolor(0);
              outtextxy(77,429,'Enter a Y radius within pixels (0-100)');
                 gotoxy(1,1);
              readln(c);
                 gotoxy(1,1);
              setfillstyle(solidfill,0);
              bar(0,0,58,440);
           until  (c < 101) and (c > 0);
           end;
           drawbutton(69,425,400,15,false);  { user info panal }
           setcolor(0);
           outtextxy(77,429,'Filled or Non-filled [Y] or [N]');
             anykey:=readkey;
              if anykey = 'n' then
               begin
                setcolor(color);
                ellipse(x,y,0,360,z,c);
                drawbutton(69,425,400,15,false);  { user info panal }
                setcolor(0);
                outtextxy(77,429,'Drawing an Ellipse ( NON-FILLED)');
               end
              else
                begin
                setcolor(0);
                ellipse(x,y,0,360,z,c);
                setfillstyle(solidfill,color);
                floodfill(x,y,0);
                drawbutton(69,425,400,15,false);  { user info panal }
                setcolor(0);
                outtextxy(77,429,'Drawing an Ellipse (FILLED)');
                end;
           end;
         end;
       rect:
           begin
            topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
            drawbutton(520,210,24,24,false);
            icons;
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(black);
            outtextxy(72,430,'Do you want to draw a rectangle [y]or[n]');
            anykey:=readkey;
           if anykey = 'n' then
             begin
               drawbutton(69,425,400,15,false);      { user info panal }
               setcolor(black);
               outtextxy(72,430,'Continue');
              exit;
           end
       else
          if anykey = 'y' then
              drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(0);
            outtextxy(77,429,'Enter the X pixel position (integer)');
               gotoxy(1,1);
            readln(z);
               gotoxy(1,1);
            setfillstyle(solidfill,0);
            bar(0,0,58,440);
            if (z > 455) or (z < 80) then
             begin
              repeat
                drawbutton(69,425,400,15,false);  { user info panal }
                setcolor(0);
                outtextxy(77,429,'Enter a X within (80-455)');
                   gotoxy(1,1);
                readln(z);
                   gotoxy(1,1);
                setfillstyle(solidfill,0);
                bar(0,0,58,440);
              until (z < 455) or (z > 80)
            end;
          drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(black);
          outtextxy(77,429,'Enter the Y pixel position (integer)');
             gotoxy(1,1);
          readln(c);
             gotoxy(1,1);
          setfillstyle(solidfill,0);
          bar(0,0,58,440);
          if (c > 402) or (c < 121)  then
            repeat
              drawbutton(69,425,400,15,false);  { user info panal }
              setcolor(0);
              outtextxy(77,429,'Enter a Y within (121-402)');
                 gotoxy(1,1);
              readln(c);
                 gotoxy(1,1);
              setfillstyle(solidfill,0);
              bar(0,0,58,440);
           until  (c < 402) or (c > 121);
             setcolor(color);
             rectangle(x,y,z,c);
             drawbutton(69,425,400,15,false);  { user info panal }
             setcolor(0);
             outtextxy(77,429,'Drawing a Rectangle');
            end;
       tri:
         begin
            topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(black);
           outtextxy(72,430,'Do you want to draw a Triangle [y]or[n]');
           anykey:=readkey;
           if anykey = 'n' then
              begin
               drawbutton(69,425,400,15,false);      { user info panal }
               setcolor(black);
               outtextxy(72,430,'Continue');
             exit;
        end
       else
          if anykey = 'y' then
           begin
            drawbutton(490,270,24,24,false);
            icons;
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(0);
            outtextxy(77,429,'Enter the height and width (integer)');
               gotoxy(1,1);
            readln(z,c);
               gotoxy(1,1);
            setfillstyle(solidfill,0);
            bar(0,0,58,440);
            if (z > 101) or (z < 0) or (c>101) or (c<0) then
             begin
              repeat
                drawbutton(69,425,400,15,false);  { user info panal }
                setcolor(0);
                outtextxy(77,429,'Enter a height and width within (0-100)');
                   gotoxy(1,1);
                readln(z,c);
                   gotoxy(1,1);
                setfillstyle(solidfill,0);
                bar(0,0,58,440);
              until (z < 101) and (z > 0) and (c < 101) and (c > 0);
              end;
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(0);
            outtextxy(77,429,'Filled or Non-filled [Y] or [N]');
            anykey:=readkey;
            if anykey = 'n' then
               begin
                 line(x,y,x-z,y+c);
                 line(x,y,x+z,y+c);
                 line(x-z,y+c,x+z,y+c);
                 end
              else
                begin
                 line(x,y,x-z,y+c);
                 line(x,y,x+z,y+c);
                 line(x-z,y+c,x+z,y+c);
                 setcolor(0);
                 setfillstyle(solidfill,color) ;
                 floodfill(x,y+2,0);
                end;
            end;
            end;
        Poly:
          begin
            topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(black);
            outtextxy(72,430,'Are you sure you want to draw a poly [y]or[n]');
            anykey:=readkey;
          if anykey = 'n' then
             begin
              drawbutton(69,425,400,15,false);      { user info panal }
              setcolor(black);
              outtextxy(72,430,'Continue');
             exit;
        end
       else
          if anykey = 'y' then
           begin
            drawbutton(520,270,24,24,false);
            icons;
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(0);
            outtextxy(77,429,'Enter the height and width (integer)');
               gotoxy(1,1);
            readln(z,c);
               gotoxy(1,1);
            if (z > 51) or (z < 0) or (c > 51) or (c < 0) then
             begin
              repeat
                drawbutton(69,425,400,15,false);  { user info panal }
                setcolor(0);
                outtextxy(77,429,'Enter a height and width within (0-50)');
                   gotoxy(1,1);
                readln(z,c);
                   gotoxy(1,1);
                setfillstyle(solidfill,0);
                bar(0,0,58,440);
              until (z < 51) and (z > 0) and (c<51) and (c>0);
            end;
            setfillstyle(solidfill,0);
            bar(0,0,58,440);
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(0);
            outtextxy(77,429,'Filled or Non-filled [Y] or [N]');
            anykey:=readkey;
            if anykey = 'n' then
               begin
                 line(x,y,x-z,y+c);
                 line(x,y,x+z,y+c+z);
                 line(x-z,y+c,x+z,y+c+z)  ;
               end
                else
                begin
                 line(x,y,x-z,y+c);
                 line(x,y,x+z,y+c+z);
                 line(x-z,y+c,x+z,y+c+z);
                 setcolor(0);
                 setfillstyle(solidfill,color) ;
                 floodfill(x,y+2,0);
                end;
              end;
           end;
         ChangeBK:
         begin
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(red);
            outtextxy(77,429,'Warning will erase all previous work,Continue Y-N');
            setfillstyle(solidfill,0); {covers the readln text}
            bar(0,0,58,440);
            topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
            drawbutton(121,70,20,20,false);
            icons2;
            drawwinflag(254,73);
            anykey:=readkey;
           if anykey = 'y' then
              begin
              drawbutton(69,425,400,15,false);  { user info panal }
              setcolor(0);
              outtextxy(77,429,'Background Changed');
              drawbutton(71,97,397,317,true);{ for now draw window}
              setfillstyle(solidfill,blue);
              bar(76,100,462,112);
              setcolor(white);
              outtextxy(80,103,'NoName00');
              drawbutton(80,120,377,284,false);
              setfillstyle(solidfill,color);
              bar(82,122,455,402);
                SetTextStyle(defaultfont, vertdir,1);
                setcolor(lightblue);
                outtextxy(80,125,'125');
                outtextxy(80,175,'175');
                outtextxy(80,225,'225');
                outtextxy(80,275,'275');
                outtextxy(80,325,'325');
                outtextxy(80,375,'375');
           settextstyle(defaultfont, horizdir,1);
           outtextxy(85,406,'85');
            outtextxy(115,406,'115');
           outtextxy(155,406,'155');
            outtextxy(195,406,'195');
           outtextxy(235,406,'235');
          outtextxy(275,406,'275');
           outtextxy(315,406,'315');
          outtextxy(355,406,'355');
          outtextxy(395,406,'395');
          outtextxy(435,406,'415');

        end
             else
              if anykey = 'n' then
              drawbutton(69,425,400,15,false);  { user info panal }
              setcolor(0);
              outtextxy(77,429,'                    < Continue Drawing >');
            end;
            dia : begin
                X := x+1;
                y := y-1;
               if (y < 121) or (y > 402)  then
                y:= 402;
                 if  (x > 455) or ( x < 80) then
                x:= 80;
                drawbutton(490,180,24,24,false);
              icons;
             if buttonchanged then begin
             drawbutton(69,425,400,15,false);  { user info panal }
             setcolor(0);
             outtextxy(77,429,'Drawing Diagonally (/-Up)');
              end;
              end;

       dia2 : begin

               X := x - 1;
               y := y - 1;
               if ( y < 121) or (y > 402) then
                  y:=402;
                if (x > 455) or (x < 80) then
                    x := 80;
               drawbutton(490,180,24,24,false);
              icons;
                 if buttonchanged then begin
             drawbutton(69,425,400,15,false);  { user info panal }
             setcolor(0);
             outtextxy(77,429,'Drawing Diagonally (\-Up)');
             end;
             end;
      dia3 : begin

              X := x-1;
              y := y+1;
               if (y < 121) or (y > 402)  then
                y:= 402;
                 if  (x > 455) or ( x < 80) then
                x:= 80;
                    drawbutton(490,180,24,24,false);
              icons;
             if buttonchanged then begin
            drawbutton(69,425,400,15,false);  { user info panal }
             setcolor(0);
             outtextxy(77,429,'Drawing Diagonally (/-down)');
             end;
             end;
      dia4 : begin

              X := x+1;
              y := y+1;
              if (y < 121) or (y > 402)  then
               y:= 402;
                if  (x > 455) or ( x < 80) then
              x:= 80;
                  drawbutton(490,180,24,24,false);
              icons;
                 if buttonchanged then begin
                 drawbutton(69,425,400,15,false);  { user info panal }
             setcolor(0);
             outtextxy(77,429,'Drawing Diagonally (\-down)');
            end;
            end;
        dotdia : begin

                X := x+3;
                y := y-3;
               if (y < 121) or (y > 402)  then
                y:= 402;
                 if  (x > 455) or ( x < 80) then
                x:= 80;
                drawbutton(520,180,24,24,false);
                icons;
                   if buttonchanged then begin
             drawbutton(69,425,400,15,false);  { user info panal }
             setcolor(0);
             outtextxy(77,429,'Drawing Diagonally (/-Up) (dotted)');
              end;
              end;
       dotdia2 : begin

               X := x - 3;
               y := y - 3;
               if ( y < 121) or (y > 402) then
                  y:=402;
                if (x > 455) or (x < 80) then
                    x := 80;
                       drawbutton(520,180,24,24,false);
                icons;
                   if buttonchanged then begin
             drawbutton(69,425,400,15,false);  { user info panal }
             setcolor(0);
             outtextxy(77,429,'Drawing Diagonally (\-Up) (dotted)');
             end;
             end;
      dotdia3 : begin

              X := x-3;
              y := y+3;
               if (y < 121) or (y > 402)  then
                y:= 402;
                 if  (x > 455) or ( x < 80) then
                x:= 80;
                   drawbutton(520,180,24,24,false);
                icons;
               if buttonchanged then begin
            drawbutton(69,425,400,15,false);  { user info panal }
             setcolor(0);
             outtextxy(77,429,'Drawing Diagonally (/-down) (dotted)');
             end;
             end;
      dotdia4 : begin

              X := x+3;
              y := y+3;
              if (y < 121) or (y > 402)  then
               y:= 402;
                if  (x > 455) or ( x < 80) then
              x:= 80;
                 drawbutton(520,180,24,24,false);
                icons;
                   if buttonchanged then begin
               drawbutton(69,425,400,15,false);  { user info panal }
             setcolor(0);
             outtextxy(77,429,'Drawing Diagonally (\-down) (dotted)');
            end;
      end;
      Time:
        begin
         drawbutton(69,425,400,15,false);  { user info panal }
         setcolor(0);
         outtextxy(77,429,'Time is being Viewed -------------------------->');
         topbuttonsup;
         icons2;
         rightbuttonsup;
         icons;
         drawtime;
       end;

     helpfile:
         begin
           topbuttonsup;
         icons2;
         rightbuttonsup;
         icons;
         drawbutton(69,425,400,15,false);  { user info panal }
         setcolor(0);
         outtextxy(77,429,'Help file is being Viewed    ? ? ? ? ? ? ? ?');
            drawbutton(277,70,20,20,false);
         icons2;
         drawwinflag(254,73);
         drawbutton(485,117,200,180,true);
          setfillstyle(solidfill,blue);
          bar(495,125,615,136);
          setcolor(white);
          outtextxy(500,128,'HelpFile');
          setcolor(0);
          outtextxy(500,150,'   Content');
          outtextxy(495,190,'Hotkeys [H]');
          outtextxy(495,210,'Tips [\] ');
          outtextxy(495,230,'TroubleShooting[W] ');
          outtextxy(495,250,'About Doodle 2 []]');
          getcommand(command);
          performcommand(command,x,y,readytodraw);
        {  key:=readkey;}
          setfillstyle(solidfill,black);
          bar(559,117,680,400);
          drawbutton(485,117,73,180,false);
          drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
          outtextxy(77,429,'Help Menu Closed');
             topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
          end;
hotkeys:
       begin
          topbuttonsup;
          icons2;
          rightbuttonsup;
          icons;
          drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
          outtextxy(77,429,'Hotkeys are being Viewed [menu 1]');
          drawbutton(199,70,20,20,false);
          icons2;
          drawbutton(485,117,200,180,true);
          setfillstyle(solidfill,blue);
          bar(495,125,615,136);
          setcolor(white);
          outtextxy(500,128,'Hotkeys :');
          setcolor(0);
          Outtextxy(490,140,'[8] moveup');
          outtextxy(490,150,'[2] movedown');
          outtextxy(490,160,'[4] moveleft');
          outtextxy(490,170,'[6] moveright');
          outtextxy(490,180,'[9] dotright');
          outtextxy(490,190,'[7] dotleft');
          Outtextxy(490,200,'[1] dotUp');
          outtextxy(490,210,'[3] dotdown');
          outtextxy(490,220,'[P] penup');
          outtextxy(490,230,'[Q] pendown');
          outtextxy(490,240,'[Esc] Exit');
          outtextxy(490,250,'[N] startover');
          Outtextxy(490,260,'[G] GridOn');
          outtextxy(490,270,'[C] circle');
          outtextxy(490,280,'[R] rectangle');
          outtextxy(610,288,'[>]');
          key:=readkey;
          setfillstyle(solidfill,black);
          bar(559,117,680,400);
          drawbutton(485,117,73,180,false);
              topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
      if key = '>'  then
       begin
          drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
          outtextxy(77,429,'Hotkeys are being Viewed [menu 2]');
          drawbutton(485,117,200,180,true);
          setfillstyle(solidfill,blue);
          bar(495,125,615,136);
          setcolor(white);
          outtextxy(500,128,'Hotkeys :');
          setcolor(0);
          outtextxy(490,140,'[L] ellipse');
          outtextxy(490,150,'[A] arc');
          outtextxy(490,160,'[T] diagonal (/)');
          Outtextxy(490,170,'[U] diagonal (\)');
          outtextxy(490,180,'[Y] diagonal (/)');
          outtextxy(490,190,'[I] diagonal (\)');
          outtextxy(490,200,'[M] dotdiagonal(/)');
          outtextxy(490,210,'[,] dotdiagonal(\)');
          outtextxy(490,220,'[.] dotdiagonal(/)');
          Outtextxy(490,230,'[/] dotdiagonal(\)');
          outtextxy(490,240,'[!] Color1');
          outtextxy(490,250,'[@] Color2');
          outtextxy(490,260,'[#] Color3');
          outtextxy(490,270,'[$] Color4');
          outtextxy(490,280,'[%] Color5');
          outtextxy(610,288,'[>]') ;
          key:=readkey;
          setfillstyle(solidfill,black);
          bar(559,117,680,400);
          drawbutton(485,117,73,180,false);
           topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
          end;
      if key = '>'  then
       begin
           drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
          outtextxy(77,429,'Hotkeys are being Viewed [menu 3]');
          drawbutton(485,117,200,180,true);
          setfillstyle(solidfill,blue);
          bar(495,125,615,136);
          setcolor(white);
          outtextxy(500,128,'Hotkeys :');
          setcolor(0);
          Outtextxy(490,140,'[^] Color6');
          outtextxy(490,150,'[&] Color7');
          outtextxy(490,160,'[*] Color8');
          outtextxy(490,170,'[(] Color9');
          outtextxy(490,180,'[)] Color10');
          outtextxy(490,190,'[_] Color11');
          Outtextxy(490,200,'[+] Color12');
          outtextxy(490,210,'[[] Color13');
          outtextxy(490,220,'[]] Color14');
          outtextxy(490,230,'[|] Color15');
          outtextxy(490,240,'[O] Time');
          outtextxy(490,250,'[D] Triangle');
          Outtextxy(490,260,'[S] Poly');
          outtextxy(490,270,'[H] Hotkeys');
          outtextxy(490,280,'[F] File');
          outtextxy(610,288,'[>]');
          key:=readkey;
          setfillstyle(solidfill,black);
          bar(559,117,680,400);
          drawbutton(485,117,73,180,false);
            topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
          if key = '>'  then
       begin
           drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
          outtextxy(77,429,'Hotkeys are being Viewed [menu 4]');
          drawbutton(485,117,200,180,true);
          setfillstyle(solidfill,blue);
          bar(495,125,615,136);
          setcolor(white);
          outtextxy(500,128,'Hotkeys :');
          setcolor(0);
          outtextxy(490,140,'[K] ChangeBK');
          outtextxy(490,150,'[`] Edit');
          outtextxy(490,160,'[:] Shapes');
          outtextxy(490,170,'["] Options');
          outtextxy(490,180,'[?] Helpfile');
          outtextxy(490,190,'[[] Fullscreen');
          outtextxy(490,200,'[]] About Doodle2');
          outtextxy(490,210,'[\] Tips ');
          outtextxy(490,220,'[W] TroubleShooting');
          outtextxy(490,230,'[Z] Change Pen Size');
          outtextxy(490,240,'[~] Color Black');
          outtextxy(490,250,'[E] Window Color');
          outtextxy(550,288,'[>] to exit hotkeys');

          key:=readkey;
          setfillstyle(solidfill,black);
          bar(559,117,680,400);
          drawbutton(485,117,73,180,false);
          drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
          outtextxy(77,429,'Hotkeys Menu Closed');
            topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;

         end;
       end;
     end;

      filer:begin
      topbuttonsup;
      icons2;
       rightbuttonsup;
      icons;
       drawbutton(69,425,400,15,false);  { user info panal }
       setcolor(0);
       outtextxy(77,429,'File Menu is being Viewed');
       setfillstyle(solidfill,0);
       bar(0,0,58,440);
       drawwindow(0,45,59,100);    {File menu}
       outtextxy(8,70,'New');
       outtextxy(8,71,'_');
       outtextxy(8,85,'Exit');
       outtextxy(8,86,'_');
       outtextxy(3,130,'[enter]');
       outtextxy(8,51,'File >');
       drawline(7,64,50,64);
       key:=readkey;
       setfillstyle(solidfill,0);
       bar(0,0,58,440);
       drawbutton(69,425,400,15,false);  { user info panal }
       setcolor(0);
       outtextxy(77,429,'File Menu Closed');
      end;
   Edit:
     begin
       topbuttonsup;
       icons2;
       rightbuttonsup;
       icons;
       drawbutton(69,425,400,15,false);  { user info panal }
       setcolor(0);
       outtextxy(77,429,'Edit Menu is being Viewed');
       setfillstyle(solidfill,0);
       bar(0,0,58,440);
       drawwindow(0,45,59,130);    {Edit menu}
       outtextxy(8,80,'Back.. ');
       outtextxy(8,81,'   _');
       outtextxy(8,90,'ground');
       outtextxy(8,51,'Edit >');
       outtextxy(8,115,'Window');
       outtextxy(8,125,'Color');
       outtextxy(8,135,' [E]');
       outtextxy(3,155,'[enter]');
       drawline(7,64,50,64);
       key:=readkey;
       setfillstyle(solidfill,0);
       bar(0,0,58,440);
       drawbutton(69,425,400,15,false);  { user info panal }
       setcolor(0);
       outtextxy(77,429,'Edit Menu Closed');
       end;
    Shapes:
    begin
      topbuttonsup;
       icons2;
       rightbuttonsup;
      icons;
       drawbutton(69,425,400,15,false);  { user info panal }
       setcolor(0);
       outtextxy(77,429,'Shapes Menu is being Viewed');
       setfillstyle(solidfill,0);
       bar(0,0,58,440);
       drawwindow(0,45,59,160);    {Shapes menu}
       outtextxy(5,152,'Tri.[d]');
       outtextxy(5,153,' ');
       outtextxy(5,136,'Arc');
       outtextxy(5,137,'_');

       outtextxy(5,123,'Ellipse');
       outtextxy(5,124,'  _ ');

       outtextxy(5,110,'Poly[s]');

       outtextxy(5,83,'angle');
       outtextxy(5,73,'Rect..');
       outtextxy(5,76,'_');

       outtextxy(5,96,'Circle');
       outtextxy(5,97,'_');

       outtextxy(5,51,'Shape>');
       outtextxy(3,190,'[enter]');
       drawline(7,64,50,64);
       key:=readkey;
       setfillstyle(solidfill,0);
       bar(0,0,58,440);
       drawbutton(69,425,400,15,false);  { user info panal }
       setcolor(0);
       outtextxy(77,429,'Shapes Menu Closed');
      end;
     Options:
     begin
        topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
       drawbutton(69,425,400,15,false);  { user info panal }
       setcolor(0);
       outtextxy(77,429,'Options Menu is being Viewed');
       setfillstyle(solidfill,0);
       bar(0,0,58,440);
       drawwindow(0,45,59,100);    {Shapes menu}
       outtextxy(8,70,' Full');
       outtextxy(8,79,'Screen');
       outtextxy(8,92,'< [ >');
       outtextxy(5,51,'Opiton>');
       outtextxy(3,130,'[enter]');
       drawline(7,64,50,64);
       key:=readkey;
       setfillstyle(solidfill,0);
       bar(0,0,58,440);
       drawbutton(69,425,400,15,false);  { user info panal }
       setcolor(0);
       outtextxy(77,429,'Options Menu Closed');
       end;
    fullscreen:
        begin
          topbuttonsup;
          icons2;
          drawbutton(147,70,20,20,false);
          icons2;
          drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(red);
          outtextxy(77,429,'WARNING - No return to Drawing [Y] [N]');
          anykey:=readkey;
          if anykey = 'y' then
           begin
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(red);
            outtextxy(77,429,'FullScreen Activated');
            drawwinflag(254,73);
            delay(1000);
            setfillstyle(solidfill,0);
            bar(0,0,640,122);
            bar(0,0,82,480);
            bar(640,0,455,440);
            bar(0,480,640,402);
            outtextxy(350,440,'Press <Enter> to Exit Program');
            settextstyle(7,horizdir,8);
            setcolor(red);
            outtextxy(60,20,' Doodle 2');
            key:=readkey;
            closegraph;
           mainwindow;
            end
          else
           begin
            topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(0);
            outtextxy(77,429,'Continue Drawing');
            end;
         end;
        About:
           begin
            drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(0);
            outtextxy(77,429,'Program Information is being Viewed');
            topbuttonsup;
            icons2;
            drawbutton(251,70,20,20,false);
            icons2;
            drawwinflag(254,73);
            drawbutton(485,117,200,180,true);
            setfillstyle(solidfill,blue);
            bar(495,125,615,136);
            setcolor(white);
            outtextxy(500,128,'About Doodle 2');
            setcolor(0);
            outtextxy(500,150,'   Doodle II');
            outtextxy(495,170,'Written by:');
            outtextxy(495,190,'Joe Costa');
            outtextxy(495,200,'Grade:12(OAC)');
            outtextxy(495,220,'Block: [F]');
            outtextxy(495,230,'Due: 30/04/98');
            outtextxy(495,250,'Email:Assman_2@');
            outtextxy(495,260,'hotmail.com');
            key:=readkey;
            setfillstyle(solidfill,black);
            bar(559,117,680,400);
           drawbutton(485,117,73,180,false);
           drawbutton(69,425,400,15,false);  { user info panal }
           setcolor(0);
          outtextxy(77,429,'About Doodle2 Menu Closed');
          topbuttonsup;
          icons2;
          rightbuttonsup;
         icons;
          end;
      tips:
       begin
          drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
           outtextxy(77,429,'Tips are being Viewed');
           topbuttonsup;
           icons2;
           drawbutton(225,70,20,20,false);
           icons2;
           drawwinflag(254,73);
           drawbutton(485,117,200,180,true);
           setfillstyle(solidfill,blue);
           bar(495,125,615,136);
           setcolor(white);
           outtextxy(500,128,'Tips');
           setcolor(0);
           outtextxy(490,150,'Use 2D shapes');
           outtextxy(490,170,'consecutively to');
           outtextxy(490,190,'create 3D images.');
           outtextxy(490,210,'Use the rectangle');
           outtextxy(490,230,'consecutively to');
           outtextxy(490,250,'create spreadsheet');
           outtextxy(490,270,'cells.');
           key:=readkey;
           setfillstyle(solidfill,black);
           bar(559,117,680,400);
           drawbutton(485,117,73,180,false);
           drawbutton(69,425,400,15,false);  { user info panal }
           setcolor(0);
           outtextxy(77,429,'Tips Menu Closed');
           topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
           end;
      Troubleshooting:
           begin
           topbuttonsup;
           icons2;
           rightbuttonsup;
           icons;
           drawbutton(69,425,400,15,false);  { user info panal }
           setcolor(0);
           outtextxy(77,429,'Troubleshooting Content is being Viewed');
           drawbutton(485,117,200,180,true);
           setfillstyle(solidfill,blue);
           bar(495,125,625,136);
           setcolor(white);
           outtextxy(500,128,'TroubleShooting:');
           setcolor(0);
           outtextxy(490,150,'Shape not');
           outtextxy(490,163,'filling in.');
           outtextxy(490,173,'- change position');
           outtextxy(490,183,'- change color');
           outtextxy(490,193,'- change Pen (z)');
           outtextxy(490,204,'Command does not');
           outtextxy(490,213,'activate.');
           outtextxy(490,223,'- Press key 2x');
           outtextxy(490,233,'- Use another key');
           outtextxy(490,243,'Program stalls.');
           outtextxy(490,253,'- Try other commands');
           outtextxy(490,263,'- Press Ctrl Break');
           outtextxy(490,273,'- Press Ctrl [Z]');

           outtextxy(610,288,'[>]');
           key:=readkey;
           setfillstyle(solidfill,black);
           bar(559,117,680,400);
           drawbutton(485,117,73,180,false);
              topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
          if key = '>'  then
         begin
          drawbutton(69,425,400,15,false);  { user info panal }
          setcolor(0);
          outtextxy(77,429,'Troubleshooting Content is being Viewed [menu 2]');
          drawbutton(485,117,200,180,true);
          setfillstyle(solidfill,blue);
          bar(495,125,625,136);
          setcolor(white);
          outtextxy(500,128,'TroubleShooting:');
          setcolor(0);
           outtextxy(490,150,'  Caps LOCK OFF');
           outtextxy(490,163,'     ALWAYS');
           outtextxy(490,173,'');
           outtextxy(490,183,'Cursor Unseen');
           outtextxy(490,193,' -Press [q]');
           outtextxy(490,203,' -Change Color');
           outtextxy(490,213,'When changing');
           outtextxy(490,223,'Window Appearence');
           outtextxy(490,233,' -choose color 1st');
           outtextxy(490,243,'Using PenUp/down');
           outtextxy(490,253,' -Must be using ');
           outtextxy(490,263,'  small pen');
           Outtextxy(490,270,'');
           setcolor(0);
           key:=readkey;
           setfillstyle(solidfill,black);
           bar(559,117,680,400);
           drawbutton(485,117,73,180,false);
            topbuttonsup;
            icons2;
            rightbuttonsup;
            icons;
           drawbutton(69,425,400,15,false);  { user info panal }
            setcolor(0);
            outtextxy(77,429,'TroubleShooting Menu Closed');
          end;
      end;
     C0:begin
           colors;  { draw all false}
           color := 0;
           drawbutton(69,425,400,15,false);  { user info panal }
           setcolor(0);
           outtextxy(77,429,'Color Black Activated');
        end;
     C1:
      begin
          colors;  { draw all false}
           color := 1;
           drawbutton(490,400,15,15,false);
           setfillstyle(solidfill,1);
           bar(492,402,503,414);
             drawbutton(69,425,400,15,false);  { user info panal }
           setcolor(0);
           outtextxy(77,429,'Color Blue Activated');
         end;
      C2: begin

      colors;
         color:=2;
         drawbutton(510,400,15,15,false);
         setfillstyle(solidfill,2);
         bar(512,402,523,414);
         drawbutton(69,425,400,15,false);  { user info panal }
         setcolor(0);
         outtextxy(77,429,'Color Green Activated');
       end;
     C3: begin
     colors;
        color:=3;
        drawbutton(530,400,15,15,false);
        setfillstyle(solidfill,3);
       bar(532,402,543,414);
         drawbutton(69,425,400,15,false);  { user info panal }
           setcolor(0);
           outtextxy(77,429,'Color Cyan Activated');
     end;
   C4:begin
   colors;
      color:=4;
       drawbutton(490,380,15,15,false);
     setfillstyle(solidfill,4);
      bar(492,382,503,394);
      drawbutton(69,425,400,15,false);  { user info panal }
      setcolor(0);
      outtextxy(77,429,'Color Red Activated');
    end;
  C5:begin
  colors;
     color:=5;
  drawbutton(510,380,15,15,false);
   setfillstyle(solidfill,5);
  bar(512,382,523,394);
    drawbutton(69,425,400,15,false);  { user info panal }
    setcolor(0);
    outtextxy(77,429,'Color Magenta Activated');
  end;
  C6:begin
    colors;
    color:=6;
      drawbutton(530,380,15,15,false);
  setfillstyle(solidfill,6);
  bar(532,382,543,394);
    drawbutton(69,425,400,15,false);  { user info panal }
    setcolor(0);
    outtextxy(77,429,'Color Brown Activated');
  end;
  C7:begin
      colors;
      color:=7;
        drawbutton(490,360,15,15,false);
  setfillstyle(solidfill,7);
  bar(492,362,503,374);
    drawbutton(69,425,400,15,false);  { user info panal }
    setcolor(0);
    outtextxy(77,429,'Color Lightgray Activated');
   end;
   C8:begin
      colors;
        color:=8;
        drawbutton(510,360,15,15,false);          {set of color}
         setfillstyle(solidfill,8);
        bar(512,362,523,374);
          drawbutton(69,425,400,15,false);  { user info panal }
           setcolor(0);
           outtextxy(77,429,'Color Darkgray Activated');
        end;
   C9:begin
     colors;
     color:=9;
      drawbutton(530,360,15,15,false);
  setfillstyle(solidfill,9);           { C9 }
  bar(532,362,543,374);
    drawbutton(69,425,400,15,false);  { user info panal }
   setcolor(0);
   outtextxy(77,429,'Color LightBlue Activated');
  end;
  C10:begin
     colors;
     color:=10;
       drawbutton(490,340,15,15,false);
     setfillstyle(solidfill,10);            { C 10 }
    bar(492,342,503,354);
      drawbutton(69,425,400,15,false);  { user info panal }
      setcolor(0);
      outtextxy(77,429,'Color LightGreen Activated');
    end;
  C11:begin
    colors;
    color:=11;
       drawbutton(510,340,15,15,false);
  setfillstyle(solidfill,11);             { C11 }
  bar(512,342,523,354);
    drawbutton(69,425,400,15,false);  { user info panal }
    setcolor(0);
    outtextxy(77,429,'Color LightCyan Activated');
    end;
  C12:begin
     colors;
     color:=12;
      drawbutton(530,340,15,15,false);
  setfillstyle(solidfill,12);            { C12 }
  bar(532,342,543,354);
    drawbutton(69,425,400,15,false);  { user info panal }
    setcolor(0);
    outtextxy(77,429,'Color LightRed Activated');
   end;
   C13: begin
      colors;
       color:=13;
        drawbutton(490,320,15,15,false);
      setfillstyle(solidfill,13);            { C13 }
  bar(492,322,503,334);
    drawbutton(69,425,400,15,false);  { user info panal }
     setcolor(0);
     outtextxy(77,429,'Color LightMagenta Activated');
   end;
   C14:begin
       colors;
       color:=14;
         drawbutton(510,320,15,15,false);
      setfillstyle(solidfill,14);           { C14 }
      bar(512,322,523,334);
        drawbutton(69,425,400,15,false);  { user info panal }
        setcolor(0);
        outtextxy(77,429,'Color Yellow Activated');
     end;
   C15:begin
     colors;
      color:=15;
     drawbutton(530,320,15,15,false);
    setfillstyle(solidfill,15);            { C15 }
    bar(532,322,543,334);
    drawbutton(69,425,400,15,false);  { user info panal }
    setcolor(0);
    outtextxy(77,429,'Color White Activated');
  end;
     end;
   if readyToDraw
    then
      PutPixel (x,y,color);

  end;

{============================== MAIN =======================================}
begin
  detectgraph (device, mode);
  initgraph (device, mode, 'C:\bgi');
  readyToDraw := true;
  x := 268;
  y := 262;
  wincolor:=lightgray;
  Mainwindow;
  drawwinflag(254,73);  { winflag on button 10 -top }                                                     {{{{{ colors }
  colors;
  drawdate;
  settextstyle(3,horizdir,3);
  setcolor(red);
  outtextxy(130,200,' TURN ON NUM LOCK');
  outtextxy(130,170,'TURN OFF CAPS LOCK');
  setcolor(lightgreen);
  settextstyle(7,horizdir,5);
  outtextxy(170,100,'DOODLE II');
  setcolor(0);
  settextstyle(defaultfont,horizdir,1);
  outtextxy(80,240,'Use the Num Pad Directional keys.');
  outtextxy(80,250,'When filling shapes enter the color first');
  outtextxy(80,260,'and choose a color other than black.');
  outtextxy(80,270,'When entering data-Look at the top left corner');
  outtextxy(80,280,'for the prompt location.');
  outtextxy(80,290,'Be carefull when entering data, do not try to do');
  outtextxy(80,300,'two things at a time, the system may crash.');
  outtextxy(80,310,'For example if you enter a command, and half way');
  outtextxy(80,320,'you decide not to use the feature, the program ');
  outtextxy(80,330,'is proceeding with the command');
  outtextxy(80,340,'    Therefore it will stall');
  outtextxy(80,350,'In most incidences there will be a warning on');
  outtextxy(80,360,'command - Make sure you read dialog box always');
  outtextxy(90,150,'Readme File :');
  outtextxy(370,388,'Doodle II');
  outtextxy(370,398,'By:Joe Costa');
  drawwinflag(250,393);
  setcolor(9);
  outtextxy(90,382,'Requires 386 DX or higher');
  outtextxy(90,395,'WinJoes Compatiable');
  pensize;
  pensizeicons;
  settextstyle(defaultfont,horizdir,1);
  repeat
    if anykey <> 'n' then
       setcolor(black);
       outtextxy(72,430,'Press <N> to Start a New Sheet ');
       anykey:=readkey;
   until anykey = 'n';
  drawingwindow;
  drawbutton(69,425,400,15,false);  { user info panal }
  setcolor(black);
  outtextxy(77,429,'Use NumPad to Draw - [z] changes pen size');

 GetCommand (Command);
 While cmdCH <> #27 do
   begin
      performCommand (command, x, y, readyToDraw);
      getCommand (command);
      str(x,v);
      v1:=v;             { v - string }
      str(y, v);
      v1:=v1+' '+v;
      setcolor(blue);
      setfillstyle(solidfill,Wincolor);
      bar(490,315,550,300);
      outtextxy(490,305,v1);
    end;
     drawwindow(150,150,248,238);
     drawbutton(160,180,228,188,false);
     setcolor(white);
     setfillstyle(solidfill,blue);
     bar(155,158,390,168);
     outtextxy(160,160,'Shut Down Doodle II');
     setcolor(black);
     drawbutton(180,227,190,47,false);
     setcolor(0);
     outtextxy(165,200,'    Thank-You For Using');
     outtextxy(200,300,'v0.02');
     outtextxy(200,310,'Programmer:Joe Costa');
     outtextxy(200,320,'Language:Turbo Pascal');
     outtextxy(200,330,'Publisher:Costa Design');
     SetTextStyle(7, horizdir,5);
     setcolor(blue);
     outtextxy(185,225,'Doodle 2');
     setTextStyle(defaultfont, horizdir,1);
     drawbutton(69,425,400,15,false);  { user info panal }
     setcolor(1);
     outtextxy(77,429,'<<<<<<< Email me @ assman_2@hotmail.com >>>>>>>>');
     readkey;
     closegraph;
    end.



