Struct to pass the FOptiAttr environment

This commit is contained in:
Markus Gans 2018-06-25 00:14:53 +02:00
parent 32097d4bf0
commit 03c3c79946
14 changed files with 527 additions and 420 deletions

View File

@ -1,3 +1,7 @@
2017-06-25 Markus Gans <guru.mail@muenster.de>
* All termcap values required in FOptiAttr can now be passed
with a single struct
2017-06-17 Markus Gans <guru.mail@muenster.de>
* Added special console options for FreeBSD, NetBSD and OpenBSD

View File

@ -3,7 +3,7 @@
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2017 Markus Gans *
* Copyright 2017-2018 Markus Gans *
* *
* The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
@ -481,11 +481,11 @@ void MouseDraw::drawCanvas()
for (int y = 0; y < y_end; y++) // line loop
{
char_data* cc; // canvas character
char_data* wc; // window character
charData* cc; // canvas character
charData* wc; // window character
cc = &canvas->text[y * x_end];
wc = &print_area->text[(ay + y) * w_line_len + ax];
std::memcpy (wc, cc, sizeof(char_data) * unsigned(x_end));
std::memcpy (wc, cc, sizeof(charData) * unsigned(x_end));
if ( short(print_area->changes[ay + y].xmin) > ax )
print_area->changes[ay + y].xmin = uInt(ax);

View File

@ -72,7 +72,7 @@
class FOptiAttr
{
public:
// Typedef
// Typedefs
typedef struct
{
int code; // character code
@ -109,7 +109,49 @@ class FOptiAttr
uInt8 byte[3];
} attr;
} char_data;
} charData;
typedef struct
{
bool ansi_default_color;
int max_color;
int attr_without_color;
char* F_enter_bold_mode;
char* F_exit_bold_mode;
char* F_enter_dim_mode;
char* F_exit_dim_mode;
char* F_enter_italics_mode;
char* F_exit_italics_mode;
char* F_enter_underline_mode;
char* F_exit_underline_mode;
char* F_enter_blink_mode;
char* F_exit_blink_mode;
char* F_enter_reverse_mode;
char* F_exit_reverse_mode;
char* F_enter_standout_mode;
char* F_exit_standout_mode;
char* F_enter_secure_mode;
char* F_exit_secure_mode;
char* F_enter_protected_mode;
char* F_exit_protected_mode;
char* F_enter_crossed_out_mode;
char* F_exit_crossed_out_mode;
char* F_enter_dbl_underline_mode;
char* F_exit_dbl_underline_mode;
char* F_set_attributes;
char* F_exit_attribute_mode;
char* F_enter_alt_charset_mode;
char* F_exit_alt_charset_mode;
char* F_enter_pc_charset_mode;
char* F_exit_pc_charset_mode;
char* F_set_a_foreground;
char* F_set_a_background;
char* F_set_foreground;
char* F_set_background;
char* F_set_color_pair;
char* F_orig_pair;
char* F_orig_colors;
} termEnv;
// Constructor
explicit FOptiAttr();
@ -118,13 +160,14 @@ class FOptiAttr
~FOptiAttr();
// Friend operator functions
friend bool operator == (const char_data&, const char_data&);
friend bool operator != (const char_data&, const char_data&);
friend bool operator == (const charData&, const charData&);
friend bool operator != (const charData&, const charData&);
// Accessors
const char* getClassName() const;
// Mutators
void setTermEnvironment (termEnv&);
void setMaxColor (const int&);
void setNoColorVideo (int);
void setDefaultColorSupport();
@ -166,17 +209,15 @@ class FOptiAttr
void set_orig_orig_colors (char[]);
// Inquiry
static bool isNormal (char_data*&);
static bool isNormal (charData*&);
// Methods
void initialize();
static short vga2ansi (register short);
char* changeAttribute (char_data*&, char_data*&);
char* changeAttribute (charData*&, charData*&);
private:
// Typedefs and Enumerations
typedef unsigned char uChar;
typedef struct
{
char* cap;
@ -222,62 +263,62 @@ class FOptiAttr
FOptiAttr& operator = (const FOptiAttr&);
// Mutators
bool setTermBold (char_data*&);
bool unsetTermBold (char_data*&);
bool setTermDim (char_data*&);
bool unsetTermDim (char_data*&);
bool setTermItalic (char_data*&);
bool unsetTermItalic (char_data*&);
bool setTermUnderline (char_data*&);
bool unsetTermUnderline (char_data*&);
bool setTermBlink (char_data*&);
bool unsetTermBlink (char_data*&);
bool setTermReverse (char_data*&);
bool unsetTermReverse (char_data*&);
bool setTermStandout (char_data*&);
bool unsetTermStandout (char_data*&);
bool setTermInvisible (char_data*&);
bool unsetTermInvisible (char_data*&);
bool setTermProtected (char_data*&);
bool unsetTermProtected (char_data*&);
bool setTermCrossedOut (char_data*&);
bool unsetTermCrossedOut (char_data*&);
bool setTermDoubleUnderline (char_data*&);
bool unsetTermDoubleUnderline (char_data*&);
bool setTermAttributes ( char_data*&
bool setTermBold (charData*&);
bool unsetTermBold (charData*&);
bool setTermDim (charData*&);
bool unsetTermDim (charData*&);
bool setTermItalic (charData*&);
bool unsetTermItalic (charData*&);
bool setTermUnderline (charData*&);
bool unsetTermUnderline (charData*&);
bool setTermBlink (charData*&);
bool unsetTermBlink (charData*&);
bool setTermReverse (charData*&);
bool unsetTermReverse (charData*&);
bool setTermStandout (charData*&);
bool unsetTermStandout (charData*&);
bool setTermInvisible (charData*&);
bool unsetTermInvisible (charData*&);
bool setTermProtected (charData*&);
bool unsetTermProtected (charData*&);
bool setTermCrossedOut (charData*&);
bool unsetTermCrossedOut (charData*&);
bool setTermDoubleUnderline (charData*&);
bool unsetTermDoubleUnderline (charData*&);
bool setTermAttributes ( charData*&
, bool, bool, bool
, bool, bool, bool
, bool, bool, bool );
bool unsetTermAttributes (char_data*&);
bool setTermAltCharset (char_data*&);
bool unsetTermAltCharset (char_data*&);
bool setTermPCcharset (char_data*&);
bool unsetTermPCcharset (char_data*&);
bool setTermDefaultColor (char_data*&);
void setAttributesOn (char_data*&);
void setAttributesOff (char_data*&);
bool unsetTermAttributes (charData*&);
bool setTermAltCharset (charData*&);
bool unsetTermAltCharset (charData*&);
bool setTermPCcharset (charData*&);
bool unsetTermPCcharset (charData*&);
bool setTermDefaultColor (charData*&);
void setAttributesOn (charData*&);
void setAttributesOff (charData*&);
// Inquiries
static bool hasColor (char_data*&);
static bool hasAttribute (char_data*&);
static bool hasNoAttribute (char_data*&);
static bool hasColor (charData*&);
static bool hasAttribute (charData*&);
static bool hasNoAttribute (charData*&);
// Methods
bool colorChange (char_data*&, char_data*&);
void resetColor (char_data*&);
void prevent_no_color_video_attributes (char_data*&, bool = false);
void deactivateAttributes (char_data*&, char_data*&);
void changeAttributeSGR (char_data*&, char_data*&);
void changeAttributeSeparately (char_data*&, char_data*&);
void change_color (char_data*&, char_data*&);
void change_to_default_color (char_data*&, char_data*&, short&, short&);
void change_current_color (char_data*&, short, short);
void resetAttribute (char_data*&);
void reset (char_data*&);
bool colorChange (charData*&, charData*&);
void resetColor (charData*&);
void prevent_no_color_video_attributes (charData*&, bool = false);
void deactivateAttributes (charData*&, charData*&);
void changeAttributeSGR (charData*&, charData*&);
void changeAttributeSeparately (charData*&, charData*&);
void change_color (charData*&, charData*&);
void change_to_default_color (charData*&, charData*&, short&, short&);
void change_current_color (charData*&, short, short);
void resetAttribute (charData*&);
void reset (charData*&);
bool caused_reset_attributes (char[], uChar = all_tests);
bool hasCharsetEquivalence();
void detectSwitchOn (char_data*&, char_data*&);
void detectSwitchOff (char_data*&, char_data*&);
void detectSwitchOn (charData*&, charData*&);
void detectSwitchOff (charData*&, charData*&);
bool switchOn();
bool switchOff();
bool append_sequence (char[]);
@ -319,9 +360,9 @@ class FOptiAttr
capability F_orig_pair;
capability F_orig_colors;
char_data on;
char_data off;
char_data reset_byte_mask;
charData on;
charData off;
charData reset_byte_mask;
int max_color;
int attr_without_color;
@ -337,8 +378,8 @@ class FOptiAttr
// FOptiAttr inline functions
//----------------------------------------------------------------------
inline bool operator == ( const FOptiAttr::char_data& lhs,
const FOptiAttr::char_data& rhs )
inline bool operator == ( const FOptiAttr::charData& lhs,
const FOptiAttr::charData& rhs )
{
return lhs.code == rhs.code
&& lhs.fg_color == rhs.fg_color
@ -348,8 +389,8 @@ inline bool operator == ( const FOptiAttr::char_data& lhs,
}
//----------------------------------------------------------------------
inline bool operator != ( const FOptiAttr::char_data& lhs,
const FOptiAttr::char_data& rhs )
inline bool operator != ( const FOptiAttr::charData& lhs,
const FOptiAttr::charData& rhs )
{ return ! ( lhs == rhs ); }
//----------------------------------------------------------------------

View File

@ -166,7 +166,7 @@ class FTerm
{
public:
// Typedefs
typedef FOptiAttr::char_data char_data;
typedef FOptiAttr::charData charData;
// Constructor
explicit FTerm (bool = false);
@ -200,7 +200,7 @@ class FTerm
// Inquiries
static bool isCursorHidden();
static bool isKeypressTimeout (timeval*);
static bool isNormal (char_data*&);
static bool isNormal (charData*&);
static bool isRaw();
static bool hasPCcharset();
static bool hasUTF8();
@ -322,8 +322,8 @@ class FTerm
// Methods
static void initScreenSettings();
static char* changeAttribute ( char_data*&
, char_data*& );
static char* changeAttribute ( charData*&
, charData*& );
static void changeTermSizeFinished();
static void exitWithMessage (std::string)
#if defined(__clang__) || defined(__GNUC__)

View File

@ -3,7 +3,7 @@
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2017 Markus Gans *
* Copyright 2017-2018 Markus Gans *
* *
* The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
@ -54,7 +54,7 @@ class FTermBuffer
{
public:
// Typedef
typedef FOptiAttr::char_data char_data;
typedef FOptiAttr::charData charData;
// Constructor
explicit FTermBuffer();
@ -65,7 +65,7 @@ class FTermBuffer
// Overloaded operators
template<class type> FTermBuffer& operator << (const type&);
// Non-member operators
friend std::vector<char_data>& operator << ( std::vector<char_data>&
friend std::vector<charData>& operator << ( std::vector<charData>&
, const FTermBuffer& );
// Accessors
@ -92,10 +92,10 @@ class FTermBuffer
int write (const FString&);
int write (int);
FTermBuffer& write ();
std::vector<char_data> getBuffer();
std::vector<charData> getBuffer();
private:
std::vector<char_data> data;
std::vector<charData> data;
};
#pragma pack(pop)
@ -133,7 +133,7 @@ inline FTermBuffer& FTermBuffer::write()
{ return *this; }
//----------------------------------------------------------------------
inline std::vector<FTermBuffer::char_data> FTermBuffer::getBuffer()
inline std::vector<FTermBuffer::charData> FTermBuffer::getBuffer()
{ return data; }
#endif // FTERMBUFFER_H

View File

@ -82,7 +82,7 @@ class FVTerm : public FTerm
uInt trans_count; // Number of transparent characters
} line_changes;
typedef FOptiAttr::char_data char_data;
typedef FOptiAttr::charData charData;
typedef void (FVTerm::*FPreprocessingHandler)();
struct term_area; // forward declaration
@ -117,7 +117,7 @@ class FVTerm : public FTerm
// Overloaded operators
template<class type> FVTerm& operator << (const type&);
FVTerm& operator << (const std::vector<char_data>&);
FVTerm& operator << (const std::vector<charData>&);
// Accessors
virtual const char* getClassName() const;
@ -125,7 +125,7 @@ class FVTerm : public FTerm
static short getTermBackgroundColor();
term_area* getVWin() const;
FPoint getPrintCursor();
static char_data getAttribute();
static charData getAttribute();
// Mutators
static void setTermXY (register int, register int);
@ -250,12 +250,12 @@ class FVTerm : public FTerm
int print (term_area*, const std::string&);
int print (const FString&);
int print (term_area*, const FString&);
int print (const std::vector<char_data>&);
int print (term_area*, const std::vector<char_data>&);
int print (const std::vector<charData>&);
int print (term_area*, const std::vector<charData>&);
int print (int);
int print (term_area*, int);
int print (char_data&);
int print (term_area*, char_data&);
int print (charData&);
int print (term_area*, charData&);
FVTerm& print();
protected:
@ -337,21 +337,21 @@ class FVTerm : public FTerm
static void scrollAreaReverse (term_area*);
static void clearArea (term_area*, int = ' ');
static char_data generateCharacter (const FPoint&);
static char_data generateCharacter (int, int);
static charData generateCharacter (const FPoint&);
static charData generateCharacter (int, int);
static char_data getCharacter ( character_type
static charData getCharacter ( character_type
, const FPoint&
, FVTerm* );
static char_data getCharacter ( character_type
static charData getCharacter ( character_type
, int
, int, FVTerm* );
static char_data getCoveredCharacter (const FPoint&, FVTerm*);
static char_data getCoveredCharacter (int, int, FVTerm*);
static char_data getOverlappedCharacter (const FPoint&, FVTerm*);
static char_data getOverlappedCharacter (int, int, FVTerm*);
static charData getCoveredCharacter (const FPoint&, FVTerm*);
static charData getCoveredCharacter (int, int, FVTerm*);
static charData getOverlappedCharacter (const FPoint&, FVTerm*);
static charData getOverlappedCharacter (int, int, FVTerm*);
static void processTerminalUpdate();
static void startTerminalUpdate();
static void finishTerminalUpdate();
@ -392,14 +392,14 @@ class FVTerm : public FTerm
// Methods
void init();
void finish();
static void putAreaLine (char_data*, char_data*, int);
static void putAreaLine (charData*, charData*, int);
static void putAreaCharacter ( int, int, FVTerm*
, char_data*, char_data* );
, charData*, charData* );
static void getAreaCharacter ( int, int, term_area*
, char_data*& );
, charData*& );
static bool clearTerm (int = ' ');
static bool clearFullArea (term_area*, char_data&);
static void clearAreaWithShadow (term_area*, char_data&);
static bool clearFullArea (term_area*, charData&);
static void clearAreaWithShadow (term_area*, charData&);
static bool canClearToEOL (uInt, uInt);
static bool canClearLeadingWS (uInt&, uInt);
static bool canClearTrailingWS (uInt&, uInt);
@ -414,12 +414,12 @@ class FVTerm : public FTerm
static bool isInsideTerminal (int, int);
static void markAsPrinted (uInt, uInt);
static void markAsPrinted (uInt, uInt, uInt);
static void newFontChanges (char_data*&);
static void charsetChanges (char_data*&);
static void appendCharacter (char_data*&);
static void appendChar (char_data*&);
static void appendAttributes (char_data*&);
static int appendLowerRight (char_data*&);
static void newFontChanges (charData*&);
static void charsetChanges (charData*&);
static void appendCharacter (charData*&);
static void appendChar (charData*&);
static void appendAttributes (charData*&);
static int appendLowerRight (charData*&);
static void appendOutputBuffer (const std::string&);
static void appendOutputBuffer (const char[]);
@ -431,10 +431,10 @@ class FVTerm : public FTerm
// Data Members
static std::queue<int>* output_buffer;
static char_data term_attribute;
static char_data next_attribute;
static char_data s_ch; // shadow character
static char_data i_ch; // inherit background character
static charData term_attribute;
static charData next_attribute;
static charData s_ch; // shadow character
static charData i_ch; // inherit background character
static FPoint* term_pos; // terminal cursor position
static termcap_map* tcap;
static bool terminal_update_complete;
@ -492,7 +492,7 @@ struct FVTerm::term_area // define virtual terminal character properties
FWidget* widget; // Widget that owns this term_area
FPreprocessing preprocessing_call;
line_changes* changes;
char_data* text; // Text data for the output
charData* text; // Text data for the output
bool input_cursor_visible;
bool has_changes;
bool visible;
@ -518,7 +518,7 @@ inline FVTerm& FVTerm::operator << (const type& s)
}
//----------------------------------------------------------------------
inline FVTerm& FVTerm::operator << (const std::vector<FVTerm::char_data>& termString)
inline FVTerm& FVTerm::operator << (const std::vector<FVTerm::charData>& termString)
{
print (termString);
return *this;
@ -541,7 +541,7 @@ inline FVTerm::term_area* FVTerm::getVWin() const
{ return vwin; }
//----------------------------------------------------------------------
inline FVTerm::char_data FVTerm::getAttribute()
inline FVTerm::charData FVTerm::getAttribute()
{ return next_attribute; }
//----------------------------------------------------------------------

View File

@ -1271,7 +1271,7 @@ void FListView::draw()
//----------------------------------------------------------------------
void FListView::drawColumnLabels()
{
std::vector<char_data>::const_iterator first, last;
std::vector<charData>::const_iterator first, last;
headerItems::const_iterator iter;
if ( header.empty()
@ -1297,7 +1297,7 @@ void FListView::drawColumnLabels()
++iter;
}
std::vector<char_data> h;
std::vector<charData> h;
h << headerline;
first = h.begin() + xoffset;
@ -1314,7 +1314,7 @@ void FListView::drawColumnLabels()
}
setPrintPos (2, 1);
print() << std::vector<char_data>(first, last);
print() << std::vector<charData>(first, last);
}
//----------------------------------------------------------------------

View File

@ -96,6 +96,55 @@ FOptiAttr::~FOptiAttr() // destructor
// public methods of FOptiAttr
//----------------------------------------------------------------------
void FOptiAttr::setTermEnvironment (termEnv& term_env)
{
// Set all required termcap values at once
// and initialize the FOptiAttr environment
ansi_default_color = term_env.ansi_default_color;
max_color = term_env.max_color;
attr_without_color = term_env.attr_without_color;
set_enter_bold_mode (term_env.F_enter_bold_mode);
set_exit_bold_mode (term_env.F_exit_bold_mode);
set_enter_dim_mode (term_env.F_enter_dim_mode);
set_exit_dim_mode (term_env.F_exit_dim_mode);
set_enter_italics_mode (term_env.F_enter_italics_mode);
set_exit_italics_mode (term_env.F_exit_italics_mode);
set_enter_underline_mode (term_env.F_enter_underline_mode);
set_exit_underline_mode (term_env.F_exit_underline_mode);
set_enter_blink_mode (term_env.F_enter_blink_mode);
set_exit_blink_mode (term_env.F_exit_blink_mode);
set_enter_reverse_mode (term_env.F_enter_reverse_mode);
set_exit_reverse_mode (term_env.F_exit_reverse_mode);
set_enter_standout_mode (term_env.F_enter_standout_mode);
set_exit_standout_mode (term_env.F_exit_standout_mode);
set_enter_secure_mode (term_env.F_enter_secure_mode);
set_exit_secure_mode (term_env.F_exit_secure_mode);
set_enter_protected_mode (term_env.F_enter_protected_mode);
set_exit_protected_mode (term_env.F_exit_protected_mode);
set_enter_crossed_out_mode (term_env.F_enter_crossed_out_mode);
set_exit_crossed_out_mode (term_env.F_exit_crossed_out_mode);
set_enter_dbl_underline_mode (term_env.F_enter_dbl_underline_mode);
set_exit_dbl_underline_mode (term_env.F_exit_dbl_underline_mode);
set_set_attributes (term_env.F_set_attributes);
set_exit_attribute_mode (term_env.F_exit_attribute_mode);
set_enter_alt_charset_mode (term_env.F_enter_alt_charset_mode);
set_exit_alt_charset_mode (term_env.F_exit_alt_charset_mode);
set_enter_pc_charset_mode (term_env.F_enter_pc_charset_mode);
set_exit_pc_charset_mode (term_env.F_exit_pc_charset_mode);
set_a_foreground_color (term_env.F_set_a_foreground);
set_a_background_color (term_env.F_set_a_background);
set_foreground_color (term_env.F_set_foreground);
set_background_color (term_env.F_set_background);
set_term_color_pair (term_env.F_set_color_pair);
set_orig_pair (term_env.F_orig_pair);
set_orig_orig_colors (term_env.F_orig_colors);
initialize();
}
//----------------------------------------------------------------------
void FOptiAttr::set_enter_bold_mode (char cap[])
{
@ -447,7 +496,7 @@ void FOptiAttr::set_orig_orig_colors (char cap[])
}
//----------------------------------------------------------------------
bool FOptiAttr::isNormal (char_data*& ch)
bool FOptiAttr::isNormal (charData*& ch)
{
return hasNoAttribute(ch) && ! hasColor(ch);
}
@ -539,7 +588,7 @@ short FOptiAttr::vga2ansi (register short color)
}
//----------------------------------------------------------------------
char* FOptiAttr::changeAttribute (char_data*& term, char_data*& next)
char* FOptiAttr::changeAttribute (charData*& term, charData*& next)
{
const bool next_has_color = hasColor(next);
fake_reverse = false;
@ -581,7 +630,7 @@ char* FOptiAttr::changeAttribute (char_data*& term, char_data*& next)
// private methods of FOptiAttr
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermBold (char_data*& term)
inline bool FOptiAttr::setTermBold (charData*& term)
{
if ( ! term )
return false;
@ -595,7 +644,7 @@ inline bool FOptiAttr::setTermBold (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermBold (char_data*& term)
inline bool FOptiAttr::unsetTermBold (charData*& term)
{
// Back to normal intensity (turns off bold + dim)
@ -617,7 +666,7 @@ inline bool FOptiAttr::unsetTermBold (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermDim (char_data*& term)
inline bool FOptiAttr::setTermDim (charData*& term)
{
if ( ! term )
return false;
@ -631,7 +680,7 @@ inline bool FOptiAttr::setTermDim (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermDim (char_data*& term)
inline bool FOptiAttr::unsetTermDim (charData*& term)
{
// Back to normal intensity (turns off bold + dim)
@ -653,7 +702,7 @@ inline bool FOptiAttr::unsetTermDim (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermItalic (char_data*& term)
inline bool FOptiAttr::setTermItalic (charData*& term)
{
if ( ! term )
return false;
@ -667,7 +716,7 @@ inline bool FOptiAttr::setTermItalic (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermItalic (char_data*& term)
inline bool FOptiAttr::unsetTermItalic (charData*& term)
{
if ( ! term )
return false;
@ -684,7 +733,7 @@ inline bool FOptiAttr::unsetTermItalic (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermUnderline (char_data*& term)
inline bool FOptiAttr::setTermUnderline (charData*& term)
{
if ( ! term )
return false;
@ -698,7 +747,7 @@ inline bool FOptiAttr::setTermUnderline (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermUnderline (char_data*& term)
inline bool FOptiAttr::unsetTermUnderline (charData*& term)
{
// Turns off every underlining
@ -720,7 +769,7 @@ inline bool FOptiAttr::unsetTermUnderline (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermBlink (char_data*& term)
inline bool FOptiAttr::setTermBlink (charData*& term)
{
if ( ! term )
return false;
@ -734,7 +783,7 @@ inline bool FOptiAttr::setTermBlink (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermBlink (char_data*& term)
inline bool FOptiAttr::unsetTermBlink (charData*& term)
{
if ( ! term )
return false;
@ -751,7 +800,7 @@ inline bool FOptiAttr::unsetTermBlink (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermReverse (char_data*& term)
inline bool FOptiAttr::setTermReverse (charData*& term)
{
if ( ! term )
return false;
@ -765,7 +814,7 @@ inline bool FOptiAttr::setTermReverse (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermReverse (char_data*& term)
inline bool FOptiAttr::unsetTermReverse (charData*& term)
{
if ( ! term )
return false;
@ -782,7 +831,7 @@ inline bool FOptiAttr::unsetTermReverse (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermStandout (char_data*& term)
inline bool FOptiAttr::setTermStandout (charData*& term)
{
if ( ! term )
return false;
@ -796,7 +845,7 @@ inline bool FOptiAttr::setTermStandout (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermStandout (char_data*& term)
inline bool FOptiAttr::unsetTermStandout (charData*& term)
{
if ( ! term )
return false;
@ -813,7 +862,7 @@ inline bool FOptiAttr::unsetTermStandout (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermInvisible (char_data*& term)
inline bool FOptiAttr::setTermInvisible (charData*& term)
{
if ( ! term )
return false;
@ -827,7 +876,7 @@ inline bool FOptiAttr::setTermInvisible (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermInvisible (char_data*& term)
inline bool FOptiAttr::unsetTermInvisible (charData*& term)
{
if ( ! term )
return false;
@ -844,7 +893,7 @@ inline bool FOptiAttr::unsetTermInvisible (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermProtected (char_data*& term)
inline bool FOptiAttr::setTermProtected (charData*& term)
{
if ( ! term )
return false;
@ -858,7 +907,7 @@ inline bool FOptiAttr::setTermProtected (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermProtected (char_data*& term)
inline bool FOptiAttr::unsetTermProtected (charData*& term)
{
if ( ! term )
return false;
@ -875,7 +924,7 @@ inline bool FOptiAttr::unsetTermProtected (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermCrossedOut (char_data*& term)
inline bool FOptiAttr::setTermCrossedOut (charData*& term)
{
if ( ! term )
return false;
@ -889,7 +938,7 @@ inline bool FOptiAttr::setTermCrossedOut (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermCrossedOut (char_data*& term)
inline bool FOptiAttr::unsetTermCrossedOut (charData*& term)
{
if ( ! term )
return false;
@ -906,7 +955,7 @@ inline bool FOptiAttr::unsetTermCrossedOut (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermDoubleUnderline (char_data*& term)
inline bool FOptiAttr::setTermDoubleUnderline (charData*& term)
{
if ( ! term )
return false;
@ -920,7 +969,7 @@ inline bool FOptiAttr::setTermDoubleUnderline (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermDoubleUnderline (char_data*& term)
inline bool FOptiAttr::unsetTermDoubleUnderline (charData*& term)
{
// Turns off every underlining
@ -942,7 +991,7 @@ inline bool FOptiAttr::unsetTermDoubleUnderline (char_data*& term)
}
//----------------------------------------------------------------------
bool FOptiAttr::setTermAttributes ( char_data*& term
bool FOptiAttr::setTermAttributes ( charData*& term
, bool p1, bool p2, bool p3
, bool p4, bool p5, bool p6
, bool p7, bool p8, bool p9 )
@ -982,7 +1031,7 @@ bool FOptiAttr::setTermAttributes ( char_data*& term
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermAttributes (char_data*& term)
inline bool FOptiAttr::unsetTermAttributes (charData*& term)
{
if ( ! term )
return false;
@ -996,7 +1045,7 @@ inline bool FOptiAttr::unsetTermAttributes (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermAltCharset (char_data*& term)
inline bool FOptiAttr::setTermAltCharset (charData*& term)
{
if ( ! term )
return false;
@ -1013,7 +1062,7 @@ inline bool FOptiAttr::setTermAltCharset (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermAltCharset (char_data*& term)
inline bool FOptiAttr::unsetTermAltCharset (charData*& term)
{
if ( ! term )
return false;
@ -1030,7 +1079,7 @@ inline bool FOptiAttr::unsetTermAltCharset (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::setTermPCcharset (char_data*& term)
inline bool FOptiAttr::setTermPCcharset (charData*& term)
{
if ( ! term )
return false;
@ -1047,7 +1096,7 @@ inline bool FOptiAttr::setTermPCcharset (char_data*& term)
}
//----------------------------------------------------------------------
inline bool FOptiAttr::unsetTermPCcharset (char_data*& term)
inline bool FOptiAttr::unsetTermPCcharset (charData*& term)
{
if ( ! term )
return false;
@ -1064,7 +1113,7 @@ inline bool FOptiAttr::unsetTermPCcharset (char_data*& term)
}
//----------------------------------------------------------------------
bool FOptiAttr::setTermDefaultColor (char_data*& term)
bool FOptiAttr::setTermDefaultColor (charData*& term)
{
if ( ! term )
return false;
@ -1087,7 +1136,7 @@ bool FOptiAttr::setTermDefaultColor (char_data*& term)
}
//----------------------------------------------------------------------
void FOptiAttr::setAttributesOn (char_data*& term)
void FOptiAttr::setAttributesOn (charData*& term)
{
if ( on.attr.bit.alt_charset )
setTermAltCharset(term);
@ -1130,7 +1179,7 @@ void FOptiAttr::setAttributesOn (char_data*& term)
}
//----------------------------------------------------------------------
void FOptiAttr::setAttributesOff (char_data*& term)
void FOptiAttr::setAttributesOff (charData*& term)
{
if ( off.attr.bit.pc_charset )
unsetTermPCcharset(term);
@ -1173,7 +1222,7 @@ void FOptiAttr::setAttributesOff (char_data*& term)
}
//----------------------------------------------------------------------
bool FOptiAttr::hasColor (char_data*& attr)
bool FOptiAttr::hasColor (charData*& attr)
{
if ( attr && attr->fg_color < 0 && attr->bg_color < 0 )
return false;
@ -1182,7 +1231,7 @@ bool FOptiAttr::hasColor (char_data*& attr)
}
//----------------------------------------------------------------------
bool FOptiAttr::hasAttribute (char_data*& attr)
bool FOptiAttr::hasAttribute (charData*& attr)
{
if ( attr )
{
@ -1205,13 +1254,13 @@ bool FOptiAttr::hasAttribute (char_data*& attr)
}
//----------------------------------------------------------------------
bool FOptiAttr::hasNoAttribute (char_data*& attr)
bool FOptiAttr::hasNoAttribute (charData*& attr)
{
return ! hasAttribute(attr);
}
//----------------------------------------------------------------------
inline bool FOptiAttr::colorChange (char_data*& term, char_data*& next)
inline bool FOptiAttr::colorChange (charData*& term, charData*& next)
{
if ( term && next )
{
@ -1228,7 +1277,7 @@ inline bool FOptiAttr::colorChange (char_data*& term, char_data*& next)
}
//----------------------------------------------------------------------
inline void FOptiAttr::resetColor (char_data*& attr)
inline void FOptiAttr::resetColor (charData*& attr)
{
if ( attr )
{
@ -1238,7 +1287,7 @@ inline void FOptiAttr::resetColor (char_data*& attr)
}
//----------------------------------------------------------------------
inline void FOptiAttr::prevent_no_color_video_attributes ( char_data*& attr
inline void FOptiAttr::prevent_no_color_video_attributes ( charData*& attr
, bool next_has_color )
{
// Ignore attributes which can not combined with a color
@ -1299,8 +1348,8 @@ inline void FOptiAttr::prevent_no_color_video_attributes ( char_data*& attr
}
//----------------------------------------------------------------------
inline void FOptiAttr::deactivateAttributes ( char_data*& term
, char_data*& next )
inline void FOptiAttr::deactivateAttributes ( charData*& term
, charData*& next )
{
if ( hasAttribute(term) )
{
@ -1323,8 +1372,8 @@ inline void FOptiAttr::deactivateAttributes ( char_data*& term
}
//----------------------------------------------------------------------
inline void FOptiAttr::changeAttributeSGR ( char_data*& term
, char_data*& next )
inline void FOptiAttr::changeAttributeSGR ( charData*& term
, charData*& next )
{
bool pc_charset_usable = true;
@ -1373,8 +1422,8 @@ inline void FOptiAttr::changeAttributeSGR ( char_data*& term
}
//----------------------------------------------------------------------
inline void FOptiAttr::changeAttributeSeparately ( char_data*& term
, char_data*& next )
inline void FOptiAttr::changeAttributeSeparately ( charData*& term
, charData*& next )
{
setAttributesOff(term);
@ -1386,7 +1435,7 @@ inline void FOptiAttr::changeAttributeSeparately ( char_data*& term
}
//----------------------------------------------------------------------
void FOptiAttr::change_color (char_data*& term, char_data*& next)
void FOptiAttr::change_color (charData*& term, charData*& next)
{
short fg, bg;
@ -1427,8 +1476,8 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next)
}
//----------------------------------------------------------------------
inline void FOptiAttr::change_to_default_color ( char_data*& term
, char_data*& next
inline void FOptiAttr::change_to_default_color ( charData*& term
, charData*& next
, short& fg, short& bg )
{
if ( ansi_default_color )
@ -1467,7 +1516,7 @@ inline void FOptiAttr::change_to_default_color ( char_data*& term
}
//----------------------------------------------------------------------
inline void FOptiAttr::change_current_color ( char_data*& term
inline void FOptiAttr::change_current_color ( charData*& term
, short fg, short bg )
{
char* color_str;
@ -1515,7 +1564,7 @@ inline void FOptiAttr::change_current_color ( char_data*& term
}
//----------------------------------------------------------------------
inline void FOptiAttr::resetAttribute (char_data*& attr)
inline void FOptiAttr::resetAttribute (charData*& attr)
{
if ( attr )
{
@ -1525,7 +1574,7 @@ inline void FOptiAttr::resetAttribute (char_data*& attr)
}
//----------------------------------------------------------------------
inline void FOptiAttr::reset (char_data*& attr)
inline void FOptiAttr::reset (charData*& attr)
{
if ( attr )
{
@ -1585,7 +1634,7 @@ inline bool FOptiAttr::hasCharsetEquivalence()
}
//----------------------------------------------------------------------
inline void FOptiAttr::detectSwitchOn (char_data*& term, char_data*& next)
inline void FOptiAttr::detectSwitchOn (charData*& term, charData*& next)
{
if ( ! (term && next) )
return;
@ -1606,7 +1655,7 @@ inline void FOptiAttr::detectSwitchOn (char_data*& term, char_data*& next)
}
//----------------------------------------------------------------------
inline void FOptiAttr::detectSwitchOff (char_data*& term, char_data*& next)
inline void FOptiAttr::detectSwitchOff (charData*& term, charData*& next)
{
if ( ! (term && next) )
return;
@ -1629,14 +1678,14 @@ inline void FOptiAttr::detectSwitchOff (char_data*& term, char_data*& next)
//----------------------------------------------------------------------
inline bool FOptiAttr::switchOn()
{
char_data* on_ptr = &on;
charData* on_ptr = &on;
return hasAttribute(on_ptr);
}
//----------------------------------------------------------------------
inline bool FOptiAttr::switchOff()
{
char_data* off_ptr = &off;
charData* off_ptr = &off;
return hasAttribute(off_ptr);
}

View File

@ -682,13 +682,13 @@ void FScrollView::copy2area()
for (int y = 0; y < y_end; y++) // line loop
{
char_data* vc; // viewport character
char_data* ac; // area character
charData* vc; // viewport character
charData* ac; // area character
int v_line_len = viewport->width;
int a_line_len = print_area->width + print_area->right_shadow;
vc = &viewport->text[(dy + y) * v_line_len + dx];
ac = &print_area->text[(ay + y) * a_line_len + ax];
std::memcpy (ac, vc, sizeof(char_data) * unsigned(x_end));
std::memcpy (ac, vc, sizeof(charData) * unsigned(x_end));
if ( short(print_area->changes[ay + y].xmin) > ax )
print_area->changes[ay + y].xmin = uInt(ax);

View File

@ -183,7 +183,7 @@ FMouseControl* FTerm::getMouseControl()
}
//----------------------------------------------------------------------
bool FTerm::isNormal (char_data*& ch)
bool FTerm::isNormal (charData*& ch)
{
return opti_attr->isNormal(ch);
}
@ -1027,8 +1027,8 @@ void FTerm::initScreenSettings()
}
//----------------------------------------------------------------------
char* FTerm::changeAttribute ( char_data*& term_attr
, char_data*& next_attr )
char* FTerm::changeAttribute ( charData*& term_attr
, charData*& next_attr )
{
return opti_attr->changeAttribute (term_attr, next_attr);
}
@ -1551,48 +1551,49 @@ void FTerm::init_OptiAttr()
{
// Setting video attribute optimization
opti_attr->setNoColorVideo (int(FTermcap::attr_without_color));
opti_attr->set_enter_bold_mode (TCAP(fc::t_enter_bold_mode));
opti_attr->set_exit_bold_mode (TCAP(fc::t_exit_bold_mode));
opti_attr->set_enter_dim_mode (TCAP(fc::t_enter_dim_mode));
opti_attr->set_exit_dim_mode (TCAP(fc::t_exit_dim_mode));
opti_attr->set_enter_italics_mode (TCAP(fc::t_enter_italics_mode));
opti_attr->set_exit_italics_mode (TCAP(fc::t_exit_italics_mode));
opti_attr->set_enter_underline_mode (TCAP(fc::t_enter_underline_mode));
opti_attr->set_exit_underline_mode (TCAP(fc::t_exit_underline_mode));
opti_attr->set_enter_blink_mode (TCAP(fc::t_enter_blink_mode));
opti_attr->set_exit_blink_mode (TCAP(fc::t_exit_blink_mode));
opti_attr->set_enter_reverse_mode (TCAP(fc::t_enter_reverse_mode));
opti_attr->set_exit_reverse_mode (TCAP(fc::t_exit_reverse_mode));
opti_attr->set_enter_standout_mode (TCAP(fc::t_enter_standout_mode));
opti_attr->set_exit_standout_mode (TCAP(fc::t_exit_standout_mode));
opti_attr->set_enter_secure_mode (TCAP(fc::t_enter_secure_mode));
opti_attr->set_exit_secure_mode (TCAP(fc::t_exit_secure_mode));
opti_attr->set_enter_protected_mode (TCAP(fc::t_enter_protected_mode));
opti_attr->set_exit_protected_mode (TCAP(fc::t_exit_protected_mode));
opti_attr->set_enter_crossed_out_mode (TCAP(fc::t_enter_crossed_out_mode));
opti_attr->set_exit_crossed_out_mode (TCAP(fc::t_exit_crossed_out_mode));
opti_attr->set_enter_dbl_underline_mode (TCAP(fc::t_enter_dbl_underline_mode));
opti_attr->set_exit_dbl_underline_mode (TCAP(fc::t_exit_dbl_underline_mode));
opti_attr->set_set_attributes (TCAP(fc::t_set_attributes));
opti_attr->set_exit_attribute_mode (TCAP(fc::t_exit_attribute_mode));
opti_attr->set_enter_alt_charset_mode (TCAP(fc::t_enter_alt_charset_mode));
opti_attr->set_exit_alt_charset_mode (TCAP(fc::t_exit_alt_charset_mode));
opti_attr->set_enter_pc_charset_mode (TCAP(fc::t_enter_pc_charset_mode));
opti_attr->set_exit_pc_charset_mode (TCAP(fc::t_exit_pc_charset_mode));
opti_attr->set_a_foreground_color (TCAP(fc::t_set_a_foreground));
opti_attr->set_a_background_color (TCAP(fc::t_set_a_background));
opti_attr->set_foreground_color (TCAP(fc::t_set_foreground));
opti_attr->set_background_color (TCAP(fc::t_set_background));
opti_attr->set_term_color_pair (TCAP(fc::t_set_color_pair));
opti_attr->set_orig_pair (TCAP(fc::t_orig_pair));
opti_attr->set_orig_orig_colors (TCAP(fc::t_orig_colors));
opti_attr->setMaxColor (FTermcap::max_color);
FOptiAttr::termEnv optiattr_env =
{
FTermcap::ansi_default_color,
FTermcap::max_color,
FTermcap::attr_without_color,
TCAP(fc::t_enter_bold_mode),
TCAP(fc::t_exit_bold_mode),
TCAP(fc::t_enter_dim_mode),
TCAP(fc::t_exit_dim_mode),
TCAP(fc::t_enter_italics_mode),
TCAP(fc::t_exit_italics_mode),
TCAP(fc::t_enter_underline_mode),
TCAP(fc::t_exit_underline_mode),
TCAP(fc::t_enter_blink_mode),
TCAP(fc::t_exit_blink_mode),
TCAP(fc::t_enter_reverse_mode),
TCAP(fc::t_exit_reverse_mode),
TCAP(fc::t_enter_standout_mode),
TCAP(fc::t_exit_standout_mode),
TCAP(fc::t_enter_secure_mode),
TCAP(fc::t_exit_secure_mode),
TCAP(fc::t_enter_protected_mode),
TCAP(fc::t_exit_protected_mode),
TCAP(fc::t_enter_crossed_out_mode),
TCAP(fc::t_exit_crossed_out_mode),
TCAP(fc::t_enter_dbl_underline_mode),
TCAP(fc::t_exit_dbl_underline_mode),
TCAP(fc::t_set_attributes),
TCAP(fc::t_exit_attribute_mode),
TCAP(fc::t_enter_alt_charset_mode),
TCAP(fc::t_enter_alt_charset_mode),
TCAP(fc::t_enter_pc_charset_mode),
TCAP(fc::t_exit_pc_charset_mode),
TCAP(fc::t_set_a_foreground),
TCAP(fc::t_set_a_background),
TCAP(fc::t_set_foreground),
TCAP(fc::t_set_background),
TCAP(fc::t_orig_pair),
TCAP(fc::t_orig_pair),
TCAP(fc::t_orig_colors)
};
if ( FTermcap::ansi_default_color )
opti_attr->setDefaultColorSupport();
opti_attr->initialize();
opti_attr->setTermEnvironment(optiattr_env);
}
//----------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
* *
* This file is part of the Final Cut widget toolkit *
* *
* Copyright 2017 Markus Gans *
* Copyright 2017-2018 Markus Gans *
* *
* The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
@ -138,7 +138,7 @@ int FTermBuffer::write (const FString& s)
{
while ( *p )
{
char_data nc; // next character
charData nc; // next character
nc = FVTerm::getAttribute();
nc.code = *p;
nc.attr.bit.no_changes = false;
@ -157,7 +157,7 @@ int FTermBuffer::write (const FString& s)
//----------------------------------------------------------------------
int FTermBuffer::write (register int c)
{
char_data nc; // next character
charData nc; // next character
nc = FVTerm::getAttribute();
nc.code = c;
nc.attr.bit.no_changes = false;
@ -170,8 +170,8 @@ int FTermBuffer::write (register int c)
// FTermBuffer non-member operators
//----------------------------------------------------------------------
std::vector<FTermBuffer::char_data>& operator << \
( std::vector<FTermBuffer::char_data>& termString
std::vector<FTermBuffer::charData>& operator << \
( std::vector<FTermBuffer::charData>& termString
, const FTermBuffer& buf )
{
if ( ! buf.data.empty() )

View File

@ -45,10 +45,10 @@ FVTerm::term_area* FVTerm::vdesktop = 0;
FVTerm::term_area* FVTerm::active_area = 0;
FVTerm::termcap_map* FVTerm::tcap = 0;
FTermcap::tcap_map* FTermcap::tcap = 0;
FVTerm::char_data FVTerm::term_attribute;
FVTerm::char_data FVTerm::next_attribute;
FVTerm::char_data FVTerm::s_ch;
FVTerm::char_data FVTerm::i_ch;
FVTerm::charData FVTerm::term_attribute;
FVTerm::charData FVTerm::next_attribute;
FVTerm::charData FVTerm::s_ch;
FVTerm::charData FVTerm::i_ch;
//----------------------------------------------------------------------
@ -425,7 +425,7 @@ int FVTerm::print (term_area* area, const FString& s)
{
assert ( ! s.isNull() );
const wchar_t* p;
std::vector<char_data> term_string;
std::vector<charData> term_string;
if ( ! area )
return -1;
@ -436,7 +436,7 @@ int FVTerm::print (term_area* area, const FString& s)
{
while ( *p )
{
char_data nc; // next character
charData nc; // next character
nc.code = *p;
nc.fg_color = next_attribute.fg_color;
nc.bg_color = next_attribute.bg_color;
@ -454,7 +454,7 @@ int FVTerm::print (term_area* area, const FString& s)
}
//----------------------------------------------------------------------
int FVTerm::print (const std::vector<char_data>& term_string)
int FVTerm::print (const std::vector<charData>& term_string)
{
if ( term_string.empty() )
return 0;
@ -473,10 +473,10 @@ int FVTerm::print (const std::vector<char_data>& term_string)
}
//----------------------------------------------------------------------
int FVTerm::print (term_area* area, const std::vector<char_data>& term_string)
int FVTerm::print (term_area* area, const std::vector<charData>& term_string)
{
register int len = 0;
std::vector<char_data>::const_iterator iter;
std::vector<charData>::const_iterator iter;
iter = term_string.begin();
uInt tabstop = uInt(getTabstop());
@ -517,7 +517,7 @@ int FVTerm::print (term_area* area, const std::vector<char_data>& term_string)
default:
{
char_data nc = *iter; // next character
charData nc = *iter; // next character
print (area, nc);
printable_character = true;
}
@ -552,7 +552,7 @@ int FVTerm::print (register int c)
//----------------------------------------------------------------------
int FVTerm::print (term_area* area, register int c)
{
char_data nc; // next character
charData nc; // next character
if ( ! area )
return -1;
@ -568,7 +568,7 @@ int FVTerm::print (term_area* area, register int c)
}
//----------------------------------------------------------------------
int FVTerm::print (char_data& term_char)
int FVTerm::print (charData& term_char)
{
term_area* area = getPrintArea();
@ -584,9 +584,9 @@ int FVTerm::print (char_data& term_char)
}
//----------------------------------------------------------------------
int FVTerm::print (term_area* area, char_data& term_char)
int FVTerm::print (term_area* area, charData& term_char)
{
char_data& nc = term_char; // next character
charData& nc = term_char; // next character
int width, height, rsh, bsh, ax, ay;
if ( ! area )
@ -604,7 +604,7 @@ int FVTerm::print (term_area* area, char_data& term_char)
&& ax < area->width + area->right_shadow
&& ay < area->height + area->bottom_shadow )
{
char_data* ac; // area character
charData* ac; // area character
int line_len = area->width + area->right_shadow;
ac = &area->text[ay * line_len + ax];
@ -797,7 +797,7 @@ inline void FVTerm::setTextToDefault ( term_area* area
, int width
, int height )
{
char_data default_char;
charData default_char;
line_changes unchanged;
int size = width * height;
@ -831,7 +831,7 @@ inline bool FVTerm::reallocateTextArea ( term_area* area
try
{
area->changes = new line_changes[height];
area->text = new char_data[size];
area->text = new charData[size];
}
catch (const std::bad_alloc& ex)
{
@ -850,7 +850,7 @@ inline bool FVTerm::reallocateTextArea (term_area* area, int size)
try
{
area->text = new char_data[size];
area->text = new charData[size];
}
catch (const std::bad_alloc& ex)
{
@ -897,8 +897,8 @@ void FVTerm::restoreVTerm (const FRect& box)
//----------------------------------------------------------------------
void FVTerm::restoreVTerm (int x, int y, int w, int h)
{
char_data* tc; // terminal character
char_data sc; // shown character
charData* tc; // terminal character
charData sc; // shown character
x--;
y--;
@ -933,7 +933,7 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
int xpos = x + tx;
tc = &vterm->text[ypos * vterm->width + xpos];
sc = generateCharacter(xpos, ypos);
std::memcpy (tc, &sc, sizeof(char_data));
std::memcpy (tc, &sc, sizeof(charData));
}
if ( short(vterm->changes[ypos].xmin) > x )
@ -996,7 +996,7 @@ FVTerm::covered_state FVTerm::isCovered ( int x, int y
if ( found && geometry.contains(x, y) )
{
char_data* tmp;
charData* tmp;
int line_len = win->width + win->right_shadow;
tmp = &win->text[(y - win_y) * line_len + (x - win_x)];
@ -1029,14 +1029,14 @@ void FVTerm::updateOverlappedColor ( term_area* area
int& rsh = area->right_shadow;
int line_len = aw + rsh;
// Area character
char_data* ac = &area->text[y * line_len + x];
charData* ac = &area->text[y * line_len + x];
// Terminal character
char_data* tc = &vterm->text[ty * vterm->width + tx];
charData* tc = &vterm->text[ty * vterm->width + tx];
// New character
char_data nc;
std::memcpy (&nc, ac, sizeof(char_data));
charData nc;
std::memcpy (&nc, ac, sizeof(charData));
// Overlapped character
char_data oc = getOverlappedCharacter (tx + 1, ty + 1, area->widget);
charData oc = getOverlappedCharacter (tx + 1, ty + 1, area->widget);
nc.fg_color = oc.fg_color;
nc.bg_color = oc.bg_color;
nc.attr.bit.reverse = false;
@ -1051,7 +1051,7 @@ void FVTerm::updateOverlappedColor ( term_area* area
nc.code = ' ';
nc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == nc);
std::memcpy (tc, &nc, sizeof(char_data));
std::memcpy (tc, &nc, sizeof(charData));
}
//----------------------------------------------------------------------
@ -1060,11 +1060,11 @@ void FVTerm::updateOverlappedCharacter (term_area* area, int tx, int ty)
// Restore one character on vterm
// Terminal character
char_data* tc = &vterm->text[ty * vterm->width + tx];
charData* tc = &vterm->text[ty * vterm->width + tx];
// Overlapped character
char_data oc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
charData oc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
oc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == oc);
std::memcpy (tc, &oc, sizeof(char_data));
std::memcpy (tc, &oc, sizeof(charData));
}
//----------------------------------------------------------------------
@ -1077,11 +1077,11 @@ void FVTerm::updateShadedCharacter ( term_area* area
int& rsh = area->right_shadow;
int line_len = aw + rsh;
// Area character
char_data* ac = &area->text[y * line_len + x];
charData* ac = &area->text[y * line_len + x];
// Terminal character
char_data* tc = &vterm->text[ty * vterm->width + tx];
charData* tc = &vterm->text[ty * vterm->width + tx];
// Overlapped character
char_data oc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
charData oc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
oc.fg_color = ac->fg_color;
oc.bg_color = ac->bg_color;
oc.attr.bit.reverse = false;
@ -1096,7 +1096,7 @@ void FVTerm::updateShadedCharacter ( term_area* area
oc.code = ' ';
oc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == oc);
std::memcpy (tc, &oc, sizeof(char_data));
std::memcpy (tc, &oc, sizeof(charData));
}
//----------------------------------------------------------------------
@ -1109,17 +1109,17 @@ void FVTerm::updateInheritBackground ( term_area* area
int& rsh = area->right_shadow;
int line_len = aw + rsh;
// Area character
char_data* ac = &area->text[y * line_len + x];
charData* ac = &area->text[y * line_len + x];
// Terminal character
char_data* tc = &vterm->text[ty * vterm->width + tx];
charData* tc = &vterm->text[ty * vterm->width + tx];
// New character
char_data nc;
std::memcpy (&nc, ac, sizeof(char_data));
charData nc;
std::memcpy (&nc, ac, sizeof(charData));
// Covered character
char_data cc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
charData cc = getCoveredCharacter (tx + 1, ty + 1, area->widget);
nc.bg_color = cc.bg_color;
nc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == nc);
std::memcpy (tc, &nc, sizeof(char_data));
std::memcpy (tc, &nc, sizeof(charData));
}
//----------------------------------------------------------------------
@ -1132,10 +1132,10 @@ void FVTerm::updateCharacter ( term_area* area
int& rsh = area->right_shadow;
int line_len = aw + rsh;
// Area character
char_data* ac = &area->text[y * line_len + x];
charData* ac = &area->text[y * line_len + x];
// Terminal character
char_data* tc = &vterm->text[ty * vterm->width + tx];
std::memcpy (tc, ac, sizeof(char_data));
charData* tc = &vterm->text[ty * vterm->width + tx];
std::memcpy (tc, ac, sizeof(charData));
if ( tc->attr.bit.printed && *tc == *ac )
tc->attr.bit.no_changes = true;
@ -1151,7 +1151,7 @@ bool FVTerm::updateVTermCharacter ( term_area* area
int& rsh = area->right_shadow;
int line_len = aw + rsh;
// Area character
char_data* ac = &area->text[y * line_len + x];
charData* ac = &area->text[y * line_len + x];
// Get covered state
covered_state is_covered = isCovered(tx, ty, area);
@ -1460,11 +1460,11 @@ void FVTerm::getArea (int ax, int ay, term_area* area)
for (int y = 0; y < y_end; y++) // line loop
{
char_data* tc; // terminal character
char_data* ac; // area character
charData* tc; // terminal character
charData* ac; // area character
tc = &vterm->text[(ay + y) * vterm->width + ax];
ac = &area->text[y * area->width];
std::memcpy (ac, tc, sizeof(char_data) * unsigned(length));
std::memcpy (ac, tc, sizeof(charData) * unsigned(length));
if ( short(area->changes[y].xmin) > 0 )
area->changes[y].xmin = 0;
@ -1515,12 +1515,12 @@ void FVTerm::getArea (int x, int y, int w, int h, term_area* area)
for (int _y = 0; _y < y_end; _y++) // line loop
{
char_data* tc; // terminal character
char_data* ac; // area character
charData* tc; // terminal character
charData* ac; // area character
int line_len = area->width + area->right_shadow;
tc = &vterm->text[(y + _y - 1) * vterm->width + x - 1];
ac = &area->text[(dy + _y) * line_len + dx];
std::memcpy (ac, tc, sizeof(char_data) * unsigned(length));
std::memcpy (ac, tc, sizeof(charData) * unsigned(length));
if ( short(area->changes[dy + _y].xmin) > dx )
area->changes[dy + _y].xmin = uInt(dx);
@ -1549,8 +1549,8 @@ void FVTerm::putArea (int ax, int ay, term_area* area)
{
// Copies the given area block to the virtual terminal position
char_data* tc; // terminal character
char_data* ac; // area character
charData* tc; // terminal character
charData* ac; // area character
if ( ! area )
return;
@ -1627,9 +1627,9 @@ void FVTerm::scrollAreaForward (term_area* area)
int total_width
, length
, y_max;
char_data nc; // next character
char_data* lc; // last character
char_data* dc; // destination character
charData nc; // next character
charData* lc; // last character
charData* dc; // destination character
if ( ! area )
return;
@ -1643,19 +1643,19 @@ void FVTerm::scrollAreaForward (term_area* area)
for (int y = 0; y < y_max; y++)
{
char_data* sc; // source character
charData* sc; // source character
int pos1 = y * total_width;
int pos2 = (y + 1) * total_width;
sc = &area->text[pos2];
dc = &area->text[pos1];
std::memcpy (dc, sc, sizeof(char_data) * unsigned(length));
std::memcpy (dc, sc, sizeof(charData) * unsigned(length));
area->changes[y].xmin = 0;
area->changes[y].xmax = uInt(area->width - 1);
}
// insert a new line below
lc = &area->text[(y_max * total_width) - area->right_shadow - 1];
std::memcpy (&nc, lc, sizeof(char_data));
std::memcpy (&nc, lc, sizeof(charData));
nc.code = ' ';
dc = &area->text[y_max * total_width];
std::fill_n (dc, area->width, nc);
@ -1688,9 +1688,9 @@ void FVTerm::scrollAreaReverse (term_area* area)
int total_width
, length
, y_max;
char_data nc; // next character
char_data* lc; // last character
char_data* dc; // destination character
charData nc; // next character
charData* lc; // last character
charData* dc; // destination character
if ( ! area )
return;
@ -1704,19 +1704,19 @@ void FVTerm::scrollAreaReverse (term_area* area)
for (int y = y_max; y > 0; y--)
{
char_data* sc; // source character
charData* sc; // source character
int pos1 = (y - 1) * total_width;
int pos2 = y * total_width;
sc = &area->text[pos1];
dc = &area->text[pos2];
std::memcpy (dc, sc, sizeof(char_data) * unsigned(length));
std::memcpy (dc, sc, sizeof(charData) * unsigned(length));
area->changes[y].xmin = 0;
area->changes[y].xmax = uInt(area->width - 1);
}
// insert a new line above
lc = &area->text[total_width];
std::memcpy (&nc, lc, sizeof(char_data));
std::memcpy (&nc, lc, sizeof(charData));
nc.code = ' ';
dc = &area->text[0];
std::fill_n (dc, area->width, nc);
@ -1747,11 +1747,11 @@ void FVTerm::clearArea (term_area* area, int fillchar)
{
// Clear the area with the current attributes
char_data nc; // next character
charData nc; // next character
uInt w;
// Current attributes with a space character
std::memcpy (&nc, &next_attribute, sizeof(char_data));
std::memcpy (&nc, &next_attribute, sizeof(charData));
nc.code = fillchar;
if ( ! (area && area->text) )
@ -1797,18 +1797,18 @@ void FVTerm::clearArea (term_area* area, int fillchar)
}
//----------------------------------------------------------------------
FVTerm::char_data FVTerm::generateCharacter (const FPoint& pos)
FVTerm::charData FVTerm::generateCharacter (const FPoint& pos)
{
// Generates characters for a given position considering all areas
return generateCharacter (pos.getX(), pos.getY());
}
//----------------------------------------------------------------------
FVTerm::char_data FVTerm::generateCharacter (int x, int y)
FVTerm::charData FVTerm::generateCharacter (int x, int y)
{
// Generates characters for a given position considering all areas
FWidget::widgetList::const_iterator iter, end;
char_data* sc; // shown character
charData* sc; // shown character
FWidget* widget;
widget = static_cast<FWidget*>(vterm->widget);
@ -1837,7 +1837,7 @@ FVTerm::char_data FVTerm::generateCharacter (int x, int y)
// Window is visible and contains current character
if ( geometry.contains(x, y) )
{
char_data* tmp;
charData* tmp;
int line_len = win->width + win->right_shadow;
tmp = &win->text[(y - win_y) * line_len + (x - win_x)];
@ -1846,7 +1846,7 @@ FVTerm::char_data FVTerm::generateCharacter (int x, int y)
if ( tmp->attr.bit.trans_shadow ) // Transparent shadow
{
// Keep the current vterm character
std::memcpy (&s_ch, sc, sizeof(char_data));
std::memcpy (&s_ch, sc, sizeof(charData));
s_ch.fg_color = tmp->fg_color;
s_ch.bg_color = tmp->bg_color;
s_ch.attr.bit.reverse = false;
@ -1865,7 +1865,7 @@ FVTerm::char_data FVTerm::generateCharacter (int x, int y)
else if ( tmp->attr.bit.inherit_bg )
{
// Add the covered background to this character
std::memcpy (&i_ch, tmp, sizeof(char_data));
std::memcpy (&i_ch, tmp, sizeof(charData));
i_ch.bg_color = sc->bg_color; // Last background color
sc = &i_ch;
}
@ -1879,7 +1879,7 @@ FVTerm::char_data FVTerm::generateCharacter (int x, int y)
}
//----------------------------------------------------------------------
FVTerm::char_data FVTerm::getCharacter ( character_type type
FVTerm::charData FVTerm::getCharacter ( character_type type
, const FPoint& pos
, FVTerm* obj )
{
@ -1888,14 +1888,14 @@ FVTerm::char_data FVTerm::getCharacter ( character_type type
}
//----------------------------------------------------------------------
FVTerm::char_data FVTerm::getCharacter ( character_type char_type
FVTerm::charData FVTerm::getCharacter ( character_type char_type
, int x
, int y
, FVTerm* obj )
{
// Gets the overlapped or the covered character for the position (x,y)
int xx, yy, layer;
char_data* cc; // covered character
charData* cc; // covered character
FWidget* w;
FWidget::widgetList::const_iterator iter, end;
@ -1962,7 +1962,7 @@ FVTerm::char_data FVTerm::getCharacter ( character_type char_type
}
//----------------------------------------------------------------------
FVTerm::char_data FVTerm::getCoveredCharacter ( const FPoint& pos
FVTerm::charData FVTerm::getCoveredCharacter ( const FPoint& pos
, FVTerm* obj )
{
// Gets the covered character for a given position
@ -1970,7 +1970,7 @@ FVTerm::char_data FVTerm::getCoveredCharacter ( const FPoint& pos
}
//----------------------------------------------------------------------
FVTerm::char_data FVTerm::getCoveredCharacter ( int x
FVTerm::charData FVTerm::getCoveredCharacter ( int x
, int y
, FVTerm* obj)
{
@ -1979,7 +1979,7 @@ FVTerm::char_data FVTerm::getCoveredCharacter ( int x
}
//----------------------------------------------------------------------
FVTerm::char_data FVTerm::getOverlappedCharacter ( const FPoint& pos
FVTerm::charData FVTerm::getOverlappedCharacter ( const FPoint& pos
, FVTerm* obj )
{
// Gets the overlapped character for a given position
@ -1987,7 +1987,7 @@ FVTerm::char_data FVTerm::getOverlappedCharacter ( const FPoint& pos
}
//----------------------------------------------------------------------
FVTerm::char_data FVTerm::getOverlappedCharacter ( int x
FVTerm::charData FVTerm::getOverlappedCharacter ( int x
, int y
, FVTerm* obj)
{
@ -2082,7 +2082,7 @@ void FVTerm::init()
term_attribute.attr.byte[0] = 0;
// next_attribute contains the state of the next printed character
std::memcpy (&next_attribute, &term_attribute, sizeof(char_data));
std::memcpy (&next_attribute, &term_attribute, sizeof(charData));
// receive the terminal capabilities
tcap = FTermcap().getTermcapMap();
@ -2127,31 +2127,31 @@ void FVTerm::finish()
}
//----------------------------------------------------------------------
void FVTerm::putAreaLine (char_data* ac, char_data* tc, int length)
void FVTerm::putAreaLine (charData* ac, charData* tc, int length)
{
// copy "length" characters from area to terminal
std::memcpy (tc, ac, sizeof(char_data) * unsigned(length));
std::memcpy (tc, ac, sizeof(charData) * unsigned(length));
}
//----------------------------------------------------------------------
void FVTerm::putAreaCharacter ( int x, int y, FVTerm* obj
, char_data* ac
, char_data* tc )
, charData* ac
, charData* tc )
{
if ( ac->attr.bit.transparent ) // Transparent
{
// Restore one character on vterm
char_data ch;
charData ch;
ch = getCoveredCharacter (x, y, obj);
std::memcpy (tc, &ch, sizeof(char_data));
std::memcpy (tc, &ch, sizeof(charData));
}
else // Mot transparent
{
if ( ac->attr.bit.trans_shadow ) // Transparent shadow
{
// Get covered character + add the current color
char_data ch;
charData ch;
ch = getCoveredCharacter (x, y, obj);
ch.fg_color = ac->fg_color;
ch.bg_color = ac->bg_color;
@ -2166,27 +2166,27 @@ void FVTerm::putAreaCharacter ( int x, int y, FVTerm* obj
|| ch.code == fc::FullBlock )
ch.code = ' ';
std::memcpy (tc, &ch, sizeof(char_data));
std::memcpy (tc, &ch, sizeof(charData));
}
else if ( ac->attr.bit.inherit_bg )
{
// Add the covered background to this character
char_data ch, cc;
std::memcpy (&ch, ac, sizeof(char_data));
charData ch, cc;
std::memcpy (&ch, ac, sizeof(charData));
cc = getCoveredCharacter (x, y, obj);
ch.bg_color = cc.bg_color;
std::memcpy (tc, &ch, sizeof(char_data));
std::memcpy (tc, &ch, sizeof(charData));
}
else // Default
std::memcpy (tc, ac, sizeof(char_data));
std::memcpy (tc, ac, sizeof(charData));
}
}
//----------------------------------------------------------------------
void FVTerm::getAreaCharacter ( int x, int y, term_area* area
, char_data*& cc )
, charData*& cc )
{
char_data* tmp;
charData* tmp;
int area_x = area->offset_left;
int area_y = area->offset_top;
int line_len = area->width + area->right_shadow;
@ -2198,7 +2198,7 @@ void FVTerm::getAreaCharacter ( int x, int y, term_area* area
if ( tmp->attr.bit.trans_shadow ) // transparent shadow
{
// Keep the current vterm character
std::memcpy (&s_ch, cc, sizeof(char_data));
std::memcpy (&s_ch, cc, sizeof(charData));
s_ch.fg_color = tmp->fg_color;
s_ch.bg_color = tmp->bg_color;
s_ch.attr.bit.reverse = false;
@ -2208,7 +2208,7 @@ void FVTerm::getAreaCharacter ( int x, int y, term_area* area
else if ( tmp->attr.bit.inherit_bg )
{
// Add the covered background to this character
std::memcpy (&i_ch, tmp, sizeof(char_data));
std::memcpy (&i_ch, tmp, sizeof(charData));
i_ch.bg_color = cc->bg_color; // last background color
cc = &i_ch;
}
@ -2226,7 +2226,7 @@ bool FVTerm::clearTerm (int fillchar)
char*& cd = TCAP(fc::t_clr_eos);
char*& cb = TCAP(fc::t_clr_eol);
bool ut = FTermcap::background_color_erase;
char_data* next = &next_attribute;
charData* next = &next_attribute;
bool normal = isNormal(next);
appendAttributes(next);
@ -2265,7 +2265,7 @@ bool FVTerm::clearTerm (int fillchar)
}
//----------------------------------------------------------------------
bool FVTerm::clearFullArea (term_area* area, char_data& nc)
bool FVTerm::clearFullArea (term_area* area, charData& nc)
{
// Clear area
int area_size = area->width * area->height;
@ -2296,9 +2296,9 @@ bool FVTerm::clearFullArea (term_area* area, char_data& nc)
}
//----------------------------------------------------------------------
void FVTerm::clearAreaWithShadow (term_area* area, char_data& nc)
void FVTerm::clearAreaWithShadow (term_area* area, charData& nc)
{
char_data t_char = nc;
charData t_char = nc;
int total_width = area->width + area->right_shadow;
t_char.attr.bit.transparent = true;
@ -2327,7 +2327,7 @@ bool FVTerm::canClearToEOL (uInt xmin, uInt y)
term_area*& vt = vterm;
char*& ce = TCAP(fc::t_clr_eol);
char_data* min_char = &vt->text[y * uInt(vt->width) + xmin];
charData* min_char = &vt->text[y * uInt(vt->width) + xmin];
if ( ce && min_char->code == ' ' )
{
@ -2337,7 +2337,7 @@ bool FVTerm::canClearToEOL (uInt xmin, uInt y)
for (uInt x = xmin + 1; x < uInt(vt->width); x++)
{
char_data* ch = &vt->text[y * uInt(vt->width) + x];
charData* ch = &vt->text[y * uInt(vt->width) + x];
if ( *min_char == *ch )
beginning_whitespace++;
@ -2362,7 +2362,7 @@ bool FVTerm::canClearLeadingWS (uInt& xmin, uInt y)
term_area*& vt = vterm;
char*& cb = TCAP(fc::t_clr_bol);
char_data* first_char = &vt->text[y * uInt(vt->width)];
charData* first_char = &vt->text[y * uInt(vt->width)];
if ( cb && first_char->code == ' ' )
{
@ -2372,7 +2372,7 @@ bool FVTerm::canClearLeadingWS (uInt& xmin, uInt y)
for (uInt x = 1; x < uInt(vt->width); x++)
{
char_data* ch = &vt->text[y * uInt(vt->width) + x];
charData* ch = &vt->text[y * uInt(vt->width) + x];
if ( *first_char == *ch )
leading_whitespace++;
@ -2400,7 +2400,7 @@ bool FVTerm::canClearTrailingWS (uInt& xmax, uInt y)
term_area*& vt = vterm;
char*& ce = TCAP(fc::t_clr_eol);
char_data* last_char = &vt->text[(y + 1) * uInt(vt->width) - 1];
charData* last_char = &vt->text[(y + 1) * uInt(vt->width) - 1];
if ( ce && last_char->code == ' ' )
{
@ -2410,7 +2410,7 @@ bool FVTerm::canClearTrailingWS (uInt& xmax, uInt y)
for (uInt x = uInt(vt->width) - 1; x > 0 ; x--)
{
char_data* ch = &vt->text[y * uInt(vt->width) + x];
charData* ch = &vt->text[y * uInt(vt->width) + x];
if ( *last_char == *ch )
trailing_whitespace++;
@ -2436,7 +2436,7 @@ bool FVTerm::skipUnchangedCharacters(uInt& x, uInt xmax, uInt y)
// Skip characters without changes if it is faster than redrawing
term_area*& vt = vterm;
char_data* print_char = &vt->text[y * uInt(vt->width) + x];
charData* print_char = &vt->text[y * uInt(vt->width) + x];
print_char->attr.bit.printed = true;
if ( print_char->attr.bit.no_changes )
@ -2445,7 +2445,7 @@ bool FVTerm::skipUnchangedCharacters(uInt& x, uInt xmax, uInt y)
for (uInt i = x + 1; i <= xmax; i++)
{
char_data* ch = &vt->text[y * uInt(vt->width) + i];
charData* ch = &vt->text[y * uInt(vt->width) + i];
if ( ch->attr.bit.no_changes )
count++;
@ -2470,7 +2470,7 @@ void FVTerm::printRange ( uInt xmin, uInt xmax, uInt y
{
for (uInt x = xmin; x <= xmax; x++)
{
char_data* print_char;
charData* print_char;
term_area*& vt = vterm;
char*& ec = TCAP(fc::t_erase_chars);
char*& rp = TCAP(fc::t_repeat_char);
@ -2510,7 +2510,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
term_area*& vt = vterm;
char*& ec = TCAP(fc::t_erase_chars);
char_data* print_char = &vt->text[y * uInt(vt->width) + x];
charData* print_char = &vt->text[y * uInt(vt->width) + x];
if ( ! ec || print_char->code != ' ' )
return not_used;
@ -2520,7 +2520,7 @@ FVTerm::exit_state FVTerm::eraseCharacters ( uInt& x, uInt xmax, uInt y
for (uInt i = x + 1; i <= xmax; i++)
{
char_data* ch = &vt->text[y * uInt(vt->width) + i];
charData* ch = &vt->text[y * uInt(vt->width) + i];
if ( *print_char == *ch )
whitespace++;
@ -2572,7 +2572,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y)
term_area*& vt = vterm;
char*& rp = TCAP(fc::t_repeat_char);
char_data* print_char = &vt->text[y * uInt(vt->width) + x];
charData* print_char = &vt->text[y * uInt(vt->width) + x];
if ( ! rp )
return not_used;
@ -2581,7 +2581,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y)
for (uInt i = x + 1; i <= xmax; i++)
{
char_data* ch = &vt->text[y * uInt(vt->width) + i];
charData* ch = &vt->text[y * uInt(vt->width) + i];
if ( *print_char == *ch )
repetitions++;
@ -2689,9 +2689,9 @@ void FVTerm::updateTerminalLine (uInt y)
bool draw_leading_ws = false;
bool draw_trailing_ws = false;
char*& ce = TCAP(fc::t_clr_eol);
char_data* first_char = &vt->text[y * uInt(vt->width)];
char_data* last_char = &vt->text[(y + 1) * uInt(vt->width) - 1];
char_data* min_char = &vt->text[y * uInt(vt->width) + xmin];
charData* first_char = &vt->text[y * uInt(vt->width)];
charData* last_char = &vt->text[(y + 1) * uInt(vt->width) - 1];
charData* min_char = &vt->text[y * uInt(vt->width) + xmin];
// Clear rest of line
bool is_eol_clean = canClearToEOL (xmin, y);
@ -2793,7 +2793,7 @@ inline void FVTerm::markAsPrinted (uInt from, uInt to, uInt line)
}
//----------------------------------------------------------------------
inline void FVTerm::newFontChanges (char_data*& next_char)
inline void FVTerm::newFontChanges (charData*& next_char)
{
// NewFont special cases
if ( isNewFont() )
@ -2834,7 +2834,7 @@ inline void FVTerm::newFontChanges (char_data*& next_char)
}
//----------------------------------------------------------------------
inline void FVTerm::charsetChanges (char_data*& next_char)
inline void FVTerm::charsetChanges (charData*& next_char)
{
if ( getEncoding() == fc::UTF8 )
return;
@ -2876,7 +2876,7 @@ inline void FVTerm::charsetChanges (char_data*& next_char)
}
//----------------------------------------------------------------------
inline void FVTerm::appendCharacter (char_data*& next_char)
inline void FVTerm::appendCharacter (charData*& next_char)
{
int term_width = vterm->width - 1;
int term_height = vterm->height - 1;
@ -2891,7 +2891,7 @@ inline void FVTerm::appendCharacter (char_data*& next_char)
}
//----------------------------------------------------------------------
inline void FVTerm::appendChar (char_data*& next_char)
inline void FVTerm::appendChar (charData*& next_char)
{
newFontChanges (next_char);
charsetChanges (next_char);
@ -2901,10 +2901,10 @@ inline void FVTerm::appendChar (char_data*& next_char)
}
//----------------------------------------------------------------------
inline void FVTerm::appendAttributes (char_data*& next_attr)
inline void FVTerm::appendAttributes (charData*& next_attr)
{
char* attr_str;
char_data* term_attr = &term_attribute;
charData* term_attr = &term_attribute;
// generate attribute string for the next character
attr_str = changeAttribute (term_attr, next_attr);
@ -2914,7 +2914,7 @@ inline void FVTerm::appendAttributes (char_data*& next_attr)
}
//----------------------------------------------------------------------
int FVTerm::appendLowerRight (char_data*& screen_char)
int FVTerm::appendLowerRight (charData*& screen_char)
{
char* SA = TCAP(fc::t_enter_am_mode);
char* RA = TCAP(fc::t_exit_am_mode);

View File

@ -2274,7 +2274,7 @@ void FWidget::draw()
void FWidget::drawWindows()
{
// redraw windows
FOptiAttr::char_data default_char;
FOptiAttr::charData default_char;
default_char.code = ' ';
default_char.fg_color = fc::Black;
default_char.bg_color = fc::Black;

View File

@ -121,7 +121,7 @@ void FOptiAttrTest::classNameTest()
//----------------------------------------------------------------------
void FOptiAttrTest::noArgumentTest()
{
FOptiAttr::char_data* ch = new FOptiAttr::char_data();
FOptiAttr::charData* ch = new FOptiAttr::charData();
FOptiAttr oa;
oa.initialize();
@ -133,7 +133,7 @@ void FOptiAttrTest::noArgumentTest()
CPPUNIT_ASSERT ( oa.isNormal(ch) );
// Null test
FOptiAttr::char_data* ch_null = 0;
FOptiAttr::charData* ch_null = 0;
CPPUNIT_ASSERT ( oa.changeAttribute(ch, ch) == 0 );
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(ch, ch_null), C_STR("") );
CPPUNIT_ASSERT_CSTRING ( oa.changeAttribute(ch_null, ch), C_STR("") );
@ -168,8 +168,8 @@ void FOptiAttrTest::fakeReverseTest()
{
FOptiAttr oa;
oa.setDefaultColorSupport(); // ANSI default color
oa.setNoColorVideo (4); // Avoid reverse (4)
oa.setMaxColor (8);
oa.setNoColorVideo (4); // Avoid reverse (4)
oa.set_enter_bold_mode (0);
oa.set_exit_bold_mode (0);
oa.set_enter_dim_mode (0);
@ -207,8 +207,8 @@ void FOptiAttrTest::fakeReverseTest()
oa.set_orig_orig_colors (0);
oa.initialize();
FOptiAttr::char_data* from = new FOptiAttr::char_data();
FOptiAttr::char_data* to = new FOptiAttr::char_data();
FOptiAttr::charData* from = new FOptiAttr::charData();
FOptiAttr::charData* to = new FOptiAttr::charData();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Gray text on blue background
@ -256,8 +256,8 @@ void FOptiAttrTest::ansiTest()
FOptiAttr oa;
oa.setDefaultColorSupport(); // ANSI default color
oa.setNoColorVideo (3); // Avoid standout (1) + underline mode (2)
oa.setMaxColor (8);
oa.setNoColorVideo (3); // Avoid standout (1) + underline mode (2)
oa.set_enter_bold_mode (C_STR(CSI "1m"));
oa.set_exit_bold_mode (C_STR(CSI "0m"));
oa.set_enter_dim_mode (0);
@ -302,8 +302,8 @@ void FOptiAttrTest::ansiTest()
oa.set_orig_orig_colors (0);
oa.initialize();
FOptiAttr::char_data* from = new FOptiAttr::char_data();
FOptiAttr::char_data* to = new FOptiAttr::char_data();
FOptiAttr::charData* from = new FOptiAttr::charData();
FOptiAttr::charData* to = new FOptiAttr::charData();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -723,8 +723,8 @@ void FOptiAttrTest::vt100Test()
FOptiAttr oa;
oa.unsetDefaultColorSupport(); // No ANSI default color
oa.setNoColorVideo (0);
oa.setMaxColor (1);
oa.setNoColorVideo (0);
oa.set_enter_bold_mode (C_STR(CSI "1m$<2>"));
oa.set_exit_bold_mode (C_STR(CSI "0m$<2>"));
oa.set_enter_dim_mode (0);
@ -767,8 +767,8 @@ void FOptiAttrTest::vt100Test()
oa.set_orig_orig_colors (0);
oa.initialize();
FOptiAttr::char_data* from = new FOptiAttr::char_data();
FOptiAttr::char_data* to = new FOptiAttr::char_data();
FOptiAttr::charData* from = new FOptiAttr::charData();
FOptiAttr::charData* to = new FOptiAttr::charData();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -1185,8 +1185,8 @@ void FOptiAttrTest::xtermTest()
FOptiAttr oa;
oa.setDefaultColorSupport(); // ANSI default color
oa.setNoColorVideo (0);
oa.setMaxColor (256);
oa.setNoColorVideo (0);
oa.set_enter_bold_mode (C_STR(CSI "1m"));
oa.set_exit_bold_mode (C_STR(CSI "22m"));
oa.set_enter_dim_mode (C_STR(CSI "2m"));
@ -1239,8 +1239,8 @@ void FOptiAttrTest::xtermTest()
oa.set_orig_orig_colors (0);
oa.initialize();
FOptiAttr::char_data* from = new FOptiAttr::char_data();
FOptiAttr::char_data* to = new FOptiAttr::char_data();
FOptiAttr::charData* from = new FOptiAttr::charData();
FOptiAttr::charData* to = new FOptiAttr::charData();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -1666,8 +1666,8 @@ void FOptiAttrTest::rxvtTest()
FOptiAttr oa;
oa.setDefaultColorSupport(); // ANSI default color
oa.setNoColorVideo (0);
oa.setMaxColor (8);
oa.setNoColorVideo (0);
oa.set_enter_bold_mode (C_STR(CSI "1m"));
oa.set_exit_bold_mode (C_STR(CSI "22m"));
oa.set_enter_dim_mode (0);
@ -1710,8 +1710,8 @@ void FOptiAttrTest::rxvtTest()
oa.set_orig_orig_colors (0);
oa.initialize();
FOptiAttr::char_data* from = new FOptiAttr::char_data();
FOptiAttr::char_data* to = new FOptiAttr::char_data();
FOptiAttr::charData* from = new FOptiAttr::charData();
FOptiAttr::charData* to = new FOptiAttr::charData();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -2138,8 +2138,8 @@ void FOptiAttrTest::linuxTest()
FOptiAttr oa;
oa.setDefaultColorSupport(); // ANSI default color
oa.setNoColorVideo (18);
oa.setMaxColor (16);
oa.setNoColorVideo (18);
oa.set_enter_bold_mode (C_STR(CSI "1m"));
oa.set_exit_bold_mode (C_STR(CSI "22m"));
oa.set_enter_dim_mode (0);
@ -2183,8 +2183,8 @@ void FOptiAttrTest::linuxTest()
oa.set_orig_orig_colors (C_STR(OSC "R"));
oa.initialize();
FOptiAttr::char_data* from = new FOptiAttr::char_data();
FOptiAttr::char_data* to = new FOptiAttr::char_data();
FOptiAttr::charData* from = new FOptiAttr::charData();
FOptiAttr::charData* to = new FOptiAttr::charData();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -2613,8 +2613,8 @@ void FOptiAttrTest::puttyTest()
FOptiAttr oa;
oa.unsetDefaultColorSupport(); // No ANSI default color
oa.setNoColorVideo (0);
oa.setMaxColor (256);
oa.setNoColorVideo (0);
oa.set_enter_bold_mode (C_STR(CSI "1m"));
oa.set_exit_bold_mode (C_STR(CSI "22m"));
oa.set_enter_dim_mode (C_STR(CSI "2m"));
@ -2667,8 +2667,8 @@ void FOptiAttrTest::puttyTest()
oa.initialize();
FOptiAttr::char_data* from = new FOptiAttr::char_data();
FOptiAttr::char_data* to = new FOptiAttr::char_data();
FOptiAttr::charData* from = new FOptiAttr::charData();
FOptiAttr::charData* to = new FOptiAttr::charData();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -3096,8 +3096,8 @@ void FOptiAttrTest::teratermTest()
FOptiAttr oa;
oa.unsetDefaultColorSupport(); // No ANSI default color
oa.setNoColorVideo (41); // Avoid standout (1) + blink (8) + bold (32)
oa.setMaxColor (16);
oa.setNoColorVideo (41); // Avoid standout (1) + blink (8) + bold (32)
oa.set_enter_bold_mode (C_STR(CSI "1m"));
oa.set_exit_bold_mode (C_STR(CSI "22m"));
oa.set_enter_dim_mode (0);
@ -3141,8 +3141,8 @@ void FOptiAttrTest::teratermTest()
oa.initialize();
FOptiAttr::char_data* from = new FOptiAttr::char_data();
FOptiAttr::char_data* to = new FOptiAttr::char_data();
FOptiAttr::charData* from = new FOptiAttr::charData();
FOptiAttr::charData* to = new FOptiAttr::charData();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -3563,8 +3563,8 @@ void FOptiAttrTest::ibmColorTest()
FOptiAttr oa;
oa.unsetDefaultColorSupport(); // No ANSI default color
oa.setNoColorVideo (3); // Avoid standout (1) + underline mode (2)
oa.setMaxColor (8);
oa.setNoColorVideo (3); // Avoid standout (1) + underline mode (2)
oa.set_enter_bold_mode (0);
oa.set_exit_bold_mode (0);
oa.set_enter_dim_mode (0);
@ -3617,8 +3617,8 @@ void FOptiAttrTest::ibmColorTest()
oa.initialize();
FOptiAttr::char_data* from = new FOptiAttr::char_data();
FOptiAttr::char_data* to = new FOptiAttr::char_data();
FOptiAttr::charData* from = new FOptiAttr::charData();
FOptiAttr::charData* to = new FOptiAttr::charData();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold
@ -4001,54 +4001,66 @@ void FOptiAttrTest::wyse50Test()
// Simulate an Wyse-50 terminal
FOptiAttr oa;
oa.unsetDefaultColorSupport(); // No ANSI default color
oa.setNoColorVideo (0);
oa.setMaxColor (1);
oa.set_enter_bold_mode (0);
oa.set_exit_bold_mode (C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD"));
oa.set_enter_dim_mode (C_STR(ESC "Gp"));
oa.set_exit_dim_mode (C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD"));
oa.set_enter_italics_mode (0);
oa.set_exit_italics_mode (0);
oa.set_enter_underline_mode (C_STR(ESC "G8"));
oa.set_exit_underline_mode (C_STR(ESC "G0"));
oa.set_enter_blink_mode (C_STR(ESC "G2"));
oa.set_exit_blink_mode (C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD"));
oa.set_enter_reverse_mode (C_STR(ESC "G2"));
oa.set_exit_reverse_mode (C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD"));
oa.set_enter_standout_mode (C_STR(ESC "Gt"));
oa.set_exit_standout_mode (C_STR(ESC "G0"));
oa.set_enter_secure_mode (C_STR(ESC "G1"));
oa.set_exit_secure_mode (C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD"));
oa.set_enter_protected_mode (C_STR(ESC ")"));
oa.set_exit_protected_mode (C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD"));
oa.set_enter_crossed_out_mode (0);
oa.set_exit_crossed_out_mode (C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD"));
oa.set_enter_dbl_underline_mode (0);
oa.set_exit_dbl_underline_mode (0);
oa.set_set_attributes (C_STR("%?%p8%t\E)%e\E(%;"
"%?%p9%t\EcE%e\EcD%;\EG%'0'"
"%?%p2%t%{8}%|%;"
"%?%p1%p3%|%p6%|%t%{4}%|%;"
"%?%p4%t%{2}%|%;"
"%?%p1%p5%|%t%'@'%|%;"
"%?%p7%t%{1}%|%;%c"));
oa.set_exit_attribute_mode (C_STR(ESC "(" ESC "H\003" ESC "G0" ESC "cD"));
oa.set_enter_alt_charset_mode (C_STR(ESC "cE"));
oa.set_exit_alt_charset_mode (C_STR(ESC "cD"));
oa.set_enter_pc_charset_mode (0);
oa.set_exit_pc_charset_mode (0);
oa.set_a_foreground_color (0);
oa.set_a_background_color (0);
oa.set_foreground_color (0);
oa.set_background_color (0);
oa.set_term_color_pair (0);
oa.set_orig_pair (0);
oa.set_orig_orig_colors (0);
oa.initialize();
FOptiAttr::termEnv optiattr_env =
{
false, // No ANSI default color
1, // Max color
0, // No color video
0, // Enter bold
C_STR(ESC "(" ESC "H\003"
ESC "G0" ESC "cD"), // Exit bold
C_STR(ESC "Gp"), // Enter dim
C_STR(ESC "(" ESC "H\003"
ESC "G0" ESC "cD"), // Exit dim
0, // Enter italics
0, // Exit italics
C_STR(ESC "G8"), // Enter underline
C_STR(ESC "G0"), // Exit underline
C_STR(ESC "G2"), // Enter blink
C_STR(ESC "(" ESC "H\003"
ESC "G0" ESC "cD"), // Exit blink
C_STR(ESC "G2"), // Enter reverse
C_STR(ESC "(" ESC "H\003"
ESC "G0" ESC "cD"), // Exit reverse
C_STR(ESC "Gt"), // Enter standout
C_STR(ESC "G0"), // Exit standout
C_STR(ESC "G1"), // Enter secure
C_STR(ESC "(" ESC "H\003"
ESC "G0" ESC "cD"), // Exit secure
C_STR(ESC ")"), // Enter protected
C_STR(ESC "(" ESC "H\003"
ESC "G0" ESC "cD"), // Exit protected
0, // Enter crossed out
C_STR(ESC "(" ESC "H\003"
ESC "G0" ESC "cD"), // Exit crossed out
0, // Enter double underline
0, // Exit double underline
C_STR("%?%p8%t\E)%e\E(%;"
"%?%p9%t\EcE%e\EcD%;\EG%'0'"
"%?%p2%t%{8}%|%;"
"%?%p1%p3%|%p6%|%t%{4}%|%;"
"%?%p4%t%{2}%|%;"
"%?%p1%p5%|%t%'@'%|%;"
"%?%p7%t%{1}%|%;%c"), // Set attributes
C_STR(ESC "(" ESC "H\003"
ESC "G0" ESC "cD"), // Exit attribute
C_STR(ESC "cE"), // Enter alt charset
C_STR(ESC "cD"), // Exit alt charset
0, // Enter pc charset
0, // Exit pc charset
0, // Ansi foreground color
0, // Ansi background color
0, // Foreground color
0, // Background color
0, // Term color pair
0, // Orig pair
0 // Orig orig colors
};
FOptiAttr::char_data* from = new FOptiAttr::char_data();
FOptiAttr::char_data* to = new FOptiAttr::char_data();
oa.setTermEnvironment(optiattr_env);
FOptiAttr::charData* from = new FOptiAttr::charData();
FOptiAttr::charData* to = new FOptiAttr::charData();
CPPUNIT_ASSERT ( oa.changeAttribute(from, to) == 0 );
// Default color + bold