mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 20:19:27 +02:00
fixed freeing synedit PrimarySelection and sending gtklist DrawItem msg for destroing controls
git-svn-id: trunk@5691 -
This commit is contained in:
parent
852d652b26
commit
bddd2f7bdc
@ -259,10 +259,12 @@ type
|
||||
xtLongWord, // longword
|
||||
xtWord, // word
|
||||
xtSmallInt, // smallint
|
||||
xtByte, // byte
|
||||
xtCompilerFunc,// SUCC, PREC, LOW, HIGH, ORD, LENGTH, COPY (1.1)
|
||||
xtNil // nil = pointer, class, procedure, method, ...
|
||||
);
|
||||
TExpressionTypeDescs = set of TExpressionTypeDesc;
|
||||
// Do not use this: TExpressionTypeDescs = set of TExpressionTypeDesc;
|
||||
// There are too many enums, so the set would be big and slow
|
||||
|
||||
const
|
||||
ExpressionTypeDescNames: array[TExpressionTypeDesc] of string = (
|
||||
@ -299,6 +301,7 @@ const
|
||||
'LongWord',
|
||||
'Word',
|
||||
'SmallInt',
|
||||
'Byte',
|
||||
'CompilerFunc',
|
||||
'Nil'
|
||||
);
|
||||
@ -306,7 +309,7 @@ const
|
||||
xtAllTypes = [Low(TExpressionTypeDesc)..High(TExpressionTypeDesc)]-[xtNone];
|
||||
xtAllPredefinedTypes = xtAllTypes-[xtContext];
|
||||
xtAllIntegerTypes = [xtInt64, xtQWord, xtConstOrdInteger, xtLongint,
|
||||
xtLongWord, xtWord, xtCardinal, xtSmallInt];
|
||||
xtLongWord, xtWord, xtCardinal, xtSmallInt, xtByte];
|
||||
xtAllBooleanTypes = [xtBoolean, xtByteBool, xtLongBool];
|
||||
xtAllRealTypes = [xtReal, xtConstReal, xtSingle, xtDouble, xtExtended,
|
||||
xtCurrency, xtComp];
|
||||
@ -785,6 +788,8 @@ begin
|
||||
Result:=xtCardinal
|
||||
else if CompareIdentifiers(Identifier,'SMALLINT')=0 then
|
||||
Result:=xtSmallInt
|
||||
else if CompareIdentifiers(Identifier,'BYTE')=0 then
|
||||
Result:=xtByte
|
||||
else
|
||||
Result:=xtNone;
|
||||
end;
|
||||
@ -6244,6 +6249,7 @@ begin
|
||||
xtLongint,
|
||||
xtLongWord,
|
||||
xtSmallInt,
|
||||
xtByte,
|
||||
xtWord:
|
||||
Result:=ExpressionTypeDescNames[ExprType.Desc];
|
||||
|
||||
|
@ -1165,6 +1165,7 @@ begin
|
||||
Add('LONGINT' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('COPY' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('SMALLINT' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
Add('BYTE' ,{$ifdef FPC}@{$endif}AllwaysTrue);
|
||||
end;
|
||||
|
||||
WordIsPredefinedDelphiIdentifier:=TKeyWordFunctionList.Create;
|
||||
|
@ -7453,6 +7453,10 @@ begin
|
||||
{$IFNDEF DisableDoubleBuf}
|
||||
FreeAndNil(BufferBitmap);
|
||||
{$ENDIF}
|
||||
{$IFDEF SYN_LAZARUS}
|
||||
if PrimarySelection.OnRequest=@PrimarySelectionRequest then
|
||||
PrimarySelection.OnRequest:=nil;
|
||||
{$ENDIF}
|
||||
inherited DestroyWnd;
|
||||
end;
|
||||
|
||||
|
@ -134,6 +134,11 @@ procedure SaveStringList(XMLConfig: TXMLConfig; List: TStrings;
|
||||
function FindProgram(const Programname, BaseDirectory: string;
|
||||
WithBaseDirectory: boolean): string;
|
||||
|
||||
const DateAsCfgStrFormat='YYYYMMDD';
|
||||
|
||||
function DateToCfgStr(const Date: TDateTime): string;
|
||||
function CfgStrToDate(const s: string; var Date: TDateTime): boolean;
|
||||
|
||||
// text conversion
|
||||
function TabsToSpaces(const s: string; TabWidth: integer): string;
|
||||
function CommentLines(const s: string): string;
|
||||
@ -1211,6 +1216,44 @@ begin
|
||||
Delim,Flags);
|
||||
end;
|
||||
|
||||
function DateToCfgStr(const Date: TDateTime): string;
|
||||
begin
|
||||
try
|
||||
Result:=FormatDateTime(DateAsCfgStrFormat,Date);
|
||||
except
|
||||
Result:='';
|
||||
end;
|
||||
//debugln('DateToCfgStr "',Result,'"');
|
||||
end;
|
||||
|
||||
function CfgStrToDate(const s: string; var Date: TDateTime): boolean;
|
||||
var
|
||||
i: Integer;
|
||||
Year, Month, Day: word;
|
||||
begin
|
||||
//debugln('CfgStrToDate "',s,'"');
|
||||
Result:=true;
|
||||
if length(s)<>length(DateAsCfgStrFormat) then begin
|
||||
Result:=false;
|
||||
exit;
|
||||
end;
|
||||
try
|
||||
Year:=0;
|
||||
Month:=0;
|
||||
Day:=0;
|
||||
for i:=1 to length(DateAsCfgStrFormat) do begin
|
||||
case DateAsCfgStrFormat[i] of
|
||||
'Y': Year:=Year*10+ord(s[i])-ord('0');
|
||||
'M': Month:=Month*10+ord(s[i])-ord('0');
|
||||
'D': Day:=Day*10+ord(s[i])-ord('0');
|
||||
end;
|
||||
end;
|
||||
Date:=EncodeDate(Year,Month,Day);
|
||||
except
|
||||
Result:=false;
|
||||
end;
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
TabsToSpaces
|
||||
|
||||
|
@ -59,7 +59,7 @@ var
|
||||
LCLList: TGtkListStringList;
|
||||
begin
|
||||
Result:=true;
|
||||
|
||||
|
||||
//DebugLn('gtkListItemDrawCB ');
|
||||
|
||||
// get context
|
||||
@ -70,6 +70,7 @@ begin
|
||||
GtkListItemLCLListTag));
|
||||
if LCLList=nil then
|
||||
RaiseException('gtkListItemDrawAfterCB LCLList=nil');
|
||||
if [csDestroying,csLoading]*LCLList.Owner.ComponentState<>[] then exit;
|
||||
|
||||
// get itemindex and area
|
||||
ItemIndex:=g_list_index(GtkList^.children,Data);
|
||||
@ -961,6 +962,9 @@ end;
|
||||
{ =============================================================================
|
||||
|
||||
$Log$
|
||||
Revision 1.27 2004/07/17 14:24:31 mattias
|
||||
fixed freeing synedit PrimarySelection and sending gtklist DrawItem msg for destroing controls
|
||||
|
||||
Revision 1.26 2004/07/03 11:11:08 mattias
|
||||
TGTKListStringList now keeps selection on Put and Move
|
||||
|
||||
|
@ -43,7 +43,23 @@ uses
|
||||
|
||||
type
|
||||
|
||||
{ TPackageLink }
|
||||
{ TPackageLink
|
||||
There are several types of package links.
|
||||
|
||||
Global: These are collected from the lazarus source directory.
|
||||
EnvironmentOptions.LazarusDirectory+'packager/globallinks/*.lpl'
|
||||
This way packages can install/uninstal themselves to one lazarus
|
||||
source directory, and this lazarus directory can then be shared
|
||||
by several users/configs.
|
||||
|
||||
User: These are collected from the user config directory, from the file
|
||||
packagelinks.xml.
|
||||
These links are maintained by the IDE. Everytime the user opens a
|
||||
package a user link is created, so that the next time the package
|
||||
can be automatically opened. The list is checked by the IDE from
|
||||
time to time and missing packages are first marked and after several
|
||||
months deleted from the list.
|
||||
}
|
||||
|
||||
TPkgLinkOrigin = (
|
||||
ploGlobal,
|
||||
@ -53,7 +69,11 @@ type
|
||||
|
||||
TPackageLink = class(TLazPackageID)
|
||||
private
|
||||
FAutoCheckExists: boolean;
|
||||
FFilename: string;
|
||||
FLastCheck: TDateTime;
|
||||
FLastCheckValid: boolean;
|
||||
FNotFoundCount: integer;
|
||||
FOrigin: TPkgLinkOrigin;
|
||||
procedure SetFilename(const AValue: string);
|
||||
procedure SetOrigin(const AValue: TPkgLinkOrigin);
|
||||
@ -64,6 +84,10 @@ type
|
||||
public
|
||||
property Origin: TPkgLinkOrigin read FOrigin write SetOrigin;
|
||||
property Filename: string read FFilename write SetFilename;
|
||||
property AutoCheckExists: boolean read FAutoCheckExists write FAutoCheckExists;
|
||||
property NotFoundCount: integer read FNotFoundCount write FNotFoundCount;
|
||||
property LastCheckValid: boolean read FLastCheckValid write FLastCheckValid;
|
||||
property LastCheck: TDateTime read FLastCheck write FLastCheck;
|
||||
end;
|
||||
|
||||
|
||||
@ -79,7 +103,7 @@ type
|
||||
private
|
||||
FGlobalLinks: TAVLTree; // tree of TPackageLink sorted for ID
|
||||
FModified: boolean;
|
||||
FUserLinks: TAVLTree; // tree of TPackageLink
|
||||
FUserLinks: TAVLTree; // tree of TPackageLink sorted for ID
|
||||
fUpdateLock: integer;
|
||||
FStates: TPkgLinksStates;
|
||||
function FindLeftMostNode(LinkTree: TAVLTree;
|
||||
@ -178,6 +202,7 @@ end;
|
||||
constructor TPackageLink.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
FAutoCheckExists:=true;
|
||||
end;
|
||||
|
||||
destructor TPackageLink.Destroy;
|
||||
@ -387,7 +412,18 @@ begin
|
||||
NewPkgLink.Version.LoadFromXMLConfig(XMLConfig,ItemPath+'Version/',
|
||||
LazPkgXMLFileVersion);
|
||||
NewPkgLink.Filename:=XMLConfig.GetValue(ItemPath+'Filename/Value','');
|
||||
|
||||
NewPkgLink.AutoCheckExists:=
|
||||
XMLConfig.GetValue(ItemPath+'AutoCheckExists/Value',true);
|
||||
NewPkgLink.LastCheckValid:=
|
||||
XMLConfig.GetValue(ItemPath+'LastCheckValid/Value',false);
|
||||
if NewPkgLink.LastCheckValid then begin
|
||||
NewPkgLink.LastCheckValid:=
|
||||
CfgStrToDate(XMLConfig.GetValue(ItemPath+'LastCheck/Value',''),
|
||||
NewPkgLink.FLastCheck);
|
||||
end;
|
||||
NewPkgLink.NotFoundCount:=
|
||||
XMLConfig.GetValue(ItemPath+'NotFoundCount/Value',0);
|
||||
|
||||
if NewPkgLink.MakeSense then
|
||||
FUserLinks.Add(NewPkgLink)
|
||||
else
|
||||
@ -457,6 +493,14 @@ begin
|
||||
XMLConfig.SetDeleteValue(ItemPath+'Name/Value',CurPkgLink.Name,'');
|
||||
CurPkgLink.Version.SaveToXMLConfig(XMLConfig,ItemPath+'Version/');
|
||||
XMLConfig.SetDeleteValue(ItemPath+'Filename/Value',CurPkgLink.Filename,'');
|
||||
XMLConfig.SetDeleteValue(ItemPath+'LastCheckValid/Value',
|
||||
CurPkgLink.LastCheckValid,false);
|
||||
if CurPkgLink.LastCheckValid then
|
||||
XMLConfig.SetDeleteValue(ItemPath+'LastCheck/Value',
|
||||
DateToCfgStr(CurPkgLink.LastCheck),'');
|
||||
XMLConfig.SetDeleteValue(ItemPath+'NotFoundCount/Value',
|
||||
CurPkgLink.NotFoundCount,0);
|
||||
|
||||
ANode:=FUserLinks.FindSuccessor(ANode);
|
||||
end;
|
||||
XMLConfig.SetDeleteValue(Path+'Count',FUserLinks.Count,0);
|
||||
|
Loading…
Reference in New Issue
Block a user