Bookmarks.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //---------------------------------------------------------------------------
  2. #ifndef BookmarksH
  3. #define BookmarksH
  4. //---------------------------------------------------------------------------
  5. class THierarchicalStorage;
  6. class TBookmarkList;
  7. class TShortCuts;
  8. //---------------------------------------------------------------------------
  9. class TBookmarks : public TObject
  10. {
  11. public:
  12. __fastcall TBookmarks();
  13. virtual __fastcall ~TBookmarks();
  14. void __fastcall Load(THierarchicalStorage * Storage);
  15. void __fastcall Save(THierarchicalStorage * Storage, bool All);
  16. void __fastcall ModifyAll(bool Modify);
  17. void __fastcall Clear();
  18. __property TBookmarkList * Bookmarks[UnicodeString Index] = { read = GetBookmarks, write = SetBookmarks };
  19. __property TBookmarkList * SharedBookmarks = { read = GetSharedBookmarks, write = SetSharedBookmarks };
  20. private:
  21. TStringList * FBookmarkLists;
  22. UnicodeString FSharedKey;
  23. static UnicodeString Keys[];
  24. TBookmarkList * __fastcall GetBookmarks(UnicodeString Index);
  25. void __fastcall SetBookmarks(UnicodeString Index, TBookmarkList * value);
  26. TBookmarkList * __fastcall GetSharedBookmarks();
  27. void __fastcall SetSharedBookmarks(TBookmarkList * value);
  28. void __fastcall LoadLevel(THierarchicalStorage * Storage, const UnicodeString Key,
  29. int Index, TBookmarkList * BookmarkList);
  30. };
  31. //---------------------------------------------------------------------------
  32. class TBookmarkList : public TPersistent
  33. {
  34. friend class TBookmarks;
  35. friend class TBookmark;
  36. public:
  37. __fastcall TBookmarkList();
  38. virtual __fastcall ~TBookmarkList();
  39. void __fastcall Clear();
  40. void __fastcall Add(TBookmark * Bookmark);
  41. void __fastcall Insert(int Index, TBookmark * Bookmark);
  42. void __fastcall InsertBefore(TBookmark * BeforeBookmark, TBookmark * Bookmark);
  43. void __fastcall MoveTo(TBookmark * ToBookmark, TBookmark * Bookmark, bool Before);
  44. void __fastcall Delete(TBookmark * Bookmark);
  45. TBookmark * __fastcall FindByName(const UnicodeString Node, const UnicodeString Name);
  46. TBookmark * __fastcall FindByShortCut(TShortCut ShortCut);
  47. virtual void __fastcall Assign(TPersistent * Source);
  48. void __fastcall LoadOptions(THierarchicalStorage * Storage);
  49. void __fastcall SaveOptions(THierarchicalStorage * Storage);
  50. void __fastcall ShortCuts(TShortCuts & ShortCuts);
  51. __property int Count = { read = GetCount };
  52. __property TBookmark * Bookmarks[int Index] = { read = GetBookmarks };
  53. __property bool NodeOpened[UnicodeString Index] = { read = GetNodeOpened, write = SetNodeOpened };
  54. protected:
  55. int __fastcall IndexOf(TBookmark * Bookmark);
  56. void __fastcall KeyChanged(int Index);
  57. __property bool Modified = { read = FModified, write = FModified };
  58. private:
  59. TStringList * FBookmarks;
  60. TStringList * FOpenedNodes;
  61. bool FModified;
  62. int __fastcall GetCount();
  63. TBookmark * __fastcall GetBookmarks(int Index);
  64. bool __fastcall GetNodeOpened(UnicodeString Index);
  65. void __fastcall SetNodeOpened(UnicodeString Index, bool value);
  66. };
  67. //---------------------------------------------------------------------------
  68. class TBookmark : public TPersistent
  69. {
  70. friend class TBookmarkList;
  71. public:
  72. __fastcall TBookmark();
  73. virtual void __fastcall Assign(TPersistent * Source);
  74. __property UnicodeString Name = { read = FName, write = SetName };
  75. __property UnicodeString Local = { read = FLocal, write = SetLocal };
  76. __property UnicodeString Remote = { read = FRemote, write = SetRemote };
  77. __property UnicodeString Node = { read = FNode, write = SetNode };
  78. __property TShortCut ShortCut = { read = FShortCut, write = SetShortCut };
  79. protected:
  80. TBookmarkList * FOwner;
  81. static UnicodeString __fastcall BookmarkKey(const UnicodeString Node, const UnicodeString Name);
  82. __property UnicodeString Key = { read = GetKey };
  83. private:
  84. UnicodeString FName;
  85. UnicodeString FLocal;
  86. UnicodeString FRemote;
  87. UnicodeString FNode;
  88. TShortCut FShortCut;
  89. void __fastcall SetName(const UnicodeString value);
  90. void __fastcall SetLocal(const UnicodeString value);
  91. void __fastcall SetRemote(const UnicodeString value);
  92. void __fastcall SetNode(const UnicodeString value);
  93. void __fastcall SetShortCut(TShortCut value);
  94. UnicodeString __fastcall GetKey();
  95. void __fastcall Modify(int OldIndex);
  96. };
  97. //---------------------------------------------------------------------------
  98. #endif