diff options
Diffstat (limited to 'src/Remember.hh')
-rw-r--r-- | src/Remember.hh | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/Remember.hh b/src/Remember.hh index 8058c15..d3a30e0 100644 --- a/src/Remember.hh +++ b/src/Remember.hh | |||
@@ -21,7 +21,7 @@ | |||
21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 21 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
22 | // DEALINGS IN THE SOFTWARE. | 22 | // DEALINGS IN THE SOFTWARE. |
23 | 23 | ||
24 | // $Id: Remember.hh,v 1.6 2003/06/05 13:33:27 fluxgen Exp $ | 24 | // $Id: Remember.hh,v 1.7 2003/06/12 15:12:19 rathnor Exp $ |
25 | 25 | ||
26 | /* Based on the original "Remember patch" by Xavier Brouckaert */ | 26 | /* Based on the original "Remember patch" by Xavier Brouckaert */ |
27 | 27 | ||
@@ -32,7 +32,14 @@ | |||
32 | 32 | ||
33 | #include <fstream> | 33 | #include <fstream> |
34 | #include <map> | 34 | #include <map> |
35 | #include <list> | ||
35 | #include <string> | 36 | #include <string> |
37 | #include <utility> | ||
38 | |||
39 | class FluxboxWindow; | ||
40 | class BScreen; | ||
41 | class WinClient; | ||
42 | class ClientPattern; | ||
36 | 43 | ||
37 | class Application { | 44 | class Application { |
38 | public: | 45 | public: |
@@ -99,12 +106,8 @@ public: | |||
99 | 106 | ||
100 | bool save_on_close_remember; | 107 | bool save_on_close_remember; |
101 | bool save_on_close; | 108 | bool save_on_close; |
102 | }; | ||
103 | |||
104 | 109 | ||
105 | class FluxboxWindow; | 110 | }; |
106 | class BScreen; | ||
107 | class WinClient; | ||
108 | 111 | ||
109 | /** | 112 | /** |
110 | * Class Remember is an atomhandler to avoid interfering with | 113 | * Class Remember is an atomhandler to avoid interfering with |
@@ -132,13 +135,21 @@ public: | |||
132 | REM_LASTATTRIB // not actually used | 135 | REM_LASTATTRIB // not actually used |
133 | }; | 136 | }; |
134 | 137 | ||
135 | typedef std::map<std::string, Application *> Apps; | 138 | // a "pattern" to the relevant app |
139 | // each app exists ONLY for that pattern. | ||
140 | // And we need to keep a list of pairs as we want to keep the | ||
141 | // applications in the same order as they will be in the apps file | ||
142 | typedef std::list< std::pair<ClientPattern *, Application *> > Patterns; | ||
143 | |||
144 | // We keep track of which app is assigned to a winclient | ||
145 | // particularly useful to update counters etc on windowclose | ||
146 | typedef std::map<WinClient *, Application *> Clients; | ||
147 | |||
136 | Remember(); | 148 | Remember(); |
149 | ~Remember(); | ||
137 | 150 | ||
138 | Application* find(WinClient &winclient); | 151 | Application* find(WinClient &winclient); |
139 | Application* find(const char* app_name); | ||
140 | Application* add(WinClient &winclient); | 152 | Application* add(WinClient &winclient); |
141 | Application* add(const char* app_name); | ||
142 | 153 | ||
143 | void load(); | 154 | void load(); |
144 | void save(); | 155 | void save(); |
@@ -176,7 +187,8 @@ private: | |||
176 | 187 | ||
177 | // returns number of lines read | 188 | // returns number of lines read |
178 | int parseApp(std::ifstream &file, Application &app); | 189 | int parseApp(std::ifstream &file, Application &app); |
179 | Apps apps; | 190 | Patterns m_pats; |
191 | Clients m_clients; | ||
180 | 192 | ||
181 | }; | 193 | }; |
182 | 194 | ||