1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  */
5 
6 #ifndef TODOLIST_H
7 #define TODOLIST_H
8 
9 #ifdef __BORLANDC__
10     #pragma hdrstop
11 #endif
12 
13 #include <wx/arrstr.h>
14 #include "cbplugin.h" // the base class we're inheriting
15 #include "globals.h"
16 
17 class wxMenuBar;
18 class wxMenu;
19 class wxToolBar;
20 class FileTreeData;
21 class wxCommandEvent;
22 class wxUpdateUIEvent;
23 class CodeBlocksEvent;
24 class ToDoListView;
25 class FileTreeData;
26 
27 class ToDoList : public cbPlugin
28 {
29     public:
30         ToDoList();
31         ~ToDoList();
32         virtual cbConfigurationPanel* GetConfigurationPanel(wxWindow* parent);
33         void BuildMenu(wxMenuBar* menuBar);
34         void BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* data = 0);
35         void OnAttach(); // fires when the plugin is attached to the application
36         void OnRelease(bool appShutDown); // fires when the plugin is released from the application
37     private:
38         // only parse files when C::B app is already start up
39         void OnAppDoneStartup(CodeBlocksEvent& event);
40 
41         // menu item click event
42         // menu item click (toggle the show status of the todo list control)
43         void OnViewList(wxCommandEvent& event);
44         // menu item click to add a todo item in the source file
45         void OnAddItem(wxCommandEvent& event);
46 
47         // event handler of the C::B editor/project event
48         // some status has changed, so we need to update the todo list control, currently, project
49         // close/activate, project file added/removed will all fire this function
50         void OnReparse(CodeBlocksEvent& event);
51 
52         // parse the current/active editor, currently, editor open/save/activated/close will fire
53         // this function
54         void OnReparseCurrent(CodeBlocksEvent& event);
55 
56         // update the menu status
57         // update the menu items (check status)
58         void OnUpdateUI(wxUpdateUIEvent& event);
59         // update the menu items (this manu item is valid when an buildin editor is active)
60         void OnUpdateAdd(wxUpdateUIEvent& event);
61         //write and load from configuration file
62         void LoadUsers(); // different user can add todos
63         void SaveUsers();
64         void LoadTypes(); // types are some thing like fixme, todo, note .....
65         void SaveTypes();
66 
67         // parse current editor, if force is true, we need to update the items of the current editor
68         void ParseCurrent(bool forced = false);
69         // parse all the files involved?
70         void Parse();
71 
72         // ListCtrl of all the Todo items
73         ToDoListView* m_pListLog;
74         // the slot index in Logs & others panel
75         int m_ListPageIndex;
76         // when a new todo item is added, do we need to refresh the list (parse the files)
77         bool m_AutoRefresh;
78         // set true after C::B app is done
79         bool m_InitDone;
80         // delay parsing the while files if this variable is set to true, this usually happens
81         // the project is currently loading or C::B is not fully start up.
82         bool m_ParsePending;
83         // float window or a table page in Logs & others
84         bool m_StandAlone;
85         // who wrote the todos
86         wxArrayString m_Users;
87         // many kinds of todos, like: fixme, todo, note.....
88         wxArrayString m_Types;
89 
90         DECLARE_EVENT_TABLE()
91 };
92 
93 #endif // TODOLIST_H
94 
95