some small fixes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@758 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-05-21 18:40:10 +00:00
parent 096e00715d
commit 586beb3a79
5 changed files with 108 additions and 69 deletions

View File

@ -1,3 +1,13 @@
2000-05-21 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/language.C (initL): change the initialization of languages
so that compiles goes _fast_.
* src/menus.C (Add_to_toc_menu): limit the line length in TOC to
40 chars.
* src/lyxfunc.C (processKeyEvent): initalize keysym_return to 0.
2000-05-21 Lars Gullik Bjønnes <larsbj@lyx.org> 2000-05-21 Lars Gullik Bjønnes <larsbj@lyx.org>
* release 1.1.5pre3 * release 1.1.5pre3

View File

@ -19,11 +19,11 @@ public:
} }
private: private:
/// ///
void newLang(string const & l, string const & d, bool rtl) { void newLang(char const * l, char const * d, bool rtl) {
Language lang; Language lang(l, d, rtl);
lang.lang = l; //lang.lang = l;
lang.display = d; //lang.display = d;
lang.RightToLeft = rtl; //lang.RightToLeft = rtl;
languages[l] = lang; languages[l] = lang;
} }
/// ///
@ -33,49 +33,69 @@ private:
}; };
struct lang_item {
char const * lang;
char const * display;
bool rtl;
};
void LangInit::initL() void LangInit::initL()
{ {
newLang("afrikaans", N_("Afrikaans"), false); // Use this style of initialization to lower compilation times.
newLang("american", N_("American"), false); // Same method is used in LyXAction.C (Lgb)
newLang("arabic", N_("Arabic"), true);
newLang("austrian", N_("Austrian"), false); lang_item items[] = {
newLang("bahasa", N_("Bahasa"), false); { "afrikaans", N_("Afrikaans"), false },
newLang("brazil", N_("Brazil"), false); { "american", N_("American"), false },
newLang("breton", N_("Breton"), false); { "arabic", N_("Arabic"), true },
newLang("catalan", N_("Catalan"), false); { "austrian", N_("Austrian"), false },
newLang("croatian", N_("Croatian"), false); { "bahasa", N_("Bahasa"), false },
newLang("czech", N_("Czech"), false); { "brazil", N_("Brazil"), false },
newLang("danish", N_("Danish"), false); { "breton", N_("Breton"), false },
newLang("dutch", N_("Dutch"), false); { "catalan", N_("Catalan"), false },
newLang("english", N_("English"), false); { "croatian", N_("Croatian"), false },
newLang("esperanto", N_("Esperanto"), false); { "czech", N_("Czech"), false },
newLang("estonian", N_("Estonian"), false); { "danish", N_("Danish"), false },
newLang("finnish", N_("Finnish"), false); { "dutch", N_("Dutch"), false },
newLang("francais", N_("Francais"), false); { "english", N_("English"), false },
newLang("french", N_("French"), false); { "esperanto", N_("Esperanto"), false },
newLang("frenchb", N_("Frenchb"), false); { "estonian", N_("Estonian"), false },
newLang("galician", N_("Galician"), false); { "finnish", N_("Finnish"), false },
newLang("german", N_("German"), false); { "francais", N_("Francais"), false },
newLang("greek", N_("Greek"), false); { "french", N_("French"), false },
newLang("hebrew", N_("Hebrew"), true); { "frenchb", N_("Frenchb"), false },
newLang("hungarian", N_("Hungarian"), false); { "galician", N_("Galician"), false },
newLang("irish", N_("Irish"), false); { "german", N_("German"), false },
newLang("italian", N_("Italian"), false); { "greek", N_("Greek"), false },
newLang("lsorbian", N_("Lsorbian"), false); { "hebrew", N_("Hebrew"), true },
newLang("magyar", N_("Magyar"), false); { "hungarian", N_("Hungarian"), false },
newLang("norsk", N_("Norsk"), false); { "irish", N_("Irish"), false },
newLang("polish", N_("Polish"), false); { "italian", N_("Italian"), false },
newLang("portuges", N_("Portuges"), false); { "lsorbian", N_("Lsorbian"), false },
newLang("romanian", N_("Romanian"), false); { "magyar", N_("Magyar"), false },
newLang("russian", N_("Russian"), false); { "norsk", N_("Norsk"), false },
newLang("scottish", N_("Scottish"), false); { "polish", N_("Polish"), false },
newLang("spanish", N_("Spanish"), false); { "portuges", N_("Portuges"), false },
newLang("slovak", N_("Slovak"), false); { "romanian", N_("Romanian"), false },
newLang("slovene", N_("Slovene"), false); { "russian", N_("Russian"), false },
newLang("swedish", N_("Swedish"), false); { "scottish", N_("Scottish"), false },
newLang("turkish", N_("Turkish"), false); { "spanish", N_("Spanish"), false },
newLang("usorbian", N_("Usorbian"), false); { "slovak", N_("Slovak"), false },
newLang("welsh", N_("Welsh"), false); { "slovene", N_("Slovene"), false },
{ "swedish", N_("Swedish"), false },
{ "turkish", N_("Turkish"), false },
{ "usorbian", N_("Usorbian"), false },
{ "welsh", N_("Welsh"), false },
{ 0, 0, false }
};
int i = 0;
while (items[i].lang) {
newLang(items[i].lang, items[i].display, items[i].rtl);
++i;
}
default_language = &languages["american"]; default_language = &languages["american"];
} }

View File

@ -161,11 +161,11 @@ extern "C" void error_handler(int err_sig);
void LyX::init(int */*argc*/, char **argv, bool gui) void LyX::init(int */*argc*/, char **argv, bool gui)
{ {
// Install the signal handlers // Install the signal handlers
std::signal(SIGHUP, error_handler); signal(SIGHUP, error_handler);
std::signal(SIGFPE, error_handler); signal(SIGFPE, error_handler);
std::signal(SIGSEGV, error_handler); signal(SIGSEGV, error_handler);
std::signal(SIGINT, error_handler); signal(SIGINT, error_handler);
std::signal(SIGTERM, error_handler); signal(SIGTERM, error_handler);
// //
// Determine path of binary // Determine path of binary

View File

@ -190,7 +190,7 @@ int LyXFunc::processKeyEvent(XEvent * ev)
char s_r[10]; char s_r[10];
string argument; string argument;
XKeyEvent * keyevent = &ev->xkey; XKeyEvent * keyevent = &ev->xkey;
KeySym keysym_return; KeySym keysym_return = 0;
int num_bytes = LyXLookupString(ev, s_r, 10, &keysym_return); int num_bytes = LyXLookupString(ev, s_r, 10, &keysym_return);
s_r[num_bytes] = '\0'; s_r[num_bytes] = '\0';

View File

@ -1288,33 +1288,42 @@ void Add_to_toc_menu(vector<Buffer::TocItem> const & toclist,
int menu, vector<int> & menus, FL_OBJECT * ob) int menu, vector<int> & menus, FL_OBJECT * ob)
{ {
unsigned int const max_number_of_items = 25; unsigned int const max_number_of_items = 25;
if (to - from <= max_number_of_items) if (to - from <= max_number_of_items) {
for (unsigned int i = from; i < to; ++i) for (unsigned int i = from; i < to; ++i) {
fl_addtopup(menu,
(string(4*max(0,toclist[i].depth-depth),' ') string line(4 * max(0, toclist[i].depth - depth),' ');
+ toclist[i].str + "%x" line += toclist[i].str;
+ tostr(i+1)).c_str()); line += "%x";
else { line += tostr(i + 1);
string entry(line, 0, 40);
fl_addtopup(menu, entry.c_str());
}
} else {
unsigned int pos = from; unsigned int pos = from;
while (pos < to) { while (pos < to) {
unsigned int new_pos = pos+1; unsigned int new_pos = pos+1;
while (new_pos < to && while (new_pos < to &&
toclist[new_pos].depth > depth) toclist[new_pos].depth > depth)
++new_pos; ++new_pos;
if (new_pos == pos+1) { if (new_pos == pos + 1) {
fl_addtopup(menu, string line(4 * max(0, toclist[pos].depth - depth), ' ');
(string(4*max(0,toclist[pos].depth-depth),' ') line += toclist[pos].str;
+ toclist[pos].str + "%x" line += "%x";
+ tostr(pos+1)).c_str() ); line += tostr(pos + 1);
string entry(line, 0, 40);
fl_addtopup(menu, entry.c_str());
} else { } else {
int menu2 = fl_newpup(FL_ObjWin(ob)); int menu2 = fl_newpup(FL_ObjWin(ob));
menus.push_back(menu2); menus.push_back(menu2);
Add_to_toc_menu(toclist, pos, new_pos, Add_to_toc_menu(toclist, pos, new_pos,
depth+1, menu2, menus,ob); depth + 1, menu2, menus,ob);
fl_addtopup(menu, string line(4 * max(0, toclist[pos].depth - depth), ' ');
(string(4*max(0,toclist[pos].depth-depth),' ') line += toclist[pos].str;
+ toclist[pos].str+"%m").c_str(), line += "%m";
menu2); string entry(line, 0, 40);
fl_addtopup(menu, entry.c_str(), menu2);
} }
pos = new_pos; pos = new_pos;
} }