Fixes the compilation of avisocncwriter and improves the code structure

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1522 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2011-03-08 14:32:14 +00:00
parent aa5644ca43
commit c54cc35102
6 changed files with 160 additions and 19 deletions

View File

@ -36,6 +36,10 @@ var
i, j: Integer; i, j: Integer;
Str: string; Str: string;
APath: TPath; APath: TPath;
CurSegment: T2DSegment;
Cur3DSegment: T3DSegment;
Cur2DBezierSegment: T2DBezierSegment;
Cur3DBezierSegment: T3DBezierSegment;
begin begin
AStrings.Clear; AStrings.Clear;
@ -51,25 +55,39 @@ begin
// levanta a broca // levanta a broca
AStrings.Add('P01 // Sobe a cabeça de gravação'); AStrings.Add('P01 // Sobe a cabeça de gravação');
// vai para o ponto inicial // vai para o ponto inicial
CurSegment := T2DSegment(APath.Points);
AStrings.Add(Format('G01 X%f Y%f', AStrings.Add(Format('G01 X%f Y%f',
[APath.Points[0].X, APath.Points[0].Y])); [CurSegment.X, CurSegment.Y]));
AStrings.Add('P02 // Abaixa a cabeça de gravação'); AStrings.Add('P02 // Abaixa a cabeça de gravação');
for j := 1 to APath.Len - 1 do for j := 1 to APath.Len - 1 do
begin begin
case APath.Points[j].SegmentType of CurSegment := T2DSegment(CurSegment.Next);
case CurSegment.SegmentType of
st2DLine: AStrings.Add(Format('G01 X%f Y%f', st2DLine: AStrings.Add(Format('G01 X%f Y%f',
[APath.Points[j].X, APath.Points[j].Y])); [CurSegment.X, CurSegment.Y]));
st3DLine: AStrings.Add(Format('G01 X%f Y%f Z%f', st3DLine:
[APath.Points[j].X, APath.Points[j].Y, APath.Points[j].Z])); begin
st2DBezier: AStrings.Add(Format('B02 X%f Y%f X%f Y%f X%f Y%f', Cur3DSegment := T3DSegment(CurSegment);
[APath.Points[j].X2, APath.Points[j].Y2, AStrings.Add(Format('G01 X%f Y%f Z%f',
APath.Points[j].X3, APath.Points[j].Y3, [Cur3DSegment.X, Cur3DSegment.Y, Cur3DSegment.Z]));
APath.Points[j].X, APath.Points[j].Y])); end;
st3DBezier: AStrings.Add(Format('B03 X%f Y%f Z%f X%f Y%f Z%f X%f Y%f Z%f', st2DBezier:
[APath.Points[j].X2, APath.Points[j].Y2, APath.Points[j].Z2, begin
APath.Points[j].X3, APath.Points[j].Y3, APath.Points[j].Z3, Cur2DBezierSegment := T2DBezierSegment(CurSegment);
APath.Points[j].X, APath.Points[j].Y, APath.Points[j].Z])); AStrings.Add(Format('B02 X%f Y%f X%f Y%f X%f Y%f',
[Cur2DBezierSegment.X2, Cur2DBezierSegment.Y2,
Cur2DBezierSegment.X3, Cur2DBezierSegment.Y3,
Cur2DBezierSegment.X, Cur2DBezierSegment.Y]));
end;
st3DBezier:
begin
Cur3DBezierSegment := T3DBezierSegment(CurSegment);
AStrings.Add(Format('B03 X%f Y%f Z%f X%f Y%f Z%f X%f Y%f Z%f',
[Cur3DBezierSegment.X2, Cur3DBezierSegment.Y2, Cur3DBezierSegment.Z2,
Cur3DBezierSegment.X3, Cur3DBezierSegment.Y3, Cur3DBezierSegment.Z3,
Cur3DBezierSegment.X, Cur3DBezierSegment.Y, Cur3DBezierSegment.Z]));
end;
end; end;
end; end;
end; end;

View File

@ -0,0 +1,85 @@
<?xml version="1.0"?>
<CONFIG>
<Package Version="3">
<Name Value="fpvectorialpkg"/>
<CompilerOptions>
<Version Value="10"/>
<SearchPaths>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/"/>
</SearchPaths>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Files Count="13">
<Item1>
<Filename Value="svgvectorialwriter.pas"/>
<UnitName Value="svgvectorialwriter"/>
</Item1>
<Item2>
<Filename Value="pdfvrsintatico.pas"/>
<UnitName Value="pdfvrsintatico"/>
</Item2>
<Item3>
<Filename Value="pdfvrsemantico.pas"/>
<UnitName Value="pdfvrsemantico"/>
</Item3>
<Item4>
<Filename Value="pdfvrlexico.pas"/>
<UnitName Value="pdfvrlexico"/>
</Item4>
<Item5>
<Filename Value="pdfvectorialreader.pas"/>
<UnitName Value="pdfvectorialreader"/>
</Item5>
<Item6>
<Filename Value="fpvtocanvas.pas"/>
<UnitName Value="fpvtocanvas"/>
</Item6>
<Item7>
<Filename Value="fpvectorial.pas"/>
<UnitName Value="fpvectorial"/>
</Item7>
<Item8>
<Filename Value="fpvectbuildunit.pas"/>
<UnitName Value="fpvectbuildunit"/>
</Item8>
<Item9>
<Filename Value="dxfvectorialreader.pas"/>
<UnitName Value="dxfvectorialreader"/>
</Item9>
<Item10>
<Filename Value="cdrvectorialreader.pas"/>
<UnitName Value="cdrvectorialreader"/>
</Item10>
<Item11>
<Filename Value="avisozlib.pas"/>
<UnitName Value="avisozlib"/>
</Item11>
<Item12>
<Filename Value="avisocncgcodewriter.pas"/>
<UnitName Value="avisocncgcodewriter"/>
</Item12>
<Item13>
<Filename Value="avisocncgcodereader.pas"/>
<UnitName Value="avisocncgcodereader"/>
</Item13>
</Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="2">
<Item1>
<PackageName Value="LCL"/>
</Item1>
<Item2>
<PackageName Value="FCL"/>
<MinVersion Major="1" Release="1" Valid="True"/>
</Item2>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
</Package>
</CONFIG>

View File

@ -0,0 +1,23 @@
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit fpvectorialpkg;
interface
uses
svgvectorialwriter, pdfvrsintatico, pdfvrsemantico, pdfvrlexico,
pdfvectorialreader, fpvtocanvas, fpvectorial, fpvectbuildunit,
dxfvectorialreader, cdrvectorialreader, avisozlib, avisocncgcodewriter,
avisocncgcodereader, LazarusPackageIntf;
implementation
procedure Register;
begin
end;
initialization
RegisterPackage('fpvectorialpkg', @Register);
end.

View File

@ -11,7 +11,7 @@ uses
{$ifdef USE_LCL_CANVAS} {$ifdef USE_LCL_CANVAS}
Graphics, LCLIntf, Graphics, LCLIntf,
{$else} {$else}
fpcanvas, fpcanvas, fpimage,
{$endif} {$endif}
fpvectorial; fpvectorial;
@ -295,7 +295,11 @@ begin
SetLength(Points, 3); SetLength(Points, 3);
if CurDim.DimensionRight.Y = CurDim.DimensionLeft.Y then if CurDim.DimensionRight.Y = CurDim.DimensionLeft.Y then
begin begin
{$ifdef USE_LCL_CANVAS}
ADest.Brush.Color := clBlack; ADest.Brush.Color := clBlack;
{$else}
ADest.Brush.FPColor := colBlack;
{$endif}
ADest.Brush.Style := bsSolid; ADest.Brush.Style := bsSolid;
// Left arrow // Left arrow
Points[0] := Point(CoordToCanvasX(CurDim.DimensionLeft.X), CoordToCanvasY(CurDim.DimensionLeft.Y)); Points[0] := Point(CoordToCanvasX(CurDim.DimensionLeft.X), CoordToCanvasY(CurDim.DimensionLeft.Y));
@ -317,7 +321,11 @@ begin
end end
else else
begin begin
{$ifdef USE_LCL_CANVAS}
ADest.Brush.Color := clBlack; ADest.Brush.Color := clBlack;
{$else}
ADest.Brush.FPColor := colBlack;
{$endif}
ADest.Brush.Style := bsSolid; ADest.Brush.Style := bsSolid;
// There is no upper/lower preference for DimensionLeft/Right, so we need to check // There is no upper/lower preference for DimensionLeft/Right, so we need to check
if CurDim.DimensionLeft.Y > CurDim.DimensionRight.Y then if CurDim.DimensionLeft.Y > CurDim.DimensionRight.Y then
@ -364,7 +372,11 @@ begin
CurText := ASource.GetText(i); CurText := ASource.GetText(i);
ADest.Font.Size := Round(AmulX * CurText.FontSize); ADest.Font.Size := Round(AmulX * CurText.FontSize);
ADest.Pen.Style := psSolid; ADest.Pen.Style := psSolid;
{$ifdef USE_LCL_CANVAS}
ADest.Pen.Color := clBlack; ADest.Pen.Color := clBlack;
{$else}
ADest.Pen.FPColor := colBlack;
{$endif}
ADest.Brush.Style := bsClear; ADest.Brush.Style := bsClear;
LowerDim.Y := CurText.Y + CurText.FontSize; LowerDim.Y := CurText.Y + CurText.FontSize;
ADest.TextOut(CoordToCanvasX(CurText.X), CoordToCanvasY(LowerDim.Y), CurText.Value); ADest.TextOut(CoordToCanvasX(CurText.X), CoordToCanvasY(LowerDim.Y), CurText.Value);

View File

@ -28,14 +28,17 @@
<LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> <LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local> </local>
</RunParams> </RunParams>
<RequiredPackages Count="2"> <RequiredPackages Count="3">
<Item1> <Item1>
<PackageName Value="LCLBase"/> <PackageName Value="fpvectorialpkg"/>
<MinVersion Major="1" Release="1" Valid="True"/>
</Item1> </Item1>
<Item2> <Item2>
<PackageName Value="LCL"/> <PackageName Value="LCLBase"/>
<MinVersion Major="1" Release="1" Valid="True"/>
</Item2> </Item2>
<Item3>
<PackageName Value="LCL"/>
</Item3>
</RequiredPackages> </RequiredPackages>
<Units Count="4"> <Units Count="4">
<Unit0> <Unit0>

View File

@ -7,7 +7,7 @@ uses
cthreads, cthreads,
{$ENDIF}{$ENDIF} {$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset Interfaces, // this includes the LCL widgetset
Forms, fpvv_mainform, dxftokentotree, fpvv_drawer Forms, fpvv_mainform, dxftokentotree, fpvv_drawer, fpvectorialpkg
{ you can add units after this }; { you can add units after this };
{$R *.res} {$R *.res}