Example #1
0
void OpenRelatedProject(COMMAND_T* pCmd)
{
	if ((int)pCmd->user == g_relatedProjects.Get()->GetSize())
		// Give the user the chance to add a related project if they selected the first open spot
		if (MessageBox(g_hwndParent, __LOCALIZE("No related project found. Add one now?","sws_mbox"), __LOCALIZE("SWS Open Related Project","sws_mbox"), MB_YESNO) == IDYES)
			AddRelatedProject();

	if ((int)pCmd->user >= g_relatedProjects.Get()->GetSize())
		return;

	WDL_String* pStr = g_relatedProjects.Get()->Get((int)pCmd->user);
	ReaProject* pProj;
	// See if it's already opened
	char cOpenedProj[256];
	int i = 0;
	while ((pProj = EnumProjects(i++, cOpenedProj, 256)))
	{
		if (_stricmp(cOpenedProj, pStr->Get()) == 0)
		{
			SelectProjectInstance(pProj);
			return;
		}
	}

	// Nope, open in new tab
	// Save "prompt on new project" variable
	int iNewProjOpts;
	int sztmp;
	int* pNewProjOpts = (int*)get_config_var("newprojdo", &sztmp);
	iNewProjOpts = *pNewProjOpts;
	*pNewProjOpts = 0;
	pProj = EnumProjects(-1, NULL, 0);
	Main_OnCommand(41929, 0); // New project tab (ignore default template)
	Main_openProject(pStr->Get());
	EnumProjects(-1, cOpenedProj, 256);
	if (_stricmp(pStr->Get(), cOpenedProj))
	{
		Main_OnCommand(40860, 0); // 40860 = Close current project tab
		SelectProjectInstance(pProj);
		g_relatedProjects.Get()->Delete((int)pCmd->user, true);
	}
	*pNewProjOpts = iNewProjOpts;
}
Example #2
0
void LoadOrSelectProject(const char* _fn, bool _newTab)
{
	if (!_fn)
		return;

	int i=0;
	bool found = false;
	ReaProject* prj = NULL;
	char fn[SNM_MAX_PATH] = "";
	while (!found && (prj = EnumProjects(i++, fn, sizeof(fn))))
		if (!_stricmp(_fn, fn))
			found = true;

	if (found)
		SelectProjectInstance(prj);
	else {
		if (_newTab) Main_OnCommand(40859,0);
		Main_openProject((char*)_fn); // includes an undo point
	}
}
Example #3
0
int SWS_ProjectListWnd::OnKey(MSG* msg, int iKeyState)
{
	if (msg->message == WM_KEYDOWN && !iKeyState)
	{
		if (msg->wParam == VK_DELETE)
		{
			Main_OnCommand(40860, 0);
			Show(false, true);
			return 1;
		}
		else if (msg->wParam == VK_RETURN)
		{
			if (m_pLists.Get(0))
			{
				ReaProject* proj = (ReaProject*)m_pLists.Get(0)->EnumSelected(NULL);
				if (proj)
					SelectProjectInstance(proj);
			}
			Show(false, true);
			return 1;
		}
	}
	return 0;
}
Example #4
0
void SelectProjectJob::Perform() {
	if (ReaProject* proj = EnumProjects(GetIntValue(), NULL, 0)) // project number is 0-based
		SelectProjectInstance(proj);
}
Example #5
0
void OpenProjectTab(COMMAND_T* ctx)
{
	ReaProject* proj = EnumProjects((int)ctx->user, NULL, 0);
	if (proj)
		SelectProjectInstance(proj);
}
Example #6
0
void LastProjectTab(COMMAND_T*)
{
	int iNumProjects = 0;
	while (EnumProjects(++iNumProjects, NULL, 0));
	SelectProjectInstance(EnumProjects(iNumProjects-1, NULL, 0));
}
Example #7
0
void SWS_ProjectListView::OnItemDblClk(SWS_ListItem* item, int iCol)
{
	SelectProjectInstance((ReaProject*)item);
	g_pProjList->Show(false, true);
}