void NameTrackLikeFirstItem(COMMAND_T* ct) { // Get the first item's take MediaItem* item = GetSelectedMediaItem(NULL, 0); if (!item || !GetMediaItemNumTakes(item)) return; MediaItem_Take* take = GetMediaItemTake(item, -1); if (!take) return; // Get the first item's name const char* pName = (const char*)GetSetMediaItemTakeInfo(take, "P_NAME", NULL); if (!pName || !strlen(pName)) return; // Strip out extension char* pNameNoExt = new char[strlen(pName)+1]; strcpy(pNameNoExt, pName); char* pDot = strrchr(pNameNoExt, '.'); if (pDot && IsMediaExtension(pDot+1, false)) *pDot = 0; // Set all sel tracks to that name WDL_TypedBuf<MediaTrack*> tracks; SWS_GetSelectedTracks(&tracks); for (int i = 0; i < tracks.GetSize(); i++) GetSetMediaTrackInfo(tracks.Get()[i], "P_NAME", (void*)pNameNoExt); Undo_OnStateChangeEx(SWS_CMD_SHORTNAME(ct), UNDO_STATE_TRACKCFG, -1); delete [] pNameNoExt; }
void RMSNormalizeAll(double dTargetDb, double dWindowSize) { WDL_TypedBuf<MediaItem*> items; SWS_GetSelectedMediaItems(&items); double dMaxRMS = -DBL_MAX; ANALYZE_PCM a; memset(&a, 0, sizeof(a)); a.dWindowSize = dWindowSize; for (int i = 0; i < items.GetSize(); i++) { MediaItem* mi = items.Get()[i]; MediaItem_Take* take = GetMediaItemTake(mi, -1); if (take && AnalyzeItem(mi, &a) && a.dRMS != 0.0 && a.dRMS > dMaxRMS) dMaxRMS = a.dRMS; } if (dMaxRMS > -DBL_MAX) { for (int i = 0; i < items.GetSize(); i++) { MediaItem* mi = items.Get()[i]; MediaItem_Take* take = GetMediaItemTake(mi, -1); if (take) { double dVol = *(double*)GetSetMediaItemTakeInfo(take, "D_VOL", NULL); dVol *= DB2VAL(dTargetDb) / dMaxRMS; GetSetMediaItemTakeInfo(take, "D_VOL", &dVol); } } UpdateTimeline(); Undo_OnStateChangeEx(__LOCALIZE("Normalize items to RMS","sws_undo"), UNDO_STATE_ITEMS, -1); } }
void ToolbarToggle(COMMAND_T* ct, WDL_TypedBuf<TrackInfo>* pState) { if (CheckTrackParam(ct)) { pState->Resize(GetNumTracks(), false); for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); pState->Get()[i-1].guid = *(GUID*)GetSetMediaTrackInfo(tr, "GUID", NULL); pState->Get()[i-1].param = GetMediaTrackInfo_Value(tr, (const char*)ct->user); SetMediaTrackInfo_Value(tr, (const char*)ct->user, 0.0); } } else { // Restore state for (int i = 0; i < pState->GetSize(); i++) { MediaTrack* tr = GuidToTrack(&pState->Get()[i].guid); if (tr) SetMediaTrackInfo_Value(tr, (const char*)ct->user, pState->Get()[i].param); } } TrackList_AdjustWindows(false); Undo_OnStateChangeEx(SWS_CMD_SHORTNAME(ct), UNDO_STATE_TRACKCFG, -1); }
void ColorChildren(COMMAND_T* = NULL) { int iParentDepth; COLORREF crParentColor; bool bSelected = false; MediaTrack* gfd = NULL; for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); int iType; int iFolder = GetFolderDepth(tr, &iType, &gfd); if (bSelected) GetSetMediaTrackInfo(tr, "I_CUSTOMCOLOR", &crParentColor); if (iType == 1) { if (!bSelected && *(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) { iParentDepth = iFolder; bSelected = true; } crParentColor = *(COLORREF*)GetSetMediaTrackInfo(tr, "I_CUSTOMCOLOR", NULL); } if (iType + iFolder <= iParentDepth) bSelected = false; } Undo_OnStateChangeEx(__LOCALIZE("Set track(s) children to same color","sws_undo"), UNDO_STATE_TRACKCFG, -1); }
void NameTrackLikeItem(COMMAND_T* ct) { WDL_TypedBuf<MediaTrack*> tracks; SWS_GetSelectedTracks(&tracks); bool bUndo = false; for (int i = 0; i < tracks.GetSize(); i++) { for (int j = 0; j < GetTrackNumMediaItems(tracks.Get()[i]); j++) { MediaItem* mi = GetTrackMediaItem(tracks.Get()[i], j); if (*(bool*)GetSetMediaItemInfo(mi, "B_UISEL", NULL) && GetMediaItemNumTakes(mi)) { MediaItem_Take* take = GetMediaItemTake(mi, -1); if (take) { const char* pName = (const char*)GetSetMediaItemTakeInfo(take, "P_NAME", NULL); if (pName && strlen(pName)) { char* pNameNoExt = new char[strlen(pName)+1]; strcpy(pNameNoExt, pName); char* pDot = strrchr(pNameNoExt, '.'); if (pDot && IsMediaExtension(pDot+1, false)) *pDot = 0; GetSetMediaTrackInfo(tracks.Get()[i], "P_NAME", (void*)pNameNoExt); bUndo = true; delete [] pNameNoExt; } break; } } } } if (bUndo) Undo_OnStateChangeEx(SWS_CMD_SHORTNAME(ct), UNDO_STATE_TRACKCFG, -1); }
void RegionsFromItems(COMMAND_T* ct) { // Ignore the fact that the user may have items selected with the exact same times. Just blindly create regions! WDL_TypedBuf<MediaItem*> items; SWS_GetSelectedMediaItems(&items); bool bUndo = false; for (int i = 0; i < items.GetSize(); i++) { MediaItem_Take* take = GetActiveTake(items.Get()[i]); if (take) { char* cName = (char*)GetSetMediaItemTakeInfo(take, "P_NAME", NULL); double dStart = *(double*)GetSetMediaItemInfo(items.Get()[i], "D_POSITION", NULL); double dEnd = *(double*)GetSetMediaItemInfo(items.Get()[i], "D_LENGTH", NULL) + dStart; AddProjectMarker(NULL, true, dStart, dEnd, cName, -1); bUndo = true; } else if (!CountTakes(items.Get()[i])) /* In case of an empty item there is no take so process item instead */ { double dStart = *(double*)GetSetMediaItemInfo(items.Get()[i], "D_POSITION", NULL); double dEnd = *(double*)GetSetMediaItemInfo(items.Get()[i], "D_LENGTH", NULL) + dStart; AddProjectMarker(NULL, true, dStart, dEnd, NULL, -1); bUndo = true; } } if (bUndo) { UpdateTimeline(); Undo_OnStateChangeEx(SWS_CMD_SHORTNAME(ct), UNDO_STATE_MISCCFG, -1); } }
void HideAll(COMMAND_T* = NULL) { for (int i = 1; i <= GetNumTracks(); i++) SetTrackVis(CSurf_TrackFromID(i, false), 0); TrackList_AdjustWindows(MAJORADJUST); UpdateTimeline(); Undo_OnStateChangeEx(__LOCALIZE("Hide all tracks","sws_undo"), UNDO_STATE_TRACKCFG, -1); }
void ColorTrackNext(COMMAND_T* = NULL) { for (int i = 0; i < GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) GetSetMediaTrackInfo(tr, "I_CUSTOMCOLOR", GetSetMediaTrackInfo(CSurf_TrackFromID(i+1, false), "I_CUSTOMCOLOR", NULL)); } Undo_OnStateChangeEx(__LOCALIZE("Set track(s) to previous track's color","sws_undo"), UNDO_STATE_TRACKCFG, -1); }
void BlackTrack(COMMAND_T* = NULL) { int iBlack = 0x1000000 | RGB(0, 0, 0); for (int i = 0; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) GetSetMediaTrackInfo(tr, "I_CUSTOMCOLOR", &iBlack); } Undo_OnStateChangeEx(__LOCALIZE("Set track(s) color black","sws_undo"), UNDO_STATE_TRACKCFG, -1); }
void ShowAllTCP(COMMAND_T*) { for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); SetTrackVis(tr, GetTrackVis(tr) | 2); } TrackList_AdjustWindows(MAJORADJUST); UpdateTimeline(); Undo_OnStateChangeEx(__LOCALIZE("Show all tracks in TCP","sws_undo"), UNDO_STATE_TRACKCFG, -1); }
void HideUnSel(COMMAND_T*) { for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (!*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) SetTrackVis(tr, 0); } TrackList_AdjustWindows(MAJORADJUST); UpdateTimeline(); Undo_OnStateChangeEx(__LOCALIZE("Hide unselected tracks","sws_undo"), UNDO_STATE_TRACKCFG, -1); }
void ToggleHide(COMMAND_T*) { for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) SetTrackVis(tr, GetTrackVis(tr) ? 0 : 3); } TrackList_AdjustWindows(MAJORADJUST); UpdateTimeline(); Undo_OnStateChangeEx(__LOCALIZE("Toggle selected tracks fully visible/hidden","sws_undo"), UNDO_STATE_TRACKCFG, -1); }
void SetMasterOutputVol(COMMAND_T* ct) { MediaTrack* tr = CSurf_TrackFromID(0, false); int iOutput = abs((int)ct->user) >> 8; if (GetSetTrackSendInfo(tr, 1, iOutput, "D_VOL", NULL)) { double dVol = DB2VAL((double)((abs((int)ct->user) & 0xFF) * (ct->user >= 0 ? 1 : -1))); GetSetTrackSendInfo(tr, 1, iOutput, "D_VOL", &dVol); TrackList_AdjustWindows(false); Undo_OnStateChangeEx(SWS_CMD_SHORTNAME(ct), UNDO_STATE_TRACKCFG, 0); } }
void SetAllMasterOutputMutes(COMMAND_T* ct) { MediaTrack* tr = CSurf_TrackFromID(0, false); int i = 0; bool bMute = ct->user ? true : false; while (GetSetTrackSendInfo(tr, 1, i, "B_MUTE", NULL)) { GetSetTrackSendInfo(tr, 1, i++, "B_MUTE", &bMute); } if (i) Undo_OnStateChangeEx(SWS_CMD_SHORTNAME(ct), UNDO_STATE_TRACKCFG, 0); }
void MasterOutputMute(COMMAND_T* ct, int mode) // mode 0==toggle, 1==set mute, 2==set unmute { MediaTrack* tr = CSurf_TrackFromID(0, false); bool* pMute; if ((pMute = (bool*)GetSetTrackSendInfo(tr, 1, (int)ct->user, "B_MUTE", NULL))) { bool bMute; if (mode == 0) bMute = *pMute ? false : true; else bMute = mode == 1 ? true : false; GetSetTrackSendInfo(tr, 1, (int)ct->user, "B_MUTE", &bMute); Undo_OnStateChangeEx(SWS_CMD_SHORTNAME(ct), UNDO_STATE_TRACKCFG, 0); } }
void TrackOrderedCol(COMMAND_T* = NULL) { int iCurPos = 0; UpdateCustomColors(); for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) { COLORREF cr = g_custColors[iCurPos++ % 16] | 0x1000000; GetSetMediaTrackInfo(tr, "I_CUSTOMCOLOR", &cr); } } Undo_OnStateChangeEx(__LOCALIZE("Set track(s) to ordered custom color color(s)","sws_undo"), UNDO_STATE_TRACKCFG, -1); }
void TrackCustomColor(int iCustColor) { COLORREF cr; UpdateCustomColors(); cr = g_custColors[iCustColor] | 0x1000000; for (int i = 0; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) GetSetMediaTrackInfo(tr, "I_CUSTOMCOLOR", &cr); } char cUndoText[100]; sprintf(cUndoText, __LOCALIZE_VERFMT("Set track(s) to custom color %d","sws_undo"), iCustColor+1); Undo_OnStateChangeEx(cUndoText, UNDO_STATE_TRACKCFG, -1); }
void OrganizeByVol(COMMAND_T* ct) { for (int iTrack = 1; iTrack <= GetNumTracks(); iTrack++) { WDL_TypedBuf<MediaItem*> items; SWS_GetSelectedMediaItemsOnTrack(&items, CSurf_TrackFromID(iTrack, false)); if (items.GetSize() > 1) { double dStart = *(double*)GetSetMediaItemInfo(items.Get()[0], "D_POSITION", NULL); double* pVol = new double[items.GetSize()]; ANALYZE_PCM a; memset(&a, 0, sizeof(a)); if (ct->user == 2) { // Windowed mode, set the window size char str[100]; GetPrivateProfileString(SWS_INI, SWS_RMS_KEY, "-20,0.1", str, 100, get_ini_file()); char* pWindow = strchr(str, ','); a.dWindowSize = pWindow ? atof(pWindow+1) : 0.1; } for (int i = 0; i < items.GetSize(); i++) { pVol[i] = -1.0; if (AnalyzeItem(items.Get()[i], &a)) pVol[i] = ct->user ? a.dRMS : a.dPeakVal; } // Sort and arrange items from min to max RMS while (true) { int iItem = -1; double dMinVol = 1e99; for (int i = 0; i < items.GetSize(); i++) if (pVol[i] >= 0.0 && pVol[i] < dMinVol) { dMinVol = pVol[i]; iItem = i; } if (iItem == -1) break; pVol[iItem] = -1.0; GetSetMediaItemInfo(items.Get()[iItem], "D_POSITION", &dStart); dStart += *(double*)GetSetMediaItemInfo(items.Get()[iItem], "D_LENGTH", NULL); } delete [] pVol; UpdateTimeline(); Undo_OnStateChangeEx(SWS_CMD_SHORTNAME(ct), UNDO_STATE_ITEMS, -1); } } }
void ShowInTCPEx(COMMAND_T*) { for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); int iVis = GetTrackVis(tr); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) SetTrackVis(tr, iVis | 2); else SetTrackVis(tr, iVis & 1); } TrackList_AdjustWindows(MAJORADJUST); UpdateTimeline(); Undo_OnStateChangeEx(__LOCALIZE("Show selected tracks in TCP, hide others","sws_undo"), UNDO_STATE_TRACKCFG, -1); }
void TrackRandomCol(COMMAND_T* = NULL) { COLORREF cr; // All black check if (AllBlack()) return; while (!(cr = g_custColors[rand() % 16])); cr |= 0x1000000; for (int i = 0; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) GetSetMediaTrackInfo(tr, "I_CUSTOMCOLOR", &cr); } Undo_OnStateChangeEx(__LOCALIZE("Set track(s) to one random custom color","sws_undo"), UNDO_STATE_TRACKCFG, -1); }
void ShrinkSelectedTakes(int nbSamples, bool bActiveOnly) { list<MediaItem*> items; MidiItemProcessor::getSelectedMediaItems(items); for(list<MediaItem*>::iterator item = items.begin(); item != items.end(); item++) { double itemLength = *(double*)GetSetMediaItemInfo(*item, "D_LENGTH", NULL); int itemLengthSamples = (int)(MIDIITEMPROC_DEFAULT_SAMPLERATE * itemLength); itemLengthSamples -= nbSamples; itemLength = (double)(itemLengthSamples)/MIDIITEMPROC_DEFAULT_SAMPLERATE; GetSetMediaItemInfo(*item, "D_LENGTH", &itemLength); UpdateItemInProject(*item); } Undo_OnStateChangeEx(__LOCALIZE("Item Processor: shrink","sws_undo"), UNDO_STATE_ITEMS, -1); UpdateTimeline(); }
void ColorTrackNextCust(COMMAND_T* = NULL) { if (AllBlack()) return; for (int j = 1; j <= GetNumTracks(); j++) { MediaTrack* tr = CSurf_TrackFromID(j, false); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) { COLORREF cr = *(int*)GetSetMediaTrackInfo(tr, "I_CUSTOMCOLOR", NULL) & 0xFFFFFF; cr = GetNextCustColor(cr) | 0x1000000; GetSetMediaTrackInfo(tr, "I_CUSTOMCOLOR", &cr); } } Undo_OnStateChangeEx(__LOCALIZE("Set track(s) to next custom color","sws_undo"), UNDO_STATE_TRACKCFG, -1); }
void InputMatch(COMMAND_T* ct) { int iInput = -2; // Would use -1, but that's for "Input: None" for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) { if (iInput == -2) iInput = *(int*)GetSetMediaTrackInfo(tr, "I_RECINPUT", NULL); else GetSetMediaTrackInfo(tr, "I_RECINPUT", &iInput); } } TrackList_AdjustWindows(false); Undo_OnStateChangeEx(SWS_CMD_SHORTNAME(ct), UNDO_STATE_TRACKCFG, -1); }
// Gradient stuffs void TrackGradient(COMMAND_T* = NULL) { int iNumSel = NumSelTracks(); int iCurPos = 0; if (iNumSel < 2) return; for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) { COLORREF cr = CalcGradient(g_crGradStart, g_crGradEnd, (double)iCurPos++ / (iNumSel-1)) | 0x1000000; GetSetMediaTrackInfo(tr, "I_CUSTOMCOLOR", &cr); } } Undo_OnStateChangeEx(__LOCALIZE("Set tracks to color gradient","sws_undo"), UNDO_STATE_TRACKCFG, -1); }
void DelTracksChild(COMMAND_T* = NULL) { int iRet = MessageBox(g_hwndParent, __LOCALIZE("Delete track(s) children too?","sws_mbox"), __LOCALIZE("Delete track(s)","sws_mbox"), MB_YESNOCANCEL); if (iRet == IDCANCEL) return; if (iRet == IDYES) SelChildren(); for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) { DeleteTrack(tr); i--; } } Undo_OnStateChangeEx(__LOCALIZE("Delete track(s)","sws_undo"), UNDO_STATE_TRACKCFG, -1); }
void InsertTrkAbove(COMMAND_T* = NULL) { for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) { InsertTrackAtIndex(i-1, false); ClearSelected(); tr = CSurf_TrackFromID(i, false); TrackList_AdjustWindows(false); GetSetMediaTrackInfo(tr, "I_SELECTED", &g_i1); UpdateTimeline(); Undo_OnStateChangeEx(__LOCALIZE("Insert track above selected track","sws_undo"), UNDO_STATE_ALL, -1); return; } } }
void AddRelatedProject(COMMAND_T* = NULL) { char cPath[256]; GetProjectPath(cPath, 256); char* filename = BrowseForFiles(__LOCALIZE("Select related projects","sws_mbox"), cPath, NULL, false, "Reaper Project (*.RPP)\0*.RPP"); char* pBuf = filename; if (pBuf) { while(filename[0]) { g_relatedProjects.Get()->Add(new WDL_String(filename)); filename += strlen(filename) +1; } free(pBuf); Undo_OnStateChangeEx(__LOCALIZE("Add related projects","sws_mbox"), UNDO_STATE_MISCCFG, -1); } }
void RestoreLastSelItemTrack(COMMAND_T* ct) { PreventUIRefresh(1); for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) { GUID* g = (GUID*)GetSetMediaTrackInfo(tr, "GUID", NULL); for (int j = 0; j < g_selItemsTrack.Get()->GetSize(); j++) if (GuidsEqual(g, &g_selItemsTrack.Get()->Get(j)->m_guid)) { g_selItemsTrack.Get()->Get(j)->PreviousSelection(tr); break; } } } PreventUIRefresh(-1); Undo_OnStateChangeEx(SWS_CMD_SHORTNAME(ct), UNDO_STATE_ITEMS, -1); UpdateArrange(); }
static INT_PTR WINAPI doDeleteDialog(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (INT_PTR r = SNM_HookThemeColorsMessage(hwndDlg, uMsg, wParam, lParam)) return r; switch (uMsg) { case WM_INITDIALOG: { HWND list = GetDlgItem(hwndDlg, IDC_COMBO); WDL_UTF8_HookComboBox(list); for (int i = 0; i < g_relatedProjects.Get()->GetSize(); i++) SendMessage(list, CB_ADDSTRING, 0, (LPARAM)g_relatedProjects.Get()->Get(i)->Get()); SendMessage(list, CB_SETCURSEL, 0, 0); SetWindowText(hwndDlg, __LOCALIZE("SWS Delete Related Project","sws_mbox")); RestoreWindowPos(hwndDlg, DELWINDOW_POS_KEY); return 0; } case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: { HWND list = GetDlgItem(hwndDlg, IDC_COMBO); int iList = (int)SendMessage(list, CB_GETCURSEL, 0, 0); if (iList >= 0 && iList < g_relatedProjects.Get()->GetSize()) g_relatedProjects.Get()->Delete(iList, true); Undo_OnStateChangeEx(__LOCALIZE("Delete related project","sws_undo"), UNDO_STATE_MISCCFG, -1); } // Fall through to cancel to save/end case IDCANCEL: SaveWindowPos(hwndDlg, DELWINDOW_POS_KEY); EndDialog(hwndDlg, 0); break; } break; } return 0; }
void RestoreSelTrackSelItems(int iSlot) { PreventUIRefresh(1); for (int i = 1; i <= GetNumTracks(); i++) { MediaTrack* tr = CSurf_TrackFromID(i, false); if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL)) { GUID* g = (GUID*)GetSetMediaTrackInfo(tr, "GUID", NULL); for (int j = 0; j < g_selItemsTrack.Get()->GetSize(); j++) if (GuidsEqual(g, &g_selItemsTrack.Get()->Get(j)->m_guid)) { g_selItemsTrack.Get()->Get(j)->Restore(tr, iSlot); break; } } } PreventUIRefresh(-1); char cUndoText[256]; sprintf(cUndoText, __LOCALIZE_VERFMT("Restore selected track(s) selected item(s), slot %d","sws_undo"), iSlot+1); Undo_OnStateChangeEx(cUndoText, UNDO_STATE_ITEMS, -1); UpdateArrange(); }