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 FilenameIsAbsolute(Filename) then
Filename:=FindProgram(Filename,GetCurrentDir,false);
WorkingDir:=TrimFilename(WorkingDir);
Filename:=TrimFilename(Filename);
CmdLine:=Filename;
if Params<>'' then
CmdLine:=CmdLine+' '+Params;
DebugLn('[TExternalToolList.Run] ',CmdLine);
DebugLn('[TExternalToolList.Run] CmdLine="',CmdLine,'" WorkDir="',WorkingDir,'"');
try
CheckIfFileIsExecutable(Filename);
TheProcess := TProcess.Create(nil);

View File

@ -26,8 +26,6 @@ unit OutputFilter;
interface
{$DEFINE ShowTriedFiles}
uses
Classes, SysUtils, Forms, Controls, CompilerOptions, Project, Process,
IDEProcs, FileUtil, LclProc, LazConf;
@ -238,6 +236,7 @@ var
begin
Result:=true;
Clear;
//debugln('TOutputFilter.Execute A CurrentDirectory="',TheProcess.CurrentDirectory,'"');
TheProcess.Execute;
fCurrentDirectory:=TrimFilename(TheProcess.CurrentDirectory);
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)
// it parses the output
begin
//writeln('TOutputFilter: "',s,'"');
//debugln('TOutputFilter: "',s,'"');
fLastMessageType:=omtNone;
fLastErrorType:=etNone;
fOutput.Add(s);

View File

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

View File

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

View File

@ -92,6 +92,12 @@ resourcestring
// component editors
cesStringGridEditor = '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';
//checklistbox editor
@ -219,6 +225,9 @@ resourcestring
oisLoadImageDialog = 'Load Image Dialog';
oisOK = '&OK';
oisCancel = '&Cancel';
oisLoadPicture = 'Load picture';
oisSavePicture = 'Save picture';
oisClearPicture = 'Clear picture';
oisLoad = '&Load';
oisSave = '&Save';
oisCLear = 'C&lear';

View File

@ -1048,6 +1048,9 @@ type
Sibling: TControl);
procedure AnchorHorizontalCenterTo(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 SetInitialBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
procedure SetBoundsKeepBase(aLeft, aTop, aWidth, aHeight: integer;
@ -2953,6 +2956,9 @@ end.
{ =============================================================================
$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
implemented renaming of new package files

View File

@ -3401,6 +3401,40 @@ begin
Anchors:=Anchors+[akTop]-[akBottom];
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);
begin
//DebugLn('TControl.SetInitialBounds A ',Name,':',ClassName,' ',aLeft,',',aTop,',',aWidth,',',aHeight);
@ -3553,6 +3587,9 @@ end;
{ =============================================================================
$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
TSplitter can now also work with Align=alNone and AnchorSide

View File

@ -129,10 +129,10 @@ var
BevelSize: Integer;
begin
inherited AdjustClientRect(Rect);
InflateRect(Rect, -BorderWidth, -BorderWidth);
BevelSize := 0;
BevelSize := BorderWidth;
if BevelOuter <> 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);
end;

View File

@ -708,6 +708,9 @@ var
NewLeft: LongInt;
NewTop: LongInt;
CurAnchors: TAnchors;
CurClientRect: TRect;
dx: Integer;
dy: Integer;
begin
//debugln('TWinControl.DoAutoSize ',DbgSName(Self));
If not AutoSizeCanStart then exit;
@ -718,6 +721,28 @@ begin
AutoSizing := True;
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
CurAnchors:=Anchors;
if Align<>alNone then CurAnchors:=CurAnchors+AnchorAlign[Align];
@ -732,23 +757,6 @@ begin
if HeightIsFixed or (PreferredHeight<=0) then
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
{$IFDEF VerboseAutoSize}
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;
NewClientHeight: Integer;
OldClientRect: TRect;
OldAdjustedClientRect: TRect;
NewWidth: Integer;
NewHeight: Integer;
begin
inherited CalculatePreferredSize(PreferredWidth, PreferredHeight);
if HandleAllocated then
TWSWinControlClass(WidgetSetClass).GetPreferredSize(Self,
PreferredWidth, PreferredHeight);
if ControlCount>0 then begin
// get the size requirements for the child controls
GetChildBounds(ChildBounds,true);
NewClientWidth := ChildBounds.Right - ChildBounds.Left;
NewClientHeight := ChildBounds.Bottom - ChildBounds.Top;
// add the adjusted client area border
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}
debugln('TWinControl.CalculatePreferredSize ',DbgSName(Self),
' HandleAllocated=',dbgs(HandleAllocated)+' ChildBounds='+dbgs(ChildBounds),
' 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}
PreferredWidth:=
Max(PreferredWidth,Width-OldClientRect.Right+NewClientWidth);
PreferredHeight:=
Max(PreferredHeight,Height-OldClientRect.Bottom+NewClientHeight);
PreferredWidth:=Max(PreferredWidth,NewWidth);
PreferredHeight:=Max(PreferredHeight,NewHeight);
end;
{$IFDEF VerboseAutoSize}
debugln('TWinControl.CalculatePreferredSize ',DbgSName(Self),
@ -4579,6 +4605,9 @@ end;
{ =============================================================================
$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
improved autosizing of project inspector