From: <sag...@us...> - 2014-03-26 13:37:48
|
Revision: 3968 http://sourceforge.net/p/modplug/code/3968 Author: saga-games Date: 2014-03-26 13:37:36 +0000 (Wed, 26 Mar 2014) Log Message: ----------- [Mod] Avoid recreating and duplicating image lists in child views by storing them all in CMainFrame. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Globals.cpp trunk/OpenMPT/mptrack/Globals.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Mpdlgs.cpp trunk/OpenMPT/mptrack/SelectPluginDialog.cpp trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/view_com.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-03-26 13:37:36 UTC (rev 3968) @@ -885,7 +885,7 @@ CModControlDlg::OnInitDialog(); m_bInitialized = FALSE; - m_ToolBar.Init(IDB_PATTERNS); + m_ToolBar.Init(CMainFrame::GetMainFrame()->m_PatternIcons); m_ToolBar.AddButton(IDC_INSTRUMENT_NEW, TIMAGE_INSTR_NEW); m_ToolBar.AddButton(IDC_INSTRUMENT_OPEN, TIMAGE_OPEN); m_ToolBar.AddButton(IDC_INSTRUMENT_SAVEAS, TIMAGE_SAVE); Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-03-26 13:37:36 UTC (rev 3968) @@ -133,7 +133,7 @@ rcOrderList.right = rect.right - 4; m_OrderList.Init(rcOrderList, pMainFrm->GetGUIFont()); // Toolbar buttons - m_ToolBar.Init(IDB_PATTERNS); + m_ToolBar.Init(CMainFrame::GetMainFrame()->m_PatternIcons); m_ToolBar.AddButton(IDC_PATTERN_NEW, TIMAGE_PATTERN_NEW); m_ToolBar.AddButton(IDC_PATTERN_PLAY, TIMAGE_PATTERN_PLAY); m_ToolBar.AddButton(IDC_PATTERN_PLAYFROMSTART, TIMAGE_PATTERN_RESTART); Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-03-26 13:37:36 UTC (rev 3968) @@ -218,12 +218,12 @@ m_ComboZoom.SetItemData(m_ComboZoom.AddString("1:128"), 8); m_ComboZoom.SetCurSel(0); // File ToolBar - m_ToolBar1.Init(IDB_PATTERNS); + m_ToolBar1.Init(CMainFrame::GetMainFrame()->m_PatternIcons); m_ToolBar1.AddButton(IDC_SAMPLE_NEW, TIMAGE_SAMPLE_NEW); m_ToolBar1.AddButton(IDC_SAMPLE_OPEN, TIMAGE_OPEN); m_ToolBar1.AddButton(IDC_SAMPLE_SAVEAS, TIMAGE_SAVE); // Edit ToolBar - m_ToolBar2.Init(IDB_PATTERNS); + m_ToolBar2.Init(CMainFrame::GetMainFrame()->m_PatternIcons); m_ToolBar2.AddButton(IDC_SAMPLE_PLAY, TIMAGE_PREVIEW); m_ToolBar2.AddButton(IDC_SAMPLE_NORMALIZE, TIMAGE_SAMPLE_NORMALIZE); m_ToolBar2.AddButton(IDC_SAMPLE_AMPLIFY, TIMAGE_SAMPLE_AMPLIFY); Modified: trunk/OpenMPT/mptrack/Globals.cpp =================================================================== --- trunk/OpenMPT/mptrack/Globals.cpp 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/Globals.cpp 2014-03-26 13:37:36 UTC (rev 3968) @@ -150,7 +150,7 @@ if (!pMainFrm) return FALSE; if (!CTabCtrl::Create(dwStyle, rect, pParentWnd, nID)) return FALSE; SendMessage(WM_SETFONT, (WPARAM)pMainFrm->GetGUIFont()); - SetImageList(pMainFrm->GetImageList()); + SetImageList(&pMainFrm->m_MiscIcons); return TRUE; } @@ -488,7 +488,7 @@ int nItems = m_TabCtrl.GetItemCount(); for (int i=0; i<nItems; i++) { - if (m_TabCtrl.GetItemData(i) == nIndex) + if ((WPARAM)m_TabCtrl.GetItemData(i) == nIndex) { m_TabCtrl.SetCurSel(i); SetActivePage(i, lParam); @@ -730,17 +730,15 @@ END_MESSAGE_MAP() -BOOL CModControlBar::Init(UINT nId) -//--------------------------------- +BOOL CModControlBar::Init(CImageListEx &icons) +//-------------------------------------------- { SetButtonStructSize(sizeof(TBBUTTON)); SetBitmapSize(CSize(16, 16)); SetButtonSize(CSize(27, 24)); // Add bitmaps - m_ImageList.Create(nId, 16, 16, IMGLIST_NUMIMAGES, 1); - - SetImageList(&m_ImageList); + SetImageList(&icons); UpdateStyle(); return TRUE; } Modified: trunk/OpenMPT/mptrack/Globals.h =================================================================== --- trunk/OpenMPT/mptrack/Globals.h 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/Globals.h 2014-03-26 13:37:36 UTC (rev 3968) @@ -22,16 +22,14 @@ class CModControlView; class CModControlBar; +class CImageListEx; //======================================= class CModControlBar: public CToolBarCtrl //======================================= { -protected: - CImageListEx m_ImageList; - public: - BOOL Init(UINT nId); + BOOL Init(CImageListEx &icons); void UpdateStyle(); BOOL AddButton(UINT nID, int iImage=0, UINT nStyle=TBSTYLE_BUTTON, UINT nState=TBSTATE_ENABLED); afx_msg LRESULT OnHelpHitTest(WPARAM, LPARAM); Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-03-26 13:37:36 UTC (rev 3968) @@ -178,7 +178,6 @@ ///////////////////////////////////////////////////////////////////////////// // CMainFrame construction/destruction -//#include <direct.h> CMainFrame::CMainFrame() //---------------------- { @@ -291,7 +290,10 @@ // Load resources m_hIcon = theApp.LoadIcon(IDR_MAINFRAME); - m_ImageList.Create(IDB_IMAGELIST, 16, 16, IMGLIST_NUMIMAGES, 1); + m_MiscIcons.Create(IDB_IMAGELIST, 16, 16, IMGLIST_NUMIMAGES, 1); + m_PatternIcons.Create(IDB_PATTERNS, 16, 16, PATTERNIMG_NUMIMAGES, 1); + m_EnvelopeIcons.Create(IDB_ENVTOOLBAR, 20, 18, ENVIMG_NUMIMAGES, 1); + m_SampleIcons.Create(IDB_SMPTOOLBAR, 20, 18, SAMPLEIMG_NUMIMAGES, 1); m_hGUIFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); m_hFixedFont = ::CreateFont(12,5, 0,0, 300, Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2014-03-26 13:37:36 UTC (rev 3968) @@ -308,12 +308,17 @@ public: static HMIDIIN shMidiIn; +public: + CImageListEx m_MiscIcons; // Misc Icons + CImageListEx m_EnvelopeIcons; // Instrument editor icons + CImageListEx m_SampleIcons; // Sample editor icons + CImageListEx m_PatternIcons; // Pattern icons (includes some from sample editor as well...) + protected: CModTreeBar m_wndTree; CStatusBar m_wndStatusBar; CMainToolBar m_wndToolBar; - CImageListEx m_ImageList; CSoundFile *m_pSndFile; // != NULL only when currently playing or rendering HWND m_hWndMidi; CSoundFile::samplecount_t m_dwTimeSec; @@ -393,7 +398,6 @@ UINT GetBaseOctave() const; CModDoc *GetActiveDoc(); CView *GetActiveView(); //rewbs.customKeys - CImageListEx *GetImageList() { return &m_ImageList; } void OnDocumentCreated(CModDoc *pModDoc); void OnDocumentClosed(CModDoc *pModDoc); void UpdateTree(CModDoc *pModDoc, DWORD lHint=0, CObject *pHint=NULL); Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-03-26 13:37:36 UTC (rev 3968) @@ -252,7 +252,7 @@ // Sound Device { m_CbnDevice.ResetContent(); - m_CbnDevice.SetImageList(CMainFrame::GetMainFrame()->GetImageList()); + m_CbnDevice.SetImageList(&CMainFrame::GetMainFrame()->m_MiscIcons); COMBOBOXEXITEM cbi; UINT iItem = 0; Modified: trunk/OpenMPT/mptrack/SelectPluginDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/SelectPluginDialog.cpp 2014-03-26 13:37:36 UTC (rev 3968) @@ -88,7 +88,7 @@ CDialog::OnInitDialog(); m_treePlugins.ModifyStyle(dwRemove, dwAdd); - m_treePlugins.SetImageList(CMainFrame::GetMainFrame()->GetImageList(), TVSIL_NORMAL); + m_treePlugins.SetImageList(&CMainFrame::GetMainFrame()->m_MiscIcons, TVSIL_NORMAL); if (m_pPlugin) { Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2014-03-26 13:37:36 UTC (rev 3968) @@ -131,7 +131,7 @@ } MemsetZero(m_NcButtonState); - m_bmpEnvBar.Create(IDB_ENVTOOLBAR, 20, 18, ENVIMG_NUMIMAGES, 1); + m_bmpEnvBar.Create(&CMainFrame::GetMainFrame()->m_EnvelopeIcons); m_baPlayingNote.reset(); //rewbs.envRowGrid Modified: trunk/OpenMPT/mptrack/View_ins.h =================================================================== --- trunk/OpenMPT/mptrack/View_ins.h 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/View_ins.h 2014-03-26 13:37:36 UTC (rev 3968) @@ -23,7 +23,7 @@ //========================================== { protected: - CImageListEx m_bmpEnvBar; + CImageList m_bmpEnvBar; POINT m_ptMenu; CRect m_rcClient; Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2014-03-26 13:37:36 UTC (rev 3968) @@ -128,9 +128,8 @@ m_dwNotifyPos[i] = Notification::PosInvalid; } MemsetZero(m_NcButtonState); + m_bmpEnvBar.Create(&CMainFrame::GetMainFrame()->m_SampleIcons); - m_bmpEnvBar.Create(IDB_SMPTOOLBAR, 20, 18, SAMPLEIMG_NUMIMAGES, 1); - m_lastDrawPoint.SetPoint(-1, -1); noteChannel.assign(NOTE_MAX - NOTE_MIN + 1, CHANNELINDEX_INVALID); offScreenDC = nullptr; Modified: trunk/OpenMPT/mptrack/View_smp.h =================================================================== --- trunk/OpenMPT/mptrack/View_smp.h 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/View_smp.h 2014-03-26 13:37:36 UTC (rev 3968) @@ -29,7 +29,7 @@ }; protected: - CImageListEx m_bmpEnvBar; + CImageList m_bmpEnvBar; CRect m_rcClient; HDC offScreenDC; HGDIOBJ offScreenBitmap; Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2014-03-26 13:37:36 UTC (rev 3968) @@ -216,7 +216,7 @@ m_pDataTree->InsLibSetFullPath(m_InstrLibPath, mpt::PathString()); } - SetImageList(CMainFrame::GetMainFrame()->GetImageList(), TVSIL_NORMAL); + SetImageList(&CMainFrame::GetMainFrame()->m_MiscIcons, TVSIL_NORMAL); if (!IsSampleBrowser()) { // Create Midi Library @@ -1661,7 +1661,7 @@ // Enumerating Drives... if(!IsSampleBrowser()) { - CImageListEx &images = *CMainFrame::GetMainFrame()->GetImageList(); + CImageListEx &images = CMainFrame::GetMainFrame()->m_MiscIcons; // Avoid adding the same images again and again... images.SetImageCount(IMGLIST_NUMIMAGES); Modified: trunk/OpenMPT/mptrack/view_com.cpp =================================================================== --- trunk/OpenMPT/mptrack/view_com.cpp 2014-03-26 13:03:18 UTC (rev 3967) +++ trunk/OpenMPT/mptrack/view_com.cpp 2014-03-26 13:37:36 UTC (rev 3968) @@ -147,7 +147,7 @@ } GetClientRect(&rect); m_ToolBar.Create(WS_CHILD|WS_VISIBLE|CCS_NOPARENTALIGN, rect, this, IDC_TOOLBAR_DETAILS); - m_ToolBar.Init(IDB_IMAGELIST); + m_ToolBar.Init(CMainFrame::GetMainFrame()->m_MiscIcons); m_ItemList.Create(WS_CHILD|WS_VISIBLE|LVS_REPORT|LVS_SINGLESEL|LVS_EDITLABELS|LVS_NOSORTHEADER, rect, this, IDC_LIST_DETAILS); m_ItemList.ModifyStyleEx(0, WS_EX_STATICEDGE); // Add ToolBar Buttons This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-03-26 15:41:23
|
Revision: 3969 http://sourceforge.net/p/modplug/code/3969 Author: saga-games Date: 2014-03-26 15:41:15 +0000 (Wed, 26 Mar 2014) Log Message: ----------- [Imp] Make disabled icons look a bit nicer by making them translucent. Modified Paths: -------------- trunk/OpenMPT/mptrack/CImageListEx.h trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_pat.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Globals.cpp trunk/OpenMPT/mptrack/Globals.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainbar.cpp trunk/OpenMPT/mptrack/Mainbar.h trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/view_com.cpp Modified: trunk/OpenMPT/mptrack/CImageListEx.h =================================================================== --- trunk/OpenMPT/mptrack/CImageListEx.h 2014-03-26 13:37:36 UTC (rev 3968) +++ trunk/OpenMPT/mptrack/CImageListEx.h 2014-03-26 15:41:15 UTC (rev 3969) @@ -12,28 +12,44 @@ class CImageListEx : public CImageList { public: - BOOL Create(UINT resourceID, int cx, int cy, int nInitial, int nGrow) + bool Create(UINT resourceID, int cx, int cy, int nInitial, int nGrow, bool disabled = false) { CBitmap *bitmap = ReadPNG(MAKEINTRESOURCE(resourceID)); if(bitmap == nullptr) { - return FALSE; + return false; } + BITMAP bm; + bitmap->GetBitmap(&bm); + const uint32_t bitmapSize = bm.bmWidthBytes * bm.bmHeight; + + std::vector<RGBQUAD> bitmapBytes(bitmapSize / sizeof(RGBQUAD)); + bitmap->GetBitmapBits(bitmapSize, &bitmapBytes[0]); + + if(disabled) + { + // Grayed out icons + RGBQUAD *pixel = &bitmapBytes[0]; + for(size_t i = bitmapBytes.size(); i != 0; i--, pixel++) + { + if(pixel->rgbReserved != 0) + { + uint8_t y = static_cast<uint8_t>(pixel->rgbRed * 0.299f + pixel->rgbGreen * 0.587f + pixel->rgbBlue * 0.114f); + pixel->rgbRed = pixel->rgbGreen = pixel->rgbBlue = y; + pixel->rgbReserved /= 2; + } + } + bitmap->SetBitmapBits(bitmapSize, &bitmapBytes[0]); + } + // Icons with alpha transparency screw up in Windows 2000 and older as well as Wine 1.4 and older. // They all support 1-bit transparency, though, so we pre-multiply all pixels with the default button face colour and create a transparency mask. if(!mpt::Windows::Version::IsAtLeast(mpt::Windows::Version::WinXP) || mpt::Windows::Version::IsWine()) { - BITMAP bm; - bitmap->GetBitmap(&bm); - uint32_t bitmapSize = bm.bmWidthBytes * bm.bmHeight; - - std::vector<RGBQUAD> bitmapBytes(bitmapSize / sizeof(RGBQUAD)), maskBytes(bitmapSize / sizeof(RGBQUAD)); - bitmap->GetBitmapBits(bitmapSize, &bitmapBytes[0]); - CBitmap bitmapMask; bitmapMask.CreateBitmapIndirect(&bm); - bitmapMask.GetBitmapBits(bitmapSize, &maskBytes[0]); + std::vector<RGBQUAD> maskBytes(bitmapSize / sizeof(RGBQUAD)); const COLORREF buttonColor = GetSysColor(COLOR_BTNFACE); const uint8_t r = GetRValue(buttonColor), g = GetGValue(buttonColor), b = GetBValue(buttonColor); @@ -68,19 +84,22 @@ if(!CImageList::Create(cx, cy, ILC_COLOR32 | ILC_MASK, nInitial, nGrow)) { - return FALSE; + delete bitmap; + return false; } CImageList::Add(bitmap, &bitmapMask); + bitmapMask.Detach(); } else { if(!CImageList::Create(cx, cy, ILC_COLOR32, nInitial, nGrow)) { - return FALSE; + delete bitmap; + return false; } CImageList::Add(bitmap, RGB(0, 0, 0)); } bitmap->Detach(); delete bitmap; - return TRUE; + return true; } }; \ No newline at end of file Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-03-26 13:37:36 UTC (rev 3968) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-03-26 15:41:15 UTC (rev 3969) @@ -885,7 +885,7 @@ CModControlDlg::OnInitDialog(); m_bInitialized = FALSE; - m_ToolBar.Init(CMainFrame::GetMainFrame()->m_PatternIcons); + m_ToolBar.Init(CMainFrame::GetMainFrame()->m_PatternIcons,CMainFrame::GetMainFrame()->m_PatternIconsDisabled); m_ToolBar.AddButton(IDC_INSTRUMENT_NEW, TIMAGE_INSTR_NEW); m_ToolBar.AddButton(IDC_INSTRUMENT_OPEN, TIMAGE_OPEN); m_ToolBar.AddButton(IDC_INSTRUMENT_SAVEAS, TIMAGE_SAVE); Modified: trunk/OpenMPT/mptrack/Ctrl_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-03-26 13:37:36 UTC (rev 3968) +++ trunk/OpenMPT/mptrack/Ctrl_pat.cpp 2014-03-26 15:41:15 UTC (rev 3969) @@ -133,7 +133,7 @@ rcOrderList.right = rect.right - 4; m_OrderList.Init(rcOrderList, pMainFrm->GetGUIFont()); // Toolbar buttons - m_ToolBar.Init(CMainFrame::GetMainFrame()->m_PatternIcons); + m_ToolBar.Init(CMainFrame::GetMainFrame()->m_PatternIcons,CMainFrame::GetMainFrame()->m_PatternIconsDisabled); m_ToolBar.AddButton(IDC_PATTERN_NEW, TIMAGE_PATTERN_NEW); m_ToolBar.AddButton(IDC_PATTERN_PLAY, TIMAGE_PATTERN_PLAY); m_ToolBar.AddButton(IDC_PATTERN_PLAYFROMSTART, TIMAGE_PATTERN_RESTART); Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-03-26 13:37:36 UTC (rev 3968) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-03-26 15:41:15 UTC (rev 3969) @@ -218,12 +218,12 @@ m_ComboZoom.SetItemData(m_ComboZoom.AddString("1:128"), 8); m_ComboZoom.SetCurSel(0); // File ToolBar - m_ToolBar1.Init(CMainFrame::GetMainFrame()->m_PatternIcons); + m_ToolBar1.Init(CMainFrame::GetMainFrame()->m_PatternIcons,CMainFrame::GetMainFrame()->m_PatternIconsDisabled); m_ToolBar1.AddButton(IDC_SAMPLE_NEW, TIMAGE_SAMPLE_NEW); m_ToolBar1.AddButton(IDC_SAMPLE_OPEN, TIMAGE_OPEN); m_ToolBar1.AddButton(IDC_SAMPLE_SAVEAS, TIMAGE_SAVE); // Edit ToolBar - m_ToolBar2.Init(CMainFrame::GetMainFrame()->m_PatternIcons); + m_ToolBar2.Init(CMainFrame::GetMainFrame()->m_PatternIcons,CMainFrame::GetMainFrame()->m_PatternIconsDisabled); m_ToolBar2.AddButton(IDC_SAMPLE_PLAY, TIMAGE_PREVIEW); m_ToolBar2.AddButton(IDC_SAMPLE_NORMALIZE, TIMAGE_SAMPLE_NORMALIZE); m_ToolBar2.AddButton(IDC_SAMPLE_AMPLIFY, TIMAGE_SAMPLE_AMPLIFY); Modified: trunk/OpenMPT/mptrack/Globals.cpp =================================================================== --- trunk/OpenMPT/mptrack/Globals.cpp 2014-03-26 13:37:36 UTC (rev 3968) +++ trunk/OpenMPT/mptrack/Globals.cpp 2014-03-26 15:41:15 UTC (rev 3969) @@ -730,8 +730,8 @@ END_MESSAGE_MAP() -BOOL CModControlBar::Init(CImageListEx &icons) -//-------------------------------------------- +BOOL CModControlBar::Init(CImageList &icons, CImageList &disabledIcons) +//--------------------------------------------------------------------- { SetButtonStructSize(sizeof(TBBUTTON)); SetBitmapSize(CSize(16, 16)); @@ -739,6 +739,7 @@ // Add bitmaps SetImageList(&icons); + SetDisabledImageList(&disabledIcons); UpdateStyle(); return TRUE; } Modified: trunk/OpenMPT/mptrack/Globals.h =================================================================== --- trunk/OpenMPT/mptrack/Globals.h 2014-03-26 13:37:36 UTC (rev 3968) +++ trunk/OpenMPT/mptrack/Globals.h 2014-03-26 15:41:15 UTC (rev 3969) @@ -29,7 +29,7 @@ //======================================= { public: - BOOL Init(CImageListEx &icons); + BOOL Init(CImageList &icons, CImageList &disabledIcons); void UpdateStyle(); BOOL AddButton(UINT nID, int iImage=0, UINT nStyle=TBSTYLE_BUTTON, UINT nState=TBSTATE_ENABLED); afx_msg LRESULT OnHelpHitTest(WPARAM, LPARAM); Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-03-26 13:37:36 UTC (rev 3968) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-03-26 15:41:15 UTC (rev 3969) @@ -291,7 +291,9 @@ m_hIcon = theApp.LoadIcon(IDR_MAINFRAME); m_MiscIcons.Create(IDB_IMAGELIST, 16, 16, IMGLIST_NUMIMAGES, 1); + m_MiscIconsDisabled.Create(IDB_IMAGELIST, 16, 16, IMGLIST_NUMIMAGES, 1, true); m_PatternIcons.Create(IDB_PATTERNS, 16, 16, PATTERNIMG_NUMIMAGES, 1); + m_PatternIconsDisabled.Create(IDB_PATTERNS, 16, 16, PATTERNIMG_NUMIMAGES, 1, true); m_EnvelopeIcons.Create(IDB_ENVTOOLBAR, 20, 18, ENVIMG_NUMIMAGES, 1); m_SampleIcons.Create(IDB_SMPTOOLBAR, 20, 18, SAMPLEIMG_NUMIMAGES, 1); Modified: trunk/OpenMPT/mptrack/Mainbar.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp 2014-03-26 13:37:36 UTC (rev 3968) +++ trunk/OpenMPT/mptrack/Mainbar.cpp 2014-03-26 15:41:15 UTC (rev 3969) @@ -232,7 +232,9 @@ if (!CToolBar::Create(parent, dwStyle)) return FALSE; m_ImageList.Create(IDB_MAINBAR, 16, 16, IMGLIST_NUMIMAGES, 1); + m_ImageListDisabled.Create(IDB_MAINBAR, 16, 16, IMGLIST_NUMIMAGES, 1, true); GetToolBarCtrl().SetImageList(&m_ImageList); + GetToolBarCtrl().SetDisabledImageList(&m_ImageListDisabled); if (!SetButtons(MainButtons, CountOf(MainButtons))) return FALSE; Modified: trunk/OpenMPT/mptrack/Mainbar.h =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.h 2014-03-26 13:37:36 UTC (rev 3968) +++ trunk/OpenMPT/mptrack/Mainbar.h 2014-03-26 15:41:15 UTC (rev 3969) @@ -74,7 +74,7 @@ //=================================== { protected: - CImageListEx m_ImageList; + CImageListEx m_ImageList, m_ImageListDisabled; CStatic m_EditTempo, m_EditSpeed, m_EditOctave, m_EditRowsPerBeat; CStatic m_StaticTempo, m_StaticSpeed, m_StaticRowsPerBeat; CSpinButtonCtrl m_SpinTempo, m_SpinSpeed, m_SpinOctave, m_SpinRowsPerBeat; Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2014-03-26 13:37:36 UTC (rev 3968) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2014-03-26 15:41:15 UTC (rev 3969) @@ -309,10 +309,10 @@ static HMIDIIN shMidiIn; public: - CImageListEx m_MiscIcons; // Misc Icons - CImageListEx m_EnvelopeIcons; // Instrument editor icons - CImageListEx m_SampleIcons; // Sample editor icons - CImageListEx m_PatternIcons; // Pattern icons (includes some from sample editor as well...) + CImageListEx m_MiscIcons, m_MiscIconsDisabled; // Misc Icons + CImageListEx m_PatternIcons, m_PatternIconsDisabled; // Pattern icons (includes some from sample editor as well...) + CImageListEx m_EnvelopeIcons; // Instrument editor icons + CImageListEx m_SampleIcons; // Sample editor icons protected: Modified: trunk/OpenMPT/mptrack/view_com.cpp =================================================================== --- trunk/OpenMPT/mptrack/view_com.cpp 2014-03-26 13:37:36 UTC (rev 3968) +++ trunk/OpenMPT/mptrack/view_com.cpp 2014-03-26 15:41:15 UTC (rev 3969) @@ -147,7 +147,7 @@ } GetClientRect(&rect); m_ToolBar.Create(WS_CHILD|WS_VISIBLE|CCS_NOPARENTALIGN, rect, this, IDC_TOOLBAR_DETAILS); - m_ToolBar.Init(CMainFrame::GetMainFrame()->m_MiscIcons); + m_ToolBar.Init(CMainFrame::GetMainFrame()->m_MiscIcons, CMainFrame::GetMainFrame()->m_MiscIconsDisabled); m_ItemList.Create(WS_CHILD|WS_VISIBLE|LVS_REPORT|LVS_SINGLESEL|LVS_EDITLABELS|LVS_NOSORTHEADER, rect, this, IDC_LIST_DETAILS); m_ItemList.ModifyStyleEx(0, WS_EX_STATICEDGE); // Add ToolBar Buttons This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-03-26 20:54:58
|
Revision: 3970 http://sourceforge.net/p/modplug/code/3970 Author: saga-games Date: 2014-03-26 20:54:48 +0000 (Wed, 26 Mar 2014) Log Message: ----------- [Fix] Icons weren't displayed properly on screen bit depths lower than 16-bit. Modified Paths: -------------- trunk/OpenMPT/mptrack/CImageListEx.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainbar.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/PNG.cpp trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters Added Paths: ----------- trunk/OpenMPT/mptrack/CImageListEx.cpp trunk/OpenMPT/mptrack/PNG.h Added: trunk/OpenMPT/mptrack/CImageListEx.cpp =================================================================== --- trunk/OpenMPT/mptrack/CImageListEx.cpp (rev 0) +++ trunk/OpenMPT/mptrack/CImageListEx.cpp 2014-03-26 20:54:48 UTC (rev 3970) @@ -0,0 +1,94 @@ +/* + * CImageListEx.cpp + * ---------------- + * Purpose: A class that extends MFC's CImageList to handle alpha-blended images properly. + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + +#pragma once + +#include "stdafx.h" +#include "CImageListEx.h" +#include "PNG.h" + +bool CImageListEx::Create(UINT resourceID, int cx, int cy, int nInitial, int nGrow, CDC *dc, bool disabled) +{ + PNG::Bitmap *bitmap = PNG::ReadPNG(MAKEINTRESOURCE(resourceID)); + if(bitmap == nullptr) + { + return false; + } + + if(disabled) + { + // Grayed out icons + PNG::Pixel *pixel = bitmap->GetPixels(); + for(size_t i = bitmap->GetNumPixels(); i != 0; i--, pixel++) + { + if(pixel->a != 0) + { + uint8_t y = static_cast<uint8_t>(pixel->r * 0.299f + pixel->g * 0.587f + pixel->b * 0.114f); + pixel->r = pixel->g = pixel->b = y; + pixel->a /= 2; + } + } + } + + bool result; + + // Icons with alpha transparency screw up in Windows 2000 and older as well as Wine 1.4 and older. + // They all support 1-bit transparency, though, so we pre-multiply all pixels with the default button face colour and create a transparency mask. + // Additionally, since we create a bitmap that fits the device's bit depth, we apply this fix when using a bit depth that doesn't have an alpha channel. + if(!mpt::Windows::Version::IsAtLeast(mpt::Windows::Version::WinXP) + || mpt::Windows::Version::IsWine() + || GetDeviceCaps(dc->GetSafeHdc(), BITSPIXEL) * GetDeviceCaps(dc->GetSafeHdc(), PLANES) < 32) + { + PNG::Bitmap bitmapMask(bitmap->width, bitmap->height); + + const COLORREF buttonColor = GetSysColor(COLOR_BTNFACE); + const uint8_t r = GetRValue(buttonColor), g = GetGValue(buttonColor), b = GetBValue(buttonColor); + + PNG::Pixel *pixel = bitmap->GetPixels(), *mask = bitmapMask.GetPixels(); + for(size_t i = bitmap->GetNumPixels(); i != 0; i--, pixel++, mask++) + { + if(pixel->a != 0) + { + // Pixel not fully transparent - multiply with default background colour +#define MIXCOLOR(c) (((pixel->##c) * pixel->a + (c) * (255 - pixel->a)) >> 8); + pixel->r = MIXCOLOR(r); + pixel->g = MIXCOLOR(g); + pixel->b = MIXCOLOR(b); +#undef MIXCOLOR + mask->r = 0; + mask->g = 0; + mask->b = 0; + mask->a = 255; + } else + { + // Transparent pixel + mask->r = 255; + mask->g = 255; + mask->b = 255; + mask->a = 255; + } + } + + CBitmap dib, dibMask; + bitmap->ToDIB(dib); + bitmapMask.ToDIB(dibMask); + + result = CImageList::Create(cx, cy, ILC_COLOR24 | ILC_MASK, nInitial, nGrow) + && CImageList::Add(&dib, &dibMask); + } else + { + // 32-bit image on modern system + CBitmap dib; + bitmap->ToDIB(dib); + result = CImageList::Create(cx, cy, ILC_COLOR32, nInitial, nGrow) + && CImageList::Add(&dib, RGB(0, 0, 0)); + } + delete bitmap; + return true; +} Modified: trunk/OpenMPT/mptrack/CImageListEx.h =================================================================== --- trunk/OpenMPT/mptrack/CImageListEx.h 2014-03-26 15:41:15 UTC (rev 3969) +++ trunk/OpenMPT/mptrack/CImageListEx.h 2014-03-26 20:54:48 UTC (rev 3970) @@ -1,105 +1,17 @@ /* * CImageListEx.h * -------------- - * Purpose: A class that extends MFC's CImageList to handle alpha-blended images properly. Also provided 1-bit transparency fallback for legacy Win9x systems. + * Purpose: A class that extends MFC's CImageList to handle alpha-blended images properly. Also provided 1-bit transparency fallback when needed. * Notes : (currently none) * Authors: OpenMPT Devs * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. */ + #pragma once class CImageListEx : public CImageList { public: - bool Create(UINT resourceID, int cx, int cy, int nInitial, int nGrow, bool disabled = false) - { - CBitmap *bitmap = ReadPNG(MAKEINTRESOURCE(resourceID)); - if(bitmap == nullptr) - { - return false; - } - - BITMAP bm; - bitmap->GetBitmap(&bm); - const uint32_t bitmapSize = bm.bmWidthBytes * bm.bmHeight; - - std::vector<RGBQUAD> bitmapBytes(bitmapSize / sizeof(RGBQUAD)); - bitmap->GetBitmapBits(bitmapSize, &bitmapBytes[0]); - - if(disabled) - { - // Grayed out icons - RGBQUAD *pixel = &bitmapBytes[0]; - for(size_t i = bitmapBytes.size(); i != 0; i--, pixel++) - { - if(pixel->rgbReserved != 0) - { - uint8_t y = static_cast<uint8_t>(pixel->rgbRed * 0.299f + pixel->rgbGreen * 0.587f + pixel->rgbBlue * 0.114f); - pixel->rgbRed = pixel->rgbGreen = pixel->rgbBlue = y; - pixel->rgbReserved /= 2; - } - } - bitmap->SetBitmapBits(bitmapSize, &bitmapBytes[0]); - } - - // Icons with alpha transparency screw up in Windows 2000 and older as well as Wine 1.4 and older. - // They all support 1-bit transparency, though, so we pre-multiply all pixels with the default button face colour and create a transparency mask. - if(!mpt::Windows::Version::IsAtLeast(mpt::Windows::Version::WinXP) || mpt::Windows::Version::IsWine()) - { - CBitmap bitmapMask; - bitmapMask.CreateBitmapIndirect(&bm); - std::vector<RGBQUAD> maskBytes(bitmapSize / sizeof(RGBQUAD)); - - const COLORREF buttonColor = GetSysColor(COLOR_BTNFACE); - const uint8_t r = GetRValue(buttonColor), g = GetGValue(buttonColor), b = GetBValue(buttonColor); - - RGBQUAD *pixel = &bitmapBytes[0], *mask = &maskBytes[0]; - for(size_t i = bitmapBytes.size(); i != 0; i--, pixel++, mask++) - { - if(pixel->rgbReserved != 0) - { - // Pixel not fully transparent - multiply with default background colour -#define MIXCOLOR(a, b) (((a) * pixel->rgbReserved + (b) * (255 - pixel->rgbReserved)) >> 8); - pixel->rgbRed = MIXCOLOR(pixel->rgbRed, r); - pixel->rgbGreen = MIXCOLOR(pixel->rgbGreen, g); - pixel->rgbBlue = MIXCOLOR(pixel->rgbBlue, b); - pixel->rgbReserved = 255; -#undef MIXCOLOR - mask->rgbRed = 0; - mask->rgbGreen = 0; - mask->rgbBlue = 0; - mask->rgbReserved = 255; - } else - { - // Transparent pixel - mask->rgbRed = 255; - mask->rgbGreen = 255; - mask->rgbBlue = 255; - mask->rgbReserved = 255; - } - } - bitmap->SetBitmapBits(bitmapSize, &bitmapBytes[0]); - bitmapMask.SetBitmapBits(bitmapSize, &maskBytes[0]); - - if(!CImageList::Create(cx, cy, ILC_COLOR32 | ILC_MASK, nInitial, nGrow)) - { - delete bitmap; - return false; - } - CImageList::Add(bitmap, &bitmapMask); - bitmapMask.Detach(); - } else - { - if(!CImageList::Create(cx, cy, ILC_COLOR32, nInitial, nGrow)) - { - delete bitmap; - return false; - } - CImageList::Add(bitmap, RGB(0, 0, 0)); - } - bitmap->Detach(); - delete bitmap; - return true; - } + bool Create(UINT resourceID, int cx, int cy, int nInitial, int nGrow, CDC *dc, bool disabled = false); }; \ No newline at end of file Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-03-26 15:41:15 UTC (rev 3969) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-03-26 20:54:48 UTC (rev 3970) @@ -68,7 +68,7 @@ ON_COMMAND(ID_VIEW_MIDIMAPPING, OnViewMIDIMapping) //ON_COMMAND(ID_HELP, CMDIFrameWnd::OnHelp) ON_COMMAND(ID_VIEW_SONGPROPERTIES, OnSongProperties) - ON_COMMAND(ID_REPORT_BUG, OnReportBug) //rewbs.reportBug + ON_COMMAND(ID_REPORT_BUG, OnReportBug) ON_COMMAND(ID_NEXTOCTAVE, OnNextOctave) ON_COMMAND(ID_PREVOCTAVE, OnPrevOctave) ON_COMMAND_RANGE(ID_FILE_OPENTEMPLATE, ID_FILE_OPENTEMPLATE_LASTINRANGE, OnOpenTemplateModule) @@ -86,12 +86,12 @@ ON_UPDATE_COMMAND_UI(ID_INDICATOR_TIME, OnUpdateTime) ON_UPDATE_COMMAND_UI(ID_INDICATOR_USER, OnUpdateUser) ON_UPDATE_COMMAND_UI(ID_INDICATOR_INFO, OnUpdateInfo) - ON_UPDATE_COMMAND_UI(ID_INDICATOR_XINFO,OnUpdateXInfo) //rewbs.xinfo + ON_UPDATE_COMMAND_UI(ID_INDICATOR_XINFO,OnUpdateXInfo) ON_UPDATE_COMMAND_UI(IDD_TREEVIEW, OnUpdateControlBarMenu) ON_MESSAGE(WM_MOD_UPDATEPOSITION, OnUpdatePosition) ON_MESSAGE(WM_MOD_INVALIDATEPATTERNS, OnInvalidatePatterns) ON_MESSAGE(WM_MOD_SPECIALKEY, OnSpecialKey) - ON_MESSAGE(WM_MOD_KEYCOMMAND, OnCustomKeyMsg) //rewbs.customKeys + ON_MESSAGE(WM_MOD_KEYCOMMAND, OnCustomKeyMsg) ON_COMMAND(ID_INTERNETUPDATE, OnInternetUpdate) ON_COMMAND(ID_HELP_SHOWSETTINGSFOLDER, OnShowSettingsFolder) ON_COMMAND(ID_HELPSHOW, OnHelp) @@ -100,7 +100,7 @@ ON_UPDATE_COMMAND_UI(ID_MRU_LIST_FIRST, OnUpdateMRUItem) //}}AFX_MSG_MAP ON_WM_INITMENU() - ON_WM_KILLFOCUS() //rewbs.fix3116 + ON_WM_KILLFOCUS() ON_WM_MOUSEWHEEL() ON_WM_SHOWWINDOW() END_MESSAGE_MAP() @@ -123,7 +123,7 @@ HFONT CMainFrame::m_hFixedFont = NULL; HFONT CMainFrame::m_hLargeFixedFont = NULL; HPEN CMainFrame::penDarkGray = NULL; -HPEN CMainFrame::penScratch = NULL; //rewbs.fxVis +HPEN CMainFrame::penScratch = NULL; HPEN CMainFrame::penGray00 = NULL; HPEN CMainFrame::penGray33 = NULL; HPEN CMainFrame::penGray40 = NULL; @@ -131,7 +131,7 @@ HPEN CMainFrame::penGray80 = NULL; HPEN CMainFrame::penGray99 = NULL; HPEN CMainFrame::penGraycc = NULL; -HPEN CMainFrame::penGrayff = NULL; //end rewbs.fxVis +HPEN CMainFrame::penGrayff = NULL; HPEN CMainFrame::penLightGray = NULL; HPEN CMainFrame::penBlack = NULL; HPEN CMainFrame::penWhite = NULL; @@ -144,8 +144,6 @@ HBRUSH CMainFrame::brushBlack = NULL; HBRUSH CMainFrame::brushWhite = NULL; HBRUSH CMainFrame::brushText = NULL; -//CBrush *CMainFrame::pbrushBlack = NULL;//rewbs.envRowGrid -//CBrush *CMainFrame::pbrushWhite = NULL;//rewbs.envRowGrid HBRUSH CMainFrame::brushHighLight = NULL; HBRUSH CMainFrame::brushHighLightRed = NULL; @@ -163,13 +161,13 @@ LPMODPLUGDIB CMainFrame::bmpVisPcNode = NULL; COLORREF CMainFrame::gcolrefVuMeter[NUM_VUMETER_PENS*2]; -CInputHandler *CMainFrame::m_InputHandler = nullptr; //rewbs.customKeys -CAutoSaver *CMainFrame::m_pAutoSaver = nullptr; //rewbs.autosave +CInputHandler *CMainFrame::m_InputHandler = nullptr; +CAutoSaver *CMainFrame::m_pAutoSaver = nullptr; static UINT indicators[] = { ID_SEPARATOR, // status line indicator - ID_INDICATOR_XINFO, //rewbs.xinfo + ID_INDICATOR_XINFO, ID_INDICATOR_INFO, ID_INDICATOR_USER, ID_INDICATOR_TIME, @@ -187,10 +185,10 @@ m_AudioThreadId = 0; m_InNotifyHandler = false; - m_bModTreeHasFocus = false; //rewbs.customKeys - m_pNoteMapHasFocus = nullptr; //rewbs.customKeys + m_bModTreeHasFocus = false; + m_pNoteMapHasFocus = nullptr; m_pOrderlistHasFocus = nullptr; - m_bOptionsLocked = false; //rewbs.customKeys + m_bOptionsLocked = false; m_SoundCardOptionsDialog = nullptr; @@ -202,7 +200,7 @@ m_nAvgMixChn = m_nMixChn = 0; m_szUserText[0] = 0; m_szInfoText[0] = 0; - m_szXInfoText[0]= 0; //rewbs.xinfo + m_szXInfoText[0]= 0; MemsetZero(gcolrefVuMeter); @@ -210,7 +208,7 @@ MemsetZero(g_csAudio); InitializeCriticalSection(&g_csAudio); - m_InputHandler = new CInputHandler(this); //rewbs.customKeys + m_InputHandler = new CInputHandler(this); //Loading static tunings here - probably not the best place to do that but anyway. CSoundFile::LoadStaticTunings(); @@ -276,8 +274,8 @@ //----------------------- { DeleteCriticalSection(&g_csAudio); - delete m_InputHandler; //rewbs.customKeys - delete m_pAutoSaver; //rewbs.autosaver + delete m_InputHandler; + delete m_pAutoSaver; CChannelManagerDlg::DestroySharedInstance(); CSoundFile::DeleteStaticdata(); @@ -290,12 +288,13 @@ // Load resources m_hIcon = theApp.LoadIcon(IDR_MAINFRAME); - m_MiscIcons.Create(IDB_IMAGELIST, 16, 16, IMGLIST_NUMIMAGES, 1); - m_MiscIconsDisabled.Create(IDB_IMAGELIST, 16, 16, IMGLIST_NUMIMAGES, 1, true); - m_PatternIcons.Create(IDB_PATTERNS, 16, 16, PATTERNIMG_NUMIMAGES, 1); - m_PatternIconsDisabled.Create(IDB_PATTERNS, 16, 16, PATTERNIMG_NUMIMAGES, 1, true); - m_EnvelopeIcons.Create(IDB_ENVTOOLBAR, 20, 18, ENVIMG_NUMIMAGES, 1); - m_SampleIcons.Create(IDB_SMPTOOLBAR, 20, 18, SAMPLEIMG_NUMIMAGES, 1); + // Toolbar and other icons + m_MiscIcons.Create(IDB_IMAGELIST, 16, 16, IMGLIST_NUMIMAGES, 1, GetDC()); + m_MiscIconsDisabled.Create(IDB_IMAGELIST, 16, 16, IMGLIST_NUMIMAGES, 1, GetDC(), true); + m_PatternIcons.Create(IDB_PATTERNS, 16, 16, PATTERNIMG_NUMIMAGES, 1, GetDC()); + m_PatternIconsDisabled.Create(IDB_PATTERNS, 16, 16, PATTERNIMG_NUMIMAGES, 1, GetDC(), true); + m_EnvelopeIcons.Create(IDB_ENVTOOLBAR, 20, 18, ENVIMG_NUMIMAGES, 1, GetDC()); + m_SampleIcons.Create(IDB_SMPTOOLBAR, 20, 18, SAMPLEIMG_NUMIMAGES, 1, GetDC()); m_hGUIFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); m_hFixedFont = ::CreateFont(12,5, 0,0, 300, @@ -1864,7 +1863,7 @@ void CMainFrame::OnViewOptions() //------------------------------ { - if (m_bOptionsLocked) //rewbs.customKeys + if (m_bOptionsLocked) return; CPropertySheet dlg("OpenMPT Setup", this, m_nLastOptionsPage); @@ -1875,7 +1874,7 @@ COptionsColors colors; COptionsMixer mixerdlg; CMidiSetupDlg mididlg(TrackerSettings::Instance().m_dwMidiSetup, TrackerSettings::Instance().m_nMidiDevice); - CAutoSaverGUI autosavedlg(m_pAutoSaver); //rewbs.AutoSaver + CAutoSaverGUI autosavedlg(m_pAutoSaver); CUpdateSetupDlg updatedlg; #if defined(MPT_SETTINGS_CACHE) COptionsAdvanced advanced; @@ -1896,11 +1895,11 @@ #if defined(MPT_SETTINGS_CACHE) dlg.AddPage(&advanced); #endif // MPT_SETTINGS_CACHE - m_bOptionsLocked=true; //rewbs.customKeys + m_bOptionsLocked = true; m_SoundCardOptionsDialog = &sounddlg; dlg.DoModal(); m_SoundCardOptionsDialog = nullptr; - m_bOptionsLocked=false; //rewbs.customKeys + m_bOptionsLocked = false; m_wndTree.OnOptionsChanged(); } @@ -2130,7 +2129,7 @@ return NULL; } -//rewbs.customKeys + CView *CMainFrame::GetActiveView() //--------------------------------- { @@ -2140,10 +2139,10 @@ return pMDIActive->GetActiveView(); } - return NULL; + return nullptr; } -//end rewbs.customKeys + void CMainFrame::SwitchToActiveView() //----------------------------------- { @@ -2341,15 +2340,15 @@ SwitchToActiveView(); } -//rewbs.reportBug + void CMainFrame::OnReportBug() //---------------------------- { CTrackApp::OpenURL("http://bugs.openmpt.org/"); return; } -//end rewbs.reportBug + BOOL CMainFrame::OnInternetLink(UINT nID) //--------------------------------------- { Modified: trunk/OpenMPT/mptrack/Mainbar.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp 2014-03-26 15:41:15 UTC (rev 3969) +++ trunk/OpenMPT/mptrack/Mainbar.cpp 2014-03-26 20:54:48 UTC (rev 3970) @@ -231,8 +231,8 @@ if (!CToolBar::Create(parent, dwStyle)) return FALSE; - m_ImageList.Create(IDB_MAINBAR, 16, 16, IMGLIST_NUMIMAGES, 1); - m_ImageListDisabled.Create(IDB_MAINBAR, 16, 16, IMGLIST_NUMIMAGES, 1, true); + m_ImageList.Create(IDB_MAINBAR, 16, 16, IMGLIST_NUMIMAGES, 1, GetDC()); + m_ImageListDisabled.Create(IDB_MAINBAR, 16, 16, IMGLIST_NUMIMAGES, 1, GetDC(), true); GetToolBarCtrl().SetImageList(&m_ImageList); GetToolBarCtrl().SetDisabledImageList(&m_ImageListDisabled); Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2014-03-26 15:41:15 UTC (rev 3969) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2014-03-26 20:54:48 UTC (rev 3970) @@ -254,16 +254,17 @@ #define TIMERID_GUI 1 #define TIMERID_NOTIFY 2 -extern CBitmap *ReadPNG(const TCHAR *resource); #include "CImageListEx.h" #include "Mainbar.h" #include "TrackerSettings.h" struct MODPLUGDIB; -template<> inline SettingValue ToSettingValue(const WINDOWPLACEMENT &val) { +template<> inline SettingValue ToSettingValue(const WINDOWPLACEMENT &val) +{ return SettingValue(EncodeBinarySetting<WINDOWPLACEMENT>(val), "WINDOWPLACEMENT"); } -template<> inline WINDOWPLACEMENT FromSettingValue(const SettingValue &val) { +template<> inline WINDOWPLACEMENT FromSettingValue(const SettingValue &val) +{ ASSERT(val.GetTypeTag() == "WINDOWPLACEMENT"); return DecodeBinarySetting<WINDOWPLACEMENT>(val.as<std::vector<char> >()); } Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-03-26 15:41:15 UTC (rev 3969) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-03-26 20:54:48 UTC (rev 3970) @@ -29,6 +29,7 @@ #include "CloseMainDialog.h" #include "AutoSaver.h" #include "FileDialog.h" +#include "PNG.h" // rewbs.memLeak #define _CRTDBG_MAP_ALLOC @@ -1553,7 +1554,7 @@ //================================= { protected: - CBitmap *m_Bitmap; + CBitmap m_Bitmap; BITMAP bm; public: @@ -1578,11 +1579,7 @@ CSplashScreen::CSplashScreen(CWnd *parent) //---------------------------------------- { - m_Bitmap = ReadPNG(MAKEINTRESOURCE(IDB_SPLASHNOFOLDFIN)); - m_Bitmap->GetBitmap(&bm); - Create(IDD_SPLASHSCREEN, parent); - ASSERT(m_Bitmap); } @@ -1590,8 +1587,6 @@ //----------------------------- { gpSplashScreen = NULL; - m_Bitmap->DeleteObject(); - delete m_Bitmap; } @@ -1604,7 +1599,7 @@ CDC hdcMem; hdcMem.CreateCompatibleDC(&dc); - CBitmap *oldBitmap = hdcMem.SelectObject(m_Bitmap); + CBitmap *oldBitmap = hdcMem.SelectObject(&m_Bitmap); dc.BitBlt(0, 0, bm.bmWidth, bm.bmHeight, &hdcMem, 0, 0, SRCCOPY); hdcMem.SelectObject(oldBitmap); hdcMem.DeleteDC(); @@ -1616,6 +1611,9 @@ BOOL CSplashScreen::OnInitDialog() //-------------------------------- { + PNG::ReadPNG(MAKEINTRESOURCE(IDB_SPLASHNOFOLDFIN))->ToDIB(m_Bitmap, GetDC()); + m_Bitmap.GetBitmap(&bm); + CRect rect; int cx, cy, newcx, newcy; Modified: trunk/OpenMPT/mptrack/PNG.cpp =================================================================== --- trunk/OpenMPT/mptrack/PNG.cpp 2014-03-26 15:41:15 UTC (rev 3969) +++ trunk/OpenMPT/mptrack/PNG.cpp 2014-03-26 20:54:48 UTC (rev 3970) @@ -11,6 +11,7 @@ #include "stdafx.h" #include "MPTrackUtil.h" +#include "PNG.h" #include "../soundlib/FileReader.h" #if !defined(NO_ZLIB) #include <zlib.h> @@ -20,8 +21,8 @@ #endif -CBitmap *ReadPNG(FileReader &file) -//-------------------------------- +PNG::Bitmap *PNG::ReadPNG(FileReader &file) +//----------------------------------------- { file.Rewind(); if(!file.ReadMagic("\211PNG\r\n\032\n")) @@ -38,7 +39,7 @@ uint8_t interlaceMethod; std::vector<uint8_t> dataIn; - std::vector<RGBQUAD> palette; + std::vector<Pixel> palette; while(file.AreBytesLeft()) { @@ -46,7 +47,7 @@ char magic[4]; file.ReadArray(magic); FileReader chunk = file.ReadChunk(chunkLength); - file.Skip(4); + file.Skip(4); // CRC32 if(!memcmp(magic, "IHDR", 4)) { // Image header @@ -87,12 +88,8 @@ size_t numEntries = std::min<size_t>(256u, chunk.GetLength() / 3u); for(size_t i = 0; i < numEntries; i++) { - RGBQUAD col; - col.rgbRed = chunk.ReadUint8(); - col.rgbGreen = chunk.ReadUint8(); - col.rgbBlue = chunk.ReadUint8(); - col.rgbReserved = 255; - palette[i] = col; + uint8_t r = chunk.ReadUint8(), g = chunk.ReadUint8(), b = chunk.ReadUint8(); + palette[i] = Pixel(r, g, b, 255); } } } @@ -113,25 +110,15 @@ if(!width || !height || !bitsPerPixel || (colorType != 2 && colorType != 3 && colorType != 6) || bitDepth != 8 // Only RGB(A) and 8-bit palette PNGs for now. || compressionMethod || interlaceMethod + || (colorType == 3 && palette.empty()) || dataIn.size() < (bitsPerPixel * width * height) / 8 + height) // Enough data present? { return nullptr; } - CBitmap *bitmap = new CBitmap; - if(!bitmap->CreateBitmap(width, height, 1, 32, nullptr)) - { - delete bitmap; - return nullptr; - } + Bitmap *bitmap = new (std::nothrow) Bitmap(width, height); - const uint32_t imageSize = width * height * sizeof(RGBQUAD); - std::vector<RGBQUAD> dataOut(width * height); - bitmap->GetBitmapBits(imageSize, &dataOut[0]); - - FileReader imageData(&dataIn[0], dataIn.size()); - - RGBQUAD *pixelOut = &dataOut[0]; + Pixel *pixelOut = bitmap->GetPixels(); uint32_t x = 0, y = 0; size_t offset = 0; while(y < height) @@ -145,31 +132,17 @@ if(colorType == 6) { // RGBA - struct PNGPixel32 - { - uint8_t r, g, b, a; - }; - - const PNGPixel32 &inPixel = reinterpret_cast<const PNGPixel32 &>(dataIn[offset]); - pixelOut->rgbRed = inPixel.r; - pixelOut->rgbGreen = inPixel.g; - pixelOut->rgbBlue = inPixel.b; - pixelOut->rgbReserved= inPixel.a; - offset += 4; + pixelOut->r = dataIn[offset++]; + pixelOut->g = dataIn[offset++]; + pixelOut->b = dataIn[offset++]; + pixelOut->a = dataIn[offset++]; } else if(colorType == 2) { // RGB - struct PNGPixel24 - { - uint8_t r, g, b; - }; - - const PNGPixel24 &inPixel = reinterpret_cast<const PNGPixel24 &>(dataIn[offset]); - pixelOut->rgbRed = inPixel.r; - pixelOut->rgbGreen = inPixel.g; - pixelOut->rgbBlue = inPixel.b; - pixelOut->rgbReserved= 255; - offset += 3; + pixelOut->r = dataIn[offset++]; + pixelOut->g = dataIn[offset++]; + pixelOut->b = dataIn[offset++]; + pixelOut->a = 255; } else if(colorType == 3) { // Palette @@ -185,13 +158,12 @@ } } - bitmap->SetBitmapBits(imageSize, &dataOut[0]); return bitmap; } -CBitmap *ReadPNG(const TCHAR *resource) -//------------------------------------- +PNG::Bitmap *PNG::ReadPNG(const TCHAR *resource) +//---------------------------------------------- { const char *pData = nullptr; HGLOBAL hglob = nullptr; @@ -203,8 +175,28 @@ FileReader file(pData, nSize); - CBitmap *bitmap = ReadPNG(file); + Bitmap *bitmap = ReadPNG(file); FreeResource(hglob); return bitmap; } + + +// Create a DIB for the current device from our PNG. +bool PNG::Bitmap::ToDIB(CBitmap &bitmap, CDC *dc) const +//----------------------------------------------------- +{ + BITMAPINFOHEADER bi; + MemsetZero(bi); + bi.biSize = sizeof(BITMAPINFOHEADER); + bi.biWidth = width; + bi.biHeight = -(int32_t)height; + bi.biPlanes = 1; + bi.biBitCount = 32; + bi.biCompression = BI_RGB; + bi.biSizeImage = width * height * 4; + + if(dc == nullptr) dc = CDC::FromHandle(GetDC(NULL)); + return bitmap.CreateCompatibleBitmap(dc, width, height) + && SetDIBits(dc->GetSafeHdc(), bitmap, 0, height, GetPixels(), reinterpret_cast<BITMAPINFO *>(&bi), DIB_RGB_COLORS); +}; Added: trunk/OpenMPT/mptrack/PNG.h =================================================================== --- trunk/OpenMPT/mptrack/PNG.h (rev 0) +++ trunk/OpenMPT/mptrack/PNG.h 2014-03-26 20:54:48 UTC (rev 3970) @@ -0,0 +1,40 @@ +/* + * PNG.h + * ----- + * Purpose: Extremely minimalistic PNG loader. + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + + +#pragma once + +class FileReader; + +namespace PNG +{ + struct Pixel + { + uint8_t b, g, r, a; // Component order must be compatible with Microsoft DIBs! + Pixel(uint8_t r = 0, uint8_t g = 0, uint8_t b = 0, uint8_t a = 0) : b(b), g(g), r(r), a(a) { } + }; + + struct Bitmap + { + const uint32_t width, height; + std::vector<Pixel> pixels; + + Bitmap(uint32_t width, uint32_t height) : width(width), height(height), pixels(width * height) { } + + Pixel *GetPixels() { ASSERT(!pixels.empty()); return &pixels[0]; } + const Pixel *GetPixels() const { ASSERT(!pixels.empty()); return &pixels[0]; } + uint32_t GetNumPixels() const { return width * height; } + + // Create a DIB for the current device from our PNG. + bool ToDIB(CBitmap &bitmap, CDC *dc = nullptr) const; + }; + + Bitmap *ReadPNG(FileReader &file); + Bitmap *ReadPNG(const TCHAR *resource); +} Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-03-26 15:41:15 UTC (rev 3969) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-03-26 20:54:48 UTC (rev 3970) @@ -460,6 +460,10 @@ > </File> <File + RelativePath=".\CImageListEx.cpp" + > + </File> + <File RelativePath=".\CleanupSong.cpp" > </File> @@ -1370,6 +1374,10 @@ > </File> <File + RelativePath=".\PNG.h" + > + </File> + <File RelativePath=".\soundlib\plugins\PluginEventQueue.h" > </File> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2014-03-26 15:41:15 UTC (rev 3969) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2014-03-26 20:54:48 UTC (rev 3970) @@ -520,6 +520,7 @@ <ClCompile Include="Autotune.cpp" /> <ClCompile Include="ChannelManagerDlg.cpp" /> <ClCompile Include="Childfrm.cpp" /> + <ClCompile Include="CImageListEx.cpp" /> <ClCompile Include="CleanupSong.cpp" /> <ClCompile Include="CloseMainDialog.cpp" /> <ClCompile Include="ColourEdit.cpp" /> @@ -757,6 +758,7 @@ <ClInclude Include="Notification.h" /> <ClInclude Include="PatternClipboard.h" /> <ClInclude Include="PatternCursor.h" /> + <ClInclude Include="PNG.h" /> <ClInclude Include="Reporting.h" /> <ClInclude Include="resource.h" /> <ClInclude Include="SelectPluginDialog.h" /> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2014-03-26 15:41:15 UTC (rev 3969) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2014-03-26 20:54:48 UTC (rev 3970) @@ -364,9 +364,6 @@ <ClCompile Include="PatternClipboard.cpp"> <Filter>Source Files\mptrack</Filter> </ClCompile> - <ClCompile Include="SelectPluginDialog.cpp"> - <Filter>Source Files\mptrack</Filter> - </ClCompile> <ClCompile Include="TrackerSettings.cpp"> <Filter>Source Files\mptrack</Filter> </ClCompile> @@ -484,9 +481,6 @@ <ClCompile Include="Settings.cpp"> <Filter>Source Files\mptrack</Filter> </ClCompile> - <ClCompile Include="FileDialog.cpp"> - <Filter>Source Files\mptrack</Filter> - </ClCompile> <ClCompile Include="..\common\mptPathString.cpp"> <Filter>Source Files\common</Filter> </ClCompile> @@ -514,6 +508,15 @@ <ClCompile Include="PNG.cpp"> <Filter>Source Files\mptrack</Filter> </ClCompile> + <ClCompile Include="FileDialog.cpp"> + <Filter>Source Files\mptrack\Dialogs</Filter> + </ClCompile> + <ClCompile Include="SelectPluginDialog.cpp"> + <Filter>Source Files\mptrack\Dialogs</Filter> + </ClCompile> + <ClCompile Include="CImageListEx.cpp"> + <Filter>Source Files\mptrack</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\soundlib\Loaders.h"> @@ -960,9 +963,6 @@ <ClInclude Include="..\common\mptFstream.h"> <Filter>Header Files\common</Filter> </ClInclude> - <ClInclude Include="FileDialog.h"> - <Filter>Header Files\mptrack</Filter> - </ClInclude> <ClInclude Include="..\common\mptPathString.h"> <Filter>Header Files\common</Filter> </ClInclude> @@ -1006,8 +1006,14 @@ <Filter>Header Files\pluginBridgeWrapper</Filter> </ClInclude> <ClInclude Include="CImageListEx.h"> - <Filter>Header Files</Filter> + <Filter>Header Files\mptrack</Filter> </ClInclude> + <ClInclude Include="FileDialog.h"> + <Filter>Header Files\mptrack\Dialogs</Filter> + </ClInclude> + <ClInclude Include="PNG.h"> + <Filter>Header Files\mptrack</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="res\bitmap1.bmp"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-03-27 02:49:01
|
Revision: 3972 http://sourceforge.net/p/modplug/code/3972 Author: saga-games Date: 2014-03-27 02:48:52 +0000 (Thu, 27 Mar 2014) Log Message: ----------- [Mod] After ten years, it's time time for a new About dialog toy (I may or may not have been bored). Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/mptrack.rc Added Paths: ----------- trunk/OpenMPT/mptrack/res/mptrack.png Removed Paths: ------------- trunk/OpenMPT/mptrack/res/mptrack.bmp Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-03-26 21:00:28 UTC (rev 3971) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-03-27 02:48:52 UTC (rev 3972) @@ -1221,252 +1221,219 @@ // CAboutDlg dialog used for App About //=============================== -class CPaletteBitmap: public CWnd +class CRippleBitmap: public CWnd //=============================== { protected: - LPBITMAPINFO m_lpBmp, m_lpCopy; - HPALETTE m_hPal; - LPBYTE m_lpRotoZoom; - DWORD m_dwStartTime, m_dwFrameTime; - UINT m_nRotoWidth, m_nRotoHeight; - BOOL m_bFirst; + BITMAPINFOHEADER bi; + PNG::Bitmap *bitmapSrc, *bitmapTarget; + std::vector<int32_t> offset1, offset2; + int32_t *frontBuf, *backBuf; + DWORD lastFrame; // Time of last frame + bool frame; // Backbuffer toggle + bool damp; // Ripple damping status + bool activity; // There are actually some ripples + bool showMouse; public: - CPaletteBitmap() { m_hPal = NULL; m_lpBmp = NULL; m_lpRotoZoom = NULL; m_lpCopy = NULL; m_bFirst = TRUE; } - ~CPaletteBitmap(); - void LoadBitmap(LPCSTR lpszResource); - BOOL Animate(); - UINT GetWidth() const { return (m_lpBmp) ? m_lpBmp->bmiHeader.biWidth : 0; } - UINT GetHeight() const { return (m_lpBmp) ? m_lpBmp->bmiHeader.biHeight : 0; } + CRippleBitmap(); + ~CRippleBitmap(); + bool Animate(); + uint32_t Width() const { return bitmapSrc->width; } + uint32_t Height() const { return bitmapSrc->height; } protected: - afx_msg void OnPaint(); - afx_msg BOOL OnEraseBkgnd(CDC *) { return TRUE; } - afx_msg void OnLButtonDblClk(UINT, CPoint) { m_dwStartTime = timeGetTime(); } + virtual void OnPaint(); + virtual BOOL OnEraseBkgnd(CDC *) { return TRUE; } + DECLARE_MESSAGE_MAP() + void OnMouseMove(UINT nFlags, CPoint point); + void OnMouseHover(UINT nFlags, CPoint point) { OnMouseMove(nFlags, point); } + void OnMouseLeave(); }; -static CPaletteBitmap *gpRotoZoom = NULL; +static CRippleBitmap *gpAboutAnimation = nullptr; -BEGIN_MESSAGE_MAP(CPaletteBitmap, CWnd) +BEGIN_MESSAGE_MAP(CRippleBitmap, CWnd) ON_WM_PAINT() ON_WM_ERASEBKGND() - ON_WM_LBUTTONDBLCLK() + ON_WM_MOUSEMOVE() + ON_WM_MOUSEHOVER() + ON_WM_MOUSELEAVE() END_MESSAGE_MAP() -void CPaletteBitmap::LoadBitmap(LPCSTR lpszResource) -//-------------------------------------------------- +CRippleBitmap::CRippleBitmap() +//---------------------------- { - m_hPal = NULL; - m_lpBmp = NULL; - // True Color Mode ? - HDC hdc = ::GetDC(AfxGetApp()->m_pMainWnd->m_hWnd); - int nbits = GetDeviceCaps(hdc, BITSPIXEL); - ::ReleaseDC(AfxGetApp()->m_pMainWnd->m_hWnd, hdc); - // Creating palette - HINSTANCE hInstance = AfxGetInstanceHandle(); - HRSRC hrsrc = FindResource(hInstance, lpszResource, RT_BITMAP); - HGLOBAL hglb = LoadResource(hInstance, hrsrc); - LPBITMAPINFO p = (LPBITMAPINFO)LockResource(hglb); - m_lpBmp = p; - m_nRotoWidth = m_nRotoHeight = 0; - if (p) + bitmapSrc = PNG::ReadPNG(MAKEINTRESOURCE(IDB_MPTRACK)); + bitmapTarget = new PNG::Bitmap(bitmapSrc->width, bitmapSrc->height); + offset1.assign(bitmapSrc->GetNumPixels(), 0); + offset2.assign(bitmapSrc->GetNumPixels(), 0); + frontBuf = &offset2[0]; + backBuf = &offset1[0]; + activity = true; + lastFrame = 0; + frame = false; + damp = true; + showMouse = true; + + // Pre-fill first and last row of output bitmap, since those won't be touched. + const PNG::Pixel *in1 = bitmapSrc->GetPixels(), *in2 = bitmapSrc->GetPixels() + (bitmapSrc->height - 1) * bitmapSrc->width; + PNG::Pixel *out1 = bitmapTarget->GetPixels(), *out2 = bitmapTarget->GetPixels() + (bitmapSrc->height - 1) * bitmapSrc->width; + for(uint32_t i = 0; i < bitmapSrc->width; i++) { - char pal_buf[sizeof(LOGPALETTE) + 512*sizeof(PALETTEENTRY)]; - LPLOGPALETTE pal = (LPLOGPALETTE)&pal_buf[0]; - for (int i=0; i<256; i++) - { - pal->palPalEntry[i].peRed = p->bmiColors[i].rgbRed; - pal->palPalEntry[i].peGreen = p->bmiColors[i].rgbGreen; - pal->palPalEntry[i].peBlue = p->bmiColors[i].rgbBlue; - pal->palPalEntry[i].peFlags = 0; - } - pal->palVersion = 0x300; - pal->palNumEntries = 256; - if (nbits <= 8) m_hPal = CreatePalette(pal); - if ((p->bmiHeader.biWidth == 256) && (p->bmiHeader.biHeight == 128)) - { - UINT n; - CRect rect; - GetClientRect(&rect); - m_nRotoWidth = (rect.Width() + 3) & ~3; - m_nRotoHeight = rect.Height(); - if ((n = m_nRotoWidth - rect.Width()) > 0) - { - GetWindowRect(&rect); - SetWindowPos(NULL, 0,0, rect.Width()+n, rect.Height(), SWP_NOMOVE | SWP_NOZORDER); - } - m_lpRotoZoom = new BYTE[m_nRotoWidth*m_nRotoHeight]; - if (m_lpRotoZoom) - { - memset(m_lpRotoZoom, 0, m_nRotoWidth*m_nRotoHeight); - m_lpCopy = (LPBITMAPINFO)(new char [sizeof(BITMAPINFO) + 256*sizeof(RGBQUAD)]); - if (m_lpCopy) - { - memcpy(m_lpCopy, p, sizeof(BITMAPINFO) + 256*sizeof(RGBQUAD)); - m_lpCopy->bmiHeader.biWidth = m_nRotoWidth; - m_lpCopy->bmiHeader.biHeight = m_nRotoHeight; - m_lpCopy->bmiHeader.biSizeImage = m_nRotoWidth * m_nRotoHeight; - } - gpRotoZoom = this; - } + *(out1++) = *(in1++); + *(out2++) = *(in2++); + } - } - } - m_dwStartTime = timeGetTime(); - m_dwFrameTime = 0; + MemsetZero(bi); + bi.biSize = sizeof(BITMAPINFOHEADER); + bi.biWidth = bitmapSrc->width; + bi.biHeight = -(int32_t)bitmapSrc->height; + bi.biPlanes = 1; + bi.biBitCount = 32; + bi.biCompression = BI_RGB; + bi.biSizeImage = bitmapSrc->width * bitmapSrc->height * 4; + + gpAboutAnimation = this; } -CPaletteBitmap::~CPaletteBitmap() -//------------------------------- +CRippleBitmap::~CRippleBitmap() +//----------------------------- { - if (gpRotoZoom == this) gpRotoZoom = NULL; - if (m_hPal) + delete bitmapSrc; + delete bitmapTarget; + if (gpAboutAnimation == this) gpAboutAnimation = nullptr; +} + + +void CRippleBitmap::OnMouseMove(UINT nFlags, CPoint point) +//-------------------------------------------------------- +{ + // Initiate ripples at cursor location + Limit(point.x, 1, int(bitmapSrc->width) - 2); + Limit(point.y, 2, int(bitmapSrc->height) - 3); + int32_t *p = backBuf + point.x + point.y * bitmapSrc->width; + p[0] += (nFlags & MK_LBUTTON) ? 50 : 150; + p[0] += (nFlags & MK_MBUTTON) ? 150 : 0; + + int32_t w = bitmapSrc->width; + // Make the initial point of this ripple a bit "fatter". + p[-1] += p[0] / 2; p[1] += p[0] / 2; + p[-w] += p[0] / 2; p[w] += p[0] / 2; + p[-w - 1] += p[0] / 4; p[-w + 1] += p[0] / 4; + p[w - 1] += p[0] / 4; p[w + 1] += p[0] / 4; + + damp = !(nFlags & MK_RBUTTON); + activity = true; + + TRACKMOUSEEVENT me; + me.cbSize = sizeof(TRACKMOUSEEVENT); + me.dwFlags = TME_LEAVE | TME_HOVER; + me.hwndTrack = m_hWnd; + me.dwHoverTime = 1500; + + if(TrackMouseEvent(&me) && showMouse) { - DeleteObject(m_hPal); - m_hPal = NULL; + ShowCursor(FALSE); + showMouse = false; } - if (m_lpRotoZoom) - { - delete[] m_lpRotoZoom; - m_lpRotoZoom = NULL; - } - if (m_lpCopy) - { - delete[] m_lpCopy; - m_lpCopy = NULL; - } } -void CPaletteBitmap::OnPaint() -//---------------------------- +void CRippleBitmap::OnMouseLeave() +//-------------------------------- { - CPaintDC dc(this); - HDC hdc = dc.m_hDC; - HPALETTE oldpal = NULL; - LPBITMAPINFO lpdib; - if (m_hPal) + if(!showMouse) { - oldpal = SelectPalette(hdc, m_hPal, FALSE); - RealizePalette(hdc); + ShowCursor(TRUE); + showMouse = true; } - if ((lpdib = m_lpBmp) != NULL) - { - if ((m_lpRotoZoom) && (m_lpCopy)) - { - lpdib = m_lpCopy; - SetDIBitsToDevice(hdc, - 0, - 0, - m_nRotoWidth, - m_nRotoHeight, - 0, - 0, - 0, - lpdib->bmiHeader.biHeight, - m_lpRotoZoom, - lpdib, - DIB_RGB_COLORS); - } else - { - CRect rect; - GetClientRect(&rect); - StretchDIBits(hdc, - 0, - 0, - rect.right, - rect.bottom, - 0, - 0, - lpdib->bmiHeader.biWidth, - lpdib->bmiHeader.biHeight, - &lpdib->bmiColors[256], - lpdib, - DIB_RGB_COLORS, - SRCCOPY); - } - } - if (oldpal) SelectPalette(hdc, oldpal, FALSE); } -//////////////////////////////////////////////////////////////////// -// RotoZoomer -const int __SinusTable[256] = +void CRippleBitmap::OnPaint() +//--------------------------- { - 0, 6, 12, 18, 25, 31, 37, 43, 49, 56, 62, 68, 74, 80, 86, 92, - 97, 103, 109, 115, 120, 126, 131, 136, 142, 147, 152, 157, 162, 167, 171, 176, - 181, 185, 189, 193, 197, 201, 205, 209, 212, 216, 219, 222, 225, 228, 231, 234, - 236, 238, 241, 243, 244, 246, 248, 249, 251, 252, 253, 254, 254, 255, 255, 255, - 256, 255, 255, 255, 254, 254, 253, 252, 251, 249, 248, 246, 244, 243, 241, 238, - 236, 234, 231, 228, 225, 222, 219, 216, 212, 209, 205, 201, 197, 193, 189, 185, - 181, 176, 171, 167, 162, 157, 152, 147, 142, 136, 131, 126, 120, 115, 109, 103, - 97, 92, 86, 80, 74, 68, 62, 56, 49, 43, 37, 31, 25, 18, 12, 6, - 0, -6, -12, -18, -25, -31, -37, -43, -49, -56, -62, -68, -74, -80, -86, -92, - -97,-103,-109,-115,-120,-126,-131,-136,-142,-147,-152,-157,-162,-167,-171,-176, - -181,-185,-189,-193,-197,-201,-205,-209,-212,-216,-219,-222,-225,-228,-231,-234, - -236,-238,-241,-243,-244,-246,-248,-249,-251,-252,-253,-254,-254,-255,-255,-255, - -256,-255,-255,-255,-254,-254,-253,-252,-251,-249,-248,-246,-244,-243,-241,-238, - -236,-234,-231,-228,-225,-222,-219,-216,-212,-209,-205,-201,-197,-193,-189,-185, - -181,-176,-171,-167,-162,-157,-152,-147,-142,-136,-131,-126,-120,-115,-109,-103, - -97, -92, -86, -80, -74, -68, -62, -56, -49, -43, -37, -31, -25, -18, -12, -6 -}; + CPaintDC dc(this); -#define Sinus(x) __SinusTable[(x)&0xFF] -#define Cosinus(x) __SinusTable[((x)+0x40)&0xFF] + SetDIBitsToDevice(dc.m_hDC, + 0, 0, + bitmapTarget->width, bitmapTarget->height, 0, 0, + 0, bitmapTarget->height, + bitmapTarget->GetPixels(), reinterpret_cast<BITMAPINFO *>(&bi), DIB_RGB_COLORS); +} -#define PI 3.14159265358979323f -BOOL CPaletteBitmap::Animate() -//---------------------------- + +bool CRippleBitmap::Animate() +//--------------------------- { - //included random hacking by rewbs to get funny animation. - LPBYTE dest, src; - DWORD t = (timeGetTime() - m_dwStartTime) / 10; - LONG Dist, Phi, srcx, srcy, spdx, spdy, sizex, sizey; - bool dir; + // Were there any pixels being moved in the last frame? + if(!activity) + return FALSE; - if ((!m_lpRotoZoom) || (!m_lpBmp) || (!m_nRotoWidth) || (!m_nRotoHeight)) return FALSE; - Sleep(2); //give away some CPU + DWORD now = timeGetTime(); + if(now - lastFrame < 15) + return TRUE; + lastFrame = now; + activity = false; - if (t > 256) - m_bFirst = FALSE; + frontBuf = &(frame ? offset2 : offset1)[0]; + backBuf = &(frame ? offset1 : offset2)[0]; - dir = ((t/256) % 2 != 0); //change dir every 256 t - t = t%256; - if (!dir) t = (256-t); + // Spread the ripples... + const int32_t w = bitmapSrc->width, h = bitmapSrc->height; + const int32_t numPixels = w * (h - 2); + const int32_t *back = backBuf + w; + int32_t *front = frontBuf + w; + for(int32_t i = numPixels; i != 0; i--, back++, front++) + { + (*front) = (back[-1] + back[1] + back[w] + back[-w]) / 2 - (*front); + if(damp) (*front) -= (*front) >> 5; + } - sizex = m_nRotoWidth; - sizey = m_nRotoHeight; - m_dwFrameTime = t; - src = (LPBYTE)&m_lpBmp->bmiColors[256]; - dest = m_lpRotoZoom; - Dist = t; - Phi = t; - spdx = 70000 + Sinus(Phi) * 10000 / 256; - spdy = 0; - spdx =(Cosinus(Phi)+Sinus(Phi<<2))*(Dist<<9)/sizex; - spdy =(Sinus(Phi)+Cosinus(Phi>>2))*(Dist<<9)/sizey; - srcx = 0x800000 - ((spdx * sizex) >> 1) + (spdy * sizey); - srcy = 0x800000 - ((spdy * sizex) >> 1) + (spdx * sizey); - for (UINT y=sizey; y; y--) + // ...and compute the final picture. + const int32_t *offset = frontBuf + w; + const PNG::Pixel *pixelIn = bitmapSrc->GetPixels() + w; + PNG::Pixel *pixelOut = bitmapTarget->GetPixels() + w; + PNG::Pixel *limitMin = bitmapSrc->GetPixels(), *limitMax = bitmapSrc->GetPixels() + bitmapSrc->GetNumPixels() - 1; + for(int32_t i = numPixels; i != 0; i--, pixelIn++, pixelOut++, offset++) { - UINT oldx = srcx, oldy = srcy; - for (UINT x=sizex; x; x--) + const int32_t xOff = offset[-1] - offset[1]; + const int32_t yOff = offset[-w] - offset[w]; + const PNG::Pixel *p = pixelIn + xOff + yOff * w; + Limit(p, limitMin, limitMax); + // Add a bit of shading depending on how far we're displacing the pixel... + pixelOut->r = (uint8_t)Clamp(p->r + (p->r * xOff) / 32, 0, 255); + pixelOut->g = (uint8_t)Clamp(p->g + (p->g * xOff) / 32, 0, 255); + pixelOut->b = (uint8_t)Clamp(p->b + (p->b * xOff) / 32, 0, 255); + // ...and mix it with original picture + pixelOut->r = (pixelOut->r + pixelIn->r) / 2u; + pixelOut->g = (pixelOut->g + pixelIn->g) / 2u; + pixelOut->b = (pixelOut->b + pixelIn->b) / 2u; + + // And now some cheap image smoothing... + if(xOff | yOff) { - srcx += spdx; - srcy += spdy; - *dest++ = src[((srcy & 0x7F0000) >> 8) | ((srcx & 0xFF0000) >> 16)]; + pixelOut[-1].r = (pixelOut->r + pixelIn[-1].r) / 2u; + pixelOut[-1].g = (pixelOut->g + pixelIn[-1].g) / 2u; + pixelOut[-1].b = (pixelOut->b + pixelIn[-1].b) / 2u; + pixelOut[-w].r = (pixelOut->r + pixelIn[-w].r) / 2u; + pixelOut[-w].g = (pixelOut->g + pixelIn[-w].g) / 2u; + pixelOut[-w].b = (pixelOut->b + pixelIn[-w].b) / 2u; + activity = true; // Also use this to update activity status... } - srcx=oldx-spdy; - srcy=oldy+spdx; } + + frame = !frame; + InvalidateRect(NULL, FALSE); UpdateWindow(); - return TRUE; + Sleep(10); //give away some CPU + + return true; } @@ -1475,11 +1442,10 @@ //============================= { protected: - CPaletteBitmap m_bmp; + CRippleBitmap m_bmp; CCreditStatic m_static; public: - CAboutDlg() {} ~CAboutDlg(); // Implementation @@ -1501,7 +1467,7 @@ void CAboutDlg::OnOK() //-------------------- { - gpRotoZoom = NULL; + gpAboutAnimation = NULL; gpAboutDlg = NULL; DestroyWindow(); delete this; @@ -1519,8 +1485,9 @@ //---------------------------- { CDialog::OnInitDialog(); + m_bmp.SubclassDlgItem(IDC_BITMAP1, this); - m_bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MPTRACK)); + SetDlgItemText(IDC_EDIT2, CString("Build Date: ") + MptVersion::GetBuildDateString().c_str()); SetDlgItemText(IDC_EDIT3, CString("OpenMPT ") + MptVersion::GetVersionStringExtended().c_str()); m_static.SubclassDlgItem(IDC_CREDITS,this); @@ -1587,7 +1554,7 @@ CSplashScreen::~CSplashScreen() //----------------------------- { - gpSplashScreen = NULL; + gpSplashScreen = nullptr; delete bitmap; } @@ -1595,8 +1562,6 @@ void CSplashScreen::OnPaint() //--------------------------- { - CRect rect; - GetUpdateRect(&rect); CPaintDC dc(this); CDC hdcMem; @@ -1613,7 +1578,6 @@ BOOL CSplashScreen::OnInitDialog() //-------------------------------- { - PNG::Bitmap *bitmap = PNG::ReadPNG(MAKEINTRESOURCE(IDB_SPLASHNOFOLDFIN)); bitmap->ToDIB(m_Bitmap, GetDC()); CRect rect; @@ -1659,12 +1623,9 @@ if (!gpSplashScreen) { gpSplashScreen = new CSplashScreen(m_pMainWnd); - if (gpSplashScreen) - { - gpSplashScreen->ShowWindow(SW_SHOW); - gpSplashScreen->UpdateWindow(); - gpSplashScreen->BeginWaitCursor(); - } + gpSplashScreen->ShowWindow(SW_SHOW); + gpSplashScreen->UpdateWindow(); + gpSplashScreen->BeginWaitCursor(); } } @@ -1676,11 +1637,7 @@ { gpSplashScreen->EndWaitCursor(); gpSplashScreen->DestroyWindow(); - if (gpSplashScreen) - { - delete gpSplashScreen; - gpSplashScreen = NULL; - } + delete gpSplashScreen; } } @@ -1705,9 +1662,9 @@ StopSplashScreen(); } } - if (gpRotoZoom) + if (gpAboutAnimation) { - if (gpRotoZoom->Animate()) return TRUE; + if (gpAboutAnimation->Animate()) return TRUE; } // Call plugins idle routine for open editor Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-03-26 21:00:28 UTC (rev 3971) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-03-27 02:48:52 UTC (rev 3972) @@ -469,6 +469,7 @@ IDB_PATTERNS PNG "res\\pattern_toolbar.png" IDB_SMPTOOLBAR PNG "res\\sample_toolbar.png" IDB_SPLASHNOFOLDFIN PNG "res\\splashno.png" +IDB_MPTRACK PNG "res\\mptrack.png" #endif // German (Germany) resources ///////////////////////////////////////////////////////////////////////////// @@ -490,7 +491,7 @@ CAPTION "About OpenMPT" FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - CONTROL "",IDC_BITMAP1,"Static",SS_BLACKRECT | SS_NOTIFY | SS_CENTERIMAGE,5,3,256,81,WS_EX_CLIENTEDGE + CONTROL "",IDC_BITMAP1,"Static",SS_BLACKRECT | SS_NOTIFY | SS_CENTERIMAGE,47,3,173,81,WS_EX_CLIENTEDGE CTEXT "",IDC_CREDITS,5,116,256,72,0,WS_EX_STATICEDGE DEFPUSHBUTTON "OK",IDOK,5,192,256,14,WS_GROUP EDITTEXT IDC_EDIT2,15,100,233,12,ES_CENTER | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER @@ -1958,7 +1959,6 @@ // Bitmap // -IDB_MPTRACK BITMAP "res\\mptrack.bmp" IDB_PATTERNVIEW BITMAP "res\\view_pat.bmp" IDB_COLORSETUP BITMAP "res\\colors.bmp" IDB_VUMETERS BITMAP "res\\vumeters.bmp" Deleted: trunk/OpenMPT/mptrack/res/mptrack.bmp =================================================================== (Binary files differ) Added: trunk/OpenMPT/mptrack/res/mptrack.png =================================================================== (Binary files differ) Index: trunk/OpenMPT/mptrack/res/mptrack.png =================================================================== --- trunk/OpenMPT/mptrack/res/mptrack.png 2014-03-26 21:00:28 UTC (rev 3971) +++ trunk/OpenMPT/mptrack/res/mptrack.png 2014-03-27 02:48:52 UTC (rev 3972) Property changes on: trunk/OpenMPT/mptrack/res/mptrack.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-03-27 12:57:49
|
Revision: 3976 http://sourceforge.net/p/modplug/code/3976 Author: saga-games Date: 2014-03-27 12:57:41 +0000 (Thu, 27 Mar 2014) Log Message: ----------- [Ref] Make mptrack.cpp a tiny bit more lightweight by moving About dialog to AboutDialog.cpp/.h Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters Added Paths: ----------- trunk/OpenMPT/mptrack/AboutDialog.cpp trunk/OpenMPT/mptrack/AboutDialog.h Removed Paths: ------------- trunk/OpenMPT/mptrack/res/splashno.bmp Added: trunk/OpenMPT/mptrack/AboutDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/AboutDialog.cpp (rev 0) +++ trunk/OpenMPT/mptrack/AboutDialog.cpp 2014-03-27 12:57:41 UTC (rev 3976) @@ -0,0 +1,239 @@ +#include "stdafx.h" +#include "Mptrack.h" +#include "AboutDialog.h" +#include "PNG.h" +#include "../common/version.h" + +CRippleBitmap *CRippleBitmap::instance = nullptr; +CAboutDlg *CAboutDlg::instance = nullptr; + + +BEGIN_MESSAGE_MAP(CRippleBitmap, CWnd) + ON_WM_PAINT() + ON_WM_ERASEBKGND() + ON_WM_MOUSEMOVE() + ON_WM_MOUSEHOVER() + ON_WM_MOUSELEAVE() +END_MESSAGE_MAP() + + +CRippleBitmap::CRippleBitmap() +//---------------------------- +{ + bitmapSrc = PNG::ReadPNG(MAKEINTRESOURCE(IDB_MPTRACK)); + bitmapTarget = new PNG::Bitmap(bitmapSrc->width, bitmapSrc->height); + offset1.assign(bitmapSrc->GetNumPixels(), 0); + offset2.assign(bitmapSrc->GetNumPixels(), 0); + frontBuf = &offset2[0]; + backBuf = &offset1[0]; + activity = true; + lastFrame = 0; + frame = false; + damp = true; + showMouse = true; + + // Pre-fill first and last row of output bitmap, since those won't be touched. + const PNG::Pixel *in1 = bitmapSrc->GetPixels(), *in2 = bitmapSrc->GetPixels() + (bitmapSrc->height - 1) * bitmapSrc->width; + PNG::Pixel *out1 = bitmapTarget->GetPixels(), *out2 = bitmapTarget->GetPixels() + (bitmapSrc->height - 1) * bitmapSrc->width; + for(uint32_t i = 0; i < bitmapSrc->width; i++) + { + *(out1++) = *(in1++); + *(out2++) = *(in2++); + } + + MemsetZero(bi); + bi.biSize = sizeof(BITMAPINFOHEADER); + bi.biWidth = bitmapSrc->width; + bi.biHeight = -(int32_t)bitmapSrc->height; + bi.biPlanes = 1; + bi.biBitCount = 32; + bi.biCompression = BI_RGB; + bi.biSizeImage = bitmapSrc->width * bitmapSrc->height * 4; + + instance = this; +} + + +CRippleBitmap::~CRippleBitmap() +//----------------------------- +{ + delete bitmapSrc; + delete bitmapTarget; + if(instance == this) instance = nullptr; +} + + +void CRippleBitmap::OnMouseMove(UINT nFlags, CPoint point) +//-------------------------------------------------------- +{ + // Initiate ripples at cursor location + Limit(point.x, 1, int(bitmapSrc->width) - 2); + Limit(point.y, 2, int(bitmapSrc->height) - 3); + int32_t *p = backBuf + point.x + point.y * bitmapSrc->width; + p[0] += (nFlags & MK_LBUTTON) ? 50 : 150; + p[0] += (nFlags & MK_MBUTTON) ? 150 : 0; + + int32_t w = bitmapSrc->width; + // Make the initial point of this ripple a bit "fatter". + p[-1] += p[0] / 2; p[1] += p[0] / 2; + p[-w] += p[0] / 2; p[w] += p[0] / 2; + p[-w - 1] += p[0] / 4; p[-w + 1] += p[0] / 4; + p[w - 1] += p[0] / 4; p[w + 1] += p[0] / 4; + + damp = !(nFlags & MK_RBUTTON); + activity = true; + + TRACKMOUSEEVENT me; + me.cbSize = sizeof(TRACKMOUSEEVENT); + me.dwFlags = TME_LEAVE | TME_HOVER; + me.hwndTrack = m_hWnd; + me.dwHoverTime = 1500; + + if(TrackMouseEvent(&me) && showMouse) + { + ShowCursor(FALSE); + showMouse = false; + } +} + + +void CRippleBitmap::OnMouseLeave() +//-------------------------------- +{ + if(!showMouse) + { + ShowCursor(TRUE); + showMouse = true; + } +} + + +void CRippleBitmap::OnPaint() +//--------------------------- +{ + CPaintDC dc(this); + + SetDIBitsToDevice(dc.m_hDC, + 0, 0, + bitmapTarget->width, bitmapTarget->height, 0, 0, + 0, bitmapTarget->height, + bitmapTarget->GetPixels(), reinterpret_cast<BITMAPINFO *>(&bi), DIB_RGB_COLORS); +} + + +bool CRippleBitmap::Animate() +//--------------------------- +{ + // Were there any pixels being moved in the last frame? + if(!activity) + return FALSE; + + DWORD now = timeGetTime(); + if(now - lastFrame < 15) + return TRUE; + lastFrame = now; + activity = false; + + frontBuf = &(frame ? offset2 : offset1)[0]; + backBuf = &(frame ? offset1 : offset2)[0]; + + // Spread the ripples... + const int32_t w = bitmapSrc->width, h = bitmapSrc->height; + const int32_t numPixels = w * (h - 2); + const int32_t *back = backBuf + w; + int32_t *front = frontBuf + w; + for(int32_t i = numPixels; i != 0; i--, back++, front++) + { + (*front) = (back[-1] + back[1] + back[w] + back[-w]) / 2 - (*front); + if(damp) (*front) -= (*front) >> 5; + } + + // ...and compute the final picture. + const int32_t *offset = frontBuf + w; + const PNG::Pixel *pixelIn = bitmapSrc->GetPixels() + w; + PNG::Pixel *pixelOut = bitmapTarget->GetPixels() + w; + PNG::Pixel *limitMin = bitmapSrc->GetPixels(), *limitMax = bitmapSrc->GetPixels() + bitmapSrc->GetNumPixels() - 1; + for(int32_t i = numPixels; i != 0; i--, pixelIn++, pixelOut++, offset++) + { + // Compute pixel displacement + const int32_t xOff = offset[-1] - offset[1]; + const int32_t yOff = offset[-w] - offset[w]; + + if(xOff | yOff) + { + const PNG::Pixel *p = pixelIn + xOff + yOff * w; + Limit(p, limitMin, limitMax); + // Add a bit of shading depending on how far we're displacing the pixel... + pixelOut->r = (uint8_t)Clamp(p->r + (p->r * xOff) / 32, 0, 255); + pixelOut->g = (uint8_t)Clamp(p->g + (p->g * xOff) / 32, 0, 255); + pixelOut->b = (uint8_t)Clamp(p->b + (p->b * xOff) / 32, 0, 255); + // ...and mix it with original picture + pixelOut->r = (pixelOut->r + pixelIn->r) / 2u; + pixelOut->g = (pixelOut->g + pixelIn->g) / 2u; + pixelOut->b = (pixelOut->b + pixelIn->b) / 2u; + // And now some cheap image smoothing... + pixelOut[-1].r = (pixelOut->r + pixelOut[-1].r) / 2u; + pixelOut[-1].g = (pixelOut->g + pixelOut[-1].g) / 2u; + pixelOut[-1].b = (pixelOut->b + pixelOut[-1].b) / 2u; + pixelOut[-w].r = (pixelOut->r + pixelOut[-w].r) / 2u; + pixelOut[-w].g = (pixelOut->g + pixelOut[-w].g) / 2u; + pixelOut[-w].b = (pixelOut->b + pixelOut[-w].b) / 2u; + activity = true; // Also use this to update activity status... + } else + { + *pixelOut = *pixelIn; + } + } + + frame = !frame; + + InvalidateRect(NULL, FALSE); + UpdateWindow(); + Sleep(10); //give away some CPU + + return true; +} + + +CAboutDlg::~CAboutDlg() +//--------------------- +{ + instance = NULL; +} + +void CAboutDlg::OnOK() +//-------------------- +{ + instance = NULL; + DestroyWindow(); + delete this; +} + + +void CAboutDlg::OnCancel() +//------------------------ +{ + OnOK(); +} + + +BOOL CAboutDlg::OnInitDialog() +//---------------------------- +{ + CDialog::OnInitDialog(); + + m_bmp.SubclassDlgItem(IDC_BITMAP1, this); + + SetDlgItemText(IDC_EDIT2, CString("Build Date: ") + MptVersion::GetBuildDateString().c_str()); + SetDlgItemText(IDC_EDIT3, CString("OpenMPT ") + MptVersion::GetVersionStringExtended().c_str()); + m_static.SubclassDlgItem(IDC_CREDITS,this); + m_static.SetCredits((mpt::String::Replace(mpt::To(mpt::CharsetLocale, mpt::CharsetUTF8, MptVersion::GetFullCreditsString()), "\n", "|") + "|" + mpt::String::Replace(MptVersion::GetContactString(), "\n", "|" ) + "||||||").c_str()); + m_static.SetSpeed(DISPLAY_SLOW); + m_static.SetColor(BACKGROUND_COLOR, RGB(138, 165, 219)); // Background Colour + m_static.SetTransparent(); // Set parts of bitmaps with RGB(192,192,192) transparent + m_static.SetGradient(GRADIENT_LEFT_DARK); // Background goes from blue to black from left to right + // m_static.SetBkImage(IDB_BITMAP1); // Background image + m_static.StartScrolling(); + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} Added: trunk/OpenMPT/mptrack/AboutDialog.h =================================================================== --- trunk/OpenMPT/mptrack/AboutDialog.h (rev 0) +++ trunk/OpenMPT/mptrack/AboutDialog.h 2014-03-27 12:57:41 UTC (rev 3976) @@ -0,0 +1,58 @@ +#pragma once + +#include "CreditStatic.h" + +namespace PNG { struct Bitmap; } + +//=============================== +class CRippleBitmap: public CWnd +//=============================== +{ +protected: + BITMAPINFOHEADER bi; + PNG::Bitmap *bitmapSrc, *bitmapTarget; + std::vector<int32_t> offset1, offset2; + int32_t *frontBuf, *backBuf; + DWORD lastFrame; // Time of last frame + bool frame; // Backbuffer toggle + bool damp; // Ripple damping status + bool activity; // There are actually some ripples + bool showMouse; + +public: + static CRippleBitmap *instance; + + CRippleBitmap(); + ~CRippleBitmap(); + bool Animate(); + +protected: + virtual void OnPaint(); + virtual BOOL OnEraseBkgnd(CDC *) { return TRUE; } + + DECLARE_MESSAGE_MAP() + void OnMouseMove(UINT nFlags, CPoint point); + void OnMouseHover(UINT nFlags, CPoint point) { OnMouseMove(nFlags, point); } + void OnMouseLeave(); +}; + + +//============================= +class CAboutDlg: public CDialog +//============================= +{ +protected: + CRippleBitmap m_bmp; + CCreditStatic m_static; + +public: + static CAboutDlg *instance; + + ~CAboutDlg(); + + // Implementation +protected: + virtual BOOL OnInitDialog(); + virtual void OnOK(); + virtual void OnCancel(); +}; \ No newline at end of file Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-03-27 09:30:17 UTC (rev 3975) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-03-27 12:57:41 UTC (rev 3976) @@ -17,7 +17,6 @@ #include "globals.h" #include "Dlsbank.h" #include "vstplug.h" -#include "CreditStatic.h" #include "commctrl.h" #include "../common/version.h" #include "../test/test.h" @@ -27,6 +26,7 @@ #include "../common/StringFixer.h" #include "ExceptionHandler.h" #include "CloseMainDialog.h" +#include "AboutDialog.h" #include "AutoSaver.h" #include "FileDialog.h" #include "PNG.h" @@ -1217,299 +1217,13 @@ } -///////////////////////////////////////////////////////////////////////////// -// CAboutDlg dialog used for App About - -//=============================== -class CRippleBitmap: public CWnd -//=============================== -{ -protected: - BITMAPINFOHEADER bi; - PNG::Bitmap *bitmapSrc, *bitmapTarget; - std::vector<int32_t> offset1, offset2; - int32_t *frontBuf, *backBuf; - DWORD lastFrame; // Time of last frame - bool frame; // Backbuffer toggle - bool damp; // Ripple damping status - bool activity; // There are actually some ripples - bool showMouse; - -public: - CRippleBitmap(); - ~CRippleBitmap(); - bool Animate(); - uint32_t Width() const { return bitmapSrc->width; } - uint32_t Height() const { return bitmapSrc->height; } - -protected: - virtual void OnPaint(); - virtual BOOL OnEraseBkgnd(CDC *) { return TRUE; } - - DECLARE_MESSAGE_MAP() - void OnMouseMove(UINT nFlags, CPoint point); - void OnMouseHover(UINT nFlags, CPoint point) { OnMouseMove(nFlags, point); } - void OnMouseLeave(); -}; - -static CRippleBitmap *gpAboutAnimation = nullptr; - -BEGIN_MESSAGE_MAP(CRippleBitmap, CWnd) - ON_WM_PAINT() - ON_WM_ERASEBKGND() - ON_WM_MOUSEMOVE() - ON_WM_MOUSEHOVER() - ON_WM_MOUSELEAVE() -END_MESSAGE_MAP() - - -CRippleBitmap::CRippleBitmap() -//---------------------------- -{ - bitmapSrc = PNG::ReadPNG(MAKEINTRESOURCE(IDB_MPTRACK)); - bitmapTarget = new PNG::Bitmap(bitmapSrc->width, bitmapSrc->height); - offset1.assign(bitmapSrc->GetNumPixels(), 0); - offset2.assign(bitmapSrc->GetNumPixels(), 0); - frontBuf = &offset2[0]; - backBuf = &offset1[0]; - activity = true; - lastFrame = 0; - frame = false; - damp = true; - showMouse = true; - - // Pre-fill first and last row of output bitmap, since those won't be touched. - const PNG::Pixel *in1 = bitmapSrc->GetPixels(), *in2 = bitmapSrc->GetPixels() + (bitmapSrc->height - 1) * bitmapSrc->width; - PNG::Pixel *out1 = bitmapTarget->GetPixels(), *out2 = bitmapTarget->GetPixels() + (bitmapSrc->height - 1) * bitmapSrc->width; - for(uint32_t i = 0; i < bitmapSrc->width; i++) - { - *(out1++) = *(in1++); - *(out2++) = *(in2++); - } - - MemsetZero(bi); - bi.biSize = sizeof(BITMAPINFOHEADER); - bi.biWidth = bitmapSrc->width; - bi.biHeight = -(int32_t)bitmapSrc->height; - bi.biPlanes = 1; - bi.biBitCount = 32; - bi.biCompression = BI_RGB; - bi.biSizeImage = bitmapSrc->width * bitmapSrc->height * 4; - - gpAboutAnimation = this; -} - - -CRippleBitmap::~CRippleBitmap() -//----------------------------- -{ - delete bitmapSrc; - delete bitmapTarget; - if (gpAboutAnimation == this) gpAboutAnimation = nullptr; -} - - -void CRippleBitmap::OnMouseMove(UINT nFlags, CPoint point) -//-------------------------------------------------------- -{ - // Initiate ripples at cursor location - Limit(point.x, 1, int(bitmapSrc->width) - 2); - Limit(point.y, 2, int(bitmapSrc->height) - 3); - int32_t *p = backBuf + point.x + point.y * bitmapSrc->width; - p[0] += (nFlags & MK_LBUTTON) ? 50 : 150; - p[0] += (nFlags & MK_MBUTTON) ? 150 : 0; - - int32_t w = bitmapSrc->width; - // Make the initial point of this ripple a bit "fatter". - p[-1] += p[0] / 2; p[1] += p[0] / 2; - p[-w] += p[0] / 2; p[w] += p[0] / 2; - p[-w - 1] += p[0] / 4; p[-w + 1] += p[0] / 4; - p[w - 1] += p[0] / 4; p[w + 1] += p[0] / 4; - - damp = !(nFlags & MK_RBUTTON); - activity = true; - - TRACKMOUSEEVENT me; - me.cbSize = sizeof(TRACKMOUSEEVENT); - me.dwFlags = TME_LEAVE | TME_HOVER; - me.hwndTrack = m_hWnd; - me.dwHoverTime = 1500; - - if(TrackMouseEvent(&me) && showMouse) - { - ShowCursor(FALSE); - showMouse = false; - } -} - - -void CRippleBitmap::OnMouseLeave() -//-------------------------------- -{ - if(!showMouse) - { - ShowCursor(TRUE); - showMouse = true; - } -} - - -void CRippleBitmap::OnPaint() -//--------------------------- -{ - CPaintDC dc(this); - - SetDIBitsToDevice(dc.m_hDC, - 0, 0, - bitmapTarget->width, bitmapTarget->height, 0, 0, - 0, bitmapTarget->height, - bitmapTarget->GetPixels(), reinterpret_cast<BITMAPINFO *>(&bi), DIB_RGB_COLORS); -} - - -bool CRippleBitmap::Animate() -//--------------------------- -{ - // Were there any pixels being moved in the last frame? - if(!activity) - return FALSE; - - DWORD now = timeGetTime(); - if(now - lastFrame < 15) - return TRUE; - lastFrame = now; - activity = false; - - frontBuf = &(frame ? offset2 : offset1)[0]; - backBuf = &(frame ? offset1 : offset2)[0]; - - // Spread the ripples... - const int32_t w = bitmapSrc->width, h = bitmapSrc->height; - const int32_t numPixels = w * (h - 2); - const int32_t *back = backBuf + w; - int32_t *front = frontBuf + w; - for(int32_t i = numPixels; i != 0; i--, back++, front++) - { - (*front) = (back[-1] + back[1] + back[w] + back[-w]) / 2 - (*front); - if(damp) (*front) -= (*front) >> 5; - } - - // ...and compute the final picture. - const int32_t *offset = frontBuf + w; - const PNG::Pixel *pixelIn = bitmapSrc->GetPixels() + w; - PNG::Pixel *pixelOut = bitmapTarget->GetPixels() + w; - PNG::Pixel *limitMin = bitmapSrc->GetPixels(), *limitMax = bitmapSrc->GetPixels() + bitmapSrc->GetNumPixels() - 1; - for(int32_t i = numPixels; i != 0; i--, pixelIn++, pixelOut++, offset++) - { - const int32_t xOff = offset[-1] - offset[1]; - const int32_t yOff = offset[-w] - offset[w]; - const PNG::Pixel *p = pixelIn + xOff + yOff * w; - Limit(p, limitMin, limitMax); - // Add a bit of shading depending on how far we're displacing the pixel... - pixelOut->r = (uint8_t)Clamp(p->r + (p->r * xOff) / 32, 0, 255); - pixelOut->g = (uint8_t)Clamp(p->g + (p->g * xOff) / 32, 0, 255); - pixelOut->b = (uint8_t)Clamp(p->b + (p->b * xOff) / 32, 0, 255); - // ...and mix it with original picture - pixelOut->r = (pixelOut->r + pixelIn->r) / 2u; - pixelOut->g = (pixelOut->g + pixelIn->g) / 2u; - pixelOut->b = (pixelOut->b + pixelIn->b) / 2u; - - // And now some cheap image smoothing... - if(xOff | yOff) - { - pixelOut[-1].r = (pixelOut->r + pixelOut[-1].r) / 2u; - pixelOut[-1].g = (pixelOut->g + pixelOut[-1].g) / 2u; - pixelOut[-1].b = (pixelOut->b + pixelOut[-1].b) / 2u; - pixelOut[-w].r = (pixelOut->r + pixelOut[-w].r) / 2u; - pixelOut[-w].g = (pixelOut->g + pixelOut[-w].g) / 2u; - pixelOut[-w].b = (pixelOut->b + pixelOut[-w].b) / 2u; - activity = true; // Also use this to update activity status... - } - } - - frame = !frame; - - InvalidateRect(NULL, FALSE); - UpdateWindow(); - Sleep(10); //give away some CPU - - return true; -} - - -//============================= -class CAboutDlg: public CDialog -//============================= -{ -protected: - CRippleBitmap m_bmp; - CCreditStatic m_static; - -public: - ~CAboutDlg(); - -// Implementation -protected: - virtual BOOL OnInitDialog(); - virtual void OnOK(); - virtual void OnCancel(); -}; - -static CAboutDlg *gpAboutDlg = NULL; - - -CAboutDlg::~CAboutDlg() -//--------------------- -{ - gpAboutDlg = NULL; -} - -void CAboutDlg::OnOK() -//-------------------- -{ - gpAboutAnimation = NULL; - gpAboutDlg = NULL; - DestroyWindow(); - delete this; -} - - -void CAboutDlg::OnCancel() -//------------------------ -{ - OnOK(); -} - - -BOOL CAboutDlg::OnInitDialog() -//---------------------------- -{ - CDialog::OnInitDialog(); - - m_bmp.SubclassDlgItem(IDC_BITMAP1, this); - - SetDlgItemText(IDC_EDIT2, CString("Build Date: ") + MptVersion::GetBuildDateString().c_str()); - SetDlgItemText(IDC_EDIT3, CString("OpenMPT ") + MptVersion::GetVersionStringExtended().c_str()); - m_static.SubclassDlgItem(IDC_CREDITS,this); - m_static.SetCredits((mpt::String::Replace(mpt::To(mpt::CharsetLocale, mpt::CharsetUTF8, MptVersion::GetFullCreditsString()), "\n", "|") + "|" + mpt::String::Replace(MptVersion::GetContactString(), "\n", "|" ) + "||||||").c_str()); - m_static.SetSpeed(DISPLAY_SLOW); - m_static.SetColor(BACKGROUND_COLOR, RGB(138, 165, 219)); // Background Colour - m_static.SetTransparent(); // Set parts of bitmaps with RGB(192,192,192) transparent - m_static.SetGradient(GRADIENT_LEFT_DARK); // Background goes from blue to black from left to right - // m_static.SetBkImage(IDB_BITMAP1); // Background image - m_static.StartScrolling(); - return TRUE; // return TRUE unless you set the focus to a control - // EXCEPTION: OCX Property Pages should return FALSE -} - - // App command to run the dialog void CTrackApp::OnAppAbout() //-------------------------- { - if (gpAboutDlg) return; - gpAboutDlg = new CAboutDlg(); - gpAboutDlg->Create(IDD_ABOUTBOX, m_pMainWnd); + if (CAboutDlg::instance) return; + CAboutDlg::instance = new CAboutDlg(); + CAboutDlg::instance->Create(IDD_ABOUTBOX, m_pMainWnd); } @@ -1662,9 +1376,9 @@ StopSplashScreen(); } } - if (gpAboutAnimation) + if (CRippleBitmap::instance) { - if (gpAboutAnimation->Animate()) return TRUE; + if (CRippleBitmap::instance->Animate()) return TRUE; } // Call plugins idle routine for open editor @@ -1744,11 +1458,11 @@ //------------------------------------------------------------------------------------------------------- { RECT rect; - HGDIOBJ oldpen = ::SelectObject(hdc, (bPushed) ? CMainFrame::penDarkGray : CMainFrame::penLightGray); + HGDIOBJ oldpen = SelectPen(hdc, (bPushed) ? CMainFrame::penDarkGray : CMainFrame::penLightGray); ::MoveToEx(hdc, lpRect->left, lpRect->bottom-1, NULL); ::LineTo(hdc, lpRect->left, lpRect->top); ::LineTo(hdc, lpRect->right-1, lpRect->top); - ::SelectObject(hdc, (bPushed) ? CMainFrame::penLightGray : CMainFrame::penDarkGray); + SelectPen(hdc, (bPushed) ? CMainFrame::penLightGray : CMainFrame::penDarkGray); ::LineTo(hdc, lpRect->right-1, lpRect->bottom-1); ::LineTo(hdc, lpRect->left, lpRect->bottom-1); rect.left = lpRect->left + 1; @@ -1756,7 +1470,7 @@ rect.right = lpRect->right - 1; rect.bottom = lpRect->bottom - 1; ::FillRect(hdc, &rect, CMainFrame::brushGray); - ::SelectObject(hdc, oldpen); + SelectPen(hdc, oldpen); if ((lpszText) && (lpszText[0])) { if (bPushed) Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-03-27 09:30:17 UTC (rev 3975) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-03-27 12:57:41 UTC (rev 3976) @@ -428,6 +428,10 @@ Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" > <File + RelativePath=".\AboutDialog.cpp" + > + </File> + <File RelativePath=".\AbstractVstEditor.cpp" > </File> @@ -1002,7 +1006,7 @@ </Filter> <Filter Name="Resource Files" - Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" + Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe;png" > <File RelativePath="res\bitmap1.bmp" @@ -1017,15 +1021,15 @@ > </File> <File - RelativePath=".\Res\envbar.bmp" + RelativePath=".\Res\envelope_toolbar.bmp" > </File> <File - RelativePath=".\res\img_list.bmp" + RelativePath=".\res\icons.bmp" > </File> <File - RelativePath=".\res\mainbar.bmp" + RelativePath=".\res\main_toolbar.bmp" > </File> <File @@ -1033,7 +1037,7 @@ > </File> <File - RelativePath=".\res\MPTRACK.bmp" + RelativePath=".\res\mptrack.png" > </File> <File @@ -1053,7 +1057,7 @@ > </File> <File - RelativePath=".\res\patterns.bmp" + RelativePath=".\res\pattern_toolbar.bmp" > </File> <File @@ -1061,11 +1065,11 @@ > </File> <File - RelativePath=".\Res\smptoolb.bmp" + RelativePath=".\Res\sample_toolbar.bmp" > </File> <File - RelativePath=".\res\splashno.bmp" + RelativePath=".\res\splashno.png" > </File> <File @@ -1090,6 +1094,10 @@ Filter="h;hpp;hxx;hm;inl" > <File + RelativePath=".\AboutDialog.h" + > + </File> + <File RelativePath=".\AbstractVstEditor.h" > </File> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2014-03-27 09:30:17 UTC (rev 3975) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2014-03-27 12:57:41 UTC (rev 3976) @@ -514,6 +514,7 @@ <ClCompile Include="..\unarchiver\unlha.cpp" /> <ClCompile Include="..\unarchiver\unrar.cpp" /> <ClCompile Include="..\unarchiver\unzip.cpp" /> + <ClCompile Include="AboutDialog.cpp" /> <ClCompile Include="AbstractVstEditor.cpp" /> <ClCompile Include="AppendModule.cpp" /> <ClCompile Include="AutoSaver.cpp" /> @@ -723,6 +724,7 @@ <ClInclude Include="..\unarchiver\unlha.h" /> <ClInclude Include="..\unarchiver\unrar.h" /> <ClInclude Include="..\unarchiver\unzip.h" /> + <ClInclude Include="AboutDialog.h" /> <ClInclude Include="AbstractVstEditor.h" /> <ClInclude Include="AutoSaver.h" /> <ClInclude Include="Autotune.h" /> @@ -807,18 +809,14 @@ <ItemGroup> <None Include="..\soundlib\Tunings\built-inTunings.tc" /> <None Include="res\bitmap1.bmp" /> - <None Include="res\bmp00001.bmp" /> <None Include="res\colors.bmp" /> <None Include="res\dragging.cur" /> - <None Include="Res\envbar.bmp" /> <None Include="res\envelope_toolbar.png" /> <None Include="res\icons.png" /> - <None Include="res\img_list.bmp" /> - <None Include="res\mainbar.bmp" /> <None Include="res\main_toolbar.png" /> <None Include="res\moddoc.ico" /> - <None Include="res\MPTRACK.bmp" /> <None Include="res\mptrack.ico" /> + <None Include="res\mptrack.png" /> <None Include="res\mptrack.rc2" /> <None Include="Res\nodrag.cur" /> <None Include="res\nodrop.cur" /> @@ -826,8 +824,6 @@ <None Include="res\pattern_toolbar.png" /> <None Include="res\rt_manif.bin" /> <None Include="res\sample_toolbar.png" /> - <None Include="Res\smptoolb.bmp" /> - <None Include="res\splashno.bmp" /> <None Include="res\splashno.png" /> <None Include="res\view_pat.bmp" /> <None Include="res\visnode1.bmp" /> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2014-03-27 09:30:17 UTC (rev 3975) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2014-03-27 12:57:41 UTC (rev 3976) @@ -517,6 +517,9 @@ <ClCompile Include="CImageListEx.cpp"> <Filter>Source Files\mptrack</Filter> </ClCompile> + <ClCompile Include="AboutDialog.cpp"> + <Filter>Source Files\mptrack\Dialogs</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\soundlib\Loaders.h"> @@ -1014,6 +1017,9 @@ <ClInclude Include="PNG.h"> <Filter>Header Files\mptrack</Filter> </ClInclude> + <ClInclude Include="AboutDialog.h"> + <Filter>Header Files\mptrack\Dialogs</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="res\bitmap1.bmp"> @@ -1031,21 +1037,9 @@ <None Include="res\dragging.cur"> <Filter>Resource Files</Filter> </None> - <None Include="Res\envbar.bmp"> - <Filter>Resource Files</Filter> - </None> - <None Include="res\img_list.bmp"> - <Filter>Resource Files</Filter> - </None> - <None Include="res\mainbar.bmp"> - <Filter>Resource Files</Filter> - </None> <None Include="res\moddoc.ico"> <Filter>Resource Files</Filter> </None> - <None Include="res\MPTRACK.bmp"> - <Filter>Resource Files</Filter> - </None> <None Include="res\mptrack.ico"> <Filter>Resource Files</Filter> </None> @@ -1070,12 +1064,6 @@ <None Include="res\rt_manif.bin"> <Filter>Resource Files</Filter> </None> - <None Include="Res\smptoolb.bmp"> - <Filter>Resource Files</Filter> - </None> - <None Include="res\splashno.bmp"> - <Filter>Resource Files</Filter> - </None> <None Include="res\view_pat.bmp"> <Filter>Resource Files</Filter> </None> @@ -1088,15 +1076,27 @@ <None Include="..\soundlib\Tunings\built-inTunings.tc"> <Filter>Resource Files</Filter> </None> - <None Include="res\bmp00001.bmp"> + <None Include="res\envelope_toolbar.png"> <Filter>Resource Files</Filter> </None> - <None Include="res\envelope_toolbar.png" /> - <None Include="res\icons.png" /> - <None Include="res\main_toolbar.png" /> - <None Include="res\pattern_toolbar.png" /> - <None Include="res\sample_toolbar.png" /> - <None Include="res\splashno.png" /> + <None Include="res\splashno.png"> + <Filter>Resource Files</Filter> + </None> + <None Include="res\icons.png"> + <Filter>Resource Files</Filter> + </None> + <None Include="res\main_toolbar.png"> + <Filter>Resource Files</Filter> + </None> + <None Include="res\mptrack.png"> + <Filter>Resource Files</Filter> + </None> + <None Include="res\pattern_toolbar.png"> + <Filter>Resource Files</Filter> + </None> + <None Include="res\sample_toolbar.png"> + <Filter>Resource Files</Filter> + </None> </ItemGroup> <ItemGroup> <Filter Include="Header Files"> Deleted: trunk/OpenMPT/mptrack/res/splashno.bmp =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2014-03-28 10:01:27
|
Revision: 3981 http://sourceforge.net/p/modplug/code/3981 Author: manxorist Date: 2014-03-28 10:01:21 +0000 (Fri, 28 Mar 2014) Log Message: ----------- [Fix] When importing old sound device settings, use the correct (the old stored) sound device to determine the type. As this also fixes the crash which r3979 worked around, revert r3979 . Revision Links: -------------- http://sourceforge.net/p/modplug/code/3979 http://sourceforge.net/p/modplug/code/3979 Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-03-28 02:34:36 UTC (rev 3980) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-03-28 10:01:21 UTC (rev 3981) @@ -881,8 +881,6 @@ // Construct auto saver instance, class TrackerSettings expects it being available. CMainFrame::m_pAutoSaver = new CAutoSaver(); - m_pSoundDevicesManager = new SoundDevicesManager(); - m_pSettingsIniFile = new IniFileSettingsBackend(m_szConfigFileName); m_pSettings = new SettingsContainer(m_pSettingsIniFile); @@ -923,6 +921,7 @@ //RegisterExtensions(); // Load sound APIs + m_pSoundDevicesManager = new SoundDevicesManager(); if(TrackerSettings::Instance().m_SoundDeviceSettingsUseOldDefaults) { // get the old default device Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-03-28 02:34:36 UTC (rev 3980) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-03-28 10:01:21 UTC (rev 3981) @@ -166,6 +166,7 @@ , m_SoundSettingsOpenDeviceAtStartup(conf, "Sound Settings", "OpenDeviceAtStartup", false) , m_SoundSettingsStopMode(conf, "Sound Settings", "StopMode", SoundDeviceStopModeClosed) , m_SoundDeviceSettingsUseOldDefaults(false) + , m_SoundDeviceID_DEPRECATED(SoundDeviceID()) , m_SoundDeviceIdentifier(conf, "Sound Settings", "Device", std::wstring()) , MixerMaxChannels(conf, "Sound Settings", "MixChannels", MixerSettings().m_nMaxMixChannels) , MixerDSPMask(conf, "Sound Settings", "Quality", MixerSettings().DSPMask) @@ -411,7 +412,7 @@ { if(m_BufferLength_DEPRECATED < 1) m_BufferLength_DEPRECATED = 1; // 1ms if(m_BufferLength_DEPRECATED > 1000) m_BufferLength_DEPRECATED = 1000; // 1sec - if(GetSoundDeviceID().GetType() == SNDDEV_ASIO) + if(m_SoundDeviceID_DEPRECATED.GetType() == SNDDEV_ASIO) { m_LatencyMS = m_BufferLength_DEPRECATED; m_UpdateIntervalMS = m_BufferLength_DEPRECATED / 8; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-03-28 18:07:59
|
Revision: 3988 http://sourceforge.net/p/modplug/code/3988 Author: saga-games Date: 2014-03-28 18:07:52 +0000 (Fri, 28 Mar 2014) Log Message: ----------- [Fix] Icon resource leak in treeview. [Fix] Cursor and hi-dpi fixes in about dialog. Modified Paths: -------------- trunk/OpenMPT/mptrack/AboutDialog.cpp trunk/OpenMPT/mptrack/View_tre.cpp Modified: trunk/OpenMPT/mptrack/AboutDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/AboutDialog.cpp 2014-03-28 16:03:39 UTC (rev 3987) +++ trunk/OpenMPT/mptrack/AboutDialog.cpp 2014-03-28 18:07:52 UTC (rev 3988) @@ -57,6 +57,10 @@ CRippleBitmap::~CRippleBitmap() //----------------------------- { + if(!showMouse) + { + ShowCursor(TRUE); + } delete bitmapSrc; delete bitmapTarget; if(instance == this) instance = nullptr; @@ -113,11 +117,13 @@ { CPaintDC dc(this); - SetDIBitsToDevice(dc.m_hDC, - 0, 0, - bitmapTarget->width, bitmapTarget->height, 0, 0, - 0, bitmapTarget->height, - bitmapTarget->GetPixels(), reinterpret_cast<BITMAPINFO *>(&bi), DIB_RGB_COLORS); + CRect rect; + GetClientRect(rect); + StretchDIBits(dc.m_hDC, + 0, 0, rect.Width(), rect.Height(), + 0, 0, bitmapTarget->width, bitmapTarget->height, + bitmapTarget->GetPixels(), + reinterpret_cast<BITMAPINFO *>(&bi), DIB_RGB_COLORS, SRCCOPY); } Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2014-03-28 16:03:39 UTC (rev 3987) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2014-03-28 18:07:52 UTC (rev 3988) @@ -1676,6 +1676,7 @@ SHFILEINFOW fileInfo; SHGetFileInfoW(s, 0, &fileInfo, sizeof(fileInfo), SHGFI_ICON | SHGFI_SMALLICON); ModTreeInsert(s, images.Add(fileInfo.hIcon)); + DestroyIcon(fileInfo.hIcon); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-03-28 21:02:54
|
Revision: 3990 http://sourceforge.net/p/modplug/code/3990 Author: saga-games Date: 2014-03-28 21:02:41 +0000 (Fri, 28 Mar 2014) Log Message: ----------- [Imp] Options dialog / Advanced: Support pressing enter to edit the selected setting, and add a filter to search for settings. Modified Paths: -------------- trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/Moptions.h trunk/OpenMPT/mptrack/mptrack.rc Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2014-03-28 18:08:52 UTC (rev 3989) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2014-03-28 21:02:41 UTC (rev 3990) @@ -796,7 +796,8 @@ #if defined(MPT_SETTINGS_CACHE) BEGIN_MESSAGE_MAP(COptionsAdvanced, CPropertyPage) - ON_LBN_DBLCLK(IDC_LIST4, OnOptionDblClick) + ON_LBN_DBLCLK(IDC_LIST4, OnOptionDblClick) + ON_EN_CHANGE(IDC_EDIT1, OnFindStringChanged) END_MESSAGE_MAP() void COptionsAdvanced::DoDataExchange(CDataExchange* pDX) @@ -816,6 +817,18 @@ } +BOOL COptionsAdvanced::PreTranslateMessage(MSG *msg) +//-------------------------------------------------- +{ + if(msg->message == WM_KEYDOWN && msg->wParam == VK_RETURN) + { + OnOptionDblClick(); + return TRUE; + } + return FALSE; +} + + BOOL COptionsAdvanced::OnInitDialog() //----------------------------------- { @@ -828,13 +841,29 @@ void COptionsAdvanced::ReInit() //----------------------------- { + m_List.SetRedraw(FALSE); m_List.ResetContent(); m_IndexToPath.clear(); + CString findStr; + GetDlgItemText(IDC_EDIT1, findStr); + findStr.MakeLower(); for(SettingsContainer::SettingsMap::const_iterator it = theApp.GetSettings().begin(); it != theApp.GetSettings().end(); ++it) { - int index = m_List.AddString(FormatSetting(it->first, it->second)); - m_IndexToPath[index] = it->first; + CString str = FormatSetting(it->first, it->second); + bool addString = true; + if(!findStr.IsEmpty()) + { + CString strLower = str; + addString = strLower.MakeLower().Find(findStr) >= 0; + } + if(addString) + { + int index = m_List.AddString(str); + m_IndexToPath[index] = it->first; + } } + m_List.SetRedraw(TRUE); + m_List.Invalidate(FALSE); } Modified: trunk/OpenMPT/mptrack/Moptions.h =================================================================== --- trunk/OpenMPT/mptrack/Moptions.h 2014-03-28 18:08:52 UTC (rev 3989) +++ trunk/OpenMPT/mptrack/Moptions.h 2014-03-28 21:02:41 UTC (rev 3990) @@ -76,8 +76,10 @@ virtual void OnOK(); virtual BOOL OnSetActive(); virtual void DoDataExchange(CDataExchange* pDX); + virtual BOOL PreTranslateMessage(MSG *msg); afx_msg void OnOptionDblClick(); afx_msg void OnSettingsChanged() { SetModified(TRUE); } + afx_msg void OnFindStringChanged() { ReInit(); } void ReInit(); Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2014-03-28 18:08:52 UTC (rev 3989) +++ trunk/OpenMPT/mptrack/mptrack.rc 2014-03-28 21:02:41 UTC (rev 3990) @@ -296,8 +296,10 @@ CAPTION "Advanced" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - LISTBOX IDC_LIST4,6,36,258,234,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP LTEXT "Warning:\nChanging advanced settings might cause stability problems.\nYou should only continue if you know what you are doing.",IDC_STATIC,6,6,258,24 + LTEXT "Find:",IDC_STATIC,6,38,17,8 + EDITTEXT IDC_EDIT1,30,36,234,12,ES_AUTOHSCROLL + LISTBOX IDC_LIST4,6,54,258,216,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP END IDD_SCANPLUGINS DIALOGEX 0, 0, 316, 34 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-04-02 15:02:08
|
Revision: 4002 http://sourceforge.net/p/modplug/code/4002 Author: saga-games Date: 2014-04-02 15:01:53 +0000 (Wed, 02 Apr 2014) Log Message: ----------- [New] Added transpose shortcuts to sample editor [Fix] Key messages are now also sent properly to the upper views (ctrl_*) - this never worked properly before, I guess. [Fix] All sample views of the current module should now be updated properly when editing a sample. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h trunk/OpenMPT/mptrack/Globals.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2014-04-02 13:44:44 UTC (rev 4001) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2014-04-02 15:01:53 UTC (rev 4002) @@ -486,9 +486,9 @@ DefineKeyCommand(kcSampleLoad, 1673, _T("Load Sample")); DefineKeyCommand(kcSampleSave, 1674, _T("Save Sample")); DefineKeyCommand(kcSampleNew, 1675, _T("New Sample")); - DefineKeyCommand(kcSampleCtrlLoad, 1676, _T("Load Sample"), kcHidden); - DefineKeyCommand(kcSampleCtrlSave, 1677, _T("Save Sample"), kcHidden); - DefineKeyCommand(kcSampleCtrlNew, 1678, _T("New Sample"), kcHidden); + //DefineKeyCommand(kcSampleCtrlLoad, 1676, _T("Load Sample"), kcHidden); + //DefineKeyCommand(kcSampleCtrlSave, 1677, _T("Save Sample"), kcHidden); + //DefineKeyCommand(kcSampleCtrlNew, 1678, _T("New Sample"), kcHidden); DefineKeyCommand(kcInstrumentLoad, 1679, _T("Load an instrument"), kcHidden); DefineKeyCommand(kcInstrumentSave, 1680, _T("Save instrument"), kcHidden); DefineKeyCommand(kcInstrumentNew, 1681, _T("New instrument"), kcHidden); @@ -655,6 +655,10 @@ DefineKeyCommand(kcSelectEvent, 1904, _T("Select Event")); DefineKeyCommand(kcEditRedo, 1905, _T("Redo")); DefineKeyCommand(kcFileAppend, 1906, _T("File/Append Module")); + DefineKeyCommand(kcSampleTransposeUp, 1907, _T("Transpose +1")); + DefineKeyCommand(kcSampleTransposeDown, 1908, _T("Transpose -1")); + DefineKeyCommand(kcSampleTransposeOctUp, 1909, _T("Transpose +12")); + DefineKeyCommand(kcSampleTransposeOctDown, 1910, _T("Transpose -12")); // Add new key commands here. Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2014-04-02 13:44:44 UTC (rev 4001) +++ trunk/OpenMPT/mptrack/CommandSet.h 2014-04-02 15:01:53 UTC (rev 4002) @@ -651,14 +651,12 @@ kcSampleLoad=kcStartSampleMisc, kcSampleSave, kcSampleNew, - kcEndSampleMisc=kcSampleNew, + kcSampleTransposeUp, + kcSampleTransposeDown, + kcSampleTransposeOctUp, + kcSampleTransposeOctDown, + kcEndSampleMisc=kcSampleTransposeOctDown, - kcStartSampleCtrlMisc, - kcSampleCtrlLoad=kcStartSampleCtrlMisc, - kcSampleCtrlSave, - kcSampleCtrlNew, - kcEndSampleCtrlMisc=kcSampleCtrlNew, - kcStartSampleEditing, kcSampleTrim=kcStartSampleEditing, kcSampleSilence, Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-04-02 13:44:44 UTC (rev 4001) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-04-02 15:01:53 UTC (rev 4002) @@ -462,60 +462,6 @@ SetCurrentSample((SAMPLEINDEX)lParam, -1, TRUE); break; - //rewbs.customKeys - case IDC_SAMPLE_REVERSE: - OnReverse(); - break; - - case IDC_SAMPLE_SILENCE: - OnSilence(); - break; - - case IDC_SAMPLE_INVERT: - OnInvert(); - break; - - case IDC_SAMPLE_XFADE: - OnXFade(); - break; - - case IDC_SAMPLE_AUTOTUNE: - OnAutotune(); - break; - - case IDC_SAMPLE_SIGN_UNSIGN: - OnSignUnSign(); - break; - - case IDC_SAMPLE_DCOFFSET: - OnRemoveDCOffset(); - break; - - case IDC_SAMPLE_NORMALIZE: - OnNormalize(); - break; - - case IDC_SAMPLE_AMPLIFY: - OnAmplify(); - break; - - case IDC_SAMPLE_QUICKFADE: - OnQuickFade(); - break; - - case IDC_SAMPLE_OPEN: - OnSampleOpen(); - break; - - case IDC_SAMPLE_SAVEAS: - OnSampleSave(); - break; - - case IDC_SAMPLE_NEW: - OnSampleNew(); - break; - //end rewbs.customKeys - default: return CModControlDlg::OnModCtrlMsg(wParam, lParam); } @@ -753,6 +699,16 @@ } +// updateAll: Update all views including this one. Otherwise, only update update other views. +void CCtrlSamples::SetModified(DWORD mask, bool updateAll) +//-------------------------------------------------------- +{ + m_modDoc.SetModified(); + m_modDoc.UpdateAllViews(nullptr, mask | (m_nSample << HINT_SHIFT_SMP), updateAll ? nullptr : this); +} + + + bool CCtrlSamples::OpenSample(const mpt::PathString &fileName) //------------------------------------------------------------ { @@ -855,8 +811,7 @@ sample.nPan = 128; sample.uFlags.set(CHN_PANNING); } - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, NULL); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, true); } return true; } @@ -880,8 +835,7 @@ EndWaitCursor(); - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, NULL); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, true); return true; } @@ -1244,7 +1198,7 @@ if(bModified) { - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA, false); } EndWaitCursor(); SwitchToView(); @@ -1294,8 +1248,7 @@ } } sample.PrecomputeLoops(m_sndFile, false); - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, NULL); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA, false); EndWaitCursor(); SwitchToView(); } @@ -1349,7 +1302,7 @@ fReportOffset += fOffset; numModified++; - m_modDoc.UpdateAllViews(NULL, (iSmp << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); + m_modDoc.UpdateAllViews(nullptr, (iSmp << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO); } EndWaitCursor(); @@ -1360,7 +1313,7 @@ CString dcInfo; if(numModified) { - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); if(numModified == 1) { dcInfo.Format(GetStrI18N(TEXT("Removed DC offset (%.1f%%)")), fReportOffset * 100); @@ -1546,8 +1499,7 @@ { SetSelectionPoints(dwStart, dwEnd + (dwEnd - dwStart)); } - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } EndWaitCursor(); SwitchToView(); @@ -1662,8 +1614,7 @@ { SetSelectionPoints(dwStart, dwStart + dwRemove); } - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } EndWaitCursor(); SwitchToView(); @@ -1812,8 +1763,7 @@ } // Update sample view - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } @@ -2243,8 +2193,7 @@ m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_reverse, "Reverse", selection.nStart, selection.nEnd); if(ctrlSmp::ReverseSample(sample, selection.nStart, selection.nEnd, m_sndFile)) { - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, NULL); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA, false); } else { m_modDoc.GetSampleUndo().RemoveLastUndoStep(m_nSample); @@ -2264,8 +2213,7 @@ m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_invert, "Invert", selection.nStart, selection.nEnd); if(ctrlSmp::InvertSample(sample, selection.nStart, selection.nEnd, m_sndFile) == true) { - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, NULL); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA, false); } else { m_modDoc.GetSampleUndo().RemoveLastUndoStep(m_nSample); @@ -2290,8 +2238,7 @@ m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_unsign, "Unsign", selection.nStart, selection.nEnd); if(ctrlSmp::UnsignSample(sample, selection.nStart, selection.nEnd, m_sndFile) == true) { - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, NULL); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA, false); } else { m_modDoc.GetSampleUndo().RemoveLastUndoStep(m_nSample); @@ -2345,8 +2292,7 @@ } } sample.PrecomputeLoops(m_sndFile, false); - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, NULL); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA, false); } EndWaitCursor(); @@ -2384,9 +2330,7 @@ if (_tcscmp(s, m_sndFile.m_szNames[m_nSample])) { mpt::String::Copy(m_sndFile.m_szNames[m_nSample], s); - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | (HINT_SMPNAMES|HINT_SAMPLEINFO), this); - m_modDoc.UpdateAllViews(NULL, HINT_INSNAMES, this); - m_modDoc.SetModified(); + SetModified(HINT_SMPNAMES | HINT_SAMPLEINFO, false); } } @@ -2402,8 +2346,7 @@ if (_tcscmp(s, m_sndFile.GetSample(m_nSample).filename)) { mpt::String::Copy(m_sndFile.GetSample(m_nSample).filename, s); - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO, this); - if (m_sndFile.m_nType & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } @@ -2418,7 +2361,7 @@ if (nVol != m_sndFile.GetSample(m_nSample).nVolume) { m_sndFile.GetSample(m_nSample).nVolume = (WORD)nVol; - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } @@ -2432,7 +2375,7 @@ if (nVol != m_sndFile.GetSample(m_nSample).nGlobalVol) { m_sndFile.GetSample(m_nSample).nGlobalVol = (uint16)nVol; - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } @@ -2452,7 +2395,7 @@ if(b != sample.uFlags[CHN_PANNING]) { sample.uFlags.set(CHN_PANNING, b); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } @@ -2476,7 +2419,7 @@ if (nPan != m_sndFile.GetSample(m_nSample).nPan) { m_sndFile.GetSample(m_nSample).nPan = (uint16)nPan; - if (m_sndFile.m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT)) m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } @@ -2502,7 +2445,7 @@ m_CbnBaseNote.SetCurSel(basenote); UnlockControls(); } - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } else { @@ -2511,7 +2454,7 @@ if ((n >= -128) && (n <= 127)) { m_sndFile.GetSample(m_nSample).nFineTune = (signed char)n; - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } @@ -2538,14 +2481,14 @@ LockControls(); m_EditFineTune.SetWindowText(s); UnlockControls(); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } else { if ((n >= -128) && (n < 128)) { sample.RelativeTone = (int8)n; - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } } @@ -2561,7 +2504,7 @@ m_sndFile.GetSample(m_nSample).nVibType = static_cast<uint8>(n); PropagateAutoVibratoChanges(); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } @@ -2578,7 +2521,7 @@ m_sndFile.GetSample(m_nSample).nVibDepth = static_cast<uint8>(n); PropagateAutoVibratoChanges(); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } @@ -2595,7 +2538,7 @@ m_sndFile.GetSample(m_nSample).nVibSweep = static_cast<uint8>(n); PropagateAutoVibratoChanges(); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } @@ -2612,7 +2555,7 @@ m_sndFile.GetSample(m_nSample).nVibRate = static_cast<uint8>(n); PropagateAutoVibratoChanges(); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } @@ -2640,13 +2583,13 @@ { sample.SetLoop(0, sample.nLength, true, n == 2, m_sndFile); } - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); + m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA); } else { sample.PrecomputeLoops(m_sndFile); } ctrlSmp::UpdateLoopPoints(sample, m_sndFile); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } @@ -2659,8 +2602,7 @@ if ((n >= 0) && (n < sample.nLength) && ((n < sample.nLoopEnd) || !sample.uFlags[CHN_LOOP])) { sample.SetLoop(n, sample.nLoopEnd, sample.uFlags[CHN_LOOP], sample.uFlags[CHN_PINGPONGLOOP], m_sndFile); - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA, false); } } @@ -2674,8 +2616,7 @@ if ((n >= 0) && (n <= sample.nLength) && ((n > sample.nLoopStart) || !sample.uFlags[CHN_LOOP])) { sample.SetLoop(sample.nLoopStart, n, sample.uFlags[CHN_LOOP], sample.uFlags[CHN_PINGPONGLOOP], m_sndFile); - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEDATA, false); } } @@ -2704,13 +2645,13 @@ { sample.SetSustainLoop(0, sample.nLength, true, n == 2, m_sndFile); } - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); + m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA); } else { sample.PrecomputeLoops(m_sndFile); } ctrlSmp::UpdateLoopPoints(sample, m_sndFile); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } @@ -2724,8 +2665,7 @@ && ((n < sample.nSustainEnd) || !sample.uFlags[CHN_SUSTAINLOOP])) { sample.SetSustainLoop(n, sample.nSustainEnd, sample.uFlags[CHN_SUSTAINLOOP], sample.uFlags[CHN_PINGPONGSUSTAIN], m_sndFile); - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } @@ -2740,8 +2680,7 @@ && ((n > sample.nSustainStart) || !sample.uFlags[CHN_SUSTAINLOOP])) { sample.SetSustainLoop(sample.nSustainStart, n, sample.uFlags[CHN_SUSTAINLOOP], sample.uFlags[CHN_PINGPONGSUSTAIN], m_sndFile); - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } } @@ -3031,8 +2970,7 @@ if(nCode == SB_ENDSCROLL) SwitchToView(); if(redraw) { - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA, this); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, false); } UnlockControls(); } @@ -3055,7 +2993,7 @@ UINT nRepCnt = LOWORD(pMsg->lParam); UINT nFlags = HIWORD(pMsg->lParam); KeyEventType kT = ih->GetKeyEventType(nFlags); - InputTargetContext ctx = (InputTargetContext)(kCtxCtrlSamples); + InputTargetContext ctx = (InputTargetContext)(kCtxViewSamples); if (ih->KeyEvent(ctx, nChar, nRepCnt, nFlags, kT) != kcNull) return true; // Mapped to a command, no need to pass message on. @@ -3067,17 +3005,48 @@ } LRESULT CCtrlSamples::OnCustomKeyMsg(WPARAM wParam, LPARAM /*lParam*/) -//---------------------------------------------------------------- +//-------------------------------------------------------------------- { if (wParam == kcNull) return NULL; + int transpose = 0; switch(wParam) { - case kcSampleCtrlLoad: OnSampleOpen(); return wParam; - case kcSampleCtrlSave: OnSampleSave(); return wParam; - case kcSampleCtrlNew: OnSampleNew(); return wParam; + case kcSampleLoad: OnSampleOpen(); return wParam; + case kcSampleSave: OnSampleSave(); return wParam; + case kcSampleNew: OnSampleNew(); return wParam; + + case kcSampleReverse: OnReverse(); return wParam; + case kcSampleSilence: OnSilence(); return wParam; + case kcSampleNormalize: OnNormalize(); return wParam; + case kcSampleAmplify: OnAmplify(); return wParam; + case kcSampleInvert: OnInvert(); return wParam; + case kcSampleSignUnsign: OnSignUnSign(); return wParam; + case kcSampleRemoveDCOffset: OnRemoveDCOffset(); return wParam; + case kcSampleXFade: OnXFade(); return wParam; + case kcSampleAutotune: OnAutotune(); return wParam; + case kcSampleQuickFade: OnQuickFade(); return wParam; + + case kcSampleTransposeUp: transpose = 1; break; + case kcSampleTransposeDown: transpose = -1; break; + case kcSampleTransposeOctUp: transpose = 12; break; + case kcSampleTransposeOctDown: transpose = -12; break; } + + if(transpose) + { + if(m_CbnBaseNote.IsWindowEnabled()) + { + int sel = Clamp(m_CbnBaseNote.GetCurSel() - transpose, 0, m_CbnBaseNote.GetCount() - 1); + if(sel != m_CbnBaseNote.GetCurSel()) + { + m_CbnBaseNote.SetCurSel(sel); + OnBaseNoteChanged(); + } + } + return wParam; + } return 0; } @@ -3167,8 +3136,7 @@ if(ctrlSmp::XFadeSample(sample, fadeLength, m_sndFile)) { - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA, true); } else { m_modDoc.GetSampleUndo().RemoveLastUndoStep(m_nSample); @@ -3196,8 +3164,7 @@ BeginWaitCursor(); m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Automatic Sample Tuning"); at.Apply(static_cast<double>(dlg.GetPitchReference()), dlg.GetTargetNote()); - m_modDoc.UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO, NULL); - m_modDoc.SetModified(); + SetModified(HINT_SAMPLEINFO, true); EndWaitCursor(); } } @@ -3228,9 +3195,9 @@ m_sndFile.GetSample(*sample).nVibType = m_sndFile.GetSample(m_nSample).nVibType; m_sndFile.GetSample(*sample).nVibRate = m_sndFile.GetSample(m_nSample).nVibRate; m_sndFile.GetSample(*sample).nVibSweep = m_sndFile.GetSample(m_nSample).nVibSweep; + m_modDoc.UpdateAllViews(nullptr, HINT_SAMPLEINFO | ((*sample) << HINT_SHIFT_SMP)); } } } } - } \ No newline at end of file Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-04-02 13:44:44 UTC (rev 4001) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-04-02 15:01:53 UTC (rev 4002) @@ -128,6 +128,8 @@ afx_msg void OnEnableStretchToSize(); afx_msg void OnEstimateSampleSize(); + void SetModified(DWORD mask, bool updateAll); + //}}AFX_MSG DECLARE_MESSAGE_MAP() }; Modified: trunk/OpenMPT/mptrack/Globals.h =================================================================== --- trunk/OpenMPT/mptrack/Globals.h 2014-04-02 13:44:44 UTC (rev 4001) +++ trunk/OpenMPT/mptrack/Globals.h 2014-04-02 15:01:53 UTC (rev 4002) @@ -135,6 +135,7 @@ int GetInstrumentChange() const { return m_nInstrumentChanged; } void SetMDIParentFrame(HWND hwnd) { m_hWndMDI = hwnd; } void ForceRefresh(); + CModControlDlg *GetCurrentControlDlg() { return m_Pages[m_nActiveDlg]; } protected: void RecalcLayout(); @@ -208,6 +209,8 @@ virtual LRESULT OnPlayerNotify(Notification *) { return 0; } //}}AFX_VIRTUAL + CModControlDlg *GetControlDlg() { return static_cast<CModControlView *>(CWnd::FromHandle(m_hWndCtrl))->GetCurrentControlDlg(); } + protected: //{{AFX_MSG(CModScrollView) afx_msg void OnDestroy(); Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-04-02 13:44:44 UTC (rev 4001) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-04-02 15:01:53 UTC (rev 4002) @@ -2474,9 +2474,18 @@ return m_pOrderlistHasFocus->PostMessage(WM_MOD_KEYCOMMAND, wParam, lParam); //Else send it to the active view - CView* pView = GetActiveView(); - if (pView) - return pView->PostMessage(WM_MOD_KEYCOMMAND, wParam, lParam); + CMDIChildWnd *pMDIActive = MDIGetActive(); + CWnd *wnd = nullptr; + if(pMDIActive) + { + wnd = pMDIActive->GetActiveView(); + // Hack: If the upper view is active, we only get the "container" (the dialog view with the tabs), not the view itself. + if(!strcmp(wnd->GetRuntimeClass()->m_lpszClassName, "CModControlView")) + { + wnd = static_cast<CModControlView *>(wnd)->GetCurrentControlDlg(); + } + } + if(wnd) return wnd->SendMessage(WM_MOD_KEYCOMMAND, wParam, lParam); } return wParam; Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2014-04-02 13:44:44 UTC (rev 4001) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2014-04-02 15:01:53 UTC (rev 4002) @@ -2872,8 +2872,8 @@ return CModScrollView::PreTranslateMessage(pMsg); } -LRESULT CViewSample::OnCustomKeyMsg(WPARAM wParam, LPARAM /*lParam*/) -//------------------------------------------------------------------- +LRESULT CViewSample::OnCustomKeyMsg(WPARAM wParam, LPARAM lParam) +//--------------------------------------------------------------- { if (wParam == kcNull) return NULL; @@ -2905,25 +2905,9 @@ case kcSampleMonoRight: OnMonoConvertRight(); return wParam; case kcSampleMonoSplit: OnMonoConvertSplit(); return wParam; - case kcSampleLoad: PostCtrlMessage(IDC_SAMPLE_OPEN); return wParam; - case kcSampleSave: PostCtrlMessage(IDC_SAMPLE_SAVEAS); return wParam; - case kcSampleNew: PostCtrlMessage(IDC_SAMPLE_NEW); return wParam; - - case kcSampleReverse: PostCtrlMessage(IDC_SAMPLE_REVERSE); return wParam; - case kcSampleSilence: PostCtrlMessage(IDC_SAMPLE_SILENCE); return wParam; - case kcSampleNormalize: PostCtrlMessage(IDC_SAMPLE_NORMALIZE); return wParam; - case kcSampleAmplify: PostCtrlMessage(IDC_SAMPLE_AMPLIFY); return wParam; - case kcSampleInvert: PostCtrlMessage(IDC_SAMPLE_INVERT); return wParam; - case kcSampleSignUnsign: PostCtrlMessage(IDC_SAMPLE_SIGN_UNSIGN); return wParam; - case kcSampleRemoveDCOffset: PostCtrlMessage(IDC_SAMPLE_DCOFFSET); return wParam; - case kcSampleXFade: PostCtrlMessage(IDC_SAMPLE_XFADE); return wParam; - case kcSampleAutotune: PostCtrlMessage(IDC_SAMPLE_AUTOTUNE); return wParam; - case kcSampleQuickFade: PostCtrlMessage(IDC_SAMPLE_QUICKFADE); return wParam; - // Those don't seem to work. case kcNoteOff: PlayNote(NOTE_KEYOFF); return wParam; case kcNoteCut: PlayNote(NOTE_NOTECUT); return wParam; - } if(wParam >= kcSampStartNotes && wParam <= kcSampEndNotes) { @@ -2970,7 +2954,8 @@ } } - return NULL; + // Pass on to ctrl_smp + return GetControlDlg()->SendMessage(WM_MOD_KEYCOMMAND, wParam, lParam); } Modified: trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb =================================================================== --- trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2014-04-02 13:44:44 UTC (rev 4001) +++ trunk/OpenMPT/mptrack/res/defaultKeybindings.mkb 2014-04-02 15:01:53 UTC (rev 4002) @@ -284,7 +284,6 @@ 8:1380:2:84:1 //Trim sample around loop points: Ctrl+T (KeyDown) 8:1383:0:8:1 //Silence sample selection: BACKSPACE (KeyDown) 8:1384:1:78:1 //Normalise Sample: Shift+N (KeyDown) -8:1385:3:65:1 //Amplify Sample: Shift+Ctrl+A (KeyDown) 8:1385:2:77:1 //Amplify Sample: Ctrl+M (KeyDown) 8:1381:3:82:1 //Reverse Sample: Shift+Ctrl+R (KeyDown) 8:1382:0:46:1 //Delete sample selection: DELETE (KeyDown) @@ -296,6 +295,10 @@ 8:1790:2:69:1 //Remove DC Offset: Ctrl+E (KeyDown) 8:1856:2:68:1 //Quick Fade: Ctrl+D (KeyDown) 8:1857:2:76:1 //Crossfade Sample Loop: Ctrl+L (KeyDown) +8:1907:2:81:1 //Transpose +1 (Note Map): Ctrl+Q (KeyDown) +8:1908:2:65:1 //Transpose -1 (Note Map): Ctrl+A (KeyDown) +8:1909:3:81:1 //Transpose +12 (Note Map): Shift+Ctrl+Q (KeyDown) +8:1910:3:65:1 //Transpose -12 (Note Map): Shift+Ctrl+A (KeyDown) //----( Instrument Context [bottom] (9) )------------ 9:1837:0:107:5 //Zoom In: NUM PLUS (KeyDown|KeyHold) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-04-02 19:26:43
|
Revision: 4003 http://sourceforge.net/p/modplug/code/4003 Author: saga-games Date: 2014-04-02 19:26:35 +0000 (Wed, 02 Apr 2014) Log Message: ----------- [Fix] More multi-view update fixes. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/Ctrl_ins.h trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-04-02 19:26:35 UTC (rev 4003) @@ -396,7 +396,7 @@ } if (bModified) { - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); } } @@ -417,7 +417,7 @@ } if (bModified) { - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); } } @@ -438,7 +438,7 @@ } if (bModified) { - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); } } @@ -480,7 +480,7 @@ } if (bModified) { - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); } } @@ -581,7 +581,7 @@ if (n != pIns->NoteMap[m_nNote]) { pIns->NoteMap[m_nNote] = n; - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); } if (bOk) @@ -616,7 +616,7 @@ if (n != pIns->Keyboard[m_nNote]) { pIns->Keyboard[m_nNote] = n; - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); PlayNote(m_nNote+1); } @@ -648,7 +648,7 @@ if (n != pIns->NoteMap[m_nNote]) { pIns->NoteMap[m_nNote] = n; - m_pParent.SetInstrumentModified(); + m_pParent.SetModified(HINT_INSTRUMENT, false); InvalidateRect(NULL, FALSE); } @@ -975,18 +975,23 @@ // Set instrument (and moddoc) as modified. -void CCtrlInstruments::SetInstrumentModified(const bool modified) -//--------------------------------------------------------------- +// updateAll: Update all views including this one. Otherwise, only update update other views. +void CCtrlInstruments::SetModified(DWORD mask, bool updateAll, bool modified) +//--------------------------------------------------------------------------- { -// -> CODE#0023 -// -> DESC="IT project files (.itp)" - m_modDoc.m_bsInstrumentModified.set(m_nInstrument - 1, modified); - m_modDoc.UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSNAMES, this); -// -! NEW_FEATURE#0023 - if(modified) + // -> CODE#0023 + // -> DESC="IT project files (.itp)" + if(m_modDoc.GetrSoundFile().m_SongFlags[SONG_ITPROJECT]) { - m_modDoc.SetModified(); + if(m_modDoc.m_bsInstrumentModified[m_nInstrument - 1] != modified) + { + m_modDoc.m_bsInstrumentModified.set(m_nInstrument - 1, modified); + mask |= HINT_INSNAMES; + } } + m_modDoc.UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | mask, updateAll ? nullptr : this); + // -! NEW_FEATURE#0023 + if(modified) m_modDoc.SetModified(); } @@ -1431,12 +1436,8 @@ if (!m_nInstrument) m_nInstrument = 1; if (m_sndFile.ReadInstrumentFromFile(m_nInstrument, file, TrackerSettings::Instance().m_MayNormalizeSamplesOnLoad)) { - m_modDoc.UpdateAllViews(NULL, HINT_SAMPLEINFO | HINT_MODTYPE, NULL); - // -> CODE#0023 - // -> DESC="IT project files (.itp)" m_sndFile.m_szInstrumentPath[m_nInstrument - 1] = fileName; - SetInstrumentModified(false); - // -! NEW_FEATURE#0023 + SetModified(HINT_SAMPLEINFO | HINT_MODTYPE, true, false); bOk = TRUE; } } @@ -1770,23 +1771,15 @@ else ok = m_sndFile.SaveITIInstrument(m_nInstrument, dlg.GetFirstFile(), index == (m_sndFile.GetType() == MOD_TYPE_XM ? 3 : 2)); -// -> CODE#0023 -// -> DESC="IT project files (.itp)" m_sndFile.m_szInstrumentPath[m_nInstrument - 1] = dlg.GetFirstFile(); - SetInstrumentModified(false); -// -! NEW_FEATURE#0023 + SetModified(HINT_MODTYPE | HINT_INSNAMES, true, false); + m_modDoc.UpdateAllViews(nullptr, HINT_SMPNAMES, this); EndWaitCursor(); - if (!ok) ErrorBox(IDS_ERR_SAVEINS, this); else - { + if (!ok) + ErrorBox(IDS_ERR_SAVEINS, this); + else TrackerDirectories::Instance().SetWorkingDirectory(dlg.GetWorkingDirectory(), DIR_INSTRUMENTS); - -// -> CODE#0023 -// -> DESC="IT project files (.itp)" -// m_pModDoc.UpdateAllViews(NULL, (m_nInstrument << 24) | HINT_INSTRUMENT); - m_modDoc.UpdateAllViews(NULL, HINT_MODTYPE | HINT_INSNAMES | HINT_SMPNAMES); -// -! NEW_FEATURE#0023 - } SwitchToView(); } @@ -1817,7 +1810,7 @@ if ((pIns) && (strncmp(s, pIns->name, MAX_INSTRUMENTNAME))) { mpt::String::Copy(pIns->name, s); - SetInstrumentModified(true); + SetModified(HINT_INSNAMES, false); } } } @@ -1835,7 +1828,7 @@ if ((pIns) && (strncmp(s, pIns->filename, 12))) { mpt::String::Copy(pIns->filename, s); - SetInstrumentModified(true); + SetModified(HINT_INSNAMES, false); } } } @@ -1855,7 +1848,7 @@ if(nVol != (int)pIns->nFadeOut) { pIns->nFadeOut = nVol; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -1872,7 +1865,7 @@ if (nVol != (int)pIns->nGlobalVol) { pIns->nGlobalVol = nVol; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -1916,11 +1909,11 @@ if(smp > 0 && smp <= m_sndFile.GetNumSamples()) m_sndFile.GetSample(smp).uFlags &= ~CHN_PANNING; } - m_modDoc.UpdateAllViews(NULL, HINT_SAMPLEINFO | HINT_MODTYPE); + m_modDoc.UpdateAllViews(NULL, HINT_SAMPLEINFO | HINT_MODTYPE, this); } } } - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } @@ -1939,7 +1932,7 @@ if (nPan != (int)pIns->nPan) { pIns->nPan = nPan; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -1954,12 +1947,12 @@ if (pIns->nNNA != m_ComboNNA.GetCurSel()) { pIns->nNNA = m_ComboNNA.GetCurSel(); - SetInstrumentModified(true); - } + SetModified(HINT_INSTRUMENT, false); + } } } - - + + void CCtrlInstruments::OnDCTChanged() //----------------------------------- { @@ -1969,12 +1962,12 @@ if (pIns->nDCT != m_ComboDCT.GetCurSel()) { pIns->nDCT = m_ComboDCT.GetCurSel(); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } - + void CCtrlInstruments::OnDCAChanged() //----------------------------------- { @@ -1984,7 +1977,7 @@ if (pIns->nDNA != m_ComboDCA.GetCurSel()) { pIns->nDNA = m_ComboDCA.GetCurSel(); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2002,7 +1995,7 @@ if (pIns->nMidiProgram != n) { pIns->nMidiProgram = n; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } //rewbs.MidiBank: we will not set the midi bank/program if it is 0 @@ -2027,7 +2020,7 @@ if(w >= 0 && w <= 16384 && pIns->wMidiBank != w) { pIns->wMidiBank = w; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } //rewbs.MidiBank: we will not set the midi bank/program if it is 0 if(w == 0) @@ -2051,7 +2044,7 @@ if(pIns->nMidiChannel != ch) { pIns->nMidiChannel = ch; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2066,8 +2059,7 @@ if (pIns->nResampling != (BYTE)(n & 0xff)) { pIns->nResampling = (BYTE)(n & 0xff); - SetInstrumentModified(true); - m_modDoc.UpdateAllViews(NULL, HINT_INSNAMES, this); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2094,7 +2086,7 @@ if ((!IsLocked()) && pIns->nMixPlug != nPlug) { pIns->nMixPlug = nPlug; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); m_modDoc.UpdateAllViews(NULL, HINT_MIXPLUGINS, this); } @@ -2184,7 +2176,7 @@ if (pIns->nPPS != (signed char)n) { pIns->nPPS = (signed char)n; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2204,7 +2196,7 @@ if(pIns->nVolRampUp != newRamp) { pIns->nVolRampUp = newRamp; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } m_SliderAttack.SetPos(n); @@ -2229,7 +2221,7 @@ if (pIns->nPPC != n) { pIns->nPPC = n; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2260,7 +2252,7 @@ } } UpdateFilterText(); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); SwitchToView(); } @@ -2289,7 +2281,7 @@ } } UpdateFilterText(); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); SwitchToView(); } @@ -2355,7 +2347,7 @@ { pIns->nVolRampUp = newRamp; SetDlgItemInt(IDC_EDIT2,n); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } // -! NEW_FEATURE#0027 } @@ -2365,8 +2357,8 @@ n = m_SliderVolSwing.GetPos(); if ((n >= 0) && (n <= 100) && (n != (int)pIns->nVolSwing)) { - pIns->nVolSwing = (BYTE)n; - SetInstrumentModified(true); + pIns->nVolSwing = (uint8)n; + SetModified(HINT_INSTRUMENT, false); } } // Pan Swing @@ -2375,8 +2367,8 @@ n = m_SliderPanSwing.GetPos(); if ((n >= 0) && (n <= 64) && (n != (int)pIns->nPanSwing)) { - pIns->nPanSwing = (BYTE)n; - SetInstrumentModified(true); + pIns->nPanSwing = (uint8)n; + SetModified(HINT_INSTRUMENT, false); } } //Cutoff swing @@ -2385,8 +2377,8 @@ n = m_SliderCutSwing.GetPos(); if ((n >= 0) && (n <= 64) && (n != (int)pIns->nCutSwing)) { - pIns->nCutSwing = (BYTE)n; - SetInstrumentModified(true); + pIns->nCutSwing = (uint8)n; + SetModified(HINT_INSTRUMENT, false); } } //Resonance swing @@ -2395,8 +2387,8 @@ n = m_SliderResSwing.GetPos(); if ((n >= 0) && (n <= 64) && (n != (int)pIns->nResSwing)) { - pIns->nResSwing = (BYTE)n; - SetInstrumentModified(true); + pIns->nResSwing = (uint8)n; + SetModified(HINT_INSTRUMENT, false); } } // Filter CutOff @@ -2406,7 +2398,7 @@ if ((n >= 0) && (n < 0x80) && (n != (int)(pIns->GetCutoff()))) { pIns->SetCutoff(n, pIns->IsCutoffEnabled()); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); UpdateFilterText(); filterChanger = true; } @@ -2418,7 +2410,7 @@ if ((n >= 0) && (n < 0x80) && (n != (int)(pIns->GetResonance()))) { pIns->SetResonance(n, pIns->IsResonanceEnabled()); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); UpdateFilterText(); filterChanger = true; } @@ -2672,7 +2664,7 @@ } pIns->nPluginVelocityHandling = n; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2695,7 +2687,7 @@ } pIns->nPluginVolumeHandling = n; - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } @@ -2715,7 +2707,7 @@ if(pwd != pIns->midiPWD) { pIns->midiPWD = static_cast<int8>(pwd); - SetInstrumentModified(true); + SetModified(HINT_INSTRUMENT, false); } } } Modified: trunk/OpenMPT/mptrack/Ctrl_ins.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.h 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/Ctrl_ins.h 2014-04-02 19:26:35 UTC (rev 4003) @@ -120,7 +120,7 @@ virtual ~CCtrlInstruments(); public: - void SetInstrumentModified(const bool modified = true); + void SetModified(DWORD mask, bool updateAll, bool modified = true); BOOL SetCurrentInstrument(UINT nIns, BOOL bUpdNum=TRUE); BOOL OpenInstrument(const mpt::PathString &fileName); BOOL OpenInstrument(CSoundFile &sndFile, INSTRUMENTINDEX nInstr); Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2014-04-02 19:26:35 UTC (rev 4003) @@ -177,15 +177,16 @@ // Set instrument (and moddoc) as modified. -void CViewInstrument::SetInstrumentModified() -//------------------------------------------- +// updateAll: Update all views including this one. Otherwise, only update update other views. +void CViewInstrument::SetModified(DWORD mask, bool updateAll) +//----------------------------------------------------------- { CModDoc *pModDoc = GetDocument(); if(pModDoc == nullptr) return; // -> CODE#0023 // -> DESC="IT project files (.itp)" pModDoc->m_bsInstrumentModified.set(m_nInstrument - 1, true); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSNAMES, this); + pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSNAMES | mask, updateAll ? nullptr : this); // -! NEW_FEATURE#0023 pModDoc->SetModified(); } @@ -772,9 +773,13 @@ //////////////////////////////////////////////////////////////////// // CViewInstrument drawing -void CViewInstrument::UpdateView(DWORD dwHintMask, CObject *) -//----------------------------------------------------------- +void CViewInstrument::UpdateView(DWORD dwHintMask, CObject *hint) +//--------------------------------------------------------------- { + if(hint == this) + { + return; + } const INSTRUMENTINDEX updateIns = (dwHintMask >> HINT_SHIFT_INS); if((dwHintMask & (HINT_MPTOPTIONS | HINT_MODTYPE)) || ((dwHintMask & HINT_ENVELOPE) && (m_nInstrument == updateIns || updateIns == 0)) @@ -1044,8 +1049,7 @@ envelope->nReleaseNode = ENV_RELEASE_NODE_UNSET; } - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + SetModified(HINT_ENVELOPE, true); return true; } } @@ -1119,8 +1123,7 @@ if (envelope->nSustainEnd >= i) envelope->nSustainEnd++; if (envelope->nReleaseNode >= i && envelope->nReleaseNode != ENV_RELEASE_NODE_UNSET) envelope->nReleaseNode++; - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + SetModified(HINT_ENVELOPE, true); return i + 1; } } @@ -1517,8 +1520,7 @@ CModDoc *pModDoc = GetDocument(); if(pModDoc) { - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + SetModified(HINT_ENVELOPE, true); } UpdateWindow(); //rewbs: TODO - optimisation here so we don't redraw whole view. } @@ -1776,9 +1778,7 @@ pEnv->nLoopStart = 0; pEnv->nLoopEnd = static_cast<uint8>(pEnv->nNodes - 1); } - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, true); } } @@ -1795,9 +1795,7 @@ // Enabled sustain loop => set sustain loop points if no sustain loop has been specified yet. pEnv->nSustainStart = pEnv->nSustainEnd = static_cast<uint8>(m_nDragItem - 1); } - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, true); } } @@ -1808,8 +1806,7 @@ CModDoc *pModDoc = GetDocument(); if ((pModDoc) && (EnvSetCarry(!EnvGetCarry()))) { - SetInstrumentModified(); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, false); } } @@ -1818,8 +1815,7 @@ { if(IsDragItemEnvPoint() && EnvToggleReleaseNode(m_nDragItem - 1)) { - SetInstrumentModified(); - InvalidateRect(NULL, FALSE); + SetModified(HINT_ENVELOPE, true); } } @@ -1829,8 +1825,7 @@ { if (EnvSetVolEnv(!EnvGetVolEnv())) { - SetInstrumentModified(); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, false); } } @@ -1840,8 +1835,7 @@ { if (EnvSetPanEnv(!EnvGetPanEnv())) { - SetInstrumentModified(); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, false); } } @@ -1851,8 +1845,7 @@ { if (EnvSetPitchEnv(!EnvGetPitchEnv())) { - SetInstrumentModified(); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, false); } } @@ -1862,8 +1855,7 @@ { if (EnvSetFilterEnv(!EnvGetFilterEnv())) { - SetInstrumentModified(); - UpdateNcButtonState(); + SetModified(HINT_ENVELOPE, false); } } @@ -1873,10 +1865,10 @@ { m_bGrid = !m_bGrid; if (m_bGrid) - m_bGridForceRedraw; + m_bGridForceRedraw = true; CModDoc *pModDoc = GetDocument(); if (pModDoc) - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE); } //end rewbs.envRowGrid @@ -2122,8 +2114,7 @@ } if (bUpdate) { - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT | HINT_ENVELOPE | HINT_INSNAMES, NULL); + SetModified(HINT_INSTRUMENT | HINT_ENVELOPE | HINT_INSNAMES, true); } CMDIChildWnd *pMDIFrame = (CMDIChildWnd *)GetParentFrame(); if (pMDIFrame) @@ -2254,8 +2245,7 @@ CScaleEnvPointsDlg dlg(this, *GetEnvelopePtr(), nOffset); if(dlg.DoModal() == IDOK) { - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + SetModified(HINT_ENVELOPE, true); } } } @@ -2310,8 +2300,7 @@ return; pEnv->Ticks[m_nDragItem - 1]--; - SetInstrumentModified(); - InvalidateRect(NULL, FALSE); + SetModified(HINT_ENVELOPE, true); } @@ -2324,8 +2313,7 @@ return; pEnv->Ticks[m_nDragItem - 1]++; - SetInstrumentModified(); - InvalidateRect(NULL, FALSE); + SetModified(HINT_ENVELOPE, true); } @@ -2339,8 +2327,7 @@ else pEnv->Values[m_nDragItem - 1] = ENVELOPE_MAX; - SetInstrumentModified(); - InvalidateRect(NULL, FALSE); + SetModified(HINT_ENVELOPE, true); } @@ -2354,8 +2341,7 @@ else pEnv->Values[m_nDragItem - 1] = ENVELOPE_MIN; - SetInstrumentModified(); - InvalidateRect(NULL, FALSE); + SetModified(HINT_ENVELOPE, true); } void CViewInstrument::EnvKbdInsertPoint() @@ -2450,8 +2436,7 @@ if(EnvToggleReleaseNode(m_nDragItem - 1)) { CModDoc *pModDoc = GetDocument(); // sanity checks are done in GetEnvelopePtr() already - SetInstrumentModified(); - pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); + SetModified(HINT_ENVELOPE, true); } } Modified: trunk/OpenMPT/mptrack/View_ins.h =================================================================== --- trunk/OpenMPT/mptrack/View_ins.h 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/View_ins.h 2014-04-02 19:26:35 UTC (rev 4003) @@ -131,7 +131,7 @@ //////////////////////// // Misc stuff void UpdateScrollSize(); - void SetInstrumentModified(); + void SetModified(DWORD mask, bool updateAll); BOOL SetCurrentInstrument(INSTRUMENTINDEX nIns, enmEnvelopeTypes m_nEnv = ENV_VOLUME); ModInstrument *GetInstrumentPtr() const; InstrumentEnvelope *GetEnvelopePtr() const; Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2014-04-02 19:26:35 UTC (rev 4003) @@ -3856,6 +3856,7 @@ if(!liveRecord) InvalidateRow(editpos.row); pMainFrm->ThreadSafeSetModified(pModDoc); + pModDoc->UpdateAllViews(this, HINT_PATTERNDATA | (editpos.pattern << HINT_SHIFT_PAT), this); } if(captured) @@ -3920,13 +3921,14 @@ m.command = CMD_SMOOTHMIDI; m.param = nByte2; pMainFrm->ThreadSafeSetModified(pModDoc); + pModDoc->UpdateAllViews(this, HINT_PATTERNDATA | (editpos.pattern << HINT_SHIFT_PAT), this); // Update GUI only if not recording live. if(!liveRecord) InvalidateRow(editpos.row); } } - + MPT_FALLTHROUGH; default: if(event == MIDIEvents::evSystem && TrackerSettings::Instance().m_dwMidiSetup & MIDISETUP_RESPONDTOPLAYCONTROLMSGS) { Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2014-04-02 19:26:35 UTC (rev 4003) @@ -162,6 +162,16 @@ } +// updateAll: Update all views including this one. Otherwise, only update update other views. +void CViewSample::SetModified(DWORD mask, bool updateAll) +//------------------------------------------------------- +{ + CModDoc *pModDoc = GetDocument(); + pModDoc->SetModified(); + pModDoc->UpdateAllViews(nullptr, mask | (m_nSample << HINT_SHIFT_SMP), updateAll ? nullptr : this); +} + + void CViewSample::UpdateScrollSize(int newZoom, bool forceRefresh, SmpLength centeredSample) //------------------------------------------------------------------------------------------ { @@ -495,9 +505,13 @@ /////////////////////////////////////////////////////////////// // CViewSample drawing -void CViewSample::UpdateView(DWORD dwHintMask, CObject *) -//------------------------------------------------------- +void CViewSample::UpdateView(DWORD dwHintMask, CObject *hint) +//----------------------------------------------------------- { + if(hint == this) + { + return; + } const SAMPLEINDEX updateSmp = (dwHintMask >> HINT_SHIFT_SMP); if((dwHintMask & (HINT_MPTOPTIONS | HINT_MODTYPE)) || ((dwHintMask & HINT_SAMPLEDATA) && (m_nSample == updateSmp || updateSmp == 0))) @@ -1605,7 +1619,7 @@ sndFile.GetSample(m_nSample).PrecomputeLoops(sndFile, false); InvalidateSample(); - pModDoc->SetModified(); + SetModified(HINT_SAMPLEDATA, false); } } else if (old != m_dwEndDrag) @@ -1660,7 +1674,7 @@ sndFile.GetSample(m_nSample).PrecomputeLoops(sndFile, false); InvalidateSample(); - pModDoc->SetModified(); + SetModified(HINT_SAMPLEDATA, false); } else { // ctrl + click = play from cursor pos @@ -1913,8 +1927,7 @@ if ((sample.nLoopStart != m_dwBeginSel) || (sample.nLoopEnd != m_dwEndSel)) { sample.SetLoop(m_dwBeginSel, m_dwEndSel, true, sample.uFlags[CHN_PINGPONGLOOP], sndFile); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA, true); } } } @@ -1934,8 +1947,7 @@ if ((sample.nSustainStart != m_dwBeginSel) || (sample.nSustainEnd != m_dwEndSel)) { sample.SetSustainLoop(m_dwBeginSel, m_dwEndSel, true, sample.uFlags[CHN_PINGPONGSUSTAIN], sndFile); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA, true); } } } @@ -2037,8 +2049,7 @@ sample.PrecomputeLoops(sndFile); } SetCurSel(0, 0); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | dwUpdateFlags, NULL); + SetModified(dwUpdateFlags, false); } @@ -2176,8 +2187,7 @@ GlobalUnlock(hCpy); SetCurSel(0, 0); sample.PrecomputeLoops(sndFile, true); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES, NULL); + SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES, true); } CloseClipboard(); } @@ -2191,7 +2201,9 @@ CModDoc *pModDoc = GetDocument(); if(pModDoc == nullptr) return; if(pModDoc->GetSampleUndo().Undo(m_nSample)) - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + { + SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES, true); + } } @@ -2201,7 +2213,9 @@ CModDoc *pModDoc = GetDocument(); if(pModDoc == nullptr) return; if(pModDoc->GetSampleUndo().Redo(m_nSample)) - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + { + SetModified(HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES, true); + } } @@ -2235,8 +2249,7 @@ sample.PrecomputeLoops(sndFile, false); cs.Leave(); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } } EndWaitCursor(); @@ -2304,8 +2317,7 @@ right.nPan = 256; } } - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES | HINT_INSNAMES, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } else { pModDoc->GetSampleUndo().RemoveLastUndoStep(m_nSample); @@ -2359,9 +2371,8 @@ sample.PrecomputeLoops(sndFile); cs.Leave(); - pModDoc->SetModified(); SetCurSel(0, 0); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } EndWaitCursor(); } @@ -2560,8 +2571,7 @@ } if (bUpdate) { - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, NULL); - pModDoc->SetModified(); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO | HINT_SMPNAMES, true); } CMDIChildWnd *pMDIFrame = (CMDIChildWnd *)GetParentFrame(); if (pMDIFrame) @@ -2628,8 +2638,7 @@ { pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Set Loop Start"); sample.SetLoop(m_dwMenuParam, sample.nLoopEnd, true, sample.uFlags[CHN_PINGPONGLOOP], sndFile); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } } } @@ -2647,8 +2656,7 @@ { pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Set Loop End"); sample.SetLoop(sample.nLoopStart, m_dwMenuParam, true, sample.uFlags[CHN_PINGPONGLOOP], sndFile); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } } } @@ -2666,8 +2674,7 @@ { pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Set Sustain Start"); sample.SetSustainLoop(m_dwMenuParam, sample.nSustainEnd, true, sample.uFlags[CHN_PINGPONGSUSTAIN], sndFile); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } } } @@ -2685,8 +2692,7 @@ { pModDoc->GetSampleUndo().PrepareUndo(m_nSample, sundo_none, "Set Sustain End"); sample.SetSustainLoop(sample.nSustainStart, m_dwMenuParam, true, sample.uFlags[CHN_PINGPONGSUSTAIN], sndFile); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } } } @@ -2782,8 +2788,7 @@ if(nOldLength != sample.nLength) { SetCurSel(0, 0); - pModDoc->SetModified(); - pModDoc->UpdateAllViews(NULL, (m_nSample << HINT_SHIFT_SMP) | HINT_SAMPLEINFO | HINT_SAMPLEDATA | HINT_SMPNAMES, NULL); + SetModified(HINT_SAMPLEDATA | HINT_SAMPLEINFO, true); } } Modified: trunk/OpenMPT/mptrack/View_smp.h =================================================================== --- trunk/OpenMPT/mptrack/View_smp.h 2014-04-02 15:01:53 UTC (rev 4002) +++ trunk/OpenMPT/mptrack/View_smp.h 2014-04-02 19:26:35 UTC (rev 4003) @@ -57,6 +57,7 @@ DECLARE_SERIAL(CViewSample) protected: + void SetModified(DWORD mask, bool updateAll); void UpdateScrollSize() { UpdateScrollSize(m_nZoom, true); } void UpdateScrollSize(int newZoom, bool forceRefresh, SmpLength centeredSample = SmpLength(-1)); BOOL SetCurrentSample(SAMPLEINDEX nSmp); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-04-04 22:10:45
|
Revision: 4004 http://sourceforge.net/p/modplug/code/4004 Author: saga-games Date: 2014-04-04 22:10:38 +0000 (Fri, 04 Apr 2014) Log Message: ----------- [Fix] Typo in shortcut name [Fix] Bug in pattern navigation introduced in r4002 most likely (http://bugs.openmpt.org/view.php?id=502) [Fix] Don't evaluate some sample editor shortcuts while in the upper view like it was done before. Default silence sample shortcut is backspace, which interferes with edit boxes. Revision Links: -------------- http://sourceforge.net/p/modplug/code/4002 Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_smp.cpp Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2014-04-02 19:26:35 UTC (rev 4003) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2014-04-04 22:10:38 UTC (rev 4004) @@ -635,7 +635,7 @@ DefineKeyCommand(kcChannelSplitRecordSelect, 1884, _T("Channel Split Record Select")); DefineKeyCommand(kcDataEntryUp, 1885, _T("Data Entry +1")); DefineKeyCommand(kcDataEntryDown, 1886, _T("Data Entry -1")); - DefineKeyCommand(kcSample8Bit, 1887, _T("Conver to 8-bit")); + DefineKeyCommand(kcSample8Bit, 1887, _T("Convert to 8-bit")); DefineKeyCommand(kcSampleMonoMix, 1888, _T("Convert to Mono (Mix)")); DefineKeyCommand(kcSampleMonoLeft, 1889, _T("Convert to Mono (Left Channel)")); DefineKeyCommand(kcSampleMonoRight, 1890, _T("Convert to Mono (Right Channel)")); Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-04-02 19:26:35 UTC (rev 4003) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-04-04 22:10:38 UTC (rev 4004) @@ -462,6 +462,60 @@ SetCurrentSample((SAMPLEINDEX)lParam, -1, TRUE); break; + //rewbs.customKeys + case IDC_SAMPLE_REVERSE: + OnReverse(); + break; + + case IDC_SAMPLE_SILENCE: + OnSilence(); + break; + + case IDC_SAMPLE_INVERT: + OnInvert(); + break; + + case IDC_SAMPLE_XFADE: + OnXFade(); + break; + + case IDC_SAMPLE_AUTOTUNE: + OnAutotune(); + break; + + case IDC_SAMPLE_SIGN_UNSIGN: + OnSignUnSign(); + break; + + case IDC_SAMPLE_DCOFFSET: + OnRemoveDCOffset(); + break; + + case IDC_SAMPLE_NORMALIZE: + OnNormalize(); + break; + + case IDC_SAMPLE_AMPLIFY: + OnAmplify(); + break; + + case IDC_SAMPLE_QUICKFADE: + OnQuickFade(); + break; + + case IDC_SAMPLE_OPEN: + OnSampleOpen(); + break; + + case IDC_SAMPLE_SAVEAS: + OnSampleSave(); + break; + + case IDC_SAMPLE_NEW: + OnSampleNew(); + break; + //end rewbs.customKeys + default: return CModControlDlg::OnModCtrlMsg(wParam, lParam); } @@ -3017,17 +3071,6 @@ case kcSampleSave: OnSampleSave(); return wParam; case kcSampleNew: OnSampleNew(); return wParam; - case kcSampleReverse: OnReverse(); return wParam; - case kcSampleSilence: OnSilence(); return wParam; - case kcSampleNormalize: OnNormalize(); return wParam; - case kcSampleAmplify: OnAmplify(); return wParam; - case kcSampleInvert: OnInvert(); return wParam; - case kcSampleSignUnsign: OnSignUnSign(); return wParam; - case kcSampleRemoveDCOffset: OnRemoveDCOffset(); return wParam; - case kcSampleXFade: OnXFade(); return wParam; - case kcSampleAutotune: OnAutotune(); return wParam; - case kcSampleQuickFade: OnQuickFade(); return wParam; - case kcSampleTransposeUp: transpose = 1; break; case kcSampleTransposeDown: transpose = -1; break; case kcSampleTransposeOctUp: transpose = 12; break; Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2014-04-02 19:26:35 UTC (rev 4003) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2014-04-04 22:10:38 UTC (rev 4004) @@ -1695,7 +1695,7 @@ CModDoc *pModDoc = GetDocument(); if (pModDoc) { - pModDoc->SoloChannel(chn, false); //rewbs.merge: recover old solo/mute behaviour + pModDoc->SoloChannel(chn, false); pModDoc->MuteChannel(chn, !pModDoc->IsChannelMuted(chn)); //If we just unmuted a channel, make sure none are still considered "solo". @@ -1803,7 +1803,7 @@ for(CHANNELINDEX i = 0; i < nChns; i++) { pModDoc->MuteChannel(i, false); - pModDoc->SoloChannel(i, false); //rewbs.merge: binary solo/mute behaviour + pModDoc->SoloChannel(i, false); } InvalidateChannelsHeaders(); } @@ -4266,11 +4266,11 @@ case kcNavigateLeftSelect: case kcNavigateLeft: MoveCursor(false); - break; + return wParam; case kcNavigateRightSelect: case kcNavigateRight: MoveCursor(true); - break; + return wParam; case kcNavigateNextChanSelect: case kcNavigateNextChan: SetCurrentColumn((GetCurrentChannel() + 1) % pSndFile->GetNumChannels(), m_Cursor.GetColumnType()); return wParam; @@ -4424,23 +4424,23 @@ case kcDecreaseSpacing: if(m_nSpacing > 0) SetSpacing(m_nSpacing - 1); - break; + return wParam; case kcIncreaseSpacing: if(m_nSpacing < MAX_SPACING) SetSpacing(m_nSpacing + 1); - break; + return wParam; // Clipboard Manager case kcToggleClipboardManager: PatternClipboardDialog::Toggle(); - break; + return wParam; case kcClipboardPrev: PatternClipboard::CycleBackward(); PatternClipboardDialog::UpdateList(); - break; + return wParam; case kcClipboardNext: PatternClipboard::CycleForward(); PatternClipboardDialog::UpdateList(); - break; + return wParam; } //Ranges: @@ -5928,7 +5928,7 @@ } } -//rewbs.merge + bool CViewPattern::HandleSplit(ModCommand &m, int note) //----------------------------------------------------- { Modified: trunk/OpenMPT/mptrack/View_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_smp.cpp 2014-04-02 19:26:35 UTC (rev 4003) +++ trunk/OpenMPT/mptrack/View_smp.cpp 2014-04-04 22:10:38 UTC (rev 4004) @@ -2910,6 +2910,17 @@ case kcSampleMonoRight: OnMonoConvertRight(); return wParam; case kcSampleMonoSplit: OnMonoConvertSplit(); return wParam; + case kcSampleReverse: PostCtrlMessage(IDC_SAMPLE_REVERSE); return wParam; + case kcSampleSilence: PostCtrlMessage(IDC_SAMPLE_SILENCE); return wParam; + case kcSampleNormalize: PostCtrlMessage(IDC_SAMPLE_NORMALIZE); return wParam; + case kcSampleAmplify: PostCtrlMessage(IDC_SAMPLE_AMPLIFY); return wParam; + case kcSampleInvert: PostCtrlMessage(IDC_SAMPLE_INVERT); return wParam; + case kcSampleSignUnsign: PostCtrlMessage(IDC_SAMPLE_SIGN_UNSIGN); return wParam; + case kcSampleRemoveDCOffset: PostCtrlMessage(IDC_SAMPLE_DCOFFSET); return wParam; + case kcSampleXFade: PostCtrlMessage(IDC_SAMPLE_XFADE); return wParam; + case kcSampleAutotune: PostCtrlMessage(IDC_SAMPLE_AUTOTUNE); return wParam; + case kcSampleQuickFade: PostCtrlMessage(IDC_SAMPLE_QUICKFADE); return wParam; + // Those don't seem to work. case kcNoteOff: PlayNote(NOTE_KEYOFF); return wParam; case kcNoteCut: PlayNote(NOTE_NOTECUT); return wParam; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-04-09 23:28:26
|
Revision: 4008 http://sourceforge.net/p/modplug/code/4008 Author: saga-games Date: 2014-04-09 23:28:19 +0000 (Wed, 09 Apr 2014) Log Message: ----------- [Fix] Undoing channel deletion didn't work properly. Modified Paths: -------------- trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Modedit.cpp Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2014-04-09 19:20:28 UTC (rev 4007) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2014-04-09 23:28:19 UTC (rev 4008) @@ -2953,13 +2953,19 @@ //------------------------------------------------------------------------------------- { bool linkUndo = false; + + PATTERNINDEX lastPat = PATTERNINDEX_INVALID; for(PATTERNINDEX pat = 0; pat < m_SndFile.Patterns.Size(); pat++) { + if(m_SndFile.Patterns.IsValidPat(pat)) lastPat = pat; + } + + for(PATTERNINDEX pat = 0; pat < m_SndFile.Patterns.Size(); pat++) + { if(m_SndFile.Patterns.IsValidPat(pat)) { - GetPatternUndo().PrepareUndo(pat, 0, 0, GetNumChannels(), m_SndFile.Patterns[pat].GetNumRows(), description, linkUndo, storeChannelInfo); + GetPatternUndo().PrepareUndo(pat, 0, 0, GetNumChannels(), m_SndFile.Patterns[pat].GetNumRows(), description, linkUndo, storeChannelInfo && pat == lastPat); linkUndo = true; - storeChannelInfo = false; } } } Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2014-04-09 19:20:28 UTC (rev 4007) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2014-04-09 23:28:19 UTC (rev 4008) @@ -395,7 +395,7 @@ } } else { - PrepareUndoForAllPatterns("Rearrange Samples"); + PrepareUndoForAllPatterns(false, "Rearrange Samples"); std::vector<ModCommand::INSTR> indices(newIndex.size(), 0); for(size_t i = 0; i < newIndex.size(); i++) @@ -471,7 +471,7 @@ m_SndFile.DestroyInstrument(i, doNoDeleteAssociatedSamples); } - PrepareUndoForAllPatterns("Rearrange Instrumens"); + PrepareUndoForAllPatterns(false, "Rearrange Instrumens"); std::vector<ModCommand::INSTR> indices(newIndex.size(), 0); for(size_t i = 0; i < newIndex.size(); i++) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-04-13 15:19:27
|
Revision: 4011 http://sourceforge.net/p/modplug/code/4011 Author: saga-games Date: 2014-04-13 15:19:18 +0000 (Sun, 13 Apr 2014) Log Message: ----------- [Fix] Sample tab: Fading samples was broken in 64-bit builds (http://bugs.openmpt.org/view.php?id=507) Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Ctrl_smp.h Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-04-10 00:50:51 UTC (rev 4010) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2014-04-13 15:19:18 UTC (rev 4011) @@ -1259,9 +1259,28 @@ } -void CCtrlSamples::ApplyAmplify(LONG lAmp, bool bFadeIn, bool bFadeOut) -//----------------------------------------------------------------------- +template<typename T> +void ApplyAmplifyImpl(void *pSample, SmpLength start, SmpLength end, int32 amp, bool fadeIn, bool fadeOut) +//-------------------------------------------------------------------------------------------------------- { + T *p = static_cast<T *>(pSample) + start; + SmpLength len = end - start; + int64 l64 = static_cast<int64>(len); + + for(SmpLength i = 0; i < len; i++) + { + int32 l = (p[i] * amp) / 100; + if(fadeIn) l = (int32)((l * (int64)i) / l64); + if(fadeOut) l = (int32)((l * (int64)(len - i)) / l64); + Clamp(l, std::numeric_limits<T>::min(), std::numeric_limits<T>::max()); + p[i] = static_cast<T>(l); + } +} + + +void CCtrlSamples::ApplyAmplify(int32 lAmp, bool fadeIn, bool fadeOut) +//-------------------------------------------------------------------- +{ if((!m_sndFile.GetSample(m_nSample).pSample)) return; BeginWaitCursor(); @@ -1272,34 +1291,13 @@ m_modDoc.GetSampleUndo().PrepareUndo(m_nSample, sundo_update, "Amplify", selection.nStart, selection.nEnd); if (sample.uFlags[CHN_STEREO]) { selection.nStart *= 2; selection.nEnd *= 2; } - SmpLength len = selection.nEnd - selection.nStart; - if ((bFadeIn) && (bFadeOut)) lAmp *= 4; + if ((fadeIn) && (fadeOut)) lAmp *= 4; if (sample.uFlags[CHN_16BIT]) { - signed short *p = ((signed short *)sample.pSample) + selection.nStart; - - for (SmpLength i=0; i<len; i++) - { - LONG l = (p[i] * lAmp) / 100; - if (bFadeIn) l = (LONG)((l * (LONGLONG)i) / len); - if (bFadeOut) l = (LONG)((l * (LONGLONG)(len-i)) / len); - if (l < -32768) l = -32768; - if (l > 32767) l = 32767; - p[i] = (signed short)l; - } + ApplyAmplifyImpl<int16>(sample.pSample, selection.nStart, selection.nEnd, lAmp, fadeIn, fadeOut); } else { - signed char *p = ((signed char *)sample.pSample) + selection.nStart; - - for (SmpLength i=0; i<len; i++) - { - LONG l = (p[i] * lAmp) / 100; - if (bFadeIn) l = (LONG)((l * (LONGLONG)i) / len); - if (bFadeOut) l = (LONG)((l * (LONGLONG)(len-i)) / len); - if (l < -128) l = -128; - if (l > 127) l = 127; - p[i] = (signed char)l; - } + ApplyAmplifyImpl<int8>(sample.pSample, selection.nStart, selection.nEnd, lAmp, fadeIn, fadeOut); } sample.PrecomputeLoops(m_sndFile, false); SetModified(HINT_SAMPLEDATA, false); Modified: trunk/OpenMPT/mptrack/Ctrl_smp.h =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-04-10 00:50:51 UTC (rev 4010) +++ trunk/OpenMPT/mptrack/Ctrl_smp.h 2014-04-13 15:19:18 UTC (rev 4011) @@ -52,7 +52,7 @@ // Applies amplification to sample. Negative values // can be used to invert phase. - void ApplyAmplify(LONG nAmp, bool bFadeIn = false, bool bFadeOut = false); + void ApplyAmplify(int32 nAmp, bool fadeIn = false, bool fadeOut = false); SampleSelectionPoints GetSelectionPoints(); void SetSelectionPoints(SmpLength nStart, SmpLength nEnd); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-04-22 15:55:32
|
Revision: 4015 http://sourceforge.net/p/modplug/code/4015 Author: saga-games Date: 2014-04-22 15:55:21 +0000 (Tue, 22 Apr 2014) Log Message: ----------- [Imp] Don't require shift key to be pressed when entering numeric effect letters on French keyboards (https://forum.openmpt.org/index.php?topic=5279.0) [Fix] Mixer setup: Changing the filter window didn't mark the dialog as modified. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/Mpdlgs.cpp Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2014-04-17 01:37:05 UTC (rev 4014) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2014-04-22 15:55:21 UTC (rev 4015) @@ -1642,7 +1642,6 @@ { std::istringstream iStrm(std::string(pData, nSize)); LoadFile(iStrm, std::wstring(), pTempCS); - FreeResource(hglob); } } else { @@ -1855,7 +1854,7 @@ bool CCommandSet::QuickChange_SetEffects(const CModSpecifications &modSpecs) //-------------------------------------------------------------------------- { - int choices=0; + int choices = 0; KeyCombination kc(kCtxViewPatternsFX, 0, 0, kKeyEventDown); for(CommandID cmd = kcFixedFXStart; cmd <= kcFixedFXend; cmd = static_cast<CommandID>(cmd + 1)) @@ -1887,13 +1886,16 @@ if(codeNmod != -1) { kc.KeyCode(LOBYTE(codeNmod)); - kc.Modifier(HIBYTE(codeNmod) & 0x07); //We're only interest in the bottom 3 bits. + kc.Modifier(0); + // Don't add modifier keys, since on French keyboards, numbers are input using Shift. + // We don't really want that behaviour here, and I'm sure we don't want that in other cases on other layouts as well. + //kc.Modifier(HIBYTE(codeNmod) & 0x07); //We're only interest in the bottom 3 bits. Add(kc, cmd, true); } - if (kc.KeyCode() >= '0' && kc.KeyCode() <= '9') //for numbers, ensure numpad works too + if (effect >= '0' && effect <= '9') //for numbers, ensure numpad works too { - kc.KeyCode(VK_NUMPAD0 + (kc.KeyCode() - '0')); + kc.KeyCode(VK_NUMPAD0 + (effect - '0')); Add(kc, cmd, true); } } Modified: trunk/OpenMPT/mptrack/Mpdlgs.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-04-17 01:37:05 UTC (rev 4014) +++ trunk/OpenMPT/mptrack/Mpdlgs.cpp 2014-04-22 15:55:21 UTC (rev 4015) @@ -728,15 +728,13 @@ BEGIN_MESSAGE_MAP(COptionsMixer, CPropertyPage) ON_WM_HSCROLL() ON_WM_VSCROLL() - ON_CBN_SELCHANGE(IDC_COMBO_FILTER, OnResamplerChanged) - ON_EN_UPDATE(IDC_WFIRCUTOFF, OnSettingsChanged) - ON_EN_UPDATE(IDC_COMBO_FILTERWINDOW, OnSettingsChanged) - ON_EN_UPDATE(IDC_RAMPING_IN, OnRampingChanged) - ON_EN_UPDATE(IDC_RAMPING_OUT, OnRampingChanged) - ON_CBN_SELCHANGE(IDC_COMBO_POLYPHONY, OnSettingsChanged) - // slider stereo sep - ON_COMMAND(IDC_CHECK_SOFTPAN, OnSettingsChanged) - // slider preamp + ON_CBN_SELCHANGE(IDC_COMBO_FILTER, OnResamplerChanged) + ON_CBN_SELCHANGE(IDC_COMBO_FILTERWINDOW, OnSettingsChanged) + ON_CBN_SELCHANGE(IDC_COMBO_POLYPHONY, OnSettingsChanged) + ON_EN_UPDATE(IDC_WFIRCUTOFF, OnSettingsChanged) + ON_EN_UPDATE(IDC_RAMPING_IN, OnRampingChanged) + ON_EN_UPDATE(IDC_RAMPING_OUT, OnRampingChanged) + ON_COMMAND(IDC_CHECK_SOFTPAN, OnSettingsChanged) END_MESSAGE_MAP() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-04-24 17:16:53
|
Revision: 4020 http://sourceforge.net/p/modplug/code/4020 Author: saga-games Date: 2014-04-24 17:16:47 +0000 (Thu, 24 Apr 2014) Log Message: ----------- [Fix] last commit was incomplete Modified Paths: -------------- trunk/OpenMPT/mptrack/Childfrm.h trunk/OpenMPT/mptrack/View_gen.h Modified: trunk/OpenMPT/mptrack/Childfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Childfrm.h 2014-04-24 17:16:16 UTC (rev 4019) +++ trunk/OpenMPT/mptrack/Childfrm.h 2014-04-24 17:16:47 UTC (rev 4020) @@ -18,9 +18,9 @@ typedef struct _GENERALVIEWSTATE { DWORD cbStruct; + PlugParamIndex nParam; + CHANNELINDEX nTab; PLUGINDEX nPlugin; - DWORD nParam; - DWORD nTab; } GENERALVIEWSTATE; Modified: trunk/OpenMPT/mptrack/View_gen.h =================================================================== --- trunk/OpenMPT/mptrack/View_gen.h 2014-04-24 17:16:16 UTC (rev 4019) +++ trunk/OpenMPT/mptrack/View_gen.h 2014-04-24 17:16:47 UTC (rev 4020) @@ -31,9 +31,10 @@ CSliderCtrl m_sbWetDry; CSpinButtonCtrl m_spinVolume[4], m_spinPan[4]; CButton m_BtnSelect, m_BtnEdit; - int m_nActiveTab, m_nLockCount; + int m_nLockCount; + PlugParamIndex m_nCurrentParam; + CHANNELINDEX m_nActiveTab; PLUGINDEX m_nCurrentPlugin; - PlugParamIndex m_nCurrentParam; CComboBox m_CbnSpecialMixProcessing; CSpinButtonCtrl m_SpinMixGain; // update#02 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-04-27 13:44:42
|
Revision: 4021 http://sourceforge.net/p/modplug/code/4021 Author: saga-games Date: 2014-04-27 13:44:35 +0000 (Sun, 27 Apr 2014) Log Message: ----------- [Imp] Tree view: Ctrl+Enter starts label editing [Imp] Pattern tab: Extend channel mute and channel mute on pattern transition shortcuts to cover all channels covered by the selection instead of just the channel where the cursor is. Modified Paths: -------------- trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_tre.cpp Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2014-04-24 17:16:47 UTC (rev 4020) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2014-04-27 13:44:35 UTC (rev 4021) @@ -4198,10 +4198,14 @@ case kcPatternRecord: OnPatternRecord(); return wParam; case kcCursorCopy: OnCursorCopy(); return wParam; case kcCursorPaste: OnCursorPaste(); return wParam; - case kcChannelMute: OnMuteChannel(GetCurrentChannel()); return wParam; + case kcChannelMute: for(CHANNELINDEX c = m_Selection.GetStartChannel(); c <= m_Selection.GetEndChannel(); c++) + OnMuteChannel(c); + return wParam; case kcChannelSolo: OnSoloChannel(GetCurrentChannel()); return wParam; case kcChannelUnmuteAll: OnUnmuteAll(); return wParam; - case kcToggleChanMuteOnPatTransition: TogglePendingMute(GetCurrentChannel()); return wParam; + case kcToggleChanMuteOnPatTransition: for(CHANNELINDEX c = m_Selection.GetStartChannel(); c <= m_Selection.GetEndChannel(); c++) + TogglePendingMute(c); + return wParam; case kcUnmuteAllChnOnPatTransition: OnPendingUnmuteAllChnFromClick(); return wParam; case kcChannelRecordSelect: for(CHANNELINDEX c = m_Selection.GetStartChannel(); c <= m_Selection.GetEndChannel(); c++) pModDoc->Record1Channel(c); Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2014-04-24 17:16:47 UTC (rev 4020) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2014-04-27 13:44:35 UTC (rev 4021) @@ -264,11 +264,17 @@ HTREEITEM hItem = GetSelectedItem(); if(hItem) { - if(!ExecuteItem(hItem)) + if(CMainFrame::GetInputHandler()->CtrlPressed()) { - if(ItemHasChildren(hItem)) + EditLabel(hItem); + } else + { + if(!ExecuteItem(hItem)) { - Expand(hItem, TVE_TOGGLE); + if(ItemHasChildren(hItem)) + { + Expand(hItem, TVE_TOGGLE); + } } } } @@ -1661,7 +1667,7 @@ // Enumerating Drives... if(!IsSampleBrowser()) { - CImageListEx &images = CMainFrame::GetMainFrame()->m_MiscIcons; + CImageList &images = CMainFrame::GetMainFrame()->m_MiscIcons; // Avoid adding the same images again and again... images.SetImageCount(IMGLIST_NUMIMAGES); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-05-01 13:56:29
|
Revision: 4024 http://sourceforge.net/p/modplug/code/4024 Author: saga-games Date: 2014-05-01 13:56:16 +0000 (Thu, 01 May 2014) Log Message: ----------- [Imp] Updated code to use CHM help file instead of PDF. [Int] Added scripts for creating the CHM manual. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Moptions.h trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj Added Paths: ----------- trunk/OpenMPT/mptrack/manual_generator/ trunk/OpenMPT/mptrack/manual_generator/readme.txt trunk/OpenMPT/mptrack/manual_generator/run.cmd trunk/OpenMPT/mptrack/manual_generator/run.sh trunk/OpenMPT/mptrack/manual_generator/source/ trunk/OpenMPT/mptrack/manual_generator/source/bullet.png trunk/OpenMPT/mptrack/manual_generator/source/external.png trunk/OpenMPT/mptrack/manual_generator/source/help.css trunk/OpenMPT/mptrack/manual_generator/wiki.py Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2014-04-29 17:09:05 UTC (rev 4023) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2014-05-01 13:56:16 UTC (rev 4024) @@ -535,7 +535,7 @@ void CCtrlGeneral::OnPlayerProperties() //------------------------------------- { - CMainFrame::m_nLastOptionsPage = 2; //OPTIONS_PAGE_PLAYER + CMainFrame::m_nLastOptionsPage = OPTIONS_PAGE_PLAYER; CMainFrame::GetMainFrame()->OnViewOptions(); } Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-04-29 17:09:05 UTC (rev 4023) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-05-01 13:56:16 UTC (rev 4024) @@ -38,6 +38,7 @@ #include "soundlib/FileReader.h" #include "../common/Profiler.h" #include "FileDialog.h" +#include <HtmlHelp.h> #ifdef _DEBUG #define new DEBUG_NEW @@ -106,7 +107,7 @@ END_MESSAGE_MAP() // Globals -UINT CMainFrame::m_nLastOptionsPage = 0; +OptionsPage CMainFrame::m_nLastOptionsPage = OPTIONS_PAGE_DEFAULT; HHOOK CMainFrame::ghKbdHook = NULL; std::vector<mpt::PathString> CMainFrame::s_ExampleModulePaths; @@ -363,6 +364,8 @@ if(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_MIDIRECORD) midiOpenDevice(false); + HtmlHelpW(m_hWnd, nullptr, HH_INITIALIZE, reinterpret_cast<DWORD_PTR>(&helpCookie)); + return 0; } @@ -377,6 +380,8 @@ BOOL CMainFrame::DestroyWindow() //------------------------------ { + HtmlHelpW(m_hWnd, nullptr, HH_UNINITIALIZE, reinterpret_cast<DWORD_PTR>(&helpCookie)); + // Uninstall Keyboard Hook if (ghKbdHook) { @@ -2616,11 +2621,41 @@ void CMainFrame::OnHelp() //----------------------- { - const mpt::PathString helpFile = theApp.GetAppDirPath() + MPT_PATHSTRING("OpenMPT Manual.pdf"); - if(!theApp.OpenFile(helpFile)) + CView *view = GetActiveView(); + const char *page = ""; + if(m_bOptionsLocked) { + switch(m_nLastOptionsPage) + { + case OPTIONS_PAGE_GENERAL: page = "::/Setup_General.html"; break; + case OPTIONS_PAGE_SOUNDCARD: page = "::/Setup_Soundcard.html"; break; + case OPTIONS_PAGE_MIXER: page = "::/Setup_Mixer.html"; break; + case OPTIONS_PAGE_PLAYER: page = "::/Setup_DSP.html"; break; + case OPTIONS_PAGE_SAMPLEDITOR: page = "::/Setup_Samples.html"; break; + case OPTIONS_PAGE_KEYBOARD: page = "::/Setup_Keyboard.html"; break; + case OPTIONS_PAGE_COLORS: page = "::/Setup_Colours.html"; break; + case OPTIONS_PAGE_MIDI: page = "::/Setup_MIDI.html"; break; + case OPTIONS_PAGE_AUTOSAVE: page = "::/Setup_Autosave.html"; break; + case OPTIONS_PAGE_UPDATE: page = "::/Setup_Update.html"; break; + case OPTIONS_PAGE_ADVANCED: page = "::/Setup_Advanced.html"; break; + } + } else if(view != nullptr) + { + const char *className = view->GetRuntimeClass()->m_lpszClassName; + if(!strcmp("CViewGlobals", className)) page = "::/General.html"; + else if(!strcmp("CViewPattern", className)) page = "::/Patterns.html"; + else if(!strcmp("CViewSample", className)) page = "::/Samples.html"; + else if(!strcmp("CViewInstrument", className)) page = "::/Instruments.html"; + else if(!strcmp("CModControlView", className)) page = "::/Comments.html"; + } + + const mpt::PathString helpFile = theApp.GetAppDirPath() + MPT_PATHSTRING("OpenMPT Manual.chm") + mpt::PathString::FromUTF8(page); + if(!HtmlHelpW(m_hWnd, helpFile.AsNative().c_str(), strcmp(page, "") ? HH_DISPLAY_TOC : HH_DISPLAY_TOPIC, NULL)) + { Reporting::Error(L"Could not find help file:\n" + helpFile.ToWide()); + return; } + //::ShowWindow(hwndHelp, SW_SHOWMAXIMIZED); } Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2014-04-29 17:09:05 UTC (rev 4023) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2014-05-01 13:56:16 UTC (rev 4024) @@ -245,6 +245,24 @@ }; +// Tab Order +enum OptionsPage +{ + OPTIONS_PAGE_DEFAULT = 0, + OPTIONS_PAGE_GENERAL = OPTIONS_PAGE_DEFAULT, + OPTIONS_PAGE_SOUNDCARD, + OPTIONS_PAGE_MIXER, + OPTIONS_PAGE_PLAYER, + OPTIONS_PAGE_SAMPLEDITOR, + OPTIONS_PAGE_KEYBOARD, + OPTIONS_PAGE_COLORS, + OPTIONS_PAGE_MIDI, + OPTIONS_PAGE_AUTOSAVE, + OPTIONS_PAGE_UPDATE, + OPTIONS_PAGE_ADVANCED, +}; + + ///////////////////////////////////////////////////////////////////////// // Player position notification @@ -279,7 +297,7 @@ public: // Globals - static UINT m_nLastOptionsPage; + static OptionsPage m_nLastOptionsPage; static HHOOK ghKbdHook; // GDI @@ -328,6 +346,7 @@ // Misc CModDoc* m_pJustModifiedDoc; class COptionsSoundcard *m_SoundCardOptionsDialog; + DWORD helpCookie; bool m_bOptionsLocked; // Notification Buffer Modified: trunk/OpenMPT/mptrack/Moptions.h =================================================================== --- trunk/OpenMPT/mptrack/Moptions.h 2014-04-29 17:09:05 UTC (rev 4023) +++ trunk/OpenMPT/mptrack/Moptions.h 2014-05-01 13:56:16 UTC (rev 4024) @@ -12,23 +12,7 @@ class COptionsKeyboard; -// Tab Order -enum { - OPTIONS_PAGE_GENERAL=0, - OPTIONS_PAGE_SOUNDCARD, - OPTIONS_PAGE_MIXER, - OPTIONS_PAGE_PLAYER, - OPTIONS_PAGE_SAMPLEDITOR, - OPTIONS_PAGE_KEYBOARD, - OPTIONS_PAGE_COLORS, - OPTIONS_PAGE_MIDI, - OPTIONS_PAGE_AUTOSAVE, - OPTIONS_PAGE_UPDATE, - OPTIONS_PAGE_ADVANCED, -}; - - //========================================= class COptionsGeneral: public CPropertyPage //========================================= Index: trunk/OpenMPT/mptrack/manual_generator =================================================================== --- trunk/OpenMPT/mptrack/manual_generator 2014-04-29 17:09:05 UTC (rev 4023) +++ trunk/OpenMPT/mptrack/manual_generator 2014-05-01 13:56:16 UTC (rev 4024) Property changes on: trunk/OpenMPT/mptrack/manual_generator ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,2 ## +html +htmlhelp Added: svn:global-ignores ## -0,0 +1 ## +html Added: tsvn:logminsize ## -0,0 +1 ## +10 \ No newline at end of property Added: trunk/OpenMPT/mptrack/manual_generator/readme.txt =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/readme.txt (rev 0) +++ trunk/OpenMPT/mptrack/manual_generator/readme.txt 2014-05-01 13:56:16 UTC (rev 4024) @@ -0,0 +1,3 @@ +To generate the manual, run wiki.py. This will download all required files into the "html" +sub directory and prepare all files needed for HTML Help Workshop. +Place HTML Help Workshop in the sub directory "htmlhelp" and execute run.cmd. \ No newline at end of file Added: trunk/OpenMPT/mptrack/manual_generator/run.cmd =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/run.cmd (rev 0) +++ trunk/OpenMPT/mptrack/manual_generator/run.cmd 2014-05-01 13:56:16 UTC (rev 4024) @@ -0,0 +1,7 @@ +REM del /s html +REM mkdir html +REM wiki.py +copy source\*.* html\ +htmlhelp\hhc.exe "html\OpenMPT Manual.hhp" +copy "html\OpenMPT Manual.chm" "..\..\packageTemplate\" +@pause \ No newline at end of file Added: trunk/OpenMPT/mptrack/manual_generator/run.sh =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/run.sh (rev 0) +++ trunk/OpenMPT/mptrack/manual_generator/run.sh 2014-05-01 13:56:16 UTC (rev 4024) @@ -0,0 +1,4 @@ +#!/bin/bash +rm -rf html/*.* +mkdir html +./wiki.py \ No newline at end of file Index: trunk/OpenMPT/mptrack/manual_generator/source =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/source 2014-04-29 17:09:05 UTC (rev 4023) +++ trunk/OpenMPT/mptrack/manual_generator/source 2014-05-01 13:56:16 UTC (rev 4024) Property changes on: trunk/OpenMPT/mptrack/manual_generator/source ___________________________________________________________________ Added: tsvn:logminsize ## -0,0 +1 ## +10 \ No newline at end of property Added: trunk/OpenMPT/mptrack/manual_generator/source/bullet.png =================================================================== (Binary files differ) Index: trunk/OpenMPT/mptrack/manual_generator/source/bullet.png =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/source/bullet.png 2014-04-29 17:09:05 UTC (rev 4023) +++ trunk/OpenMPT/mptrack/manual_generator/source/bullet.png 2014-05-01 13:56:16 UTC (rev 4024) Property changes on: trunk/OpenMPT/mptrack/manual_generator/source/bullet.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: trunk/OpenMPT/mptrack/manual_generator/source/external.png =================================================================== (Binary files differ) Index: trunk/OpenMPT/mptrack/manual_generator/source/external.png =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/source/external.png 2014-04-29 17:09:05 UTC (rev 4023) +++ trunk/OpenMPT/mptrack/manual_generator/source/external.png 2014-05-01 13:56:16 UTC (rev 4024) Property changes on: trunk/OpenMPT/mptrack/manual_generator/source/external.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: trunk/OpenMPT/mptrack/manual_generator/source/help.css =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/source/help.css (rev 0) +++ trunk/OpenMPT/mptrack/manual_generator/source/help.css 2014-05-01 13:56:16 UTC (rev 4024) @@ -0,0 +1,36 @@ +body +{ + margin: 0; + padding: 0; + border: 0; + background: #fff; + color: #000; +} + +h1 +{ + background-color: #DFEFFF; + padding: 0.25em; +} + +#content +{ + margin: 0 !important; + border: 0 !important; + padding: 1em !important; +} + +#toc +{ + display: none; +} + +ul +{ + list-style-image: url(bullet.png) !important; +} + +div#content a.external +{ + background-image: url(external.png) !important; +} \ No newline at end of file Added: trunk/OpenMPT/mptrack/manual_generator/wiki.py =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/wiki.py (rev 0) +++ trunk/OpenMPT/mptrack/manual_generator/wiki.py 2014-05-01 13:56:16 UTC (rev 4024) @@ -0,0 +1,156 @@ +#!/usr/bin/env python +# OpenMPT help file scraper +# by coda and Saga Musix +# This script downloads the OpenMPT manual TOC and then downloads all pages +# from that TOC. The pages are parsed and all required image files are fetched. +# The script also generates the appropriate files that can be fed into the +# HTML Help Workshop to generate a CHM file. + +from urllib2 import urlopen +from urllib import urlretrieve +import re + +base_url = 'http://wiki.openmpt.org' + +style = urlopen(base_url + '/load.php?debug=false&lang=en&modules=mediawiki.legacy.common%2Cshared|skins.vector&only=styles&*').read() +# Remove a few unused CSS classes +style = re.sub(r'\}(\w+)?[\.#]vector([\w >]+)\{.+?\}', '}', style) +style_file = open('html/style.css', 'w') +style_file.write(style) +style_file.close() + +toc_page = urlopen(base_url + '/index.php?title=Manual:_CHM_TOC&action=render').read() + +pages = re.findall('href="' + base_url + '/(.+?)"', toc_page) + +def destname(p): + p = p.split(':_')[1] + p = p.replace('/', '_') + p = p.replace('.', '_') + if p.find('#') >= 0: + parts = p.split('#') + return parts[0] + '.html#' + parts[1] + return p + '.html' + +def title(p): + p = p.split(':_')[1] + p = p.replace('_', ' ') + return p + +def localurl(p): + p = destname(p) + return p + +def replace_images(m): + global base_url + filepath = m.group(1) + '/' + m.group(2) + '/' + filename = m.group(3) + project.write(filename + "\n") + + urlretrieve(base_url + '/images/' + filepath + filename, 'html/' + filename) + return '"' + filename + '"' + +def fix_internal_links(m): + return '<a href="' + localurl(m.group(1)) + '"' + +project = open('html/OpenMPT Manual.hhp', 'w') + +project.write("""[OPTIONS] +Compatibility=1.1 or later +Compiled file=OpenMPT Manual.chm +Contents file=OpenMPT Manual.hhc +Display compile progress=No +Full-text search=Yes +Language=0x409 English (United States) +Title=OpenMPT Manual +Default topic=""" + localurl(pages[0]) + """ + + +[FILES] +style.css +help.css +bullet.png +external.png +""") + +for p in pages: + content = urlopen(base_url + '/index.php?title=' + p + '&action=render').read() + # Download and replace image URLs + content = re.sub(r'"/images/thumb/(\w+)/(\w+)/([^\/]+?)/([^\/]+?)"', replace_images, content) + content = re.sub(r'"/images/(\w+)/(\w+)/([^\/]+?)"', replace_images, content) + # Remove comments + content = re.sub(r'<!--(.+?)-->', '', content, flags = re.DOTALL) + # Fix local URLs + content = re.sub(r'<a href="' + base_url + '/File:', '<a href="', content) + content = re.sub(r'<a href="' + base_url + '/(Manual:.+?)"', fix_internal_links, content) + content = re.sub(r'<a href="/(Manual:.+?)"', fix_internal_links, content) + # Remove templates that shouldn't turn up in the manual + content = re.sub(r'<div class="todo".+?</div>', '', content, flags = re.DOTALL); + content = re.sub(r'<p class="newversion".+?</p>', '', content, flags = re.DOTALL); + # Remove edit links (MW 1.23 should make this superfluous) + content = re.sub(r'<span class="mw-editsection"><span class="mw-editsection-bracket">\[</span><a href=".+?">edit</a><span class="mw-editsection-bracket">\]</span></span>', '', content) + # Remove magnify links for images + content = content.replace('<img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" />', '') + + section = re.match(r'(.+)/', title(p)) + section_str = '' + if section: + section_str = section.group(1) + + content = """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <link href="style.css" rel="stylesheet" /> + <link href="help.css" rel="stylesheet" /> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <title>OpenMPT Manual - """ + title(p) + """</title> + </head> + <body> + <h1>""" + title(p) + '</h1><div id="content">' + content + '</div></body></html>' + + saved = open('html/' + destname(p), 'wb') + + saved.write(content) + saved.close() + + project.write(destname(p)+"\n") + print p + +project.close() + +# Create TOC +toc = open('html/OpenMPT Manual.hhc', 'w') + +toc.write(""" +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<HTML> +<HEAD> +<meta name="GENERATOR" content="Microsoft® HTML Help Workshop 4.1"> +<!-- Sitemap 1.0 --> +</HEAD><BODY> +<OBJECT type="text/site properties"> + <param name="ImageType" value="Folder"> +</OBJECT> +""") + +def toc_parse(m): + return """<OBJECT type="text/sitemap"> + <param name="Name" value=\"""" + m.group(2) + """"> + <param name="Local" value=\"""" + localurl(m.group(1)) + """"> + </OBJECT>""" + +def toc_parse_chapter(m): + return """<li><OBJECT type="text/sitemap"> + <param name="Name" value=\"""" + m.group(1) + """"> + </OBJECT>""" + +toc_text = re.sub(r'<!--(.+?)-->', '', toc_page, flags = re.DOTALL) +toc_text = re.sub(r'<div(.+?)/div>', '', toc_text, flags = re.DOTALL) +toc_text = re.sub(r'<a href="' + base_url + '/(.+?)".*?>(.+?)</a>', toc_parse, toc_text) +toc_text = re.sub(r'<li> ([^<]+)$', toc_parse_chapter, toc_text, flags = re.MULTILINE) +toc.write(toc_text) + +toc.write(""" +</BODY></HTML> +""") +toc.close() \ No newline at end of file Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-04-29 17:09:05 UTC (rev 4023) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2014-05-01 13:56:16 UTC (rev 4024) @@ -82,7 +82,7 @@ <Tool Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" - AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib dsound.lib msacm32.lib ksguid.lib ksuser.lib" + AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib dsound.lib msacm32.lib ksguid.lib ksuser.lib htmlhelp.lib" Version="5.0" LinkIncremental="2" SuppressStartupBanner="true" @@ -182,7 +182,7 @@ <Tool Name="VCLinkerTool" AdditionalOptions="/MACHINE:I386" - AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib wininet.lib dsound.lib msacm32.lib ksguid.lib ksuser.lib" + AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib wininet.lib dsound.lib msacm32.lib ksguid.lib ksuser.lib htmlhelp.lib" Version="5.0" LinkIncremental="1" SuppressStartupBanner="true" @@ -281,7 +281,7 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib dsound.lib msacm32.lib ksguid.lib ksuser.lib" + AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib dsound.lib msacm32.lib ksguid.lib ksuser.lib htmlhelp.lib" Version="5.0" LinkIncremental="2" SuppressStartupBanner="true" @@ -381,7 +381,7 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib wininet.lib dsound.lib msacm32.lib ksuser.lib" + AdditionalDependencies="winmm.lib strmiids.lib dmoguids.lib version.lib Rpcrt4.lib delayimp.lib wininet.lib dsound.lib msacm32.lib ksuser.lib htmlhelp.lib" Version="5.0" LinkIncremental="1" SuppressStartupBanner="true" Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2014-04-29 17:09:05 UTC (rev 4023) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2014-05-01 13:56:16 UTC (rev 4024) @@ -145,7 +145,7 @@ </ResourceCompile> <Link> <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions> - <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;dsound.lib;msacm32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;dsound.lib;msacm32.lib;htmlhelp.lib;%(AdditionalDependencies)</AdditionalDependencies> <Version>5.0</Version> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> @@ -196,7 +196,7 @@ </ResourceCompile> <Link> <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions> - <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;dsound.lib;msacm32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;dsound.lib;msacm32.lib;htmlhelp.lib;%(AdditionalDependencies)</AdditionalDependencies> <Version>5.0</Version> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> @@ -251,7 +251,7 @@ </ResourceCompile> <Link> <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions> - <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;wininet.lib;dsound.lib;msacm32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;wininet.lib;dsound.lib;msacm32.lib;htmlhelp.lib;%(AdditionalDependencies)</AdditionalDependencies> <Version>5.0</Version> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> @@ -307,7 +307,7 @@ </ResourceCompile> <Link> <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions> - <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;wininet.lib;dsound.lib;msacm32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;wininet.lib;dsound.lib;msacm32.lib;htmlhelp.lib;%(AdditionalDependencies)</AdditionalDependencies> <Version>5.0</Version> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> @@ -364,7 +364,7 @@ </ResourceCompile> <Link> <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions> - <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;wininet.lib;dsound.lib;msacm32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;wininet.lib;dsound.lib;msacm32.lib;htmlhelp.lib;%(AdditionalDependencies)</AdditionalDependencies> <Version>5.0</Version> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> @@ -420,7 +420,7 @@ </ResourceCompile> <Link> <AdditionalOptions>%(AdditionalOptions)</AdditionalOptions> - <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;wininet.lib;dsound.lib;msacm32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>winmm.lib;strmiids.lib;dmoguids.lib;version.lib;Rpcrt4.lib;delayimp.lib;wininet.lib;dsound.lib;msacm32.lib;htmlhelp.lib;%(AdditionalDependencies)</AdditionalDependencies> <Version>5.0</Version> <SuppressStartupBanner>true</SuppressStartupBanner> <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-05-01 13:57:01
|
Revision: 4025 http://sourceforge.net/p/modplug/code/4025 Author: saga-games Date: 2014-05-01 13:56:50 +0000 (Thu, 01 May 2014) Log Message: ----------- [Fix] Input handler: Handle recursive input bypassing properly (adding a plugin through the plugin selection dialog un-bypassed the input handler there) Modified Paths: -------------- trunk/OpenMPT/mptrack/InputHandler.cpp trunk/OpenMPT/mptrack/InputHandler.h Modified: trunk/OpenMPT/mptrack/InputHandler.cpp =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.cpp 2014-05-01 13:56:16 UTC (rev 4024) +++ trunk/OpenMPT/mptrack/InputHandler.cpp 2014-05-01 13:56:50 UTC (rev 4025) @@ -69,8 +69,8 @@ activeCommandSet->GenKeyMap(keyMap); SetupSpecialKeyInterception(); // Feature: use Windows keys as modifier keys, intercept special keys - m_bBypass = false; - modifierMask=0; + bypassCount = 0; + modifierMask = 0; m_bNoAltMenu = true; } @@ -140,7 +140,7 @@ CommandID CInputHandler::KeyEvent(InputTargetContext context, UINT &nChar, UINT &/*nRepCnt*/, UINT &nFlags, KeyEventType keyEventType, CWnd* pSourceWnd) -//---------------------------------------------------------------------------------------------------------------------------------------------------------- +//------------------------------------------------------------------------------------------------------------------------------------------------------ { if(InterceptSpecialKeys(nChar, nFlags, false)) return kcNull; @@ -410,14 +410,18 @@ void CInputHandler::Bypass(bool b) //-------------------------------- { - m_bBypass=b; + if(b) + bypassCount++; + else + bypassCount--; + ASSERT(bypassCount >= 0); } bool CInputHandler::IsBypassed() //------------------------------ { - return m_bBypass; + return bypassCount > 0; } @@ -606,7 +610,7 @@ { //Alpha-numerics (only shift or no modifier): - if(!CtrlPressed() && !AltPressed() + if(!(GetModifierMask() & (~HOTKEYF_SHIFT)) && ((key>='A'&&key<='Z') || (key>='0'&&key<='9') || key==VK_DIVIDE || key==VK_MULTIPLY || key==VK_SPACE || key==VK_RETURN || key==VK_CAPITAL || (key>=VK_OEM_1 && key<=VK_OEM_3) || (key>=VK_OEM_4 && key<=VK_OEM_8))) @@ -618,7 +622,7 @@ return true; //Copy paste etc.. - if(CMainFrame::GetInputHandler()->GetModifierMask()==HOTKEYF_CONTROL && + if(GetModifierMask()==HOTKEYF_CONTROL && (key == 'Y' || key == 'Z' || key == 'X' || key == 'C' || key == 'V' || key == 'A')) return true; Modified: trunk/OpenMPT/mptrack/InputHandler.h =================================================================== --- trunk/OpenMPT/mptrack/InputHandler.h 2014-05-01 13:56:16 UTC (rev 4024) +++ trunk/OpenMPT/mptrack/InputHandler.h 2014-05-01 13:56:50 UTC (rev 4025) @@ -37,7 +37,7 @@ KeyMap keyMap; void LogModifiers(UINT mask); UINT modifierMask; - bool m_bBypass; + int bypassCount; bool m_bNoAltMenu; bool CatchModifierChange(WPARAM wParam, KeyEventType keyEventType, int scancode); bool m_bInterceptWindowsKeys, m_bInterceptNumLock, m_bInterceptCapsLock, m_bInterceptScrollLock; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-05-01 18:58:03
|
Revision: 4026 http://sourceforge.net/p/modplug/code/4026 Author: saga-games Date: 2014-05-01 18:57:56 +0000 (Thu, 01 May 2014) Log Message: ----------- [Mod] Don't regenerate key config everytime the pattern editor is focussed. Only do it when the effect keys have actually changed. This greatly speeds up debug builds because inserting into the unordered_map there is... slow. Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2014-05-01 13:56:50 UTC (rev 4025) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2014-05-01 18:57:56 UTC (rev 4026) @@ -51,6 +51,8 @@ SetupCommands(); SetupContextHierarchy(); + + oldSpecs = nullptr; } @@ -1854,6 +1856,13 @@ bool CCommandSet::QuickChange_SetEffects(const CModSpecifications &modSpecs) //-------------------------------------------------------------------------- { + // Is this already the active key configuration? + if(&modSpecs == oldSpecs) + { + return false; + } + oldSpecs = &modSpecs; + int choices = 0; KeyCombination kc(kCtxViewPatternsFX, 0, 0, kKeyEventDown); @@ -1932,9 +1941,11 @@ { // m_isParentContext.SetSize(kCtxMaxInputContexts); - for (UINT nCtx=0; nCtx<kCtxMaxInputContexts; nCtx++) { + for (UINT nCtx=0; nCtx<kCtxMaxInputContexts; nCtx++) + { // m_isParentContext[nCtx].SetSize(kCtxMaxInputContexts); - for (UINT nCtx2=0; nCtx2<kCtxMaxInputContexts; nCtx2++) { + for (UINT nCtx2=0; nCtx2<kCtxMaxInputContexts; nCtx2++) + { m_isParentContext[nCtx][nCtx2] = false; }//InputTargetContext } Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2014-05-01 13:56:50 UTC (rev 4025) +++ trunk/OpenMPT/mptrack/CommandSet.h 2014-05-01 18:57:56 UTC (rev 4026) @@ -1270,6 +1270,8 @@ kcDummy }; +struct CModSpecifications; + class CCommandSet { protected: @@ -1283,6 +1285,7 @@ int FindCmd(int uid); bool KeyCombinationConflict(KeyCombination kc1, KeyCombination kc2, bool &crossCxtConflict); + const CModSpecifications *oldSpecs; CommandStruct commands[kcNumCommands]; bool m_isParentContext[kCtxMaxInputContexts][kCtxMaxInputContexts]; bool enforceRule[kNumRules]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-05-03 13:14:52
|
Revision: 4030 http://sourceforge.net/p/modplug/code/4030 Author: saga-games Date: 2014-05-03 13:14:43 +0000 (Sat, 03 May 2014) Log Message: ----------- [Imp] CHM: Define a custom window to have a slightly more sane default sized help setup. Modified Paths: -------------- trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/manual_generator/wiki.py Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2014-05-02 19:02:48 UTC (rev 4029) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2014-05-03 13:14:43 UTC (rev 4030) @@ -2649,7 +2649,7 @@ else if(!strcmp("CModControlView", className)) page = "::/Comments.html"; } - const mpt::PathString helpFile = theApp.GetAppDirPath() + MPT_PATHSTRING("OpenMPT Manual.chm") + mpt::PathString::FromUTF8(page); + const mpt::PathString helpFile = theApp.GetAppDirPath() + MPT_PATHSTRING("OpenMPT Manual.chm") + mpt::PathString::FromUTF8(page) + MPT_PATHSTRING(">OpenMPT"); if(!HtmlHelpW(m_hWnd, helpFile.AsNative().c_str(), strcmp(page, "") ? HH_DISPLAY_TOC : HH_DISPLAY_TOPIC, NULL)) { Reporting::Error(L"Could not find help file:\n" + helpFile.ToWide()); Modified: trunk/OpenMPT/mptrack/manual_generator/wiki.py =================================================================== --- trunk/OpenMPT/mptrack/manual_generator/wiki.py 2014-05-02 19:02:48 UTC (rev 4029) +++ trunk/OpenMPT/mptrack/manual_generator/wiki.py 2014-05-03 13:14:43 UTC (rev 4030) @@ -65,6 +65,8 @@ Title=OpenMPT Manual Default topic=""" + localurl(pages[0]) + """ +[WINDOWS] +OpenMPT=,"OpenMPT Manual.hhc",,"" + localurl(pages[0]) + "",,,,,,0x42520,,0x300e,[50,50,750,550],0xb0000,,,,,,0 [FILES] style.css This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-05-03 13:57:32
|
Revision: 4031 http://sourceforge.net/p/modplug/code/4031 Author: saga-games Date: 2014-05-03 13:57:20 +0000 (Sat, 03 May 2014) Log Message: ----------- [Mod] Get rid of horrible font artefacts in credits dialog with cleartype being enabled [Mod] Small code cleanups Modified Paths: -------------- trunk/OpenMPT/mptrack/CreditStatic.cpp trunk/OpenMPT/mptrack/Ctrl_ins.cpp trunk/OpenMPT/mptrack/PNG.cpp trunk/OpenMPT/mptrack/View_ins.cpp Modified: trunk/OpenMPT/mptrack/CreditStatic.cpp =================================================================== --- trunk/OpenMPT/mptrack/CreditStatic.cpp 2014-05-03 13:14:43 UTC (rev 4030) +++ trunk/OpenMPT/mptrack/CreditStatic.cpp 2014-05-03 13:57:20 UTC (rev 4031) @@ -562,7 +562,7 @@ ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, - PROOF_QUALITY, + ANTIALIASED_QUALITY, VARIABLE_PITCH | 0x04 | FF_DONTCARE, (LPSTR)"Arial"); memDC.SetTextColor(m_Colors[TOP_LEVEL_GROUP_COLOR]); @@ -580,7 +580,7 @@ ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, - PROOF_QUALITY, + ANTIALIASED_QUALITY, VARIABLE_PITCH | 0x04 | FF_DONTCARE, (LPSTR)"Arial"); memDC.SetTextColor(m_Colors[GROUP_TITLE_COLOR]); @@ -598,7 +598,7 @@ ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, - PROOF_QUALITY, + ANTIALIASED_QUALITY, VARIABLE_PITCH | 0x04 | FF_DONTCARE, (LPSTR)"Arial"); memDC.SetTextColor(m_Colors[TOP_LEVEL_TITLE_COLOR]); @@ -642,7 +642,7 @@ ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, - PROOF_QUALITY, + ANTIALIASED_QUALITY, VARIABLE_PITCH | 0x04 | FF_DONTCARE, (LPSTR)"Arial"); memDC.SetTextColor(m_Colors[NORMAL_TEXT_COLOR]); Modified: trunk/OpenMPT/mptrack/Ctrl_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-05-03 13:14:43 UTC (rev 4030) +++ trunk/OpenMPT/mptrack/Ctrl_ins.cpp 2014-05-03 13:57:20 UTC (rev 4031) @@ -1463,8 +1463,7 @@ } SetCurrentInstrument(m_nInstrument); - m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT | HINT_ENVELOPE | HINT_INSNAMES | HINT_SMPNAMES); + SetModified(HINT_INSTRUMENT | HINT_ENVELOPE | HINT_INSNAMES | HINT_SMPNAMES, true); } else bOk = FALSE; } if (bFirst) m_modDoc.UpdateAllViews(NULL, HINT_MODTYPE | HINT_INSNAMES | HINT_SMPNAMES); @@ -1487,7 +1486,6 @@ bFirst = true; m_sndFile.m_nInstruments = 1; m_NoteMap.SetCurrentInstrument(1); - m_modDoc.SetModified(); bFirst = true; } if (!m_nInstrument) @@ -1499,10 +1497,8 @@ cs.Leave(); - m_modDoc.SetModified(); - m_modDoc.UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_INSTRUMENT | HINT_ENVELOPE | HINT_INSNAMES | HINT_SMPNAMES); + SetModified(HINT_INSTRUMENT | HINT_ENVELOPE | HINT_INSNAMES | HINT_SMPNAMES, true); if (bFirst) m_modDoc.UpdateAllViews(NULL, HINT_MODTYPE | HINT_INSNAMES | HINT_SMPNAMES); - m_modDoc.SetModified(); EndWaitCursor(); return TRUE; } Modified: trunk/OpenMPT/mptrack/PNG.cpp =================================================================== --- trunk/OpenMPT/mptrack/PNG.cpp 2014-05-03 13:14:43 UTC (rev 4030) +++ trunk/OpenMPT/mptrack/PNG.cpp 2014-05-03 13:57:20 UTC (rev 4031) @@ -2,7 +2,7 @@ * PNG.cpp * ------- * Purpose: Extremely minimalistic PNG loader (only for internal data resources) - * Notes : Currenlty implemented: 8-bit, 24-bit and 32-bit images (8 bits per component), no filters, no interlaced pictures. + * Notes : Currently implemented: 8-bit, 24-bit and 32-bit images (8 bits per component), no filters, no interlaced pictures. * Paletted pictures are automatically depalettized. * Authors: OpenMPT Devs * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. @@ -175,11 +175,7 @@ } FileReader file(pData, nSize); - - Bitmap *bitmap = ReadPNG(file); - - FreeResource(hglob); - return bitmap; + return ReadPNG(file); } Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2014-05-03 13:14:43 UTC (rev 4030) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2014-05-03 13:57:20 UTC (rev 4031) @@ -841,9 +841,9 @@ nPrevTick = nTick; nRow = nTick / speed; - if (nRow % std::max(1, nRowsPerMeasure) == 0) + if (nRowsPerMeasure > 0 && nRow % nRowsPerMeasure == 0) m_dcGrid.SelectObject(CMainFrame::penGray80); - else if (nRow % std::max(1, nRowsPerBeat) == 0) + else if (nRowsPerBeat > 0 && nRow % nRowsPerBeat == 0) m_dcGrid.SelectObject(CMainFrame::penGray55); else m_dcGrid.SelectObject(CMainFrame::penGray33); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-05-03 14:42:36
|
Revision: 4033 http://sourceforge.net/p/modplug/code/4033 Author: saga-games Date: 2014-05-03 14:42:30 +0000 (Sat, 03 May 2014) Log Message: ----------- [Mod] Pattern tab: After pasting pattern data, the pasted area is automatically marked (http://bugs.openmpt.org/view.php?id=498). Modified Paths: -------------- trunk/OpenMPT/mptrack/PatternClipboard.cpp trunk/OpenMPT/mptrack/PatternClipboard.h trunk/OpenMPT/mptrack/View_pat.cpp Modified: trunk/OpenMPT/mptrack/PatternClipboard.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternClipboard.cpp 2014-05-03 14:39:50 UTC (rev 4032) +++ trunk/OpenMPT/mptrack/PatternClipboard.cpp 2014-05-03 14:42:30 UTC (rev 4033) @@ -271,34 +271,34 @@ // Try pasting a pattern selection from the system clipboard. -bool PatternClipboard::Paste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, ORDERINDEX curOrder) -//-------------------------------------------------------------------------------------------------------------- +bool PatternClipboard::Paste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, ORDERINDEX curOrder, PatternRect &pasteRect) +//-------------------------------------------------------------------------------------------------------------------------------------- { CString data; - if(!FromSystemClipboard(data) || !HandlePaste(sndFile, pastePos, mode, data, curOrder)) + if(!FromSystemClipboard(data) || !HandlePaste(sndFile, pastePos, mode, data, curOrder, pasteRect)) { // Fall back to internal clipboard if there's no valid pattern data in the system clipboard. - return Paste(sndFile, pastePos, mode, curOrder, instance.activeClipboard); + return Paste(sndFile, pastePos, mode, curOrder, pasteRect, instance.activeClipboard); } return true; } // Try pasting a pattern selection from an internal clipboard. -bool PatternClipboard::Paste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, ORDERINDEX curOrder, clipindex_t internalClipboard) -//--------------------------------------------------------------------------------------------------------------------------------------------- +bool PatternClipboard::Paste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, ORDERINDEX curOrder, PatternRect &pasteRect, clipindex_t internalClipboard) +//--------------------------------------------------------------------------------------------------------------------------------------------------------------------- { if(internalClipboard >= instance.clipboards.size()) { return false; } - return HandlePaste(sndFile, pastePos, mode, instance.clipboards[internalClipboard].content, curOrder); + return HandlePaste(sndFile, pastePos, mode, instance.clipboards[internalClipboard].content, curOrder, pasteRect); } // Parse clipboard string and perform the pasting operation. -bool PatternClipboard::HandlePaste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, const CString &data, ORDERINDEX curOrder) -//----------------------------------------------------------------------------------------------------------------------------------------- +bool PatternClipboard::HandlePaste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, const CString &data, ORDERINDEX curOrder, PatternRect &pasteRect) +//----------------------------------------------------------------------------------------------------------------------------------------------------------------- { PATTERNINDEX pattern = pastePos.pattern; if(sndFile.GetpModDoc() == nullptr) @@ -443,6 +443,7 @@ const bool doMixPaste = (mode == pmMixPaste) || doITStyleMix; const bool clipboardHasS3MCommands = (pasteFormat & (MOD_TYPE_IT | MOD_TYPE_MPT | MOD_TYPE_S3M)) != 0; + PatternCursor startPoint(startRow, startChan, PatternCursor::lastColumn), endPoint(startRow, startChan, PatternCursor::firstColumn); ModCommand *patData = sndFile.Patterns[pattern].GetpModCommand(startRow, 0); pos = startPos; @@ -564,10 +565,13 @@ m.Clear(); } + PatternCursor::Columns firstCol = PatternCursor::lastColumn, lastCol = PatternCursor::firstColumn; + // Note if(data[pos] != ' ' && (!doMixPaste || ((!doITStyleMix && origModCmd.note == NOTE_NONE) || (doITStyleMix && origModCmd.note == NOTE_NONE && origModCmd.instr == 0 && origModCmd.volcmd == VOLCMD_NONE)))) { + firstCol = PatternCursor::noteColumn; m.note = NOTE_NONE; if(data[pos] == '=') m.note = NOTE_KEYOFF; @@ -609,6 +613,8 @@ if(data[pos + 3] > ' ' && (!doMixPaste || ( (!doITStyleMix && origModCmd.instr == 0) || (doITStyleMix && origModCmd.note == NOTE_NONE && origModCmd.instr == 0 && origModCmd.volcmd == VOLCMD_NONE) ) )) { + firstCol = std::min(firstCol, PatternCursor::instrColumn); + lastCol = std::max(lastCol, PatternCursor::instrColumn); if(data[pos + 3] >= '0' && data[pos + 3] <= ('0' + (MAX_SAMPLES / 10))) { m.instr = (data[pos + 3] - '0') * 10 + (data[pos + 4] - '0'); @@ -619,6 +625,8 @@ if(data[pos + 5] > ' ' && (!doMixPaste || ((!doITStyleMix && origModCmd.volcmd == VOLCMD_NONE) || (doITStyleMix && origModCmd.note == NOTE_NONE && origModCmd.instr == 0 && origModCmd.volcmd == VOLCMD_NONE)))) { + firstCol = std::min(firstCol, PatternCursor::volumeColumn); + lastCol = std::max(lastCol, PatternCursor::volumeColumn); if(data[pos + 5] != '.') { if(m.IsPcNote()) @@ -651,6 +659,8 @@ { if(data[pos + 8] != '.' && data[pos + 8] > ' ') { + firstCol = std::min(firstCol, PatternCursor::paramColumn); + lastCol = std::max(lastCol, PatternCursor::paramColumn); m.SetValueEffectCol(ConvertStrTo<uint16>(data.Mid(pos + 8, 3))); } } else @@ -658,6 +668,8 @@ if(data[pos + 8] > ' ' && (!doMixPaste || ((!doITStyleMix && origModCmd.command == CMD_NONE) || (doITStyleMix && origModCmd.command == CMD_NONE && origModCmd.param == 0)))) { + firstCol = std::min(firstCol, PatternCursor::effectColumn); + lastCol = std::max(lastCol, PatternCursor::effectColumn); m.command = CMD_NONE; if(data[pos + 8] != '.') { @@ -677,6 +689,8 @@ if(data[pos + 9] > ' ' && (!doMixPaste || ((!doITStyleMix && (origModCmd.command == CMD_NONE || origModCmd.param == 0)) || (doITStyleMix && origModCmd.command == CMD_NONE && origModCmd.param == 0)))) { + firstCol = std::min(firstCol, PatternCursor::paramColumn); + lastCol = std::max(lastCol, PatternCursor::paramColumn); m.param = 0; if(data[pos + 9] != '.') { @@ -741,8 +755,13 @@ // if the original modcommand was empty as otherwise the unchanged parts // of the old modcommand would falsely be interpreted being of type // origFormat and ConvertCommand could change them. - if (pasteFormat != sndFile.GetType() && (!doMixPaste || origModCmd.IsEmpty(false))) + if(pasteFormat != sndFile.GetType() && (!doMixPaste || origModCmd.IsEmpty(false))) m.Convert(pasteFormat, sndFile.GetType()); + + // Adjust pattern selection + if(col == startChan) startPoint.SetColumn(startChan, firstCol); + if(endPoint.CompareColumn(PatternCursor(0, col, lastCol)) < 0) endPoint.SetColumn(col, lastCol); + if(curRow > endPoint.GetRow()) endPoint.SetRow(curRow); } pos += 11; @@ -769,9 +788,9 @@ startRow = 0; } } - } + pasteRect = PatternRect(startPoint, endPoint); return success; } Modified: trunk/OpenMPT/mptrack/PatternClipboard.h =================================================================== --- trunk/OpenMPT/mptrack/PatternClipboard.h 2014-05-03 14:39:50 UTC (rev 4032) +++ trunk/OpenMPT/mptrack/PatternClipboard.h 2014-05-03 14:42:30 UTC (rev 4033) @@ -69,9 +69,9 @@ // Copy a pattern selection to both the system clipboard and the internal clipboard. static bool Copy(CSoundFile &sndFile, PATTERNINDEX pattern, PatternRect selection); // Try pasting a pattern selection from the system clipboard. - static bool Paste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, ORDERINDEX curOrder); + static bool Paste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, ORDERINDEX curOrder, PatternRect &pasteRect); // Try pasting a pattern selection from an internal clipboard. - static bool Paste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, ORDERINDEX curOrder, clipindex_t internalClipboard); + static bool Paste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, ORDERINDEX curOrder, PatternRect &pasteRect, clipindex_t internalClipboard); // Copy one of the internal clipboards to the system clipboard. static bool SelectClipboard(clipindex_t which); // Switch to the next internal clipboard. @@ -95,7 +95,7 @@ static CString CreateClipboardString(CSoundFile &sndFile, PATTERNINDEX pattern, PatternRect selection); // Parse clipboard string and perform the pasting operation. - static bool HandlePaste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, const CString &data, ORDERINDEX curOrder); + static bool HandlePaste(CSoundFile &sndFile, ModCommandPos &pastePos, PasteModes mode, const CString &data, ORDERINDEX curOrder, PatternRect &pasteRect); // System-specific clipboard functions static bool ToSystemClipboard(const PatternClipboardElement &clipboard) { return ToSystemClipboard(clipboard.content); }; Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2014-05-03 14:39:50 UTC (rev 4032) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2014-05-03 14:42:30 UTC (rev 4033) @@ -6837,7 +6837,8 @@ pos.row = pastePos.GetRow(); pos.channel = pastePos.GetChannel(); ORDERINDEX curOrder = GetCurrentOrder(); - bool result = PatternClipboard::Paste(*GetSoundFile(), pos, mode, curOrder); + PatternRect rect; + bool result = PatternClipboard::Paste(*GetSoundFile(), pos, mode, curOrder, rect); EndWaitCursor(); if(pos.pattern != nPattern) @@ -6850,6 +6851,7 @@ if(result) { + SetCurSel(rect); GetDocument()->SetModified(); GetDocument()->UpdateAllViews(NULL, HINT_MODSEQUENCE | HINT_PATTERNDATA | (pos.pattern << HINT_SHIFT_PAT), nullptr); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-05-04 20:41:02
|
Revision: 4038 http://sourceforge.net/p/modplug/code/4038 Author: saga-games Date: 2014-05-04 20:40:56 +0000 (Sun, 04 May 2014) Log Message: ----------- [Mod] VST: When resetting all voices, forget about the previously chosen program (this helps with some external softsynth controlled by the MIDI I/O plugin that forget about their settings when there is no active MIDI connection) Modified Paths: -------------- trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2014-05-04 09:02:37 UTC (rev 4037) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2014-05-04 20:40:56 UTC (rev 4038) @@ -681,6 +681,7 @@ for(int ch = 0; ch < 16; ch++) { m_MidiCh[ch].midiPitchBendPos = EncodePitchBendParam(MIDIEvents::pitchBendCentre); // centre pitch bend on all channels + m_MidiCh[ch].ResetProgram(); } // Update Mix structure @@ -861,7 +862,7 @@ m_pPrev = nullptr; m_pNext = nullptr; - CVstPlugin::Dispatch(effClose, 0, 0, nullptr, 0); + Dispatch(effClose, 0, 0, nullptr, 0); if(m_hLibrary) { FreeLibrary(m_hLibrary); @@ -1737,6 +1738,7 @@ for(uint8 mc = 0; mc < CountOf(m_MidiCh); mc++) //all midi chans { VSTInstrChannel &channel = m_MidiCh[mc]; + channel.ResetProgram(); MidiPitchBend(mc, EncodePitchBendParam(MIDIEvents::pitchBendCentre)); // centre pitch bend if(GetUID() != CCONST('K', 'L', 'W', 'V')) Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2014-05-04 09:02:37 UTC (rev 4037) +++ trunk/OpenMPT/mptrack/Vstplug.h 2014-05-04 20:40:56 UTC (rev 4038) @@ -151,6 +151,8 @@ uint16 currentProgram; uint16 currentBank; uint8 noteOnMap[128][MAX_CHANNELS]; + + void ResetProgram() { currentProgram = uint16(-1); currentBank = uint16(-1); } }; CVstPlugin *m_pNext, *m_pPrev; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-05-08 21:40:21
|
Revision: 4044 http://sourceforge.net/p/modplug/code/4044 Author: saga-games Date: 2014-05-08 21:40:14 +0000 (Thu, 08 May 2014) Log Message: ----------- [Fix] Tentatively fix broken transparency on icons on some (rare?) systems (http://bugs.openmpt.org/view.php?id=520) Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/PNG.cpp trunk/OpenMPT/mptrack/PNG.h Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-05-08 12:55:04 UTC (rev 4043) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-05-08 21:40:14 UTC (rev 4044) @@ -1292,7 +1292,7 @@ BOOL CSplashScreen::OnInitDialog() //-------------------------------- { - bitmap->ToDIB(m_Bitmap, GetDC()); + bitmap->ToDIB(m_Bitmap); CRect rect; int cx, cy, newcx, newcy; Modified: trunk/OpenMPT/mptrack/PNG.cpp =================================================================== --- trunk/OpenMPT/mptrack/PNG.cpp 2014-05-08 12:55:04 UTC (rev 4043) +++ trunk/OpenMPT/mptrack/PNG.cpp 2014-05-08 21:40:14 UTC (rev 4044) @@ -177,23 +177,3 @@ FileReader file(pData, nSize); return ReadPNG(file); } - - -// Create a DIB for the current device from our PNG. -bool PNG::Bitmap::ToDIB(CBitmap &bitmap, CDC *dc) const -//----------------------------------------------------- -{ - BITMAPINFOHEADER bi; - MemsetZero(bi); - bi.biSize = sizeof(BITMAPINFOHEADER); - bi.biWidth = width; - bi.biHeight = -(int32_t)height; - bi.biPlanes = 1; - bi.biBitCount = 32; - bi.biCompression = BI_RGB; - bi.biSizeImage = width * height * 4; - - if(dc == nullptr) dc = CDC::FromHandle(GetDC(NULL)); - return bitmap.CreateCompatibleBitmap(dc, width, height) - && SetDIBits(dc->GetSafeHdc(), bitmap, 0, height, GetPixels(), reinterpret_cast<BITMAPINFO *>(&bi), DIB_RGB_COLORS); -}; Modified: trunk/OpenMPT/mptrack/PNG.h =================================================================== --- trunk/OpenMPT/mptrack/PNG.h 2014-05-08 12:55:04 UTC (rev 4043) +++ trunk/OpenMPT/mptrack/PNG.h 2014-05-08 21:40:14 UTC (rev 4044) @@ -32,8 +32,8 @@ const Pixel *GetPixels() const { ASSERT(width && height && pixels); return pixels; } uint32_t GetNumPixels() const { return width * height; } - // Create a DIB for the current device from our PNG. - bool ToDIB(CBitmap &bitmap, CDC *dc = nullptr) const; + // Create a DIB from our PNG. + bool ToDIB(CBitmap &bitmap) const { return bitmap.CreateBitmap(width, height, 1, 32, GetPixels()) != FALSE; } }; Bitmap *ReadPNG(FileReader &file); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sag...@us...> - 2014-05-16 20:15:19
|
Revision: 4052 http://sourceforge.net/p/modplug/code/4052 Author: saga-games Date: 2014-05-16 20:15:12 +0000 (Fri, 16 May 2014) Log Message: ----------- [New] Pattern tab: Added possibility to interpolate instrument column. [Fix] Find MPT hacks identified FT2 pan law mix mode as a hack (http://bugs.openmpt.org/view.php?id=531). Modified Paths: -------------- trunk/OpenMPT/mptrack/CommandSet.cpp trunk/OpenMPT/mptrack/CommandSet.h trunk/OpenMPT/mptrack/MPTHacks.cpp trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/resource.h Modified: trunk/OpenMPT/mptrack/CommandSet.cpp =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.cpp 2014-05-14 09:43:38 UTC (rev 4051) +++ trunk/OpenMPT/mptrack/CommandSet.cpp 2014-05-16 20:15:12 UTC (rev 4052) @@ -661,6 +661,7 @@ DefineKeyCommand(kcSampleTransposeDown, 1908, _T("Transpose -1")); DefineKeyCommand(kcSampleTransposeOctUp, 1909, _T("Transpose +12")); DefineKeyCommand(kcSampleTransposeOctDown, 1910, _T("Transpose -12")); + DefineKeyCommand(kcPatternInterpolateInstr, 1911, _T("Interpolate Instrument")); // Add new key commands here. Modified: trunk/OpenMPT/mptrack/CommandSet.h =================================================================== --- trunk/OpenMPT/mptrack/CommandSet.h 2014-05-14 09:43:38 UTC (rev 4051) +++ trunk/OpenMPT/mptrack/CommandSet.h 2014-05-16 20:15:12 UTC (rev 4052) @@ -296,6 +296,7 @@ kcEndTranspose = kcDataEntryDownCoarse, kcPatternAmplify, kcPatternInterpolateNote, + kcPatternInterpolateInstr, kcPatternInterpolateVol, kcPatternInterpolateEffect, kcPatternVisualizeEffect, Modified: trunk/OpenMPT/mptrack/MPTHacks.cpp =================================================================== --- trunk/OpenMPT/mptrack/MPTHacks.cpp 2014-05-14 09:43:38 UTC (rev 4051) +++ trunk/OpenMPT/mptrack/MPTHacks.cpp 2014-05-16 20:15:12 UTC (rev 4052) @@ -463,12 +463,12 @@ } } - if(m_SndFile.GetMixLevels() != mixLevels_compatible) + if(m_SndFile.GetMixLevels() != mixLevels_compatible && m_SndFile.GetMixLevels() != mixLevels_compatible_FT2) { AddToLog("Found incorrect mix levels (only compatible mix levels allowed)"); foundHacks = true; if(autofix) - m_SndFile.SetMixLevels(mixLevels_compatible); + m_SndFile.SetMixLevels(m_SndFile.GetType() == MOD_TYPE_XM ? mixLevels_compatible_FT2 : mixLevels_compatible); } if(autofix && foundHacks) Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2014-05-14 09:43:38 UTC (rev 4051) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2014-05-16 20:15:12 UTC (rev 4052) @@ -113,6 +113,7 @@ ON_COMMAND(ID_PATTERN_INTERPOLATE_VOLUME, OnInterpolateVolume) ON_COMMAND(ID_PATTERN_INTERPOLATE_EFFECT, OnInterpolateEffect) ON_COMMAND(ID_PATTERN_INTERPOLATE_NOTE, OnInterpolateNote) + ON_COMMAND(ID_PATTERN_INTERPOLATE_INSTR, OnInterpolateInstr) ON_COMMAND(ID_PATTERN_VISUALIZE_EFFECT, OnVisualizeEffect) //rewbs.fxvis ON_COMMAND(ID_GROW_SELECTION, OnGrowSelection) ON_COMMAND(ID_SHRINK_SELECTION, OnShrinkSelection) @@ -2731,6 +2732,20 @@ } break; + case PatternCursor::instrColumn: + vsrc = srcCmd.instr; + vdest = destCmd.instr; + verr = (distance * 63) / 128; + if(srcCmd.instr == 0) + { + vsrc = vdest; + vcmd = destCmd.instr; + } else if(destCmd.instr == 0) + { + vdest = vsrc; + } + break; + case PatternCursor::volumeColumn: vsrc = srcCmd.vol; vdest = destCmd.vol; @@ -2794,16 +2809,24 @@ if ((pcmd->note == NOTE_NONE) || (pcmd->instr == vcmd)) { int note = vsrc + ((vdest - vsrc) * i + verr) / distance; - pcmd->note = (BYTE)note; + pcmd->note = (ModCommand::NOTE)note; pcmd->instr = vcmd; } break; + case PatternCursor::instrColumn: + if (pcmd->instr == 0) + { + int instr = vsrc + ((vdest - vsrc) * i + verr) / distance; + pcmd->instr = (ModCommand::INSTR)instr; + } + break; + case PatternCursor::volumeColumn: if ((pcmd->volcmd == VOLCMD_NONE) || (pcmd->volcmd == vcmd)) { int vol = vsrc + ((vdest - vsrc) * i + verr) / distance; - pcmd->vol = (BYTE)vol; + pcmd->vol = (ModCommand::VOL)vol; pcmd->volcmd = vcmd; } break; @@ -2826,7 +2849,7 @@ if ((pcmd->command == CMD_NONE) || (pcmd->command == vcmd)) { int val = vsrc + ((vdest - vsrc) * i + verr) / distance; - pcmd->param = (BYTE)val; + pcmd->param = (ModCommand::PARAM)val; pcmd->command = vcmd; } } @@ -4231,6 +4254,7 @@ case kcPatternAmplify: OnPatternAmplify(); return wParam; case kcPatternSetInstrument: OnSetSelInstrument(); return wParam; case kcPatternInterpolateNote: OnInterpolateNote(); return wParam; + case kcPatternInterpolateInstr: OnInterpolateInstr(); return wParam; case kcPatternInterpolateVol: OnInterpolateVolume(); return wParam; case kcPatternInterpolateEffect: OnInterpolateEffect(); return wParam; case kcPatternVisualizeEffect: OnVisualizeEffect(); return wParam; @@ -6107,6 +6131,7 @@ HMENU subMenu = CreatePopupMenu(); bool possible = BuildInterpolationCtxMenu(subMenu, PatternCursor::noteColumn, CString("Note Column\t") + ih->GetKeyTextFromCommand(kcPatternInterpolateNote), ID_PATTERN_INTERPOLATE_NOTE) + | BuildInterpolationCtxMenu(subMenu, PatternCursor::instrColumn, (isPCNote ? CString("Plugin Column\t") : CString("Instrument Column\t")) + ih->GetKeyTextFromCommand(kcPatternInterpolateInstr), ID_PATTERN_INTERPOLATE_INSTR) | BuildInterpolationCtxMenu(subMenu, PatternCursor::volumeColumn, (isPCNote ? CString("Parameter Column\t") : CString("Volume Column\t")) + ih->GetKeyTextFromCommand(kcPatternInterpolateVol), ID_PATTERN_INTERPOLATE_VOLUME) | BuildInterpolationCtxMenu(subMenu, PatternCursor::effectColumn, (isPCNote ? CString("Value Column\t") : CString("Effect Column\t")) + ih->GetKeyTextFromCommand(kcPatternInterpolateEffect), ID_PATTERN_INTERPOLATE_EFFECT); if(possible || !(TrackerSettings::Instance().m_dwPatternSetup & PATTERN_OLDCTXMENUSTYLE)) @@ -6451,12 +6476,10 @@ || (ModCommand::IsNoteOrEmpty(startRowCmd) && ModCommand::IsNoteOrEmpty(endRowCmd) && !(startRowCmd == NOTE_NONE && endRowCmd == NOTE_NONE)); // Interpolate between two notes of which one may be empty break; - case PatternCursor::effectColumn: - startRowCmd = startRowMC.command; - endRowCmd = endRowMC.command; - result = (startRowCmd == endRowCmd && startRowCmd != CMD_NONE) // Interpolate between two identical commands - || (startRowCmd != CMD_NONE && endRowCmd == CMD_NONE) // Fill in values from the first row - || (startRowCmd == CMD_NONE && endRowCmd != CMD_NONE); // Fill in values from the last row + case PatternCursor::instrColumn: + startRowCmd = startRowMC.instr; + endRowCmd = endRowMC.instr; + result = startRowCmd != 0 || endRowCmd != 0; break; case PatternCursor::volumeColumn: @@ -6466,6 +6489,15 @@ || (startRowCmd != VOLCMD_NONE && endRowCmd == VOLCMD_NONE) // Fill in values from the first row || (startRowCmd == VOLCMD_NONE && endRowCmd != VOLCMD_NONE); // Fill in values from the last row break; + + case PatternCursor::effectColumn: + startRowCmd = startRowMC.command; + endRowCmd = endRowMC.command; + result = (startRowCmd == endRowCmd && startRowCmd != CMD_NONE) // Interpolate between two identical commands + || (startRowCmd != CMD_NONE && endRowCmd == CMD_NONE) // Fill in values from the first row + || (startRowCmd == CMD_NONE && endRowCmd != CMD_NONE); // Fill in values from the last row + break; + default: result = false; } Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2014-05-14 09:43:38 UTC (rev 4051) +++ trunk/OpenMPT/mptrack/View_pat.h 2014-05-16 20:15:12 UTC (rev 4052) @@ -402,6 +402,7 @@ afx_msg void OnInterpolateVolume() { Interpolate(PatternCursor::volumeColumn); } afx_msg void OnInterpolateEffect() { Interpolate(PatternCursor::effectColumn); } afx_msg void OnInterpolateNote() { Interpolate(PatternCursor::noteColumn); } + afx_msg void OnInterpolateInstr() { Interpolate(PatternCursor::instrColumn); } afx_msg void OnVisualizeEffect(); //rewbs.fxvis afx_msg void OnTransposeUp() { TransposeSelection(1); } afx_msg void OnTransposeDown() { TransposeSelection(-1); } Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2014-05-14 09:43:38 UTC (rev 4051) +++ trunk/OpenMPT/mptrack/resource.h 2014-05-16 20:15:12 UTC (rev 4052) @@ -1093,6 +1093,7 @@ #define ID_PATTERN_OPEN_RANDOMIZER 32905 #define ID_PATTERN_INTERPOLATE_NOTE 32906 #define ID_PATTERN_CHNRESET 32907 +#define ID_PATTERN_INTERPOLATE_INSTR 32908 #define ID_PRESET_LOAD 32915 #define ID_PRESET_SAVE 32916 #define ID_PRESET_RANDOM 32917 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |