author | wimpie <wimpie> | 2004-04-09 18:04:30 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-09 18:04:30 (UTC) |
commit | 028717962deec0c2ff0e382221cbc2242393b79e (patch) (unidiff) | |
tree | a5f00a3b3d229f838b6e40e34ca12f248b317813 /inputmethods/dasher | |
parent | d17b9f7b64e004dcc301866f8122171218553b42 (diff) | |
download | opie-028717962deec0c2ff0e382221cbc2242393b79e.zip opie-028717962deec0c2ff0e382221cbc2242393b79e.tar.gz opie-028717962deec0c2ff0e382221cbc2242393b79e.tar.bz2 |
Removed warnings about initialization sequence in constructores
and unused variables and arguments
21 files changed, 118 insertions, 79 deletions
diff --git a/inputmethods/dasher/AlphIO.cpp b/inputmethods/dasher/AlphIO.cpp index 41b1b23..96ca14a 100644 --- a/inputmethods/dasher/AlphIO.cpp +++ b/inputmethods/dasher/AlphIO.cpp | |||
@@ -1,57 +1,59 @@ | |||
1 | // AlphIO.cpp | 1 | // AlphIO.cpp |
2 | // | 2 | // |
3 | ///////////////////////////////////////////////////////////////////////////// | 3 | ///////////////////////////////////////////////////////////////////////////// |
4 | // | 4 | // |
5 | // Copyright (c) 2002 Iain Murray | 5 | // Copyright (c) 2002 Iain Murray |
6 | // | 6 | // |
7 | ///////////////////////////////////////////////////////////////////////////// | 7 | ///////////////////////////////////////////////////////////////////////////// |
8 | 8 | ||
9 | 9 | ||
10 | 10 | ||
11 | #include "AlphIO.h" | 11 | #include "AlphIO.h" |
12 | 12 | ||
13 | using namespace Dasher; | 13 | using namespace Dasher; |
14 | using namespace std; | 14 | using namespace std; |
15 | 15 | ||
16 | CAlphIO::CAlphIO(string SystemLocation, string UserLocation) | 16 | CAlphIO::CAlphIO(string SystemLocation, string UserLocation) |
17 | : SystemLocation(SystemLocation), UserLocation(UserLocation), | 17 | : BlankInfo(), |
18 | BlankInfo(), CData("") | 18 | SystemLocation(SystemLocation), |
19 | UserLocation(UserLocation), | ||
20 | CData("") | ||
19 | { | 21 | { |
20 | CreateDefault(); | 22 | CreateDefault(); |
21 | } | 23 | } |
22 | 24 | ||
23 | 25 | ||
24 | void CAlphIO::GetAlphabets(std::vector< std::string > * AlphabetList) const | 26 | void CAlphIO::GetAlphabets(std::vector< std::string > * AlphabetList) const |
25 | { | 27 | { |
26 | AlphabetList->clear(); | 28 | AlphabetList->clear(); |
27 | 29 | ||
28 | typedef std::map<std::string, AlphInfo>::const_iterator CI; | 30 | typedef std::map<std::string, AlphInfo>::const_iterator CI; |
29 | CI End = Alphabets.end(); | 31 | CI End = Alphabets.end(); |
30 | 32 | ||
31 | for (CI Cur=Alphabets.begin(); Cur!=End; Cur++) | 33 | for (CI Cur=Alphabets.begin(); Cur!=End; Cur++) |
32 | AlphabetList->push_back( (*Cur).second.AlphID); | 34 | AlphabetList->push_back( (*Cur).second.AlphID); |
33 | } | 35 | } |
34 | 36 | ||
35 | 37 | ||
36 | const CAlphIO::AlphInfo& CAlphIO::GetInfo(const std::string& AlphID) | 38 | const CAlphIO::AlphInfo& CAlphIO::GetInfo(const std::string& AlphID) |
37 | { | 39 | { |
38 | if (AlphID=="") | 40 | if (AlphID=="") |
39 | return Alphabets["Default"]; | 41 | return Alphabets["Default"]; |
40 | else { | 42 | else { |
41 | AlphInfo& CurInfo = Alphabets[AlphID]; | 43 | // AlphInfo& CurInfo = Alphabets[AlphID]; |
42 | Alphabets[AlphID].AlphID = AlphID; // Ensure consistency | 44 | Alphabets[AlphID].AlphID = AlphID; // Ensure consistency |
43 | return Alphabets[AlphID]; | 45 | return Alphabets[AlphID]; |
44 | } | 46 | } |
45 | } | 47 | } |
46 | 48 | ||
47 | 49 | ||
48 | void CAlphIO::SetInfo(const AlphInfo& NewInfo) | 50 | void CAlphIO::SetInfo(const AlphInfo& NewInfo) |
49 | { | 51 | { |
50 | Alphabets[NewInfo.AlphID] = NewInfo; | 52 | Alphabets[NewInfo.AlphID] = NewInfo; |
51 | } | 53 | } |
52 | 54 | ||
53 | 55 | ||
54 | void CAlphIO::Delete(const std::string& AlphID) | 56 | void CAlphIO::Delete(const std::string& AlphID) |
55 | { | 57 | { |
56 | if (Alphabets.find(AlphID)!=Alphabets.end()) { | 58 | if (Alphabets.find(AlphID)!=Alphabets.end()) { |
57 | Alphabets.erase(AlphID); | 59 | Alphabets.erase(AlphID); |
diff --git a/inputmethods/dasher/Alphabet.cpp b/inputmethods/dasher/Alphabet.cpp index dc58b35..6327d8a 100644 --- a/inputmethods/dasher/Alphabet.cpp +++ b/inputmethods/dasher/Alphabet.cpp | |||
@@ -3,48 +3,48 @@ | |||
3 | ///////////////////////////////////////////////////////////////////////////// | 3 | ///////////////////////////////////////////////////////////////////////////// |
4 | // | 4 | // |
5 | // Copyright (c) 2001-2002 David Ward | 5 | // Copyright (c) 2001-2002 David Ward |
6 | // | 6 | // |
7 | ///////////////////////////////////////////////////////////////////////////// | 7 | ///////////////////////////////////////////////////////////////////////////// |
8 | 8 | ||
9 | #include "Alphabet.h" | 9 | #include "Alphabet.h" |
10 | #include "AlphabetMap.h" | 10 | #include "AlphabetMap.h" |
11 | 11 | ||
12 | //#include <iostream> | 12 | //#include <iostream> |
13 | //WinCE doesn't have iostream! | 13 | //WinCE doesn't have iostream! |
14 | 14 | ||
15 | using namespace Dasher; | 15 | using namespace Dasher; |
16 | using namespace std; | 16 | using namespace std; |
17 | 17 | ||
18 | 18 | ||
19 | CAlphabet::CAlphabet() : m_Groups(0), m_DefaultEncoding(Opts::Western), m_Orientation(Opts::LeftToRight) | 19 | CAlphabet::CAlphabet() : m_DefaultEncoding(Opts::Western), m_Orientation(Opts::LeftToRight), m_Groups(0) |
20 | { | 20 | { |
21 | m_Characters.push_back(""); | 21 | m_Characters.push_back(""); |
22 | m_Display.push_back(""); | 22 | m_Display.push_back(""); |
23 | m_Colours.push_back(""); | 23 | m_Colours.push_back(""); |
24 | m_Foreground.push_back(""); | 24 | m_Foreground.push_back(""); |
25 | m_Group.push_back(0); | 25 | m_Group.push_back(0); |
26 | } | 26 | } |
27 | 27 | ||
28 | 28 | ||
29 | void CAlphabet::GetSymbols(vector<symbol>* Symbols, string* Input, bool IsMore) | 29 | void CAlphabet::GetSymbols(vector<symbol>* Symbols, string* Input, bool IsMore) |
30 | { | 30 | { |
31 | string Tmp; | 31 | string Tmp; |
32 | symbol CurSymbol=0, TmpSymbol=0; | 32 | symbol CurSymbol=0, TmpSymbol=0; |
33 | bool KeyIsPrefix; | 33 | bool KeyIsPrefix; |
34 | int z= Input->size(); | 34 | // int z= Input->size(); |
35 | int extras; | 35 | int extras; |
36 | unsigned int bit; | 36 | unsigned int bit; |
37 | 37 | ||
38 | for (unsigned int i=0; i<Input->size(); i++) { | 38 | for (unsigned int i=0; i<Input->size(); i++) { |
39 | 39 | ||
40 | Tmp = (*Input)[i]; | 40 | Tmp = (*Input)[i]; |
41 | 41 | ||
42 | /* The string we've been given is in UTF-8. The symbols are | 42 | /* The string we've been given is in UTF-8. The symbols are |
43 | also in UTF-8, so we need to pass the entire UTF-8 character | 43 | also in UTF-8, so we need to pass the entire UTF-8 character |
44 | which may be several bytes long. RFC 2279 describes this | 44 | which may be several bytes long. RFC 2279 describes this |
45 | encoding */ | 45 | encoding */ |
46 | 46 | ||
47 | if ((*Input)[i] & 0x80) { // Character is more than 1 byte long | 47 | if ((*Input)[i] & 0x80) { // Character is more than 1 byte long |
48 | extras = 1; | 48 | extras = 1; |
49 | for (bit = 0x20; ((*Input)[i] & bit) != 0; bit >>= 1) | 49 | for (bit = 0x20; ((*Input)[i] & bit) != 0; bit >>= 1) |
50 | extras++; | 50 | extras++; |
diff --git a/inputmethods/dasher/AlphabetMap.cpp b/inputmethods/dasher/AlphabetMap.cpp index 09e2c72..c687e45 100644 --- a/inputmethods/dasher/AlphabetMap.cpp +++ b/inputmethods/dasher/AlphabetMap.cpp | |||
@@ -1,31 +1,31 @@ | |||
1 | // AlphabetMap.cpp | 1 | // AlphabetMap.cpp |
2 | // | 2 | // |
3 | ///////////////////////////////////////////////////////////////////////////// | 3 | ///////////////////////////////////////////////////////////////////////////// |
4 | // | 4 | // |
5 | // Copyright (c) 2002 Iain Murray | 5 | // Copyright (c) 2002 Iain Murray |
6 | // | 6 | // |
7 | ///////////////////////////////////////////////////////////////////////////// | 7 | ///////////////////////////////////////////////////////////////////////////// |
8 | 8 | ||
9 | #include "AlphabetMap.h" | 9 | #include "AlphabetMap.h" |
10 | 10 | ||
11 | using namespace Dasher; | 11 | using namespace Dasher; |
12 | using namespace std; | 12 | using namespace std; |
13 | 13 | ||
14 | alphabet_map::alphabet_map(unsigned int InitialTableSize) | 14 | alphabet_map::alphabet_map(unsigned int InitialTableSize) |
15 | : Undefined(0), HashTable(InitialTableSize<<1) | 15 | : HashTable(InitialTableSize<<1), Undefined(0) |
16 | { | 16 | { |
17 | Entries.reserve(InitialTableSize); | 17 | Entries.reserve(InitialTableSize); |
18 | } | 18 | } |
19 | 19 | ||
20 | 20 | ||
21 | void alphabet_map::Add(const string& Key, symbol Value) | 21 | void alphabet_map::Add(const string& Key, symbol Value) |
22 | { | 22 | { |
23 | RecursiveAdd(Key, Value, false); | 23 | RecursiveAdd(Key, Value, false); |
24 | } | 24 | } |
25 | 25 | ||
26 | 26 | ||
27 | void alphabet_map::RecursiveAdd(const string& Key, symbol Value, bool PrefixFlag) | 27 | void alphabet_map::RecursiveAdd(const string& Key, symbol Value, bool PrefixFlag) |
28 | { | 28 | { |
29 | Entry*& HashEntry = HashTable[Hash(Key)]; | 29 | Entry*& HashEntry = HashTable[Hash(Key)]; |
30 | 30 | ||
31 | // Loop through Entries with the correct Hash value. | 31 | // Loop through Entries with the correct Hash value. |
diff --git a/inputmethods/dasher/AlphabetMap.h b/inputmethods/dasher/AlphabetMap.h index 3aac1f5..62f20d9 100644 --- a/inputmethods/dasher/AlphabetMap.h +++ b/inputmethods/dasher/AlphabetMap.h | |||
@@ -55,33 +55,33 @@ IAM 08/2002 | |||
55 | 55 | ||
56 | #include "DasherTypes.h" | 56 | #include "DasherTypes.h" |
57 | 57 | ||
58 | namespace Dasher {class alphabet_map;} | 58 | namespace Dasher {class alphabet_map;} |
59 | class Dasher::alphabet_map | 59 | class Dasher::alphabet_map |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | alphabet_map(uint InitialTableSize=255); | 62 | alphabet_map(uint InitialTableSize=255); |
63 | void Add(const std::string& Key, symbol Value); | 63 | void Add(const std::string& Key, symbol Value); |
64 | symbol Get(const std::string& Key, bool* KeyIsPrefix=0) const; | 64 | symbol Get(const std::string& Key, bool* KeyIsPrefix=0) const; |
65 | 65 | ||
66 | private: | 66 | private: |
67 | class Entry | 67 | class Entry |
68 | { | 68 | { |
69 | public: | 69 | public: |
70 | Entry(std::string Key, symbol Symbol, Entry* Next) | 70 | Entry(std::string Key, symbol Symbol, Entry* Next) |
71 | : Key(Key), Symbol(Symbol), Next(Next), KeyIsPrefix(false) {} | 71 | : Key(Key), KeyIsPrefix(false), Symbol(Symbol), Next(Next) {} |
72 | 72 | ||
73 | std::string Key; | 73 | std::string Key; |
74 | bool KeyIsPrefix; | 74 | bool KeyIsPrefix; |
75 | symbol Symbol; | 75 | symbol Symbol; |
76 | Entry* Next; | 76 | Entry* Next; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | void RecursiveAdd(const std::string& Key, symbol Value, bool PrefixFlag); | 79 | void RecursiveAdd(const std::string& Key, symbol Value, bool PrefixFlag); |
80 | 80 | ||
81 | // A standard hash -- could try and research something specific. | 81 | // A standard hash -- could try and research something specific. |
82 | inline uint Hash(const std::string& Input) const { | 82 | inline uint Hash(const std::string& Input) const { |
83 | uint Result = 0; | 83 | uint Result = 0; |
84 | 84 | ||
85 | typedef std::string::const_iterator CI; | 85 | typedef std::string::const_iterator CI; |
86 | CI Cur = Input.begin(); | 86 | CI Cur = Input.begin(); |
87 | CI end = Input.end(); | 87 | CI end = Input.end(); |
diff --git a/inputmethods/dasher/DashEdit.h b/inputmethods/dasher/DashEdit.h index dc14d15..0baeec9 100644 --- a/inputmethods/dasher/DashEdit.h +++ b/inputmethods/dasher/DashEdit.h | |||
@@ -10,106 +10,106 @@ | |||
10 | /* | 10 | /* |
11 | An abstract DashEditbox class is described here. | 11 | An abstract DashEditbox class is described here. |
12 | An implementation will handle interaction between Dasher and an actual Edit control. | 12 | An implementation will handle interaction between Dasher and an actual Edit control. |
13 | e.g. - output characters to the edit control | 13 | e.g. - output characters to the edit control |
14 | - tapping on the edit box updates the Dasher display | 14 | - tapping on the edit box updates the Dasher display |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #ifndef __DashEdit_h__ | 17 | #ifndef __DashEdit_h__ |
18 | #define __DashEdit_h__ | 18 | #define __DashEdit_h__ |
19 | 19 | ||
20 | #include "DasherWidgetInterface.h" | 20 | #include "DasherWidgetInterface.h" |
21 | 21 | ||
22 | namespace Dasher {class CDashEditbox;} | 22 | namespace Dasher {class CDashEditbox;} |
23 | class Dasher::CDashEditbox | 23 | class Dasher::CDashEditbox |
24 | { | 24 | { |
25 | public: | 25 | public: |
26 | CDashEditbox() : m_iFlushed(0), m_DasherInterface(0), m_dirty(false) {} | 26 | CDashEditbox() : m_dirty(false),m_iFlushed(0), m_DasherInterface(0) {} |
27 | 27 | ||
28 | //! Provide the Editbox with a widget interface | 28 | //! Provide the Editbox with a widget interface |
29 | virtual void SetInterface(CDasherWidgetInterface* DasherInterface) {m_DasherInterface = DasherInterface;} | 29 | virtual void SetInterface(CDasherWidgetInterface* DasherInterface) {m_DasherInterface = DasherInterface;} |
30 | 30 | ||
31 | //! Write some buffered output to a file | 31 | //! Write some buffered output to a file |
32 | virtual void write_to_file()=0; | 32 | virtual void write_to_file()=0; |
33 | 33 | ||
34 | //! Set the number of flushed characters | 34 | //! Set the number of flushed characters |
35 | // | 35 | // |
36 | //! Set the number of flushed characters to an arbitrary number. | 36 | //! Set the number of flushed characters to an arbitrary number. |
37 | //! Usually used to reset it to 0 after unflushing | 37 | //! Usually used to reset it to 0 after unflushing |
38 | void set_flushed(int i) {m_iFlushed=i;} | 38 | void set_flushed(int i) {m_iFlushed=i;} |
39 | 39 | ||
40 | //! Provide context from the editbox for the core | 40 | //! Provide context from the editbox for the core |
41 | // | 41 | // |
42 | //! Provide the context at the current position within the editbox to | 42 | //! Provide the context at the current position within the editbox to |
43 | //! the core. Set str to up to max characters before | 43 | //! the core. Set str to up to max characters before |
44 | //! the cursor position within the editbox. | 44 | //! the cursor position within the editbox. |
45 | virtual void get_new_context(std::string& str, int max)=0; | 45 | virtual void get_new_context(std::string& str, int max)=0; |
46 | 46 | ||
47 | //! Delete flushed text from the editbox | 47 | //! Delete flushed text from the editbox |
48 | virtual inline void unflush()=0; | 48 | virtual void unflush()=0; |
49 | 49 | ||
50 | //! Enter a the character Symbol into the text box | 50 | //! Enter a the character Symbol into the text box |
51 | virtual void output(symbol Symbol)=0; | 51 | virtual void output(symbol Symbol)=0; |
52 | 52 | ||
53 | //! Delete the previous symbol from the text box | 53 | //! Delete the previous symbol from the text box |
54 | virtual void deletetext()=0; | 54 | virtual void deletetext()=0; |
55 | 55 | ||
56 | //! Enter a character into the text box and remember that it is flushed | 56 | //! Enter a character into the text box and remember that it is flushed |
57 | // | 57 | // |
58 | //! Output the character and increment m_iFlushed. When unflush is | 58 | //! Output the character and increment m_iFlushed. When unflush is |
59 | //! called, remove the previous m_iFlushed characters | 59 | //! called, remove the previous m_iFlushed characters |
60 | virtual void flush(symbol Symbol)=0; | 60 | virtual void flush(symbol Symbol)=0; |
61 | 61 | ||
62 | // File I/O (optional) | 62 | // File I/O (optional) |
63 | 63 | ||
64 | //! If Value is true, timestamp all new files (optional) | 64 | //! If Value is true, timestamp all new files (optional) |
65 | // | 65 | // |
66 | //! If switched on, all new files should be timestamped, either in the | 66 | //! If switched on, all new files should be timestamped, either in the |
67 | //! filename or in file metadata | 67 | //! filename or in file metadata |
68 | virtual void TimeStampNewFiles(bool Value) {} | 68 | virtual void TimeStampNewFiles(bool ) {} |
69 | 69 | ||
70 | //! Return true if any text has been modified since the last save (optional) | 70 | //! Return true if any text has been modified since the last save (optional) |
71 | bool IsDirty() {return m_dirty;} | 71 | bool IsDirty() {return m_dirty;} |
72 | 72 | ||
73 | //! Generate a new file (optional) | 73 | //! Generate a new file (optional) |
74 | // | 74 | // |
75 | //! New file - provide a file save dialogue and return the filename in | 75 | //! New file - provide a file save dialogue and return the filename in |
76 | //! filename, or provide a blank filename and present a file | 76 | //! filename, or provide a blank filename and present a file |
77 | //! save dialogue when Save() is called | 77 | //! save dialogue when Save() is called |
78 | virtual void New(const std::string& filename) {}; // filename can be "", but you cannot call Save() without having set a filename. | 78 | virtual void New(const std::string& ) {}; // filename can be "", but you cannot call Save() without having set a filename. |
79 | 79 | ||
80 | //! Open a file (optional) | 80 | //! Open a file (optional) |
81 | // | 81 | // |
82 | //! Provide a file open dialogue and set filename to the | 82 | //! Provide a file open dialogue and set filename to the |
83 | //! filename. Return true if a file is chosen and opened successfully, | 83 | //! filename. Return true if a file is chosen and opened successfully, |
84 | //! false otherwise | 84 | //! false otherwise |
85 | virtual bool Open(const std::string& filename) {return false;}; | 85 | virtual bool Open(const std::string& ) {return false;}; |
86 | 86 | ||
87 | //! Open a file and append to it (optional) | 87 | //! Open a file and append to it (optional) |
88 | // | 88 | // |
89 | //! Provide a file open dialogue and set filename to the | 89 | //! Provide a file open dialogue and set filename to the |
90 | //! filename. The file will then have any new text appended to it. | 90 | //! filename. The file will then have any new text appended to it. |
91 | //! Return true if a file is chosen and opened successfully, false | 91 | //! Return true if a file is chosen and opened successfully, false |
92 | //! otherwise | 92 | //! otherwise |
93 | virtual bool OpenAppendMode(const std::string& filename) {return false;}; | 93 | virtual bool OpenAppendMode(const std::string& ) {return false;}; |
94 | //! Save a file as a provided filename (optional) | 94 | //! Save a file as a provided filename (optional) |
95 | // | 95 | // |
96 | //! Provide a file save dialogue and set filename to the | 96 | //! Provide a file save dialogue and set filename to the |
97 | //! filename. Return true if a file is chosen and saved successfully, | 97 | //! filename. Return true if a file is chosen and saved successfully, |
98 | //! false otherwise | 98 | //! false otherwise |
99 | virtual bool SaveAs(const std::string& filename) {return false;}; | 99 | virtual bool SaveAs(const std::string& ) {return false;}; |
100 | 100 | ||
101 | //! Save the current file (optional) | 101 | //! Save the current file (optional) |
102 | // | 102 | // |
103 | //! Save file to the current filename. If there is no current filename, | 103 | //! Save file to the current filename. If there is no current filename, |
104 | //! or if saving fails, return false | 104 | //! or if saving fails, return false |
105 | virtual bool Save() {return false;}; // returns false if there is no filename set, or if saving fails | 105 | virtual bool Save() {return false;}; // returns false if there is no filename set, or if saving fails |
106 | 106 | ||
107 | // Clipboard (optional) | 107 | // Clipboard (optional) |
108 | //! Cut selected text (optional) | 108 | //! Cut selected text (optional) |
109 | // | 109 | // |
110 | //! Copy the selected text to the clipboard and remove it from the | 110 | //! Copy the selected text to the clipboard and remove it from the |
111 | //! editbox | 111 | //! editbox |
112 | virtual void Cut() {}; | 112 | virtual void Cut() {}; |
113 | 113 | ||
114 | //! Copy selected text (optional) | 114 | //! Copy selected text (optional) |
115 | // | 115 | // |
diff --git a/inputmethods/dasher/DasherInterface.cpp b/inputmethods/dasher/DasherInterface.cpp index bb5b85e..4699687 100644 --- a/inputmethods/dasher/DasherInterface.cpp +++ b/inputmethods/dasher/DasherInterface.cpp | |||
@@ -12,37 +12,54 @@ | |||
12 | //#include "EnglishAlphabet.h" | 12 | //#include "EnglishAlphabet.h" |
13 | #include "CustomAlphabet.h" | 13 | #include "CustomAlphabet.h" |
14 | #include "DasherViewSquare.h" | 14 | #include "DasherViewSquare.h" |
15 | #include "PPMLanguageModel.h" | 15 | #include "PPMLanguageModel.h" |
16 | #include <iostream> | 16 | #include <iostream> |
17 | namespace { | 17 | namespace { |
18 | #include "stdio.h" | 18 | #include "stdio.h" |
19 | } | 19 | } |
20 | using namespace Dasher; | 20 | using namespace Dasher; |
21 | using namespace std; | 21 | using namespace std; |
22 | 22 | ||
23 | 23 | ||
24 | const string CDasherInterface::EmptyString = ""; | 24 | const string CDasherInterface::EmptyString = ""; |
25 | 25 | ||
26 | 26 | ||
27 | CDasherInterface::CDasherInterface() | 27 | CDasherInterface::CDasherInterface() |
28 | : m_DashEditbox(0), m_DasherScreen(0), m_LanguageModel(0), TrainContext(0), m_Alphabet(0), | 28 | : m_Alphabet(0), |
29 | m_DasherModel(0), m_DasherView(0), AlphabetID(""), LanguageModelID(-1), ViewID(-1), | 29 | m_LanguageModel(0), |
30 | m_MaxBitRate(-1), m_Orientation(Opts::LeftToRight), m_SettingsStore(0), m_SettingsUI(0), | 30 | m_DasherModel(0), |
31 | m_UserLocation("usr_"), m_SystemLocation("sys_"), m_AlphIO(0), m_TrainFile(""), | 31 | m_DashEditbox(0), |
32 | m_DasherFont(""), m_EditFont(""), m_EditFontSize(0), m_DrawKeyboard(false) | 32 | m_DasherScreen(0), |
33 | m_DasherView(0), | ||
34 | m_SettingsStore(0), | ||
35 | m_SettingsUI(0), | ||
36 | m_AlphIO(0), | ||
37 | TrainContext(0), | ||
38 | AlphabetID(""), | ||
39 | LanguageModelID(-1), | ||
40 | ViewID(-1), | ||
41 | m_MaxBitRate(-1), | ||
42 | m_DrawKeyboard(false), | ||
43 | m_Orientation(Opts::LeftToRight), | ||
44 | m_UserLocation("usr_"), | ||
45 | m_SystemLocation("sys_"), | ||
46 | m_TrainFile(""), | ||
47 | m_DasherFont(""), | ||
48 | m_EditFont(""), | ||
49 | m_EditFontSize(0) | ||
33 | { | 50 | { |
34 | } | 51 | } |
35 | 52 | ||
36 | 53 | ||
37 | CDasherInterface::~CDasherInterface() | 54 | CDasherInterface::~CDasherInterface() |
38 | { | 55 | { |
39 | if (m_LanguageModel) | 56 | if (m_LanguageModel) |
40 | m_LanguageModel->ReleaseNodeContext(TrainContext); | 57 | m_LanguageModel->ReleaseNodeContext(TrainContext); |
41 | delete m_DasherModel; // The order of some of these deletions matters | 58 | delete m_DasherModel; // The order of some of these deletions matters |
42 | delete m_LanguageModel; // eg DasherModel has a pointer to LanguageModel. | 59 | delete m_LanguageModel; // eg DasherModel has a pointer to LanguageModel. |
43 | delete m_Alphabet; // DM baulks if LM is deleted before it is. | 60 | delete m_Alphabet; // DM baulks if LM is deleted before it is. |
44 | delete m_DasherView; | 61 | delete m_DasherView; |
45 | // Do NOT delete Edit box or Screen. This class did not create them. | 62 | // Do NOT delete Edit box or Screen. This class did not create them. |
46 | } | 63 | } |
47 | 64 | ||
48 | 65 | ||
diff --git a/inputmethods/dasher/DasherInterface.h b/inputmethods/dasher/DasherInterface.h index 6338801..7c4496f 100644 --- a/inputmethods/dasher/DasherInterface.h +++ b/inputmethods/dasher/DasherInterface.h | |||
@@ -25,33 +25,33 @@ | |||
25 | #include "Alphabet.h" | 25 | #include "Alphabet.h" |
26 | #include "AlphIO.h" | 26 | #include "AlphIO.h" |
27 | #include "LanguageModel.h" | 27 | #include "LanguageModel.h" |
28 | #include "DasherModel.h" | 28 | #include "DasherModel.h" |
29 | #include "DashEdit.h" | 29 | #include "DashEdit.h" |
30 | #include "DasherView.h" | 30 | #include "DasherView.h" |
31 | 31 | ||
32 | #include "MSVC_Unannoy.h" | 32 | #include "MSVC_Unannoy.h" |
33 | #include <map> | 33 | #include <map> |
34 | 34 | ||
35 | namespace Dasher {class CDasherInterface;} | 35 | namespace Dasher {class CDasherInterface;} |
36 | class Dasher::CDasherInterface : private NoClones, | 36 | class Dasher::CDasherInterface : private NoClones, |
37 | public CDasherWidgetInterface, public CDasherAppInterface, public CDasherSettingsInterface | 37 | public CDasherWidgetInterface, public CDasherAppInterface, public CDasherSettingsInterface |
38 | { | 38 | { |
39 | public: | 39 | public: |
40 | CDasherInterface(); | 40 | CDasherInterface(); |
41 | ~CDasherInterface(); | 41 | virtual ~CDasherInterface(); |
42 | 42 | ||
43 | //! Tell the core which CSettingsStore should be used | 43 | //! Tell the core which CSettingsStore should be used |
44 | void SetSettingsStore(CSettingsStore* SettingsStore); | 44 | void SetSettingsStore(CSettingsStore* SettingsStore); |
45 | 45 | ||
46 | //! Tell the core which CDasherSettingsInterface should be used | 46 | //! Tell the core which CDasherSettingsInterface should be used |
47 | // | 47 | // |
48 | //! Provide a pointer to an instance of CDasherSettingsInterface in | 48 | //! Provide a pointer to an instance of CDasherSettingsInterface in |
49 | //! order to allow for platform dependent configuration of certain | 49 | //! order to allow for platform dependent configuration of certain |
50 | //! options | 50 | //! options |
51 | void SetSettingsUI(CDasherSettingsInterface* SettingsUI); | 51 | void SetSettingsUI(CDasherSettingsInterface* SettingsUI); |
52 | 52 | ||
53 | //! Set the path for user specific configuration and files | 53 | //! Set the path for user specific configuration and files |
54 | void SetUserLocation(std::string UserLocation); | 54 | void SetUserLocation(std::string UserLocation); |
55 | 55 | ||
56 | //! Set the path for system-wide configuration and files | 56 | //! Set the path for system-wide configuration and files |
57 | void SetSystemLocation(std::string SystemLocation); | 57 | void SetSystemLocation(std::string SystemLocation); |
diff --git a/inputmethods/dasher/DasherModel.cpp b/inputmethods/dasher/DasherModel.cpp index 0450d66..f15fa49 100644 --- a/inputmethods/dasher/DasherModel.cpp +++ b/inputmethods/dasher/DasherModel.cpp | |||
@@ -4,33 +4,33 @@ | |||
4 | // | 4 | // |
5 | // Copyright (c) 2001-2002 David Ward | 5 | // Copyright (c) 2001-2002 David Ward |
6 | // | 6 | // |
7 | ///////////////////////////////////////////////////////////////////////////// | 7 | ///////////////////////////////////////////////////////////////////////////// |
8 | 8 | ||
9 | #include <iostream> | 9 | #include <iostream> |
10 | #include "DasherModel.h" | 10 | #include "DasherModel.h" |
11 | 11 | ||
12 | using namespace Dasher; | 12 | using namespace Dasher; |
13 | using namespace std; | 13 | using namespace std; |
14 | 14 | ||
15 | ////////////////////////////////////////////////////////////////////// | 15 | ////////////////////////////////////////////////////////////////////// |
16 | // CDasherModel | 16 | // CDasherModel |
17 | ////////////////////////////////////////////////////////////////////// | 17 | ////////////////////////////////////////////////////////////////////// |
18 | 18 | ||
19 | CDasherModel::CDasherModel(CDashEditbox* Editbox, CLanguageModel* LanguageModel, bool Dimensions) | 19 | CDasherModel::CDasherModel(CDashEditbox* Editbox, CLanguageModel* LanguageModel, bool Dimensions) |
20 | : m_editbox(Editbox), m_languagemodel(LanguageModel), m_Root(0), m_Dimensions(Dimensions) | 20 | : m_Dimensions(Dimensions), m_editbox(Editbox), m_languagemodel(LanguageModel), m_Root(0) |
21 | { | 21 | { |
22 | LearnContext = m_languagemodel->GetRootNodeContext(); | 22 | LearnContext = m_languagemodel->GetRootNodeContext(); |
23 | 23 | ||
24 | // various settings | 24 | // various settings |
25 | int iShift = 12; | 25 | int iShift = 12; |
26 | m_DasherY = 1<<iShift; | 26 | m_DasherY = 1<<iShift; |
27 | m_DasherOY = m_DasherY/2; | 27 | m_DasherOY = m_DasherY/2; |
28 | m_DasherOX = m_DasherY/2; | 28 | m_DasherOX = m_DasherY/2; |
29 | m_dAddProb = 0.003; | 29 | m_dAddProb = 0.003; |
30 | } | 30 | } |
31 | 31 | ||
32 | 32 | ||
33 | CDasherModel::~CDasherModel() | 33 | CDasherModel::~CDasherModel() |
34 | { | 34 | { |
35 | m_languagemodel->ReleaseNodeContext(LearnContext); | 35 | m_languagemodel->ReleaseNodeContext(LearnContext); |
36 | delete m_Root; // which will also delete all the whole structure | 36 | delete m_Root; // which will also delete all the whole structure |
@@ -92,33 +92,33 @@ CDasherNode * CDasherModel::Get_node_under_mouse(myint Mousex,myint Mousey) | |||
92 | { | 92 | { |
93 | return m_Root->Get_node_under(Normalization(),m_Rootmin,m_Rootmax,Mousex,Mousey); | 93 | return m_Root->Get_node_under(Normalization(),m_Rootmin,m_Rootmax,Mousex,Mousey); |
94 | } | 94 | } |
95 | 95 | ||
96 | ///////////////////////////////////////////////////////////////////////////// | 96 | ///////////////////////////////////////////////////////////////////////////// |
97 | 97 | ||
98 | 98 | ||
99 | void CDasherModel::Get_string_under_mouse(const myint Mousex,const myint Mousey, vector<symbol> &str) | 99 | void CDasherModel::Get_string_under_mouse(const myint Mousex,const myint Mousey, vector<symbol> &str) |
100 | { | 100 | { |
101 | m_Root->Get_string_under(Normalization(),m_Rootmin,m_Rootmax,Mousex,Mousey,str); | 101 | m_Root->Get_string_under(Normalization(),m_Rootmin,m_Rootmax,Mousex,Mousey,str); |
102 | return; | 102 | return; |
103 | } | 103 | } |
104 | 104 | ||
105 | ///////////////////////////////////////////////////////////////////////////// | 105 | ///////////////////////////////////////////////////////////////////////////// |
106 | 106 | ||
107 | 107 | ||
108 | void CDasherModel::Flush(const myint Mousex,const myint Mousey) | 108 | void CDasherModel::Flush(const myint ,const myint ) |
109 | { | 109 | { |
110 | vector<symbol> vtUnder; | 110 | vector<symbol> vtUnder; |
111 | Get_string_under_mouse(m_DasherOX,m_DasherOY,vtUnder); | 111 | Get_string_under_mouse(m_DasherOX,m_DasherOY,vtUnder); |
112 | unsigned int i; | 112 | unsigned int i; |
113 | for (i=0;i<vtUnder.size();i++) { | 113 | for (i=0;i<vtUnder.size();i++) { |
114 | if (vtUnder[i]==0) | 114 | if (vtUnder[i]==0) |
115 | continue; | 115 | continue; |
116 | m_editbox->flush(vtUnder[i]); | 116 | m_editbox->flush(vtUnder[i]); |
117 | } | 117 | } |
118 | } | 118 | } |
119 | 119 | ||
120 | ///////////////////////////////////////////////////////////////////////////// | 120 | ///////////////////////////////////////////////////////////////////////////// |
121 | 121 | ||
122 | void CDasherModel::Update(CDasherNode *node,CDasherNode *under_mouse,int iSafe) | 122 | void CDasherModel::Update(CDasherNode *node,CDasherNode *under_mouse,int iSafe) |
123 | // go through the Dasher nodes, delete ones who have expired | 123 | // go through the Dasher nodes, delete ones who have expired |
124 | // decrease the time left for nodes which arent safe | 124 | // decrease the time left for nodes which arent safe |
@@ -171,33 +171,33 @@ void CDasherModel::Start() | |||
171 | m_languagemodel->ReleaseNodeContext(LearnContext); | 171 | m_languagemodel->ReleaseNodeContext(LearnContext); |
172 | LearnContext = m_languagemodel->CloneNodeContext(therootcontext); | 172 | LearnContext = m_languagemodel->CloneNodeContext(therootcontext); |
173 | } | 173 | } |
174 | m_Root=new CDasherNode(0,0,0,0,Opts::Nodes1,0,Normalization(),m_languagemodel); | 174 | m_Root=new CDasherNode(0,0,0,0,Opts::Nodes1,0,Normalization(),m_languagemodel); |
175 | m_Root->Push_Node(therootcontext); | 175 | m_Root->Push_Node(therootcontext); |
176 | 176 | ||
177 | m_languagemodel->ReleaseNodeContext(therootcontext); | 177 | m_languagemodel->ReleaseNodeContext(therootcontext); |
178 | //ppmmodel->dump(); | 178 | //ppmmodel->dump(); |
179 | //dump(); | 179 | //dump(); |
180 | 180 | ||
181 | } | 181 | } |
182 | 182 | ||
183 | ///////////////////////////////////////////////////////////////////////////// | 183 | ///////////////////////////////////////////////////////////////////////////// |
184 | 184 | ||
185 | void CDasherModel::Get_new_root_coords(myint Mousex,myint Mousey) | 185 | void CDasherModel::Get_new_root_coords(myint Mousex,myint Mousey) |
186 | { | 186 | { |
187 | int cappedrate=0; | 187 | // int cappedrate=0; |
188 | double dRx=1.0,dRxnew=1.0; | 188 | double dRx=1.0,dRxnew=1.0; |
189 | double dRxnew2; | 189 | double dRxnew2; |
190 | 190 | ||
191 | int iSteps=m_fr.Steps(); | 191 | int iSteps=m_fr.Steps(); |
192 | 192 | ||
193 | if (Mousex<m_DasherOX) { | 193 | if (Mousex<m_DasherOX) { |
194 | //rx=1.0001*Ixmap[mx]/Ixmap[cx]; | 194 | //rx=1.0001*Ixmap[mx]/Ixmap[cx]; |
195 | if (Mousex<=0) | 195 | if (Mousex<=0) |
196 | Mousex=1; | 196 | Mousex=1; |
197 | dRx=1.0*m_DasherOX/Mousex; | 197 | dRx=1.0*m_DasherOX/Mousex; |
198 | dRxnew=pow(dRx,1.0/iSteps); // or exp(log(rx)/steps) - i think the replacement is faster | 198 | dRxnew=pow(dRx,1.0/iSteps); // or exp(log(rx)/steps) - i think the replacement is faster |
199 | 199 | ||
200 | dRxnew2=1+(dRx-1)/iSteps; | 200 | dRxnew2=1+(dRx-1)/iSteps; |
201 | //+(rx-1)*(rx-1)*(1.0/fr.steps()-1.0)/2/fr.steps(); | 201 | //+(rx-1)*(rx-1)*(1.0/fr.steps()-1.0)/2/fr.steps(); |
202 | 202 | ||
203 | 203 | ||
@@ -230,33 +230,33 @@ void CDasherModel::Get_new_root_coords(myint Mousex,myint Mousey) | |||
230 | 230 | ||
231 | myint miDistance=m_DasherY/2-Mousey; | 231 | myint miDistance=m_DasherY/2-Mousey; |
232 | miDistance=myint(miDistance*(dRxnew-1)/(dRx-1)); | 232 | miDistance=myint(miDistance*(dRxnew-1)/(dRx-1)); |
233 | myint miNewrootzoom=Mousey+miDistance; | 233 | myint miNewrootzoom=Mousey+miDistance; |
234 | 234 | ||
235 | myint newRootmax=miNewrootzoom+myint(below*dRxnew); | 235 | myint newRootmax=miNewrootzoom+myint(below*dRxnew); |
236 | myint newRootmin=miNewrootzoom-myint(above*dRxnew); | 236 | myint newRootmin=miNewrootzoom-myint(above*dRxnew); |
237 | if (newRootmin<m_DasherY/2 && newRootmax>m_DasherY/2 && newRootmax<LLONG_MAX && newRootmin>LLONG_MIN) { | 237 | if (newRootmin<m_DasherY/2 && newRootmax>m_DasherY/2 && newRootmax<LLONG_MAX && newRootmin>LLONG_MIN) { |
238 | m_Rootmax=newRootmax; | 238 | m_Rootmax=newRootmax; |
239 | m_Rootmin=newRootmin; | 239 | m_Rootmin=newRootmin; |
240 | } | 240 | } |
241 | 241 | ||
242 | } | 242 | } |
243 | 243 | ||
244 | ///////////////////////////////////////////////////////////////////////////// | 244 | ///////////////////////////////////////////////////////////////////////////// |
245 | 245 | ||
246 | void CDasherModel::Tap_on_display(myint miMousex,myint miMousey, unsigned long Time) | 246 | void CDasherModel::Tap_on_display(myint miMousex,myint miMousey, unsigned long ) |
247 | // work out the next viewpoint, opens some new nodes | 247 | // work out the next viewpoint, opens some new nodes |
248 | { | 248 | { |
249 | // works out next viewpoint | 249 | // works out next viewpoint |
250 | Get_new_root_coords(miMousex,miMousey); | 250 | Get_new_root_coords(miMousex,miMousey); |
251 | 251 | ||
252 | // opens up new nodes | 252 | // opens up new nodes |
253 | 253 | ||
254 | // push node under mouse | 254 | // push node under mouse |
255 | CDasherNode *under_mouse=Get_node_under_mouse(miMousex,miMousey); | 255 | CDasherNode *under_mouse=Get_node_under_mouse(miMousex,miMousey); |
256 | under_mouse->Push_Node(); | 256 | under_mouse->Push_Node(); |
257 | 257 | ||
258 | 258 | ||
259 | if (Framerate() > 4) { | 259 | if (Framerate() > 4) { |
260 | // push node under mouse but with x coord on RHS | 260 | // push node under mouse but with x coord on RHS |
261 | CDasherNode *right=Get_node_under_mouse(50,miMousey); | 261 | CDasherNode *right=Get_node_under_mouse(50,miMousey); |
262 | right->Push_Node(); | 262 | right->Push_Node(); |
diff --git a/inputmethods/dasher/DasherNode.cpp b/inputmethods/dasher/DasherNode.cpp index 26af10f..3a984ef 100644 --- a/inputmethods/dasher/DasherNode.cpp +++ b/inputmethods/dasher/DasherNode.cpp | |||
@@ -19,33 +19,33 @@ void CDasherNode::Dump_node () const | |||
19 | dchar out[256]; | 19 | dchar out[256]; |
20 | if (m_Symbol) | 20 | if (m_Symbol) |
21 | wsprintf(out,TEXT("%7x %3c %7x %5d %7x %5d %8x %8x \n"),this,m_Symbol,m_iGroup,m_context,m_Children,m_Cscheme,m_iLbnd,m_iHbnd); | 21 | wsprintf(out,TEXT("%7x %3c %7x %5d %7x %5d %8x %8x \n"),this,m_Symbol,m_iGroup,m_context,m_Children,m_Cscheme,m_iLbnd,m_iHbnd); |
22 | else | 22 | else |
23 | wsprintf(out,TEXT("%7x %7x %5d %7x %5d %8x %8x \n"),this,m_iGroup,m_context,m_Children,m_Cscheme,m_iLbnd,m_iHbnd); | 23 | wsprintf(out,TEXT("%7x %7x %5d %7x %5d %8x %8x \n"),this,m_iGroup,m_context,m_Children,m_Cscheme,m_iLbnd,m_iHbnd); |
24 | 24 | ||
25 | OutputDebugString(out); | 25 | OutputDebugString(out); |
26 | 26 | ||
27 | if (m_Children) { | 27 | if (m_Children) { |
28 | unsigned int i; | 28 | unsigned int i; |
29 | for (i=1;i<m_iChars;i++) | 29 | for (i=1;i<m_iChars;i++) |
30 | m_Children[i]->Dump_node(); | 30 | m_Children[i]->Dump_node(); |
31 | } | 31 | } |
32 | */ | 32 | */ |
33 | } | 33 | } |
34 | 34 | ||
35 | void CDasherNode::Generic_Push_Node(CLanguageModel::CNodeContext *context) { | 35 | void CDasherNode::Generic_Push_Node(CLanguageModel::CNodeContext *) { |
36 | 36 | ||
37 | m_iAge=0; | 37 | m_iAge=0; |
38 | m_bAlive=true; | 38 | m_bAlive=true; |
39 | if (m_Symbol && !m_iChars) // make sure it's a valid symbol and don't enter if already done | 39 | if (m_Symbol && !m_iChars) // make sure it's a valid symbol and don't enter if already done |
40 | m_languagemodel->EnterNodeSymbol(m_context,m_Symbol); | 40 | m_languagemodel->EnterNodeSymbol(m_context,m_Symbol); |
41 | 41 | ||
42 | 42 | ||
43 | vector<symbol> newchars; // place to put this list of characters | 43 | vector<symbol> newchars; // place to put this list of characters |
44 | vector<unsigned int> cum,groups; // for the probability list | 44 | vector<unsigned int> cum,groups; // for the probability list |
45 | m_languagemodel->GetNodeProbs(m_context,newchars,groups,cum,0.003); | 45 | m_languagemodel->GetNodeProbs(m_context,newchars,groups,cum,0.003); |
46 | m_iChars=newchars.size(); | 46 | m_iChars=newchars.size(); |
47 | // work out cumulative probs | 47 | // work out cumulative probs |
48 | unsigned int i; | 48 | unsigned int i; |
49 | for (i=1;i<m_iChars;i++) | 49 | for (i=1;i<m_iChars;i++) |
50 | cum[i]+=cum[i-1]; | 50 | cum[i]+=cum[i-1]; |
51 | 51 | ||
diff --git a/inputmethods/dasher/DasherNode.h b/inputmethods/dasher/DasherNode.h index 705a9d4..fb00d47 100644 --- a/inputmethods/dasher/DasherNode.h +++ b/inputmethods/dasher/DasherNode.h | |||
@@ -61,35 +61,49 @@ public: | |||
61 | void Generic_Push_Node(CLanguageModel::CNodeContext *context); | 61 | void Generic_Push_Node(CLanguageModel::CNodeContext *context); |
62 | void Push_Node(); // give birth to children | 62 | void Push_Node(); // give birth to children |
63 | void Push_Node(CLanguageModel::CNodeContext *context); // give birth to children with this context | 63 | void Push_Node(CLanguageModel::CNodeContext *context); // give birth to children with this context |
64 | void Delete_children(); | 64 | void Delete_children(); |
65 | void Dump_node() const; // diagnostic | 65 | void Dump_node() const; // diagnostic |
66 | }; | 66 | }; |
67 | 67 | ||
68 | ///////////////////////////////////////////////////////////////////////////// | 68 | ///////////////////////////////////////////////////////////////////////////// |
69 | // Inline functions | 69 | // Inline functions |
70 | ///////////////////////////////////////////////////////////////////////////// | 70 | ///////////////////////////////////////////////////////////////////////////// |
71 | 71 | ||
72 | using namespace Dasher; | 72 | using namespace Dasher; |
73 | using namespace Opts; | 73 | using namespace Opts; |
74 | 74 | ||
75 | ///////////////////////////////////////////////////////////////////////////// | 75 | ///////////////////////////////////////////////////////////////////////////// |
76 | 76 | ||
77 | inline CDasherNode::CDasherNode(CDasherNode *parent,symbol Symbol, unsigned int igroup, int iphase, ColorSchemes ColorScheme,int ilbnd,int ihbnd,CLanguageModel *lm, int Colour=0) | 77 | inline CDasherNode::CDasherNode(CDasherNode *parent,symbol Symbol, unsigned int igroup, int iphase, ColorSchemes ColorScheme,int ilbnd,int ihbnd,CLanguageModel *lm, int Colour=0) : |
78 | : m_parent(parent),m_Symbol(Symbol),m_iGroup(igroup),m_iLbnd(ilbnd),m_iHbnd(ihbnd),m_languagemodel(lm),m_iPhase(iphase), | 78 | m_iLbnd(ilbnd), |
79 | m_context(0), m_iAge(0), m_bAlive(1), m_Children(0), m_bForce(false), m_iChars(0), m_ColorScheme(ColorScheme), m_bControlChild(false), m_iColour(Colour) | 79 | m_iHbnd(ihbnd), |
80 | m_iGroup(igroup), | ||
81 | m_iChars(0), | ||
82 | m_iAge(0), | ||
83 | m_bAlive(1), | ||
84 | m_bControlChild(false), | ||
85 | m_ColorScheme(ColorScheme), | ||
86 | m_iPhase(iphase), | ||
87 | m_iColour(Colour), | ||
88 | m_Symbol(Symbol), | ||
89 | m_languagemodel(lm), | ||
90 | m_Children(0), | ||
91 | m_parent(parent), | ||
92 | m_context(0), | ||
93 | m_bForce(false) | ||
80 | { | 94 | { |
81 | /* | 95 | /* |
82 | switch (ColorScheme) { | 96 | switch (ColorScheme) { |
83 | case Nodes1: | 97 | case Nodes1: |
84 | m_ColorScheme = Nodes2; | 98 | m_ColorScheme = Nodes2; |
85 | break; | 99 | break; |
86 | case Nodes2: | 100 | case Nodes2: |
87 | m_ColorScheme = Nodes1; | 101 | m_ColorScheme = Nodes1; |
88 | break; | 102 | break; |
89 | case Special1: | 103 | case Special1: |
90 | m_ColorScheme = Special2; | 104 | m_ColorScheme = Special2; |
91 | break; | 105 | break; |
92 | case Special2: | 106 | case Special2: |
93 | m_ColorScheme = Special1; | 107 | m_ColorScheme = Special1; |
94 | break; | 108 | break; |
95 | case default: | 109 | case default: |
diff --git a/inputmethods/dasher/DasherSettingsInterface.h b/inputmethods/dasher/DasherSettingsInterface.h index 9d03eba..34b55d4 100644 --- a/inputmethods/dasher/DasherSettingsInterface.h +++ b/inputmethods/dasher/DasherSettingsInterface.h | |||
@@ -8,107 +8,107 @@ | |||
8 | 8 | ||
9 | 9 | ||
10 | #ifndef __DasherSettingsInterface_h__ | 10 | #ifndef __DasherSettingsInterface_h__ |
11 | #define __DasherSettingsInterface_h__ | 11 | #define __DasherSettingsInterface_h__ |
12 | 12 | ||
13 | #include "DasherTypes.h" | 13 | #include "DasherTypes.h" |
14 | #include "SettingsStore.h" | 14 | #include "SettingsStore.h" |
15 | 15 | ||
16 | namespace Dasher {class CDasherSettingsInterface;} | 16 | namespace Dasher {class CDasherSettingsInterface;} |
17 | class Dasher::CDasherSettingsInterface | 17 | class Dasher::CDasherSettingsInterface |
18 | { | 18 | { |
19 | public: | 19 | public: |
20 | void SettingsDefaults(CSettingsStore* Store); | 20 | void SettingsDefaults(CSettingsStore* Store); |
21 | 21 | ||
22 | // These actually affect the way Dasher works | 22 | // These actually affect the way Dasher works |
23 | //! Change the alphabet in use to NewAlphabetID | 23 | //! Change the alphabet in use to NewAlphabetID |
24 | virtual void ChangeAlphabet(const std::string& NewAlphabetID) {}; | 24 | virtual void ChangeAlphabet(const std::string& ) {}; |
25 | 25 | ||
26 | //! Change the maximum bitrate (effectively the speed) of Dasher | 26 | //! Change the maximum bitrate (effectively the speed) of Dasher |
27 | virtual void ChangeMaxBitRate(double NewMaxBitRate) {}; | 27 | virtual void ChangeMaxBitRate(double ) {}; |
28 | 28 | ||
29 | //! Generate a new langage model. Not usually needed | 29 | //! Generate a new langage model. Not usually needed |
30 | virtual void ChangeLanguageModel(unsigned int NewLanguageModelID) {}; | 30 | virtual void ChangeLanguageModel(unsigned int ) {}; |
31 | 31 | ||
32 | //! Generate a new view of the model. Call it with 0 when starting up | 32 | //! Generate a new view of the model. Call it with 0 when starting up |
33 | virtual void ChangeView(unsigned int NewViewID) {}; | 33 | virtual void ChangeView(unsigned int ) {}; |
34 | 34 | ||
35 | //! Change the orientation (l->r, r->l, so on) of the model | 35 | //! Change the orientation (l->r, r->l, so on) of the model |
36 | virtual void ChangeOrientation(Opts::ScreenOrientations Orientation) {}; | 36 | virtual void ChangeOrientation(Opts::ScreenOrientations ) {}; |
37 | 37 | ||
38 | //! Set the file encoding of output files to Encoding | 38 | //! Set the file encoding of output files to Encoding |
39 | virtual void SetFileEncoding(Opts::FileEncodingFormats Encoding) {}; | 39 | virtual void SetFileEncoding(Opts::FileEncodingFormats ) {}; |
40 | 40 | ||
41 | //! Inform the core that the screen has this size | 41 | //! Inform the core that the screen has this size |
42 | virtual void SetScreenSize(long Width, long Height) {}; | 42 | virtual void SetScreenSize(long , long ) {}; |
43 | 43 | ||
44 | //! Set the size of the font used in the Dasher canvas | 44 | //! Set the size of the font used in the Dasher canvas |
45 | virtual void SetDasherFontSize(Dasher::Opts::FontSize fontsize) {}; | 45 | virtual void SetDasherFontSize(Dasher::Opts::FontSize ) {}; |
46 | 46 | ||
47 | //! Set the number of dimensions of input (either 1 or 2) | 47 | //! Set the number of dimensions of input (either 1 or 2) |
48 | virtual void SetDasherDimensions(bool Value) {}; | 48 | virtual void SetDasherDimensions(bool ) {}; |
49 | 49 | ||
50 | // These are recommended options for the Dasher GUI. {{{ They don't actually | 50 | // These are recommended options for the Dasher GUI. {{{ They don't actually |
51 | // change the way Dasher works. They are part of the Dasher interface | 51 | // change the way Dasher works. They are part of the Dasher interface |
52 | // anyway so that it can handle option saving for you, and to make it | 52 | // anyway so that it can handle option saving for you, and to make it |
53 | // easy for the Dasher engine to control the GUI later on. }}} | 53 | // easy for the Dasher engine to control the GUI later on. }}} |
54 | 54 | ||
55 | //! True if toolbar should be shown, false otherwise | 55 | //! True if toolbar should be shown, false otherwise |
56 | virtual void ShowToolbar(bool Value) {}; | 56 | virtual void ShowToolbar(bool ) {}; |
57 | 57 | ||
58 | //! True if toolbar should show text, false otherwse | 58 | //! True if toolbar should show text, false otherwse |
59 | virtual void ShowToolbarText(bool Value) {}; | 59 | virtual void ShowToolbarText(bool ) {}; |
60 | 60 | ||
61 | //! True if toolbar should have large icons, false otherwise | 61 | //! True if toolbar should have large icons, false otherwise |
62 | virtual void ShowToolbarLargeIcons(bool Value) {}; | 62 | virtual void ShowToolbarLargeIcons(bool ) {}; |
63 | 63 | ||
64 | //! True if the speed slider should be shown, false otherwise | 64 | //! True if the speed slider should be shown, false otherwise |
65 | virtual void ShowSpeedSlider(bool Value) {}; | 65 | virtual void ShowSpeedSlider(bool ) {}; |
66 | 66 | ||
67 | //! True if the window layout should be fixed, false otherwise | 67 | //! True if the window layout should be fixed, false otherwise |
68 | virtual void FixLayout(bool Value) {}; | 68 | virtual void FixLayout(bool ) {}; |
69 | 69 | ||
70 | //! True if new files should be timestamped, false otherwise | 70 | //! True if new files should be timestamped, false otherwise |
71 | virtual void TimeStampNewFiles(bool Value) {}; | 71 | virtual void TimeStampNewFiles(bool ) {}; |
72 | 72 | ||
73 | //! True if all text should be copied to clipboard when Dasher is stopped, false otherwise | 73 | //! True if all text should be copied to clipboard when Dasher is stopped, false otherwise |
74 | virtual void CopyAllOnStop(bool Value) {}; | 74 | virtual void CopyAllOnStop(bool ) {}; |
75 | 75 | ||
76 | //! True if a box should be drawn to represent the logical position of the mouse | 76 | //! True if a box should be drawn to represent the logical position of the mouse |
77 | virtual void DrawMouse(bool Value) {}; | 77 | virtual void DrawMouse(bool ) {}; |
78 | 78 | ||
79 | //! Set the editbox font | 79 | //! Set the editbox font |
80 | virtual void SetEditFont(std::string Name, long Size) {}; | 80 | virtual void SetEditFont(std::string , long ) {}; |
81 | 81 | ||
82 | //! Set the canvas font | 82 | //! Set the canvas font |
83 | virtual void SetDasherFont(std::string Name) {}; | 83 | virtual void SetDasherFont(std::string ) {}; |
84 | 84 | ||
85 | //! Set the height of the edit box | 85 | //! Set the height of the edit box |
86 | virtual void SetEditHeight(long Value) {}; | 86 | virtual void SetEditHeight(long ) {}; |
87 | 87 | ||
88 | //! Should Dasher start and stop on space bar? | 88 | //! Should Dasher start and stop on space bar? |
89 | virtual void StartOnSpace(bool Value) {}; | 89 | virtual void StartOnSpace(bool ) {}; |
90 | 90 | ||
91 | //! Should Dasher start and stop on left mouse button? | 91 | //! Should Dasher start and stop on left mouse button? |
92 | virtual void StartOnLeft(bool Value) {}; | 92 | virtual void StartOnLeft(bool ) {}; |
93 | 93 | ||
94 | //! Should Dasher be keyboard controlled? | 94 | //! Should Dasher be keyboard controlled? |
95 | virtual void KeyControl(bool Value) {}; | 95 | virtual void KeyControl(bool ) {}; |
96 | 96 | ||
97 | //! Should Dasher pause when the pointer leaves the window? | 97 | //! Should Dasher pause when the pointer leaves the window? |
98 | virtual void WindowPause(bool Value) {}; | 98 | virtual void WindowPause(bool ) {}; |
99 | }; | 99 | }; |
100 | 100 | ||
101 | 101 | ||
102 | #include <string> | 102 | #include <string> |
103 | 103 | ||
104 | namespace Dasher | 104 | namespace Dasher |
105 | { | 105 | { |
106 | namespace Keys | 106 | namespace Keys |
107 | { | 107 | { |
108 | // Standard Option strings. You are encouraged to use these constants. | 108 | // Standard Option strings. You are encouraged to use these constants. |
109 | // ------------------------------------------------------------------- | 109 | // ------------------------------------------------------------------- |
110 | 110 | ||
111 | // bool options | 111 | // bool options |
112 | extern const std::string TIME_STAMP; | 112 | extern const std::string TIME_STAMP; |
113 | extern const std::string SHOW_TOOLBAR; | 113 | extern const std::string SHOW_TOOLBAR; |
114 | extern const std::string SHOW_TOOLBAR_TEXT; | 114 | extern const std::string SHOW_TOOLBAR_TEXT; |
diff --git a/inputmethods/dasher/DasherView.cpp b/inputmethods/dasher/DasherView.cpp index 3b8cb64..8e32cf1 100644 --- a/inputmethods/dasher/DasherView.cpp +++ b/inputmethods/dasher/DasherView.cpp | |||
@@ -11,40 +11,40 @@ using namespace Dasher; | |||
11 | 11 | ||
12 | 12 | ||
13 | CDasherView::CDasherView(CDasherScreen* DasherScreen, CDasherModel& DasherModel, Opts::ScreenOrientations Orientation) | 13 | CDasherView::CDasherView(CDasherScreen* DasherScreen, CDasherModel& DasherModel, Opts::ScreenOrientations Orientation) |
14 | : m_Screen(DasherScreen), m_DasherModel(DasherModel), ScreenOrientation(Orientation), ColourMode(false) | 14 | : m_Screen(DasherScreen), m_DasherModel(DasherModel), ScreenOrientation(Orientation), ColourMode(false) |
15 | { | 15 | { |
16 | //XYScale = (double)m_Screen->GetHeight() / m_Screen->GetWidth(); | 16 | //XYScale = (double)m_Screen->GetHeight() / m_Screen->GetWidth(); |
17 | } | 17 | } |
18 | 18 | ||
19 | 19 | ||
20 | void CDasherView::ChangeOrientation(Dasher::Opts::ScreenOrientations Orientation) | 20 | void CDasherView::ChangeOrientation(Dasher::Opts::ScreenOrientations Orientation) |
21 | { | 21 | { |
22 | ScreenOrientation = Orientation; | 22 | ScreenOrientation = Orientation; |
23 | Render(); | 23 | Render(); |
24 | } | 24 | } |
25 | 25 | ||
26 | 26 | ||
27 | void CDasherView::FlushAt(int mousex,int mousey) | 27 | void CDasherView::FlushAt(int ,int ) |
28 | { | 28 | { |
29 | m_DasherModel.Flush(0,0); | 29 | m_DasherModel.Flush(0,0); |
30 | } | 30 | } |
31 | 31 | ||
32 | int CDasherView::RecursiveRender(CDasherNode* Render, myint y1,myint y2,int mostleft, bool text) | 32 | int CDasherView::RecursiveRender(CDasherNode* Render, myint y1,myint y2,int mostleft, bool text) |
33 | { | 33 | { |
34 | symbol CurChar = Render->Symbol(); | 34 | // symbol CurChar = Render->Symbol(); |
35 | int Color; | 35 | int Color; |
36 | 36 | ||
37 | if (ColourMode==true) { | 37 | if (ColourMode==true) { |
38 | Color = Render->Colour(); | 38 | Color = Render->Colour(); |
39 | } else { | 39 | } else { |
40 | Color = Render->Phase()%3; | 40 | Color = Render->Phase()%3; |
41 | } | 41 | } |
42 | 42 | ||
43 | if (RenderNode(Render->Symbol(), Color, Render->Cscheme(), y1, y2, mostleft, Render->m_bForce, text)) | 43 | if (RenderNode(Render->Symbol(), Color, Render->Cscheme(), y1, y2, mostleft, Render->m_bForce, text)) |
44 | RenderGroups(Render, y1, y2, text); | 44 | RenderGroups(Render, y1, y2, text); |
45 | else | 45 | else |
46 | Render->Kill(); | 46 | Render->Kill(); |
47 | 47 | ||
48 | CDasherNode** const Children=Render->Children(); | 48 | CDasherNode** const Children=Render->Children(); |
49 | if (!Children) | 49 | if (!Children) |
50 | return 0; | 50 | return 0; |
diff --git a/inputmethods/dasher/DasherView.h b/inputmethods/dasher/DasherView.h index 81cc24e..6257c03 100644 --- a/inputmethods/dasher/DasherView.h +++ b/inputmethods/dasher/DasherView.h | |||
@@ -15,33 +15,33 @@ | |||
15 | #ifndef __DasherView_h_ | 15 | #ifndef __DasherView_h_ |
16 | #define __DasherView_h_ | 16 | #define __DasherView_h_ |
17 | 17 | ||
18 | #include "MSVC_Unannoy.h" | 18 | #include "MSVC_Unannoy.h" |
19 | #include "DasherScreen.h" | 19 | #include "DasherScreen.h" |
20 | #include "DasherModel.h" | 20 | #include "DasherModel.h" |
21 | 21 | ||
22 | // CDasherView is an abstract view class | 22 | // CDasherView is an abstract view class |
23 | // The implentation must provide several functions - defined here as pure virtual functions | 23 | // The implentation must provide several functions - defined here as pure virtual functions |
24 | // See the CDasherViewSquare class for an example | 24 | // See the CDasherViewSquare class for an example |
25 | 25 | ||
26 | namespace Dasher {class CDasherView;} | 26 | namespace Dasher {class CDasherView;} |
27 | class Dasher::CDasherView | 27 | class Dasher::CDasherView |
28 | { | 28 | { |
29 | public: | 29 | public: |
30 | CDasherView(CDasherScreen* DasherScreen, CDasherModel& DasherModel, Dasher::Opts::ScreenOrientations Orientation=Dasher::Opts::LeftToRight); | 30 | CDasherView(CDasherScreen* DasherScreen, CDasherModel& DasherModel, Dasher::Opts::ScreenOrientations Orientation=Dasher::Opts::LeftToRight); |
31 | ~CDasherView() {} | 31 | virtual ~CDasherView() {} |
32 | 32 | ||
33 | void ChangeOrientation(Dasher::Opts::ScreenOrientations Orientation); | 33 | void ChangeOrientation(Dasher::Opts::ScreenOrientations Orientation); |
34 | 34 | ||
35 | // TODO Sort this out | 35 | // TODO Sort this out |
36 | void FlushAt(int mousex,int mousey); | 36 | void FlushAt(int mousex,int mousey); |
37 | 37 | ||
38 | // renders Dasher | 38 | // renders Dasher |
39 | inline void Render(); | 39 | inline void Render(); |
40 | 40 | ||
41 | // translates the screen coordinates to Dasher coordinates and calls | 41 | // translates the screen coordinates to Dasher coordinates and calls |
42 | // dashermodel.TapOnDisplay | 42 | // dashermodel.TapOnDisplay |
43 | virtual void TapOnDisplay(int mousex, int mousey, unsigned long Time)=0; | 43 | virtual void TapOnDisplay(int mousex, int mousey, unsigned long Time)=0; |
44 | 44 | ||
45 | virtual void ChangeScreen(CDasherScreen* NewScreen) | 45 | virtual void ChangeScreen(CDasherScreen* NewScreen) |
46 | { | 46 | { |
47 | m_Screen=NewScreen; | 47 | m_Screen=NewScreen; |
diff --git a/inputmethods/dasher/PPMLanguageModel.cpp b/inputmethods/dasher/PPMLanguageModel.cpp index b725a2b..137b07f 100644 --- a/inputmethods/dasher/PPMLanguageModel.cpp +++ b/inputmethods/dasher/PPMLanguageModel.cpp | |||
@@ -59,46 +59,46 @@ CPPMLanguageModel::CPPMnode * CPPMLanguageModel::CPPMnode::add_symbol_to_node(in | |||
59 | ///////////////////////////////////////////////////////////////////// | 59 | ///////////////////////////////////////////////////////////////////// |
60 | 60 | ||
61 | CPPMLanguageModel::CPPMLanguageModel(CAlphabet *_alphabet,int _normalization) | 61 | CPPMLanguageModel::CPPMLanguageModel(CAlphabet *_alphabet,int _normalization) |
62 | : CLanguageModel(_alphabet,_normalization) | 62 | : CLanguageModel(_alphabet,_normalization) |
63 | { | 63 | { |
64 | root=new CPPMnode(-1); | 64 | root=new CPPMnode(-1); |
65 | m_rootcontext=new CPPMContext(root,0); | 65 | m_rootcontext=new CPPMContext(root,0); |
66 | } | 66 | } |
67 | 67 | ||
68 | 68 | ||
69 | CPPMLanguageModel::~CPPMLanguageModel() | 69 | CPPMLanguageModel::~CPPMLanguageModel() |
70 | { | 70 | { |
71 | delete root; | 71 | delete root; |
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
75 | bool CPPMLanguageModel::GetProbs(CContext *context,vector<unsigned int> &probs,double addprob) | 75 | bool CPPMLanguageModel::GetProbs(CContext *context,vector<unsigned int> &probs,double ) |
76 | // get the probability distribution at the context | 76 | // get the probability distribution at the context |
77 | { | 77 | { |
78 | // seems like we have to have this hack for VC++ | 78 | // seems like we have to have this hack for VC++ |
79 | CPPMContext *ppmcontext=static_cast<CPPMContext *> (context); | 79 | CPPMContext *ppmcontext=static_cast<CPPMContext *> (context); |
80 | 80 | ||
81 | 81 | ||
82 | int modelchars=GetNumberModelChars(); | 82 | int modelchars=GetNumberModelChars(); |
83 | int norm=CLanguageModel::normalization(); | 83 | int norm=CLanguageModel::normalization(); |
84 | probs.resize(modelchars); | 84 | probs.resize(modelchars); |
85 | CPPMnode *temp,*s; | 85 | CPPMnode *temp,*s; |
86 | int loop,total; | 86 | int loop,total; |
87 | int sym; | 87 | int sym; |
88 | ulong spent=0; | 88 | // ulong spent=0; |
89 | ulong size_of_slice; | 89 | ulong size_of_slice; |
90 | bool *exclusions=new bool [modelchars]; | 90 | bool *exclusions=new bool [modelchars]; |
91 | ulong uniform=modelchars; | 91 | ulong uniform=modelchars; |
92 | ulong tospend=norm-uniform; | 92 | ulong tospend=norm-uniform; |
93 | temp=ppmcontext->head; | 93 | temp=ppmcontext->head; |
94 | for (loop=0; loop <modelchars; loop++) { /* set up the exclusions array */ | 94 | for (loop=0; loop <modelchars; loop++) { /* set up the exclusions array */ |
95 | probs[loop]=0; | 95 | probs[loop]=0; |
96 | exclusions[loop]=0; | 96 | exclusions[loop]=0; |
97 | } | 97 | } |
98 | while (temp!=0) { | 98 | while (temp!=0) { |
99 | //Usprintf(debug,TEXT("tospend %u\n"),tospend); | 99 | //Usprintf(debug,TEXT("tospend %u\n"),tospend); |
100 | //DebugOutput(TEXT("round\n")); | 100 | //DebugOutput(TEXT("round\n")); |
101 | total=0; | 101 | total=0; |
102 | s=temp->child; | 102 | s=temp->child; |
103 | while (s) { | 103 | while (s) { |
104 | sym=s->symbol; | 104 | sym=s->symbol; |
@@ -179,33 +179,33 @@ void CPPMLanguageModel::AddSymbol(CPPMLanguageModel::CPPMContext &context,int sy | |||
179 | temp=temp->vine; | 179 | temp=temp->vine; |
180 | } | 180 | } |
181 | vineptr->vine=root; | 181 | vineptr->vine=root; |
182 | if (context.order>MAX_ORDER){ | 182 | if (context.order>MAX_ORDER){ |
183 | context.head=context.head->vine; | 183 | context.head=context.head->vine; |
184 | context.order--; | 184 | context.order--; |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | 188 | ||
189 | // update context with symbol 'Symbol' | 189 | // update context with symbol 'Symbol' |
190 | void CPPMLanguageModel::EnterSymbol(CContext* Context, modelchar Symbol) | 190 | void CPPMLanguageModel::EnterSymbol(CContext* Context, modelchar Symbol) |
191 | { | 191 | { |
192 | CPPMLanguageModel::CPPMContext& context = * static_cast<CPPMContext *> (Context); | 192 | CPPMLanguageModel::CPPMContext& context = * static_cast<CPPMContext *> (Context); |
193 | 193 | ||
194 | CPPMnode *find; | 194 | CPPMnode *find; |
195 | CPPMnode *temp=context.head; | 195 | // CPPMnode *temp=context.head; |
196 | 196 | ||
197 | while (context.head) { | 197 | while (context.head) { |
198 | find =context.head->find_symbol(Symbol); | 198 | find =context.head->find_symbol(Symbol); |
199 | if (find) { | 199 | if (find) { |
200 | context.order++; | 200 | context.order++; |
201 | context.head=find; | 201 | context.head=find; |
202 | //Usprintf(debug,TEXT("found context %x order %d\n"),head,order); | 202 | //Usprintf(debug,TEXT("found context %x order %d\n"),head,order); |
203 | //DebugOutput(debug); | 203 | //DebugOutput(debug); |
204 | return; | 204 | return; |
205 | } | 205 | } |
206 | context.order--; | 206 | context.order--; |
207 | context.head=context.head->vine; | 207 | context.head=context.head->vine; |
208 | } | 208 | } |
209 | 209 | ||
210 | if (context.head==0) { | 210 | if (context.head==0) { |
211 | context.head=root; | 211 | context.head=root; |
@@ -233,33 +233,33 @@ void CPPMLanguageModel::dumpSymbol(int symbol) | |||
233 | 233 | ||
234 | void CPPMLanguageModel::dumpString( char *str, int pos, int len ) | 234 | void CPPMLanguageModel::dumpString( char *str, int pos, int len ) |
235 | // Dump the string STR starting at position POS | 235 | // Dump the string STR starting at position POS |
236 | { | 236 | { |
237 | char cc; | 237 | char cc; |
238 | int p; | 238 | int p; |
239 | for (p = pos; p<pos+len; p++) { | 239 | for (p = pos; p<pos+len; p++) { |
240 | cc = str [p]; | 240 | cc = str [p]; |
241 | if ((cc <= 31) || (cc >= 127)) | 241 | if ((cc <= 31) || (cc >= 127)) |
242 | printf( "<%d>", cc ); | 242 | printf( "<%d>", cc ); |
243 | else | 243 | else |
244 | printf( "%c", cc ); | 244 | printf( "%c", cc ); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | 247 | ||
248 | 248 | ||
249 | void CPPMLanguageModel::dumpTrie( CPPMLanguageModel::CPPMnode *t, int d ) | 249 | void CPPMLanguageModel::dumpTrie( CPPMLanguageModel::CPPMnode *, int ) |
250 | // diagnostic display of the PPM trie from node t and deeper | 250 | // diagnostic display of the PPM trie from node t and deeper |
251 | { | 251 | { |
252 | //TODO | 252 | //TODO |
253 | /* | 253 | /* |
254 | dchar debug[256]; | 254 | dchar debug[256]; |
255 | int sym; | 255 | int sym; |
256 | CPPMnode *s; | 256 | CPPMnode *s; |
257 | Usprintf( debug,TEXT("%5d %7x "), d, t ); | 257 | Usprintf( debug,TEXT("%5d %7x "), d, t ); |
258 | //TODO: Uncomment this when headers sort out | 258 | //TODO: Uncomment this when headers sort out |
259 | //DebugOutput(debug); | 259 | //DebugOutput(debug); |
260 | if (t < 0) // pointer to input | 260 | if (t < 0) // pointer to input |
261 | printf( " <" ); | 261 | printf( " <" ); |
262 | else { | 262 | else { |
263 | Usprintf(debug,TEXT( " %3d %5d %7x %7x %7x <"), t->symbol,t->count, t->vine, t->child, t->next ); | 263 | Usprintf(debug,TEXT( " %3d %5d %7x %7x %7x <"), t->symbol,t->count, t->vine, t->child, t->next ); |
264 | //TODO: Uncomment this when headers sort out | 264 | //TODO: Uncomment this when headers sort out |
265 | //DebugOutput(debug); | 265 | //DebugOutput(debug); |
diff --git a/inputmethods/dasher/PPMLanguageModel.h b/inputmethods/dasher/PPMLanguageModel.h index bd860b8..7025a0a 100644 --- a/inputmethods/dasher/PPMLanguageModel.h +++ b/inputmethods/dasher/PPMLanguageModel.h | |||
@@ -3,58 +3,59 @@ | |||
3 | ///////////////////////////////////////////////////////////////////////////// | 3 | ///////////////////////////////////////////////////////////////////////////// |
4 | // | 4 | // |
5 | // Copyright (c) 1999-2002 David Ward | 5 | // Copyright (c) 1999-2002 David Ward |
6 | // | 6 | // |
7 | ///////////////////////////////////////////////////////////////////////////// | 7 | ///////////////////////////////////////////////////////////////////////////// |
8 | 8 | ||
9 | #ifndef __PPMLanguageModel_h__ | 9 | #ifndef __PPMLanguageModel_h__ |
10 | #define __PPMLanguageModel_h__ | 10 | #define __PPMLanguageModel_h__ |
11 | 11 | ||
12 | #include "NoClones.h" | 12 | #include "NoClones.h" |
13 | #include "MSVC_Unannoy.h" | 13 | #include "MSVC_Unannoy.h" |
14 | #include <vector> | 14 | #include <vector> |
15 | #include <stdio.h> | 15 | #include <stdio.h> |
16 | 16 | ||
17 | #include "LanguageModel.h" | 17 | #include "LanguageModel.h" |
18 | 18 | ||
19 | static char dumpTrieStr[40000]; | 19 | // static char dumpTrieStr[40000]; |
20 | const int MAX_ORDER = 5; | 20 | const int MAX_ORDER = 5; |
21 | const int maxcont =200; | 21 | const int maxcont =200; |
22 | 22 | ||
23 | namespace Dasher {class CPPMLanguageModel;} | 23 | namespace Dasher {class CPPMLanguageModel;} |
24 | class Dasher::CPPMLanguageModel : public Dasher::CLanguageModel, private NoClones | 24 | class Dasher::CPPMLanguageModel : public Dasher::CLanguageModel, private NoClones |
25 | { | 25 | { |
26 | public: | 26 | public: |
27 | CPPMLanguageModel(CAlphabet *_alphabet, int _normalization); | 27 | CPPMLanguageModel(CAlphabet *_alphabet, int _normalization); |
28 | ~CPPMLanguageModel(); | 28 | virtual ~CPPMLanguageModel(); |
29 | 29 | ||
30 | class CPPMnode { | 30 | class CPPMnode { |
31 | public: | 31 | public: |
32 | CPPMnode* find_symbol(int sym); | 32 | CPPMnode* find_symbol(int sym); |
33 | CPPMnode* add_symbol_to_node(int sym,int *update); | 33 | CPPMnode* add_symbol_to_node(int sym,int *update); |
34 | CPPMnode* child; | 34 | CPPMnode* child; |
35 | CPPMnode* next; | 35 | CPPMnode* next; |
36 | CPPMnode* vine; | 36 | CPPMnode* vine; |
37 | short int count; | 37 | short int count; |
38 | const short int symbol; | 38 | const short int symbol; |
39 | CPPMnode(int sym); | 39 | CPPMnode(int sym); |
40 | }; | 40 | }; |
41 | 41 | ||
42 | class CPPMContext : public CContext { | 42 | class CPPMContext : public CContext { |
43 | public: | 43 | public: |
44 | CPPMContext(CPPMContext const &input) {head = input.head;order= input.order;} | 44 | CPPMContext(CPPMContext const &input) : CContext(input) |
45 | { head = input.head;order= input.order;} | ||
45 | CPPMContext(CPPMnode* _head=0, int _order=0) : head(_head),order(_order) {}; | 46 | CPPMContext(CPPMnode* _head=0, int _order=0) : head(_head),order(_order) {}; |
46 | ~CPPMContext() {}; | 47 | ~CPPMContext() {}; |
47 | void dump(); | 48 | void dump(); |
48 | CPPMnode* head; | 49 | CPPMnode* head; |
49 | int order; | 50 | int order; |
50 | }; | 51 | }; |
51 | 52 | ||
52 | void ReleaseContext(CContext*); | 53 | void ReleaseContext(CContext*); |
53 | CContext* GetRootContext(); | 54 | CContext* GetRootContext(); |
54 | inline CContext* CloneContext(CContext*); | 55 | inline CContext* CloneContext(CContext*); |
55 | void EnterSymbol(CContext* context, modelchar Symbol); | 56 | void EnterSymbol(CContext* context, modelchar Symbol); |
56 | //inline bool GetProbs(CContext*,std::vector<symbol> &newchars,std::vector<unsigned int> &groups,std::vector<unsigned int> &probs,double addprob); | 57 | //inline bool GetProbs(CContext*,std::vector<symbol> &newchars,std::vector<unsigned int> &groups,std::vector<unsigned int> &probs,double addprob); |
57 | bool GetProbs(CContext*, std::vector<unsigned int> &Probs, double AddProb); | 58 | bool GetProbs(CContext*, std::vector<unsigned int> &Probs, double AddProb); |
58 | 59 | ||
59 | void LearnSymbol(CContext* Context, modelchar Symbol); | 60 | void LearnSymbol(CContext* Context, modelchar Symbol); |
60 | void dump(); | 61 | void dump(); |
diff --git a/inputmethods/dasher/QtDasherImpl.cc b/inputmethods/dasher/QtDasherImpl.cc index d72f6d9..f4a70dd 100644 --- a/inputmethods/dasher/QtDasherImpl.cc +++ b/inputmethods/dasher/QtDasherImpl.cc | |||
@@ -8,33 +8,33 @@ | |||
8 | 8 | ||
9 | /* XPM */ | 9 | /* XPM */ |
10 | static const char * qtdasher_xpm[]={ | 10 | static const char * qtdasher_xpm[]={ |
11 | "28 7 2 1", | 11 | "28 7 2 1", |
12 | "# c #303030", | 12 | "# c #303030", |
13 | " c None", | 13 | " c None", |
14 | " ########################## ", | 14 | " ########################## ", |
15 | " ", | 15 | " ", |
16 | " # # ", | 16 | " # # ", |
17 | " # # # # ", | 17 | " # # # # ", |
18 | " # # # # ", | 18 | " # # # # ", |
19 | " # # # ", | 19 | " # # # ", |
20 | " ########################## "}; | 20 | " ########################## "}; |
21 | 21 | ||
22 | 22 | ||
23 | QtDasherImpl::QtDasherImpl() | 23 | QtDasherImpl::QtDasherImpl() |
24 | : qtdasherwidget(0), icn(0), qtdasherinterface(0) | 24 | : qtdasherinterface(0), qtdasherwidget(0), icn(0) |
25 | { | 25 | { |
26 | } | 26 | } |
27 | 27 | ||
28 | QtDasherImpl::~QtDasherImpl() | 28 | QtDasherImpl::~QtDasherImpl() |
29 | { | 29 | { |
30 | delete qtdasherwidget; | 30 | delete qtdasherwidget; |
31 | delete icn; | 31 | delete icn; |
32 | } | 32 | } |
33 | 33 | ||
34 | QWidget *QtDasherImpl::inputMethod( QWidget *parent, Qt::WFlags f ) | 34 | QWidget *QtDasherImpl::inputMethod( QWidget *parent, Qt::WFlags f ) |
35 | { | 35 | { |
36 | if ( !qtdasherwidget ) { | 36 | if ( !qtdasherwidget ) { |
37 | qtdasherwidget = new QtDasherPlugin( parent, "Dasher", f ); | 37 | qtdasherwidget = new QtDasherPlugin( parent, "Dasher", f ); |
38 | } | 38 | } |
39 | return qtdasherwidget; | 39 | return qtdasherwidget; |
40 | } | 40 | } |
diff --git a/inputmethods/dasher/QtDasherPlugin.cc b/inputmethods/dasher/QtDasherPlugin.cc index cf4fc2c..f491769 100644 --- a/inputmethods/dasher/QtDasherPlugin.cc +++ b/inputmethods/dasher/QtDasherPlugin.cc | |||
@@ -36,33 +36,33 @@ QSize QtDasherPlugin::sizeHint() const | |||
36 | QtDasherPlugin::~QtDasherPlugin() | 36 | QtDasherPlugin::~QtDasherPlugin() |
37 | { | 37 | { |
38 | delete d; | 38 | delete d; |
39 | } | 39 | } |
40 | 40 | ||
41 | void QtDasherPlugin::resetState() | 41 | void QtDasherPlugin::resetState() |
42 | { | 42 | { |
43 | flushcount=0; | 43 | flushcount=0; |
44 | interface->Start(); | 44 | interface->Start(); |
45 | interface->Redraw(); | 45 | interface->Redraw(); |
46 | } | 46 | } |
47 | 47 | ||
48 | void QtDasherPlugin::unflush() | 48 | void QtDasherPlugin::unflush() |
49 | { | 49 | { |
50 | if (flushcount==0) | 50 | if (flushcount==0) |
51 | return; | 51 | return; |
52 | for (flushcount; flushcount>0; flushcount--) { | 52 | for (; flushcount>0; flushcount--) { |
53 | deletetext(); | 53 | deletetext(); |
54 | } | 54 | } |
55 | } | 55 | } |
56 | 56 | ||
57 | void QtDasherPlugin::output(int Symbol) | 57 | void QtDasherPlugin::output(int Symbol) |
58 | { | 58 | { |
59 | std::string label = interface->GetEditText(Symbol); | 59 | std::string label = interface->GetEditText(Symbol); |
60 | QString unicodestring = utf8_codec->toUnicode(label.c_str()); | 60 | QString unicodestring = utf8_codec->toUnicode(label.c_str()); |
61 | for (int i=0; i<int(unicodestring.length()); i++) { | 61 | for (int i=0; i<int(unicodestring.length()); i++) { |
62 | emit key( unicodestring[i].unicode(), 0, 0, true, false ); | 62 | emit key( unicodestring[i].unicode(), 0, 0, true, false ); |
63 | emit key( unicodestring[i].unicode(), 0, 0, false, false ); | 63 | emit key( unicodestring[i].unicode(), 0, 0, false, false ); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | void QtDasherPlugin::deletetext() | 67 | void QtDasherPlugin::deletetext() |
68 | { | 68 | { |
diff --git a/inputmethods/dasher/QtDasherPlugin.h b/inputmethods/dasher/QtDasherPlugin.h index 5f70acf..c979a2f 100644 --- a/inputmethods/dasher/QtDasherPlugin.h +++ b/inputmethods/dasher/QtDasherPlugin.h | |||
@@ -9,33 +9,33 @@ class QtDasherPlugin : public QFrame, public CDashEditbox | |||
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | public: | 10 | public: |
11 | QtDasherPlugin(QWidget* parent=0, const char* name=0, WFlags f=0); | 11 | QtDasherPlugin(QWidget* parent=0, const char* name=0, WFlags f=0); |
12 | ~QtDasherPlugin(); | 12 | ~QtDasherPlugin(); |
13 | 13 | ||
14 | void resetState(); | 14 | void resetState(); |
15 | QSize sizeHint() const; | 15 | QSize sizeHint() const; |
16 | 16 | ||
17 | void write_to_file() {}; | 17 | void write_to_file() {}; |
18 | void get_new_context(std::string&, int) {}; | 18 | void get_new_context(std::string&, int) {}; |
19 | void unflush(); | 19 | void unflush(); |
20 | void output(int); | 20 | void output(int); |
21 | void deletetext(); | 21 | void deletetext(); |
22 | void flush(int); | 22 | void flush(int); |
23 | void Clear() {}; | 23 | void Clear() {}; |
24 | void SetEncoding(Dasher::Opts::FileEncodingFormats) {}; | 24 | void SetEncoding(Dasher::Opts::FileEncodingFormats) {}; |
25 | void SetFont(std::string Name, long Size) {}; | 25 | void SetFont(std::string , long ) {}; |
26 | 26 | ||
27 | signals: | 27 | signals: |
28 | void key( ushort, ushort, ushort, bool, bool); | 28 | void key( ushort, ushort, ushort, bool, bool); |
29 | 29 | ||
30 | private: | 30 | private: |
31 | QtDasherScreen *d; | 31 | QtDasherScreen *d; |
32 | CDasherInterface *interface; | 32 | CDasherInterface *interface; |
33 | int flushcount; | 33 | int flushcount; |
34 | QUtf8Codec *utf8_codec; | 34 | QUtf8Codec *utf8_codec; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | 37 | ||
38 | 38 | ||
39 | 39 | ||
40 | 40 | ||
41 | 41 | ||
diff --git a/inputmethods/dasher/QtDasherScreen.cc b/inputmethods/dasher/QtDasherScreen.cc index 747b705..2179cfb 100644 --- a/inputmethods/dasher/QtDasherScreen.cc +++ b/inputmethods/dasher/QtDasherScreen.cc | |||
@@ -5,47 +5,52 @@ | |||
5 | 5 | ||
6 | #include <iostream> | 6 | #include <iostream> |
7 | #include <string> | 7 | #include <string> |
8 | 8 | ||
9 | #include <qpointarray.h> | 9 | #include <qpointarray.h> |
10 | #include <qpoint.h> | 10 | #include <qpoint.h> |
11 | 11 | ||
12 | #include "QtDasherScreen.h" | 12 | #include "QtDasherScreen.h" |
13 | #include "DasherScreen.h" | 13 | #include "DasherScreen.h" |
14 | #include "SettingsStore.h" | 14 | #include "SettingsStore.h" |
15 | 15 | ||
16 | #define MAXFONTSIZE 25 | 16 | #define MAXFONTSIZE 25 |
17 | #define MINFONTSIZE 8 | 17 | #define MINFONTSIZE 8 |
18 | 18 | ||
19 | QtDasherScreen::QtDasherScreen (int _width, int _height, | 19 | QtDasherScreen::QtDasherScreen (int _width, int _height, |
20 | CDasherInterface *_interface, | 20 | CDasherInterface *_interface, |
21 | QWidget * _parent, Dasher::CDashEditbox *edit): | 21 | QWidget * _parent, |
22 | QWidget(_parent), interface( _interface ), | 22 | Dasher::CDashEditbox *_edit): |
23 | fontname( "fixed" ), fontsize(12), | 23 | QWidget(_parent), |
24 | Dasher::CDasherScreen(_width, _height) | 24 | Dasher::CDasherScreen(_width, _height), |
25 | fontsize(12), | ||
26 | interface( _interface ), | ||
27 | fontname( "fixed" ) | ||
25 | { | 28 | { |
26 | font = QFont (fontname.c_str(), fontsize); | 29 | font = QFont (fontname.c_str(), fontsize); |
27 | painter = new QPainter (); | 30 | painter = new QPainter (); |
28 | 31 | ||
29 | pixmap = new QPixmap (_width, _height); | 32 | pixmap = new QPixmap (_width, _height); |
30 | pixmap->setOptimization(QPixmap::BestOptim); | 33 | pixmap->setOptimization(QPixmap::BestOptim); |
31 | interface->SetSettingsStore(new CSettingsStore); | 34 | interface->SetSettingsStore(new CSettingsStore); |
32 | 35 | ||
33 | interface->ChangeLanguageModel(0); | 36 | interface->ChangeLanguageModel(0); |
34 | interface->ChangeView(0); | 37 | interface->ChangeView(0); |
35 | interface->ChangeEdit(edit); | 38 | interface->ChangeEdit(_edit); |
39 | edit = _edit; | ||
40 | |||
36 | 41 | ||
37 | /* interface->GetFontSizes(&FontSizes); | 42 | /* interface->GetFontSizes(&FontSizes); |
38 | 43 | ||
39 | for (int i=0; i<FontSizes.size(); i++) { | 44 | for (int i=0; i<FontSizes.size(); i++) { |
40 | if (FontSizes[i]>Fonts.size()) | 45 | if (FontSizes[i]>Fonts.size()) |
41 | Fonts.resize((FontSizes[i])+1); | 46 | Fonts.resize((FontSizes[i])+1); |
42 | Fonts[FontSizes[i]]= QFont (fontname.c_str(), FontSizes[i]); | 47 | Fonts[FontSizes[i]]= QFont (fontname.c_str(), FontSizes[i]); |
43 | // Fonts[FontSizes[i]].setPixelSize(FontSizes[i]); | 48 | // Fonts[FontSizes[i]].setPixelSize(FontSizes[i]); |
44 | } | 49 | } |
45 | */ | 50 | */ |
46 | interface->ChangeScreen(this); | 51 | interface->ChangeScreen(this); |
47 | 52 | ||
48 | paused=true; | 53 | paused=true; |
49 | 54 | ||
50 | QTimer *tmr = new QTimer(this); | 55 | QTimer *tmr = new QTimer(this); |
51 | connect (tmr, SIGNAL(timeout()), SLOT(timer())); | 56 | connect (tmr, SIGNAL(timeout()), SLOT(timer())); |
@@ -130,33 +135,33 @@ void QtDasherScreen::Polyline(point* Points, int Number) const | |||
130 | QPointArray qpa(Number); | 135 | QPointArray qpa(Number); |
131 | Points_to_QPointArray (Points, Number, qpa); | 136 | Points_to_QPointArray (Points, Number, qpa); |
132 | painter->setPen (SolidLine); | 137 | painter->setPen (SolidLine); |
133 | painter->drawPolyline (qpa); | 138 | painter->drawPolyline (qpa); |
134 | painter->setPen (NoPen); | 139 | painter->setPen (NoPen); |
135 | } | 140 | } |
136 | 141 | ||
137 | void QtDasherScreen::DrawPolygon(point* Points, int Number, int Color, | 142 | void QtDasherScreen::DrawPolygon(point* Points, int Number, int Color, |
138 | Opts::ColorSchemes ColorScheme) const | 143 | Opts::ColorSchemes ColorScheme) const |
139 | { | 144 | { |
140 | painter->setBrush (getColor (Color, ColorScheme)); | 145 | painter->setBrush (getColor (Color, ColorScheme)); |
141 | QPointArray qpa(Number); | 146 | QPointArray qpa(Number); |
142 | Points_to_QPointArray (Points, Number, qpa); | 147 | Points_to_QPointArray (Points, Number, qpa); |
143 | painter->drawPolygon (qpa); | 148 | painter->drawPolygon (qpa); |
144 | } | 149 | } |
145 | 150 | ||
146 | void QtDasherScreen::mousePressEvent (QMouseEvent *e) | 151 | void QtDasherScreen::mousePressEvent (QMouseEvent *) |
147 | { | 152 | { |
148 | paused=false; | 153 | paused=false; |
149 | interface->Unpause(get_time()); | 154 | interface->Unpause(get_time()); |
150 | } | 155 | } |
151 | 156 | ||
152 | void QtDasherScreen::mouseReleaseEvent(QMouseEvent *e) | 157 | void QtDasherScreen::mouseReleaseEvent(QMouseEvent *e) |
153 | { | 158 | { |
154 | QPoint p = e->pos(); | 159 | QPoint p = e->pos(); |
155 | interface->PauseAt(p.x(), p.y()); | 160 | interface->PauseAt(p.x(), p.y()); |
156 | paused=true; | 161 | paused=true; |
157 | } | 162 | } |
158 | 163 | ||
159 | void QtDasherScreen::timer() | 164 | void QtDasherScreen::timer() |
160 | { | 165 | { |
161 | if (paused==false) { | 166 | if (paused==false) { |
162 | QPoint cursorpos; | 167 | QPoint cursorpos; |
diff --git a/inputmethods/dasher/QtDasherScreen.h b/inputmethods/dasher/QtDasherScreen.h index 06689d6..d3d67cb 100644 --- a/inputmethods/dasher/QtDasherScreen.h +++ b/inputmethods/dasher/QtDasherScreen.h | |||
@@ -23,43 +23,43 @@ | |||
23 | 23 | ||
24 | using namespace Dasher; | 24 | using namespace Dasher; |
25 | 25 | ||
26 | class QtDasherScreen : public QWidget, public Dasher::CDasherScreen | 26 | class QtDasherScreen : public QWidget, public Dasher::CDasherScreen |
27 | 27 | ||
28 | { | 28 | { |
29 | Q_OBJECT | 29 | Q_OBJECT |
30 | public: | 30 | public: |
31 | QtDasherScreen (int _width, int _height, | 31 | QtDasherScreen (int _width, int _height, |
32 | CDasherInterface *_interface, | 32 | CDasherInterface *_interface, |
33 | QWidget * _parent=0, Dasher::CDashEditbox* edit=0); | 33 | QWidget * _parent=0, Dasher::CDashEditbox* edit=0); |
34 | QtDasherScreen::~QtDasherScreen(); | 34 | QtDasherScreen::~QtDasherScreen(); |
35 | 35 | ||
36 | void SetFont(std::string Name) | 36 | void SetFont(std::string Name) |
37 | { fontname = Name; /* set_the_font(); */ } | 37 | { fontname = Name; /* set_the_font(); */ } |
38 | 38 | ||
39 | void SetFontSize(Dasher::Opts::FontSize fontsize) | 39 | void SetFontSize(Dasher::Opts::FontSize ) |
40 | { | 40 | { |
41 | #warning QtDasherScreen::SetFontSize() not implemented | 41 | #warning QtDasherScreen::SetFontSize() not implemented |
42 | } | 42 | } |
43 | Dasher::Opts::FontSize GetFontSize() | 43 | Dasher::Opts::FontSize GetFontSize() |
44 | { | 44 | { |
45 | #warning QtDasherScreen::GetFontSize() not implemented | 45 | #warning QtDasherScreen::GetFontSize() not implemented |
46 | return (Dasher::Opts::Normal); | 46 | return (Dasher::Opts::Normal); |
47 | } | 47 | } |
48 | 48 | ||
49 | void TextSize(symbol Character, int* Width, int* Height, int Size) const | 49 | void TextSize(symbol , int* Width, int* Height, int ) const |
50 | { | 50 | { |
51 | // should probably use QPainter::boundingRect() | 51 | // should probably use QPainter::boundingRect() |
52 | *Width = *Height = font.pixelSize(); | 52 | *Width = *Height = font.pixelSize(); |
53 | 53 | ||
54 | } | 54 | } |
55 | void DrawText(symbol Character, int x1, int y1, int Size) const | 55 | void DrawText(symbol Character, int x1, int y1, int Size) const |
56 | { | 56 | { |
57 | // QFont font = QFont (fontname.c_str(), Size); | 57 | // QFont font = QFont (fontname.c_str(), Size); |
58 | // font.setPixelSize(Size); | 58 | // font.setPixelSize(Size); |
59 | QPoint point = QPoint(x1, y1+Size/2); | 59 | QPoint point = QPoint(x1, y1+Size/2); |
60 | 60 | ||
61 | painter->setFont (font); | 61 | painter->setFont (font); |
62 | painter->drawText (point, | 62 | painter->drawText (point, |
63 | QString(interface->GetDisplayText(Character).c_str())); | 63 | QString(interface->GetDisplayText(Character).c_str())); |
64 | } | 64 | } |
65 | 65 | ||
diff --git a/inputmethods/dasher/SettingsStore.cpp b/inputmethods/dasher/SettingsStore.cpp index c5bbfea..f7661bd 100644 --- a/inputmethods/dasher/SettingsStore.cpp +++ b/inputmethods/dasher/SettingsStore.cpp | |||
@@ -89,47 +89,47 @@ void CSettingsStore::SetLongDefault(const string& Key, long Value) | |||
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | void CSettingsStore::SetStringDefault(const string& Key, const string& Value) | 92 | void CSettingsStore::SetStringDefault(const string& Key, const string& Value) |
93 | { | 93 | { |
94 | string TmpValue; | 94 | string TmpValue; |
95 | if ( (StringMap.find(Key)==StringMap.end()) && (!LoadSetting(Key, &TmpValue)) ) | 95 | if ( (StringMap.find(Key)==StringMap.end()) && (!LoadSetting(Key, &TmpValue)) ) |
96 | SetStringOption(Key, Value); | 96 | SetStringOption(Key, Value); |
97 | } | 97 | } |
98 | 98 | ||
99 | 99 | ||
100 | /* Private functions -- Settings are not saved between sessions unless these | 100 | /* Private functions -- Settings are not saved between sessions unless these |
101 | functions are over-ridden. | 101 | functions are over-ridden. |
102 | --------------------------------------------------------------------------*/ | 102 | --------------------------------------------------------------------------*/ |
103 | 103 | ||
104 | 104 | ||
105 | bool CSettingsStore::LoadSetting(const string& Key, bool* Value) | 105 | bool CSettingsStore::LoadSetting(const string& , bool* ) |
106 | { | 106 | { |
107 | return false; | 107 | return false; |
108 | } | 108 | } |
109 | 109 | ||
110 | 110 | ||
111 | bool CSettingsStore::LoadSetting(const string& Key, long* Value) | 111 | bool CSettingsStore::LoadSetting(const string& , long* ) |
112 | { | 112 | { |
113 | return false; | 113 | return false; |
114 | } | 114 | } |
115 | 115 | ||
116 | 116 | ||
117 | bool CSettingsStore::LoadSetting(const string& Key, string* Value) | 117 | bool CSettingsStore::LoadSetting(const string& , string* ) |
118 | { | 118 | { |
119 | return false; | 119 | return false; |
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | void CSettingsStore::SaveSetting(const string& Key, bool Value) | 123 | void CSettingsStore::SaveSetting(const string& , bool ) |
124 | { | 124 | { |
125 | } | 125 | } |
126 | 126 | ||
127 | 127 | ||
128 | void CSettingsStore::SaveSetting(const string& Key, long Value) | 128 | void CSettingsStore::SaveSetting(const string& , long ) |
129 | { | 129 | { |
130 | } | 130 | } |
131 | 131 | ||
132 | 132 | ||
133 | void CSettingsStore::SaveSetting(const string& Key, const string& Value) | 133 | void CSettingsStore::SaveSetting(const string& , const string& ) |
134 | { | 134 | { |
135 | } | 135 | } |