mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 09:56:12 +02:00
fixed changing widget set and TStringGrid exceptions on ColCount=0
git-svn-id: trunk@4386 -
This commit is contained in:
parent
8a77658903
commit
7880351d77
@ -196,7 +196,7 @@ type
|
|||||||
read FOnAfterApplyChanges write FOnAfterApplyChanges;
|
read FOnAfterApplyChanges write FOnAfterApplyChanges;
|
||||||
|
|
||||||
// defines
|
// defines
|
||||||
procedure SetGlobalValue(const VariableName, VariableValue: string);
|
function SetGlobalValue(const VariableName, VariableValue: string): boolean;
|
||||||
function GetUnitPathForDirectory(const Directory: string): string;
|
function GetUnitPathForDirectory(const Directory: string): string;
|
||||||
function GetIncludePathForDirectory(const Directory: string): string;
|
function GetIncludePathForDirectory(const Directory: string): string;
|
||||||
function GetSrcPathForDirectory(const Directory: string): string;
|
function GetSrcPathForDirectory(const Directory: string): string;
|
||||||
@ -606,13 +606,14 @@ begin
|
|||||||
Result:=SourceChangeCache.Apply;
|
Result:=SourceChangeCache.Apply;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCodeToolManager.SetGlobalValue(const VariableName,
|
function TCodeToolManager.SetGlobalValue(const VariableName,
|
||||||
VariableValue: string);
|
VariableValue: string): boolean;
|
||||||
var
|
var
|
||||||
OldValue: string;
|
OldValue: string;
|
||||||
begin
|
begin
|
||||||
OldValue:=GlobalValues[VariableName];
|
OldValue:=GlobalValues[VariableName];
|
||||||
if OldValue=VariableValue then exit;
|
Result:=(OldValue<>VariableValue);
|
||||||
|
if not Result then exit;
|
||||||
GlobalValues[VariableName]:=VariableValue;
|
GlobalValues[VariableName]:=VariableValue;
|
||||||
DefineTree.ClearCache;
|
DefineTree.ClearCache;
|
||||||
end;
|
end;
|
||||||
|
@ -2645,14 +2645,20 @@ end;
|
|||||||
procedure TProjectDefineTemplates.UpdateGlobalValues;
|
procedure TProjectDefineTemplates.UpdateGlobalValues;
|
||||||
var
|
var
|
||||||
NewProjectDir: String;
|
NewProjectDir: String;
|
||||||
|
Changed: Boolean;
|
||||||
begin
|
begin
|
||||||
CodeToolBoss.SetGlobalValue(ExternalMacroStart+'LCLWidgetType',
|
Changed:=false;
|
||||||
Owner.CompilerOptions.LCLWidgetType);
|
Changed:=Changed or CodeToolBoss.SetGlobalValue(
|
||||||
|
ExternalMacroStart+'LCLWidgetType',
|
||||||
|
Owner.CompilerOptions.LCLWidgetType);
|
||||||
if Owner.IsVirtual then
|
if Owner.IsVirtual then
|
||||||
NewProjectDir:=VirtualDirectory
|
NewProjectDir:=VirtualDirectory
|
||||||
else
|
else
|
||||||
NewProjectDir:=Owner.ProjectDirectory;
|
NewProjectDir:=Owner.ProjectDirectory;
|
||||||
CodeToolBoss.SetGlobalValue(ExternalMacroStart+'ProjPath',NewProjectDir);
|
Changed:=Changed or CodeToolBoss.SetGlobalValue(
|
||||||
|
ExternalMacroStart+'ProjPath',NewProjectDir);
|
||||||
|
if Changed then
|
||||||
|
IncreaseCompilerParseStamp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
@ -2661,6 +2667,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.131 2003/07/08 17:30:19 mattias
|
||||||
|
fixed changing widget set and TStringGrid exceptions on ColCount=0
|
||||||
|
|
||||||
Revision 1.130 2003/06/25 17:22:47 mattias
|
Revision 1.130 2003/06/25 17:22:47 mattias
|
||||||
added automatic linux-windows file conversions
|
added automatic linux-windows file conversions
|
||||||
|
|
||||||
|
@ -871,8 +871,11 @@ End;
|
|||||||
|
|
||||||
Function TCustomGrid.Getcolwidths(Acol: Integer): Integer;
|
Function TCustomGrid.Getcolwidths(Acol: Integer): Integer;
|
||||||
Begin
|
Begin
|
||||||
Result:=Integer(FCols[aCol]);
|
if aCol<ColCount then begin
|
||||||
if result<0 then Result:=fDefColWidth;
|
Result:=Integer(FCols[aCol]);
|
||||||
|
if result<0 then Result:=fDefColWidth;
|
||||||
|
end else
|
||||||
|
Result:=0;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
procedure TCustomGrid.SetEditor(AValue: TWinControl);
|
procedure TCustomGrid.SetEditor(AValue: TWinControl);
|
||||||
@ -1267,7 +1270,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// The visible grid Depends on TopLeft and ClientWidht,ClientHeight,
|
// The visible grid Depends on TopLeft and ClientWidht,ClientHeight,
|
||||||
// Col/Row Count, So it Should be called inmediately after any change
|
// Col/Row Count, So it Should be called immediately after any change
|
||||||
// like that
|
// like that
|
||||||
function TCustomGrid.GetVisibleGrid: TRect;
|
function TCustomGrid.GetVisibleGrid: TRect;
|
||||||
Var
|
Var
|
||||||
@ -1527,7 +1530,7 @@ Var
|
|||||||
Rs: Boolean;
|
Rs: Boolean;
|
||||||
R: TRect;
|
R: TRect;
|
||||||
begin
|
begin
|
||||||
|
if (RowCount=0) or (ColCount=0) then exit;
|
||||||
ColRowToOffSet(False, True, aRow, R.Top, R.Bottom);
|
ColRowToOffSet(False, True, aRow, R.Top, R.Bottom);
|
||||||
|
|
||||||
// Draw columns in this row
|
// Draw columns in this row
|
||||||
@ -1929,8 +1932,13 @@ begin
|
|||||||
ValidGrid:=(Left>=0)And(Top>=0)And(Right>=Left)And(Bottom>=Top);
|
ValidGrid:=(Left>=0)And(Top>=0)And(Right>=Left)And(Bottom>=Top);
|
||||||
If Not ValidGrid Then MaxClientXY:=Point(0,0)
|
If Not ValidGrid Then MaxClientXY:=Point(0,0)
|
||||||
Else begin
|
Else begin
|
||||||
R:=ColRowToClientCellrect(VisibleGrid.Right, VisibleGrid.Bottom);
|
if (VisibleGrid.Right<ColCount)
|
||||||
MaxClientXY:=R.BottomRight;
|
and (VisibleGrid.Bottom<RowCount) then begin
|
||||||
|
R:=ColRowToClientCellrect(VisibleGrid.Right, VisibleGrid.Bottom);
|
||||||
|
MaxClientXY:=R.BottomRight;
|
||||||
|
end else begin
|
||||||
|
MaxClientXY:=Point(0,0);
|
||||||
|
end;
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
end;
|
end;
|
||||||
@ -2125,7 +2133,8 @@ begin
|
|||||||
End;
|
End;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomGrid.ColRowToOffset(IsCol,Fisical:Boolean; Index:Integer; Var Ini,Fin:Integer): Boolean;
|
function TCustomGrid.ColRowToOffset(IsCol,Fisical:Boolean; Index:Integer;
|
||||||
|
Var Ini,Fin:Integer): Boolean;
|
||||||
Var
|
Var
|
||||||
Dim: Integer;
|
Dim: Integer;
|
||||||
begin
|
begin
|
||||||
@ -2527,7 +2536,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ Returns a reactagle corresponding to a fisical cell[aCol,aRow] }
|
{ Returns a rectangle corresponding to a fisical cell[aCol,aRow] }
|
||||||
function TCustomGrid.ColRowToClientCellRect(aCol, aRow: Integer): TRect;
|
function TCustomGrid.ColRowToClientCellRect(aCol, aRow: Integer): TRect;
|
||||||
begin
|
begin
|
||||||
ColRowToOffset(True, True, ACol, Result.Left, Result.Right);
|
ColRowToOffset(True, True, ACol, Result.Left, Result.Right);
|
||||||
|
Loading…
Reference in New Issue
Block a user