color artist's info loaded from a file
This commit is contained in:
@@ -99,6 +99,8 @@ void * GetArtistInfo(void *ptr)
|
||||
first = 0;
|
||||
}
|
||||
input.close();
|
||||
sInfo->SetFormatting(fmtBold, "\n\nSimilar artists:\n", fmtBoldEnd, 0);
|
||||
sInfo->SetFormatting(Config.color2, "\n * ", clEnd);
|
||||
artist_info_ready = 1;
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
@@ -101,6 +101,11 @@ void Scrollpad::Flush()
|
||||
itsBuffer.SetTemp(0);
|
||||
}
|
||||
|
||||
void Scrollpad::SetFormatting(short vb, const std::basic_string<my_char_t> &s, short ve, bool for_each)
|
||||
{
|
||||
itsBuffer.SetFormatting(vb, s, ve, for_each);
|
||||
}
|
||||
|
||||
void Scrollpad::Recreate()
|
||||
{
|
||||
delwin(itsWindow);
|
||||
|
||||
@@ -32,6 +32,7 @@ class Scrollpad: public Window
|
||||
virtual ~Scrollpad() { }
|
||||
|
||||
void Flush();
|
||||
void SetFormatting(short, const std::basic_string<my_char_t> &, short, bool for_each = 1);
|
||||
std::basic_string<my_char_t> Content() { return itsBuffer.Str(); }
|
||||
|
||||
virtual void Refresh();
|
||||
@@ -50,6 +51,7 @@ class Scrollpad: public Window
|
||||
Scrollpad &operator<<(std::ostream &(*os)(std::ostream &));
|
||||
|
||||
# ifdef _UTF8
|
||||
void SetFormatting(short vb, const std::string &s, short ve, bool for_each = 1) { SetFormatting(vb, ToWString(s), ve, for_each); }
|
||||
Scrollpad &operator<<(const char *s);
|
||||
Scrollpad &operator<<(const std::string &s);
|
||||
# endif // _UTF8
|
||||
|
||||
@@ -47,6 +47,7 @@ template <class C> class basic_buffer
|
||||
basic_buffer() : itsTempString(0) { }
|
||||
|
||||
std::basic_string<C> Str() const;
|
||||
void SetFormatting(short vb, const std::basic_string<C> &s, short ve, bool for_each = 1);
|
||||
void SetTemp(std::basic_string<C> *);
|
||||
void Clear();
|
||||
|
||||
@@ -72,6 +73,25 @@ template <class C> std::basic_string<C> basic_buffer<C>::Str() const
|
||||
return itsString.str();
|
||||
}
|
||||
|
||||
template <class C> void basic_buffer<C>::SetFormatting(short vb, const std::basic_string<C> &s, short ve, bool for_each)
|
||||
{
|
||||
std::basic_string<C> base = itsString.str();
|
||||
FormatPos fp;
|
||||
|
||||
for (size_t i = base.find(s); i != std::basic_string<C>::npos; i = base.find(s))
|
||||
{
|
||||
base[i] = 0;
|
||||
fp.Value = vb;
|
||||
fp.Position = i;
|
||||
itsFormat.push_back(fp);
|
||||
fp.Value = ve;
|
||||
fp.Position = i+s.length();
|
||||
itsFormat.push_back(fp);
|
||||
if (!for_each)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template <class C> void basic_buffer<C>::SetTemp(std::basic_string<C> *tmp)
|
||||
{
|
||||
itsTempString = tmp;
|
||||
|
||||
Reference in New Issue
Block a user