コード例 #1
0
ファイル: Paladin.cpp プロジェクト: passick/Paladin
void
App::OpenPartner(entry_ref ref)
{
	entry_ref partnerRef = GetPartnerRef(ref);
	DPath refpath(BPath(&ref).Path());
	
	if (partnerRef.name)
	{
		OpenFile(partnerRef);
		return;
	}
	
	BString errmsg;
	errmsg	<< "Couldn't find a partner file for " << ref.name
			<< " in " << refpath.GetFolder() << "/ .";
	ShowAlert(errmsg.String());
}
コード例 #2
0
ファイル: Paladin.cpp プロジェクト: humdingerb/Paladin
void
App::OpenPartner(entry_ref ref)
{
	entry_ref partnerRef = GetPartnerRef(ref);
	DPath refpath(BPath(&ref).Path());
	
	if (partnerRef.name)
	{
		OpenFile(partnerRef);
		return;
	}
	
	BString errmsg = B_TRANSLATE(
		"Couldn't find a partner file for %refname% in %reffolder%/.");
	errmsg.ReplaceFirst("%refname%", ref.name);
	errmsg.ReplaceFirst("%reffolder%", refpath.GetFolder());
	ShowAlert(errmsg.String());
}
コード例 #3
0
ファイル: ProjectWindow.cpp プロジェクト: passick/Paladin
void
ProjectWindow::MenusBeginning(void)
{
	gSettings.Lock();
	int32 index = 0;
	entry_ref ref;
	while (gSettings.FindRef("recentitems",index++,&ref) == B_OK)
	{
		if (!BEntry(&ref).Exists())
		{
			index--;
			gSettings.RemoveData("recentitems",index);
		}
		else
		{
			DPath refpath(ref);
			BMessage *refmsg = new BMessage(B_REFS_RECEIVED);
			refmsg->AddRef("refs",&ref);
			fRecentMenu->AddItem(new BMenuItem(refpath.GetBaseName(),refmsg));
		}
	}
	gSettings.Unlock();
	fRecentMenu->SetTargetForItems(be_app);
}
コード例 #4
0
ファイル: Globals.cpp プロジェクト: jscipione/Paladin
entry_ref
GetPartnerRef(entry_ref ref)
{
	DPath refpath(BPath(&ref).Path());
	BString ext(refpath.GetExtension());
	if (ext.CountChars() < 1)
		return entry_ref();
	
	BString pathbase = refpath.GetFullPath();
	pathbase.Truncate(pathbase.FindLast(".") + 1);
	
	const char *cpp_ext[] = { "cpp","c","cxx","cc", NULL };
	const char *hpp_ext[] = { "h","hpp","hxx","hh", NULL };
	
	bool isSource = false;
	bool isHeader = false;
	
	int i = 0;
	while (cpp_ext[i])
	{
		if (ext == cpp_ext[i])
		{
			isSource = true;
			break;
		}
		i++;
	}
	
	if (!isSource)
	{
		i = 0;
		while (hpp_ext[i])
		{
			if (ext == hpp_ext[i])
			{
				isHeader = true;
				break;
			}
			i++;
		}
	}
	else
	{
		i = 0;
		while (hpp_ext[i])
		{
			BString partpath = pathbase;
			partpath << hpp_ext[i];
			BEntry entry(partpath.String());
			if (entry.Exists())
			{
				entry_ref header_ref;
				entry.GetRef(&header_ref);
				return header_ref;
			}
			i++;
		}
	}
	
	if (isHeader)
	{
		i = 0;
		while (cpp_ext[i])
		{
			BString partpath = pathbase;
			partpath << cpp_ext[i];
			BEntry entry(partpath.String());
			if (entry.Exists())
			{
				entry_ref source_ref;
				entry.GetRef(&source_ref);
				return source_ref;
			}
			i++;
		}
	}
	
	return entry_ref();
}