- Timestamp:
- Jul 26, 2012, 2:07:15 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.lfm
r49 r51 941 941 Images = ImageListMain 942 942 left = 216 943 top = 240943 top = 192 944 944 object AProjectOpen: TAction 945 945 Category = 'Project' … … 1928 1928 top = 240 1929 1929 end 1930 object CoolTranslator1: TCoolTranslator1931 POFilesFolder = 'Languages'1932 left = 2161933 top = 1841934 end1935 1930 object TimerRefresh: TTimer 1936 1931 OnTimer = TimerRefreshTimer 1937 1932 left = 56 1938 top = 2961939 end1940 object ApplicationInfo: TApplicationInfo1941 Identification = 11942 VersionMajor = 11943 VersionMinor = 01944 VersionBugFix = 01945 VersionSuffix = 'alfa'1946 CompanyName = 'Chronosoft'1947 CompanyHomePage = 'http://svn.zdechov.net/trac/LazFuck'1948 HomePage = 'http://svn.zdechov.net/trac/LazFuck'1949 AuthorsName = 'Chronos'1950 EmailContact = 'robie@centrum.cz'1951 AppName = 'LazFuck'1952 ReleaseDate = 411021953 RegistryKey = '\Software\Chronosoft\LazFuck'1954 RegistryRoot = rrKeyCurrentUser1955 left = 2161956 1933 top = 296 1957 1934 end -
trunk/Forms/UFormMain.pas
r48 r51 7 7 uses 8 8 Classes, SysUtils, FileUtil, SynEdit, Forms, Controls, Graphics, Dialogs, 9 Menus, ActnList, StdCtrls, ComCtrls, ExtCtrls, UTargetInterpretter, 10 UCoolTranslator, StrUtils, SpecializedList, UTarget, UApplicationInfo, 11 Registry, URegistry, ULastOpenedList, Process; 12 13 const 14 RegistryRoot = HKEY_CURRENT_USER; 9 Menus, ActnList, StdCtrls, ComCtrls, ExtCtrls, 10 StrUtils, SpecializedList, UTarget, 11 Registry, URegistry, Process; 15 12 16 13 type … … 19 16 20 17 TMainForm = class(TForm) 21 ApplicationInfo: TApplicationInfo;22 18 AProgramShowExecutionPoint: TAction; 23 19 AShowSourcePosition: TAction; … … 43 39 AProjectOpen: TAction; 44 40 ActionList1: TActionList; 45 CoolTranslator1: TCoolTranslator;46 41 ImageListMain: TImageList; 47 42 MainMenu1: TMainMenu; … … 145 140 private 146 141 FCurrentTarget: TTarget; 142 procedure SetCurrentTarget(AValue: TTarget); 147 143 procedure AProjectOpenRecentExecute(Sender: TObject); 148 144 procedure TargetStateChanged(Sender: TObject); … … 150 146 procedure MenuItemTargetClick(Sender: TObject); 151 147 procedure ProjectOpen(FileName: string); 152 procedure SetCurrentTarget(AValue: TTarget);153 148 procedure UpdateToolBarHints; 154 149 procedure DockInit; 155 150 procedure LastOpenedListChange(Sender: TObject); 156 151 public 157 Modified: Boolean;158 ProjectFileName: string;159 Targets: TTargetList;160 LastOpenedList: TLastOpenedList;161 OpenProjectOnStart: Boolean;162 152 procedure LoadFromRegistry(Root: HKEY; Key: string); 163 153 procedure SaveToRegistry(Root: HKEY; Key: string); … … 177 167 178 168 uses 179 UFormCPU, UFormOptions, UFormMessages, UTargetJava, 180 UTargetDelphi, UTargetPHP, UTargetC, UFormTargets, UFormOutput, UFormInput, 181 UFormMemory, UFormSourceCode, UFormTargetCode; 169 UCore, UFormCPU, UFormOptions, UFormMessages, UFormTargets, UFormOutput, UFormInput, 170 UFormMemory, UFormSourceCode, UFormTargetCode, UTargetInterpretter; 182 171 183 172 resourcestring … … 189 178 { TMainForm } 190 179 180 procedure TMainForm.SetCurrentTarget(AValue: TTarget); 181 var 182 I: Integer; 183 begin 184 if FCurrentTarget = AValue then Exit; 185 FCurrentTarget := AValue; 186 for I := 0 to Core.Targets.Count - 1 do 187 TTarget(Core.Targets[I]).OnChangeState := nil; 188 FCurrentTarget.OnChangeState := TargetStateChanged; 189 FCurrentTarget.Messages.OnChange := MessagesChanged; 190 UpdateTargetList; 191 UpdateInterface; 192 end; 193 191 194 procedure TMainForm.FormShow(Sender: TObject); 192 195 begin 193 LoadFromRegistry( RegistryRoot,ApplicationInfo.RegistryKey);196 LoadFromRegistry(HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey); 194 197 PageControlMain.TabIndex := 0; 195 if OpenProjectOnStart and (LastOpenedList.Items.Count > 0) then196 ProjectOpen( LastOpenedList.Items[0])198 if Core.OpenProjectOnStart and (Core.LastOpenedList.Items.Count > 0) then 199 ProjectOpen(Core.LastOpenedList.Items[0]) 197 200 else AProjectNew.Execute; 198 201 UpdateInterface; … … 228 231 if Sender is TMenuItem then 229 232 with TMenuItem(Sender) do begin 230 CurrentTarget := TTarget( Targets[MenuIndex]);233 CurrentTarget := TTarget(Core.Targets[MenuIndex]); 231 234 Checked := True; 232 235 for I := 0 to Parent.Count - 1 do … … 239 242 AProjectClose.Execute; 240 243 FormSourceCode.MemoSource.Lines.LoadFromFile(UTF8Decode(FileName)); 241 LastOpenedList.AddItem(FileName);242 ProjectFileName := FileName;243 Modified := False;244 Core.LastOpenedList.AddItem(FileName); 245 Core.ProjectFileName := FileName; 246 Core.Modified := False; 244 247 CurrentTarget.Compiled := False; 245 UpdateInterface;246 end;247 248 procedure TMainForm.SetCurrentTarget(AValue: TTarget);249 var250 I: Integer;251 begin252 if FCurrentTarget = AValue then Exit;253 FCurrentTarget := AValue;254 for I := 0 to Targets.Count - 1 do255 TTarget(Targets[I]).OnChangeState := nil;256 FCurrentTarget.OnChangeState := TargetStateChanged;257 FCurrentTarget.Messages.OnChange := MessagesChanged;258 UpdateTargetList;259 248 UpdateInterface; 260 249 end; … … 297 286 procedure TMainForm.LastOpenedListChange(Sender: TObject); 298 287 begin 299 LastOpenedList.LoadToMenuItem(MenuItemOpenRecent, AProjectOpenRecentExecute);300 LastOpenedList.LoadToMenuItem(PopupMenuRecentFiles.Items, AProjectOpenRecentExecute);288 Core.LastOpenedList.LoadToMenuItem(MenuItemOpenRecent, AProjectOpenRecentExecute); 289 Core.LastOpenedList.LoadToMenuItem(PopupMenuRecentFiles.Items, AProjectOpenRecentExecute); 301 290 end; 302 291 … … 309 298 RootKey := Root; 310 299 OpenKey(Key, True); 311 OpenProjectOnStart := ReadBoolWithDefault('OpenProjectOnStart', True);300 Core.OpenProjectOnStart := ReadBoolWithDefault('OpenProjectOnStart', True); 312 301 if ValueExists('LanguageCode') then 313 Co olTranslator1.Language :=CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', ''))314 else Co olTranslator1.Language :=CoolTranslator1.Languages.SearchByCode('');302 Core.CoolTranslator1.Language := Core.CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('LanguageCode', '')) 303 else Core.CoolTranslator1.Language := Core.CoolTranslator1.Languages.SearchByCode(''); 315 304 TargetName := ReadStringWithDefault('TargetName', 'Interpretter'); 316 CurrentTarget := Targets.FindByName(TargetName);317 if not Assigned(CurrentTarget) then CurrentTarget := TTarget( Targets[0]);305 CurrentTarget := Core.Targets.FindByName(TargetName); 306 if not Assigned(CurrentTarget) then CurrentTarget := TTarget(Core.Targets[0]); 318 307 finally 319 308 Free; 320 309 end; 321 LastOpenedList.LoadFromRegistry(Root, Key);322 Targets.LoadFromRegistry(Root, Key);310 Core.LastOpenedList.LoadFromRegistry(Root, Key); 311 Core.Targets.LoadFromRegistry(Root, Key); 323 312 end; 324 313 325 314 procedure TMainForm.SaveToRegistry(Root: HKEY; Key: string); 326 315 begin 327 Targets.SaveToRegistry(Root, Key);328 LastOpenedList.SaveToRegistry(Root, Key);316 Core.Targets.SaveToRegistry(Root, Key); 317 Core.LastOpenedList.SaveToRegistry(Root, Key); 329 318 with TRegistryEx.Create do 330 319 try 331 320 RootKey := Root; 332 321 OpenKey(Key, True); 333 WriteBool('OpenProjectOnStart', OpenProjectOnStart);334 if Assigned(Co olTranslator1.Language) and (CoolTranslator1.Language.Code <> '') then335 WriteString('LanguageCode', Co olTranslator1.Language.Code)322 WriteBool('OpenProjectOnStart', Core.OpenProjectOnStart); 323 if Assigned(Core.CoolTranslator1.Language) and (Core.CoolTranslator1.Language.Code <> '') then 324 WriteString('LanguageCode', Core.CoolTranslator1.Language.Code) 336 325 else DeleteValue('LanguageCode'); 337 326 WriteString('TargetName', CurrentTarget.Name); … … 345 334 Title: string; 346 335 begin 347 AProjectSave.Enabled := Modified;348 Title := ApplicationInfo.AppName;349 if ProjectFileName <> '' then Title :=ProjectFileName + ' - ' + Title;350 if Modified then Title := Title + ' *';336 AProjectSave.Enabled := Core.Modified; 337 Title := Core.ApplicationInfo.AppName; 338 if Core.ProjectFileName <> '' then Title := Core.ProjectFileName + ' - ' + Title; 339 if Core.Modified then Title := Title + ' *'; 351 340 Caption := Title; 352 FormSourceCode.MemoSource.Enabled := ProjectFileName <> '';353 AProjectClose.Enabled := ProjectFileName <> '';341 FormSourceCode.MemoSource.Enabled := Core.ProjectFileName <> ''; 342 AProjectClose.Enabled := Core.ProjectFileName <> ''; 354 343 AProgramRun.Enabled := (tcRun in CurrentTarget.Capabilities) and 355 ( ProjectFileName <> '') and (CurrentTarget.State = rsStopped) or (CurrentTarget.State = rsPaused);344 (Core.ProjectFileName <> '') and (CurrentTarget.State = rsStopped) or (CurrentTarget.State = rsPaused); 356 345 AProgramPause.Enabled := (tcPause in CurrentTarget.Capabilities) and 357 ( ProjectFileName <> '') and (CurrentTarget.State = rsRunning);346 (Core.ProjectFileName <> '') and (CurrentTarget.State = rsRunning); 358 347 AProgramStop.Enabled := (tcStop in CurrentTarget.Capabilities) and 359 ( ProjectFileName <> '') and (CurrentTarget.State <> rsStopped);348 (Core.ProjectFileName <> '') and (CurrentTarget.State <> rsStopped); 360 349 AProgramCompile.Enabled := (tcCompile in CurrentTarget.Capabilities) and 361 ( ProjectFileName <> '');350 (Core.ProjectFileName <> ''); 362 351 AProgramStepInto.Enabled := (tcStepInto in CurrentTarget.Capabilities) and 363 ( ProjectFileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));352 (Core.ProjectFileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped)); 364 353 AProgramStepOut.Enabled := (tcStepOut in CurrentTarget.Capabilities) and 365 ( ProjectFileName <> '') and (CurrentTarget.State = rsPaused);354 (Core.ProjectFileName <> '') and (CurrentTarget.State = rsPaused); 366 355 AProgramRunToCursor.Enabled := (tcRunToCursor in CurrentTarget.Capabilities) and 367 ( ProjectFileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));356 (Core.ProjectFileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped)); 368 357 AProgramStepOver.Enabled := (tcStepOver in CurrentTarget.Capabilities) and 369 ( ProjectFileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));358 (Core.ProjectFileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped)); 370 359 AProgramShowExecutionPoint.Enabled := (tcPause in CurrentTarget.Capabilities) and 371 ( ProjectFileName <> '') and (CurrentTarget.State = rsPaused);360 (Core.ProjectFileName <> '') and (CurrentTarget.State = rsPaused); 372 361 AShowSourcePosition.Enabled := CurrentTarget.Compiled; 373 362 AShowTargetPosition.Enabled := CurrentTarget.Compiled; … … 385 374 I: Integer; 386 375 begin 387 Targets.LoadToMenuItem(MenuItemTarget, MenuItemTargetClick, CurrentTarget);388 Targets.LoadToMenuItem(PopupMenuTargets.Items, MenuItemTargetClick, CurrentTarget);376 Core.Targets.LoadToMenuItem(MenuItemTarget, MenuItemTargetClick, CurrentTarget); 377 Core.Targets.LoadToMenuItem(PopupMenuTargets.Items, MenuItemTargetClick, CurrentTarget); 389 378 390 379 // Update toolbutton 391 I := Targets.IndexOf(CurrentTarget);380 I := Core.Targets.IndexOf(CurrentTarget); 392 381 if I <> -1 then 393 with TTarget( Targets[I]) do begin382 with TTarget(Core.Targets[I]) do begin 394 383 ToolButtonTarget.ImageIndex := ImageIndex; 395 384 ToolButtonTarget.Caption := Name; … … 400 389 procedure TMainForm.FormCreate(Sender: TObject); 401 390 begin 402 Targets := TTargetList.Create;403 Targets.Add(TTargetInterpretter.Create);404 Targets.Add(TTargetDelphi.Create);405 Targets.Add(TTargetPHP.Create);406 Targets.Add(TTargetC.Create);407 Targets.Add(TTargetJava.Create);408 391 UpdateTargetList; 409 LastOpenedList := TLastOpenedList.Create(nil); 410 LastOpenedList.OnChange := LastOpenedListChange; 392 Core.LastOpenedList.OnChange := LastOpenedListChange; 411 393 end; 412 394 413 395 procedure TMainForm.FormDestroy(Sender: TObject); 414 396 begin 415 SaveToRegistry(RegistryRoot, ApplicationInfo.RegistryKey); 416 LastOpenedList.Free; 417 Targets.Free; 397 SaveToRegistry(HKEY(Core.ApplicationInfo.RegistryRoot), Core.ApplicationInfo.RegistryKey); 418 398 end; 419 399 … … 461 441 procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean); 462 442 begin 463 if Modified then AProjectSaveAs.Execute;443 if Core.Modified then AProjectSaveAs.Execute; 464 444 end; 465 445 … … 483 463 Optimization := coNormal; 484 464 SourceCode := FormSourceCode.MemoSource.Text; 485 ProjectFileName := Self.ProjectFileName;486 ProgramName := ExtractFileNameOnly( Self.ProjectFileName);465 ProjectFileName := Core.ProjectFileName; 466 ProgramName := ExtractFileNameOnly(Core.ProjectFileName); 487 467 CurrentTarget.Messages.AddMessage('Compiling...'); 488 468 Compile; … … 568 548 procedure TMainForm.AProjectCloseExecute(Sender: TObject); 569 549 begin 570 if Modified then AProjectSaveAs.Execute;550 if Core.Modified then AProjectSaveAs.Execute; 571 551 AProgramStop.Execute; 572 ProjectFileName := '';552 Core.ProjectFileName := ''; 573 553 FormSourceCode.MemoSource.Clear; 574 Modified := False;554 Core.Modified := False; 575 555 UpdateInterface; 576 556 end; … … 579 559 begin 580 560 AProjectClose.Execute; 581 ProjectFileName := 'Examples' + DirectorySeparator + SNewProject + '.b';561 Core.ProjectFileName := 'Examples' + DirectorySeparator + SNewProject + '.b'; 582 562 FormSourceCode.MemoSource.Clear; 583 Modified := False;563 Core.Modified := False; 584 564 CurrentTarget.Compiled := False; 585 565 UpdateInterface; … … 588 568 procedure TMainForm.AProjectOpenRecentExecute(Sender: TObject); 589 569 begin 590 ProjectOpen( LastOpenedList.Items[TMenuItem(Sender).MenuIndex]);570 ProjectOpen(Core.LastOpenedList.Items[TMenuItem(Sender).MenuIndex]); 591 571 end; 592 572 … … 594 574 begin 595 575 AProjectClose.Execute; 596 OpenDialog1.FileName := ProjectFileName;576 OpenDialog1.FileName := Core.ProjectFileName; 597 577 if OpenDialog1.Execute then begin 598 578 ProjectOpen(OpenDialog1.FileName); … … 602 582 procedure TMainForm.AProjectSaveAsExecute(Sender: TObject); 603 583 begin 604 SaveDialog1.FileName := ProjectFileName;584 SaveDialog1.FileName := Core.ProjectFileName; 605 585 if SaveDialog1.Execute then begin 606 586 FormSourceCode.MemoSource.Lines.SaveToFile(UTF8Decode(SaveDialog1.FileName)); 607 ProjectFileName := SaveDialog1.FileName;608 LastOpenedList.AddItem(SaveDialog1.FileName);609 Modified := False;587 Core.ProjectFileName := SaveDialog1.FileName; 588 Core.LastOpenedList.AddItem(SaveDialog1.FileName); 589 Core.Modified := False; 610 590 UpdateInterface; 611 591 end; … … 614 594 procedure TMainForm.AProjectSaveExecute(Sender: TObject); 615 595 begin 616 if Modified then AProjectSaveAs.Execute;596 if Core.Modified then AProjectSaveAs.Execute; 617 597 end; 618 598 -
trunk/Forms/UFormOptions.pas
r37 r51 40 40 41 41 uses 42 U FormMain, ULanguages;42 UCore, ULanguages; 43 43 44 44 { TOptionsForm } … … 46 46 procedure TOptionsForm.FormShow(Sender: TObject); 47 47 begin 48 MainForm.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items);49 ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject( MainForm.CoolTranslator1.Language);48 Core.CoolTranslator1.LanguageListToStrings(ComboBoxLanguage.Items); 49 ComboBoxLanguage.ItemIndex := ComboBoxLanguage.Items.IndexOfObject(Core.CoolTranslator1.Language); 50 50 if ComboBoxLanguage.ItemIndex = -1 then ComboBoxLanguage.ItemIndex := 0; 51 CheckBox1.Checked := MainForm.OpenProjectOnStart;51 CheckBox1.Checked := Core.OpenProjectOnStart; 52 52 end; 53 53 … … 55 55 begin 56 56 if ComboBoxLanguage.ItemIndex <> -1 then 57 MainForm.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]);58 MainForm.OpenProjectOnStart := CheckBox1.Checked;57 Core.CoolTranslator1.Language := TLanguage(ComboBoxLanguage.Items.Objects[ComboBoxLanguage.ItemIndex]); 58 Core.OpenProjectOnStart := CheckBox1.Checked; 59 59 end; 60 60 -
trunk/Forms/UFormSourceCode.pas
r47 r51 64 64 65 65 uses 66 U FormMain;66 UCore, UFormMain; 67 67 68 68 resourcestring … … 168 168 procedure TFormSourceCode.MemoSourceChange(Sender: TObject); 169 169 begin 170 MainForm.Modified := True;170 Core.Modified := True; 171 171 MainForm.CurrentTarget.Compiled := False; 172 172 MainForm.UpdateInterface; -
trunk/Forms/UFormTargets.pas
r50 r51 31 31 32 32 uses 33 U FormMain, UTarget, UFormTargetOptions;33 UCore, UTarget, UFormTargetOptions; 34 34 35 35 { TFormCompilers } … … 42 42 procedure TFormCompilers.ListView1Data(Sender: TObject; Item: TListItem); 43 43 begin 44 if (Item.Index >= 0) and (Item.Index < MainForm.Targets.Count) then45 with TTarget( MainForm.Targets[Item.Index]) do begin44 if (Item.Index >= 0) and (Item.Index < Core.Targets.Count) then 45 with TTarget(Core.Targets[Item.Index]) do begin 46 46 Item.Caption := Name; 47 Item.Data := MainForm.Targets[Item.Index];47 Item.Data := Core.Targets[Item.Index]; 48 48 Item.SubItems.Add(ExecutorPath); 49 49 Item.SubItems.Add(CompilerPath); … … 62 62 procedure TFormCompilers.ReloadList; 63 63 begin 64 ListView1.Items.Count := MainForm.Targets.Count;64 ListView1.Items.Count := Core.Targets.Count; 65 65 ListView1.Refresh; 66 66 end; -
trunk/LazFuckIDE.lpi
r50 r51 90 90 </Item5> 91 91 </RequiredPackages> 92 <Units Count="1 8">92 <Units Count="19"> 93 93 <Unit0> 94 94 <Filename Value="LazFuckIDE.lpr"/> … … 208 208 <IsPartOfProject Value="True"/> 209 209 <ComponentName Value="FormTargetOptions"/> 210 <HasResources Value="True"/> 210 211 <ResourceBaseClass Value="Form"/> 211 212 <UnitName Value="UFormTargetOptions"/> 212 213 </Unit17> 214 <Unit18> 215 <Filename Value="UCore.pas"/> 216 <IsPartOfProject Value="True"/> 217 <ComponentName Value="Core"/> 218 <HasResources Value="True"/> 219 <ResourceBaseClass Value="DataModule"/> 220 <UnitName Value="UCore"/> 221 </Unit18> 213 222 </Units> 214 223 </ProjectOptions> -
trunk/LazFuckIDE.lpr
r50 r51 13 13 UFormOptions, CoolTranslator, Common, 14 14 TemplateGenerics, UFormTargets, UFormOutput, UFormInput, UFormMemory, 15 UFormMessages, UFormSourceCode, UFormTargetCode, UFormTargetOptions ;15 UFormMessages, UFormSourceCode, UFormTargetCode, UFormTargetOptions, UCore; 16 16 17 17 {$R *.res} … … 21 21 RequireDerivedFormResource := True; 22 22 Application.Initialize; 23 Application.CreateForm(TCore, Core); 23 24 Application.CreateForm(TMainForm, MainForm); 24 25 Application.CreateForm(TFormCPU, FormCPU);
Note:
See TracChangeset
for help on using the changeset viewer.