mirror of https://gitlab.com/basile.b/dexed.git
libman ed, fix, widget caption modifed after selection of the sources root
+ disable col auto size + remove old restriction on certain lib name + add copy menu to list
This commit is contained in:
parent
4d81fceaa6
commit
061d7e7c51
|
@ -1,7 +1,7 @@
|
||||||
inherited CELibManEditorWidget: TCELibManEditorWidget
|
inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
Left = 790
|
Left = 1051
|
||||||
Height = 297
|
Height = 297
|
||||||
Top = 274
|
Top = 0
|
||||||
Width = 641
|
Width = 641
|
||||||
Caption = 'Library manager'
|
Caption = 'Library manager'
|
||||||
ClientHeight = 297
|
ClientHeight = 297
|
||||||
|
@ -25,29 +25,24 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 4
|
||||||
Columns = <
|
Columns = <
|
||||||
item
|
item
|
||||||
AutoSize = True
|
|
||||||
Caption = 'Alias'
|
Caption = 'Alias'
|
||||||
Width = 39
|
Width = 100
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
|
||||||
Caption = 'Library file or folder of sources'
|
Caption = 'Library file or folder of sources'
|
||||||
Width = 195
|
Width = 230
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
|
||||||
Caption = 'Sources root'
|
Caption = 'Sources root'
|
||||||
Width = 88
|
Width = 230
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
|
||||||
Caption = 'project'
|
Caption = 'project'
|
||||||
Width = 54
|
Width = 230
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
AutoSize = True
|
|
||||||
Caption = 'enabled'
|
Caption = 'enabled'
|
||||||
Width = 236
|
Width = 30
|
||||||
end>
|
end>
|
||||||
GridLines = True
|
GridLines = True
|
||||||
HideSelection = False
|
HideSelection = False
|
||||||
|
@ -191,7 +186,6 @@ inherited CELibManEditorWidget: TCELibManEditorWidget
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
inherited contextMenu: TPopupMenu
|
inherited contextMenu: TPopupMenu
|
||||||
left = 304
|
left = 400
|
||||||
top = 16
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,11 +6,11 @@ interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||||
Menus, ComCtrls, Buttons, LazFileUtils, fphttpclient, StdCtrls,
|
Menus, ComCtrls, Buttons, LazFileUtils, fphttpclient, StdCtrls, math,
|
||||||
fpjson, jsonparser,
|
fpjson, jsonparser,
|
||||||
ce_widget, ce_interfaces, ce_ceproject, ce_dmdwrap, ce_common, ce_dialogs,
|
ce_widget, ce_interfaces, ce_ceproject, ce_dmdwrap, ce_common, ce_dialogs,
|
||||||
ce_sharedres, process, ce_dubproject, ce_observer, ce_libman,
|
ce_sharedres, process, ce_dubproject, ce_observer, ce_libman,
|
||||||
ce_projutils, ce_dsgncontrols;
|
ce_projutils, ce_dsgncontrols, ce_controls;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ type
|
||||||
property packageVersion: string read getPackageVersion;
|
property packageVersion: string read getPackageVersion;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TCELibManEditorWidget }
|
|
||||||
TCELibManEditorWidget = class(TCEWidget, ICEProjectObserver)
|
TCELibManEditorWidget = class(TCEWidget, ICEProjectObserver)
|
||||||
btnAddLib: TCEToolButton;
|
btnAddLib: TCEToolButton;
|
||||||
btnDubFetch: TCEToolButton;
|
btnDubFetch: TCEToolButton;
|
||||||
|
@ -76,7 +75,6 @@ type
|
||||||
procedure projCompiled(project: ICECommonProject; success: boolean);
|
procedure projCompiled(project: ICECommonProject; success: boolean);
|
||||||
function itemForRow(row: TListItem): TLibraryItem;
|
function itemForRow(row: TListItem): TLibraryItem;
|
||||||
procedure RowToLibrary(row: TListItem; added: boolean = false);
|
procedure RowToLibrary(row: TListItem; added: boolean = false);
|
||||||
//
|
|
||||||
procedure dataToGrid;
|
procedure dataToGrid;
|
||||||
protected
|
protected
|
||||||
procedure DoShow; override;
|
procedure DoShow; override;
|
||||||
|
@ -84,13 +82,10 @@ type
|
||||||
constructor Create(aOwner: TComponent); override;
|
constructor Create(aOwner: TComponent); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// determine the root of a library, according to the module names
|
|
||||||
//function sourceRoot(project: ICECommonProject): string;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
notav: string = '< n/a >';
|
notav: string = '< n/a >';
|
||||||
enableStr: array [boolean] of string = ('false','true');
|
enableStr: array [boolean] of string = ('false','true');
|
||||||
|
@ -98,6 +93,7 @@ const
|
||||||
constructor TCELibManEditorWidget.Create(aOwner: TComponent);
|
constructor TCELibManEditorWidget.Create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
TCEListViewCopyMenu.create(List);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCELibManEditorWidget.updateButtonsState;
|
procedure TCELibManEditorWidget.updateButtonsState;
|
||||||
|
@ -125,7 +121,7 @@ begin
|
||||||
if fProj = nil then exit;
|
if fProj = nil then exit;
|
||||||
if fProj <> project then
|
if fProj <> project then
|
||||||
exit;
|
exit;
|
||||||
//
|
|
||||||
updateButtonsState;
|
updateButtonsState;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -582,26 +578,22 @@ var
|
||||||
begin
|
begin
|
||||||
if List.Selected.isNil then
|
if List.Selected.isNil then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
al := List.Selected.Caption;
|
al := List.Selected.Caption;
|
||||||
if (al = 'phobos') or (al = 'druntime') then
|
if inputQuery('library alias', '', al) then
|
||||||
begin
|
begin
|
||||||
dlgOkInfo('phobos and druntime cannot be renamed');
|
for i := 0 to LibMan.librariesCount-1 do
|
||||||
end else
|
if (LibMan.libraryByIndex[i].libAlias = al) and
|
||||||
begin
|
(LibMan.libraryByIndex[i] <> itemForRow(List.Selected)) then
|
||||||
if inputQuery('library alias', '', al) then
|
|
||||||
begin
|
begin
|
||||||
for i := 0 to LibMan.librariesCount-1 do
|
dlgOkError('This alias is already used by another library, the renaming is canceled');
|
||||||
if (LibMan.libraryByIndex[i].libAlias = al) and
|
exit;
|
||||||
(LibMan.libraryByIndex[i] <> itemForRow(List.Selected)) then
|
|
||||||
begin
|
|
||||||
dlgOkError('This alias is already used by another library, the renaming is canceled');
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
List.Selected.Caption := al;
|
|
||||||
LibMan.updateItemsByAlias;
|
|
||||||
RowToLibrary(List.Selected);
|
|
||||||
end;
|
end;
|
||||||
|
List.Selected.Caption := al;
|
||||||
|
LibMan.updateItemsByAlias;
|
||||||
|
RowToLibrary(List.Selected);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCELibManEditorWidget.btnEnabledClick(Sender: TObject);
|
procedure TCELibManEditorWidget.btnEnabledClick(Sender: TObject);
|
||||||
|
@ -622,10 +614,12 @@ var
|
||||||
fname: string;
|
fname: string;
|
||||||
fmt: TCEProjectFileFormat;
|
fmt: TCEProjectFileFormat;
|
||||||
begin
|
begin
|
||||||
if List.Selected.isNil then exit;
|
if List.Selected.isNil then
|
||||||
|
exit;
|
||||||
fname := List.Selected.SubItems[2];
|
fname := List.Selected.SubItems[2];
|
||||||
if not fname.fileExists then exit;
|
if not fname.fileExists then
|
||||||
//
|
exit;
|
||||||
|
|
||||||
fmt := projectFormat(fname);
|
fmt := projectFormat(fname);
|
||||||
if fmt in [pffCe, pffDub] then
|
if fmt in [pffCe, pffDub] then
|
||||||
begin
|
begin
|
||||||
|
@ -652,8 +646,9 @@ var
|
||||||
lalias: string;
|
lalias: string;
|
||||||
row: TListItem;
|
row: TListItem;
|
||||||
begin
|
begin
|
||||||
if fProj = nil then exit;
|
if fProj = nil then
|
||||||
//
|
exit;
|
||||||
|
|
||||||
fname := fProj.filename;
|
fname := fProj.filename;
|
||||||
lalias := ExtractFileNameOnly(fname);
|
lalias := ExtractFileNameOnly(fname);
|
||||||
if List.Items.findCaption(lalias, row) then
|
if List.Items.findCaption(lalias, row) then
|
||||||
|
@ -662,7 +657,7 @@ begin
|
||||||
[lalias]));
|
[lalias]));
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
//
|
|
||||||
str := TStringList.Create;
|
str := TStringList.Create;
|
||||||
try
|
try
|
||||||
root := projectSourcePath(fProj);
|
root := projectSourcePath(fProj);
|
||||||
|
@ -671,7 +666,7 @@ begin
|
||||||
dlgOkInfo('the static library can not be registered because its source files have no common folder');
|
dlgOkInfo('the static library can not be registered because its source files have no common folder');
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
//
|
|
||||||
fname := fProj.outputFilename;
|
fname := fProj.outputFilename;
|
||||||
row := List.Items.Add;
|
row := List.Items.Add;
|
||||||
row.Data := LibMan.libraries.Add;
|
row.Data := LibMan.libraries.Add;
|
||||||
|
@ -698,6 +693,7 @@ procedure TCELibManEditorWidget.btnRemLibClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if List.Selected.isNil then
|
if List.Selected.isNil then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
LibMan.libraries.Delete(List.Selected.Index);
|
LibMan.libraries.Delete(List.Selected.Index);
|
||||||
List.Items.Delete(List.Selected.Index);
|
List.Items.Delete(List.Selected.Index);
|
||||||
updateButtonsState;
|
updateButtonsState;
|
||||||
|
@ -713,6 +709,7 @@ begin
|
||||||
ini := List.Selected.SubItems[2];
|
ini := List.Selected.SubItems[2];
|
||||||
with TOpenDialog.Create(nil) do
|
with TOpenDialog.Create(nil) do
|
||||||
try
|
try
|
||||||
|
Title := 'Select the project that compiles the library';
|
||||||
FileName := ini;
|
FileName := ini;
|
||||||
if Execute then
|
if Execute then
|
||||||
List.Selected.SubItems[2] := FileName.normalizePath;
|
List.Selected.SubItems[2] := FileName.normalizePath;
|
||||||
|
@ -732,6 +729,7 @@ begin
|
||||||
ini := List.Selected.SubItems[0];
|
ini := List.Selected.SubItems[0];
|
||||||
with TOpenDialog.Create(nil) do
|
with TOpenDialog.Create(nil) do
|
||||||
try
|
try
|
||||||
|
Title := 'Select the static library file';
|
||||||
filename := ini;
|
filename := ini;
|
||||||
if Execute then
|
if Execute then
|
||||||
begin
|
begin
|
||||||
|
@ -775,7 +773,7 @@ begin
|
||||||
with TSelectDirectoryDialog.Create(nil) do
|
with TSelectDirectoryDialog.Create(nil) do
|
||||||
try
|
try
|
||||||
InitialDir:= dir;
|
InitialDir:= dir;
|
||||||
Caption := 'sources root';
|
Title := 'Select the root of the sources';
|
||||||
Options := options + [ofNoDereferenceLinks, ofForceShowHidden];
|
Options := options + [ofNoDereferenceLinks, ofForceShowHidden];
|
||||||
if execute then
|
if execute then
|
||||||
List.Selected.SubItems[1] := FileName;
|
List.Selected.SubItems[1] := FileName;
|
||||||
|
@ -789,9 +787,7 @@ procedure TCELibManEditorWidget.btnMoveUpClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
if list.Selected.isNil then
|
if list.Selected.isNil or (list.Selected.Index = 0) then
|
||||||
exit;
|
|
||||||
if list.Selected.Index = 0 then
|
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
i := list.Selected.Index;
|
i := list.Selected.Index;
|
||||||
|
@ -803,9 +799,7 @@ procedure TCELibManEditorWidget.btnMoveDownClick(Sender: TObject);
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
if list.Selected.isNil then
|
if list.Selected.isNil or (list.Selected.Index = list.Items.Count - 1) then
|
||||||
exit;
|
|
||||||
if list.Selected.Index = list.Items.Count - 1 then
|
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
i := list.Selected.Index;
|
i := list.Selected.Index;
|
||||||
|
@ -827,6 +821,7 @@ var
|
||||||
begin
|
begin
|
||||||
if LibMan.isNil then
|
if LibMan.isNil then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
List.BeginUpdate;
|
List.BeginUpdate;
|
||||||
List.Clear;
|
List.Clear;
|
||||||
for i := 0 to LibMan.libraries.Count - 1 do
|
for i := 0 to LibMan.libraries.Count - 1 do
|
||||||
|
|
Loading…
Reference in New Issue