Revision | 44 (tree) |
---|---|
Time | 2019-12-07 04:21:43 |
Author | derekwildstar |
Corrigida a forma de carregamento de textos planos dos frames SYLT e USLT. Agora os caracteres NULL ao final do texto não são mais gerados
Corrigido o método TSYLT.ExibirVerso de forma que ao se usar APosicao = 0 o algoritmo entenda que trata-se de obter o primeiro "verso" independentemente do seu tempo
O texto plano importado e exportado a partir do form de edição de SYLT agora usa formato Unicode (2 Bytes por caractere) sempre
Tela de about concluída!
@@ -486,12 +486,12 @@ | ||
486 | 486 | Exit; |
487 | 487 | |
488 | 488 | with TFileStream.Create(AArquivo,fmCreate or fmShareDenyWrite) do |
489 | - try | |
490 | - Write(PWideChar(Trim(Items[FIndice].Texto))^, (Length(Trim(Items[FIndice].Texto)) + 1) * 2); | |
491 | - Result := True; | |
492 | - finally | |
493 | - Free; | |
494 | - end; | |
489 | + try | |
490 | + Write(PWideChar(Trim(Items[FIndice].Texto))^, Length(Trim(Items[FIndice].Texto)) * 2); | |
491 | + Result := True; | |
492 | + finally | |
493 | + Free; | |
494 | + end; | |
495 | 495 | end; |
496 | 496 | |
497 | 497 | function TUSLT.HTMLDoBrowser: String; |
@@ -857,22 +857,35 @@ | ||
857 | 857 | if (FIndice = -1) or (Items[FIndice].Versos.Count = 0) then |
858 | 858 | Exit; |
859 | 859 | |
860 | - for var i: Word := 0 to Pred(Items[FIndice].Versos.Count) do | |
861 | - if Items[FIndice].Versos[i].Tempo = APosicao then | |
862 | - begin | |
863 | - FSaidaAnterior.Caption := '####### INÍCIO #######'; | |
860 | + if APosicao = 0 then | |
861 | + begin | |
862 | + FSaidaAnterior.Caption := '####### INÍCIO #######'; | |
863 | + | |
864 | + FSaidaCentral.Caption := Items[FIndice].Versos[0].Texto; | |
865 | + | |
866 | + if Pred(Items[FIndice].Versos.Count) > 0 then | |
867 | + FSaidaPosterior.Caption := Items[FIndice].Versos[1].Texto | |
868 | + else | |
864 | 869 | FSaidaPosterior.Caption := '######## FIM ########'; |
870 | + end | |
871 | + else | |
872 | + for var i: Word := 0 to Pred(Items[FIndice].Versos.Count) do | |
873 | + if Items[FIndice].Versos[i].Tempo = APosicao then | |
874 | + begin | |
875 | + if i > 0 then | |
876 | + FSaidaAnterior.Caption := Items[FIndice].Versos[i - 1].Texto | |
877 | + else | |
878 | + FSaidaAnterior.Caption := '####### INÍCIO #######'; | |
865 | 879 | |
866 | - FSaidaCentral.Caption := Items[FIndice].Versos[i].Texto; | |
880 | + FSaidaCentral.Caption := Items[FIndice].Versos[i].Texto; | |
867 | 881 | |
868 | - if i > 0 then | |
869 | - FSaidaAnterior.Caption := Items[FIndice].Versos[i - 1].Texto; | |
882 | + if i < Pred(Items[FIndice].Versos.Count) then | |
883 | + FSaidaPosterior.Caption := Items[FIndice].Versos[i + 1].Texto | |
884 | + else | |
885 | + FSaidaPosterior.Caption := '######## FIM ########'; | |
870 | 886 | |
871 | - if i < Pred(Items[FIndice].Versos.Count) then | |
872 | - FSaidaPosterior.Caption := Items[FIndice].Versos[i + 1].Texto; | |
873 | - | |
874 | - Break; | |
875 | - end; | |
887 | + Break; | |
888 | + end; | |
876 | 889 | end; |
877 | 890 | |
878 | 891 | function TSYLT.ExportarTexto(AArquivo: TFileName): Boolean; |
@@ -889,7 +902,7 @@ | ||
889 | 902 | for var Verso: TSYLTVerso in Items[FIndice].Versos do |
890 | 903 | Texto := Texto + Verso.Tempo.ToString + '=' + Verso.Texto + ^M^J; |
891 | 904 | |
892 | - Write(PWideChar(Trim(Texto))^, (Length(Trim(Texto)) + 1) * 2); | |
905 | + Write(PWideChar(Trim(Texto))^, Length(Trim(Texto)) * 2); | |
893 | 906 | |
894 | 907 | Result := True; |
895 | 908 | finally |
@@ -37,7 +37,8 @@ | ||
37 | 37 | |
38 | 38 | {$R *.dfm} |
39 | 39 | |
40 | -uses UDAMOPrincipal, UBassUtils; | |
40 | +uses | |
41 | + UDAMOPrincipal, UBassUtils; | |
41 | 42 | |
42 | 43 | { TForm1 } |
43 | 44 |
@@ -92,7 +93,7 @@ | ||
92 | 93 | procedure TFORMEditarSYLT.PNSBCarregarTextoSYLTClick(Sender: TObject); |
93 | 94 | begin |
94 | 95 | if TDAMOPrincipal(Owner).OPDITXT.Execute then |
95 | - VLEDVersos.Strings.LoadFromFile(TDAMOPrincipal(Owner).OPDITXT.FileName); | |
96 | + VLEDVersos.Strings.LoadFromFile(TDAMOPrincipal(Owner).OPDITXT.FileName,TEncoding.Unicode); | |
96 | 97 | end; |
97 | 98 | |
98 | 99 | procedure TFORMEditarSYLT.PNSBSalvarClick(Sender: TObject); |
@@ -106,7 +107,7 @@ | ||
106 | 107 | procedure TFORMEditarSYLT.PNSBSalvarTextoSYLTClick(Sender: TObject); |
107 | 108 | begin |
108 | 109 | if TDAMOPrincipal(Owner).SADITXT.Execute then |
109 | - VLEDVersos.Strings.SaveToFile(TDAMOPrincipal(Owner).OPDITXT.FileName); | |
110 | + VLEDVersos.Strings.SaveToFile(TDAMOPrincipal(Owner).SADITXT.FileName,TEncoding.Unicode); | |
110 | 111 | end; |
111 | 112 | |
112 | 113 | end. |
@@ -18,6 +18,9 @@ | ||
18 | 18 | LABEPoweredBy: TLabel; |
19 | 19 | BEVELinha2: TBevel; |
20 | 20 | procedure FormClose(Sender: TObject; var Action: TCloseAction); |
21 | + procedure IMAGID3v2Click(Sender: TObject); | |
22 | + procedure IMAGBassClick(Sender: TObject); | |
23 | + procedure IMAGDelphiClick(Sender: TObject); | |
21 | 24 | private |
22 | 25 | { Private declarations } |
23 | 26 | public |
@@ -27,6 +30,9 @@ | ||
27 | 30 | |
28 | 31 | implementation |
29 | 32 | |
33 | +uses | |
34 | + ShellApi; | |
35 | + | |
30 | 36 | {$R *.dfm} |
31 | 37 | |
32 | 38 | { TFORMSobre } |
@@ -36,6 +42,21 @@ | ||
36 | 42 | Action := caFree; |
37 | 43 | end; |
38 | 44 | |
45 | +procedure TFORMSobre.IMAGBassClick(Sender: TObject); | |
46 | +begin | |
47 | + ShellExecute(0, 'open', 'http://www.un4seen.com', nil, nil, SW_SHOWNORMAL); | |
48 | +end; | |
49 | + | |
50 | +procedure TFORMSobre.IMAGDelphiClick(Sender: TObject); | |
51 | +begin | |
52 | + ShellExecute(0, 'open', 'https://www.embarcadero.com/br/products/delphi/starter', nil, nil, SW_SHOWNORMAL); | |
53 | +end; | |
54 | + | |
55 | +procedure TFORMSobre.IMAGID3v2Click(Sender: TObject); | |
56 | +begin | |
57 | + ShellExecute(0, 'open', 'http://id3.org/Home', nil, nil, SW_SHOWNORMAL); | |
58 | +end; | |
59 | + | |
39 | 60 | class procedure TFORMSobre.ShowMe(AOwner: TComponent); |
40 | 61 | begin |
41 | 62 | TFORMSobre.Create(AOwner).ShowModal; |