View Issue Details

IDProjectCategoryView StatusLast Update
0014882LazarusIDEpublic2011-12-01 11:25
ReporterStijn SandersAssigned ToJuha Manninen 
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product VersionProduct Build 
Target VersionFixed in Version0.9.31 (SVN) 
Summary0014882: Use unit dialog (Alt-F11)
DescriptionUse unit dialog (Alt-F11) should open a dialog box listing the other units in the project, not already included in the unit currently open in the editor. Selecting one adds it to the uses clause. Optionally with a select-option to which uses clause you want the unit added (interface/implementation), preferably sensing from where the cursur is (above or below the 'implementation' keyword)
Additional InformationI have a vague recollection of a dialog box that didn't list any units until you start typing, and then listed only those units that contained the typed, selected from the -entire- set of units found in all unit-search-directories of project, environment and system (and whatnot).
TagsNo tags attached.
Fixed in Revision28949
LazTarget0.99.0
Widgetset
Attached Files
  • UseProjUnitCmd.patch (572 bytes)
    Index: idecommands.pas
    ===================================================================
    --- idecommands.pas	(revision 28795)
    +++ idecommands.pas	(working copy)
    @@ -140,7 +140,8 @@
       ecShowAbstractMethods     = ecFirstLazarus + 119;
       ecRemoveEmptyMethods      = ecFirstLazarus + 120;
       ecRemoveUnusedUnits       = ecFirstLazarus + 121;
    -  ecFindOverloads           = ecFirstLazarus + 122;
    +  ecUseProjectUnit          = ecFirstLazarus + 122;
    +  ecFindOverloads           = ecFirstLazarus + 123;
     
       // file menu
       ecNew                     = ecFirstLazarus + 201;
    
    UseProjUnitCmd.patch (572 bytes)
  • UseProjUnitPrepare.patch (3,315 bytes)
    Index: ide/keymapping.pp
    ===================================================================
    --- ide/keymapping.pp	(revision 28796)
    +++ ide/keymapping.pp	(working copy)
    @@ -437,6 +437,7 @@
       ecShowAbstractMethods: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
       ecRemoveEmptyMethods: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
       ecRemoveUnusedUnits: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
    +  ecUseProjectUnit: SetResult(VK_F11,[ssAlt],VK_UNKNOWN,[]);
       ecFindOverloads: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
     
       // source notebook
    @@ -2113,6 +2114,7 @@
         ecShowAbstractMethods     : Result:= srkmecShowAbstractMethods;
         ecRemoveEmptyMethods      : Result:= srkmecRemoveEmptyMethods;
         ecRemoveUnusedUnits       : Result:= srkmecRemoveUnusedUnits;
    +    ecUseProjectUnit          : Result:= srkmecUseProjectUnit;
         ecFindOverloads           : Result:= srkmecFindOverloads;
     
         // project (menu string resource)
    @@ -2661,6 +2663,8 @@
         ecRemoveEmptyMethods);
       AddDefault(C, 'Remove unused units', srkmecRemoveUnusedUnits,
         ecRemoveUnusedUnits);
    +  AddDefault(C, 'Add unit to uses section', srkmecUseProjectUnit,
    +    ecUseProjectUnit);
       AddDefault(C, 'Find overloads', srkmecFindOverloads,
         ecFindOverloads);
     
    Index: ide/main.pp
    ===================================================================
    --- ide/main.pp	(revision 28796)
    +++ ide/main.pp	(working copy)
    @@ -141,7 +141,7 @@
       IDEFPCInfo, IDEInfoDlg, ProcessList, InitialSetupDlgs, NewDialog,
       MakeResStrDlg, DialogProcs, FindReplaceDialog, FindInFilesDlg, CodeExplorer,
       BuildFileDlg, ProcedureList, ExtractProcDlg, FindRenameIdentifier,
    -  AbstractsMethodsDlg, EmptyMethodsDlg, UnusedUnitsDlg, FindOverloadsDlg,
    +  AbstractsMethodsDlg, EmptyMethodsDlg, UnusedUnitsDlg, UseProjUnitDlg, FindOverloadsDlg,
       CleanDirDlg, CodeContextForm, AboutFrm, CompatibilityRestrictions,
       RestrictionBrowser, ProjectWizardDlg, IDECmdLine, CodeExplOpts,
       // main ide
    @@ -978,6 +978,7 @@
         function DoShowAbstractMethods: TModalResult;
         function DoRemoveEmptyMethods: TModalResult;
         function DoRemoveUnusedUnits: TModalResult;
    +    function DoUseProjectUnit: TModalResult;
         function DoFindOverloads: TModalResult;
         function DoInitIdentCompletion(JumpToError: boolean): boolean;
         function DoShowCodeContext(JumpToError: boolean): boolean;
    @@ -3120,6 +3121,9 @@
       ecRemoveUnusedUnits:
         DoRemoveUnusedUnits;
     
    +  ecUseProjectUnit:
    +    DoUseProjectUnit;
    +
       ecFindOverloads:
         DoFindOverloads;
     
    @@ -14813,6 +14817,11 @@
       Result:=ShowUnusedUnitsDialog;
     end;
     
    +function TMainIDE.DoUseProjectUnit: TModalResult;
    +begin
    +  Result:=ShowUseProjUnitDialog;
    +end;
    +
     function TMainIDE.DoFindOverloads: TModalResult;
     begin
       Result:=ShowFindOverloadsDialog;
    Index: ide/lazarusidestrconsts.pas
    ===================================================================
    --- ide/lazarusidestrconsts.pas	(revision 28796)
    +++ ide/lazarusidestrconsts.pas	(working copy)
    @@ -2598,6 +2598,7 @@
       srkmecShowAbstractMethods       = 'Show abstract methods';
       srkmecRemoveEmptyMethods        = 'Remove empty methods';
       srkmecRemoveUnusedUnits         = 'Remove unused units';
    +  srkmecUseProjectUnit            = 'Add unit to uses section';
       srkmecFindOverloads             = 'Find overloads';
     
       //Plugin template Edit
    
    UseProjUnitPrepare.patch (3,315 bytes)

Activities

2010-12-21 19:12

 

UseProjUnitCmd.patch (572 bytes)
Index: idecommands.pas
===================================================================
--- idecommands.pas	(revision 28795)
+++ idecommands.pas	(working copy)
@@ -140,7 +140,8 @@
   ecShowAbstractMethods     = ecFirstLazarus + 119;
   ecRemoveEmptyMethods      = ecFirstLazarus + 120;
   ecRemoveUnusedUnits       = ecFirstLazarus + 121;
-  ecFindOverloads           = ecFirstLazarus + 122;
+  ecUseProjectUnit          = ecFirstLazarus + 122;
+  ecFindOverloads           = ecFirstLazarus + 123;
 
   // file menu
   ecNew                     = ecFirstLazarus + 201;
UseProjUnitCmd.patch (572 bytes)

2010-12-21 19:12

 

UseProjUnitPrepare.patch (3,315 bytes)
Index: ide/keymapping.pp
===================================================================
--- ide/keymapping.pp	(revision 28796)
+++ ide/keymapping.pp	(working copy)
@@ -437,6 +437,7 @@
   ecShowAbstractMethods: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
   ecRemoveEmptyMethods: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
   ecRemoveUnusedUnits: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
+  ecUseProjectUnit: SetResult(VK_F11,[ssAlt],VK_UNKNOWN,[]);
   ecFindOverloads: SetResult(VK_UNKNOWN,[],VK_UNKNOWN,[]);
 
   // source notebook
@@ -2113,6 +2114,7 @@
     ecShowAbstractMethods     : Result:= srkmecShowAbstractMethods;
     ecRemoveEmptyMethods      : Result:= srkmecRemoveEmptyMethods;
     ecRemoveUnusedUnits       : Result:= srkmecRemoveUnusedUnits;
+    ecUseProjectUnit          : Result:= srkmecUseProjectUnit;
     ecFindOverloads           : Result:= srkmecFindOverloads;
 
     // project (menu string resource)
@@ -2661,6 +2663,8 @@
     ecRemoveEmptyMethods);
   AddDefault(C, 'Remove unused units', srkmecRemoveUnusedUnits,
     ecRemoveUnusedUnits);
+  AddDefault(C, 'Add unit to uses section', srkmecUseProjectUnit,
+    ecUseProjectUnit);
   AddDefault(C, 'Find overloads', srkmecFindOverloads,
     ecFindOverloads);
 
Index: ide/main.pp
===================================================================
--- ide/main.pp	(revision 28796)
+++ ide/main.pp	(working copy)
@@ -141,7 +141,7 @@
   IDEFPCInfo, IDEInfoDlg, ProcessList, InitialSetupDlgs, NewDialog,
   MakeResStrDlg, DialogProcs, FindReplaceDialog, FindInFilesDlg, CodeExplorer,
   BuildFileDlg, ProcedureList, ExtractProcDlg, FindRenameIdentifier,
-  AbstractsMethodsDlg, EmptyMethodsDlg, UnusedUnitsDlg, FindOverloadsDlg,
+  AbstractsMethodsDlg, EmptyMethodsDlg, UnusedUnitsDlg, UseProjUnitDlg, FindOverloadsDlg,
   CleanDirDlg, CodeContextForm, AboutFrm, CompatibilityRestrictions,
   RestrictionBrowser, ProjectWizardDlg, IDECmdLine, CodeExplOpts,
   // main ide
@@ -978,6 +978,7 @@
     function DoShowAbstractMethods: TModalResult;
     function DoRemoveEmptyMethods: TModalResult;
     function DoRemoveUnusedUnits: TModalResult;
+    function DoUseProjectUnit: TModalResult;
     function DoFindOverloads: TModalResult;
     function DoInitIdentCompletion(JumpToError: boolean): boolean;
     function DoShowCodeContext(JumpToError: boolean): boolean;
@@ -3120,6 +3121,9 @@
   ecRemoveUnusedUnits:
     DoRemoveUnusedUnits;
 
+  ecUseProjectUnit:
+    DoUseProjectUnit;
+
   ecFindOverloads:
     DoFindOverloads;
 
@@ -14813,6 +14817,11 @@
   Result:=ShowUnusedUnitsDialog;
 end;
 
+function TMainIDE.DoUseProjectUnit: TModalResult;
+begin
+  Result:=ShowUseProjUnitDialog;
+end;
+
 function TMainIDE.DoFindOverloads: TModalResult;
 begin
   Result:=ShowFindOverloadsDialog;
Index: ide/lazarusidestrconsts.pas
===================================================================
--- ide/lazarusidestrconsts.pas	(revision 28796)
+++ ide/lazarusidestrconsts.pas	(working copy)
@@ -2598,6 +2598,7 @@
   srkmecShowAbstractMethods       = 'Show abstract methods';
   srkmecRemoveEmptyMethods        = 'Remove empty methods';
   srkmecRemoveUnusedUnits         = 'Remove unused units';
+  srkmecUseProjectUnit            = 'Add unit to uses section';
   srkmecFindOverloads             = 'Find overloads';
 
   //Plugin template Edit
UseProjUnitPrepare.patch (3,315 bytes)

Juha Manninen

2010-12-21 19:21

developer   ~0044473

I uploaded 2 patches, one for the IDE command and one for taking care and forwarding the command.
File UseProjUnitDlg that actually implements the feature is already committed by me to make things easier.

The feature works so well that it could be applied now. Other choice is to wait until the release. It is up to the other developers.

Only i18n is not implemented yet (no resource strings for the dialog). They will be added later.

Juha Manninen

2010-12-31 11:47

developer   ~0044752

Someone could apply this. There is a new idecommand which I can't apply myself.

Paul Ishenin

2011-01-11 08:25

manager   ~0045084

Thanks, applied. Juha, ask on the dev list for the rights on ideintf directory.

Issue History

Date Modified Username Field Change
2009-10-23 14:32 Stijn Sanders New Issue
2009-10-23 14:38 Vincent Snijders LazTarget => post 1.2
2009-10-23 14:38 Vincent Snijders Status new => acknowledged
2010-12-20 10:34 Juha Manninen Status acknowledged => assigned
2010-12-20 10:34 Juha Manninen Assigned To => Juha Manninen
2010-12-21 19:12 Juha Manninen File Added: UseProjUnitCmd.patch
2010-12-21 19:12 Juha Manninen File Added: UseProjUnitPrepare.patch
2010-12-21 19:21 Juha Manninen Note Added: 0044473
2010-12-31 11:44 Juha Manninen LazTarget post 1.2 => 0.99.0
2010-12-31 11:47 Juha Manninen Note Added: 0044752
2011-01-11 08:25 Paul Ishenin Fixed in Revision => 28949
2011-01-11 08:25 Paul Ishenin Status assigned => resolved
2011-01-11 08:25 Paul Ishenin Fixed in Version => 0.9.31 (SVN)
2011-01-11 08:25 Paul Ishenin Resolution open => fixed
2011-01-11 08:25 Paul Ishenin Note Added: 0045084
2011-01-11 08:25 Paul Ishenin Target Version => 0.99.0
2011-12-01 11:25 Marc Weustink Status resolved => closed