mirror of https://gitlab.com/basile.b/dexed.git
added a tool buton to open the proj matching to a library item, when possible
This commit is contained in:
parent
6c90ec9a6c
commit
de04bd5ecf
|
@ -125,7 +125,7 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
TabOrder = 8
|
TabOrder = 8
|
||||||
end
|
end
|
||||||
object btnDubFetch: TBitBtn
|
object btnDubFetch: TBitBtn
|
||||||
Left = 140
|
Left = 168
|
||||||
Height = 26
|
Height = 26
|
||||||
Hint = 'register an online dub package'
|
Hint = 'register an online dub package'
|
||||||
Top = 0
|
Top = 0
|
||||||
|
@ -146,6 +146,17 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
Spacing = 0
|
Spacing = 0
|
||||||
TabOrder = 10
|
TabOrder = 10
|
||||||
end
|
end
|
||||||
|
object btnOpenProj: TBitBtn
|
||||||
|
Left = 140
|
||||||
|
Height = 26
|
||||||
|
Hint = 'open the matching project'
|
||||||
|
Top = 0
|
||||||
|
Width = 28
|
||||||
|
Align = alLeft
|
||||||
|
OnClick = btnOpenProjClick
|
||||||
|
Spacing = 0
|
||||||
|
TabOrder = 11
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object List: TListView[1]
|
object List: TListView[1]
|
||||||
Left = 4
|
Left = 4
|
||||||
|
@ -158,22 +169,22 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Alias'
|
Caption = 'Alias'
|
||||||
Width = 629
|
Width = 39
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Library file'
|
Caption = 'Library file'
|
||||||
Width = 67
|
Width = 76
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Sources root'
|
Caption = 'Sources root'
|
||||||
Width = 78
|
Width = 88
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'project'
|
Caption = 'project'
|
||||||
Width = 49
|
Width = 409
|
||||||
end>
|
end>
|
||||||
GridLines = True
|
GridLines = True
|
||||||
HideSelection = False
|
HideSelection = False
|
||||||
|
@ -183,11 +194,12 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
ViewStyle = vsReport
|
ViewStyle = vsReport
|
||||||
OnEdited = ListEdited
|
OnEdited = ListEdited
|
||||||
|
OnSelectItem = ListSelectItem
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
inherited contextMenu: TPopupMenu
|
inherited contextMenu: TPopupMenu
|
||||||
left = 184
|
left = 304
|
||||||
top = 8
|
top = 16
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,6 +14,7 @@ type
|
||||||
{ TCELibManEditorWidget }
|
{ TCELibManEditorWidget }
|
||||||
|
|
||||||
TCELibManEditorWidget = class(TCEWidget, ICEProjectObserver)
|
TCELibManEditorWidget = class(TCEWidget, ICEProjectObserver)
|
||||||
|
btnOpenProj: TBitBtn;
|
||||||
btnMoveDown: TBitBtn;
|
btnMoveDown: TBitBtn;
|
||||||
btnMoveUp: TBitBtn;
|
btnMoveUp: TBitBtn;
|
||||||
btnReg: TBitBtn;
|
btnReg: TBitBtn;
|
||||||
|
@ -30,6 +31,7 @@ type
|
||||||
procedure btnAddLibClick(Sender: TObject);
|
procedure btnAddLibClick(Sender: TObject);
|
||||||
procedure btnDubFetchClick(Sender: TObject);
|
procedure btnDubFetchClick(Sender: TObject);
|
||||||
procedure btnEditAliasClick(Sender: TObject);
|
procedure btnEditAliasClick(Sender: TObject);
|
||||||
|
procedure btnOpenProjClick(Sender: TObject);
|
||||||
procedure btnRegClick(Sender: TObject);
|
procedure btnRegClick(Sender: TObject);
|
||||||
procedure btnRemLibClick(Sender: TObject);
|
procedure btnRemLibClick(Sender: TObject);
|
||||||
procedure btnSelFileClick(Sender: TObject);
|
procedure btnSelFileClick(Sender: TObject);
|
||||||
|
@ -39,9 +41,11 @@ type
|
||||||
procedure btnMoveUpClick(Sender: TObject);
|
procedure btnMoveUpClick(Sender: TObject);
|
||||||
procedure btnMoveDownClick(Sender: TObject);
|
procedure btnMoveDownClick(Sender: TObject);
|
||||||
procedure ListEdited(Sender: TObject; Item: TListItem; var AValue: string);
|
procedure ListEdited(Sender: TObject; Item: TListItem; var AValue: string);
|
||||||
|
procedure ListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean
|
||||||
|
);
|
||||||
private
|
private
|
||||||
fProj: ICECommonProject;
|
fProj: ICECommonProject;
|
||||||
procedure updateRegistrable;
|
procedure updateButtonsState;
|
||||||
procedure projNew(aProject: ICECommonProject);
|
procedure projNew(aProject: ICECommonProject);
|
||||||
procedure projChanged(aProject: ICECommonProject);
|
procedure projChanged(aProject: ICECommonProject);
|
||||||
procedure projClosing(aProject: ICECommonProject);
|
procedure projClosing(aProject: ICECommonProject);
|
||||||
|
@ -80,12 +84,15 @@ begin
|
||||||
AssignPng(btnReg, 'book_link');
|
AssignPng(btnReg, 'book_link');
|
||||||
AssignPng(btnDubFetch, 'dub_small');
|
AssignPng(btnDubFetch, 'dub_small');
|
||||||
AssignPng(btnSelProj, 'script_bricks');
|
AssignPng(btnSelProj, 'script_bricks');
|
||||||
|
AssignPng(btnOpenProj, 'book_open');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCELibManEditorWidget.updateRegistrable;
|
procedure TCELibManEditorWidget.updateButtonsState;
|
||||||
begin
|
begin
|
||||||
btnReg.Enabled := (fProj <> nil) and (fProj.binaryKind = staticlib) and
|
btnReg.Enabled := (fProj <> nil) and (fProj.binaryKind = staticlib) and
|
||||||
FileExists(fProj.Filename);
|
FileExists(fProj.Filename);
|
||||||
|
btnOpenProj.Enabled := (List.Selected <> nil) and
|
||||||
|
(fileExists(List.Selected.SubItems[2]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCELibManEditorWidget.projNew(aProject: ICECommonProject);
|
procedure TCELibManEditorWidget.projNew(aProject: ICECommonProject);
|
||||||
|
@ -99,7 +106,7 @@ begin
|
||||||
if fProj <> aProject then
|
if fProj <> aProject then
|
||||||
exit;
|
exit;
|
||||||
//
|
//
|
||||||
updateRegistrable;
|
updateButtonsState;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCELibManEditorWidget.projClosing(aProject: ICECommonProject);
|
procedure TCELibManEditorWidget.projClosing(aProject: ICECommonProject);
|
||||||
|
@ -107,13 +114,13 @@ begin
|
||||||
if fProj <> aProject then
|
if fProj <> aProject then
|
||||||
exit;
|
exit;
|
||||||
fProj := nil;
|
fProj := nil;
|
||||||
updateRegistrable;
|
updateButtonsState;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCELibManEditorWidget.projFocused(aProject: ICECommonProject);
|
procedure TCELibManEditorWidget.projFocused(aProject: ICECommonProject);
|
||||||
begin
|
begin
|
||||||
fProj := aProject;
|
fProj := aProject;
|
||||||
updateRegistrable;
|
updateButtonsState;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCELibManEditorWidget.projCompiling(aProject: ICECommonProject);
|
procedure TCELibManEditorWidget.projCompiling(aProject: ICECommonProject);
|
||||||
|
@ -125,6 +132,12 @@ begin
|
||||||
gridToData;
|
gridToData;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCELibManEditorWidget.ListSelectItem(Sender: TObject;
|
||||||
|
Item: TListItem; Selected: Boolean);
|
||||||
|
begin
|
||||||
|
updateButtonsState;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCELibManEditorWidget.btnAddLibClick(Sender: TObject);
|
procedure TCELibManEditorWidget.btnAddLibClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
itm: TListItem;
|
itm: TListItem;
|
||||||
|
@ -289,6 +302,39 @@ begin
|
||||||
gridToData;
|
gridToData;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCELibManEditorWidget.btnOpenProjClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
fname: string;
|
||||||
|
begin
|
||||||
|
if List.Selected = nil then exit;
|
||||||
|
fname := List.Selected.SubItems[2];
|
||||||
|
if not FileExists(fname) then exit;
|
||||||
|
//
|
||||||
|
if isValidNativeProject(fname) then
|
||||||
|
begin
|
||||||
|
if assigned(fProj) then
|
||||||
|
begin
|
||||||
|
if fProj.modified and (dlgFileChangeClose(fname) = mrCancel) then
|
||||||
|
exit;
|
||||||
|
fProj.getProject.Free;
|
||||||
|
end;
|
||||||
|
TCENativeProject.create(nil);
|
||||||
|
fProj.loadFromFile(fname);
|
||||||
|
end
|
||||||
|
else if isValidDubProject(fname) then
|
||||||
|
begin
|
||||||
|
if assigned(fProj) then
|
||||||
|
begin
|
||||||
|
if fProj.modified and (dlgFileChangeClose(fname) = mrCancel) then
|
||||||
|
exit;
|
||||||
|
fProj.getProject.Free;
|
||||||
|
end;
|
||||||
|
TCEDubProject.create(nil);
|
||||||
|
fProj.loadFromFile(fname);
|
||||||
|
end
|
||||||
|
else dlgOkInfo('the project file for this library seems to be invalid');
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCELibManEditorWidget.btnRegClick(Sender: TObject);
|
procedure TCELibManEditorWidget.btnRegClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
str: TStringList;
|
str: TStringList;
|
||||||
|
|
Loading…
Reference in New Issue