diff --git a/src/apps/deskcalc/CalcView.cpp b/src/apps/deskcalc/CalcView.cpp index bd6006c3f2..fc54589461 100644 --- a/src/apps/deskcalc/CalcView.cpp +++ b/src/apps/deskcalc/CalcView.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -33,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -210,7 +208,6 @@ CalcView::CalcView(BRect frame, rgb_color rgbBaseColor, BMessage* settings) fPopUpMenu(NULL), fAutoNumlockItem(NULL), - fAudioFeedbackItem(NULL), fOptions(new CalcOptions()), fEvaluateThread(-1), fEvaluateMessageRunner(NULL), @@ -249,7 +246,6 @@ CalcView::CalcView(BMessage* archive) fPopUpMenu(NULL), fAutoNumlockItem(NULL), - fAudioFeedbackItem(NULL), fOptions(new CalcOptions()), fEvaluateThread(-1), fEvaluateMessageRunner(NULL), @@ -316,10 +312,6 @@ CalcView::MessageReceived(BMessage* message) ToggleAutoNumlock(); return; - case MSG_OPTIONS_AUDIO_FEEDBACK: - ToggleAudioFeedback(); - return; - case MSG_OPTIONS_ANGLE_MODE_RADIAN: SetDegreeMode(false); return; @@ -810,15 +802,16 @@ CalcView::Copy() { // access system clipboard if (be_clipboard->Lock()) { - be_clipboard->Clear(); - BMessage* clipper = be_clipboard->Data(); - clipper->what = B_MIME_DATA; - // TODO: should check return for errors! - BString expression = fExpressionTextView->Text(); - clipper->AddData("text/plain", B_MIME_TYPE, - expression.String(), expression.Length()); - //clipper->PrintToStream(); - be_clipboard->Commit(); + BMessage* clipper; + if (be_clipboard->Clear() == B_OK + && (clipper = be_clipboard->Data()) == B_OK) { + BString expression = fExpressionTextView->Text(); + if (clipper->AddData("text/plain", B_MIME_TYPE, + expression.String(), expression.Length() == B_OK) { + clipper->what = B_MIME_DATA; + be_clipboard->Commit(); + } + } be_clipboard->Unlock(); } } @@ -953,7 +946,6 @@ CalcView::Evaluate() return; } - _AudioFeedback(false); _SetEnabled(false); // Disable input while we evaluate @@ -995,14 +987,6 @@ CalcView::ToggleAutoNumlock(void) } -void -CalcView::ToggleAudioFeedback(void) -{ - fOptions->audio_feedback = !fOptions->audio_feedback; - fAudioFeedbackItem->SetMarked(fOptions->audio_feedback); -} - - void CalcView::SetDegreeMode(bool degrees) { @@ -1331,8 +1315,6 @@ CalcView::_PressKey(int key) fExpressionTextView->Insert(fKeypad[key].code); } } - - _AudioFeedback(true); } @@ -1379,22 +1361,6 @@ CalcView::_FlashKey(int32 key, uint32 flashFlags) } -void -CalcView::_AudioFeedback(bool inBackGround) -{ - // TODO: Use beep events... This interface is not implemented on Haiku - // anyways... -#if 0 - if (fOptions->audio_feedback) { - BEntry zimp("key.AIFF"); - entry_ref zimp_ref; - zimp.GetRef(&zimp_ref); - play_sound(&zimp_ref, true, false, inBackGround); - } -#endif -} - - void CalcView::_Colorize() { @@ -1429,8 +1395,6 @@ CalcView::_CreatePopUpMenu(bool addKeypadModeMenuItems) // construct items fAutoNumlockItem = new BMenuItem(B_TRANSLATE("Enable Num Lock on startup"), new BMessage(MSG_OPTIONS_AUTO_NUM_LOCK)); - fAudioFeedbackItem = new BMenuItem(B_TRANSLATE("Audio Feedback"), - new BMessage(MSG_OPTIONS_AUDIO_FEEDBACK)); fAngleModeRadianItem = new BMenuItem(B_TRANSLATE("Radians"), new BMessage(MSG_OPTIONS_ANGLE_MODE_RADIAN)); fAngleModeDegreeItem = new BMenuItem(B_TRANSLATE("Degrees"), @@ -1446,7 +1410,6 @@ CalcView::_CreatePopUpMenu(bool addKeypadModeMenuItems) // apply current settings fAutoNumlockItem->SetMarked(fOptions->auto_num_lock); - fAudioFeedbackItem->SetMarked(fOptions->audio_feedback); fAngleModeRadianItem->SetMarked(!fOptions->degree_mode); fAngleModeDegreeItem->SetMarked(fOptions->degree_mode); @@ -1454,9 +1417,6 @@ CalcView::_CreatePopUpMenu(bool addKeypadModeMenuItems) fPopUpMenu = new BPopUpMenu("pop-up", false, false); fPopUpMenu->AddItem(fAutoNumlockItem); - // TODO: Enable this when we use beep events which can be configured - // in the Sounds preflet. - //fPopUpMenu->AddItem(fAudioFeedbackItem); fPopUpMenu->AddSeparatorItem(); fPopUpMenu->AddItem(fAngleModeRadianItem); fPopUpMenu->AddItem(fAngleModeDegreeItem); diff --git a/src/apps/deskcalc/CalcView.h b/src/apps/deskcalc/CalcView.h index ed61313309..391d38a649 100644 --- a/src/apps/deskcalc/CalcView.h +++ b/src/apps/deskcalc/CalcView.h @@ -18,7 +18,6 @@ enum { MSG_OPTIONS_AUTO_NUM_LOCK = 'oanl', - MSG_OPTIONS_AUDIO_FEEDBACK = 'oafb', MSG_OPTIONS_ANGLE_MODE_RADIAN = 'oamr', MSG_OPTIONS_ANGLE_MODE_DEGREE = 'oamd', MSG_OPTIONS_KEYPAD_MODE_COMPACT = 'okmc', @@ -87,10 +86,6 @@ class CalcView : public BView { // Toggle whether or not the Num Lock key starts on void ToggleAutoNumlock(void); - // Toggle whether or not to provide audio feedback - // (option currently disabled) - void ToggleAudioFeedback(void); - // Set the angle mode to degrees or radians void SetDegreeMode(bool degrees); @@ -107,7 +102,6 @@ class CalcView : public BView { void _PressKey(const char* label); int32 _KeyForLabel(const char* label) const; void _FlashKey(int32 key, uint32 flashFlags); - void _AudioFeedback(bool inBackGround); void _Colorize(); @@ -156,7 +150,6 @@ class CalcView : public BView { // pop-up context menu. BPopUpMenu* fPopUpMenu; BMenuItem* fAutoNumlockItem; - BMenuItem* fAudioFeedbackItem; BMenuItem* fAngleModeRadianItem; BMenuItem* fAngleModeDegreeItem;