]> git.lyx.org Git - features.git/commitdiff
Patches from Angus, Baruch, Dekel (2), and some glue from me.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 16 Oct 2000 13:27:56 +0000 (13:27 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 16 Oct 2000 13:27:56 +0000 (13:27 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1123 a592a061-630c-0410-9148-cb99ea01b6c8

17 files changed:
ChangeLog
forms/layout_forms.fd
lib/CREDITS
lib/lyxrc.example
src/MenuBackend.C
src/cheaders/cstdarg [new file with mode: 0644]
src/converter.C
src/converter.h
src/exporter.C
src/exporter.h
src/frontends/support/Makefile.am
src/layout_forms.C
src/lyx_gui.C
src/lyx_main.C
src/lyxfunc.C
src/support/snprintf.h
src/text.C

index 4876a7b512b3edf19f11a6228369f7c82edab691..b163fb2ac49888bbf61107c27479702bca703659 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,52 @@
+2000-10-16  Angus Leeming <a.leeming@ic.ac.uk>
+
+       * forms/layout_forms.fd:
+       * src/layout_forms.C (create_form_form_character): small change to use
+       labelframe rather than engraved frame + text
+
+       * src/lyx_gui.C (create_forms): initialise choice_language with some
+       arbitrary value to prevent segfault when dialog is shown.
+
+2000-10-16  Baruch Even  <baruch.even@writeme.com>
+
+       * src/converter.C (runLaTeX, scanLog): Added a warning when there
+       is no resulting file. This pertains only to LaTeX output.
+
+2000-10-14  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * src/text.C (Backspace): Make sure that the row of the cursor is
+       rebreaked.
+
+       * src/lyxfunc.C (Dispatch): Call to showState() after insertion of 
+       a char.
+
+       * src/lyx_gui.C (init): Prevent a crash when only one font from 
+       menu/popup fonts is not found.
+
+       * lib/lyxrc.example: Add an example for binding a key for language 
+       switching.
+
+2000-10-15  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * src/converter.C (GetReachable): Changed the returned type to
+       vector<FormatPair>
+       (IsReachable): New method
+
+       * src/MenuBackend.C (expand): Handle formats that appear more
+       than once
+
+2000-10-16  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * src/frontends/support/Makefile.am
+       (libfrontendsupport_la_EXTRA_DIST): add LyXImage_X.[Ch] here and
+       not in SOURCES.
+
+       * lib/CREDITS: add Garst Reese.
+
+       * src/support/snprintf.h: add extern "C" {} around the definitions.
+
+       * src/cheaders/cstdarg: new header file, taken from GNU libstdc++.
+
 2000-10-13  Angus Leeming <a.leeming@ic.ac.uk>
 
        * src/combox.[Ch]:
index d29fcd32cc7251a8bfd76625e0ab30ff4e9ccda1..ead098f7ed1bb8e08c9e3bf0fac72ad490019b3a 100644 (file)
@@ -11,7 +11,7 @@ SnapGrid: 5
 Name: form_character
 Width: 300
 Height: 415
-Number of Objects: 16
+Number of Objects: 14
 
 --------------------
 class: FL_BOX
@@ -31,42 +31,6 @@ name:
 callback: 
 argument: 
 
---------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 10 325 280 45
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_X
-gravity: FL_NorthWest FL_NorthEast
-name: 
-callback: 
-argument: 
-
---------------------
-class: FL_FRAME
-type: ENGRAVED_FRAME
-box: 10 265 280 45
-boxtype: FL_NO_BOX
-colors: FL_BLACK FL_COL1
-alignment: FL_ALIGN_CENTER
-style: FL_NORMAL_STYLE
-size: FL_DEFAULT_SIZE
-lcol: FL_BLACK
-label: 
-shortcut: 
-resize: FL_RESIZE_X
-gravity: FL_NorthWest FL_NorthEast
-name: 
-callback: 
-argument: 
-
 --------------------
 class: FL_FRAME
 type: ENGRAVED_FRAME
@@ -248,56 +212,56 @@ callback:
 argument: 
 
 --------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 20 255 210 20
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
-style: FL_BOLD_STYLE
-size: FL_DEFAULT_SIZE
+class: FL_CHOICE
+type: DROPLIST_CHOICE
+box: 95 175 190 30
+boxtype: FL_FRAME_BOX
+colors: FL_COL1 FL_BLACK
+alignment: FL_ALIGN_LEFT
+style: FL_NORMAL_STYLE
+size: FL_NORMAL_SIZE
 lcol: FL_BLACK
-label: These are never toggled
+label: Language:
 shortcut: 
 resize: FL_RESIZE_X
 gravity: FL_NorthWest FL_NorthEast
-name: 
+name: choice_language
 callback: 
 argument: 
 
 --------------------
-class: FL_TEXT
-type: NORMAL_TEXT
-box: 20 315 215 20
-boxtype: FL_FLAT_BOX
-colors: FL_COL1 FL_MCOL
-alignment: FL_ALIGN_LEFT|FL_ALIGN_INSIDE
+class: FL_LABELFRAME
+type: ENGRAVED_FRAME
+box: 10 265 280 45
+boxtype: FL_NO_BOX
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
 style: FL_BOLD_STYLE
 size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
-label: These are always toggled
+label: These are never toggled
 shortcut: 
-resize: FL_RESIZE_X
+resize: FL_RESIZE_ALL
 gravity: FL_NorthWest FL_NorthEast
 name: 
 callback: 
 argument: 
 
 --------------------
-class: FL_CHOICE
-type: DROPLIST_CHOICE
-box: 95 175 190 30
-boxtype: FL_FRAME_BOX
-colors: FL_COL1 FL_BLACK
-alignment: FL_ALIGN_LEFT
-style: FL_NORMAL_STYLE
-size: FL_NORMAL_SIZE
+class: FL_LABELFRAME
+type: ENGRAVED_FRAME
+box: 10 325 280 45
+boxtype: FL_NO_BOX
+colors: FL_BLACK FL_COL1
+alignment: FL_ALIGN_TOP_LEFT
+style: FL_BOLD_STYLE
+size: FL_DEFAULT_SIZE
 lcol: FL_BLACK
-label: Language:
+label: These are always toggled
 shortcut: 
-resize: FL_RESIZE_X
+resize: FL_RESIZE_ALL
 gravity: FL_NorthWest FL_NorthEast
-name: choice_language
+name: 
 callback: 
 argument: 
 
index 8f73a1680e5216d02a5de69602cd27f48df7f8a6..07598646f8339e3a36a1ec4ead8fccfcb2052e8b 100644 (file)
 @iE-mail: rae@elec.uq.edu.au
    bug reports/fixes, Itemize Bullet Selection,
    xforms-0.81 + gcc-2.6.3 compatibility
+@bGarst R. Reese
+@iE-mail: reese@isn.net
+   provided hollywood and broadway classes
+   for writing screen scripts and plays
 @bBernd Rellermeyer
 @iE-mail: 100.41728@germanynet.de
    Support for Koma-Script family of classes
index e30863e900aa283f427dc3f227a9267c4c7984fc..3ff19d53da88c6cb02ecb2df7282cf93408d4b6c 100644 (file)
 # Default is "true"
 #\mark_foreign_language false
 
+# It is possible to bind keys for changing the language inside a document. 
+# For example, the following command will cause F12 to switch between French
+# and English in a French document, and in a document of other language it will
+# switch between that language and French.
+#\bind "F12" "language french"
+
 #
 # HEBREW SUPPORT SECTION ####################################################
 #
index acd8603743b7443c3283e19b84bdbc11cb893171..2c82cde44ab99565b4383a67b22ee86e7a462f1b 100644 (file)
@@ -23,6 +23,7 @@
 #include "gettext.h"
 #include "lastfiles.h"
 #include "bufferlist.h"
+#include "converter.h"
 #include "exporter.h"
 #include "support/filetools.h"
 #include "support/lyxfunctional.h"
@@ -35,6 +36,7 @@ using std::endl;
 using std::vector;
 using std::pair;
 using std::find_if;
+using std::sort;
 
 // This is the global menu definition
 MenuBackend menubackend;
@@ -190,6 +192,11 @@ Menu & Menu::read(LyXLex & lex)
        return *this;
 }
 
+struct compare_formatpair {
+       bool operator()(FormatPair const & a, FormatPair const & b) {
+               return a.format->prettyname < b.format->prettyname; 
+       }
+};
 
 void Menu::expand(Menu & tomenu, Buffer * buf) const
 {
@@ -237,7 +244,7 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
                case MenuItem::ViewFormats:
                case MenuItem::UpdateFormats:
                case MenuItem::ExportFormats: {
-                       vector<pair<string,string> > names;
+                       vector<FormatPair> names;
                        kb_action action;
                        if ((*cit).kind() == MenuItem::ViewFormats) {
                                names = Exporter::GetViewableFormats(buf);
@@ -249,13 +256,23 @@ void Menu::expand(Menu & tomenu, Buffer * buf) const
                                names = Exporter::GetExportableFormats(buf);
                                action = LFUN_EXPORT;
                        }
+                       sort(names.begin(), names.end(), compare_formatpair());
 
-                       for (vector<pair<string,string> >::const_iterator fit = names.begin();
+                       for (vector<FormatPair>::const_iterator fit = names.begin();
                             fit != names.end() ; ++fit) {
-                               int action2 =
-                                       lyxaction.getPseudoAction(action,
-                                                                 (*fit).first);
-                               string label = (*fit).second;
+                               string fmt = (*fit).format->name;
+                               string label = (*fit).format->prettyname;
+                               if ((*fit).from &&
+                                   ( (fit != names.begin() &&
+                                      (*fit).format == (*(fit-1)).format) ||
+                                     (fit+1 != names.end() &&
+                                      (*fit).format == (*(fit+1)).format) )) {
+                                       fmt += ":" + (*fit).from->name;
+                                       string head;
+                                       split((*fit).command, head, ' ');
+                                       label += _(" (using ") + head + ")";
+                               }
+                               int action2 = lyxaction.getPseudoAction(action, fmt);
                                tomenu.add(MenuItem(MenuItem::Command,
                                                    label, action2));
                        }
diff --git a/src/cheaders/cstdarg b/src/cheaders/cstdarg
new file mode 100644 (file)
index 0000000..324f5a1
--- /dev/null
@@ -0,0 +1,7 @@
+// -*- C++ -*- forwarding header.
+// This file is part of the GNU ANSI C++ Library.
+
+#ifndef __CSTDARG__
+#define __CSTDARG__
+#include <stdarg.h>
+#endif
index 179de6ee1bdcdfd9864eef359d8b561806932d2b..9773b5fbcb74e37f5271fb73306e8aae8d81d413 100644 (file)
@@ -15,7 +15,6 @@
 #endif
 
 #include <queue>
-#include <algorithm> // sort()
 
 #include "converter.h"
 #include "lyxrc.h"
@@ -33,7 +32,6 @@ using std::map;
 using std::vector;
 using std::queue;
 using std::pair;
-using std::sort;
 using std::endl;
 
 //////////////////////////////////////////////////////////////////////////////
@@ -53,7 +51,7 @@ string const add_options(string const & command, string const & options)
 //////////////////////////////////////////////////////////////////////////////
 
 Format::Format(string const & n)
-       : name(n), in_degree(0)
+       : name(n)
 {
        struct Item {
                char const * name;
@@ -209,23 +207,19 @@ void Converter::Add(string const & from, string const & to,
        commands.push_back(Com);
        Formats::Add(from);
        Formats::Add(to);
-       ++Formats::GetFormat(to)->in_degree;
 }
 
 
-vector< pair<string,string> > const
+vector<FormatPair> const
 Converter::GetReachable(string const & from, bool only_viewable)
 {
-       vector< pair<string,string> > result;
+       vector<FormatPair> result;
        Format * format = Formats::GetFormat(from);
        if (!format)
                return result;
 
-       int sort_start = 0;
-       if (!only_viewable || !format->viewer.empty()) {
-               result.push_back(pair<string,string>(from, format->prettyname));
-               sort_start = 1;
-       }
+       if (!only_viewable || !format->viewer.empty())
+               result.push_back(FormatPair(format, 0, ""));
 
        queue< vector<Command>::iterator > Q;
        for (vector<Command>::iterator it = commands.begin();
@@ -238,18 +232,12 @@ Converter::GetReachable(string const & from, bool only_viewable)
 
        while (!Q.empty()) {
                vector<Command>::iterator it = Q.front();
+               Q.pop();
                format = Formats::GetFormat((*it).to);
-               string name = format->name;
-               string prettyname = format->prettyname;
-               if (format->in_degree > 1) {
-                       name += ":" + (*it).from;
-                       string tmp;
-                       split((*it).command, tmp, ' ');
-                       prettyname  += _(" (using ") + tmp + ")";       
-               }
                if (!only_viewable || !format->viewer.empty())
-                       result.push_back(pair<string,string>(name, prettyname));
-               Q.pop();
+                       result.push_back(FormatPair(format,
+                                                   Formats::GetFormat((*it).from),
+                                                   (*it).command));
                for (vector<Command>::iterator it2 = commands.begin();
                     it2 != commands.end(); ++it2)
                        if (!(*it2).visited && (*it).to == (*it2).from) {
@@ -258,10 +246,42 @@ Converter::GetReachable(string const & from, bool only_viewable)
                        }
        }
 
-       sort(result.begin() + sort_start, result.end());
        return result;
 }
 
+bool Converter::IsReachable(string const & from, string const & target_format)
+{
+       Format * format = Formats::GetFormat(from);
+       if (!format)
+               return false;
+       else if (format->name == target_format)
+               return true;
+
+       queue< vector<Command>::iterator > Q;
+       for (vector<Command>::iterator it = commands.begin();
+            it != commands.end(); ++it)
+               if ((*it).from == from) {
+                       Q.push(it);
+                       (*it).visited = true;
+               } else
+                       (*it).visited = false;
+
+       while (!Q.empty()) {
+               vector<Command>::iterator it = Q.front();
+               Q.pop();
+               format = Formats::GetFormat((*it).to);
+               if (format->name == target_format)
+                       return true;
+               for (vector<Command>::iterator it2 = commands.begin();
+                    it2 != commands.end(); ++it2)
+                       if (!(*it2).visited && (*it).to == (*it2).from) {
+                               Q.push(it2);
+                               (*it2).visited = true;
+                       }
+       }
+       return false;
+}
+
 
 bool Converter::Convert(Buffer const * buffer, string const & from_file,
                        string const & to_file, string const & using_format,
@@ -471,6 +491,12 @@ bool Converter::scanLog(Buffer const * buffer, string const & command,
                        bv->redraw();
                        bv->fitCursor(bv->text);
                }
+       if (result & LaTeX::NO_OUTPUT) {
+               string const s = _("The operation resulted in");
+               string const t = _("an empty file.");
+               WriteAlert(_("Resulting file is empty"), s, t);
+               return false;
+       }
                AllowInput(bv);
        }
        if ((result & LaTeX::ERRORS)) {
@@ -529,6 +555,10 @@ bool Converter::runLaTeX(Buffer const * buffer, string const & command)
                        bv->redraw();
                        bv->fitCursor(bv->text);
                }
+       } else if (result & LaTeX::NO_OUTPUT) {
+               string const s = _("The operation resulted in");
+               string const t = _("an empty file.");
+               WriteAlert(_("Resulting file is empty"), s, t);
        }
 
        // check return value from latex.run().
@@ -554,7 +584,12 @@ bool Converter::runLaTeX(Buffer const * buffer, string const & command)
        if (bv)
                AllowInput(bv);
  
-        return (result & (LaTeX::NO_LOGFILE | LaTeX::ERRORS)) == 0;
+       int const ERROR_MASK = 
+                       LaTeX::NO_LOGFILE |
+                       LaTeX::ERRORS |
+                       LaTeX::NO_OUTPUT;
+       
+       return (result & ERROR_MASK) == 0;
 
 }
 
@@ -613,3 +648,8 @@ string const Converter::dvips_options(Buffer const * buffer)
                result += ' ' + lyxrc.print_landscape_flag;
        return result;
 }
+
+void Converter::init()
+{
+       Formats::Add("txt");    
+}
index 8e282352f3ae736b05de1949344e6ba1c4e60f37..b23a0ffd62ca884140f8d13781a08b587a4103c4 100644 (file)
@@ -57,7 +57,7 @@ struct Command {
 class Format {
 public:
        ///
-       Format() : in_degree(0) {}
+       Format() {}
        ///
        Format(string const & n);
        ///
@@ -66,8 +66,19 @@ public:
        string prettyname;
        ///
        string viewer;
+};
+
+class FormatPair {
+public:
+       ///
+       Format * format;
+       ///
+       Format * from;
+       ///
+       string command;
        ///
-       int in_degree;
+       FormatPair(Format * f1, Format * f2, string c)
+               : format(f1), from(f2), command(c) {}
 };
 
 ///
@@ -102,12 +113,17 @@ public:
        void Add(string const & from, string const & to,
                 string const & command, string const & flags);
        ///
+       
+       ///
        static
-       std::vector<std::pair<string, string> > const
+       std::vector<FormatPair> const
        GetReachable(string const & from,
                     bool only_viewable = false);
        ///
        static
+       bool IsReachable(string const & from, string const & target_format);
+       ///
+       static
        bool Convert(Buffer const * buffer, string const & from_file,
                     string const & to_file, string const & using_format,
                     string * view_file = 0);
@@ -120,6 +136,9 @@ public:
        ///
        static
        string const dvips_options(Buffer const * buffer);
+       ///
+       static
+       void init();
 private:
        ///
        static
index e2c4c37e7cd0e37be538b86a2b5da00563cc2453..40986a514f1096ff61f67ce774c677b11a1f20e0 100644 (file)
 #endif
 
 #include "exporter.h"
-#include "converter.h"
 #include "buffer.h"
 #include "lyx_cb.h" //ShowMessage()
 #include "support/filetools.h"
 #include "lyxrc.h"
+#include "converter.h"
 
 using std::vector;
-using std::pair;
 
 bool Exporter::Export(Buffer * buffer, string const & format0,
                      bool put_in_tempdir, string * view_file)
@@ -84,37 +83,31 @@ bool Exporter::Preview(Buffer * buffer, string const & format0)
 
 bool Exporter::IsExportable(Buffer const * buffer, string const & format)
 {
-       // This is not efficient (Dekel)
-       vector<pair<string, string> > const v = GetExportableFormats(buffer);
-       for (vector<pair<string, string> >::const_iterator it = v.begin();
-            it != v.end(); ++it) {
-               string format2;
-                split((*it).first, format2, ':');
-               if (format == format2)
-                       return true;
-       }
-       return false;
+       return format == "txt" ||
+               Converter::IsReachable(BufferExtension(buffer), format);
 }
 
 
-vector<pair<string, string> > const
+vector<FormatPair> const
 Exporter::GetExportableFormats(Buffer const * buffer)
 {
-       vector<pair<string, string> > result = 
+       vector<FormatPair> result = 
                Converter::GetReachable(BufferExtension(buffer), false);
-       result.push_back(pair<string,string>("txt", "Ascii"));
+       Format * format = Formats::GetFormat("txt");
+       if (format)
+               result.push_back(FormatPair(format , 0, ""));
        return result;
 }
 
 
-vector<pair<string, string> > const
+vector<FormatPair> const
 Exporter::GetViewableFormats(Buffer const * buffer)
 {
-       vector<pair<string, string> > result = 
+       vector<FormatPair> result = 
                Converter::GetReachable(BufferExtension(buffer), true);
        Format * format = Formats::GetFormat("txt");
        if (format && !format->viewer.empty())
-               result.push_back(pair<string,string>("txt", "Ascii"));
+               result.push_back(FormatPair(format , 0, ""));
        return result;
 }
 
index 26e1a5dad07ae815507ac9b8db949af71ecfcc56..f8c9ac7d45eb49b76fd2e1abc4287b2ab5b82200 100644 (file)
@@ -20,8 +20,8 @@
 #include "LString.h"
 
 class Buffer;
+class FormatPair;
 
-///
 class Exporter {
 public:
        ///
@@ -36,11 +36,11 @@ public:
        bool IsExportable(Buffer const * buffer, string const & format);
        ///
        static
-       std::vector<std::pair<string, string> > const
+       std::vector<FormatPair> const
        GetExportableFormats(Buffer const * buffer);
        ///
        static
-       std::vector<std::pair<string, string> > const
+       std::vector<FormatPair> const
        GetViewableFormats(Buffer const * buffer);
        ///
        static
index ec57ed83b0a4db78769203946e61026f5f73137f..3da878292099bc91d4f59fb31fa555d2c78f64d4 100644 (file)
@@ -8,6 +8,8 @@ INCLUDES = -I${srcdir}/../../ $(SIGC_CFLAGS)
 
 libfrontendsupport_la_SOURCES = \
        LyXImage.h \
-       LyXImage.C \
+       LyXImage.C
+
+libfrontendsupport_la_EXTRA_DIST = \
        LyXImage_X.h \
        LyXImage_X.C
index 3c96d9c089989cfe4e8dfbdd65100e094724e920..4b5ba67d65faf4167bddfe741e552d5b47b16d13 100644 (file)
@@ -17,12 +17,6 @@ FD_form_character *create_form_form_character(void)
   fdui->form_character = fl_bgn_form(FL_NO_BOX, 300, 415);
   obj = fl_add_box(FL_UP_BOX, 0, 0, 300, 415, "");
     fl_set_object_gravity(obj, FL_NorthWest, FL_SouthEast);
-  obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 325, 280, 45, "");
-    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
-    fl_set_object_resize(obj, FL_RESIZE_X);
-  obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 265, 280, 45, "");
-    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
-    fl_set_object_resize(obj, FL_RESIZE_X);
   obj = fl_add_frame(FL_ENGRAVED_FRAME, 10, 10, 280, 240, "");
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
@@ -67,21 +61,17 @@ FD_form_character *create_form_form_character(void)
   fdui->check_toggle_all = obj = fl_add_checkbutton(FL_PUSH_BUTTON, 30, 215, 255, 25, idex(_("Toggle on all these|#T")));fl_set_button_shortcut(obj, scex(_("Toggle on all these|#T")), 1);
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
-  obj = fl_add_text(FL_NORMAL_TEXT, 20, 255, 210, 20, _("These are never toggled"));
-    fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
-    fl_set_object_lstyle(obj, FL_BOLD_STYLE);
-    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
-    fl_set_object_resize(obj, FL_RESIZE_X);
-  obj = fl_add_text(FL_NORMAL_TEXT, 20, 315, 215, 20, _("These are always toggled"));
-    fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
-    fl_set_object_lstyle(obj, FL_BOLD_STYLE);
-    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
-    fl_set_object_resize(obj, FL_RESIZE_X);
   fdui->choice_language = obj = fl_add_choice(FL_DROPLIST_CHOICE, 95, 175, 190, 30, _("Language:"));
     fl_set_object_boxtype(obj, FL_FRAME_BOX);
     fl_set_object_lsize(obj, FL_NORMAL_SIZE);
     fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
     fl_set_object_resize(obj, FL_RESIZE_X);
+  obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 265, 280, 45, _("These are never toggled"));
+    fl_set_object_lstyle(obj, FL_BOLD_STYLE);
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
+  obj = fl_add_labelframe(FL_ENGRAVED_FRAME, 10, 325, 280, 45, _("These are always toggled"));
+    fl_set_object_lstyle(obj, FL_BOLD_STYLE);
+    fl_set_object_gravity(obj, FL_NorthWest, FL_NorthEast);
   fl_end_form();
 
   fdui->form_character->fdui = fdui;
index 20c8b6ffc4741ac20031ff59592b65c9d84dfabb..6829b15472c0d10e8ab6d0d13a26ef7270f2878d 100644 (file)
@@ -185,35 +185,41 @@ void LyXGUI::init()
        if (lyxrc.font_norm_menu.empty())
                lyxrc.font_norm_menu = lyxrc.font_norm;
        // Set the font name for popups and menus
-        string menufontname = lyxrc.menu_font_name 
+        string boldfontname = lyxrc.menu_font_name 
                               + "-*-*-*-?-*-*-*-*-"  
                               + lyxrc.font_norm_menu;
                // "?" means "scale that font"
-        string popupfontname = lyxrc.popup_font_name 
+        string fontname = lyxrc.popup_font_name 
                               + "-*-*-*-?-*-*-*-*-"  
                               + lyxrc.font_norm_menu;
 
-       int bold = fl_set_font_name(FL_BOLD_STYLE, menufontname.c_str());
-       int normal = fl_set_font_name(FL_NORMAL_STYLE, popupfontname.c_str());
+       int bold = fl_set_font_name(FL_BOLD_STYLE, boldfontname.c_str());
+       int normal = fl_set_font_name(FL_NORMAL_STYLE, fontname.c_str());
         if (bold < 0)
                 lyxerr << "Could not set menu font to "
-                      << menufontname << endl;
+                      << boldfontname << endl;
 
         if (normal < 0)
                 lyxerr << "Could not set popup font to "
-                      << popupfontname << endl;
+                      << fontname << endl;
 
        if (bold < 0 && normal < 0) {
                lyxerr << "Using 'helvetica' font for menus" << endl;
-               bold = fl_set_font_name(FL_BOLD_STYLE,
-                                       "-*-helvetica-bold-r-*-*-*-?-*-*-*-*-iso8859-1");
-               normal = fl_set_font_name(FL_NORMAL_STYLE,
-                                         "-*-helvetica-medium-r-*-*-*-?-*-*-*-*-iso8859-1");
+               boldfontname = "-*-helvetica-bold-r-*-*-*-?-*-*-*-*-iso8859-1";
+               fontname = "-*-helvetica-medium-r-*-*-*-?-*-*-*-*-iso8859-1";
+               bold = fl_set_font_name(FL_BOLD_STYLE, boldfontname.c_str());
+               normal = fl_set_font_name(FL_NORMAL_STYLE, fontname.c_str());
+
                if (bold < 0 && normal < 0) {
                        lyxerr << "Could not find helvetica font. Using 'fixed'." << endl;
-                       normal = fl_set_font_name(FL_NORMAL_STYLE, "fixed");
+                       fl_set_font_name(FL_NORMAL_STYLE, "fixed");
+                       normal = bold = 0;
                }
        }
+       if (bold < 0)
+               fl_set_font_name(FL_BOLD_STYLE, fontname.c_str());
+       else if (normal < 0)
+               fl_set_font_name(FL_NORMAL_STYLE, boldfontname.c_str());
 
        // put here (after fl_initialize) to avoid segfault. Cannot be done
        // in setDefaults() (Matthias 140496)
@@ -312,6 +318,10 @@ void LyXGUI::create_forms()
        fl_addto_choice(fd_form_character->choice_color, 
                        _(" No change %l| No color | Black | White | Red | Green "
                        "| Blue | Cyan | Magenta | Yellow %l| Reset "));
+       // Appears to need initialising to avoid seg fault when dialog is
+       // launched. Over-written by combo_language2, below
+       fl_addto_choice(fd_form_character->choice_language,
+                       _(" English %l| German | French "));
        fl_set_form_minsize(fd_form_character->form_character,
                            fd_form_character->form_character->w,
                            fd_form_character->form_character->h);
index eaf8725d081a3d7b7bcfd0c2a06dccf54aa38b9e..045e8cc72a57c5c34c570696fc88aa39a35523a7 100644 (file)
@@ -39,6 +39,7 @@
 #include "ToolbarDefaults.h"
 #include "lyxlex.h"
 #include "encoding.h"
+#include "converter.h"
 
 using std::endl;
 
@@ -404,6 +405,9 @@ void LyX::init(int */*argc*/, char **argv, bool gui)
        if (!ReadRcFile("preferences"))
            ReadRcFile("lyxrc");
 
+       /// Init Converter
+       Converter::init();
+
        // Read encodings
        ReadEncodingsFile("encodings");
        // Read languages
index 97d237899082a3096501d5fb34c053c430547e52..f84201f8b302da067db32efd45a67ef47bc8da09 100644 (file)
@@ -2895,6 +2895,8 @@ string const LyXFunc::Dispatch(int ac,
                owner->view()->text->sel_cursor = 
                        owner->view()->text->cursor;
                moveCursorUpdate(false);
+               owner->showState(); // current_font.number can change
+                                   // so we need to update the minibuffer
        }
        break;
 
@@ -3030,6 +3032,8 @@ string const LyXFunc::Dispatch(int ac,
                        owner->view()->text->sel_cursor = 
                                owner->view()->text->cursor;
                        moveCursorUpdate(false);
+                       owner->showState(); // current_font.number can change
+                                           // so we need to update the minibuffer
                        return string();
                } else {
                        // why is an "Unknown action" with empty
index cad692e54101e1b043fcf0e32f400c8817a37dcd..6ab2dcc8ea466df82050d9a3dfc1d2388a2d254d 100644 (file)
@@ -4,23 +4,31 @@
 #define PORTABLE_SNPRINTF_VERSION_MAJOR 2
 #define PORTABLE_SNPRINTF_VERSION_MINOR 1
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+  
 #ifdef HAVE_SNPRINTF
 #include <stdio.h>
 #else
-extern int snprintf(char *, size_t, const char *, /*args*/ ...);
-extern int vsnprintf(char *, size_t, const char *, va_list);
+int snprintf(char *, size_t, const char *, /*args*/ ...);
+int vsnprintf(char *, size_t, const char *, va_list);
 #endif
 
 #if defined(HAVE_SNPRINTF) && defined(PREFER_PORTABLE_SNPRINTF)
-extern int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...);
-extern int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap);
+int portable_snprintf(char *str, size_t str_m, const char *fmt, /*args*/ ...);
+int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap);
 #define snprintf  portable_snprintf
 #define vsnprintf portable_vsnprintf
 #endif
 
-extern int asprintf  (char **ptr, const char *fmt, /*args*/ ...);
-extern int vasprintf (char **ptr, const char *fmt, va_list ap);
-extern int asnprintf (char **ptr, size_t str_m, const char *fmt, /*args*/ ...);
-extern int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap);
+int asprintf  (char **ptr, const char *fmt, /*args*/ ...);
+int vasprintf (char **ptr, const char *fmt, va_list ap);
+int asnprintf (char **ptr, size_t str_m, const char *fmt, /*args*/ ...);
+int vasnprintf(char **ptr, size_t str_m, const char *fmt, va_list ap);
 
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+  
 #endif
index 84a7967b30fd2cdae7baf6259b89fcdd9e26d628..0e50ffcf8c398d9682c5efc8793206833722de8a 100644 (file)
@@ -2956,10 +2956,19 @@ void LyXText::Backspace(BufferView * bview)
                        status = LyXText::NEED_MORE_REFRESH;
                        
                        BreakAgainOneRow(bview, row);
+                       // will the cursor be in another row now?
+                       if (row->next() && row->next()->par() == row->par() &&
+                           RowLast(row) <= cursor.pos()) {
+                               row = row->next();
+                               BreakAgainOneRow(bview, row);
+                       }
+
                        SetCursor(bview, cursor.par(), cursor.pos(), false, cursor.boundary());
-                       // cursor MUST be in row now
-                       
-                       need_break_row = row->next();
+
+                       if (row->next() && row->next()->par() == row->par())
+                               need_break_row = row->next();
+                       else
+                               need_break_row = 0;
                } else  {
                        // set the dimensions of the row
                        row->fill(Fill(bview, row, workWidth(bview)));