Changeset 65 for trunk


Ignore:
Timestamp:
Dec 5, 2014, 8:34:59 PM (10 years ago)
Author:
chronos
Message:
  • Added: Confirmation dialog for closing and saving file.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r64 r65  
    180180  SDone = 'Done';
    181181  SChanged = 'Changed';
     182  SUnsavedChanges = 'Unsaved changes';
     183  SDoYouWantToSaveProject = 'There are unsaved changes in project. Do you want to save them?';
     184  SCloseProjectFirst = 'Project need to be closed before it can be openned';
    182185
    183186{ TMainForm }
     
    259262procedure TMainForm.ProjectOpen(FileName: string);
    260263begin
    261   AProjectClose.Execute;
     264  if Core.Project.Openned then
     265    raise Exception.Create(SCloseProjectFirst);
    262266  FormSourceCode.MemoSource.Lines.LoadFromFile(UTF8Decode(FileName));
    263267  Core.LastOpenedList.AddItem(FileName);
     
    455459procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: boolean);
    456460begin
    457   if Core.Project.Modified then AProjectSaveAs.Execute;
     461  if Core.Project.Modified then begin
     462    AProjectClose.Execute;
     463    if Core.Project.Openned then CanClose := False;
     464  end;
    458465end;
    459466
     
    564571
    565572procedure TMainForm.AProjectCloseExecute(Sender: TObject);
    566 begin
    567   if Core.Project.Modified then AProjectSaveAs.Execute;
    568   AProgramStop.Execute;
    569   Core.Project.Openned := False;
    570   FormSourceCode.MemoSource.Clear;
    571   UpdateInterface;
     573var
     574  DialogResult: TModalResult;
     575begin
     576  DialogResult := mrNo;
     577  if Core.Project.Modified then begin
     578    DialogResult := MessageDlg(SUnsavedChanges, SDoYouWantToSaveProject, mtConfirmation, [mbYes, mbNo, mbCancel], 0);
     579    if DialogResult = mrYes then begin
     580      AProjectSave.Execute;
     581    end;
     582  end;
     583  if (DialogResult = mrNo) or (DialogResult = mrYes) then begin
     584    AProgramStop.Execute;
     585    Core.Project.Openned := False;
     586    FormSourceCode.MemoSource.Clear;
     587    UpdateInterface;
     588  end;
    572589end;
    573590
     
    575592begin
    576593  AProjectClose.Execute;
     594  if Core.Project.Openned then Exit;
    577595  Core.Project.FileName := 'Examples' + DirectorySeparator + SNewProject + '.b';
    578596  FormSourceCode.MemoSource.Clear;
     
    584602procedure TMainForm.AProjectOpenRecentExecute(Sender: TObject);
    585603begin
     604  AProjectClose.Execute;
     605  if Core.Project.Openned then Exit;
    586606  ProjectOpen(Core.LastOpenedList.Items[TMenuItem(Sender).MenuIndex]);
    587607end;
     
    589609procedure TMainForm.AProjectOpenExecute(Sender: TObject);
    590610begin
    591   AProjectClose.Execute;
    592611  if Core.LastOpenedList.Items.Count > 0 then
    593612    OpenDialog1.FileName := Core.LastOpenedList.Items[0]
     
    595614  OpenDialog1.InitialDir := ExtractFileDir(OpenDialog1.FileName);
    596615  if OpenDialog1.Execute then begin
     616    AProjectClose.Execute;
     617    if Core.Project.Openned then Exit;
    597618    ProjectOpen(OpenDialog1.FileName);
    598619  end;
  • trunk/Languages/LazFuckIDE.cs.po

    r64 r65  
    549549#: toptionsform.label4.caption
    550550msgid "Compiler optimizations:"
    551 msgstr ""
     551msgstr "Optimalizace překladače:"
    552552
    553553#: toptionsform.labeldpi.caption
     
    620620msgstr "Změněno"
    621621
     622#: uformmain.scloseprojectfirst
     623msgid "Project need to be closed before it can be openned"
     624msgstr "Projekt musí bÃœt uzavřen před tím, něş můşe bÃœt otevřen"
     625
    622626#: uformmain.scompilestart
    623627msgid "Compiling..."
     
    627631msgid "Done"
    628632msgstr "Dokončeno"
     633
     634#: uformmain.sdoyouwanttosaveproject
     635msgid "There are unsaved changes in project. Do you want to save them?"
     636msgstr "V projektu Jsou neuloÅŸené změny. Chcete je uloÅŸit?"
    629637
    630638#: uformmain.snewproject
     
    645653msgstr "Program zastaven"
    646654
     655#: uformmain.sunsavedchanges
     656msgid "Unsaved changes"
     657msgstr "NeuloÅŸené změny"
     658
    647659#: uformsourcecode.senternumber
    648660msgctxt "uformsourcecode.senternumber"
     
    750762#: utargetinterpretter.sunsupportedcommand
    751763msgid "Unsupported command"
    752 msgstr ""
    753 
     764msgstr "NepodporovanÃœ příkaz"
  • trunk/Languages/LazFuckIDE.po

    r64 r65  
    607607msgstr ""
    608608
     609#: uformmain.scloseprojectfirst
     610msgid "Project need to be closed before it can be openned"
     611msgstr ""
     612
    609613#: uformmain.scompilestart
    610614msgid "Compiling..."
     
    613617#: uformmain.sdone
    614618msgid "Done"
     619msgstr ""
     620
     621#: uformmain.sdoyouwanttosaveproject
     622msgid "There are unsaved changes in project. Do you want to save them?"
    615623msgstr ""
    616624
     
    632640msgstr ""
    633641
     642#: uformmain.sunsavedchanges
     643msgid "Unsaved changes"
     644msgstr ""
     645
    634646#: uformsourcecode.senternumber
    635647msgctxt "uformsourcecode.senternumber"
  • trunk/UTarget.pas

    r64 r65  
    3232    function SearchByTargetPos(Pos: Integer): TDebugStep;
    3333    procedure AddStep(SourcePos, TargetPos: Integer; Operation: TStepOperation);
     34    procedure UpdateTargetPos(Old, New: Integer);
    3435  end;
    3536
     
    271272end;
    272273
     274procedure TDebugStepList.UpdateTargetPos(Old, New: Integer);
     275var
     276  I: Integer;
     277begin
     278  I := 0;
     279  while (I < Count) do begin
     280    if TDebugStep(Items[I]).TargetPosition = Old then
     281      TDebugStep(Items[I]).TargetPosition := New;
     282    Inc(I);
     283  end;
     284end;
     285
    273286
    274287{ TTargetList }
     
    594607      end;
    595608    end;
     609    DebugSteps.UpdateTargetPos(FProgramIndex, NewProgramIndex);
    596610    Inc(FProgramIndex);
    597611    Inc(NewProgramIndex);
     
    734748    end;
    735749    PreviousCommand := FProgram[FProgramIndex].Command;
     750    DebugSteps.UpdateTargetPos(FProgramIndex, NewProgramIndex);
    736751    Inc(FProgramIndex);
    737752    Inc(NewProgramIndex);
Note: See TracChangeset for help on using the changeset viewer.