diff --git a/application/preferences/CayaPreferences.h b/application/preferences/CayaPreferences.h index fa0ad7b..8be989a 100644 --- a/application/preferences/CayaPreferences.h +++ b/application/preferences/CayaPreferences.h @@ -11,10 +11,13 @@ typedef struct CayaPreferencesData { bool MoveToCurrentWorkspace; bool ActivateWindow; + bool IgnoreEmoticons; CayaPreferencesData() - : MoveToCurrentWorkspace(true), - ActivateWindow(true) + : + MoveToCurrentWorkspace(true), + ActivateWindow(true), + IgnoreEmoticons(false) { } }; diff --git a/application/preferences/PreferencesBehavior.cpp b/application/preferences/PreferencesBehavior.cpp index fcfeb16..0bdfc90 100644 --- a/application/preferences/PreferencesBehavior.cpp +++ b/application/preferences/PreferencesBehavior.cpp @@ -21,6 +21,8 @@ const uint32 kToCurrentWorkspace = 'CBcw'; const uint32 kActivateChatWindow = 'CBac'; +const uint32 kIgnoreEmoticons = 'CBhe'; + PreferencesBehavior::PreferencesBehavior() @@ -43,9 +45,10 @@ PreferencesBehavior::PreferencesBehavior() "Play sound event", NULL); fPlaySoundOnMessageReceived->SetEnabled(false); // not implemented - fHideEmoticons = new BCheckBox("HideEmoticons", - "Hide Emoticons", NULL); - fHideEmoticons->SetEnabled(false); // not implemented + fIgnoreEmoticons = new BCheckBox("IgnoreEmoticons", + "Ignore Emoticons", + new BMessage(kIgnoreEmoticons)); + fIgnoreEmoticons->SetEnabled(true); fMarkUnreadWindow = new BCheckBox("MarkUnreadWindow", "Mark unread window chat", NULL); @@ -63,7 +66,7 @@ PreferencesBehavior::PreferencesBehavior() .Add(fPlaySoundOnMessageReceived) .SetInsets(spacing * 2, spacing, spacing, spacing) .End() - .Add(fHideEmoticons) + .Add(fIgnoreEmoticons) .AddGlue() .SetInsets(spacing, spacing, spacing, spacing) ); @@ -75,11 +78,15 @@ PreferencesBehavior::AttachedToWindow() { fToCurrentWorkspace->SetTarget(this); fActivateChatWindow->SetTarget(this); + fIgnoreEmoticons->SetTarget(this); fToCurrentWorkspace->SetValue( CayaPreferences::Item()->MoveToCurrentWorkspace); fActivateChatWindow->SetValue( CayaPreferences::Item()->ActivateWindow); + fIgnoreEmoticons->SetValue( + CayaPreferences::Item()->IgnoreEmoticons); + } @@ -95,6 +102,10 @@ PreferencesBehavior::MessageReceived(BMessage* message) CayaPreferences::Item()->ActivateWindow = fActivateChatWindow->Value(); break; + case kIgnoreEmoticons: + CayaPreferences::Item()->IgnoreEmoticons + = fIgnoreEmoticons->Value(); + break; default: BView::MessageReceived(message); } diff --git a/application/preferences/PreferencesBehavior.h b/application/preferences/PreferencesBehavior.h index 9c95950..e8d9d3b 100644 --- a/application/preferences/PreferencesBehavior.h +++ b/application/preferences/PreferencesBehavior.h @@ -25,7 +25,7 @@ private: BCheckBox* fPlaySoundOnMessageReceived; BCheckBox* fMarkUnreadWindow; - BCheckBox* fHideEmoticons; + BCheckBox* fIgnoreEmoticons; }; diff --git a/application/views/CayaRenderView.cpp b/application/views/CayaRenderView.cpp index e628d65..32436ff 100644 --- a/application/views/CayaRenderView.cpp +++ b/application/views/CayaRenderView.cpp @@ -1,19 +1,21 @@ +#include "CayaPreferences.h" #include "CayaRenderView.h" #include "Theme.h" #include "RunView.h" + CayaRenderView::CayaRenderView(const char *name, const char* smileyConfig) : RunView( BRect(0, 0, 1, 1), name, fTheme = new Theme(name, COL_MAX_COLORS + 1, COL_MAX_COLORS + 1, MAX_RENDERS + 1), B_FOLLOW_ALL, B_WILL_DRAW ) { if (smileyConfig) Emoticor::Get()->LoadConfig(smileyConfig); - + PrepareTheme(fTheme); - + SetViewColor(245, 245, 245, 0); SetLowColor(245, 245, 245, 0); SetHighColor(0, 0, 0, 0); - + SetTimeStampFormat(NULL); if ( IsHidden() ) @@ -21,7 +23,7 @@ CayaRenderView::CayaRenderView(const char *name, const char* smileyConfig) : ScrollToBottom(); } -void +void CayaRenderView::AppendOtherMessage(const char* message) { Append(fOtherNick.String(), COL_OTHERNICK, COL_OTHERNICK, R_TEXT); @@ -37,14 +39,17 @@ CayaRenderView::AppendOwnMessage(const char* message) Append("You say: ", COL_OWNNICK, COL_OWNNICK, R_TEXT); AddEmoticText(message, COL_TEXT, R_TEXT,COL_TEXT,R_EMOTICON); Append("\n", COL_TEXT, COL_TEXT, R_TEXT); - ScrollToSelection(); + ScrollToSelection(); } - + void CayaRenderView::AddEmoticText(const char * txt, int16 cols , int16 font , int16 cols2 , int16 font2) -{ - Emoticor::Get()->AddText(this, txt, cols, font, cols2, font2); +{ + if (CayaPreferences::Item()->IgnoreEmoticons) + Append(txt,cols,cols,font); + else + Emoticor::Get()->AddText(this, txt, cols, font, cols2, font2); } void @@ -64,26 +69,26 @@ CayaRenderView::PrepareTheme(Theme *fTheme) fTheme->WriteLock(); fTheme->SetForeground(COL_URL, 5, 5, 150); fTheme->SetBackground(COL_URL, 255, 255, 255); - + fTheme->SetForeground(COL_TIMESTAMP, 130, 130, 130); fTheme->SetBackground(COL_TIMESTAMP, 255, 255, 255); fTheme->SetForeground(COL_TEXT, 0, 0, 0); fTheme->SetBackground(COL_TEXT, 255, 255, 255); - + fTheme->SetForeground(COL_ACTION, 0, 0, 0); fTheme->SetBackground(COL_ACTION, 255, 255, 255); - + fTheme->SetForeground(COL_SELECTION, 255, 255, 255); fTheme->SetBackground(COL_SELECTION, 0, 0, 0); fTheme->SetForeground(COL_OWNNICK, 0, 0, 255); fTheme->SetBackground(COL_OWNNICK, 255, 255, 255); - + fTheme->SetForeground(COL_OTHERNICK, 255, 0, 0); fTheme->SetBackground(COL_OTHERNICK, 255, 255, 255); - - fTheme->SetTextRender(R_EMOTICON, &str); + + fTheme->SetTextRender(R_EMOTICON, &str); fTheme->SetSoftLineIndent(5.0); fTheme->SetTextMargin(5.0);