* fixed unit name

git-svn-id: https://svn.code.sf.net/p/kolmck/code@124 91bb2d04-0c0c-4d2d-88a5-bbb6f4c1fa07
This commit is contained in:
dkolmck
2014-12-03 08:58:09 +00:00
parent cb0dea0599
commit e2bebba230

View File

@@ -84,7 +84,7 @@ const
#13#10 + #13#10 +
'{$IFDEF KOL_MCK}procedure NewForm1( var Result: PForm1; AParent: PControl );{$ENDIF}' + #13#10 + '{$IFDEF KOL_MCK}procedure NewForm1( var Result: PForm1; AParent: PControl );{$ENDIF}' + #13#10 +
'implementation' + #13#10 + 'implementation' + #13#10 +
'{$IF Defined(KOL_MCK)}{$I Unit1_1.inc}{$ELSE}{$R *.DFM}{$IFEND}' + #13#10 + '{$IF Defined(KOL_MCK)}{$I %unt_name%_1.inc}{$ELSE}{$R *.DFM}{$IFEND}' + #13#10 +
#13#10 + #13#10 +
'end.'; 'end.';
@@ -141,7 +141,7 @@ const
'TabulateEx = False' + #13#10 + 'TabulateEx = False' + #13#10 +
'UnitSourcePath = ''%path%''' + #13#10 + 'UnitSourcePath = ''%path%''' + #13#10 +
'Locked = False' + #13#10 + 'Locked = False' + #13#10 +
'formUnit = ''Unit1''' + #13#10 + 'formUnit = ''%unt_name%''' + #13#10 +
'formMain = True' + #13#10 + 'formMain = True' + #13#10 +
'Enabled = True' + #13#10 + 'Enabled = True' + #13#10 +
'defaultSize = False' + #13#10 + 'defaultSize = False' + #13#10 +
@@ -208,6 +208,7 @@ end;
procedure TMCKWizard.Execute; procedure TMCKWizard.Execute;
var var
unt_name: String;
prj: String; prj: String;
unt: String; unt: String;
dlg: TSaveDialog; dlg: TSaveDialog;
@@ -230,16 +231,19 @@ begin
unt := dlg.FileName; unt := dlg.FileName;
if (Pos('.', unt) = Length(unt) - 3) then if (Pos('.', unt) = Length(unt) - 3) then
SetLength(unt, Length(unt) - 4); SetLength(unt, Length(unt) - 4);
// unt_name
unt_name := ExtractFileName(unt);
// gen project // gen project
lst := TStringList.Create; lst := TStringList.Create;
lst.Text := StringReplace(prj_template, '%prj_name%', ExtractFileName(prj), [rfReplaceAll]); lst.Text := StringReplace(prj_template, '%prj_name%', ExtractFileName(prj), [rfReplaceAll]);
lst.Text := StringReplace(lst.Text, '%unt_name%', ExtractFileName(unt), [rfReplaceAll]); lst.Text := StringReplace(lst.Text, '%unt_name%', unt_name, [rfReplaceAll]);
lst.SaveToFile(ChangeFileExt(prj, '.dpr')); lst.SaveToFile(ChangeFileExt(prj, '.dpr'));
// gen unit // gen unit
lst.Text := StringReplace(unt_template, '%unt_name%', ExtractFileName(unt), [rfReplaceAll]); lst.Text := StringReplace(unt_template, '%unt_name%', unt_name, [rfReplaceAll]);
lst.SaveToFile(ChangeFileExt(unt, '.pas')); lst.SaveToFile(ChangeFileExt(unt, '.pas'));
// gen dfm // gen dfm
lst.Text := StringReplace(dfm_template, '%path%', ExtractFilePath(unt), [rfReplaceAll]); lst.Text := StringReplace(dfm_template, '%path%', ExtractFilePath(unt), [rfReplaceAll]);
lst.Text := StringReplace(lst.Text, '%unt_name%', unt_name, [rfReplaceAll]);
lst.SaveToFile(ChangeFileExt(unt, '.dfm')); lst.SaveToFile(ChangeFileExt(unt, '.dfm'));
// close all // close all
//if (MessageBox(0, 'Close all projects before opening new?', 'MCKAppExpert200x', MB_ICONQUESTION or MB_YESNO) = IDYES) then //if (MessageBox(0, 'Close all projects before opening new?', 'MCKAppExpert200x', MB_ICONQUESTION or MB_YESNO) = IDYES) then
@@ -261,7 +265,7 @@ end;
function TMCKWizard.GetComment: string; function TMCKWizard.GetComment: string;
begin begin
Result := 'No comments =)'; Result := 'v0.02';
end; end;
function TMCKWizard.GetGlyph: Cardinal; function TMCKWizard.GetGlyph: Cardinal;