home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 October / Chip_1997-10_cd.bin / tema / sw602 / wintext / disk1 / data.1 / MARGINS.TXT < prev    next >
Text File  |  1994-10-11  |  2KB  |  81 lines

  1. Program Margins;
  2. // p°φklad pou₧itφ runtime funkcφ t²kajφcφch se okraj∙
  3.  
  4. const
  5.   first = 1;
  6.   next = 2;
  7.   last = 3;
  8.  
  9. var
  10.   ok : boolean;
  11.   l, r, t, b : real;
  12.  
  13. procedure GetInitialMarg;
  14. begin
  15.   l:=GetLeftMargin;
  16.   r:=GetRightMargin;
  17.   t:=GetTopMargin;
  18.   b:=GetBottomMargin;
  19. end;
  20.  
  21. procedure RestoreInitialMarg;
  22. begin
  23.   SetLeftMargin(l);
  24.   SetRightMargin(r);
  25.   SetTopMargin(t);
  26.   SetBottomMargin(b);
  27. end;
  28.  
  29. procedure zobraz_margins(nadpis : short);
  30. var 
  31.   S, Sp : string[255];
  32. begin
  33.  
  34.   S:="";
  35.   S:=S + "Left margin   "  +  Real2Str(GetLeftMargin, -2)  + #13#10;
  36.   S:=S + "Right margin  "  +  Real2Str(GetRightMargin, -2) + #13#10;
  37.   S:=S + "Top margin    "  +  Real2Str(GetTopMargin, -2)   + #13#10;
  38.   S:=S + "Bottom margin "  +  Real2Str(GetBottomMargin, -2);
  39.  
  40.   case nadpis of
  41.     first : Sp:="PoΦßteΦnφ : ";
  42.     next  : Sp:="Zm∞na na";
  43.     last  : Sp:="Poslednφ zm∞na"
  44.   end;
  45.  
  46.   Info_box(Sp, S);
  47. end;
  48.  
  49. function rozpul_margins : boolean;
  50. var
  51.   ok1, ok2, ok3, ok4 : boolean;
  52. begin
  53.   ok1:=SetLeftMargin(GetLeftMargin/2);
  54.   ok2:=SetRightMargin(GetRightMargin/2);
  55.   ok3:=SetTopMargin(GetTopMargin/2);
  56.   ok4:=SetBottomMargin(GetBottomMargin/2);
  57.   rozpul_margins:= ok1 and ok2 and ok3 and ok4;
  58. end;
  59.  
  60. begin
  61.   GetInitialMarg;
  62.   zobraz_margins(first);
  63.   repeat
  64.     ok:=rozpul_margins;
  65.     zobraz_margins(ok ? next : last);
  66.   until not ok;
  67.  
  68.   RestoreInitialMarg;
  69.  
  70.   if Yesno_box("", "Nastavit dialogem jinΘ hodnoty ?")
  71.   then case SetMargins(TRUE, l+1, r+1, t+1, b+1) of
  72.          IDOK : Info_box("", "Bylo IDOK");
  73.          IDCANCEL : Info_box("", "Bylo IDCANCEL");
  74.        end
  75.   else case SetMargins(FALSE, l*2, r*2, t*2, b*2) of
  76.           IDOK : Info_box("", "P∙vodni hodnoty "
  77.                               "byly zvojnßsobeny");
  78.           IDERROR :Info_box("", "P∙vodni hodnoty "
  79.                                 "nelze zvojnßsobit");
  80.        end;
  81. end.