Imported Upstream version 9.20
[platform/upstream/7zip.git] / CPP / 7zip / UI / FileManager / ViewSettings.h
1 // ViewSettings.h\r
2 \r
3 #ifndef __VIEW_SETTINGS_H\r
4 #define __VIEW_SETTINGS_H\r
5 \r
6 #include "Common/MyString.h"\r
7 #include "Common/Types.h"\r
8 \r
9 struct CColumnInfo\r
10 {\r
11   PROPID PropID;\r
12   bool IsVisible;\r
13   UInt32 Width;\r
14 };\r
15 \r
16 inline bool operator==(const CColumnInfo &a1, const CColumnInfo &a2)\r
17 {\r
18   return (a1.PropID == a2.PropID) &&\r
19     (a1.IsVisible == a2.IsVisible) && (a1.Width == a2.Width);\r
20 }\r
21 \r
22 inline bool operator!=(const CColumnInfo &a1, const CColumnInfo &a2)\r
23 {\r
24   return !(a1 == a2);\r
25 }\r
26 \r
27 struct CListViewInfo\r
28 {\r
29   CObjectVector<CColumnInfo> Columns;\r
30   PROPID SortID;\r
31   bool Ascending;\r
32 \r
33   void Clear()\r
34   {\r
35     SortID = 0;\r
36     Ascending = true;\r
37     Columns.Clear();\r
38   }\r
39 \r
40   int FindColumnWithID(PROPID propID) const\r
41   {\r
42     for (int i = 0; i < Columns.Size(); i++)\r
43       if (Columns[i].PropID == propID)\r
44         return i;\r
45     return -1;\r
46   }\r
47 \r
48   bool IsEqual(const CListViewInfo &info) const\r
49   {\r
50     if (Columns.Size() != info.Columns.Size() ||\r
51         // SortIndex != info.SortIndex ||\r
52         SortID != info.SortID ||\r
53         Ascending != info.Ascending)\r
54       return false;\r
55     for (int i = 0; i < Columns.Size(); i++)\r
56       if (Columns[i] != info.Columns[i])\r
57         return false;\r
58     return true;\r
59   }\r
60 };\r
61 \r
62 void SaveListViewInfo(const UString &id, const CListViewInfo &viewInfo);\r
63 void ReadListViewInfo(const UString &id, CListViewInfo &viewInfo);\r
64 \r
65 void SaveWindowSize(const RECT &rect, bool maximized);\r
66 bool ReadWindowSize(RECT &rect, bool &maximized);\r
67 \r
68 void SavePanelsInfo(UInt32 numPanels, UInt32 currentPanel, UInt32 splitterPos);\r
69 bool ReadPanelsInfo(UInt32 &numPanels, UInt32 &currentPanel, UInt32 &splitterPos);\r
70 \r
71 void SaveToolbarsMask(UInt32 toolbarMask);\r
72 UInt32 ReadToolbarsMask();\r
73 \r
74 void SavePanelPath(UInt32 panel, const UString &path);\r
75 bool ReadPanelPath(UInt32 panel, UString &path);\r
76 \r
77 struct CListMode\r
78 {\r
79   UInt32 Panels[2];\r
80   void Init() { Panels[0] = Panels[1] = 3; }\r
81   CListMode() { Init(); }\r
82 };\r
83 \r
84 void SaveListMode(const CListMode &listMode);\r
85 void ReadListMode(CListMode &listMode);\r
86 \r
87 void SaveFolderHistory(const UStringVector &folders);\r
88 void ReadFolderHistory(UStringVector &folders);\r
89 \r
90 void SaveFastFolders(const UStringVector &folders);\r
91 void ReadFastFolders(UStringVector &folders);\r
92 \r
93 void SaveCopyHistory(const UStringVector &folders);\r
94 void ReadCopyHistory(UStringVector &folders);\r
95 \r
96 void AddUniqueStringToHeadOfList(UStringVector &list, const UString &s);\r
97 \r
98 #endif\r