]> git.lyx.org Git - features.git/commitdiff
add a setDefaults to GUIRuntime + some const changes in tabular + some c_str to work...
authorLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 18 Sep 2000 19:41:52 +0000 (19:41 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Mon, 18 Sep 2000 19:41:52 +0000 (19:41 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1027 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/frontends/GUIRunTime.h
src/frontends/gnome/GUIRunTime.C
src/frontends/kde/GUIRunTime.C
src/frontends/xforms/GUIRunTime.C
src/insets/insettabular.C
src/lyx_gui.C
src/mathed/math_cursor.C
src/mathed/math_cursor.h
src/spellchecker.C
src/tabular.C

index 9da00fba2eb5181adac0388e42da06d67568236c..9ec94b0e3f4fb7856e8f9aa0d9b661273a9d9c73 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2000-09-18  Lars Gullik Bjønnes  <larsbj@lyx.org>
 
+       * src/tabular.C: some more const to local vars move some loop vars
+       
+       * src/spellchecker.C: added some c_str after some word for pspell
+
+       * src/frontends/GUIRunTime.h: add new static method setDefaults
+       * src/frontends/xforms/GUIRunTime.C (setDefaults): 
+       * src/frontends/kde/GUIRunTime.C (setDefaults): 
+       * src/frontends/gnome/GUIRunTime.C (setDefaults): new method
+
        * src/mathed/math_cursor.C (MacroModeClose): don't call SetName
        with strnew in arg, use correct emptystring when calling SetName.
 
index 39bac4997bc89775fb404a67bf440c30f2d0b7f9..7b4a8e594d314aa4c766b36b7576ba569ebafebe 100644 (file)
@@ -31,5 +31,8 @@ public:
        ///
        static
        void runTime();
+       /// This is run first in the LyXGUI constructor.
+       static
+       void setDefaults();
 };
 #endif
index 928301224d845a4374338a9528863467f1c98a5b..7a3c4522fe526be08d5f9342df98ffe532474811 100644 (file)
@@ -90,3 +90,25 @@ void GUIRunTime::runTime()
                }
        }
 }
+
+
+void GUIRunTime::setDefaults()
+{
+       FL_IOPT cntl;
+       cntl.buttonFontSize = FL_NORMAL_SIZE;
+       cntl.browserFontSize = FL_NORMAL_SIZE;
+       cntl.labelFontSize = FL_NORMAL_SIZE;
+       cntl.choiceFontSize = FL_NORMAL_SIZE;
+       cntl.inputFontSize = FL_NORMAL_SIZE;
+       cntl.menuFontSize  = FL_NORMAL_SIZE;
+       cntl.borderWidth = -1;
+       cntl.vclass = FL_DefaultVisual;
+       fl_set_defaults(FL_PDVisual
+                       | FL_PDButtonFontSize
+                       | FL_PDBrowserFontSize
+                       | FL_PDLabelFontSize
+                       | FL_PDChoiceFontSize
+                       | FL_PDInputFontSize
+                       | FL_PDMenuFontSize
+                       | FL_PDBorderWidth, &cntl);
+}
index 15cc4f1ce8cb08f2d6355e9dd9b8f1e3795b435f..a836e50ddc172a53cd38b0b9e437c5245d386e2f 100644 (file)
@@ -86,3 +86,26 @@ void GUIRunTime::runTime()
                }
        }
 }
+
+
+void GUIRunTime::setDefaults() 
+{
+       FL_IOPT cntl;
+       cntl.buttonFontSize = FL_NORMAL_SIZE;
+       cntl.browserFontSize = FL_NORMAL_SIZE;
+       cntl.labelFontSize = FL_NORMAL_SIZE;
+       cntl.choiceFontSize = FL_NORMAL_SIZE;
+       cntl.inputFontSize = FL_NORMAL_SIZE;
+       cntl.menuFontSize  = FL_NORMAL_SIZE;
+       cntl.borderWidth = -1;
+       cntl.vclass = FL_DefaultVisual;
+       fl_set_defaults(FL_PDVisual
+                       | FL_PDButtonFontSize
+                       | FL_PDBrowserFontSize
+                       | FL_PDLabelFontSize
+                       | FL_PDChoiceFontSize
+                       | FL_PDInputFontSize
+                       | FL_PDMenuFontSize
+                       | FL_PDBorderWidth, &cntl);
+}
+
index 8e0dc35155cdc2f5669681529d85eed90d1a7080..cc867e24fbdc5403de60c6c11cc79ba12cedd3ae 100644 (file)
@@ -60,14 +60,15 @@ int GUIRunTime::initApplication(int , char **)
        return 0;
 }
 
+
 void GUIRunTime::processEvents() 
 {
-    XEvent ev;
+       XEvent ev;
 
-    if (fl_do_forms() == FL_EVENT) {
-       lyxerr << "LyX: This shouldn't happen..." << endl;
-       fl_XNextEvent(&ev);
-    }
+       if (fl_do_forms() == FL_EVENT) {
+               lyxerr << "LyX: This shouldn't happen..." << endl;
+               fl_XNextEvent(&ev);
+       }
 }
 
 
@@ -82,3 +83,24 @@ void GUIRunTime::runTime()
        }
 }
 
+
+void GUIRunTime::setDefaults()
+{
+       FL_IOPT cntl;
+       cntl.buttonFontSize = FL_NORMAL_SIZE;
+       cntl.browserFontSize = FL_NORMAL_SIZE;
+       cntl.labelFontSize = FL_NORMAL_SIZE;
+       cntl.choiceFontSize = FL_NORMAL_SIZE;
+       cntl.inputFontSize = FL_NORMAL_SIZE;
+       cntl.menuFontSize  = FL_NORMAL_SIZE;
+       cntl.borderWidth = -1;
+       cntl.vclass = FL_DefaultVisual;
+       fl_set_defaults(FL_PDVisual
+                       | FL_PDButtonFontSize
+                       | FL_PDBrowserFontSize
+                       | FL_PDLabelFontSize
+                       | FL_PDChoiceFontSize
+                       | FL_PDInputFontSize
+                       | FL_PDMenuFontSize
+                       | FL_PDBorderWidth, &cntl);
+}
index b0906a250958d7906981534b94ccc35c0b685875..8b07c7885f7a163a87fa1e393757211c571623ad 100644 (file)
@@ -879,9 +879,10 @@ int InsetTabular::Latex(Buffer const * buf, ostream & os,
 }
 
 
-int InsetTabular::Ascii(Buffer const *, ostream &) const
+int InsetTabular::Ascii(Buffer const * buf, ostream & os) const
 {
-    return 0;
+    // This should be changed to a real ascii export
+    return tabular->Latex(buf, os, false, false);
 }
 
 
index 1008af715194f1f6e8ecb277aeb3101354271c3d..1b090fc06524d14c3391c5362bb0b4506d9b5de1 100644 (file)
@@ -109,6 +109,7 @@ LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI)
        if (!gui)
                return;
 
+       // 
        setDefaults();
        
        static const int num_res = sizeof(res)/sizeof(FL_resource);
@@ -172,7 +173,6 @@ LyXGUI::~LyXGUI()
        delete lyxserver;
        lyxserver = 0;
        delete lyxViews;
-       lyxViews = 0;
 
        CloseLyXLookup();
 }
@@ -180,23 +180,7 @@ LyXGUI::~LyXGUI()
 
 void LyXGUI::setDefaults()
 {
-       FL_IOPT cntl;
-       cntl.buttonFontSize = FL_NORMAL_SIZE;
-       cntl.browserFontSize = FL_NORMAL_SIZE;
-       cntl.labelFontSize = FL_NORMAL_SIZE;
-       cntl.choiceFontSize = FL_NORMAL_SIZE;
-       cntl.inputFontSize = FL_NORMAL_SIZE;
-       cntl.menuFontSize  = FL_NORMAL_SIZE;
-       cntl.borderWidth = -1;
-       cntl.vclass = FL_DefaultVisual;
-       fl_set_defaults(FL_PDVisual
-                       | FL_PDButtonFontSize
-                       | FL_PDBrowserFontSize
-                       | FL_PDLabelFontSize
-                       | FL_PDChoiceFontSize
-                       | FL_PDInputFontSize
-                       | FL_PDMenuFontSize
-                       | FL_PDBorderWidth, &cntl);
+       GUIRunTime::setDefaults();
 }
 
 
index 5e2451b55e12ee1bcd1313cfb8914a86ac8b332a..7d635f20a0d7a1b2d7967add9953949a906e7c76 100644 (file)
@@ -53,23 +53,9 @@ bool IsMacro(short tok, int id)
           !(tok == LM_TK_SYM && id < 255));
 }
 
-
-// Yes, mathed isn't using string yet.
-static inline
-char * strnew(char const * s)
-{
-    char * s1 = new char[strlen(s)+1];
-    strcpy(s1, s);
-    return s1;
-}
-
-
-
 static int const MAX_STACK_ITEMS = 32;
 
-
 struct MathStackXIter {
-    
     int i, imax;
     MathedXIter * item;
     
@@ -114,7 +100,8 @@ struct MathStackXIter {
 } mathstk, *selstk = 0;
 
 
-MathStackXIter::MathStackXIter(MathStackXIter & stk) {
+MathStackXIter::MathStackXIter(MathStackXIter & stk)
+{
     imax = stk.imax;
     item = new MathedXIter[imax];
     i = stk.i;
@@ -777,7 +764,6 @@ void MathedCursor::MacroModeClose()
       if (macroln > 0 && (!l || (l && IsMacro(l->token, l->id))) && 
          !MathMacroTable::mathMTable.getMacro(macrobf)) {
          if (!l) {
-                 //imacro->SetName(strnew(macrobf));
            imacro->SetName(macrobf);
              // This guarantees that the string will be removed by destructor
            imacro->SetType(LM_OT_UNDEF);
index 8ccd85936c6da15b8c5d5c9c14141f6452a17167..b187a72fca21f173fd82345d53efec538153ce5e 100644 (file)
@@ -143,7 +143,7 @@ class MathedCursor {
     ///
 //    LyxArrayBase *selarray; 
     ///
-    Bool is_visible;
+    bool is_visible;
     ///
     long unsigned win;
     ///
index 6783f2989ea4950c15c53468b69f8965233baf0c..451baa54c8ac7d4fc86396f35079d9c81623834e 100644 (file)
@@ -624,14 +624,15 @@ static
 isp_result * sc_check_word(string const & word)
 {
        isp_result * result = new isp_result;
-       int word_ok = pspell_manager_check(sc, word);
+       int word_ok = pspell_manager_check(sc, word.c_str());
        Assert(word_ok != -1);
 
        if (word_ok) {
                result->flag = ISP_OK;
        } else {
 
-               PspellWordList const * sugs = pspell_manager_suggest(sc, word);
+               PspellWordList const * sugs =
+                       pspell_manager_suggest(sc, word.c_str());
                Assert(sugs != 0);
                result->els = pspell_word_list_elements(sugs);
                if (pspell_word_list_empty(sugs)) 
@@ -653,14 +654,14 @@ void close_spell_checker()
 static inline 
 void sc_insert_word(string const & word)
 {
-       pspell_manager_add_to_personal(sc, word);
+       pspell_manager_add_to_personal(sc, word.c_str());
 }
 
 
 static inline 
 void sc_accept_word(string const & word) 
 {
-       pspell_manager_add_to_session(sc, word);
+       pspell_manager_add_to_session(sc, word.c_str());
 }
 
 
index e29f37b40ba78a99812a30f482d2abd305f852f2..7707ba27b8745044ff6d1b906d212b279772b82f 100644 (file)
@@ -1341,12 +1341,8 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
 
 string const LyXTabular::GetDocBookAlign(int cell, bool isColumn) const
 {
-       int i = isColumn ? cell : column_of_cell(cell);
+    int i = isColumn ? cell : column_of_cell(cell);
        
-       //if (isColumn)
-       //i = cell;
-       //else
-       //i = column_of_cell(cell);
     if (!isColumn && IsMultiColumn(cell)) {
        if (!cellinfo_of_cell(cell)->align_special.empty()) {
            return cellinfo_of_cell(cell)->align_special;
@@ -1389,10 +1385,8 @@ string const LyXTabular::GetDocBookAlign(int cell, bool isColumn) const
 // returns the number of printed newlines
 int LyXTabular::DocBookEndOfCell(ostream & os, int cell, int & depth) const
 {
-    int i;
     int ret = 0;
-    //int tmp; // tmp2; // unused
-    int nvcell; // fcell; // unused
+    int nvcell;
     if (IsLastCell(cell)) {
            os << newlineAndDepth(--depth)
               << "</ENTRY>"
@@ -1420,7 +1414,7 @@ int LyXTabular::DocBookEndOfCell(ostream & os, int cell, int & depth) const
               << "' COLSEP='1' ROWSEP='1'>"
               << newlineAndDepth(++depth);
             ++ret;
-            for (i = 0; i < columns_; ++i) {
+            for (int i = 0; i < columns_; ++i) {
                    os << "<COLSPEC ALIGN='"
                       << GetDocBookAlign(i, true)
                       << "' COLNAME='col"
@@ -1474,7 +1468,7 @@ int LyXTabular::DocBookEndOfCell(ostream & os, int cell, int & depth) const
                       << "' VALIGN='middle'";
                if (IsMultiColumn(cell + 1)) {
                       os << " NAMEST='col"
-                         << column_of_cell(cell+1) + 1
+                         << column_of_cell(cell + 1) + 1
                          << "' NAMEEND='col"
                          << column_of_cell(cell + 1) +
                               cells_in_multicolumn(cell + 1)
@@ -1492,10 +1486,10 @@ int LyXTabular::DocBookEndOfCell(ostream & os, int cell, int & depth) const
                       << "' VALIGN='middle'";
                if (IsMultiColumn(cell + 1)) {
                       os << " NAMEST='col"
-                         << column_of_cell(cell+1) + 1
+                         << column_of_cell(cell + 1) + 1
                          << "' NAMEEND='col"
-                         << column_of_cell(cell+1) +
-                              cells_in_multicolumn(cell+1)
+                         << column_of_cell(cell + 1) +
+                              cells_in_multicolumn(cell + 1)
                          << "'";
                }
                os << ">"
@@ -1517,8 +1511,8 @@ bool LyXTabular::IsMultiColumn(int cell, bool real) const
 
 LyXTabular::cellstruct * LyXTabular::cellinfo_of_cell(int cell) const
 {
-    int row = row_of_cell(cell);
-    int column = column_of_cell(cell);
+    int const row = row_of_cell(cell);
+    int const column = column_of_cell(cell);
     return  &cell_info[row][column];
 }
    
@@ -1538,7 +1532,7 @@ void LyXTabular::SetMultiColumn(int cell, int number)
 
 int LyXTabular::cells_in_multicolumn(int cell) const
 {
-    int row = row_of_cell(cell);
+    int const row = row_of_cell(cell);
     int column = column_of_cell(cell);
     int result = 1;
     ++column;
@@ -1554,7 +1548,7 @@ int LyXTabular::cells_in_multicolumn(int cell) const
 
 int LyXTabular::UnsetMultiColumn(int cell)
 {
-    int row = row_of_cell(cell);
+    int const row = row_of_cell(cell);
     int column = column_of_cell(cell);
     
     int result = 0;
@@ -1627,7 +1621,7 @@ bool LyXTabular::NeedRotating() const
 
 bool LyXTabular::IsLastCell(int cell) const
 {
-    if ((cell+1) < GetNumberOfCells())
+    if ((cell + 1) < GetNumberOfCells())
         return false;
     return true;
 }
@@ -1643,7 +1637,7 @@ int LyXTabular::GetCellAbove(int cell) const
 
 int LyXTabular::GetCellBelow(int cell) const
 {
-    if (row_of_cell(cell)+1 < rows_)
+    if (row_of_cell(cell) + 1 < rows_)
         return cell_info[row_of_cell(cell)+1][column_of_cell(cell)].cellno;
     return cell;
 }
@@ -1655,17 +1649,17 @@ int LyXTabular::GetLastCellAbove(int cell) const
        return cell;
     if (!IsMultiColumn(cell))
        return GetCellAbove(cell);
-    return cell_info[row_of_cell(cell)-1][right_column_of_cell(cell)].cellno;
+    return cell_info[row_of_cell(cell) - 1][right_column_of_cell(cell)].cellno;
 }
 
 
 int LyXTabular::GetLastCellBelow(int cell) const
 {
-    if (row_of_cell(cell)+1 >= rows_)
+    if (row_of_cell(cell) + 1 >= rows_)
        return cell;
     if (!IsMultiColumn(cell))
        return GetCellBelow(cell);
-    return cell_info[row_of_cell(cell)+1][right_column_of_cell(cell)].cellno;
+    return cell_info[row_of_cell(cell) + 1][right_column_of_cell(cell)].cellno;
 }
 
 
@@ -1704,7 +1698,7 @@ int LyXTabular::GetUsebox(int cell) const
 void LyXTabular::SetLTHead(int cell, bool first)
 {
     int const row = row_of_cell(cell);
-    int const val = (row+1) * (column_of_cell(cell)? 1:-1);
+    int const val = (row + 1) * (column_of_cell(cell) ? 1 : -1);
 
     if (first) {
         if (endfirsthead == val)
@@ -1725,7 +1719,7 @@ bool LyXTabular::GetRowOfLTHead(int cell, int & row) const
     row = endhead;
     if (abs(endhead) > rows_)
         return false;
-    return (row_of_cell(cell) == (abs(endhead)-1));
+    return (row_of_cell(cell) == abs(endhead) - 1);
 }
 
 
@@ -1734,14 +1728,14 @@ bool LyXTabular::GetRowOfLTFirstHead(int cell, int & row) const
     row = endfirsthead;
     if (abs(endfirsthead) > rows_)
         return false;
-    return (row_of_cell(cell) == (abs(endfirsthead)-1));
+    return (row_of_cell(cell) == abs(endfirsthead) - 1);
 }
 
 
 void LyXTabular::SetLTFoot(int cell, bool last)
 {
     int const row = row_of_cell(cell);
-    int const val = (row + 1) * (column_of_cell(cell)? 1:-1);
+    int const val = (row + 1) * (column_of_cell(cell) ? 1 : -1);
 
     if (last) {
         if (endlastfoot == val)
@@ -1760,9 +1754,9 @@ void LyXTabular::SetLTFoot(int cell, bool last)
 bool LyXTabular::GetRowOfLTFoot(int cell, int & row) const
 {
     row = endfoot;
-    if ((endfoot+1) > rows_)
+    if ((endfoot + 1) > rows_)
         return false;
-    return (row_of_cell(cell) == (abs(endfoot)-1));
+    return (row_of_cell(cell) == abs(endfoot) - 1);
 }
 
 
@@ -1842,19 +1836,19 @@ bool LyXTabular::IsPartOfMultiColumn(int row, int column) const
 
 int LyXTabular::TeXTopHLine(ostream & os, int row) const
 {
-    int fcell = GetFirstCellInRow(row);
-    int n = NumberOfCellsInRow(fcell) + fcell;
-    int tmp=0;
-    int i;
+#warning should this return a bool? (Lgb)
+    int const fcell = GetFirstCellInRow(row);
+    int const n = NumberOfCellsInRow(fcell) + fcell;
+    int tmp = 0;
 
-    for (i = fcell; i < n; ++i) {
+    for (int i = fcell; i < n; ++i) {
        if (TopLine(i))
            ++tmp;
     }
     if (tmp == (n - fcell)){
        os << "\\hline ";
     } else {
-       for (i = fcell; i < n; ++i) {
+       for (int i = fcell; i < n; ++i) {
            if (TopLine(i)) {
                os << "\\cline{"
                   << column_of_cell(i) + 1
@@ -1874,6 +1868,7 @@ int LyXTabular::TeXTopHLine(ostream & os, int row) const
 
 int LyXTabular::TeXBottomHLine(ostream & os, int row) const
 {
+#warning should this return a bool? (Lgb)
     int const fcell = GetFirstCellInRow(row);
     int const n = NumberOfCellsInRow(fcell) + fcell;
     int tmp = 0;
@@ -2178,9 +2173,9 @@ void LyXTabular::Validate(LaTeXFeatures & features) const
 
 bool LyXTabular::UseParbox(int cell) const
 {
-    LyXParagraph *par = GetCellInset(cell)->par;
+    LyXParagraph * par = GetCellInset(cell)->par;
 
-    for(;par; par = par->next) {
+    for(; par; par = par->next) {
        for(int i = 0; i < par->Last(); ++i) {
            if (par->GetChar(i) == LyXParagraph::META_NEWLINE)
                return true;