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

View File

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

View File

@ -1499,12 +1499,12 @@ end;
function TIDEFPCParser.CheckForLinkerErrors(p: PChar): boolean;
const
pat: String = 'Undefined symbols for architecture';
patUndefinedSymbol: String = 'Undefined symbols for architecture';
patLD: String = '/usr/bin/ld: ';
var
MsgLine: TMessageLine;
begin
Result:=CompareMem(PChar(pat),p,length(pat));
if Result then
if CompareMem(PChar(patUndefinedSymbol),p,length(patUndefinedSymbol)) then
begin
MsgLine:=CreateMsgLine;
MsgLine.MsgID:=0;
@ -1512,7 +1512,19 @@ begin
MsgLine.Urgency:=mluError;
MsgLine.Msg:='linker: '+p;
inherited AddMsgLine(MsgLine);
exit(true);
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;
function TIDEFPCParser.CheckForAssemblerErrors(p: PChar): boolean;
@ -1651,6 +1663,15 @@ For example:
_COCOAINT_TCOCOAWIDGETSET_$__GETKEYSTATE$LONGINT$$SMALLINT in cocoaint.o
ld: symbol(s) not found for architecture x86_64
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
i: Integer;
@ -1660,6 +1681,7 @@ begin
i:=Tool.WorkerMessages.Count-1;
while i>=0 do begin
MsgLine:=Tool.WorkerMessages[i];
//debugln(['TIDEFPCParser.AddLinkingMessages ',i,' ',dbgs(MsgLine.Urgency),' ',MsgLine.Msg]);
if MsgLine.Urgency<mluHint then
MsgLine.Urgency:=mluImportant
else
@ -1671,6 +1693,7 @@ begin
i:=Tool.WorkerMessages.Count-1;
if i<0 then exit;
MsgLine:=Tool.WorkerMessages[i];
//debugln(['TIDEFPCParser.AddLinkingMessages MsgLine.OutputIndex=',MsgLine.OutputIndex,' fOutputIndex=',fOutputIndex]);
for i:=MsgLine.OutputIndex+1 to fOutputIndex-1 do begin
MsgLine:=inherited CreateMsgLine(i);
MsgLine.MsgID:=0;

View File

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

View File

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

View File

@ -2211,7 +2211,7 @@ Begin
// set colors
if (Editor<>nil) and (TheForm<>nil) then begin
with TheForm as TSourceEditCompletionForm do begin
DrawBorderColor := FActiveEditBorderColor;
DrawBorderColor := FActiveEditBorderColor;
BackgroundColor := FActiveEditBackgroundColor;
clSelect := FActiveEditBackgroundSelectedColor;
TextColor := FActiveEditTextColor;