Skip to content

Commit

Permalink
Add 'commentDrawLineCount' option
Browse files Browse the repository at this point in the history
  • Loading branch information
rutice committed Mar 11, 2014
1 parent b31c034 commit 4ae604a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CommentWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ CCommentWindow::CCommentWindow()
, commentSizeMin_(1)
, commentSizeMax_(INT_MAX)
, lineCount_(DEFAULT_LINE_COUNT)
, lineDrawCount_(DEFAULT_LINE_DRAW_COUNT - 0.5)
, fontScale_(1.0)
, fontSmallScale_(1.0)
, fontStyle_(Gdiplus::FontStyleRegular)
Expand Down Expand Up @@ -264,6 +265,11 @@ void CCommentWindow::SetCommentSize(int size, int sizeMin, int sizeMax, int line
fontSmallScale_ = fontScale_ * FONT_SMALL_RATIO / 100;
}

void CCommentWindow::SetDrawLineCount(int lineDrawCount)
{
lineDrawCount_ = lineDrawCount - 0.5;
}

void CCommentWindow::SetDisplayDuration(int duration)
{
WaitForIdleDrawingThread();
Expand Down Expand Up @@ -816,7 +822,7 @@ void CCommentWindow::DrawChat(Gdiplus::Graphics &g, int width, int height, RECT
// ウィンドウ下にはみ出すコメントは表示ライン行間に移す
// それでもはみ出すコメントは無視
double actLine = it->line >= actLineCount ? (it->line - actLineCount) + 0.5 : it->line;
if (actLine < 0 || actLineCount <= actLine) {
if (actLine < 0 || actLineCount <= actLine || lineDrawCount_ <= actLine) {
continue;
}
Gdiplus::FontFamily fontFamily;
Expand Down
3 changes: 3 additions & 0 deletions CommentWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class CCommentWindow
{
public:
static const int DEFAULT_LINE_COUNT = 14;
static const int DEFAULT_LINE_DRAW_COUNT = 9999;
static const int DISPLAY_DURATION = 4000;
static const int CHAT_TEXT_MAX = 256;
// 表示すべきコメントがないときウィンドウを非表示にするまでの猶予[秒]
Expand Down Expand Up @@ -39,6 +40,7 @@ class CCommentWindow
void SetStyle(LPCTSTR fontName, LPCTSTR fontNameMulti, bool bBold, bool bAntiAlias,
int fontOutline, bool bUseOsdCompositor, bool bUseTexture, bool bUseDrawingThread);
void SetCommentSize(int size, int sizeMin, int sizeMax, int lineMargin);
void SetDrawLineCount(int lineDrawCount);
int GetDisplayDuration() const { return displayDuration_; }
void SetDisplayDuration(int duration);
BYTE GetOpacity() const { return opacity_; }
Expand Down Expand Up @@ -108,6 +110,7 @@ class CCommentWindow
int commentSizeMin_;
int commentSizeMax_;
int lineCount_;
double lineDrawCount_;
double fontScale_;
double fontSmallScale_;
TCHAR fontName_[LF_FACESIZE];
Expand Down
2 changes: 2 additions & 0 deletions NicoJK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ void CNicoJK::LoadFromIni()
s_.bCommentFontBold = GetBufferedProfileInt(pBuf, TEXT("commentFontBold"), 1) != 0;
s_.bCommentFontAntiAlias = GetBufferedProfileInt(pBuf, TEXT("commentFontAntiAlias"), 1) != 0;
s_.commentDuration = GetBufferedProfileInt(pBuf, TEXT("commentDuration"), CCommentWindow::DISPLAY_DURATION);
s_.commentDrawLineCount = GetBufferedProfileInt(pBuf, TEXT("commentDrawLineCount"), CCommentWindow::DEFAULT_LINE_DRAW_COUNT);
s_.logfileMode = GetBufferedProfileInt(pBuf, TEXT("logfileMode"), 0);
GetBufferedProfileString(pBuf, TEXT("logfileDrivers"),
TEXT("BonDriver_UDP.dll:BonDriver_TCP.dll:BonDriver_File.dll:BonDriver_RecTask.dll:BonDriver_Pipe.dll"),
Expand Down Expand Up @@ -1426,6 +1427,7 @@ INT_PTR CNicoJK::ForceDialogProcMain(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
s_.commentFontOutline, s_.bUseOsdCompositor, s_.bUseTexture, s_.bUseDrawingThread);
commentWindow_.SetCommentSize(s_.commentSize, s_.commentSizeMin, s_.commentSizeMax, s_.commentLineMargin);
commentWindow_.SetDisplayDuration(s_.commentDuration);
commentWindow_.SetDrawLineCount(s_.commentDrawLineCount);
commentWindow_.SetOpacity(static_cast<BYTE>(s_.commentOpacity));
if (commentWindow_.GetOpacity() != 0 && m_pApp->GetPreview()) {
HWND hwndContainer = FindVideoContainer();
Expand Down
1 change: 1 addition & 0 deletions NicoJK.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class CNicoJK : public TVTest::CTVTestPlugin
bool bCommentFontBold;
bool bCommentFontAntiAlias;
int commentDuration;
int commentDrawLineCount;
int logfileMode;
TCHAR logfileDrivers[512];
TCHAR nonTunerDrivers[512];
Expand Down
3 changes: 3 additions & 0 deletions NicoJK.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
; commentFontAntiAlias=1
; コメントの表示期間 (ms) (デフォルトは 4000ms)
; commentDuration=4000
; コメントを描画する最大行数 (デフォルトは 9999行)
; # コメントを表示する行の算出は画面全体で行い、描画のみ行数を制限します
; commentDrawLineCount=5

; 受信したコメントのログファイルへの記録モードを指定
; # 0 = 一切記録しない (デフォルト)
Expand Down

0 comments on commit 4ae604a

Please sign in to comment.