diff options
| author | John Scipione <jscipione@gmail.com> | 2012-07-31 08:01:32 -0400 |
|---|---|---|
| committer | John Scipione <jscipione@gmail.com> | 2012-07-31 08:01:32 -0400 |
| commit | fa37d94d1bd5b2c559f1ab1cac40826a945cec9c (patch) | |
| tree | b56f48db1e2f1b9c1b487a759563e3cfc484e4b1 | |
| parent | bd97ee39e0e93fe8c7774d89e411de8b85ad0cbf (diff) | |
Fix radian/degree mode toggling bug in Deskcalchrev44445
I overlooked this problem in my last commit...
If you select the current angle (radian/degree) mode from the menu
it toggles the angle mode, fixed this to make it keep the current
mode.
| -rw-r--r-- | src/apps/deskcalc/CalcView.cpp | 20 | ||||
| -rw-r--r-- | src/apps/deskcalc/CalcView.h | 7 | ||||
| -rw-r--r-- | src/apps/deskcalc/CalcWindow.cpp | 10 |
3 files changed, 23 insertions, 14 deletions
diff --git a/src/apps/deskcalc/CalcView.cpp b/src/apps/deskcalc/CalcView.cpp index eba3f4f414..0f17810376 100644 --- a/src/apps/deskcalc/CalcView.cpp +++ b/src/apps/deskcalc/CalcView.cpp @@ -245,8 +245,12 @@ CalcView::MessageReceived(BMessage* message) ToggleAudioFeedback(); return; - case MSG_OPTIONS_ANGLE_MODE: - ToggleAngleMode(); + case MSG_OPTIONS_ANGLE_MODE_RADIAN: + SetDegreeMode(false); + return; + + case MSG_OPTIONS_ANGLE_MODE_DEGREE: + SetDegreeMode(true); return; } } @@ -977,11 +981,11 @@ CalcView::ToggleAudioFeedback(void) void -CalcView::ToggleAngleMode(void) +CalcView::SetDegreeMode(bool degrees) { - fOptions->degree_mode = !fOptions->degree_mode; - fAngleModeRadianItem->SetMarked(!fOptions->degree_mode); - fAngleModeDegreeItem->SetMarked(fOptions->degree_mode); + fOptions->degree_mode = degrees; + fAngleModeRadianItem->SetMarked(!degrees); + fAngleModeDegreeItem->SetMarked(degrees); } @@ -1273,9 +1277,9 @@ CalcView::_CreatePopUpMenu(bool addKeypadModeMenuItems) fAudioFeedbackItem = new BMenuItem(B_TRANSLATE("Audio Feedback"), new BMessage(MSG_OPTIONS_AUDIO_FEEDBACK)); fAngleModeRadianItem = new BMenuItem(B_TRANSLATE("Radian Mode"), - new BMessage(MSG_OPTIONS_ANGLE_MODE)); + new BMessage(MSG_OPTIONS_ANGLE_MODE_RADIAN)); fAngleModeDegreeItem = new BMenuItem(B_TRANSLATE("Degree Mode"), - new BMessage(MSG_OPTIONS_ANGLE_MODE)); + new BMessage(MSG_OPTIONS_ANGLE_MODE_DEGREE)); if (addKeypadModeMenuItems) { fKeypadModeCompactItem = new BMenuItem(B_TRANSLATE("Compact"), new BMessage(MSG_OPTIONS_KEYPAD_MODE_COMPACT), '0'); diff --git a/src/apps/deskcalc/CalcView.h b/src/apps/deskcalc/CalcView.h index 2c61fe7dc2..f5ffa063fa 100644 --- a/src/apps/deskcalc/CalcView.h +++ b/src/apps/deskcalc/CalcView.h @@ -16,7 +16,8 @@ enum { MSG_OPTIONS_AUTO_NUM_LOCK = 'oanl', MSG_OPTIONS_AUDIO_FEEDBACK = 'oafb', - MSG_OPTIONS_ANGLE_MODE = 'oamd', + MSG_OPTIONS_ANGLE_MODE_RADIAN = 'oamr', + MSG_OPTIONS_ANGLE_MODE_DEGREE = 'oamd', MSG_OPTIONS_KEYPAD_MODE_COMPACT = 'okmc', MSG_OPTIONS_KEYPAD_MODE_BASIC = 'okmb', MSG_OPTIONS_KEYPAD_MODE_SCIENTIFIC = 'okms', @@ -91,8 +92,8 @@ class CalcView : public BView { // (option currently disabled) void ToggleAudioFeedback(void); - // Toggle radian/degree mode - void ToggleAngleMode(void); + // Set the angle mode to degrees or radians + void SetDegreeMode(bool degrees); // Set the keypad mode void SetKeypadMode(uint8 mode); diff --git a/src/apps/deskcalc/CalcWindow.cpp b/src/apps/deskcalc/CalcWindow.cpp index f91d0d49fc..d8abc593e8 100644 --- a/src/apps/deskcalc/CalcWindow.cpp +++ b/src/apps/deskcalc/CalcWindow.cpp @@ -88,9 +88,13 @@ CalcWindow::MessageReceived(BMessage* message) fCalcView->ToggleAudioFeedback(); break; - case MSG_OPTIONS_ANGLE_MODE: - fCalcView->ToggleAngleMode(); - break; + case MSG_OPTIONS_ANGLE_MODE_RADIAN: + fCalcView->SetDegreeMode(false); + return; + + case MSG_OPTIONS_ANGLE_MODE_DEGREE: + fCalcView->SetDegreeMode(true); + return; case MSG_OPTIONS_KEYPAD_MODE_COMPACT: fCalcView->SetKeypadMode(KEYPAD_MODE_COMPACT); |
