Changes required by API changes in used libraries.
[ttodo.git] / cldoc.h
blobb5fbf0aea18b2adf076296fb47bc0b50f6404755
1 // Copyright (c) 2006 by Mike Sharov <msharov@users.sourceforge.net>
2 //
3 // cldoc.h
4 //
6 #ifndef CLDOC_H_0C4B8F6A2D8E432948411FC661E0CABB
7 #define CLDOC_H_0C4B8F6A2D8E432948411FC661E0CABB
9 #include "tddoc.h"
11 /// \class CCurlistDocument cldoc.h cldoc.h
12 class CCurlistDocument : public CDocument {
13 public:
14 typedef const tdevec_t& rctdevec_t;
15 typedef const CTodoItem& rcitem_t;
16 typedef CTodoItem::id_t itemid_t;
17 typedef const string& rcfname_t;
18 enum {
19 f_CompleteVisible = CDocument::f_Last, ///< All old items are visible.
20 f_Descended, ///< Descended down item tree by dir path.
21 f_Last
23 public:
24 CCurlistDocument (void);
25 rcitem_t CurrentItem (void) const;
26 inline uint32_t Selection (void) const { return (m_Selection.back()); }
27 inline rctdevec_t List (void) const { return (m_List); }
28 void SetSelection (uoff_t v);
29 void AppendItem (void);
30 void PasteLinkToItem (itemid_t id);
31 void UpdateCurrentItem (rcitem_t e);
32 void RemoveCurrentItem (void);
33 private:
34 inline void ToggleCompleteVisible (void) { SetFlag (f_CompleteVisible, !Flag (f_CompleteVisible)); ReloadList(); }
35 inline size_t NestingDepth (void) const { return (m_Stack.size() - 1); }
36 void SetCurrentItemPriority (CTodoItem::EPriority p);
37 void MarkItemComplete (void);
38 void EnterCurrentItem (void);
39 void LeaveCurrentItem (void);
40 protected:
41 virtual void OnUpdate (void);
42 virtual void OnInitialUpdate (void);
43 virtual void OnCommand (cmd_t c);
44 virtual void OnUpdateCommandUI (rcmd_t rc) const;
45 private:
46 typedef CTodoDocument* pdoc_t;
47 typedef const CTodoDocument* pcdoc_t;
48 typedef tdevec_t::iterator iitem_t;
49 typedef tdevec_t::const_iterator icitem_t;
50 typedef tddepmap_t::iterator idep_t;
51 typedef tddepmap_t::const_iterator icdep_t;
52 typedef const tddepmap_t& rcdepmap_t;
53 typedef vector<itemid_t> itstack_t;
54 typedef vector<uint32_t> selstack_t;
55 private:
56 inline pdoc_t Document (void) { return (TDocument<CTodoDocument>()); }
57 inline pcdoc_t Document (void) const { return (TDocument<CTodoDocument>()); }
58 inline rcdepmap_t Deps (void) const { return (m_Deps); }
59 void DescendByCwd (void);
60 bool ItemNameIsADirectory (rcfname_t name) const;
61 void UpdateItemDirectoryFlag (iitem_t icuri) const;
62 void ReloadList (void);
63 void SelectItem (itemid_t id);
64 inline itemid_t ItemId (void) const { return (m_Stack.back()); }
65 rcfname_t GetTodoFileDir (void) const;
66 private:
67 tdevec_t m_List; ///< Currently selected list.
68 tddepmap_t m_Deps; ///< Dependency list that created m_List.
69 itstack_t m_Stack; ///< The callstack of the currently active list.
70 selstack_t m_Selection; ///< Index of the selected item.
73 //----------------------------------------------------------------------
75 /// Global commands for this application.
76 enum {
77 cmd_List = cmd_User,
78 cmd_List_Enter,
79 cmd_List_Leave,
80 cmd_List_Copy,
81 cmd_List_Paste,
82 cmd_List_OldItems,
83 cmd_Item,
84 cmd_Item_New,
85 cmd_Item_Edit,
86 cmd_Item_Delete,
87 cmd_Item_Complete,
88 cmd_Item_Priority,
89 cmd_Item_Priority_Highest,
90 cmd_Item_Priority_High,
91 cmd_Item_Priority_Medium,
92 cmd_Item_Priority_Low,
93 cmd_Item_Priority_Lowest,
96 //----------------------------------------------------------------------
98 #endif