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); } }
void CDlgCalcDlg::OnEnter() { LiftStack (); DisplayXRegister (); m_bStackLiftEnabled = FALSE; m_bNewX = TRUE; }
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 {
void CDlgCalcDlg::OnRecall() { LiftStack (); m_dblStack[0] = m_dblMemory; DisplayXRegister (); m_bStackLiftEnabled = TRUE; m_bNewX = TRUE; }
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); } }