コード例 #1
0
void CEquationEditorWindow::OnWmCommand( WPARAM wParam, LPARAM lParam )
{
	CCaret caret;
	if( HIWORD( wParam ) == 1 ) {
		switch( LOWORD( wParam ) ) {
			case ID_ACC_SQRBRAC:
				presenter->AddControlView( SQUAREBRACKETS );
				break;
			case ID_ACC_BRAC:
				presenter->AddControlView( BRACES );
				break;
			case ID_ACC_PAR:
				presenter->AddControlView( PARENTHESES );
				break;
			case ID_ACC_DEGR:
				presenter->AddControlView( DEGR );
				break;
			case ID_ACC_FRAC:
				presenter->AddControlView( FRAC );
				break;
			case ID_SHIFT_LEFT:
				caret = presenter->GetCaret();
				caret.GetCurEdit()->MoveCaretLeft( caret.GetCurEdit().get(), caret );
				presenter->SetSelection( caret.GetPointX(), caret.GetPointY() );
				break;
			case ID_SHIFT_RIGHT:
				caret = presenter->GetCaret();
				caret.GetCurEdit()->MoveCaretRight( caret.GetCurEdit().get(), caret );
				presenter->SetSelection( caret.GetPointX(), caret.GetPointY() );
				break;
			default:
				return;
		}
	} else if( HIWORD( wParam ) == 0 ) {
		switch( LOWORD( wParam ) ) {
			case ID_ADD_FRAC:
				presenter->AddControlView( FRAC );
				break;
			case ID_ADD_DEGR:
				presenter->AddControlView( DEGR );
				break;
			case ID_ADD_SUBSCRIPT:
				presenter->AddControlView( SUBSCRIPT );
				break;
			case ID_ADD_RADICAL:
				presenter->AddControlView( RADICAL );
				break;
			case ID_ADD_PARANTHESES:
				presenter->AddControlView( PARENTHESES );
				break;
			case ID_ADD_BRACES:
				presenter->AddControlView( BRACES );
				break;
			case ID_ADD_SQUAREBRACKETS:
				presenter->AddControlView( SQUAREBRACKETS );
				break;
			case ID_ADD_SUM:
				presenter->AddControlView( SUM );
				break;
			case ID_ADD_PRODUCT:
				presenter->AddControlView( PRODUCT );
				break;
			case ID_ADD_SYSTEM:
				presenter->AddControlView( SYSTEM );
				break;
		case ID_ADD_SAVE:
			presenter->Serialize();
			break;
		}
	}
}
コード例 #2
0
void CEquationEditorWindow::OnWmCommand( WPARAM wParam, LPARAM lParam )
{
	CCaret caret;
	if( HIWORD( wParam ) == 1 ) {
		switch( LOWORD( wParam ) ) {
			case ID_ACC_SQRBRAC:
				presenter->AddControlView( SQUAREBRACKETS );
				break;
			case ID_ACC_BRAC:
				presenter->AddControlView( BRACES );
				break;
			case ID_ACC_PAR:
				presenter->AddControlView( PARENTHESES );
				break;
			case ID_ACC_DEGR:
				presenter->AddControlView( DEGR );
				break;
			case ID_ACC_FRAC:
				presenter->AddControlView( FRAC );
				break;
			case ID_SHIFT_LEFT:
				caret = presenter->GetCaret();
				caret.GetCurEdit()->MoveCaretLeft( caret.GetCurEdit().get(), caret );
				presenter->SetSelection( caret.GetPointX(), caret.GetPointY() );
				break;
			case ID_SHIFT_RIGHT:
				caret = presenter->GetCaret();
				caret.GetCurEdit()->MoveCaretRight( caret.GetCurEdit().get(), caret );
				presenter->SetSelection( caret.GetPointX(), caret.GetPointY() );
				break;
			default:
				return;
		}
	} else if( HIWORD( wParam ) == 0 ) {
		switch( LOWORD( wParam ) ) {
			case ID_ADD_FRAC:
				presenter->AddControlView( FRAC );
				break;
			case ID_ADD_DEGR:
				presenter->AddControlView( DEGR );
				break;
			case ID_ADD_SUBSCRIPT:
				presenter->AddControlView( SUBSCRIPT );
				break;
			case ID_ADD_RADICAL:
				presenter->AddControlView( RADICAL );
				break;
			case ID_ADD_PARANTHESES:
				presenter->AddControlView( PARENTHESES );
				break;
			case ID_ADD_BRACES:
				presenter->AddControlView( BRACES );
				break;
			case ID_ADD_SQUAREBRACKETS:
				presenter->AddControlView( SQUAREBRACKETS );
				break;
			case ID_ADD_SUM:
				presenter->AddControlView( SUM );
				break;
			case ID_ADD_PRODUCT:
				presenter->AddControlView( PRODUCT );
				break;
            case ID_ZOOM_IN:
                Zoom( true );
                break;
            case ID_ZOOM_OUT:
                Zoom( false );
                break;
			case ID_ADD_SYSTEM:
				presenter->AddControlView( SYSTEM );
				break;
			case ID_ADD_Validator:
				CEquationEditorWindow::ValidateFormula();
				break;
            case ID_DRAW_GRAPH:
                DrawGraph();
                break;
		    case ID_ADD_SAVE:
			    SaveToFile();
			    break;
		}
        OnZoom();
	}
}