コード例 #1
0
ファイル: Project.cpp プロジェクト: passick/Paladin
void
Project::ForceRebuild(void)
{
	STRACE(1,("%s: Force rebuild\n",GetName()));
	for (int32 i = 0; i < CountGroups(); i++)
	{
		SourceGroup *group = GroupAt(i);
		
		for (int32 j = 0; j < group->filelist.CountItems(); j++)
		{
			SourceFile *file = group->filelist.ItemAt(j);
			file->RemoveObjects(fBuildInfo);
		}
	}
	
}
コード例 #2
0
ファイル: ProjectWindow.cpp プロジェクト: passick/Paladin
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:
				{
					fSourceControl->Revert(relPath.String());
					break;
				}
				case M_DIFF_SELECTION:
				{
					fSourceControl->Diff(relPath.String());
					break;
				}
				default:
				{
					return;
				}
			}
		}
	}
}