diff --git a/aegisub/Makefile.am b/aegisub/Makefile.am index bbe84bfa5..54c7a4b23 100644 --- a/aegisub/Makefile.am +++ b/aegisub/Makefile.am @@ -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 \ diff --git a/aegisub/audio_display.cpp b/aegisub/audio_display.cpp index 54c90e7eb..8e105d5a2 100644 --- a/aegisub/audio_display.cpp +++ b/aegisub/audio_display.cpp @@ -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(); } diff --git a/aegisub/audio_karaoke.cpp b/aegisub/audio_karaoke.cpp index c19009702..254d61c96 100644 --- a/aegisub/audio_karaoke.cpp +++ b/aegisub/audio_karaoke.cpp @@ -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 diff --git a/aegisub/auto4_base.cpp b/aegisub/auto4_base.cpp index 558feb0a6..83f8ebebc 100644 --- a/aegisub/auto4_base.cpp +++ b/aegisub/auto4_base.cpp @@ -49,7 +49,7 @@ #ifdef WIN32 #include -#include +#include #else #include #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++) { diff --git a/aegisub/auto4_lua_dialog.cpp b/aegisub/auto4_lua_dialog.cpp index a488d7c79..f460115de 100644 --- a/aegisub/auto4_lua_dialog.cpp +++ b/aegisub/auto4_lua_dialog.cpp @@ -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 diff --git a/aegisub/dialog_options.cpp b/aegisub/dialog_options.cpp index 3f2dc453b..b32a8e04b 100644 --- a/aegisub/dialog_options.cpp +++ b/aegisub/dialog_options.cpp @@ -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(); diff --git a/aegisub/dialog_version_check.cpp b/aegisub/dialog_version_check.cpp index f5820b49c..4243594c7 100644 --- a/aegisub/dialog_version_check.cpp +++ b/aegisub/dialog_version_check.cpp @@ -84,6 +84,7 @@ DialogVersionCheck::DialogVersionCheck(wxWindow *parent,bool hidden) visible = false; if (!hidden) { Show(); + CenterOnParent(); visible = true; } diff --git a/lua51/src/loadlib.c b/lua51/src/loadlib.c index 905028be7..9137327f5 100644 --- a/lua51/src/loadlib.c +++ b/lua51/src/loadlib.c @@ -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); }