void CSetSavedDataPage::OnBnClickedStoreddecisionsclear()
{
	static const CString tgitvalues[] = {
		L"OldMsysgitVersionWarning",
		L"OpenRebaseRemoteBranchUnchanged",
		L"OpenRebaseRemoteBranchFastForwards",
		L"DaemonNoSecurityWarning",
		L"NothingToCommitShowUnversioned",
		L"NoJumpNotFoundWarning",
		L"HintHierarchicalConfig",
		L"TagOptNoTagsWarning",
		L"NoStashIncludeUntrackedWarning",
		L"CommitMergeHint",
		L"AskSetTrackedBranch",
	};
	for (const auto& value : tgitvalues)
	{
		CRegDWORD regkey(_T("Software\\TortoiseGit\\") + value);
		regkey.removeValue();
	}

	static const CString tmergevalues[] = {
		L"DeleteFileWhenEmpty",
	};
	for (const auto& value : tgitvalues)
	{
		CRegDWORD regkey(_T("Software\\TortoiseGitMerge\\") + value);
		regkey.removeValue();
	}
}
void CHistoryCombo::SaveHistory()
{
	if (m_sSection.IsEmpty())
		return;

	//add the current item to the history
	CString sCurItem;
	GetWindowText(sCurItem);
	if (m_bTrim)
		sCurItem.Trim();
	if (!sCurItem.IsEmpty())
		AddString(sCurItem, 0);
	//save history to registry/inifile
	int nMax = min(GetCount(), m_nMaxHistoryItems + 1);
	for (int n = 0; n < nMax; n++)
	{
		CString sKey;
		sKey.Format(L"%s\\%s%d", (LPCTSTR)m_sSection, (LPCTSTR)m_sKeyPrefix, n);
		CRegString regkey(sKey);
		regkey = m_arEntries.GetAt(n);
	}
	//remove items exceeding the max number of history items
	for (int n = nMax; ; n++)
	{
		CString sKey;
		sKey.Format(L"%s\\%s%d", (LPCTSTR)m_sSection, (LPCTSTR)m_sKeyPrefix, n);
		CRegString regkey(sKey);
		CString sText = regkey;
		if (sText.IsEmpty())
			break;
		regkey.removeValue(); // remove entry
	}
}
Exemple #3
0
void EjectKey::GetRemappedScanCode(BYTE &extendedScanCode, BYTE &scanCode)
{
    DWORD regSize = 0;
    if (ERROR_SUCCESS == 
        RegGetValue(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout"), 
        _T("Scancode Map"), RRF_RT_REG_BINARY, nullptr, nullptr, &regSize))
    {
        std::unique_ptr<BYTE[]> regkey(new BYTE[regSize]);
        if (ERROR_SUCCESS == RegGetValue(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Control\\Keyboard Layout"), 
            _T("Scancode Map"), RRF_RT_REG_BINARY, nullptr, regkey.get(), &regSize))
        {
            scancode_map* sc_map = reinterpret_cast<scancode_map*>(regkey.get());
            for (unsigned int i = 0; i< sc_map->no_of_mappings; i++)
            {
                mapping& current = sc_map->mappings[i];
                if (current.fromExtScanCode == extendedScanCode && current.fromScanCode == scanCode)
                {
                    extendedScanCode = current.toExtScanCode;
                    scanCode = current.toScanCode;
                    break;
                }
            }
        }
    }
}
void CHistoryCombo::RemoveEntryFromHistory(LPCTSTR lpszSection, LPCTSTR lpszKeyPrefix, const CString& entryToRemove)
{
	if (entryToRemove.IsEmpty())
		return;
	CString sText;
	bool found = false;
	int n = -1;
	do
	{
		CString sKey;
		sKey.Format(L"%s\\%s%d", lpszSection, lpszKeyPrefix, ++n);
		CRegString regkey(sKey);
		sText = regkey;
		if (sText == entryToRemove)
		{
			regkey.removeValue();
			found = true;
			++n;
			break;
		}
	} while (!sText.IsEmpty());
	if (!found)
		return;
	for (;; ++n)
	{
		CString sKey;
		sKey.Format(L"%s\\%s%d", lpszSection, lpszKeyPrefix, n);
		CRegString regkey(sKey);
		sText = regkey;
		if (!sText.IsEmpty())
		{
			CString sKeyNew;
			sKeyNew.Format(L"%s\\%s%d", lpszSection, lpszKeyPrefix, n - 1);
			CRegString regkeyNew(sKeyNew);
			regkeyNew = sText;
			regkey.removeValue();
			continue;
		}
		else
			break;
	}
}
bool CompilerLocatorCygwin::Locate()
{
    m_compilers.clear();
#ifdef __WXMSW__ // for wxRegKey
    {
        wxRegKey regkey(wxRegKey::HKLM, "SOFTWARE\\Cygwin\\setup");
        wxString cygwinInstallDir;
        if ( regkey.QueryValue("rootdir", cygwinInstallDir) && wxDirExists(cygwinInstallDir)) {
            Locate( cygwinInstallDir );
        }
    }   
    {
        // If we are running a 64 bit version of CodeLite, we should search under the 
        // Wow6432Node
        wxRegKey regkey(wxRegKey::HKLM, "SOFTWARE\\Wow6432Node\\Cygwin\\setup");
        wxString cygwinInstallDir;
        if ( regkey.QueryValue("rootdir", cygwinInstallDir) && wxDirExists(cygwinInstallDir)) {
            Locate( cygwinInstallDir );
        }
    }
    
#endif
    return !m_compilers.empty();
}
void CHistoryCombo::ClearHistory(BOOL bDeleteRegistryEntries/*=TRUE*/)
{
	ResetContent();
	if (! m_sSection.IsEmpty() && bDeleteRegistryEntries)
	{
		//remove profile entries
		CString sKey;
		for (int n = 0; ; n++)
		{
			sKey.Format(L"%s\\%s%d", (LPCTSTR)m_sSection, (LPCTSTR)m_sKeyPrefix, n);
			CRegString regkey(sKey);
			CString sText = regkey;
			if (sText.IsEmpty())
				break;
			regkey.removeValue(); // remove entry
		}
	}
}
Exemple #7
0
bool CRegHistory::Save() const
{
    if (m_sSection.empty())
        return false;

    // save history to registry
    int nMax = min((int)m_arEntries.size(), m_nMaxHistoryItems + 1);
    for (int n = 0; n < (int)m_arEntries.size(); n++)
    {
        TCHAR sKey[4096] = {0};
        if (m_pIniFile)
        {
            _stprintf_s(sKey, _countof(sKey), _T("%s%d"), m_sKeyPrefix.c_str(), n);
            m_pIniFile->SetValue(m_sSection.c_str(), sKey, m_arEntries[n].c_str());
        }
        else
        {
            _stprintf_s(sKey, _countof(sKey), _T("%s\\%s%d"), m_sSection.c_str(), m_sKeyPrefix.c_str(), n);
            CRegStdString regkey(sKey);
            regkey = m_arEntries[n];
        }
    }
    // remove items exceeding the max number of history items
    for (int n = nMax; ; n++)
    {
        TCHAR sKey[4096] = {0};
        if (m_pIniFile)
        {
            _stprintf_s(sKey, _countof(sKey), _T("%s\\%s%d"), m_sSection.c_str(), m_sKeyPrefix.c_str(), n);
            if (wcscmp(m_pIniFile->GetValue(m_sSection.c_str(), sKey, L""), L"")==0)
                break;
            m_pIniFile->Delete(m_sSection.c_str(), sKey, false);
        }
        else
        {
            _stprintf_s(sKey, _countof(sKey), _T("%s\\%s%d"), m_sSection.c_str(), m_sKeyPrefix.c_str(), n);
            CRegStdString regkey = CRegStdString(sKey);
            if (std::wstring(regkey).empty())
                break;
            regkey.removeValue(); // remove entry
        }
    }
    return true;
}
void CSetSavedDataPage::OnBnClickedLoghistclear()
{
	CRegistryKey reg(_T("Software\\TortoiseGit\\History"));
	CStringList histlist;
	reg.getSubKeys(histlist);
	for (POSITION pos = histlist.GetHeadPosition(); pos != NULL; )
	{
		CString sHist = histlist.GetNext(pos);
		if (sHist.Left(6).CompareNoCase(_T("commit"))==0)
		{
			CRegistryKey regkey(_T("Software\\TortoiseGit\\History\\")+sHist);
			regkey.removeKey();
		}
	}

	m_btnLogHistClear.EnableWindow(FALSE);
	m_tooltips.DelTool(GetDlgItem(IDC_RESIZABLEHISTCLEAR));
	m_tooltips.DelTool(GetDlgItem(IDC_RESIZABLEHISTORY));
}
clDockerSettings::clDockerSettings()
    : clConfigItem("Docker")
{
    // The defaults
    wxArrayString hints;
    hints.Add("/usr/local/bin");
    hints.Add("/usr/bin");
#ifdef __WXMSW__
    {
        wxRegKey regkey(wxRegKey::HKCU, "Environment");
        wxString docker_path;
        if(regkey.QueryValue("DOCKER_TOOLBOX_INSTALL_PATH", docker_path) && wxDirExists(docker_path)) {
            hints.Add(docker_path);
        }
    }
#endif
    ::clFindExecutable("docker", m_docker, hints);
    ::clFindExecutable("docker-compose", m_dockerCompose, hints);
}