diff options
Diffstat (limited to 'src/apps/mplayerc')
31 files changed, 665 insertions, 344 deletions
diff --git a/src/apps/mplayerc/Changelog.txt b/src/apps/mplayerc/Changelog.txt index bb34f3dee..9db31df54 100644 --- a/src/apps/mplayerc/Changelog.txt +++ b/src/apps/mplayerc/Changelog.txt @@ -12,10 +12,11 @@ v1.5.xxxx.0 - unreleased CHANGED: Updated FFmpeg
CHANGED: Updated MediaInfoLib to v0.7.36 Beta
CHANGED: Updated ZenLib to v0.4.16 Beta
- CHANGED: Updated Little CMS to v2.1(alpha1) - 09172010
+ CHANGED: Updated Little CMS to v2.1(alpha1) - 09282010
CHANGED: Updated libpng to v1.4.4
CHANGED: Cleaned up and optimized code for QT PCM, small corrections in MP4Splitter
FIXED : Ticket #52, [playlist] shuffle is broken
+ FIXED : Ticket #293, giving "remember last window size" a meaning
FIXED : Ticket #564, EVR Sync enabled when it shouldn't be
FIXED : Ticket #627, Don't create the "AppData\Roaming\Media Player Classic"
folder if the "Remember items" in playlist is disabled
@@ -23,14 +24,17 @@ v1.5.xxxx.0 - unreleased FIXED : Ticket #647, Weird "keys" listed
FIXED : Ticket #651, Make EVR CP stats graph smaller
FIXED : Ticket #652, Escape key on certain form causes form to collapse
+ FIXED : Ticket #678, Remember last window size NOT working and mpc-hc.ini
FIXED : Ticket #698, VMR-9 (Renderless) + pixel shaders crashes
FIXED : Ticket #699, fix EAC3 mediatype and string
+ FIXED : Ticket #712, Audio renderer menu problem with Haali splitter after r2339
FIXED : Ticket #724, Frequency range and bandwidth value are currently
not taken into account when doing a scan
FIXED : Ticket #753, DVB-T, internal MPEG-2 filter & wrong aspect ratio
FIXED : Ticket #778, Playlist interface problem
FIXED : Ticket #782, VMR-7 & 9 filter names misspelled
FIXED : Ticket #791, Change the cursor behavior
+ FIXED : Ticket #796, MPC HC window doesn't stay snapped to desktop corners
FIXED : Ticket #809, Resize-arrows no longer appear with caption hidden
diff --git a/src/apps/mplayerc/FGFilter.cpp b/src/apps/mplayerc/FGFilter.cpp index c21196da2..3c44dfa66 100644 --- a/src/apps/mplayerc/FGFilter.cpp +++ b/src/apps/mplayerc/FGFilter.cpp @@ -77,13 +77,13 @@ bool CFGFilter::CheckTypes(const CAtlArray<GUID>& types, bool fExactMatch) if(fExactMatch)
{
if(majortype == types[i] && majortype != GUID_NULL
- && subtype == types[i+1] && subtype != GUID_NULL)
+ && subtype == types[i+1] && subtype != GUID_NULL)
return true;
}
else
{
if((majortype == GUID_NULL || types[i] == GUID_NULL || majortype == types[i])
- && (subtype == GUID_NULL || types[i+1] == GUID_NULL || subtype == types[i+1]))
+ && (subtype == GUID_NULL || types[i+1] == GUID_NULL || subtype == types[i+1]))
return true;
}
}
@@ -306,7 +306,7 @@ void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len) BYTE* ptr = NULL;
if(SUCCEEDED(pFD.CoCreateInstance(CLSID_FilterMapper2))
- && SUCCEEDED(pFD->ParseFilterData(p, len, (BYTE**)&ptr)))
+ && SUCCEEDED(pFD->ParseFilterData(p, len, (BYTE**)&ptr)))
{
REGFILTER2* prf = (REGFILTER2*)*(WPARAM*)ptr; // this is f*cked up
@@ -412,7 +412,7 @@ void CFGFilterRegistry::ExtractFilterData(BYTE* p, UINT len) ChkLen(8)
if(*(DWORD*)p < (p-base+8) || *(DWORD*)p >= len
- || *(DWORD*)(p+4) < (p-base+8) || *(DWORD*)(p+4) >= len)
+ || *(DWORD*)(p+4) < (p-base+8) || *(DWORD*)(p+4) >= len)
{
p += 8;
continue;
@@ -468,17 +468,17 @@ HRESULT CFGFilterVideoRenderer::Create(IBaseFilter** ppBF, CInterfaceList<IUnkno CComPtr<ISubPicAllocatorPresenter> pCAP;
if(m_clsid == CLSID_VMR7AllocatorPresenter
- || m_clsid == CLSID_VMR9AllocatorPresenter
- || m_clsid == CLSID_DXRAllocatorPresenter
- || m_clsid == CLSID_madVRAllocatorPresenter
- || m_clsid == CLSID_EVRAllocatorPresenter
- || m_clsid == CLSID_SyncAllocatorPresenter)
+ || m_clsid == CLSID_VMR9AllocatorPresenter
+ || m_clsid == CLSID_DXRAllocatorPresenter
+ || m_clsid == CLSID_madVRAllocatorPresenter
+ || m_clsid == CLSID_EVRAllocatorPresenter
+ || m_clsid == CLSID_SyncAllocatorPresenter)
{
bool bFullscreen = (AfxGetApp()->m_pMainWnd != NULL) && (((CMainFrame*)AfxGetApp()->m_pMainWnd)->IsD3DFullScreenMode());
if(SUCCEEDED(CreateAP7(m_clsid, m_hWnd, &pCAP))
- || SUCCEEDED(CreateAP9(m_clsid, m_hWnd, bFullscreen, &pCAP))
- || SUCCEEDED(CreateEVR(m_clsid, m_hWnd, bFullscreen, &pCAP))
- || SUCCEEDED(CreateSyncRenderer(m_clsid, m_hWnd, bFullscreen, &pCAP)))
+ || SUCCEEDED(CreateAP9(m_clsid, m_hWnd, bFullscreen, &pCAP))
+ || SUCCEEDED(CreateEVR(m_clsid, m_hWnd, bFullscreen, &pCAP))
+ || SUCCEEDED(CreateSyncRenderer(m_clsid, m_hWnd, bFullscreen, &pCAP)))
{
CComPtr<IUnknown> pRenderer;
if(SUCCEEDED(hr = pCAP->CreateRenderer(&pRenderer)))
@@ -550,7 +550,7 @@ void CFGFilterList::Insert(CFGFilter* pFGF, int group, bool exactmatch, bool aut if(CFGFilterRegistry* f2r = dynamic_cast<CFGFilterRegistry*>(f2.pFGF))
{
if(f1r->GetMoniker() && f2r->GetMoniker() && S_OK == f1r->GetMoniker()->IsEqual(f2r->GetMoniker())
- || f1r->GetCLSID() != GUID_NULL && f1r->GetCLSID() == f2r->GetCLSID())
+ || f1r->GetCLSID() != GUID_NULL && f1r->GetCLSID() == f2r->GetCLSID())
{
TRACE(_T("FGM: Inserting %d %d %016I64x '%s' NOT!\n"),
group, exactmatch, pFGF->GetMerit(),
diff --git a/src/apps/mplayerc/FakeFilterMapper2.cpp b/src/apps/mplayerc/FakeFilterMapper2.cpp index 7cc958483..2c9c43bba 100644 --- a/src/apps/mplayerc/FakeFilterMapper2.cpp +++ b/src/apps/mplayerc/FakeFilterMapper2.cpp @@ -272,8 +272,8 @@ HRESULT WINAPI Mine_CoCreateInstance(IN REFCLSID rclsid, IN LPUNKNOWN pUnkOuter, */
if(!pUnkOuter)
if(rclsid == CLSID_VideoMixingRenderer || rclsid == CLSID_VideoMixingRenderer9
- || rclsid == CLSID_VideoRenderer || rclsid == CLSID_VideoRendererDefault
- || rclsid == CLSID_OverlayMixer)// || rclsid == CLSID_OverlayMixer2 - where is this declared?)
+ || rclsid == CLSID_VideoRenderer || rclsid == CLSID_VideoRendererDefault
+ || rclsid == CLSID_OverlayMixer)// || rclsid == CLSID_OverlayMixer2 - where is this declared?)
{
CMacrovisionKicker* pMK = DNew CMacrovisionKicker(NAME("CMacrovisionKicker"), NULL);
CComPtr<IUnknown> pUnk = (IUnknown*)(INonDelegatingUnknown*)pMK;
diff --git a/src/apps/mplayerc/FloatEdit.cpp b/src/apps/mplayerc/FloatEdit.cpp index 3c3d29656..4f4ca6326 100644 --- a/src/apps/mplayerc/FloatEdit.cpp +++ b/src/apps/mplayerc/FloatEdit.cpp @@ -141,7 +141,7 @@ END_MESSAGE_MAP() void CHexEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(!(nChar >= 'A' && nChar <= 'F' || nChar >= 'a' && nChar <= 'f'
- || nChar >= '0' && nChar <= '9' || nChar == '\b'))
+ || nChar >= '0' && nChar <= '9' || nChar == '\b'))
return;
CString str;
diff --git a/src/apps/mplayerc/MainFrm.cpp b/src/apps/mplayerc/MainFrm.cpp index 7b0e93309..4aad24334 100644 --- a/src/apps/mplayerc/MainFrm.cpp +++ b/src/apps/mplayerc/MainFrm.cpp @@ -4505,8 +4505,6 @@ void CMainFrame::OnFileReopen() OpenCurPlaylistItem();
}
-void RecurseAddDir(CString path, CAtlList<CString>* sl);
-
void CMainFrame::OnDropFiles(HDROP hDropInfo)
{
SetForegroundWindow();
@@ -9225,10 +9223,19 @@ static BOOL CALLBACK MonitorEnumProc(HMONITOR hMonitor, HDC hdcMonitor, LPRECT l void CMainFrame::SetDefaultWindowRect(int iMonitor)
{
AppSettings& s = AfxGetAppSettings();
+ int w, h, x, y;
+ if(s.HasFixedWindowSize())
{
- boolean m_center = true;
-
+ w = s.fixedWindowSize.cx;
+ h = s.fixedWindowSize.cy;
+ }
+ else if(s.fRememberWindowSize)
+ {
+ w = s.rcLastWindowPos.Width();
+ h = s.rcLastWindowPos.Height();
+ }
+ else {
CRect r1, r2;
GetClientRect(&r1);
m_wndView.GetClientRect(&r2);
@@ -9242,32 +9249,24 @@ void CMainFrame::SetDefaultWindowRect(int iMonitor) DWORD style = GetStyle();
- MENUBARINFO mbi;
- memset(&mbi, 0, sizeof(mbi));
- mbi.cbSize = sizeof(mbi);
- ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi);
-
- int w = _DEFCLIENTW + ((style&WS_THICKFRAME) ? GetSystemMetrics(SM_CXSIZEFRAME)*2 : 0)
- + r1.Width() - r2.Width();
- int h = _DEFCLIENTH + ((style&WS_THICKFRAME) ? GetSystemMetrics(SM_CYSIZEFRAME)*2 : 0)
- + (mbi.rcBar.bottom - mbi.rcBar.top)
- + r1.Height() - r2.Height()
- + 1; // ???
-// + 2; // ???
- if(style&WS_CAPTION) h += GetSystemMetrics(SM_CYCAPTION);
+ w = _DEFCLIENTW + ((style&WS_THICKFRAME) ? GetSystemMetrics(SM_CXSIZEFRAME)*2 : 0)
+ + r1.Width() - r2.Width();
+ h = _DEFCLIENTH + ((style&WS_THICKFRAME) ? GetSystemMetrics(SM_CYSIZEFRAME)*2 : 0)
+ + r1.Height() - r2.Height();
- if(s.HasFixedWindowSize())
- {
- w = s.fixedWindowSize.cx;
- h = s.fixedWindowSize.cy;
- }
- else if(s.fRememberWindowSize)
- {
- w = s.rcLastWindowPos.Width();
- h = s.rcLastWindowPos.Height();
- m_center = false;
+ if(style&WS_CAPTION) {
+ h += GetSystemMetrics(SM_CYCAPTION); // if we have caption then we have menu too
+ h += GetSystemMetrics(SM_CYMENU);
}
+ }
+ if(s.fRememberWindowPos)
+ {
+ x = s.rcLastWindowPos.TopLeft().x;
+ y = s.rcLastWindowPos.TopLeft().y;
+ }
+ else
+ {
HMONITOR hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
if(iMonitor > 0)
@@ -9282,48 +9281,31 @@ void CMainFrame::SetDefaultWindowRect(int iMonitor) mi.cbSize = sizeof(MONITORINFO);
GetMonitorInfo(hMonitor, &mi);
- int x = (mi.rcWork.left+mi.rcWork.right-w)/2;
- int y = (mi.rcWork.top+mi.rcWork.bottom-h)/2;
-
- if(s.fRememberWindowPos)
- {
- CRect r = s.rcLastWindowPos;
-// x = r.CenterPoint().x - w/2;
-// y = r.CenterPoint().y - h/2;
- x = r.TopLeft().x;
- y = r.TopLeft().y;
- m_center = false;
- }
-
- UINT lastWindowType = s.lastWindowType;
-
- MoveWindow(x, y, w, h);
+ x = (mi.rcWork.left+mi.rcWork.right-w)/2; // Center main window
+ y = (mi.rcWork.top+mi.rcWork.bottom-h)/2; // no need to call CenterWindow()
+ }
- // Center main window ...
- if(m_center) CenterWindow();
+ UINT lastWindowType = s.lastWindowType;
+ MoveWindow(x, y, w, h);
- // Waffs : fullscreen command line
- if(!(s.nCLSwitches&CLSW_ADD) && (s.nCLSwitches&CLSW_FULLSCREEN) && !s.slFiles.IsEmpty())
- {
- ToggleFullscreen(true, true);
- SetCursor(NULL);
- AfxGetAppSettings().nCLSwitches &= ~CLSW_FULLSCREEN;
- m_fFirstFSAfterLaunchOnFS = true;
- }
+ // Waffs : fullscreen command line
+ if(!(s.nCLSwitches&CLSW_ADD) && (s.nCLSwitches&CLSW_FULLSCREEN) && !s.slFiles.IsEmpty())
+ {
+ ToggleFullscreen(true, true);
+ SetCursor(NULL);
+ AfxGetAppSettings().nCLSwitches &= ~CLSW_FULLSCREEN;
+ m_fFirstFSAfterLaunchOnFS = true;
+ }
- if(s.fRememberWindowSize && s.fRememberWindowPos)
- {
- WINDOWPLACEMENT wp;
- memset(&wp, 0, sizeof(wp));
- wp.length = sizeof(WINDOWPLACEMENT);
- if(lastWindowType == SIZE_MAXIMIZED)
- ShowWindow(SW_MAXIMIZE);
- else if(lastWindowType == SIZE_MINIMIZED)
- ShowWindow(SW_MINIMIZE);
+ if(s.fRememberWindowSize && s.fRememberWindowPos)
+ {
+ if(lastWindowType == SIZE_MAXIMIZED)
+ ShowWindow(SW_MAXIMIZE);
+ else if(lastWindowType == SIZE_MINIMIZED)
+ ShowWindow(SW_MINIMIZE);
- // Casimir666 : if fullscreen was on, put it on back
- if (!m_fFullScreen && s.fLastFullScreen) ToggleFullscreen(true, true);
- }
+ // Casimir666 : if fullscreen was on, put it on back
+ if (!m_fFullScreen && s.fLastFullScreen) ToggleFullscreen(true, true);
}
if(s.fHideCaptionMenu)
@@ -9344,53 +9326,51 @@ void CMainFrame::RestoreDefaultWindowRect() // && (GetExStyle()&WS_EX_APPWINDOW)
&& !s.fRememberWindowSize)
{
- CRect r1, r2;
- GetClientRect(&r1);
- m_wndView.GetClientRect(&r2);
-
- CSize logosize = m_wndView.GetLogoSize();
- int _DEFCLIENTW = max(logosize.cx, DEFCLIENTW);
- int _DEFCLIENTH = max(logosize.cy, DEFCLIENTH);
-
- DWORD style = GetStyle();
-
- MENUBARINFO mbi;
- memset(&mbi, 0, sizeof(mbi));
- mbi.cbSize = sizeof(mbi);
- ::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi);
-
- int w = _DEFCLIENTW + ((style&WS_THICKFRAME) ? GetSystemMetrics(SM_CXSIZEFRAME)*2 : 0)
- + r1.Width() - r2.Width();
- int h = _DEFCLIENTH + ((style&WS_THICKFRAME) ? GetSystemMetrics(SM_CYSIZEFRAME)*2 : 0)
- + (mbi.rcBar.bottom - mbi.rcBar.top)
- + r1.Height() - r2.Height()
- + 1; // ???
-// + 2; // ???
- if(style&WS_CAPTION) h += GetSystemMetrics(SM_CYCAPTION);
+ int x, y, w, h;
if(s.HasFixedWindowSize())
{
w = s.fixedWindowSize.cx;
h = s.fixedWindowSize.cy;
}
+ else
+ {
+ CRect r1, r2;
+ GetClientRect(&r1);
+ m_wndView.GetClientRect(&r2);
- CRect r;
- GetWindowRect(r);
+ CSize logosize = m_wndView.GetLogoSize();
+ int _DEFCLIENTW = max(logosize.cx, DEFCLIENTW);
+ int _DEFCLIENTH = max(logosize.cy, DEFCLIENTH);
- int x = r.CenterPoint().x - w/2;
- int y = r.CenterPoint().y - h/2;
+ DWORD style = GetStyle();
+ w = _DEFCLIENTW + ((style&WS_THICKFRAME) ? GetSystemMetrics(SM_CXSIZEFRAME)*2 : 0)
+ + r1.Width() - r2.Width();
+ h = _DEFCLIENTH + ((style&WS_THICKFRAME) ? GetSystemMetrics(SM_CYSIZEFRAME)*2 : 0)
+ + r1.Height() - r2.Height();
+
+ if(style&WS_CAPTION)
+ {
+ h += GetSystemMetrics(SM_CYCAPTION);
+ h += GetSystemMetrics(SM_CYMENU);
+ }
+ }
if(s.fRememberWindowPos)
{
- CRect r = s.rcLastWindowPos;
+ x = s.rcLastWindowPos.TopLeft().x;
+ y = s.rcLastWindowPos.TopLeft().y;
+ }
+ else
+ {
+ CRect r;
+ GetWindowRect(r);
- x = r.TopLeft().x;
- y = r.TopLeft().y;
+ x = r.CenterPoint().x - w/2; // Center window here
+ y = r.CenterPoint().y - h/2; // no need to call CenterWindow()
}
MoveWindow(x, y, w, h);
-
- if(!s.fRememberWindowPos) CenterWindow();
}
}
@@ -9407,6 +9387,7 @@ void CMainFrame::SetPlaybackMode(int iNewStatus) if (m_wndNavigationBar.IsWindowVisible() && GetPlaybackMode() != PM_CAPTURE)
ShowControlBar(&m_wndNavigationBar, !m_wndNavigationBar.IsWindowVisible(), TRUE);
}
+
CSize CMainFrame::GetVideoSize()
{
bool fKeepAspectRatio = AfxGetAppSettings().fKeepAspectRatio;
@@ -9493,7 +9474,7 @@ void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasT HMONITOR hm_cur = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
CMonitors monitors;
- bool m_PlayListBarVisible = false;
+ static bool m_PlayListBarVisible = false;
if(!m_fFullScreen)
{
@@ -9557,7 +9538,7 @@ void CMainFrame::ToggleFullscreen(bool fToNearest, bool fSwitchScreenResWhenHasT ModifyStyleEx(dwRemoveEx, dwAddEx, SWP_NOZORDER);
::SetMenu(m_hWnd, hMenu);
- bool m_Change_Monitor = false;
+ static bool m_Change_Monitor = false;
// try disable shader when move from one monitor to other ...
if(m_fFullScreen)
{
@@ -9931,6 +9912,7 @@ void CMainFrame::ZoomVideoWindow(double scale) OnGetMinMaxInfo(&mmi);
CRect r;
+ GetWindowRect(r);
int w = 0, h = 0;
if(!m_fAudioOnly)
@@ -9950,14 +9932,7 @@ void CMainFrame::ZoomVideoWindow(double scale) + r1.Width() - r2.Width()
+ lWidth;
- // This doesn't give correct menu pixel size
- //MENUBARINFO mbi;
- //memset(&mbi, 0, sizeof(mbi));
- //mbi.cbSize = sizeof(mbi);
- //::GetMenuBarInfo(m_hWnd, OBJID_MENU, 0, &mbi);
-
h = ((style&WS_THICKFRAME) ? GetSystemMetrics(SM_CYSIZEFRAME)*2 : 0)
- //+ (mbi.rcBar.bottom - mbi.rcBar.top)
+ r1.Height() - r2.Height()
+ lHeight;
@@ -9966,20 +9941,13 @@ void CMainFrame::ZoomVideoWindow(double scale) h += GetSystemMetrics( SM_CYCAPTION );
// If we have a caption then we have a menu bar
h += GetSystemMetrics( SM_CYMENU );
- // Do not use magic values please !
- //w += 2; h += 2; // for the 1 pixel wide sunken frame
- //w += 2; h += 3; // for the inner black border
}
- GetWindowRect(r);
-
w = max(w, mmi.ptMinTrackSize.x);
h = max(h, mmi.ptMinTrackSize.y);
}
else
{
- GetWindowRect(r);
-
w = r.Width(); // mmi.ptMinTrackSize.x;
h = mmi.ptMinTrackSize.y;
}
@@ -9991,22 +9959,40 @@ void CMainFrame::ZoomVideoWindow(double scale) w = min(w, (mi.rcWork.right - mi.rcWork.left));
h = min(h, (mi.rcWork.bottom - mi.rcWork.top));
- // center window
if(!s.fRememberWindowPos)
{
- CPoint cp = r.CenterPoint();
- r.left = cp.x - w/2;
- r.top = cp.y - h/2;
+ bool isSnapped = false;
+
+ if(s.fSnapToDesktopEdges) { // check if snapped to edges
+ isSnapped = (r.left == mi.rcWork.left) || (r.top == mi.rcWork.top)
+ || (r.right == mi.rcWork.right) || (r.bottom == mi.rcWork.bottom);
+ }
+
+ if(isSnapped) // prefer left, top snap to right, bottom snap
+ {
+ if(r.left == mi.rcWork.left) {}
+ else if(r.right == mi.rcWork.right)
+ {
+ r.left = r.right - w;
+ }
+
+ if(r.top == mi.rcWork.top) {}
+ else if(r.bottom == mi.rcWork.bottom)
+ {
+ r.top = r.bottom - h;
+ }
+ }
+ else // center window
+ {
+ CPoint cp = r.CenterPoint();
+ r.left = cp.x - w/2;
+ r.top = cp.y - h/2;
+ }
}
r.right = r.left + w;
r.bottom = r.top + h;
- /*
- MONITORINFO mi;
- mi.cbSize = sizeof(MONITORINFO);
- GetMonitorInfo(MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST), &mi);
- */
if(r.right > mi.rcWork.right) r.OffsetRect(mi.rcWork.right-r.right, 0);
if(r.left < mi.rcWork.left) r.OffsetRect(mi.rcWork.left-r.left, 0);
if(r.bottom > mi.rcWork.bottom) r.OffsetRect(0, mi.rcWork.bottom-r.bottom);
diff --git a/src/apps/mplayerc/PPageAccelTbl.cpp b/src/apps/mplayerc/PPageAccelTbl.cpp index b93a64c02..c4f865ac1 100644 --- a/src/apps/mplayerc/PPageAccelTbl.cpp +++ b/src/apps/mplayerc/PPageAccelTbl.cpp @@ -134,7 +134,7 @@ CPPageAccelTbl::~CPPageAccelTbl() BOOL CPPageAccelTbl::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN
- && (pMsg->hwnd == m_WinLircEdit.m_hWnd || pMsg->hwnd == m_UIceEdit.m_hWnd))
+ && (pMsg->hwnd == m_WinLircEdit.m_hWnd || pMsg->hwnd == m_UIceEdit.m_hWnd))
{
OnApply();
return TRUE;
@@ -1584,8 +1584,8 @@ void CPPageAccelTbl::OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) return;
if(pItem->iSubItem == COL_MOD || pItem->iSubItem == COL_KEY || pItem->iSubItem == COL_TYPE
- || pItem->iSubItem == COL_MOUSE || pItem->iSubItem == COL_APPCMD
- || pItem->iSubItem == COL_RMCMD || pItem->iSubItem == COL_RMREPCNT)
+ || pItem->iSubItem == COL_MOUSE || pItem->iSubItem == COL_APPCMD
+ || pItem->iSubItem == COL_RMCMD || pItem->iSubItem == COL_RMREPCNT)
{
*pResult = TRUE;
}
diff --git a/src/apps/mplayerc/PPageBase.cpp b/src/apps/mplayerc/PPageBase.cpp index 0765f465a..12b0409f3 100644 --- a/src/apps/mplayerc/PPageBase.cpp +++ b/src/apps/mplayerc/PPageBase.cpp @@ -65,8 +65,8 @@ BOOL CPPageBase::PreTranslateMessage(MSG* pMsg) MSG msg;
memcpy(&msg, pMsg, sizeof(MSG));
for(HWND hWndParent = ::GetParent(msg.hwnd);
- hWndParent && hWndParent != m_hWnd;
- hWndParent = ::GetParent(hWndParent))
+ hWndParent && hWndParent != m_hWnd;
+ hWndParent = ::GetParent(hWndParent))
{
msg.hwnd = hWndParent;
}
diff --git a/src/apps/mplayerc/PPageFileInfoDetails.cpp b/src/apps/mplayerc/PPageFileInfoDetails.cpp index 5d43cac24..35e5f19fd 100644 --- a/src/apps/mplayerc/PPageFileInfoDetails.cpp +++ b/src/apps/mplayerc/PPageFileInfoDetails.cpp @@ -309,7 +309,7 @@ void CPPageFileInfoDetails::InitEncoding() CMediaTypeEx mt;
PIN_DIRECTION dir;
if(FAILED(pPin->QueryDirection(&dir)) || dir != PINDIR_OUTPUT
- || FAILED(pPin->ConnectionMediaType(&mt)))
+ || FAILED(pPin->ConnectionMediaType(&mt)))
continue;
CString str = mt.ToString();
diff --git a/src/apps/mplayerc/PPageFileMediaInfo.cpp b/src/apps/mplayerc/PPageFileMediaInfo.cpp index 085a047fe..89621ab55 100644 --- a/src/apps/mplayerc/PPageFileMediaInfo.cpp +++ b/src/apps/mplayerc/PPageFileMediaInfo.cpp @@ -70,7 +70,7 @@ static LRESULT CALLBACK ControlProc(HWND control, UINT message, WPARAM wParam, L {
if(message == WM_KEYDOWN) {
if ((LOWORD(wParam)== 'A' || LOWORD(wParam) == 'a')
- &&(GetKeyState(VK_CONTROL) < 0)) {
+ &&(GetKeyState(VK_CONTROL) < 0)) {
CEdit *pEdit = (CEdit*)CWnd::FromHandle(control);
pEdit->SetSel(0, pEdit->GetWindowTextLength(), TRUE);
return 0;
diff --git a/src/apps/mplayerc/PPageFormats.cpp b/src/apps/mplayerc/PPageFormats.cpp index 15ca29065..06b8094be 100644 --- a/src/apps/mplayerc/PPageFormats.cpp +++ b/src/apps/mplayerc/PPageFormats.cpp @@ -834,7 +834,7 @@ void CPPageFormats::OnLvnItemchangedList1(NMHDR *pNMHDR, LRESULT *pResult) LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);
if(pNMLV->iItem >= 0 && pNMLV->iSubItem == COL_CATEGORY
- && (pNMLV->uChanged&LVIF_STATE) && (pNMLV->uNewState&LVIS_SELECTED))
+ && (pNMLV->uChanged&LVIF_STATE) && (pNMLV->uNewState&LVIS_SELECTED))
{
m_exts = AfxGetAppSettings().Formats[(int)m_list.GetItemData(pNMLV->iItem)].GetExtsWithPeriod();
UpdateData(FALSE);
diff --git a/src/apps/mplayerc/PPageFullscreen.cpp b/src/apps/mplayerc/PPageFullscreen.cpp index 6daba5f95..dcd759229 100644 --- a/src/apps/mplayerc/PPageFullscreen.cpp +++ b/src/apps/mplayerc/PPageFullscreen.cpp @@ -301,17 +301,17 @@ void CPPageFullscreen::ModesUpdate() m_dispmode29d97combo.AddString(str);
if(iSel_24 < 0 && dmtoset24.fValid && dm.size == dmtoset24.size
- && dm.bpp == dmtoset24.bpp && dm.freq == dmtoset24.freq) iSel_24 = j;
+ && dm.bpp == dmtoset24.bpp && dm.freq == dmtoset24.freq) iSel_24 = j;
if(iSel_25 < 0 && dmtoset25.fValid && dm.size == dmtoset25.size
- && dm.bpp == dmtoset25.bpp && dm.freq == dmtoset25.freq) iSel_25 = j;
+ && dm.bpp == dmtoset25.bpp && dm.freq == dmtoset25.freq) iSel_25 = j;
if(iSel_30 < 0 && dmtoset30.fValid && dm.size == dmtoset30.size
- && dm.bpp == dmtoset30.bpp && dm.freq == dmtoset30.freq) iSel_30 = j;
+ && dm.bpp == dmtoset30.bpp && dm.freq == dmtoset30.freq) iSel_30 = j;
if(iSel_Other < 0 && dmtosetOther.fValid && dm.size == dmtosetOther.size
- && dm.bpp == dmtosetOther.bpp && dm.freq == dmtosetOther.freq) iSel_Other = j;
+ && dm.bpp == dmtosetOther.bpp && dm.freq == dmtosetOther.freq) iSel_Other = j;
if(iSel_23 < 0 && dmtoset23.fValid && dm.size == dmtoset23.size
- && dm.bpp == dmtoset23.bpp && dm.freq == dmtoset23.freq) iSel_23 = j;
+ && dm.bpp == dmtoset23.bpp && dm.freq == dmtoset23.freq) iSel_23 = j;
if(iSel_29 < 0 && dmtoset29.fValid && dm.size == dmtoset29.size
- && dm.bpp == dmtoset29.bpp && dm.freq == dmtoset29.freq) iSel_29 = j;
+ && dm.bpp == dmtoset29.bpp && dm.freq == dmtoset29.freq) iSel_29 = j;
j++;
}
m_dispmode24combo.SetCurSel(iSel_24);
diff --git a/src/apps/mplayerc/PPagePlayback.cpp b/src/apps/mplayerc/PPagePlayback.cpp index cdacd0a2b..ca1f25c9d 100644 --- a/src/apps/mplayerc/PPagePlayback.cpp +++ b/src/apps/mplayerc/PPagePlayback.cpp @@ -184,3 +184,21 @@ void CPPagePlayback::OnUpdateAutoZoomCombo(CCmdUI* pCmdUI) {
pCmdUI->Enable(!!IsDlgButtonChecked(IDC_CHECK5));
}
+
+BOOL CPPagePlayback::OnSetActive()
+{
+ AppSettings& s = AfxGetAppSettings();
+ m_iRememberZoomLevel = !!s.fRememberZoomLevel;
+ UpdateData(FALSE);
+
+ return __super::OnSetActive();
+}
+
+BOOL CPPagePlayback::OnKillActive()
+{
+ AppSettings& s = AfxGetAppSettings();
+ if(s.fRememberZoomLevel)
+ s.fRememberWindowSize = false;
+
+ return __super::OnKillActive();
+}
\ No newline at end of file diff --git a/src/apps/mplayerc/PPagePlayback.h b/src/apps/mplayerc/PPagePlayback.h index 4bb147491..4232d3140 100644 --- a/src/apps/mplayerc/PPagePlayback.h +++ b/src/apps/mplayerc/PPagePlayback.h @@ -62,6 +62,8 @@ public: protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog();
+ virtual BOOL OnSetActive();
+ virtual BOOL OnKillActive();
virtual BOOL OnApply();
virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
diff --git a/src/apps/mplayerc/PPagePlayer.cpp b/src/apps/mplayerc/PPagePlayer.cpp index 22baa4afc..a64e6b202 100644 --- a/src/apps/mplayerc/PPagePlayer.cpp +++ b/src/apps/mplayerc/PPagePlayer.cpp @@ -180,3 +180,21 @@ void CPPagePlayer::OnUpdatePos(CCmdUI* pCmdUI) pCmdUI->Enable( !!m_fKeepHistory );
}
+
+BOOL CPPagePlayer::OnSetActive()
+{
+ AppSettings& s = AfxGetAppSettings();
+ m_fRememberWindowSize = !!s.fRememberWindowSize;
+ UpdateData(FALSE);
+
+ return __super::OnSetActive();
+}
+
+BOOL CPPagePlayer::OnKillActive()
+{
+ AppSettings& s = AfxGetAppSettings();
+ if(s.fRememberWindowSize)
+ s.fRememberZoomLevel = false;
+
+ return __super::OnKillActive();
+}
\ No newline at end of file diff --git a/src/apps/mplayerc/PPagePlayer.h b/src/apps/mplayerc/PPagePlayer.h index dd1f77ee0..475060b8e 100644 --- a/src/apps/mplayerc/PPagePlayer.h +++ b/src/apps/mplayerc/PPagePlayer.h @@ -59,6 +59,8 @@ public: protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnInitDialog();
+ virtual BOOL OnSetActive();
+ virtual BOOL OnKillActive();
virtual BOOL OnApply();
DECLARE_MESSAGE_MAP()
diff --git a/src/apps/mplayerc/PlayerCaptureDialog.cpp b/src/apps/mplayerc/PlayerCaptureDialog.cpp index e0362bbf3..b9a35af7e 100644 --- a/src/apps/mplayerc/PlayerCaptureDialog.cpp +++ b/src/apps/mplayerc/PlayerCaptureDialog.cpp @@ -195,7 +195,7 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo int iCount = 0, iSize;
if(SUCCEEDED(pAMSC->GetNumberOfCapabilities(&iCount, &iSize))
- && iSize == sizeof(T) && iCount > 0)
+ && iSize == sizeof(T) && iCount > 0)
{
for(int i = 0; i < iCount; i++)
{
@@ -216,7 +216,7 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo CFormatElem<T>* pfe = tfa[i]->GetAt(0);
if(pfe->mt.formattype != FORMAT_VideoInfo
- && pfe->mt.formattype != FORMAT_VideoInfo2)
+ && pfe->mt.formattype != FORMAT_VideoInfo2)
continue;
static SIZE presets[] =
@@ -242,13 +242,13 @@ static void SetupMediaTypes(IAMStreamConfig* pAMSC, CFormatArray<T>& tfa, CCombo for(int j = 0; j < countof(presets); j++)
{
if(presets[j].cx == bihCur.biWidth
- && presets[j].cy == abs(bihCur.biHeight)
- || presets[j].cx < pcaps->MinOutputSize.cx
- || presets[j].cx > pcaps->MaxOutputSize.cx
- || presets[j].cy < pcaps->MinOutputSize.cy
- || presets[j].cy > pcaps->MaxOutputSize.cy
- || presets[j].cx % pcaps->OutputGranularityX
- || presets[j].cy % pcaps->OutputGranularityY)
+ && presets[j].cy == abs(bihCur.biHeight)
+ || presets[j].cx < pcaps->MinOutputSize.cx
+ || presets[j].cx > pcaps->MaxOutputSize.cx
+ || presets[j].cy < pcaps->MinOutputSize.cy
+ || presets[j].cy > pcaps->MaxOutputSize.cy
+ || presets[j].cx % pcaps->OutputGranularityX
+ || presets[j].cy % pcaps->OutputGranularityY)
continue;
CMediaType mt = pfe->mt;
diff --git a/src/apps/mplayerc/PlayerListCtrl.cpp b/src/apps/mplayerc/PlayerListCtrl.cpp index 4f9ad23fb..64ee33969 100644 --- a/src/apps/mplayerc/PlayerListCtrl.cpp +++ b/src/apps/mplayerc/PlayerListCtrl.cpp @@ -57,9 +57,9 @@ BOOL CInPlaceEdit::PreTranslateMessage(MSG* pMsg) if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_RETURN
- || pMsg->wParam == VK_DELETE
- || pMsg->wParam == VK_ESCAPE
- || GetKeyState(VK_CONTROL))
+ || pMsg->wParam == VK_DELETE
+ || pMsg->wParam == VK_ESCAPE
+ || GetKeyState(VK_CONTROL))
{
::TranslateMessage(pMsg);
::DispatchMessage(pMsg);
@@ -177,7 +177,7 @@ BOOL CInPlaceComboBox::PreTranslateMessage(MSG* pMsg) if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_RETURN
- || pMsg->wParam == VK_ESCAPE)
+ || pMsg->wParam == VK_ESCAPE)
{
::TranslateMessage(pMsg);
::DispatchMessage(pMsg);
@@ -285,7 +285,7 @@ BOOL CInPlaceListBox::PreTranslateMessage(MSG* pMsg) if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam == VK_RETURN
- || pMsg->wParam == VK_ESCAPE)
+ || pMsg->wParam == VK_ESCAPE)
{
::TranslateMessage(pMsg);
::DispatchMessage(pMsg);
@@ -858,14 +858,14 @@ BOOL CPlayerListCtrl::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult) UINT nID = pNMHDR->idFrom;
if(pNMHDR->code == TTN_NEEDTEXTA && (pTTTA->uFlags & TTF_IDISHWND)
- || pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))
+ || pNMHDR->code == TTN_NEEDTEXTW && (pTTTW->uFlags & TTF_IDISHWND))
{
// idFrom is actually the HWND of the tool
nID = ::GetDlgCtrlID((HWND)nID);
}
- if(nID == 0) // Notification in NT from automatically
- return FALSE; // created tooltip
+ if(nID == 0) // Notification in NT from automatically
+ return FALSE; // created tooltip
if(pNMHDR->code == TTN_NEEDTEXTA) pTTTA->lParam = (LPARAM)m_hWnd;
else if(pNMHDR->code == TTN_NEEDTEXTW) pTTTW->lParam = (LPARAM)m_hWnd;
diff --git a/src/apps/mplayerc/PlayerNavigationDialog.cpp b/src/apps/mplayerc/PlayerNavigationDialog.cpp index a1c6f03a5..282bd0da2 100644 --- a/src/apps/mplayerc/PlayerNavigationDialog.cpp +++ b/src/apps/mplayerc/PlayerNavigationDialog.cpp @@ -164,7 +164,7 @@ void CPlayerNavigationDialog::UpdateElementList() {
CDVBChannel& Channel = s.DVBChannels.GetNext(pos);
if ((m_bTVStations && (Channel.GetVideoPID() != 0)) ||
- (!m_bTVStations && (Channel.GetAudioCount() > 0)) && (Channel.GetVideoPID() == 0))
+ (!m_bTVStations && (Channel.GetAudioCount() > 0)) && (Channel.GetVideoPID() == 0))
{
nItem = m_ChannelList.AddString (Channel.GetName());
if (nItem < MAX_CHANNELS_ALLOWED)
diff --git a/src/apps/mplayerc/PlayerPlaylistBar.cpp b/src/apps/mplayerc/PlayerPlaylistBar.cpp index 9364bbafd..19dae4177 100644 --- a/src/apps/mplayerc/PlayerPlaylistBar.cpp +++ b/src/apps/mplayerc/PlayerPlaylistBar.cpp @@ -214,9 +214,9 @@ void CPlayerPlaylistBar::ResolveLinkFiles( CAtlList<CString> &fns ) CString& fn = fns.GetNext(pos);
TCHAR buff[_MAX_PATH];
if(CPath(fn).GetExtension().MakeLower() != _T(".lnk")
- || FAILED(pPF->Load(CStringW(fn), STGM_READ))
- || FAILED(pSL->Resolve(NULL, SLR_ANY_MATCH|SLR_NO_UI))
- || FAILED(pSL->GetPath(buff, countof(buff), NULL, 0)))
+ || FAILED(pPF->Load(CStringW(fn), STGM_READ))
+ || FAILED(pSL->Resolve(NULL, SLR_ANY_MATCH|SLR_NO_UI))
+ || FAILED(pSL->GetPath(buff, countof(buff), NULL, 0)))
continue;
fn = buff;
@@ -672,7 +672,7 @@ OpenMediaData* CPlayerPlaylistBar::GetCurOMD(REFERENCE_TIME rtStart) CString fn = CString(pli->m_fns.GetHead()).MakeLower();
if(fn.Find(_T("video_ts.ifo")) >= 0
- || fn.Find(_T(".ratdvd")) >= 0)
+ || fn.Find(_T(".ratdvd")) >= 0)
{
if(OpenDVDData* p = DNew OpenDVDData())
{
@@ -1175,7 +1175,7 @@ BOOL CPlayerPlaylistBar::OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResul TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
if((pNMHDR->code == TTN_NEEDTEXTA && (HWND)pTTTA->lParam != m_list.m_hWnd)
- || (pNMHDR->code == TTN_NEEDTEXTW && (HWND)pTTTW->lParam != m_list.m_hWnd))
+ || (pNMHDR->code == TTN_NEEDTEXTW && (HWND)pTTTW->lParam != m_list.m_hWnd))
return FALSE;
int row = ((pNMHDR->idFrom-1) >> 10) & 0x3fffff;
diff --git a/src/apps/mplayerc/PlayerSubresyncBar.cpp b/src/apps/mplayerc/PlayerSubresyncBar.cpp index e46470af7..1bcb250fd 100644 --- a/src/apps/mplayerc/PlayerSubresyncBar.cpp +++ b/src/apps/mplayerc/PlayerSubresyncBar.cpp @@ -591,10 +591,10 @@ static bool ParseTime(CString str, int& ret, bool fWarn = true) h = abs(h);
if(n == 7
- && 0 <= h && h < 24
- && 0 <= m && m < 60
- && 0 <= s && s < 60
- && 0 <= ms && ms < 1000)
+ && 0 <= h && h < 24
+ && 0 <= m && m < 60
+ && 0 <= s && s < 60
+ && 0 <= ms && ms < 1000)
{
ret = sign*(h*60*60*1000+m*60*1000+s*1000+ms);
return(true);
@@ -614,9 +614,9 @@ void CPlayerSubresyncBar::OnBeginlabeleditList(NMHDR* pNMHDR, LRESULT* pResult) if(pItem->iItem >= 0)
{
if((pItem->iSubItem == COL_START || pItem->iSubItem == COL_END || pItem->iSubItem == COL_TEXT
- || pItem->iSubItem == COL_STYLE || pItem->iSubItem == COL_LAYER
- || pItem->iSubItem == COL_ACTOR || pItem->iSubItem == COL_EFFECT)
- && m_mode == TEXTSUB)
+ || pItem->iSubItem == COL_STYLE || pItem->iSubItem == COL_LAYER
+ || pItem->iSubItem == COL_ACTOR || pItem->iSubItem == COL_EFFECT)
+ && m_mode == TEXTSUB)
{
*pResult = TRUE;
}
@@ -638,9 +638,9 @@ void CPlayerSubresyncBar::OnDolabeleditList(NMHDR* pNMHDR, LRESULT* pResult) if(pItem->iItem >= 0)
{
if((pItem->iSubItem == COL_START || pItem->iSubItem == COL_END || pItem->iSubItem == COL_TEXT
- || pItem->iSubItem == COL_STYLE || pItem->iSubItem == COL_LAYER
- || pItem->iSubItem == COL_ACTOR || pItem->iSubItem == COL_EFFECT)
- && m_mode == TEXTSUB)
+ || pItem->iSubItem == COL_STYLE || pItem->iSubItem == COL_LAYER
+ || pItem->iSubItem == COL_ACTOR || pItem->iSubItem == COL_EFFECT)
+ && m_mode == TEXTSUB)
{
m_list.ShowInPlaceEdit(pItem->iItem, pItem->iSubItem);
*pResult = TRUE;
@@ -1207,8 +1207,8 @@ void CPlayerSubresyncBar::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult) COLORREF clrTextBk;
if((pLVCD->iSubItem == COL_START || pLVCD->iSubItem == COL_END || pLVCD->iSubItem == COL_TEXT || pLVCD->iSubItem == COL_STYLE
- || pLVCD->iSubItem == COL_LAYER || pLVCD->iSubItem == COL_ACTOR || pLVCD->iSubItem == COL_EFFECT)
- && m_mode == TEXTSUB)
+ || pLVCD->iSubItem == COL_LAYER || pLVCD->iSubItem == COL_ACTOR || pLVCD->iSubItem == COL_EFFECT)
+ && m_mode == TEXTSUB)
{
clrText = 0;
}
diff --git a/src/apps/mplayerc/Playlist.cpp b/src/apps/mplayerc/Playlist.cpp index 3d49a2863..f659db5e7 100644 --- a/src/apps/mplayerc/Playlist.cpp +++ b/src/apps/mplayerc/Playlist.cpp @@ -171,7 +171,7 @@ void CPlaylistItem::AutoLoadFiles() CString fullpath = path + fd.cFileName;
CString ext2 = fullpath.Mid(fullpath.ReverseFind('.')+1).MakeLower();
if(!FindFileInList(m_fns, fullpath) && ext != ext2
- && mf.FindExt(ext2, true) && mf.IsUsingEngine(fullpath, DirectShow))
+ && mf.FindExt(ext2, true) && mf.IsUsingEngine(fullpath, DirectShow))
{
m_fns.AddTail(fullpath);
}
diff --git a/src/apps/mplayerc/ShaderEditorDlg.cpp b/src/apps/mplayerc/ShaderEditorDlg.cpp index 60d1b0a57..14f088b36 100644 --- a/src/apps/mplayerc/ShaderEditorDlg.cpp +++ b/src/apps/mplayerc/ShaderEditorDlg.cpp @@ -74,10 +74,10 @@ CShaderEdit::~CShaderEdit() BOOL CShaderEdit::PreTranslateMessage(MSG* pMsg)
{
if(m_acdlg.IsWindowVisible()
- && pMsg->message == WM_KEYDOWN
- && (pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN
- || pMsg->wParam == VK_PRIOR || pMsg->wParam == VK_NEXT
- || pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE))
+ && pMsg->message == WM_KEYDOWN
+ && (pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN
+ || pMsg->wParam == VK_PRIOR || pMsg->wParam == VK_NEXT
+ || pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE))
{
int i = m_acdlg.m_list.GetCurSel();
@@ -301,7 +301,7 @@ END_MESSAGE_MAP() BOOL CShaderEditorDlg::PreTranslateMessage(MSG* pMsg)
{
if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN
- && pMsg->hwnd == m_labels.m_edit.GetSafeHwnd())
+ && pMsg->hwnd == m_labels.m_edit.GetSafeHwnd())
{
OnCbnSelchangeCombo1();
diff --git a/src/apps/mplayerc/WebServer.cpp b/src/apps/mplayerc/WebServer.cpp index 98fc05478..90d24ebdf 100644 --- a/src/apps/mplayerc/WebServer.cpp +++ b/src/apps/mplayerc/WebServer.cpp @@ -102,7 +102,7 @@ CWebServer::CWebServer(CMainFrame* pMainFrame, int nPort) TCHAR ext[64];
ULONG len = countof(ext);
if(ERROR_SUCCESS == mime.Open(HKEY_CLASSES_ROOT, str + _T("\\") + buff, KEY_READ)
- && ERROR_SUCCESS == mime.QueryStringValue(_T("Extension"), ext, &len))
+ && ERROR_SUCCESS == mime.QueryStringValue(_T("Extension"), ext, &len))
m_mimes[CStringA(ext).MakeLower()] = CStringA(buff).MakeLower();
}
}
@@ -353,7 +353,7 @@ void CWebServer::OnRequest(CWebClientSocket* pClient, CStringA& hdr, CStringA& b CString redir;
if(pClient->m_get.Lookup(_T("redir"), redir)
- || pClient->m_post.Lookup(_T("redir"), redir))
+ || pClient->m_post.Lookup(_T("redir"), redir))
{
if(redir.IsEmpty()) redir = '/';
@@ -620,9 +620,9 @@ bool CWebServer::CallCGI(CWebClientSocket* pClient, CStringA& hdr, CStringA& bod if(hChildStdinRd && hChildStdoutWr)
if(CreateProcess(
- NULL, cmdln, NULL, NULL, TRUE, 0,
- envstr.GetLength() ? (LPVOID)(LPCSTR)envstr : NULL,
- dir, &siStartInfo, &piProcInfo))
+ NULL, cmdln, NULL, NULL, TRUE, 0,
+ envstr.GetLength() ? (LPVOID)(LPCSTR)envstr : NULL,
+ dir, &siStartInfo, &piProcInfo))
{
DWORD ThreadId;
CreateThread(NULL, 0, KillCGI, (LPVOID)piProcInfo.hProcess, 0, &ThreadId);
diff --git a/src/apps/mplayerc/mpcresources/common.pl b/src/apps/mplayerc/mpcresources/common.pl index 0df199035..d129cbaa8 100644 --- a/src/apps/mplayerc/mpcresources/common.pl +++ b/src/apps/mplayerc/mpcresources/common.pl @@ -30,7 +30,7 @@ use Data::Dumper; use vars qw(@InTags @TextTags $AdjustedDir);
-@InTags = qw(DIALOGEX MENU STRINGTABLE VERSIONINFO DLGINIT DESIGNINFO TOOLBAR);
+@InTags = qw(DIALOGEX MENU STRINGTABLE VERSIONINFO DIALOG DLGINIT TOOLBAR);
@TextTags = qw(BITMAP AVI ICON);
$AdjustedDir = q(..\\\\);
@@ -39,7 +39,7 @@ $AdjustedDir = q(..\\\\); ###################################################################################################
sub analyseData {
my ($input, $outline) = (shift, shift);
- my ($dialogs, $menus, $strings, $versionInfo) = @_;
+ my ($dialogs, $menus, $strings, $versionInfo, $designInfos) = @_;
my @inputs=();
push(@inputs, @{$input});
@@ -95,6 +95,11 @@ sub analyseData { push(@{$outline},["VERSIONINFO",[@blocks]]);
push(@$versionInfo, @blocks);
}
+ elsif($tagidx ==4)
+ {
+ my $dlgname = readDesignInfo($designInfos, \@blocks);
+ push(@{$outline},["DESIGNINFO",[$dlgname, ""]]);
+ }
elsif($tagidx < @InTags){
push(@{$outline},["BLOCK",[@blocks]]);
}
@@ -121,6 +126,7 @@ sub readDialog { my ($dialogs, $input) = @_;
my $dlgname;
+ my $fontname;
my $linenum = 0;
my @data=();
@@ -130,6 +136,11 @@ sub readDialog { $dlgname = $1;
next;
}
+ if(/\bFONT\b.*(".*")/) {
+ $fontname = $1;
+ $dialogs->{$dlgname}->{"__FONT__"} = [$linenum, $fontname];
+ next;
+ }
next if /^STYLE\b/;
next if /^BEGIN\b/;
next if /^END\b/;
@@ -208,6 +219,25 @@ sub readStringTable { }
#--------------------------------------------------------------------------------------------------
+sub readDesignInfo {
+ my ($designInfos, $input) = @_;
+
+ my $dlgname;
+ my @data=();
+
+ foreach(@$input){
+ if(/(ID\S+),\s*DIALOG\b/) {
+ $dlgname = $1;
+ last;
+ }
+ }
+ $designInfos->{$dlgname}->{"__TEXT__"}=[@$input];
+ $designInfos->{$dlgname}->{"__LINES__"} = $#$input + 1;
+
+ $dlgname;
+}
+
+#--------------------------------------------------------------------------------------------------
sub skipNonTranslatedStr {
my $line = shift;
@@ -347,4 +377,51 @@ sub lcs { }
}
+#--------------------------------------------------------------------------------------------------
+sub writePatchFile {
+ my ($output, $data, $withBOM) = @_;
+
+ my @localData = ();
+ foreach (@$data) {
+ if($_->[0] eq "DIALOG") {
+ my $lines = $_->[1]{"__LINES__"};
+ while (my($key, $value)=each(%{$_->[1]})) {
+ if($key eq "__LINES__") {
+ next;
+ }
+ else {
+ push(@localData, "BEGIN DIALOGEX ".$key." LINES $lines");
+ foreach my $pair(@{$value}){
+ push(@localData, "$pair->[0]\t\t$pair->[1]");
+ }
+ }
+ }
+ push(@localData, "END");
+ push(@localData, "");
+ }
+ elsif($_->[0] eq "STRINGTABLE") {
+ my($key, $value)=each(%{$_->[1]});
+ push(@localData, "STRING $key\t\t$value");
+ }
+ elsif($_->[0] eq "MENU") {
+ my $lines = $_->[1]{"__LINES__"};
+ while (my($key, $value)=each(%{$_->[1]})) {
+ if($key eq "__LINES__") {
+ next;
+ }
+ else {
+ push(@localData, "BEGIN MENU ".$key. " LINES $lines");
+ foreach my $pair(@{$value}){
+ push(@localData, "$pair->[0]\t\t$pair->[1]");
+ }
+ }
+ }
+ push(@localData, "END");
+ push(@localData, "");
+ }
+ }
+
+ writeFile($output, \@localData, $withBOM);
+}
+
###################################################################################################
diff --git a/src/apps/mplayerc/mpcresources/mpcresources.vcproj b/src/apps/mplayerc/mpcresources/mpcresources.vcproj index 90c013a20..3e60ae07f 100644 --- a/src/apps/mplayerc/mpcresources/mpcresources.vcproj +++ b/src/apps/mplayerc/mpcresources/mpcresources.vcproj @@ -55,6 +55,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -130,6 +131,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -204,6 +206,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -279,6 +282,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -353,6 +357,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -428,6 +433,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -502,6 +508,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -577,6 +584,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -651,6 +659,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -726,6 +735,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -800,6 +810,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -875,6 +886,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -949,6 +961,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1024,6 +1037,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1098,6 +1112,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1173,6 +1188,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1247,6 +1263,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1322,6 +1339,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1396,6 +1414,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1471,6 +1490,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1545,6 +1565,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1620,6 +1641,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1694,6 +1716,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1769,6 +1792,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1843,6 +1867,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1918,6 +1943,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -1992,6 +2018,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -2067,6 +2094,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -2141,6 +2169,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -2216,6 +2245,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -2290,6 +2320,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -2365,6 +2396,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -2439,6 +2471,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -2514,6 +2547,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -2588,6 +2622,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -2663,6 +2698,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -2737,6 +2773,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -2812,6 +2849,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -2886,6 +2924,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
@@ -2961,6 +3000,7 @@ />
<Tool
Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_UNICODE;UNICODE;NO_VERSION_REV_NEEDED"
/>
<Tool
Name="VCPreLinkEventTool"
diff --git a/src/apps/mplayerc/mpcresources/mpcresources.vcxproj b/src/apps/mplayerc/mpcresources/mpcresources.vcxproj index 8fe197480..08cb1e9b7 100644 --- a/src/apps/mplayerc/mpcresources/mpcresources.vcxproj +++ b/src/apps/mplayerc/mpcresources/mpcresources.vcxproj @@ -635,6 +635,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release French|x64'">
<Midl>
@@ -659,6 +662,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release German|Win32'">
<ClCompile>
@@ -680,6 +686,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release German|x64'">
<Midl>
@@ -704,6 +713,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Russian|Win32'">
<ClCompile>
@@ -725,6 +737,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Russian|x64'">
<Midl>
@@ -749,6 +764,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Turkish|Win32'">
<ClCompile>
@@ -770,6 +788,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Turkish|x64'">
<Midl>
@@ -794,6 +815,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Czech|Win32'">
<ClCompile>
@@ -815,6 +839,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Czech|x64'">
<Midl>
@@ -839,6 +866,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Spanish|Win32'">
<ClCompile>
@@ -860,6 +890,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Spanish|x64'">
<Midl>
@@ -884,6 +917,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Hungarian|Win32'">
<ClCompile>
@@ -905,6 +941,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Hungarian|x64'">
<Midl>
@@ -929,6 +968,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Korean|Win32'">
<ClCompile>
@@ -950,6 +992,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Korean|x64'">
<Midl>
@@ -974,6 +1019,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Polish|Win32'">
<ClCompile>
@@ -995,6 +1043,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Polish|x64'">
<Midl>
@@ -1019,6 +1070,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Ukrainian|Win32'">
<ClCompile>
@@ -1040,6 +1094,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Ukrainian|x64'">
<Midl>
@@ -1064,6 +1121,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Italian|Win32'">
<ClCompile>
@@ -1085,6 +1145,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Italian|x64'">
<Midl>
@@ -1109,6 +1172,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Slovak|Win32'">
<ClCompile>
@@ -1130,6 +1196,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Slovak|x64'">
<Midl>
@@ -1154,6 +1223,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Chinese simplified|Win32'">
<ClCompile>
@@ -1175,6 +1247,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Chinese simplified|x64'">
<Midl>
@@ -1199,6 +1274,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Chinese traditional|Win32'">
<ClCompile>
@@ -1220,6 +1298,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Chinese traditional|x64'">
<Midl>
@@ -1244,6 +1325,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Belarusian|Win32'">
<ClCompile>
@@ -1265,6 +1349,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Belarusian|x64'">
<Midl>
@@ -1289,6 +1376,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swedish|Win32'">
<ClCompile>
@@ -1310,6 +1400,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Swedish|x64'">
<Midl>
@@ -1334,6 +1427,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Portuguese|Win32'">
<ClCompile>
@@ -1355,6 +1451,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Portuguese|x64'">
<Midl>
@@ -1379,6 +1478,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Dutch|Win32'">
<ClCompile>
@@ -1400,6 +1502,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Dutch|x64'">
<Midl>
@@ -1424,6 +1529,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Catalan|Win32'">
<ClCompile>
@@ -1445,6 +1553,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Catalan|x64'">
<Midl>
@@ -1469,6 +1580,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Japanese|Win32'">
<ClCompile>
@@ -1490,6 +1604,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX86</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Japanese|x64'">
<Midl>
@@ -1514,6 +1631,9 @@ <DataExecutionPrevention>true</DataExecutionPrevention>
<TargetMachine>MachineX64</TargetMachine>
</Link>
+ <ResourceCompile>
+ <PreprocessorDefinitions>_UNICODE;UNICODE;NO_VERSION_REV_NEEDED;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ResourceCompile Include="mplayerc.br.rc">
diff --git a/src/apps/mplayerc/mpcresources/mplayerc.de.rc b/src/apps/mplayerc/mpcresources/mplayerc.de.rc Binary files differindex ef4029d0f..b032615c6 100644 --- a/src/apps/mplayerc/mpcresources/mplayerc.de.rc +++ b/src/apps/mplayerc/mpcresources/mplayerc.de.rc diff --git a/src/apps/mplayerc/mpcresources/patch.bat b/src/apps/mplayerc/mpcresources/patch.bat index 5ad32e09d..1de67f0bc 100644 --- a/src/apps/mplayerc/mpcresources/patch.bat +++ b/src/apps/mplayerc/mpcresources/patch.bat @@ -4,5 +4,5 @@ rem A simple script demos how to apply translated text to locale rc file. rem This is only an example, to use it you will have to change filenames.
echo Generating new rc files and string files...
-perl patch.pl -i newrc\mplayerc.fr.rc.txt newrc\mplayerc.fr.rc
+perl patch.pl -i text\mplayerc.fr.rc.txt mplayerc.fr.rc
pause
\ No newline at end of file diff --git a/src/apps/mplayerc/mpcresources/rcfile.pl b/src/apps/mplayerc/mpcresources/rcfile.pl index 48778d000..6d8487293 100644 --- a/src/apps/mplayerc/mpcresources/rcfile.pl +++ b/src/apps/mplayerc/mpcresources/rcfile.pl @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# Apply mplayerc.rc file changes to locale rc files, and generate patch files for translators.
+# Apply mplayerc.rc file changes to locale rc files.
#
# To use this program, you need a perl with PerlIO package installed.
# For help of usage, type: perl rcfile.pl -h
@@ -36,21 +36,19 @@ require "common.pl"; my $BaseFileName = "../mplayerc.rc";
my $NewFileName = "../mplayerc.rc";
-my $Extension=".txt";
my $help;
-my $result = GetOptions("base|b=s" =>\$BaseFileName, "new|n=s" =>\$NewFileName, "suffix|x=s"=>\$Extension, "help|h"=>\$help);
+my $result = GetOptions("base|b=s" =>\$BaseFileName, "new|n=s" =>\$NewFileName, "help|h"=>\$help);
if($help || !$result) {
print << 'USAGE';
Usage: perl rcfile.pl [Options] | -h --help
Copy all changes between two version of mplayerc.rc files to all rc files in the current directory,
-generate new rc files and texts for translators under the "newrc" subdirectory.
+generate new rc files under the "newrc" subdirectory.
Options:
--base -b base file, default "../mplayerc.rc" optional
--new -n modified file, default "../mplayerc.rc" optional
- --suffix -x output file suffix, default ".txt" optional
--help -h show this help
Base file: the previous revision of mplayerc.rc file
@@ -67,17 +65,18 @@ Options: Second: >perl rcfile.pl -b mplayerc.rc.old
Or better yet use provided batch file: >rcfile.bat
- After running this script, you will find all new language rc files under "newrc" subdir, along with
- the string text files for translators to translate. These new rc files have all changes copied from your
- modified mplayerc.rc file and is ready to compile, except use english version strings.
- After recieved translated text files, use another script to merge back to rc files.
+ After running this script, you will find all new language rc files under "newrc" subdir.
+ These new rc files have all changes copied from your modified mplayerc.rc file and is ready to compile,
+ except use english version strings. Use rcstrings.pl to extract all strings for translators,
+ After recieved translated text files, use patch.pl script to merge back to rc files.
USAGE
exit(0);
}
my($BaseDialogs, $BaseMenus, $BaseStrings, @BaseOutline) = ({}, {}, {}, ());
my($NewDialogs, $NewMenus, $NewStrings, @NewOutline) = ({}, {}, {}, ());
-my ($MenuDiffs, $DialogDiffs) = ({}, {});
+my($MenuDiffs, $DialogDiffs) = ({}, {});
+my($BaseDesignInfos, $NewDesignInfos) = ({}, {});
my @BaseFile = readFile($BaseFileName, 1);
my @NewFile = readFile($NewFileName, 1);
@@ -91,41 +90,40 @@ getDifference(); #Trace($MenuDiffs, "MenuDiffs");
#Trace($DialogDiffs, "DialogDiffs");
-my @FileLists = <*.rc>;
+my @FileLists = ();
-#put all generted files under newrc sub dir.
+if(@ARGV) { @FileLists = @ARGV; }
+else { @FileLists = <*.rc>; }
+
+#put all generted files under "newrc" sub dir.
if(!-e "newrc"){
- mkdir(File::Spec->catdir(".", "newrc")) || die "Can not create sub directory newrc.";
+ mkdir(File::Spec->catdir(".", "newrc")) || die "Can not create \"newrc\" sub directory.";
}
-
foreach my $filename(@FileLists) {
print "Anaylse locale file: $filename...\n";
my @oldrcfile = readFile($filename, 1);
my($curDialogs, $curMenus, $curStrings, @curOutline) = ({},{},{}, ());
my @curVersionInfo = ();
- analyseData(\@oldrcfile, \@curOutline, $curDialogs, $curMenus, $curStrings, \@curVersionInfo);
-
+ my $curDesignInfos = {};
+ analyseData(\@oldrcfile, \@curOutline, $curDialogs, $curMenus, $curStrings, \@curVersionInfo, $curDesignInfos);
+
my $newrcfile = File::Spec->catfile(".", "newrc", $filename);
- my $txtfile = File::Spec->catfile(".", "newrc", $filename.$Extension);
my @newrc = ();
my @patches = ();
- writeData(\@newrc, \@patches, \@curOutline, $curDialogs, $curMenus, $curStrings, \@curVersionInfo);
+ writeData(\@newrc, \@patches, \@curOutline, $curDialogs, $curMenus, $curStrings, \@curVersionInfo, $curDesignInfos);
- print "Generate new locale file: $newrcfile...\n";
+ print "Generate new locale file: $newrcfile...\n\n";
writeFile($newrcfile, \@newrc, 2);
-
- print "Generate text file to translate: $txtfile...\n\n";
- writePatchFile($txtfile, \@patches, 1);
}
###################################################################################################
sub getDifference {
my @curVersionInfo = (); # no use for mplayerc.rc
- analyseData(\@BaseFile, \@BaseOutline,$BaseDialogs, $BaseMenus, $BaseStrings, \@curVersionInfo);
- analyseData(\@NewFile,\@NewOutline, $NewDialogs, $NewMenus, $NewStrings, \@curVersionInfo);
+ analyseData(\@BaseFile, \@BaseOutline,$BaseDialogs, $BaseMenus, $BaseStrings, \@curVersionInfo, $BaseDesignInfos);
+ analyseData(\@NewFile,\@NewOutline, $NewDialogs, $NewMenus, $NewStrings, \@curVersionInfo, $NewDesignInfos);
while (my ($key, $value) = each(%{$BaseMenus})) {
my $value1 = $NewMenus->{$key};
@@ -143,7 +141,9 @@ sub getDifference { if($value1) {
my @changeset = ();
- lcs($value->{"__TEXT__"}, $value1->{"__TEXT__"}, \@changeset);
+ my @data0 = map{$_->[1]}@{$value->{"__DATA__"}};
+ my @data1 = map{$_->[1]}@{$value1->{"__DATA__"}};
+ lcs(\@data0, \@data1, \@changeset);
@changeset = @changeset[sort {$changeset[$a][0] <=> $changeset[$b][0];}(0..$#changeset)];
$DialogDiffs->{$key} = [@changeset];
}
@@ -154,9 +154,9 @@ sub getDifference { #--------------------------------------------------------------------------------------------------
sub writeData {
my ($newrc, $patches) = (shift, shift);
- my ($curOutline, $curDialogs, $curMenus, $curStrings, $curVersionInfo) = @_;
+ my ($curOutline, $curDialogs, $curMenus, $curStrings, $curVersionInfo, $curDesignInfos) = @_;
- my ($curDialogName, $curMenuName);
+ my ($curDialogName, $curMenuName, $curDesignName);
my $headsection = 0;
my $tailsection = $#NewOutline;
@@ -188,6 +188,15 @@ sub writeData { push(@{$newrc}, @_text); #in general use texts from new rc file
}
}
+ elsif($tag eq "DESIGNINFO") {
+ $curDesignName = $_->[1][0];
+ #if($curDesignInfos->{$curDesignName}) {
+ # push(@{$newrc}, @{$curDesignInfos->{$curDesignName}{"__TEXT__"}}); # use locale design info section
+ #}
+ #else {
+ push(@{$newrc}, @{$NewDesignInfos->{$curDesignName}{"__TEXT__"}}); # use new design info section
+ #}
+ }
elsif($tag eq "BLOCK") {
push(@{$newrc}, @{$_->[1]}); # use new file block section
}
@@ -244,8 +253,6 @@ sub writeStringTable { my $localeStr = $refs->{$key};
if((!$localeStr) || (!$baseStr) || ($baseStr ne $value)) {
- #new string or changed string or not in locale files, use new one
- push(@{$patches},["STRINGTABLE",{$key=>$value}]);
}
else {
s/\Q$value\E/$localeStr/; #use locale string
@@ -259,59 +266,37 @@ sub writeDialogContent { my @contents = ();
push(@contents, @{$NewDialogs->{$name}{"__TEXT__"}});
- my $contentLines = @contents;
- if(my $diffData = $DialogDiffs->{$name}) {
- # this dialog exists in old file
- my @changes = grep($_->[0] != $_->[1],@$diffData); #anything changed for this dialog?
- my $samelines = @$diffData;
-
- if((!@changes) && ($samelines == $contentLines)) { #no change then just use old data
- @contents = ();
- push(@contents, @{$refs->{$name}{"__TEXT__"}});
- }
- else { #change in this dialog
- my $curlines = $refs->{$name}{"__LINES__"};
- my $oldlines = $BaseDialogs->{$name}{"__LINES__"};
-
- if($oldlines == $curlines) {
- # if locale rc files have the same line numbers with the original main mplayerc.rc
- # TODO: need some other checks, though errors will be easier to spot.
- my @checkIdx=(1..$contentLines);
-
- my $idx = 0;
- foreach (@$diffData) {
- $contents[$_->[0]] = $refs->{$name}{"__TEXT__"}[$_->[1]]; #use those values from locale file
- $checkIdx[$_->[0]] = 0;
- }
+ my @newdatas = map{$_->[1]}@{$NewDialogs->{$name}{"__DATA__"}};
+ my @newidxs = map{$_->[0]}@{$NewDialogs->{$name}{"__DATA__"}};
+ my $newdataLines = @newdatas;
- @checkIdx=grep($_>0, @checkIdx); #the rest from new fc file, also put in patches
- my @data = grep{
- my $i=0;
- foreach $idx(@checkIdx) {
- if($_->[0]==$idx){
- $i = 1;
- last;
- }
- }
- $i;
- }@{$NewDialogs->{$name}{"__DATA__"}};
+ my @baseidxs = map{$_->[0]}@{$BaseDialogs->{$name}{"__DATA__"}};
+ my $basedataLines = @baseidxs;
- if(@data) {
- push(@{$patches}, ["DIALOG", {$name => [@data], "__LINES__" => $contentLines}]);
- }
- }
- else {
- # if locale rc files have different line numbers with original main mplayerc.rc,
- # don't try to use locale values, just use english version and to patch file
- push(@{$patches}, ["DIALOG",{$name =>$NewDialogs->{$name}{"__DATA__"}, "__LINES__" => $contentLines}]);
+ my @refdatas = map{$_->[1]}@{$refs->{$name}{"__DATA__"}};
+ my $refdataLines = @refdatas;
+
+ if($newdataLines && $basedataLines && $refdataLines) {
+ my $diffData = $DialogDiffs->{$name};
+
+ foreach(@$diffData) {
+ my $linenum = $newidxs[$_->[0]];
+
+ my $str = $newdatas[$_->[0]];
+ my $localstr = $refdatas[$_->[1]];
+
+ if($localstr) {
+ $contents[$linenum-1] =~ s/\Q$str\E/$localstr/;
}
}
}
- else { #new dialog, use english version
- push(@{$patches}, ["DIALOG",{$name =>$NewDialogs->{$name}{"__DATA__"}, "__LINES__" => $contentLines}]); #new dialog
- }
+ my $localfont = $refs->{$name}{"__FONT__"}[1];
+ if($localfont) {
+ $contents[$NewDialogs->{$name}{"__FONT__"}[0]-1] = $refs->{$name}{"__TEXT__"}[$refs->{$name}{"__FONT__"}[0]-1];
+ }
+
push(@{$output}, @contents);
}
@@ -339,27 +324,8 @@ sub writeMenuContent { $contents[$_->[0]] = $refs->{$name}{"__TEXT__"}[$_->[1]]; #first use those values from locale file
$checkIdx[$_->[0]] = 0;
}
-
- @checkIdx=grep($_>0, @checkIdx);
- my @data = grep{
- my $i=0;
- foreach my $idx(@checkIdx) {
- if($_->[0]==$idx){
- $i = 1;
- last;
- }
- }
- $i;
- }@{$NewMenus->{$name}{"__DATA__"}};
-
- if(@data) {
- push(@{$patches}, ["MENU", {$name => [@data], "__LINES__" => $contentLines }]);
- }
}
}
- else {
- push(@{$patches}, ["MENU", {$name => $NewMenus->{$name}{"__DATA__"}, "__LINES__" => $contentLines }]); #new menu
- }
push(@{$output}, @contents);
}
@@ -380,52 +346,4 @@ sub writeVersionInfo{ push(@{$input}, "");
}
-#--------------------------------------------------------------------------------------------------
-sub writePatchFile {
- my ($output, $data, $withBOM) = @_;
-
- my @localData = ();
- foreach (@$data) {
- if($_->[0] eq "DIALOG") {
- my $lines = $_->[1]{"__LINES__"};
- while (my($key, $value)=each(%{$_->[1]})) {
- if($key eq "__LINES__") {
- next;
- }
- else {
- push(@localData, "BEGIN DIALOGEX ".$key." LINES $lines");
- foreach my $pair(@{$value}){
- push(@localData, "$pair->[0]\t\t$pair->[1]");
- }
- }
- }
- push(@localData, "END");
- push(@localData, "");
- }
- elsif($_->[0] eq "STRINGTABLE") {
- my($key, $value)=each(%{$_->[1]});
- push(@localData, "STRING $key\t\t$value");
- push(@localData, "");
- }
- elsif($_->[0] eq "MENU") {
- my $lines = $_->[1]{"__LINES__"};
- while (my($key, $value)=each(%{$_->[1]})) {
- if($key eq "__LINES__") {
- next;
- }
- else {
- push(@localData, "BEGIN MENU ".$key. " LINES $lines");
- foreach my $pair(@{$value}){
- push(@localData, "$pair->[0]\t\t$pair->[1]");
- }
- }
- }
- push(@localData, "END");
- push(@localData, "");
- }
- }
-
- writeFile($output, \@localData, $withBOM);
-}
-
###################################################################################################
diff --git a/src/apps/mplayerc/mpcresources/rcstrings.bat b/src/apps/mplayerc/mpcresources/rcstrings.bat new file mode 100644 index 000000000..0b6778ce8 --- /dev/null +++ b/src/apps/mplayerc/mpcresources/rcstrings.bat @@ -0,0 +1,7 @@ +@echo off
+
+rem A simple script demos how to extract all strings from rc files.
+
+echo Generating string files...
+perl rcstrings.pl -a
+pause
\ No newline at end of file diff --git a/src/apps/mplayerc/mpcresources/rcstrings.pl b/src/apps/mplayerc/mpcresources/rcstrings.pl new file mode 100644 index 000000000..69b696a40 --- /dev/null +++ b/src/apps/mplayerc/mpcresources/rcstrings.pl @@ -0,0 +1,129 @@ +#/bin/perl
+#
+# $Id$
+#
+# (C) 2006-2010 see AUTHORS
+#
+# This file is part of mplayerc.
+#
+# Mplayerc is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Mplayerc is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Extract all translatable strings from rc files.
+#
+# To use this program, you need a perl with PerlIO package installed.
+# For help of usage, type: perl rcstrings.pl -h
+#
+
+use strict;
+use Getopt::Long;
+use vars qw(@InTags @TextTags);
+
+use File::Basename;
+use File::Spec;
+use File::Glob qw(:globally :nocase);
+require "common.pl";
+
+my $Extension=".txt";
+my $help;
+my ($OutputAll, $OutputDialogs, $OutputMenus, $OutputStringtables);
+
+my $result = GetOptions("suffix|x=s"=>\$Extension, "help|h"=>\$help, "all|a"=>\$OutputAll,
+ "dialog|d"=>\$OutputDialogs, "menu|m"=>\$OutputMenus, "stringtable|s"=>\$OutputStringtables);
+
+if($OutputAll) {
+ ($OutputDialogs, $OutputMenus, $OutputStringtables) = (1,1,1);
+}
+
+if($help || !$result) {
+ print << 'USAGE';
+Usage: perl rcstrings.pl [Options] file1 file2 | -h --help
+Extract all translatable strings from file1 file2 or all rc files.
+
+Options:
+ --suffix -x output file suffix, default ".txt" optional
+ --help -h show this help
+
+ -all -a output all strings, including dialogs, menus, stringtables
+ -dialog -d output dialogs
+ -menu -m output menus
+ -stringtable -s output stringtables
+
+ After running this script, you will find all the string text files under "text" sub directory.
+USAGE
+ exit(0);
+}
+
+my @FileLists = ();
+
+if(@ARGV) { @FileLists = @ARGV; }
+else { @FileLists = <*.rc>; }
+
+#put all generated files under text sub dir.
+if(!-e "text"){
+ mkdir(File::Spec->catdir(".", "text")) || die "Can not create \"text\" sub directory.";
+}
+
+foreach my $filename(@FileLists) {
+ print "Anaylse locale file: $filename...\n";
+ my @rcfile = readFile($filename, 1);
+ my($curDialogs, $curMenus, $curStrings, @curOutline) = ({},{},{}, ());
+ my @curVersionInfo = ();
+ my $curDesignInfos = {};
+ analyseData(\@rcfile, \@curOutline, $curDialogs, $curMenus, $curStrings, \@curVersionInfo, $curDesignInfos);
+
+ my $txtfile = File::Spec->catfile(".", "text", $filename.$Extension);
+
+ writeFileStrings($txtfile, $curDialogs, $curMenus, $curStrings);
+}
+
+###################################################################################################
+sub writeFileStrings {
+ my ($filename, $dialogs, $menus, $strings) = @_;
+ my @contents = ();
+
+ if($OutputDialogs) {
+ foreach (sort(keys(%{$dialogs}))) {
+ my @data = ();
+ push(@data, @{$dialogs->{$_}{"__DATA__"}});
+ if(defined($data[0])) {
+ push(@contents, ["DIALOG", {$_ =>[@data], "__LINES__" => $dialogs->{$_}{"__LINES__"}}]);
+ }
+ }
+ }
+ if($OutputMenus) {
+ foreach (sort(keys(%{$menus}))) {
+ my @data = ();
+ push(@data, @{$menus->{$_}{"__DATA__"}});
+ @data = grep(skipNonTranslatedStr($_->[1]), @data);
+ @data = grep(($_->[1] !~/""/),@data);
+ push(@contents, ["MENU",{$_ =>[@data], "__LINES__" => $menus->{$_}{"__LINES__"}}]);
+ }
+ }
+ if($OutputStringtables) {
+ foreach (sort(keys(%{$strings}))) {
+ my $line = $strings->{$_};
+ $line = skipNonTranslatedStr($line);
+ if($line) {
+ push(@contents,["STRINGTABLE",{$_=>$strings->{$_}}]);
+ }
+ }
+ }
+
+ if(@contents) {
+ print "Generate string files $filename...\n";
+ writePatchFile($filename, \@contents, 1);
+ }
+}
+
+###################################################################################################
|