From: <sag...@us...> - 2015-05-24 01:12:54
|
Revision: 5151 http://sourceforge.net/p/modplug/code/5151 Author: saga-games Date: 2015-05-24 01:12:47 +0000 (Sun, 24 May 2015) Log Message: ----------- [Mod] Tuning dialog: Remove unnecessary clutter which was mostly there for debugging purposes [Imp] Tuning dialog: Mouse wheel can now be used to scroll the tuning note map. Modified Paths: -------------- trunk/OpenMPT/mptrack/TuningDialog.cpp trunk/OpenMPT/mptrack/TuningDialog.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp trunk/OpenMPT/mptrack/tuningRatioMapWnd.h Modified: trunk/OpenMPT/mptrack/TuningDialog.cpp =================================================================== --- trunk/OpenMPT/mptrack/TuningDialog.cpp 2015-05-24 00:41:16 UTC (rev 5150) +++ trunk/OpenMPT/mptrack/TuningDialog.cpp 2015-05-24 01:12:47 UTC (rev 5151) @@ -117,10 +117,10 @@ HTREEITEM nextitem = m_TreeCtrlTuning.GetNextItem(temp, TVGN_NEXT); if(!nextitem) nextitem = m_TreeCtrlTuning.GetNextItem(temp, TVGN_PREVIOUS); m_pActiveTuning = m_TreeItemTuningItemMap.GetMapping_12(nextitem).GetT(); - m_TreeCtrlTuning.DeleteItem(temp); - //Note: Item from map is deleted 'automatically' in + m_TreeCtrlTuning.DeleteItem(temp); + //Note: Item from map is deleted 'automatically' in //OnTvnDeleteitemTreeTuning. - + } } @@ -143,7 +143,7 @@ pTCnext = GetpTuningCollection(nextTTI.GetT()); if(pTCprev == NULL) pTCprev = GetpTuningCollection(prevTTI.GetT()); - + if(pTCnext != NULL && pTCnext != m_pActiveTuningCollection) m_pActiveTuningCollection = pTCnext; else @@ -153,9 +153,9 @@ else m_pActiveTuningCollection = NULL; } - + m_TreeCtrlTuning.DeleteItem(temp); - //Note: Item from map is deleted 'automatically' in + //Note: Item from map is deleted 'automatically' in //OnTvnDeleteitemTreeTuning. } else @@ -192,11 +192,6 @@ m_ButtonSet.EnableWindow(FALSE); - //#ifdef DEBUG - m_EditTuningCollectionVersion.ShowWindow(SW_SHOW); - m_EditTuningCollectionEditMask.ShowWindow(SW_SHOW); - //#endif - m_EditSteps.SetLimitText(2); m_EditFineTuneSteps.SetLimitText(3); @@ -217,7 +212,7 @@ return; } - //-->Updating treeview + //-->Updating treeview if(updateMask != UM_TUNINGDATA) { TUNINGTREEITEM tuningitem; @@ -236,11 +231,11 @@ m_TreeCtrlTuning.SetItemText(treeitem, m_pActiveTuning->GetName().c_str()); else m_TreeCtrlTuning.SetItemText(treeitem, m_pActiveTuningCollection->GetName().c_str()); - } + } } //<--Updating treeview - + if(m_pActiveTuningCollection == NULL) { return; @@ -250,9 +245,9 @@ if(updateMask == 0 || updateMask & UM_TUNINGCOLLECTION) { m_EditTuningCollectionName.SetWindowText(m_pActiveTuningCollection->GetName().c_str()); - m_EditTuningCollectionVersion.SetWindowText(m_pActiveTuningCollection->GetVersionString().c_str()); - m_EditTuningCollectionEditMask.SetWindowText(m_pActiveTuningCollection->GetEditMaskString().c_str()); - m_EditTuningCollectionItemNum.SetWindowText(mpt::ToString(m_pActiveTuningCollection->GetNumTunings()).c_str()); + //m_EditTuningCollectionVersion.SetWindowText(m_pActiveTuningCollection->GetVersionString().c_str()); + //m_EditTuningCollectionEditMask.SetWindowText(m_pActiveTuningCollection->GetEditMaskString().c_str()); + //m_EditTuningCollectionItemNum.SetWindowText(mpt::ToString(m_pActiveTuningCollection->GetNumTunings()).c_str()); ::SetWindowTextW(m_EditTuningCollectionPath.m_hWnd, m_pActiveTuningCollection->GetSaveFilePath().ToWide().c_str()); } //<-- Updating tuning collection part @@ -323,14 +318,14 @@ m_EditMiscActions.SetReadOnly(!enableControls); m_EditFineTuneSteps.SetReadOnly(!enableControls); m_EditName.SetReadOnly(!enableControls); - + m_ButtonSet.EnableWindow(enableControls); m_CombobTuningType.Invalidate(); m_EditSteps.Invalidate(); m_EditRatioPeriod.Invalidate(); } - else + else { if(m_pActiveTuning == NULL) //No active tuning, clearing tuning part. { @@ -377,9 +372,6 @@ DDX_Control(pDX, IDC_EDIT_NAME, m_EditName); DDX_Control(pDX, IDC_TREE_TUNING, m_TreeCtrlTuning); DDX_Control(pDX, IDC_EDIT_TUNINGCOLLECTION_NAME, m_EditTuningCollectionName); - DDX_Control(pDX, IDC_EDIT_TUNINGC_VERSION, m_EditTuningCollectionVersion); - DDX_Control(pDX, IDC_EDIT_TUNINGC_EDITMASK, m_EditTuningCollectionEditMask); - DDX_Control(pDX, IDC_EDIT_TUNINGNUM, m_EditTuningCollectionItemNum); DDX_Control(pDX, IDC_EDIT_TUNINGCOLLECTION_PATH, m_EditTuningCollectionPath); } @@ -488,7 +480,7 @@ else if(newType == TT_GEOMETRIC) m_pActiveTuning->CreateGeometric(steps, pr); - + UpdateView(UM_TUNINGDATA); } else //Not wanting to discard current values. @@ -500,7 +492,7 @@ { if(oldType == TT_GROUPGEOMETRIC) m_CombobTuningType.SetCurSel(1); - else + else m_CombobTuningType.SetCurSel(0); } } @@ -524,7 +516,7 @@ void CTuningDialog::OnEnChangeEditNotename() //------------------------------------------ { - + if(!m_NoteEditApply) { m_NoteEditApply = true; @@ -550,13 +542,13 @@ m_ModifiedTCs[GetpTuningCollection(m_pActiveTuning)] = true; m_RatioMapWnd.Invalidate(); - + } void CTuningDialog::OnEnChangeEditRatiovalue() //-------------------------------------------- { - + if(!m_RatioEditApply) { m_RatioEditApply = true; @@ -579,7 +571,7 @@ UpdateTuningType(); m_RatioMapWnd.Invalidate(); } - + } void CTuningDialog::OnBnClickedButtonSetvalues() @@ -619,7 +611,7 @@ void CTuningDialog::OnBnClickedButtonExport() //------------------------------------------- -{ +{ const CTuning* pT = m_pActiveTuning; const CTuningCollection* pTC = m_pActiveTuningCollection; @@ -628,7 +620,7 @@ MsgBox(IDS_ERR_NO_TUNING_SELECTION, this, NULL, MB_ICONINFORMATION); return; } - + std::string filter; if(pT != NULL) filter = std::string("Tuning files (*") + CTuning::s_FileExtension + std::string(")|*") + CTuning::s_FileExtension + std::string("|"); @@ -646,7 +638,7 @@ BeginWaitCursor(); bool failure = true; - + mpt::ofstream fout(dlg.GetFirstFile(), std::ios::binary); if(filterIndex == 0) @@ -662,7 +654,7 @@ fout.close(); EndWaitCursor(); - + if(failure) ErrorBox(IDS_ERR_EXPORT_TUNING, this); } @@ -699,7 +691,7 @@ const bool bIsTun = (mpt::PathString::CompareNoCase(fileExt, mpt::PathString::FromUTF8(CTuning::s_FileExtension)) == 0); const bool bIsScl = (mpt::PathString::CompareNoCase(fileExt, MPT_PATHSTRING(".scl")) == 0); - + if (bIsTun || bIsScl) { CTuning* pT = nullptr; @@ -746,7 +738,7 @@ else // scl import successful. pT = &m_TempTunings.GetTuning(m_TempTunings.GetNumTunings() - 1); } - + if (pT) { m_pActiveTuning = pT; @@ -755,15 +747,15 @@ } else if(mpt::PathString::CompareNoCase(fileExt, mpt::PathString::FromUTF8(CTuningCollection::s_FileExtension)) == 0) { - // For now only loading tuning collection as - // a separate collection - no possibility to + // For now only loading tuning collection as + // a separate collection - no possibility to // directly replace some collection. CTuningCollection* pNewTCol = new CTuningCollection; pNewTCol->SetSavefilePath(files[counter]); if (pNewTCol->Deserialize()) { delete pNewTCol; pNewTCol = 0; - sLoadReport += L"-Unable to import tuning collection \"" + fileNameExt + L"\": unrecognized file.\n"; + sLoadReport += L"-Unable to import tuning collection \"" + fileNameExt + L"\": unrecognized file.\n"; } else { @@ -774,7 +766,7 @@ } else // Case: Unknown extension (should not happen). { - sLoadReport += L"-Unable to load \"" + fileNameExt + L"\": unrecognized file extension.\n"; + sLoadReport += L"-Unable to load \"" + fileNameExt + L"\": unrecognized file extension.\n"; } } if(sLoadReport.length() > 0) @@ -855,7 +847,7 @@ m_pActiveTuning->ChangeGroupsize(ConvertStrTo<UNOTEINDEXTYPE>(buffer)); m_ModifiedTCs[GetpTuningCollection(m_pActiveTuning)] = true; UpdateView(UM_TUNINGDATA); - } + } } @@ -894,7 +886,7 @@ return (*iter).second; else return false; - + } CTuningCollection* CTuningDialog::GetpTuningCollection(HTREEITEM ti) const @@ -944,7 +936,7 @@ LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR); TUNINGTREEITEM ti = m_TreeItemTuningItemMap.GetMapping_12(pNMTreeView->itemNew.hItem); - + if(ti) { int updateMask = UM_TUNINGDATA; @@ -961,7 +953,7 @@ { m_pActiveTuning = pT; m_pActiveTuningCollection = GetpTuningCollection(m_pActiveTuning); - + } if(m_pActiveTuningCollection != pPrevTuningCollection) updateMask |= UM_TUNINGCOLLECTION; UpdateView(updateMask); @@ -1064,7 +1056,7 @@ std::vector<CTuningCollection*>::const_iterator iter = find(m_DeletableTuningCollections.begin(), m_DeletableTuningCollections.end(), pTC); if(iter != m_DeletableTuningCollections.end()) return true; - else + else return false; } @@ -1108,7 +1100,7 @@ CTuningCollection* pTCdest = NULL; CTuningCollection* pTCsrc = m_CommandItemSrc.GetTC(); - + if(pTCsrc == NULL) pTCsrc = GetpTuningCollection(m_CommandItemSrc.GetT()); @@ -1124,9 +1116,9 @@ pTCdest = destTunItem.GetTC(); //For now, ignoring drags within a tuning collection. - if(pTCdest == pTCsrc) + if(pTCdest == pTCsrc) return; - + if(pTCdest) { UINT mask = MF_STRING; @@ -1238,7 +1230,7 @@ m_CommandItemDest = s_notFoundItemTuning; return; } - + CTuningCollection* pTCdest = NULL; if(m_CommandItemDest.GetT()) pTCdest = GetpTuningCollection(m_CommandItemDest.GetT()); @@ -1270,7 +1262,7 @@ if(!pTC) return; - + m_CommandItemDest = s_notFoundItemTuning; CTuning* pT = m_CommandItemSrc.GetT(); @@ -1307,7 +1299,7 @@ m_TuningCollections.erase(iter); DeleteTreeItem(m_pActiveTuningCollection); delete deletableTC; deletableTC = 0; - + UpdateView(); } @@ -1386,8 +1378,8 @@ HTREEITEM hItem; hItem = HitTest(point, NULL); m_rParentDialog.OnEndDrag(hItem); - - CTreeCtrl::OnLButtonUp(nFlags, point); + + CTreeCtrl::OnLButtonUp(nFlags, point); } } @@ -1404,25 +1396,25 @@ //---------------------------------------------------------- { CString sMsg; - switch(id) - { - case enSclImportFailTooManyNotes: + switch(id) + { + case enSclImportFailTooManyNotes: AfxFormatString1(sMsg, IDS_SCL_IMPORT_FAIL_8, mpt::ToString(s_nSclImportMaxNoteCount).c_str()); return sMsg; - - case enSclImportFailTooLargeNumDenomIntegers: + + case enSclImportFailTooLargeNumDenomIntegers: sMsg.LoadString(IDS_SCL_IMPORT_FAIL_1); return sMsg; - - case enSclImportFailZeroDenominator: + + case enSclImportFailZeroDenominator: sMsg.LoadString(IDS_SCL_IMPORT_FAIL_2); return sMsg; - - case enSclImportFailNegativeRatio: + + case enSclImportFailNegativeRatio: sMsg.LoadString(IDS_SCL_IMPORT_FAIL_3); return sMsg; - - case enSclImportFailUnableToOpenFile: + + case enSclImportFailUnableToOpenFile: sMsg.LoadString(IDS_SCL_IMPORT_FAIL_4); return sMsg; - - case enSclImportLineCountMismatch: + + case enSclImportLineCountMismatch: sMsg.LoadString(IDS_SCL_IMPORT_FAIL_5); return sMsg; case enSclImportTuningCreationFailure: @@ -1430,32 +1422,32 @@ case enSclImportAddTuningFailure: sMsg.LoadString(IDS_SCL_IMPORT_FAIL_7); return sMsg; - - default: - return sMsg; - } + + default: + return sMsg; + } } static void SkipCommentLines(std::istream& iStrm, std::string& str) //----------------------------------------------------------------- { - while(std::getline(iStrm, str)) - { - LPCSTR psz = str.c_str(); - for(; *psz != 0; psz++) - { - if (*psz == ' ' || *psz == '\t') - continue; - else - { - if (*psz != '!') - return; - else // Found comment line: break for loop and get another line. - break; - } - } - } + while(std::getline(iStrm, str)) + { + LPCSTR psz = str.c_str(); + for(; *psz != 0; psz++) + { + if (*psz == ' ' || *psz == '\t') + continue; + else + { + if (*psz != '!') + return; + else // Found comment line: break for loop and get another line. + break; + } + } + } } @@ -1520,12 +1512,12 @@ } if (*pNonDigit == '.') // Reading cents - { + { SclFloat fCent = ConvertStrTo<SclFloat>(psz); fRatios.push_back(static_cast<CTuningRTI::RATIOTYPE>(CentToRatio(fCent))); } else if (*pNonDigit == '/') // Reading ratios - { + { *pNonDigit = 0; // Replace '/' with null. int64 nNum = ConvertStrTo<int64>(psz); psz = pNonDigit + 1; @@ -1570,4 +1562,4 @@ } -OPENMPT_NAMESPACE_END +OPENMPT_NAMESPACE_END \ No newline at end of file Modified: trunk/OpenMPT/mptrack/TuningDialog.h =================================================================== --- trunk/OpenMPT/mptrack/TuningDialog.h 2015-05-24 00:41:16 UTC (rev 5150) +++ trunk/OpenMPT/mptrack/TuningDialog.h 2015-05-24 01:12:47 UTC (rev 5151) @@ -92,7 +92,7 @@ } private: - //Elements are collected to two arrays so that elements with the + //Elements are collected to two arrays so that elements with the //same index are mapped to each other. std::vector<T1> m_T1; std::vector<T2> m_T2; @@ -120,13 +120,13 @@ bool m_Dragging; afx_msg void OnLButtonUp(UINT nFlags, CPoint point); - DECLARE_MESSAGE_MAP() + DECLARE_MESSAGE_MAP() }; //=================== class CTuningTreeItem //=================== -{ +{ private: CTuning* m_pTuning; CTuningCollection* m_pTuningCollection; @@ -136,12 +136,12 @@ m_pTuningCollection(NULL) {} - CTuningTreeItem(CTuning* pT) : + CTuningTreeItem(CTuning* pT) : m_pTuning(pT), m_pTuningCollection(NULL) {} - CTuningTreeItem(CTuningCollection* pTC) : + CTuningTreeItem(CTuningCollection* pTC) : m_pTuning(NULL), m_pTuningCollection(pTC) {} @@ -156,8 +156,8 @@ } void Reset() {m_pTuning = NULL; m_pTuningCollection = NULL;} - + void Set(CTuning* pT) { m_pTuning = pT; @@ -176,8 +176,8 @@ //if(CTuningTreeItemInstance.m_pTuning != NULL || // CTuningTreeItemInstance.m_pTuningCollection != NULL) if(m_pTuning) - return m_pTuning; - else + return m_pTuning; + else return m_pTuningCollection; } @@ -248,19 +248,19 @@ //Returns pointer to the tuning collection where tuning given as argument //belongs to. CTuningCollection* GetpTuningCollection(const CTuning* const) const; - + //Returns the address of corresponding tuningcollection; if it points //to tuning-entry, returning the owning tuningcollection CTuningCollection* GetpTuningCollection(HTREEITEM ti) const; - + //Checks whether tuning collection can be deleted. bool IsDeletable(const CTuningCollection* const pTC) const; // Scl-file import. EnSclImport ImportScl(const mpt::PathString &filename, const mpt::ustring &name); EnSclImport ImportScl(std::istream& iStrm, const mpt::ustring &name); - + private: CTuningRatioMapWnd m_RatioMapWnd; TUNINGVECTOR m_TuningCollections; @@ -285,12 +285,9 @@ //-->Tuning collection edits CEdit m_EditTuningCollectionName; - CEdit m_EditTuningCollectionVersion; - CEdit m_EditTuningCollectionEditMask; - CEdit m_EditTuningCollectionItemNum; CEdit m_EditTuningCollectionPath; //<--Tuningcollection edits - + CButton m_ButtonSet; CButton m_ButtonExport; CButton m_ButtonImport; @@ -307,7 +304,7 @@ TUNINGTREEITEM m_CommandItemSrc; TUNINGTREEITEM m_CommandItemDest; //Commanditem is used when receiving context menu-commands, - //m_CommandItemDest is used when the command really need only + //m_CommandItemDest is used when the command really need only //one argument. typedef std::map<const CTuningCollection* const, bool> MODIFIED_MAP; @@ -324,13 +321,13 @@ static CString GetSclImportFailureMsg(EnSclImport); static const size_t s_nSclImportMaxNoteCount = 64; - //To indicate whether to apply changes made to - //those edit boxes(they are modified by certain activities + //To indicate whether to apply changes made to + //those edit boxes(they are modified by certain activities //in case which the modifications should not be applied to //tuning data. bool m_NoteEditApply; bool m_RatioEditApply; - + enum { UM_TUNINGDATA = 1, //UM <-> Update Mask @@ -344,7 +341,7 @@ //Flag to prevent multiple exit error-messages. bool m_DoErrorExit; - + void DoErrorExit(); virtual void OnOK(); @@ -356,7 +353,7 @@ afx_msg void OnMoveTuning(); afx_msg void OnCopyTuning(); afx_msg void OnRemoveTuningCollection(); - + //Event-functions public: afx_msg void OnCbnSelchangeComboTtype(); @@ -381,9 +378,9 @@ afx_msg void OnTvnSelchangedTreeTuning(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnTvnDeleteitemTreeTuning(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnNMRclickTreeTuning(NMHDR *pNMHDR, LRESULT *pResult); - afx_msg void OnTvnBegindragTreeTuning(NMHDR *pNMHDR, LRESULT *pResult); + afx_msg void OnTvnBegindragTreeTuning(NMHDR *pNMHDR, LRESULT *pResult); DECLARE_MESSAGE_MAP() }; -OPENMPT_NAMESPACE_END +OPENMPT_NAMESPACE_END \ No newline at end of file Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2015-05-24 00:41:16 UTC (rev 5150) +++ trunk/OpenMPT/mptrack/mptrack.rc 2015-05-24 01:12:47 UTC (rev 5151) @@ -2657,9 +2657,9 @@ CAPTION "Tuning Properties" FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - DEFPUSHBUTTON "Close",IDOK,456,12,48,14 - PUSHBUTTON "Import",IDC_BUTTON_IMPORT,456,30,48,14 - PUSHBUTTON "Export",IDC_BUTTON_EXPORT,456,48,48,14 + DEFPUSHBUTTON "Close",IDOK,456,10,48,14 + PUSHBUTTON "Import",IDC_BUTTON_IMPORT,456,28,48,14 + PUSHBUTTON "Export",IDC_BUTTON_EXPORT,456,46,48,14 CONTROL "",IDC_TREE_TUNING,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_SHOWSELALWAYS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,6,6,96,222 CONTROL "Read Only",IDC_CHECK_READONLY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,113,77,199,12 LTEXT "Name:",IDC_STATIC,114,96,53,11 @@ -2683,16 +2683,10 @@ CONTROL "",IDC_STATICRATIOMAP,"Static",SS_GRAYRECT | SS_NOTIFY | WS_TABSTOP,324,78,168,138,WS_EX_CLIENTEDGE GROUPBOX "Tuning Editor",IDC_STATIC,108,66,395,162 LTEXT "Name:",IDC_STATIC,114,19,35,9,SS_CENTERIMAGE - EDITTEXT IDC_EDIT_TUNINGCOLLECTION_NAME,162,18,84,12,ES_AUTOHSCROLL | ES_READONLY - LTEXT "File Path: ",IDC_STATIC,252,18,31,12,SS_CENTERIMAGE - EDITTEXT IDC_EDIT_TUNINGCOLLECTION_PATH,288,18,120,12,ES_AUTOHSCROLL | ES_READONLY - PUSHBUTTON "Save",IDC_BUTTON_TUNINGCOLLECTION_SAVE,414,18,30,12 - LTEXT "Number of tunings:",IDC_STATIC,114,36,72,11,SS_CENTERIMAGE - EDITTEXT IDC_EDIT_TUNINGNUM,186,36,60,13,ES_AUTOHSCROLL | ES_READONLY - LTEXT "Version:",IDC_STATIC,252,37,35,9,SS_CENTERIMAGE - EDITTEXT IDC_EDIT_TUNINGC_VERSION,288,36,30,13,ES_AUTOHSCROLL | ES_READONLY | NOT WS_VISIBLE - LTEXT "Edit Mask:",IDC_STATIC,324,38,35,8,SS_CENTERIMAGE - EDITTEXT IDC_EDIT_TUNINGC_EDITMASK,366,36,78,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_VISIBLE + EDITTEXT IDC_EDIT_TUNINGCOLLECTION_NAME,162,18,282,12,ES_AUTOHSCROLL | ES_READONLY + LTEXT "File Path: ",IDC_STATIC,114,36,31,12,SS_CENTERIMAGE + EDITTEXT IDC_EDIT_TUNINGCOLLECTION_PATH,162,36,240,12,ES_AUTOHSCROLL | ES_READONLY + PUSHBUTTON "Save",IDC_BUTTON_TUNINGCOLLECTION_SAVE,408,36,36,12 GROUPBOX "Tuning Collection",IDC_STATIC,108,6,342,54 END Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2015-05-24 00:41:16 UTC (rev 5150) +++ trunk/OpenMPT/mptrack/resource.h 2015-05-24 01:12:47 UTC (rev 5151) @@ -778,10 +778,6 @@ #define IDC_EDIT_MISC_ACTIONS 2284 #define IDC_BUTTON_TUNINGCOLLECTION_SAVE 2285 #define IDC_EDIT_TUNINGCOLLECTION_PATH 2286 -#define IDC_EDIT_TUNINGC_EDITMASK 2287 -#define IDC_EDIT_TUNINGNUM 2288 -#define IDC_EDIT_TUNINGC_VERSION 2289 -#define IDC_EDIT_TUNINGCVERSION 2290 #define IDC_EDIT_TUNINGCOLLECTION_NAME 2291 #define IDC_TREE_TUNING 2292 #define IDC_PATTERN_FOLLOWSONG 2293 Modified: trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp =================================================================== --- trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp 2015-05-24 00:41:16 UTC (rev 5150) +++ trunk/OpenMPT/mptrack/tuningRatioMapWnd.cpp 2015-05-24 01:12:47 UTC (rev 5151) @@ -24,6 +24,7 @@ ON_WM_SETFOCUS() ON_WM_KILLFOCUS() ON_WM_LBUTTONDOWN() + ON_WM_MOUSEWHEEL() END_MESSAGE_MAP() @@ -68,14 +69,14 @@ NOTEINDEXTYPE nPos = m_nNote - (nNotes/2); int ypaint = 0; - + for (int ynote=0; ynote<nNotes; ynote++, ypaint+=m_cyFont, nPos++) { BOOL bHighLight; // Note NOTEINDEXTYPE noteToDraw = nPos - m_nNoteCentre; s[0] = 0; - + const bool isValidNote = m_pTuning->IsValidNote(noteToDraw); std::string temp; if(isValidNote) @@ -87,8 +88,8 @@ wsprintf(s, "%s", temp.c_str()); else wsprintf(s, "%s", "..."); - + rect.SetRect(0, ypaint, m_cxFont, ypaint+m_cyFont); DrawButtonRect(hdc, &rect, s, FALSE, FALSE); // Mapped Note @@ -111,7 +112,7 @@ DrawButtonRect(hdc, &rect, "", FALSE, FALSE); if (ypaint < rcClient.bottom) { - rect.SetRect(rcClient.left, ypaint, rcClient.right, rcClient.bottom); + rect.SetRect(rcClient.left, ypaint, rcClient.right, rcClient.bottom); FillRect(hdc, &rect, CMainFrame::brushGray); } } @@ -133,16 +134,36 @@ InvalidateRect(NULL, FALSE); } + +BOOL CTuningRatioMapWnd::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt) +//------------------------------------------------------------------------- +{ + NOTEINDEXTYPE note = static_cast<NOTEINDEXTYPE>(m_nNote - sgn(zDelta)); + if(m_pTuning->IsValidNote(note - m_nNoteCentre)) + { + m_nNote = note; + InvalidateRect(NULL, FALSE); + if(m_pParent) + m_pParent->UpdateRatioMapEdits(GetShownCentre()); + } + + return CWnd::OnMouseWheel(nFlags, zDelta, pt); +} + + void CTuningRatioMapWnd::OnLButtonDown(UINT, CPoint pt) -//---------------------------------------------- +//----------------------------------------------------- { - if ((pt.x >= m_cxFont) && (pt.x < m_cxFont*2)) { + if ((pt.x >= m_cxFont) && (pt.x < m_cxFont*2)) + { InvalidateRect(NULL, FALSE); } - if ((pt.x > m_cxFont*2) && (pt.x <= m_cxFont*3)) { + if ((pt.x > m_cxFont*2) && (pt.x <= m_cxFont*3)) + { InvalidateRect(NULL, FALSE); } - if ((pt.x >= 0) && (m_cyFont)) { + if ((pt.x >= 0) && (m_cyFont)) + { CRect rcClient; GetClientRect(&rcClient); int nNotes = (rcClient.bottom + m_cyFont - 1) / m_cyFont; @@ -155,7 +176,7 @@ if(m_pParent) m_pParent->UpdateRatioMapEdits(GetShownCentre()); } - + } SetFocus(); } @@ -163,10 +184,10 @@ NOTEINDEXTYPE CTuningRatioMapWnd::GetShownCentre() const -//-------------------------------------- +//------------------------------------------------------ { return m_nNote - m_nNoteCentre; } -OPENMPT_NAMESPACE_END +OPENMPT_NAMESPACE_END \ No newline at end of file Modified: trunk/OpenMPT/mptrack/tuningRatioMapWnd.h =================================================================== --- trunk/OpenMPT/mptrack/tuningRatioMapWnd.h 2015-05-24 00:41:16 UTC (rev 5150) +++ trunk/OpenMPT/mptrack/tuningRatioMapWnd.h 2015-05-24 01:12:47 UTC (rev 5151) @@ -51,7 +51,8 @@ NOTEINDEXTYPE GetShownCentre() const; protected: - + + afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt); afx_msg void OnLButtonDown(UINT, CPoint); afx_msg void OnLButtonUp(UINT, CPoint); afx_msg void OnSetFocus(CWnd *pOldWnd); @@ -61,4 +62,4 @@ DECLARE_MESSAGE_MAP() }; -OPENMPT_NAMESPACE_END +OPENMPT_NAMESPACE_END \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |