当前位置: 首页>>代码示例>>C++>>正文


C++ SourceFile::UsesBuild方法代码示例

本文整理汇总了C++中SourceFile::UsesBuild方法的典型用法代码示例。如果您正苦于以下问题:C++ SourceFile::UsesBuild方法的具体用法?C++ SourceFile::UsesBuild怎么用?C++ SourceFile::UsesBuild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SourceFile的用法示例。


在下文中一共展示了SourceFile::UsesBuild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: partnerPath

void
ProjectWindow::ActOnSelectedFiles(const int32 &command)
{
	SCMOutputWindow *win = NULL;
	switch (command)
	{
		case M_ADD_SELECTION_TO_REPO:
		{
			if (!fSourceControl)
				return;
				
			win = new SCMOutputWindow(TR("Add to Repository"));
			win->Show();
			break;
		}
		case M_REMOVE_SELECTION_FROM_REPO:
		{
			if (!fSourceControl)
				return;
				
			win = new SCMOutputWindow(TR("Remove from Repository"));
			win->Show();
			break;
		}
		case M_REVERT_SELECTION:
		{
			if (!fSourceControl)
				return;
				
			win = new SCMOutputWindow(TR("Revert"));
			win->Show();
			break;
		}
		case M_DIFF_SELECTION:
		{
			if (!fSourceControl)
				return;
				
			win = new SCMOutputWindow(TR("Show Differences"));
			win->Show();
			break;
		}
		default:
			break;
	}
	
	for (int32 i = 0; i < fProjectList->CountItems(); i++)
	{
		SourceFileItem *item = dynamic_cast<SourceFileItem*>(fProjectList->ItemAt(i));
		if (item && item->IsSelected())
		{
			SourceFile *file = item->GetData();
			
			BString relPath = file->GetPath().GetFullPath();
			if (relPath.FindFirst(fProject->GetPath().GetFolder()) == 0)
			{
				relPath.RemoveFirst(fProject->GetPath().GetFolder());
				relPath.RemoveFirst("/");
			}
			
			BString relPartnerPath;
			entry_ref partnerRef = GetPartnerRef(file->GetPath().GetRef());
			if (partnerRef.name)
			{
				DPath partnerPath(partnerRef);
				relPartnerPath = partnerPath.GetFullPath();
				if (relPartnerPath.FindFirst(fProject->GetPath().GetFolder()) == 0)
				{
					relPartnerPath.RemoveFirst(fProject->GetPath().GetFolder());
					relPartnerPath.RemoveFirst("/");
				}
			}
			switch (command)
			{
				case M_REBUILD_FILE:
				{
					if (file->UsesBuild())
					{
						file->RemoveObjects(*fProject->GetBuildInfo());
						item->SetDisplayState(SFITEM_NEEDS_BUILD);
						fProjectList->InvalidateItem(fProjectList->IndexOf(item));
					}
					break;
				}
				case M_ADD_SELECTION_TO_REPO:
				{
					fSourceControl->AddToRepository(relPath.String());
					if (relPartnerPath.CountChars() > 0)
						fSourceControl->AddToRepository(relPartnerPath.String());
					break;
				}
				case M_REMOVE_SELECTION_FROM_REPO:
				{
					fSourceControl->RemoveFromRepository(relPath.String());
					if (relPartnerPath.CountChars() > 0)
						fSourceControl->RemoveFromRepository(relPartnerPath.String());
					break;
				}
				case M_REVERT_SELECTION:
				{
//.........这里部分代码省略.........
开发者ID:passick,项目名称:Paladin,代码行数:101,代码来源:ProjectWindow.cpp

示例2: openmsg


//.........这里部分代码省略.........
					i--;
				}
			}
			CullEmptyGroups();
			if (save)
				fProject->Save();
			break;
		}
		case M_EMPTY_CCACHE:
		{
			// We don't do this when forcing a rebuild of the sources because sometimes it
			// can take quite a while
			if (gUseCCache && gCCacheAvailable)
			{
				fStatusBar->SetText(TR("Emptying build cache"));
				UpdateIfNeeded();
				system("ccache -c > /dev/null");
				fStatusBar->SetText("");
				UpdateIfNeeded();
			}
			break;
		}
		case M_FORCE_REBUILD:
		{
			fProject->ForceRebuild();
			
			for (int32 i = 0; i < fProjectList->FullListCountItems(); i++)
			{
				SourceFileItem *item = dynamic_cast<SourceFileItem*>(fProjectList->FullListItemAt(i));
				if (!item)
					continue;
				
				SourceFile *file = item->GetData();
				if (file->UsesBuild())
				{
					item->SetDisplayState(SFITEM_NEEDS_BUILD);
					fProjectList->InvalidateItem(i);
				}
			}
			// This is necessary because InvalidateItem() uses indices from ItemAt(),
			// not FullListItemAt
			fProjectList->Invalidate();
			break;
		}
		case M_UPDATE_DEPENDENCIES:
		{
			UpdateDependencies();
			break;
		}
		case M_MAKE_PROJECT:
		case M_BUILD_PROJECT:
		{
			fBuildingFile = 0;
			DoBuild(POSTBUILD_NOTHING);
			break;
		}
		case M_RUN_PROJECT:
		{
			DoBuild(POSTBUILD_RUN);
			break;
		}
		case M_RUN_IN_TERMINAL:
		{
			DoBuild(POSTBUILD_RUN_IN_TERMINAL);
			break;
		}
开发者ID:passick,项目名称:Paladin,代码行数:67,代码来源:ProjectWindow.cpp

示例3: path

void
ProjectWindow::AddFile(const entry_ref &ref, BPoint *pt)
{
	BPath path(&ref);
	
	if (fProject->HasFileName(path.Path()))
	{
		STRACE(1,("%s is already part of the project\n", path.Path()));
		return;
	}
	
	SourceFile *file = gFileFactory.CreateSourceFileItem(path.Path());
	SourceFileItem *item = new SourceFileItem(file,1);
	
	int32 selection;
	if (pt)
		selection = fProjectList->IndexOf(*pt);
	else
		selection = fProjectList->FullListCurrentSelection();
	
	SourceGroupItem *groupItem = dynamic_cast<SourceGroupItem*>
								(fProjectList->FullListItemAt(selection));
	if (groupItem)
	{
		if (!groupItem->IsExpanded())
			fProjectList->Expand(groupItem);
		fProjectList->AddUnder(item,groupItem);
		fProject->AddFile(file,groupItem->GetData(),0);
	}
	else
	{
		if (selection >= 0)
		{
			fProjectList->AddItem(item,selection + 1);
			groupItem = (SourceGroupItem*)fProjectList->Superitem(item);
			
			int32 index = fProjectList->UnderIndexOf(item);
			
			// if we've added it via drag & drop, add it after the item under the
			// drop point. If, however, we added it via the filepanel, it makes the
			// most sense to add it after the selection
//			if (pt)
//				index++;
			fProject->AddFile(file,groupItem->GetData(),index);
			STRACE(1,("Added file %s to project\n",path.Path()));
		}
		else
		{
			// No selection, so we'll add it to the last group available unless there
			// isn't one, which shouldn't ever be.
			if (fProject->CountGroups())
			{
				groupItem = fProjectList->ItemForGroup(
							fProject->GroupAt(fProject->CountGroups() - 1));
				fProjectList->AddUnder(item,groupItem);
				fProjectList->MoveItem(fProjectList->FullListIndexOf(item),
										fProjectList->FullListCountItems());
				
				fProject->AddFile(file,groupItem->GetData(),-1);
				STRACE(1,("Added file %s to project\n",path.Path()));
			}
			else
			{
				debugger("BUG: No groups exist");
				delete file;
				return;
			}
		}
	}

	
		
	if (file->UsesBuild())
		item->SetDisplayState(SFITEM_NEEDS_BUILD);
	else
		item->SetDisplayState(SFITEM_NORMAL);
	fProjectList->InvalidateItem(fProjectList->IndexOf(item));
	if (groupItem)
		fProjectList->InvalidateItem(fProjectList->IndexOf(groupItem));
}
开发者ID:passick,项目名称:Paladin,代码行数:80,代码来源:ProjectWindow.cpp


注:本文中的SourceFile::UsesBuild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。