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> 2017-06-17 Markus Gans <guru.mail@muenster.de>
* Added special console options for FreeBSD, NetBSD and OpenBSD * 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 * * 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 * * The Final Cut is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License * * 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 for (int y = 0; y < y_end; y++) // line loop
{ {
char_data* cc; // canvas character charData* cc; // canvas character
char_data* wc; // window character charData* wc; // window character
cc = &canvas->text[y * x_end]; cc = &canvas->text[y * x_end];
wc = &print_area->text[(ay + y) * w_line_len + ax]; 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 ) if ( short(print_area->changes[ay + y].xmin) > ax )
print_area->changes[ay + y].xmin = uInt(ax); print_area->changes[ay + y].xmin = uInt(ax);

View File

@ -72,7 +72,7 @@
class FOptiAttr class FOptiAttr
{ {
public: public:
// Typedef // Typedefs
typedef struct typedef struct
{ {
int code; // character code int code; // character code
@ -109,7 +109,49 @@ class FOptiAttr
uInt8 byte[3]; uInt8 byte[3];
} attr; } 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 // Constructor
explicit FOptiAttr(); explicit FOptiAttr();
@ -118,13 +160,14 @@ class FOptiAttr
~FOptiAttr(); ~FOptiAttr();
// Friend operator functions // Friend operator functions
friend bool operator == (const char_data&, const char_data&); friend bool operator == (const charData&, const charData&);
friend bool operator != (const char_data&, const char_data&); friend bool operator != (const charData&, const charData&);
// Accessors // Accessors
const char* getClassName() const; const char* getClassName() const;
// Mutators // Mutators
void setTermEnvironment (termEnv&);
void setMaxColor (const int&); void setMaxColor (const int&);
void setNoColorVideo (int); void setNoColorVideo (int);
void setDefaultColorSupport(); void setDefaultColorSupport();
@ -166,17 +209,15 @@ class FOptiAttr
void set_orig_orig_colors (char[]); void set_orig_orig_colors (char[]);
// Inquiry // Inquiry
static bool isNormal (char_data*&); static bool isNormal (charData*&);
// Methods // Methods
void initialize(); void initialize();
static short vga2ansi (register short); static short vga2ansi (register short);
char* changeAttribute (char_data*&, char_data*&); char* changeAttribute (charData*&, charData*&);
private: private:
// Typedefs and Enumerations // Typedefs and Enumerations
typedef unsigned char uChar;
typedef struct typedef struct
{ {
char* cap; char* cap;
@ -222,62 +263,62 @@ class FOptiAttr
FOptiAttr& operator = (const FOptiAttr&); FOptiAttr& operator = (const FOptiAttr&);
// Mutators // Mutators
bool setTermBold (char_data*&); bool setTermBold (charData*&);
bool unsetTermBold (char_data*&); bool unsetTermBold (charData*&);
bool setTermDim (char_data*&); bool setTermDim (charData*&);
bool unsetTermDim (char_data*&); bool unsetTermDim (charData*&);
bool setTermItalic (char_data*&); bool setTermItalic (charData*&);
bool unsetTermItalic (char_data*&); bool unsetTermItalic (charData*&);
bool setTermUnderline (char_data*&); bool setTermUnderline (charData*&);
bool unsetTermUnderline (char_data*&); bool unsetTermUnderline (charData*&);
bool setTermBlink (char_data*&); bool setTermBlink (charData*&);
bool unsetTermBlink (char_data*&); bool unsetTermBlink (charData*&);
bool setTermReverse (char_data*&); bool setTermReverse (charData*&);
bool unsetTermReverse (char_data*&); bool unsetTermReverse (charData*&);
bool setTermStandout (char_data*&); bool setTermStandout (charData*&);
bool unsetTermStandout (char_data*&); bool unsetTermStandout (charData*&);
bool setTermInvisible (char_data*&); bool setTermInvisible (charData*&);
bool unsetTermInvisible (char_data*&); bool unsetTermInvisible (charData*&);
bool setTermProtected (char_data*&); bool setTermProtected (charData*&);
bool unsetTermProtected (char_data*&); bool unsetTermProtected (charData*&);
bool setTermCrossedOut (char_data*&); bool setTermCrossedOut (charData*&);
bool unsetTermCrossedOut (char_data*&); bool unsetTermCrossedOut (charData*&);
bool setTermDoubleUnderline (char_data*&); bool setTermDoubleUnderline (charData*&);
bool unsetTermDoubleUnderline (char_data*&); bool unsetTermDoubleUnderline (charData*&);
bool setTermAttributes ( char_data*& bool setTermAttributes ( charData*&
, bool, bool, bool , bool, bool, bool
, bool, bool, bool , bool, bool, bool
, bool, bool, bool ); , bool, bool, bool );
bool unsetTermAttributes (char_data*&); bool unsetTermAttributes (charData*&);
bool setTermAltCharset (char_data*&); bool setTermAltCharset (charData*&);
bool unsetTermAltCharset (char_data*&); bool unsetTermAltCharset (charData*&);
bool setTermPCcharset (char_data*&); bool setTermPCcharset (charData*&);
bool unsetTermPCcharset (char_data*&); bool unsetTermPCcharset (charData*&);
bool setTermDefaultColor (char_data*&); bool setTermDefaultColor (charData*&);
void setAttributesOn (char_data*&); void setAttributesOn (charData*&);
void setAttributesOff (char_data*&); void setAttributesOff (charData*&);
// Inquiries // Inquiries
static bool hasColor (char_data*&); static bool hasColor (charData*&);
static bool hasAttribute (char_data*&); static bool hasAttribute (charData*&);
static bool hasNoAttribute (char_data*&); static bool hasNoAttribute (charData*&);
// Methods // Methods
bool colorChange (char_data*&, char_data*&); bool colorChange (charData*&, charData*&);
void resetColor (char_data*&); void resetColor (charData*&);
void prevent_no_color_video_attributes (char_data*&, bool = false); void prevent_no_color_video_attributes (charData*&, bool = false);
void deactivateAttributes (char_data*&, char_data*&); void deactivateAttributes (charData*&, charData*&);
void changeAttributeSGR (char_data*&, char_data*&); void changeAttributeSGR (charData*&, charData*&);
void changeAttributeSeparately (char_data*&, char_data*&); void changeAttributeSeparately (charData*&, charData*&);
void change_color (char_data*&, char_data*&); void change_color (charData*&, charData*&);
void change_to_default_color (char_data*&, char_data*&, short&, short&); void change_to_default_color (charData*&, charData*&, short&, short&);
void change_current_color (char_data*&, short, short); void change_current_color (charData*&, short, short);
void resetAttribute (char_data*&); void resetAttribute (charData*&);
void reset (char_data*&); void reset (charData*&);
bool caused_reset_attributes (char[], uChar = all_tests); bool caused_reset_attributes (char[], uChar = all_tests);
bool hasCharsetEquivalence(); bool hasCharsetEquivalence();
void detectSwitchOn (char_data*&, char_data*&); void detectSwitchOn (charData*&, charData*&);
void detectSwitchOff (char_data*&, char_data*&); void detectSwitchOff (charData*&, charData*&);
bool switchOn(); bool switchOn();
bool switchOff(); bool switchOff();
bool append_sequence (char[]); bool append_sequence (char[]);
@ -319,9 +360,9 @@ class FOptiAttr
capability F_orig_pair; capability F_orig_pair;
capability F_orig_colors; capability F_orig_colors;
char_data on; charData on;
char_data off; charData off;
char_data reset_byte_mask; charData reset_byte_mask;
int max_color; int max_color;
int attr_without_color; int attr_without_color;
@ -337,8 +378,8 @@ class FOptiAttr
// FOptiAttr inline functions // FOptiAttr inline functions
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool operator == ( const FOptiAttr::char_data& lhs, inline bool operator == ( const FOptiAttr::charData& lhs,
const FOptiAttr::char_data& rhs ) const FOptiAttr::charData& rhs )
{ {
return lhs.code == rhs.code return lhs.code == rhs.code
&& lhs.fg_color == rhs.fg_color && 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, inline bool operator != ( const FOptiAttr::charData& lhs,
const FOptiAttr::char_data& rhs ) const FOptiAttr::charData& rhs )
{ return ! ( lhs == rhs ); } { return ! ( lhs == rhs ); }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

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

View File

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

View File

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

View File

@ -1271,7 +1271,7 @@ void FListView::draw()
//---------------------------------------------------------------------- //----------------------------------------------------------------------
void FListView::drawColumnLabels() void FListView::drawColumnLabels()
{ {
std::vector<char_data>::const_iterator first, last; std::vector<charData>::const_iterator first, last;
headerItems::const_iterator iter; headerItems::const_iterator iter;
if ( header.empty() if ( header.empty()
@ -1297,7 +1297,7 @@ void FListView::drawColumnLabels()
++iter; ++iter;
} }
std::vector<char_data> h; std::vector<charData> h;
h << headerline; h << headerline;
first = h.begin() + xoffset; first = h.begin() + xoffset;
@ -1314,7 +1314,7 @@ void FListView::drawColumnLabels()
} }
setPrintPos (2, 1); 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 // 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[]) 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); 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); const bool next_has_color = hasColor(next);
fake_reverse = false; fake_reverse = false;
@ -581,7 +630,7 @@ char* FOptiAttr::changeAttribute (char_data*& term, char_data*& next)
// private methods of FOptiAttr // private methods of FOptiAttr
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FOptiAttr::setTermBold (char_data*& term) inline bool FOptiAttr::setTermBold (charData*& term)
{ {
if ( ! term ) if ( ! term )
return false; 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) // 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 ) if ( ! term )
return false; 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) // 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 // 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 // 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 p1, bool p2, bool p3
, bool p4, bool p5, bool p6 , bool p4, bool p5, bool p6
, bool p7, bool p8, bool p9 ) , 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( ! term )
return false; 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 ) if ( on.attr.bit.alt_charset )
setTermAltCharset(term); 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 ) if ( off.attr.bit.pc_charset )
unsetTermPCcharset(term); 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 ) if ( attr && attr->fg_color < 0 && attr->bg_color < 0 )
return false; 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 ) 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); return ! hasAttribute(attr);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FOptiAttr::colorChange (char_data*& term, char_data*& next) inline bool FOptiAttr::colorChange (charData*& term, charData*& next)
{ {
if ( term && 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 ) 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 ) , bool next_has_color )
{ {
// Ignore attributes which can not combined with a 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 inline void FOptiAttr::deactivateAttributes ( charData*& term
, char_data*& next ) , charData*& next )
{ {
if ( hasAttribute(term) ) if ( hasAttribute(term) )
{ {
@ -1323,8 +1372,8 @@ inline void FOptiAttr::deactivateAttributes ( char_data*& term
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FOptiAttr::changeAttributeSGR ( char_data*& term inline void FOptiAttr::changeAttributeSGR ( charData*& term
, char_data*& next ) , charData*& next )
{ {
bool pc_charset_usable = true; bool pc_charset_usable = true;
@ -1373,8 +1422,8 @@ inline void FOptiAttr::changeAttributeSGR ( char_data*& term
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline void FOptiAttr::changeAttributeSeparately ( char_data*& term inline void FOptiAttr::changeAttributeSeparately ( charData*& term
, char_data*& next ) , charData*& next )
{ {
setAttributesOff(term); 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; 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 inline void FOptiAttr::change_to_default_color ( charData*& term
, char_data*& next , charData*& next
, short& fg, short& bg ) , short& fg, short& bg )
{ {
if ( ansi_default_color ) 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 ) , short fg, short bg )
{ {
char* color_str; 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 ) 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 ) 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) ) if ( ! (term && next) )
return; 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) ) if ( ! (term && next) )
return; return;
@ -1629,14 +1678,14 @@ inline void FOptiAttr::detectSwitchOff (char_data*& term, char_data*& next)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FOptiAttr::switchOn() inline bool FOptiAttr::switchOn()
{ {
char_data* on_ptr = &on; charData* on_ptr = &on;
return hasAttribute(on_ptr); return hasAttribute(on_ptr);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline bool FOptiAttr::switchOff() inline bool FOptiAttr::switchOff()
{ {
char_data* off_ptr = &off; charData* off_ptr = &off;
return hasAttribute(off_ptr); return hasAttribute(off_ptr);
} }

View File

@ -682,13 +682,13 @@ void FScrollView::copy2area()
for (int y = 0; y < y_end; y++) // line loop for (int y = 0; y < y_end; y++) // line loop
{ {
char_data* vc; // viewport character charData* vc; // viewport character
char_data* ac; // area character charData* ac; // area character
int v_line_len = viewport->width; int v_line_len = viewport->width;
int a_line_len = print_area->width + print_area->right_shadow; int a_line_len = print_area->width + print_area->right_shadow;
vc = &viewport->text[(dy + y) * v_line_len + dx]; vc = &viewport->text[(dy + y) * v_line_len + dx];
ac = &print_area->text[(ay + y) * a_line_len + ax]; 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 ) if ( short(print_area->changes[ay + y].xmin) > ax )
print_area->changes[ay + y].xmin = uInt(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); return opti_attr->isNormal(ch);
} }
@ -1027,8 +1027,8 @@ void FTerm::initScreenSettings()
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
char* FTerm::changeAttribute ( char_data*& term_attr char* FTerm::changeAttribute ( charData*& term_attr
, char_data*& next_attr ) , charData*& next_attr )
{ {
return opti_attr->changeAttribute (term_attr, next_attr); return opti_attr->changeAttribute (term_attr, next_attr);
} }
@ -1551,48 +1551,49 @@ void FTerm::init_OptiAttr()
{ {
// Setting video attribute optimization // Setting video attribute optimization
opti_attr->setNoColorVideo (int(FTermcap::attr_without_color)); FOptiAttr::termEnv optiattr_env =
opti_attr->set_enter_bold_mode (TCAP(fc::t_enter_bold_mode)); {
opti_attr->set_exit_bold_mode (TCAP(fc::t_exit_bold_mode)); FTermcap::ansi_default_color,
opti_attr->set_enter_dim_mode (TCAP(fc::t_enter_dim_mode)); FTermcap::max_color,
opti_attr->set_exit_dim_mode (TCAP(fc::t_exit_dim_mode)); FTermcap::attr_without_color,
opti_attr->set_enter_italics_mode (TCAP(fc::t_enter_italics_mode)); TCAP(fc::t_enter_bold_mode),
opti_attr->set_exit_italics_mode (TCAP(fc::t_exit_italics_mode)); TCAP(fc::t_exit_bold_mode),
opti_attr->set_enter_underline_mode (TCAP(fc::t_enter_underline_mode)); TCAP(fc::t_enter_dim_mode),
opti_attr->set_exit_underline_mode (TCAP(fc::t_exit_underline_mode)); TCAP(fc::t_exit_dim_mode),
opti_attr->set_enter_blink_mode (TCAP(fc::t_enter_blink_mode)); TCAP(fc::t_enter_italics_mode),
opti_attr->set_exit_blink_mode (TCAP(fc::t_exit_blink_mode)); TCAP(fc::t_exit_italics_mode),
opti_attr->set_enter_reverse_mode (TCAP(fc::t_enter_reverse_mode)); TCAP(fc::t_enter_underline_mode),
opti_attr->set_exit_reverse_mode (TCAP(fc::t_exit_reverse_mode)); TCAP(fc::t_exit_underline_mode),
opti_attr->set_enter_standout_mode (TCAP(fc::t_enter_standout_mode)); TCAP(fc::t_enter_blink_mode),
opti_attr->set_exit_standout_mode (TCAP(fc::t_exit_standout_mode)); TCAP(fc::t_exit_blink_mode),
opti_attr->set_enter_secure_mode (TCAP(fc::t_enter_secure_mode)); TCAP(fc::t_enter_reverse_mode),
opti_attr->set_exit_secure_mode (TCAP(fc::t_exit_secure_mode)); TCAP(fc::t_exit_reverse_mode),
opti_attr->set_enter_protected_mode (TCAP(fc::t_enter_protected_mode)); TCAP(fc::t_enter_standout_mode),
opti_attr->set_exit_protected_mode (TCAP(fc::t_exit_protected_mode)); TCAP(fc::t_exit_standout_mode),
opti_attr->set_enter_crossed_out_mode (TCAP(fc::t_enter_crossed_out_mode)); TCAP(fc::t_enter_secure_mode),
opti_attr->set_exit_crossed_out_mode (TCAP(fc::t_exit_crossed_out_mode)); TCAP(fc::t_exit_secure_mode),
opti_attr->set_enter_dbl_underline_mode (TCAP(fc::t_enter_dbl_underline_mode)); TCAP(fc::t_enter_protected_mode),
opti_attr->set_exit_dbl_underline_mode (TCAP(fc::t_exit_dbl_underline_mode)); TCAP(fc::t_exit_protected_mode),
opti_attr->set_set_attributes (TCAP(fc::t_set_attributes)); TCAP(fc::t_enter_crossed_out_mode),
opti_attr->set_exit_attribute_mode (TCAP(fc::t_exit_attribute_mode)); TCAP(fc::t_exit_crossed_out_mode),
opti_attr->set_enter_alt_charset_mode (TCAP(fc::t_enter_alt_charset_mode)); TCAP(fc::t_enter_dbl_underline_mode),
opti_attr->set_exit_alt_charset_mode (TCAP(fc::t_exit_alt_charset_mode)); TCAP(fc::t_exit_dbl_underline_mode),
opti_attr->set_enter_pc_charset_mode (TCAP(fc::t_enter_pc_charset_mode)); TCAP(fc::t_set_attributes),
opti_attr->set_exit_pc_charset_mode (TCAP(fc::t_exit_pc_charset_mode)); TCAP(fc::t_exit_attribute_mode),
opti_attr->set_a_foreground_color (TCAP(fc::t_set_a_foreground)); TCAP(fc::t_enter_alt_charset_mode),
opti_attr->set_a_background_color (TCAP(fc::t_set_a_background)); TCAP(fc::t_enter_alt_charset_mode),
opti_attr->set_foreground_color (TCAP(fc::t_set_foreground)); TCAP(fc::t_enter_pc_charset_mode),
opti_attr->set_background_color (TCAP(fc::t_set_background)); TCAP(fc::t_exit_pc_charset_mode),
opti_attr->set_term_color_pair (TCAP(fc::t_set_color_pair)); TCAP(fc::t_set_a_foreground),
opti_attr->set_orig_pair (TCAP(fc::t_orig_pair)); TCAP(fc::t_set_a_background),
opti_attr->set_orig_orig_colors (TCAP(fc::t_orig_colors)); TCAP(fc::t_set_foreground),
opti_attr->setMaxColor (FTermcap::max_color); 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->setTermEnvironment(optiattr_env);
opti_attr->setDefaultColorSupport();
opti_attr->initialize();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

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

View File

@ -45,10 +45,10 @@ FVTerm::term_area* FVTerm::vdesktop = 0;
FVTerm::term_area* FVTerm::active_area = 0; FVTerm::term_area* FVTerm::active_area = 0;
FVTerm::termcap_map* FVTerm::tcap = 0; FVTerm::termcap_map* FVTerm::tcap = 0;
FTermcap::tcap_map* FTermcap::tcap = 0; FTermcap::tcap_map* FTermcap::tcap = 0;
FVTerm::char_data FVTerm::term_attribute; FVTerm::charData FVTerm::term_attribute;
FVTerm::char_data FVTerm::next_attribute; FVTerm::charData FVTerm::next_attribute;
FVTerm::char_data FVTerm::s_ch; FVTerm::charData FVTerm::s_ch;
FVTerm::char_data FVTerm::i_ch; FVTerm::charData FVTerm::i_ch;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -425,7 +425,7 @@ int FVTerm::print (term_area* area, const FString& s)
{ {
assert ( ! s.isNull() ); assert ( ! s.isNull() );
const wchar_t* p; const wchar_t* p;
std::vector<char_data> term_string; std::vector<charData> term_string;
if ( ! area ) if ( ! area )
return -1; return -1;
@ -436,7 +436,7 @@ int FVTerm::print (term_area* area, const FString& s)
{ {
while ( *p ) while ( *p )
{ {
char_data nc; // next character charData nc; // next character
nc.code = *p; nc.code = *p;
nc.fg_color = next_attribute.fg_color; nc.fg_color = next_attribute.fg_color;
nc.bg_color = next_attribute.bg_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() ) if ( term_string.empty() )
return 0; 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; register int len = 0;
std::vector<char_data>::const_iterator iter; std::vector<charData>::const_iterator iter;
iter = term_string.begin(); iter = term_string.begin();
uInt tabstop = uInt(getTabstop()); uInt tabstop = uInt(getTabstop());
@ -517,7 +517,7 @@ int FVTerm::print (term_area* area, const std::vector<char_data>& term_string)
default: default:
{ {
char_data nc = *iter; // next character charData nc = *iter; // next character
print (area, nc); print (area, nc);
printable_character = true; printable_character = true;
} }
@ -552,7 +552,7 @@ int FVTerm::print (register int c)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
int FVTerm::print (term_area* area, register int c) int FVTerm::print (term_area* area, register int c)
{ {
char_data nc; // next character charData nc; // next character
if ( ! area ) if ( ! area )
return -1; 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(); 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; int width, height, rsh, bsh, ax, ay;
if ( ! area ) if ( ! area )
@ -604,7 +604,7 @@ int FVTerm::print (term_area* area, char_data& term_char)
&& ax < area->width + area->right_shadow && ax < area->width + area->right_shadow
&& ay < area->height + area->bottom_shadow ) && ay < area->height + area->bottom_shadow )
{ {
char_data* ac; // area character charData* ac; // area character
int line_len = area->width + area->right_shadow; int line_len = area->width + area->right_shadow;
ac = &area->text[ay * line_len + ax]; ac = &area->text[ay * line_len + ax];
@ -797,7 +797,7 @@ inline void FVTerm::setTextToDefault ( term_area* area
, int width , int width
, int height ) , int height )
{ {
char_data default_char; charData default_char;
line_changes unchanged; line_changes unchanged;
int size = width * height; int size = width * height;
@ -831,7 +831,7 @@ inline bool FVTerm::reallocateTextArea ( term_area* area
try try
{ {
area->changes = new line_changes[height]; area->changes = new line_changes[height];
area->text = new char_data[size]; area->text = new charData[size];
} }
catch (const std::bad_alloc& ex) catch (const std::bad_alloc& ex)
{ {
@ -850,7 +850,7 @@ inline bool FVTerm::reallocateTextArea (term_area* area, int size)
try try
{ {
area->text = new char_data[size]; area->text = new charData[size];
} }
catch (const std::bad_alloc& ex) 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) void FVTerm::restoreVTerm (int x, int y, int w, int h)
{ {
char_data* tc; // terminal character charData* tc; // terminal character
char_data sc; // shown character charData sc; // shown character
x--; x--;
y--; y--;
@ -933,7 +933,7 @@ void FVTerm::restoreVTerm (int x, int y, int w, int h)
int xpos = x + tx; int xpos = x + tx;
tc = &vterm->text[ypos * vterm->width + xpos]; tc = &vterm->text[ypos * vterm->width + xpos];
sc = generateCharacter(xpos, ypos); sc = generateCharacter(xpos, ypos);
std::memcpy (tc, &sc, sizeof(char_data)); std::memcpy (tc, &sc, sizeof(charData));
} }
if ( short(vterm->changes[ypos].xmin) > x ) 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) ) if ( found && geometry.contains(x, y) )
{ {
char_data* tmp; charData* tmp;
int line_len = win->width + win->right_shadow; int line_len = win->width + win->right_shadow;
tmp = &win->text[(y - win_y) * line_len + (x - win_x)]; 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& rsh = area->right_shadow;
int line_len = aw + rsh; int line_len = aw + rsh;
// Area character // Area character
char_data* ac = &area->text[y * line_len + x]; charData* ac = &area->text[y * line_len + x];
// Terminal character // Terminal character
char_data* tc = &vterm->text[ty * vterm->width + tx]; charData* tc = &vterm->text[ty * vterm->width + tx];
// New character // New character
char_data nc; charData nc;
std::memcpy (&nc, ac, sizeof(char_data)); std::memcpy (&nc, ac, sizeof(charData));
// Overlapped character // 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.fg_color = oc.fg_color;
nc.bg_color = oc.bg_color; nc.bg_color = oc.bg_color;
nc.attr.bit.reverse = false; nc.attr.bit.reverse = false;
@ -1051,7 +1051,7 @@ void FVTerm::updateOverlappedColor ( term_area* area
nc.code = ' '; nc.code = ' ';
nc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == nc); 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 // Restore one character on vterm
// Terminal character // Terminal character
char_data* tc = &vterm->text[ty * vterm->width + tx]; charData* tc = &vterm->text[ty * vterm->width + tx];
// Overlapped character // 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); 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& rsh = area->right_shadow;
int line_len = aw + rsh; int line_len = aw + rsh;
// Area character // Area character
char_data* ac = &area->text[y * line_len + x]; charData* ac = &area->text[y * line_len + x];
// Terminal character // Terminal character
char_data* tc = &vterm->text[ty * vterm->width + tx]; charData* tc = &vterm->text[ty * vterm->width + tx];
// Overlapped character // 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.fg_color = ac->fg_color;
oc.bg_color = ac->bg_color; oc.bg_color = ac->bg_color;
oc.attr.bit.reverse = false; oc.attr.bit.reverse = false;
@ -1096,7 +1096,7 @@ void FVTerm::updateShadedCharacter ( term_area* area
oc.code = ' '; oc.code = ' ';
oc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == oc); 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& rsh = area->right_shadow;
int line_len = aw + rsh; int line_len = aw + rsh;
// Area character // Area character
char_data* ac = &area->text[y * line_len + x]; charData* ac = &area->text[y * line_len + x];
// Terminal character // Terminal character
char_data* tc = &vterm->text[ty * vterm->width + tx]; charData* tc = &vterm->text[ty * vterm->width + tx];
// New character // New character
char_data nc; charData nc;
std::memcpy (&nc, ac, sizeof(char_data)); std::memcpy (&nc, ac, sizeof(charData));
// Covered character // 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.bg_color = cc.bg_color;
nc.attr.bit.no_changes = bool(tc->attr.bit.printed && *tc == nc); 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& rsh = area->right_shadow;
int line_len = aw + rsh; int line_len = aw + rsh;
// Area character // Area character
char_data* ac = &area->text[y * line_len + x]; charData* ac = &area->text[y * line_len + x];
// Terminal character // Terminal character
char_data* tc = &vterm->text[ty * vterm->width + tx]; charData* tc = &vterm->text[ty * vterm->width + tx];
std::memcpy (tc, ac, sizeof(char_data)); std::memcpy (tc, ac, sizeof(charData));
if ( tc->attr.bit.printed && *tc == *ac ) if ( tc->attr.bit.printed && *tc == *ac )
tc->attr.bit.no_changes = true; tc->attr.bit.no_changes = true;
@ -1151,7 +1151,7 @@ bool FVTerm::updateVTermCharacter ( term_area* area
int& rsh = area->right_shadow; int& rsh = area->right_shadow;
int line_len = aw + rsh; int line_len = aw + rsh;
// Area character // Area character
char_data* ac = &area->text[y * line_len + x]; charData* ac = &area->text[y * line_len + x];
// Get covered state // Get covered state
covered_state is_covered = isCovered(tx, ty, area); 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 for (int y = 0; y < y_end; y++) // line loop
{ {
char_data* tc; // terminal character charData* tc; // terminal character
char_data* ac; // area character charData* ac; // area character
tc = &vterm->text[(ay + y) * vterm->width + ax]; tc = &vterm->text[(ay + y) * vterm->width + ax];
ac = &area->text[y * area->width]; 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 ) if ( short(area->changes[y].xmin) > 0 )
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 for (int _y = 0; _y < y_end; _y++) // line loop
{ {
char_data* tc; // terminal character charData* tc; // terminal character
char_data* ac; // area character charData* ac; // area character
int line_len = area->width + area->right_shadow; int line_len = area->width + area->right_shadow;
tc = &vterm->text[(y + _y - 1) * vterm->width + x - 1]; tc = &vterm->text[(y + _y - 1) * vterm->width + x - 1];
ac = &area->text[(dy + _y) * line_len + dx]; 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 ) if ( short(area->changes[dy + _y].xmin) > dx )
area->changes[dy + _y].xmin = uInt(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 // Copies the given area block to the virtual terminal position
char_data* tc; // terminal character charData* tc; // terminal character
char_data* ac; // area character charData* ac; // area character
if ( ! area ) if ( ! area )
return; return;
@ -1627,9 +1627,9 @@ void FVTerm::scrollAreaForward (term_area* area)
int total_width int total_width
, length , length
, y_max; , y_max;
char_data nc; // next character charData nc; // next character
char_data* lc; // last character charData* lc; // last character
char_data* dc; // destination character charData* dc; // destination character
if ( ! area ) if ( ! area )
return; return;
@ -1643,19 +1643,19 @@ void FVTerm::scrollAreaForward (term_area* area)
for (int y = 0; y < y_max; y++) for (int y = 0; y < y_max; y++)
{ {
char_data* sc; // source character charData* sc; // source character
int pos1 = y * total_width; int pos1 = y * total_width;
int pos2 = (y + 1) * total_width; int pos2 = (y + 1) * total_width;
sc = &area->text[pos2]; sc = &area->text[pos2];
dc = &area->text[pos1]; 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].xmin = 0;
area->changes[y].xmax = uInt(area->width - 1); area->changes[y].xmax = uInt(area->width - 1);
} }
// insert a new line below // insert a new line below
lc = &area->text[(y_max * total_width) - area->right_shadow - 1]; 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 = ' '; nc.code = ' ';
dc = &area->text[y_max * total_width]; dc = &area->text[y_max * total_width];
std::fill_n (dc, area->width, nc); std::fill_n (dc, area->width, nc);
@ -1688,9 +1688,9 @@ void FVTerm::scrollAreaReverse (term_area* area)
int total_width int total_width
, length , length
, y_max; , y_max;
char_data nc; // next character charData nc; // next character
char_data* lc; // last character charData* lc; // last character
char_data* dc; // destination character charData* dc; // destination character
if ( ! area ) if ( ! area )
return; return;
@ -1704,19 +1704,19 @@ void FVTerm::scrollAreaReverse (term_area* area)
for (int y = y_max; y > 0; y--) for (int y = y_max; y > 0; y--)
{ {
char_data* sc; // source character charData* sc; // source character
int pos1 = (y - 1) * total_width; int pos1 = (y - 1) * total_width;
int pos2 = y * total_width; int pos2 = y * total_width;
sc = &area->text[pos1]; sc = &area->text[pos1];
dc = &area->text[pos2]; 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].xmin = 0;
area->changes[y].xmax = uInt(area->width - 1); area->changes[y].xmax = uInt(area->width - 1);
} }
// insert a new line above // insert a new line above
lc = &area->text[total_width]; lc = &area->text[total_width];
std::memcpy (&nc, lc, sizeof(char_data)); std::memcpy (&nc, lc, sizeof(charData));
nc.code = ' '; nc.code = ' ';
dc = &area->text[0]; dc = &area->text[0];
std::fill_n (dc, area->width, nc); 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 // Clear the area with the current attributes
char_data nc; // next character charData nc; // next character
uInt w; uInt w;
// Current attributes with a space character // Current attributes with a space character
std::memcpy (&nc, &next_attribute, sizeof(char_data)); std::memcpy (&nc, &next_attribute, sizeof(charData));
nc.code = fillchar; nc.code = fillchar;
if ( ! (area && area->text) ) 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 // Generates characters for a given position considering all areas
return generateCharacter (pos.getX(), pos.getY()); 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 // Generates characters for a given position considering all areas
FWidget::widgetList::const_iterator iter, end; FWidget::widgetList::const_iterator iter, end;
char_data* sc; // shown character charData* sc; // shown character
FWidget* widget; FWidget* widget;
widget = static_cast<FWidget*>(vterm->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 // Window is visible and contains current character
if ( geometry.contains(x, y) ) if ( geometry.contains(x, y) )
{ {
char_data* tmp; charData* tmp;
int line_len = win->width + win->right_shadow; int line_len = win->width + win->right_shadow;
tmp = &win->text[(y - win_y) * line_len + (x - win_x)]; 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 if ( tmp->attr.bit.trans_shadow ) // Transparent shadow
{ {
// Keep the current vterm character // 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.fg_color = tmp->fg_color;
s_ch.bg_color = tmp->bg_color; s_ch.bg_color = tmp->bg_color;
s_ch.attr.bit.reverse = false; 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 ) else if ( tmp->attr.bit.inherit_bg )
{ {
// Add the covered background to this character // 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 i_ch.bg_color = sc->bg_color; // Last background color
sc = &i_ch; 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 , const FPoint& pos
, FVTerm* obj ) , 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 x
, int y , int y
, FVTerm* obj ) , FVTerm* obj )
{ {
// Gets the overlapped or the covered character for the position (x,y) // Gets the overlapped or the covered character for the position (x,y)
int xx, yy, layer; int xx, yy, layer;
char_data* cc; // covered character charData* cc; // covered character
FWidget* w; FWidget* w;
FWidget::widgetList::const_iterator iter, end; 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 ) , FVTerm* obj )
{ {
// Gets the covered character for a given position // 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 , int y
, FVTerm* obj) , 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 ) , FVTerm* obj )
{ {
// Gets the overlapped character for a given position // 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 , int y
, FVTerm* obj) , FVTerm* obj)
{ {
@ -2082,7 +2082,7 @@ void FVTerm::init()
term_attribute.attr.byte[0] = 0; term_attribute.attr.byte[0] = 0;
// next_attribute contains the state of the next printed character // 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 // receive the terminal capabilities
tcap = FTermcap().getTermcapMap(); 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 // 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 void FVTerm::putAreaCharacter ( int x, int y, FVTerm* obj
, char_data* ac , charData* ac
, char_data* tc ) , charData* tc )
{ {
if ( ac->attr.bit.transparent ) // Transparent if ( ac->attr.bit.transparent ) // Transparent
{ {
// Restore one character on vterm // Restore one character on vterm
char_data ch; charData ch;
ch = getCoveredCharacter (x, y, obj); ch = getCoveredCharacter (x, y, obj);
std::memcpy (tc, &ch, sizeof(char_data)); std::memcpy (tc, &ch, sizeof(charData));
} }
else // Mot transparent else // Mot transparent
{ {
if ( ac->attr.bit.trans_shadow ) // Transparent shadow if ( ac->attr.bit.trans_shadow ) // Transparent shadow
{ {
// Get covered character + add the current color // Get covered character + add the current color
char_data ch; charData ch;
ch = getCoveredCharacter (x, y, obj); ch = getCoveredCharacter (x, y, obj);
ch.fg_color = ac->fg_color; ch.fg_color = ac->fg_color;
ch.bg_color = ac->bg_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 == fc::FullBlock )
ch.code = ' '; ch.code = ' ';
std::memcpy (tc, &ch, sizeof(char_data)); std::memcpy (tc, &ch, sizeof(charData));
} }
else if ( ac->attr.bit.inherit_bg ) else if ( ac->attr.bit.inherit_bg )
{ {
// Add the covered background to this character // Add the covered background to this character
char_data ch, cc; charData ch, cc;
std::memcpy (&ch, ac, sizeof(char_data)); std::memcpy (&ch, ac, sizeof(charData));
cc = getCoveredCharacter (x, y, obj); cc = getCoveredCharacter (x, y, obj);
ch.bg_color = cc.bg_color; ch.bg_color = cc.bg_color;
std::memcpy (tc, &ch, sizeof(char_data)); std::memcpy (tc, &ch, sizeof(charData));
} }
else // Default 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 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_x = area->offset_left;
int area_y = area->offset_top; int area_y = area->offset_top;
int line_len = area->width + area->right_shadow; 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 if ( tmp->attr.bit.trans_shadow ) // transparent shadow
{ {
// Keep the current vterm character // 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.fg_color = tmp->fg_color;
s_ch.bg_color = tmp->bg_color; s_ch.bg_color = tmp->bg_color;
s_ch.attr.bit.reverse = false; 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 ) else if ( tmp->attr.bit.inherit_bg )
{ {
// Add the covered background to this character // 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 i_ch.bg_color = cc->bg_color; // last background color
cc = &i_ch; cc = &i_ch;
} }
@ -2226,7 +2226,7 @@ bool FVTerm::clearTerm (int fillchar)
char*& cd = TCAP(fc::t_clr_eos); char*& cd = TCAP(fc::t_clr_eos);
char*& cb = TCAP(fc::t_clr_eol); char*& cb = TCAP(fc::t_clr_eol);
bool ut = FTermcap::background_color_erase; bool ut = FTermcap::background_color_erase;
char_data* next = &next_attribute; charData* next = &next_attribute;
bool normal = isNormal(next); bool normal = isNormal(next);
appendAttributes(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 // Clear area
int area_size = area->width * area->height; 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; int total_width = area->width + area->right_shadow;
t_char.attr.bit.transparent = true; t_char.attr.bit.transparent = true;
@ -2327,7 +2327,7 @@ bool FVTerm::canClearToEOL (uInt xmin, uInt y)
term_area*& vt = vterm; term_area*& vt = vterm;
char*& ce = TCAP(fc::t_clr_eol); 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 == ' ' ) 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++) 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 ) if ( *min_char == *ch )
beginning_whitespace++; beginning_whitespace++;
@ -2362,7 +2362,7 @@ bool FVTerm::canClearLeadingWS (uInt& xmin, uInt y)
term_area*& vt = vterm; term_area*& vt = vterm;
char*& cb = TCAP(fc::t_clr_bol); 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 == ' ' ) 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++) 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 ) if ( *first_char == *ch )
leading_whitespace++; leading_whitespace++;
@ -2400,7 +2400,7 @@ bool FVTerm::canClearTrailingWS (uInt& xmax, uInt y)
term_area*& vt = vterm; term_area*& vt = vterm;
char*& ce = TCAP(fc::t_clr_eol); 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 == ' ' ) 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--) 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 ) if ( *last_char == *ch )
trailing_whitespace++; 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 // Skip characters without changes if it is faster than redrawing
term_area*& vt = vterm; 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; print_char->attr.bit.printed = true;
if ( print_char->attr.bit.no_changes ) 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++) 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 ) if ( ch->attr.bit.no_changes )
count++; count++;
@ -2470,7 +2470,7 @@ void FVTerm::printRange ( uInt xmin, uInt xmax, uInt y
{ {
for (uInt x = xmin; x <= xmax; x++) for (uInt x = xmin; x <= xmax; x++)
{ {
char_data* print_char; charData* print_char;
term_area*& vt = vterm; term_area*& vt = vterm;
char*& ec = TCAP(fc::t_erase_chars); char*& ec = TCAP(fc::t_erase_chars);
char*& rp = TCAP(fc::t_repeat_char); 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; term_area*& vt = vterm;
char*& ec = TCAP(fc::t_erase_chars); 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 != ' ' ) if ( ! ec || print_char->code != ' ' )
return not_used; 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++) 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 ) if ( *print_char == *ch )
whitespace++; whitespace++;
@ -2572,7 +2572,7 @@ FVTerm::exit_state FVTerm::repeatCharacter (uInt& x, uInt xmax, uInt y)
term_area*& vt = vterm; term_area*& vt = vterm;
char*& rp = TCAP(fc::t_repeat_char); 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 ) if ( ! rp )
return not_used; 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++) 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 ) if ( *print_char == *ch )
repetitions++; repetitions++;
@ -2689,9 +2689,9 @@ void FVTerm::updateTerminalLine (uInt y)
bool draw_leading_ws = false; bool draw_leading_ws = false;
bool draw_trailing_ws = false; bool draw_trailing_ws = false;
char*& ce = TCAP(fc::t_clr_eol); char*& ce = TCAP(fc::t_clr_eol);
char_data* first_char = &vt->text[y * uInt(vt->width)]; charData* first_char = &vt->text[y * uInt(vt->width)];
char_data* last_char = &vt->text[(y + 1) * uInt(vt->width) - 1]; charData* last_char = &vt->text[(y + 1) * uInt(vt->width) - 1];
char_data* min_char = &vt->text[y * uInt(vt->width) + xmin]; charData* min_char = &vt->text[y * uInt(vt->width) + xmin];
// Clear rest of line // Clear rest of line
bool is_eol_clean = canClearToEOL (xmin, y); 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 // NewFont special cases
if ( isNewFont() ) 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 ) if ( getEncoding() == fc::UTF8 )
return; 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_width = vterm->width - 1;
int term_height = vterm->height - 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); newFontChanges (next_char);
charsetChanges (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* attr_str;
char_data* term_attr = &term_attribute; charData* term_attr = &term_attribute;
// generate attribute string for the next character // generate attribute string for the next character
attr_str = changeAttribute (term_attr, next_attr); 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* SA = TCAP(fc::t_enter_am_mode);
char* RA = TCAP(fc::t_exit_am_mode); char* RA = TCAP(fc::t_exit_am_mode);

View File

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

View File

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