mirror of https://gitlab.com/basile.b/dexed.git
libman editor, btn to register an entry using the project parameters
This commit is contained in:
parent
f9be3bd0fc
commit
1da6889f4f
|
@ -113,6 +113,17 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
Spacing = 0
|
Spacing = 0
|
||||||
TabOrder = 7
|
TabOrder = 7
|
||||||
end
|
end
|
||||||
|
object btnReg: TBitBtn
|
||||||
|
Left = 112
|
||||||
|
Height = 24
|
||||||
|
Hint = 'register from the current project'
|
||||||
|
Top = 0
|
||||||
|
Width = 28
|
||||||
|
Align = alLeft
|
||||||
|
OnClick = btnRegClick
|
||||||
|
Spacing = 0
|
||||||
|
TabOrder = 8
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object List: TListView[1]
|
object List: TListView[1]
|
||||||
Left = 4
|
Left = 4
|
||||||
|
@ -130,12 +141,12 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Library file'
|
Caption = 'Library file'
|
||||||
Width = 67
|
Width = 82
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'Sources root'
|
Caption = 'Sources root'
|
||||||
Width = 78
|
Width = 95
|
||||||
end>
|
end>
|
||||||
GridLines = True
|
GridLines = True
|
||||||
HideSelection = False
|
HideSelection = False
|
||||||
|
|
|
@ -6,13 +6,17 @@ interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||||
Menus, ComCtrls, Buttons, ce_widget;
|
Menus, ComCtrls, Buttons, ce_widget, ce_interfaces, ce_project, ce_dmdwrap,
|
||||||
|
ce_common;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
TCELibManEditorWidget = class(TCEWidget)
|
{ TCELibManEditorWidget }
|
||||||
|
|
||||||
|
TCELibManEditorWidget = class(TCEWidget, ICEProjectObserver)
|
||||||
btnMoveDown: TBitBtn;
|
btnMoveDown: TBitBtn;
|
||||||
btnMoveUp: TBitBtn;
|
btnMoveUp: TBitBtn;
|
||||||
|
btnReg: TBitBtn;
|
||||||
btnSelFile: TBitBtn;
|
btnSelFile: TBitBtn;
|
||||||
btnAddLib: TBitBtn;
|
btnAddLib: TBitBtn;
|
||||||
btnRemLib: TBitBtn;
|
btnRemLib: TBitBtn;
|
||||||
|
@ -23,6 +27,7 @@ type
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
procedure btnAddLibClick(Sender: TObject);
|
procedure btnAddLibClick(Sender: TObject);
|
||||||
procedure btnEditAliasClick(Sender: TObject);
|
procedure btnEditAliasClick(Sender: TObject);
|
||||||
|
procedure btnRegClick(Sender: TObject);
|
||||||
procedure btnRemLibClick(Sender: TObject);
|
procedure btnRemLibClick(Sender: TObject);
|
||||||
procedure btnSelFileClick(Sender: TObject);
|
procedure btnSelFileClick(Sender: TObject);
|
||||||
procedure btnSelfoldOfFilesClick(Sender: TObject);
|
procedure btnSelfoldOfFilesClick(Sender: TObject);
|
||||||
|
@ -31,6 +36,14 @@ type
|
||||||
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);
|
||||||
private
|
private
|
||||||
|
fProj: TCEProject;
|
||||||
|
procedure updateRegistrable;
|
||||||
|
procedure projNew(aProject: TCEProject);
|
||||||
|
procedure projChanged(aProject: TCEProject);
|
||||||
|
procedure projClosing(aProject: TCEProject);
|
||||||
|
procedure projFocused(aProject: TCEProject);
|
||||||
|
procedure projCompiling(aProject: TCEProject);
|
||||||
|
//
|
||||||
procedure dataToGrid;
|
procedure dataToGrid;
|
||||||
procedure gridToData;
|
procedure gridToData;
|
||||||
protected
|
protected
|
||||||
|
@ -72,11 +85,48 @@ begin
|
||||||
btnSelfoldOfFiles.Glyph.Assign(png);
|
btnSelfoldOfFiles.Glyph.Assign(png);
|
||||||
png.LoadFromLazarusResource('folder_add');
|
png.LoadFromLazarusResource('folder_add');
|
||||||
btnSelRoot.Glyph.Assign(png);
|
btnSelRoot.Glyph.Assign(png);
|
||||||
|
png.LoadFromLazarusResource('book_link');
|
||||||
|
btnReg.Glyph.Assign(png);
|
||||||
finally
|
finally
|
||||||
png.Free;
|
png.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCELibManEditorWidget.updateRegistrable;
|
||||||
|
begin
|
||||||
|
btnReg.Enabled := (fProj <> nil) and
|
||||||
|
(fProj.currentConfiguration.outputOptions.binaryKind = staticlib) and
|
||||||
|
(FileExists(fProj.Filename))
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCELibManEditorWidget.projNew(aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
fProj := aProject;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCELibManEditorWidget.projChanged(aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
updateRegistrable;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCELibManEditorWidget.projClosing(aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
if aProject <> fProj then exit;
|
||||||
|
fProj := nil;
|
||||||
|
updateRegistrable;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCELibManEditorWidget.projFocused(aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
fProj := aProject;
|
||||||
|
updateRegistrable;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCELibManEditorWidget.projCompiling(aProject: TCEProject);
|
||||||
|
begin
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TCELibManEditorWidget.ListEdited(Sender: TObject; Item: TListItem; var AValue: string);
|
procedure TCELibManEditorWidget.ListEdited(Sender: TObject; Item: TListItem; var AValue: string);
|
||||||
begin
|
begin
|
||||||
gridToData;
|
gridToData;
|
||||||
|
@ -106,6 +156,40 @@ begin
|
||||||
gridToData;
|
gridToData;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCELibManEditorWidget.btnRegClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
str: TStringList;
|
||||||
|
root: string;
|
||||||
|
i: integer;
|
||||||
|
begin
|
||||||
|
if fProj = nil then exit;
|
||||||
|
//
|
||||||
|
str := TStringList.Create;
|
||||||
|
try
|
||||||
|
for i := 0 to fProj.Sources.Count-1 do
|
||||||
|
str.Add(fProj.getAbsoluteSourceName(i));
|
||||||
|
root := commonFolder(str);
|
||||||
|
root := ExtractFileDir(root);
|
||||||
|
if root = '' then
|
||||||
|
exit;
|
||||||
|
//
|
||||||
|
with List.Items.Add do
|
||||||
|
begin
|
||||||
|
Caption := ExtractFileNameOnly(fProj.Filename);
|
||||||
|
if ExtractFileExt(fProj.outputFilename) <> libExt then
|
||||||
|
SubItems.add(fProj.outputFilename + libExt)
|
||||||
|
else
|
||||||
|
SubItems.add(fProj.outputFilename);
|
||||||
|
SubItems.add(root);
|
||||||
|
Selected:= true;
|
||||||
|
end;
|
||||||
|
SetFocus;
|
||||||
|
gridToData;
|
||||||
|
finally
|
||||||
|
str.free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCELibManEditorWidget.btnRemLibClick(Sender: TObject);
|
procedure TCELibManEditorWidget.btnRemLibClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if List.Selected = nil then
|
if List.Selected = nil then
|
||||||
|
|
Loading…
Reference in New Issue