|
@@ -95,6 +95,7 @@ const
|
|
edReadBlock = 15;
|
|
edReadBlock = 15;
|
|
edFileOnDiskChanged = 16;
|
|
edFileOnDiskChanged = 16;
|
|
edChangedOnloading = 17;
|
|
edChangedOnloading = 17;
|
|
|
|
+ edSaveError = 18;
|
|
|
|
|
|
ffmOptions = $0007; ffsOptions = 0;
|
|
ffmOptions = $0007; ffsOptions = 0;
|
|
ffmDirection = $0008; ffsDirection = 3;
|
|
ffmDirection = $0008; ffsDirection = 3;
|
|
@@ -269,6 +270,7 @@ type
|
|
TabSize : integer;
|
|
TabSize : integer;
|
|
HighlightRow: sw_integer;
|
|
HighlightRow: sw_integer;
|
|
DebuggerRow: sw_integer;
|
|
DebuggerRow: sw_integer;
|
|
|
|
+ ChangedLine : sw_integer;
|
|
UndoList : PEditorActionCollection;
|
|
UndoList : PEditorActionCollection;
|
|
RedoList : PEditorActionCollection;
|
|
RedoList : PEditorActionCollection;
|
|
CompleteState: TCompleteState;
|
|
CompleteState: TCompleteState;
|
|
@@ -348,7 +350,6 @@ type
|
|
LastSyntaxedLine : sw_integer;
|
|
LastSyntaxedLine : sw_integer;
|
|
SyntaxComplete : boolean;
|
|
SyntaxComplete : boolean;
|
|
{$endif TEST_PARTIAL_SYNTAX}
|
|
{$endif TEST_PARTIAL_SYNTAX}
|
|
- ChangedLine : sw_integer;
|
|
|
|
ErrorMessage: PString;
|
|
ErrorMessage: PString;
|
|
Bookmarks : array[0..9] of TEditorBookmark;
|
|
Bookmarks : array[0..9] of TEditorBookmark;
|
|
LockFlag : integer;
|
|
LockFlag : integer;
|
|
@@ -5092,7 +5093,7 @@ function TFileEditor.LoadFile: boolean;
|
|
var S: PBufStream;
|
|
var S: PBufStream;
|
|
OK: boolean;
|
|
OK: boolean;
|
|
begin
|
|
begin
|
|
- New(S, Init(GetShortName(FileName),stOpenRead,EditorTextBufSize));
|
|
|
|
|
|
+ New(S, Init(FileName,stOpenRead,EditorTextBufSize));
|
|
OK:=Assigned(S);
|
|
OK:=Assigned(S);
|
|
{$ifdef TEST_PARTIAL_SYNTAX}
|
|
{$ifdef TEST_PARTIAL_SYNTAX}
|
|
SyntaxComplete:=false;
|
|
SyntaxComplete:=false;
|
|
@@ -5125,7 +5126,7 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
{$I-}
|
|
{$I-}
|
|
- if IsFlagSet(efBackupFiles) then
|
|
|
|
|
|
+ if IsFlagSet(efBackupFiles) and ExistsFile(FileName) then
|
|
begin
|
|
begin
|
|
BAKName:=DirAndNameOf(FileName)+'.bak';
|
|
BAKName:=DirAndNameOf(FileName)+'.bak';
|
|
Assign(f,BAKName);
|
|
Assign(f,BAKName);
|
|
@@ -5137,12 +5138,25 @@ begin
|
|
end;
|
|
end;
|
|
{$I+}
|
|
{$I+}
|
|
New(S, Init(FileName,stCreate,EditorTextBufSize));
|
|
New(S, Init(FileName,stCreate,EditorTextBufSize));
|
|
- OK:=Assigned(S);
|
|
|
|
|
|
+ OK:=Assigned(S) and (S^.Status=stOK);
|
|
if OK then OK:=SaveToStream(S);
|
|
if OK then OK:=SaveToStream(S);
|
|
if Assigned(S) then Dispose(S, Done);
|
|
if Assigned(S) then Dispose(S, Done);
|
|
- if OK then SetModified(false);
|
|
|
|
|
|
+ if OK then
|
|
|
|
+ SetModified(false)
|
|
|
|
+ { Restore the original }
|
|
|
|
+ else if IsFlagSet(efBackupFiles) and ExistsFile(BakName) then
|
|
|
|
+ begin
|
|
|
|
+{$I-}
|
|
|
|
+ Assign(f,BakName);
|
|
|
|
+ Rename(F,FileName);
|
|
|
|
+ EatIO;
|
|
|
|
+{$I+}
|
|
|
|
+ end;
|
|
{ don't forget to update the OnDiskLoadTime value }
|
|
{ don't forget to update the OnDiskLoadTime value }
|
|
- OnDiskLoadTime:=GetFileTime(FileName);
|
|
|
|
|
|
+ if OK then
|
|
|
|
+ OnDiskLoadTime:=GetFileTime(FileName);
|
|
|
|
+ if not OK then
|
|
|
|
+ EditorDialog(edSaveError,@FileName);
|
|
SaveFile:=OK;
|
|
SaveFile:=OK;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -5478,6 +5492,9 @@ begin
|
|
@Info, mfInsertInApp+ mfError + mfOkButton);
|
|
@Info, mfInsertInApp+ mfError + mfOkButton);
|
|
edWriteError:
|
|
edWriteError:
|
|
StdEditorDialog := MessageBox('Error writing file %s.',
|
|
StdEditorDialog := MessageBox('Error writing file %s.',
|
|
|
|
+ @Info, mfInsertInApp+ mfError + mfOkButton);
|
|
|
|
+ edSaveError:
|
|
|
|
+ StdEditorDialog := MessageBox('Error saving file %s.',
|
|
@Info, mfInsertInApp+ mfError + mfOkButton);
|
|
@Info, mfInsertInApp+ mfError + mfOkButton);
|
|
edCreateError:
|
|
edCreateError:
|
|
StdEditorDialog := MessageBox('Error creating file %s.',
|
|
StdEditorDialog := MessageBox('Error creating file %s.',
|
|
@@ -5616,7 +5633,10 @@ end;
|
|
END.
|
|
END.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.83 2000-03-14 13:38:03 pierre
|
|
|
|
|
|
+ Revision 1.84 2000-03-20 19:19:44 pierre
|
|
|
|
+ * LFN support in streams
|
|
|
|
+
|
|
|
|
+ Revision 1.83 2000/03/14 13:38:03 pierre
|
|
* max number of line changed and warning added
|
|
* max number of line changed and warning added
|
|
|
|
|
|
Revision 1.82 2000/03/02 22:33:36 pierre
|
|
Revision 1.82 2000/03/02 22:33:36 pierre
|