Changeset 62 for trunk/Forms/UFormMain.pas
- Timestamp:
- Dec 4, 2014, 11:46:40 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r61 r62 154 154 procedure LastOpenedListChange(Sender: TObject); 155 155 public 156 LastFileName: string;157 156 procedure LoadFromRegistry(Root: HKEY; Key: string); 158 157 procedure SaveToRegistry(Root: HKEY; Key: string); … … 182 181 SCompileStart = 'Compiling...'; 183 182 SDone = 'Done'; 183 SChanged = 'Changed'; 184 184 185 185 { TMainForm } … … 264 264 Core.LastOpenedList.AddItem(FileName); 265 265 Core.Project.FileName := FileName; 266 Core.Project. Modified := False;266 Core.Project.Openned := True; 267 267 CurrentTarget.Compiled := False; 268 268 UpdateInterface; … … 319 319 OpenKey(Key, True); 320 320 TargetName := ReadStringWithDefault('TargetName', 'Interpretter'); 321 LastFileName := ReadStringWithDefault('LastFileName',322 ExtractFileDir(Application.ExeName) + DirectorySeparator + 'Examples');323 321 CurrentTarget := Core.Targets.FindByName(TargetName); 324 322 if not Assigned(CurrentTarget) then CurrentTarget := TTarget(Core.Targets[0]); … … 335 333 OpenKey(Key, True); 336 334 WriteString('TargetName', CurrentTarget.Name); 337 WriteString('LastFileName', LastFileName);338 335 finally 339 336 Free; … … 345 342 Title: string; 346 343 begin 344 Title := ''; 345 if Core.Project.FileName <> '' then Title := Core.Project.FileName; 346 if Core.Project.Modified then Title := Title + ' (' + SChanged + ')'; 347 Title:= Title + ' - ' + Core.ApplicationInfo.AppName; 348 Caption := Title; 347 349 AProjectSave.Enabled := Core.Project.Modified; 348 Title := Core.ApplicationInfo.AppName; 349 if Core.Project.FileName <> '' then Title := Core.Project.FileName + ' - ' + Title; 350 if Core.Project.Modified then Title := Title + ' *'; 351 Caption := Title; 352 FormSourceCode.MemoSource.Enabled := Core.Project.FileName <> ''; 353 AProjectClose.Enabled := Core.Project.FileName <> ''; 350 FormSourceCode.MemoSource.Enabled := Core.Project.Openned; 351 AProjectClose.Enabled := Core.Project.Openned; 352 AProjectSaveAs.Enabled := Core.Project.Openned; 354 353 AProgramRun.Enabled := (tcRun in CurrentTarget.Capabilities) and 355 (Core.Project.FileName <> '')and (CurrentTarget.State = rsStopped) or (CurrentTarget.State = rsPaused);354 Core.Project.Openned and (CurrentTarget.State = rsStopped) or (CurrentTarget.State = rsPaused); 356 355 AProgramPause.Enabled := (tcPause in CurrentTarget.Capabilities) and 357 (Core.Project.FileName <> '')and (CurrentTarget.State = rsRunning);356 Core.Project.Openned and (CurrentTarget.State = rsRunning); 358 357 AProgramStop.Enabled := (tcStop in CurrentTarget.Capabilities) and 359 (Core.Project.FileName <> '')and (CurrentTarget.State <> rsStopped);358 Core.Project.Openned and (CurrentTarget.State <> rsStopped); 360 359 AProgramCompile.Enabled := (tcCompile in CurrentTarget.Capabilities) and 361 (Core.Project.FileName <> '');360 Core.Project.Openned; 362 361 AProgramStepInto.Enabled := (tcStepInto in CurrentTarget.Capabilities) and 363 (Core.Project.FileName <> '')and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));362 Core.Project.Openned and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped)); 364 363 AProgramStepOut.Enabled := (tcStepOut in CurrentTarget.Capabilities) and 365 (Core.Project.FileName <> '')and (CurrentTarget.State = rsPaused);364 Core.Project.Openned and (CurrentTarget.State = rsPaused); 366 365 AProgramRunToCursor.Enabled := (tcRunToCursor in CurrentTarget.Capabilities) and 367 (Core.Project.FileName <> '')and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));366 Core.Project.Openned and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped)); 368 367 AProgramStepOver.Enabled := (tcStepOver in CurrentTarget.Capabilities) and 369 (Core.Project.FileName <> '')and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));368 Core.Project.Openned and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped)); 370 369 AProgramShowExecutionPoint.Enabled := (tcPause in CurrentTarget.Capabilities) and 371 (Core.Project.FileName <> '')and (CurrentTarget.State = rsPaused);370 Core.Project.Openned and (CurrentTarget.State = rsPaused); 372 371 AShowSourcePosition.Enabled := CurrentTarget.Compiled; 373 372 AShowTargetPosition.Enabled := CurrentTarget.Compiled; … … 568 567 if Core.Project.Modified then AProjectSaveAs.Execute; 569 568 AProgramStop.Execute; 570 Core.Project. FileName := '';569 Core.Project.Openned := False; 571 570 FormSourceCode.MemoSource.Clear; 572 Core.Project.Modified := False;573 571 UpdateInterface; 574 572 end; … … 579 577 Core.Project.FileName := 'Examples' + DirectorySeparator + SNewProject + '.b'; 580 578 FormSourceCode.MemoSource.Clear; 581 Core.Project. Modified := False;579 Core.Project.Openned := True; 582 580 CurrentTarget.Compiled := False; 583 581 UpdateInterface; … … 592 590 begin 593 591 AProjectClose.Execute; 594 OpenDialog1.FileName := LastFileName; 595 OpenDialog1.InitialDir := ExtractFileDir(LastFileName); 592 if Core.LastOpenedList.Items.Count > 0 then 593 OpenDialog1.FileName := Core.LastOpenedList.Items[0] 594 else OpenDialog1.FileName := ExtractFileDir(Application.ExeName) + DirectorySeparator + 'Examples'; 595 OpenDialog1.InitialDir := ExtractFileDir(OpenDialog1.FileName); 596 596 if OpenDialog1.Execute then begin 597 LastFileName := OpenDialog1.FileName;598 597 ProjectOpen(OpenDialog1.FileName); 599 598 end; … … 614 613 procedure TMainForm.AProjectSaveExecute(Sender: TObject); 615 614 begin 616 if Core.Project.Modified then AProjectSaveAs.Execute; 615 if Core.Project.Modified and FileExistsUTF8(Core.Project.FileName) then begin 616 FormSourceCode.MemoSource.Lines.SaveToFile(UTF8Decode(Core.Project.FileName)); 617 Core.Project.Modified := False; 618 UpdateInterface; 619 end else AProjectSaveAs.Execute; 617 620 end; 618 621
Note:
See TracChangeset
for help on using the changeset viewer.