Commit 267cc34e authored by Gustavo Carneiro's avatar Gustavo Carneiro

Move CharacterFormat class to a new file.

parent f2c3d18e
......@@ -68,6 +68,7 @@ set(konsoleprivate_SRCS ${sessionadaptors_SRCS}
HistoryScroll.cpp
HistoryScrollFile.cpp
HistoryScrollNone.cpp
CharacterFormat.cpp
HistorySizeDialog.cpp
widgets/HistorySizeWidget.cpp
widgets/IncrementalSearchBar.cpp
......
/*
This file is part of Konsole, an X terminal.
Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
*/
#include "CharacterFormat.h"
using namespace Konsole;
bool CharacterFormat::equalsFormat(const CharacterFormat &other) const
{
return (other.rendition & ~RE_EXTENDED_CHAR) == (rendition & ~RE_EXTENDED_CHAR)
&& other.fgColor == fgColor && other.bgColor == bgColor;
}
bool CharacterFormat::equalsFormat(const Character &c) const
{
return (c.rendition & ~RE_EXTENDED_CHAR) == (rendition & ~RE_EXTENDED_CHAR)
&& c.foregroundColor == fgColor && c.backgroundColor == bgColor;
}
void CharacterFormat::setFormat(const Character &c)
{
rendition = c.rendition;
fgColor = c.foregroundColor;
bgColor = c.backgroundColor;
isRealCharacter = c.isRealCharacter;
}
/*
This file is part of Konsole, an X terminal.
Copyright 1997,1998 by Lars Doelle <lars.doelle@on-line.de>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
*/
#ifndef CHARACTERFORMAT_H
#define CHARACTERFORMAT_H
#include "Character.h"
namespace Konsole
{
class CharacterFormat
{
public:
bool equalsFormat(const CharacterFormat &other) const;
bool equalsFormat(const Character &c) const;
void setFormat(const Character &c);
CharacterColor fgColor, bgColor;
quint16 startPos;
RenditionFlags rendition;
bool isRealCharacter;
};
}
#endif
......@@ -36,6 +36,7 @@
#include "HistoryScroll.h"
#include "HistoryScrollFile.h"
#include "HistoryScrollNone.h"
#include "CharacterFormat.h"
// Konsole
#include "Character.h"
......@@ -49,35 +50,6 @@ namespace Konsole {
//////////////////////////////////////////////////////////////////////
typedef QVector<Character> TextLine;
class CharacterFormat
{
public:
bool equalsFormat(const CharacterFormat &other) const
{
return (other.rendition & ~RE_EXTENDED_CHAR) == (rendition & ~RE_EXTENDED_CHAR)
&& other.fgColor == fgColor && other.bgColor == bgColor;
}
bool equalsFormat(const Character &c) const
{
return (c.rendition & ~RE_EXTENDED_CHAR) == (rendition & ~RE_EXTENDED_CHAR)
&& c.foregroundColor == fgColor && c.backgroundColor == bgColor;
}
void setFormat(const Character &c)
{
rendition = c.rendition;
fgColor = c.foregroundColor;
bgColor = c.backgroundColor;
isRealCharacter = c.isRealCharacter;
}
CharacterColor fgColor, bgColor;
quint16 startPos;
RenditionFlags rendition;
bool isRealCharacter;
};
class CompactHistoryBlock
{
public:
......
......@@ -26,6 +26,7 @@
#include "../session/Session.h"
#include "../Emulation.h"
#include "../History.h"
#include "../HistoryScrollFile.h"
using namespace Konsole;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment