Strict use of fc::colornames in FOptiAttr

This commit is contained in:
Markus Gans 2018-04-15 20:48:25 +02:00
parent bbacc369ec
commit 73ba1bc219
6 changed files with 14 additions and 25 deletions

View File

@ -194,13 +194,6 @@ class FOptiAttr
all_tests = 0x1f all_tests = 0x1f
}; };
enum default_color
{
Default = -1,
Black = 0,
LightGray = 7
};
enum attr_modes enum attr_modes
{ {
standout_mode = 1, standout_mode = 1,

View File

@ -1333,7 +1333,6 @@ void FListBox::recalculateHorizontalBar (int len, bool has_brackets)
if ( ! hbar->isVisible() ) if ( ! hbar->isVisible() )
hbar->setVisible(); hbar->setVisible();
} }
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -1626,7 +1626,6 @@ inline void FMenu::keyRight (FKeyEvent* ev)
} }
else else
keypressMenuBar(ev); // select next menu keypressMenuBar(ev); // select next menu
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -1067,8 +1067,8 @@ bool FOptiAttr::setTermDefaultColor (char_data*& term)
if ( ! term ) if ( ! term )
return false; return false;
term->fg_color = Default; term->fg_color = fc::Default;
term->bg_color = Default; term->bg_color = fc::Default;
if ( append_sequence(F_orig_pair.cap) ) if ( append_sequence(F_orig_pair.cap) )
return true; return true;
@ -1230,8 +1230,8 @@ inline void FOptiAttr::resetColor (char_data*& attr)
{ {
if ( attr ) if ( attr )
{ {
attr->fg_color = Default; attr->fg_color = fc::Default;
attr->bg_color = Default; attr->bg_color = fc::Default;
} }
} }
@ -1400,7 +1400,7 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next)
fg = next->fg_color; fg = next->fg_color;
bg = next->bg_color; bg = next->bg_color;
if ( fg == Default || bg == Default ) if ( fg == fc::Default || bg == fc::Default )
change_to_default_color (term, next, fg, bg); change_to_default_color (term, next, fg, bg);
if ( fake_reverse && fg < 0 && bg < 0 ) if ( fake_reverse && fg < 0 && bg < 0 )
@ -1411,7 +1411,7 @@ void FOptiAttr::change_color (char_data*& term, char_data*& next)
{ {
std::swap (fg, bg); std::swap (fg, bg);
if ( fg == Default || bg == Default ) if ( fg == fc::Default || bg == fc::Default )
setTermDefaultColor(term); setTermDefaultColor(term);
} }
@ -1428,18 +1428,18 @@ inline void FOptiAttr::change_to_default_color ( char_data*& term
{ {
if ( ansi_default_color ) if ( ansi_default_color )
{ {
if ( fg == Default && term->fg_color != Default if ( fg == fc::Default && term->fg_color != fc::Default
&& bg == Default && term->bg_color != Default ) && bg == fc::Default && term->bg_color != fc::Default )
{ {
setTermDefaultColor(term); setTermDefaultColor(term);
} }
else if ( fg == Default && term->fg_color != Default ) else if ( fg == fc::Default && term->fg_color != fc::Default )
{ {
char sgr_39[] = CSI "39m"; char sgr_39[] = CSI "39m";
append_sequence (sgr_39); append_sequence (sgr_39);
term->fg_color = Default; term->fg_color = fc::Default;
} }
else if ( bg == Default && term->bg_color != Default ) else if ( bg == fc::Default && term->bg_color != fc::Default )
{ {
char* sgr_49; char* sgr_49;
char* op = F_orig_pair.cap; char* op = F_orig_pair.cap;
@ -1450,14 +1450,14 @@ inline void FOptiAttr::change_to_default_color ( char_data*& term
sgr_49 = C_STR(CSI "49m"); sgr_49 = C_STR(CSI "49m");
append_sequence (sgr_49); append_sequence (sgr_49);
term->bg_color = Default; term->bg_color = fc::Default;
} }
} }
else if ( ! setTermDefaultColor(term) ) else if ( ! setTermDefaultColor(term) )
{ {
// Fallback to gray on black // Fallback to gray on black
fg = next->fg_color = LightGray; fg = next->fg_color = fc::LightGray;
bg = next->bg_color = Black; bg = next->bg_color = fc::Black;
} }
} }

View File

@ -395,7 +395,6 @@ void FScrollView::scrollTo (int x, int y)
viewport->has_changes = true; viewport->has_changes = true;
copy2area(); copy2area();
updateTerminal(); updateTerminal();
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@ -505,7 +505,6 @@ void FStringTest::additionTest()
const char c2 = 'a'; const char c2 = 'a';
CPPUNIT_ASSERT ( c2 + s5 == "aabc" ); CPPUNIT_ASSERT ( c2 + s5 == "aabc" );
CPPUNIT_ASSERT ( c2 + FString("def") == L"adef" ); CPPUNIT_ASSERT ( c2 + FString("def") == L"adef" );
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------