#include "mathed/formulabase.h"
extern LyXTextClass::size_type current_layout;
-extern int greek_kb_flag;
using std::vector;
using std::find_if;
extern BufferList bufferlist;
extern char ascii_type;
-extern bool math_insert_greek(BufferView *, char);
extern void sigchldchecker(pid_t pid, int * status);
extern int bibitemMaxWidth(BufferView *, LyXFont const &);
break;
case LFUN_LANGUAGE:
- Lang(bv_, argument);
+ lang(bv_, argument);
setState();
owner_->showState();
break;
case LFUN_EMPH:
- Emph(bv_);
+ emph(bv_);
owner_->showState();
break;
case LFUN_BOLD:
- Bold(bv_);
+ bold(bv_);
owner_->showState();
break;
case LFUN_NOUN:
- Noun(bv_);
+ noun(bv_);
owner_->showState();
break;
case LFUN_CODE:
- Code(bv_);
+ code(bv_);
owner_->showState();
break;
case LFUN_SANS:
- Sans(bv_);
+ sans(bv_);
owner_->showState();
break;
case LFUN_ROMAN:
- Roman(bv_);
+ roman(bv_);
owner_->showState();
break;
case LFUN_DEFAULT:
- StyleReset(bv_);
+ styleReset(bv_);
owner_->showState();
break;
case LFUN_UNDERLINE:
- Underline(bv_);
+ underline(bv_);
owner_->showState();
break;
case LFUN_FONT_SIZE:
- FontSize(bv_, argument);
+ fontSize(bv_, argument);
owner_->showState();
break;
case LFUN_FONT_STATE:
- owner_->getLyXFunc()->setMessage(CurrentState(bv_));
+ owner_->getLyXFunc()->setMessage(currentState(bv_));
break;
case LFUN_UPCASE_WORD:
InsetCommandParams p("index");
if (argument.empty()) {
string const idxstring(bv_->getLyXText()->getStringToIndex(bv_));
- if (!idxstring.empty())
+ if (!idxstring.empty()) {
p.setContents(idxstring);
- else
+ } else {
break;
+ }
} else {
p.setContents(argument);
}
string::const_iterator cit = argument.begin();
string::const_iterator end = argument.end();
for (; cit != end; ++cit) {
- if (greek_kb_flag) {
- if (!math_insert_greek(bv_, *cit))
- owner_->getIntl()->getTrans().TranslateAndInsert(*cit, lt);
- } else
- owner_->getIntl()->getTrans().TranslateAndInsert(*cit, lt);
+ owner_->getIntl()->getTrans().TranslateAndInsert(*cit, lt);
}
bv_->update(lt,
+2001-08-02 André Pönitz <poenitz@gmx.net>
+
+ * lyxfunc.C:
+ BufferView_pimpl.C: remove broken special code for math-greek
+
2001-08-02 Juergen Vigna <jug@sad.it>
* BufferView_pimpl.C (update): redone this function so that we
lfun->dispatch(LFUN_MESSAGE, str.str().c_str());
}
-
- //WriteStatus(lfun, string(_("LaTeX run number ")) + tostr(count));
this->operator()();
scanres = scanLogFile(terr);
if (scanres & ERROR_RERUN) {
lfun->dispatch(LFUN_MESSAGE, str.str().c_str());
}
-// WriteStatus(minib, string(_("LaTeX run number ")) + tostr(count));
this->operator()();
scanres = scanLogFile(terr);
if (scanres & ERRORS) {
void LyXView::showState()
{
- message(CurrentState(view()));
+ message(currentState(view()));
getToolbar()->update();
menubar->update();
}
}
-std::vector<Thesaurus::ThesaurusEntry> Thesaurus::lookup(string const & text)
+std::vector<Thesaurus::ThesaurusEntry>
+Thesaurus::lookup(string const & /*text*/)
{
return std::vector<ThesaurusEntry>();
}
+// -*- C++ -*-
/**
* \file Thesaurus.h
* Copyright 2001 the LyX Team
#endif
} else if (token == "\\begin_float") {
+ insertErtContents(par, pos, font);
+ //insertErtContents(par, pos, font, false);
+ //ert_stack.push(ert_comp);
+ //ert_comp = ErtComp();
+
// This is the compability reader. It can be removed in
// LyX version 1.3.0. (Lgb)
lex.next();
inset->read(this, nylex);
par->insertInset(pos, inset, font);
++pos;
+ insertErtContents(par, pos, font);
} else if (token == "\\begin_deeper") {
++depth;
} else if (token == "\\end_deeper") {
#ifdef NO_LATEX
ert_comp = ert_stack.top();
ert_stack.pop();
+ insertErtContents(par, pos, font);
#endif
} else if (token == "\\SpecialChar") {
LyXLayout const & layout =
#include "gettext.h"
#include "ParagraphParameters.h"
-void Emph(BufferView * bv)
+
+void emph(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setEmph(LyXFont::TOGGLE);
- ToggleAndShow(bv, font);
+ toggleAndShow(bv, font);
}
-void Bold(BufferView * bv)
+void bold(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setSeries(LyXFont::BOLD_SERIES);
- ToggleAndShow(bv, font);
+ toggleAndShow(bv, font);
}
-void Noun(BufferView * bv)
+void noun(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setNoun(LyXFont::TOGGLE);
- ToggleAndShow(bv, font);
+ toggleAndShow(bv, font);
}
-void Number(BufferView * bv)
+void number(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setNumber(LyXFont::TOGGLE);
- ToggleAndShow(bv, font);
+ toggleAndShow(bv, font);
}
-void Lang(BufferView * bv, string const & l)
+void lang(BufferView * bv, string const & l)
{
LyXFont font(LyXFont::ALL_IGNORE);
Language const * lang = languages.getLanguage(l);
if (lang) {
font.setLanguage(lang);
- ToggleAndShow(bv, font);
+ toggleAndShow(bv, font);
} else
WriteAlert(_("Error! unknown language"),l);
}
#ifndef NO_LATEX
-void Tex(BufferView * bv)
+void tex(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setLatex (LyXFont::TOGGLE);
- ToggleAndShow(bv, font);
+ toggleAndShow(bv, font);
}
#endif
}
-void Code(BufferView * bv)
+void code(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setFamily(LyXFont::TYPEWRITER_FAMILY); // no good
- ToggleAndShow(bv, font);
+ toggleAndShow(bv, font);
}
-void Sans(BufferView * bv)
+void sans(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setFamily(LyXFont::SANS_FAMILY);
- ToggleAndShow(bv, font);
+ toggleAndShow(bv, font);
}
-void Roman(BufferView * bv)
+void roman(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setFamily(LyXFont::ROMAN_FAMILY);
- ToggleAndShow(bv, font);
+ toggleAndShow(bv, font);
}
-void StyleReset(BufferView * bv)
+void styleReset(BufferView * bv)
{
LyXFont font(LyXFont::ALL_INHERIT);
- ToggleAndShow(bv, font);
+ toggleAndShow(bv, font);
}
-void Underline(BufferView * bv)
+void underline(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setUnderbar(LyXFont::TOGGLE);
- ToggleAndShow(bv, font);
+ toggleAndShow(bv, font);
}
-void FontSize(BufferView * bv, string const & size)
+void fontSize(BufferView * bv, string const & size)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setLyXSize(size);
- ToggleAndShow(bv, font);
+ toggleAndShow(bv, font);
}
// Returns the current font and depth as a message.
-string const CurrentState(BufferView * bv)
+string const currentState(BufferView * bv)
{
ostringstream state;
/* -------> Does the actual toggle job of the XxxCB() calls above.
* Also shows the current font state.
*/
-void ToggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
+void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
{
if (bv->available()) {
if (bv->theLockingInset()) {
class LyXText;
///
-extern void Emph(BufferView *);
+extern void emph(BufferView *);
///
-extern void Bold(BufferView *);
+extern void bold(BufferView *);
///
-extern void Noun(BufferView *);
+extern void noun(BufferView *);
///
-extern void Figure();
+extern void table();
///
-extern void Table();
+extern void lang(BufferView *, string const &);
///
-extern void Lang(BufferView *, string const &);
+extern void number(BufferView *);
///
-extern void Number(BufferView *);
-///
-extern void Tex(BufferView *);
+extern void tex(BufferView *);
///
extern void changeDepth(BufferView *, LyXText *, int);
///
-extern void Code(BufferView *);
+extern void code(BufferView *);
///
-extern void Sans(BufferView *);
+extern void sans(BufferView *);
///
-extern void Roman(BufferView *);
+extern void roman(BufferView *);
///
-extern void StyleReset(BufferView *);
+extern void styleReset(BufferView *);
///
-extern void Underline(BufferView *);
+extern void underline(BufferView *);
///
-extern void FontSize(BufferView *, string const &);
+extern void fontSize(BufferView *, string const &);
/// Returns the current font and depth as a message.
-extern string const CurrentState(BufferView *);
+extern string const currentState(BufferView *);
///
-extern void ToggleAndShow(BufferView *, LyXFont const &, bool toggleall=true);
+extern void toggleAndShow(BufferView *, LyXFont const &,
+ bool toggleall = true);
#endif
if (lv_.view()->available())
view().apply();
- ToggleAndShow(lv_.view(), *(font_.get()), toggleall_);
+ toggleAndShow(lv_.view(), *(font_.get()), toggleall_);
lv_.view()->setState();
lv_.buffer()->markDirty();
setMinibuffer(&lv_, _("Character set"));
}
-std::vector<string> ControlThesaurus::getEntries(string const & str, Thesaurus::POS pos)
+std::vector<string>
+ControlThesaurus::getEntries(string const & str, Thesaurus::POS pos)
{
if (str != laststr_)
entries_ = thesaurus.lookup(str);
char * tmp = new char[s + 1];
str.copy(tmp, s);
tmp[s] = '\0';
- string ret(gettext(tmp));
+ string const ret(gettext(tmp));
delete [] tmp;
return ret;
- }
- else
+ } else {
return string();
+ }
}
void locale_init()
}
lt->clearSelection();
for (string::size_type i = 0; i < arg.length(); ++i) {
- if (greek_kb_flag) {
- if (!math_insert_greek(bv, arg[i])) {
- bv->owner()->getIntl()->getTrans().TranslateAndInsert(arg[i], lt);
- } else if (!the_locking_inset) {
- (void)moveRight(bv, false);
- }
- } else {
- bv->owner()->getIntl()->getTrans().TranslateAndInsert(arg[i], lt);
- }
+ bv->owner()->getIntl()->getTrans().TranslateAndInsert(arg[i], lt);
}
}
lt->selection.cursor = lt->cursor;
#include "TextCache.h"
#include "lyxfind.h"
#include "undo_funcs.h"
+#include "figureForm.h"
using std::pair;
using std::make_pair;
// --- insert characters ----------------------------------------
// --- Mathed stuff. If we are here, there is no locked inset yet.
-
- // Greek mode
- case LFUN_GREEK:
- {
- if (!greek_kb_flag) {
- greek_kb_flag = 1;
- setMessage(N_("Math greek mode on"));
- } else
- greek_kb_flag = 0;
- }
- break;
-
- // Greek keyboard
- case LFUN_GREEK_TOGGLE:
- {
- greek_kb_flag = greek_kb_flag ? 0 : 2;
- if (greek_kb_flag) {
- setMessage(N_("Math greek keyboard on"));
- } else {
- setMessage(N_("Math greek keyboard off"));
- }
- }
- break;
-
case LFUN_MATH_EXTERN:
case LFUN_MATH_NUMBER:
case LFUN_MATH_NONUMBER:
ReadBindFile(bind_file);
}
+
int LyXRC::read(string const & filename)
{
LyXLex lexrc(lyxrcTags, lyxrcCount);
switch (static_cast<LyXRCTags>(le)) {
case RC_INPUT: // Include file
if (lexrc.next()) {
- string tmp = LibFileSearch(string(),
- lexrc.GetString());
+ string const tmp =
+ LibFileSearch(string(),
+ lexrc.GetString());
if (read(tmp)) {
lexrc.printError("Error reading "
"included file: "+tmp);
break;
case RC_BINDFILE: // RVDK_PATCH_5
if (lexrc.next()) {
- string tmp(lexrc.GetString());
+ string const tmp(lexrc.GetString());
if (hasBindFile)
// We are already in the
// "actually read bind file"
case RC_KBMAP_PRIMARY:
if (lexrc.next()) {
- string kmap(lexrc.GetString());
+ string const kmap(lexrc.GetString());
if (kmap.empty()) {
// nothing
} else if (!LibFileSearch("kbd", kmap,
case RC_KBMAP_SECONDARY:
if (lexrc.next()) {
- string kmap(lexrc.GetString());
+ string const kmap(lexrc.GetString());
if (kmap.empty()) {
// nothing
} else if (!LibFileSearch("kbd", kmap,
case RC_DEFAULT_PAPERSIZE:
if (lexrc.next()) {
- string size = lowercase(lexrc.GetString());
+ string const size =
+ lowercase(lexrc.GetString());
if (size == "usletter")
default_papersize =
BufferParams::PAPER_USLETTER;
mathcursor->insert(c, char_code);
- if (greek_kb_flag && char_code == LM_TC_RM )
+ if (greek_kb_flag && char_code == LM_TC_RM)
mathcursor->setLastCode(LM_TC_VAR);
varcode = LM_TC_MIN;
}
-
-/* FIXME: math-greek-toggle seems to work OK, but math-greek doesn't turn
- * on greek mode */
-bool math_insert_greek(BufferView * bv, char c)
-{
- if (!bv->available())
- return false;
-
- if (!isalpha(c))
- return false;
-
- string tmp;
- tmp = c;
- if (!bv->theLockingInset() || bv->theLockingInset()->isTextInset()) {
- int greek_kb_flag_save = greek_kb_flag;
- InsetFormula * new_inset = new InsetFormula();
- bv->beforeChange(bv->text);
- if (!bv->insertInset(new_inset)) {
- delete new_inset;
- return false;
- }
- //Update(1);//BUG
- new_inset->edit(bv, 0, 0, 0);
- new_inset->localDispatch(bv, LFUN_SELFINSERT, tmp);
- if (greek_kb_flag_save < 2) {
- bv->unlockInset(new_inset); // bv->theLockingInset());
- bv->text->cursorRight(bv, true);
- }
- } else
- if (bv->theLockingInset()->lyxCode() == Inset::MATH_CODE ||
- bv->theLockingInset()->lyxCode() == Inset::MATHMACRO_CODE)
- static_cast<InsetFormula*>(bv->theLockingInset())->localDispatch(bv, LFUN_SELFINSERT, tmp);
- else
- lyxerr << "Math error: attempt to write on a wrong "
- "class of inset." << endl;
- return true;
-}
-
-
-
Inset::Code InsetFormulaBase::lyxCode() const
{
return Inset::MATH_CODE;
{
char c;
is->get(c);
+ if (!is->good()) {
+ lyxerr << "The input stream is not well..." << endl;
+ }
+
return static_cast<unsigned char>(c);
}
}
-
MathScriptInset * prevScriptInset(MathArray const & array)
{
MathInset * p = array.back_inset();
}
-
static bool curr_num;
static string curr_label;
-void mathed_parse_lines(MathInset * inset, int col, bool numbered, bool outmost)
+void mathed_parse_lines(MathInset * inset, int col,
+ bool numbered, bool outmost)
{
// save global variables
- bool saved_num = curr_num;
- string saved_label = curr_label;
+ bool const saved_num = curr_num;
+ string const saved_label = curr_label;
MathGridInset * p = static_cast<MathGridInset *>(inset);
for (int row = 0; true; ++row) {
// reset global variables
curr_num = numbered;
- curr_label = string();
+ curr_label.erase();
// reading a row
int idx = p->nargs() - p->ncols();
switch (t) {
case LM_TK_NEWCOMMAND: {
- string name = lexArg('{').substr(1);
- string arg = lexArg('[');
+ string const name = lexArg('{').substr(1);
+ string const arg = lexArg('[');
int narg = arg.empty() ? 0 : atoi(arg.c_str());
p = new MathMacroTemplate(name, narg);
mathed_parse_into(p->cell(0), FLAG_BRACE | FLAG_BRACE_LAST);
case LM_OT_SIMPLE: {
curr_num = latex_mathenv[i].numbered;
- curr_label = string();
+ curr_label.erase();
mathed_parse_into(m->cell(0), 0);
m->numbered(0, curr_num);
m->label(0, curr_label);
case LM_OT_EQUATION: {
curr_num = latex_mathenv[i].numbered;
- curr_label = string();
+ curr_label.erase();
mathed_parse_into(m->cell(0), FLAG_END);
m->numbered(0, curr_num);
m->label(0, curr_label);
break;
case LM_TK_CLOSE:
- --brace;
+ --brace;
if (brace < 0) {
mathPrintError("Unmatching braces");
panic = true;
MathInsetTypes typ = latex_mathenv[i].typ;
if (typ == LM_OT_MATRIX) {
- string valign = lexArg('[') + 'c';
- string halign = lexArg('{');
+ string const valign = lexArg('[') + 'c';
+ string const halign = lexArg('{');
//lyxerr << "valign: '" << valign << "'\n";
//lyxerr << "halign: '" << halign << "'\n";
MathArrayInset * m = new MathArrayInset(halign.size(), 1);
do {
t = yylex();
} while (yyis->good() && t != LM_TK_END && t);
- } else
+ } else {
t = yylex();
-
+ }
}
--plevel;
}
namespace {
-bool getTokenValue(string const & str, const char * token, string & ret)
+bool getTokenValue(string const & str, char const * token, string & ret)
{
size_t token_length = strlen(token);
string::size_type pos = str.find(token);
}
-bool getTokenValue(string const & str, const char * token, int & num)
+bool getTokenValue(string const & str, char const * token, int & num)
{
string::size_type pos = str.find(token);
char ch = str[pos + strlen(token)];
}
-bool getTokenValue(string const & str, const char * token, LyXAlignment & num)
+bool getTokenValue(string const & str, char const * token, LyXAlignment & num)
{
int tmp;
bool const ret = getTokenValue(str, token, tmp);
}
-bool getTokenValue(string const & str, const char * token,
+bool getTokenValue(string const & str, char const * token,
LyXTabular::VAlignment & num)
{
int tmp;
}
-bool getTokenValue(string const & str, const char * token,
+bool getTokenValue(string const & str, char const * token,
LyXTabular::BoxType & num)
{
int tmp;
}
-bool getTokenValue(string const & str, const char * token, bool & flag)
+bool getTokenValue(string const & str, char const * token, bool & flag)
{
string::size_type pos = str.find(token);
char ch = str[pos + strlen(token)];
cursor.par(),
cursor.pos()-1).number() == LyXFont::ON)
)
- Number(bview); // Set current_font.number to OFF
+ number(bview); // Set current_font.number to OFF
} else if (isdigit(c) &&
real_current_font.isVisibleRightToLeft()) {
- Number(bview); // Set current_font.number to ON
+ number(bview); // Set current_font.number to ON
if (cursor.pos() > 0) {
char const c = cursor.par()->getChar(cursor.pos() - 1);