mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 20:59:36 +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;
|
||||
|
||||
// defines
|
||||
procedure SetGlobalValue(const VariableName, VariableValue: string);
|
||||
function SetGlobalValue(const VariableName, VariableValue: string): boolean;
|
||||
function GetUnitPathForDirectory(const Directory: string): string;
|
||||
function GetIncludePathForDirectory(const Directory: string): string;
|
||||
function GetSrcPathForDirectory(const Directory: string): string;
|
||||
@ -606,13 +606,14 @@ begin
|
||||
Result:=SourceChangeCache.Apply;
|
||||
end;
|
||||
|
||||
procedure TCodeToolManager.SetGlobalValue(const VariableName,
|
||||
VariableValue: string);
|
||||
function TCodeToolManager.SetGlobalValue(const VariableName,
|
||||
VariableValue: string): boolean;
|
||||
var
|
||||
OldValue: string;
|
||||
begin
|
||||
OldValue:=GlobalValues[VariableName];
|
||||
if OldValue=VariableValue then exit;
|
||||
Result:=(OldValue<>VariableValue);
|
||||
if not Result then exit;
|
||||
GlobalValues[VariableName]:=VariableValue;
|
||||
DefineTree.ClearCache;
|
||||
end;
|
||||
|
@ -2645,14 +2645,20 @@ end;
|
||||
procedure TProjectDefineTemplates.UpdateGlobalValues;
|
||||
var
|
||||
NewProjectDir: String;
|
||||
Changed: Boolean;
|
||||
begin
|
||||
CodeToolBoss.SetGlobalValue(ExternalMacroStart+'LCLWidgetType',
|
||||
Owner.CompilerOptions.LCLWidgetType);
|
||||
Changed:=false;
|
||||
Changed:=Changed or CodeToolBoss.SetGlobalValue(
|
||||
ExternalMacroStart+'LCLWidgetType',
|
||||
Owner.CompilerOptions.LCLWidgetType);
|
||||
if Owner.IsVirtual then
|
||||
NewProjectDir:=VirtualDirectory
|
||||
else
|
||||
NewProjectDir:=Owner.ProjectDirectory;
|
||||
CodeToolBoss.SetGlobalValue(ExternalMacroStart+'ProjPath',NewProjectDir);
|
||||
Changed:=Changed or CodeToolBoss.SetGlobalValue(
|
||||
ExternalMacroStart+'ProjPath',NewProjectDir);
|
||||
if Changed then
|
||||
IncreaseCompilerParseStamp;
|
||||
end;
|
||||
|
||||
end.
|
||||
@ -2661,6 +2667,9 @@ end.
|
||||
|
||||
{
|
||||
$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
|
||||
added automatic linux-windows file conversions
|
||||
|
||||
|
@ -871,8 +871,11 @@ End;
|
||||
|
||||
Function TCustomGrid.Getcolwidths(Acol: Integer): Integer;
|
||||
Begin
|
||||
Result:=Integer(FCols[aCol]);
|
||||
if result<0 then Result:=fDefColWidth;
|
||||
if aCol<ColCount then begin
|
||||
Result:=Integer(FCols[aCol]);
|
||||
if result<0 then Result:=fDefColWidth;
|
||||
end else
|
||||
Result:=0;
|
||||
End;
|
||||
|
||||
procedure TCustomGrid.SetEditor(AValue: TWinControl);
|
||||
@ -1267,7 +1270,7 @@ begin
|
||||
end;
|
||||
|
||||
// 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
|
||||
function TCustomGrid.GetVisibleGrid: TRect;
|
||||
Var
|
||||
@ -1527,7 +1530,7 @@ Var
|
||||
Rs: Boolean;
|
||||
R: TRect;
|
||||
begin
|
||||
|
||||
if (RowCount=0) or (ColCount=0) then exit;
|
||||
ColRowToOffSet(False, True, aRow, R.Top, R.Bottom);
|
||||
|
||||
// Draw columns in this row
|
||||
@ -1929,8 +1932,13 @@ begin
|
||||
ValidGrid:=(Left>=0)And(Top>=0)And(Right>=Left)And(Bottom>=Top);
|
||||
If Not ValidGrid Then MaxClientXY:=Point(0,0)
|
||||
Else begin
|
||||
R:=ColRowToClientCellrect(VisibleGrid.Right, VisibleGrid.Bottom);
|
||||
MaxClientXY:=R.BottomRight;
|
||||
if (VisibleGrid.Right<ColCount)
|
||||
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;
|
||||
@ -2125,7 +2133,8 @@ begin
|
||||
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
|
||||
Dim: Integer;
|
||||
begin
|
||||
@ -2527,7 +2536,7 @@ begin
|
||||
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;
|
||||
begin
|
||||
ColRowToOffset(True, True, ACol, Result.Left, Result.Right);
|
||||
|
Loading…
Reference in New Issue
Block a user