ShortcutMapper::ShortcutMapper() :
    _babygrid(NULL),
    _rightClickMenu(NULL),
    _currentState(STATE_MENU),
    _hTabCtrl(NULL)
{
    generic_strncpy(tabNames[0], TEXT("Main menu"), maxTabName);
    generic_strncpy(tabNames[1], TEXT("Macros"), maxTabName);
    generic_strncpy(tabNames[2], TEXT("Run commands"), maxTabName);
    generic_strncpy(tabNames[3], TEXT("Plugin commands"), maxTabName);
    generic_strncpy(tabNames[4], TEXT("Scintilla commands"), maxTabName);
}
Exemple #2
0
// Build Recent File menu entries from given
TCHAR *BuildMenuFileName(TCHAR *buffer, int len, int pos, const TCHAR *filename)
{
    buffer[0] = 0;

    TCHAR *itr = buffer;
    TCHAR *end = buffer + MAX_PATH - 1;
    if (pos < 9)
    {
        *itr++ = '&';
        *itr++ = '1' + (TCHAR)pos;
    }
    else if (pos == 9)
    {
        *itr++ = '1';
        *itr++ = '&';
        *itr++ = '0';
    }
    else
    {
        wsprintf(itr, TEXT("%d"), pos+1);
        itr = itr + lstrlen(itr);
    }
    *itr++ = ':';
    *itr++ = ' ';

    if (len > 0)
    {
        TCHAR cnvName[MAX_PATH*2];
        convertFileName(cnvName, filename);
        ::PathCompactPathEx(itr, filename, len - (itr-buffer), 0);
    }
    else
    {
        TCHAR cnvName[MAX_PATH];
        const TCHAR *s1;

        if (len == 0)
            s1 = PathFindFileName(filename);
        else // (len < 0)
            s1 = filename;

        int len = lstrlen(s1);
        if (len < (end-itr))
        {
            lstrcpy(cnvName, s1);
        }
        else
        {
            int n = (len-3-(itr-buffer))/2;
            generic_strncpy(cnvName, s1, n);
            lstrcpy(cnvName+n, TEXT("..."));
            lstrcat(cnvName, s1 + lstrlen(s1) - n);
        }
        convertFileName(itr, cnvName);
    }
    return buffer;
}
Exemple #3
0
TCHAR *BuildMenuFileName(TCHAR *buffer, int len, int pos, const TCHAR *filename)
{
	TCHAR cwd[MAX_PATH];
	buffer[0] = 0;
	GetCurrentDirectory(_countof(cwd), cwd);
	lstrcat(cwd, TEXT("\\"));

	TCHAR *itr = buffer;
	TCHAR *end = buffer + len - 1;
	if (pos < 9)
	{
		*itr++ = '&';
		*itr++ = '1' + (TCHAR)pos;
	}
	else if (pos == 9)
	{
		*itr++ = '1';
		*itr++ = '&';
		*itr++ = '0';
	}
	else
	{
		wsprintf(itr, TEXT("%d"), pos+1);
		itr = itr + lstrlen(itr);
	}
	*itr++ = ':';
	*itr++ = ' ';
	if (0 == generic_strnicmp(filename, cwd, lstrlen(cwd)))
	{
		TCHAR cnvName[MAX_PATH];
		const TCHAR *s1 = PathFindFileName(filename);
		int len = lstrlen(s1);
		if (len < (end-itr))
		{
			lstrcpy(cnvName, s1);
		}
		else
		{
			int n = (len-3-(itr-buffer))/2;
			generic_strncpy(cnvName, s1, n);
			lstrcpy(cnvName+n, TEXT("..."));
			lstrcat(cnvName, s1 + lstrlen(s1) - n);
		}
		convertFileName(itr, cnvName);
	}
	else
	{
		TCHAR cnvName[MAX_PATH*2];
		convertFileName(cnvName, filename);
		PathCompactPathEx(itr, filename, len - (itr-buffer), 0);
	}
	return buffer;
}
void ShortcutMapper::translateTab(int index, const TCHAR * newname) {
	if (index < 0 || index > 4)
		return;
	generic_strncpy(tabNames[index], newname, maxTabName);
}