@@ -47,12 +47,10 @@ interface
4747 , Vcl.Styles.Utils
4848 , Vcl.Styles.Utils.SysControls
4949 , Vcl.Styles.UxTheme
50- // {$IFDEF WIN32}
5150 , Vcl.Styles.Hooks
5251 , Vcl.Styles.Utils.Forms
5352 , Vcl.Styles.Utils.ComCtrls
5453 , Vcl.Styles.Utils.StdCtrls
55- // {$ENDIF}
5654 , Vcl.Styles.Ext
5755 ;
5856
@@ -441,7 +439,7 @@ function TfrmMain.OpenFile(const FileName : string;
441439 FProcessingFiles := True;
442440 if FileExists(FileName) then
443441 begin
444- // ciclo per cercare se il file è già aperto
442+ // looking for the file already opened
445443 EditingFile := nil ;
446444 I := -1 ;
447445 for J := 0 to EditFileList.Count -1 do
@@ -454,16 +452,15 @@ function TfrmMain.OpenFile(const FileName : string;
454452 break;
455453 end ;
456454 end ;
457- // Creo l'oggetto EditingFile
455+ // searching EditingFile object
458456 Try
459457 if not Assigned(EditingFile) then
460458 begin
461459 EditingFile := TEditingFile.Create(FileName);
462- // Aggiungo il file alla lista
460+ // Add file to list
463461 I := AddEditingFile(EditingFile);
464462 end ;
465463
466- // Apro il file
467464 EditingFile.ReadFromFile;
468465
469466 Result := True;
@@ -747,7 +744,7 @@ procedure TfrmMain.FormCreate(Sender: TObject);
747744 InitialDir : string;
748745 FileVersionStr: string;
749746begin
750- // creo la lista dei files aperti
747+ // Build opened- files list
751748 EditFileList := TObjectList.Create(True);
752749 FEditorOptions := TSynEditorOptionsContainer.create(self);
753750 FEditorSettings := TEditorSettings.CreateSettings(nil , FEditorOptions);
@@ -763,7 +760,7 @@ procedure TfrmMain.FormCreate(Sender: TObject);
763760 // Bold font for image preview panel
764761 ImagePreviewPanel.Font.Style := ImagePreviewPanel.Font.Style + [fsBold];
765762
766- // Versione
763+ // Version
767764 FileVersionStr := uMisc.GetFileVersion(GetModuleLocation());
768765 Application.Title := Application.Title + ' (Ver.' +FileVersionStr+' )' ;
769766 Caption := Application.Title;
@@ -772,25 +769,21 @@ procedure TfrmMain.FormCreate(Sender: TObject);
772769
773770 UpdateFromSettings(nil );
774771
775- // Aggancia l'imagelist che si sgancia
772+ // Explicit attach imagelist
776773 ActionList.Images := VirtualImageList;
777774
778- // directory di partenza
775+ // staring folder
779776 CurrentDir := IncludeTrailingPathDelimiter(TPath.GetDocumentsPath);
780777
781- // PageControl.Images := dmResources.Images;
782- // PageControl.Images := IconList;
783-
784- // Inizializza output di stampa
778+ // Initialize print output
785779 InitSynEditPrint;
786780
787- // Carico i files che erano rimasti aperti
781+ // Load previous opened- files
788782 LoadOpenedFiles;
789783
790- // Inizializza Open e Save Dialog dalla Dir di lancio del programma
791784 if ParamStr(1 ) <> ' ' then
792785 begin
793- // Carico l'eventuale file esterno
786+ // Load file passed at command line
794787 InitialDir := ParamStr(1 );
795788 OpenFile(ParamStr(1 ));
796789 AssignSVGToImage;
@@ -801,7 +794,7 @@ procedure TfrmMain.FormCreate(Sender: TObject);
801794 OpenDialog.InitialDir := InitialDir;
802795 SaveDialog.InitialDir := InitialDir;
803796
804- // Aggiorna le impostazioni di tutti gli editor aperti
797+ // Update all editor options
805798 UpdateEditorsOptions;
806799end ;
807800
@@ -811,11 +804,10 @@ procedure TfrmMain.acNewFileExecute(Sender: TObject);
811804 EditingFile : TEditingFile;
812805 NewFileType : TEditFileType;
813806begin
814- // Chiedo che tipo di file vuoto voglio aggiungere
815807 NewExt := ' svg' ;
816808 NewFileType := dmResources.GetEditFileType(NewExt);
817809
818- // Aggiungo un file vuoto
810+ // Create object to manage new file
819811 EditingFile := TEditingFile.Create(CurrentDir+' New.' +NewExt);
820812 Try
821813 AddEditingFile(EditingFile);
@@ -839,7 +831,6 @@ procedure TfrmMain.acReplaceUpdate(Sender: TObject);
839831
840832procedure TfrmMain.acCloseExecute (Sender: TObject);
841833begin
842- // Rimuovo il file da editare
843834 RemoveEditingFile(CurrentEditFile);
844835end ;
845836
@@ -896,23 +887,23 @@ function TfrmMain.AddEditingFile(EditingFile: TEditingFile): Integer;
896887 ts : TTabSheet;
897888 Editor : TSynEdit;
898889begin
899- // lo aggiungo alla lista dei file aperti
890+ // Add file to opened-list
900891 Result := EditFileList.Add(EditingFile);
901- // Appena aggiungo un'oggetto alla lista creo la pagina Associata
892+ // Create the Tabsheet page associated to the file
902893 ts := nil ;
903894 Editor := nil ;
904895 Try
905896 ts := TTabSheet.Create(self);
906897 ts.PageControl := PageControl;
907- // Attacco al TAG del tabsheet l'oggetto del file da editare
898+ // Use TAG of tabsheet to store the object pointer
908899 ts.Tag := Integer(EditingFile);
909900 ts.Caption := EditingFile.Name ;
910901 ts.Imagename := ' svg-logo-gray' ;
911902 ts.Parent := PageControl;
912903 ts.TabVisible := True;
913904 EditingFile.TabSheet := ts;
914905
915- // Creo l'oggetto dell' editor all'interno della pagina con l'owner la pagina
906+ // Create the SynEdit object editor into the TabSheet that is the owner
916907 Editor := TSynEdit.Create(ts);
917908 Editor.OnChange := SynEditChange;
918909 Editor.OnEnter := SynEditEnter;
@@ -921,27 +912,26 @@ function TfrmMain.AddEditingFile(EditingFile: TEditingFile): Integer;
921912 Editor.Parent := ts;
922913 Editor.SearchEngine := SynEditSearch;
923914 Editor.PopupMenu := popEditor;
924- // Assegna le preferenze dell'utente
915+ // Assign user preferences to the editor
925916 FEditorOptions.AssignTo(Editor);
926917 Editor.MaxScrollWidth := 3000 ;
927918 EditingFile.SynEditor := Editor;
928919 UpdateFromSettings(Editor);
929920 UpdateHighlighter(Editor);
930921 Editor.Visible := True;
931922
932- // Visualizzo il tabsheet
923+ // Show the tabsheet
933924 ts.Visible := True;
925+
926+ // Make the Tabsheet the current page
927+ // and call "change" of pagecontrol
928+ PageControl.ActivePage := ts;
929+ PageControl.OnChange(PageControl);
934930 Except
935931 ts.Free;
936932 Editor.Free;
937933 raise;
938934 End ;
939-
940- // Attivo la pagina appena creata
941- PageControl.ActivePage := ts;
942-
943- // Forzo "change" della pagina
944- PageControl.OnChange(PageControl);
945935end ;
946936
947937procedure TfrmMain.AssignSVGToImage ;
@@ -950,7 +940,7 @@ procedure TfrmMain.AssignSVGToImage;
950940begin
951941 if FProcessingFiles then
952942 Exit;
953- // Assegna l'immagine SVG
943+ // Assign SVG image
954944 try
955945 if CurrentEditor <> nil then
956946 begin
@@ -995,7 +985,7 @@ procedure TfrmMain.BackgroundTrackBarChange(Sender: TObject);
995985
996986procedure TfrmMain.PageControlChange (Sender: TObject);
997987begin
998- // Imposto la caption dell'Editor
988+ // Setting the Editor caption as the actual file opened
999989 if CurrentEditFile <> nil then
1000990 Caption := Application.Title+' - ' +CurrentEditFile.FileName;
1001991 AssignSVGToImage;
@@ -1044,25 +1034,24 @@ procedure TfrmMain.RemoveEditingFile(EditingFile: TEditingFile);
10441034 if pos = -1 then
10451035 raise EComponentError.Create(CLOSING_PROBLEMS);
10461036
1047- // Richiesta di abbandono delle modifiche pendenti
1037+ // Confirm abandon changes
10481038 if EditingFile.SynEditor.Modified then
10491039 begin
10501040 if MessageDlg(Format(CONFIRM_ABANDON,[EditingFile.FileName]),
10511041 mtWarning, [mbYes, mbNo], 0 ) = mrNo then
10521042 Abort;
10531043 end ;
10541044
1055- // Elimino il file dalla lista
1045+ // Delete the file from the Opened-List
10561046 EditFileList.Delete(pos);
10571047
1058- // Elimino la pagina
1048+ // Delete the TabSheet
10591049 PageControl.Pages[pos].Free;
10601050
1061- // Attivo la pagina nuova che ha preso il posto della precedente
1051+ // Activate the previous page and
1052+ // call "change" of pagecontrol
10621053 if pos > 0 then
10631054 PageControl.ActivePageIndex := pos-1 ;
1064-
1065- // Forzo "change" della pagina
10661055 PageControl.OnChange(PageControl);
10671056end ;
10681057
@@ -1079,6 +1068,7 @@ procedure TfrmMain.acCloseAllExecute(Sender: TObject);
10791068 RemoveEditingFile(TEditingFile(EditFileList.items[0 ]));
10801069 finally
10811070 FProcessingFiles := False;
1071+ AssignSVGToImage;
10821072 end ;
10831073end ;
10841074
@@ -1271,7 +1261,7 @@ procedure TfrmMain.UpdateHighlighter(ASynEditor: TSynEdit);
12711261 LBackgroundColor := StyleServices.GetSystemColor(clWindow);
12721262 ASynEditor.Highlighter := dmResources.GetSynHighlighter(
12731263 FEditorSettings.UseDarkStyle, LBackgroundColor);
1274- // Assegna i colori "custom" all' Highlighter
1264+ // Assign custom colors to the Highlighter
12751265 FEditorSettings.ReadSettings(ASynEditor.Highlighter, self.FEditorOptions);
12761266end ;
12771267
@@ -1328,8 +1318,7 @@ procedure TfrmMain.actnSaveAsExecute(Sender: TObject);
13281318 CurrentEditFile.FileName := SaveDialog.FileName;
13291319 end ;
13301320 CurrentEditFile.SaveToFile;
1331-
1332- // Forzo "change" della pagina
1321+ // call the "onchange" event of PageControl
13331322 PageControl.OnChange(PageControl);
13341323 end ;
13351324end ;
@@ -1435,7 +1424,7 @@ procedure TfrmMain.actnFormatXMLExecute(Sender: TObject);
14351424var
14361425 OldText, NewText : string;
14371426begin
1438- // formatta XML
1427+ // format XML text
14391428 OldText := CurrentEditor.Text;
14401429 NewText := Xml.XMLDoc.FormatXMLData(OldText);
14411430 if OldText <> NewText then
@@ -1455,14 +1444,14 @@ procedure TfrmMain.AddOpenedFile(const AFileName: string);
14551444var
14561445 i : integer;
14571446begin
1458- // se esiste già la voce la cancello
1447+ // Add the opened file to the opened-file list
14591448 i := FEditorSettings.HistoryFileList.IndexOf(AFileName);
14601449 if i >= 0 then
14611450 FEditorSettings.HistoryFileList.Delete(i);
1462- // massimo 15 voci
1451+ // max 15 items
14631452 if FEditorSettings.HistoryFileList.Count > 15 then
14641453 FEditorSettings.HistoryFileList.Delete(14 );
1465- // Aggiungo la voce in prima posizione
1454+ // add the last opened-file at first position
14661455 FEditorSettings.HistoryFileList.Insert(0 , AFileName);
14671456end ;
14681457
@@ -1551,7 +1540,7 @@ procedure TfrmMain.HistoryListClick(Sender: TObject);
15511540 LFileName : string;
15521541begin
15531542 LFilename := (Sender as TMenuItem).Hint;
1554- // Carico il file selezionato
1543+ // Load the selected file
15551544 OpenFile(LFileName);
15561545 AssignSVGToImage;
15571546 if (CurrentEditor <> nil ) and (CurrentEditor.CanFocus) then
@@ -1565,7 +1554,9 @@ procedure TfrmMain.FormShow(Sender: TObject);
15651554end ;
15661555
15671556initialization
1557+ { $IFDEF DEBUG}
15681558 ReportMemoryLeaksOnShutdown := True;
1559+ { $ENDIF}
15691560
15701561end .
15711562
0 commit comments