Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DasherSettingsInterface.cpp

Go to the documentation of this file.
00001 // DasherSettingsInterface.cpp
00002 //
00004 //
00005 // Copyright (c) 2002 Iain Murray
00006 //
00008 
00009 #include <iostream>
00010 
00011 #include "DasherSettingsInterface.h"
00012 
00013 namespace Dasher{
00014 namespace Keys {
00015         // Standard Option strings. You are encouraged to use these constants.
00016         // -------------------------------------------------------------------
00017         
00018         // bool options
00019         const std::string TIME_STAMP = "TimeStampNewFiles";
00020         const std::string SHOW_TOOLBAR = "ViewToolbar";
00021         const std::string SHOW_TOOLBAR_TEXT = "ShowToolbarText";
00022         const std::string SHOW_LARGE_ICONS = "ShowLargeIcons";
00023         const std::string FIX_LAYOUT = "FixLayout";
00024         const std::string SHOW_SLIDER = "ShowSpeedSlider";
00025         const std::string COPY_ALL_ON_STOP = "CopyAllOnStop";
00026         const std::string DRAW_MOUSE = "DrawMouse";
00027         const std::string START_MOUSE = "StartOnLeft";
00028         const std::string START_SPACE = "StartOnSpace";
00029         const std::string KEY_CONTROL = "KeyControl";
00030         const std::string WINDOW_PAUSE = "PauseOutsideWindow";
00031 
00032         // long options
00033         const std::string FILE_ENCODING = "FileEncodingFormat";
00034         const std::string MAX_BITRATE_TIMES100 = "MaxBitRateTimes100";
00035         const std::string SCREEN_ORIENTATION = "ScreenOrientation";
00036         const std::string VIEW_ID = "ViewID";
00037         const std::string LANGUAGE_MODEL_ID = "LanguageModelID";
00038         const std::string EDIT_FONT_SIZE = "EditFontSize";
00039         const std::string EDIT_HEIGHT = "EditHeight";
00040         const std::string SCREEN_WIDTH = "ScreenWidth";
00041         const std::string SCREEN_HEIGHT = "ScreenHeight";
00042         const std::string DASHER_FONTSIZE = "DasherFontSize";
00043         const std::string DASHER_DIMENSIONS = "NumberDimensions";
00044 
00045         // string options
00046         const std::string ALPHABET_ID = "AlphabetID";
00047         const std::string DASHER_FONT = "DasherFont";
00048         const std::string EDIT_FONT = "EditFont";
00049 }
00050 }
00051 
00052 
00053 void Dasher::CDasherSettingsInterface::SettingsDefaults(CSettingsStore* Store)
00054 {
00055         using namespace Dasher;
00056         using namespace Keys;
00057         using namespace Opts;
00058         
00059         Store->SetLongDefault(MAX_BITRATE_TIMES100, 150);
00060         this->ChangeMaxBitRate(Store->GetLongOption(MAX_BITRATE_TIMES100)/100.0);
00061         
00062         Store->SetBoolDefault(TIME_STAMP, true);
00063         this->TimeStampNewFiles(Store->GetBoolOption(TIME_STAMP));
00064         Store->SetBoolDefault(COPY_ALL_ON_STOP, false);
00065         this->CopyAllOnStop(Store->GetBoolOption(COPY_ALL_ON_STOP));
00066 
00067         Store->SetBoolDefault(DRAW_MOUSE, false);
00068         this->DrawMouse(Store->GetBoolOption(DRAW_MOUSE));
00069 
00070         Store->SetLongDefault(FILE_ENCODING, AlphabetDefault);
00071         this->SetFileEncoding((FileEncodingFormats) Store->GetLongOption(FILE_ENCODING));
00072         
00073         Store->SetBoolDefault(SHOW_SLIDER, true);
00074         this->ShowSpeedSlider(Store->GetBoolOption(SHOW_SLIDER));
00075         Store->SetBoolDefault(FIX_LAYOUT, false);
00076         this->FixLayout(Store->GetBoolOption(FIX_LAYOUT));
00077         
00078         // Toolbar defaults
00079         Store->SetBoolDefault(SHOW_TOOLBAR_TEXT, true);
00080         this->ShowToolbarText(Store->GetBoolOption(SHOW_TOOLBAR_TEXT));
00081         Store->SetBoolDefault(SHOW_LARGE_ICONS, true);
00082         this->ShowToolbarLargeIcons(Store->GetBoolOption(SHOW_LARGE_ICONS));
00083 
00084         Store->SetBoolDefault(SHOW_TOOLBAR, true);
00085         this->ShowToolbar(Store->GetBoolOption(SHOW_TOOLBAR));
00086 
00087         Store->SetLongDefault(SCREEN_ORIENTATION, Opts::LeftToRight);
00088         this->ChangeOrientation((ScreenOrientations) Store->GetLongOption(SCREEN_ORIENTATION));
00089         
00090         Store->SetBoolDefault(START_MOUSE, true);
00091         this->StartOnLeft(Store->GetBoolOption(START_MOUSE));
00092 
00093         Store->SetBoolDefault(START_SPACE, false);
00094         this->StartOnSpace(Store->GetBoolOption(START_SPACE));
00095 
00096         Store->SetBoolDefault(KEY_CONTROL, false);
00097         this->KeyControl(Store->GetBoolOption(KEY_CONTROL));
00098 
00099         Store->SetBoolDefault(DASHER_DIMENSIONS, false);
00100         this->SetDasherDimensions(Store->GetBoolOption(DASHER_DIMENSIONS));
00101 
00102         Store->SetBoolDefault(WINDOW_PAUSE, false);
00103         this->WindowPause(Store->GetBoolOption(WINDOW_PAUSE));
00104 
00105         // The following standard options don't have sensible cross-platform or cross-language defaults.
00106         // "" or 0 will have to mean "do something sensible for this user and platform"
00107         // The user may have saved a preference for some of these options though:
00108         
00109         this->ChangeAlphabet(Store->GetStringOption(ALPHABET_ID));
00110 
00111         // FIXME - need to work out why this breaks stuff
00112         //      this->ChangeLanguageModel(Store->GetLongOption(LANGUAGE_MODEL_ID));
00113         this->ChangeView(Store->GetLongOption(VIEW_ID));
00114         
00115         // Fonts
00116         this->SetEditFont(Store->GetStringOption(EDIT_FONT), Store->GetLongOption(EDIT_FONT_SIZE));
00117         this->SetDasherFont(Store->GetStringOption(DASHER_FONT));
00118         this->SetDasherFontSize(Dasher::Opts::FontSize(Store->GetLongOption(DASHER_FONTSIZE)));
00119 
00120         // Window Geometry
00121         this->SetEditHeight(Store->GetLongOption(EDIT_HEIGHT));
00122         this->SetScreenSize(Store->GetLongOption(SCREEN_WIDTH), Store->GetLongOption(SCREEN_HEIGHT));
00123 }
00124 
00125 
00126 

Generated on Sat Nov 5 16:16:00 2005 for OPIE by  doxygen 1.4.2