Fixed bug at48523

This commit is contained in:
Christian Hammacher 2006-12-18 14:33:06 +00:00
parent 93cb2060dd
commit 266ed797c5
3 changed files with 13 additions and 9 deletions

Binary file not shown.

View File

@ -80,7 +80,7 @@ function IEInstalled: Boolean;
function GetAMXXDir(ListenServer: Boolean): String; function GetAMXXDir(ListenServer: Boolean): String;
function CloseDocument(eDocument: TDocument; SaveActiveDoc, RemoveTab: Boolean): Boolean; function CloseDocument(eDocument: TDocument; SaveActiveDoc, RemoveTab: Boolean): Boolean;
function AddExtension(eFilename, eHighlighter: String): String; function AddExtension(eFilename, eHighlighter: String; Document: TDocument): String;
function ShowColorDialog(var Color: TColor; ePaintImage: TImage): Boolean; function ShowColorDialog(var Color: TColor; ePaintImage: TImage): Boolean;
@ -468,11 +468,15 @@ begin
Collection.Close(eDocument.Index, RemoveTab); Collection.Close(eDocument.Index, RemoveTab);
end; end;
function AddExtension(eFilename, eHighlighter: String): String; function AddExtension(eFilename, eHighlighter: String; Document: TDocument): String;
begin begin
if ExtractFileExt(eFilename) = '' then begin if ExtractFileExt(eFilename) = '' then begin
if eHighlighter = 'Pawn' then if eHighlighter = 'Pawn' then begin
Result := eFilename + '.sma'; if (ExtractFileExt(Document.Title) = '.inc') then
Result := eFilename + '.inc'
else
Result := eFilename + '.sma';
end;
if eHighlighter = 'C++' then if eHighlighter = 'C++' then
Result := eFilename + '.cpp'; Result := eFilename + '.cpp';
if eHighlighter = 'HTML' then if eHighlighter = 'HTML' then

View File

@ -894,7 +894,7 @@ end;
procedure TfrmMain.mnuSaveAsClick(Sender: TObject); procedure TfrmMain.mnuSaveAsClick(Sender: TObject);
begin begin
if sdSave.Execute then begin if sdSave.Execute then begin
ActiveDoc.FileName := AddExtension(sdSave.FileName, ActiveDoc.Highlighter); ActiveDoc.FileName := AddExtension(sdSave.FileName, ActiveDoc.Highlighter, ActiveDoc);
ActiveDoc.Save; ActiveDoc.Save;
tbDocs.Tabs[ActiveDoc.Index].Caption := ActiveDoc.Title; tbDocs.Tabs[ActiveDoc.Index].Caption := ActiveDoc.Title;
end; end;
@ -1296,7 +1296,7 @@ begin
b := Integer(frmAllFilesForm.lstFiles.Items.Objects[a]); b := Integer(frmAllFilesForm.lstFiles.Items.Objects[a]);
if TDocument(Collection.Items[b]).Untitled then begin if TDocument(Collection.Items[b]).Untitled then begin
if sdSave.Execute then begin if sdSave.Execute then begin
TDocument(Collection.Items[b]).FileName := AddExtension(sdSave.FileName, TDocument(Collection.Items[b]).Highlighter); TDocument(Collection.Items[b]).FileName := AddExtension(sdSave.FileName, TDocument(Collection.Items[b]).Highlighter, TDocument(Collection.Items[b]));
TDocument(Collection.Items[b]).Save; TDocument(Collection.Items[b]).Save;
TJvTabBarItem(tbDocs.Tabs[b]).Caption := TDocument(Collection.Items[b]).Title; TJvTabBarItem(tbDocs.Tabs[b]).Caption := TDocument(Collection.Items[b]).Title;
end end
@ -1547,7 +1547,7 @@ begin
else begin else begin
frmMain.sdSave.FilterIndex := 1; frmMain.sdSave.FilterIndex := 1;
if frmMain.sdSave.Execute then begin if frmMain.sdSave.Execute then begin
eItem.FileName := AddExtension(frmMain.sdSave.FileName, eItem.Highlighter); eItem.FileName := AddExtension(frmMain.sdSave.FileName, eItem.Highlighter, eItem);
eItem.Save; eItem.Save;
end end
else begin else begin
@ -1571,7 +1571,7 @@ begin
else begin else begin
frmMain.sdSave.FilterIndex := 2; frmMain.sdSave.FilterIndex := 2;
if frmMain.sdSave.Execute then begin if frmMain.sdSave.Execute then begin
eItem.FileName := AddExtension(frmMain.sdSave.FileName, eItem.Highlighter); eItem.FileName := AddExtension(frmMain.sdSave.FileName, eItem.Highlighter, eItem);
eItem.Save; eItem.Save;
end end
else begin else begin
@ -1595,7 +1595,7 @@ begin
else begin else begin
frmMain.sdSave.FilterIndex := 0; frmMain.sdSave.FilterIndex := 0;
if frmMain.sdSave.Execute then begin if frmMain.sdSave.Execute then begin
eItem.FileName := AddExtension(frmMain.sdSave.FileName, eItem.Highlighter); eItem.FileName := AddExtension(frmMain.sdSave.FileName, eItem.Highlighter, eItem);
eItem.Save; eItem.Save;
end end
else begin else begin