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 ActivateWindow;
|
||||
bool IgnoreEmoticons;
|
||||
|
||||
CayaPreferencesData()
|
||||
: MoveToCurrentWorkspace(true),
|
||||
ActivateWindow(true)
|
||||
:
|
||||
MoveToCurrentWorkspace(true),
|
||||
ActivateWindow(true),
|
||||
IgnoreEmoticons(false)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ private:
|
|||
BCheckBox* fPlaySoundOnMessageReceived;
|
||||
BCheckBox* fMarkUnreadWindow;
|
||||
|
||||
BCheckBox* fHideEmoticons;
|
||||
BCheckBox* fIgnoreEmoticons;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Ŝarĝante…
Reference in New Issue