Implement 'Ignore Emoticons' feature in preferences

This commit is contained in:
urnenfeld 2010-05-20 18:37:01 +00:00
parent b314c7abd8
commit 52b169b0ba
4 changed files with 40 additions and 21 deletions

View File

@ -11,10 +11,13 @@ typedef struct CayaPreferencesData
{
bool MoveToCurrentWorkspace;
bool ActivateWindow;
bool IgnoreEmoticons;
CayaPreferencesData()
: MoveToCurrentWorkspace(true),
ActivateWindow(true)
:
MoveToCurrentWorkspace(true),
ActivateWindow(true),
IgnoreEmoticons(false)
{
}
};

View File

@ -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);
}

View File

@ -25,7 +25,7 @@ private:
BCheckBox* fPlaySoundOnMessageReceived;
BCheckBox* fMarkUnreadWindow;
BCheckBox* fHideEmoticons;
BCheckBox* fIgnoreEmoticons;
};

View File

@ -1,7 +1,9 @@
#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 )
{
@ -44,7 +46,10 @@ CayaRenderView::AppendOwnMessage(const char* message)
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