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,19 +1,21 @@
|
||||||
|
#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 )
|
||||||
{
|
{
|
||||||
if (smileyConfig)
|
if (smileyConfig)
|
||||||
Emoticor::Get()->LoadConfig(smileyConfig);
|
Emoticor::Get()->LoadConfig(smileyConfig);
|
||||||
|
|
||||||
PrepareTheme(fTheme);
|
PrepareTheme(fTheme);
|
||||||
|
|
||||||
SetViewColor(245, 245, 245, 0);
|
SetViewColor(245, 245, 245, 0);
|
||||||
SetLowColor(245, 245, 245, 0);
|
SetLowColor(245, 245, 245, 0);
|
||||||
SetHighColor(0, 0, 0, 0);
|
SetHighColor(0, 0, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
SetTimeStampFormat(NULL);
|
SetTimeStampFormat(NULL);
|
||||||
if ( IsHidden() )
|
if ( IsHidden() )
|
||||||
|
@ -21,7 +23,7 @@ CayaRenderView::CayaRenderView(const char *name, const char* smileyConfig) :
|
||||||
ScrollToBottom();
|
ScrollToBottom();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CayaRenderView::AppendOtherMessage(const char* message)
|
CayaRenderView::AppendOtherMessage(const char* message)
|
||||||
{
|
{
|
||||||
Append(fOtherNick.String(), COL_OTHERNICK, COL_OTHERNICK, R_TEXT);
|
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);
|
Append("You say: ", COL_OWNNICK, COL_OWNNICK, R_TEXT);
|
||||||
AddEmoticText(message, COL_TEXT, R_TEXT,COL_TEXT,R_EMOTICON);
|
AddEmoticText(message, COL_TEXT, R_TEXT,COL_TEXT,R_EMOTICON);
|
||||||
Append("\n", COL_TEXT, COL_TEXT, R_TEXT);
|
Append("\n", COL_TEXT, COL_TEXT, R_TEXT);
|
||||||
ScrollToSelection();
|
ScrollToSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
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
|
void
|
||||||
|
@ -64,26 +69,26 @@ CayaRenderView::PrepareTheme(Theme *fTheme)
|
||||||
fTheme->WriteLock();
|
fTheme->WriteLock();
|
||||||
fTheme->SetForeground(COL_URL, 5, 5, 150);
|
fTheme->SetForeground(COL_URL, 5, 5, 150);
|
||||||
fTheme->SetBackground(COL_URL, 255, 255, 255);
|
fTheme->SetBackground(COL_URL, 255, 255, 255);
|
||||||
|
|
||||||
fTheme->SetForeground(COL_TIMESTAMP, 130, 130, 130);
|
fTheme->SetForeground(COL_TIMESTAMP, 130, 130, 130);
|
||||||
fTheme->SetBackground(COL_TIMESTAMP, 255, 255, 255);
|
fTheme->SetBackground(COL_TIMESTAMP, 255, 255, 255);
|
||||||
|
|
||||||
fTheme->SetForeground(COL_TEXT, 0, 0, 0);
|
fTheme->SetForeground(COL_TEXT, 0, 0, 0);
|
||||||
fTheme->SetBackground(COL_TEXT, 255, 255, 255);
|
fTheme->SetBackground(COL_TEXT, 255, 255, 255);
|
||||||
|
|
||||||
fTheme->SetForeground(COL_ACTION, 0, 0, 0);
|
fTheme->SetForeground(COL_ACTION, 0, 0, 0);
|
||||||
fTheme->SetBackground(COL_ACTION, 255, 255, 255);
|
fTheme->SetBackground(COL_ACTION, 255, 255, 255);
|
||||||
|
|
||||||
fTheme->SetForeground(COL_SELECTION, 255, 255, 255);
|
fTheme->SetForeground(COL_SELECTION, 255, 255, 255);
|
||||||
fTheme->SetBackground(COL_SELECTION, 0, 0, 0);
|
fTheme->SetBackground(COL_SELECTION, 0, 0, 0);
|
||||||
|
|
||||||
fTheme->SetForeground(COL_OWNNICK, 0, 0, 255);
|
fTheme->SetForeground(COL_OWNNICK, 0, 0, 255);
|
||||||
fTheme->SetBackground(COL_OWNNICK, 255, 255, 255);
|
fTheme->SetBackground(COL_OWNNICK, 255, 255, 255);
|
||||||
|
|
||||||
fTheme->SetForeground(COL_OTHERNICK, 255, 0, 0);
|
fTheme->SetForeground(COL_OTHERNICK, 255, 0, 0);
|
||||||
fTheme->SetBackground(COL_OTHERNICK, 255, 255, 255);
|
fTheme->SetBackground(COL_OTHERNICK, 255, 255, 255);
|
||||||
|
|
||||||
fTheme->SetTextRender(R_EMOTICON, &str);
|
fTheme->SetTextRender(R_EMOTICON, &str);
|
||||||
|
|
||||||
fTheme->SetSoftLineIndent(5.0);
|
fTheme->SetSoftLineIndent(5.0);
|
||||||
fTheme->SetTextMargin(5.0);
|
fTheme->SetTextMargin(5.0);
|
||||||
|
|
Ŝarĝante…
Reference in New Issue