made New Dialog buttons context sensitive

git-svn-id: trunk@6902 -
This commit is contained in:
mattias 2005-03-05 19:45:22 +00:00
parent 2db9ede5e0
commit ab6d1b24b4
5 changed files with 34 additions and 12 deletions

View File

@ -2946,7 +2946,7 @@ var
for i:=Low(FPCOperatingSystemNames) to High(FPCOperatingSystemNames) for i:=Low(FPCOperatingSystemNames) to High(FPCOperatingSystemNames)
do do
if FPCOperatingSystemNames[i]=DirName then begin if FPCOperatingSystemNames[i]=DirName then begin
if AnsiCompareText(DirName,DefaultTargetOS)=0 then if CompareText(DirName,DefaultTargetOS)=0 then
inc(DefaultMacroCount); inc(DefaultMacroCount);
Result:=copy(Result,1,DirStart-1)+TargetOS+ Result:=copy(Result,1,DirStart-1)+TargetOS+
copy(Result,DirEnd,length(Result)-DirEnd+1); copy(Result,DirEnd,length(Result)-DirEnd+1);
@ -2959,7 +2959,7 @@ var
to High(FPCOperatingSystemAlternativeNames) to High(FPCOperatingSystemAlternativeNames)
do do
if FPCOperatingSystemAlternativeNames[i]=DirName then begin if FPCOperatingSystemAlternativeNames[i]=DirName then begin
if AnsiCompareText(DirName,DefaultSrcOS)=0 then if CompareText(DirName,DefaultSrcOS)=0 then
inc(DefaultMacroCount); inc(DefaultMacroCount);
Result:=copy(Result,1,DirStart-1)+SrcOS+ Result:=copy(Result,1,DirStart-1)+SrcOS+
copy(Result,DirEnd,length(Result)-DirEnd+1); copy(Result,DirEnd,length(Result)-DirEnd+1);
@ -2970,7 +2970,7 @@ var
// replace processor type // replace processor type
for i:=Low(FPCProcessorNames) to High(FPCProcessorNames) do for i:=Low(FPCProcessorNames) to High(FPCProcessorNames) do
if FPCProcessorNames[i]=DirName then begin if FPCProcessorNames[i]=DirName then begin
if AnsiCompareText(DirName,DefaultProcessorName)=0 then if CompareText(DirName,DefaultProcessorName)=0 then
inc(DefaultMacroCount); inc(DefaultMacroCount);
Result:=copy(Result,1,DirStart-1)+TargetProcessor+ Result:=copy(Result,1,DirStart-1)+TargetProcessor+
copy(Result,DirEnd,length(Result)-DirEnd+1); copy(Result,DirEnd,length(Result)-DirEnd+1);

View File

@ -133,6 +133,7 @@ type
CancelButton: TButton; CancelButton: TButton;
procedure ItemsTreeViewClick(Sender: TObject); procedure ItemsTreeViewClick(Sender: TObject);
procedure ItemsTreeViewDblClick(Sender: TObject); procedure ItemsTreeViewDblClick(Sender: TObject);
procedure ItemsTreeViewSelectionChanged(Sender: TObject);
procedure NewOtherDialogResize(Sender: TObject); procedure NewOtherDialogResize(Sender: TObject);
procedure OkButtonClick(Sender: TObject); procedure OkButtonClick(Sender: TObject);
private private
@ -253,6 +254,12 @@ begin
OkButtonClick(Self); OkButtonClick(Self);
end; end;
procedure TNewOtherDialog.ItemsTreeViewSelectionChanged(Sender: TObject);
begin
OkButton.Enabled:=(ItemsTreeView.Selected<>nil)
and (TObject(ItemsTreeView.Selected.Data) is TNewIDEItemTemplate);
end;
procedure TNewOtherDialog.SetupComponents; procedure TNewOtherDialog.SetupComponents;
begin begin
ItemsTreeView:=TTreeView.Create(Self); ItemsTreeView:=TTreeView.Create(Self);
@ -263,6 +270,7 @@ begin
Top:=5; Top:=5;
OnClick:=@ItemsTreeViewClick; OnClick:=@ItemsTreeViewClick;
OnDblClick:=@ItemsTreeViewDblClick; OnDblClick:=@ItemsTreeViewDblClick;
OnSelectionChanged:=@ItemsTreeViewSelectionChanged;
end; end;
DescriptionGroupBox:=TGroupBox.Create(Self); DescriptionGroupBox:=TGroupBox.Create(Self);
@ -291,6 +299,7 @@ begin
Top:=100; Top:=100;
Caption:=lisLazBuildOk; Caption:=lisLazBuildOk;
OnClick:=@OkButtonClick; OnClick:=@OkButtonClick;
Enabled:=false;
end; end;
CancelButton:=TButton.Create(Self); CancelButton:=TButton.Create(Self);
@ -302,6 +311,8 @@ begin
Caption:=dlgCancel; Caption:=dlgCancel;
ModalResult := mrCancel; ModalResult := mrCancel;
end; end;
DefaultControl:=OkButton;
CancelControl:=CancelButton; CancelControl:=CancelButton;
end; end;

View File

@ -38,7 +38,7 @@ type
{ TNewProjectDialog } { TNewProjectDialog }
TNewProjectDialog = class(TForm) TNewProjectDialog = class(TForm)
CreateButton: TButton; CreateButton: TButton;
CancelButton: TButton; CancelButton: TButton;
ListBox: TListBox; ListBox: TListBox;

View File

@ -1825,9 +1825,12 @@ type
property Width: Integer read GetWidth; property Width: Integer read GetWidth;
property ZoneLimit: Integer read GetZoneLimit write SetZoneLimit; property ZoneLimit: Integer read GetZoneLimit write SetZoneLimit;
end; end;
TDockZoneClass = class of TDockZone;
{ TDockTree - a tree of TDockZones - Every docked window has one tree { TDockTree - a tree of TDockZones - Every docked window has one tree
This is an abstract class. The real implementation is in ldocktree.pas
Docking means here: Combining several windows to one. A window can here be Docking means here: Combining several windows to one. A window can here be
a TCustomForm or a floating control (undocked) or a TDockForm. a TCustomForm or a floating control (undocked) or a TDockForm.
@ -1854,9 +1857,9 @@ type
|+---+|+----+| |+---+|+----+|
+------------+ +------------+
If "A" or "B" were floating controls, the floating dock sites are kept ???. If "A" or "B" were floating controls, the floating dock sites are freed.
If "A" or "B" were forms, they loose there decorations (title bars and If "A" or "B" were forms, their decorations (title bars and borders) are
borders) ???. replaced by docked decorations.
If "A" had a TDockTree, it is freed and its child dockzones are merged to If "A" had a TDockTree, it is freed and its child dockzones are merged to
the docktree of "B". the docktree of "B".
@ -1882,9 +1885,9 @@ type
+-------+ +-------+
Every DockZone has siblings and childs. Siblings can either be Every DockZone has siblings and childs. Siblings can either be
horizontally (left to right, splitter), - horizontally (left to right, splitter),
vertically (top to bottom, splitter) - vertically (top to bottom, splitter)
or upon each other (as pages, left to right). - or upon each other (as pages, left to right).
} }
TForEachZoneProc = procedure(Zone: TDockZone) of object; TForEachZoneProc = procedure(Zone: TDockZone) of object;
@ -1896,10 +1899,13 @@ type
); );
TDockTreeFlags = set of TDockTreeFlag; TDockTreeFlags = set of TDockTreeFlag;
{ TDockTree }
TDockTree = class(TDockManager) TDockTree = class(TDockManager)
private private
FBorderWidth: Integer; FBorderWidth: Integer;
FDockSite: TWinControl; FDockSite: TWinControl;
FDockZoneClass: TDockZoneClass;
FGrabberSize: Integer; FGrabberSize: Integer;
FGrabbersOnTop: Boolean; FGrabbersOnTop: Boolean;
FFlags: TDockTreeFlags; FFlags: TDockTreeFlags;
@ -1930,6 +1936,7 @@ type
constructor Create(TheDockSite: TWinControl); virtual; constructor Create(TheDockSite: TWinControl); virtual;
destructor Destroy; override; destructor Destroy; override;
procedure PaintSite(DC: HDC); override; procedure PaintSite(DC: HDC); override;
property DockZoneClass: TDockZoneClass read FDockZoneClass;
end; end;
@ -2982,6 +2989,9 @@ end.
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.287 2005/03/05 19:45:22 mattias
made New Dialog buttons context sensitive
Revision 1.286 2005/03/04 17:55:34 micha Revision 1.286 2005/03/04 17:55:34 micha
fix bug 605: resizing upward or leftward should not move control fix bug 605: resizing upward or leftward should not move control

View File

@ -120,12 +120,13 @@ constructor TDockTree.Create(TheDockSite: TWinControl);
var var
i: Integer; i: Integer;
begin begin
FDockZoneClass:=TDockZone;
inherited Create; inherited Create;
FBorderWidth:=4; FBorderWidth:=4;
FDockSite:=TheDockSite; FDockSite:=TheDockSite;
FGrabberSize:=DefaultDockGrabberSize; FGrabberSize:=DefaultDockGrabberSize;
FGrabbersOnTop:=(FDockSite.Align <> alTop) and (FDockSite.Align <> alBottom); FGrabbersOnTop:=(FDockSite.Align <> alTop) and (FDockSite.Align <> alBottom);
FTopZone:=TDockZone.Create(Self); FTopZone:=FDockZoneClass.Create(Self);
// insert existing controls into tree // insert existing controls into tree
BeginUpdate; BeginUpdate;
try try
@ -145,7 +146,7 @@ end;
procedure TDockTree.PaintSite(DC: HDC); procedure TDockTree.PaintSite(DC: HDC);
begin begin
// TODO
end; end;
// included by controls.pp // included by controls.pp