Bookmarks.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 TBookmarkList : public TPersistent
  35. {
  36. friend class TBookmarks;
  37. friend class TBookmark;
  38. public:
  39. __fastcall TBookmarkList();
  40. virtual __fastcall ~TBookmarkList();
  41. void __fastcall Clear();
  42. void __fastcall Add(TBookmark * Bookmark);
  43. void __fastcall Insert(int Index, TBookmark * Bookmark);
  44. void __fastcall InsertBefore(TBookmark * BeforeBookmark, TBookmark * Bookmark);
  45. void __fastcall MoveTo(TBookmark * ToBookmark, TBookmark * Bookmark, bool Before);
  46. void __fastcall Delete(TBookmark * Bookmark);
  47. TBookmark * __fastcall FindByName(const UnicodeString Node, const UnicodeString Name);
  48. TBookmark * __fastcall FindByShortCut(TShortCut ShortCut);
  49. virtual void __fastcall Assign(TPersistent * Source);
  50. void __fastcall LoadOptions(THierarchicalStorage * Storage);
  51. void __fastcall SaveOptions(THierarchicalStorage * Storage);
  52. void __fastcall ShortCuts(TShortCuts & ShortCuts);
  53. __property int Count = { read = GetCount };
  54. __property TBookmark * Bookmarks[int Index] = { read = GetBookmarks };
  55. __property bool NodeOpened[UnicodeString Index] = { read = GetNodeOpened, write = SetNodeOpened };
  56. protected:
  57. int __fastcall IndexOf(TBookmark * Bookmark);
  58. void __fastcall KeyChanged(int Index);
  59. __property bool Modified = { read = FModified, write = FModified };
  60. private:
  61. TStringList * FBookmarks;
  62. TStringList * FOpenedNodes;
  63. bool FModified;
  64. int __fastcall GetCount();
  65. TBookmark * __fastcall GetBookmarks(int Index);
  66. bool __fastcall GetNodeOpened(UnicodeString Index);
  67. void __fastcall SetNodeOpened(UnicodeString Index, bool value);
  68. };
  69. //---------------------------------------------------------------------------
  70. class TBookmark : public TPersistent
  71. {
  72. friend class TBookmarkList;
  73. public:
  74. __fastcall TBookmark();
  75. virtual void __fastcall Assign(TPersistent * Source);
  76. UnicodeString __fastcall GetSideDirectory(TOperationSide Side);
  77. __property UnicodeString Name = { read = FName, write = SetName };
  78. __property UnicodeString Local = { read = FLocal, write = SetLocal };
  79. __property UnicodeString Remote = { read = FRemote, write = SetRemote };
  80. __property UnicodeString Node = { read = FNode, write = SetNode };
  81. __property TShortCut ShortCut = { read = FShortCut, write = SetShortCut };
  82. protected:
  83. TBookmarkList * FOwner;
  84. static UnicodeString __fastcall BookmarkKey(const UnicodeString Node, const UnicodeString Name);
  85. __property UnicodeString Key = { read = GetKey };
  86. private:
  87. UnicodeString FName;
  88. UnicodeString FLocal;
  89. UnicodeString FRemote;
  90. UnicodeString FNode;
  91. TShortCut FShortCut;
  92. void __fastcall SetName(const UnicodeString value);
  93. void __fastcall SetLocal(const UnicodeString value);
  94. void __fastcall SetRemote(const UnicodeString value);
  95. void __fastcall SetNode(const UnicodeString value);
  96. void __fastcall SetShortCut(TShortCut value);
  97. UnicodeString __fastcall GetKey();
  98. void __fastcall Modify(int OldIndex);
  99. };
  100. //---------------------------------------------------------------------------
  101. #endif