less #define and replaced some deprecated methods

pull/2/head
pjx206 4 years ago
parent 66fa79b87e
commit 1725692ad6

@ -33,25 +33,26 @@ namespace Konsole
{
typedef unsigned char LineProperty;
typedef quint16 RenditionFlags;
static const int LINE_DEFAULT = 0;
static const int LINE_WRAPPED = (1 << 0);
static const int LINE_DOUBLEWIDTH = (1 << 1);
static const int LINE_DOUBLEHEIGHT = (1 << 2);
#define DEFAULT_RENDITION 0
#define RE_BOLD (1 << 0)
#define RE_BLINK (1 << 1)
#define RE_UNDERLINE (1 << 2)
#define RE_REVERSE (1 << 3) // Screen only
#define RE_INTENSIVE (1 << 3) // Widget only
#define RE_ITALIC (1 << 4)
#define RE_CURSOR (1 << 5)
#define RE_EXTENDED_CHAR (1 << 6)
#define RE_FAINT (1 << 7)
#define RE_STRIKEOUT (1 << 8)
#define RE_CONCEAL (1 << 9)
#define RE_OVERLINE (1 << 10)
const RenditionFlags DEFAULT_RENDITION = 0;
const RenditionFlags RE_BOLD = (1 << 0);
const RenditionFlags RE_BLINK = (1 << 1);
const RenditionFlags RE_UNDERLINE = (1 << 2);
const RenditionFlags RE_REVERSE = (1 << 3); // Screen only
const RenditionFlags RE_INTENSIVE = (1 << 3); // Widget only
const RenditionFlags RE_ITALIC = (1 << 4);
const RenditionFlags RE_CURSOR = (1 << 5);
const RenditionFlags RE_EXTENDED_CHAR = (1 << 6);
const RenditionFlags RE_FAINT = (1 << 7);
const RenditionFlags RE_STRIKEOUT = (1 << 8);
const RenditionFlags RE_CONCEAL = (1 << 9);
const RenditionFlags RE_OVERLINE = (1 << 10);
/**
* A single character in the terminal which consists of a unicode character
@ -72,7 +73,7 @@ public:
inline Character(quint16 _c = ' ',
CharacterColor _f = CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_FORE_COLOR),
CharacterColor _b = CharacterColor(COLOR_SPACE_DEFAULT,DEFAULT_BACK_COLOR),
quint8 _r = DEFAULT_RENDITION)
RenditionFlags _r = DEFAULT_RENDITION)
: character(_c), rendition(_r), foregroundColor(_f), backgroundColor(_b) {}
union
@ -90,7 +91,7 @@ public:
};
/** A combination of RENDITION flags which specify options for drawing the character. */
quint8 rendition;
RenditionFlags rendition;
/** The foreground color used to draw this character. */
CharacterColor foregroundColor;

@ -221,14 +221,14 @@ void TerminalDisplay::fontChange(const QFont&)
// "Base character width on widest ASCII character. This prevents too wide
// characters in the presence of double wide (e.g. Japanese) characters."
// Get the width from representative normal width characters
_fontWidth = qRound((double)fm.width(QLatin1String(REPCHAR))/(double)qstrlen(REPCHAR));
_fontWidth = qRound((double)fm.horizontalAdvance(QLatin1String(REPCHAR))/(double)qstrlen(REPCHAR));
_fixedFont = true;
int fw = fm.width(QLatin1Char(REPCHAR[0]));
int fw = fm.horizontalAdvance(QLatin1Char(REPCHAR[0]));
for(unsigned int i=1; i< qstrlen(REPCHAR); i++)
{
if (fw != fm.width(QLatin1Char(REPCHAR[i])))
if (fw != fm.horizontalAdvance(QLatin1Char(REPCHAR[i])))
{
_fixedFont = false;
break;
@ -1611,7 +1611,7 @@ void TerminalDisplay::drawContents(QPainter &paint, const QRect &rect)
bool doubleWidth = (_image[ qMin(loc(x,y)+1,_imageSize) ].character == 0);
CharacterColor currentForeground = _image[loc(x,y)].foregroundColor;
CharacterColor currentBackground = _image[loc(x,y)].backgroundColor;
quint8 currentRendition = _image[loc(x,y)].rendition;
RenditionFlags currentRendition = _image[loc(x,y)].rendition;
while (x+len <= rlx &&
_image[loc(x+len,y)].foregroundColor == currentForeground &&

Loading…
Cancel
Save