diff options
author | fluxgen <fluxgen> | 2002-11-25 14:07:21 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2002-11-25 14:07:21 (GMT) |
commit | 99c92a637392a988382559d0b162aed68ab83ba8 (patch) | |
tree | d353aa10684ed0814327a64e9aef041510e08a41 /src/Tab.cc | |
parent | 1fc16d3d3d8a62a9697f4a42044b695707fe5d50 (diff) | |
download | fluxbox_pavel-99c92a637392a988382559d0b162aed68ab83ba8.zip fluxbox_pavel-99c92a637392a988382559d0b162aed68ab83ba8.tar.bz2 |
fixed rotated text on vertical tab in XFontImp and a rotate function in FontImp interface
Diffstat (limited to 'src/Tab.cc')
-rw-r--r-- | src/Tab.cc | 46 |
1 files changed, 20 insertions, 26 deletions
@@ -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.41 2002/11/17 13:40:01 fluxgen Exp $ | 22 | // $Id: Tab.cc,v 1.42 2002/11/25 14:07:21 fluxgen Exp $ |
23 | 23 | ||
24 | #include "Tab.hh" | 24 | #include "Tab.hh" |
25 | 25 | ||
@@ -367,43 +367,30 @@ void Tab::draw(bool pressed) const { | |||
367 | GC gc = ((m_win->isFocused()) ? m_win->getScreen()->getWindowStyle()->tab.l_text_focus_gc : | 367 | GC gc = ((m_win->isFocused()) ? m_win->getScreen()->getWindowStyle()->tab.l_text_focus_gc : |
368 | m_win->getScreen()->getWindowStyle()->tab.l_text_unfocus_gc); | 368 | m_win->getScreen()->getWindowStyle()->tab.l_text_unfocus_gc); |
369 | 369 | ||
370 | // Different routines for drawing rotated text | ||
371 | // TODO: rotated font | ||
372 | /*if ((m_win->getScreen()->getTabPlacement() == PLEFT || | ||
373 | m_win->getScreen()->getTabPlacement() == PRIGHT) && | ||
374 | (!m_win->isShaded() && m_win->getScreen()->isTabRotateVertical())) { | ||
375 | |||
376 | tabtext_w = DrawUtil::XRotTextWidth(m_win->getScreen()->getWindowStyle()->tab.rot_font, | ||
377 | m_win->getTitle().c_str(), m_win->getTitle().size()); | ||
378 | tabtext_w += (m_win->frame.bevel_w * 4); | ||
379 | |||
380 | DrawUtil::DrawRotString(m_display, m_tabwin, gc, | ||
381 | m_win->getScreen()->getWindowStyle()->tab.rot_font, | ||
382 | m_win->getScreen()->getWindowStyle()->tab.font.justify, | ||
383 | tabtext_w, m_size_w, m_size_h, | ||
384 | m_win->frame.bevel_w, m_win->getTitle().c_str()); | ||
385 | |||
386 | } else { | ||
387 | */ | ||
388 | int dx=0; | 370 | int dx=0; |
389 | Theme::WindowStyle *winstyle = m_win->getScreen()->getWindowStyle(); | 371 | Theme::WindowStyle *winstyle = m_win->getScreen()->getWindowStyle(); |
390 | size_t dlen = m_win->getTitle().size(); | 372 | size_t dlen = m_win->getTitle().size(); |
391 | size_t l = winstyle->tab.font.textWidth(m_win->getTitle().c_str(), dlen); | 373 | size_t l = winstyle->tab.font.textWidth(m_win->getTitle().c_str(), dlen); |
374 | |||
375 | size_t max_width = m_size_w; // special cases in rotated mode | ||
376 | if (winstyle->tab.font.isRotated()) | ||
377 | max_width = m_size_h; | ||
378 | |||
392 | if ( l > m_size_w) { | 379 | if ( l > m_size_w) { |
393 | for (; dlen >= 0; dlen--) { | 380 | for (; dlen >= 0; dlen--) { |
394 | l = winstyle->tab.font.textWidth(m_win->getTitle().c_str(), dlen) + m_win->frame.bevel_w*4; | 381 | l = winstyle->tab.font.textWidth(m_win->getTitle().c_str(), dlen) + m_win->frame.bevel_w*4; |
395 | 382 | ||
396 | if (l < m_size_w || dlen == 0) | 383 | if (l < max_width || dlen == 0) |
397 | break; | 384 | break; |
398 | } | 385 | } |
399 | } | 386 | } |
400 | 387 | ||
401 | switch (winstyle->tab.justify) { | 388 | switch (winstyle->tab.justify) { |
402 | case DrawUtil::Font::RIGHT: | 389 | case DrawUtil::Font::RIGHT: |
403 | dx += m_size_w - l - m_win->frame.bevel_w*3; | 390 | dx += max_width - l - m_win->frame.bevel_w*3; |
404 | break; | 391 | break; |
405 | case DrawUtil::Font::CENTER: | 392 | case DrawUtil::Font::CENTER: |
406 | dx += (m_size_w - l) / 2; | 393 | dx += (max_width - l) / 2; |
407 | break; | 394 | break; |
408 | case DrawUtil::Font::LEFT: | 395 | case DrawUtil::Font::LEFT: |
409 | dx = m_win->frame.bevel_w; | 396 | dx = m_win->frame.bevel_w; |
@@ -411,14 +398,21 @@ void Tab::draw(bool pressed) const { | |||
411 | default: | 398 | default: |
412 | break; | 399 | break; |
413 | } | 400 | } |
414 | 401 | ||
415 | m_win->getScreen()->getWindowStyle()->tab.font.drawText( | 402 | int dy = winstyle->tab.font.ascent() + m_win->frame.bevel_w; |
403 | // swap dx and dy if we're rotated | ||
404 | if (winstyle->tab.font.isRotated()) { | ||
405 | int tmp = dy; | ||
406 | dy = m_size_h - dx; // upside down | ||
407 | dx = tmp; | ||
408 | } | ||
409 | |||
410 | winstyle->tab.font.drawText( | ||
416 | m_tabwin, | 411 | m_tabwin, |
417 | m_win->getScreen()->getScreenNumber(), | 412 | m_win->getScreen()->getScreenNumber(), |
418 | gc, | 413 | gc, |
419 | m_win->getTitle().c_str(), dlen, | 414 | m_win->getTitle().c_str(), dlen, |
420 | dx, | 415 | dx, dy); |
421 | m_win->getScreen()->getWindowStyle()->tab.font.ascent() + m_win->frame.bevel_w); | ||
422 | 416 | ||
423 | } | 417 | } |
424 | 418 | ||