Implement 'Ignore Emoticons' feature in preferences
This commit is contained in:
parent
b314c7abd8
commit
52b169b0ba
|
@ -11,10 +11,13 @@ typedef struct CayaPreferencesData
|
||||||
{
|
{
|
||||||
bool MoveToCurrentWorkspace;
|
bool MoveToCurrentWorkspace;
|
||||||
bool ActivateWindow;
|
bool ActivateWindow;
|
||||||
|
bool IgnoreEmoticons;
|
||||||
|
|
||||||
CayaPreferencesData()
|
CayaPreferencesData()
|
||||||
: MoveToCurrentWorkspace(true),
|
:
|
||||||
ActivateWindow(true)
|
MoveToCurrentWorkspace(true),
|
||||||
|
ActivateWindow(true),
|
||||||
|
IgnoreEmoticons(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
const uint32 kToCurrentWorkspace = 'CBcw';
|
const uint32 kToCurrentWorkspace = 'CBcw';
|
||||||
const uint32 kActivateChatWindow = 'CBac';
|
const uint32 kActivateChatWindow = 'CBac';
|
||||||
|
const uint32 kIgnoreEmoticons = 'CBhe';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PreferencesBehavior::PreferencesBehavior()
|
PreferencesBehavior::PreferencesBehavior()
|
||||||
|
@ -43,9 +45,10 @@ PreferencesBehavior::PreferencesBehavior()
|
||||||
"Play sound event", NULL);
|
"Play sound event", NULL);
|
||||||
fPlaySoundOnMessageReceived->SetEnabled(false); // not implemented
|
fPlaySoundOnMessageReceived->SetEnabled(false); // not implemented
|
||||||
|
|
||||||
fHideEmoticons = new BCheckBox("HideEmoticons",
|
fIgnoreEmoticons = new BCheckBox("IgnoreEmoticons",
|
||||||
"Hide Emoticons", NULL);
|
"Ignore Emoticons",
|
||||||
fHideEmoticons->SetEnabled(false); // not implemented
|
new BMessage(kIgnoreEmoticons));
|
||||||
|
fIgnoreEmoticons->SetEnabled(true);
|
||||||
|
|
||||||
fMarkUnreadWindow = new BCheckBox("MarkUnreadWindow",
|
fMarkUnreadWindow = new BCheckBox("MarkUnreadWindow",
|
||||||
"Mark unread window chat", NULL);
|
"Mark unread window chat", NULL);
|
||||||
|
@ -63,7 +66,7 @@ PreferencesBehavior::PreferencesBehavior()
|
||||||
.Add(fPlaySoundOnMessageReceived)
|
.Add(fPlaySoundOnMessageReceived)
|
||||||
.SetInsets(spacing * 2, spacing, spacing, spacing)
|
.SetInsets(spacing * 2, spacing, spacing, spacing)
|
||||||
.End()
|
.End()
|
||||||
.Add(fHideEmoticons)
|
.Add(fIgnoreEmoticons)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.SetInsets(spacing, spacing, spacing, spacing)
|
.SetInsets(spacing, spacing, spacing, spacing)
|
||||||
);
|
);
|
||||||
|
@ -75,11 +78,15 @@ PreferencesBehavior::AttachedToWindow()
|
||||||
{
|
{
|
||||||
fToCurrentWorkspace->SetTarget(this);
|
fToCurrentWorkspace->SetTarget(this);
|
||||||
fActivateChatWindow->SetTarget(this);
|
fActivateChatWindow->SetTarget(this);
|
||||||
|
fIgnoreEmoticons->SetTarget(this);
|
||||||
|
|
||||||
fToCurrentWorkspace->SetValue(
|
fToCurrentWorkspace->SetValue(
|
||||||
CayaPreferences::Item()->MoveToCurrentWorkspace);
|
CayaPreferences::Item()->MoveToCurrentWorkspace);
|
||||||
fActivateChatWindow->SetValue(
|
fActivateChatWindow->SetValue(
|
||||||
CayaPreferences::Item()->ActivateWindow);
|
CayaPreferences::Item()->ActivateWindow);
|
||||||
|
fIgnoreEmoticons->SetValue(
|
||||||
|
CayaPreferences::Item()->IgnoreEmoticons);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,6 +102,10 @@ PreferencesBehavior::MessageReceived(BMessage* message)
|
||||||
CayaPreferences::Item()->ActivateWindow
|
CayaPreferences::Item()->ActivateWindow
|
||||||
= fActivateChatWindow->Value();
|
= fActivateChatWindow->Value();
|
||||||
break;
|
break;
|
||||||
|
case kIgnoreEmoticons:
|
||||||
|
CayaPreferences::Item()->IgnoreEmoticons
|
||||||
|
= fIgnoreEmoticons->Value();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
BView::MessageReceived(message);
|
BView::MessageReceived(message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ private:
|
||||||
BCheckBox* fPlaySoundOnMessageReceived;
|
BCheckBox* fPlaySoundOnMessageReceived;
|
||||||
BCheckBox* fMarkUnreadWindow;
|
BCheckBox* fMarkUnreadWindow;
|
||||||
|
|
||||||
BCheckBox* fHideEmoticons;
|
BCheckBox* fIgnoreEmoticons;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
#include "CayaPreferences.h"
|
||||||
#include "CayaRenderView.h"
|
#include "CayaRenderView.h"
|
||||||
#include "Theme.h"
|
#include "Theme.h"
|
||||||
#include "RunView.h"
|
#include "RunView.h"
|
||||||
|
|
||||||
|
|
||||||
CayaRenderView::CayaRenderView(const char *name, const char* smileyConfig) :
|
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 )
|
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,6 +46,9 @@ CayaRenderView::AppendOwnMessage(const char* message)
|
||||||
void
|
void
|
||||||
CayaRenderView::AddEmoticText(const char * txt, int16 cols , int16 font , int16 cols2 , int16 font2)
|
CayaRenderView::AddEmoticText(const char * txt, int16 cols , int16 font , int16 cols2 , int16 font2)
|
||||||
{
|
{
|
||||||
|
if (CayaPreferences::Item()->IgnoreEmoticons)
|
||||||
|
Append(txt,cols,cols,font);
|
||||||
|
else
|
||||||
Emoticor::Get()->AddText(this, txt, cols, font, cols2, font2);
|
Emoticor::Get()->AddText(this, txt, cols, font, cols2, font2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ŝarĝante…
Reference in New Issue