1 /* 2 * Copyright 2006-2012 Haiku, Inc. All Rights Reserved. 3 * Copyright 1997, 1998 R3 Software Ltd. All Rights Reserved. 4 * Distributed under the terms of the MIT License. 5 * 6 * Authors: 7 * Stephan Aßmus, superstippi@gmx.de 8 * John Scipione, jscipione@gmail.com 9 * Timothy Wayper, timmy@wunderbear.com 10 */ 11 12 13 #include "CalcOptions.h" 14 15 #include <stdlib.h> 16 #include <stdio.h> 17 18 #include <Message.h> 19 20 21 CalcOptions::CalcOptions() 22 : 23 auto_num_lock(false), 24 audio_feedback(false), 25 degree_mode(false), 26 keypad_mode(KEYPAD_MODE_BASIC) 27 { 28 } 29 30 31 void 32 CalcOptions::LoadSettings(const BMessage* archive) 33 { 34 bool option; 35 uint8 keypad_mode_option; 36 37 if (archive->FindBool("auto num lock", &option) == B_OK) 38 auto_num_lock = option; 39 40 if (archive->FindBool("audio feedback", &option) == B_OK) 41 audio_feedback = option; 42 43 if (archive->FindBool("degree mode", &option) == B_OK) 44 degree_mode = option; 45 46 if (archive->FindUInt8("keypad mode", &keypad_mode_option) == B_OK) 47 keypad_mode = keypad_mode_option; 48 } 49 50 51 status_t 52 CalcOptions::SaveSettings(BMessage* archive) const 53 { 54 status_t ret = archive->AddBool("auto num lock", auto_num_lock); 55 56 if (ret == B_OK) 57 ret = archive->AddBool("audio feedback", audio_feedback); 58 59 if (ret == B_OK) 60 ret = archive->AddBool("degree mode", degree_mode); 61 62 if (ret == B_OK) 63 ret = archive->AddUInt8("keypad mode", keypad_mode); 64 65 return ret; 66 } 67