Exemplo n.º 1
0
Wt::WWidget *FormWidgets::autoComplete()
{
  Wt::WTemplate *result = new TopicTemplate("forms-autoComplete");
  result->bindWidget("AutoComplete", AutoComplete());

  return result;
}
Exemplo n.º 2
0
BOOL CIrcWnd::PreTranslateMessage(MSG* pMsg) 
{
	if(pMsg->message == WM_KEYDOWN && (pMsg->hwnd == GetDlgItem(IDC_INPUTWINDOW)->m_hWnd)) {
		if (pMsg->wParam == VK_RETURN) 
		{
			//If we press the enter key, treat is as if we pressed the send button.
			OnBnClickedChatsend();
			return TRUE;
		}

		if (pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN) 
		{
			//If we press page up/down scroll..
			m_channelselect.ScrollHistory(pMsg->wParam == VK_DOWN);
			return TRUE;
		}

		if (pMsg->wParam == VK_TAB )
		{
			AutoComplete();
			return true;
		}
	}
	OnChatTextChange();
	return CResizableDialog::PreTranslateMessage(pMsg);
}
Exemplo n.º 3
0
BOOL CIrcWnd::PreTranslateMessage(MSG* pMsg)
{
	if (pMsg->message == WM_KEYDOWN)
	{
		// Don't handle Ctrl+Tab in this window. It will be handled by main window.
		if (pMsg->wParam == VK_TAB && GetAsyncKeyState(VK_CONTROL) < 0)
			return FALSE;

		if (pMsg->hwnd == m_wndInput)
		{
			if (pMsg->wParam == VK_RETURN)
			{
				//If we press the enter key, treat is as if we pressed the send button.
				OnBnClickedIrcSend();
				return TRUE;
			}

			if (pMsg->wParam == VK_UP || pMsg->wParam == VK_DOWN)
			{
				//If we press page up/down scroll..
				m_wndChanSel.ScrollHistory(pMsg->wParam == VK_DOWN);
				return TRUE;
			}

			if (pMsg->wParam == VK_TAB)
			{
				AutoComplete();
				return TRUE;
			}
		}
	}
	OnChatTextChange();
	return CResizableDialog::PreTranslateMessage(pMsg);
}
Exemplo n.º 4
0
void FontFaceCtrl::OnSetFocus(wxFocusEvent & evt)
{
    evt.Skip();
    // Set the combobox list contents
    wxCriticalSectionLocker lock(s_fontCS);
    wxString value = GetValue();
    Set(s_facenames);
    AutoComplete(s_facenames);
    wxComboBox::SetValue(value);
    if (s_threadComplete)
        Unbind(wxEVT_SET_FOCUS, &FontFaceCtrl::OnSetFocus, this);
}
Exemplo n.º 5
0
void EditControl::Changed(bool DelBlock)
{
	m_Flags.Set(FEDITLINE_CMP_CHANGED);
	if(m_Callback.Active)
	{
		if(m_Callback.m_Callback)
		{
			m_Callback.m_Callback(m_Callback.m_Param);
		}
		AutoComplete(false, DelBlock);
	}
}
Exemplo n.º 6
0
void MessageWndEdit::KeyPress(GG::Key key, boost::uint32_t key_code_point,
                              GG::Flags<GG::ModKey> mod_keys)
{
    switch (key) {
    case GG::GGK_TAB: 
        AutoComplete();
        break;
    case GG::GGK_RETURN:
    case GG::GGK_KP_ENTER:
        TextEnteredSignal();
        break;
    case GG::GGK_UP:
        UpPressedSignal();
        break;
    case GG::GGK_DOWN:
        DownPressedSignal();
        break;
    default:
        break;
    }
    Edit::KeyPress(key, key_code_point, mod_keys);
}
Exemplo n.º 7
0
void CGameGUIFileDialog::OnKeyDown(int nKey,bool *pbProcessed)
{
	if(nKey==GK_RETURN){ProcessSelect();*pbProcessed=true;}
	if(nKey==GK_ESCAPE){EndDialog(DIALOG_CANCEL);*pbProcessed=true;}
	if(nKey=='\t'){AutoComplete();*pbProcessed=true;}
}
Exemplo n.º 8
0
int32_t SHELL_Main(p_shell_context_t context)
{
    uint8_t ch;
    int32_t i;

    if (!context)
    {
        return -1;
    }

    context->exit = false;
    context->printf_data_func("\r\nSHELL (build: %s)\r\n", __DATE__);
    context->printf_data_func("Copyright (c) 2015 Freescale Semiconductor\r\n");
    context->printf_data_func(context->prompt);

    while (1)
    {
        if (context->exit)
        {
            break;
        }
        ch = GetChar(context);
        /* Special key */
        if (ch == KEY_ESC)
        {
            context->stat = kSHELL_Special;
            continue;
        }
        else if (context->stat == kSHELL_Special)
        {
            /* Function key */
            if (ch == '[')
            {
                context->stat = kSHELL_Function;
                continue;
            }
            context->stat = kSHELL_Normal;
        }
        else if (context->stat == kSHELL_Function)
        {
            context->stat = kSHELL_Normal;

            switch ((uint8_t)ch)
            {
                /* History operation here */
                case 'A': /* Up key */
                    GetHistoryCommand(context, context->hist_current);
                    if (context->hist_current < (context->hist_count - 1))
                    {
                        context->hist_current++;
                    }
                    break;
                case 'B': /* Down key */
                    GetHistoryCommand(context, context->hist_current);
                    if (context->hist_current > 0)
                    {
                        context->hist_current--;
                    }
                    break;
                case 'D': /* Left key */
                    if (context->c_pos)
                    {
                        context->printf_data_func("\b");
                        context->c_pos--;
                    }
                    break;
                case 'C': /* Right key */
                    if (context->c_pos < context->l_pos)
                    {
                        context->printf_data_func("%c", context->line[context->c_pos]);
                        context->c_pos++;
                    }
                    break;
                default:
                    break;
            }
            continue;
        }
        /* Handle tab key */
        else if (ch == '\t')
        {
#if SHELL_AUTO_COMPLETE
            /* Move the cursor to the beginning of line */
            for (i = 0; i < context->c_pos; i++)
            {
                context->printf_data_func("\b");
            }
            /* Do auto complete */
            AutoComplete(context);
            /* Move position to end */
            context->c_pos = context->l_pos = StrLen(context->line);
#endif
            continue;
        }
#if SHELL_SEARCH_IN_HIST
        /* Search command in history */
        else if ((ch == '`') && (context->l_pos == 0) && (context->line[0] == 0x00))
        {
        }
#endif
        /* Handle backspace key */
        else if ((ch == KET_DEL) || (ch == '\b'))
        {
            /* There must be at last one char */
            if (context->c_pos == 0)
            {
                continue;
            }

            context->l_pos--;
            context->c_pos--;

            if (context->l_pos > context->c_pos)
            {
                memmove(&context->line[context->c_pos], &context->line[context->c_pos + 1],
                        context->l_pos - context->c_pos);
                context->line[context->l_pos] = 0;
                context->printf_data_func("\b%s  \b", &context->line[context->c_pos]);

                /* Reset position */
                for (i = context->c_pos; i <= context->l_pos; i++)
                {
                    context->printf_data_func("\b");
                }
            }
            else /* Normal backspace operation */
            {
                context->printf_data_func("\b \b");
                context->line[context->l_pos] = 0;
            }
            continue;
        }
        else
        {
        }

        /* Input too long */
        if (context->l_pos >= (SHELL_BUFFER_SIZE - 1))
        {
            context->l_pos = 0;
        }

        /* Handle end of line, break */
        if ((ch == '\r') || (ch == '\n'))
        {
            context->printf_data_func("\r\n");
            ProcessCommand(context, context->line);
            /* Reset all params */
            context->c_pos = context->l_pos = 0;
            context->hist_current = 0;
            context->printf_data_func(context->prompt);
            memset(context->line, 0, sizeof(context->line));
            continue;
        }

        /* Normal character */
        if (context->c_pos < context->l_pos)
        {
            memmove(&context->line[context->c_pos + 1], &context->line[context->c_pos],
                    context->l_pos - context->c_pos);
            context->line[context->c_pos] = ch;
            context->printf_data_func("%s", &context->line[context->c_pos]);
            /* Move the cursor to new position */
            for (i = context->c_pos; i < context->l_pos; i++)
            {
                context->printf_data_func("\b");
            }
        }
        else
        {
            context->line[context->l_pos] = ch;
            context->printf_data_func("%c", ch);
        }

        ch = 0;
        context->l_pos++;
        context->c_pos++;
    }
    return 0;
}
Exemplo n.º 9
0
bool mmConsole::mmClient::Aggregate(wchar_t const p_cCurrent) {
    if(p_cCurrent == cNavTrigger1 || p_cCurrent == cNavTrigger2) {
        wchar_t v_cDirection = ::_getwch();
        if(v_cDirection == cNavUp && m_sPositionInHistory != m_sHistory.begin()) {
            m_bNavigate = true;

            EraseToPrompt();

            --m_sPositionInHistory;
            Write(m_sPositionInHistory->Print(cEndOfWord, cEscape));
        } else if(v_cDirection == cNavDown && m_sPositionInHistory != m_sHistory.end()) {
            m_bNavigate = true;

            EraseToPrompt();

            ++m_sPositionInHistory;
            if(m_sPositionInHistory != m_sHistory.end())
                Write(m_sPositionInHistory->Print(cEndOfWord, cEscape));
            else
                Write(m_sCommandLine.Print(cEndOfWord, cEscape));
        }
    } else {
        if(m_bNavigate) {
            if(m_sPositionInHistory != m_sHistory.end()) {
                m_sCommandLine = *m_sPositionInHistory;
                m_sPositionInHistory = m_sHistory.end();
            }
            m_bNavigate = false;
        }
    }

    if(p_cCurrent == cEndOfWord) {
        m_sCommandLine.AddParam();
        Write(p_cCurrent);
    } else if(p_cCurrent == cEndOfLine) {
        // optionally find method if not found
        std::vector<std::wstring> v_sCommandLineElements = m_sCommandLine.GetParams();
        if(m_psCommand == NULL)
            m_psCommand = FindCommand(v_sCommandLineElements.front());
        // print new line
        NewLine();
        // interpret command
        if(m_psCommand != NULL) {
            std::vector<mmCommands::mmParam> v_sExpectedParams = m_psCommand->GetInputParams();
            std::vector<std::wstring> v_sReceivedParams(v_sCommandLineElements.empty() ? v_sCommandLineElements.begin() : (v_sCommandLineElements.begin() + 1), v_sCommandLineElements.end());
            if(! ValidateParams(v_sReceivedParams, v_sExpectedParams)) {
                WriteLn(m_psCommand->GetInfo());
            } else if(! m_psCommand->Run(v_sCommandLineElements.front(), v_sExpectedParams)) {
                WriteLn(L"error: " + m_psCommand->GetErrorMessage());
            }
        } else {
            WriteLn(v_sCommandLineElements.front() + L": command not found");
        }
        // clear command
        m_psCommand = NULL;
        m_sHistory.push_back(m_sCommandLine);
        m_sCommandLine = mmCommandLine();
        // reset current position in history
        m_sPositionInHistory = m_sHistory.end();
        // display prompt
        DisplayPrompt();
    } else if(p_cCurrent == cAutoComplete) {
        // run autocomplete for current context
        if(! AutoComplete()) {
            // display prompt
            DisplayPrompt();
        }
        // echo all
        Write(m_sCommandLine.Print(cEndOfWord, cEscape));
    } else if(p_cCurrent == cBackSpace) {
        bool v_bSuccess = false;
        if(! m_sCommandLine.IsParamEmpty())
            v_bSuccess = m_sCommandLine.EraseFromParam();
        else
            v_bSuccess = m_sCommandLine.EraseParam();
        if(v_bSuccess) {
            Write(cBackSpace);
            Write(L' ');
            Write(cBackSpace);
        }
    } else if(IsAllowedCharacter(p_cCurrent)) {
        m_sCommandLine.AddToParam(p_cCurrent);
        Write(p_cCurrent);
    }

    return true;
}