コード例 #1
0
//*****************************************************************************	
bool CCeWatchElement::WriteData(CStdioFile& file) const
//*****************************************************************************	
{
	// don't forget to increment the version string if you change anything here
	bool rv = false;
	CString str;

    str = CEWATCH_EXP_NAME + m_Name + CEWATCH_EXP_CRLF;
	file.WriteString(str);

	if (m_Type.GetName().GetLength() > 0)
	{
		str.Format(";%d", (int)m_Type.GetVarKind());
		file.WriteString(m_Type.GetName() + str);
	}
	file.WriteString(CEWATCH_EXP_CRLF);

    str = CEWATCH_EXP_VAL + m_strValue + CEWATCH_EXP_CRLF;
    file.WriteString(str);

	if (m_strFormat.GetLength() > 0)
		file.WriteString(m_strFormat);
	file.WriteString(CEWATCH_EXP_CRLF);

	str.Format("%d", GetHistoryCount());
    str += CEWATCH_EXP_CRLF;
	file.WriteString(str);
	for (int ii = 0; ii < GetHistoryCount(); ii++)
		file.WriteString(GetHistory(ii) + CEWATCH_EXP_CRLF);

	str.Format("%d", GetChildrenCount());
    str += CEWATCH_EXP_CRLF;

	file.WriteString(str);
	rv = true;
	for (ii = 0; ii < GetChildrenCount() && rv; ii++)
		rv &= GetChild(ii)->WriteData(file);

	return rv;;
}
コード例 #2
0
void CCommandLineDisplay::InputHistoryUp (void)

//	InputHistoryUp
//
//	Recalls a line from the history buffer

	{
	if (m_iHistoryIndex < (GetHistoryCount()-1))
		{
		m_iHistoryIndex++;
		m_sInput = GetHistory(m_iHistoryIndex);
		m_iCursorPos = m_sInput.GetLength();
		m_bInvalid = true;
		}
	}
コード例 #3
0
ファイル: shop_imp.cpp プロジェクト: quinsmpang/phone-code
bool CommonBuy(SUser *p_user, CVendibleData::SData *p_data, uint32 count, uint32 path)
{
    // 每日限购
    if (p_data->daily_limit_count > 0 && GetDailyCount(p_user, p_data->id) + count > p_data->daily_limit_count)
        return false;
    // 历史限购
    if (p_data->history_limit_count > 0 && GetHistoryCount(p_user, p_data->id) + count > p_data->history_limit_count)
        return false;

    if (!Buy(p_user, p_data, count, path))
        return false;

    // 添加购买记录
    AddBuyCount(p_user, p_data, count);
    return true;
}
コード例 #4
0
ファイル: steshell.cpp プロジェクト: Aetherdyne/glintercept
void wxSTEditorShell::OnKeyDown(wxKeyEvent &event)
{
    event.Skip(false);
    CheckReadOnly(true);

    switch (event.GetKeyCode())
    {
        case WXK_UP : case WXK_NUMPAD_UP :
        {
            // you can scroll up through multiline entry
            int current_line = GetCurrentLine();
            int prompt_line = GetPromptLine();
            if ((current_line < prompt_line) || (current_line > prompt_line))
                break;

            // up/down arrows go through the history buffer
            wxString promptText = GetPromptText();
            SetPromptText(GetNextHistoryLine(event.GetKeyCode() == WXK_DOWN, promptText));
            return;
        }
        case WXK_DOWN : case WXK_NUMPAD_DOWN :
        {
            // you can scroll down through multiline entry
            int total_lines = GetLineCount();
            total_lines = wxMax(0, total_lines - 1);
            int current_line = GetCurrentLine();
            if (current_line < total_lines)
                break;

            // up/down arrows go through the history buffer
            if ((int)GetHistoryIndex() < (int)GetHistoryCount()-1)
            {
                wxString promptText = GetPromptText();
                SetPromptText(GetNextHistoryLine(event.GetKeyCode() == WXK_DOWN, promptText));
            }
            return;
        }
        case WXK_LEFT : case WXK_NUMPAD_LEFT :
        {
            int current_line = GetCurrentLine();
            int prompt_line = GetPromptLine();
            if (current_line >= prompt_line)
            {
                int caret_pos = 0;
                GetCurLine(&caret_pos);
                if (caret_pos < 1)
                    return;
            }
            break;
        }

        case WXK_PRIOR : case WXK_NUMPAD_PRIOR : //case WXK_NUMPAD_PAGEUP :
        case WXK_NEXT  : case WXK_NUMPAD_NEXT  : //case WXK_NUMPAD_PAGEDOWN :
        case WXK_END   : case WXK_NUMPAD_END   :
        case WXK_HOME  : case WXK_NUMPAD_HOME  :
        case WXK_RIGHT : case WXK_NUMPAD_RIGHT :

        case WXK_SHIFT :
        case WXK_CONTROL :
        case WXK_ALT :
        {
            // default processing for these keys
            event.Skip();
            return;
        }

        case WXK_RETURN : case WXK_NUMPAD_ENTER :
        {
            // put cursor at end if not already on the last line
            if (!CaretOnPromptLine(STE_CARET_MOVE_NONE))
            {
                GotoPos(GetLength());
                return;
            }

            int current_line = GetCurrentLine();
            int prompt_line = GetPromptLine();

            // allow multiline entry for shift+enter
            if ((current_line >= prompt_line) && event.ShiftDown())
            {
                event.Skip();
                return;
            }

            wxString promptText = GetPromptText();

            // goto the end of the line and store the line for the history
            LineEnd();
            if (!promptText.IsEmpty())
                AddHistoryLine(promptText, true);

            // just send the event, the receiver can do what they like
            SendEvent(wxEVT_STESHELL_ENTER, 0, GetState(), promptText);
            return;
        }
        case WXK_BACK :
        {
            // go to the end of the last line if not on last line
            if (!CaretOnPromptLine(STE_CARET_MOVE_NONE))
            {
                GotoPos(GetLength());
                return;
            }
            // don't let them backspace into previous line
            int caret_pos = 0;
            GetCurLine(&caret_pos);
            if (caret_pos < 1)
                return;

            break;
        }
        default : // move cursor to end if not already there
        {
            CaretOnPromptLine(STE_CARET_MOVE_ENDTEXT);
            break;
        }
    }

    event.Skip();
}