Пример #1
0
// Return TRUE on delete send
bool ResolveMissingRecv(MediaTrack* tr, int iSend, TrackSend* ts, WDL_PtrList<TrackSendFix>* pFix)
{
	WDL_FastString str;
	char* cName = (char*)GetSetMediaTrackInfo(tr, "P_NAME", NULL);
	if (!cName || !cName[0])
		cName = (char*)__LOCALIZE("(unnamed)","sws_DLG_114");
	str.SetFormatted(200, __LOCALIZE_VERFMT("Send %d on track %d \"%s\" is missing its receive track!","sws_DLG_114"), iSend+1, CSurf_TrackToID(tr, false), cName);

	g_cErrorStr = str.Get();
	g_ts = ts;
	g_send = tr;
	g_recv = NULL;

	DialogBox(g_hInst, MAKEINTRESOURCE(IDD_RECVMISSING), g_hwndParent, doResolve);

	if (g_iResolveRet == 1)
		return true;
	else if (g_iResolveRet == 2)
	{
		GUID* newGuid = (GUID*)GetSetMediaTrackInfo(g_recv, "GUID", NULL);
		if (pFix)
			pFix->Add(new TrackSendFix(ts->GetGuid(), newGuid));
		ts->SetGuid(newGuid);
	}

	return false;
}
Пример #2
0
void ToggleWriteEnvExists(COMMAND_T* _ct)
{
	bool updated = false;
	// restore write modes
	if (g_toolbarAutoModeToggles.GetSize())
	{
		for (int i=0; i < g_toolbarAutoModeToggles.GetSize(); i++)
		{
			SNM_TrackInt* tri = g_toolbarAutoModeToggles.Get(i);
			GetSetMediaTrackInfo(tri->m_tr, "I_AUTOMODE", &(tri->m_int));
			updated = true;
		}
		g_toolbarAutoModeToggles.Empty(true);
	}
	// set read mode and store previous write modes
	else
	{
		for (int i=0; i <= GetNumTracks(); i++) // incl. master
		{
			MediaTrack* tr = CSurf_TrackFromID(i, false); 
			int autoMode = tr ? *(int*)GetSetMediaTrackInfo(tr, "I_AUTOMODE", NULL) : -1;
			if (autoMode >= 2 /* touch */ && autoMode <= 4 /* latch */)
			{
				GetSetMediaTrackInfo(tr, "I_AUTOMODE", &g_i1); // set read mode
				g_toolbarAutoModeToggles.Add(new SNM_TrackInt(tr, autoMode));
				updated = true;
			}
		}
	}

	if (updated) {
		Undo_OnStateChangeEx2(NULL, SWS_CMD_SHORTNAME(_ct), UNDO_STATE_ALL, -1);
		RefreshToolbar(SWSGetCommandID(ToggleWriteEnvExists)); // in case auto-refresh toolbar option is off..
	}
}
Пример #3
0
// I_FOLDERDEPTH :
//  0=normal, 1=track is a folder parent, 
// -1=track is the last in the innermost folder
// -2=track is the last in the innermost and next-innermost folders, etc
void SetTracksFolderState(COMMAND_T* _ct)
{
	bool updated = false;
	for (int i=1; i <= GetNumTracks(); i++) // skip master
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (tr && *(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
		{
			int newState = (int)_ct->user;
			int curState = *(int*)GetSetMediaTrackInfo(tr, "I_FOLDERDEPTH", NULL);
			if ((int)_ct->user == -1) // last in folder?
			{
				if (SNM_GetTrackDepth(tr)>0)
					newState = curState<0 ? curState-1 : -1;
				else
					newState = curState;
			}
			else if ((int)_ct->user == -2) // very last in folder?
			{
				int depth = SNM_GetTrackDepth(tr);
				if (depth>0)
					newState = depth * (-1);
				else
					newState = curState;
			}

			if (curState!=newState) {
				GetSetMediaTrackInfo(tr, "I_FOLDERDEPTH", &newState);
				updated = true;
			}
		}
	}
	if (updated)
		Undo_OnStateChangeEx2(NULL, SWS_CMD_SHORTNAME(_ct), UNDO_STATE_ALL, -1);
}
Пример #4
0
void RestoreTracksFolderStates(COMMAND_T* _ct)
{
	bool updated = false;
	const char* strState = !_ct->user ? "I_FOLDERDEPTH" : "I_FOLDERCOMPACT";
	WDL_PtrList_DeleteOnDestroy<SNM_TrackInt>* saveList = !_ct->user ? &g_trackFolderStates : &g_trackFolderCompactStates;
	for (int i=1; i <= GetNumTracks(); i++) // skip master
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (tr && *(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
		{
			for(int j=0; j < saveList->GetSize(); j++)
			{
				SNM_TrackInt* savedTF = saveList->Get(j);
				int current = *(int*)GetSetMediaTrackInfo(tr, strState, NULL);
				if (savedTF->m_tr == tr && 
					((!_ct->user && savedTF->m_int != current) ||
					(_ct->user && *(int*)GetSetMediaTrackInfo(tr, "I_FOLDERDEPTH", NULL) == 1 && savedTF->m_int != current)))
				{
					GetSetMediaTrackInfo(tr, strState, &(savedTF->m_int));
					updated = true;
					break;
				}
			}
		}
	}
	if (updated)
		Undo_OnStateChangeEx2(NULL, SWS_CMD_SHORTNAME(_ct), UNDO_STATE_ALL, -1);
}
Пример #5
0
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);
}
Пример #6
0
void RecSrcOut(COMMAND_T* = NULL)
{
	// Set the rec source to output
	// Set to mono or stereo based on first item
	for (int i = 1; i <= GetNumTracks(); i++)
	{
		int iMode = 1; // 5 = mono, 1 = stereo
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
		{
			if (GetTrackNumMediaItems(tr))
			{
				MediaItem* mi = GetTrackMediaItem(tr, 0);
				if (GetMediaItemNumTakes(mi))
				{
					MediaItem_Take* mit = GetMediaItemTake(mi, 0);
					PCM_source* p = (PCM_source*)GetSetMediaItemTakeInfo(mit, "P_SOURCE", NULL);
					if (p && p->GetNumChannels() == 1)
						iMode = 5;

				}
			}
			GetSetMediaTrackInfo(tr, "I_RECMODE", &iMode);
		}
	}
}
Пример #7
0
void RemapMIDIInputChannel(COMMAND_T* _ct)
{
	bool updated = false;
	int ch = (int)_ct->user; // 0: source channel

	char pLine[SNM_MAX_CHUNK_LINE_LENGTH] = "";
	if (ch && _snprintfStrict(pLine, sizeof(pLine), "MIDI_INPUT_CHANMAP %d\n", ch-1) <= 0)
		return;

	for (int i=1; i <= GetNumTracks(); i++) // skip master
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (tr && *(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
		{
			int in = *(int*)GetSetMediaTrackInfo(tr, "I_RECINPUT", NULL);
			if ((in & 0x1000) == 0x1000) // midi in?
			{
				SNM_ChunkParserPatcher p(tr);
				char currentCh[3] = "";
				int chunkPos = p.Parse(SNM_GET_CHUNK_CHAR, 1, "TRACK", "MIDI_INPUT_CHANMAP", 0, 1, currentCh, NULL, "TRACKID");
				if (chunkPos > 0) {
					if (!ch || atoi(currentCh) != (ch-1))
						updated |= p.ReplaceLine(--chunkPos, pLine); // pLine can be "", i.e. remove line
				}
				else
					updated |= p.InsertAfterBefore(0, pLine, "TRACK", "TRACKHEIGHT", 1, 0, "TRACKID");
			}
		}
	}
	if (updated)
		Undo_OnStateChangeEx2(NULL, SWS_CMD_SHORTNAME(_ct), UNDO_STATE_ALL, -1);
}
Пример #8
0
void CustomColorAll(COMMAND_T*)
{	
	// Get the first selected track
	for (int i = 1; i <= GetNumTracks(); i++)
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
		{
			Undo_BeginBlock();
			Main_OnCommand(40357, 0); // Set track(s) to one custom color
			// Assume the user clicked 'OK' in the color picker!
			COLORREF cr = *(COLORREF*)GetSetMediaTrackInfo(tr, "I_CUSTOMCOLOR", NULL);
			for (int i = 1; i <= GetNumTracks(); i++)
			{
				tr = CSurf_TrackFromID(i, false);
				for (int j = 0; j < GetTrackNumMediaItems(tr); j++)
				{
					MediaItem* mi = GetTrackMediaItem(tr, j);
					if (*(bool*)GetSetMediaItemInfo(mi, "B_UISEL", NULL))
						GetSetMediaItemInfo(mi, "I_CUSTOMCOLOR", &cr);
				}
			}
			UpdateTimeline();
			Undo_EndBlock(__LOCALIZE("Set selected track(s)/item(s) to custom color","sws_undo"), UNDO_STATE_ALL);
			return;
		}
	}
	// No tracks selected so just run the item action
	Main_OnCommand(40704, 0); // Set item(s) to one custom color
}
Пример #9
0
void SWS_TrackListView::GetItemText(SWS_ListItem* item, int iCol, char* str, int iStrMax)
{
	MediaTrack* tr = (MediaTrack*)item;
	if (tr)
	{
		switch (iCol)
		{
		case COL_NUM: // #
			_snprintf(str, iStrMax, "%d", CSurf_TrackToID(tr, false));
			break;
		case COL_NAME: // Name
			lstrcpyn(str, (char*)GetSetMediaTrackInfo(tr, "P_NAME", NULL), iStrMax);
			break;
		case COL_TCP: // TCP
			lstrcpyn(str, GetTrackVis(tr) & 2 ? UTF8_BULLET : UTF8_CIRCLE, iStrMax);
			break;
		case COL_MCP: // MCP
			lstrcpyn(str, GetTrackVis(tr) & 1 ? UTF8_BULLET : UTF8_CIRCLE, iStrMax);
			break;
		case COL_ARM:
			lstrcpyn(str, *(int*)GetSetMediaTrackInfo(tr, "I_RECARM", NULL) ? UTF8_BULLET : UTF8_CIRCLE, iStrMax);
			break;
		case COL_MUTE:
			lstrcpyn(str, *(bool*)GetSetMediaTrackInfo(tr, "B_MUTE", NULL) ? UTF8_BULLET : UTF8_CIRCLE, iStrMax);
			break;
		case COL_SOLO:
			lstrcpyn(str, *(int*)GetSetMediaTrackInfo(tr, "I_SOLO", NULL) ? UTF8_BULLET : UTF8_CIRCLE, iStrMax);
			break;
//		case COL_INPUT:
//			_snprintf(str, iStrMax, "%d", *(int*)GetSetMediaTrackInfo(tr, "I_RECINPUT", NULL) + 1);
//			break;
		}
	}
}
Пример #10
0
void SWS_TrackListView::OnItemSelChanged(SWS_ListItem* item, int iState)
{
	MediaTrack* tr = (MediaTrack*)item;
	if (iState & LVIS_FOCUSED)
		g_pList->m_trLastTouched = tr;
	if ((iState & LVIS_SELECTED ? true : false) != (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL) ? true : false))
		GetSetMediaTrackInfo(tr, "I_SELECTED", iState & LVIS_SELECTED ? &g_i1 : &g_i0);
}
Пример #11
0
void DisableMPSend(COMMAND_T* = NULL)
{
	for (int i = 1; i <= GetNumTracks(); i++)
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
			GetSetMediaTrackInfo(tr, "B_MAINSEND", &g_bFalse);
	}
}
Пример #12
0
void UnbypassFX(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_FXEN", &g_i1);
	}
}
Пример #13
0
void UnsetMonMedia(COMMAND_T* = NULL)
{
	for (int i = 1; i <= GetNumTracks(); i++)
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
			GetSetMediaTrackInfo(tr, "I_RECMONITEMS", &g_i0);
	}
}
Пример #14
0
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);
}
Пример #15
0
void MinimizeTracks(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_HEIGHTOVERRIDE", &g_i1);
	}
	TrackList_AdjustWindows(false);
	UpdateTimeline();
}
Пример #16
0
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);
}
Пример #17
0
void SaveTracksFolderStates(COMMAND_T* _ct)
{
	const char* strState = !_ct->user ? "I_FOLDERDEPTH" : "I_FOLDERCOMPACT";
	WDL_PtrList_DeleteOnDestroy<SNM_TrackInt>* saveList = !_ct->user ? &g_trackFolderStates : &g_trackFolderCompactStates;
	saveList->Empty(true);
	for (int i=1; i <= GetNumTracks(); i++) // skip master
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (tr && *(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
			saveList->Add(new SNM_TrackInt(tr, *(int*)GetSetMediaTrackInfo(tr, strState, NULL)));
	}
}
Пример #18
0
int GetTrackVis(MediaTrack* tr) // &1 == mcp, &2 == tcp
{
	int iTrack = CSurf_TrackToID(tr, false);
	if (iTrack == 0)
		return *(int*)GetConfigVar("showmaintrack") ? 3 : 1; // For now, always return master vis in MCP
	else if (iTrack < 0)
		return 0;

	int iVis = *(bool*)GetSetMediaTrackInfo(tr, "B_SHOWINMIXER", NULL) ? 1 : 0;
	iVis    |= *(bool*)GetSetMediaTrackInfo(tr, "B_SHOWINTCP", NULL) ? 2 : 0;
	return iVis;
}
Пример #19
0
void TogMPSend(COMMAND_T* = NULL)
{
	bool bMPSend;
	for (int i = 1; i <= GetNumTracks(); i++)
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
		{
			bMPSend = !*(bool*)GetSetMediaTrackInfo(tr, "B_MAINSEND", NULL);
			GetSetMediaTrackInfo(tr, "B_MAINSEND", &bMPSend);
		}
	}
}
Пример #20
0
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);
}
Пример #21
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);
}
Пример #22
0
int IsMinimizeTracks(COMMAND_T* ct)
{
	int mins=0, seltrs=0;
	for (int i=0; i <= GetNumTracks(); i++)
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL))
		{
			seltrs++;
			if (*(int*)GetSetMediaTrackInfo(tr, "I_HEIGHTOVERRIDE", NULL)==1)
				mins++;
		}
	}
	return seltrs && seltrs==mins;
}
Пример #23
0
double MediaTrack_GetDoubleProperty(MediaTrack* track, const char* property)
{
   double* resultPtr = reinterpret_cast<double*>(GetSetMediaTrackInfo(track, property, 0));
   AssertTrue(resultPtr != 0);
   double value = *resultPtr;
   return value;
}
Пример #24
0
int MediaTrack_GetIntProperty(MediaTrack* track, const char* property)
{
   int* resultPtr = reinterpret_cast<int*>(GetSetMediaTrackInfo(track, property, 0));
   AssertTrue(resultPtr != 0);
   int value = *resultPtr;
   return value;
}
Пример #25
0
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);
}
Пример #26
0
bool MediaTrack_GetBoolProperty(MediaTrack* track, const char* property)
{
   bool* resultPtr = reinterpret_cast<bool*>(GetSetMediaTrackInfo(track, property, 0));
   AssertTrue(resultPtr != 0);
   bool value = *resultPtr;
   return value;
}
Пример #27
0
void RestoreSelected()
{
	int iSel = 1;
	for (int i = 0; i < g_iNumSel; i++)
		if (CSurf_TrackToID(g_pSelTracks[i], false) >= 0)
			GetSetMediaTrackInfo(g_pSelTracks[i], "I_SELECTED", &iSel);
}
Пример #28
0
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);
}
Пример #29
0
void SelULItem(COMMAND_T* = NULL)
{
	UnselOnTracks();
	for (int i = 1; i <= GetNumTracks(); i++)
	{
		MediaTrack* tr = CSurf_TrackFromID(i, false);
		int iNumItems = GetTrackNumMediaItems(tr);
		if (*(int*)GetSetMediaTrackInfo(tr, "I_SELECTED", NULL) && iNumItems)
		{
			MediaItem* pUL = GetTrackMediaItem(tr, 0);
			double dFirstPos = *(double*)GetSetMediaItemInfo(pUL, "D_POSITION", NULL);
			float fFIPMy = *(float*)GetSetMediaItemInfo(pUL, "F_FREEMODE_Y", NULL);
			for (int j = 1; j < iNumItems; j++)
			{
				if (dFirstPos != *(double*)GetSetMediaItemInfo(GetTrackMediaItem(tr, j), "D_POSITION", NULL))
					break;
				if (fFIPMy > *(float*)GetSetMediaItemInfo(GetTrackMediaItem(tr, j), "F_FREEMODE_Y", NULL))
				{
					pUL = GetTrackMediaItem(tr, j);
					fFIPMy = *(float*)GetSetMediaItemInfo(pUL, "F_FREEMODE_Y", NULL);
				}
			}
			GetSetMediaItemInfo(pUL, "B_UISEL", &g_bTrue);
		}
	}
	UpdateTimeline();
}
Пример #30
0
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;
}