Bookmarks.h 4.6 KB

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