Exemplo n.º 1
0
void WorkspaceWork::RemoveFile()
{
	int i = filelist.GetCursor();
	int s = filelist.GetSbPos();
	bool separator = false;
	if(i >= 0 && i < fileindex.GetCount()) {
		int fx = fileindex[i];
		separator = actual.file[fx].separator;
		if(separator && closed.Find(GetActiveSepfo()) >= 0) {
			int px = fx;
			while(--px >= 0 && !actual.file[fx].separator)
				;
			if(px >= 0) {
				int c = closed.Find(Sepfo(GetActivePackage(), actual.file[px]));
				if(c >= 0)
					closed.Unlink(c);
			}
		}
		actual.file.Remove(fx);
	}
	if(separator || IsAux())
		SaveLoadPackageNS(false);
	else
		SaveLoadPackage(false);

	if (separator || FileRemove()) {
		filelist.SetSbPos(s);
		filelist.SetCursor(i);
	}
}
Exemplo n.º 2
0
void WorkspaceWork::SyncErrorPackages()
{
	for(int i = 0; i < package.GetCount(); i++) {
		FileList::File f = package.Get(i);
		if(!IsAux(f.name) && i < speed.GetCount()) {
			FileList::File ff = f;
			String path = GetFileFolder(PackagePath(f.name));
		#ifdef PLATFORM_WIN32
			path = ToLower(path);
		#endif
			ff.icon = i ? IdeImg::Package() : IdeImg::MainPackage();
			if(speed[i])
				ff.icon = ImageOver(ff.icon, IdeImg::FastPackage());
			ff.underline = Null;
			for(int q = 0; q < errorfiles.GetCount(); q++) {
				if(errorfiles[q].StartsWith(path)) {
					ff.icon = ImageOverRed(ff.icon);
					ff.underline = LtRed;
					break;
				}
			}
			ff.icon = DPI(ff.icon);
			package.Set(i, ff);
		}
	}
}
Exemplo n.º 3
0
Vector<String> WorkspaceWork::SvnDirs(bool actual)
{
	Vector<String> d = GetUppDirs();
	if (actual && !IsAux())
		d.Insert(0, GetFileFolder(PackagePath(actualpackage)));
	Vector<String> r;
	for(int i = 0; i < d.GetCount(); i++)
		if(IsSvnDir(d[i]))
			r.Add(d[i]);
	return r;
}
Exemplo n.º 4
0
CConnection::~CConnection()
{
    try {
        if( IsAux() ) {
            _TRACE("Auxiliary connection " << (void*)this << " is being deleted...");
        } else {
            _TRACE("Default connection " << (void*)this << " is being deleted...");
        }
        FreeResources();
        Notify(CDbapiDeletedEvent(this));
        _TRACE(GetIdent() << " " << (void*)this << " deleted.");
    }
    NCBI_CATCH_ALL_X( 1, kEmptyStr )
}
Exemplo n.º 5
0
void WorkspaceWork::InsertSpecialMenu(Bar& menu)
{
	bool isaux = IsAux();
	menu.Add("Insert any file(s)", THISBACK1(AddFile, ANY_FILE))
		.Key(K_SHIFT|K_CTRL_I)
		.Help("Insert files from anywhere on disk (discouraged in portable packages)");
	menu.Add(isaux && GetOutputDir().GetCount(), "Insert output directory file(s)", THISBACK1(AddFile, OUTPUT_FILE))
		.Help("Open file selector in output / intermediate directory for current package");
#ifdef PLATFORM_POSIX
	menu.Add(isaux && GetConfigDir().GetCount(), "Insert config directory file(s)", THISBACK1(AddFile, CONFIG_FILE))
		.Help("Open file selector in output / intermediate directory for current package");
#endif
	menu.Add(isaux, "Insert Local directory file(s)", THISBACK1(AddFile, LOCAL_FILE))
		.Help("Open file selector in Local directory for current package");
	menu.Add("Insert home directory file(s)", THISBACK1(AddFile, HOME_FILE))
		.Help("Open file selector in current user's HOME directory");
}
Exemplo n.º 6
0
void WorkspaceWork::RenamePackage()
{
	if(IsAux() || !package.IsCursor())
		return;
	WithRenamePackageLayout<TopWindow> dlg;
	CtrlLayoutOKCancel(dlg, "Rename package");
	dlg.name.SetFilter(FilterPackageName);
	dlg.name <<= package.Get(package.GetCursor()).name;
	dlg.name.SelectAll();
again:
	if(dlg.Execute() != IDOK)
		return;
	String pn = ~dlg.name;
	if(!RenamePackageFs(GetActivePackage(), pn))
		goto again;
	PackageOp(GetActivePackage(), Null, pn);
}
Exemplo n.º 7
0
void WorkspaceWork::PackageMenu(Bar& menu)
{
	if(!menu.IsScanKeys()) {
		bool cando = !IsAux() && package.IsCursor();
		String act = UnixPath(GetActivePackage());
		menu.Add(cando, ~NFormat("Add package to '%s'", act), IdeImg::package_add(), THISBACK(AddNormalUses));
		RemovePackageMenu(menu);
		if(menu.IsMenuBar()) {
			menu.Add(cando, "Rename package..", THISBACK(RenamePackage));
			menu.Add(cando, "Delete package", THISBACK(DeletePackage));
			menu.Separator();
			menu.Add(cando, "Optimize for speed", THISBACK(TogglePackageSpeed))
			    .Check(actual.optimize_speed);
			menu.Separator();
			BuildPackageMenu(menu);
			menu.Add("Open Package Directory",THISBACK(OpenPackageFolder));
		}
	}
}
Exemplo n.º 8
0
void WorkspaceWork::DeletePackage()
{
	String active = GetActivePackage();
	if(package.GetCursor() == 0) {
		Exclamation("Cannot delete the main package!");
		return;
	}
	if(IsAux() || !package.IsCursor() ||
	   !PromptYesNo("Do you really want to delete package [* \1" + active + "\1]?&&"
	                "[/ Warning:] [* Package will only be removed&"
	                "from packages of current workspace!]"))
		return;
	if(!PromptYesNo("This operation is irreversible.&Do you really want to proceed?"))
		return;
	if(!DeleteFolderDeep(GetFileFolder(GetActivePackagePath()))) {
		Exclamation("Deleting directory has failed.");
		return;
	}
	PackageOp(active, Null, Null);
}
Exemplo n.º 9
0
void WorkspaceWork::FileMenu(Bar& menu)
{
	bool sel = filelist.IsCursor() && filelist[filelist.GetCursor()].isdir;
	bool isaux = IsAux();
	if(isaux)
		InsertSpecialMenu(menu);
	else {
		menu.Add(!isaux, "Insert package directory file(s)", THISBACK1(AddFile, PACKAGE_FILE))
			.Help("Insert file relative to current package");
		menu.Add(!isaux, "Insert topic++ group", THISBACK(AddTopicGroup));
		menu.Add("Special", THISBACK(SpecialFileMenu))
		    .Help("Less frequently used methods of adding files to the package");
	}
	menu.Add("Insert separator", THISBACK(AddSeparator))
		.Help("Insert text separator line");
	menu.Separator();
	if(!organizer) {
		if(sel)
			menu.Add(closed.Find(GetActiveSepfo()) < 0 ? "Close group\t[double-click]"
			                                           : "Open group\t[double-click]", THISBACK(Group));
		menu.Add("Open all groups", THISBACK(OpenAllGroups));
		menu.Add("Close all groups", THISBACK(CloseAllGroups));
		menu.Separator();
		BuildFileMenu(menu);
		menu.Separator();
	}
	menu.Add("Rename...", THISBACK(RenameFile))
	    .Help("Rename file / separator / topic group");
	menu.Add("Remove", THISBACK(RemoveFile))
		.Key(organizer ? K_DELETE : K_ALT_DELETE)
		.Help("Remove file / separator / topic group from package");
	menu.Add(filelist.IsCursor() && !sel, "Delete", THISBACK(DelFile))
		.Help("Remove file / topic group reference from package & delete file / folder on disk");
	menu.Separator();
	menu.Add("Open File Directory",THISBACK(OpenFileFolder));
	menu.Add("Copy File Path", callback1(WriteClipboardText, GetActiveFilePath()));
	menu.Separator();
	menu.Add(filelist.GetCursor() > 0, "Move up", THISBACK1(MoveFile, -1))
		.Key(organizer ? K_CTRL_UP : K_SHIFT_CTRL_UP)
		.Help("Move current file one position towards package beginning");
	menu.Add(filelist.IsCursor() && filelist.GetCursor() < filelist.GetCount() - 1, "Move down",
	         THISBACK1(MoveFile, 1))
		.Key(organizer ? K_CTRL_DOWN : K_SHIFT_CTRL_DOWN)
		.Help("Move current file one position towards package end");
	if(IsActiveFile()) {
		menu.Separator();
		String p = GetActiveFilePath();
		String ext = GetFileExt(p);
		if(ext == ".tpp" && IsFolder(p)) {
			menu.Add("Includeable topic group", THISBACK(ToggleIncludeable))
			    .Check(FileExists(AppendFileName(p, "all.i")));
			if(IsSvnDir(p))
				menu.Add("Svn Synchronize " + p, THISBACK1(SyncSvnDir, p));
		}
		else {
			menu.Add("Optimize for speed", THISBACK(ToggleFileSpeed))
			    .Check(ActiveFile().optimize_speed);
			if(IsHeaderExt(ext))
				menu.Add("Precompile header", THISBACK(TogglePCH))
				    .Check(ActiveFile().pch);
		}
	}
	FilePropertiesMenu(menu);
}
Exemplo n.º 10
0
bool WorkspaceWork::IsAux()
{
	return IsAux(actualpackage);
}