IDE: component palette: helper button: item to open options, item to open view all components window

git-svn-id: trunk@58029 -
This commit is contained in:
mattias 2018-05-25 11:08:15 +00:00
parent a4ef8dcb02
commit 399f542fee
6 changed files with 100 additions and 135 deletions

View File

@ -46,6 +46,7 @@ uses
// IdeIntf // IdeIntf
FormEditingIntf, LazIDEIntf, IDEImagesIntf, PropEdits, ComponentReg, FormEditingIntf, LazIDEIntf, IDEImagesIntf, PropEdits, ComponentReg,
// IDE // IDE
ComponentPalette_Options,
MainBase, LazarusIDEStrConsts, DesignerProcs, PackageDefs, EnvironmentOpts, MainBase, LazarusIDEStrConsts, DesignerProcs, PackageDefs, EnvironmentOpts,
ImgList; ImgList;
@ -149,7 +150,7 @@ type
function CompareControlsWithTag(Control1, Control2: Pointer): integer; function CompareControlsWithTag(Control1, Control2: Pointer): integer;
implementation implementation
uses componentpalette_options;
{$R ../images/components_images.res} {$R ../images/components_images.res}
{$DEFINE USE_PageIndex} {$DEFINE USE_PageIndex}

View File

@ -34,9 +34,10 @@ unit CompPagesPopup;
interface interface
uses uses
Classes, SysUtils, FileUtil, IDEImagesIntf, Forms, Controls, Graphics, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, LMessages,
Dialogs, ComCtrls, ExtCtrls, Buttons, MainBar, LazarusIDEStrConsts, LCLIntf, Dialogs, ComCtrls, ExtCtrls, Buttons, LCLIntf,
LMessages; IDEImagesIntf,
LazarusIDEStrConsts, MainBar, ComponentPalette_Options, MainBase;
type type
@ -53,6 +54,7 @@ type
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
procedure TreeView1Click(Sender: TObject); procedure TreeView1Click(Sender: TObject);
private private
fViewAllNode, fOptionsNode: TTreeNode;
fGroups: TStringList; // Objects have group TreeNodes fGroups: TStringList; // Objects have group TreeNodes
fLastCloseUp: QWord; fLastCloseUp: QWord;
fLastCanShowCheck: Boolean; fLastCanShowCheck: Boolean;
@ -147,12 +149,18 @@ end;
procedure TDlgCompPagesPopup.TreeView1Click(Sender: TObject); procedure TDlgCompPagesPopup.TreeView1Click(Sender: TObject);
var var
i: integer; i: integer;
SelNode: TTreeNode;
begin begin
if (TreeView1.Selected=nil) or (TreeView1.Selected.ImageIndex=1) then exit; SelNode:=TreeView1.Selected;
with MainIDEBar do if (SelNode=nil) or (SelNode.ImageIndex=1) then exit;
if SelNode=fViewAllNode then
MainIDE.DoShowComponentList
else if SelNode=fOptionsNode then
MainIDE.DoOpenIDEOptions(TCompPaletteOptionsFrame, '', [], [])
else with MainIDEBar do
if Assigned(ComponentPageControl) and (ComponentPageControl.PageCount>0) then if Assigned(ComponentPageControl) and (ComponentPageControl.PageCount>0) then
for i:=0 to ComponentPageControl.PageCount-1 do for i:=0 to ComponentPageControl.PageCount-1 do
if SameText(TreeView1.Selected.Text, ComponentPageControl.Page[i].Caption) then if SameText(SelNode.Text, ComponentPageControl.Page[i].Caption) then
begin begin
ComponentPageControl.PageIndex:=i; ComponentPageControl.PageIndex:=i;
ComponentPageControl.OnChange(Self); ComponentPageControl.OnChange(Self);
@ -175,7 +183,7 @@ end;
procedure TDlgCompPagesPopup.FindGroups; procedure TDlgCompPagesPopup.FindGroups;
// Find groups. Page names with many words are grouped by the first word. // Find groups. Page names with many words are grouped by the first word.
var var
i, grInd: integer; i, grpIndex: integer;
Word1: string; Word1: string;
begin begin
for i:=0 to MainIDEBar.ComponentPageControl.PageCount-1 do for i:=0 to MainIDEBar.ComponentPageControl.PageCount-1 do
@ -183,11 +191,11 @@ begin
Word1 := FirstWord(MainIDEBar.ComponentPageControl.Page[i].Caption); Word1 := FirstWord(MainIDEBar.ComponentPageControl.Page[i].Caption);
if (Word1 <> '') and (Word1 <> 'Data') then // "Data" is an exception if (Word1 <> '') and (Word1 <> 'Data') then // "Data" is an exception
begin begin
grInd := fGroups.IndexOf(Word1); grpIndex := fGroups.IndexOf(Word1);
if grInd > -1 then // Found, mark as group. TreeNode will be created later. if grpIndex > -1 then // Found, mark as group. TreeNode will be created later.
fGroups.Objects[grInd] := TObject(0) fGroups.Objects[grpIndex] := nil
else // Will be a group only if other members are found. else // Will be a group only if other members are found.
fGroups.AddObject(Word1, TObject(1)); // "1" means a single item now. fGroups.AddObject(Word1, Self); // <>nil means a single item now.
end; end;
end; end;
// Delete single items (marked with "1") from groups list. // Delete single items (marked with "1") from groups list.
@ -232,11 +240,13 @@ procedure TDlgCompPagesPopup.BuildList;
var var
i: integer; i: integer;
begin begin
TreeView1.Items.Clear;
TreeView1.BeginUpdate; TreeView1.BeginUpdate;
TreeView1.Items.Clear;
fViewAllNode:=nil;
fOptionsNode:=nil;
if MainIDEBar.ComponentPageControl=nil then if MainIDEBar.ComponentPageControl=nil then
begin begin
TreeView1.Items.AddChild(nil,'Sorry, NO Pages'); TreeView1.Items.AddChild(nil,'Sorry, No Pages');
Exit; Exit;
end; end;
fGroups := TStringList.Create; fGroups := TStringList.Create;
@ -247,6 +257,17 @@ begin
finally finally
fGroups.Free; fGroups.Free;
end; end;
// add 'View all'
fViewAllNode:=TreeView1.Items.AddChild(nil, lisCompPalComponentList);
fViewAllNode.ImageIndex:=IDEImages.GetImageIndex('item_package');
fViewAllNode.SelectedIndex:=fViewAllNode.ImageIndex;
// add 'Options'
fOptionsNode:=TreeView1.Items.AddChild(nil, lisOptions);
fOptionsNode.ImageIndex:=IDEImages.LoadImage('menu_environment_options');
fOptionsNode.SelectedIndex:=fOptionsNode.ImageIndex;
TreeView1.EndUpdate; TreeView1.EndUpdate;
TreeView1.FullExpand; TreeView1.FullExpand;
Panel2.Caption:=Format(lisTotalPages, Panel2.Caption:=Format(lisTotalPages,

View File

@ -1499,12 +1499,12 @@ end;
function TIDEFPCParser.CheckForLinkerErrors(p: PChar): boolean; function TIDEFPCParser.CheckForLinkerErrors(p: PChar): boolean;
const const
pat: String = 'Undefined symbols for architecture'; patUndefinedSymbol: String = 'Undefined symbols for architecture';
patLD: String = '/usr/bin/ld: ';
var var
MsgLine: TMessageLine; MsgLine: TMessageLine;
begin begin
Result:=CompareMem(PChar(pat),p,length(pat)); if CompareMem(PChar(patUndefinedSymbol),p,length(patUndefinedSymbol)) then
if Result then
begin begin
MsgLine:=CreateMsgLine; MsgLine:=CreateMsgLine;
MsgLine.MsgID:=0; MsgLine.MsgID:=0;
@ -1512,7 +1512,19 @@ begin
MsgLine.Urgency:=mluError; MsgLine.Urgency:=mluError;
MsgLine.Msg:='linker: '+p; MsgLine.Msg:='linker: '+p;
inherited AddMsgLine(MsgLine); inherited AddMsgLine(MsgLine);
exit(true);
end; end;
if CompareMem(PChar(patLD),p,length(patLD)) then
begin
MsgLine:=CreateMsgLine;
MsgLine.MsgID:=0;
MsgLine.SubTool:=SubToolFPCLinker;
MsgLine.Urgency:=mluVerbose;
MsgLine.Msg:='linker: '+p;
inherited AddMsgLine(MsgLine);
exit(true);
end;
Result:=false;
end; end;
function TIDEFPCParser.CheckForAssemblerErrors(p: PChar): boolean; function TIDEFPCParser.CheckForAssemblerErrors(p: PChar): boolean;
@ -1651,6 +1663,15 @@ For example:
_COCOAINT_TCOCOAWIDGETSET_$__GETKEYSTATE$LONGINT$$SMALLINT in cocoaint.o _COCOAINT_TCOCOAWIDGETSET_$__GETKEYSTATE$LONGINT$$SMALLINT in cocoaint.o
ld: symbol(s) not found for architecture x86_64 ld: symbol(s) not found for architecture x86_64
An error occurred while linking An error occurred while linking
Linking IDE:
(9015) Linking ../lazarus
/usr/bin/ld: cannot find -lGL
make[2]: *** [lazarus] Error 1
make[1]: *** [idepkg] Error 2
make: *** [idepkg] Error 2
/home/mattias/pascal/wichtig/lazarus/ide/lazarus.pp(161,1) Error: (9013) Error while linking
} }
var var
i: Integer; i: Integer;
@ -1660,6 +1681,7 @@ begin
i:=Tool.WorkerMessages.Count-1; i:=Tool.WorkerMessages.Count-1;
while i>=0 do begin while i>=0 do begin
MsgLine:=Tool.WorkerMessages[i]; MsgLine:=Tool.WorkerMessages[i];
//debugln(['TIDEFPCParser.AddLinkingMessages ',i,' ',dbgs(MsgLine.Urgency),' ',MsgLine.Msg]);
if MsgLine.Urgency<mluHint then if MsgLine.Urgency<mluHint then
MsgLine.Urgency:=mluImportant MsgLine.Urgency:=mluImportant
else else
@ -1671,6 +1693,7 @@ begin
i:=Tool.WorkerMessages.Count-1; i:=Tool.WorkerMessages.Count-1;
if i<0 then exit; if i<0 then exit;
MsgLine:=Tool.WorkerMessages[i]; MsgLine:=Tool.WorkerMessages[i];
//debugln(['TIDEFPCParser.AddLinkingMessages MsgLine.OutputIndex=',MsgLine.OutputIndex,' fOutputIndex=',fOutputIndex]);
for i:=MsgLine.OutputIndex+1 to fOutputIndex-1 do begin for i:=MsgLine.OutputIndex+1 to fOutputIndex-1 do begin
MsgLine:=inherited CreateMsgLine(i); MsgLine:=inherited CreateMsgLine(i);
MsgLine.MsgID:=0; MsgLine.MsgID:=0;

View File

@ -11,20 +11,20 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
DesignTop = 213 DesignTop = 213
object PagesGroupBox: TGroupBox object PagesGroupBox: TGroupBox
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = CompPalModeGroupBox AnchorSideTop.Control = cbPaletteVisible
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Splitter1 AnchorSideRight.Control = Splitter1
AnchorSideBottom.Control = Owner AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 0 Left = 0
Height = 326 Height = 432
Top = 142 Top = 36
Width = 193 Width = 193
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'PagesGroupBox' Caption = 'PagesGroupBox'
ClientHeight = 304 ClientHeight = 417
ClientWidth = 185 ClientWidth = 189
Constraints.MinWidth = 100 Constraints.MinWidth = 100
TabOrder = 1 TabOrder = 1
object PagesListBox: TListBox object PagesListBox: TListBox
@ -33,9 +33,9 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
AnchorSideRight.Control = PageMoveUpBtn AnchorSideRight.Control = PageMoveUpBtn
AnchorSideBottom.Control = AddPageButton AnchorSideBottom.Control = AddPageButton
Left = 3 Left = 3
Height = 221 Height = 331
Top = 3 Top = 3
Width = 148 Width = 152
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 3 BorderSpacing.Left = 3
BorderSpacing.Top = 3 BorderSpacing.Top = 3
@ -47,16 +47,18 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
OnKeyDown = PagesListBoxKeyDown OnKeyDown = PagesListBoxKeyDown
OnSelectionChange = PagesListBoxSelectionChange OnSelectionChange = PagesListBoxSelectionChange
PopupMenu = PagesPopupMenu PopupMenu = PagesPopupMenu
ScrollWidth = 150
TabOrder = 0 TabOrder = 0
TopIndex = -1
end end
object AddPageButton: TBitBtn object AddPageButton: TBitBtn
AnchorSideLeft.Control = PagesListBox AnchorSideLeft.Control = PagesListBox
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = ImportDividerBevel AnchorSideBottom.Control = ImportDividerBevel
Left = 3 Left = 3
Height = 22 Height = 25
Top = 230 Top = 340
Width = 64 Width = 46
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Top = 6 BorderSpacing.Top = 6
@ -70,10 +72,10 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
AnchorSideLeft.Side = asrBottom AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = AddPageButton AnchorSideTop.Control = AddPageButton
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 73 Left = 55
Height = 22 Height = 25
Top = 230 Top = 340
Width = 117 Width = 99
AutoSize = True AutoSize = True
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
@ -85,7 +87,7 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
AnchorSideLeft.Control = PageMoveUpBtn AnchorSideLeft.Control = PageMoveUpBtn
AnchorSideTop.Control = PageMoveUpBtn AnchorSideTop.Control = PageMoveUpBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 157 Left = 161
Height = 26 Height = 26
Top = 135 Top = 135
Width = 22 Width = 22
@ -100,7 +102,7 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = PagesGroupBox AnchorSideRight.Control = PagesGroupBox
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 157 Left = 161
Height = 26 Height = 26
Top = 102 Top = 102
Width = 22 Width = 22
@ -118,9 +120,9 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = ImportButton AnchorSideBottom.Control = ImportButton
Left = 3 Left = 3
Height = 16 Height = 13
Top = 258 Top = 371
Width = 182 Width = 186
Caption = 'Import / Export' Caption = 'Import / Export'
Anchors = [akLeft, akRight, akBottom] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Bottom = 2 BorderSpacing.Bottom = 2
@ -134,10 +136,10 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideBottom.Control = PagesGroupBox AnchorSideBottom.Control = PagesGroupBox
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 88 Left = 70
Height = 22 Height = 25
Top = 276 Top = 386
Width = 79 Width = 61
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Left = 6 BorderSpacing.Left = 6
@ -153,9 +155,9 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
AnchorSideBottom.Control = PagesGroupBox AnchorSideBottom.Control = PagesGroupBox
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 3 Left = 3
Height = 22 Height = 25
Top = 276 Top = 386
Width = 79 Width = 61
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
AutoSize = True AutoSize = True
BorderSpacing.Top = 3 BorderSpacing.Top = 3
@ -180,8 +182,8 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Left = 6 BorderSpacing.Left = 6
Caption = 'ComponentsGroupBox' Caption = 'ComponentsGroupBox'
ClientHeight = 446 ClientHeight = 453
ClientWidth = 379 ClientWidth = 383
TabOrder = 3 TabOrder = 3
object ComponentsListView: TListView object ComponentsListView: TListView
AnchorSideLeft.Control = ComponentsGroupBox AnchorSideLeft.Control = ComponentsGroupBox
@ -190,9 +192,9 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
AnchorSideBottom.Control = ComponentsGroupBox AnchorSideBottom.Control = ComponentsGroupBox
AnchorSideBottom.Side = asrBottom AnchorSideBottom.Side = asrBottom
Left = 6 Left = 6
Height = 434 Height = 441
Top = 6 Top = 6
Width = 339 Width = 343
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Around = 6 BorderSpacing.Around = 6
Columns = < Columns = <
@ -239,7 +241,7 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = ComponentsGroupBox AnchorSideRight.Control = ComponentsGroupBox
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 351 Left = 355
Height = 26 Height = 26
Top = 102 Top = 102
Width = 22 Width = 22
@ -254,7 +256,7 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
AnchorSideLeft.Control = CompMoveUpBtn AnchorSideLeft.Control = CompMoveUpBtn
AnchorSideTop.Control = CompMoveUpBtn AnchorSideTop.Control = CompMoveUpBtn
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 351 Left = 355
Height = 26 Height = 26
Top = 135 Top = 135
Width = 22 Width = 22
@ -279,90 +281,13 @@ object CompPaletteOptionsFrame: TCompPaletteOptionsFrame
AnchorSideLeft.Control = Owner AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner AnchorSideTop.Control = Owner
Left = 0 Left = 0
Height = 18 Height = 24
Top = 6 Top = 6
Width = 118 Width = 114
BorderSpacing.Top = 6 BorderSpacing.Top = 6
Caption = 'Palette is visible' Caption = 'Palette is visible'
TabOrder = 0 TabOrder = 0
end end
object CompPalModeGroupBox: TGroupBox
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = cbPaletteVisible
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Splitter1
Left = 0
Height = 106
Top = 30
Width = 193
Anchors = [akTop, akLeft, akRight]
AutoSize = True
BorderSpacing.Top = 6
BorderSpacing.Bottom = 6
Caption = 'CompPalModeGroupBox'
ClientHeight = 84
ClientWidth = 185
TabOrder = 4
Visible = False
object CompPalModeComboBox: TComboBox
AnchorSideLeft.Control = CompPalModeGroupBox
AnchorSideTop.Control = CompPalModeGroupBox
AnchorSideRight.Control = CompPalModeGroupBox
AnchorSideRight.Side = asrBottom
Left = 6
Height = 20
Top = 6
Width = 173
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Around = 6
ItemHeight = 0
OnChange = CompPalModeComboBoxChange
Style = csDropDownList
TabOrder = 0
end
object CompPalModeAddButton: TButton
AnchorSideLeft.Control = CompPalModeGroupBox
AnchorSideTop.Control = CompPalModeComboBox
AnchorSideTop.Side = asrBottom
Left = 6
Height = 20
Top = 32
Width = 70
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Add'
OnClick = CompPalModeAddButtonClick
TabOrder = 1
end
object CompPalModeDeleteButton: TButton
AnchorSideLeft.Control = CompPalModeAddButton
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = CompPalModeAddButton
Left = 82
Height = 20
Top = 32
Width = 70
AutoSize = True
BorderSpacing.Right = 6
Caption = 'Delete'
OnClick = CompPalModeDeleteButtonClick
TabOrder = 2
end
object CompPalModeRenameButton: TButton
AnchorSideLeft.Control = CompPalModeAddButton
AnchorSideTop.Control = CompPalModeAddButton
AnchorSideTop.Side = asrBottom
Left = 6
Height = 20
Top = 58
Width = 73
AutoSize = True
BorderSpacing.Bottom = 6
Caption = 'Rename'
OnClick = CompPalModeRenameButtonClick
TabOrder = 3
end
end
object ImportDialog: TOpenDialog object ImportDialog: TOpenDialog
left = 272 left = 272
top = 256 top = 256

View File

@ -18,7 +18,7 @@
* * * *
*************************************************************************** ***************************************************************************
} }
unit componentpalette_options; unit ComponentPalette_Options;
{$mode objfpc}{$H+} {$mode objfpc}{$H+}
@ -38,15 +38,10 @@ type
TCompPaletteOptionsFrame = class(TAbstractIDEOptionsEditor) TCompPaletteOptionsFrame = class(TAbstractIDEOptionsEditor)
AddPageButton: TBitBtn; AddPageButton: TBitBtn;
cbPaletteVisible: TCheckBox; cbPaletteVisible: TCheckBox;
CompPalModeDeleteButton: TButton;
CompPalModeAddButton: TButton;
CompPalModeComboBox: TComboBox;
CompPalModeRenameButton: TButton;
ImportButton: TBitBtn; ImportButton: TBitBtn;
ComponentsListView: TListView; ComponentsListView: TListView;
CompMoveDownBtn: TSpeedButton; CompMoveDownBtn: TSpeedButton;
DeleteMenuItem: TMenuItem; DeleteMenuItem: TMenuItem;
CompPalModeGroupBox: TGroupBox;
RenameMenuItem: TMenuItem; RenameMenuItem: TMenuItem;
PagesPopupMenu: TPopupMenu; PagesPopupMenu: TPopupMenu;
ExportButton: TBitBtn; ExportButton: TBitBtn;