readonly flag is now only saved if user set

git-svn-id: trunk@3875 -
This commit is contained in:
mattias 2003-02-26 12:44:52 +00:00
parent 0109a75851
commit ae1de60c60
6 changed files with 97 additions and 38 deletions

View File

@ -82,6 +82,7 @@ type
fCustomHighlighter: boolean; // do not change highlighter on file extension change
fEditorIndex: integer;
fFileName: string;
fFileReadOnly: Boolean;
fForm: TComponent;
fFormName: string; { classname is always T<FormName>
this attribute contains the formname even if the unit is not loaded }
@ -98,24 +99,25 @@ type
fOnUnitNameChange: TOnUnitNameChange;
fPrevPartOfProject: TUnitInfo;
FProject: TProject;
fReadOnly: Boolean;
FResourceFilename: string;
fSource: TCodeBuffer;
fSyntaxHighlighter: TLazSyntaxHighlighter;
fTopLine: integer;
fUnitName: String;
fUsageCount: extended;
fUserReadOnly: Boolean;
function GetFileName: string;
function GetHasResources:boolean;
procedure SetEditorIndex(const AValue: integer);
procedure SetFileReadOnly(const AValue: Boolean);
procedure SetForm(const AValue: TComponent);
procedure SetIsPartOfProject(const AValue: boolean);
procedure SetLoaded(const AValue: Boolean);
procedure SetProject(const AValue: TProject);
procedure SetReadOnly(const NewValue: boolean);
procedure SetSource(ABuffer: TCodeBuffer);
procedure SetUnitName(const NewUnitName:string);
procedure SetUserReadOnly(const NewValue: boolean);
protected
fNextUnitWithEditorIndex: TUnitInfo;
fPrevUnitWithEditorIndex: TUnitInfo;
@ -154,6 +156,7 @@ type
function NeedsSaveToDisk: boolean;
procedure UpdateUsageCount(Min, IfBelowThis, IncIfBelow: extended);
procedure UpdateUsageCount(TheUsage: TUnitUsage; Factor: extended);
function ReadOnly: boolean;
{ Properties }
public
@ -175,6 +178,7 @@ type
read fCustomHighlighter write fCustomHighlighter;
property EditorIndex:integer read fEditorIndex write SetEditorIndex;
property Filename: String read GetFilename;
property FileReadOnly: Boolean read fFileReadOnly write SetFileReadOnly;
property Form: TComponent read fForm write SetForm;
property FormName: string read fFormName write fFormName;
property FormResourceName: string
@ -190,7 +194,6 @@ type
property OnUnitNameChange: TOnUnitNameChange
read fOnUnitNameChange write fOnUnitNameChange;
property Project: TProject read FProject write SetProject;
property ReadOnly: Boolean read fReadOnly write SetReadOnly;
property ResourceFileName: string
read FResourceFilename write FResourceFilename;
property Source: TCodeBuffer read fSource write SetSource;
@ -198,6 +201,7 @@ type
read fSyntaxHighlighter write fSyntaxHighlighter;
property TopLine: integer read fTopLine write fTopLine;
property UnitName: String read fUnitName write SetUnitName;
property UserReadOnly: Boolean read fUserReadOnly write SetUserReadOnly;
end;
@ -569,7 +573,8 @@ begin
fIsPartOfProject := false;
Loaded := false;
fModified := false;
fReadOnly := false;
fUserReadOnly := false;
fFileReadOnly := false;
if fSource<>nil then fSource.Clear;
fSyntaxHighlighter := lshText;
fTopLine := -1;
@ -595,7 +600,7 @@ begin
XMLConfig.SetDeleteValue(Path+'HasResources/Value',fHasResources,false);
XMLConfig.SetDeleteValue(Path+'IsPartOfProject/Value',fIsPartOfProject,false);
XMLConfig.SetDeleteValue(Path+'Loaded/Value',fLoaded,false);
XMLConfig.SetDeleteValue(Path+'ReadOnly/Value',fReadOnly,false);
XMLConfig.SetDeleteValue(Path+'ReadOnly/Value',fUserReadOnly,false);
AFilename:=FResourceFilename;
if Assigned(fOnLoadSaveFilename) then
fOnLoadSaveFilename(AFilename,false);
@ -626,7 +631,7 @@ begin
HasResources:=XMLConfig.GetValue(Path+'HasResources/Value',false);
IsPartOfProject:=XMLConfig.GetValue(Path+'IsPartOfProject/Value',false);
Loaded:=XMLConfig.GetValue(Path+'Loaded/Value',false);
ReadOnly:=XMLConfig.GetValue(Path+'ReadOnly/Value',false);
fUserReadOnly:=XMLConfig.GetValue(Path+'ReadOnly/Value',false);
AFilename:=XMLConfig.GetValue(Path+'ResourceFilename/Value','');
if Assigned(fOnLoadSaveFilename) then
fOnLoadSaveFilename(AFilename,true);
@ -810,6 +815,11 @@ begin
end;
end;
function TUnitInfo.ReadOnly: boolean;
begin
Result:=UserReadOnly or FileReadOnly;
end;
procedure TUnitInfo.SetSource(ABuffer: TCodeBuffer);
begin
if fSource=ABuffer then exit;
@ -824,11 +834,11 @@ begin
end;
end;
procedure TUnitInfo.SetReadOnly(const NewValue: boolean);
procedure TUnitInfo.SetUserReadOnly(const NewValue: boolean);
begin
fReadOnly:=NewValue;
fUserReadOnly:=NewValue;
if fSource<>nil then
fSource.ReadOnly:=fReadOnly;
fSource.ReadOnly:=ReadOnly;
end;
procedure TUnitInfo.CreateStartCode(NewUnitType: TNewUnitType;
@ -925,6 +935,14 @@ begin
UpdateEditorIndexList;
end;
procedure TUnitInfo.SetFileReadOnly(const AValue: Boolean);
begin
if fFileReadOnly=AValue then exit;
fFileReadOnly:=AValue;
if fSource<>nil then
fSource.ReadOnly:=ReadOnly;
end;
procedure TUnitInfo.SetForm(const AValue: TComponent);
begin
if fForm=AValue then exit;
@ -2185,6 +2203,9 @@ end.
{
$Log$
Revision 1.91 2003/02/26 12:44:52 mattias
readonly flag is now only saved if user set
Revision 1.90 2003/01/15 09:08:08 mattias
fixed search paths for virtual projects

View File

@ -56,7 +56,6 @@ function FileIsSymlink(const AFilename: string): boolean;
function GetFileDescription(const AFilename: string): string;
function ReadAllLinks(const Filename: string;
ExceptionOnError: boolean): string;
function CopyFile(const SrcFilename, DestFilename: string): boolean;
// directories
function DirectoryExists(const FileName: String): Boolean;
@ -79,8 +78,10 @@ function FileIsInPath(const Filename, Path: string): boolean;
function SearchFileInPath(const Filename, BasePath, SearchPath,
Delimiter: string; SearchLoUpCase: boolean): string;
// file read
// file actions
function ReadFileToString(const Filename: string): string;
function CopyFile(const SrcFilename, DestFilename: string): boolean;
function GetTempFilename(const Path, Prefix: string): string;
implementation
@ -113,6 +114,9 @@ end.
{
$Log$
Revision 1.13 2003/02/26 12:44:52 mattias
readonly flag is now only saved if user set
Revision 1.12 2003/02/20 11:03:20 mattias
save as of project files now starts in project dierctory

View File

@ -702,6 +702,26 @@ begin
end;
end;
{------------------------------------------------------------------------------
function GetTempFilename(const Path, Prefix: string): string;
------------------------------------------------------------------------------}
function GetTempFilename(const Path, Prefix: string): string;
var
i: Integer;
CurPath: String;
CurName: String;
begin
Result:=ExpandFilename(Path);
CurPath:=AppendPathDelim(ExtractFilePath(Result));
CurName:=Prefix+ExtractFileNameOnly(Result);
i:=1;
repeat
Result:=CurPath+CurName+IntToStr(i)+'.tmp';
if not FileExists(Result) then exit;
inc(i);
until false;
end;
{------------------------------------------------------------------------------
function SearchFileInPath(const Filename, BasePath, SearchPath,
Delimiter: string; SearchLoUpCase: boolean): string;
@ -793,6 +813,9 @@ end;
{
$Log$
Revision 1.15 2003/02/26 12:44:52 mattias
readonly flag is now only saved if user set
Revision 1.14 2003/02/20 11:03:20 mattias
save as of project files now starts in project dierctory

View File

@ -78,12 +78,20 @@ type
Bool = LongBool;
pByte = ^byte;
HGLOBAL = THAndle;
// from Delphis sysutils.pas
PByteArray = ^TByteArray;
TByteArray = array[0..32767] of Byte;
var
hInstance :HINST;
const
INVALID_HANDLE_VALUE = 0;
MaxByte = 255;
{ Ternary raster operations }
SRCCOPY = $00CC0020; { dest = source }
SRCPAINT = $00EE0086; { dest = source OR dest }
@ -756,14 +764,14 @@ type
PLogPalette = ^tagLogPalette;
tagLOGPALETTE = packed record
palVersion: Word; //what IS this?! Should we use it?
palVersion: Word;
palNumEntries: Word;
palPalEntry: array[0..0] of tagPaletteEntry;
end;
LOGPALETTE = tagLOGPALETTE;
TLOGPALETTE = tagLOGPALETTE;
{GradientFill Structures}
{ GradientFill Structures }
PTriVertex = ^tagTriVertex;
tagTRIVERTEX = packed record
x: Longint;
@ -793,11 +801,7 @@ type
{ ********************************** }
{ B I T M A P S T U F F }
{ TBitmap is an encapsulation of a matrix of pixels. It has a Canvas to allow
modifications to the image. Creating copies of a TBitmap is very fast
since the handle is copied not the image. If the image is modified, and
the handle is shared by more than one TBitmap object, the image is copied
before the modification is performed (i.e. copy on write). }
{ TBitmap is an encapsulation of a matrix of pixels. }
PBitmap = ^TagBitmap;
tagBITMAP = packed record
bmType: Longint;
@ -1771,6 +1775,9 @@ end.
{
$Log$
Revision 1.32 2003/02/26 12:44:52 mattias
readonly flag is now only saved if user set
Revision 1.31 2002/12/27 17:12:37 mattias
added more Delphi win32 compatibility functions

View File

@ -202,21 +202,22 @@ const
LM_CLOSEQUERY = LM_USER+62;
LM_DRAGSTART = LM_USER+63;
LM_DEACTIVATE = LM_USER+64; //used when a form is no longer in front
LM_QUIT = LM_USER+65;
LM_MONTHCHANGED = LM_USER+65;
LM_YEARCHANGED = LM_USER+66;
LM_DAYCHANGED = LM_USER+67;
LM_MONTHCHANGED = LM_USER+66;
LM_YEARCHANGED = LM_USER+67;
LM_DAYCHANGED = LM_USER+68;
LM_MOUSEFIRST2 = LM_USER+68;
LM_LBUTTONTRIPLECLK = LM_USER+68;
LM_LBUTTONQUADCLK = LM_USER+69;
LM_MBUTTONTRIPLECLK = LM_USER+70;
LM_MBUTTONQUADCLK = LM_USER+71;
LM_RBUTTONTRIPLECLK = LM_USER+72;
LM_RBUTTONQUADCLK = LM_USER+73;
LM_MOUSEENTER = LM_USER+74;
LM_MOUSELEAVE = LM_USER+75;
LM_MOUSELAST2 = LM_RBUTTONQUADCLK;
LM_MOUSEFIRST2 = LM_USER+70;
LM_LBUTTONTRIPLECLK = LM_MOUSEFIRST2 +0;
LM_LBUTTONQUADCLK = LM_MOUSEFIRST2 +1;
LM_MBUTTONTRIPLECLK = LM_MOUSEFIRST2 +2;
LM_MBUTTONQUADCLK = LM_MOUSEFIRST2 +3;
LM_RBUTTONTRIPLECLK = LM_MOUSEFIRST2 +4;
LM_RBUTTONQUADCLK = LM_MOUSEFIRST2 +5;
LM_MOUSEENTER = LM_MOUSEFIRST2 +6;
LM_MOUSELEAVE = LM_MOUSEFIRST2 +7;
LM_MOUSELAST2 = LM_MOUSELEAVE;
LM_GRABFOCUS = LM_USER+79;
@ -1040,6 +1041,9 @@ end.
{
$Log$
Revision 1.45 2003/02/26 12:44:52 mattias
readonly flag is now only saved if user set
Revision 1.44 2002/12/27 17:12:37 mattias
added more Delphi win32 compatibility functions

View File

@ -39,37 +39,37 @@ const
WM_ERASEBKGND = LM_ERASEBKGND;
WM_GETDLGCODE = LM_GETDLGCODE;
WM_HSCROLL = LM_HSCROLL;
WM_LButtonDblClk = LM_LBUTTONDBLCLK;
WM_KILLFOCUS = LM_KILLFOCUS;
WM_LButtonDblClk = LM_LBUTTONDBLCLK;
WM_MOUSEMOVE = LM_MOUSEMOVE;
WM_NCHITTEST = LM_NCHITTEST;
WM_SIZE = LM_SIZE;
WM_QUIT = LM_QUIT;
WM_SETCURSOR = LM_SETCURSOR;
WM_SETFOCUS = LM_SETFOCUS;
WM_SIZE = LM_SIZE;
WM_SYSCHAR = LM_SYSCHAR;
WM_SYSKEYDOWN = LM_SYSKEYDOWN;
WM_SYSKEYUP = LM_SYSKEYUP;
WM_VSCROLL = LM_VSCROLL;
WM_MOUSEMOVE = LM_MOUSEMOVE;
type
TMessage = TLMessage;
TWMEraseBkgnd = TLMEraseBkgnd;
TWMKILLFOCUS = TLMKILLFOCUS;
TWMMOUSE = TLMMouse;
TWMKillFocus = TLMKillFocus;
TWMMouse = TLMMouse;
TWMNCHITTEST = TLMNCHITTEST;
TWMSCROLL = TLMSCROLL;
TWMSETCURSOR = TLMSETCURSOR;
TWMSetFocus = TLMSetFocus;
TWMSIZE = TLMSIZE;
TWMHScroll = TLMHScroll;
TWMVScroll = TLMVScroll;
TWMGetDlgCode = TLMNoParams;
TWMMouseMove = TLMMouseMove;
implementation