|
Lines 21-27
Link Here
|
| 21 |
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
21 |
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 22 |
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 |
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 23 |
|
23 |
|
| 24 |
******************************************************************/ |
24 |
***************************************************************** |
|
|
25 |
|
| 26 |
Additional changes: |
| 27 |
- 2013/10/22 Michele Calgaro |
| 28 |
* added support for display mode (Icons and Text, Text only, Icons only) |
| 29 |
and removed "Show application icons" |
| 30 |
*/ |
| 25 |
|
31 |
|
| 26 |
#include <assert.h> |
32 |
#include <assert.h> |
| 27 |
|
33 |
|
|
Lines 216-222
Link Here
|
| 216 |
|
222 |
|
| 217 |
void TaskContainer::showMe() |
223 |
void TaskContainer::showMe() |
| 218 |
{ |
224 |
{ |
| 219 |
if(!frames.isEmpty() && taskBar->showIcon()) |
225 |
if(!frames.isEmpty() && taskBar->showIcons()) |
| 220 |
animationTimer.start(100); |
226 |
animationTimer.start(100); |
| 221 |
|
227 |
|
| 222 |
emit showMe(this); |
228 |
emit showMe(this); |
|
Lines 307-334
Link Here
|
| 307 |
|
313 |
|
| 308 |
void TaskContainer::animationTimerFired() |
314 |
void TaskContainer::animationTimerFired() |
| 309 |
{ |
315 |
{ |
| 310 |
if (!frames.isEmpty() && taskBar->showIcon() && frames.at(currentFrame) != frames.end()) |
316 |
if (!frames.isEmpty() && taskBar->showIcons() && frames.at(currentFrame) != frames.end()) |
| 311 |
{ |
317 |
{ |
| 312 |
TQPixmap *pm = *frames.at(currentFrame); |
318 |
TQPixmap *pm = *frames.at(currentFrame); |
| 313 |
|
319 |
|
| 314 |
// draw pixmap |
320 |
// draw pixmap |
| 315 |
if ( pm && !pm->isNull() ) { |
321 |
if ( pm && !pm->isNull() ) |
|
|
322 |
{ |
| 316 |
// we only have to redraw the background for frames 0, 8 and 9 |
323 |
// we only have to redraw the background for frames 0, 8 and 9 |
| 317 |
if ( currentFrame == 0 || currentFrame > 7 ) { |
324 |
if ( currentFrame == 0 || currentFrame > 7 ) |
| 318 |
// double buffered painting |
325 |
{ |
| 319 |
TQPixmap composite( animBg ); |
326 |
// double buffered painting |
| 320 |
bitBlt( &composite, 0, 0, pm ); |
327 |
TQPixmap composite( animBg ); |
| 321 |
bitBlt( this, iconRect.x(), iconRect.y(), &composite ); |
328 |
bitBlt( &composite, 0, 0, pm ); |
| 322 |
} |
329 |
bitBlt( this, iconRect.x(), iconRect.y(), &composite ); |
| 323 |
else |
330 |
} |
| 324 |
bitBlt( this, iconRect.x(), iconRect.y(), pm ); |
331 |
else |
| 325 |
} |
332 |
bitBlt( this, iconRect.x(), iconRect.y(), pm ); |
| 326 |
|
333 |
} |
| 327 |
// increment frame counter |
334 |
|
| 328 |
if ( currentFrame >= 9) |
335 |
// increment frame counter |
| 329 |
currentFrame = 0; |
336 |
if ( currentFrame >= 9) |
| 330 |
else |
337 |
currentFrame = 0; |
| 331 |
currentFrame++; |
338 |
else |
|
|
339 |
currentFrame++; |
| 332 |
} |
340 |
} |
| 333 |
} |
341 |
} |
| 334 |
|
342 |
|
|
Lines 685-836
Link Here
|
| 685 |
{ |
693 |
{ |
| 686 |
p->translate(shift.x(), shift.y()); |
694 |
p->translate(shift.x(), shift.y()); |
| 687 |
} |
695 |
} |
|
|
696 |
|
| 697 |
TQString text = name(); // find text |
| 698 |
int textPos = ( taskBar->showIcons() && (!pixmap.isNull() || m_startup)) ? 2 + 16 + 2 : 0; |
| 688 |
|
699 |
|
| 689 |
if (taskBar->showIcon()) |
700 |
// show icons |
| 690 |
{ |
701 |
if (taskBar->showIcons()) |
| 691 |
if (pixmap.isNull() && m_startup) |
|
|
| 692 |
{ |
| 693 |
pixmap = SmallIcon(m_startup->icon()); |
| 694 |
} |
| 695 |
|
| 696 |
if ( !pixmap.isNull() ) |
| 697 |
{ |
| 698 |
// make sure it is no larger than 16x16 |
| 699 |
if ( pixmap.width() > 16 || pixmap.height() > 16 ) |
| 700 |
{ |
| 701 |
TQImage tmp = pixmap.convertToImage(); |
| 702 |
pixmap.convertFromImage( tmp.smoothScale( 16, 16 ) ); |
| 703 |
} |
| 704 |
|
| 705 |
// fade out the icon when minimized |
| 706 |
if (iconified) |
| 707 |
{ |
| 708 |
TDEIconEffect::semiTransparent( pixmap ); |
| 709 |
} |
| 710 |
|
| 711 |
// draw icon |
| 712 |
TQRect pmr(0, 0, pixmap.width(), pixmap.height()); |
| 713 |
pmr.moveCenter(iconRect.center()); |
| 714 |
p->drawPixmap(pmr, pixmap); |
| 715 |
} |
| 716 |
} |
| 717 |
|
| 718 |
// find text |
| 719 |
TQString text = name(); |
| 720 |
|
| 721 |
// modified overlay |
| 722 |
static TQString modStr = "[" + i18n( "modified" ) + "]"; |
| 723 |
int modStrPos = text.find( modStr ); |
| 724 |
int textPos = ( taskBar->showIcon() && (!pixmap.isNull() || m_startup)) ? 2 + 16 + 2 : 0; |
| 725 |
|
| 726 |
if (modStrPos >= 0) |
| 727 |
{ |
702 |
{ |
| 728 |
// +1 because we include a space after the closing brace. |
703 |
if (pixmap.isNull() && m_startup) |
| 729 |
text.remove(modStrPos, modStr.length() + 1); |
704 |
pixmap = SmallIcon(m_startup->icon()); |
| 730 |
TQPixmap modPixmap = SmallIcon("modified"); |
|
|
| 731 |
|
| 732 |
// draw modified overlay |
| 733 |
if (!modPixmap.isNull()) |
| 734 |
{ |
| 735 |
TQRect r = TQStyle::visualRect(TQRect(br.x() + textPos, |
| 736 |
(height() - 16) / 2, 16, 16), |
| 737 |
this); |
| 738 |
|
705 |
|
|
|
706 |
if ( !pixmap.isNull() ) |
| 707 |
{ |
| 708 |
// make sure it is no larger than 16x16 |
| 709 |
if ( pixmap.width() > 16 || pixmap.height() > 16 ) |
| 710 |
{ |
| 711 |
TQImage tmp = pixmap.convertToImage(); |
| 712 |
pixmap.convertFromImage( tmp.smoothScale( 16, 16 ) ); |
| 713 |
} |
| 714 |
|
| 715 |
// fade out the icon when minimized |
| 716 |
if (iconified) |
| 717 |
TDEIconEffect::semiTransparent( pixmap ); |
| 718 |
|
| 719 |
// draw icon |
| 720 |
TQRect pmr(0, 0, pixmap.width(), pixmap.height()); |
| 721 |
pmr.moveCenter(iconRect.center()); |
| 722 |
p->drawPixmap(pmr, pixmap); |
| 723 |
} |
| 724 |
|
| 725 |
// modified overlay icon |
| 726 |
if (taskBar->showText()) |
| 727 |
{ |
| 728 |
static TQString modStr = "[" + i18n( "modified" ) + "]"; |
| 729 |
int modStrPos = text.find( modStr ); |
| 730 |
if (modStrPos >= 0) |
| 731 |
{ |
| 732 |
// +1 because we include a space after the closing brace. |
| 733 |
text.remove(modStrPos, modStr.length() + 1); |
| 734 |
TQPixmap modPixmap = SmallIcon("modified"); |
| 735 |
|
| 736 |
// draw modified overlay |
| 737 |
if (!modPixmap.isNull()) |
| 738 |
{ |
| 739 |
TQRect r = TQStyle::visualRect(TQRect(br.x() + textPos,(height() - 16) / 2, 16, 16), this); |
| 739 |
if (iconified) |
740 |
if (iconified) |
| 740 |
{ |
741 |
{ |
| 741 |
TDEIconEffect::semiTransparent(modPixmap); |
742 |
TDEIconEffect::semiTransparent(modPixmap); |
| 742 |
} |
743 |
} |
| 743 |
|
|
|
| 744 |
p->drawPixmap(r, modPixmap); |
744 |
p->drawPixmap(r, modPixmap); |
| 745 |
textPos += 16 + 2; |
745 |
textPos += 16 + 2; |
|
|
746 |
} |
| 746 |
} |
747 |
} |
|
|
748 |
} |
| 747 |
} |
749 |
} |
| 748 |
|
750 |
|
| 749 |
// draw text |
751 |
// draw text |
| 750 |
if (!text.isEmpty()) |
752 |
if (taskBar->showText()) |
| 751 |
{ |
753 |
{ |
| 752 |
TQRect tr = TQStyle::visualRect(TQRect(br.x() + textPos + 1, 0, |
754 |
if (!text.isEmpty()) |
| 753 |
width() - textPos, height()), |
755 |
{ |
| 754 |
this); |
756 |
TQRect tr = TQStyle::visualRect(TQRect(br.x() + textPos + 1, 0, |
| 755 |
int textFlags = AlignVCenter | SingleLine; |
757 |
width() - textPos, height()), this); |
| 756 |
textFlags |= reverse ? AlignRight : AlignLeft; |
758 |
int textFlags = AlignVCenter | SingleLine; |
| 757 |
TQPen textPen; |
759 |
textFlags |= reverse ? AlignRight : AlignLeft; |
| 758 |
|
760 |
TQPen textPen; |
| 759 |
// get the color for the text label |
761 |
|
| 760 |
if (iconified) |
762 |
// get the color for the text label |
| 761 |
{ |
763 |
if (iconified) |
| 762 |
textPen = TQPen(KickerLib::blendColors(colors.button(), colors.buttonText())); |
764 |
{ |
| 763 |
} |
765 |
textPen = TQPen(KickerLib::blendColors(colors.button(), colors.buttonText())); |
| 764 |
else if (!active) |
766 |
} |
| 765 |
{ |
767 |
else if (!active) |
| 766 |
textPen = TQPen(colors.buttonText()); |
768 |
{ |
| 767 |
} |
769 |
textPen = TQPen(colors.buttonText()); |
| 768 |
else // hack for the dotNET style and others |
770 |
} |
| 769 |
{ |
771 |
else // hack for the dotNET style and others |
| 770 |
if (READ_MERGED_TASBKAR_SETTING(useCustomColors)) |
772 |
{ |
| 771 |
{ |
773 |
if (READ_MERGED_TASBKAR_SETTING(useCustomColors)) |
| 772 |
textPen = TQPen(READ_MERGED_TASBKAR_SETTING(activeTaskTextColor)); |
774 |
{ |
| 773 |
} |
775 |
textPen = TQPen(READ_MERGED_TASBKAR_SETTING(activeTaskTextColor)); |
| 774 |
else |
776 |
} |
| 775 |
{ |
777 |
else |
| 776 |
textPen = TQPen(colors.buttonText()); // textPen = p->pen(); |
778 |
{ |
| 777 |
} |
779 |
textPen = TQPen(colors.buttonText()); // textPen = p->pen(); |
| 778 |
} |
780 |
} |
| 779 |
|
781 |
} |
| 780 |
int availableWidth = width() - (br.x() * 2) - textPos - 2 - (READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())?2:0; |
782 |
|
| 781 |
if (m_filteredTasks.count() > 1) |
783 |
int availableWidth = width() - (br.x() * 2) - textPos - 2 - (READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())?2:0; |
| 782 |
{ |
784 |
if (m_filteredTasks.count() > 1) |
| 783 |
availableWidth -= 8; |
785 |
{ |
| 784 |
} |
786 |
availableWidth -= 8; |
| 785 |
|
787 |
} |
| 786 |
if (TQFontMetrics(font).width(text) > availableWidth) |
788 |
|
| 787 |
{ |
789 |
if (TQFontMetrics(font).width(text) > availableWidth) |
| 788 |
// draw text into overlay pixmap |
790 |
{ |
| 789 |
TQPixmap tpm(*pm); |
791 |
// draw text into overlay pixmap |
| 790 |
TQPainter tp(&tpm); |
792 |
TQPixmap tpm(*pm); |
| 791 |
|
793 |
TQPainter tp(&tpm); |
| 792 |
if (sunken) |
794 |
|
| 793 |
{ |
795 |
if (sunken) |
| 794 |
tp.translate(shift.x(), shift.y()); |
796 |
{ |
| 795 |
} |
797 |
tp.translate(shift.x(), shift.y()); |
| 796 |
|
798 |
} |
| 797 |
tp.setFont(font); |
799 |
|
| 798 |
tp.setPen(textPen); |
800 |
tp.setFont(font); |
| 799 |
|
801 |
tp.setPen(textPen); |
| 800 |
if (halo) |
802 |
|
| 801 |
{ |
803 |
if (halo) |
| 802 |
taskBar->textShadowEngine()->drawText(tp, tr, textFlags, text, size()); |
804 |
{ |
| 803 |
} |
805 |
taskBar->textShadowEngine()->drawText(tp, tr, textFlags, text, size()); |
| 804 |
else |
806 |
} |
| 805 |
{ |
807 |
else |
| 806 |
tp.drawText(tr, textFlags, text); |
808 |
{ |
| 807 |
} |
809 |
tp.drawText(tr, textFlags, text); |
| 808 |
|
810 |
} |
| 809 |
// blend text into background image |
811 |
|
| 810 |
TQImage img = pm->convertToImage(); |
812 |
// blend text into background image |
| 811 |
TQImage timg = tpm.convertToImage(); |
813 |
TQImage img = pm->convertToImage(); |
| 812 |
KImageEffect::blend(img, timg, *taskBar->blendGradient(size()), KImageEffect::Red); |
814 |
TQImage timg = tpm.convertToImage(); |
| 813 |
|
815 |
KImageEffect::blend(img, timg, *taskBar->blendGradient(size()), KImageEffect::Red); |
| 814 |
// End painting before assigning the pixmap |
816 |
|
| 815 |
TQPaintDevice* opd = p->device(); |
817 |
// End painting before assigning the pixmap |
| 816 |
p->end(); |
818 |
TQPaintDevice* opd = p->device(); |
| 817 |
pm->convertFromImage(img); |
819 |
p->end(); |
| 818 |
p->begin(opd ,this); |
820 |
pm->convertFromImage(img); |
| 819 |
} |
821 |
p->begin(opd ,this); |
| 820 |
else |
822 |
} |
| 821 |
{ |
823 |
else |
| 822 |
p->setFont(font); |
824 |
{ |
| 823 |
p->setPen(textPen); |
825 |
p->setFont(font); |
| 824 |
|
826 |
p->setPen(textPen); |
| 825 |
if (halo) |
827 |
|
| 826 |
{ |
828 |
if (halo) |
| 827 |
taskBar->textShadowEngine()->drawText(*p, tr, textFlags, text, size()); |
829 |
{ |
| 828 |
} |
830 |
taskBar->textShadowEngine()->drawText(*p, tr, textFlags, text, size()); |
| 829 |
else |
831 |
} |
| 830 |
{ |
832 |
else |
| 831 |
p->drawText(tr, textFlags, text); |
833 |
{ |
| 832 |
} |
834 |
p->drawText(tr, textFlags, text); |
| 833 |
} |
835 |
} |
|
|
836 |
} |
| 837 |
} |
| 834 |
} |
838 |
} |
| 835 |
|
839 |
|
| 836 |
if (!frames.isEmpty() && m_startup && frames.at(currentFrame) != frames.end()) |
840 |
if (!frames.isEmpty() && m_startup && frames.at(currentFrame) != frames.end()) |