Changeset 61
- Timestamp:
- Dec 4, 2014, 11:26:54 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r60 r61 263 263 FormSourceCode.MemoSource.Lines.LoadFromFile(UTF8Decode(FileName)); 264 264 Core.LastOpenedList.AddItem(FileName); 265 Core.Project FileName := FileName;266 Core. Modified := False;265 Core.Project.FileName := FileName; 266 Core.Project.Modified := False; 267 267 CurrentTarget.Compiled := False; 268 268 UpdateInterface; … … 300 300 FormMessages.Align := alClient; 301 301 FormMessages.Show; 302 PageControlRight.Width := MainForm.Width div 2;302 PageControlRight.Width := MainForm.Width div 3; 303 303 PageControlBottom.Height := MainForm.Height div 5; 304 304 end; … … 345 345 Title: string; 346 346 begin 347 AProjectSave.Enabled := Core. Modified;347 AProjectSave.Enabled := Core.Project.Modified; 348 348 Title := Core.ApplicationInfo.AppName; 349 if Core.Project FileName <> '' then Title := Core.ProjectFileName + ' - ' + Title;350 if Core. Modified then Title := Title + ' *';349 if Core.Project.FileName <> '' then Title := Core.Project.FileName + ' - ' + Title; 350 if Core.Project.Modified then Title := Title + ' *'; 351 351 Caption := Title; 352 FormSourceCode.MemoSource.Enabled := Core.Project FileName <> '';353 AProjectClose.Enabled := Core.Project FileName <> '';352 FormSourceCode.MemoSource.Enabled := Core.Project.FileName <> ''; 353 AProjectClose.Enabled := Core.Project.FileName <> ''; 354 354 AProgramRun.Enabled := (tcRun in CurrentTarget.Capabilities) and 355 (Core.Project FileName <> '') and (CurrentTarget.State = rsStopped) or (CurrentTarget.State = rsPaused);355 (Core.Project.FileName <> '') and (CurrentTarget.State = rsStopped) or (CurrentTarget.State = rsPaused); 356 356 AProgramPause.Enabled := (tcPause in CurrentTarget.Capabilities) and 357 (Core.Project FileName <> '') and (CurrentTarget.State = rsRunning);357 (Core.Project.FileName <> '') and (CurrentTarget.State = rsRunning); 358 358 AProgramStop.Enabled := (tcStop in CurrentTarget.Capabilities) and 359 (Core.Project FileName <> '') and (CurrentTarget.State <> rsStopped);359 (Core.Project.FileName <> '') and (CurrentTarget.State <> rsStopped); 360 360 AProgramCompile.Enabled := (tcCompile in CurrentTarget.Capabilities) and 361 (Core.Project FileName <> '');361 (Core.Project.FileName <> ''); 362 362 AProgramStepInto.Enabled := (tcStepInto in CurrentTarget.Capabilities) and 363 (Core.Project FileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));363 (Core.Project.FileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped)); 364 364 AProgramStepOut.Enabled := (tcStepOut in CurrentTarget.Capabilities) and 365 (Core.Project FileName <> '') and (CurrentTarget.State = rsPaused);365 (Core.Project.FileName <> '') and (CurrentTarget.State = rsPaused); 366 366 AProgramRunToCursor.Enabled := (tcRunToCursor in CurrentTarget.Capabilities) and 367 (Core.Project FileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));367 (Core.Project.FileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped)); 368 368 AProgramStepOver.Enabled := (tcStepOver in CurrentTarget.Capabilities) and 369 (Core.Project FileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));369 (Core.Project.FileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped)); 370 370 AProgramShowExecutionPoint.Enabled := (tcPause in CurrentTarget.Capabilities) and 371 (Core.Project FileName <> '') and (CurrentTarget.State = rsPaused);371 (Core.Project.FileName <> '') and (CurrentTarget.State = rsPaused); 372 372 AShowSourcePosition.Enabled := CurrentTarget.Compiled; 373 373 AShowTargetPosition.Enabled := CurrentTarget.Compiled; … … 457 457 procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean); 458 458 begin 459 if Core. Modified then AProjectSaveAs.Execute;459 if Core.Project.Modified then AProjectSaveAs.Execute; 460 460 end; 461 461 … … 481 481 Optimization := coNormal; 482 482 SourceCode := FormSourceCode.MemoSource.Text; 483 ProjectFileName := Core.Project FileName;484 ProgramName := ExtractFileNameOnly(Core.Project FileName);483 ProjectFileName := Core.Project.FileName; 484 ProgramName := ExtractFileNameOnly(Core.Project.FileName); 485 485 CurrentTarget.Messages.AddMessage(SCompileStart); 486 486 Compile; … … 566 566 procedure TMainForm.AProjectCloseExecute(Sender: TObject); 567 567 begin 568 if Core. Modified then AProjectSaveAs.Execute;568 if Core.Project.Modified then AProjectSaveAs.Execute; 569 569 AProgramStop.Execute; 570 Core.Project FileName := '';570 Core.Project.FileName := ''; 571 571 FormSourceCode.MemoSource.Clear; 572 Core. Modified := False;572 Core.Project.Modified := False; 573 573 UpdateInterface; 574 574 end; … … 577 577 begin 578 578 AProjectClose.Execute; 579 Core.Project FileName := 'Examples' + DirectorySeparator + SNewProject + '.b';579 Core.Project.FileName := 'Examples' + DirectorySeparator + SNewProject + '.b'; 580 580 FormSourceCode.MemoSource.Clear; 581 Core. Modified := False;581 Core.Project.Modified := False; 582 582 CurrentTarget.Compiled := False; 583 583 UpdateInterface; … … 602 602 procedure TMainForm.AProjectSaveAsExecute(Sender: TObject); 603 603 begin 604 SaveDialog1.FileName := Core.Project FileName;604 SaveDialog1.FileName := Core.Project.FileName; 605 605 if SaveDialog1.Execute then begin 606 606 FormSourceCode.MemoSource.Lines.SaveToFile(UTF8Decode(SaveDialog1.FileName)); 607 Core.Project FileName := SaveDialog1.FileName;607 Core.Project.FileName := SaveDialog1.FileName; 608 608 Core.LastOpenedList.AddItem(SaveDialog1.FileName); 609 Core. Modified := False;609 Core.Project.Modified := False; 610 610 UpdateInterface; 611 611 end; … … 614 614 procedure TMainForm.AProjectSaveExecute(Sender: TObject); 615 615 begin 616 if Core. Modified then AProjectSaveAs.Execute;616 if Core.Project.Modified then AProjectSaveAs.Execute; 617 617 end; 618 618 -
trunk/Forms/UFormMemory.lfm
r59 r61 1 1 object FormMemory: TFormMemory 2 Left = 2562 Left = 565 3 3 Height = 259 4 Top = 324 Top = 182 5 5 Width = 391 6 6 Caption = 'Memory' … … 34 34 Width = 330 35 35 end> 36 Font.Height = -1 136 Font.Height = -12 37 37 Font.Name = 'Courier New' 38 38 OwnerData = True -
trunk/Forms/UFormMemory.pas
r38 r61 63 63 end; 64 64 65 66 65 end. 67 66 -
trunk/Forms/UFormSourceCode.lfm
r48 r61 7 7 ClientHeight = 240 8 8 ClientWidth = 320 9 LCLVersion = '1. 1'9 LCLVersion = '1.3' 10 10 object MemoSource: TMemo 11 11 Left = 0 -
trunk/Forms/UFormSourceCode.pas
r51 r61 168 168 procedure TFormSourceCode.MemoSourceChange(Sender: TObject); 169 169 begin 170 Core. Modified := True;170 Core.Project.Modified := True; 171 171 MainForm.CurrentTarget.Compiled := False; 172 172 MainForm.UpdateInterface; -
trunk/LazFuckIDE.lpi
r60 r61 96 96 </Item6> 97 97 </RequiredPackages> 98 <Units Count="2 1">98 <Units Count="22"> 99 99 <Unit0> 100 100 <Filename Value="LazFuckIDE.lpr"/> … … 199 199 <HasResources Value="True"/> 200 200 <ResourceBaseClass Value="Form"/> 201 <UnitName Value="UFormSourceCode"/> 201 202 </Unit15> 202 203 <Unit16> … … 232 233 <IsPartOfProject Value="True"/> 233 234 <ComponentName Value="FormLog"/> 235 <HasResources Value="True"/> 234 236 <ResourceBaseClass Value="Form"/> 235 237 <UnitName Value="UFormLog"/> 236 238 </Unit20> 239 <Unit21> 240 <Filename Value="UProject.pas"/> 241 <IsPartOfProject Value="True"/> 242 <UnitName Value="UProject"/> 243 </Unit21> 237 244 </Units> 238 245 </ProjectOptions> -
trunk/LazFuckIDE.lpr
r60 r61 13 13 UFormOutput, UFormInput, UFormMemory, UFormMessages, UFormSourceCode, 14 14 UFormTargetCode, UFormTargetOptions, UCore, Common, TemplateGenerics, 15 CoolTranslator, UFormLog ;15 CoolTranslator, UFormLog, UProject; 16 16 17 17 {$R *.res} -
trunk/Packages/Common/Common.lpk
r59 r61 102 102 <Item20> 103 103 <Filename Value="UScaleDPI.pas"/> 104 <HasRegisterProc Value="True"/> 104 105 <UnitName Value="UScaleDPI"/> 105 106 </Item20> -
trunk/Packages/Common/Common.pas
r59 r61 24 24 RegisterUnit('UPersistentForm', @UPersistentForm.Register); 25 25 RegisterUnit('UFindFile', @UFindFile.Register); 26 RegisterUnit('UScaleDPI', @UScaleDPI.Register); 26 27 end; 27 28 -
trunk/Packages/Common/UScaleDPI.pas
r59 r61 14 14 { TScaleDPI } 15 15 16 TScaleDPI = class 16 TScaleDPI = class(TComponent) 17 17 private 18 18 FAutoDetect: Boolean; … … 27 27 function ScaleX(Size: Integer; FromDPI: Integer): Integer; 28 28 function ScaleY(Size: Integer; FromDPI: Integer): Integer; 29 constructor Create; 29 constructor Create(AOwner: TComponent); 30 published 30 31 property AutoDetect: Boolean read FAutoDetect write SetAutoDetect; 31 32 end; 32 33 34 procedure Register; 33 35 34 36 implementation 37 38 procedure Register; 39 begin 40 RegisterComponents('Common', [TScaleDPI]); 41 end; 35 42 36 43 procedure TScaleDPI.SetAutoDetect(AValue: Boolean); … … 59 66 I: Integer; 60 67 begin 61 if (DPI.X <= FromDPI.X * 1.1) or (DPI.Y <= FromDPI.Y * 1.1) then Exit;62 63 68 NewWidth := ScaleX(ImgList.Width, FromDPI.X); 64 69 NewHeight := ScaleY(ImgList.Height, FromDPI.Y); … … 97 102 function TScaleDPI.ScaleX(Size: Integer; FromDPI: Integer): Integer; 98 103 begin 99 if DPI.X <= FromDPI then 100 Result := Size 101 else 102 Result := MulDiv(Size, DPI.X, FromDPI); 104 Result := MulDiv(Size, DPI.X, FromDPI); 103 105 end; 104 106 105 107 function TScaleDPI.ScaleY(Size: Integer; FromDPI: Integer): Integer; 106 108 begin 107 if Screen.PixelsPerInch <= FromDPI then 108 Result := Size 109 else 110 Result := MulDiv(Size, DPI.Y, FromDPI); 109 Result := MulDiv(Size, DPI.Y, FromDPI); 111 110 end; 112 111 … … 117 116 end; 118 117 119 constructor TScaleDPI.Create ;118 constructor TScaleDPI.Create(AOwner: TComponent); 120 119 begin 120 inherited; 121 121 DPI := Point(96, 96); 122 122 DesignDPI := Point(96, 96); … … 129 129 ToolBarControl: TToolBar; 130 130 begin 131 if (DPI.X <= FromDPI.X) or (DPI.Y <= FromDPI.Y) then Exit;132 133 131 with Control do begin 134 132 Left := ScaleX(Left, FromDPI.X); -
trunk/UCore.pas
r60 r61 6 6 7 7 uses 8 Classes, SysUtils, FileUtil, UApplicationInfo, ULastOpenedList, 8 Classes, SysUtils, FileUtil, UApplicationInfo, ULastOpenedList, UProject, 9 9 UCoolTranslator, UTarget, URegistry, Registry, XMLConf, Graphics, UScaleDPI; 10 10 … … 22 22 public 23 23 ScaleDPI: TScaleDPI; 24 Modified: Boolean; 25 ProjectFileName: string; 24 Project: TProject; 26 25 Targets: TTargetList; 27 26 OpenProjectOnStart: Boolean; … … 46 45 procedure TCore.DataModuleCreate(Sender: TObject); 47 46 begin 48 ScaleDPI := TScaleDPI.Create; 47 Project := TProject.Create; 48 ScaleDPI := TScaleDPI.Create(nil); 49 49 Targets := TTargetList.Create; 50 50 Targets.Add(TTargetInterpretter.Create); … … 61 61 SaveToRegistry(HKEY(ApplicationInfo.RegistryRoot), ApplicationInfo.RegistryKey); 62 62 Targets.Free; 63 Project.Free; 63 64 ScaleDPI.Free; 64 65 end;
Note:
See TracChangeset
for help on using the changeset viewer.