mirror of https://github.com/procxx/kepka.git
				
				
				
			Unread bar in a service message display fixed.
Elided text with a skip block in the end display fixed.
This commit is contained in:
		
							parent
							
								
									be2a0abbc8
								
							
						
					
					
						commit
						0fa6b5bc90
					
				| 
						 | 
					@ -7972,25 +7972,28 @@ void HistoryService::setServiceText(const QString &text) {
 | 
				
			||||||
void HistoryService::draw(Painter &p, const QRect &r, TextSelection selection, uint64 ms) const {
 | 
					void HistoryService::draw(Painter &p, const QRect &r, TextSelection selection, uint64 ms) const {
 | 
				
			||||||
	int height = _height - st::msgServiceMargin.top() - st::msgServiceMargin.bottom();
 | 
						int height = _height - st::msgServiceMargin.top() - st::msgServiceMargin.bottom();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						QRect clip(r);
 | 
				
			||||||
	int dateh = 0, unreadbarh = 0;
 | 
						int dateh = 0, unreadbarh = 0;
 | 
				
			||||||
	if (auto date = Get<HistoryMessageDate>()) {
 | 
						if (auto date = Get<HistoryMessageDate>()) {
 | 
				
			||||||
		dateh = date->height();
 | 
							dateh = date->height();
 | 
				
			||||||
		//if (r.intersects(QRect(0, 0, _history->width, dateh))) {
 | 
							//if (clip.intersects(QRect(0, 0, _history->width, dateh))) {
 | 
				
			||||||
		//	date->paint(p, 0, _history->width);
 | 
							//	date->paint(p, 0, _history->width);
 | 
				
			||||||
		//}
 | 
							//}
 | 
				
			||||||
		p.translate(0, dateh);
 | 
							p.translate(0, dateh);
 | 
				
			||||||
 | 
							clip.translate(0, -dateh);
 | 
				
			||||||
		height -= dateh;
 | 
							height -= dateh;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (auto unreadbar = Get<HistoryMessageUnreadBar>()) {
 | 
						if (auto unreadbar = Get<HistoryMessageUnreadBar>()) {
 | 
				
			||||||
		unreadbarh = unreadbar->height();
 | 
							unreadbarh = unreadbar->height();
 | 
				
			||||||
		if (r.intersects(QRect(0, 0, _history->width, unreadbarh))) {
 | 
							if (clip.intersects(QRect(0, 0, _history->width, unreadbarh))) {
 | 
				
			||||||
			unreadbar->paint(p, 0, _history->width);
 | 
								unreadbar->paint(p, 0, _history->width);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		p.translate(0, unreadbarh);
 | 
							p.translate(0, unreadbarh);
 | 
				
			||||||
 | 
							clip.translate(0, -unreadbarh);
 | 
				
			||||||
		height -= unreadbarh;
 | 
							height -= unreadbarh;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	HistoryLayout::PaintContext context(ms, r, selection);
 | 
						HistoryLayout::PaintContext context(ms, clip, selection);
 | 
				
			||||||
	HistoryLayout::ServiceMessagePainter::paint(p, this, context, height);
 | 
						HistoryLayout::ServiceMessagePainter::paint(p, this, context, height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (int skiph = dateh + unreadbarh) {
 | 
						if (int skiph = dateh + unreadbarh) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1188,7 +1188,7 @@ public:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool drawLine(uint16 _lineEnd, const Text::TextBlocks::const_iterator &_endBlockIter, const Text::TextBlocks::const_iterator &_end) {
 | 
						bool drawLine(uint16 _lineEnd, const Text::TextBlocks::const_iterator &_endBlockIter, const Text::TextBlocks::const_iterator &_end) {
 | 
				
			||||||
		_yDelta = (_lineHeight - _fontHeight) / 2;
 | 
							_yDelta = (_lineHeight - _fontHeight) / 2;
 | 
				
			||||||
		if (_yTo >= 0 && _y + _yDelta >= _yTo) return false;
 | 
							if (_yTo >= 0 && (_y + _yDelta >= _yTo || _y >= _yTo)) return false;
 | 
				
			||||||
		if (_y + _yDelta + _fontHeight <= _yFrom) {
 | 
							if (_y + _yDelta + _fontHeight <= _yFrom) {
 | 
				
			||||||
			if (_lookupSymbol) {
 | 
								if (_lookupSymbol) {
 | 
				
			||||||
				_lookupResult.symbol = (_lineEnd > _lineStart) ? (_lineEnd - 1) : _lineStart;
 | 
									_lookupResult.symbol = (_lineEnd > _lineStart) ? (_lineEnd - 1) : _lineStart;
 | 
				
			||||||
| 
						 | 
					@ -1205,8 +1205,19 @@ public:
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ITextBlock *_endBlock = (_endBlockIter == _end) ? 0 : (*_endBlockIter);
 | 
							ITextBlock *_endBlock = (_endBlockIter == _end) ? nullptr : (*_endBlockIter);
 | 
				
			||||||
		bool elidedLine = _elideLast && _endBlock && (_y + _lineHeight >= _yToElide);
 | 
							bool elidedLine = _elideLast && (_y + _lineHeight >= _yToElide);
 | 
				
			||||||
 | 
							if (elidedLine) {
 | 
				
			||||||
 | 
								// If we decided to draw the last line elided only because of the skip block
 | 
				
			||||||
 | 
								// that did not fit on this line, we just draw the line till the very end.
 | 
				
			||||||
 | 
								// Skip block is ignored in the elided lines, instead "removeFromEnd" is used.
 | 
				
			||||||
 | 
								if (_endBlock && _endBlock->type() == TextBlockTSkip) {
 | 
				
			||||||
 | 
									_endBlock = nullptr;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								if (!_endBlock) {
 | 
				
			||||||
 | 
									elidedLine = false;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int blockIndex = _lineStartBlock;
 | 
							int blockIndex = _lineStartBlock;
 | 
				
			||||||
		ITextBlock *currentBlock = _t->_blocks[blockIndex];
 | 
							ITextBlock *currentBlock = _t->_blocks[blockIndex];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue