diff options
Diffstat (limited to 'src/note.cpp')
-rw-r--r-- | src/note.cpp | 634 |
1 files changed, 317 insertions, 317 deletions
diff --git a/src/note.cpp b/src/note.cpp index fd1fb34..54bb90d 100644 --- a/src/note.cpp +++ b/src/note.cpp @@ -18,19 +18,19 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#include <qpainter.h> +#include <tqpainter.h> #include <kglobalsettings.h> -#include <qstyle.h> +#include <tqstyle.h> #include <kapplication.h> #include <kstyle.h> -#include <qcursor.h> +#include <tqcursor.h> #include <kiconloader.h> #include <kpixmapeffect.h> #include <kpixmap.h> #include <kglobal.h> #include <klocale.h> #include <kurifilter.h> -#include <qfile.h> +#include <tqfile.h> #include <stdlib.h> // rand() function #include <math.h> // sqrt() and pow() functions @@ -68,12 +68,12 @@ int Note::TAG_ARROW_WIDTH = 5; int Note::EMBLEM_SIZE = 16; int Note::MIN_HEIGHT = 2*NOTE_MARGIN + EMBLEM_SIZE; -Note::Note(Basket *parent) +Note::Note(Basket *tqparent) : m_prev(0), m_next(0), m_x(0), m_y(-1), m_width(-1), m_height(-1), m_groupWidth(250), m_isFolded(false), m_firstChild(0L), m_parentNote(0), - m_basket(parent), m_content(0), m_addedDate(QDateTime::currentDateTime()), m_lastModificationDate(QDateTime::currentDateTime()), + m_basket(tqparent), m_content(0), m_addedDate(TQDateTime::tqcurrentDateTime()), m_lastModificationDate(TQDateTime::tqcurrentDateTime()), m_computedAreas(false), m_onTop(false), m_deltaX(0), m_deltaY(0), m_deltaHeight(0), m_collapseFinished(true), m_expandingFinished(true), m_hovered(false), m_hoveredZone(Note::None), m_focused(false), m_selected(false), m_wasInLastSelectionRect(false), @@ -88,27 +88,27 @@ Note::~Note() deleteChilds(); } -QString Note::addedStringDate() +TQString Note::addedStringDate() { return KGlobal::locale()->formatDateTime(m_addedDate); } -QString Note::lastModificationStringDate() +TQString Note::lastModificationStringDate() { return KGlobal::locale()->formatDateTime(m_lastModificationDate); } -QString Note::toText(const QString &cuttedFullPath) +TQString Note::toText(const TQString &cuttedFullPath) { if (content()) { // Convert note to text: - QString text = content()->toText(cuttedFullPath); + TQString text = content()->toText(cuttedFullPath); // If we should not export tags with the text, return immediatly: if (!Settings::exportTextTags()) return text; // Compute the text equivalent of the tag states: - QString firstLine; - QString otherLines; + TQString firstLine; + TQString otherLines; for (State::List::Iterator it = m_states.begin(); it != m_states.end(); ++it) { if (!(*it)->textEquivalent().isEmpty()) { firstLine += (*it)->textEquivalent() + " "; @@ -121,8 +121,8 @@ QString Note::toText(const QString &cuttedFullPath) return text; if (otherLines.isEmpty()) return firstLine + text; - QStringList lines = QStringList::split('\n', text, /*allowEmptyEntries=*/true); - QString result = firstLine + lines[0] + (lines.count() > 1 ? "\n" : ""); + TQStringList lines = TQStringList::split('\n', text, /*allowEmptyEntries=*/true); + TQString result = firstLine + lines[0] + (lines.count() > 1 ? "\n" : ""); for (uint i = 1/*Skip the first line*/; i < lines.count(); ++i) result += otherLines + lines[i] + (i < lines.count() - 1 ? "\n" : ""); return result; @@ -212,7 +212,7 @@ int Note::countDirectChilds() return count; } -QString Note::fullPath() +TQString Note::fullPath() { if (content()) return basket()->fullPath() + content()->fileName(); @@ -275,17 +275,17 @@ void Note::finishLazyLoad() child->finishLazyLoad(); } -void Note::selectIn(const QRect &rect, bool invertSelection, bool unselectOthers /*= true*/) +void Note::selectIn(const TQRect &rect, bool invertSelection, bool unselectOthers /*= true*/) { -// QRect myRect(x(), y(), width(), height()); +// TQRect myRect(x(), y(), width(), height()); // bool intersects = myRect.intersects(rect); // Only intersects with visible areas. // If the note is not visible, the user don't think it will be selected while selecting the note(s) that hide this, so act like the user think: bool intersects = false; - for (QValueList<QRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) { - QRect &r = *it; + for (TQValueList<TQRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) { + TQRect &r = *it; if (r.intersects(rect)) { intersects = true; break; @@ -422,7 +422,7 @@ NoteSelection* Note::selectedNotes() NoteSelection *reducedSelection = selection->firstChild; // delete selection; // TODO: Cut all connexions of 'selection' before deleting it! for (NoteSelection *node = reducedSelection; node; node = node->next) - node->parent = 0; + node->tqparent = 0; return reducedSelection; } } else { @@ -445,7 +445,7 @@ bool Note::isAfter(Note *note) return true; } -bool Note::contains(Note *note) +bool Note::tqcontains(Note *note) { // if (this == note) // return true; @@ -454,10 +454,10 @@ bool Note::contains(Note *note) if (note == this) return true; else - note = note->parentNote(); + note = note->tqparentNote(); // FOR_EACH_CHILD (child) -// if (child->contains(note)) +// if (child->tqcontains(note)) // return true; return false; } @@ -520,18 +520,18 @@ int Note::yExpander() bool Note::isFree() { - return parentNote() == 0 && basket()->isFreeLayout(); + return tqparentNote() == 0 && basket()->isFreeLayout(); } bool Note::isColumn() { - return parentNote() == 0 && basket()->isColumnsLayout(); + return tqparentNote() == 0 && basket()->isColumnsLayout(); } bool Note::hasResizer() { // "isFree" || "isColmun but not the last" - return parentNote() == 0 && (basket()->isFreeLayout() || m_next != 0L); + return tqparentNote() == 0 && (basket()->isFreeLayout() || m_next != 0L); } int Note::resizerHeight() @@ -549,7 +549,7 @@ void Note::setHoveredZone(Zone zone) // TODO: Remove setHovered(bool) and assume } } -Note::Zone Note::zoneAt(const QPoint &pos, bool toAdd) +Note::Zone Note::zoneAt(const TQPoint &pos, bool toAdd) { // Keep the resizer highlighted when resizong, even if the cursor is over another note: if (basket()->resizingNote() == this) @@ -641,16 +641,16 @@ Note::Zone Note::zoneAt(const QPoint &pos, bool toAdd) if (!linkAt(pos).isEmpty()) return Link; - int customZone = content()->zoneAt(pos - QPoint(contentX(), NOTE_MARGIN)); + int customZone = content()->zoneAt(pos - TQPoint(contentX(), NOTE_MARGIN)); if (customZone) return (Note::Zone)customZone; return Content; } -QString Note::linkAt(const QPoint &pos) +TQString Note::linkAt(const TQPoint &pos) { - QString link = m_content->linkAt(pos - QPoint(contentX(), NOTE_MARGIN)); + TQString link = m_content->linkAt(pos - TQPoint(contentX(), NOTE_MARGIN)); if (link.isEmpty()) return link; else @@ -662,10 +662,10 @@ int Note::contentX() return HANDLE_WIDTH + NOTE_MARGIN + (EMBLEM_SIZE+NOTE_MARGIN)*m_emblemsCount + TAG_ARROW_WIDTH + NOTE_MARGIN; } -QRect Note::zoneRect(Note::Zone zone, const QPoint &pos) +TQRect Note::zoneRect(Note::Zone zone, const TQPoint &pos) { if (zone >= Emblem0) - return QRect(HANDLE_WIDTH + (NOTE_MARGIN+EMBLEM_SIZE)*(zone-Emblem0), + return TQRect(HANDLE_WIDTH + (NOTE_MARGIN+EMBLEM_SIZE)*(zone-Emblem0), INSERTION_HEIGHT, NOTE_MARGIN + EMBLEM_SIZE, height() - 2*INSERTION_HEIGHT); @@ -673,37 +673,37 @@ QRect Note::zoneRect(Note::Zone zone, const QPoint &pos) int yExp; int right; int xGroup = (isFree() ? (isGroup() ? 0 : GROUP_WIDTH) : width() / 2); - QRect rect; + TQRect rect; int insertSplit = (Settings::groupOnInsertionLine() ? 2 : 1); switch (zone) { - case Note::Handle: return QRect(0, 0, HANDLE_WIDTH, height()); + case Note::Handle: return TQRect(0, 0, HANDLE_WIDTH, height()); case Note::Group: yExp = yExpander(); - if (pos.y() < yExp) return QRect(0, INSERTION_HEIGHT, width(), yExp - INSERTION_HEIGHT); - if (pos.y() > yExp + EXPANDER_HEIGHT) return QRect(0, yExp + EXPANDER_HEIGHT, width(), height() - yExp - EXPANDER_HEIGHT - INSERTION_HEIGHT); - if (pos.x() < NOTE_MARGIN) return QRect(0, 0, NOTE_MARGIN, height()); - else return QRect(width() - NOTE_MARGIN, 0, NOTE_MARGIN, height()); - case Note::TagsArrow: return QRect(HANDLE_WIDTH + (NOTE_MARGIN+EMBLEM_SIZE)*m_emblemsCount, + if (pos.y() < yExp) return TQRect(0, INSERTION_HEIGHT, width(), yExp - INSERTION_HEIGHT); + if (pos.y() > yExp + EXPANDER_HEIGHT) return TQRect(0, yExp + EXPANDER_HEIGHT, width(), height() - yExp - EXPANDER_HEIGHT - INSERTION_HEIGHT); + if (pos.x() < NOTE_MARGIN) return TQRect(0, 0, NOTE_MARGIN, height()); + else return TQRect(width() - NOTE_MARGIN, 0, NOTE_MARGIN, height()); + case Note::TagsArrow: return TQRect(HANDLE_WIDTH + (NOTE_MARGIN+EMBLEM_SIZE)*m_emblemsCount, INSERTION_HEIGHT, NOTE_MARGIN + TAG_ARROW_WIDTH + NOTE_MARGIN, height() - 2*INSERTION_HEIGHT); case Note::Custom0: - case Note::Content: rect = content()->zoneRect(zone, pos - QPoint(contentX(), NOTE_MARGIN)); + case Note::Content: rect = content()->zoneRect(zone, pos - TQPoint(contentX(), NOTE_MARGIN)); rect.moveBy(contentX(), NOTE_MARGIN); - return rect.intersect( QRect(contentX(), INSERTION_HEIGHT, width() - contentX(), height() - 2*INSERTION_HEIGHT) ); // Only IN contentRect - case Note::GroupExpander: return QRect(NOTE_MARGIN, yExpander(), EXPANDER_WIDTH, EXPANDER_HEIGHT); + return rect.intersect( TQRect(contentX(), INSERTION_HEIGHT, width() - contentX(), height() - 2*INSERTION_HEIGHT) ); // Only IN contentRect + case Note::GroupExpander: return TQRect(NOTE_MARGIN, yExpander(), EXPANDER_WIDTH, EXPANDER_HEIGHT); case Note::Resizer: right = rightLimit(); - return QRect(right - x(), 0, RESIZER_WIDTH, resizerHeight()); + return TQRect(right - x(), 0, RESIZER_WIDTH, resizerHeight()); case Note::Link: - case Note::TopInsert: if (isGroup()) return QRect(0, 0, width(), INSERTION_HEIGHT); - else return QRect(HANDLE_WIDTH, 0, width() / insertSplit - HANDLE_WIDTH, INSERTION_HEIGHT); - case Note::TopGroup: return QRect(xGroup, 0, width() - xGroup, INSERTION_HEIGHT); - case Note::BottomInsert: if (isGroup()) return QRect(0, height() - INSERTION_HEIGHT, width(), INSERTION_HEIGHT); - else return QRect(HANDLE_WIDTH, height() - INSERTION_HEIGHT, width() / insertSplit - HANDLE_WIDTH, INSERTION_HEIGHT); - case Note::BottomGroup: return QRect(xGroup, height() - INSERTION_HEIGHT, width() - xGroup, INSERTION_HEIGHT); - case Note::BottomColumn: return QRect(0, height(), rightLimit() - x(), basket()->contentsHeight() - height()); - case Note::None: return QRect(/*0, 0, -1, -1*/); - default: return QRect(/*0, 0, -1, -1*/); + case Note::TopInsert: if (isGroup()) return TQRect(0, 0, width(), INSERTION_HEIGHT); + else return TQRect(HANDLE_WIDTH, 0, width() / insertSplit - HANDLE_WIDTH, INSERTION_HEIGHT); + case Note::TopGroup: return TQRect(xGroup, 0, width() - xGroup, INSERTION_HEIGHT); + case Note::BottomInsert: if (isGroup()) return TQRect(0, height() - INSERTION_HEIGHT, width(), INSERTION_HEIGHT); + else return TQRect(HANDLE_WIDTH, height() - INSERTION_HEIGHT, width() / insertSplit - HANDLE_WIDTH, INSERTION_HEIGHT); + case Note::BottomGroup: return TQRect(xGroup, height() - INSERTION_HEIGHT, width() - xGroup, INSERTION_HEIGHT); + case Note::BottomColumn: return TQRect(0, height(), rightLimit() - x(), basket()->contentsHeight() - height()); + case Note::None: return TQRect(/*0, 0, -1, -1*/); + default: return TQRect(/*0, 0, -1, -1*/); } } @@ -711,30 +711,30 @@ void Note::setCursor(Zone zone) { switch (zone) { case Note::Handle: - case Note::Group: basket()->viewport()->setCursor(Qt::SizeAllCursor); break; + case Note::Group: basket()->viewport()->setCursor(TQt::SizeAllCursor); break; case Note::Resizer: if (isColumn()) - basket()->viewport()->setCursor(Qt::SplitHCursor); + basket()->viewport()->setCursor(TQt::SplitHCursor); else - basket()->viewport()->setCursor(Qt::SizeHorCursor); break; + basket()->viewport()->setCursor(TQt::SizeHorCursor); break; case Note::Custom0: content()->setCursor(basket()->viewport(), zone); break; case Note::Link: case Note::TagsArrow: - case Note::GroupExpander: basket()->viewport()->setCursor(Qt::PointingHandCursor); break; + case Note::GroupExpander: basket()->viewport()->setCursor(TQt::PointingHandCursor); break; - case Note::Content: basket()->viewport()->setCursor(Qt::IbeamCursor); break; + case Note::Content: basket()->viewport()->setCursor(TQt::IbeamCursor); break; case Note::TopInsert: case Note::TopGroup: case Note::BottomInsert: case Note::BottomGroup: - case Note::BottomColumn: basket()->viewport()->setCursor(Qt::CrossCursor); break; + case Note::BottomColumn: basket()->viewport()->setCursor(TQt::CrossCursor); break; case Note::None: basket()->viewport()->unsetCursor(); break; default: State *state = stateForEmblemNumber(zone - Emblem0); - if (state && state->parentTag()->states().count() > 1) - basket()->viewport()->setCursor(Qt::PointingHandCursor); + if (state && state->tqparentTag()->states().count() > 1) + basket()->viewport()->setCursor(TQt::PointingHandCursor); else basket()->viewport()->unsetCursor(); } @@ -853,20 +853,20 @@ void Note::unsetWidth() child->unsetWidth(); } -void Note::requestRelayout() +void Note::requestRetqlayout() { m_width = 0; unbufferize(); - basket()->relayoutNotes(true); // TODO: A signal that will relayout ONCE and DELAYED if called several times + basket()->retqlayoutNotes(true); // TODO: A signal that will retqlayout ONCE and DELAYED if called several times } void Note::setWidth(int width) // TODO: inline ? { if (m_width != width) - setWidthForceRelayout(width); + setWidthForceRetqlayout(width); } -void Note::setWidthForceRelayout(int width) +void Note::setWidthForceRetqlayout(int width) { unbufferize(); m_width = (width < minWidth() ? minWidth() : width); @@ -898,7 +898,7 @@ int Note::minRight() bool first = true; while (child) { if ((showSubNotes() || first) && child->matching()) - right = QMAX(right, child->minRight()); + right = TQMAX(right, child->minRight()); child = child->next(); first = false; } @@ -959,7 +959,7 @@ void Note::toggleFolded(bool animate) { // Close the editor if it was editing a note that we are about to hide after collapsing: if (!m_isFolded && basket() && basket()->isDuringEdit()) { - if (contains(basket()->editedNote()) && firstRealChild() != basket()->editedNote()) + if (tqcontains(basket()->editedNote()) && firstRealChild() != basket()->editedNote()) basket()->closeEditor(); } @@ -970,7 +970,7 @@ void Note::toggleFolded(bool animate) if (animate) { // We animate collapsing (so sub-notes fluidly go under the first note) - // We don't animate expanding: we place sub-notes directly under the first note (and the next relayout will animate the expanding) + // We don't animate expanding: we place sub-notes directly under the first note (and the next retqlayout will animate the expanding) // But if user quickly collapsed and then expand (while the collapsing animation isn't finished), we animate anyway bool animateSetUnder = (m_isFolded || !m_collapseFinished); // std::cout << "fold:" << m_isFolded << " collapseFinished:" << m_collapseFinished << " animateSetUnder:" << animateSetUnder << std::endl; @@ -998,7 +998,7 @@ void Note::toggleFolded(bool animate) if (basket()->isLoaded() && !m_isFolded) { //basket()->setFocusedNote(this); - basket()->relayoutNotes(true); + basket()->retqlayoutNotes(true); basket()->ensureNoteVisible(this); } @@ -1029,9 +1029,9 @@ Note* Note::noteAt(int x, int y) if ((x >= right) && (x < right + RESIZER_WIDTH) && (y >= m_y) && (y < m_y + resizerHeight())) { if ( ! m_computedAreas ) recomputeAreas(); - for (QValueList<QRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) { - QRect &rect = *it; - if (rect.contains(x, y)) + for (TQValueList<TQRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) { + TQRect &rect = *it; + if (rect.tqcontains(x, y)) return this; } } @@ -1041,9 +1041,9 @@ Note* Note::noteAt(int x, int y) if ((x >= m_x) && (x < m_x + width()) && (y >= m_y) && (y < m_y + m_height)) { if ( ! m_computedAreas ) recomputeAreas(); - for (QValueList<QRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) { - QRect &rect = *it; - if (rect.contains(x, y)) + for (TQValueList<TQRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) { + TQRect &rect = *it; + if (rect.tqcontains(x, y)) return this; } return NULL; @@ -1063,9 +1063,9 @@ Note* Note::noteAt(int x, int y) } else if (matching() && y >= m_y && y < m_y + m_height && x >= m_x && x < m_x + m_width) { if ( ! m_computedAreas ) recomputeAreas(); - for (QValueList<QRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) { - QRect &rect = *it; - if (rect.contains(x, y)) + for (TQValueList<TQRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) { + TQRect &rect = *it; + if (rect.tqcontains(x, y)) return this; } return NULL; @@ -1074,14 +1074,14 @@ Note* Note::noteAt(int x, int y) return NULL; } -QRect Note::rect() +TQRect Note::rect() { - return QRect(x(), y(), width(), height()); + return TQRect(x(), y(), width(), height()); } -QRect Note::resizerRect() +TQRect Note::resizerRect() { - return QRect(rightLimit(), y(), RESIZER_WIDTH, resizerHeight()); + return TQRect(rightLimit(), y(), RESIZER_WIDTH, resizerHeight()); } @@ -1090,7 +1090,7 @@ bool Note::showSubNotes() return !m_isFolded || !m_collapseFinished || basket()->isFiltering(); } -void Note::relayoutAt(int x, int y, bool animate) +void Note::retqlayoutAt(int x, int y, bool animate) { if (!matching()) return; @@ -1098,7 +1098,7 @@ void Note::relayoutAt(int x, int y, bool animate) m_computedAreas = false; m_areas.clear(); - // Don't relayout free notes one under the other, because by definition they are freely positionned! + // Don't retqlayout free notes one under the other, because by definition they are freely positionned! if (isFree()) { x = finalX(); y = finalY(); @@ -1109,7 +1109,7 @@ void Note::relayoutAt(int x, int y, bool animate) cancelAnimation(); setX(x); setY(y); - // But relayout others vertically if they are inside such primary groups or if it is a "normal" basket: + // But retqlayout others vertically if they are inside such primary groups or if it is a "normal" basket: } else { if (animate) setFinalPosition(x, y); @@ -1120,21 +1120,21 @@ void Note::relayoutAt(int x, int y, bool animate) } } - // Then, relayout sub-notes (only the first, if the group is folded) and so, assign an height to the group: + // Then, retqlayout sub-notes (only the first, if the group is folded) and so, assign an height to the group: if (isGroup()) { int h = 0; Note *child = firstChild(); bool first = true; while (child) { - if (child->matching() && (!m_isFolded || first || basket()->isFiltering())) { // Don't use showSubNotes() but use !m_isFolded because we don't want a relayout for the animated collapsing notes - child->relayoutAt(x + width(), y+h, animate); + if (child->matching() && (!m_isFolded || first || basket()->isFiltering())) { // Don't use showSubNotes() but use !m_isFolded because we don't want a retqlayout for the animated collapsing notes + child->retqlayoutAt(x + width(), y+h, animate); h += child->finalHeight(); } else // In case the user collapse a group, then move it and then expand it: child->setXRecursivly(x + width()); // notes SHOULD have a good X coordonate, and not the old one! // For future animation when re-match, but on bottom of already matched notes! - // Find parent primary note and set the Y to THAT y: + // Find tqparent primary note and set the Y to THAT y: if (!child->matching()) - child->setY(parentPrimaryNote()->y()); + child->setY(tqparentPrimaryNote()->y()); child = child->next(); first = false; } @@ -1153,8 +1153,8 @@ void Note::relayoutAt(int x, int y, bool animate) // and NEED RELAYOUT } - // Set the basket area limits (but not for child notes: no need, because they will look for theire parent note): - if (!parentNote()) { + // Set the basket area limits (but not for child notes: no need, because they will look for theire tqparent note): + if (!tqparentNote()) { if (basket()->tmpWidth < finalRightLimit() + (hasResizer() ? RESIZER_WIDTH : 0)) basket()->tmpWidth = finalRightLimit() + (hasResizer() ? RESIZER_WIDTH : 0); if (basket()->tmpHeight < finalY() + finalHeight()) @@ -1202,9 +1202,9 @@ int Note::groupWidth() int Note::rightLimit() { if (isColumn() && m_next == 0L) // The last column - return QMAX(x() + minWidth(), basket()->visibleWidth()); - else if (parentNote()) - return parentNote()->rightLimit(); + return TQMAX(x() + minWidth(), basket()->visibleWidth()); + else if (tqparentNote()) + return tqparentNote()->rightLimit(); else return m_x + m_groupWidth; } @@ -1212,26 +1212,26 @@ int Note::rightLimit() int Note::finalRightLimit() { if (isColumn() && m_next == 0L) // The last column - return QMAX(finalX() + minWidth(), basket()->visibleWidth()); - else if (parentNote()) - return parentNote()->finalRightLimit(); + return TQMAX(finalX() + minWidth(), basket()->visibleWidth()); + else if (tqparentNote()) + return tqparentNote()->finalRightLimit(); else return finalX() + m_groupWidth; } /* - * This code is derivated from drawMetalGradient() from the Qt documentation: + * This code is derivated from drawMetalGradient() from the TQt documentation: */ -void drawGradient( QPainter *p, const QColor &colorTop, const QColor & colorBottom, +void drawGradient( TQPainter *p, const TQColor &colorTop, const TQColor & colorBottom, int x, int y, int w, int h, bool sunken, bool horz, bool flat ) /*const*/ { - QColor highlight(colorBottom); - QColor subh1(colorTop); - QColor subh2(colorTop); + TQColor highlight(colorBottom); + TQColor subh1(colorTop); + TQColor subh2(colorTop); - QColor topgrad(colorTop); - QColor botgrad(colorBottom); + TQColor topgrad(colorTop); + TQColor botgrad(colorBottom); if ( flat && !sunken ) @@ -1267,44 +1267,44 @@ void drawGradient( QPainter *p, const QColor &colorTop, const QColor & colorBott if ( ng > 1 ) { for ( int j =0; j < ng; j++ ) { - p->setPen( QColor( h1 + ((h2-h1)*j)/(ng-1), + p->setPen( TQColor( h1 + ((h2-h1)*j)/(ng-1), s1 + ((s2-s1)*j)/(ng-1), - v1 + ((v2-v1)*j)/(ng-1), QColor::Hsv ) ); + v1 + ((v2-v1)*j)/(ng-1), TQColor::Hsv ) ); DRAWLINE; } } else if ( ng == 1 ) { - p->setPen( QColor((h1+h2)/2, (s1+s2)/2, (v1+v2)/2, QColor::Hsv) ); + p->setPen( TQColor((h1+h2)/2, (s1+s2)/2, (v1+v2)/2, TQColor::Hsv) ); DRAWLINE; } } } -void Note::drawExpander(QPainter *painter, int x, int y, const QColor &background, bool expand, Basket *basket) +void Note::drawExpander(TQPainter *painter, int x, int y, const TQColor &background, bool expand, Basket *basket) { // If the current style is a KStyle, use it to draw the expander (plus or minus): - if (dynamic_cast<KStyle*>(&(kapp->style())) != NULL) { + if (dynamic_cast<KStyle*>(&(kapp->tqstyle())) != NULL) { // Set the 4 rounded corners background to background color: - QColorGroup cg(basket->colorGroup()); - cg.setColor(QColorGroup::Base, background); + TQColorGroup cg(basket->tqcolorGroup()); + cg.setColor(TQColorGroup::Base, background); // Fill the inside of the expander in white, typically: - QBrush brush(KGlobalSettings::baseColor()); + TQBrush brush(KGlobalSettings::baseColor()); painter->fillRect(x, y, 9, 9, brush); // Draw it: - ((KStyle&)(kapp->style())).drawKStylePrimitive( KStyle::KPE_ListViewExpander, + ((KStyle&)(kapp->tqstyle())).drawKStylePrimitive( KStyle::KPE_ListViewExpander, painter, basket->viewport(), - QRect(x, y, 9, 9), + TQRect(x, y, 9, 9), cg, - (expand ? QStyle::Style_On : QStyle::Style_Off) ); - // Else, QStyle does not provide easy way to do so (if it's doable at all...) + (expand ? TQStyle::Style_On : TQStyle::Style_Off) ); + // Else, TQStyle does not provide easy way to do so (if it's doable at all...) // So, I'm drawing it myself my immitating Plastik (pretty style)... - // After all, the note/group handles are all non-QStyle aware so that doesn't matter if the expander is a custom one too. + // After all, the note/group handles are all non-TQStyle aware so that doesn't matter if the expander is a custom one too. } else { int width = EXPANDER_WIDTH; int height = EXPANDER_HEIGHT; - const QColorGroup &cg = basket->colorGroup(); + const TQColorGroup &cg = basket->tqcolorGroup(); // Fill white area: painter->fillRect(x + 1, y + 1, width - 2, height - 2, cg.base()); @@ -1337,7 +1337,7 @@ void Note::drawExpander(QPainter *painter, int x, int y, const QColor &backgroun } } -QColor expanderBackground(int height, int y, const QColor &foreground) +TQColor expanderBackground(int height, int y, const TQColor &foreground) { // We will divide height per two, substract one and use that below a division bar: // To avoid division by zero error, height should be bigger than 3. @@ -1345,8 +1345,8 @@ QColor expanderBackground(int height, int y, const QColor &foreground) if (height <= 3 || y <= 0 || y >= height - 1) return foreground; - QColor dark = foreground.dark(110); // 1/1.1 of brightness - QColor light = foreground.light(150); // 50% brighter + TQColor dark = foreground.dark(110); // 1/1.1 of brightness + TQColor light = foreground.light(150); // 50% brighter int h1, h2, s1, s2, v1, v2; int ng; @@ -1361,18 +1361,18 @@ QColor expanderBackground(int height, int y, const QColor &foreground) ng = (height-2)-(height-2)/2; y -= 1 + (height-2)/2; } - return QColor( h1 + ((h2-h1)*y)/(ng-1), + return TQColor( h1 + ((h2-h1)*y)/(ng-1), s1 + ((s2-s1)*y)/(ng-1), - v1 + ((v2-v1)*y)/(ng-1), QColor::Hsv ); + v1 + ((v2-v1)*y)/(ng-1), TQColor::Hsv ); } -void Note::drawHandle(QPainter *painter, int x, int y, int width, int height, const QColor &background, const QColor &foreground) +void Note::drawHandle(TQPainter *painter, int x, int y, int width, int height, const TQColor &background, const TQColor &foreground) { - QPen backgroundPen(background); - QPen foregroundPen(foreground); + TQPen backgroundPen(background); + TQPen foregroundPen(foreground); - QColor dark = foreground.dark(110); // 1/1.1 of brightness - QColor light = foreground.light(150); // 50% brighter + TQColor dark = foreground.dark(110); // 1/1.1 of brightness + TQColor light = foreground.light(150); // 50% brighter // Draw the surrounding rectangle: painter->setPen(foregroundPen); @@ -1418,8 +1418,8 @@ void Note::drawHandle(QPainter *painter, int x, int y, int width, int height, co if (nbGrips < 2) nbGrips = 2; int yGrips = (height + 1 - nbGrips * 6 - 3) / 2; // +1 to avoid rounding errors, -nbGrips*6-3 the size of the grips - QColor darker = foreground.dark(130); - QColor lighter = foreground.light(130); + TQColor darker = foreground.dark(130); + TQColor lighter = foreground.light(130); for (int i = 0; i < nbGrips; ++i) { /// Dark color: painter->setPen(darker); @@ -1448,14 +1448,14 @@ void Note::drawHandle(QPainter *painter, int x, int y, int width, int height, co painter->drawPoint(xGrips + 1, yGrips + 1); } -void Note::drawResizer(QPainter *painter, int x, int y, int width, int height, const QColor &background, const QColor &foreground, bool rounded) +void Note::drawResizer(TQPainter *painter, int x, int y, int width, int height, const TQColor &background, const TQColor &foreground, bool rounded) { - QPen backgroundPen(background); - QPen foregroundPen(foreground); + TQPen backgroundPen(background); + TQPen foregroundPen(foreground); - QColor dark = foreground.dark(110); // 1/1.1 of brightness - QColor light = foreground.light(150); // 50% brighter - QColor midLight = foreground.light(105); // 5% brighter + TQColor dark = foreground.dark(110); // 1/1.1 of brightness + TQColor light = foreground.light(150); // 50% brighter + TQColor midLight = foreground.light(105); // 5% brighter // Draw the surrounding rectangle: painter->setPen(foregroundPen); @@ -1497,8 +1497,8 @@ void Note::drawResizer(QPainter *painter, int x, int y, int width, int height, c int xArrow = 2; int hMargin = 9; int countArrows = (height >= hMargin*4 + 6*3 ? 3 : (height >= hMargin*3 + 6*2 ? 2 : 1)); - QColor darker = foreground.dark(130); - QColor lighter = foreground.light(130); + TQColor darker = foreground.dark(130); + TQColor lighter = foreground.light(130); for (int i = 0; i < countArrows; ++i) { int yArrow; switch (countArrows) { @@ -1526,10 +1526,10 @@ void Note::drawResizer(QPainter *painter, int x, int y, int width, int height, c } } -void Note::drawInactiveResizer(QPainter *painter, int x, int y, int height, const QColor &background, bool column) +void Note::drawInactiveResizer(TQPainter *painter, int x, int y, int height, const TQColor &background, bool column) { // If background color is too dark, we compute a lighter color instead of a darker: - QColor darkBgColor = (Tools::tooDark(background) ? background.light(120) : background.dark(105)); + TQColor darkBgColor = (Tools::tooDark(background) ? background.light(120) : background.dark(105)); if (column) { int halfWidth = RESIZER_WIDTH / 2; drawGradient(painter, darkBgColor, background, x, y, halfWidth, height, /*sunken=*/false, /*horz=*/false, /*flat=*/false); @@ -1539,7 +1539,7 @@ void Note::drawInactiveResizer(QPainter *painter, int x, int y, int height, cons } -#include <qimage.h> +#include <tqimage.h> #include <kimageeffect.h> /* type: 1: topLeft @@ -1551,7 +1551,7 @@ void Note::drawInactiveResizer(QPainter *painter, int x, int y, int height, cons * (x,y) relate to the painter origin * (width,height) only used for 5:fourCorners type */ -void Note::drawRoundings(QPainter *painter, int x, int y, int type, int width, int height) +void Note::drawRoundings(TQPainter *painter, int x, int y, int type, int width, int height) { int right; @@ -1559,36 +1559,36 @@ void Note::drawRoundings(QPainter *painter, int x, int y, int type, int width, i case 1: x += this->x(); y += this->y(); - basket()->blendBackground(*painter, QRect(x, y, 4, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x, y + 1, 2, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x, y + 2, 1, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x, y + 3, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x, y, 4, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x, y + 1, 2, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x, y + 2, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x, y + 3, 1, 1), this->x(), this->y()); break; case 2: x += this->x(); y += this->y(); - basket()->blendBackground(*painter, QRect(x, y - 1, 1, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x, y, 1, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x, y + 1, 2, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x, y + 2, 4, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x, y - 1, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x, y, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x, y + 1, 2, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x, y + 2, 4, 1), this->x(), this->y()); break; case 3: right = rightLimit(); x += right; y += this->y(); - basket()->blendBackground(*painter, QRect(x - 1, y, 4, 1), right, this->y()); - basket()->blendBackground(*painter, QRect(x + 1, y + 1, 2, 1), right, this->y()); - basket()->blendBackground(*painter, QRect(x + 2, y + 2, 1, 1), right, this->y()); - basket()->blendBackground(*painter, QRect(x + 2, y + 3, 1, 1), right, this->y()); + basket()->blendBackground(*painter, TQRect(x - 1, y, 4, 1), right, this->y()); + basket()->blendBackground(*painter, TQRect(x + 1, y + 1, 2, 1), right, this->y()); + basket()->blendBackground(*painter, TQRect(x + 2, y + 2, 1, 1), right, this->y()); + basket()->blendBackground(*painter, TQRect(x + 2, y + 3, 1, 1), right, this->y()); break; case 4: right = rightLimit(); x += right; y += this->y(); - basket()->blendBackground(*painter, QRect(x + 2, y - 1, 1, 1), right, this->y()); - basket()->blendBackground(*painter, QRect(x + 2, y, 1, 1), right, this->y()); - basket()->blendBackground(*painter, QRect(x + 1, y + 1, 2, 1), right, this->y()); - basket()->blendBackground(*painter, QRect(x - 1, y + 2, 4, 1), right, this->y()); + basket()->blendBackground(*painter, TQRect(x + 2, y - 1, 1, 1), right, this->y()); + basket()->blendBackground(*painter, TQRect(x + 2, y, 1, 1), right, this->y()); + basket()->blendBackground(*painter, TQRect(x + 1, y + 1, 2, 1), right, this->y()); + basket()->blendBackground(*painter, TQRect(x - 1, y + 2, 4, 1), right, this->y()); break; case 5: // First make sure the corners are white (depending on the widget style): @@ -1600,29 +1600,29 @@ void Note::drawRoundings(QPainter *painter, int x, int y, int type, int width, i // And then blend corners: x += this->x(); y += this->y(); - basket()->blendBackground(*painter, QRect(x, y, 1, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x + width - 1, y, 1, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x + width - 1, y + height - 1, 1, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x, y + height - 1, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x, y, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x + width - 1, y, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x + width - 1, y + height - 1, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x, y + height - 1, 1, 1), this->x(), this->y()); break; case 6: x += this->x(); y += this->y(); //if (!isSelected()) { // Inside left corners: - basket()->blendBackground(*painter, QRect(x + HANDLE_WIDTH + 1, y + 1, 1, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x + HANDLE_WIDTH, y + 2, 1, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x + HANDLE_WIDTH + 1, y + height - 2, 1, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x + HANDLE_WIDTH, y + height - 3, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x + HANDLE_WIDTH + 1, y + 1, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x + HANDLE_WIDTH, y + 2, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x + HANDLE_WIDTH + 1, y + height - 2, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x + HANDLE_WIDTH, y + height - 3, 1, 1), this->x(), this->y()); // Inside right corners: - basket()->blendBackground(*painter, QRect(x + width - 4, y + 1, 1, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x + width - 3, y + 2, 1, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x + width - 4, y + height - 2, 1, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x + width - 3, y + height - 3, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x + width - 4, y + 1, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x + width - 3, y + 2, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x + width - 4, y + height - 2, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x + width - 3, y + height - 3, 1, 1), this->x(), this->y()); //} // Outside right corners: - basket()->blendBackground(*painter, QRect(x + width - 1, y, 1, 1), this->x(), this->y()); - basket()->blendBackground(*painter, QRect(x + width - 1, y + height - 1, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x + width - 1, y, 1, 1), this->x(), this->y()); + basket()->blendBackground(*painter, TQRect(x + width - 1, y + height - 1, 1, 1), this->x(), this->y()); break; } } @@ -1640,34 +1640,34 @@ void Note::setOnTop(bool onTop) } } -void substractRectOnAreas(const QRect &rectToSubstract, QValueList<QRect> &areas, bool andRemove) +void substractRectOnAreas(const TQRect &rectToSubstract, TQValueList<TQRect> &areas, bool andRemove) { - for (QValueList<QRect>::iterator it = areas.begin(); it != areas.end(); ) { - QRect &rect = *it; + for (TQValueList<TQRect>::iterator it = areas.begin(); it != areas.end(); ) { + TQRect &rect = *it; // Split the rectangle if it intersects with rectToSubstract: if (rect.intersects(rectToSubstract)) { // Create the top rectangle: if (rectToSubstract.top() > rect.top()) { - areas.insert(it, QRect(rect.left(), rect.top(), rect.width(), rectToSubstract.top() - rect.top())); + areas.insert(it, TQRect(rect.left(), rect.top(), rect.width(), rectToSubstract.top() - rect.top())); rect.setTop(rectToSubstract.top()); } // Create the bottom rectangle: if (rectToSubstract.bottom() < rect.bottom()) { - areas.insert(it, QRect(rect.left(), rectToSubstract.bottom() + 1, rect.width(), rect.bottom() - rectToSubstract.bottom())); + areas.insert(it, TQRect(rect.left(), rectToSubstract.bottom() + 1, rect.width(), rect.bottom() - rectToSubstract.bottom())); rect.setBottom(rectToSubstract.bottom()); } // Create the left rectangle: if (rectToSubstract.left() > rect.left()) { - areas.insert(it, QRect(rect.left(), rect.top(), rectToSubstract.left() - rect.left(), rect.height())); + areas.insert(it, TQRect(rect.left(), rect.top(), rectToSubstract.left() - rect.left(), rect.height())); rect.setLeft(rectToSubstract.left()); } // Create the right rectangle: if (rectToSubstract.right() < rect.right()) { - areas.insert(it, QRect(rectToSubstract.right() + 1, rect.top(), rect.right() - rectToSubstract.right(), rect.height())); + areas.insert(it, TQRect(rectToSubstract.right() + 1, rect.top(), rect.right() - rectToSubstract.right(), rect.height())); rect.setRight(rectToSubstract.right()); } // Remove the rectangle if it's entirely contained: - if (andRemove && rectToSubstract.contains(rect)) + if (andRemove && rectToSubstract.tqcontains(rect)) it = areas.remove(it); else ++it; @@ -1727,7 +1727,7 @@ bool Note::isEditing() return basket()->editedNote() == this; } -void Note::getGradientColors(const QColor &originalBackground, QColor *colorTop, QColor *colorBottom) +void Note::getGradientColors(const TQColor &originalBackground, TQColor *colorTop, TQColor *colorBottom) { bool wasTooDark = Tools::tooDark(originalBackground); if (wasTooDark) { @@ -1747,7 +1747,7 @@ void Note::getGradientColors(const QColor &originalBackground, QColor *colorTop, * - But as drawing the pixmap offscreen is little time consuming we can keep last visible notes buffered and then the redraw of the entire window is INSTANTANEOUS * - We keep bufferized note/group draws BUT NOT the resizer: such objects are small and fast to draw, so we don't complexify code for that */ -void Note::draw(QPainter *painter, const QRect &clipRect) +void Note::draw(TQPainter *painter, const TQRect &clipRect) { if (!matching()) return; @@ -1764,19 +1764,19 @@ void Note::draw(QPainter *painter, const QRect &clipRect) } } - QRect myRect(x(), y(), width(), height()); + TQRect myRect(x(), y(), width(), height()); /** Paint the resizer if needed: */ if (hasResizer()) { int right = rightLimit(); - QRect resizerRect(right, y(), RESIZER_WIDTH, resizerHeight()); + TQRect resizerRect(right, y(), RESIZER_WIDTH, resizerHeight()); if (resizerRect.intersects(clipRect)) { // Prepare to draw the resizer: - QPixmap pixmap(RESIZER_WIDTH, resizerHeight()); - QPainter painter2(&pixmap); + TQPixmap pixmap(RESIZER_WIDTH, resizerHeight()); + TQPainter painter2(&pixmap); // Draw gradient or resizer: if (m_hovered && m_hoveredZone == Resizer) { - QColor baseColor(basket()->backgroundColor()); - QColor highColor(KGlobalSettings::highlightColor()); + TQColor baseColor(basket()->backgroundColor()); + TQColor highColor(KGlobalSettings::highlightColor()); drawResizer(&painter2, 0, 0, RESIZER_WIDTH, resizerHeight(), baseColor, highColor, /*rounded=*/!isColumn()); if (!isColumn()) { drawRoundings(&painter2, RESIZER_WIDTH - 3, 0, /*type=*/3); @@ -1791,12 +1791,12 @@ void Note::draw(QPainter *painter, const QRect &clipRect) basket()->drawInserter(painter2, right, y()); // Draw selection rect: if (basket()->isSelecting() && resizerRect.intersects(basket()->selectionRect())) { - QRect selectionRect = basket()->selectionRect(); + TQRect selectionRect = basket()->selectionRect(); selectionRect.moveBy(-right, -y()); - QRect selectionRectInside(selectionRect.x() + 1, selectionRect.y() + 1, selectionRect.width() - 2, selectionRect.height() - 2); + TQRect selectionRectInside(selectionRect.x() + 1, selectionRect.y() + 1, selectionRect.width() - 2, selectionRect.height() - 2); if (selectionRectInside.width() > 0 && selectionRectInside.height() > 0) { - QColor insideColor = basket()->selectionRectInsideColor(); - QColor darkInsideColor(insideColor.dark(105)); + TQColor insideColor = basket()->selectionRectInsideColor(); + TQColor darkInsideColor(insideColor.dark(105)); painter2.setClipRect(selectionRectInside); if (isColumn()) { int halfWidth = RESIZER_WIDTH / 2; @@ -1823,8 +1823,8 @@ void Note::draw(QPainter *painter, const QRect &clipRect) recomputeAreas(); if (m_areas.isEmpty()) return; - for (QValueList<QRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) { - QRect &rect = *it; + for (TQValueList<TQRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) { + TQRect &rect = *it; painter->drawPixmap(rect.x(), rect.y(), pixmap, rect.x() - right, rect.y() - y(), rect.width(), rect.height()); } } @@ -1848,19 +1848,19 @@ void Note::draw(QPainter *painter, const QRect &clipRect) /** Initialise buffer painter: */ m_bufferedPixmap.resize(width(), height()); - QPainter painter2(&m_bufferedPixmap); + TQPainter painter2(&m_bufferedPixmap); /** Initialise colors: */ - QColor baseColor(basket()->backgroundColor()); - QColor highColor(KGlobalSettings::highlightColor()); - QColor midColor = Tools::mixColor(baseColor, highColor); + TQColor baseColor(basket()->backgroundColor()); + TQColor highColor(KGlobalSettings::highlightColor()); + TQColor midColor = Tools::mixColor(baseColor, highColor); /** Initialise brushs and pens: */ - QBrush baseBrush(baseColor); - QBrush highBrush(highColor); - QPen basePen(baseColor); - QPen highPen(highColor); - QPen midPen(midColor); + TQBrush baseBrush(baseColor); + TQBrush highBrush(highColor); + TQPen basePen(baseColor); + TQPen highPen(highColor); + TQPen midPen(midColor); /** Figure out the state of the note: */ bool hovered = m_hovered && m_hoveredZone != TopInsert && m_hoveredZone != BottomInsert && m_hoveredZone != Resizer; @@ -1882,8 +1882,8 @@ void Note::draw(QPainter *painter, const QRect &clipRect) drawExpander(&painter2, NOTE_MARGIN, yExp, (hovered ? expanderBackground(height(), yExp+EXPANDER_HEIGHT/2, highColor) : baseColor), m_isFolded, basket()); // Draw expander rounded edges: if (hovered) { - QColor color1 = expanderBackground(height(), yExp, highColor); - QColor color2 = expanderBackground(height(), yExp + EXPANDER_HEIGHT - 1, highColor); + TQColor color1 = expanderBackground(height(), yExp, highColor); + TQColor color2 = expanderBackground(height(), yExp + EXPANDER_HEIGHT - 1, highColor); painter2.setPen(color1); painter2.drawPoint(NOTE_MARGIN, yExp); painter2.drawPoint(NOTE_MARGIN + 9 - 1, yExp); @@ -1901,7 +1901,7 @@ void Note::draw(QPainter *painter, const QRect &clipRect) /** Or draw the note: */ // What are the background colors: - QColor background = basket()->backgroundColor(); + TQColor background = basket()->backgroundColor(); if (isSelected()) if (m_computedState.backgroundColor().isValid()) background = Tools::mixColor(Tools::mixColor(m_computedState.backgroundColor(), KGlobalSettings::highlightColor()), KGlobalSettings::highlightColor()); @@ -1909,8 +1909,8 @@ void Note::draw(QPainter *painter, const QRect &clipRect) background = KGlobalSettings::highlightColor(); else if (m_computedState.backgroundColor().isValid()) background = m_computedState.backgroundColor(); - QColor bgColor; - QColor darkBgColor; + TQColor bgColor; + TQColor darkBgColor; getGradientColors(background, &darkBgColor, &bgColor); // Draw background (color, gradient and pixmap): drawGradient( &painter2, bgColor, darkBgColor, 0, 0, width(), height(), /*sunken=*/!hovered, /*horz=*/true, /*flat=*/false ); @@ -1934,10 +1934,10 @@ void Note::draw(QPainter *painter, const QRect &clipRect) painter2.drawPoint(HANDLE_WIDTH, 1); painter2.drawPoint(HANDLE_WIDTH, height() - 2); // Light handle top-right round corner: - painter2.setPen(QPen(highColor.light(150))); + painter2.setPen(TQPen(highColor.light(150))); painter2.drawPoint(HANDLE_WIDTH - 1, 1); // Handle anti-aliased rounded handle-right-side corners: - QColor insideMidColor = Tools::mixColor(bgColor, highColor); + TQColor insideMidColor = Tools::mixColor(bgColor, highColor); painter2.setPen(insideMidColor); // Left inside round corners: painter2.drawPoint(HANDLE_WIDTH + 1, 1); @@ -1963,7 +1963,7 @@ void Note::draw(QPainter *painter, const QRect &clipRect) } if (isFocused()) { - QRect focusRect(HANDLE_WIDTH, NOTE_MARGIN - 1, width() - HANDLE_WIDTH - 2, height() - 2*NOTE_MARGIN + 2); + TQRect focusRect(HANDLE_WIDTH, NOTE_MARGIN - 1, width() - HANDLE_WIDTH - 2, height() - 2*NOTE_MARGIN + 2); painter2.drawWinFocusRect(focusRect); } @@ -1972,32 +1972,32 @@ void Note::draw(QPainter *painter, const QRect &clipRect) int xIcon = HANDLE_WIDTH + NOTE_MARGIN; for (State::List::Iterator it = m_states.begin(); it != m_states.end(); ++it) { if (!(*it)->emblem().isEmpty()) { - QPixmap stateEmblem = kapp->iconLoader()->loadIcon((*it)->emblem(), KIcon::NoGroup, 16, KIcon::DefaultState, 0L, false); + TQPixmap stateEmblem = kapp->iconLoader()->loadIcon((*it)->emblem(), KIcon::NoGroup, 16, KIcon::DefaultState, 0L, false); painter2.drawPixmap(xIcon, yIcon, stateEmblem); xIcon += NOTE_MARGIN + EMBLEM_SIZE; } } // Determine the colors (for the richText drawing) and the text color (for the tags arrow too): - QColorGroup cg(basket()->colorGroup()); - cg.setColor(QColorGroup::Text, (m_computedState.textColor().isValid() ? m_computedState.textColor() : basket()->textColor()) ); - cg.setColor(QColorGroup::Background, bgColor); + TQColorGroup cg(basket()->tqcolorGroup()); + cg.setColor(TQColorGroup::Text, (m_computedState.textColor().isValid() ? m_computedState.textColor() : basket()->textColor()) ); + cg.setColor(TQColorGroup::Background, bgColor); if (isSelected()) - cg.setColor(QColorGroup::Text, KGlobalSettings::highlightedTextColor()); + cg.setColor(TQColorGroup::Text, KGlobalSettings::highlightedTextColor()); // Draw the Tags Arrow: if (hovered) { - QColor textColor = cg.color(QColorGroup::Text); - QColor light = Tools::mixColor(textColor, bgColor); - QColor mid = Tools::mixColor(textColor, light); - painter2.setPen(light);//QPen(basket()->colorGroup().dark().light(150))); + TQColor textColor = cg.color(TQColorGroup::Text); + TQColor light = Tools::mixColor(textColor, bgColor); + TQColor mid = Tools::mixColor(textColor, light); + painter2.setPen(light);//TQPen(basket()->tqcolorGroup().dark().light(150))); painter2.drawLine(xIcon, yIcon + 6, xIcon + 4, yIcon + 6); - painter2.setPen(mid);//QPen(basket()->colorGroup().dark())); + painter2.setPen(mid);//TQPen(basket()->tqcolorGroup().dark())); painter2.drawLine(xIcon + 1, yIcon + 7, xIcon + 3, yIcon + 7); - painter2.setPen(textColor);//QPen(basket()->colorGroup().foreground())); + painter2.setPen(textColor);//TQPen(basket()->tqcolorGroup().foreground())); painter2.drawPoint(xIcon + 2, yIcon + 8); } else if (m_haveInvisibleTags) { - painter2.setPen(cg.color(QColorGroup::Text)/*QPen(basket()->colorGroup().foreground())*/); + painter2.setPen(cg.color(TQColorGroup::Text)/*TQPen(basket()->tqcolorGroup().foreground())*/); painter2.drawPoint(xIcon, yIcon + 7); painter2.drawPoint(xIcon + 2, yIcon + 7); painter2.drawPoint(xIcon + 4, yIcon + 7); @@ -2016,34 +2016,34 @@ void Note::draw(QPainter *painter, const QRect &clipRect) drawBufferOnScreen(painter, m_bufferedPixmap); } -void Note::drawBufferOnScreen(QPainter *painter, const QPixmap &contentPixmap) +void Note::drawBufferOnScreen(TQPainter *painter, const TQPixmap &contentPixmap) { - for (QValueList<QRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) { - QRect &rect = *it; + for (TQValueList<TQRect>::iterator it = m_areas.begin(); it != m_areas.end(); ++it) { + TQRect &rect = *it; if (rect.x() >= x() + width()) // It's a rect of the resizer, don't draw it! continue; // If the inserter is above the note, draw it, BUT NOT in the buffer pixmap, // we copy the rectangle in a new pixmap, apply the inserter and then draw this new pixmap on screen: if ( (basket()->inserterShown() && rect.intersects(basket()->inserterRect())) || (basket()->isSelecting() && rect.intersects(basket()->selectionRect())) ) { - QPixmap pixmap3(rect.width(), rect.height()); - QPainter painter3(&pixmap3); + TQPixmap pixmap3(rect.width(), rect.height()); + TQPainter painter3(&pixmap3); painter3.drawPixmap(0, 0, contentPixmap, rect.x() - x(), rect.y() - y(), rect.width(), rect.height()); // Draw inserter: if (basket()->inserterShown() && rect.intersects(basket()->inserterRect())) basket()->drawInserter(painter3, rect.x(), rect.y()); // Draw selection rect: if (basket()->isSelecting() && rect.intersects(basket()->selectionRect())) { - QRect selectionRect = basket()->selectionRect(); + TQRect selectionRect = basket()->selectionRect(); selectionRect.moveBy(-rect.x(), -rect.y()); - QRect selectionRectInside(selectionRect.x() + 1, selectionRect.y() + 1, selectionRect.width() - 2, selectionRect.height() - 2); + TQRect selectionRectInside(selectionRect.x() + 1, selectionRect.y() + 1, selectionRect.width() - 2, selectionRect.height() - 2); if (selectionRectInside.width() > 0 && selectionRectInside.height() > 0) { bufferizeSelectionPixmap(); selectionRectInside.moveBy(rect.x(), rect.y()); - QRect rectToPaint = rect.intersect(selectionRectInside); + TQRect rectToPaint = rect.intersect(selectionRectInside); rectToPaint.moveBy(-x(), -y()); - painter3.drawPixmap(rectToPaint.topLeft() + QPoint(x(), y()) - rect.topLeft(), m_bufferedSelectionPixmap, rectToPaint); + painter3.drawPixmap(rectToPaint.topLeft() + TQPoint(x(), y()) - rect.topLeft(), m_bufferedSelectionPixmap, rectToPaint); //blendBackground(painter2, selectionRectInside, rect.x(), rect.y(), true, &m_selectedBackgroundPixmap); } @@ -2053,7 +2053,7 @@ void Note::drawBufferOnScreen(QPainter *painter, const QPixmap &contentPixmap) painter3.setPen(Tools::mixColor(KGlobalSettings::highlightColor().dark(), basket()->backgroundColor())); else { // What are the background colors: - QColor bgColor = basket()->backgroundColor(); + TQColor bgColor = basket()->backgroundColor(); if (isSelected()) bgColor = (m_computedState.backgroundColor().isValid() ? Tools::mixColor(Tools::mixColor(m_computedState.backgroundColor(), KGlobalSettings::highlightColor()), KGlobalSettings::highlightColor()) : KGlobalSettings::highlightColor()); else if (m_computedState.backgroundColor().isValid()) @@ -2088,18 +2088,18 @@ void Note::addState(State *state, bool orReplace) if (!content()) return; - Tag *tag = state->parentTag(); + Tag *tag = state->tqparentTag(); State::List::iterator itStates = m_states.begin(); // Browse all tags, see if the note has it, increment itSates if yes, and then insert the state at this position... // For each existing tags: for (Tag::List::iterator it = Tag::all.begin(); it != Tag::all.end(); ++it) { // If the current tag isn't the one to assign or the current one on the note, go to the next tag: - if (*it != tag && itStates != m_states.end() && *it != (*itStates)->parentTag()) + if (*it != tag && itStates != m_states.end() && *it != (*itStates)->tqparentTag()) continue; // We found the tag to insert: if (*it == tag) { // And the note already have the tag: - if (itStates != m_states.end() && *it == (*itStates)->parentTag()) { + if (itStates != m_states.end() && *it == (*itStates)->tqparentTag()) { // We replace the state if wanted: if (orReplace) { itStates = m_states.insert(itStates, state); @@ -2114,17 +2114,17 @@ void Note::addState(State *state, bool orReplace) return; } // The note has this tag: - if (itStates != m_states.end() && *it == (*itStates)->parentTag()) + if (itStates != m_states.end() && *it == (*itStates)->tqparentTag()) ++itStates; } } -QFont Note::font() +TQFont Note::font() { - return m_computedState.font( basket()->QScrollView::font() ); + return m_computedState.font( basket()->TQScrollView::font() ); } -QColor Note::backgroundColor() +TQColor Note::backgroundColor() { if (m_computedState.backgroundColor().isValid()) return m_computedState.backgroundColor(); @@ -2132,7 +2132,7 @@ QColor Note::backgroundColor() return basket()->backgroundColor(); } -QColor Note::textColor() +TQColor Note::textColor() { if (m_computedState.textColor().isValid()) return m_computedState.textColor(); @@ -2146,7 +2146,7 @@ void Note::recomputeStyle() // unsetWidth(); if (content()) content()->fontChanged(); -// requestRelayout(); // TODO! +// requestRetqlayout(); // TODO! } void Note::recomputeAllStyles() @@ -2159,12 +2159,12 @@ void Note::recomputeAllStyles() child->recomputeAllStyles(); } -bool Note::removedStates(const QValueList<State*> &deletedStates) +bool Note::removedStates(const TQValueList<State*> &deletedStates) { bool modifiedBasket = false; if (!states().isEmpty()) { - for (QValueList<State*>::const_iterator it = deletedStates.begin(); it != deletedStates.end(); ++it) + for (TQValueList<State*>::const_iterator it = deletedStates.begin(); it != deletedStates.end(); ++it) if (hasState(*it)) { removeState(*it); modifiedBasket = true; @@ -2181,7 +2181,7 @@ bool Note::removedStates(const QValueList<State*> &deletedStates) void Note::addTag(Tag *tag) { - addState(tag->states().first(), /*but do not replace:*/false); + addState(tag->states().first(), /*but do not tqreplace:*/false); } void Note::removeState(State *state) @@ -2197,7 +2197,7 @@ void Note::removeState(State *state) void Note::removeTag(Tag *tag) { for (State::List::iterator it = m_states.begin(); it != m_states.end(); ++it) - if ((*it)->parentTag() == tag) { + if ((*it)->tqparentTag() == tag) { m_states.remove(it); recomputeStyle(); return; @@ -2254,7 +2254,7 @@ void Note::addStateToSelectedNotes(State *state, bool orReplace) void Note::changeStateOfSelectedNotes(State *state) { - if (content() && isSelected() && hasTag(state->parentTag())) + if (content() && isSelected() && hasTag(state->tqparentTag())) addState(state); FOR_EACH_CHILD (child) @@ -2283,7 +2283,7 @@ bool Note::hasState(State *state) bool Note::hasTag(Tag *tag) { for (State::List::iterator it = m_states.begin(); it != m_states.end(); ++it) - if ((*it)->parentTag() == tag) + if ((*it)->tqparentTag() == tag) return true; return false; } @@ -2291,7 +2291,7 @@ bool Note::hasTag(Tag *tag) State* Note::stateOfTag(Tag *tag) { for (State::List::iterator it = m_states.begin(); it != m_states.end(); ++it) - if ((*it)->parentTag() == tag) + if ((*it)->tqparentTag() == tag) return *it; return 0; } @@ -2354,8 +2354,8 @@ void Note::inheritTagsOf(Note *note) return; for (State::List::iterator it = note->states().begin(); it != note->states().end(); ++it) - if ((*it)->parentTag() && (*it)->parentTag()->inheritedBySiblings()) - addTag((*it)->parentTag()); + if ((*it)->tqparentTag() && (*it)->tqparentTag()->inheritedBySiblings()) + addTag((*it)->tqparentTag()); } void Note::unbufferizeAll() @@ -2374,38 +2374,38 @@ void Note::unbufferizeAll() void Note::bufferizeSelectionPixmap() { if (m_bufferedSelectionPixmap.isNull()) { - QColor insideColor = KGlobalSettings::highlightColor(); + TQColor insideColor = KGlobalSettings::highlightColor(); KPixmap kpixmap(m_bufferedPixmap); m_bufferedSelectionPixmap = KPixmapEffect::fade(kpixmap, 0.25, insideColor); } } -QRect Note::visibleRect() +TQRect Note::visibleRect() { - QValueList<QRect> areas; + TQValueList<TQRect> areas; areas.append(rect()); - // When we are folding a parent group, if this note is bigger than the first real note of the group, cut the top of this: - Note *parent = parentNote(); - while (parent) { - if (parent->expandingOrCollapsing()) - substractRectOnAreas(QRect(x(), parent->y() - height(), width(), height()), areas, true); - parent = parent->parentNote(); + // When we are folding a tqparent group, if this note is bigger than the first real note of the group, cut the top of this: + Note *tqparent = tqparentNote(); + while (tqparent) { + if (tqparent->expandingOrCollapsing()) + substractRectOnAreas(TQRect(x(), tqparent->y() - height(), width(), height()), areas, true); + tqparent = tqparent->tqparentNote(); } if (areas.count() > 0) return areas[0]; else - return QRect(); + return TQRect(); } -void Note::recomputeBlankRects(QValueList<QRect> &blankAreas) +void Note::recomputeBlankRects(TQValueList<TQRect> &blankAreas) { if (!matching()) return; - // visibleRect() instead of rect() because if we are folding/expanding a smaller parent group, then some part is hidden! - // But anyway, a resizer is always a primary note and is never hidden by a parent group, so no visibleResizerRect() method! + // visibleRect() instead of rect() because if we are folding/expanding a smaller tqparent group, then some part is hidden! + // But anyway, a resizer is always a primary note and is never hidden by a tqparent group, so no visibleResizerRect() method! substractRectOnAreas(visibleRect(), blankAreas, true); if (hasResizer()) substractRectOnAreas(resizerRect(), blankAreas, true); @@ -2434,7 +2434,7 @@ void Note::linkLookChanged() content()->linkLookChanged(); } -Note* Note::noteForFullPath(const QString &path) +Note* Note::noteForFullPath(const TQString &path) { if (content() && fullPath() == path) return this; @@ -2450,11 +2450,11 @@ Note* Note::noteForFullPath(const QString &path) return 0; } -void Note::listUsedTags(QValueList<Tag*> &list) +void Note::listUsedTags(TQValueList<Tag*> &list) { for (State::List::Iterator it = m_states.begin(); it != m_states.end(); ++it) { - Tag *tag = (*it)->parentTag(); - if (!list.contains(tag)) + Tag *tag = (*it)->tqparentTag(); + if (!list.tqcontains(tag)) list.append(tag); } @@ -2463,11 +2463,11 @@ void Note::listUsedTags(QValueList<Tag*> &list) } -void Note::usedStates(QValueList<State*> &states) +void Note::usedStates(TQValueList<State*> &states) { if (content()) for (State::List::Iterator it = m_states.begin(); it != m_states.end(); ++it) - if (!states.contains(*it)) + if (!states.tqcontains(*it)) states.append(*it); FOR_EACH_CHILD (child) @@ -2490,8 +2490,8 @@ Note* Note::nextInStack() else return next()->nextInStack(); - // And finally, in the parent: - Note *note = parentNote(); + // And finally, in the tqparent: + Note *note = tqparentNote(); while (note) if (note->next()) if (note->next()->content()) @@ -2499,7 +2499,7 @@ Note* Note::nextInStack() else return note->next()->nextInStack(); else - note = note->parentNote(); + note = note->tqparentNote(); // Not found: return 0; @@ -2518,8 +2518,8 @@ Note* Note::prevInStack() return note; } - if (parentNote()) - return parentNote()->prevInStack(); + if (tqparentNote()) + return tqparentNote()->prevInStack(); else return 0; } @@ -2554,20 +2554,20 @@ bool Note::isShown() return true; // So, here we go to the complexe case: if the note is inside a collapsed group: - Note *group = parentNote(); + Note *group = tqparentNote(); Note *child = this; while (group) { if (group->isFolded() && group->firstChild() != child) return false; child = group; - group = group->parentNote(); + group = group->tqparentNote(); } return true; } void Note::debug() { - std::cout << "Note@" << (Q_UINT64)this; + std::cout << "Note@" << (TQ_UINT64)this; if (!this) { std::cout << std::endl; return; @@ -2631,7 +2631,7 @@ void Note::groupIn(Note *group) if (allSelected() && !isColumn()) { basket()->unplugNote(this); - basket()->insertNote(this, group, Note::BottomColumn, QPoint(), /*animateNewPosition=*/true); + basket()->insertNote(this, group, Note::BottomColumn, TQPoint(), /*animateNewPosition=*/true); } else { Note *next; Note *child = firstChild(); @@ -2645,40 +2645,40 @@ void Note::groupIn(Note *group) bool Note::tryExpandParent() { - Note *parent = parentNote(); + Note *tqparent = tqparentNote(); Note *child = this; - while (parent) { - if (parent->firstChild() != child) + while (tqparent) { + if (tqparent->firstChild() != child) return false; - if (parent->isColumn()) + if (tqparent->isColumn()) return false; - if (parent->isFolded()) { - parent->toggleFolded(true); - basket()->relayoutNotes(true); + if (tqparent->isFolded()) { + tqparent->toggleFolded(true); + basket()->retqlayoutNotes(true); return true; } - child = parent; - parent = parent->parentNote(); + child = tqparent; + tqparent = tqparent->tqparentNote(); } return false; } bool Note::tryFoldParent() // TODO: withCtrl ? withShift ? { - Note *parent = parentNote(); + Note *tqparent = tqparentNote(); Note *child = this; - while (parent) { - if (parent->firstChild() != child) + while (tqparent) { + if (tqparent->firstChild() != child) return false; - if (parent->isColumn()) + if (tqparent->isColumn()) return false; - if (!parent->isFolded()) { - parent->toggleFolded(true); - basket()->relayoutNotes(true); + if (!tqparent->isFolded()) { + tqparent->toggleFolded(true); + basket()->retqlayoutNotes(true); return true; } - child = parent; - parent = parent->parentNote(); + child = tqparent; + tqparent = tqparent->tqparentNote(); } return false; } @@ -2754,11 +2754,11 @@ int Note::distanceOnTopBottom(Note *note, int side) return int(sqrt(pow(noteCenterX - thisCenterX, 2) + pow(noteCenterY - thisCenterY, 2)) + angle); } -Note* Note::parentPrimaryNote() +Note* Note::tqparentPrimaryNote() { Note *primary = this; - while (primary->parentNote()) - primary = primary->parentNote(); + while (primary->tqparentNote()) + primary = primary->tqparentNote(); return primary; } @@ -2794,8 +2794,8 @@ bool Note::convertTexts() bool convertedNotes = false; if (content() && content()->lowerTypeName() == "text") { - QString text = ((TextContent*)content())->text(); - QString html = "<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>" + Tools::textToHTMLWithoutP(text) + "</body></html>"; + TQString text = ((TextContent*)content())->text(); + TQString html = "<html><head><meta name=\"qrichtext\" content=\"1\" /></head><body>" + Tools::textToHTMLWithoutP(text) + "</body></html>"; basket()->saveToFile(fullPath(), html, /*isLocalEncoding=*/true); setContent( new HtmlContent(this, content()->fileName()) ); convertedNotes = true; @@ -2812,7 +2812,7 @@ bool Note::convertTexts() /** Note */ -QString Note::toHtml(const QString &imageName) +TQString Note::toHtml(const TQString &imageName) { switch (m_type) { case Text: @@ -2826,49 +2826,49 @@ QString Note::toHtml(const QString &imageName) { if ( (m_type == Image && pixmap() == 0L) || (m_type == Animation && movie() == 0L) ) { - QMimeSourceFactory::defaultFactory()->setData(imageName, 0L); + TQMimeSourceFactory::defaultFactory()->setData(imageName, 0L); return i18n("(Image)"); // Image or animation not yet loaded!! } - QImage image; + TQImage image; if (m_type == Image) image = pixmap()->convertToImage(); else image = movie()->framePixmap().convertToImage(); - image = image.smoothScale(200, 150, QImage::ScaleMin); - QPixmap pixmap = QPixmap(image); - QMimeSourceFactory::defaultFactory()->setPixmap(imageName, pixmap); + image = image.smoothScale(200, 150, TQ_ScaleMin); + TQPixmap pixmap = TQPixmap(image); + TQMimeSourceFactory::defaultFactory()->setPixmap(imageName, pixmap); return "<img src=" + imageName + ">"; /// /* // FIXME: movie isn't loaded yet: CRASH! return i18n("(Image)"); // Not executed, because don't work: - QImage image; + TQImage image; if (m_type == Image) image = pixmap()->convertToImage(); else image = movie()->framePixmap().convertToImage(); - image = image.smoothScale(200, 150, QImage::ScaleMin); - QPixmap pixmap = QPixmap(image); - QMimeSourceFactory::defaultFactory()->setPixmap(imageName, pixmap); + image = image.smoothScale(200, 150, TQ_ScaleMin); + TQPixmap pixmap = TQPixmap(image); + TQMimeSourceFactory::defaultFactory()->setPixmap(imageName, pixmap); return "<img src=" + imageName + ">"; /// - */ //TODO?: QMimeSourceFactory::defaultFactory()->setData(imageName, 0L); + */ //TODO?: TQMimeSourceFactory::defaultFactory()->setData(imageName, 0L); } case Sound: case File: { /// FIXME: Since fullPath() doesn't exist yet, the icon rely on the extension. /// Bad if there isn't one or if it's a wrong one. - /*QPixmap icon = DesktopIcon( + /*TQPixmap icon = DesktopIcon( NoteFactory::iconForURL(fullPath()), (m_type == Sound ? LinkLook::soundLook : LinkLook::fileLook)->iconSize()); - QMimeSourceFactory::defaultFactory()->setPixmap(imageName, icon); + TQMimeSourceFactory::defaultFactory()->setPixmap(imageName, icon); return "<img src=" + imageName + "> " + fileName(); */ /// return m_linkLabel->toHtml(imageName); } case Link: { - QString link = m_linkLabel->toHtml(imageName); + TQString link = m_linkLabel->toHtml(imageName); if (!autoTitle() && title() != NoteFactory::titleForURL(url().prettyURL())) link += "<br><i>" + url().prettyURL() + "</i>"; /// return link; @@ -2884,7 +2884,7 @@ QString Note::toHtml(const QString &imageName) case Unknown: return text(); } - return QString(); + return TQString(); } #endif // #if 0 |