]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_panel.C
Hopefully fix the problem with stateText() in lyxfont.C
[lyx.git] / src / mathed / math_panel.C
index 57f4785bfc42b286e9845fb4ec4b0b9b2624d6a0..6c10630a86b5cbaa0287ecfb66e533c19ac096ed 100644 (file)
@@ -6,7 +6,7 @@
  * 
  *  Dependencies: Xlib, Xpm, XForms, Lyx
  *
- *  Copyright: (c) 1996, Alejandro Aguilar Sierra 
+ *  Copyright: 1996, Alejandro Aguilar Sierra 
  *
  *   You are free to use and modify it under the terms of
  *   the GNU General Public Licence version 2 or later.
@@ -15,7 +15,6 @@
 #include <config.h>
 
 #include FORMS_H_LOCATION
-#include <cstdlib>
 
 #include "lyx_gui_misc.h" 
 #include "math_panel.h"
@@ -147,10 +146,17 @@ void delim_cb(FL_OBJECT *, long data)
     case MM_APPLY:
     case MM_OK:
       {
-        char s[80];
-        sprintf(s, "%d %d", delim_code[left], delim_code[right]); 
-        lyxfunc->Dispatch(LFUN_MATH_DELIM, s);
-        if (data == MM_APPLY) break;
+#ifdef HAVE_SSTREAM
+             std::ostringstream ost;
+             ost << delim_code[left] << ' ' << delim_code[right];
+             lyxfunc->Dispatch(LFUN_MATH_DELIM, ost.str().c_str());
+#else
+             char s[80];
+             ostrstream ost(s, 80);
+             ost << delim_code[left] << ' ' << delim_code[right] << '\0';
+             lyxfunc->Dispatch(LFUN_MATH_DELIM, ost.str());
+#endif
+             if (data == MM_APPLY) break;
       }
     case MM_CLOSE: fl_hide_form(fd_delim->delim); break;
     case 2: 
@@ -194,21 +200,28 @@ void matrix_cb(FL_OBJECT *, long data)
     case MM_APPLY:
     case MM_OK: 
       {
-        char s[80];
         char c = v_align_c[fl_get_choice(fd_matrix->valign)-1];
         char const * sh = fl_get_input(fd_matrix->halign);
         int nx = int(fl_get_slider_value(fd_matrix->columns)+0.5);
         int ny = int(fl_get_slider_value(fd_matrix->rows)+0.5);
-        sprintf(s, "%d %d %c%s", nx, ny, c, sh);      
         if (data == MM_OK) fl_hide_form(fd_matrix->matrix);
-        lyxfunc->Dispatch(LFUN_INSERT_MATRIX, s);
+#ifdef HAVE_SSTREAM
+        std::ostringstream ost;
+        ost << nx << ' ' << ny << ' ' << c << sh;
+        lyxfunc->Dispatch(LFUN_INSERT_MATRIX, ost.str().c_str());
+#else
+        char s[80];
+        ostrstream ost(s, 80);
+        ost << nx << ' ' << ny << ' ' << c << sh << '\0';
+        lyxfunc->Dispatch(LFUN_INSERT_MATRIX, ost.str());
+#endif
         break;
       }
     case MM_CLOSE: fl_hide_form(fd_matrix->matrix); break;
     case 2: 
       {
         int nx = int(fl_get_slider_value(fd_matrix->columns)+0.5);
-        for (int i= 0; i<nx; i++) h_align_str[i] = 'c';
+        for (int i = 0; i < nx; ++i) h_align_str[i] = 'c';
         //memset(h_align_str, 'c', nx);
         h_align_str[nx] = '\0';
 //      fl_freeze_form(fd_form_main->form_main);