From: <sag...@us...> - 2014-01-05 17:18:13
|
Revision: 3564 http://sourceforge.net/p/modplug/code/3564 Author: saga-games Date: 2014-01-05 17:18:06 +0000 (Sun, 05 Jan 2014) Log Message: ----------- [Mod] Tree view: Don't rely on current directory being set to the module directory when intializing tree view (so that current directory doesn't have to be set in the main code anymore) - as a consequence, set the default current directory to the executable's directory. [Fix] Tree view: Deleting samples / instruments from the treeview didn't update the tree view properly if more than one sample / instrument was removed (this could happen when deleting the last empty sample / instr and there were more empty slots before that) [Imp] Tree view: Shift+Del in instrument browser = delete file permanently (like in Windows Explorer) [Mod] OpenMPT: Version is now 1.22.07.12 Modified Paths: -------------- trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/TrackerSettings.cpp trunk/OpenMPT/mptrack/View_tre.cpp Modified: trunk/OpenMPT/common/versionNumber.h =================================================================== --- trunk/OpenMPT/common/versionNumber.h 2014-01-05 17:11:53 UTC (rev 3563) +++ trunk/OpenMPT/common/versionNumber.h 2014-01-05 17:18:06 UTC (rev 3564) @@ -17,7 +17,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 22 #define VER_MINOR 07 -#define VER_MINORMINOR 11 +#define VER_MINORMINOR 12 //Version string. For example "1.17.02.28" #define MPT_VERSION_STR VER_STRINGIZE(VER_MAJORMAJOR) "." VER_STRINGIZE(VER_MAJOR) "." VER_STRINGIZE(VER_MINOR) "." VER_STRINGIZE(VER_MINORMINOR) Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2014-01-05 17:11:53 UTC (rev 3563) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2014-01-05 17:18:06 UTC (rev 3564) @@ -698,6 +698,7 @@ WCHAR wcsDir[MAX_PATH]; GetFullPathNameW(m_szExePath.AsNative().c_str(), CountOf(wcsDir), wcsDir, NULL); m_szExePath = mpt::PathString::FromNative(wcsDir); + SetCurrentDirectoryW(wcsDir); } m_szConfigDirectory = mpt::PathString(); Modified: trunk/OpenMPT/mptrack/TrackerSettings.cpp =================================================================== --- trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-01-05 17:11:53 UTC (rev 3563) +++ trunk/OpenMPT/mptrack/TrackerSettings.cpp 2014-01-05 17:18:06 UTC (rev 3564) @@ -494,10 +494,6 @@ { TrackerDirectories::Instance().m_szWorkingDirectory[i] = TrackerDirectories::Instance().m_szDefaultDirectory[i]; } - if(!TrackerDirectories::Instance().m_szDefaultDirectory[DIR_MODS].empty()) - { - SetCurrentDirectoryW(TrackerDirectories::Instance().m_szDefaultDirectory[DIR_MODS].AsNative().c_str()); - } m_szKbdFile = theApp.RelativePathToAbsolute(m_szKbdFile); // Last fixup: update config version Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2014-01-05 17:11:53 UTC (rev 3563) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2014-01-05 17:18:06 UTC (rev 3564) @@ -194,12 +194,15 @@ if(!IsSampleBrowser()) { - m_InstrLibPath = TrackerDirectories::Instance().GetDefaultDirectory(DIR_SAMPLES); - if(m_InstrLibPath.empty()) + const Directory dirs[] = { DIR_SAMPLES, DIR_INSTRUMENTS, DIR_MODS }; + for(int i = 0; i < CountOf(dirs); i++) { - m_InstrLibPath = TrackerDirectories::Instance().GetDefaultDirectory(DIR_INSTRUMENTS); - if(m_InstrLibPath.empty()) + m_InstrLibPath = TrackerDirectories::Instance().GetDefaultDirectory(dirs[i]); + if(!m_InstrLibPath.empty()) { + break; + } else if(i == CountOf(dirs) - 1) + { // Resort to current directory. WCHAR curDir[MAX_PATH]; GetCurrentDirectoryW(CountOf(curDir), curDir); @@ -1464,19 +1467,26 @@ case MODITEM_SAMPLE: wsprintf(s, _T("Remove sample %u?"), modItemID); - if(Reporting::Confirm(s, false, true) == cnfNo) break; - modDoc->GetSampleUndo().PrepareUndo((SAMPLEINDEX)modItemID, sundo_replace); - if (modDoc->RemoveSample((SAMPLEINDEX)modItemID)) + if(Reporting::Confirm(s, false, true) == cnfYes) { - modDoc->UpdateAllViews(NULL, (UINT(modItemID) << HINT_SHIFT_SMP) | HINT_SMPNAMES|HINT_SAMPLEDATA|HINT_SAMPLEINFO); + modDoc->GetSampleUndo().PrepareUndo((SAMPLEINDEX)modItemID, sundo_replace); + const SAMPLEINDEX oldNumSamples = modDoc->GetNumSamples(); + if (modDoc->RemoveSample((SAMPLEINDEX)modItemID)) + { + modDoc->UpdateAllViews(NULL, (modDoc->GetNumSamples() != oldNumSamples ? 0 : (UINT(modItemID) << HINT_SHIFT_SMP)) | HINT_SMPNAMES|HINT_SAMPLEDATA|HINT_SAMPLEINFO); + } } break; case MODITEM_INSTRUMENT: wsprintf(s, _T("Remove instrument %u?"), modItemID); - if(Reporting::Confirm(s, false, true) == cnfYes && modDoc->RemoveInstrument((INSTRUMENTINDEX)modItemID)) + if(Reporting::Confirm(s, false, true) == cnfYes) { - modDoc->UpdateAllViews(NULL, (UINT(modItemID) << HINT_SHIFT_INS) | HINT_MODTYPE|HINT_ENVELOPE|HINT_INSTRUMENT); + const INSTRUMENTINDEX oldNumInstrs = modDoc->GetNumInstruments(); + if(modDoc->RemoveInstrument((INSTRUMENTINDEX)modItemID)) + { + modDoc->UpdateAllViews(NULL, (modDoc->GetNumInstruments() != oldNumInstrs ? 0 : (UINT(modItemID) << HINT_SHIFT_INS)) | HINT_MODTYPE|HINT_ENVELOPE|HINT_INSTRUMENT); + } } break; @@ -1505,7 +1515,7 @@ fos.hwnd = m_hWnd; fos.wFunc = FO_DELETE; fos.pFrom = fullPath.c_str(); - fos.fFlags = FOF_ALLOWUNDO; + fos.fFlags = CMainFrame::GetInputHandler()->ShiftPressed() ? 0 : FOF_ALLOWUNDO; if ((0 == SHFileOperationW(&fos)) && (!fos.fAnyOperationsAborted)) RefreshInstrumentLibrary(); } break; @@ -3391,6 +3401,7 @@ // Gets the root parent of an item, i.e. if C is a child of B and B is a child of A, GetParentRootItem(C) returns A. +// A root item is considered to be its own parent, i.e. the returned value is only ever NULL if the input value was NULL. HTREEITEM CModTree::GetParentRootItem(HTREEITEM hItem) //---------------------------------------------------- { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |