Ignore:
Timestamp:
Dec 4, 2014, 11:26:54 AM (10 years ago)
Author:
chronos
Message:
  • Added: Unit project which should handle all project related operations.
  • Fixed: TScaleDPI to handle also lower then default DPI and different horizontal and vertical DPI.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r60 r61  
    263263  FormSourceCode.MemoSource.Lines.LoadFromFile(UTF8Decode(FileName));
    264264  Core.LastOpenedList.AddItem(FileName);
    265   Core.ProjectFileName := FileName;
    266   Core.Modified := False;
     265  Core.Project.FileName := FileName;
     266  Core.Project.Modified := False;
    267267  CurrentTarget.Compiled := False;
    268268  UpdateInterface;
     
    300300  FormMessages.Align := alClient;
    301301  FormMessages.Show;
    302   PageControlRight.Width := MainForm.Width div 2;
     302  PageControlRight.Width := MainForm.Width div 3;
    303303  PageControlBottom.Height := MainForm.Height div 5;
    304304end;
     
    345345  Title: string;
    346346begin
    347   AProjectSave.Enabled := Core.Modified;
     347  AProjectSave.Enabled := Core.Project.Modified;
    348348  Title := Core.ApplicationInfo.AppName;
    349   if Core.ProjectFileName <> '' 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 + ' *';
    351351  Caption := Title;
    352   FormSourceCode.MemoSource.Enabled := Core.ProjectFileName <> '';
    353   AProjectClose.Enabled := Core.ProjectFileName <> '';
     352  FormSourceCode.MemoSource.Enabled := Core.Project.FileName <> '';
     353  AProjectClose.Enabled := Core.Project.FileName <> '';
    354354  AProgramRun.Enabled := (tcRun in CurrentTarget.Capabilities) and
    355     (Core.ProjectFileName <> '') and (CurrentTarget.State = rsStopped) or (CurrentTarget.State = rsPaused);
     355    (Core.Project.FileName <> '') and (CurrentTarget.State = rsStopped) or (CurrentTarget.State = rsPaused);
    356356  AProgramPause.Enabled := (tcPause in CurrentTarget.Capabilities) and
    357     (Core.ProjectFileName <> '') and (CurrentTarget.State = rsRunning);
     357    (Core.Project.FileName <> '') and (CurrentTarget.State = rsRunning);
    358358  AProgramStop.Enabled := (tcStop in CurrentTarget.Capabilities) and
    359     (Core.ProjectFileName <> '') and (CurrentTarget.State <> rsStopped);
     359    (Core.Project.FileName <> '') and (CurrentTarget.State <> rsStopped);
    360360  AProgramCompile.Enabled := (tcCompile in CurrentTarget.Capabilities) and
    361     (Core.ProjectFileName <> '');
     361    (Core.Project.FileName <> '');
    362362  AProgramStepInto.Enabled := (tcStepInto in CurrentTarget.Capabilities) and
    363     (Core.ProjectFileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));
     363    (Core.Project.FileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));
    364364  AProgramStepOut.Enabled := (tcStepOut in CurrentTarget.Capabilities) and
    365     (Core.ProjectFileName <> '') and (CurrentTarget.State = rsPaused);
     365    (Core.Project.FileName <> '') and (CurrentTarget.State = rsPaused);
    366366  AProgramRunToCursor.Enabled := (tcRunToCursor in CurrentTarget.Capabilities) and
    367     (Core.ProjectFileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));
     367    (Core.Project.FileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));
    368368  AProgramStepOver.Enabled := (tcStepOver in CurrentTarget.Capabilities) and
    369     (Core.ProjectFileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));
     369    (Core.Project.FileName <> '') and ((CurrentTarget.State = rsPaused) or (CurrentTarget.State = rsStopped));
    370370  AProgramShowExecutionPoint.Enabled := (tcPause in CurrentTarget.Capabilities) and
    371     (Core.ProjectFileName <> '') and (CurrentTarget.State = rsPaused);
     371    (Core.Project.FileName <> '') and (CurrentTarget.State = rsPaused);
    372372  AShowSourcePosition.Enabled := CurrentTarget.Compiled;
    373373  AShowTargetPosition.Enabled := CurrentTarget.Compiled;
     
    457457procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean);
    458458begin
    459   if Core.Modified then AProjectSaveAs.Execute;
     459  if Core.Project.Modified then AProjectSaveAs.Execute;
    460460end;
    461461
     
    481481    Optimization := coNormal;
    482482    SourceCode := FormSourceCode.MemoSource.Text;
    483     ProjectFileName := Core.ProjectFileName;
    484     ProgramName := ExtractFileNameOnly(Core.ProjectFileName);
     483    ProjectFileName := Core.Project.FileName;
     484    ProgramName := ExtractFileNameOnly(Core.Project.FileName);
    485485    CurrentTarget.Messages.AddMessage(SCompileStart);
    486486    Compile;
     
    566566procedure TMainForm.AProjectCloseExecute(Sender: TObject);
    567567begin
    568   if Core.Modified then AProjectSaveAs.Execute;
     568  if Core.Project.Modified then AProjectSaveAs.Execute;
    569569  AProgramStop.Execute;
    570   Core.ProjectFileName := '';
     570  Core.Project.FileName := '';
    571571  FormSourceCode.MemoSource.Clear;
    572   Core.Modified := False;
     572  Core.Project.Modified := False;
    573573  UpdateInterface;
    574574end;
     
    577577begin
    578578  AProjectClose.Execute;
    579   Core.ProjectFileName := 'Examples' + DirectorySeparator + SNewProject + '.b';
     579  Core.Project.FileName := 'Examples' + DirectorySeparator + SNewProject + '.b';
    580580  FormSourceCode.MemoSource.Clear;
    581   Core.Modified := False;
     581  Core.Project.Modified := False;
    582582  CurrentTarget.Compiled := False;
    583583  UpdateInterface;
     
    602602procedure TMainForm.AProjectSaveAsExecute(Sender: TObject);
    603603begin
    604   SaveDialog1.FileName := Core.ProjectFileName;
     604  SaveDialog1.FileName := Core.Project.FileName;
    605605  if SaveDialog1.Execute then begin
    606606    FormSourceCode.MemoSource.Lines.SaveToFile(UTF8Decode(SaveDialog1.FileName));
    607     Core.ProjectFileName := SaveDialog1.FileName;
     607    Core.Project.FileName := SaveDialog1.FileName;
    608608    Core.LastOpenedList.AddItem(SaveDialog1.FileName);
    609     Core.Modified := False;
     609    Core.Project.Modified := False;
    610610    UpdateInterface;
    611611  end;
     
    614614procedure TMainForm.AProjectSaveExecute(Sender: TObject);
    615615begin
    616   if Core.Modified then AProjectSaveAs.Execute;
     616  if Core.Project.Modified then AProjectSaveAs.Execute;
    617617end;
    618618
Note: See TracChangeset for help on using the changeset viewer.