summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Tab.cc168
1 files changed, 84 insertions, 84 deletions
diff --git a/src/Tab.cc b/src/Tab.cc
index fe03e35..41049de 100644
--- a/src/Tab.cc
+++ b/src/Tab.cc
@@ -1,5 +1,5 @@
1// Tab.cc for Fluxbox Window Manager 1// Tab.cc for Fluxbox Window Manager
2// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen@linuxmail.org) 2// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxgen at linuxmail.org)
3// 3//
4// Permission is hereby granted, free of charge, to any person obtaining a 4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"), 5// copy of this software and associated documentation files (the "Software"),
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: Tab.cc,v 1.47 2002/12/01 13:42:00 rathnor Exp $ 22// $Id: Tab.cc,v 1.48 2002/12/07 13:36:03 fluxgen Exp $
23 23
24#include "Tab.hh" 24#include "Tab.hh"
25 25
@@ -238,9 +238,9 @@ void Tab::loadTheme() {
238 if (tmp) image_ctrl->removeImage(tmp); 238 if (tmp) image_ctrl->removeImage(tmp);
239} 239}
240 240
241//-------------- decorate -------------------- 241/**
242// decorates the tab with current theme 242 decorates the tab with current theme
243//-------------------------------------------- 243*/
244void Tab::decorate() { 244void Tab::decorate() {
245 loadTheme(); 245 loadTheme();
246 246
@@ -250,19 +250,19 @@ void Tab::decorate() {
250 m_win->getScreen()->getWindowStyle()->tab.border_color.pixel()); 250 m_win->getScreen()->getWindowStyle()->tab.border_color.pixel());
251} 251}
252 252
253//-------------- deiconify ----------------- 253/**
254// Deiconifies the tab 254 Deiconifies the tab
255// Used from FluxboxWindow to deiconify the tab when the window is deiconfied 255 Used from FluxboxWindow to deiconify the tab when the window is deiconfied
256//------------------------------------------ 256*/
257void Tab::deiconify() { 257void Tab::deiconify() {
258 XMapWindow(m_display, m_tabwin); 258 XMapWindow(m_display, m_tabwin);
259} 259}
260 260
261//------------- iconify -------------------- 261/**
262// Iconifies the tab. 262 Iconifies the tab.
263// Used from FluxboxWindow to hide tab win when window is iconified 263 Used from FluxboxWindow to hide tab win when window is iconified
264// disconnects itself from the list 264 disconnects itself from the list
265//------------------------------------------ 265*/
266void Tab::iconify() { 266void Tab::iconify() {
267 disconnect(); 267 disconnect();
268 withdraw(); 268 withdraw();
@@ -270,16 +270,16 @@ void Tab::iconify() {
270 m_win->setTab(false);//let's get rid of this loner tab 270 m_win->setTab(false);//let's get rid of this loner tab
271} 271}
272 272
273//------------ withdraw -------------- 273/**
274// Unmaps the tab from display 274 Unmaps the tab from display
275//------------------------------------ 275*/
276void Tab::withdraw() { 276void Tab::withdraw() {
277 XUnmapWindow(m_display, m_tabwin); 277 XUnmapWindow(m_display, m_tabwin);
278} 278}
279 279
280//------------ stick -------------------- 280/**
281// Set/reset the the sticky on all windows in the list 281 Set/reset the the sticky on all windows in the list
282//--------------------------------------- 282*/
283void Tab::stick() { 283void Tab::stick() {
284 Tab *tab; 284 Tab *tab;
285 285
@@ -310,9 +310,9 @@ void Tab::stick() {
310 310
311} 311}
312 312
313//------------- resize ------------- 313/**
314// Resize the window's in the tablist 314 Resize the window's in the tablist
315//---------------------------------- 315*/
316void Tab::resize() { 316void Tab::resize() {
317 Tab *tab; 317 Tab *tab;
318 318
@@ -331,9 +331,9 @@ void Tab::resize() {
331 } 331 }
332} 332}
333 333
334//----------- shade -------------- 334/**
335// Shades the windows in the tablist 335 Shades the windows in the tablist
336//-------------------------------- 336*/
337void Tab::shade() { 337void Tab::shade() {
338 Tab *tab; 338 Tab *tab;
339 339
@@ -353,12 +353,12 @@ void Tab::shade() {
353 setPosition(); 353 setPosition();
354} 354}
355 355
356//------------ draw ----------------- 356/**
357// Draws the tab 357 Draws the tab
358// if pressed = true then it draws the tab in pressed 358 if pressed = true then it draws the tab in pressed
359// mode else it draws it in normal mode 359 mode else it draws it in normal mode
360// TODO: the "draw in pressed mode" 360 TODO: the "draw in pressed mode"
361//----------------------------------- 361*/
362void Tab::draw(bool pressed) const { 362void Tab::draw(bool pressed) const {
363 XClearWindow(m_display, m_tabwin); 363 XClearWindow(m_display, m_tabwin);
364 364
@@ -372,7 +372,7 @@ void Tab::draw(bool pressed) const {
372 size_t dlen = m_win->getTitle().size(); 372 size_t dlen = m_win->getTitle().size();
373 373
374 size_t max_width = m_size_w; // special cases in rotated mode 374 size_t max_width = m_size_w; // special cases in rotated mode
375 if (winstyle->tab.font.isRotated()) 375 if (winstyle->tab.font.isRotated() && !m_win->isShaded())
376 max_width = m_size_h; 376 max_width = m_size_h;
377 377
378 int dx = DrawUtil::doAlignment(max_width, m_win->frame.bevel_w, 378 int dx = DrawUtil::doAlignment(max_width, m_win->frame.bevel_w,
@@ -381,28 +381,30 @@ void Tab::draw(bool pressed) const {
381 m_win->getTitle().c_str(), m_win->getTitle().size(), dlen); 381 m_win->getTitle().c_str(), m_win->getTitle().size(), dlen);
382 382
383 int dy = winstyle->tab.font.ascent() + m_win->frame.bevel_w; 383 int dy = winstyle->tab.font.ascent() + m_win->frame.bevel_w;
384 bool rotate = false;
384 // swap dx and dy if we're rotated 385 // swap dx and dy if we're rotated
385 if (winstyle->tab.font.isRotated()) { 386 if (winstyle->tab.font.isRotated() && !m_win->isShaded()) {
386 int tmp = dy; 387 int tmp = dy;
387 dy = m_size_h - dx; // upside down (reverse direction) 388 dy = m_size_h - dx; // upside down (reverse direction)
388 dx = tmp; 389 dx = tmp;
390 rotate = true;
389 } 391 }
390 392 // draw normal without rotation
391 winstyle->tab.font.drawText( 393 winstyle->tab.font.drawText(
392 m_tabwin, 394 m_tabwin,
393 m_win->getScreen()->getScreenNumber(), 395 m_win->getScreen()->getScreenNumber(),
394 gc, 396 gc,
395 m_win->getTitle().c_str(), dlen, 397 m_win->getTitle().c_str(), dlen,
396 dx, dy); 398 dx, dy,
397 399 rotate);
398} 400}
399 401
400//----------------------------------------------- 402/**
401//Helper for the Tab::setPosition() call 403Helper for the Tab::setPosition() call
402//returns the y position component correctly 404returns the y position component correctly
403//according to shading in cases PBOTTOM and 405according to shading in cases PBOTTOM and
404//isShaded() 406isShaded()
405//----------------------------------------------- 407*/
406int Tab::setPositionShadingHelper(bool shaded) { 408int Tab::setPositionShadingHelper(bool shaded) {
407 if (shaded) { 409 if (shaded) {
408 return m_win->getYFrame() + m_win->getTitleHeight() + 410 return m_win->getYFrame() + m_win->getTitleHeight() +
@@ -413,13 +415,13 @@ int Tab::setPositionShadingHelper(bool shaded) {
413 } 415 }
414} 416}
415 417
416//----------------------------------------------- 418/**
417//Helpers for correct alignment of tabs used 419Helpers for correct alignment of tabs used
418//by the setPosition() call 420by the setPosition() call
419//return x/y positions correctly according to 421return x/y positions correctly according to
420//alignment, the 1st for cases PTOP and PBOTTOM 422alignment, the 1st for cases PTOP and PBOTTOM
421//the 2nd for cases PLEFT and PRIGHT 423the 2nd for cases PLEFT and PRIGHT
422//----------------------------------------------- 424*/
423int Tab::setPositionTBAlignHelper(Alignment align) { 425int Tab::setPositionTBAlignHelper(Alignment align) {
424 switch(align) { 426 switch(align) {
425 427
@@ -466,11 +468,11 @@ int Tab::setPositionLRAlignHelper(Alignment align) {
466 } 468 }
467} 469}
468 470
469//------------- setPosition ----------------- 471/**
470// Position tab ( follow the m_win pos ). 472 Position tab ( follow the m_win pos ).
471// (and resize) 473 (and resize)
472// Set new position of the other tabs in the chain 474 Set new position of the other tabs in the chain
473//------------------------------------------- 475*/
474void Tab::setPosition() { 476void Tab::setPosition() {
475 //don't do anything if the tablist is freezed 477 //don't do anything if the tablist is freezed
476 if (m_stoptabs) 478 if (m_stoptabs)
@@ -555,10 +557,10 @@ void Tab::moveNext() {
555} 557}
556 558
557 559
558//------------- calcIncrease ---------------- 560/**
559// calculates m_inc_x and m_inc_y for tabs 561 calculates m_inc_x and m_inc_y for tabs
560// used for positioning the tabs. 562 used for positioning the tabs.
561//------------------------------------------- 563*/
562void Tab::calcIncrease() { 564void Tab::calcIncrease() {
563 Tab *tab; 565 Tab *tab;
564 int inc_x = 0, inc_y = 0; 566 int inc_x = 0, inc_y = 0;
@@ -646,14 +648,14 @@ void Tab::calcIncrease() {
646 } 648 }
647} 649}
648 650
649//------------- buttonPressEvent ----------- 651/**
650// Handle button press event here. 652 Handle button press event here.
651//------------------------------------------ 653*/
652void Tab::buttonPressEvent(XButtonEvent *be) { 654void Tab::buttonPressEvent(XButtonEvent *be) {
653 //draw in pressed mode 655 //draw in pressed mode
654 draw(true); 656 draw(true);
655 657
656 //invoke root menu with auto-glueing? 658 //invoke root menu with auto-tab?
657 if (be->button == 3) { 659 if (be->button == 3) {
658 BScreen *screen = m_win->getScreen(); 660 BScreen *screen = m_win->getScreen();
659 Rootmenu *rootmenu = screen->getRootmenu(); 661 Rootmenu *rootmenu = screen->getRootmenu();
@@ -674,11 +676,11 @@ void Tab::buttonPressEvent(XButtonEvent *be) {
674 } 676 }
675} 677}
676 678
677//----------- buttonReleaseEvent ---------- 679/**
678// Handle button release event here. 680 Handle button release event here.
679// If tab is dropped then it should try to find 681 If tab is dropped then it should try to find
680// the window where the tab where dropped. 682 the window where the tab where dropped.
681//----------------------------------------- 683*/
682void Tab::buttonReleaseEvent(XButtonEvent *be) { 684void Tab::buttonReleaseEvent(XButtonEvent *be) {
683 685
684 if (m_moving) { 686 if (m_moving) {
@@ -1079,9 +1081,7 @@ void Tab::setTabHeight(unsigned int h) {
1079// PLeft || PRight && isTabRotateVertical 1081// PLeft || PRight && isTabRotateVertical
1080// --------------------------------------- 1082// ---------------------------------------
1081void Tab::resizeGroup() { 1083void Tab::resizeGroup() {
1082#ifdef DEBUG 1084
1083 cerr <<__FILE__<<"("<<__LINE__<<"): Resizing group"<<endl;
1084#endif //DEBUG
1085 Tab *first; 1085 Tab *first;
1086 for (first = getFirst(this); first != 0; first = first->m_next) { 1086 for (first = getFirst(this); first != 0; first = first->m_next) {
1087 if ((m_win->getScreen()->getTabPlacement() == PLEFT || 1087 if ((m_win->getScreen()->getTabPlacement() == PLEFT ||
@@ -1111,20 +1111,20 @@ unsigned int Tab::calcRelativeWidth() {
1111 return ((m_win->getWidth() + m_win->getScreen()->getBorderWidth2x())/num); 1111 return ((m_win->getWidth() + m_win->getScreen()->getBorderWidth2x())/num);
1112} 1112}
1113 1113
1114//--------------- numObjects ------------------- 1114/**
1115// Returns the number of objects in 1115 Returns the number of objects in
1116// the TabGroup. 1116 the TabGroup.
1117//----------------------------------------------- 1117*/
1118unsigned int Tab::numObjects() { 1118unsigned int Tab::numObjects() {
1119 unsigned int num = 0; 1119 unsigned int num = 0;
1120 for (Tab *tab = getFirst(this); tab != 0; tab = tab->m_next, num++); 1120 for (Tab *tab = getFirst(this); tab != 0; tab = tab->m_next, num++);
1121 return num; 1121 return num;
1122} 1122}
1123 1123
1124//------------- calcRelativeHeight ------- 1124/**
1125// Returns: Calculated height for relative 1125 Returns: Calculated height for relative
1126// alignment 1126 alignment
1127//---------------------------------------- 1127*/
1128unsigned int Tab::calcRelativeHeight() { 1128unsigned int Tab::calcRelativeHeight() {
1129 return ((m_win->getHeight() + 1129 return ((m_win->getHeight() +
1130 m_win->getScreen()->getBorderWidth2x())/numObjects()); 1130 m_win->getScreen()->getBorderWidth2x())/numObjects());