mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-05 17:09:56 +00:00
add a setDefaults to GUIRuntime + some const changes in tabular + some c_str to work in spellchecker
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1027 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
7bfd36da33
commit
4585597f47
@ -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.
|
||||
|
||||
|
@ -31,5 +31,8 @@ public:
|
||||
///
|
||||
static
|
||||
void runTime();
|
||||
/// This is run first in the LyXGUI constructor.
|
||||
static
|
||||
void setDefaults();
|
||||
};
|
||||
#endif
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -143,7 +143,7 @@ class MathedCursor {
|
||||
///
|
||||
// LyxArrayBase *selarray;
|
||||
///
|
||||
Bool is_visible;
|
||||
bool is_visible;
|
||||
///
|
||||
long unsigned win;
|
||||
///
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user