Georg Baum wrote:
Am Freitag, 6. April 2007 13:55 schrieb Abdelrazak Younes:
Georg Baum wrote:
Am Freitag, 6. April 2007 12:28 schrieb Abdelrazak Younes:
We should not change the configuration files of a stable release. We
did
this with the new vector flag for the formats in 1.4.4, and the result
is
that the windows installer still ships a broken lyxrc.dist.
Are you reading what I write? I never proposed to change anything just to _add_ something. This is completely different. Besides, you are comparing apples with oranges.

For me it was clear that we don't want to store information about a single math symbol in two files,

Year, that's where we disagreed then.

therefore I implied that the old information from lib/symbols would go to the new file. If you assume that then the comparison makes sense.

Indeed.

So, I've hard-coded the needed math symbol in ControlMath.C (see attached). As soon as the lib/symbols file is cleaned up to associate the math symbols with unicode (as I understand, it can't now because mathed use these fonts), then we will fill-in math_symbols_ from the symbols define in there. I've also the local 'delim' definition to ControlMath.C along the other ones.

Abdel.
Index: controllers/ControlMath.C
===================================================================
--- controllers/ControlMath.C   (revision 17723)
+++ controllers/ControlMath.C   (working copy)
@@ -21,6 +21,7 @@
 #include <functional>
 
 using std::string;
+using std::map;
 
 namespace lyx {
 
@@ -32,9 +33,49 @@
 
 ControlMath::ControlMath(Dialog & dialog)
        : Dialog::Controller(dialog)
-{}
+{
+       math_symbols_["("] = '(';
+       math_symbols_[")"] = ')';
+       math_symbols_["{"] = '{';
+       math_symbols_["}"] = '}';
+       math_symbols_["["] = '[';
+       math_symbols_["]"] = ']';
+       math_symbols_["|"] = '|';
+       math_symbols_["/"] = '/';
+       math_symbols_["\\"] = '\\';
+       math_symbols_["lceil"] = 0x2308;  // /lceil O: left ceiling, [LEFT 
CEILING]
+       math_symbols_["rceil"] = 0x2309;  // /rceil C: right ceiling, [RIGHT 
CEILING]
+       math_symbols_["lfloor"] = 0x230A;  // /lfloor O: left floor, [LEFT 
FLOOR]
+       math_symbols_["rfloor"] = 0x230B;  // /rfloor C: right floor, [RIGHT 
FLOOR]
+       math_symbols_["langle"] = 0x2329;  // alias ISOTECH lang, 
[LEFT-POINTING ANGLE BRACKET]
+       math_symbols_["rangle"] = 0x232A;  // alias ISOTECH rang, 
[RIGHT-POINTING ANGLE BRACKET]
+       math_symbols_["uparrow"] = 0x2191;  // alias ISONUM uarr, [UPWARDS 
ARROW]
+       math_symbols_["Uparrow"] = 0x21D1;  // alias ISOAMSA uArr, [UPWARDS 
DOUBLE ARROW]
+       math_symbols_["UpArrow"] = 0x2191;  // alias ISONUM uarr, [UPWARDS 
ARROW]
+       math_symbols_["UpArrowBar"] = 0x2912;  // up arrow to bar, [UPWARDS 
ARROW TO BAR]
+       math_symbols_["UpArrowDownArrow"] = 0x21C5;  // alias ISOAMSA udarr, 
[UPWARDS ARROW LEFTWARDS OF DOWNWARDS ARROW]
+       math_symbols_["updownarrow"] = 0x2195;  // alias ISOAMSA varr, [UP DOWN 
ARROW]
+       math_symbols_["Updownarrow"] = 0x21D5;  // alias ISOAMSA vArr, [UP DOWN 
DOUBLE ARROW]
+       math_symbols_["UpDownArrow"] = 0x2195;  // alias ISOAMSA varr, [UP DOWN 
ARROW]
+       math_symbols_["downarrow"] = 0x2193;  // alias ISONUM darr, [DOWNWARDS 
ARROW]
+       math_symbols_["Downarrow"] = 0x21D3;  // alias ISOAMSA dArr, [DOWNWARDS 
DOUBLE ARROW]
+       math_symbols_["DownArrow"] = 0x2193;  // alias ISONUM darr, [DOWNWARDS 
ARROW]
+       math_symbols_["DownArrowBar"] = 0x2913;  // down arrow to bar, 
[DOWNWARDS ARROW TO BAR]
+       math_symbols_["DownArrowUpArrow"] = 0x21F5;  // alias ISOAMSA duarr, 
[DOWNWARDS ARROW LEFTWARDS OF UPWARDS ARROW]
+       math_symbols_["downdownarrows"] = 0x21CA;  // alias ISOAMSA ddarr, 
[DOWNWARDS PAIRED ARROWS]
+       math_symbols_["downharpoonleft"] = 0x21C3;  // alias ISOAMSA dharl, 
[DOWNWARDS HARPOON WITH BARB LEFTWARDS]
+       math_symbols_["downharpoonright"] = 0x21C2;  // alias ISOAMSA dharr, 
[DOWNWARDS HARPOON WITH BARB RIGHTWARDS]
+       math_symbols_["vert"] = 0x007C;  // alias ISONUM verbar, [VERTICAL LINE]
+       math_symbols_["Vert"] = 0x2016;  // alias ISOTECH Verbar, [DOUBLE 
VERTICAL LINE]
+       math_symbols_["Backslash"] = 0x2216;  // alias ISOAMSB setmn, [SET 
MINUS]
 
+       std::map<string, char_type>::const_iterator it = math_symbols_.begin();
+       std::map<string, char_type>::const_iterator end = math_symbols_.end();
+       for (; it != end; ++it)
+               tex_names_[it->second] = it->first;
+}
 
+
 void ControlMath::dispatchFunc(kb_action action, string const & arg) const
 {
        kernel().dispatch(FuncRequest(action, arg));
@@ -97,6 +138,31 @@
 }
 
 
+char_type ControlMath::mathSymbol(string tex_name) const
+{
+       map<string, char_type>::const_iterator it =
+               math_symbols_.find(tex_name);
+       
+       if (it == math_symbols_.end())
+               return '?';
+       
+       return it->second;
+}
+
+
+std::string const & ControlMath::texName(char_type math_symbol) const
+{
+       map<char_type, string>::const_iterator it =
+               tex_names_.find(math_symbol);
+       
+       static string empty_string;
+       if (it == tex_names_.end())
+               return empty_string;
+       
+       return it->second;
+}
+
+
 char const * function_names[] = {
        "arccos", "arcsin", "arctan", "arg", "bmod",
        "cos", "cosh", "cot", "coth", "csc", "deg",
@@ -339,6 +405,16 @@
 int const nr_latex_ams_ops = sizeof(latex_ams_ops) / sizeof(char const *);
 
 
+char const *  latex_delimiters[] = {
+       "(", ")", "{", "}", "[", "]",
+       "lceil", "rceil", "lfloor", "rfloor", "langle", "rangle",
+       "uparrow", "Uparrow", "downarrow", "Downarrow",
+       "|", "Vert", "/", "\\", ""
+};
+
+
+int const nr_latex_delimiters = sizeof(latex_delimiters) / sizeof(char const 
*);
+
 namespace {
 
 struct XPMmap {
Index: controllers/ControlMath.h
===================================================================
--- controllers/ControlMath.h   (revision 17723)
+++ controllers/ControlMath.h   (working copy)
@@ -18,6 +18,8 @@
 #include "Dialog.h"
 #include "lfuns.h" // for kb_action
 
+#include <map>
+
 namespace lyx {
 namespace frontend {
 
@@ -53,6 +55,15 @@
         *  \param name the dialog identifier.
         */
        void showDialog(std::string const & name) const;
+
+       ///
+       char_type mathSymbol(std::string tex_name) const;
+       ///
+       std::string const & texName(char_type math_symbol) const;
+
+private:
+       std::map<std::string, char_type> math_symbols_;
+       std::map<char_type, std::string> tex_names_;
 };
 
 
@@ -84,6 +95,8 @@
 extern int const nr_latex_ams_nrel;
 extern char const * latex_ams_ops[];
 extern int const nr_latex_ams_ops;
+extern char const * latex_delimiters[];
+extern int const nr_latex_delimiters;
 
 /**
  * Return the mangled XPM filename of the given

Reply via email to