Changeset 499


Ignore:
Timestamp:
Jan 19, 2018, 5:11:01 PM (7 years ago)
Author:
chronos
Message:
  • Modified: Build main executable in lib directory also per build mode. Copy language files by pre-run script.
Location:
ProjectTemplates/FileMenuProject
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • ProjectTemplates/FileMenuProject/FileMenuProject.lpi

    r498 r499  
    2727          <PathDelim Value="\"/>
    2828          <Target>
    29             <Filename Value="FileMenuProject"/>
     29            <Filename Value="lib\$(TargetCPU)-$(TargetOS)-${BuildMode}\FileMenuProject"/>
    3030          </Target>
    3131          <SearchPaths>
    3232            <IncludeFiles Value="$(ProjOutDir)"/>
    33             <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
     33            <OtherUnitFiles Value="Forms"/>
     34            <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-${BuildMode}"/>
    3435          </SearchPaths>
    3536          <Parsing>
     
    6263              <IgnoredMessages idx5024="True"/>
    6364            </CompilerMessages>
     65            <ExecuteBefore>
     66              <Command Value="prepare.bat lib\$(TargetCPU)-$(TargetOS)-${BuildMode}"/>
     67              <CompileReasons Compile="False" Build="False"/>
     68            </ExecuteBefore>
    6469          </Other>
    6570        </CompilerOptions>
     
    138143    <PathDelim Value="\"/>
    139144    <Target>
    140       <Filename Value="FileMenuProject"/>
     145      <Filename Value="lib\$(TargetCPU)-$(TargetOS)-${BuildMode}\FileMenuProject"/>
    141146    </Target>
    142147    <SearchPaths>
    143148      <IncludeFiles Value="$(ProjOutDir)"/>
    144149      <OtherUnitFiles Value="Forms"/>
    145       <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
     150      <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)-${BuildMode}"/>
    146151    </SearchPaths>
    147152    <Parsing>
     
    178183      </CompilerMessages>
    179184      <CustomOptions Value="-dDEBUG"/>
     185      <ExecuteBefore>
     186        <Command Value="prepare.bat lib\$(TargetCPU)-$(TargetOS)-${BuildMode}"/>
     187        <CompileReasons Compile="False" Build="False"/>
     188      </ExecuteBefore>
    180189    </Other>
    181190  </CompilerOptions>
  • ProjectTemplates/FileMenuProject/Forms/UFormMain.pas

    r497 r499  
    7474procedure TFormMain.FormCloseQuery(Sender: TObject; var CanClose: boolean);
    7575begin
    76   Core.AFileClose.Execute;
     76  Core.FileClose;
    7777  CanClose := Core.FileClosed;
    7878end;
  • ProjectTemplates/FileMenuProject/Install/win/Application.iss

    r497 r499  
    6868
    6969[Files]
    70 Source: "{#MyAppSubDir}\lib\x86_64-win64\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Check: Is64BitInstallMode
    71 Source: "{#MyAppSubDir}\lib\i386-win32\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Check: not Is64BitInstallMode
     70Source: "{#MyAppSubDir}\lib\x86_64-win64-Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Check: Is64BitInstallMode
     71Source: "{#MyAppSubDir}\lib\i386-win32-Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Check: not Is64BitInstallMode
    7272Source: "{#MyAppSubDir}\Languages\*.po"; DestDir: "{app}\Languages"; Flags: ignoreversion
    7373
  • ProjectTemplates/FileMenuProject/UCore.pas

    r497 r499  
    5252    procedure FileModified(Sender: TObject);
    5353    function FindFirstNonOption: string;
    54     procedure FileOpen(FileName: string);
    55     procedure FileNew;
    5654    procedure UpdateFile;
    5755    procedure LoadConfig;
     
    6260    ReopenLastFileOnStart: Boolean;
    6361    ToolbarVisible: Boolean;
     62    procedure FileNew;
     63    procedure FileOpen(FileName: string);
     64    procedure FileClose;
    6465    procedure Initialize;
    6566    procedure UpdateInterface;
     
    100101
    101102procedure TCore.AFileCloseExecute(Sender: TObject);
     103begin
     104  FileClose;
     105  UpdateFile;
     106end;
     107
     108procedure TCore.AHomePageExecute(Sender: TObject);
     109begin
     110  OpenWebPage(ApplicationInfo1.HomePage);
     111end;
     112
     113procedure TCore.ASettingsExecute(Sender: TObject);
     114begin
     115  FormSettings := TFormSettings.Create(nil);
     116  try
     117    FormSettings.LoadData;
     118    if FormSettings.ShowModal = mrOK then
     119      FormSettings.SaveData;
     120  finally
     121    FormSettings.Free;
     122  end;
     123end;
     124
     125procedure TCore.AFileNewExecute(Sender: TObject);
     126begin
     127  FileNew;
     128  UpdateFile;
     129end;
     130
     131procedure TCore.AFileOpenExecute(Sender: TObject);
     132begin
     133  OpenDialog1.DefaultExt := '';
     134  if Assigned(DataFile) then begin
     135    OpenDialog1.InitialDir := ExtractFileDir(DataFile.FileName);
     136    OpenDialog1.FileName := ExtractFileName(DataFile.FileName);
     137  end;
     138  if OpenDialog1.Execute then begin
     139    FileOpen(OpenDialog1.FileName);
     140    UpdateFile;
     141  end;
     142end;
     143
     144procedure TCore.AFileOpenRecentExecute(Sender: TObject);
     145begin
     146  FileOpen(TMenuItem(Sender).Caption);
     147  UpdateFile;
     148end;
     149
     150procedure TCore.AFileSaveAsExecute(Sender: TObject);
     151begin
     152  SaveDialog1.DefaultExt := DataFile.GetFileExt;
     153  SaveDialog1.InitialDir := ExtractFileDir(DataFile.FileName);
     154  SaveDialog1.FileName := ExtractFileName(DataFile.FileName);
     155  if SaveDialog1.Execute then begin
     156    DataFile.SaveToFile(SaveDialog1.FileName);
     157    LastOpenedList1.AddItem(SaveDialog1.FileName);
     158    UpdateFile;
     159  end;
     160end;
     161
     162procedure TCore.AFileSaveExecute(Sender: TObject);
     163begin
     164  if FileExists(DataFile.FileName) then begin
     165    DataFile.SaveToFile(DataFile.FileName);
     166    LastOpenedList1.AddItem(DataFile.FileName);
     167    UpdateFile;
     168  end else AFileSaveAs.Execute;
     169end;
     170
     171procedure TCore.DataModuleCreate(Sender: TObject);
     172begin
     173  DataFile := nil;
     174  FileClosed := True;
     175end;
     176
     177procedure TCore.DataModuleDestroy(Sender: TObject);
     178begin
     179  SaveConfig;
     180end;
     181
     182procedure TCore.LastOpenedList1Change(Sender: TObject);
     183begin
     184  LastOpenedList1.LoadToMenuItem(FormMain.MenuItemFileOpenRecent, AFileOpenRecentExecute);
     185  LastOpenedList1.LoadToMenuItem(FormMain.PopupMenuOpenRecent.Items, AFileOpenRecentExecute);
     186end;
     187
     188procedure TCore.FileModified(Sender: TObject);
     189begin
     190  UpdateFile;
     191end;
     192
     193procedure TCore.FileOpen(FileName: string);
     194begin
     195  FileClose;
     196  if FileClosed then begin
     197    FileNew;
     198    DataFile.LoadFromFile(FileName);
     199    LastOpenedList1.AddItem(FileName);
     200  end;
     201end;
     202
     203procedure TCore.FileClose;
    102204var
    103205  ModalResult: TModalResult;
     
    120222  if DoClose then begin
    121223    FreeAndNil(DataFile);
    122     UpdateFile;
    123224    FileClosed := True;
    124225  end;
    125226end;
    126227
    127 procedure TCore.AHomePageExecute(Sender: TObject);
    128 begin
    129   OpenWebPage(ApplicationInfo1.HomePage);
    130 end;
    131 
    132 procedure TCore.ASettingsExecute(Sender: TObject);
    133 begin
    134   FormSettings := TFormSettings.Create(nil);
    135   try
    136     FormSettings.LoadData;
    137     if FormSettings.ShowModal = mrOK then
    138       FormSettings.SaveData;
    139   finally
    140     FormSettings.Free;
    141   end;
    142 end;
    143 
    144 procedure TCore.AFileNewExecute(Sender: TObject);
    145 begin
    146   FileNew;
    147   UpdateFile;
    148 end;
    149 
    150 procedure TCore.AFileOpenExecute(Sender: TObject);
    151 begin
    152   OpenDialog1.DefaultExt := '';
    153   if Assigned(DataFile) then begin
    154     OpenDialog1.InitialDir := ExtractFileDir(DataFile.FileName);
    155     OpenDialog1.FileName := ExtractFileName(DataFile.FileName);
    156   end;
    157   if OpenDialog1.Execute then begin
    158     FileOpen(OpenDialog1.FileName);
    159   end;
    160 end;
    161 
    162 procedure TCore.AFileOpenRecentExecute(Sender: TObject);
    163 begin
    164   FileOpen(TMenuItem(Sender).Caption);
    165 end;
    166 
    167 procedure TCore.AFileSaveAsExecute(Sender: TObject);
    168 begin
    169   SaveDialog1.DefaultExt := DataFile.GetFileExt;
    170   SaveDialog1.InitialDir := ExtractFileDir(DataFile.FileName);
    171   SaveDialog1.FileName := ExtractFileName(DataFile.FileName);
    172   if SaveDialog1.Execute then begin
    173     DataFile.SaveToFile(SaveDialog1.FileName);
    174     LastOpenedList1.AddItem(SaveDialog1.FileName);
    175     UpdateFile;
    176   end;
    177 end;
    178 
    179 procedure TCore.AFileSaveExecute(Sender: TObject);
    180 begin
    181   if FileExists(DataFile.FileName) then begin
    182     DataFile.SaveToFile(DataFile.FileName);
    183     LastOpenedList1.AddItem(DataFile.FileName);
    184     UpdateFile;
    185   end else AFileSaveAs.Execute;
    186 end;
    187 
    188 procedure TCore.DataModuleCreate(Sender: TObject);
    189 begin
    190   DataFile := nil;
    191   FileClosed := True;
    192 end;
    193 
    194 procedure TCore.DataModuleDestroy(Sender: TObject);
    195 begin
    196   SaveConfig;
    197 end;
    198 
    199 procedure TCore.LastOpenedList1Change(Sender: TObject);
    200 begin
    201   LastOpenedList1.LoadToMenuItem(FormMain.MenuItemFileOpenRecent, AFileOpenRecentExecute);
    202   LastOpenedList1.LoadToMenuItem(FormMain.PopupMenuOpenRecent.Items, AFileOpenRecentExecute);
    203 end;
    204 
    205 procedure TCore.FileModified(Sender: TObject);
    206 begin
    207   UpdateFile;
    208 end;
    209 
    210 procedure TCore.FileOpen(FileName: string);
    211 begin
    212   AFileClose.Execute;
    213   if FileClosed then
    214   try
    215     FileNew;
    216     DataFile.LoadFromFile(FileName);
    217     LastOpenedList1.AddItem(FileName);
    218   finally
    219     UpdateFile;
    220   end;
    221 end;
    222 
    223228procedure TCore.FileNew;
    224229begin
    225   AFileClose.Execute;
     230  FileClose;
    226231  if FileClosed then begin
    227232    DataFile := TDataFile.Create;
Note: See TracChangeset for help on using the changeset viewer.