Fixed karaoke mode committing

Other minor fixes/cleanup

Originally committed to SVN as r753.
This commit is contained in:
Niels Martin Hansen 2007-01-10 01:36:05 +00:00
parent 08ff09ee59
commit c0b3721a7f
8 changed files with 37 additions and 21 deletions

View File

@ -34,6 +34,7 @@ aegisub_SOURCES = \
audio_provider_lavc.cpp \
audio_provider_ram.cpp \
audio_provider_stream.cpp \
audio_spectrum.cpp \
auto4_base.cpp \
auto4_lua.cpp \
auto4_lua_assfile.cpp \

View File

@ -1022,7 +1022,10 @@ void AudioDisplay::CommitChanges (bool nextLine) {
curDiag->Start.SetMS(curStartMS);
curDiag->End.SetMS(curEndMS);
curDiag->Text = grid->editBox->TextEdit->GetText();
if (!karaoke->enabled)
// If user was editing karaoke stuff, that should take precedence of manual changes in the editbox,
// so only updated from editbox when not in kara mode
curDiag->Text = grid->editBox->TextEdit->GetText();
curDiag->UpdateData();
}

View File

@ -1,4 +1,4 @@
// Copyright (c) 2005, Rodrigo Braz Monteiro, Niels Martin Hansen
// Copyright (c) 2005, 2006, 2007, Rodrigo Braz Monteiro, Niels Martin Hansen
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@ -305,7 +305,7 @@ void AudioKaraoke::OnPaint(wxPaintEvent &event) {
dc.DrawRectangle(0,0,w,h);
// Set syllable font
wxFont curFont(9,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Verdana"),wxFONTENCODING_SYSTEM);
wxFont curFont(9,wxFONTFAMILY_DEFAULT,wxFONTSTYLE_NORMAL,wxFONTWEIGHT_NORMAL,false,_T("Verdana"),wxFONTENCODING_SYSTEM); // FIXME, hardcoded font
dc.SetFont(curFont);
// Draw syllables
@ -331,7 +331,8 @@ void AudioKaraoke::OnPaint(wxPaintEvent &event) {
dlen = tw + 8 + delta;
// Draw border
dc.SetPen(wxPen(wxColour(0,0,0)));
//dc.SetPen(wxPen(wxColour(0,0,0)));
dc.SetPen(*wxTRANSPARENT_PEN);
if (syl.selected && !splitting) {
dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)));
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
@ -342,6 +343,15 @@ void AudioKaraoke::OnPaint(wxPaintEvent &event) {
}
dc.DrawRectangle(dx,0,dlen,h);
// Put syllable-end-marker after text
dc.SetPen(*wxBLACK_PEN);
//dc.DrawLine(dx, 0, dx, h);
dc.DrawLine(dx, 0, dx+1, 0);
dc.DrawLine(dx, h-1, dx+1, h-1);
dc.DrawLine(dx+dlen-1, 0, dx+dlen-1, h);
dc.DrawLine(dx+dlen-2, 0, dx+dlen-1, 0);
dc.DrawLine(dx+dlen-2, h-1, dx+dlen-1, h-1);
// Draw text
if (splitting) {
// Make sure the text position is more predictable in case of splitting

View File

@ -49,7 +49,7 @@
#ifdef WIN32
#include <windows.h>
#include <wchar.h>
#include <tchar.h>
#else
#include <ft2build.h>
#include FT_FREETYPE_H
@ -73,7 +73,7 @@ namespace Automation4 {
fontsize = -MulDiv((int)(fontsize+0.5), GetDeviceCaps(dczero, LOGPIXELSY), 72);
ReleaseDC(0, dczero);
LOGFONT lf;
LOGFONTW lf;
ZeroMemory(&lf, sizeof(lf));
lf.lfHeight = fontsize;
lf.lfWeight = style->bold ? FW_BOLD : FW_NORMAL;
@ -85,7 +85,7 @@ namespace Automation4 {
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = ANTIALIASED_QUALITY;
lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE;
wcsncpy(lf.lfFaceName, style->font.wc_str(), 32);
_tcsncpy(lf.lfFaceName, style->font.c_str(), 32);
HFONT thefont = CreateFontIndirect(&lf);
if (!thefont) return false;
@ -93,7 +93,7 @@ namespace Automation4 {
SIZE sz;
size_t thetextlen = text.length();
const wchar_t *thetext = text.wc_str();
const TCHAR *thetext = text.wc_str();
if (style->spacing) {
width = 0;
for (unsigned int i = 0; i < thetextlen; i++) {

View File

@ -1,4 +1,4 @@
// Copyright (c) 2006, Niels Martin Hansen
// Copyright (c) 2006, 2007, Niels Martin Hansen
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without

View File

@ -592,6 +592,7 @@ DialogOptions::DialogOptions(wxWindow *parent)
mainSizer->Add(buttonSizer,0,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,5);
mainSizer->SetSizeHints(this);
SetSizer(mainSizer);
CenterOnParent();
// Read
ReadFromOptions();

View File

@ -84,6 +84,7 @@ DialogVersionCheck::DialogVersionCheck(wxWindow *parent,bool hidden)
visible = false;
if (!hidden) {
Show();
CenterOnParent();
visible = true;
}

View File

@ -106,14 +106,14 @@ static void setprogdir (lua_State *L) {
if (n == 0 || n == nsize || (lb = wcsrchr(buff, L'\\')) == NULL)
luaL_error(L, "unable to get ModuleFileName");
else {
char *lbuff;
size_t lbuffn;
char *lbuff;
size_t lbuffn;
*lb = '\0';
lbuffn = WideCharToMultiByte(CP_UTF8, 0, buff, n, 0, 0, 0, 0);
lbuff = (char*)malloc(lbuffn+1);
WideCharToMultiByte(CP_UTF8, 0, buff, n, lbuff, (int)lbuffn+1, 0, 0);
lbuffn = WideCharToMultiByte(CP_UTF8, 0, buff, n, 0, 0, 0, 0);
lbuff = (char*)malloc(lbuffn+1);
WideCharToMultiByte(CP_UTF8, 0, buff, n, lbuff, (int)lbuffn+1, 0, 0);
luaL_gsub(L, lua_tostring(L, -1), LUA_EXECDIR, lbuff);
free(lbuff);
free(lbuff);
lua_remove(L, -2); /* remove original string */
}
}
@ -123,13 +123,13 @@ static void pusherror (lua_State *L) {
int error = GetLastError();
wchar_t buffer[128];
if (FormatMessageW(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, error, 0, buffer, sizeof(buffer), NULL)) {
char *lbuff;
size_t lbuffn = WideCharToMultiByte(CP_UTF8, 0, buffer, -1, 0, 0, 0, 0);
lbuff = (char*)malloc(lbuffn+1);
WideCharToMultiByte(CP_UTF8, 0, buffer, -1, lbuff, (int)lbuffn+1, 0, 0);
NULL, error, 0, buffer, sizeof(buffer), NULL)) {
char *lbuff;
size_t lbuffn = WideCharToMultiByte(CP_UTF8, 0, buffer, -1, 0, 0, 0, 0);
lbuff = (char*)malloc(lbuffn+1);
WideCharToMultiByte(CP_UTF8, 0, buffer, -1, lbuff, (int)lbuffn+1, 0, 0);
lua_pushstring(L, lbuff);
free(lbuff);
free(lbuff);
} else
lua_pushfstring(L, "system error %d\n", error);
}