spkToolbar: Fix switching of image list in EditWindow.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5975 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2017-07-07 19:04:26 +00:00
parent 26520b92c9
commit 540a80e73d
2 changed files with 27 additions and 29 deletions

View File

@ -9,7 +9,6 @@ object frmEditWindow: TfrmEditWindow
Color = clBtnFace Color = clBtnFace
Font.Color = clWindowText Font.Color = clWindowText
OnActivate = FormActivate OnActivate = FormActivate
OnCreate = FormCreate
OnDestroy = FormDestroy OnDestroy = FormDestroy
OnShow = FormShow OnShow = FormShow
LCLVersion = '1.9.0.0' LCLVersion = '1.9.0.0'

View File

@ -69,7 +69,6 @@ type
N3: TMenuItem; N3: TMenuItem;
Moveup1: TMenuItem; Moveup1: TMenuItem;
Movedown1: TMenuItem; Movedown1: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure tvStructureChange(Sender: TObject; Node: TTreeNode); procedure tvStructureChange(Sender: TObject; Node: TTreeNode);
procedure aAddTabExecute(Sender: TObject); procedure aAddTabExecute(Sender: TObject);
procedure aRemoveTabExecute(Sender: TObject); procedure aRemoveTabExecute(Sender: TObject);
@ -109,6 +108,8 @@ type
function CheckValidTabNode(Node: TTreeNode): boolean; function CheckValidTabNode(Node: TTreeNode): boolean;
function CheckValidPaneNode(Node: TTreeNode): boolean; function CheckValidPaneNode(Node: TTreeNode): boolean;
function CheckValidItemNode(Node: TTreeNode): boolean; function CheckValidItemNode(Node: TTreeNode): boolean;
procedure UpdatePPI;
public public
{ Public declarations } { Public declarations }
function ValidateTreeData: boolean; function ValidateTreeData: boolean;
@ -656,30 +657,11 @@ procedure TfrmEditWindow.FormActivate(Sender: TObject);
begin begin
if (FToolbar = nil) or (FDesigner = nil) then if (FToolbar = nil) or (FDesigner = nil) then
exit; exit;
UpdatePPI;
if not ValidateTreeData then if not ValidateTreeData then
BuildTreeData; BuildTreeData;
end; end;
procedure TfrmEditWindow.FormCreate(Sender: TObject);
begin
if Monitor.PixelsPerInch >= 180 then begin
ActionList.Images := ilActionImages_200;
tbToolbar.Images := ilActionImages_200;
tvStructure.Images := ilTreeImages_150;
end else
if Monitor.PixelsPerInch >= 135 then begin
ActionList.Images := ilActionImages_150;
tbToolbar.Images := ilActionImages_150;
tvStructure.Images := ilTreeImages_150;
end else begin
ActionList.Images := ilActionImages;
tbToolbar.Images := ilActionImages;
tvStructure.Images := ilTreeImages;
end;
tbToolbar.ButtonHeight := tbToolbar.Images.Height + 8;
tbToolbar.ButtonWidth := tbToolbar.Images.Width + 8;
end;
procedure TfrmEditWindow.FormDestroy(Sender: TObject); procedure TfrmEditWindow.FormDestroy(Sender: TObject);
begin begin
if FToolbar <> nil then if FToolbar <> nil then
@ -1080,7 +1062,7 @@ begin
else if TObject(tvStructure.Selected.Data) is TSpkBaseItem then else if TObject(tvStructure.Selected.Data) is TSpkBaseItem then
DoRemoveItem DoRemoveItem
else else
raise Exception.Create('TfrmEditWindow.tvStructureKeyDown: Uszkodzona struktura drzewa!'); raise Exception.Create('TfrmEditWindow.tvStructureKeyDown: Damaged tree structure!');
end; end;
end; end;
end; end;
@ -1137,8 +1119,7 @@ begin
end; end;
end; end;
// Wa�ne! Trzeba sprawdzi�, czy w drzewie nie ma dodatkowych // Important! You need to make sure that there are no extra items in the tree!
// element�w!
ItemsValid := ItemsValid and (ItemNode = nil); ItemsValid := ItemsValid and (ItemNode = nil);
PanesValid := PanesValid and ItemsValid; PanesValid := PanesValid and ItemsValid;
end; end;
@ -1150,8 +1131,7 @@ begin
end; end;
end; end;
// Wa�ne! Trzeba sprawdzi�, czy w drzewie nie ma dodatkowych // Important! You need to make sure that there are no extra items in the tree!
// element�w!
PanesValid := PanesValid and (PaneNode = nil); PanesValid := PanesValid and (PaneNode = nil);
TabsValid := TabsValid and PanesValid; TabsValid := TabsValid and PanesValid;
end; end;
@ -1163,10 +1143,29 @@ begin
end; end;
end; end;
// Wa�ne! Trzeba sprawdzi�, czy w drzewie nie ma dodatkowych // Important! You need to make sure that there are no extra items in the tree!
// element�w!
TabsValid := TabsValid and (TabNode = nil); TabsValid := TabsValid and (TabNode = nil);
Result := TabsValid; Result := TabsValid;
end; end;
procedure TfrmEditWindow.UpdatePPI;
begin
if Monitor.PixelsPerInch >= 180 then begin
ActionList.Images := ilActionImages_200;
tbToolbar.Images := ilActionImages_200;
tvStructure.Images := ilTreeImages_200;
end else
if Monitor.PixelsPerInch >= 135 then begin
ActionList.Images := ilActionImages_150;
tbToolbar.Images := ilActionImages_150;
tvStructure.Images := ilTreeImages_150;
end else begin
ActionList.Images := ilActionImages;
tbToolbar.Images := ilActionImages;
tvStructure.Images := ilTreeImages;
end;
tbToolbar.ButtonHeight := tbToolbar.Images.Height + 8;
tbToolbar.ButtonWidth := tbToolbar.Images.Width + 8;
end;
end. end.