editor, indicates if readonly

This commit is contained in:
Basile Burg 2016-01-30 07:58:41 +01:00
parent bad7f96dcb
commit 2094449a7d
3 changed files with 17 additions and 1 deletions

View File

@ -33,6 +33,10 @@ inherited CEEditorWidget: TCEEditorWidget
item
Width = 120
end
item
Alignment = taCenter
Width = 100
end
item
Width = 2000
end>

View File

@ -472,6 +472,7 @@ begin
editorStatus.Panels[1].Text := '';
editorStatus.Panels[2].Text := '';
editorStatus.Panels[3].Text := '';
editorStatus.Panels[4].Text := '';
end else begin
editorStatus.Panels[0].Text := format('%d : %d | %d', [fDoc.CaretY, fDoc.CaretX, fDoc.SelEnd - fDoc.SelStart]);
editorStatus.Panels[1].Text := modstr[fDoc.modified];
@ -481,7 +482,13 @@ begin
editorStatus.Panels[2].Text := 'no macro'
else
editorStatus.Panels[2].Text := 'macro ready';
editorStatus.Panels[3].Text := fDoc.fileName;
if fDoc.ReadOnly then
begin
editorStatus.Panels[3].Width:= 120;
editorStatus.Panels[3].Text := '(read-only)';
end else
editorStatus.Panels[3].Width:= 0;
editorStatus.Panels[4].Text := fDoc.fileName;
if Visible and (pageControl.currentPage <> nil) and ((pageControl.currentPage.Caption = '') or
(pageControl.currentPage.Caption = '<new document>')) then
begin

View File

@ -1008,6 +1008,7 @@ begin
Lines.LoadFromFile(aFilename);
fFilename := aFilename;
FileAge(fFilename, fFileDate);
ReadOnly := FileIsReadOnly(fFilename);
//
fModified := false;
if Showing then
@ -1023,6 +1024,8 @@ procedure TCESynMemo.saveToFile(const aFilename: string);
var
ext: string;
begin
if readOnly then
exit;
Lines.SaveToFile(aFilename);
fFilename := aFilename;
ext := aFilename.extractFileExt;
@ -1036,6 +1039,8 @@ end;
procedure TCESynMemo.save;
begin
if readOnly then
exit;
Lines.SaveToFile(fFilename);
FileAge(fFilename, fFileDate);
fModified := false;