added some resourcestrings and autosizing for checklistbox editor

git-svn-id: trunk@7341 -
This commit is contained in:
mattias 2005-07-13 17:25:06 +00:00
parent cb4bbdbc39
commit 733f344443
9 changed files with 141 additions and 57 deletions

View File

@ -286,10 +286,12 @@ begin
if (not Macros.SubstituteStr(Params)) then exit; if (not Macros.SubstituteStr(Params)) then exit;
if not FilenameIsAbsolute(Filename) then if not FilenameIsAbsolute(Filename) then
Filename:=FindProgram(Filename,GetCurrentDir,false); Filename:=FindProgram(Filename,GetCurrentDir,false);
WorkingDir:=TrimFilename(WorkingDir);
Filename:=TrimFilename(Filename);
CmdLine:=Filename; CmdLine:=Filename;
if Params<>'' then if Params<>'' then
CmdLine:=CmdLine+' '+Params; CmdLine:=CmdLine+' '+Params;
DebugLn('[TExternalToolList.Run] ',CmdLine); DebugLn('[TExternalToolList.Run] CmdLine="',CmdLine,'" WorkDir="',WorkingDir,'"');
try try
CheckIfFileIsExecutable(Filename); CheckIfFileIsExecutable(Filename);
TheProcess := TProcess.Create(nil); TheProcess := TProcess.Create(nil);

View File

@ -26,8 +26,6 @@ unit OutputFilter;
interface interface
{$DEFINE ShowTriedFiles}
uses uses
Classes, SysUtils, Forms, Controls, CompilerOptions, Project, Process, Classes, SysUtils, Forms, Controls, CompilerOptions, Project, Process,
IDEProcs, FileUtil, LclProc, LazConf; IDEProcs, FileUtil, LclProc, LazConf;
@ -238,6 +236,7 @@ var
begin begin
Result:=true; Result:=true;
Clear; Clear;
//debugln('TOutputFilter.Execute A CurrentDirectory="',TheProcess.CurrentDirectory,'"');
TheProcess.Execute; TheProcess.Execute;
fCurrentDirectory:=TrimFilename(TheProcess.CurrentDirectory); fCurrentDirectory:=TrimFilename(TheProcess.CurrentDirectory);
if fCurrentDirectory='' then fCurrentDirectory:=GetCurrentDir; if fCurrentDirectory='' then fCurrentDirectory:=GetCurrentDir;
@ -296,7 +295,7 @@ procedure TOutputFilter.ReadLine(const s: string; DontFilterLine: boolean);
// this is called for every line written by the external tool (=Output) // this is called for every line written by the external tool (=Output)
// it parses the output // it parses the output
begin begin
//writeln('TOutputFilter: "',s,'"'); //debugln('TOutputFilter: "',s,'"');
fLastMessageType:=omtNone; fLastMessageType:=omtNone;
fLastErrorType:=etNone; fLastErrorType:=etNone;
fOutput.Add(s); fOutput.Add(s);

View File

@ -723,12 +723,12 @@ end;
function TNotebookComponentEditor.GetVerb(Index: Integer): string; function TNotebookComponentEditor.GetVerb(Index: Integer): string;
begin begin
case Index of case Index of
nbvAddPage: Result:='Add page'; nbvAddPage: Result:=nbcesAddPage;
nbvInsertPage: Result:='Insert page'; nbvInsertPage: Result:=nbcesInsertPage;
nbvDeletePage: Result:='Delete page'; nbvDeletePage: Result:=nbcesDeletePage;
nbvMovePageLeft: Result:='Move page left'; nbvMovePageLeft: Result:=nbcesMovePageLeft;
nbvMovePageRight: Result:='Move page right'; nbvMovePageRight: Result:=nbcesMovePageRight;
nbvShowPage: Result:='Show page ...'; nbvShowPage: Result:=nbcesShowPage;
else else
Result:=''; Result:='';
end; end;
@ -991,58 +991,59 @@ begin
Align:=alTop; Align:=alTop;
BevelInner:=bvLowered; BevelInner:=bvLowered;
BevelOuter:=bvSpace; BevelOuter:=bvSpace;
Height:=25; AutoSize:=true;
end; end;
//Button Add //Button Add
FBtnAdd:=TButton.Create(self); FBtnAdd:=TButton.Create(self);
with FBtnAdd do begin with FBtnAdd do begin
Parent:=FPanelButtons;
Align:=alLeft;
Width:=43;
Caption:=oiscAdd; Caption:=oiscAdd;
Parent:=FPanelButtons;
OnClick:=@AddItem; OnClick:=@AddItem;
AutoSize:=true;
Top:=0;
end; end;
//Button Delete //Button Delete
FBtnDelete:=TButton.Create(self); FBtnDelete:=TButton.Create(self);
with FBtnDelete do begin with FBtnDelete do begin
Parent:=FPanelButtons;
Align:=alLeft;
Width:=43;
Caption:=oiscDelete; Caption:=oiscDelete;
Parent:=FPanelButtons;
OnClick:=@DeleteItem; OnClick:=@DeleteItem;
AutoSize:=true;
AnchorToCompanion(akLeft,0,FBtnAdd);
end; end;
//Button Up //Button Up
FBtnUp:=TButton.Create(self); FBtnUp:=TButton.Create(self);
with FBtnUp do begin with FBtnUp do begin
Parent:=FPanelButtons;
Align:=alLeft;
Width:=43;
Caption:=clbUp; Caption:=clbUp;
Parent:=FPanelButtons;
OnClick:=@MoveUpItem; OnClick:=@MoveUpItem;
AutoSize:=true;
AnchorToCompanion(akLeft,0,FBtnDelete);
end; end;
//Button Down //Button Down
FBtnDown:=TButton.Create(self); FBtnDown:=TButton.Create(self);
with FBtnDown do begin with FBtnDown do begin
Parent:=FPanelButtons;
Align:=alLeft;
Width:=43;
Caption:=clbDown; Caption:=clbDown;
Parent:=FPanelButtons;
OnClick:=@MoveDownItem; OnClick:=@MoveDownItem;
AutoSize:=true;
AnchorToCompanion(akLeft,0,FBtnUp);
end; end;
//Button Modify //Button Modify
FBtnModify:=TButton.Create(self); FBtnModify:=TButton.Create(self);
with FBtnModify do begin with FBtnModify do begin
Caption:='...';
Parent:=FPanelButtons; Parent:=FPanelButtons;
Align:=alClient;
ShowHint:=true; ShowHint:=true;
Hint:=clbModify; Hint:=clbModify;
Caption:='...';
OnClick:=@ModifyItem; OnClick:=@ModifyItem;
AutoSize:=true;
AnchorToCompanion(akLeft,0,FBtnDown);
end; end;
FCheck:=TCheckListBox.Create(Self); FCheck:=TCheckListBox.Create(Self);
@ -1057,23 +1058,24 @@ begin
Align:=alBottom; Align:=alBottom;
BevelInner:=bvLowered; BevelInner:=bvLowered;
BevelOuter:=bvSpace; BevelOuter:=bvSpace;
Height:=25; AutoSize:=true;
end; end;
//Bnt Ok //Btn Ok
FBtnOK:=TBitBtn.Create(self); FBtnOK:=TBitBtn.Create(self);
with FBtnOK do begin with FBtnOK do begin
Parent:=FPanelOKCancel; Parent:=FPanelOKCancel;
Align:=alLeft;
Kind:=bkOk; Kind:=bkOk;
AutoSize:=true;
end; end;
//Bnt Cancel //Btn Cancel
FBtnCancel:=TBitBtn.Create(self); FBtnCancel:=TBitBtn.Create(self);
with FBtnCancel do begin with FBtnCancel do begin
Parent:=FPanelOKCancel; Parent:=FPanelOKCancel;
Align:=alRight;
Kind:=bkCancel; Kind:=bkCancel;
AutoSize:=true;
AnchorToCompanion(akLeft,0,FBtnOK);
end; end;
end; end;

View File

@ -243,7 +243,7 @@ begin
LoadBTN := TBUTTON.Create(Self); LoadBTN := TBUTTON.Create(Self);
With LoadBTN do begin With LoadBTN do begin
Parent := Self; Parent := Self;
CAPTION := oisLoad; CAPTION := oisLoadPicture;
ONCLICK := @LoadBTNCLICK; ONCLICK := @LoadBTNCLICK;
end; end;
@ -251,14 +251,14 @@ begin
With SaveBTN do begin With SaveBTN do begin
Parent := Self; Parent := Self;
ENABLED := False; ENABLED := False;
CAPTION := oisSave; CAPTION := oisSavePicture;
ONCLICK := @SaveBTNCLICK; ONCLICK := @SaveBTNCLICK;
end; end;
ClearBTN := TBUTTON.Create(Self); ClearBTN := TBUTTON.Create(Self);
With ClearBTN do begin With ClearBTN do begin
Parent := Self; Parent := Self;
CAPTION := oisCLear; CAPTION := oisClearPicture;
ONCLICK := @ClearBTNCLICK; ONCLICK := @ClearBTNCLICK;
end; end;

View File

@ -92,6 +92,12 @@ resourcestring
// component editors // component editors
cesStringGridEditor = 'StringGrid Editor ...'; cesStringGridEditor = 'StringGrid Editor ...';
cesStringGridEditor2 = 'StringGrid Editor'; cesStringGridEditor2 = 'StringGrid Editor';
nbcesAddPage = 'Add page';
nbcesInsertPage = 'Insert page';
nbcesDeletePage = 'Delete page';
nbcesMovePageLeft = 'Move page left';
nbcesMovePageRight = 'Move page right';
nbcesShowPage = 'Show page ...';
oisCreateDefaultEvent = 'Create default event'; oisCreateDefaultEvent = 'Create default event';
//checklistbox editor //checklistbox editor
@ -219,6 +225,9 @@ resourcestring
oisLoadImageDialog = 'Load Image Dialog'; oisLoadImageDialog = 'Load Image Dialog';
oisOK = '&OK'; oisOK = '&OK';
oisCancel = '&Cancel'; oisCancel = '&Cancel';
oisLoadPicture = 'Load picture';
oisSavePicture = 'Save picture';
oisClearPicture = 'Clear picture';
oisLoad = '&Load'; oisLoad = '&Load';
oisSave = '&Save'; oisSave = '&Save';
oisCLear = 'C&lear'; oisCLear = 'C&lear';

View File

@ -1048,6 +1048,9 @@ type
Sibling: TControl); Sibling: TControl);
procedure AnchorHorizontalCenterTo(Sibling: TControl); procedure AnchorHorizontalCenterTo(Sibling: TControl);
procedure AnchorVerticalCenterTo(Sibling: TControl); procedure AnchorVerticalCenterTo(Sibling: TControl);
procedure AnchorToCompanion(Side: TAnchorKind; Space: integer;
Sibling: TControl;
FreeCompositeSide: boolean = true);
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual; procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
procedure SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer); virtual; procedure SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
procedure SetBoundsKeepBase(aLeft, aTop, aWidth, aHeight: integer; procedure SetBoundsKeepBase(aLeft, aTop, aWidth, aHeight: integer;
@ -2953,6 +2956,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.310 2005/07/13 17:25:06 mattias
added some resourcestrings and autosizing for checklistbox editor
Revision 1.309 2005/07/13 07:33:14 mattias Revision 1.309 2005/07/13 07:33:14 mattias
implemented renaming of new package files implemented renaming of new package files

View File

@ -3401,6 +3401,40 @@ begin
Anchors:=Anchors+[akTop]-[akBottom]; Anchors:=Anchors+[akTop]-[akBottom];
end; end;
procedure TControl.AnchorToCompanion(Side: TAnchorKind; Space: integer;
Sibling: TControl; FreeCompositeSide: boolean);
procedure AnchorCompanionSides(
ResizeSide,// the side of this control, where Sibling is touched and moved
OppositeResizeSide, // opposite of ResizeSide
FixedSide1,// the first non moving side
FixedSide2:// the second non moving side
TAnchorKind);
begin
if not (OppositeAnchor[Side] in Anchors) then
AnchorSide[OppositeResizeSide].Control:=nil;
AnchorToNeighbour(ResizeSide,0,Sibling);
AnchorParallel(FixedSide1,0,Sibling);
AnchorParallel(FixedSide2,0,Sibling);
end;
var
NewAnchors: TAnchors;
begin
// anchor all. Except for the opposite side.
NewAnchors:=[akLeft,akTop,akRight,akBottom];
if FreeCompositeSide or (not (OppositeAnchor[Side] in Anchors)) then
Exclude(NewAnchors,OppositeAnchor[Side]);
Anchors:=NewAnchors;
case Side of
akLeft: AnchorCompanionSides(akLeft,akRight,akTop,akBottom);
akRight: AnchorCompanionSides(akRight,akLeft,akTop,akBottom);
akTop: AnchorCompanionSides(akTop,akBottom,akLeft,akRight);
akBottom: AnchorCompanionSides(akBottom,akTop,akLeft,akRight);
end;
end;
procedure TControl.SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer); procedure TControl.SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer);
begin begin
//DebugLn('TControl.SetInitialBounds A ',Name,':',ClassName,' ',aLeft,',',aTop,',',aWidth,',',aHeight); //DebugLn('TControl.SetInitialBounds A ',Name,':',ClassName,' ',aLeft,',',aTop,',',aWidth,',',aHeight);
@ -3553,6 +3587,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.266 2005/07/13 17:25:06 mattias
added some resourcestrings and autosizing for checklistbox editor
Revision 1.265 2005/07/09 16:20:50 mattias Revision 1.265 2005/07/09 16:20:50 mattias
TSplitter can now also work with Align=alNone and AnchorSide TSplitter can now also work with Align=alNone and AnchorSide

View File

@ -129,10 +129,10 @@ var
BevelSize: Integer; BevelSize: Integer;
begin begin
inherited AdjustClientRect(Rect); inherited AdjustClientRect(Rect);
InflateRect(Rect, -BorderWidth, -BorderWidth); BevelSize := BorderWidth;
BevelSize := 0;
if BevelOuter <> bvNone then Inc(BevelSize, BevelWidth); if BevelOuter <> bvNone then Inc(BevelSize, BevelWidth);
if BevelInner <> bvNone then Inc(BevelSize, BevelWidth); if BevelInner <> bvNone then Inc(BevelSize, BevelWidth);
//debugln('TCustomPanel.AdjustClientRect ',DbgSName(Self),' BorderWidth=',dbgs(BorderWidth),' BevelWidth=',dbgs(BevelWidth),' BevelSize=',dbgs(BevelSize));
InflateRect(Rect, -BevelSize, -BevelSize); InflateRect(Rect, -BevelSize, -BevelSize);
end; end;

View File

@ -708,6 +708,9 @@ var
NewLeft: LongInt; NewLeft: LongInt;
NewTop: LongInt; NewTop: LongInt;
CurAnchors: TAnchors; CurAnchors: TAnchors;
CurClientRect: TRect;
dx: Integer;
dy: Integer;
begin begin
//debugln('TWinControl.DoAutoSize ',DbgSName(Self)); //debugln('TWinControl.DoAutoSize ',DbgSName(Self));
If not AutoSizeCanStart then exit; If not AutoSizeCanStart then exit;
@ -718,6 +721,28 @@ begin
AutoSizing := True; AutoSizing := True;
try try
// move childs tight to left and top (so no space left and above childs)
If ControlCount > 0 then begin
// get current bounds of all childs
GetChildBounds(ChildBounds,true);
CurClientRect:=ClientRect;
AdjustClientRect(CurClientRect);
if (ChildBounds.Left<>CurClientRect.Left)
or (ChildBounds.Top<>CurClientRect.Top) then begin
// move all childs to left and top of client area
dx:=CurClientRect.Left-ChildBounds.Left;
dy:=CurClientRect.Top-ChildBounds.Top;
For I := 0 to ControlCount - 1 do begin
AControl:=Controls[I];
If AControl.Visible then begin
AControl.SetBoundsKeepBase(AControl.Left + dx, AControl.Top + dy,
AControl.Width,AControl.Height,true);
end;
end;
end;
end;
// test if resizing is possible // test if resizing is possible
CurAnchors:=Anchors; CurAnchors:=Anchors;
if Align<>alNone then CurAnchors:=CurAnchors+AnchorAlign[Align]; if Align<>alNone then CurAnchors:=CurAnchors+AnchorAlign[Align];
@ -732,23 +757,6 @@ begin
if HeightIsFixed or (PreferredHeight<=0) then if HeightIsFixed or (PreferredHeight<=0) then
PreferredHeight:=Constraints.MinMaxHeight(Height); PreferredHeight:=Constraints.MinMaxHeight(Height);
// move childs tight to left and top (so no space left and above childs)
If ControlCount > 0 then begin
// get current bounds of all childs
GetChildBounds(ChildBounds,true);
if (ChildBounds.Left<>0) or (ChildBounds.Top<>0) then begin
// move all childs to left and top
For I := 0 to ControlCount - 1 do begin
AControl:=Controls[I];
If AControl.Visible then begin
AControl.SetBoundsKeepBase(AControl.Left - ChildBounds.Left,
AControl.Top - ChildBounds.Top,
AControl.Width,AControl.Height,true);
end;
end;
end;
end;
// set new size // set new size
{$IFDEF VerboseAutoSize} {$IFDEF VerboseAutoSize}
debugln('DoAutoSize A ',DbgSName(Self),' Cur=',dbgs(Width),'x',dbgs(Height),' Prefer=',dbgs(PreferredWidth),'x',dbgs(PreferredHeight),' WidgetClass=',WidgetSetClass.ClassName); debugln('DoAutoSize A ',DbgSName(Self),' Cur=',dbgs(Width),'x',dbgs(Height),' Prefer=',dbgs(PreferredWidth),'x',dbgs(PreferredHeight),' WidgetClass=',WidgetSetClass.ClassName);
@ -4338,26 +4346,44 @@ var
NewClientWidth: Integer; NewClientWidth: Integer;
NewClientHeight: Integer; NewClientHeight: Integer;
OldClientRect: TRect; OldClientRect: TRect;
OldAdjustedClientRect: TRect;
NewWidth: Integer;
NewHeight: Integer;
begin begin
inherited CalculatePreferredSize(PreferredWidth, PreferredHeight); inherited CalculatePreferredSize(PreferredWidth, PreferredHeight);
if HandleAllocated then if HandleAllocated then
TWSWinControlClass(WidgetSetClass).GetPreferredSize(Self, TWSWinControlClass(WidgetSetClass).GetPreferredSize(Self,
PreferredWidth, PreferredHeight); PreferredWidth, PreferredHeight);
if ControlCount>0 then begin if ControlCount>0 then begin
// get the size requirements for the child controls
GetChildBounds(ChildBounds,true); GetChildBounds(ChildBounds,true);
NewClientWidth := ChildBounds.Right - ChildBounds.Left; NewClientWidth := ChildBounds.Right - ChildBounds.Left;
NewClientHeight := ChildBounds.Bottom - ChildBounds.Top; NewClientHeight := ChildBounds.Bottom - ChildBounds.Top;
// add the adjusted client area border
OldClientRect := GetClientRect; OldClientRect := GetClientRect;
OldAdjustedClientRect := OldClientRect;
AdjustClientRect(OldAdjustedClientRect);
inc(NewClientWidth,OldAdjustedClientRect.Left
+OldClientRect.Right-OldAdjustedClientRect.Right);
inc(NewClientHeight,OldAdjustedClientRect.Top
+OldClientRect.Bottom-OldAdjustedClientRect.Bottom);
// add the control border around the client area
NewWidth:=Width-OldClientRect.Right+NewClientWidth;
NewHeight:=Height-OldClientRect.Bottom+NewClientHeight;
{$IFDEF VerboseAutoSize} {$IFDEF VerboseAutoSize}
debugln('TWinControl.CalculatePreferredSize ',DbgSName(Self), debugln('TWinControl.CalculatePreferredSize ',DbgSName(Self),
' HandleAllocated=',dbgs(HandleAllocated)+' ChildBounds='+dbgs(ChildBounds), ' HandleAllocated=',dbgs(HandleAllocated)+' ChildBounds='+dbgs(ChildBounds),
' Cur='+dbgs(Width)+'x'+dbgs(Height)+ ' Cur='+dbgs(Width)+'x'+dbgs(Height)+
' Client='+dbgs(OldClientRect.Right)+'x'+dbgs(OldClientRect.Bottom)); ' Client='+dbgs(OldClientRect.Right)+'x'+dbgs(OldClientRect.Bottom),
' Adjusted='+dbgs(OldAdjustedClientRect),
' NewWidth='+dbgs(NewWidth)+' NewHeight=',+dbgs(NewHeight));
{$ENDIF} {$ENDIF}
PreferredWidth:= PreferredWidth:=Max(PreferredWidth,NewWidth);
Max(PreferredWidth,Width-OldClientRect.Right+NewClientWidth); PreferredHeight:=Max(PreferredHeight,NewHeight);
PreferredHeight:=
Max(PreferredHeight,Height-OldClientRect.Bottom+NewClientHeight);
end; end;
{$IFDEF VerboseAutoSize} {$IFDEF VerboseAutoSize}
debugln('TWinControl.CalculatePreferredSize ',DbgSName(Self), debugln('TWinControl.CalculatePreferredSize ',DbgSName(Self),
@ -4579,6 +4605,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.338 2005/07/13 17:25:06 mattias
added some resourcestrings and autosizing for checklistbox editor
Revision 1.337 2005/07/13 07:41:05 mattias Revision 1.337 2005/07/13 07:41:05 mattias
improved autosizing of project inspector improved autosizing of project inspector