Пример #1
0
void CDlgCalcDlg::OnDigit(UINT nID) 
{
    TCHAR cDigit = (char) nID;

    if (m_bFixPending) {
        m_strFormat.SetAt (3, cDigit - IDC_0 + 0x30);
        DisplayXRegister ();
        m_bFixPending = FALSE;
        m_bStackLiftEnabled = TRUE;
        m_bNewX = TRUE;
        return;
    }

    if (m_bNewX) {
        m_bNewX = FALSE;
        if (m_bStackLiftEnabled) {
            m_bStackLiftEnabled = FALSE;
            LiftStack ();
        }
        m_bDecimalInString = FALSE;
        m_strDisplay.Empty ();
    }

    int nLength = m_strDisplay.GetLength ();
    if ((nLength == MAXCHARS) ||
        ((nLength == (MAXCHARS - 10)) && !m_bDecimalInString))
        ::MessageBeep (MB_ICONASTERISK);
    else {
        m_strDisplay += (cDigit - IDC_0 + 0x30);
        UpdateDisplay (m_strDisplay);
        m_dblStack[0] = _tcstod (m_strDisplay.GetBuffer (0), NULL);
    }
}
Пример #2
0
void CDlgCalcDlg::OnEnter() 
{
    LiftStack ();
    DisplayXRegister ();
    m_bStackLiftEnabled = FALSE;
    m_bNewX = TRUE;
}
Пример #3
0
void ProcessHexCommand(SHORT comm)
{
   double       temp;

    if (bShiftMode) {
        bShiftMode = FALSE;
        WinSetWindowText(hwndSmode, "");

        EntryToStackHex();
        bLift = TRUE;

        switch (comm ) {
        case K_BS: /* CLx */
           if (bError) {
              UpdateDisplay(stack[0]);
           } else {
              UpdateDisplay(0.0);
              bLift = FALSE;
           } /* endif */
           break;
        case K_DOT: /* lastx */
           LiftStack();
           UpdateDisplay(lastx);
           break;
        default:
        }
    } else {
Пример #4
0
void CDlgCalcDlg::OnRecall() 
{
    LiftStack ();
    m_dblStack[0] = m_dblMemory;
    DisplayXRegister ();
    m_bStackLiftEnabled = TRUE;
    m_bNewX = TRUE;
}
Пример #5
0
void CDlgCalcDlg::OnDecimal() 
{
    if (m_bNewX) {
        m_bNewX = FALSE;
        if (m_bStackLiftEnabled) {
            m_bStackLiftEnabled = FALSE;
            LiftStack ();
        }
        m_bDecimalInString = FALSE;
        m_strDisplay.Empty ();
    }

    int nLength = m_strDisplay.GetLength ();
    if ((nLength == MAXCHARS) || (m_bDecimalInString))
        ::MessageBeep (MB_ICONASTERISK);
    else {
        m_bDecimalInString = TRUE;
        m_strDisplay += (char) 0x2E;
        UpdateDisplay (m_strDisplay);
        m_dblStack[0] = strtod (m_strDisplay.GetBuffer (0), NULL);
    }
}