Adding project files
This commit is contained in:
parent
baa68a8dc4
commit
3b9faf18fc
67
cfdggui.lpi
Normal file
67
cfdggui.lpi
Normal file
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="7"/>
|
||||
<General>
|
||||
<MainUnit Value="0"/>
|
||||
<TargetFileExt Value=""/>
|
||||
<UseXPManifest Value="True"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
<Language Value=""/>
|
||||
<CharSet Value=""/>
|
||||
</VersionInfo>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<DestinationDirectory Value="/home/kenkeiras/codigo/cfdggui/pub"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="1">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item1>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="cfdggui.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="cfdggui"/>
|
||||
<UsageCount Value="20"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="cfdgui.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="main"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="cfdgui"/>
|
||||
<UsageCount Value="20"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
<JumpHistory Count="0" HistoryIndex="-1"/>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="8"/>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)/"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
</CONFIG>
|
21
cfdggui.lpr
Normal file
21
cfdggui.lpr
Normal file
@ -0,0 +1,21 @@
|
||||
program cfdggui;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, cfdgui, LResources, ExtCtrls, Menus, StdCtrls
|
||||
{ you can add units after this };
|
||||
|
||||
{$IFDEF WINDOWS}{$R cfdggui.rc}{$ENDIF}
|
||||
|
||||
begin
|
||||
{$I cfdggui.lrs}
|
||||
Application.Initialize;
|
||||
Application.CreateForm(Tmain, main);
|
||||
Application.Run;
|
||||
end.
|
||||
|
5237
cfdggui.lrs
Normal file
5237
cfdggui.lrs
Normal file
File diff suppressed because it is too large
Load Diff
113
cfdgui.lfm
Normal file
113
cfdgui.lfm
Normal file
@ -0,0 +1,113 @@
|
||||
object main: Tmain
|
||||
Left = 394
|
||||
Height = 564
|
||||
Top = 76
|
||||
Width = 750
|
||||
ActiveControl = srcText
|
||||
Caption = 'CFDG Gui'
|
||||
ClientHeight = 541
|
||||
ClientWidth = 750
|
||||
Menu = MMenu
|
||||
LCLVersion = '0.9.28.2'
|
||||
object img: TImage
|
||||
Left = 250
|
||||
Height = 500
|
||||
Top = 0
|
||||
Width = 500
|
||||
Anchors = [akTop, akRight, akBottom]
|
||||
end
|
||||
object varLabel: TLabel
|
||||
Left = 72
|
||||
Height = 14
|
||||
Top = 518
|
||||
Width = 49
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = 'Variación:'
|
||||
ParentColor = False
|
||||
end
|
||||
object srcText: TMemo
|
||||
Left = 0
|
||||
Height = 500
|
||||
Top = 0
|
||||
Width = 248
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
Lines.Strings = (
|
||||
'startshape SPIRAL'
|
||||
''
|
||||
'rule SPIRAL{'
|
||||
' CIRCLE{}'
|
||||
' SPIRAL{y 0.5 rotate 1 size 0.995}'
|
||||
'}'
|
||||
''
|
||||
'rule SPIRAL 0.01{'
|
||||
' CIRCLE{}'
|
||||
' SPIRAL{y 0.5 rotate 1 size 0.995}'
|
||||
' SPIRAL{flip 90 y 0.5 rotate 1 size 0.995}'
|
||||
'}'
|
||||
)
|
||||
TabOrder = 0
|
||||
end
|
||||
object genButton: TButton
|
||||
Left = 0
|
||||
Height = 20
|
||||
Top = 512
|
||||
Width = 57
|
||||
Anchors = [akLeft, akBottom]
|
||||
Caption = 'Generar'
|
||||
OnClick = genButtonClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object varEdit: TEdit
|
||||
Left = 136
|
||||
Height = 21
|
||||
Top = 511
|
||||
Width = 75
|
||||
Anchors = [akLeft, akBottom]
|
||||
TabOrder = 2
|
||||
end
|
||||
object MMenu: TMainMenu
|
||||
left = 456
|
||||
top = 504
|
||||
object Fmenu: TMenuItem
|
||||
Caption = 'Archivo'
|
||||
object openMenu: TMenuItem
|
||||
Caption = 'Abrir'
|
||||
ShortCut = 16463
|
||||
OnClick = openMenuClick
|
||||
end
|
||||
object saveMenu: TMenuItem
|
||||
Caption = 'Guardar'
|
||||
ShortCut = 16467
|
||||
OnClick = saveMenuClick
|
||||
end
|
||||
object saveasMenu: TMenuItem
|
||||
Caption = 'Guardar Como'
|
||||
ShortCut = 24659
|
||||
OnClick = saveasMenuClick
|
||||
end
|
||||
object saveimgMenu: TMenuItem
|
||||
Caption = 'Guardar imágen'
|
||||
ShortCut = 16457
|
||||
OnClick = saveimgMenuClick
|
||||
end
|
||||
object quitMenu: TMenuItem
|
||||
Caption = 'Salir'
|
||||
ShortCut = 16465
|
||||
OnClick = quitMenuClick
|
||||
end
|
||||
end
|
||||
object GenMenu: TMenuItem
|
||||
Caption = 'Generar'
|
||||
ShortCut = 116
|
||||
OnClick = GenMenuClick
|
||||
end
|
||||
end
|
||||
object openDiag: TOpenDialog
|
||||
left = 504
|
||||
top = 504
|
||||
end
|
||||
object saveDiag: TSaveDialog
|
||||
left = 544
|
||||
top = 504
|
||||
end
|
||||
end
|
31
cfdgui.lrs
Normal file
31
cfdgui.lrs
Normal file
@ -0,0 +1,31 @@
|
||||
LazarusResources.Add('Tmain','FORMDATA',[
|
||||
'TPF0'#5'Tmain'#4'main'#4'Left'#3#138#1#6'Height'#3'4'#2#3'Top'#2'L'#5'Width'
|
||||
+#3#238#2#13'ActiveControl'#7#7'srcText'#7'Caption'#6#8'CFDG Gui'#12'ClientHe'
|
||||
+'ight'#3#29#2#11'ClientWidth'#3#238#2#4'Menu'#7#5'MMenu'#10'LCLVersion'#6#8
|
||||
+'0.9.28.2'#0#6'TImage'#3'img'#4'Left'#3#250#0#6'Height'#3#244#1#3'Top'#2#0#5
|
||||
+'Width'#3#244#1#7'Anchors'#11#5'akTop'#7'akRight'#8'akBottom'#0#0#0#6'TLabel'
|
||||
+#8'varLabel'#4'Left'#2'H'#6'Height'#2#14#3'Top'#3#6#2#5'Width'#2'1'#7'Anchor'
|
||||
+'s'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#11'Variaci'#195#179'n:'#11'Paren'
|
||||
+'tColor'#8#0#0#5'TMemo'#7'srcText'#4'Left'#2#0#6'Height'#3#244#1#3'Top'#2#0#5
|
||||
+'Width'#3#248#0#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#13
|
||||
+'Lines.Strings'#1#6#17'startshape SPIRAL'#6#0#6#12'rule SPIRAL{'#6#10' CIRC'
|
||||
+'LE{}'#6'# SPIRAL{y 0.5 rotate 1 size 0.995}'#6#1'}'#6#0#6#17'rule SPIRAL 0'
|
||||
+'.01{'#6#10' CIRCLE{}'#6'# SPIRAL{y 0.5 rotate 1 size 0.995}'#6'+ SPIRAL{'
|
||||
+'flip 90 y 0.5 rotate 1 size 0.995}'#6#1'}'#0#8'TabOrder'#2#0#0#0#7'TButton'
|
||||
+#9'genButton'#4'Left'#2#0#6'Height'#2#20#3'Top'#3#0#2#5'Width'#2'9'#7'Anchor'
|
||||
+'s'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#7'Generar'#7'OnClick'#7#14'genBu'
|
||||
+'ttonClick'#8'TabOrder'#2#1#0#0#5'TEdit'#7'varEdit'#4'Left'#3#136#0#6'Height'
|
||||
+#2#21#3'Top'#3#255#1#5'Width'#2'K'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#8'T'
|
||||
+'abOrder'#2#2#0#0#9'TMainMenu'#5'MMenu'#4'left'#3#200#1#3'top'#3#248#1#0#9'T'
|
||||
+'MenuItem'#5'Fmenu'#7'Caption'#6#7'Archivo'#0#9'TMenuItem'#8'openMenu'#7'Cap'
|
||||
+'tion'#6#5'Abrir'#8'ShortCut'#3'O@'#7'OnClick'#7#13'openMenuClick'#0#0#9'TMe'
|
||||
+'nuItem'#8'saveMenu'#7'Caption'#6#7'Guardar'#8'ShortCut'#3'S@'#7'OnClick'#7
|
||||
+#13'saveMenuClick'#0#0#9'TMenuItem'#10'saveasMenu'#7'Caption'#6#12'Guardar C'
|
||||
+'omo'#8'ShortCut'#3'S`'#7'OnClick'#7#15'saveasMenuClick'#0#0#9'TMenuItem'#11
|
||||
+'saveimgMenu'#7'Caption'#6#15'Guardar im'#195#161'gen'#8'ShortCut'#3'I@'#7'O'
|
||||
+'nClick'#7#16'saveimgMenuClick'#0#0#9'TMenuItem'#8'quitMenu'#7'Caption'#6#5
|
||||
+'Salir'#8'ShortCut'#3'Q@'#7'OnClick'#7#13'quitMenuClick'#0#0#0#9'TMenuItem'#7
|
||||
+'GenMenu'#7'Caption'#6#7'Generar'#8'ShortCut'#2't'#7'OnClick'#7#12'GenMenuCl'
|
||||
+'ick'#0#0#0#11'TOpenDialog'#8'openDiag'#4'left'#3#248#1#3'top'#3#248#1#0#0#11
|
||||
+'TSaveDialog'#8'saveDiag'#4'left'#3' '#2#3'top'#3#248#1#0#0#0
|
||||
]);
|
143
cfdgui.pas
Normal file
143
cfdgui.pas
Normal file
@ -0,0 +1,143 @@
|
||||
unit cfdgui;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, Interfaces,
|
||||
ExtCtrls, Menus, StdCtrls, Process;
|
||||
|
||||
type
|
||||
|
||||
{ Tmain }
|
||||
|
||||
Tmain = class(TForm)
|
||||
genButton: TButton;
|
||||
varEdit: TEdit;
|
||||
img: TImage;
|
||||
varLabel: TLabel;
|
||||
Fmenu: TMenuItem;
|
||||
openMenu: TMenuItem;
|
||||
quitMenu: TMenuItem;
|
||||
saveimgMenu: TMenuItem;
|
||||
saveasMenu: TMenuItem;
|
||||
saveMenu: TMenuItem;
|
||||
openDiag: TOpenDialog;
|
||||
saveDiag: TSaveDialog;
|
||||
srcText: TMemo;
|
||||
MMenu: TMainMenu;
|
||||
GenMenu: TMenuItem;
|
||||
procedure GenMenuClick(Sender: TObject);
|
||||
procedure openMenuClick(Sender: TObject);
|
||||
procedure quitMenuClick(Sender: TObject);
|
||||
procedure saveimgMenuClick(Sender: TObject);
|
||||
procedure saveasMenuClick(Sender: TObject);
|
||||
procedure saveMenuClick(Sender: TObject);
|
||||
procedure refresh;
|
||||
procedure genButtonClick(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
main: Tmain;
|
||||
tmpsrc: String = 'tmpsrc.cfdg';
|
||||
tmpimg: String = 'tmpimg.png';
|
||||
title: String = 'CFDG Gui';
|
||||
exename: String = 'cfdg';
|
||||
savename: String = '';
|
||||
|
||||
implementation
|
||||
|
||||
{ Tmain }
|
||||
|
||||
// Esta parte es la que controla al cfdg
|
||||
procedure Tmain.refresh;
|
||||
var
|
||||
pro: TProcess;
|
||||
begin
|
||||
srcText.Lines.SaveToFile(tmpsrc);
|
||||
pro := TProcess.Create(nil);
|
||||
if (varEdit.Text='') then
|
||||
pro.CommandLine := exename+' '+tmpsrc+' -o'+tmpimg
|
||||
else
|
||||
pro.CommandLine := exename+' -v'+varEdit.Text+' '+tmpsrc+' -o'+tmpimg;
|
||||
|
||||
pro.Options := pro.Options + [poWaitOnExit];
|
||||
pro.Execute;
|
||||
pro.Free;
|
||||
if (img.tag = 1) then
|
||||
img.Picture.Clear;
|
||||
if (FileExists(tmpimg)) then begin
|
||||
img.Picture.LoadFromFile(tmpimg);
|
||||
img.tag:=1;
|
||||
end else
|
||||
img.tag:=0;
|
||||
|
||||
end;
|
||||
|
||||
procedure Tmain.GenMenuClick(Sender: TObject);
|
||||
begin
|
||||
refresh;
|
||||
end;
|
||||
|
||||
procedure Tmain.openMenuClick(Sender: TObject);
|
||||
begin
|
||||
if (openDiag.Execute) then begin
|
||||
savename := openDiag.FileName;
|
||||
srcText.Lines.LoadFromFile(savename);
|
||||
main.caption := title+' - ['+savename+']';
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure Tmain.quitMenuClick(Sender: TObject);
|
||||
begin
|
||||
halt(0);
|
||||
end;
|
||||
|
||||
procedure Tmain.saveimgMenuClick(Sender: TObject);
|
||||
begin
|
||||
if (img.tag = 1) then begin
|
||||
if (saveDiag.Execute) then
|
||||
img.Picture.SaveToFile(saveDiag.FileName,'png');
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure Tmain.saveasMenuClick(Sender: TObject);
|
||||
var
|
||||
n_savename: String = '';
|
||||
begin
|
||||
if (saveDiag.Execute) then
|
||||
n_savename := saveDiag.FileName;
|
||||
if (n_savename <> '' ) then begin
|
||||
savename := n_savename;
|
||||
main.caption := title+' - ['+savename+']';
|
||||
srcText.Lines.SaveToFile(savename);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure Tmain.saveMenuClick(Sender: TObject);
|
||||
begin
|
||||
if (savename = '') then begin
|
||||
if (saveDiag.Execute) then
|
||||
savename := saveDiag.FileName;
|
||||
end;
|
||||
if (savename <> '') then begin
|
||||
srcText.Lines.SaveToFile(savename);
|
||||
main.caption := title+' - ['+savename+']';
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure Tmain.genButtonClick(Sender: TObject);
|
||||
begin
|
||||
refresh;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I cfdgui.lrs}
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user