Skip to content

Commit

Permalink
Added stuff for fading older lines
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgammon committed Feb 26, 2018
1 parent ec20047 commit 9d4f265
Show file tree
Hide file tree
Showing 9 changed files with 246 additions and 167 deletions.
19 changes: 14 additions & 5 deletions doc.cpp
Expand Up @@ -7542,22 +7542,31 @@ void CMUSHclientDoc::DoFixMenus(CCmdUI* pCmdUI)
} // end of CMUSHclientDoc::DoFixMenus

// for mapping one colour to another at drawing time
const COLORREF CMUSHclientDoc::TranslateColour (const COLORREF & source) const
const COLORREF CMUSHclientDoc::TranslateColour (const COLORREF & source, const double opacity) const
{
// quick escape
if (m_ColourTranslationMap.empty ())
return source;
{
if (opacity == 1.0)
return source;
return RGB (opacity * GetRValue (source), opacity * GetGValue (source), opacity * GetBValue (source));
}

// search for it
map<COLORREF, COLORREF>::const_iterator it = m_ColourTranslationMap.find (source);

// not found, use original colour
if (it == m_ColourTranslationMap.end ())
return source;
{
if (opacity == 1.0)
return source;
return RGB (opacity * GetRValue (source), opacity * GetGValue (source), opacity * GetBValue (source));
}

// return replacement colour
return it->second;

if (opacity == 1.0)
return it->second;
return RGB (opacity * GetRValue (it->second), opacity * GetGValue (it->second), opacity * GetBValue (it->second));
} // end of CMUSHclientDoc::TranslateColour


Expand Down
10 changes: 9 additions & 1 deletion doc.h
Expand Up @@ -925,6 +925,12 @@ class CMUSHclientDoc : public CDocument
unsigned short m_bLogScriptErrors; // write scripting error messages to log file?
unsigned short m_bOmitSavedDateFromSaveFiles; // if set, do not write the date saved to save files

// version 5.06

unsigned short m_iFadeOutputBufferAfterSeconds; // fade output buffer after these many seconds (0 = disable)
unsigned short m_FadeOutputOpacityPercent; // what opacity to fade to (0 to 100 percent)
unsigned short m_FadeOutputSeconds; // how many seconds to fade over

// end of stuff saved to disk **************************************************************

// stuff from pre version 11, read from disk but not saved
Expand Down Expand Up @@ -1382,6 +1388,8 @@ class CMUSHclientDoc : public CDocument
CString m_strWindowTitle; // for SetTitle
CString m_strMainWindowTitle; // for SetMainTitle

CTime m_timeFadeCancelled; // when we last scrolled up and cancelled faded text
CTime m_timeLastWindowDraw; // when we last redrew the output window

// see enum above: eKeepEvaluatingTriggers, eStopEvaluatingTriggers,
// eStopEvaluatingTriggersInAllPlugins
Expand Down Expand Up @@ -1824,7 +1832,7 @@ class CMUSHclientDoc : public CDocument

#endif // PANE

const COLORREF TranslateColour (const COLORREF & source) const;
const COLORREF TranslateColour (const COLORREF & source, const double opacity) const;

void OnConnect(int nErrorCode);
void HostNameResolved (WPARAM wParam, LPARAM lParam);
Expand Down
3 changes: 3 additions & 0 deletions doc_construct.cpp
Expand Up @@ -431,6 +431,9 @@ int i;
m_bTreeviewAliases = true;
m_bTreeviewTimers = true;

m_timeFadeCancelled = CTime ((time_t) 0);
m_timeLastWindowDraw = CTime ((time_t) 0);

// set up some default triggers for MUSHes

/*
Expand Down

0 comments on commit 9d4f265

Please sign in to comment.