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_lavc.cpp \
audio_provider_ram.cpp \ audio_provider_ram.cpp \
audio_provider_stream.cpp \ audio_provider_stream.cpp \
audio_spectrum.cpp \
auto4_base.cpp \ auto4_base.cpp \
auto4_lua.cpp \ auto4_lua.cpp \
auto4_lua_assfile.cpp \ auto4_lua_assfile.cpp \

View file

@ -1022,7 +1022,10 @@ void AudioDisplay::CommitChanges (bool nextLine) {
curDiag->Start.SetMS(curStartMS); curDiag->Start.SetMS(curStartMS);
curDiag->End.SetMS(curEndMS); 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(); 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. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // 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); dc.DrawRectangle(0,0,w,h);
// Set syllable font // 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); dc.SetFont(curFont);
// Draw syllables // Draw syllables
@ -331,7 +331,8 @@ void AudioKaraoke::OnPaint(wxPaintEvent &event) {
dlen = tw + 8 + delta; dlen = tw + 8 + delta;
// Draw border // Draw border
dc.SetPen(wxPen(wxColour(0,0,0))); //dc.SetPen(wxPen(wxColour(0,0,0)));
dc.SetPen(*wxTRANSPARENT_PEN);
if (syl.selected && !splitting) { if (syl.selected && !splitting) {
dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT))); dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)));
dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT)); dc.SetTextForeground(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT));
@ -342,6 +343,15 @@ void AudioKaraoke::OnPaint(wxPaintEvent &event) {
} }
dc.DrawRectangle(dx,0,dlen,h); 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 // Draw text
if (splitting) { if (splitting) {
// Make sure the text position is more predictable in case of splitting // Make sure the text position is more predictable in case of splitting

View file

@ -49,7 +49,7 @@
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#include <wchar.h> #include <tchar.h>
#else #else
#include <ft2build.h> #include <ft2build.h>
#include FT_FREETYPE_H #include FT_FREETYPE_H
@ -73,7 +73,7 @@ namespace Automation4 {
fontsize = -MulDiv((int)(fontsize+0.5), GetDeviceCaps(dczero, LOGPIXELSY), 72); fontsize = -MulDiv((int)(fontsize+0.5), GetDeviceCaps(dczero, LOGPIXELSY), 72);
ReleaseDC(0, dczero); ReleaseDC(0, dczero);
LOGFONT lf; LOGFONTW lf;
ZeroMemory(&lf, sizeof(lf)); ZeroMemory(&lf, sizeof(lf));
lf.lfHeight = fontsize; lf.lfHeight = fontsize;
lf.lfWeight = style->bold ? FW_BOLD : FW_NORMAL; lf.lfWeight = style->bold ? FW_BOLD : FW_NORMAL;
@ -85,7 +85,7 @@ namespace Automation4 {
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfQuality = ANTIALIASED_QUALITY; lf.lfQuality = ANTIALIASED_QUALITY;
lf.lfPitchAndFamily = DEFAULT_PITCH|FF_DONTCARE; 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); HFONT thefont = CreateFontIndirect(&lf);
if (!thefont) return false; if (!thefont) return false;
@ -93,7 +93,7 @@ namespace Automation4 {
SIZE sz; SIZE sz;
size_t thetextlen = text.length(); size_t thetextlen = text.length();
const wchar_t *thetext = text.wc_str(); const TCHAR *thetext = text.wc_str();
if (style->spacing) { if (style->spacing) {
width = 0; width = 0;
for (unsigned int i = 0; i < thetextlen; i++) { 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. // All rights reserved.
// //
// Redistribution and use in source and binary forms, with or without // 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->Add(buttonSizer,0,wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM,5);
mainSizer->SetSizeHints(this); mainSizer->SetSizeHints(this);
SetSizer(mainSizer); SetSizer(mainSizer);
CenterOnParent();
// Read // Read
ReadFromOptions(); ReadFromOptions();

View file

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

View file

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