diff options
author | rathnor <rathnor> | 2002-12-01 13:42:15 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2002-12-01 13:42:15 (GMT) |
commit | 28b5c604490094e187494dcc566bd3d7a05a2c25 (patch) | |
tree | 8f78f5714a5cd055c10b067a2656fe7b2338e71a /src/Windowmenu.cc | |
parent | b9134162f9633784d9097df18769a699a62650fe (diff) | |
download | fluxbox-28b5c604490094e187494dcc566bd3d7a05a2c25.zip fluxbox-28b5c604490094e187494dcc566bd3d7a05a2c25.tar.bz2 |
Indenting from tabs to emacs 4-space
Diffstat (limited to 'src/Windowmenu.cc')
-rw-r--r-- | src/Windowmenu.cc | 370 |
1 files changed, 185 insertions, 185 deletions
diff --git a/src/Windowmenu.cc b/src/Windowmenu.cc index cbcc4ce..523ff1b 100644 --- a/src/Windowmenu.cc +++ b/src/Windowmenu.cc | |||
@@ -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: Windowmenu.cc,v 1.21 2002/10/23 22:02:13 fluxgen Exp $ | 24 | // $Id: Windowmenu.cc,v 1.22 2002/12/01 13:42:05 rathnor Exp $ |
25 | 25 | ||
26 | //use GNU extensions | 26 | //use GNU extensions |
27 | #ifndef _GNU_SOURCE | 27 | #ifndef _GNU_SOURCE |
@@ -42,72 +42,72 @@ | |||
42 | #include <cstring> | 42 | #include <cstring> |
43 | 43 | ||
44 | Windowmenu::Windowmenu(FluxboxWindow &win) : Basemenu(win.getScreen()), | 44 | Windowmenu::Windowmenu(FluxboxWindow &win) : Basemenu(win.getScreen()), |
45 | window(win), | 45 | window(win), |
46 | screen(win.getScreen()), | 46 | screen(win.getScreen()), |
47 | sendToMenu(win), | 47 | sendToMenu(win), |
48 | sendGroupToMenu(win) { | 48 | sendGroupToMenu(win) { |
49 | 49 | ||
50 | setTitleVisibility(False); | 50 | setTitleVisibility(False); |
51 | setMovable(False); | 51 | setMovable(False); |
52 | setInternalMenu(); | 52 | setInternalMenu(); |
53 | 53 | ||
54 | I18n *i18n = I18n::instance(); | 54 | I18n *i18n = I18n::instance(); |
55 | 55 | ||
56 | using namespace FBNLS; | 56 | using namespace FBNLS; |
57 | insert(i18n->getMessage( | 57 | insert(i18n->getMessage( |
58 | WindowmenuSet, WindowmenuSendTo, | 58 | WindowmenuSet, WindowmenuSendTo, |
59 | "Send To ..."), | 59 | "Send To ..."), |
60 | &sendToMenu); | 60 | &sendToMenu); |
61 | 61 | ||
62 | insert(i18n->getMessage( | 62 | insert(i18n->getMessage( |
63 | WindowmenuSet, WindowmenuSendGroupTo, | 63 | WindowmenuSet, WindowmenuSendGroupTo, |
64 | "Send Group To ..."), | 64 | "Send Group To ..."), |
65 | &sendGroupToMenu); | 65 | &sendGroupToMenu); |
66 | 66 | ||
67 | insert(i18n->getMessage( | 67 | insert(i18n->getMessage( |
68 | WindowmenuSet, WindowmenuShade, | 68 | WindowmenuSet, WindowmenuShade, |
69 | "Shade"), | 69 | "Shade"), |
70 | BScreen::WINDOWSHADE); | 70 | BScreen::WINDOWSHADE); |
71 | insert(i18n->getMessage( | 71 | insert(i18n->getMessage( |
72 | WindowmenuSet, WindowmenuIconify, | 72 | WindowmenuSet, WindowmenuIconify, |
73 | "Iconify"), | 73 | "Iconify"), |
74 | BScreen::WINDOWICONIFY); | 74 | BScreen::WINDOWICONIFY); |
75 | insert(i18n->getMessage( | 75 | insert(i18n->getMessage( |
76 | WindowmenuSet, WindowmenuMaximize, | 76 | WindowmenuSet, WindowmenuMaximize, |
77 | "Maximize"), | 77 | "Maximize"), |
78 | BScreen::WINDOWMAXIMIZE); | 78 | BScreen::WINDOWMAXIMIZE); |
79 | insert(i18n->getMessage( | 79 | insert(i18n->getMessage( |
80 | WindowmenuSet, WindowmenuRaise, | 80 | WindowmenuSet, WindowmenuRaise, |
81 | "Raise"), | 81 | "Raise"), |
82 | BScreen::WINDOWRAISE); | 82 | BScreen::WINDOWRAISE); |
83 | insert(i18n->getMessage( | 83 | insert(i18n->getMessage( |
84 | WindowmenuSet, WindowmenuLower, | 84 | WindowmenuSet, WindowmenuLower, |
85 | "Lower"), | 85 | "Lower"), |
86 | BScreen::WINDOWLOWER); | 86 | BScreen::WINDOWLOWER); |
87 | insert(i18n->getMessage( | 87 | insert(i18n->getMessage( |
88 | WindowmenuSet, WindowmenuStick, | 88 | WindowmenuSet, WindowmenuStick, |
89 | "Stick"), | 89 | "Stick"), |
90 | BScreen::WINDOWSTICK); | 90 | BScreen::WINDOWSTICK); |
91 | insert(i18n->getMessage( | 91 | insert(i18n->getMessage( |
92 | WindowmenuSet, WindowmenuKillClient, | 92 | WindowmenuSet, WindowmenuKillClient, |
93 | "Kill Client"), | 93 | "Kill Client"), |
94 | BScreen::WINDOWKILL); | 94 | BScreen::WINDOWKILL); |
95 | insert(i18n->getMessage( | 95 | insert(i18n->getMessage( |
96 | WindowmenuSet, WindowmenuClose, | 96 | WindowmenuSet, WindowmenuClose, |
97 | "Close"), | 97 | "Close"), |
98 | BScreen::WINDOWCLOSE); | 98 | BScreen::WINDOWCLOSE); |
99 | insert(i18n->getMessage( | 99 | insert(i18n->getMessage( |
100 | WindowmenuSet, WindowmenuTab, | 100 | WindowmenuSet, WindowmenuTab, |
101 | "Tab"), | 101 | "Tab"), |
102 | BScreen::WINDOWTAB); | 102 | BScreen::WINDOWTAB); |
103 | 103 | ||
104 | update(); | 104 | update(); |
105 | 105 | ||
106 | setItemEnabled(2, window.hasTitlebar()); | 106 | setItemEnabled(2, window.hasTitlebar()); |
107 | setItemEnabled(3, window.isIconifiable()); | 107 | setItemEnabled(3, window.isIconifiable()); |
108 | setItemEnabled(4, window.isMaximizable()); | 108 | setItemEnabled(4, window.isMaximizable()); |
109 | setItemEnabled(9, window.isClosable()); | 109 | setItemEnabled(9, window.isClosable()); |
110 | setItemEnabled(10, window.isGroupable()); // tab option | 110 | setItemEnabled(10, window.isGroupable()); // tab option |
111 | 111 | ||
112 | } | 112 | } |
113 | 113 | ||
@@ -118,185 +118,185 @@ Windowmenu::~Windowmenu() { | |||
118 | 118 | ||
119 | 119 | ||
120 | void Windowmenu::show() { | 120 | void Windowmenu::show() { |
121 | if (isItemEnabled(2)) | 121 | if (isItemEnabled(2)) |
122 | setItemSelected(2, window.isShaded()); | 122 | setItemSelected(2, window.isShaded()); |
123 | if (isItemEnabled(4)) | 123 | if (isItemEnabled(4)) |
124 | setItemSelected(4, window.isMaximized()); | 124 | setItemSelected(4, window.isMaximized()); |
125 | if (isItemEnabled(7)) | 125 | if (isItemEnabled(7)) |
126 | setItemSelected(7, window.isStuck()); | 126 | setItemSelected(7, window.isStuck()); |
127 | 127 | ||
128 | Basemenu::show(); | 128 | Basemenu::show(); |
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | ||
132 | void Windowmenu::itemSelected(int button, unsigned int index) { | 132 | void Windowmenu::itemSelected(int button, unsigned int index) { |
133 | BasemenuItem *item = find(index); | 133 | BasemenuItem *item = find(index); |
134 | hide(); | 134 | hide(); |
135 | switch (item->function()) { | 135 | switch (item->function()) { |
136 | case BScreen::WINDOWSHADE: | 136 | case BScreen::WINDOWSHADE: |
137 | if (window.isIconic()) | 137 | if (window.isIconic()) |
138 | break; | 138 | break; |
139 | 139 | ||
140 | window.shade(); | 140 | window.shade(); |
141 | if (window.hasTab()) | 141 | if (window.hasTab()) |
142 | window.getTab()->shade(); | 142 | window.getTab()->shade(); |
143 | break; | 143 | break; |
144 | 144 | ||
145 | case BScreen::WINDOWICONIFY: | 145 | case BScreen::WINDOWICONIFY: |
146 | if (!window.isIconic()) | 146 | if (!window.isIconic()) |
147 | window.iconify(); | 147 | window.iconify(); |
148 | else | 148 | else |
149 | window.deiconify(); // restore window | 149 | window.deiconify(); // restore window |
150 | 150 | ||
151 | break; | 151 | break; |
152 | 152 | ||
153 | case BScreen::WINDOWMAXIMIZE: | 153 | case BScreen::WINDOWMAXIMIZE: |
154 | window.maximize((unsigned int) button); | 154 | window.maximize((unsigned int) button); |
155 | break; | 155 | break; |
156 | 156 | ||
157 | case BScreen::WINDOWCLOSE: | 157 | case BScreen::WINDOWCLOSE: |
158 | window.close(); | 158 | window.close(); |
159 | break; | 159 | break; |
160 | 160 | ||
161 | case BScreen::WINDOWRAISE: | 161 | case BScreen::WINDOWRAISE: |
162 | if (window.isIconic()) | 162 | if (window.isIconic()) |
163 | break; | 163 | break; |
164 | 164 | ||
165 | if (window.hasTab()) | 165 | if (window.hasTab()) |
166 | window.getTab()->raise(); //raise tabs | 166 | window.getTab()->raise(); //raise tabs |
167 | screen->getWorkspace(window.getWorkspaceNumber())->raiseWindow(&window); | 167 | screen->getWorkspace(window.getWorkspaceNumber())->raiseWindow(&window); |
168 | break; | 168 | break; |
169 | 169 | ||
170 | case BScreen::WINDOWLOWER: | 170 | case BScreen::WINDOWLOWER: |
171 | if (window.isIconic()) | 171 | if (window.isIconic()) |
172 | break; | 172 | break; |
173 | 173 | ||
174 | screen->getWorkspace(window.getWorkspaceNumber())->lowerWindow(&window); | 174 | screen->getWorkspace(window.getWorkspaceNumber())->lowerWindow(&window); |
175 | if (window.hasTab()) | 175 | if (window.hasTab()) |
176 | window.getTab()->lower(); //lower tabs AND all it's windows | 176 | window.getTab()->lower(); //lower tabs AND all it's windows |
177 | break; | 177 | break; |
178 | 178 | ||
179 | case BScreen::WINDOWSTICK: | 179 | case BScreen::WINDOWSTICK: |
180 | window.stick(); | 180 | window.stick(); |
181 | break; | 181 | break; |
182 | 182 | ||
183 | case BScreen::WINDOWKILL: | 183 | case BScreen::WINDOWKILL: |
184 | XKillClient(BaseDisplay::getXDisplay(), | 184 | XKillClient(BaseDisplay::getXDisplay(), |
185 | window.getClientWindow()); | 185 | window.getClientWindow()); |
186 | break; | 186 | break; |
187 | case BScreen::WINDOWTAB: | 187 | case BScreen::WINDOWTAB: |
188 | window.setTab(!window.hasTab()); | 188 | window.setTab(!window.hasTab()); |
189 | break; | 189 | break; |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | 193 | ||
194 | void Windowmenu::reconfigure() { | 194 | void Windowmenu::reconfigure() { |
195 | setItemEnabled(1, window.hasTitlebar()); | 195 | setItemEnabled(1, window.hasTitlebar()); |
196 | setItemEnabled(2, window.isIconifiable()); | 196 | setItemEnabled(2, window.isIconifiable()); |
197 | setItemEnabled(3, window.isMaximizable()); | 197 | setItemEnabled(3, window.isMaximizable()); |
198 | setItemEnabled(8, window.isClosable()); | 198 | setItemEnabled(8, window.isClosable()); |
199 | setItemEnabled(10, window.isResizable()); // tab option only enabled if resizable | 199 | setItemEnabled(10, window.isResizable()); // tab option only enabled if resizable |
200 | 200 | ||
201 | sendToMenu.reconfigure(); | 201 | sendToMenu.reconfigure(); |
202 | sendGroupToMenu.reconfigure(); | 202 | sendGroupToMenu.reconfigure(); |
203 | 203 | ||
204 | Basemenu::reconfigure(); | 204 | Basemenu::reconfigure(); |
205 | } | 205 | } |
206 | 206 | ||
207 | 207 | ||
208 | Windowmenu::SendtoWorkspacemenu::SendtoWorkspacemenu(FluxboxWindow &win): Basemenu(win.getScreen()), | 208 | Windowmenu::SendtoWorkspacemenu::SendtoWorkspacemenu(FluxboxWindow &win): Basemenu(win.getScreen()), |
209 | m_fbwindow(win) | 209 | m_fbwindow(win) |
210 | { | 210 | { |
211 | setTitleVisibility(false); | 211 | setTitleVisibility(false); |
212 | setMovable(false); | 212 | setMovable(false); |
213 | setInternalMenu(); | 213 | setInternalMenu(); |
214 | update(); | 214 | update(); |
215 | } | 215 | } |
216 | 216 | ||
217 | 217 | ||
218 | void Windowmenu::SendtoWorkspacemenu::itemSelected(int button, unsigned int index) { | 218 | void Windowmenu::SendtoWorkspacemenu::itemSelected(int button, unsigned int index) { |
219 | if (button > 2) | 219 | if (button > 2) |
220 | return; | 220 | return; |
221 | 221 | ||
222 | if (index <= screen()->getCount()) { | 222 | if (index <= screen()->getCount()) { |
223 | 223 | ||
224 | // no need to send it to a workspace it already exist on | 224 | // no need to send it to a workspace it already exist on |
225 | if (index == screen()->getCurrentWorkspaceID()) | 225 | if (index == screen()->getCurrentWorkspaceID()) |
226 | return; | 226 | return; |
227 | 227 | ||
228 | if (button == 1) { // send to workspace without changing workspace | 228 | if (button == 1) { // send to workspace without changing workspace |
229 | screen()->sendToWorkspace(index, &m_fbwindow, false); | 229 | screen()->sendToWorkspace(index, &m_fbwindow, false); |
230 | } else if (button == 2) { // send to workspace and change workspace | 230 | } else if (button == 2) { // send to workspace and change workspace |
231 | screen()->sendToWorkspace(index, &m_fbwindow, true); | 231 | screen()->sendToWorkspace(index, &m_fbwindow, true); |
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | hide(); | 235 | hide(); |
236 | } | 236 | } |
237 | 237 | ||
238 | 238 | ||
239 | void Windowmenu::SendtoWorkspacemenu::update() { | 239 | void Windowmenu::SendtoWorkspacemenu::update() { |
240 | unsigned int i, r = numberOfItems(); | 240 | unsigned int i, r = numberOfItems(); |
241 | 241 | ||
242 | if (numberOfItems() != 0) { | 242 | if (numberOfItems() != 0) { |
243 | for (i = 0; i < r; ++i) | 243 | for (i = 0; i < r; ++i) |
244 | remove(0); | 244 | remove(0); |
245 | } | 245 | } |
246 | for (i = 0; i < screen()->getCount(); ++i) | 246 | for (i = 0; i < screen()->getCount(); ++i) |
247 | insert(screen()->getWorkspace(i)->name().c_str()); | 247 | insert(screen()->getWorkspace(i)->name().c_str()); |
248 | 248 | ||
249 | Basemenu::update(); | 249 | Basemenu::update(); |
250 | } | 250 | } |
251 | 251 | ||
252 | 252 | ||
253 | void Windowmenu::SendtoWorkspacemenu::show() { | 253 | void Windowmenu::SendtoWorkspacemenu::show() { |
254 | update(); | 254 | update(); |
255 | 255 | ||
256 | Basemenu::show(); | 256 | Basemenu::show(); |
257 | } | 257 | } |
258 | 258 | ||
259 | Windowmenu::SendGroupToWorkspacemenu:: | 259 | Windowmenu::SendGroupToWorkspacemenu:: |
260 | SendGroupToWorkspacemenu(FluxboxWindow &win):SendtoWorkspacemenu(win) | 260 | SendGroupToWorkspacemenu(FluxboxWindow &win):SendtoWorkspacemenu(win) |
261 | { | 261 | { |
262 | 262 | ||
263 | } | 263 | } |
264 | 264 | ||
265 | void Windowmenu::SendGroupToWorkspacemenu::itemSelected(int button, unsigned int index) { | 265 | void Windowmenu::SendGroupToWorkspacemenu::itemSelected(int button, unsigned int index) { |
266 | if (button > 2) | 266 | if (button > 2) |
267 | return; | 267 | return; |
268 | 268 | ||
269 | if (index <= screen()->getCount()) { | 269 | if (index <= screen()->getCount()) { |
270 | if (index == screen()->getCurrentWorkspaceID()) | 270 | if (index == screen()->getCurrentWorkspaceID()) |
271 | return; | 271 | return; |
272 | if (fbwin().isStuck()) | 272 | if (fbwin().isStuck()) |
273 | fbwin().stick(); | 273 | fbwin().stick(); |
274 | 274 | ||
275 | // if the window is iconic, deiconify it | 275 | // if the window is iconic, deiconify it |
276 | if (fbwin().isIconic()) | 276 | if (fbwin().isIconic()) |
277 | fbwin().deiconify(); | 277 | fbwin().deiconify(); |
278 | 278 | ||
279 | if (button == 1) { | 279 | if (button == 1) { |
280 | // TODO: use reassociateGroup from BScreen instead | 280 | // TODO: use reassociateGroup from BScreen instead |
281 | if (fbwin().hasTab()) { | 281 | if (fbwin().hasTab()) { |
282 | for (Tab *first = Tab::getFirst(fbwin().getTab()); | 282 | for (Tab *first = Tab::getFirst(fbwin().getTab()); |
283 | first!=0; first=first->next()) { | 283 | first!=0; first=first->next()) { |
284 | first->withdraw(); | 284 | first->withdraw(); |
285 | first->getWindow()->withdraw(); | 285 | first->getWindow()->withdraw(); |
286 | screen()->reassociateWindow(first->getWindow(), index, true); | 286 | screen()->reassociateWindow(first->getWindow(), index, true); |
287 | 287 | ||
288 | } | 288 | } |
289 | } else { | 289 | } else { |
290 | fbwin().withdraw(); | 290 | fbwin().withdraw(); |
291 | screen()->reassociateWindow(&fbwin(), index, true); | 291 | screen()->reassociateWindow(&fbwin(), index, true); |
292 | } | 292 | } |
293 | 293 | ||
294 | } | 294 | } |
295 | 295 | ||
296 | if (button == 2) | 296 | if (button == 2) |
297 | screen()->changeWorkspaceID(index); | 297 | screen()->changeWorkspaceID(index); |
298 | } | 298 | } |
299 | hide(); | 299 | hide(); |
300 | } | 300 | } |
301 | 301 | ||
302 | 302 | ||