Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
albireo77 committed Mar 22, 2020
1 parent bc62a56 commit eb0ddb1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 28 deletions.
14 changes: 6 additions & 8 deletions Blocks/Base_Block.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1415,10 +1415,9 @@ function TBlock.DrawTextLabel(x, y: integer; const AText: string; rightJust: boo
var
fontStyles: TFontStyles;
fontColor: TColor;
tw, th: integer;
te: TSize;
begin
tw := 0;
th := 0;
te := TSize.Create(0, 0);
if not AText.IsEmpty then
begin
fontStyles := Canvas.Font.Style;
Expand All @@ -1428,17 +1427,16 @@ function TBlock.DrawTextLabel(x, y: integer; const AText: string; rightJust: boo
if fsBold in fontStyles then
Canvas.Font.Style := Canvas.Font.Style + [fsBold];
Canvas.Brush.Style := bsClear;
tw := Canvas.TextWidth(AText);
th := Canvas.TextHeight(AText);
te := Canvas.TextExtent(AText);
if rightJust then
x := Max(x-tw, 0);
x := Max(x-te.Width, 0);
if downJust then
y := Max(y-th, 0);
y := Max(y-te.Height, 0);
Canvas.TextOut(x, y, AText);
Canvas.Font.Style := fontStyles;
Canvas.Font.Color := fontColor;
end;
result := TRect.Create(Point(x, y), tw, th);
result := TRect.Create(Point(x, y), te.Width, te.Height);
end;

procedure TBlock.DrawArrow(const aFrom, aTo: TPoint; AArrowPos: TArrowPosition = arrEnd; AColor: TColor = clNone);
Expand Down
33 changes: 13 additions & 20 deletions Blocks/ForDo_Block.pas
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ procedure TForDoBlock.SetDescOrder(AValue: boolean);

procedure TForDoBlock.Paint;
var
y, bhx, br1, br2: integer;
bhx, br1, br2, t: integer;
lShapeColor: TColor;
r: TRect;
begin
Expand All @@ -218,18 +218,19 @@ procedure TForDoBlock.Paint;
begin

bhx := Branch.Hook.X;
t := 16 + edtStart.Height div 2;
r := DrawTextLabel(bhx-97, t, FForLabel, false, true);

y := edtStart.Top + edtStart.Height - 6;
r := DrawTextLabel(bhx-97, y, FForLabel, false, true);
cbVar.Left := r.Right + 4;
edtVar.Left := cbVar.Left + 4;
cbVar.SetBounds(r.Right+4, 34-t, edtVar.Width+5, cbVar.Height);

r := DrawTextLabel(edtVar.Left + edtVar.Width+3, y, GInfra.CurrentLang.ForDoVarString, false, true);
edtStart.Left := r.Right + 4;
TInfra.MoveWin(edtVar, cbVar.Left+4, 38-t);

r := DrawTextLabel(edtVar.Left + edtVar.Width+3, t, GInfra.CurrentLang.ForDoVarString, false, true);
TInfra.MoveWin(edtStart, r.Right+4, 38-t);
br1 := edtStart.Left + edtStart.Width;

r := DrawTextLabel(br1+3, y, IfThen(FDescOrder, '«', '»'), false, true);
edtStop.Left := r.Right + 4;
r := DrawTextLabel(br1+3, t, IfThen(FDescOrder, '«', '»'), false, true);
TInfra.MoveWin(edtStop, r.Right+4, 38-t);

br2 := edtStop.Left + edtStop.Width;
IPoint.X := br2 + 16;
Expand All @@ -256,9 +257,9 @@ procedure TForDoBlock.Paint;
Point(br2-9, TopHook.Y),
Point(bhx-100, TopHook.Y),
Point(bhx-100, 0)]);
DrawTextLabel(edtVar.Left + edtVar.Width+3, y, GInfra.CurrentLang.ForDoVarString, false, true);
DrawTextLabel(br1+3, y, IfThen(FDescOrder, '«', '»'), false, true);
DrawTextLabel(bhx-97, y, FForLabel, false, true);
DrawTextLabel(edtVar.Left + edtVar.Width+3, t, GInfra.CurrentLang.ForDoVarString, false, true);
DrawTextLabel(br1+3, t, IfThen(FDescOrder, '«', '»'), false, true);
DrawTextLabel(bhx-97, t, FForLabel, false, true);
DrawBlockLabel(bhx-100, 40, GInfra.CurrentLang.LabelFor);
end;
DrawI;
Expand Down Expand Up @@ -303,7 +304,6 @@ procedure TForDoBlock.VarOnChange(Sender: TObject);
if not GInfra.CurrentLang.ForDoVarList then
UpdateEditor(edtVar);
edtVar.Width := Max(TInfra.GetAutoWidth(edtVar), IfThen(GInfra.CurrentLang.ForDoVarList, 28, 5));
cbVar.Width := edtVar.Width + 5;
if GSettings.ParseFor then
begin
if (GProject.GlobalVars <> nil) and GProject.GlobalVars.IsValidLoopVar(edtVar.Text) then
Expand Down Expand Up @@ -559,14 +559,7 @@ function TForDoBlock.RetrieveFocus(AInfo: TFocusInfo): boolean;
end;

procedure TForDoBlock.PutTextControls;
var
t: integer;
begin
t := 22 - edtStart.Height div 2;
edtStart.Top := t;
edtStop.Top := t;
edtVar.Top := t;
cbVar.Top := t - 4;
VarOnChange(edtVar);
end;

Expand Down

0 comments on commit eb0ddb1

Please sign in to comment.