using std::endl;
using std::pair;
-extern string DoAccent(string const &, tex_accent);
-extern string DoAccent(char, tex_accent);
+extern string const DoAccent(string const &, tex_accent);
+extern string const DoAccent(char, tex_accent);
extern BufferView * current_view;
}
-string TransInitState::normalkey(char c, char * t)
+string const TransInitState::normalkey(char c, string const & t)
{
string res;
- if (t) res = t;
+ if (!t.empty()) res = t;
else res = c;
return res;
}
-string TransInitState::deadkey(char c, KmodInfo d)
+string const TransInitState::deadkey(char c, KmodInfo d)
{
deadkey_ = c;
deadkey_info_ = d;
}
-string TransDeadkeyState::normalkey(char c, char * trans)
+string const TransDeadkeyState::normalkey(char c, string const & trans)
{
string res;
}
if (l == 0) {
// Not an exception. Check if it allowed
- if (current_view->buffer()->params.allowAccents == true ||
- countChar(deadkey_info_.allowed, c) > 0) {
+ if (countChar(deadkey_info_.allowed, c) > 0) {
res = DoAccent(c, deadkey_info_.accent);
} else {
// Not allowed
}
-string TransDeadkeyState::deadkey(char c, KmodInfo d)
+string const TransDeadkeyState::deadkey(char c, KmodInfo d)
{
string res;
}
-string TransCombinedState::normalkey(char c, char * trans)
+string const TransCombinedState::normalkey(char c, string const & trans)
{
string res;
}
-string TransCombinedState::deadkey(char c, KmodInfo d)
+string const TransCombinedState::deadkey(char c, KmodInfo d)
{
// Third key in a row. Output the first one and
// reenter with shifted deadkeys
// TransManager
+// Initialize static member.
+Trans TransManager::default_;
+
+
TransManager::TransManager()
: active_(0), t1_(new Trans), t2_(new Trans)
{}
-Trans * TransManager::default_ = new Trans;
-
-
TransManager::~TransManager()
{
delete t1_;
}
-bool TransManager::setCharset(char const * set)
+bool TransManager::setCharset(string const & str)
{
- return chset_.loadFile(set);
+ return chset_.loadFile(str);
}
void TransManager::DisableKeymap()
{
- active_ = default_;
+ active_ = &default_;
lyxerr[Debug::KBMAP] << "Disabling keymap" << endl;
}
void TransManager::insertVerbatim(string const & str, LyXText * text)
{
- int l = str.length();
+ string::size_type const l = str.length();
- for (int i = 0; i < l; ++i){
+ for (string::size_type i = 0; i < l; ++i) {
if (str[i] == '\"'
- && text->GetFont(text->cursor.par(),
+ && text->GetFont(current_view->buffer(),text->cursor.par(),
text->cursor.pos()).latex() == LyXFont::OFF
- && text->GetFont(text->cursor.par(),
+ && text->GetFont(current_view->buffer(),text->cursor.par(),
text->cursor.pos()).language()->lang() != "hebrew")
current_view->insertCorrectQuote();
else
- text->InsertChar(str[i]);
+ text->InsertChar(current_view, str[i]);
}
}
// Could not find an encoding
InsetLatexAccent ins(str);
if (ins.CanDisplay()) {
- text->InsertInset(new InsetLatexAccent(ins));
+ text->InsertInset(current_view, new InsetLatexAccent(ins));
} else {
insertVerbatim(str, text);
}
void TransManager::deadkey(char c, tex_accent accent, LyXText * t)
{
- if (c == 0 && active_ != default_) {
+ if (c == 0 && active_ != &default_) {
// A deadkey was pressed that cannot be printed
// or a accent command was typed in the minibuffer
KmodInfo i;
}
}
- if (active_ == default_ || c == 0) {
+ if (active_ == &default_ || c == 0) {
KmodInfo i;
i.accent = accent;
i.allowed = lyx_accent_table[accent].native;