View Issue Details

IDProjectCategoryView StatusLast Update
0031006LazarusPatchpublic2017-08-28 07:57
Reportersilvioprog Assigned ToMattias Gaertner  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.7 (SVN) 
Summary0031006: [PATCH] Extend IDEIntf & improve the ToDo window
DescriptionHello,

The attached patch extends the IDEIntf adding the AddTabs parameter to the TLazIDEInterface.FindUnitsOfOwner component allowing that to find units outside project but opened in the source editor.

The patch also improves the ToDo window allowing that to find ToDos on its start and using the new AddTabs described above.
TagsNo tags attached.
Fixed in Revisionr53450, r55059
LazTarget-
Widgetset
Attached Files

Activities

silvioprog

2016-11-25 06:21

reporter  

0001-fix-issue-31006.-patch-by-Silvio-Clecio.patch (5,965 bytes)   
From 66e6bc7f51f33409b4d0af58bf3b92ebc23acb05 Mon Sep 17 00:00:00 2001
From: silvioprog <silvioprog@gmail.com>
Date: Fri, 25 Nov 2016 02:20:14 -0300
Subject: [PATCH] fix issue #31006. (patch by Silvio Clecio)

---
 components/ideintf/lazideintf.pas |  2 +-
 components/todolist/tododlg.pas   |  6 +-----
 components/todolist/todolist.pas  |  3 ++-
 ide/main.pp                       |  6 +++---
 ide/sourcefilemanager.pas         | 15 +++++++++++----
 5 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/components/ideintf/lazideintf.pas b/components/ideintf/lazideintf.pas
index ec7ba09..6304052 100644
--- a/components/ideintf/lazideintf.pas
+++ b/components/ideintf/lazideintf.pas
@@ -383,7 +383,7 @@ type
     procedure DoJumpToCodeToolBossError; virtual; abstract;
     function NeedSaveSourceEditorChangesToCodeCache(AEditor: TSourceEditorInterface): boolean; virtual; abstract;
     function SaveSourceEditorChangesToCodeCache(AEditor: TSourceEditorInterface): boolean; virtual; abstract; // true if something was saved
-    function FindUnitsOfOwner(TheOwner: TObject; AddListed, AddUsed, AddPackages: boolean): TStrings; virtual; abstract;
+    function FindUnitsOfOwner(TheOwner: TObject; AddListed, AddUsed, AddPackages, AddTabs: boolean): TStrings; virtual; abstract;
     property OpenEditorsOnCodeToolChange: boolean read FOpenEditorsOnCodeToolChange
                                              write FOpenEditorsOnCodeToolChange;
     property SaveClosedSourcesOnCodeToolChange: boolean read FSaveClosedSourcesOnCodeToolChange
diff --git a/components/todolist/tododlg.pas b/components/todolist/tododlg.pas
index 6b033b3..6659cc7 100644
--- a/components/todolist/tododlg.pas
+++ b/components/todolist/tododlg.pas
@@ -29,7 +29,7 @@ unit ToDoDlg;
 interface
 
 uses
-  Classes, SysUtils, LCLProc, Forms, Controls, Graphics, Dialogs, StdCtrls,
+  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
   ExtCtrls, Buttons, ButtonPanel, Menus, Spin,
   TodoList, ToDoListStrConsts, IDECommands, LCLType,
   MenuIntf, PackageIntf, SrcEditorIntf, IDEWindowIntf, LazIDEIntf;
@@ -49,10 +49,6 @@ type
     TodoLabel: TLabel;
     TodoMemo: TMemo;
     procedure FormCreate(Sender: TObject);
-  private
-
-  public
-
   end;
   
 var
diff --git a/components/todolist/todolist.pas b/components/todolist/todolist.pas
index ee725ff..45971f2 100644
--- a/components/todolist/todolist.pas
+++ b/components/todolist/todolist.pas
@@ -281,7 +281,7 @@ begin
     end;
 
     ResolveIDEItem(CurOwner,CurProject,CurPkg);
-    Units:=LazarusIDE.FindUnitsOfOwner(CurOwner,true,true,false);
+    Units:=LazarusIDE.FindUnitsOfOwner(CurOwner,true,true,false,true);
     for i:=0 to Units.Count-1 do
       ScanFile(Units[i]);
 
@@ -311,6 +311,7 @@ end;
 procedure TIDETodoWindow.FormShow(Sender: TObject);
 begin
   IdleConnected:=true;
+  UpdateTodos(true);
 end;
 
 procedure TIDETodoWindow.HelpButtonClick(Sender: TObject);
diff --git a/ide/main.pp b/ide/main.pp
index 6ecffef..17e4a4d 100644
--- a/ide/main.pp
+++ b/ide/main.pp
@@ -894,7 +894,7 @@ type
     function NeedSaveSourceEditorChangesToCodeCache(AEditor: TSourceEditorInterface): boolean; override;
     function SaveSourceEditorChangesToCodeCache(AEditor: TSourceEditorInterface): boolean; override;
     function FindUnitsOfOwner(TheOwner: TObject; AddListed, AddUsed,
-      AddPackages: boolean): TStrings; override;
+      AddPackages, AddTabs: boolean): TStrings; override;
     procedure ApplyCodeToolChanges;
     procedure DoJumpToOtherProcedureSection;
     procedure DoFindDeclarationAtCursor;
@@ -9476,9 +9476,9 @@ begin
 end;
 
 function TMainIDE.FindUnitsOfOwner(TheOwner: TObject; AddListed, AddUsed,
-  AddPackages: boolean): TStrings;
+  AddPackages, AddTabs: boolean): TStrings;
 begin
-  Result:=SourceFileMgr.FindUnitsOfOwner(TheOwner,AddListed,AddUsed,AddPackages);
+  Result:=SourceFileMgr.FindUnitsOfOwner(TheOwner,AddListed,AddUsed,AddPackages,AddTabs);
 end;
 
 function TMainIDE.DoJumpToSourcePosition(const Filename: string; NewX, NewY,
diff --git a/ide/sourcefilemanager.pas b/ide/sourcefilemanager.pas
index 7025267..029fb40 100644
--- a/ide/sourcefilemanager.pas
+++ b/ide/sourcefilemanager.pas
@@ -212,7 +212,7 @@ type
     function FindSourceFile(const AFilename, BaseDirectory: string;
                             Flags: TFindSourceFlags): string;
     function FindUnitsOfOwner(TheOwner: TObject; AddListed, AddUsed,
-                              AddPackages: boolean): TStrings;
+                              AddPackages, AddTabs: boolean): TStrings;
 
     function AddUnitToProject(const AEditor: TSourceEditorInterface): TModalResult;
     function AddActiveUnitToProject: TModalResult;
@@ -3045,13 +3045,13 @@ begin
 end;
 
 function TLazSourceFileManager.FindUnitsOfOwner(TheOwner: TObject; AddListed,
-  AddUsed, AddPackages: boolean): TStrings;
+  AddUsed, AddPackages, AddTabs: boolean): TStrings;
 var
   Files: TFilenameToStringTree;
   UnitPath: string; // only if not AddPackages:
                     // owner unitpath without unitpaths of required packages
 
-  function Add(aFilename: string): boolean;
+  function Add(const aFilename: string): boolean;
   begin
     if Files.Contains(aFilename) then exit(false);
     //debugln(['  Add ',aFilename]);
@@ -3075,7 +3075,7 @@ var
     end;
   end;
 
-  procedure AddUsedUnit(aFilename: string);
+  procedure AddUsedUnit(const aFilename: string);
   // add recursively all units
 
     procedure AddUses(UsesSection: TStrings);
@@ -3237,6 +3237,13 @@ begin
             AddUsedUnit(TCodeBuffer(NormalUnits.Objects[i]).Filename);
       end;
     end;
+    if AddTabs then
+      for i := 0 to pred(SourceEditorManager.SourceEditorCount) do
+      begin
+        CurFilename := SourceEditorManager.SourceEditors[i].FileName;
+        if FilenameIsPascalUnit(CurFilename) then
+          Add(CurFilename);
+      end;
   finally
     FoundInUnits.Free;
     MissingUnits.Free;
-- 
2.7.4

Mattias Gaertner

2016-11-25 13:53

manager   ~0096227

Thanks.

Notes:
- For consistency use 'source editor' instead of 'tabs'.
- You forgot to update the fpdoc entry.
- Not everyone wants to show all todos of all open files, they need only their own todos of their project. So this should be optional.

I changed the boolean flags to a set and added a check button.

silvioprog

2016-11-26 04:33

reporter   ~0096242

Last edited: 2016-11-26 04:40

View 4 revisions

Dude, thanks a lot for applying the patch, but I have some news. So, a big button in this window is a little bit ugly, so I've done a full upgrade at that window sending a new patch with the following changes:

- Added options allowing the user to choose the searching flags;
- Added a storage component to save the chosen options;
- Added fuooPackages's doc in the fpdoc entry;
- Updated the PO files (already fixed the pt_BR PO file too);
- Updated the component's TabOrder;
- Added my name to the contributors areas.

New patch in attachment (0001-Upgrades-for-the-issue-31006.-patch-by-Silvio-Clecio.patch).

silvioprog

2016-11-26 04:33

reporter  

0001-Upgrades-for-the-issue-31006.-patch-by-Silvio-Clecio.patch (43,290 bytes)   
From 694089d4098ec5f5fce40856d0116eb628ed6031 Mon Sep 17 00:00:00 2001
From: silvioprog <silvioprog@gmail.com>
Date: Sat, 26 Nov 2016 00:25:34 -0300
Subject: [PATCH] Upgrades for the issue #31006. (patch by Silvio Clecio)

---
 components/ideintf/docs/lazideintf.xml             |   6 +-
 .../todolist/languages/todoliststrconsts.cs.po     |  37 +++++--
 .../todolist/languages/todoliststrconsts.de.po     |  37 +++++--
 .../todolist/languages/todoliststrconsts.es.po     |  37 +++++--
 .../todolist/languages/todoliststrconsts.fi.po     |  37 +++++--
 .../todolist/languages/todoliststrconsts.fr.po     |  37 +++++--
 .../todolist/languages/todoliststrconsts.hu.po     |  37 +++++--
 .../todolist/languages/todoliststrconsts.it.po     |  37 +++++--
 .../todolist/languages/todoliststrconsts.lt.po     |  37 +++++--
 .../todolist/languages/todoliststrconsts.pl.po     |  37 +++++--
 components/todolist/languages/todoliststrconsts.po |  37 +++++--
 .../todolist/languages/todoliststrconsts.pt_BR.po  |  46 +++++++--
 .../todolist/languages/todoliststrconsts.ru.po     |  40 ++++++--
 .../todolist/languages/todoliststrconsts.uk.po     |  37 +++++--
 components/todolist/todolist.lfm                   | 111 ++++++++++++++++-----
 components/todolist/todolist.pas                   | 109 ++++++++++++++++----
 components/todolist/todolistlaz.lpk                |  10 +-
 components/todolist/todoliststrconsts.pas          |  11 +-
 18 files changed, 601 insertions(+), 139 deletions(-)

diff --git a/components/ideintf/docs/lazideintf.xml b/components/ideintf/docs/lazideintf.xml
index f55329b..c67f8c4 100644
--- a/components/ideintf/docs/lazideintf.xml
+++ b/components/ideintf/docs/lazideintf.xml
@@ -6,10 +6,14 @@
         <short>Searches the file name of a unit</short>
         <descr>If TheOwner is nil the current project is searched. TheOwner can be a project, a package or LazarusIDE. The unit is searched in the unit search path of the the base directory using the codetools unit search rules. It will find units of used packages too, the unit name is case insensitive and the normal extensions .pas, .pp are tried. In case of LazarusIDE it will search in all open packages. If the AFileName contains an extension it will also search in the files listed in the project inspector. It returns the empty string if not found. If the file name is not absolute the file was not newly created and not yet saved to disk.</descr>
       </element>
-    <element name="TLazIDEInterface.FindUnitsOfOwner"><short>Find units of project/package</short><descr>fuooListed: For a project add the units listed in the project inspector (.lpi). For a package add the units listed in the package editor. With fuooPackages this works recursively for all used packages as well.
+      <element name="TLazIDEInterface.FindUnitsOfOwner">
+        <short>Find units of project/package</short>
+        <descr>fuooListed: For a project add the units listed in the project inspector (.lpi). For a package add the units listed in the package editor. With fuooPackages this works recursively for all used packages as well.
 
 fuooUsed: Parse the project/package sources recursively and add all used units. Without fuooPackages units from packages are not added.
 
+fuooPackages: Extends fuooListed and fuooUsed by units from used packages.
+
 fuooSourceEditor: Add units in source editor.</descr>
       </element>
     </module>
diff --git a/components/todolist/languages/todoliststrconsts.cs.po b/components/todolist/languages/todoliststrconsts.cs.po
index 5b001d0..ab651dc 100644
--- a/components/todolist/languages/todoliststrconsts.cs.po
+++ b/components/todolist/languages/todoliststrconsts.cs.po
@@ -18,20 +18,29 @@ msgstr ""
 msgid "Refresh"
 msgstr "Obnovit"
 
-#: todoliststrconsts.lisaddunitsinsourceeditor
-msgid "Add units in source editor"
-msgstr ""
-
 #: todoliststrconsts.lisctinsertmacro
 msgid "Insert Macro"
 msgstr "Vložit makro"
 
+#: todoliststrconsts.lispackages
+msgid "Packages"
+msgstr ""
+
+#: todoliststrconsts.lispackageshint
+msgid "Extends \"%s\" and \"%s\" options by units from used packages"
+msgstr ""
+
 #: todoliststrconsts.lispkgfiletypetext
 msgid "Text"
 msgstr "Text"
 
-#: todoliststrconsts.lissearchtodosinsourceeditorunitsaswell
-msgid "Search todos in source editor units as well"
+#: todoliststrconsts.lissourceeditor
+msgid "Editor"
+msgstr ""
+
+#: todoliststrconsts.lissourceeditorhint
+msgctxt "todoliststrconsts.lissourceeditorhint"
+msgid "Add units in source editor"
 msgstr ""
 
 #: todoliststrconsts.listddinserttodo
@@ -62,6 +71,14 @@ msgstr "Modul"
 msgid "ToDo List"
 msgstr "Seznam úkolů"
 
+#: todoliststrconsts.listodolisted
+msgid "Listed"
+msgstr ""
+
+#: todoliststrconsts.listodolistedhint
+msgid "Add units listed in lpi/lpk aka project inspector/package editor"
+msgstr ""
+
 #: todoliststrconsts.listodolistgotoline
 msgid "Goto selected source line"
 msgstr "Přeskočí na umístění úkolu ve zdroji"
@@ -82,6 +99,14 @@ msgstr "Vlastník"
 msgid "Priority"
 msgstr "Priorita"
 
+#: todoliststrconsts.listodoused
+msgid "Used"
+msgstr ""
+
+#: todoliststrconsts.listodousedhint
+msgid "Add units used by main source file"
+msgstr ""
+
 #: todoliststrconsts.listtodolcategory
 msgid "Category"
 msgstr "Kategorie"
diff --git a/components/todolist/languages/todoliststrconsts.de.po b/components/todolist/languages/todoliststrconsts.de.po
index 1fa5b5c..9b4d677 100644
--- a/components/todolist/languages/todoliststrconsts.de.po
+++ b/components/todolist/languages/todoliststrconsts.de.po
@@ -18,20 +18,29 @@ msgstr ""
 msgid "Refresh"
 msgstr "Aktualisieren"
 
-#: todoliststrconsts.lisaddunitsinsourceeditor
-msgid "Add units in source editor"
-msgstr ""
-
 #: todoliststrconsts.lisctinsertmacro
 msgid "Insert Macro"
 msgstr "Makro einfügen"
 
+#: todoliststrconsts.lispackages
+msgid "Packages"
+msgstr ""
+
+#: todoliststrconsts.lispackageshint
+msgid "Extends \"%s\" and \"%s\" options by units from used packages"
+msgstr ""
+
 #: todoliststrconsts.lispkgfiletypetext
 msgid "Text"
 msgstr "Text"
 
-#: todoliststrconsts.lissearchtodosinsourceeditorunitsaswell
-msgid "Search todos in source editor units as well"
+#: todoliststrconsts.lissourceeditor
+msgid "Editor"
+msgstr ""
+
+#: todoliststrconsts.lissourceeditorhint
+msgctxt "todoliststrconsts.lissourceeditorhint"
+msgid "Add units in source editor"
 msgstr ""
 
 #: todoliststrconsts.listddinserttodo
@@ -62,6 +71,14 @@ msgstr "Modul"
 msgid "ToDo List"
 msgstr "ToDo-Liste"
 
+#: todoliststrconsts.listodolisted
+msgid "Listed"
+msgstr ""
+
+#: todoliststrconsts.listodolistedhint
+msgid "Add units listed in lpi/lpk aka project inspector/package editor"
+msgstr ""
+
 #: todoliststrconsts.listodolistgotoline
 msgid "Goto selected source line"
 msgstr "Zur gewählten Quelltextzeile springen"
@@ -82,6 +99,14 @@ msgstr "Eigentümer"
 msgid "Priority"
 msgstr "Priorität"
 
+#: todoliststrconsts.listodoused
+msgid "Used"
+msgstr ""
+
+#: todoliststrconsts.listodousedhint
+msgid "Add units used by main source file"
+msgstr ""
+
 #: todoliststrconsts.listtodolcategory
 msgid "Category"
 msgstr "Kategorie"
diff --git a/components/todolist/languages/todoliststrconsts.es.po b/components/todolist/languages/todoliststrconsts.es.po
index 3fcdd3c..6e41ced 100644
--- a/components/todolist/languages/todoliststrconsts.es.po
+++ b/components/todolist/languages/todoliststrconsts.es.po
@@ -17,20 +17,29 @@ msgstr ""
 msgid "Refresh"
 msgstr "Actualizar"
 
-#: todoliststrconsts.lisaddunitsinsourceeditor
-msgid "Add units in source editor"
-msgstr ""
-
 #: todoliststrconsts.lisctinsertmacro
 msgid "Insert Macro"
 msgstr "Insertar Macro"
 
+#: todoliststrconsts.lispackages
+msgid "Packages"
+msgstr ""
+
+#: todoliststrconsts.lispackageshint
+msgid "Extends \"%s\" and \"%s\" options by units from used packages"
+msgstr ""
+
 #: todoliststrconsts.lispkgfiletypetext
 msgid "Text"
 msgstr "Texto"
 
-#: todoliststrconsts.lissearchtodosinsourceeditorunitsaswell
-msgid "Search todos in source editor units as well"
+#: todoliststrconsts.lissourceeditor
+msgid "Editor"
+msgstr ""
+
+#: todoliststrconsts.lissourceeditorhint
+msgctxt "todoliststrconsts.lissourceeditorhint"
+msgid "Add units in source editor"
 msgstr ""
 
 #: todoliststrconsts.listddinserttodo
@@ -61,6 +70,14 @@ msgstr "Módulo"
 msgid "ToDo List"
 msgstr "Lista ToDo"
 
+#: todoliststrconsts.listodolisted
+msgid "Listed"
+msgstr ""
+
+#: todoliststrconsts.listodolistedhint
+msgid "Add units listed in lpi/lpk aka project inspector/package editor"
+msgstr ""
+
 #: todoliststrconsts.listodolistgotoline
 msgid "Goto selected source line"
 msgstr "Ir a línea seleccionada de codigo fuente"
@@ -81,6 +98,14 @@ msgstr "Propietario"
 msgid "Priority"
 msgstr "Prioridad"
 
+#: todoliststrconsts.listodoused
+msgid "Used"
+msgstr ""
+
+#: todoliststrconsts.listodousedhint
+msgid "Add units used by main source file"
+msgstr ""
+
 #: todoliststrconsts.listtodolcategory
 msgid "Category"
 msgstr "Categoría"
diff --git a/components/todolist/languages/todoliststrconsts.fi.po b/components/todolist/languages/todoliststrconsts.fi.po
index 65af3df..d1db0bd 100644
--- a/components/todolist/languages/todoliststrconsts.fi.po
+++ b/components/todolist/languages/todoliststrconsts.fi.po
@@ -9,20 +9,29 @@ msgstr "CSV tiedostot"
 msgid "Refresh"
 msgstr "Päivitä"
 
-#: todoliststrconsts.lisaddunitsinsourceeditor
-msgid "Add units in source editor"
-msgstr ""
-
 #: todoliststrconsts.lisctinsertmacro
 msgid "Insert Macro"
 msgstr "Lisää Makro"
 
+#: todoliststrconsts.lispackages
+msgid "Packages"
+msgstr ""
+
+#: todoliststrconsts.lispackageshint
+msgid "Extends \"%s\" and \"%s\" options by units from used packages"
+msgstr ""
+
 #: todoliststrconsts.lispkgfiletypetext
 msgid "Text"
 msgstr "Teksti"
 
-#: todoliststrconsts.lissearchtodosinsourceeditorunitsaswell
-msgid "Search todos in source editor units as well"
+#: todoliststrconsts.lissourceeditor
+msgid "Editor"
+msgstr ""
+
+#: todoliststrconsts.lissourceeditorhint
+msgctxt "todoliststrconsts.lissourceeditorhint"
+msgid "Add units in source editor"
 msgstr ""
 
 #: todoliststrconsts.listddinserttodo
@@ -53,6 +62,14 @@ msgstr "Moduuli"
 msgid "ToDo List"
 msgstr "ToDo luettelo"
 
+#: todoliststrconsts.listodolisted
+msgid "Listed"
+msgstr ""
+
+#: todoliststrconsts.listodolistedhint
+msgid "Add units listed in lpi/lpk aka project inspector/package editor"
+msgstr ""
+
 #: todoliststrconsts.listodolistgotoline
 msgid "Goto selected source line"
 msgstr "Mene valitulle lähderiville"
@@ -73,6 +90,14 @@ msgstr "Omistaja"
 msgid "Priority"
 msgstr "Tärkeys"
 
+#: todoliststrconsts.listodoused
+msgid "Used"
+msgstr ""
+
+#: todoliststrconsts.listodousedhint
+msgid "Add units used by main source file"
+msgstr ""
+
 #: todoliststrconsts.listtodolcategory
 msgid "Category"
 msgstr "Luokka"
diff --git a/components/todolist/languages/todoliststrconsts.fr.po b/components/todolist/languages/todoliststrconsts.fr.po
index 4709276..ca3c5f1 100644
--- a/components/todolist/languages/todoliststrconsts.fr.po
+++ b/components/todolist/languages/todoliststrconsts.fr.po
@@ -19,20 +19,29 @@ msgstr "Fichier CSV"
 msgid "Refresh"
 msgstr "Rafraîchir"
 
-#: todoliststrconsts.lisaddunitsinsourceeditor
-msgid "Add units in source editor"
-msgstr ""
-
 #: todoliststrconsts.lisctinsertmacro
 msgid "Insert Macro"
 msgstr "Insérer une macro"
 
+#: todoliststrconsts.lispackages
+msgid "Packages"
+msgstr ""
+
+#: todoliststrconsts.lispackageshint
+msgid "Extends \"%s\" and \"%s\" options by units from used packages"
+msgstr ""
+
 #: todoliststrconsts.lispkgfiletypetext
 msgid "Text"
 msgstr "Texte"
 
-#: todoliststrconsts.lissearchtodosinsourceeditorunitsaswell
-msgid "Search todos in source editor units as well"
+#: todoliststrconsts.lissourceeditor
+msgid "Editor"
+msgstr ""
+
+#: todoliststrconsts.lissourceeditorhint
+msgctxt "todoliststrconsts.lissourceeditorhint"
+msgid "Add units in source editor"
 msgstr ""
 
 #: todoliststrconsts.listddinserttodo
@@ -63,6 +72,14 @@ msgstr "Module"
 msgid "ToDo List"
 msgstr "Pense-bête"
 
+#: todoliststrconsts.listodolisted
+msgid "Listed"
+msgstr ""
+
+#: todoliststrconsts.listodolistedhint
+msgid "Add units listed in lpi/lpk aka project inspector/package editor"
+msgstr ""
+
 #: todoliststrconsts.listodolistgotoline
 msgid "Goto selected source line"
 msgstr "Aller à la ligne du code source sélectionné"
@@ -83,6 +100,14 @@ msgstr "Propriétaire"
 msgid "Priority"
 msgstr "Priorité"
 
+#: todoliststrconsts.listodoused
+msgid "Used"
+msgstr ""
+
+#: todoliststrconsts.listodousedhint
+msgid "Add units used by main source file"
+msgstr ""
+
 #: todoliststrconsts.listtodolcategory
 msgid "Category"
 msgstr "Catégorie"
diff --git a/components/todolist/languages/todoliststrconsts.hu.po b/components/todolist/languages/todoliststrconsts.hu.po
index faf6406..98ddd4c 100644
--- a/components/todolist/languages/todoliststrconsts.hu.po
+++ b/components/todolist/languages/todoliststrconsts.hu.po
@@ -19,20 +19,29 @@ msgstr "CSV fájlok"
 msgid "Refresh"
 msgstr "Frissítés"
 
-#: todoliststrconsts.lisaddunitsinsourceeditor
-msgid "Add units in source editor"
-msgstr ""
-
 #: todoliststrconsts.lisctinsertmacro
 msgid "Insert Macro"
 msgstr "Makró beszúrása"
 
+#: todoliststrconsts.lispackages
+msgid "Packages"
+msgstr ""
+
+#: todoliststrconsts.lispackageshint
+msgid "Extends \"%s\" and \"%s\" options by units from used packages"
+msgstr ""
+
 #: todoliststrconsts.lispkgfiletypetext
 msgid "Text"
 msgstr "Szöveg"
 
-#: todoliststrconsts.lissearchtodosinsourceeditorunitsaswell
-msgid "Search todos in source editor units as well"
+#: todoliststrconsts.lissourceeditor
+msgid "Editor"
+msgstr ""
+
+#: todoliststrconsts.lissourceeditorhint
+msgctxt "todoliststrconsts.lissourceeditorhint"
+msgid "Add units in source editor"
 msgstr ""
 
 #: todoliststrconsts.listddinserttodo
@@ -63,6 +72,14 @@ msgstr "Modul"
 msgid "ToDo List"
 msgstr "ToDo lista"
 
+#: todoliststrconsts.listodolisted
+msgid "Listed"
+msgstr ""
+
+#: todoliststrconsts.listodolistedhint
+msgid "Add units listed in lpi/lpk aka project inspector/package editor"
+msgstr ""
+
 #: todoliststrconsts.listodolistgotoline
 msgid "Goto selected source line"
 msgstr "Ugrás a forrás kiválasztott sorára"
@@ -83,6 +100,14 @@ msgstr "Tulajdonos"
 msgid "Priority"
 msgstr "Prioritás"
 
+#: todoliststrconsts.listodoused
+msgid "Used"
+msgstr ""
+
+#: todoliststrconsts.listodousedhint
+msgid "Add units used by main source file"
+msgstr ""
+
 #: todoliststrconsts.listtodolcategory
 msgid "Category"
 msgstr "Kategória"
diff --git a/components/todolist/languages/todoliststrconsts.it.po b/components/todolist/languages/todoliststrconsts.it.po
index 0afb090..22f9ede 100644
--- a/components/todolist/languages/todoliststrconsts.it.po
+++ b/components/todolist/languages/todoliststrconsts.it.po
@@ -20,20 +20,29 @@ msgstr ""
 msgid "Refresh"
 msgstr "Aggiorna"
 
-#: todoliststrconsts.lisaddunitsinsourceeditor
-msgid "Add units in source editor"
-msgstr ""
-
 #: todoliststrconsts.lisctinsertmacro
 msgid "Insert Macro"
 msgstr "Inserisci Macro"
 
+#: todoliststrconsts.lispackages
+msgid "Packages"
+msgstr ""
+
+#: todoliststrconsts.lispackageshint
+msgid "Extends \"%s\" and \"%s\" options by units from used packages"
+msgstr ""
+
 #: todoliststrconsts.lispkgfiletypetext
 msgid "Text"
 msgstr "Testo"
 
-#: todoliststrconsts.lissearchtodosinsourceeditorunitsaswell
-msgid "Search todos in source editor units as well"
+#: todoliststrconsts.lissourceeditor
+msgid "Editor"
+msgstr ""
+
+#: todoliststrconsts.lissourceeditorhint
+msgctxt "todoliststrconsts.lissourceeditorhint"
+msgid "Add units in source editor"
 msgstr ""
 
 #: todoliststrconsts.listddinserttodo
@@ -64,6 +73,14 @@ msgstr "Modulo"
 msgid "ToDo List"
 msgstr "lista ToDo"
 
+#: todoliststrconsts.listodolisted
+msgid "Listed"
+msgstr ""
+
+#: todoliststrconsts.listodolistedhint
+msgid "Add units listed in lpi/lpk aka project inspector/package editor"
+msgstr ""
+
 #: todoliststrconsts.listodolistgotoline
 msgid "Goto selected source line"
 msgstr "Vai alla riga di codice selezionata"
@@ -84,6 +101,14 @@ msgstr "Proprietario"
 msgid "Priority"
 msgstr "Priorità"
 
+#: todoliststrconsts.listodoused
+msgid "Used"
+msgstr ""
+
+#: todoliststrconsts.listodousedhint
+msgid "Add units used by main source file"
+msgstr ""
+
 #: todoliststrconsts.listtodolcategory
 msgid "Category"
 msgstr "Categoria"
diff --git a/components/todolist/languages/todoliststrconsts.lt.po b/components/todolist/languages/todoliststrconsts.lt.po
index 27353d4..235aab5 100644
--- a/components/todolist/languages/todoliststrconsts.lt.po
+++ b/components/todolist/languages/todoliststrconsts.lt.po
@@ -19,20 +19,29 @@ msgstr ""
 msgid "Refresh"
 msgstr "Atnaujinti"
 
-#: todoliststrconsts.lisaddunitsinsourceeditor
-msgid "Add units in source editor"
-msgstr ""
-
 #: todoliststrconsts.lisctinsertmacro
 msgid "Insert Macro"
 msgstr "Įterpti makrokomandą"
 
+#: todoliststrconsts.lispackages
+msgid "Packages"
+msgstr ""
+
+#: todoliststrconsts.lispackageshint
+msgid "Extends \"%s\" and \"%s\" options by units from used packages"
+msgstr ""
+
 #: todoliststrconsts.lispkgfiletypetext
 msgid "Text"
 msgstr "Tekstas"
 
-#: todoliststrconsts.lissearchtodosinsourceeditorunitsaswell
-msgid "Search todos in source editor units as well"
+#: todoliststrconsts.lissourceeditor
+msgid "Editor"
+msgstr ""
+
+#: todoliststrconsts.lissourceeditorhint
+msgctxt "todoliststrconsts.lissourceeditorhint"
+msgid "Add units in source editor"
 msgstr ""
 
 #: todoliststrconsts.listddinserttodo
@@ -63,6 +72,14 @@ msgstr "Modulis"
 msgid "ToDo List"
 msgstr "ToDo sąrašas"
 
+#: todoliststrconsts.listodolisted
+msgid "Listed"
+msgstr ""
+
+#: todoliststrconsts.listodolistedhint
+msgid "Add units listed in lpi/lpk aka project inspector/package editor"
+msgstr ""
+
 #: todoliststrconsts.listodolistgotoline
 msgid "Goto selected source line"
 msgstr "Rodyti eilutę pirminiame kode"
@@ -83,6 +100,14 @@ msgstr "Savininkas"
 msgid "Priority"
 msgstr "Prioritetas"
 
+#: todoliststrconsts.listodoused
+msgid "Used"
+msgstr ""
+
+#: todoliststrconsts.listodousedhint
+msgid "Add units used by main source file"
+msgstr ""
+
 #: todoliststrconsts.listtodolcategory
 msgid "Category"
 msgstr "Kategorija"
diff --git a/components/todolist/languages/todoliststrconsts.pl.po b/components/todolist/languages/todoliststrconsts.pl.po
index 7133f81..972ba12 100644
--- a/components/todolist/languages/todoliststrconsts.pl.po
+++ b/components/todolist/languages/todoliststrconsts.pl.po
@@ -20,20 +20,29 @@ msgstr ""
 msgid "Refresh"
 msgstr "Odśwież"
 
-#: todoliststrconsts.lisaddunitsinsourceeditor
-msgid "Add units in source editor"
-msgstr ""
-
 #: todoliststrconsts.lisctinsertmacro
 msgid "Insert Macro"
 msgstr "Wstaw Makro"
 
+#: todoliststrconsts.lispackages
+msgid "Packages"
+msgstr ""
+
+#: todoliststrconsts.lispackageshint
+msgid "Extends \"%s\" and \"%s\" options by units from used packages"
+msgstr ""
+
 #: todoliststrconsts.lispkgfiletypetext
 msgid "Text"
 msgstr "Tekst"
 
-#: todoliststrconsts.lissearchtodosinsourceeditorunitsaswell
-msgid "Search todos in source editor units as well"
+#: todoliststrconsts.lissourceeditor
+msgid "Editor"
+msgstr ""
+
+#: todoliststrconsts.lissourceeditorhint
+msgctxt "todoliststrconsts.lissourceeditorhint"
+msgid "Add units in source editor"
 msgstr ""
 
 #: todoliststrconsts.listddinserttodo
@@ -66,6 +75,14 @@ msgstr "Moduł"
 msgid "ToDo List"
 msgstr "Lista \"Do zrobienia\""
 
+#: todoliststrconsts.listodolisted
+msgid "Listed"
+msgstr ""
+
+#: todoliststrconsts.listodolistedhint
+msgid "Add units listed in lpi/lpk aka project inspector/package editor"
+msgstr ""
+
 #: todoliststrconsts.listodolistgotoline
 msgid "Goto selected source line"
 msgstr "Idź do wybranej linii źródła"
@@ -86,6 +103,14 @@ msgstr "Właściciel"
 msgid "Priority"
 msgstr "Priorytet"
 
+#: todoliststrconsts.listodoused
+msgid "Used"
+msgstr ""
+
+#: todoliststrconsts.listodousedhint
+msgid "Add units used by main source file"
+msgstr ""
+
 #: todoliststrconsts.listtodolcategory
 msgid "Category"
 msgstr "Kategoria"
diff --git a/components/todolist/languages/todoliststrconsts.po b/components/todolist/languages/todoliststrconsts.po
index 1555716..076f650 100644
--- a/components/todolist/languages/todoliststrconsts.po
+++ b/components/todolist/languages/todoliststrconsts.po
@@ -9,20 +9,29 @@ msgstr ""
 msgid "Refresh"
 msgstr ""
 
-#: todoliststrconsts.lisaddunitsinsourceeditor
-msgid "Add units in source editor"
-msgstr ""
-
 #: todoliststrconsts.lisctinsertmacro
 msgid "Insert Macro"
 msgstr ""
 
+#: todoliststrconsts.lispackages
+msgid "Packages"
+msgstr ""
+
+#: todoliststrconsts.lispackageshint
+msgid "Extends \"%s\" and \"%s\" options by units from used packages"
+msgstr ""
+
 #: todoliststrconsts.lispkgfiletypetext
 msgid "Text"
 msgstr ""
 
-#: todoliststrconsts.lissearchtodosinsourceeditorunitsaswell
-msgid "Search todos in source editor units as well"
+#: todoliststrconsts.lissourceeditor
+msgid "Editor"
+msgstr ""
+
+#: todoliststrconsts.lissourceeditorhint
+msgctxt "todoliststrconsts.lissourceeditorhint"
+msgid "Add units in source editor"
 msgstr ""
 
 #: todoliststrconsts.listddinserttodo
@@ -53,6 +62,14 @@ msgstr ""
 msgid "ToDo List"
 msgstr ""
 
+#: todoliststrconsts.listodolisted
+msgid "Listed"
+msgstr ""
+
+#: todoliststrconsts.listodolistedhint
+msgid "Add units listed in lpi/lpk aka project inspector/package editor"
+msgstr ""
+
 #: todoliststrconsts.listodolistgotoline
 msgid "Goto selected source line"
 msgstr ""
@@ -73,6 +90,14 @@ msgstr ""
 msgid "Priority"
 msgstr ""
 
+#: todoliststrconsts.listodoused
+msgid "Used"
+msgstr ""
+
+#: todoliststrconsts.listodousedhint
+msgid "Add units used by main source file"
+msgstr ""
+
 #: todoliststrconsts.listtodolcategory
 msgid "Category"
 msgstr ""
diff --git a/components/todolist/languages/todoliststrconsts.pt_BR.po b/components/todolist/languages/todoliststrconsts.pt_BR.po
index 3ef33dc..d12a1f6 100644
--- a/components/todolist/languages/todoliststrconsts.pt_BR.po
+++ b/components/todolist/languages/todoliststrconsts.pt_BR.po
@@ -4,34 +4,45 @@ msgstr ""
 "Project-Id-Version: \n"
 "POT-Creation-Date: \n"
 "PO-Revision-Date: \n"
-"Last-Translator: Marcelo Borges de Paula\n"
+"Last-Translator: Silvio Clecio\n"
 "Language-Team: \n"
 "MIME-Version: 1.0\n"
 "Content-Transfer-Encoding: 8bit\n"
+"Language: pt_BR\n"
+"X-Generator: Poedit 1.8.7.1\n"
 
 #: todoliststrconsts.dlgfiltercsv
 msgid "CSV files"
-msgstr ""
+msgstr "Arquivos CSV"
 
 #: todoliststrconsts.dlgunitdeprefresh
 msgid "Refresh"
 msgstr "Atualizar"
 
-#: todoliststrconsts.lisaddunitsinsourceeditor
-msgid "Add units in source editor"
-msgstr ""
-
 #: todoliststrconsts.lisctinsertmacro
 msgid "Insert Macro"
 msgstr "Inserir Macro"
 
+#: todoliststrconsts.lispackages
+msgid "Packages"
+msgstr "Pacotes"
+
+#: todoliststrconsts.lispackageshint
+msgid "Extends \"%s\" and \"%s\" options by units from used packages"
+msgstr "Estende opções \"%s\" e \"%s\" por unidades de pacotes usados"
+
 #: todoliststrconsts.lispkgfiletypetext
 msgid "Text"
 msgstr "Texto"
 
-#: todoliststrconsts.lissearchtodosinsourceeditorunitsaswell
-msgid "Search todos in source editor units as well"
-msgstr ""
+#: todoliststrconsts.lissourceeditor
+msgid "Editor"
+msgstr "Editor"
+
+#: todoliststrconsts.lissourceeditorhint
+msgctxt "todoliststrconsts.lissourceeditorhint"
+msgid "Add units in source editor"
+msgstr "Adiciona unidades no editor de código"
 
 #: todoliststrconsts.listddinserttodo
 msgid "Insert ToDo"
@@ -63,6 +74,14 @@ msgstr "Módulo"
 msgid "ToDo List"
 msgstr "Lista \"ToDo\" (à fazer)"
 
+#: todoliststrconsts.listodolisted
+msgid "Listed"
+msgstr "Listado"
+
+#: todoliststrconsts.listodolistedhint
+msgid "Add units listed in lpi/lpk aka project inspector/package editor"
+msgstr "Adiciona unidades listadas em lpi/lpk a.k.a inspetor de projeto/editor de pacotes"
+
 #: todoliststrconsts.listodolistgotoline
 msgid "Goto selected source line"
 msgstr "Ir para linha do fonte selecionada"
@@ -83,6 +102,14 @@ msgstr "Proprietário"
 msgid "Priority"
 msgstr "Prioridade"
 
+#: todoliststrconsts.listodoused
+msgid "Used"
+msgstr "Usado"
+
+#: todoliststrconsts.listodousedhint
+msgid "Add units used by main source file"
+msgstr "Adiciona unidades usadas pelo código fonte principal"
+
 #: todoliststrconsts.listtodolcategory
 msgid "Category"
 msgstr "Categoria"
@@ -92,4 +119,3 @@ msgstr "Categoria"
 #| msgid "View ToDo list"
 msgid "View ToDo List"
 msgstr "Exibir lista \"ToDo\" (à fazer)"
-
diff --git a/components/todolist/languages/todoliststrconsts.ru.po b/components/todolist/languages/todoliststrconsts.ru.po
index d6c1550..f6b4c6b 100644
--- a/components/todolist/languages/todoliststrconsts.ru.po
+++ b/components/todolist/languages/todoliststrconsts.ru.po
@@ -19,21 +19,31 @@ msgstr "Файлы CSV"
 msgid "Refresh"
 msgstr "Обновить"
 
-#: todoliststrconsts.lisaddunitsinsourceeditor
-msgid "Add units in source editor"
-msgstr "Добавить модули из редактора исходного кода"
-
 #: todoliststrconsts.lisctinsertmacro
 msgid "Insert Macro"
 msgstr "Вставить макрос"
 
+#: todoliststrconsts.lispackages
+msgid "Packages"
+msgstr ""
+
+#: todoliststrconsts.lispackageshint
+msgid "Extends \"%s\" and \"%s\" options by units from used packages"
+msgstr ""
+
 #: todoliststrconsts.lispkgfiletypetext
 msgid "Text"
 msgstr "Текст"
 
-#: todoliststrconsts.lissearchtodosinsourceeditorunitsaswell
-msgid "Search todos in source editor units as well"
-msgstr "Искать элементы ToDo также в модулях, открытых в редакторе исходного кода"
+#: todoliststrconsts.lissourceeditor
+msgid "Editor"
+msgstr ""
+
+#: todoliststrconsts.lissourceeditorhint
+#, fuzzy
+msgctxt "todoliststrconsts.lissourceeditorhint"
+msgid "Add units in source editor"
+msgstr "Добавить модули из редактора исходного кода"
 
 #: todoliststrconsts.listddinserttodo
 msgid "Insert ToDo"
@@ -63,6 +73,14 @@ msgstr "Модуль"
 msgid "ToDo List"
 msgstr "Список ToDo"
 
+#: todoliststrconsts.listodolisted
+msgid "Listed"
+msgstr ""
+
+#: todoliststrconsts.listodolistedhint
+msgid "Add units listed in lpi/lpk aka project inspector/package editor"
+msgstr ""
+
 #: todoliststrconsts.listodolistgotoline
 msgid "Goto selected source line"
 msgstr "Перейти к выделенной строке исходного кода"
@@ -83,6 +101,14 @@ msgstr "Владелец"
 msgid "Priority"
 msgstr "Приоритет"
 
+#: todoliststrconsts.listodoused
+msgid "Used"
+msgstr ""
+
+#: todoliststrconsts.listodousedhint
+msgid "Add units used by main source file"
+msgstr ""
+
 #: todoliststrconsts.listtodolcategory
 msgid "Category"
 msgstr "Категория"
diff --git a/components/todolist/languages/todoliststrconsts.uk.po b/components/todolist/languages/todoliststrconsts.uk.po
index bae89c3..2668bf2 100644
--- a/components/todolist/languages/todoliststrconsts.uk.po
+++ b/components/todolist/languages/todoliststrconsts.uk.po
@@ -20,20 +20,29 @@ msgstr "Файли CSV"
 msgid "Refresh"
 msgstr "Оновити"
 
-#: todoliststrconsts.lisaddunitsinsourceeditor
-msgid "Add units in source editor"
-msgstr ""
-
 #: todoliststrconsts.lisctinsertmacro
 msgid "Insert Macro"
 msgstr "Вставити макрос"
 
+#: todoliststrconsts.lispackages
+msgid "Packages"
+msgstr ""
+
+#: todoliststrconsts.lispackageshint
+msgid "Extends \"%s\" and \"%s\" options by units from used packages"
+msgstr ""
+
 #: todoliststrconsts.lispkgfiletypetext
 msgid "Text"
 msgstr "Текст"
 
-#: todoliststrconsts.lissearchtodosinsourceeditorunitsaswell
-msgid "Search todos in source editor units as well"
+#: todoliststrconsts.lissourceeditor
+msgid "Editor"
+msgstr ""
+
+#: todoliststrconsts.lissourceeditorhint
+msgctxt "todoliststrconsts.lissourceeditorhint"
+msgid "Add units in source editor"
 msgstr ""
 
 #: todoliststrconsts.listddinserttodo
@@ -64,6 +73,14 @@ msgstr "Модуль"
 msgid "ToDo List"
 msgstr "Список ToDo"
 
+#: todoliststrconsts.listodolisted
+msgid "Listed"
+msgstr ""
+
+#: todoliststrconsts.listodolistedhint
+msgid "Add units listed in lpi/lpk aka project inspector/package editor"
+msgstr ""
+
 #: todoliststrconsts.listodolistgotoline
 msgid "Goto selected source line"
 msgstr "Перейти до вибраного рядка сирців"
@@ -84,6 +101,14 @@ msgstr "Власник"
 msgid "Priority"
 msgstr "Пріоритет"
 
+#: todoliststrconsts.listodoused
+msgid "Used"
+msgstr ""
+
+#: todoliststrconsts.listodousedhint
+msgid "Add units used by main source file"
+msgstr ""
+
 #: todoliststrconsts.listtodolcategory
 msgid "Category"
 msgstr "Категорія"
diff --git a/components/todolist/todolist.lfm b/components/todolist/todolist.lfm
index 0f0f2f6..d1f9f3c 100644
--- a/components/todolist/todolist.lfm
+++ b/components/todolist/todolist.lfm
@@ -1,21 +1,23 @@
 object IDETodoWindow: TIDETodoWindow
   Left = 415
   Height = 300
-  Top = 429
+  Top = 398
   Width = 837
   ActiveControl = lvTodo
   Caption = 'IDETodoWindow'
   ClientHeight = 300
   ClientWidth = 837
   KeyPreview = True
+  OnCloseQuery = FormCloseQuery
   OnCreate = FormCreate
   OnKeyDown = FormKeyDown
   OnShow = FormShow
   Position = poScreenCenter
+  SessionProperties = 'chkListed.Checked;chkUsed.Checked;chkSourceEditor.Checked;chkPackages.Checked'
   LCLVersion = '1.7'
   object lvTodo: TListView
     Left = 6
-    Height = 206
+    Height = 207
     Top = 54
     Width = 825
     Align = alClient
@@ -51,7 +53,7 @@ object IDETodoWindow: TIDETodoWindow
     RowSelect = True
     ScrollBars = ssAutoBoth
     SortType = stText
-    TabOrder = 0
+    TabOrder = 1
     ViewStyle = vsReport
     OnClick = lvTodoClick
     OnColumnClick = lvTodoColumnClick
@@ -69,7 +71,7 @@ object IDETodoWindow: TIDETodoWindow
     ParentShowHint = False
     ShowCaptions = True
     ShowHint = True
-    TabOrder = 1
+    TabOrder = 0
     object tbRefresh: TToolButton
       Left = 1
       Top = 2
@@ -77,37 +79,87 @@ object IDETodoWindow: TIDETodoWindow
       AutoSize = True
     end
     object tbGoto: TToolButton
-      Left = 53
+      Left = 52
       Top = 2
       Action = acGoto
       AutoSize = True
     end
     object tbExport: TToolButton
-      Left = 100
+      Left = 99
       Top = 2
       Action = acExport
       AutoSize = True
     end
-    object ToolButton1: TToolButton
-      Left = 147
+    object N1: TToolButton
+      Left = 146
       Height = 46
       Top = 2
-      Width = 8
-      Caption = 'ToolButton1'
-      Style = tbsSeparator
+      Width = 5
+      Caption = 'N1'
+      Style = tbsDivider
     end
-    object tbAddSrcEdit: TToolButton
-      Left = 155
+    object grbOptions: TGroupBox
+      Left = 151
+      Height = 40
       Top = 2
-      Caption = 'Add source editor units'
-      OnClick = tbAddSrcEditClick
-      Style = tbsCheck
+      Width = 244
+      AutoSize = True
+      Caption = 'Options'
+      ClientHeight = 21
+      ClientWidth = 240
+      TabOrder = 0
+      object chkListed: TCheckBox
+        Left = 0
+        Height = 21
+        Top = 0
+        Width = 56
+        Align = alLeft
+        Caption = '&Listed'
+        Checked = True
+        OnChange = chkListedChange
+        State = cbChecked
+        TabOrder = 0
+      end
+      object chkUsed: TCheckBox
+        Left = 56
+        Height = 21
+        Top = 0
+        Width = 52
+        Align = alLeft
+        Caption = '&Used'
+        Checked = True
+        OnChange = chkUsedChange
+        State = cbChecked
+        TabOrder = 1
+      end
+      object chkSourceEditor: TCheckBox
+        Left = 108
+        Height = 21
+        Top = 0
+        Width = 56
+        Align = alLeft
+        Caption = 'Editor'
+        Checked = True
+        OnChange = chkSourceEditorChange
+        State = cbChecked
+        TabOrder = 2
+      end
+      object chkPackages: TCheckBox
+        Left = 164
+        Height = 21
+        Top = 0
+        Width = 76
+        Align = alLeft
+        Caption = '&Packages'
+        OnChange = chkPackagesChange
+        TabOrder = 3
+      end
     end
   end
-  object ButtonPanel1: TButtonPanel
+  object ButtonPanel: TButtonPanel
     Left = 6
-    Height = 28
-    Top = 266
+    Height = 27
+    Top = 267
     Width = 825
     OKButton.Name = 'OKButton'
     OKButton.DefaultCaption = True
@@ -123,8 +175,8 @@ object IDETodoWindow: TIDETodoWindow
     ShowBevel = False
   end
   object ActionList: TActionList
-    left = 368
-    top = 11
+    Left = 368
+    Top = 11
     object acGoto: TAction
       Caption = 'Goto'
       OnExecute = acGotoExecute
@@ -138,12 +190,21 @@ object IDETodoWindow: TIDETodoWindow
       OnExecute = acExportExecute
     end
   end
-  object SaveDialog1: TSaveDialog
-    OnShow = SaveDialog1Show
+  object SaveDialog: TSaveDialog
+    OnShow = SaveDialogShow
     DefaultExt = '.csv'
     Filter = 'csv|*.csv'
     Options = [ofCreatePrompt, ofEnableSizing, ofViewDetail]
-    left = 448
-    top = 11
+    Left = 448
+    Top = 11
+  end
+  object XMLPropStorage: TXMLPropStorage
+    StoredValues = <>
+    FileName = 'todolistoptions.xml'
+    Active = False
+    OnRestoringProperties = XMLPropStorageRestoringProperties
+    OnRestoreProperties = XMLPropStorageRestoreProperties
+    Left = 544
+    Top = 11
   end
 end
diff --git a/components/todolist/todolist.pas b/components/todolist/todolist.pas
index fcb9b03..50df8f1 100644
--- a/components/todolist/todolist.pas
+++ b/components/todolist/todolist.pas
@@ -29,6 +29,7 @@
    Gerard Visent <gerardusmercator@gmail.com>
    Mattias Gaertner
    Alexander du Plessis
+   Silvio Clecio
 
   Abstract:
     List all to do comments of current project and the file
@@ -62,7 +63,7 @@ uses
   Classes, SysUtils, Math, LCLProc, Forms, Controls, Dialogs, StrUtils,
   ComCtrls, ActnList, AvgLvlTree, LazUTF8Classes, LCLType, ButtonPanel,
   CodeCache, CodeToolManager, BasicCodeTools, FileProcs, LazFileUtils,
-  LazFileCache, LclIntf, StdCtrls,
+  LazFileCache, LclIntf, StdCtrls, XMLPropStorage,
   // IDEIntf
   LazIDEIntf, IDEImagesIntf, PackageIntf, ProjectIntf, IDEUtils,
   // IDE
@@ -136,18 +137,28 @@ type
     acRefresh: TAction;
     acExport: TAction;
     ActionList: TActionList;
-    ButtonPanel1: TButtonPanel;
+    ButtonPanel: TButtonPanel;
+    chkListed: TCheckBox;
+    chkUsed: TCheckBox;
+    chkPackages: TCheckBox;
+    chkSourceEditor: TCheckBox;
+    grbOptions: TGroupBox;
     lvTodo: TListView;
-    SaveDialog1: TSaveDialog;
+    SaveDialog: TSaveDialog;
     ToolBar: TToolBar;
     tbGoto: TToolButton;
     tbRefresh: TToolButton;
     tbExport: TToolButton;
-    ToolButton1: TToolButton;
-    tbAddSrcEdit: TToolButton;
+    N1: TToolButton;
+    XMLPropStorage: TXMLPropStorage;
     procedure acExportExecute(Sender: TObject);
     procedure acGotoExecute(Sender: TObject);
     procedure acRefreshExecute(Sender: TObject);
+    procedure chkListedChange(Sender: TObject);
+    procedure chkPackagesChange(Sender: TObject);
+    procedure chkSourceEditorChange(Sender: TObject);
+    procedure chkUsedChange(Sender: TObject);
+    procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
     procedure FormCreate(Sender: TObject);
     procedure FormKeyDown(Sender: TObject; var Key: Word; Shift:TShiftState);
     procedure FormShow(Sender: TObject);
@@ -156,13 +167,15 @@ type
     procedure lvTodoColumnClick(Sender : TObject; Column : TListColumn);
     procedure lvTodoCompare(Sender : TObject; Item1, Item2 : TListItem;
       {%H-}Data : Integer; var Compare : Integer);
-    procedure SaveDialog1Show(Sender: TObject);
-    procedure tbAddSrcEditClick(Sender: TObject);
+    procedure SaveDialogShow(Sender: TObject);
+    procedure XMLPropStorageRestoreProperties(Sender: TObject);
+    procedure XMLPropStorageRestoringProperties(Sender: TObject);
   private
     FBaseDirectory: string;
     fUpdating, fUpdateNeeded: Boolean;
     FIDEItem: string;
     FIdleConnected: boolean;
+    FLoadingOptions: boolean;
     fStartFilename: String;
     FOnOpenFile  : TOnOpenFile;
     fScannedFiles: TAvgLvlTree;// tree of TTLScannedFile
@@ -201,6 +214,9 @@ implementation
 
 {$R *.lfm}
 
+const
+  DefaultTodoListCfgFile = 'todolistoptions.xml';
+
 function CompareTLScannedFiles(Data1, Data2: Pointer): integer;
 begin
   Result:=CompareFilenames(TTLScannedFile(Data1).Filename,
@@ -224,7 +240,7 @@ begin
   acRefresh.ImageIndex := IDEImages.LoadImage(16, 'laz_refresh');
   acExport.ImageIndex := IDEImages.LoadImage(16, 'menu_saveas');
 
-  SaveDialog1.Filter:= dlgFilterCsv+'|*.csv';
+  SaveDialog.Filter:= dlgFilterCsv+'|*.csv';
 end;
 
 destructor TIDETodoWindow.Destroy;
@@ -246,6 +262,8 @@ var
   CurPkg: TIDEPackage;
   Flags: TFindUnitsOfOwnerFlags;
 begin
+  if FLoadingOptions then
+    exit;
   if not Immediately then begin
     fUpdateNeeded:=true;
     IdleConnected:=true;
@@ -280,9 +298,18 @@ begin
     end;
 
     ResolveIDEItem(CurOwner,CurProject,CurPkg);
-    Flags:=[fuooListed,fuooUsed];
-    if tbAddSrcEdit.Down then
-      Include(Flags,fuooSourceEditor);
+
+    Flags:=[];
+
+    if chkListed.Checked then
+      Include(Flags, fuooListed);
+    if chkUsed.Checked then
+      Include(Flags, fuooUsed);
+    if chkPackages.Checked then
+      Include(Flags, fuooPackages);
+    if chkSourceEditor.Checked then
+      Include(Flags, fuooSourceEditor);
+
     Units:=LazarusIDE.FindUnitsOfOwner(CurOwner,Flags);
     for i:=0 to Units.Count-1 do
       ScanFile(Units[i]);
@@ -389,16 +416,22 @@ begin
   if lvTodo.SortDirection = sdDescending then Compare := -Compare;
 end;
 
-procedure TIDETodoWindow.SaveDialog1Show(Sender: TObject);
+procedure TIDETodoWindow.SaveDialogShow(Sender: TObject);
 begin
-  SaveDialog1.InitialDir:=GetCurrentDirUTF8;
+  SaveDialog.InitialDir:=GetCurrentDirUTF8;
 end;
 
-procedure TIDETodoWindow.tbAddSrcEditClick(Sender: TObject);
+procedure TIDETodoWindow.XMLPropStorageRestoreProperties(Sender: TObject);
 begin
+  FLoadingOptions := False;
   UpdateTodos;
 end;
 
+procedure TIDETodoWindow.XMLPropStorageRestoringProperties(Sender: TObject);
+begin
+  FLoadingOptions := True;
+end;
+
 //Initialise the todo project and find them
 procedure TIDETodoWindow.SetStartFilename(const AValue: String);
 begin
@@ -582,7 +615,7 @@ begin
         else
         begin
           SetItemFields(TodoItem, TempStr);
-          TempStr := '';;
+          TempStr := '';
         end;
         inc(N);
       end;
@@ -610,8 +643,15 @@ begin
   tbRefresh.Caption := dlgUnitDepRefresh;
   tbGoto.Caption := lisToDoGoto;
   tbExport.Caption := lisToDoExport;
-  tbAddSrcEdit.Caption := lisAddUnitsInSourceEditor;
-  tbAddSrcEdit.Hint := lisSearchTodosInSourceEditorUnitsAsWell;
+
+  chkListed.Caption := lisToDoListed;
+  chkListed.Hint := lisToDoListedHint;
+  chkUsed.Caption := lisToDoUsed;
+  chkUsed.Hint := lisToDoUsedHint;
+  chkPackages.Caption := lisPackages;
+  chkPackages.Hint := Format(lisPackagesHint, [lisToDoListed, lisToDoUsed]);
+  chkSourceEditor.Caption := lisSourceEditor;
+  chkSourceEditor.Hint := lisSourceEditorHint;
 
   with lvTodo do
   begin
@@ -624,6 +664,10 @@ begin
     Column[5].Caption := lisToDoLOwner;
     Column[6].Caption := listToDoLCategory;
   end;
+
+  XMLPropStorage.FileName := Concat(AppendPathDelim(LazarusIDE.GetPrimaryConfigPath),
+    DefaultTodoListCfgFile);
+  XMLPropStorage.Active := True;
 end;
 
 procedure TIDETodoWindow.acGotoExecute(Sender: TObject);
@@ -655,8 +699,8 @@ var
   todoItm  : TTodoItem;
   i        : integer;
 begin
-  SaveDialog1.FileName:='TodoList_'+FormatDateTime('YYYY_MM_DD',now);
-  if SaveDialog1.Execute then
+  SaveDialog.FileName:='TodoList_'+FormatDateTime('YYYY_MM_DD',now);
+  if SaveDialog.Execute then
   begin
     CommaList:=TStringListUTF8.Create;
     try
@@ -675,7 +719,7 @@ begin
         CommaList.Add(s);
         i:=i+1;
       end;
-      CommaList.SaveToFile(SaveDialog1.FileName);
+      CommaList.SaveToFile(SaveDialog.FileName);
     finally
       CommaList.Clear;
       CommaList.Free;
@@ -688,6 +732,31 @@ begin
   UpdateTodos;
 end;
 
+procedure TIDETodoWindow.chkListedChange(Sender: TObject);
+begin
+  UpdateTodos;
+end;
+
+procedure TIDETodoWindow.chkPackagesChange(Sender: TObject);
+begin
+  UpdateTodos;
+end;
+
+procedure TIDETodoWindow.chkSourceEditorChange(Sender: TObject);
+begin
+  UpdateTodos;
+end;
+
+procedure TIDETodoWindow.chkUsedChange(Sender: TObject);
+begin
+  UpdateTodos;
+end;
+
+procedure TIDETodoWindow.FormCloseQuery(Sender: TObject; var CanClose: boolean);
+begin
+  XMLPropStorage.Save;
+end;
+
 procedure TIDETodoWindow.AddListItem(aTodoItem: TTodoItem);
 var
    aListItem: TListItem;
diff --git a/components/todolist/todolistlaz.lpk b/components/todolist/todolistlaz.lpk
index 6e8cd95..80e1e35 100644
--- a/components/todolist/todolistlaz.lpk
+++ b/components/todolist/todolistlaz.lpk
@@ -1,18 +1,15 @@
-<?xml version="1.0"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
   <Package Version="4">
     <Name Value="ToDoListLaz"/>
+    <Type Value="DesignTime"/>
     <AddToProjectUsesSection Value="True"/>
-    <Author Value="Olivier GUILBAUD &lt;golivier@free.fr>, Gerard Visent &lt;gerardusmercator@gmail.com>, Mattias Gaertner, Alexander du Plessis
-"/>
+    <Author Value="Olivier GUILBAUD &lt;golivier@free.fr>, Gerard Visent &lt;gerardusmercator@gmail.com>, Mattias Gaertner, Alexander du Plessis, Silvio Clecio"/>
     <CompilerOptions>
       <Version Value="11"/>
       <SearchPaths>
         <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)/$(LCLWidgetType)"/>
       </SearchPaths>
-      <Other>
-        <CompilerPath Value="$(CompPath)"/>
-      </Other>
     </CompilerOptions>
     <Description Value="A todo list window for the Lazarus IDE
 "/>
@@ -46,7 +43,6 @@
       <EnableI18N Value="True"/>
       <OutDir Value="languages"/>
     </i18n>
-    <Type Value="DesignTime"/>
     <RequiredPkgs Count="3">
       <Item1>
         <PackageName Value="IDEIntf"/>
diff --git a/components/todolist/todoliststrconsts.pas b/components/todolist/todoliststrconsts.pas
index ed1ca56..323f32d 100644
--- a/components/todolist/todoliststrconsts.pas
+++ b/components/todolist/todoliststrconsts.pas
@@ -40,9 +40,14 @@ resourcestring
   listToDoLCategory = 'Category';
   lisToDoGoto = 'Goto';
   lisToDoExport = 'Export';
-  lisAddUnitsInSourceEditor = 'Add units in source editor';
-  lisSearchTodosInSourceEditorUnitsAsWell = 'Search todos in source editor '
-    +'units as well';
+  lisToDoListed = 'Listed';
+  lisToDoListedHint = 'Add units listed in lpi/lpk aka project inspector/package editor';
+  lisToDoUsed = 'Used';
+  lisToDoUsedHint = 'Add units used by main source file';
+  lisPackages = 'Packages';
+  lisPackagesHint = 'Extends "%s" and "%s" options by units from used packages';
+  lisSourceEditor = 'Editor';
+  lisSourceEditorHint = 'Add units in source editor';
   dlgUnitDepRefresh = 'Refresh';
   lisTDDInsertToDo = 'Insert ToDo';
   lisViewToDoList = 'View ToDo List';
-- 
2.7.4

Mattias Gaertner

2016-11-26 10:53

manager   ~0096243

Thank You!

silvioprog

2016-11-26 18:36

reporter   ~0096263

Thank you too! :-)

Juha Manninen

2017-05-23 09:46

developer   ~0100616

This caused a regression in TodoList. The list was updated too early which lead to:
 "TApplication.HandleException TLazSourceFileManager.FindUnitsOfOwner: invalid owner nil"

Fixed in r55059.

Issue History

Date Modified Username Field Change
2016-11-25 06:20 silvioprog New Issue
2016-11-25 06:21 silvioprog File Added: 0001-fix-issue-31006.-patch-by-Silvio-Clecio.patch
2016-11-25 13:53 Mattias Gaertner Fixed in Revision => 53450
2016-11-25 13:53 Mattias Gaertner LazTarget => -
2016-11-25 13:53 Mattias Gaertner Note Added: 0096227
2016-11-25 13:53 Mattias Gaertner Status new => resolved
2016-11-25 13:53 Mattias Gaertner Resolution open => fixed
2016-11-25 13:53 Mattias Gaertner Assigned To => Mattias Gaertner
2016-11-26 04:33 silvioprog Note Added: 0096242
2016-11-26 04:33 silvioprog Status resolved => assigned
2016-11-26 04:33 silvioprog Resolution fixed => reopened
2016-11-26 04:33 silvioprog File Added: 0001-Upgrades-for-the-issue-31006.-patch-by-Silvio-Clecio.patch
2016-11-26 04:33 silvioprog Note Edited: 0096242 View Revisions
2016-11-26 04:33 silvioprog Note Edited: 0096242 View Revisions
2016-11-26 04:40 silvioprog Note Edited: 0096242 View Revisions
2016-11-26 10:53 Mattias Gaertner Note Added: 0096243
2016-11-26 10:53 Mattias Gaertner Status assigned => resolved
2016-11-26 10:53 Mattias Gaertner Resolution reopened => fixed
2016-11-26 18:36 silvioprog Note Added: 0096263
2016-11-26 18:36 silvioprog Status resolved => closed
2017-05-23 09:43 Juha Manninen Status closed => assigned
2017-05-23 09:43 Juha Manninen Resolution fixed => reopened
2017-05-23 09:46 Juha Manninen Note Added: 0100616
2017-05-23 09:55 Juha Manninen Fixed in Revision 53450 => r53450, r55059
2017-05-23 09:55 Juha Manninen Status assigned => resolved
2017-05-23 09:55 Juha Manninen Resolution reopened => fixed
2017-08-28 07:57 silvioprog Status resolved => closed