some formatting changes some simplifications and removal of dead code

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1198 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2000-11-04 10:00:12 +00:00
parent 8c84c220e5
commit adaef99e60
102 changed files with 960 additions and 1192 deletions

View File

@ -1,3 +1,24 @@
2000-11-04 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/frontends/xforms/FormPreferences.h (operator=): move out of RGB
(operator!): ditto
* src/frontends/xforms/FormPreferences.C (WriteableFile): simplify
the use of FileInfo
* src/lyxfunc.C (processKeyEvent): removed
* src/bufferlist.C (emergencyWrite): removed the out commented
emergency write code.
* src/Makefile.am (lyx_main.o): add dep for commandtags.h
* src/LyXView.[Ch]: remove the outcommented raw_callback code
* many files: change formatting to be a bit more uniform for
if,while,for,switch statements, remove some parantesis not needed.
2000-11-03 John Levon <moz@compsoc.man.ac.uk> 2000-11-03 John Levon <moz@compsoc.man.ac.uk>
* config/kde.m4: make config more robust when KDEDIR is set * config/kde.m4: make config more robust when KDEDIR is set

View File

@ -285,7 +285,7 @@ bool BufferView::gotoLabel(string const & label)
for (Buffer::inset_iterator it = buffer()->inset_iterator_begin(); for (Buffer::inset_iterator it = buffer()->inset_iterator_begin();
it != buffer()->inset_iterator_end(); ++it) { it != buffer()->inset_iterator_end(); ++it) {
vector<string> labels = (*it)->getLabelList(); vector<string> labels = (*it)->getLabelList();
if ( find(labels.begin(),labels.end(),label) if (find(labels.begin(),labels.end(),label)
!= labels.end()) { != labels.end()) {
beforeChange(); beforeChange();
text->SetCursor(this, it.getPar(), it.getPos()); text->SetCursor(this, it.getPar(), it.getPos());

View File

@ -432,12 +432,12 @@ void BufferView::Pimpl::scrollCB(double value)
LyXText * vbt = bv_->text; LyXText * vbt = bv_->text;
int height = vbt->DefaultHeight(); int height = vbt->DefaultHeight();
if (vbt->cursor.y() < (int)(bv_->text->first + height)) { if (vbt->cursor.y() < static_cast<int>((bv_->text->first + height))) {
vbt->SetCursorFromCoordinates(bv_, 0, vbt->SetCursorFromCoordinates(bv_, 0,
bv_->text->first + bv_->text->first +
height); height);
} else if (vbt->cursor.y() > } else if (vbt->cursor.y() >
(int)(bv_->text->first+workarea_->height()-height)) static_cast<int>((bv_->text->first+workarea_->height()-height)))
{ {
vbt->SetCursorFromCoordinates(bv_, 0, vbt->SetCursorFromCoordinates(bv_, 0,
bv_->text->first + bv_->text->first +
@ -1221,11 +1221,11 @@ void BufferView::Pimpl::restorePosition()
beforeChange(); beforeChange();
if( fname != buffer_->fileName() ) { if (fname != buffer_->fileName()) {
Buffer * b = bufferlist.exists(fname) ? Buffer * b = bufferlist.exists(fname) ?
bufferlist.getBuffer(fname) : bufferlist.getBuffer(fname) :
bufferlist.loadLyXFile(fname); // don't ask, just load it bufferlist.loadLyXFile(fname); // don't ask, just load it
if( b != 0 ) buffer(b); if (b != 0 ) buffer(b);
} }
bv_->text->SetCursorFromCoordinates(bv_, x, y); bv_->text->SetCursorFromCoordinates(bv_, x, y);
@ -1341,7 +1341,7 @@ void BufferView::Pimpl::toggleToggle()
void BufferView::Pimpl::center() void BufferView::Pimpl::center()
{ {
beforeChange(); beforeChange();
if (bv_->text->cursor.y() > (int)(workarea_->height() / 2)) { if (bv_->text->cursor.y() > static_cast<int>((workarea_->height() / 2))) {
screen_->Draw(bv_->text, bv_->text->cursor.y() - workarea_->height() / 2); screen_->Draw(bv_->text, bv_->text->cursor.y() - workarea_->height() / 2);
} else { } else {
screen_->Draw(bv_->text, 0); screen_->Draw(bv_->text, 0);

View File

@ -105,7 +105,7 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
XColor * cmap = new XColor[vi->map_entries]; XColor * cmap = new XColor[vi->map_entries];
for(int i = 0; i < vi->map_entries; ++i) { for (int i = 0; i < vi->map_entries; ++i) {
cmap[i].pixel = i; cmap[i].pixel = i;
} }
XQueryColors(display, colormap, cmap, vi->map_entries); XQueryColors(display, colormap, cmap, vi->map_entries);
@ -114,7 +114,7 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
int closest_pixel = 0; int closest_pixel = 0;
double closest_distance = 1e20; // we want to minimize this double closest_distance = 1e20; // we want to minimize this
double distance = 0; double distance = 0;
for(int t = 0; t < vi->map_entries; ++t) { for (int t = 0; t < vi->map_entries; ++t) {
// The Euclidean distance between two points in // The Euclidean distance between two points in
// a three-dimensional space, the RGB color-cube, // a three-dimensional space, the RGB color-cube,
// is used as the distance measurement between two // is used as the distance measurement between two

View File

@ -85,7 +85,7 @@ bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar,
#else #else
(startpar == (*endpar)) (startpar == (*endpar))
#endif #endif
) { ) {
// only within one paragraph // only within one paragraph
buf = new LyXParagraph; buf = new LyXParagraph;
LyXParagraph::size_type i = start; LyXParagraph::size_type i = start;
@ -181,7 +181,7 @@ bool CutAndPaste::copySelection(LyXParagraph * startpar, LyXParagraph * endpar,
#else #else
(startpar == endpar) (startpar == endpar)
#endif #endif
) { ) {
// only within one paragraph // only within one paragraph
buf = new LyXParagraph; buf = new LyXParagraph;
LyXParagraph::size_type i = start; LyXParagraph::size_type i = start;

View File

@ -46,7 +46,7 @@ void DepTable::insert(string const & fi,
void DepTable::update() void DepTable::update()
{ {
for(DepList::iterator itr = deplist.begin(); for (DepList::iterator itr = deplist.begin();
itr != deplist.end(); itr != deplist.end();
++itr) { ++itr) {
unsigned long const one = (*itr).second.second; unsigned long const one = (*itr).second.second;

View File

@ -128,7 +128,7 @@ void FontInfo::query()
strings = new string[matches]; strings = new string[matches];
// We have matches. Run them through // We have matches. Run them through
for(int i = 0; i < matches; ++i) { for (int i = 0; i < matches; ++i) {
string name(list[i]); string name(list[i]);
sizes[i] = lyx::atoi(token(name, '-', 7)); sizes[i] = lyx::atoi(token(name, '-', 7));
strings[i] = name; strings[i] = name;

View File

@ -302,12 +302,6 @@ void LyXView::create_form_form_main(int width, int height)
} }
#if 0
extern "C"
int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev);
#endif
void LyXView::init() void LyXView::init()
{ {
// Set the textclass choice // Set the textclass choice
@ -321,12 +315,6 @@ void LyXView::init()
autosave_timeout.start(); autosave_timeout.start();
} }
#if 0
// Install the raw callback for keyboard events
fl_register_raw_callback(form_,
KeyPressMask,
C_LyXView_KeyPressMask_raw_callback);
#endif
intl->InitKeyMapper(lyxrc.use_kbmap); intl->InitKeyMapper(lyxrc.use_kbmap);
} }
@ -366,71 +354,6 @@ void LyXView::updateLayoutChoice()
} }
#if 0
// This is necessary, since FL_FREE-Objects doesn't get all keypress events
// as FL_KEYBOARD events :-( Matthias 280596
int LyXView::KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
{
LyXView * view = static_cast<LyXView*>(fl->u_vdata);
int retval = 0; // 0 means XForms should have a look at this event
XKeyEvent * xke = static_cast<XKeyEvent*>(xev);
static Time last_time_pressed = 0;
static Time last_time_released = 0;
static unsigned int last_key_pressed = 0;
static unsigned int last_key_released = 0;
static unsigned int last_state_pressed = 0;
static unsigned int last_state_released = 0;
// funny. Even though the raw_callback is registered with KeyPressMask,
// also KeyRelease-events are passed through:-(
// [It seems that XForms puts them in pairs... (JMarc)]
if (static_cast<XEvent*>(xev)->type == KeyPress
&& view->bufferview->focus()
&& view->bufferview->active())
{
last_time_pressed = xke->time;
last_key_pressed = xke->keycode;
last_state_pressed = xke->state;
retval = view->getLyXFunc()
->processKeyEvent(static_cast<XEvent*>(xev));
}
else if (static_cast<XEvent*>(xev)->type == KeyRelease
&& view->bufferview->focus()
&& view->bufferview->active())
{
last_time_released = xke->time;
last_key_released = xke->keycode;
last_state_released = xke->state;
}
if (last_key_released == last_key_pressed
&& last_state_released == last_state_pressed
&& last_time_released == last_time_pressed) {
// When the diff between last_time_released and
// last_time_pressed is 0, that sinifies an autoreapeat
// at least on my system. It like some feedback from
// others, especially from user running LyX remote.
lyxerr[Debug::KEY] << "Syncing - purging X events." << endl;
XSync(fl_get_display(), 1);
// This purge make f.ex. scrolling stop imidiatly when
// releaseing the PageDown button. The question is if this
// purging of XEvents can cause any harm...after some testing
// I can see no problems, but I'd like other reports too.
}
return retval;
}
// wrapper for the above
extern "C"
int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev)
{
return LyXView::KeyPressMask_raw_callback(fl, xev);
}
#endif
// Updates the title of the window with the filename of the current document // Updates the title of the window with the filename of the current document
void LyXView::updateWindowTitle() void LyXView::updateWindowTitle()
{ {

View File

@ -133,10 +133,6 @@ private:
/// ///
void invalidateLayoutChoice(); void invalidateLayoutChoice();
public: public:
#if 0
///
static int KeyPressMask_raw_callback(FL_FORM *, void * xev);
#endif
/** This callback is run when a close event is sent from the /** This callback is run when a close event is sent from the
window manager. */ window manager. */
static int atCloseMainFormCB(FL_FORM *, void *); static int atCloseMainFormCB(FL_FORM *, void *);

View File

@ -228,7 +228,7 @@ lyx_SOURCES = \
lyx_main.o: lyx_main.C lyx_main.h config.h version.h lyx_gui.h \ lyx_main.o: lyx_main.C lyx_main.h config.h version.h lyx_gui.h \
lyx_gui_misc.h lyxrc.h support/path.h support/filetools.h \ lyx_gui_misc.h lyxrc.h support/path.h support/filetools.h \
bufferlist.h debug.h support/FileInfo.h lastfiles.h intl.h \ bufferlist.h debug.h support/FileInfo.h lastfiles.h intl.h \
lyxserver.h layout.h gettext.h kbmap.h lyxserver.h layout.h gettext.h kbmap.h commandtags.h
$(CXXCOMPILE) -DLYX_DIR=\"$(pkgdatadir)\" \ $(CXXCOMPILE) -DLYX_DIR=\"$(pkgdatadir)\" \
-DTOP_SRCDIR=\"$(top_srcdir)\" -c $(top_srcdir)/src/lyx_main.C -DTOP_SRCDIR=\"$(top_srcdir)\" -c $(top_srcdir)/src/lyx_main.C

View File

@ -46,7 +46,7 @@ MenuItem::MenuItem(Kind kind, string const & label,
string const & command, bool optional) string const & command, bool optional)
: kind_(kind), label_(label), optional_(optional) : kind_(kind), label_(label), optional_(optional)
{ {
switch(kind) { switch (kind) {
case Separator: case Separator:
case Documents: case Documents:
case Lastfiles: case Lastfiles:
@ -122,7 +122,7 @@ Menu & Menu::read(LyXLex & lex)
bool optional = false; bool optional = false;
while (lex.IsOK() && !quit) { while (lex.IsOK() && !quit) {
switch(lex.lex()) { switch (lex.lex()) {
case md_optitem: case md_optitem:
optional = true; optional = true;
// fallback to md_item // fallback to md_item
@ -351,7 +351,7 @@ void MenuBackend::read(LyXLex & lex)
bool menubar = false; bool menubar = false;
while (lex.IsOK() && !quit) { while (lex.IsOK() && !quit) {
switch(lex.lex()) { switch (lex.lex()) {
case md_menubar: case md_menubar:
menubar = true; menubar = true;
// fallback to md_menu // fallback to md_menu
@ -436,7 +436,7 @@ void MenuBackend::defaults()
add(main_nobuffer); add(main_nobuffer);
if (lyxerr.debugging(Debug::GUI)) { if (lyxerr.debugging(Debug::GUI)) {
for(const_iterator cit = begin(); for (const_iterator cit = begin();
cit != end() ; ++cit) cit != end() ; ++cit)
lyxerr << "Menu name: " << cit->name() lyxerr << "Menu name: " << cit->name()
<< ", Menubar: " << cit->menubar() << ", Menubar: " << cit->menubar()

View File

@ -319,7 +319,7 @@ PainterBase & Painter::text(int x, int y, char const * s, size_t ls,
smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE); smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
char c; char c;
int tmpx = x; int tmpx = x;
for(size_t i = 0; i < ls; ++i) { for (size_t i = 0; i < ls; ++i) {
c = s[i]; c = s[i];
if (islower(static_cast<unsigned char>(c))) { if (islower(static_cast<unsigned char>(c))) {
c = toupper(c); c = toupper(c);
@ -359,7 +359,7 @@ PainterBase & Painter::text(int x, int y, XChar2b const * s, int ls,
smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE); smallfont.decSize().decSize().setShape(LyXFont::UP_SHAPE);
static XChar2b c = {0, 0}; static XChar2b c = {0, 0};
int tmpx = x; int tmpx = x;
for(int i = 0; i < ls; ++i) { for (int i = 0; i < ls; ++i) {
if (s[i].byte1 == 0 && islower(s[i].byte2)) { if (s[i].byte1 == 0 && islower(s[i].byte2)) {
c.byte2 = toupper(s[i].byte2); c.byte2 = toupper(s[i].byte2);
lyxfont::XSetFont(display, gc, smallfont); lyxfont::XSetFont(display, gc, smallfont);

View File

@ -28,7 +28,7 @@ char const * spacing_string[] = {"single", "onehalf", "double", "other"};
float Spacing::getValue() const float Spacing::getValue() const
{ {
switch(space) { switch (space) {
case Default: // nothing special should happen with this... case Default: // nothing special should happen with this...
case Single: return 1.0; case Single: return 1.0;
case Onehalf: return 1.25; case Onehalf: return 1.25;
@ -43,7 +43,7 @@ void Spacing::set(Spacing::Space sp, float val)
{ {
space = sp; space = sp;
if (sp == Other) { if (sp == Other) {
switch(int(val * 1000 + 0.5)) { switch (int(val * 1000 + 0.5)) {
case 1000: space = Single; break; case 1000: space = Single; break;
case 1250: space = Onehalf; break; case 1250: space = Onehalf; break;
case 1667: space = Double; break; case 1667: space = Double; break;
@ -81,7 +81,7 @@ void Spacing::writeFile(ostream & os, bool para) const
string const Spacing::writeEnvirBegin() const string const Spacing::writeEnvirBegin() const
{ {
switch(space) { switch (space) {
case Default: break; // do nothing case Default: break; // do nothing
case Single: case Single:
return "\\begin{singlespace}"; return "\\begin{singlespace}";
@ -103,7 +103,7 @@ string const Spacing::writeEnvirBegin() const
string const Spacing::writeEnvirEnd() const string const Spacing::writeEnvirEnd() const
{ {
switch(space) { switch (space) {
case Default: break; // do nothing case Default: break; // do nothing
case Single: case Single:
return "\\end{singlespace}"; return "\\end{singlespace}";

View File

@ -118,7 +118,7 @@ void ToolbarDefaults::read(LyXLex & lex)
while (lex.IsOK() && !quit) { while (lex.IsOK() && !quit) {
switch(lex.lex()) { switch (lex.lex()) {
case TO_ADD: case TO_ADD:
if (lex.next()) { if (lex.next()) {
func = lex.GetString(); func = lex.GetString();

View File

@ -298,7 +298,7 @@ void fl_set_bmtable_file(FL_OBJECT * ob, int nx, int ny, char const * filename)
unsigned int bw, bh; unsigned int bw, bh;
unsigned char * bdata; unsigned char * bdata;
if(XReadBitmapFileData(filename, &bw, &bh, if (XReadBitmapFileData(filename, &bw, &bh,
&bdata, &xh, &yh) == BitmapSuccess) &bdata, &xh, &yh) == BitmapSuccess)
fl_set_bmtable_data(ob, nx, ny, bw, bh, bdata); fl_set_bmtable_data(ob, nx, ny, bw, bh, bdata);
XFlush(fl_get_display()); XFlush(fl_get_display());

View File

@ -254,7 +254,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
bool has_token = false; bool has_token = false;
string pretoken; string pretoken;
if(!par) { if (!par) {
par = new LyXParagraph; par = new LyXParagraph;
} else { } else {
users->text->BreakParagraph(users); users->text->BreakParagraph(users);
@ -550,7 +550,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
if (tmpret != LYX_LAYOUT_DEFAULT) { if (tmpret != LYX_LAYOUT_DEFAULT) {
InsetQuotes::quote_language tmpl = InsetQuotes::quote_language tmpl =
InsetQuotes::EnglishQ; InsetQuotes::EnglishQ;
switch(tmpret) { switch (tmpret) {
case 0: case 0:
tmpl = InsetQuotes::EnglishQ; tmpl = InsetQuotes::EnglishQ;
break; break;
@ -574,7 +574,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
} }
} else if (token == "\\quotes_times") { } else if (token == "\\quotes_times") {
lex.nextToken(); lex.nextToken();
switch(lex.GetInteger()) { switch (lex.GetInteger()) {
case 1: case 1:
params.quotes_times = InsetQuotes::SingleQ; params.quotes_times = InsetQuotes::SingleQ;
break; break;
@ -641,7 +641,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
params.columns = lex.GetInteger(); params.columns = lex.GetInteger();
} else if (token == "\\papersides") { } else if (token == "\\papersides") {
lex.nextToken(); lex.nextToken();
switch(lex.GetInteger()) { switch (lex.GetInteger()) {
default: default:
case 1: params.sides = LyXTextClass::OneSide; break; case 1: params.sides = LyXTextClass::OneSide; break;
case 2: params.sides = LyXTextClass::TwoSides; break; case 2: params.sides = LyXTextClass::TwoSides; break;
@ -921,7 +921,7 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
"Inserting as text."); "Inserting as text.");
string::const_iterator cit = token.begin(); string::const_iterator cit = token.begin();
string::const_iterator end = token.end(); string::const_iterator end = token.end();
for(; cit != end; ++cit) { for (; cit != end; ++cit) {
par->InsertChar(pos, (*cit), font); par->InsertChar(pos, (*cit), font);
++pos; ++pos;
} }
@ -1389,10 +1389,10 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
for (i = 0, actpos = 1; i < par->size(); ++i, ++actpos) { for (i = 0, actpos = 1; i < par->size(); ++i, ++actpos) {
if (!i && !footnoteflag && !noparbreak){ if (!i && !footnoteflag && !noparbreak){
ofs << "\n\n"; ofs << "\n\n";
for(j = 0; j < depth; ++j) for (j = 0; j < depth; ++j)
ofs << " "; ofs << " ";
currlinelen = depth * 2; currlinelen = depth * 2;
switch(ltype) { switch (ltype) {
case 0: /* Standard */ case 0: /* Standard */
case 4: /* (Sub)Paragraph */ case 4: /* (Sub)Paragraph */
case 5: /* Description */ case 5: /* Description */
@ -1411,7 +1411,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
break; break;
} }
if (ltype_depth > depth) { if (ltype_depth > depth) {
for(j = ltype_depth - 1; j > depth; --j) for (j = ltype_depth - 1; j > depth; --j)
ofs << " "; ofs << " ";
currlinelen += (ltype_depth-depth)*2; currlinelen += (ltype_depth-depth)*2;
} }
@ -1439,11 +1439,11 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
break; break;
case LyXParagraph::META_NEWLINE: case LyXParagraph::META_NEWLINE:
ofs << "\n"; ofs << "\n";
for(j = 0; j < depth; ++j) for (j = 0; j < depth; ++j)
ofs << " "; ofs << " ";
currlinelen = depth * 2; currlinelen = depth * 2;
if (ltype_depth > depth) { if (ltype_depth > depth) {
for(j = ltype_depth; for (j = ltype_depth;
j > depth; --j) j > depth; --j)
ofs << " "; ofs << " ";
currlinelen += (ltype_depth - depth) * 2; currlinelen += (ltype_depth - depth) * 2;
@ -1459,11 +1459,11 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
if (currlinelen > linelen - 10 if (currlinelen > linelen - 10
&& c == ' ' && i + 2 < par->size()) { && c == ' ' && i + 2 < par->size()) {
ofs << "\n"; ofs << "\n";
for(j = 0; j < depth; ++j) for (j = 0; j < depth; ++j)
ofs << " "; ofs << " ";
currlinelen = depth * 2; currlinelen = depth * 2;
if (ltype_depth > depth) { if (ltype_depth > depth) {
for(j = ltype_depth; for (j = ltype_depth;
j > depth; --j) j > depth; --j)
ofs << " "; ofs << " ";
currlinelen += (ltype_depth-depth)*2; currlinelen += (ltype_depth-depth)*2;
@ -1597,10 +1597,10 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
if (!i && !footnoteflag && !noparbreak){ if (!i && !footnoteflag && !noparbreak){
if (linelen > 0) if (linelen > 0)
buffer << "\n\n"; buffer << "\n\n";
for(char j = 0; j < depth; ++j) for (char j = 0; j < depth; ++j)
buffer << " "; buffer << " ";
currlinelen = depth * 2; currlinelen = depth * 2;
switch(ltype) { switch (ltype) {
case 0: /* Standard */ case 0: /* Standard */
case 4: /* (Sub)Paragraph */ case 4: /* (Sub)Paragraph */
case 5: /* Description */ case 5: /* Description */
@ -1625,7 +1625,7 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
break; break;
} }
if (ltype_depth > depth) { if (ltype_depth > depth) {
for(char j = ltype_depth - 1; j > depth; --j) for (char j = ltype_depth - 1; j > depth; --j)
buffer << " "; buffer << " ";
currlinelen += (ltype_depth-depth)*2; currlinelen += (ltype_depth-depth)*2;
} }
@ -1659,12 +1659,12 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
case LyXParagraph::META_NEWLINE: case LyXParagraph::META_NEWLINE:
if (linelen > 0) { if (linelen > 0) {
buffer << "\n"; buffer << "\n";
for(char j = 0; j < depth; ++j) for (char j = 0; j < depth; ++j)
buffer << " "; buffer << " ";
} }
currlinelen = depth * 2; currlinelen = depth * 2;
if (ltype_depth > depth) { if (ltype_depth > depth) {
for(char j = ltype_depth; for (char j = ltype_depth;
j > depth; --j) j > depth; --j)
buffer << " "; buffer << " ";
currlinelen += (ltype_depth - depth) * 2; currlinelen += (ltype_depth - depth) * 2;
@ -1681,11 +1681,11 @@ string const Buffer::asciiParagraph(LyXParagraph const * par,
(c == ' ') && ((i + 2) < par->size())) (c == ' ') && ((i + 2) < par->size()))
{ {
buffer << "\n"; buffer << "\n";
for(char j = 0; j < depth; ++j) for (char j = 0; j < depth; ++j)
buffer << " "; buffer << " ";
currlinelen = depth * 2; currlinelen = depth * 2;
if (ltype_depth > depth) { if (ltype_depth > depth) {
for(char j = ltype_depth; for (char j = ltype_depth;
j > depth; --j) j > depth; --j)
buffer << " "; buffer << " ";
currlinelen += (ltype_depth-depth)*2; currlinelen += (ltype_depth-depth)*2;
@ -1856,7 +1856,7 @@ void Buffer::makeLaTeXFile(string const & fname,
features.UsedLanguages.insert(default_language); features.UsedLanguages.insert(default_language);
#ifdef DO_USE_DEFAULT_LANGUAGE #ifdef DO_USE_DEFAULT_LANGUAGE
if (params.language->lang() != "default" || if (params.language->lang() != "default" ||
!features.UsedLanguages.empty() ) { !features.UsedLanguages.empty()) {
#endif #endif
use_babel = true; use_babel = true;
for (LaTeXFeatures::LanguageList::const_iterator cit = for (LaTeXFeatures::LanguageList::const_iterator cit =
@ -2372,7 +2372,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
LaTeXFeatures features(params, tclass.numLayouts()); LaTeXFeatures features(params, tclass.numLayouts());
validate(features); validate(features);
//if(nice) //if (nice)
tex_code_break_column = lyxrc.ascii_linelen; tex_code_break_column = lyxrc.ascii_linelen;
//else //else
//tex_code_break_column = 0; //tex_code_break_column = 0;
@ -2389,7 +2389,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
<< params.preamble << sgml_includedfiles << " \n]>\n\n"; << params.preamble << sgml_includedfiles << " \n]>\n\n";
} }
if(params.options.empty()) if (params.options.empty())
sgmlOpenTag(ofs, 0, top_element); sgmlOpenTag(ofs, 0, top_element);
else { else {
string top = top_element; string top = top_element;
@ -2434,11 +2434,11 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
// write opening SGML tags // write opening SGML tags
switch (style.latextype) { switch (style.latextype) {
case LATEX_PARAGRAPH: case LATEX_PARAGRAPH:
if(depth == par->depth if (depth == par->depth
&& !environment_stack[depth].empty()) { && !environment_stack[depth].empty()) {
sgmlCloseTag(ofs, depth, environment_stack[depth]); sgmlCloseTag(ofs, depth, environment_stack[depth]);
environment_stack[depth].erase(); environment_stack[depth].erase();
if(depth) if (depth)
--depth; --depth;
else else
ofs << "</p>"; ofs << "</p>";
@ -2477,7 +2477,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
environment_stack[depth].erase(); environment_stack[depth].erase();
} }
if (environment_stack[depth] != style.latexname()) { if (environment_stack[depth] != style.latexname()) {
if(depth == 0) { if (depth == 0) {
string const temp = "p"; string const temp = "p";
sgmlOpenTag(ofs, depth, temp); sgmlOpenTag(ofs, depth, temp);
} }
@ -2485,11 +2485,11 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
sgmlOpenTag(ofs, depth, sgmlOpenTag(ofs, depth,
environment_stack[depth]); environment_stack[depth]);
} }
if(style.latextype == LATEX_ENVIRONMENT) break; if (style.latextype == LATEX_ENVIRONMENT) break;
desc_on = (style.labeltype == LABEL_MANUAL); desc_on = (style.labeltype == LABEL_MANUAL);
if(desc_on) if (desc_on)
item_name = "tag"; item_name = "tag";
else else
item_name = "item"; item_name = "item";
@ -2515,7 +2515,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
ofs << "\n"; ofs << "\n";
// write closing SGML tags // write closing SGML tags
switch(style.latextype) { switch (style.latextype) {
case LATEX_COMMAND: case LATEX_COMMAND:
case LATEX_ENVIRONMENT: case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT: case LATEX_ITEM_ENVIRONMENT:
@ -2527,10 +2527,10 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
} }
// Close open tags // Close open tags
for(; depth > 0; --depth) for (; depth > 0; --depth)
sgmlCloseTag(ofs, depth, environment_stack[depth]); sgmlCloseTag(ofs, depth, environment_stack[depth]);
if(!environment_stack[depth].empty()) if (!environment_stack[depth].empty())
sgmlCloseTag(ofs, depth, environment_stack[depth]); sgmlCloseTag(ofs, depth, environment_stack[depth]);
if (!body_only) { if (!body_only) {
@ -2579,7 +2579,7 @@ void Buffer::DocBookHandleCaption(ostream & os, string & inner_tag,
SimpleDocBookOnePar(os, extra_par, tpar, SimpleDocBookOnePar(os, extra_par, tpar,
desc_on, depth + 2); desc_on, depth + 2);
sgmlCloseTag(os, depth+1, inner_tag); sgmlCloseTag(os, depth+1, inner_tag);
if(!extra_par.empty()) if (!extra_par.empty())
os << extra_par; os << extra_par;
} }
} }
@ -2678,9 +2678,9 @@ void Buffer::DocBookHandleFootnote(ostream & os, LyXParagraph * & par,
par = par->next; par = par->next;
} }
os << tmp_par; os << tmp_par;
if(!inner_tag.empty()) sgmlCloseTag(os, depth + 1, inner_tag); if (!inner_tag.empty()) sgmlCloseTag(os, depth + 1, inner_tag);
if(!extra_par.empty()) os << extra_par; if (!extra_par.empty()) os << extra_par;
if(!tag.empty()) sgmlCloseTag(os, depth, tag); if (!tag.empty()) sgmlCloseTag(os, depth, tag);
} }
#endif #endif
@ -2797,7 +2797,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
LyXFont const font2 = par->getFont(params, i); LyXFont const font2 = par->getFont(params, i);
if (font1.family() != font2.family()) { if (font1.family() != font2.family()) {
switch(family_type) { switch (family_type) {
case 0: case 0:
if (font2.family() == LyXFont::TYPEWRITER_FAMILY) { if (font2.family() == LyXFont::TYPEWRITER_FAMILY) {
push_tag(os, "tt", stack_num, stack); push_tag(os, "tt", stack_num, stack);
@ -2841,7 +2841,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
// handle italic and slanted fonts // handle italic and slanted fonts
if (font1.shape() != font2.shape()) { if (font1.shape() != font2.shape()) {
switch(shape_type) { switch (shape_type) {
case 0: case 0:
if (font2.shape() == LyXFont::ITALIC_SHAPE) { if (font2.shape() == LyXFont::ITALIC_SHAPE) {
push_tag(os, "it", stack_num, stack); push_tag(os, "it", stack_num, stack);
@ -2931,7 +2931,7 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
} }
// resets description flag correctly // resets description flag correctly
switch(desc_on){ switch (desc_on){
case 1: case 1:
// <tag> not closed... // <tag> not closed...
linux_doc_line_break(os, char_line_count, 6); linux_doc_line_break(os, char_line_count, 6);
@ -2986,7 +2986,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
LaTeXFeatures features(params, tclass.numLayouts()); LaTeXFeatures features(params, tclass.numLayouts());
validate(features); validate(features);
//if(nice) //if (nice)
tex_code_break_column = lyxrc.ascii_linelen; tex_code_break_column = lyxrc.ascii_linelen;
//else //else
//tex_code_break_column = 0; //tex_code_break_column = 0;
@ -2999,7 +2999,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
texrow.reset(); texrow.reset();
if(!only_body) { if (!only_body) {
string sgml_includedfiles=features.getIncludedFiles(); string sgml_includedfiles=features.getIncludedFiles();
ofs << "<!doctype " << top_element ofs << "<!doctype " << top_element
@ -3011,7 +3011,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
ofs << "\n [ " << params.preamble ofs << "\n [ " << params.preamble
<< sgml_includedfiles << " \n]>\n\n"; << sgml_includedfiles << " \n]>\n\n";
if(params.options.empty()) if (params.options.empty())
sgmlOpenTag(ofs, 0, top_element); sgmlOpenTag(ofs, 0, top_element);
else { else {
string top = top_element; string top = top_element;
@ -3031,12 +3031,12 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
par->layout); par->layout);
// environment tag closing // environment tag closing
for( ; depth > par->depth; --depth) { for (; depth > par->depth; --depth) {
if(environment_inner[depth] != "!-- --") { if (environment_inner[depth] != "!-- --") {
item_name= "listitem"; item_name= "listitem";
sgmlCloseTag(ofs, command_depth + depth, sgmlCloseTag(ofs, command_depth + depth,
item_name); item_name);
if( environment_inner[depth] == "varlistentry") if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs, depth+command_depth, sgmlCloseTag(ofs, depth+command_depth,
environment_inner[depth]); environment_inner[depth]);
} }
@ -3046,14 +3046,14 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
environment_inner[depth].erase(); environment_inner[depth].erase();
} }
if(depth == par->depth if (depth == par->depth
&& environment_stack[depth] != style.latexname() && environment_stack[depth] != style.latexname()
&& !environment_stack[depth].empty()) { && !environment_stack[depth].empty()) {
if(environment_inner[depth] != "!-- --") { if (environment_inner[depth] != "!-- --") {
item_name= "listitem"; item_name= "listitem";
sgmlCloseTag(ofs, command_depth+depth, sgmlCloseTag(ofs, command_depth+depth,
item_name); item_name);
if( environment_inner[depth] == "varlistentry") if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs, sgmlCloseTag(ofs,
depth + command_depth, depth + command_depth,
environment_inner[depth]); environment_inner[depth]);
@ -3067,9 +3067,9 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
} }
// Write opening SGML tags. // Write opening SGML tags.
switch(style.latextype) { switch (style.latextype) {
case LATEX_PARAGRAPH: case LATEX_PARAGRAPH:
if(style.latexname() != "dummy") if (style.latexname() != "dummy")
sgmlOpenTag(ofs, depth+command_depth, sgmlOpenTag(ofs, depth+command_depth,
style.latexname()); style.latexname());
break; break;
@ -3087,18 +3087,18 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
cmd_depth= lyx::atoi(c_depth); cmd_depth= lyx::atoi(c_depth);
if(command_flag) { if (command_flag) {
if(cmd_depth<command_base) { if (cmd_depth<command_base) {
for(int j = command_depth; for (int j = command_depth;
j >= command_base; --j) j >= command_base; --j)
if(!command_stack[j].empty()) if (!command_stack[j].empty())
sgmlCloseTag(ofs, j, command_stack[j]); sgmlCloseTag(ofs, j, command_stack[j]);
command_depth= command_base= cmd_depth; command_depth= command_base= cmd_depth;
} else if(cmd_depth <= command_depth) { } else if (cmd_depth <= command_depth) {
for(int j = command_depth; for (int j = command_depth;
j >= cmd_depth; --j) j >= cmd_depth; --j)
if(!command_stack[j].empty()) if (!command_stack[j].empty())
sgmlCloseTag(ofs, j, command_stack[j]); sgmlCloseTag(ofs, j, command_stack[j]);
command_depth= cmd_depth; command_depth= cmd_depth;
} else } else
@ -3140,7 +3140,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
sgmlOpenTag(ofs, depth + command_depth, sgmlOpenTag(ofs, depth + command_depth,
environment_stack[depth]); environment_stack[depth]);
} else { } else {
if(environment_inner[depth] != "!-- --") { if (environment_inner[depth] != "!-- --") {
item_name= "listitem"; item_name= "listitem";
sgmlCloseTag(ofs, sgmlCloseTag(ofs,
command_depth + depth, command_depth + depth,
@ -3152,8 +3152,8 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
} }
} }
if(style.latextype == LATEX_ENVIRONMENT) { if (style.latextype == LATEX_ENVIRONMENT) {
if(!style.latexparam().empty()) if (!style.latexparam().empty())
sgmlOpenTag(ofs, depth + command_depth, sgmlOpenTag(ofs, depth + command_depth,
style.latexparam()); style.latexparam());
break; break;
@ -3161,7 +3161,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
desc_on = (style.labeltype == LABEL_MANUAL); desc_on = (style.labeltype == LABEL_MANUAL);
if(desc_on) if (desc_on)
environment_inner[depth]= "varlistentry"; environment_inner[depth]= "varlistentry";
else else
environment_inner[depth]= "listitem"; environment_inner[depth]= "listitem";
@ -3169,7 +3169,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
sgmlOpenTag(ofs, depth + 1 + command_depth, sgmlOpenTag(ofs, depth + 1 + command_depth,
environment_inner[depth]); environment_inner[depth]);
if(desc_on) { if (desc_on) {
item_name= "term"; item_name= "term";
sgmlOpenTag(ofs, depth + 1 + command_depth, sgmlOpenTag(ofs, depth + 1 + command_depth,
item_name); item_name);
@ -3200,23 +3200,23 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
#endif #endif
string end_tag; string end_tag;
// write closing SGML tags // write closing SGML tags
switch(style.latextype) { switch (style.latextype) {
case LATEX_COMMAND: case LATEX_COMMAND:
end_tag = "title"; end_tag = "title";
sgmlCloseTag(ofs, depth + command_depth, end_tag); sgmlCloseTag(ofs, depth + command_depth, end_tag);
break; break;
case LATEX_ENVIRONMENT: case LATEX_ENVIRONMENT:
if(!style.latexparam().empty()) if (!style.latexparam().empty())
sgmlCloseTag(ofs, depth + command_depth, sgmlCloseTag(ofs, depth + command_depth,
style.latexparam()); style.latexparam());
break; break;
case LATEX_ITEM_ENVIRONMENT: case LATEX_ITEM_ENVIRONMENT:
if(desc_on == 1) break; if (desc_on == 1) break;
end_tag= "para"; end_tag= "para";
sgmlCloseTag(ofs, depth + 1 + command_depth, end_tag); sgmlCloseTag(ofs, depth + 1 + command_depth, end_tag);
break; break;
case LATEX_PARAGRAPH: case LATEX_PARAGRAPH:
if(style.latexname() != "dummy") if (style.latexname() != "dummy")
sgmlCloseTag(ofs, depth + command_depth, sgmlCloseTag(ofs, depth + command_depth,
style.latexname()); style.latexname());
break; break;
@ -3228,13 +3228,13 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
} }
// Close open tags // Close open tags
for(; depth >= 0; --depth) { for (; depth >= 0; --depth) {
if(!environment_stack[depth].empty()) { if (!environment_stack[depth].empty()) {
if(environment_inner[depth] != "!-- --") { if (environment_inner[depth] != "!-- --") {
item_name= "listitem"; item_name= "listitem";
sgmlCloseTag(ofs, command_depth + depth, sgmlCloseTag(ofs, command_depth + depth,
item_name); item_name);
if( environment_inner[depth] == "varlistentry") if (environment_inner[depth] == "varlistentry")
sgmlCloseTag(ofs, depth + command_depth, sgmlCloseTag(ofs, depth + command_depth,
environment_inner[depth]); environment_inner[depth]);
} }
@ -3244,8 +3244,8 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
} }
} }
for(int j = command_depth; j >= command_base; --j) for (int j = command_depth; j >= command_base; --j)
if(!command_stack[j].empty()) if (!command_stack[j].empty())
sgmlCloseTag(ofs, j, command_stack[j]); sgmlCloseTag(ofs, j, command_stack[j]);
if (!only_body) { if (!only_body) {
@ -3277,7 +3277,7 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
LyXFont font1 = main_body > 0 ? style.labelfont : style.font; LyXFont font1 = main_body > 0 ? style.labelfont : style.font;
int char_line_count = depth; int char_line_count = depth;
if(!style.free_spacing) if (!style.free_spacing)
for (int j = 0; j < depth; ++j) for (int j = 0; j < depth; ++j)
os << ' '; os << ' ';
@ -3315,9 +3315,9 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
// and title should come first // and title should come first
// desc_on == 4 // desc_on == 4
// //
if(desc_on!= 3 || i!= 0) { if (desc_on!= 3 || i!= 0) {
if(!tmp_out.empty() && tmp_out[0] == '@') { if (!tmp_out.empty() && tmp_out[0] == '@') {
if(desc_on == 4) if (desc_on == 4)
extra += frontStrip(tmp_out, '@'); extra += frontStrip(tmp_out, '@');
else else
os << frontStrip(tmp_out, '@'); os << frontStrip(tmp_out, '@');
@ -3360,7 +3360,7 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
} }
// resets description flag correctly // resets description flag correctly
switch(desc_on){ switch (desc_on){
case 1: case 1:
// <term> not closed... // <term> not closed...
os << "</term>"; os << "</term>";
@ -3714,7 +3714,7 @@ void Buffer::resizeInsets(BufferView * bv)
{ {
/// then remove all LyXText in text-insets /// then remove all LyXText in text-insets
LyXParagraph * par = paragraph; LyXParagraph * par = paragraph;
for(; par; par = par->next) { for (; par; par = par->next) {
par->resizeInsetsLyXText(bv); par->resizeInsetsLyXText(bv);
} }
} }

View File

@ -109,7 +109,7 @@ bool BufferList::QwriteAll()
fname = MakeDisplayPath((*it)->fileName(), 50); fname = MakeDisplayPath((*it)->fileName(), 50);
bool reask = true; bool reask = true;
while(reask) { while(reask) {
switch(AskConfirmation(_("Changes in document:"), switch (AskConfirmation(_("Changes in document:"),
fname, fname,
_("Save document?"))) { _("Save document?"))) {
case 1: // Yes case 1: // Yes
@ -185,7 +185,7 @@ bool BufferList::close(Buffer * buf)
fname = MakeDisplayPath(buf->fileName(), 50); fname = MakeDisplayPath(buf->fileName(), 50);
bool reask = true; bool reask = true;
while (reask) { while (reask) {
switch(AskConfirmation(_("Changes in document:"), switch (AskConfirmation(_("Changes in document:"),
fname, fname,
_("Save document?"))){ _("Save document?"))){
case 1: // Yes case 1: // Yes
@ -291,50 +291,6 @@ void BufferList::emergencyWrite(Buffer * buf)
buf->isUnnamed() ? OnlyFilename(buf->fileName()).c_str() buf->isUnnamed() ? OnlyFilename(buf->fileName()).c_str()
: buf->fileName().c_str()) << endl; : buf->fileName().c_str()) << endl;
//if (buf->isUnnamed())
// lyxerr << OnlyFilename(buf->fileName());
//else
// lyxerr << buf->fileName();
//lyxerr << _(" as...") << endl;
// Let's unroll this loop (Lgb)
#if 0
bool madeit = false;
for (int i = 0; i < 3 && !madeit; ++i) {
string s;
// We try to save three places:
// 1) Same place as document.
// 2) In HOME directory.
// 3) In "/tmp" directory.
if (i == 0) {
if (buf->isUnnamed())
continue;
s = buf->fileName();
} else if (i == 1) {
s = AddName(GetEnvPath("HOME"), buf->fileName());
} else {
// MakeAbsPath to prepend the current
// drive letter on OS/2
s = AddName(MakeAbsPath("/tmp/"), buf->fileName());
}
s += ".emergency";
lyxerr << " " << i + 1 << ") " << s << endl;
if (buf->writeFile(s, true)) {
buf->markLyxClean();
lyxerr << _(" Save seems successful. Phew.") << endl;
madeit = true;
} else if (i != 2) {
lyxerr << _(" Save failed! Trying...") << endl;
} else {
lyxerr << _(" Save failed! Bummer. Document is lost.")
<< endl;
}
}
#else
// We try to save three places: // We try to save three places:
// 1) Same place as document. Unless it is an unnamed doc. // 1) Same place as document. Unless it is an unnamed doc.
@ -375,7 +331,6 @@ void BufferList::emergencyWrite(Buffer * buf)
return; return;
} }
lyxerr << _(" Save failed! Bummer. Document is lost.") << endl; lyxerr << _(" Save failed! Bummer. Document is lost.") << endl;
#endif
} }

View File

@ -57,7 +57,7 @@ BufferParams::BufferParams()
sides = LyXTextClass::OneSide; sides = LyXTextClass::OneSide;
columns = 1; columns = 1;
pagestyle = "default"; pagestyle = "default";
for(int iter = 0; iter < 4; ++iter) { for (int iter = 0; iter < 4; ++iter) {
user_defined_bullets[iter] = temp_bullets[iter] user_defined_bullets[iter] = temp_bullets[iter]
= ITEMIZE_DEFAULTS[iter]; = ITEMIZE_DEFAULTS[iter];
} }
@ -139,7 +139,7 @@ void BufferParams::writeFile(ostream & os) const
<< "\n\\defskip " << defskip.asLyXCommand() << "\n\\defskip " << defskip.asLyXCommand()
<< "\n\\quotes_language " << "\n\\quotes_language "
<< string_quotes_language[quotes_language] << '\n'; << string_quotes_language[quotes_language] << '\n';
switch(quotes_times) { switch (quotes_times) {
// An output operator for insetquotes would be nice // An output operator for insetquotes would be nice
case InsetQuotes::SingleQ: case InsetQuotes::SingleQ:
os << "\\quotes_times 1\n"; break; os << "\\quotes_times 1\n"; break;

View File

@ -160,7 +160,7 @@ void Combox::add(int x, int y, int w, int hmin, int hmax)
{ {
FL_OBJECT * obj; FL_OBJECT * obj;
switch(type) { switch (type) {
case FL_COMBOX_DROPLIST: case FL_COMBOX_DROPLIST:
{ {
button = obj = fl_add_button(FL_NORMAL_BUTTON, button = obj = fl_add_button(FL_NORMAL_BUTTON,

View File

@ -58,8 +58,8 @@ enum kb_action {
LFUN_ROMAN, LFUN_ROMAN,
LFUN_NOUN, LFUN_NOUN,
LFUN_RIGHT, LFUN_RIGHT,
LFUN_LEFT, LFUN_LEFT, // 40
LFUN_UP, // 40 LFUN_UP,
LFUN_DOWN, LFUN_DOWN,
LFUN_PRIOR, LFUN_PRIOR,
LFUN_NEXT, LFUN_NEXT,
@ -68,8 +68,8 @@ enum kb_action {
LFUN_TAB, LFUN_TAB,
LFUN_SHIFT_TAB, // Jug 20000522 LFUN_SHIFT_TAB, // Jug 20000522
LFUN_WORDRIGHT, LFUN_WORDRIGHT,
LFUN_WORDLEFT, LFUN_WORDLEFT, // 50
LFUN_BEGINNINGBUF, // 50 LFUN_BEGINNINGBUF,
LFUN_ENDBUF, LFUN_ENDBUF,
LFUN_RIGHTSEL, LFUN_RIGHTSEL,
LFUN_LEFTSEL, LFUN_LEFTSEL,
@ -78,8 +78,8 @@ enum kb_action {
LFUN_PRIORSEL, LFUN_PRIORSEL,
LFUN_NEXTSEL, LFUN_NEXTSEL,
LFUN_HOMESEL, LFUN_HOMESEL,
LFUN_ENDSEL, LFUN_ENDSEL, // 60
LFUN_WORDRIGHTSEL, // 60 LFUN_WORDRIGHTSEL,
LFUN_WORDLEFTSEL, LFUN_WORDLEFTSEL,
LFUN_BEGINNINGBUFSEL, LFUN_BEGINNINGBUFSEL,
LFUN_ENDBUFSEL, LFUN_ENDBUFSEL,
@ -88,8 +88,8 @@ enum kb_action {
LFUN_DELETE, LFUN_DELETE,
LFUN_BACKSPACE, LFUN_BACKSPACE,
LFUN_BREAKLINE, LFUN_BREAKLINE,
LFUN_BREAKPARAGRAPH, LFUN_BREAKPARAGRAPH, // 70
LFUN_BREAKPARAGRAPHKEEPLAYOUT, // 70 LFUN_BREAKPARAGRAPHKEEPLAYOUT,
LFUN_QUOTE, LFUN_QUOTE,
LFUN_CIRCUMFLEX, LFUN_CIRCUMFLEX,
LFUN_GRAVE, LFUN_GRAVE,
@ -98,8 +98,8 @@ enum kb_action {
LFUN_CEDILLA, LFUN_CEDILLA,
LFUN_MACRON, LFUN_MACRON,
LFUN_UNDERBAR, LFUN_UNDERBAR,
LFUN_UNDERDOT, LFUN_UNDERDOT, // 80
LFUN_CIRCLE, // 80 LFUN_CIRCLE,
LFUN_TIE, LFUN_TIE,
LFUN_BREVE, LFUN_BREVE,
LFUN_CARON, LFUN_CARON,
@ -108,8 +108,8 @@ enum kb_action {
LFUN_UMLAUT, LFUN_UMLAUT,
LFUN_DOT, LFUN_DOT,
LFUN_OGONEK, LFUN_OGONEK,
LFUN_VECTOR, // Alejandro 040696 LFUN_VECTOR, // Alejandro 040696 // 90
LFUN_SELFINSERT, // 90 LFUN_SELFINSERT,
LFUN_GETBUFNAME, LFUN_GETBUFNAME,
LFUN_GETXY, LFUN_GETXY,
LFUN_SETXY, LFUN_SETXY,
@ -118,8 +118,8 @@ enum kb_action {
LFUN_GETLAYOUT, LFUN_GETLAYOUT,
LFUN_GETFONT, LFUN_GETFONT,
LFUN_GETLATEX, LFUN_GETLATEX,
LFUN_GETNAME, LFUN_GETNAME, // 100
LFUN_NOTIFY, // 100 LFUN_NOTIFY,
LFUN_GOTOFILEROW, // Edmar 12/23/98 LFUN_GOTOFILEROW, // Edmar 12/23/98
LFUN_INSERT_NOTE, LFUN_INSERT_NOTE,
LFUN_KMAP_OFF, LFUN_KMAP_OFF,
@ -128,8 +128,8 @@ enum kb_action {
LFUN_KMAP_TOGGLE, LFUN_KMAP_TOGGLE,
LFUN_INSERT_MATH, LFUN_INSERT_MATH,
LFUN_INSERT_MATRIX, LFUN_INSERT_MATRIX,
LFUN_GREEK, LFUN_GREEK, // 110
LFUN_MATH_LIMITS, // 110 LFUN_MATH_LIMITS,
LFUN_GREEK_TOGGLE, LFUN_GREEK_TOGGLE,
LFUN_MATH_DELIM, // Alejandro 180696 LFUN_MATH_DELIM, // Alejandro 180696
LFUN_MATH_DISPLAY, // was INSERT_EQUATION Alejandro 180696 LFUN_MATH_DISPLAY, // was INSERT_EQUATION Alejandro 180696
@ -138,8 +138,8 @@ enum kb_action {
LFUN_MATH_NONUMBER, // Alejandro 180696 LFUN_MATH_NONUMBER, // Alejandro 180696
LFUN_MATH_SIZE, // Alejandro 150896 LFUN_MATH_SIZE, // Alejandro 150896
LFUN_MATH_MACRO, // ale970510 LFUN_MATH_MACRO, // ale970510
LFUN_MATH_MACROARG, // ale970510 LFUN_MATH_MACROARG, // ale970510 // 120
LFUN_MATH_PANEL, // 120 LFUN_MATH_PANEL,
LFUN_FIGURE, LFUN_FIGURE,
LFUN_MELT, LFUN_MELT,
LFUN_DELETE_WORD_FORWARD, LFUN_DELETE_WORD_FORWARD,
@ -148,8 +148,8 @@ enum kb_action {
LFUN_MARK_OFF, LFUN_MARK_OFF,
LFUN_MARK_ON, LFUN_MARK_ON,
LFUN_LAYOUT, LFUN_LAYOUT,
LFUN_LAYOUTNO, // Lgb 97-06-10 LFUN_LAYOUTNO, // Lgb 97-06-10 // 130
LFUN_LAYOUT_CHARACTER, // 130 LFUN_LAYOUT_CHARACTER,
LFUN_LAYOUT_PARAGRAPH, LFUN_LAYOUT_PARAGRAPH,
LFUN_LAYOUT_DOCUMENT, LFUN_LAYOUT_DOCUMENT,
LFUN_LAYOUT_PREAMBLE, LFUN_LAYOUT_PREAMBLE,
@ -158,8 +158,8 @@ enum kb_action {
LFUN_CODE, LFUN_CODE,
LFUN_SANS, LFUN_SANS,
LFUN_DEFAULT, LFUN_DEFAULT,
LFUN_UNDERLINE, LFUN_UNDERLINE, // 140
LFUN_FONT_SIZE, // 140 LFUN_FONT_SIZE,
LFUN_FONT_STATE, LFUN_FONT_STATE,
LFUN_UPCASE_WORD, LFUN_UPCASE_WORD,
LFUN_LOWCASE_WORD, LFUN_LOWCASE_WORD,
@ -168,8 +168,8 @@ enum kb_action {
LFUN_REF_INSERT, LFUN_REF_INSERT,
LFUN_PUSH_TOOLBAR, LFUN_PUSH_TOOLBAR,
LFUN_ADD_TO_TOOLBAR, LFUN_ADD_TO_TOOLBAR,
LFUN_DEPTH_MIN, // RVDK_PATCH_5 LFUN_DEPTH_MIN, // 150 // RVDK_PATCH_5
LFUN_DEPTH_PLUS, // 150 // RVDK_PATCH_5 LFUN_DEPTH_PLUS, // RVDK_PATCH_5
LFUN_MENU_OPEN_BY_NAME, // RVDK_PATCH_5 LFUN_MENU_OPEN_BY_NAME, // RVDK_PATCH_5
LFUN_SPELLCHECK, // RVDK_PATCH_5 LFUN_SPELLCHECK, // RVDK_PATCH_5
LFUN_CANCEL, // RVDK_PATCH_5 LFUN_CANCEL, // RVDK_PATCH_5
@ -178,8 +178,8 @@ enum kb_action {
LFUN_FILE_INSERT, LFUN_FILE_INSERT,
LFUN_FILE_INSERT_ASCII, // CFO-G 1997-11-19 LFUN_FILE_INSERT_ASCII, // CFO-G 1997-11-19
LFUN_FILE_NEW, LFUN_FILE_NEW,
LFUN_FILE_OPEN, LFUN_FILE_OPEN, // 160
LFUN_UP_PARAGRAPH, // 160 // Asger 1996-10-01 LFUN_UP_PARAGRAPH, // Asger 1996-10-01
LFUN_UP_PARAGRAPHSEL, // Asger 1996-10-01 LFUN_UP_PARAGRAPHSEL, // Asger 1996-10-01
LFUN_DOWN_PARAGRAPH, // Asger 1996-10-01 LFUN_DOWN_PARAGRAPH, // Asger 1996-10-01
LFUN_DOWN_PARAGRAPHSEL, // Asger 1996-10-01 LFUN_DOWN_PARAGRAPHSEL, // Asger 1996-10-01

View File

@ -70,7 +70,7 @@ protected: // methods
/** Filter the inputs on callback from xforms /** Filter the inputs on callback from xforms
Return true if inputs are valid. Return true if inputs are valid.
*/ */
virtual bool input( FL_OBJECT *, long ) { virtual bool input( FL_OBJECT *, long) {
return true; return true;
} }
/// Apply from dialog (modify or create inset) /// Apply from dialog (modify or create inset)

View File

@ -52,7 +52,7 @@ FormCitation::~FormCitation()
FL_FORM * FormCitation::form() const FL_FORM * FormCitation::form() const
{ {
if ( dialog_ ) return dialog_->form; if (dialog_ ) return dialog_->form;
return 0; return 0;
} }
@ -99,7 +99,7 @@ void FormCitation::update()
vector<pair<string,string> > blist = vector<pair<string,string> > blist =
lv_->buffer()->getBibkeyList(); lv_->buffer()->getBibkeyList();
for( unsigned int i = 0; i < blist.size(); ++i ) { for (unsigned int i = 0; i < blist.size(); ++i) {
bibkeys.push_back(blist[i].first); bibkeys.push_back(blist[i].first);
bibkeysInfo.push_back(blist[i].second); bibkeysInfo.push_back(blist[i].second);
} }
@ -108,7 +108,7 @@ void FormCitation::update()
citekeys.clear(); citekeys.clear();
string tmp, keys( params.getContents() ); string tmp, keys( params.getContents() );
keys = frontStrip( split(keys, tmp, ',') ); keys = frontStrip( split(keys, tmp, ',') );
while( !tmp.empty() ) { while (!tmp.empty()) {
citekeys.push_back( tmp ); citekeys.push_back( tmp );
keys = frontStrip( split(keys, tmp, ',') ); keys = frontStrip( split(keys, tmp, ',') );
} }
@ -140,7 +140,7 @@ void FormCitation::updateBrowser( FL_OBJECT * browser,
{ {
fl_clear_browser( browser ); fl_clear_browser( browser );
for( unsigned int i = 0; i < keys.size(); ++i ) for (unsigned int i = 0; i < keys.size(); ++i )
fl_add_browser_line( browser, keys[i].c_str()); fl_add_browser_line( browser, keys[i].c_str());
} }
@ -166,7 +166,7 @@ void FormCitation::setBibButtons( State status ) const
void FormCitation::setCiteButtons( State status ) const void FormCitation::setCiteButtons( State status ) const
{ {
switch( status ) { switch (status) {
case ON: case ON:
{ {
fl_activate_object( dialog_->delBtn ); fl_activate_object( dialog_->delBtn );
@ -174,7 +174,7 @@ void FormCitation::setCiteButtons( State status ) const
int sel = fl_get_browser( dialog_->citeBrsr ); int sel = fl_get_browser( dialog_->citeBrsr );
if ( sel != 1 ) { if (sel != 1) {
fl_activate_object( dialog_->upBtn ); fl_activate_object( dialog_->upBtn );
fl_set_object_lcol( dialog_->upBtn, FL_BLACK ); fl_set_object_lcol( dialog_->upBtn, FL_BLACK );
} else { } else {
@ -182,7 +182,7 @@ void FormCitation::setCiteButtons( State status ) const
fl_set_object_lcol( dialog_->upBtn, FL_INACTIVE ); fl_set_object_lcol( dialog_->upBtn, FL_INACTIVE );
} }
if ( sel != fl_get_browser_maxline(dialog_->citeBrsr)) { if (sel != fl_get_browser_maxline(dialog_->citeBrsr)) {
fl_activate_object( dialog_->downBtn ); fl_activate_object( dialog_->downBtn );
fl_set_object_lcol( dialog_->downBtn, FL_BLACK ); fl_set_object_lcol( dialog_->downBtn, FL_BLACK );
} else { } else {
@ -233,11 +233,11 @@ void FormCitation::setSize( int hbrsr, bool bibPresent ) const
static int const hok = dialog_->button_ok->h; static int const hok = dialog_->button_ok->h;
int hform = dh1 + hbrsr + dh1; int hform = dh1 + hbrsr + dh1;
if ( bibPresent ) hform += hinfo + dh1; if (bibPresent ) hform += hinfo + dh1;
if ( natbib ) hform += hstyle + dh1 + htext + dh2; if (natbib ) hform += hstyle + dh1 + htext + dh2;
hform += htext + dh1 + hok + dh2; hform += htext + dh1 + hok + dh2;
if ( hform != minh_ ) { if (hform != minh_) {
minh_ = hform; minh_ = hform;
fl_set_form_size( dialog_->form, minw_, minh_ ); fl_set_form_size( dialog_->form, minw_, minh_ );
} else } else
@ -264,7 +264,7 @@ void FormCitation::setSize( int hbrsr, bool bibPresent ) const
y = dh1 + hbrsr + dh1; // in position for next element y = dh1 + hbrsr + dh1; // in position for next element
if ( bibPresent ) { if (bibPresent) {
x = dialog_->infoBrsr->x; x = dialog_->infoBrsr->x;
fl_set_object_position( dialog_->infoBrsr, x, y ); fl_set_object_position( dialog_->infoBrsr, x, y );
fl_show_object( dialog_->infoBrsr ); fl_show_object( dialog_->infoBrsr );
@ -272,7 +272,7 @@ void FormCitation::setSize( int hbrsr, bool bibPresent ) const
} else } else
fl_hide_object( dialog_->infoBrsr ); fl_hide_object( dialog_->infoBrsr );
if ( natbib ) { if (natbib) {
x = dialog_->style->x; x = dialog_->style->x;
fl_set_object_position( dialog_->style, x, y ); fl_set_object_position( dialog_->style, x, y );
fl_show_object( dialog_->style ); fl_show_object( dialog_->style );
@ -309,13 +309,13 @@ bool FormCitation::input( FL_OBJECT *, long data )
bool activate = false; bool activate = false;
State cb = static_cast<State>( data ); State cb = static_cast<State>( data );
switch( cb ) { switch (cb) {
case BIBBRSR: case BIBBRSR:
{ {
fl_deselect_browser( dialog_->citeBrsr ); fl_deselect_browser( dialog_->citeBrsr );
unsigned int sel = fl_get_browser( dialog_->bibBrsr ); unsigned int sel = fl_get_browser( dialog_->bibBrsr );
if ( sel < 1 || sel > bibkeys.size() ) break; if (sel < 1 || sel > bibkeys.size() ) break;
// Put into infoBrsr the additional info associated with // Put into infoBrsr the additional info associated with
// the selected bibBrsr key // the selected bibBrsr key
@ -327,14 +327,14 @@ bool FormCitation::input( FL_OBJECT *, long data )
vector<string>::iterator it = vector<string>::iterator it =
find( citekeys.begin(), citekeys.end(), bibkeys[sel-1] ); find( citekeys.begin(), citekeys.end(), bibkeys[sel-1] );
if ( it != citekeys.end() ) { if (it != citekeys.end()) {
int n = static_cast<int>( it - citekeys.begin() ); int n = static_cast<int>( it - citekeys.begin() );
fl_select_browser_line( dialog_->citeBrsr, n+1 ); fl_select_browser_line( dialog_->citeBrsr, n+1 );
fl_set_browser_topline( dialog_->citeBrsr, n+1 ); fl_set_browser_topline( dialog_->citeBrsr, n+1 );
} }
if ( !lv_->buffer()->isReadonly() ) { if (!lv_->buffer()->isReadonly()) {
if ( it != citekeys.end() ) { if (it != citekeys.end()) {
setBibButtons( OFF ); setBibButtons( OFF );
setCiteButtons( ON ); setCiteButtons( ON );
} else { } else {
@ -347,9 +347,9 @@ bool FormCitation::input( FL_OBJECT *, long data )
case CITEBRSR: case CITEBRSR:
{ {
unsigned int sel = fl_get_browser( dialog_->citeBrsr ); unsigned int sel = fl_get_browser( dialog_->citeBrsr );
if ( sel < 1 || sel > citekeys.size() ) break; if (sel < 1 || sel > citekeys.size() ) break;
if ( !lv_->buffer()->isReadonly() ) { if (!lv_->buffer()->isReadonly()) {
setBibButtons( OFF ); setBibButtons( OFF );
setCiteButtons( ON ); setCiteButtons( ON );
} }
@ -373,10 +373,10 @@ bool FormCitation::input( FL_OBJECT *, long data )
break; break;
case ADD: case ADD:
{ {
if ( lv_->buffer()->isReadonly() ) break; if (lv_->buffer()->isReadonly() ) break;
unsigned int sel = fl_get_browser( dialog_->bibBrsr ); unsigned int sel = fl_get_browser( dialog_->bibBrsr );
if ( sel < 1 || sel > bibkeys.size() ) break; if (sel < 1 || sel > bibkeys.size() ) break;
// Add the selected bibBrsr key to citeBrsr // Add the selected bibBrsr key to citeBrsr
fl_addto_browser( dialog_->citeBrsr, fl_addto_browser( dialog_->citeBrsr,
@ -393,10 +393,10 @@ bool FormCitation::input( FL_OBJECT *, long data )
break; break;
case DELETE: case DELETE:
{ {
if ( lv_->buffer()->isReadonly() ) break; if (lv_->buffer()->isReadonly() ) break;
unsigned int sel = fl_get_browser( dialog_->citeBrsr ); unsigned int sel = fl_get_browser( dialog_->citeBrsr );
if ( sel < 1 || sel > citekeys.size() ) break; if (sel < 1 || sel > citekeys.size() ) break;
// Remove the selected key from citeBrsr // Remove the selected key from citeBrsr
fl_delete_browser_line( dialog_->citeBrsr, sel ) ; fl_delete_browser_line( dialog_->citeBrsr, sel ) ;
@ -409,10 +409,10 @@ bool FormCitation::input( FL_OBJECT *, long data )
break; break;
case UP: case UP:
{ {
if ( lv_->buffer()->isReadonly() ) break; if (lv_->buffer()->isReadonly() ) break;
unsigned int sel = fl_get_browser( dialog_->citeBrsr ); unsigned int sel = fl_get_browser( dialog_->citeBrsr );
if ( sel < 2 || sel > citekeys.size() ) break; if (sel < 2 || sel > citekeys.size() ) break;
// Move the selected key up one line // Move the selected key up one line
vector<string>::iterator it = citekeys.begin() + sel-1; vector<string>::iterator it = citekeys.begin() + sel-1;
@ -430,10 +430,10 @@ bool FormCitation::input( FL_OBJECT *, long data )
break; break;
case DOWN: case DOWN:
{ {
if ( lv_->buffer()->isReadonly() ) break; if (lv_->buffer()->isReadonly() ) break;
unsigned int sel = fl_get_browser( dialog_->citeBrsr ); unsigned int sel = fl_get_browser( dialog_->citeBrsr );
if ( sel < 1 || sel > citekeys.size()-1 ) break; if (sel < 1 || sel > citekeys.size()-1 ) break;
// Move the selected key down one line // Move the selected key down one line
vector<string>::iterator it = citekeys.begin() + sel-1; vector<string>::iterator it = citekeys.begin() + sel-1;
@ -461,7 +461,7 @@ void FormCitation::apply()
if (lv_->buffer()->isReadonly()) return; if (lv_->buffer()->isReadonly()) return;
string contents; string contents;
for(unsigned int i = 0; i < citekeys.size(); ++i) { for (unsigned int i = 0; i < citekeys.size(); ++i) {
if (i > 0) contents += ", "; if (i > 0) contents += ", ";
contents += citekeys[i]; contents += citekeys[i];
} }

View File

@ -34,7 +34,7 @@ FormCopyright::~FormCopyright()
FL_FORM * FormCopyright::form() const FL_FORM * FormCopyright::form() const
{ {
if ( dialog_ ) return dialog_->form; if (dialog_ ) return dialog_->form;
return 0; return 0;
} }

View File

@ -209,7 +209,7 @@ void FormDocument::build()
#ifdef DO_USE_DEFAULT_LANGUAGE #ifdef DO_USE_DEFAULT_LANGUAGE
combo_language->addto("default"); combo_language->addto("default");
#endif #endif
for(Languages::const_iterator cit = languages.begin(); for (Languages::const_iterator cit = languages.begin();
cit != languages.end(); ++cit) { cit != languages.end(); ++cit) {
combo_language->addto((*cit).second.lang()); combo_language->addto((*cit).second.lang());
} }
@ -324,7 +324,7 @@ bool FormDocument::input( FL_OBJECT * ob, long data )
{ {
State cb = static_cast<State>( data ); State cb = static_cast<State>( data );
switch( cb ) { switch (cb) {
case CHECKCHOICECLASS: case CHECKCHOICECLASS:
CheckChoiceClass(ob, 0); CheckChoiceClass(ob, 0);
break; break;
@ -355,7 +355,7 @@ bool FormDocument::input( FL_OBJECT * ob, long data )
break; break;
} }
switch( data ) { switch (data) {
case INPUT: case INPUT:
case CHECKCHOICECLASS: case CHECKCHOICECLASS:
case CHOICEBULLETSIZE: case CHOICEBULLETSIZE:
@ -476,7 +476,7 @@ bool FormDocument::class_apply()
params.sides = LyXTextClass::OneSide; params.sides = LyXTextClass::OneSide;
Spacing tmpSpacing = params.spacing; Spacing tmpSpacing = params.spacing;
switch(fl_get_choice(class_->choice_doc_spacing)) { switch (fl_get_choice(class_->choice_doc_spacing)) {
case 1: case 1:
lyxerr[Debug::INFO] << "Spacing: SINGLE\n"; lyxerr[Debug::INFO] << "Spacing: SINGLE\n";
params.spacing.set(Spacing::Single); params.spacing.set(Spacing::Single);
@ -536,7 +536,7 @@ bool FormDocument::language_apply()
InsetQuotes::quote_language lga = InsetQuotes::EnglishQ; InsetQuotes::quote_language lga = InsetQuotes::EnglishQ;
bool redo = false; bool redo = false;
switch(fl_get_choice(language_->choice_quotes_language) - 1) { switch (fl_get_choice(language_->choice_quotes_language) - 1) {
case 0: case 0:
lga = InsetQuotes::EnglishQ; lga = InsetQuotes::EnglishQ;
break; break;
@ -952,13 +952,13 @@ void FormDocument::BulletDepth(FL_OBJECT * ob, State cb)
BufferParams & param = lv_->buffer()->params; BufferParams & param = lv_->buffer()->params;
int data = 0; int data = 0;
if( cb == BULLETDEPTH1 ) if (cb == BULLETDEPTH1 )
data = 0; data = 0;
else if ( cb == BULLETDEPTH2 ) else if (cb == BULLETDEPTH2 )
data = 1; data = 1;
else if ( cb == BULLETDEPTH3 ) else if (cb == BULLETDEPTH3 )
data = 2; data = 2;
else if ( cb == BULLETDEPTH4 ) else if (cb == BULLETDEPTH4 )
data = 3; data = 3;
switch (fl_get_button_numb(ob)) { switch (fl_get_button_numb(ob)) {
@ -981,17 +981,17 @@ void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, State cb)
/* by the user. (eg. standard.xpm, psnfss1.xpm etc...) */ /* by the user. (eg. standard.xpm, psnfss1.xpm etc...) */
int data = 0; int data = 0;
if( cb == BULLETPANEL1 ) if (cb == BULLETPANEL1 )
data = 0; data = 0;
else if ( cb == BULLETPANEL2 ) else if (cb == BULLETPANEL2 )
data = 1; data = 1;
else if ( cb == BULLETPANEL3 ) else if (cb == BULLETPANEL3 )
data = 2; data = 2;
else if ( cb == BULLETPANEL4 ) else if (cb == BULLETPANEL4 )
data = 3; data = 3;
else if ( cb == BULLETPANEL5 ) else if (cb == BULLETPANEL5 )
data = 4; data = 4;
else if ( cb == BULLETPANEL6 ) else if (cb == BULLETPANEL6 )
data = 5; data = 5;
if (data != current_bullet_panel) { if (data != current_bullet_panel) {

View File

@ -39,7 +39,7 @@ FormError::~FormError()
FL_FORM * FormError::form() const FL_FORM * FormError::form() const
{ {
if ( dialog_ ) return dialog_->form; if (dialog_ ) return dialog_->form;
return 0; return 0;
} }

View File

@ -147,7 +147,7 @@ void FormGraphics::build()
FL_FORM * FormGraphics::form() const FL_FORM * FormGraphics::form() const
{ {
if ( dialog_ ) return dialog_->form; if (dialog_ ) return dialog_->form;
return 0; return 0;
} }
@ -279,7 +279,7 @@ bool FormGraphics::input(FL_OBJECT *, long data )
bool inputOK = true; bool inputOK = true;
switch( cb ) { switch (cb) {
case CHECKINPUT: case CHECKINPUT:
inputOK = checkInput(); inputOK = checkInput();
break; break;

View File

@ -44,7 +44,7 @@ FormIndex::~FormIndex()
FL_FORM * FormIndex::form() const FL_FORM * FormIndex::form() const
{ {
if ( dialog_ ) return dialog_->form; if (dialog_ ) return dialog_->form;
return 0; return 0;
} }
@ -73,7 +73,7 @@ void FormIndex::update()
{ {
fl_set_input(dialog_->key, params.getContents().c_str()); fl_set_input(dialog_->key, params.getContents().c_str());
if ( lv_->buffer()->isReadonly() ) { if (lv_->buffer()->isReadonly()) {
fl_deactivate_object( dialog_->key ); fl_deactivate_object( dialog_->key );
fl_deactivate_object( dialog_->ok ); fl_deactivate_object( dialog_->ok );
fl_set_object_lcol( dialog_->ok, FL_INACTIVE ); fl_set_object_lcol( dialog_->ok, FL_INACTIVE );

View File

@ -469,7 +469,7 @@ void FormParagraph::extra_update()
par->pextra_width.c_str()); par->pextra_width.c_str());
fl_set_input(extra_->input_pextra_widthp, fl_set_input(extra_->input_pextra_widthp,
par->pextra_widthp.c_str()); par->pextra_widthp.c_str());
switch(par->pextra_alignment) { switch (par->pextra_alignment) {
case LyXParagraph::MINIPAGE_ALIGN_TOP: case LyXParagraph::MINIPAGE_ALIGN_TOP:
fl_set_button(extra_->radio_pextra_top, 1); fl_set_button(extra_->radio_pextra_top, 1);
break; break;

File diff suppressed because it is too large Load Diff

View File

@ -64,10 +64,6 @@ public:
int b; int b;
RGB() : r(0), g(0), b(0) {} RGB() : r(0), g(0), b(0) {}
RGB(int red, int green, int blue) : r(red), g(green), b(blue) {} RGB(int red, int green, int blue) : r(red), g(green), b(blue) {}
bool operator==(RGB const & o) const
{ return( r == o.r && g == o.g && b == o.b ); }
bool operator!=(RGB const & o) const
{ return( r != o.r || g != o.g || b != o.b ); }
}; };
private: private:
@ -148,29 +144,29 @@ private:
*/ */
/// ///
string feedbackColours(FL_OBJECT const * const) const; string const feedbackColours(FL_OBJECT const * const) const;
/// ///
string feedbackConverters(FL_OBJECT const * const) const; string const feedbackConverters(FL_OBJECT const * const) const;
/// ///
string feedbackFormats( FL_OBJECT const * const ) const; string const feedbackFormats( FL_OBJECT const * const ) const;
/// ///
string feedbackInputsMisc(FL_OBJECT const * const) const; string const feedbackInputsMisc(FL_OBJECT const * const) const;
/// ///
string feedbackInterface(FL_OBJECT const * const) const; string const feedbackInterface(FL_OBJECT const * const) const;
/// ///
string feedbackLanguage(FL_OBJECT const * const) const; string const feedbackLanguage(FL_OBJECT const * const) const;
/// ///
string feedbackLnFmisc(FL_OBJECT const * const) const; string const feedbackLnFmisc(FL_OBJECT const * const) const;
/// ///
string feedbackOutputsMisc(FL_OBJECT const * const) const; string const feedbackOutputsMisc(FL_OBJECT const * const) const;
/// ///
string feedbackPaths(FL_OBJECT const * const) const; string const feedbackPaths(FL_OBJECT const * const) const;
/// ///
string feedbackPrinter(FL_OBJECT const * const) const; string const feedbackPrinter(FL_OBJECT const * const) const;
/// ///
string feedbackScreenFonts(FL_OBJECT const * const) const; string const feedbackScreenFonts(FL_OBJECT const * const) const;
/// ///
string feedbackSpellChecker(FL_OBJECT const * const) const; string const feedbackSpellChecker(FL_OBJECT const * const) const;
/** Folder specific input functions. Not all folders require one. /** Folder specific input functions. Not all folders require one.
*/ */
@ -282,10 +278,10 @@ private:
/// Spellchecker, language stuff, etc /// Spellchecker, language stuff, etc
FD_form_outer_tab * usage_tab_; FD_form_outer_tab * usage_tab_;
/// ///
FD_form_converters * converters_;
///
FD_form_colours * colours_; FD_form_colours * colours_;
/// ///
FD_form_converters * converters_;
///
FD_form_formats * formats_; FD_form_formats * formats_;
/// ///
FD_form_inputs_misc * inputs_misc_; FD_form_inputs_misc * inputs_misc_;
@ -315,4 +311,20 @@ private:
FL_OBJECT * feedbackObj; FL_OBJECT * feedbackObj;
}; };
inline
bool operator==(FormPreferences::RGB const & c1,
FormPreferences::RGB const & c2)
{
return (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b);
}
inline
bool operator!=(FormPreferences::RGB const & c1,
FormPreferences::RGB const & c2)
{
return !(c1 == c2);
}
#endif #endif

View File

@ -52,7 +52,7 @@ FormRef::~FormRef()
FL_FORM * FormRef::form() const FL_FORM * FormRef::form() const
{ {
if ( dialog_ ) return dialog_->form; if (dialog_ ) return dialog_->form;
return 0; return 0;
} }
@ -84,7 +84,7 @@ void FormRef::build()
minw_sb = minw_; minw_sb = minw_;
// Name is irrelevant to LaTeX documents // Name is irrelevant to LaTeX documents
if ( lv_->buffer()->isLatex() ) { if (lv_->buffer()->isLatex()) {
fl_deactivate_object( dialog_->name ); fl_deactivate_object( dialog_->name );
fl_set_object_lcol( dialog_->name, FL_INACTIVE ); fl_set_object_lcol( dialog_->name, FL_INACTIVE );
} }
@ -111,7 +111,7 @@ void FormRef::update()
fl_set_object_label(dialog_->button_go, _("Goto reference")); fl_set_object_label(dialog_->button_go, _("Goto reference"));
refs.clear(); refs.clear();
if ( inset_ == 0 ) { if (inset_ == 0) {
refs = lv_->buffer()->getLabelList(); refs = lv_->buffer()->getLabelList();
updateBrowser( refs ); updateBrowser( refs );
showBrowser(); showBrowser();
@ -124,15 +124,15 @@ void FormRef::update()
void FormRef::updateBrowser( vector<string> keys ) const void FormRef::updateBrowser( vector<string> keys ) const
{ {
if ( fl_get_button( dialog_->sort ) ) if (fl_get_button( dialog_->sort ) )
sort( keys.begin(), keys.end() ); sort( keys.begin(), keys.end() );
fl_clear_browser( dialog_->browser ); fl_clear_browser( dialog_->browser );
for( vector<string>::const_iterator it = keys.begin(); for (vector<string>::const_iterator it = keys.begin();
it != keys.end(); ++it ) it != keys.end(); ++it )
fl_add_browser_line( dialog_->browser, (*it).c_str()); fl_add_browser_line( dialog_->browser, (*it).c_str());
if ( keys.empty() ) { if (keys.empty()) {
fl_add_browser_line( dialog_->browser, fl_add_browser_line( dialog_->browser,
_("*** No labels found in document ***")); _("*** No labels found in document ***"));
@ -203,7 +203,7 @@ void FormRef::setSize( int w, int dx ) const
static int x6 = dialog_->button_cancel->x; static int x6 = dialog_->button_cancel->x;
static int y6 = dialog_->button_cancel->y; static int y6 = dialog_->button_cancel->y;
if ( form()->w != w ) { if (form()->w != w) {
minw_ = w; minw_ = w;
fl_set_form_size( form(), minw_, minh_ ); fl_set_form_size( form(), minw_, minh_ );
} else } else
@ -218,7 +218,7 @@ void FormRef::setSize( int w, int dx ) const
// These two must be reset apparently // These two must be reset apparently
// Name is irrelevant to LaTeX documents // Name is irrelevant to LaTeX documents
if ( lv_->buffer()->isLatex() ) { if (lv_->buffer()->isLatex()) {
fl_deactivate_object( dialog_->name ); fl_deactivate_object( dialog_->name );
fl_set_object_lcol( dialog_->name, FL_INACTIVE ); fl_set_object_lcol( dialog_->name, FL_INACTIVE );
} }
@ -259,12 +259,12 @@ void FormRef::apply()
bool FormRef::input( FL_OBJECT *, long data ) bool FormRef::input( FL_OBJECT *, long data )
{ {
bool activate( true ); bool activate( true );
switch( data ) { switch (data) {
// goto reference / go back // goto reference / go back
case 1: case 1:
{ {
toggle = static_cast<Goto>(toggle + 1); toggle = static_cast<Goto>(toggle + 1);
if ( toggle == GOFIRST ) toggle = GOREF; if (toggle == GOFIRST ) toggle = GOREF;
switch (toggle) { switch (toggle) {
case GOREF: case GOREF:
@ -294,7 +294,7 @@ bool FormRef::input( FL_OBJECT *, long data )
case 2: case 2:
{ {
unsigned int sel = fl_get_browser( dialog_->browser ); unsigned int sel = fl_get_browser( dialog_->browser );
if ( sel < 1 || sel > refs.size() ) break; if (sel < 1 || sel > refs.size() ) break;
string s = fl_get_browser_line( dialog_->browser, sel ); string s = fl_get_browser_line( dialog_->browser, sel );
fl_set_input( dialog_->ref, s.c_str()); fl_set_input( dialog_->ref, s.c_str());
@ -326,8 +326,8 @@ bool FormRef::input( FL_OBJECT *, long data )
{ {
Type type = static_cast<Type>( Type type = static_cast<Type>(
fl_get_choice(dialog_->type) - 1 ); fl_get_choice(dialog_->type) - 1 );
if ( params.getCmdName() == getName( type ) if (params.getCmdName() == getName( type )
&& inset_ ) { && inset_) {
activate = false; activate = false;
} }
} }
@ -344,16 +344,16 @@ FormRef::Type FormRef::getType() const
{ {
Type type; Type type;
if ( params.getCmdName() == "ref" ) if (params.getCmdName() == "ref" )
type = REF; type = REF;
else if ( params.getCmdName() == "pageref" ) else if (params.getCmdName() == "pageref" )
type = PAGEREF; type = PAGEREF;
else if ( params.getCmdName() == "vref" ) else if (params.getCmdName() == "vref" )
type = VREF; type = VREF;
else if ( params.getCmdName() == "vpageref" ) else if (params.getCmdName() == "vpageref" )
type = VPAGEREF; type = VPAGEREF;
else else
@ -367,7 +367,7 @@ string FormRef::getName( Type type ) const
{ {
string name; string name;
switch( type ) { switch (type) {
case REF: case REF:
name = "ref"; name = "ref";
break; break;

View File

@ -48,7 +48,7 @@ FormTabular::~FormTabular()
FL_FORM * FormTabular::form() const FL_FORM * FormTabular::form() const
{ {
if ( dialog_ ) return dialog_->form; if (dialog_ ) return dialog_->form;
return 0; return 0;
} }

View File

@ -44,7 +44,7 @@ FormTabularCreate::~FormTabularCreate()
FL_FORM * FormTabularCreate::form() const FL_FORM * FormTabularCreate::form() const
{ {
if ( dialog_ ) return dialog_->form; if (dialog_ ) return dialog_->form;
return 0; return 0;
} }

View File

@ -51,7 +51,7 @@ FormToc::~FormToc()
FL_FORM * FormToc::form() const FL_FORM * FormToc::form() const
{ {
if ( dialog_ ) return dialog_->form; if (dialog_ ) return dialog_->form;
return 0; return 0;
} }
@ -82,13 +82,13 @@ void FormToc::update()
{ {
Buffer::TocType type; Buffer::TocType type;
if ( params.getCmdName() == "tableofcontents" ) if (params.getCmdName() == "tableofcontents" )
type = Buffer::TOC_TOC; type = Buffer::TOC_TOC;
else if ( params.getCmdName() == "listofalgorithms" ) else if (params.getCmdName() == "listofalgorithms" )
type = Buffer::TOC_LOA; type = Buffer::TOC_LOA;
else if ( params.getCmdName() == "listoffigures" ) else if (params.getCmdName() == "listoffigures" )
type = Buffer::TOC_LOF; type = Buffer::TOC_LOF;
else else

View File

@ -44,7 +44,7 @@ FormUrl::~FormUrl()
FL_FORM * FormUrl::form() const FL_FORM * FormUrl::form() const
{ {
if ( dialog_ ) return dialog_->form; if (dialog_ ) return dialog_->form;
return 0; return 0;
} }
@ -74,12 +74,12 @@ void FormUrl::update()
fl_set_input(dialog_->url, params.getContents().c_str()); fl_set_input(dialog_->url, params.getContents().c_str());
fl_set_input(dialog_->name, params.getOptions().c_str()); fl_set_input(dialog_->name, params.getOptions().c_str());
if ( params.getCmdName() == "url" ) if (params.getCmdName() == "url" )
fl_set_button(dialog_->radio_html, 0); fl_set_button(dialog_->radio_html, 0);
else else
fl_set_button(dialog_->radio_html, 1); fl_set_button(dialog_->radio_html, 1);
if ( lv_->buffer()->isReadonly() ) { if (lv_->buffer()->isReadonly()) {
fl_deactivate_object( dialog_->url ); fl_deactivate_object( dialog_->url );
fl_deactivate_object( dialog_->name ); fl_deactivate_object( dialog_->name );
fl_deactivate_object( dialog_->radio_html ); fl_deactivate_object( dialog_->radio_html );

View File

@ -64,7 +64,7 @@ int string_width(string const & str)
Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mb) Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mb)
: owner_(view), menubackend_(&mb), current_group_(0) : owner_(view), menubackend_(&mb), current_group_(0)
{ {
for(MenuBackend::const_iterator menu = menubackend_->begin(); for (MenuBackend::const_iterator menu = menubackend_->begin();
menu != menubackend_->end() ; ++menu) { menu != menubackend_->end() ; ++menu) {
if (menu->menubar()) { if (menu->menubar()) {
FL_OBJECT * group = fl_bgn_group(); FL_OBJECT * group = fl_bgn_group();
@ -169,7 +169,7 @@ void Menubar::Pimpl::set(string const & menu_name)
void Menubar::Pimpl::openByName(string const & name) void Menubar::Pimpl::openByName(string const & name)
{ {
for(ButtonList::const_iterator cit = buttonlist_.begin(); for (ButtonList::const_iterator cit = buttonlist_.begin();
cit != buttonlist_.end(); ++cit) { cit != buttonlist_.end(); ++cit) {
if ((*cit)->item_->submenu() == name) { if ((*cit)->item_->submenu() == name) {
MenuCallback((*cit)->obj_, 1); MenuCallback((*cit)->obj_, 1);
@ -510,7 +510,7 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
MenuItem const & item = (*i); MenuItem const & item = (*i);
string & extra_label = *it; string & extra_label = *it;
switch(item.kind()) { switch (item.kind()) {
case MenuItem::Command: { case MenuItem::Command: {
LyXFunc::func_status flag = LyXFunc::func_status flag =
view->getLyXFunc()->getStatus(item.action()); view->getLyXFunc()->getStatus(item.action());

View File

@ -120,13 +120,13 @@ int BubblePost(FL_OBJECT *ob, int event,
FL_OBJECT * bubble_timer = reinterpret_cast<FL_OBJECT *>(ob->u_cdata); FL_OBJECT * bubble_timer = reinterpret_cast<FL_OBJECT *>(ob->u_cdata);
// We do not test for empty help here, since this can never happen // We do not test for empty help here, since this can never happen
if(event == FL_ENTER){ if (event == FL_ENTER){
fl_set_object_callback(bubble_timer, fl_set_object_callback(bubble_timer,
C_Toolbar_BubbleTimerCB, C_Toolbar_BubbleTimerCB,
reinterpret_cast<long>(ob)); reinterpret_cast<long>(ob));
fl_set_timer(bubble_timer, 1); fl_set_timer(bubble_timer, 1);
} }
else if(event != FL_MOTION){ else if (event != FL_MOTION){
fl_set_timer(bubble_timer, 0); fl_set_timer(bubble_timer, 0);
fl_hide_oneliner(); fl_hide_oneliner();
} }
@ -252,7 +252,7 @@ void ToolbarCB(FL_OBJECT * ob, long ac)
LyXView * owner = static_cast<LyXView *>(ob->u_vdata); LyXView * owner = static_cast<LyXView *>(ob->u_vdata);
string res = owner->getLyXFunc()->Dispatch(int(ac)); string res = owner->getLyXFunc()->Dispatch(int(ac));
if(!res.empty()) if (!res.empty())
lyxerr[Debug::GUI] << "ToolbarCB: Function returned: " lyxerr[Debug::GUI] << "ToolbarCB: Function returned: "
<< res << endl; << res << endl;
} }
@ -349,7 +349,7 @@ void Toolbar::Pimpl::set(bool doingmain)
ToolbarList::iterator item = toollist.begin(); ToolbarList::iterator item = toollist.begin();
ToolbarList::iterator end = toollist.end(); ToolbarList::iterator end = toollist.end();
for (; item != end; ++item) { for (; item != end; ++item) {
switch(item->action){ switch (item->action){
case ToolbarDefaults::SEPARATOR: case ToolbarDefaults::SEPARATOR:
xpos += sepspace; xpos += sepspace;
break; break;

View File

@ -12,7 +12,7 @@
FD_form_citation::~FD_form_citation() FD_form_citation::~FD_form_citation()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -12,7 +12,7 @@
FD_form_copyright::~FD_form_copyright() FD_form_copyright::~FD_form_copyright()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -14,7 +14,7 @@
FD_form_tabbed_document::~FD_form_tabbed_document() FD_form_tabbed_document::~FD_form_tabbed_document()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -56,7 +56,7 @@ FD_form_tabbed_document * FormDocument::build_tabbed_document()
FD_form_doc_paper::~FD_form_doc_paper() FD_form_doc_paper::~FD_form_doc_paper()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -177,7 +177,7 @@ FD_form_doc_paper * FormDocument::build_doc_paper()
FD_form_doc_class::~FD_form_doc_class() FD_form_doc_class::~FD_form_doc_class()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -286,7 +286,7 @@ FD_form_doc_class * FormDocument::build_doc_class()
FD_form_doc_language::~FD_form_doc_language() FD_form_doc_language::~FD_form_doc_language()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -336,7 +336,7 @@ FD_form_doc_language * FormDocument::build_doc_language()
FD_form_doc_options::~FD_form_doc_options() FD_form_doc_options::~FD_form_doc_options()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -380,7 +380,7 @@ FD_form_doc_options * FormDocument::build_doc_options()
FD_form_doc_bullet::~FD_form_doc_bullet() FD_form_doc_bullet::~FD_form_doc_bullet()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -12,7 +12,7 @@
FD_form_error::~FD_form_error() FD_form_error::~FD_form_error()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -12,7 +12,7 @@
FD_form_graphics::~FD_form_graphics() FD_form_graphics::~FD_form_graphics()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -12,7 +12,7 @@
FD_form_index::~FD_form_index() FD_form_index::~FD_form_index()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -12,7 +12,7 @@
FD_form_paragraph_general::~FD_form_paragraph_general() FD_form_paragraph_general::~FD_form_paragraph_general()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -136,7 +136,7 @@ FD_form_paragraph_general * FormParagraph::build_paragraph_general()
FD_form_paragraph_extra::~FD_form_paragraph_extra() FD_form_paragraph_extra::~FD_form_paragraph_extra()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -225,7 +225,7 @@ FD_form_paragraph_extra * FormParagraph::build_paragraph_extra()
FD_form_tabbed_paragraph::~FD_form_tabbed_paragraph() FD_form_tabbed_paragraph::~FD_form_tabbed_paragraph()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -12,7 +12,7 @@
FD_form_preferences::~FD_form_preferences() FD_form_preferences::~FD_form_preferences()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -57,7 +57,7 @@ FD_form_preferences * FormPreferences::build_preferences()
FD_form_outer_tab::~FD_form_outer_tab() FD_form_outer_tab::~FD_form_outer_tab()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -83,7 +83,7 @@ FD_form_outer_tab * FormPreferences::build_outer_tab()
FD_form_screen_fonts::~FD_form_screen_fonts() FD_form_screen_fonts::~FD_form_screen_fonts()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -171,7 +171,7 @@ FD_form_screen_fonts * FormPreferences::build_screen_fonts()
FD_form_outputs_misc::~FD_form_outputs_misc() FD_form_outputs_misc::~FD_form_outputs_misc()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -223,7 +223,7 @@ FD_form_outputs_misc * FormPreferences::build_outputs_misc()
FD_form_spellchecker::~FD_form_spellchecker() FD_form_spellchecker::~FD_form_spellchecker()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -287,7 +287,7 @@ FD_form_spellchecker * FormPreferences::build_spellchecker()
FD_form_inputs_misc::~FD_form_inputs_misc() FD_form_inputs_misc::~FD_form_inputs_misc()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -314,7 +314,7 @@ FD_form_inputs_misc * FormPreferences::build_inputs_misc()
FD_form_language::~FD_form_language() FD_form_language::~FD_form_language()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -386,7 +386,7 @@ FD_form_language * FormPreferences::build_language()
FD_form_colours::~FD_form_colours() FD_form_colours::~FD_form_colours()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -449,7 +449,7 @@ FD_form_colours * FormPreferences::build_colours()
FD_form_converters::~FD_form_converters() FD_form_converters::~FD_form_converters()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -497,7 +497,7 @@ FD_form_converters * FormPreferences::build_converters()
FD_form_formats::~FD_form_formats() FD_form_formats::~FD_form_formats()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -549,7 +549,7 @@ FD_form_formats * FormPreferences::build_formats()
FD_form_lnf_misc::~FD_form_lnf_misc() FD_form_lnf_misc::~FD_form_lnf_misc()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -617,7 +617,7 @@ FD_form_lnf_misc * FormPreferences::build_lnf_misc()
FD_form_interface::~FD_form_interface() FD_form_interface::~FD_form_interface()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -666,7 +666,7 @@ FD_form_interface * FormPreferences::build_interface()
FD_form_printer::~FD_form_printer() FD_form_printer::~FD_form_printer()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -745,7 +745,7 @@ FD_form_printer * FormPreferences::build_printer()
FD_form_paths::~FD_form_paths() FD_form_paths::~FD_form_paths()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -12,7 +12,7 @@
FD_form_print::~FD_form_print() FD_form_print::~FD_form_print()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -12,7 +12,7 @@
FD_form_ref::~FD_form_ref() FD_form_ref::~FD_form_ref()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -12,7 +12,7 @@
FD_form_tabular::~FD_form_tabular() FD_form_tabular::~FD_form_tabular()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -51,7 +51,7 @@ FD_form_tabular * FormTabular::build_tabular()
FD_form_tabular_options::~FD_form_tabular_options() FD_form_tabular_options::~FD_form_tabular_options()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -106,7 +106,7 @@ FD_form_tabular_options * FormTabular::build_tabular_options()
FD_form_column_options::~FD_form_column_options() FD_form_column_options::~FD_form_column_options()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -196,7 +196,7 @@ FD_form_column_options * FormTabular::build_column_options()
FD_form_cell_options::~FD_form_cell_options() FD_form_cell_options::~FD_form_cell_options()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }
@ -293,7 +293,7 @@ FD_form_cell_options * FormTabular::build_cell_options()
FD_form_longtable_options::~FD_form_longtable_options() FD_form_longtable_options::~FD_form_longtable_options()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -12,7 +12,7 @@
FD_form_tabular_create::~FD_form_tabular_create() FD_form_tabular_create::~FD_form_tabular_create()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -12,7 +12,7 @@
FD_form_toc::~FD_form_toc() FD_form_toc::~FD_form_toc()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -12,7 +12,7 @@
FD_form_url::~FD_form_url() FD_form_url::~FD_form_url()
{ {
if( form->visible ) fl_hide_form( form ); if (form->visible ) fl_hide_form( form );
fl_free_form( form ); fl_free_form( form );
} }

View File

@ -81,16 +81,16 @@ void fl_print_range_filter(FL_OBJECT * ob,
pages = split (pages, piece, ',') ; pages = split (pages, piece, ',') ;
piece = strip(piece) ; piece = strip(piece) ;
piece = frontStrip(piece) ; piece = frontStrip(piece) ;
if ( !stringOnlyContains (piece, "0123456789-") ) { if (!stringOnlyContains (piece, "0123456789-")) {
WriteAlert(_("ERROR! Unable to print!"), WriteAlert(_("ERROR! Unable to print!"),
_("Check 'range of pages'!")); _("Check 'range of pages'!"));
return; return;
} }
if (piece.find('-') == string::npos) { // not found if (piece.find('-') == string::npos) { // not found
pageflag += lyxrc.print_pagerange_flag + piece + '-' + piece + ' ' ; pageflag += lyxrc.print_pagerange_flag + piece + '-' + piece + ' ' ;
} else if (suffixIs(piece, "-") ) { // missing last page } else if (suffixIs(piece, "-")) { // missing last page
pageflag += lyxrc.print_pagerange_flag + piece + "1000 "; pageflag += lyxrc.print_pagerange_flag + piece + "1000 ";
} else if (prefixIs(piece, "-") ) { // missing first page } else if (prefixIs(piece, "-")) { // missing first page
pageflag += lyxrc.print_pagerange_flag + '1' + piece + ' ' ; pageflag += lyxrc.print_pagerange_flag + '1' + piece + ' ' ;
} else { } else {
pageflag += lyxrc.print_pagerange_flag + piece + ' ' ; pageflag += lyxrc.print_pagerange_flag + piece + ' ' ;

View File

@ -18,14 +18,14 @@ using std::vector;
string formatted( string const & sin, int w, int size, int style ) string formatted( string const & sin, int w, int size, int style )
{ {
string sout; string sout;
if( sin.empty() ) return sout; if (sin.empty() ) return sout;
// break sin up into a vector of individual words // break sin up into a vector of individual words
vector<string> sentence; vector<string> sentence;
string word; string word;
for( string::const_iterator sit = sin.begin(); for (string::const_iterator sit = sin.begin();
sit != sin.end(); ++sit ) { sit != sin.end(); ++sit) {
if( (*sit) == ' ' || (*sit) == '\n') { if ((*sit) == ' ' || (*sit) == '\n') {
sentence.push_back(word); sentence.push_back(word);
word.erase(); word.erase();
} else { } else {
@ -33,17 +33,17 @@ string formatted( string const & sin, int w, int size, int style )
} }
} }
// Flush remaining contents of word // Flush remaining contents of word
if( !word.empty() ) sentence.push_back(word); if (!word.empty() ) sentence.push_back(word);
string line, l1; string line, l1;
for( vector<string>::const_iterator vit = sentence.begin(); for (vector<string>::const_iterator vit = sentence.begin();
vit != sentence.end(); ++vit ) { vit != sentence.end(); ++vit) {
if( !l1.empty() ) l1 += ' '; if (!l1.empty() ) l1 += ' ';
l1 += (*vit); l1 += (*vit);
int length = fl_get_string_width(style, size, l1.c_str(), int length = fl_get_string_width(style, size, l1.c_str(),
int(l1.length())); int(l1.length()));
if( length >= w ) { if (length >= w) {
if( !sout.empty() ) sout += '\n'; if (!sout.empty() ) sout += '\n';
sout += line; sout += line;
l1 = (*vit); l1 = (*vit);
} }
@ -51,8 +51,8 @@ string formatted( string const & sin, int w, int size, int style )
line = l1; line = l1;
} }
// Flush remaining contents of line // Flush remaining contents of line
if( !line.empty() ) { if (!line.empty()) {
if( !sout.empty() ) sout += '\n'; if (!sout.empty() ) sout += '\n';
sout += line; sout += line;
} }

View File

@ -153,7 +153,7 @@ void ExternalTemplateManager::readTemplates(string const & path)
} }
while (lex.IsOK()) { while (lex.IsOK()) {
switch(lex.lex()) { switch (lex.lex()) {
case TM_TEMPLATE: { case TM_TEMPLATE: {
lex.next(); lex.next();
string temp = lex.GetString(); string temp = lex.GetString();
@ -273,7 +273,7 @@ void ExternalTemplate::FormatTemplate::readFormat(LyXLex & lex)
pushpophelper pph(lex, formattags, FO_END); pushpophelper pph(lex, formattags, FO_END);
while (lex.IsOK()) { while (lex.IsOK()) {
switch(lex.lex()) { switch (lex.lex()) {
case FO_PRODUCT: case FO_PRODUCT:
lex.next(true); lex.next(true);
product = lex.GetString(); product = lex.GetString();

View File

@ -168,7 +168,7 @@ int GhostscriptMsg(FL_OBJECT *, Window, int, int,
{ {
XClientMessageEvent * e = reinterpret_cast<XClientMessageEvent*>(ev); XClientMessageEvent * e = reinterpret_cast<XClientMessageEvent*>(ev);
if(lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr << "ClientMessage, win:[xx] gs:[" << e->data.l[0] lyxerr << "ClientMessage, win:[xx] gs:[" << e->data.l[0]
<< "] pm:[" << e->data.l[1] << "]" << endl; << "] pm:[" << e->data.l[1] << "]" << endl;
} }
@ -322,7 +322,7 @@ void AllocColors(int num)
if (i) XFreeColors(fl_get_display(), if (i) XFreeColors(fl_get_display(),
fl_state[fl_get_vclass()].colormap, fl_state[fl_get_vclass()].colormap,
gs_pixels, i, 0); gs_pixels, i, 0);
if(lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr << "Cannot allocate color cube " lyxerr << "Cannot allocate color cube "
<< num << endl;; << num << endl;;
} }
@ -772,7 +772,7 @@ void getbitmap(figdata * p)
static static
void makeupdatelist(figdata * p) void makeupdatelist(figdata * p)
{ {
for(figures_type::iterator it = figures.begin(); for (figures_type::iterator it = figures.begin();
it != figures.end(); ++it) it != figures.end(); ++it)
if ((*it)->data == p) { if ((*it)->data == p) {
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
@ -1158,7 +1158,7 @@ int InsetFig::DocBook(Buffer const *, ostream & os) const
string buf1 = OnlyPath(owner->fileName()); string buf1 = OnlyPath(owner->fileName());
string figurename = MakeRelPath(fname, buf1); string figurename = MakeRelPath(fname, buf1);
if(suffixIs(figurename, ".eps")) if (suffixIs(figurename, ".eps"))
figurename.erase(figurename.length() - 4); figurename.erase(figurename.length() - 4);
os << "@<graphic fileref=\"" << figurename << "\"></graphic>"; os << "@<graphic fileref=\"" << figurename << "\"></graphic>";
@ -1199,7 +1199,7 @@ void InsetFig::Edit(BufferView * bv, int, int, unsigned int)
// We should have RO-versions of the form instead. // We should have RO-versions of the form instead.
// The actual prevention of altering a readonly doc // The actual prevention of altering a readonly doc
// is done in CallbackFig() // is done in CallbackFig()
if(bv->buffer()->isReadonly()) if (bv->buffer()->isReadonly())
WarnReadonly(bv->buffer()->fileName()); WarnReadonly(bv->buffer()->fileName());
if (!form) { if (!form) {
@ -1703,7 +1703,7 @@ void InsetFig::CallbackFig(long arg)
break; break;
case 7: /* apply */ case 7: /* apply */
case 8: /* ok (apply and close) */ case 8: /* ok (apply and close) */
if(!current_view->buffer()->isReadonly()) { if (!current_view->buffer()->isReadonly()) {
wtype = twtype; wtype = twtype;
htype = thtype; htype = thtype;
xwid = atof(fl_get_input(form->Width)); xwid = atof(fl_get_input(form->Width));
@ -1744,7 +1744,7 @@ void InsetFig::CallbackFig(long arg)
break; break;
} //if not readonly } //if not readonly
// The user has already been informed about RO in ::Edit // The user has already been informed about RO in ::Edit
if(arg == 7) // if 'Apply' if (arg == 7) // if 'Apply'
break; break;
// fall through // fall through
case 9: /* cancel = restore and close */ case 9: /* cancel = restore and close */
@ -1888,7 +1888,7 @@ void InsetFig::RestoreForm()
} }
else fl_set_input(form->EpsFile, ""); else fl_set_input(form->EpsFile, "");
fl_set_input(form->Subcaption, subcaption.c_str()); fl_set_input(form->Subcaption, subcaption.c_str());
if(current_view->buffer()->isReadonly()) if (current_view->buffer()->isReadonly())
DisableFigurePanel(form); DisableFigurePanel(form);
TempRegenerate(); TempRegenerate();

View File

@ -84,7 +84,7 @@ InsetBibKey::InsetBibKey(InsetCommandParams const & p)
InsetBibKey::~InsetBibKey() InsetBibKey::~InsetBibKey()
{ {
if(bibitem_form && bibitem_form->bibitem_form if (bibitem_form && bibitem_form->bibitem_form
&& bibitem_form->bibitem_form->visible && bibitem_form->bibitem_form->visible
&& bibitem_form->bibitem_form->u_vdata == &holder) && bibitem_form->bibitem_form->u_vdata == &holder)
fl_hide_form(bibitem_form->bibitem_form); fl_hide_form(bibitem_form->bibitem_form);
@ -106,7 +106,7 @@ void InsetBibKey::callback( FD_bibitem_form * form, long data )
// Do NOT change this to // Do NOT change this to
// holder.view->buffer() as this code is used by both // holder.view->buffer() as this code is used by both
// InsetBibKey and InsetBibtex! Ughhhhhhh!!!! // InsetBibKey and InsetBibtex! Ughhhhhhh!!!!
if(!current_view->buffer()->isReadonly()) { if (!current_view->buffer()->isReadonly()) {
setContents(fl_get_input(form->key)); setContents(fl_get_input(form->key));
setOptions(fl_get_input(form->label)); setOptions(fl_get_input(form->label));
// shouldn't mark the buffer dirty unless // shouldn't mark the buffer dirty unless
@ -176,7 +176,7 @@ string const InsetBibKey::getScreenLabel() const
*/ */
void InsetBibKey::Edit(BufferView * bv, int, int, unsigned int) void InsetBibKey::Edit(BufferView * bv, int, int, unsigned int)
{ {
if(bv->buffer()->isReadonly()) if (bv->buffer()->isReadonly())
WarnReadonly(bv->buffer()->fileName()); WarnReadonly(bv->buffer()->fileName());
if (!bibitem_form) { if (!bibitem_form) {
@ -213,7 +213,7 @@ InsetBibtex::InsetBibtex(InsetCommandParams const & p)
InsetBibtex::~InsetBibtex() InsetBibtex::~InsetBibtex()
{ {
if(bibitem_form && bibitem_form->bibitem_form if (bibitem_form && bibitem_form->bibitem_form
&& bibitem_form->bibitem_form->visible && bibitem_form->bibitem_form->visible
&& bibitem_form->bibitem_form->u_vdata == &holder) && bibitem_form->bibitem_form->u_vdata == &holder)
fl_hide_form(bibitem_form->bibitem_form); fl_hide_form(bibitem_form->bibitem_form);
@ -283,7 +283,7 @@ vector<pair<string, string> > const InsetBibtex::getKeys(Buffer const * buffer)
string linebuf0; string linebuf0;
while (getline(ifs, linebuf0)) { while (getline(ifs, linebuf0)) {
string linebuf = frontStrip(strip(linebuf0)); string linebuf = frontStrip(strip(linebuf0));
if( linebuf.empty() ) continue; if (linebuf.empty() ) continue;
if (prefixIs(linebuf, "@")) { if (prefixIs(linebuf, "@")) {
linebuf = subst(linebuf, '{', '('); linebuf = subst(linebuf, '{', '(');
linebuf = split(linebuf, tmp, '('); linebuf = split(linebuf, tmp, '(');
@ -296,7 +296,7 @@ vector<pair<string, string> > const InsetBibtex::getKeys(Buffer const * buffer)
keys.push_back(pair<string,string>(tmp,string())); keys.push_back(pair<string,string>(tmp,string()));
} }
} }
} else if( !keys.empty() ) { } else if (!keys.empty()) {
keys.back().second += linebuf + "\n"; keys.back().second += linebuf + "\n";
} }
} }

View File

@ -40,7 +40,7 @@ string const InsetCitation::getScreenLabel() const
keys = frontStrip(split(keys, key, ',')); keys = frontStrip(split(keys, key, ','));
string::size_type size = label.size() + 2 + key.size(); string::size_type size = label.size() + 2 + key.size();
if( size >= maxSize ) { if (size >= maxSize) {
label += ", ..."; label += ", ...";
break; break;
} }

View File

@ -44,7 +44,7 @@ string const InsetCommandParams::getAsString() const
void InsetCommandParams::setFromString( string const & b ) void InsetCommandParams::setFromString( string const & b )
{ {
string::size_type idx = b.find("|++|"); string::size_type idx = b.find("|++|");
if( idx == string::npos ) { if (idx == string::npos) {
cmdname = ""; cmdname = "";
options = ""; options = "";
contents = ""; contents = "";
@ -55,7 +55,7 @@ void InsetCommandParams::setFromString( string const & b )
string tmp = b.substr(idx+4); string tmp = b.substr(idx+4);
idx = tmp.find("|++|"); idx = tmp.find("|++|");
if( idx == string::npos ) { if (idx == string::npos) {
options = tmp; options = tmp;
} else { } else {
options = tmp.substr(0, idx); options = tmp.substr(0, idx);

View File

@ -58,7 +58,7 @@ public:
/// ///
string const & getContents() const { return contents; } string const & getContents() const { return contents; }
/// ///
void setCmdName( string const & n ) { cmdname = n; } void setCmdName( string const & n) { cmdname = n; }
/// ///
void setOptions(string const & o) { options = o; } void setOptions(string const & o) { options = o; }
/// ///

View File

@ -138,7 +138,7 @@ void include_cb(FL_OBJECT *, long arg)
} }
case 1: case 1:
if(!current_view->buffer()->isReadonly()) { if (!current_view->buffer()->isReadonly()) {
inset->setContents(fl_get_input(form->input)); inset->setContents(fl_get_input(form->input));
// don't typeset // don't typeset
inset->setNoLoad(fl_get_button(form->flag1)); inset->setNoLoad(fl_get_button(form->flag1));
@ -160,7 +160,7 @@ void include_cb(FL_OBJECT *, long arg)
fl_hide_form(form->include); fl_hide_form(form->include);
break; break;
case 5: case 5:
if(!current_view->buffer()->isReadonly()) { if (!current_view->buffer()->isReadonly()) {
inset->setContents(fl_get_input(form->input)); inset->setContents(fl_get_input(form->input));
inset->setNoLoad(fl_get_button(form->flag1)); inset->setNoLoad(fl_get_button(form->flag1));
if (fl_get_button(form->flag2)) if (fl_get_button(form->flag2))
@ -247,7 +247,7 @@ Inset * InsetInclude::Clone(Buffer const & buffer) const
void InsetInclude::Edit(BufferView * bv, int, int, unsigned int) void InsetInclude::Edit(BufferView * bv, int, int, unsigned int)
{ {
if(bv->buffer()->isReadonly()) if (bv->buffer()->isReadonly())
WarnReadonly(bv->buffer()->fileName()); WarnReadonly(bv->buffer()->fileName());
if (!form) { if (!form) {
@ -440,7 +440,7 @@ int InsetInclude::Linuxdoc(Buffer const * buffer, ostream & os) const
} else } else
writefile = getFileName(); writefile = getFileName();
if(IsLyXFilename(getFileName())) if (IsLyXFilename(getFileName()))
writefile = ChangeExtension(writefile, ".sgml"); writefile = ChangeExtension(writefile, ".sgml");
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl; lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
@ -476,7 +476,7 @@ int InsetInclude::DocBook(Buffer const * buffer, ostream & os) const
writefile = AddName(buffer->tmppath, incfile); writefile = AddName(buffer->tmppath, incfile);
} else } else
writefile = getFileName(); writefile = getFileName();
if(IsLyXFilename(getFileName())) if (IsLyXFilename(getFileName()))
writefile = ChangeExtension(writefile, ".sgml"); writefile = ChangeExtension(writefile, ".sgml");
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl; lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
@ -507,7 +507,7 @@ void InsetInclude::Validate(LaTeXFeatures & features) const
// Use the relative path. // Use the relative path.
writefile = incfile; writefile = incfile;
if(IsLyXFilename(getFileName())) if (IsLyXFilename(getFileName()))
writefile = ChangeExtension(writefile, ".sgml"); writefile = ChangeExtension(writefile, ".sgml");
features.IncludedFiles[include_label] = writefile; features.IncludedFiles[include_label] = writefile;

View File

@ -173,7 +173,7 @@ void InsetInfo::CloseInfoCB(FL_OBJECT * ob, long)
InsetInfo * inset = static_cast<InsetInfo*>(ob->u_vdata); InsetInfo * inset = static_cast<InsetInfo*>(ob->u_vdata);
string tmp = fl_get_input(inset->strobj); string tmp = fl_get_input(inset->strobj);
Buffer * buffer = current_view->buffer(); Buffer * buffer = current_view->buffer();
if(tmp != inset->contents && !(buffer->isReadonly()) ) { if (tmp != inset->contents && !(buffer->isReadonly())) {
buffer->markDirty(); buffer->markDirty();
inset->contents = tmp; inset->contents = tmp;
} }
@ -203,7 +203,7 @@ void InsetInfo::Edit(BufferView *bv, int, int, unsigned int)
{ {
static int ow = -1, oh; static int ow = -1, oh;
if(bv->buffer()->isReadonly()) if (bv->buffer()->isReadonly())
WarnReadonly(bv->buffer()->fileName()); WarnReadonly(bv->buffer()->fileName());
if (!form) { if (!form) {

View File

@ -191,7 +191,7 @@ void InsetLatexAccent::checkContents()
// special clause for \i{}, \j{} \l{} and \L{} // special clause for \i{}, \j{} \l{} and \L{}
if ((modtype == DOT_LESS_I || modtype == DOT_LESS_J if ((modtype == DOT_LESS_I || modtype == DOT_LESS_J
|| modtype == lSLASH || modtype == LSLASH) || modtype == lSLASH || modtype == LSLASH)
&& contents[3] == '}' ) { && contents[3] == '}') {
switch (modtype) { switch (modtype) {
case DOT_LESS_I: ic = 'i'; break; case DOT_LESS_I: ic = 'i'; break;
case DOT_LESS_J: ic = 'j'; break; case DOT_LESS_J: ic = 'j'; break;
@ -225,13 +225,13 @@ void InsetLatexAccent::checkContents()
remdot = true; remdot = true;
else else
return; return;
} else if ( (ic == 'i'|| ic == 'j') && contents[4] == '}') { } else if ((ic == 'i'|| ic == 'j') && contents[4] == '}') {
// Do a rewrite: \<foo>{i} --> \<foo>{\i} // Do a rewrite: \<foo>{i} --> \<foo>{\i}
string temp = contents; string temp = contents;
temp.erase(3, string::npos); temp.erase(3, string::npos);
temp += '\\'; temp += '\\';
temp += char(ic); temp += char(ic);
for(string::size_type j = 4; for (string::size_type j = 4;
j < contents.length(); ++j) j < contents.length(); ++j)
temp+= contents[j]; temp+= contents[j];
contents= temp; contents= temp;

View File

@ -32,7 +32,7 @@ using std::ostream;
InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf) InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf)
: InsetCommand(p) : InsetCommand(p)
{ {
string fn = p.getContents(); string const fn = p.getContents();
setContents(MakeAbsPath(fn, OnlyPath(bf.fileName()))); setContents(MakeAbsPath(fn, OnlyPath(bf.fileName())));
} }

View File

@ -78,7 +78,7 @@ InsetQuotes::InsetQuotes(char c, BufferParams const & params)
: language(params.quotes_language), times(params.quotes_times) : language(params.quotes_language), times(params.quotes_times)
{ {
// Decide whether left or right // Decide whether left or right
switch(c) { switch (c) {
case ' ': case '(': case '{': case '[': case '-': case ':': case ' ': case '(': case '{': case '[': case '-': case ':':
case LyXParagraph::META_HFILL: case LyXParagraph::META_HFILL:
case LyXParagraph::META_NEWLINE: case LyXParagraph::META_NEWLINE:
@ -272,7 +272,7 @@ int InsetQuotes::Linuxdoc(Buffer const *, ostream & os) const
int InsetQuotes::DocBook(Buffer const *, ostream & os) const int InsetQuotes::DocBook(Buffer const *, ostream & os) const
{ {
if(times == InsetQuotes::DoubleQ) { if (times == InsetQuotes::DoubleQ) {
if (side == InsetQuotes::LeftQ) if (side == InsetQuotes::LeftQ)
os << "&ldquo;"; os << "&ldquo;";
else else

View File

@ -23,10 +23,10 @@ InsetRef::InsetRef(InsetCommandParams const & p, Buffer const & buf)
void InsetRef::Edit(BufferView * bv, int, int, unsigned int button) void InsetRef::Edit(BufferView * bv, int, int, unsigned int button)
{ {
// Eventually trigger dialog with button 3 not 1 // Eventually trigger dialog with button 3 not 1
if( button == 3 ) if (button == 3 )
bv->owner()->getLyXFunc()-> bv->owner()->getLyXFunc()->
Dispatch(LFUN_REF_GOTO, getContents()); Dispatch(LFUN_REF_GOTO, getContents());
else if( button == 1 ) else if (button == 1 )
bv->owner()->getDialogs()->showRef( this ); bv->owner()->getDialogs()->showRef( this );
} }
@ -47,7 +47,7 @@ string const InsetRef::getScreenLabel() const
temp += getContents(); temp += getContents();
if(!isLatex if (!isLatex
&& !getOptions().empty()) { && !getOptions().empty()) {
temp += "||"; temp += "||";
temp += getOptions(); temp += getOptions();
@ -59,7 +59,7 @@ string const InsetRef::getScreenLabel() const
int InsetRef::Latex(Buffer const *, ostream & os, int InsetRef::Latex(Buffer const *, ostream & os,
bool /*fragile*/, bool /*fs*/) const bool /*fragile*/, bool /*fs*/) const
{ {
if(getOptions().empty()) if (getOptions().empty())
os << escape(getCommand()); os << escape(getCommand());
else { else {
InsetCommandParams p( getCmdName(), getContents(), "" ); InsetCommandParams p( getCmdName(), getContents(), "" );
@ -117,6 +117,6 @@ void InsetRef::Validate(LaTeXFeatures & features) const
{ {
if (getCmdName() == "vref" || getCmdName() == "vpageref") if (getCmdName() == "vref" || getCmdName() == "vpageref")
features.varioref = true; features.varioref = true;
else if(getCmdName() == "prettyref") else if (getCmdName() == "prettyref")
features.prettyref = true; features.prettyref = true;
} }

View File

@ -252,11 +252,11 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
bool dodraw; bool dodraw;
x += ADD_TO_TABULAR_WIDTH; x += ADD_TO_TABULAR_WIDTH;
if (cleared) { if (cleared) {
for(i = 0; i < tabular->rows(); ++i) { for (i = 0; i < tabular->rows(); ++i) {
nx = int(x); nx = int(x);
dodraw = ((baseline + tabular->GetDescentOfRow(i)) > 0) && dodraw = ((baseline + tabular->GetDescentOfRow(i)) > 0) &&
(baseline - tabular->GetAscentOfRow(i))<pain.paperHeight(); (baseline - tabular->GetAscentOfRow(i))<pain.paperHeight();
for(j = 0; j < tabular->columns(); ++j) { for (j = 0; j < tabular->columns(); ++j) {
if (tabular->IsPartOfMultiColumn(i, j)) if (tabular->IsPartOfMultiColumn(i, j))
continue; continue;
cx = nx + tabular->GetBeginningOfTextInCell(cell); cx = nx + tabular->GetBeginningOfTextInCell(cell);
@ -276,8 +276,8 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
} }
} else if (need_update == CELL) { } else if (need_update == CELL) {
nx = int(x); nx = int(x);
for(i = 0; (cell < actcell) && (i < tabular->rows()); ++i) { for (i = 0; (cell < actcell) && (i < tabular->rows()); ++i) {
for(j = 0; (cell < actcell) && (j < tabular->columns()); ++j) { for (j = 0; (cell < actcell) && (j < tabular->columns()); ++j) {
if (tabular->IsPartOfMultiColumn(i, j)) if (tabular->IsPartOfMultiColumn(i, j))
continue; continue;
nx += tabular->GetWidthOfColumn(cell); nx += tabular->GetWidthOfColumn(cell);
@ -402,7 +402,7 @@ void InsetTabular::update(BufferView * bv, LyXFont const & font, bool reinit)
// inset_x = cursor.x() - top_x + tabular->GetBeginningOfTextInCell(actcell); // inset_x = cursor.x() - top_x + tabular->GetBeginningOfTextInCell(actcell);
// inset_y = cursor.y(); // inset_y = cursor.y();
} }
switch(need_update) { switch (need_update) {
case INIT: case INIT:
case FULL: case FULL:
case CELL: case CELL:
@ -964,9 +964,9 @@ bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv,
InsetText * inset; InsetText * inset;
bool changed = false; bool changed = false;
for(int i = 0; i < tabular->rows(); ++i) { for (int i = 0; i < tabular->rows(); ++i) {
maxAsc = maxDesc = 0; maxAsc = maxDesc = 0;
for(int j= 0; j < tabular->columns(); ++j) { for (int j= 0; j < tabular->columns(); ++j) {
if (tabular->IsPartOfMultiColumn(i,j)) if (tabular->IsPartOfMultiColumn(i,j))
continue; continue;
++cell; ++cell;
@ -1062,7 +1062,7 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const
tabular->GetAdditionalWidth(actcell); tabular->GetAdditionalWidth(actcell);
#warning Jürgen, can you rewrite this to _not_ use the sequencing operator. (Lgb) #warning Jürgen, can you rewrite this to _not_ use the sequencing operator. (Lgb)
#if 0 #if 0
for(; !tabular->IsLastCellInRow(actcell) && (lx < x); for (; !tabular->IsLastCellInRow(actcell) && (lx < x);
++actcell,lx += tabular->GetWidthOfColumn(actcell) + ++actcell,lx += tabular->GetWidthOfColumn(actcell) +
tabular->GetAdditionalWidth(actcell - 1)); tabular->GetAdditionalWidth(actcell - 1));
#else #else
@ -1089,10 +1089,10 @@ int InsetTabular::getCellXPos(int cell) const
{ {
int c = cell; int c = cell;
for(; !tabular->IsFirstCellInRow(c); --c) for (; !tabular->IsFirstCellInRow(c); --c)
; ;
int lx = tabular->GetWidthOfColumn(cell); int lx = tabular->GetWidthOfColumn(cell);
for(; c < cell; ++c) { for (; c < cell; ++c) {
lx += tabular->GetWidthOfColumn(c); lx += tabular->GetWidthOfColumn(c);
} }
return (lx - tabular->GetWidthOfColumn(cell) + top_x); return (lx - tabular->GetWidthOfColumn(cell) + top_x);
@ -1108,7 +1108,7 @@ void InsetTabular::resetPos(BufferView * bv) const
int cell = 0; int cell = 0;
actrow = 0; actrow = 0;
cursor.y(0); cursor.y(0);
for(; (cell < actcell) && !tabular->IsLastRow(cell); ++cell) { for (; (cell < actcell) && !tabular->IsLastRow(cell); ++cell) {
if (tabular->IsLastCellInRow(cell)) { if (tabular->IsLastCellInRow(cell)) {
cursor.y(cursor.y() + tabular->GetDescentOfRow(actrow) + cursor.y(cursor.y() + tabular->GetDescentOfRow(actrow) +
tabular->GetAscentOfRow(actrow + 1) + tabular->GetAscentOfRow(actrow + 1) +
@ -1239,7 +1239,7 @@ bool InsetTabular::TabularFeatures(BufferView * bv, string const & what)
LyXTabular::Feature action = LyXTabular::LAST_ACTION; LyXTabular::Feature action = LyXTabular::LAST_ACTION;
int i = 0; int i = 0;
for(; tabularFeatures[i].action != LyXTabular::LAST_ACTION; ++i) { for (; tabularFeatures[i].action != LyXTabular::LAST_ACTION; ++i) {
string const tmp = tabularFeatures[i].feature; string const tmp = tabularFeatures[i].feature;
if (tmp == what.substr(0, tmp.length())) { if (tmp == what.substr(0, tmp.length())) {
@ -1400,8 +1400,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
flag = false; flag = false;
case LyXTabular::TOGGLE_LINE_TOP: case LyXTabular::TOGGLE_LINE_TOP:
lineSet = !tabular->TopLine(actcell, flag); lineSet = !tabular->TopLine(actcell, flag);
for(i=sel_row_start; i<=sel_row_end; ++i) for (i=sel_row_start; i<=sel_row_end; ++i)
for(j=sel_col_start; j<=sel_col_end; ++j) for (j=sel_col_start; j<=sel_col_end; ++j)
tabular->SetTopLine(tabular->GetCellNumber(i,j),lineSet, flag); tabular->SetTopLine(tabular->GetCellNumber(i,j),lineSet, flag);
UpdateLocal(bv, INIT, true); UpdateLocal(bv, INIT, true);
break; break;
@ -1410,8 +1410,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
flag = false; flag = false;
case LyXTabular::TOGGLE_LINE_BOTTOM: case LyXTabular::TOGGLE_LINE_BOTTOM:
lineSet = !tabular->BottomLine(actcell, flag); lineSet = !tabular->BottomLine(actcell, flag);
for(i=sel_row_start; i<=sel_row_end; ++i) for (i=sel_row_start; i<=sel_row_end; ++i)
for(j=sel_col_start; j<=sel_col_end; ++j) for (j=sel_col_start; j<=sel_col_end; ++j)
tabular->SetBottomLine(tabular->GetCellNumber(i,j),lineSet, tabular->SetBottomLine(tabular->GetCellNumber(i,j),lineSet,
flag); flag);
UpdateLocal(bv, INIT, true); UpdateLocal(bv, INIT, true);
@ -1421,8 +1421,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
flag = false; flag = false;
case LyXTabular::TOGGLE_LINE_LEFT: case LyXTabular::TOGGLE_LINE_LEFT:
lineSet = !tabular->LeftLine(actcell, flag); lineSet = !tabular->LeftLine(actcell, flag);
for(i=sel_row_start; i<=sel_row_end; ++i) for (i=sel_row_start; i<=sel_row_end; ++i)
for(j=sel_col_start; j<=sel_col_end; ++j) for (j=sel_col_start; j<=sel_col_end; ++j)
tabular->SetLeftLine(tabular->GetCellNumber(i,j),lineSet, tabular->SetLeftLine(tabular->GetCellNumber(i,j),lineSet,
flag); flag);
UpdateLocal(bv, INIT, true); UpdateLocal(bv, INIT, true);
@ -1432,8 +1432,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
flag = false; flag = false;
case LyXTabular::TOGGLE_LINE_RIGHT: case LyXTabular::TOGGLE_LINE_RIGHT:
lineSet = !tabular->RightLine(actcell, flag); lineSet = !tabular->RightLine(actcell, flag);
for(i=sel_row_start; i<=sel_row_end; ++i) for (i=sel_row_start; i<=sel_row_end; ++i)
for(j=sel_col_start; j<=sel_col_end; ++j) for (j=sel_col_start; j<=sel_col_end; ++j)
tabular->SetRightLine(tabular->GetCellNumber(i,j),lineSet, tabular->SetRightLine(tabular->GetCellNumber(i,j),lineSet,
flag); flag);
UpdateLocal(bv, INIT, true); UpdateLocal(bv, INIT, true);
@ -1445,8 +1445,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
case LyXTabular::ALIGN_LEFT: case LyXTabular::ALIGN_LEFT:
case LyXTabular::ALIGN_RIGHT: case LyXTabular::ALIGN_RIGHT:
case LyXTabular::ALIGN_CENTER: case LyXTabular::ALIGN_CENTER:
for(i = sel_row_start; i <= sel_row_end; ++i) for (i = sel_row_start; i <= sel_row_end; ++i)
for(j = sel_col_start; j <= sel_col_end; ++j) for (j = sel_col_start; j <= sel_col_end; ++j)
tabular->SetAlignment(tabular->GetCellNumber(i, j), setAlign, tabular->SetAlignment(tabular->GetCellNumber(i, j), setAlign,
flag); flag);
if (hasSelection()) if (hasSelection())
@ -1461,8 +1461,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
case LyXTabular::VALIGN_TOP: case LyXTabular::VALIGN_TOP:
case LyXTabular::VALIGN_BOTTOM: case LyXTabular::VALIGN_BOTTOM:
case LyXTabular::VALIGN_CENTER: case LyXTabular::VALIGN_CENTER:
for(i = sel_row_start; i <= sel_row_end; ++i) for (i = sel_row_start; i <= sel_row_end; ++i)
for(j = sel_col_start; j <= sel_col_end; ++j) for (j = sel_col_start; j <= sel_col_end; ++j)
tabular->SetVAlignment(tabular->GetCellNumber(i, j), tabular->SetVAlignment(tabular->GetCellNumber(i, j),
setVAlign, flag); setVAlign, flag);
if (hasSelection()) if (hasSelection())
@ -1513,8 +1513,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
case LyXTabular::SET_ALL_LINES: case LyXTabular::SET_ALL_LINES:
setLines = 1; setLines = 1;
case LyXTabular::UNSET_ALL_LINES: case LyXTabular::UNSET_ALL_LINES:
for(i=sel_row_start; i<=sel_row_end; ++i) for (i=sel_row_start; i<=sel_row_end; ++i)
for(j=sel_col_start; j<=sel_col_end; ++j) for (j=sel_col_start; j<=sel_col_end; ++j)
tabular->SetAllLines(tabular->GetCellNumber(i,j), setLines); tabular->SetAllLines(tabular->GetCellNumber(i,j), setLines);
UpdateLocal(bv, INIT, true); UpdateLocal(bv, INIT, true);
break; break;
@ -1533,13 +1533,13 @@ void InsetTabular::TabularFeatures(BufferView * bv,
tabular->SetRotateTabular(false); tabular->SetRotateTabular(false);
break; break;
case LyXTabular::SET_ROTATE_CELL: case LyXTabular::SET_ROTATE_CELL:
for(i=sel_row_start; i<=sel_row_end; ++i) for (i=sel_row_start; i<=sel_row_end; ++i)
for(j=sel_col_start; j<=sel_col_end; ++j) for (j=sel_col_start; j<=sel_col_end; ++j)
tabular->SetRotateCell(tabular->GetCellNumber(i,j),true); tabular->SetRotateCell(tabular->GetCellNumber(i,j),true);
break; break;
case LyXTabular::UNSET_ROTATE_CELL: case LyXTabular::UNSET_ROTATE_CELL:
for(i = sel_row_start; i <= sel_row_end; ++i) for (i = sel_row_start; i <= sel_row_end; ++i)
for(j = sel_col_start; j <= sel_col_end; ++j) for (j = sel_col_start; j <= sel_col_end; ++j)
tabular->SetRotateCell(tabular->GetCellNumber(i, j), false); tabular->SetRotateCell(tabular->GetCellNumber(i, j), false);
break; break;
case LyXTabular::SET_USEBOX: case LyXTabular::SET_USEBOX:
@ -1547,8 +1547,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
LyXTabular::BoxType val = LyXTabular::BoxType(strToInt(value)); LyXTabular::BoxType val = LyXTabular::BoxType(strToInt(value));
if (val == tabular->GetUsebox(actcell)) if (val == tabular->GetUsebox(actcell))
val = LyXTabular::BOX_NONE; val = LyXTabular::BOX_NONE;
for(i = sel_row_start; i <= sel_row_end; ++i) for (i = sel_row_start; i <= sel_row_end; ++i)
for(j = sel_col_start; j <= sel_col_end; ++j) for (j = sel_col_start; j <= sel_col_end; ++j)
tabular->SetUsebox(tabular->GetCellNumber(i, j), val); tabular->SetUsebox(tabular->GetCellNumber(i, j), val);
break; break;
} }
@ -1604,16 +1604,16 @@ bool InsetTabular::ActivateCellInset(BufferView * bv, int x, int y, int button,
bool InsetTabular::InsetHit(BufferView * bv, int x, int ) const bool InsetTabular::InsetHit(BufferView * bv, int x, int ) const
{ {
InsetText * inset = tabular->GetCellInset(actcell); InsetText * inset = tabular->GetCellInset(actcell);
int x1 = x + top_x; int const x1 = x + top_x;
if (!cellstart(cursor.pos())) { if (!cellstart(cursor.pos())) {
return (((x + top_x) < cursor.x()) && return ((x + top_x) < cursor.x() &&
((x + top_x) > (cursor.x() - inset->width(bv, (x + top_x) > (cursor.x() - inset->width(bv,
LyXFont(LyXFont::ALL_SANE))))); LyXFont(LyXFont::ALL_SANE))));
} else { } else {
int x2 = cursor.x() + tabular->GetBeginningOfTextInCell(actcell); int const x2 = cursor.x() + tabular->GetBeginningOfTextInCell(actcell);
return ((x1 > x2) && return (x1 > x2 &&
(x1 < (x2 + inset->width(bv, LyXFont(LyXFont::ALL_SANE))))); x1 < (x2 + inset->width(bv, LyXFont(LyXFont::ALL_SANE))));
} }
} }
@ -1635,7 +1635,7 @@ int InsetTabular::getMaxWidth(Painter & pain,
{ {
int const n = tabular->GetNumberOfCells(); int const n = tabular->GetNumberOfCells();
int cell = 0; int cell = 0;
for(; cell < n; ++cell) { for (; cell < n; ++cell) {
if (tabular->GetCellInset(cell) == inset) if (tabular->GetCellInset(cell) == inset)
break; break;
} }
@ -1689,7 +1689,7 @@ LyXFunc::func_status InsetTabular::getStatus(string const & what) const
LyXFunc::func_status status = LyXFunc::OK; LyXFunc::func_status status = LyXFunc::OK;
int i = 0; int i = 0;
for(; tabularFeatures[i].action != LyXTabular::LAST_ACTION; ++i) { for (; tabularFeatures[i].action != LyXTabular::LAST_ACTION; ++i) {
string const tmp = tabularFeatures[i].feature; string const tmp = tabularFeatures[i].feature;
if (tmp == what.substr(0, tmp.length())) { if (tmp == what.substr(0, tmp.length())) {
//if (!strncmp(tabularFeatures[i].feature.c_str(), what.c_str(), //if (!strncmp(tabularFeatures[i].feature.c_str(), what.c_str(),
@ -1934,14 +1934,14 @@ bool InsetTabular::copySelection(BufferView * bv)
paste_tabular = new LyXTabular(this, *tabular); // rows, columns); paste_tabular = new LyXTabular(this, *tabular); // rows, columns);
int i; int i;
for(i=0; i < sel_row_start; ++i) for (i=0; i < sel_row_start; ++i)
paste_tabular->DeleteRow(0); paste_tabular->DeleteRow(0);
while(paste_tabular->rows() > rows) while(paste_tabular->rows() > rows)
paste_tabular->DeleteRow(rows); paste_tabular->DeleteRow(rows);
paste_tabular->SetTopLine(0, true, true); paste_tabular->SetTopLine(0, true, true);
paste_tabular->SetBottomLine(paste_tabular->GetFirstCellInRow(rows-1), paste_tabular->SetBottomLine(paste_tabular->GetFirstCellInRow(rows-1),
true, true); true, true);
for(i=0; i < sel_col_start; ++i) for (i=0; i < sel_col_start; ++i)
paste_tabular->DeleteColumn(0); paste_tabular->DeleteColumn(0);
while(paste_tabular->columns() > columns) while(paste_tabular->columns() > columns)
paste_tabular->DeleteColumn(columns); paste_tabular->DeleteColumn(columns);
@ -1959,7 +1959,7 @@ bool InsetTabular::pasteSelection(BufferView * bv)
{ {
if (!paste_tabular) if (!paste_tabular)
return false; return false;
for(int j=0, i=actcell; j<paste_tabular->GetNumberOfCells(); ++j,++i) { for (int j=0, i=actcell; j<paste_tabular->GetNumberOfCells(); ++j,++i) {
while (paste_tabular->row_of_cell(j) > tabular->row_of_cell(i)-actrow) while (paste_tabular->row_of_cell(j) > tabular->row_of_cell(i)-actrow)
++i; ++i;
if (tabular->GetNumberOfCells() <= i) if (tabular->GetNumberOfCells() <= i)
@ -2006,8 +2006,8 @@ bool InsetTabular::cutSelection()
//sel_cell_end = tmp; //sel_cell_end = tmp;
swap(sel_cell_start, sel_cell_end); swap(sel_cell_start, sel_cell_end);
} }
for(int i = sel_row_start; i <= sel_row_end; ++i) { for (int i = sel_row_start; i <= sel_row_end; ++i) {
for(int j = sel_col_start; j <= sel_col_end; ++j) { for (int j = sel_col_start; j <= sel_col_end; ++j) {
tabular->GetCellInset(tabular->GetCellNumber(i, j))->clear(); tabular->GetCellInset(tabular->GetCellNumber(i, j))->clear();
} }
} }

View File

@ -114,7 +114,7 @@ InsetText::~InsetText()
{ {
// delete all instances of LyXText before deleting the paragraps used // delete all instances of LyXText before deleting the paragraps used
// by it. // by it.
for(Cache::const_iterator cit = cache.begin(); cit != cache.end(); ++cit) for (Cache::const_iterator cit = cache.begin(); cit != cache.end(); ++cit)
delete (*cit).second; delete (*cit).second;
LyXParagraph * p = par->next; LyXParagraph * p = par->next;
delete par; delete par;
@ -130,7 +130,7 @@ void InsetText::clear()
{ {
// delete all instances of LyXText before deleting the paragraps used // delete all instances of LyXText before deleting the paragraps used
// by it. // by it.
for(Cache::const_iterator cit = cache.begin(); cit != cache.end(); ++cit) for (Cache::const_iterator cit = cache.begin(); cit != cache.end(); ++cit)
delete (*cit).second; delete (*cit).second;
LyXParagraph * p = par->next; LyXParagraph * p = par->next;
delete par; delete par;
@ -177,7 +177,7 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
// delete all instances of LyXText before deleting the paragraps used // delete all instances of LyXText before deleting the paragraps used
// by it. // by it.
for(Cache::const_iterator cit = cache.begin(); cit != cache.end(); ++cit) for (Cache::const_iterator cit = cache.begin(); cit != cache.end(); ++cit)
delete (*cit).second; delete (*cit).second;
LyXParagraph * p = par->next; LyXParagraph * p = par->next;
@ -644,7 +644,7 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
paste_internally = true; paste_internally = true;
} }
TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset, TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
y+insetAscent); y + insetAscent);
TEXT(bv)->sel_cursor = TEXT(bv)->cursor; TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
UpdateLocal(bv, CURSOR, false); UpdateLocal(bv, CURSOR, false);
bv->owner()->setLayout(cpar(bv)->GetLayout()); bv->owner()->setLayout(cpar(bv)->GetLayout());
@ -742,7 +742,7 @@ InsetText::LocalDispatch(BufferView * bv,
UpdateLocal(bv, CURSOR_PAR, false); UpdateLocal(bv, CURSOR_PAR, false);
return result; return result;
} else if (result == FINISHED) { } else if (result == FINISHED) {
switch(action) { switch (action) {
case -1: case -1:
case LFUN_RIGHT: case LFUN_RIGHT:
moveRight(bv, false); moveRight(bv, false);
@ -1390,7 +1390,7 @@ void InsetText::SetParagraphData(LyXParagraph *p)
{ {
// delete all instances of LyXText before deleting the paragraps used // delete all instances of LyXText before deleting the paragraps used
// by it. // by it.
for(Cache::const_iterator cit = cache.begin(); cit != cache.end(); ++cit) for (Cache::const_iterator cit = cache.begin(); cit != cache.end(); ++cit)
delete (*cit).second; delete (*cit).second;
LyXParagraph * np; LyXParagraph * np;
@ -1509,7 +1509,7 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
if (recursive) { if (recursive) {
/// then remove all LyXText in text-insets /// then remove all LyXText in text-insets
LyXParagraph * p = par; LyXParagraph * p = par;
for(;p;p = p->next) { for (;p;p = p->next) {
p->deleteInsetsLyXText(bv); p->deleteInsetsLyXText(bv);
} }
} }
@ -1572,7 +1572,7 @@ void InsetText::resizeLyXText(BufferView * bv) const
/// then resize all LyXText in text-insets /// then resize all LyXText in text-insets
inset_x = cx(bv) - top_x + drawTextXOffset; inset_x = cx(bv) - top_x + drawTextXOffset;
inset_y = cy(bv) + drawTextYOffset; inset_y = cy(bv) + drawTextYOffset;
for(LyXParagraph * p = par; p; p = p->next) { for (LyXParagraph * p = par; p; p = p->next) {
p->resizeInsetsLyXText(bv); p->resizeInsetsLyXText(bv);
} }
} }
@ -1582,8 +1582,8 @@ void InsetText::resizeLyXText(BufferView * bv) const
void InsetText::removeNewlines() void InsetText::removeNewlines()
{ {
for(LyXParagraph * p = par; p; p = p->next) { for (LyXParagraph * p = par; p; p = p->next) {
for(int i = 0; i < p->Last(); ++i) { for (int i = 0; i < p->Last(); ++i) {
if (p->GetChar(i) == LyXParagraph::META_NEWLINE) if (p->GetChar(i) == LyXParagraph::META_NEWLINE)
p->Erase(i); p->Erase(i);
} }

View File

@ -17,11 +17,11 @@ using std::ostream;
string const InsetTOC::getScreenLabel() const string const InsetTOC::getScreenLabel() const
{ {
string cmdname( getCmdName() ); string cmdname( getCmdName() );
if( cmdname == "tableofcontents" ) if (cmdname == "tableofcontents" )
return _("Table of Contents"); return _("Table of Contents");
else if( cmdname == "listofalgorithms" ) else if (cmdname == "listofalgorithms" )
return _("List of Algorithms"); return _("List of Algorithms");
else if( cmdname == "listoffigures" ) else if (cmdname == "listoffigures" )
return _("List of Figures"); return _("List of Figures");
else else
return _("List of Tables"); return _("List of Tables");
@ -31,11 +31,11 @@ string const InsetTOC::getScreenLabel() const
Inset::Code InsetTOC::LyxCode() const Inset::Code InsetTOC::LyxCode() const
{ {
string cmdname( getCmdName() ); string cmdname( getCmdName() );
if( cmdname == "tableofcontents" ) if (cmdname == "tableofcontents" )
return Inset::TOC_CODE; return Inset::TOC_CODE;
else if( cmdname == "listofalgorithms" ) else if (cmdname == "listofalgorithms" )
return Inset::LOA_CODE; return Inset::LOA_CODE;
else if( cmdname == "listoffigures" ) else if (cmdname == "listoffigures" )
return Inset::LOF_CODE; return Inset::LOF_CODE;
else else
return Inset::LOT_CODE; return Inset::LOT_CODE;
@ -50,7 +50,7 @@ void InsetTOC::Edit(BufferView * bv, int, int, unsigned int)
int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const
{ {
if( getCmdName() == "tableofcontents" ) if (getCmdName() == "tableofcontents" )
os << "<toc>"; os << "<toc>";
return 0; return 0;
} }
@ -58,7 +58,7 @@ int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const
int InsetTOC::DocBook(Buffer const *, ostream & os) const int InsetTOC::DocBook(Buffer const *, ostream & os) const
{ {
if( getCmdName() == "tableofcontents" ) if (getCmdName() == "tableofcontents" )
os << "<toc></toc>"; os << "<toc></toc>";
return 0; return 0;
} }

View File

@ -28,12 +28,12 @@ void InsetUrl::Edit(BufferView * bv, int, int, unsigned int)
string const InsetUrl::getScreenLabel() const string const InsetUrl::getScreenLabel() const
{ {
string temp; string temp;
if( getCmdName() == "url" ) if (getCmdName() == "url" )
temp = _("Url: "); temp = _("Url: ");
else else
temp = _("HtmlUrl: "); temp = _("HtmlUrl: ");
if(!getOptions().empty()) if (!getOptions().empty())
temp += getOptions(); temp += getOptions();
else else
temp += getContents(); temp += getContents();

View File

@ -167,7 +167,7 @@ void kb_keymap::print(string & buf) const
int kb_keymap::defkey(kb_sequence * seq, int action, int idx /*= 0*/) int kb_keymap::defkey(kb_sequence * seq, int action, int idx /*= 0*/)
{ {
unsigned int code = seq->sequence[idx]; unsigned int code = seq->sequence[idx];
if(code == NoSymbol) return -1; if (code == NoSymbol) return -1;
unsigned int modmsk = seq->modifiers[idx]; unsigned int modmsk = seq->modifiers[idx];
@ -185,7 +185,7 @@ int kb_keymap::defkey(kb_sequence * seq, int action, int idx /*= 0*/)
<< buf << buf
<< "' is overriding old binding..." << "' is overriding old binding..."
<< endl; << endl;
if((*it).table) { if ((*it).table) {
delete (*it).table; delete (*it).table;
(*it).table = 0; (*it).table = 0;
} }

View File

@ -61,24 +61,24 @@ void printKeysym(unsigned int key, unsigned int mod, string & buf);
int kb_sequence::addkey(unsigned int key, int kb_sequence::addkey(unsigned int key,
unsigned int mod, unsigned int nmod /*= 0*/) unsigned int mod, unsigned int nmod /*= 0*/)
{ {
if(length < 0) length = 0; if (length < 0) length = 0;
if(length + 1 >= size) { if (length + 1 >= size) {
unsigned int * nseq = new unsigned int[size + KB_PREALLOC]; unsigned int * nseq = new unsigned int[size + KB_PREALLOC];
size += KB_PREALLOC; size += KB_PREALLOC;
memcpy(nseq, sequence, length * sizeof(unsigned int)); memcpy(nseq, sequence, length * sizeof(unsigned int));
if(sequence != staticseq) delete sequence; if (sequence != staticseq) delete sequence;
sequence = nseq; sequence = nseq;
nseq = new unsigned int[size]; nseq = new unsigned int[size];
memcpy(nseq, modifiers, length * sizeof(unsigned int)); memcpy(nseq, modifiers, length * sizeof(unsigned int));
if(modifiers != staticmod) delete modifiers; if (modifiers != staticmod) delete modifiers;
modifiers = nseq; modifiers = nseq;
} }
modifiers[length] = mod + (nmod << 16); modifiers[length] = mod + (nmod << 16);
sequence[length++] = key; sequence[length++] = key;
if(curmap) if (curmap)
return curmap->lookup(key, mod, this); return curmap->lookup(key, mod, this);
return -1; return -1;
@ -98,16 +98,16 @@ int kb_sequence::addkey(unsigned int key,
int kb_sequence::parse(string const & s) int kb_sequence::parse(string const & s)
{ {
if(s.empty()) return 1; if (s.empty()) return 1;
string::size_type i = 0; string::size_type i = 0;
unsigned int mod = 0, nmod = 0; unsigned int mod = 0, nmod = 0;
while (i < s.length()) { while (i < s.length()) {
if(s[i] && (s[i]) <= ' ') ++i; if (s[i] && (s[i]) <= ' ') ++i;
if(i >= s.length()) break; if (i >= s.length()) break;
if(s[i + 1] == '-') { // is implicit that s[i] == true if (s[i + 1] == '-') { // is implicit that s[i] == true
switch(s[i]) { switch (s[i]) {
case 's': case 'S': case 's': case 'S':
mod |= ShiftMask; mod |= ShiftMask;
i += 2; i += 2;
@ -123,8 +123,8 @@ int kb_sequence::parse(string const & s)
default: default:
return i + 1; return i + 1;
} }
} else if(s[i] == '~' && s[i + 1] && s[i + 2] == '-') { } else if (s[i] == '~' && s[i + 1] && s[i + 2] == '-') {
switch(s[i + 1]) { switch (s[i + 1]) {
case 's': case 'S': case 's': case 'S':
nmod |= ShiftMask; nmod |= ShiftMask;
i += 3; i += 3;
@ -143,11 +143,11 @@ int kb_sequence::parse(string const & s)
} else { } else {
string tbuf; string tbuf;
string::size_type j = i; string::size_type j = i;
for(; j < s.length() && s[j] > ' '; ++j) for (; j < s.length() && s[j] > ' '; ++j)
tbuf += s[j]; // (!!!check bounds :-) tbuf += s[j]; // (!!!check bounds :-)
KeySym key = XStringToKeysym(tbuf.c_str()); KeySym key = XStringToKeysym(tbuf.c_str());
if(key == NoSymbol) { if (key == NoSymbol) {
lyxerr[Debug::KBMAP] lyxerr[Debug::KBMAP]
<< "kbmap.C: No such keysym: " << "kbmap.C: No such keysym: "
<< tbuf << endl; << tbuf << endl;
@ -179,15 +179,15 @@ int kb_sequence::print(string & buf, bool when_defined) const
KeySym key; KeySym key;
unsigned int mod; unsigned int mod;
int l = length; int l = length;
if ( l < 0 && !when_defined ) l = -l; if (l < 0 && !when_defined ) l = -l;
for(int i = 0; i < l; ++i) { for (int i = 0; i < l; ++i) {
key = sequence[i]; key = sequence[i];
mod = modifiers[i] & 0xffff; mod = modifiers[i] & 0xffff;
printKeysym(key, mod, buf); // RVDK_PATCH_5 printKeysym(key, mod, buf); // RVDK_PATCH_5
if(i + 1 < l) { // append a blank if (i + 1 < l) { // append a blank
buf += ' '; buf += ' ';
} }
} }
@ -243,8 +243,8 @@ void kb_sequence::delseq()
unsigned int kb_sequence::getsym() const unsigned int kb_sequence::getsym() const
{ {
int l = length; int l = length;
if(l == 0) return NoSymbol; if (l == 0) return NoSymbol;
if(l < 0) l = -l; if (l < 0) l = -l;
return sequence[l - 1]; return sequence[l - 1];
} }
@ -261,7 +261,7 @@ char kb_sequence::getiso() const
{ {
int c = getsym(); int c = getsym();
if(c > 0xff) if (c > 0xff)
return '\0'; return '\0';
return c; return c;
} }

View File

@ -188,7 +188,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass)
while (!finished && lexrc.IsOK() && !error) { while (!finished && lexrc.IsOK() && !error) {
int le = lexrc.lex(); int le = lexrc.lex();
// See comment in lyxrc.C. // See comment in lyxrc.C.
switch(le) { switch (le) {
case LyXLex::LEX_FEOF: case LyXLex::LEX_FEOF:
continue; continue;
@ -198,7 +198,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass)
continue; continue;
default: break; default: break;
} }
switch(static_cast<LayoutTags>(le)) { switch (static_cast<LayoutTags>(le)) {
case LT_END: // end of structure case LT_END: // end of structure
finished = true; finished = true;
break; break;
@ -429,7 +429,7 @@ void LyXLayout::readAlign(LyXLex & lexrc)
return; return;
default: break; default: break;
}; };
switch(static_cast<AlignTags>(le)) { switch (static_cast<AlignTags>(le)) {
case AT_BLOCK: case AT_BLOCK:
align = LYX_ALIGN_BLOCK; align = LYX_ALIGN_BLOCK;
break; break;
@ -610,7 +610,7 @@ void LyXLayout::readEndLabelType(LyXLex & lexrc)
pushpophelper pph(lexrc, endlabelTypeTags, pushpophelper pph(lexrc, endlabelTypeTags,
END_LABEL_ENUM_LAST-END_LABEL_ENUM_FIRST+1); END_LABEL_ENUM_LAST-END_LABEL_ENUM_FIRST+1);
int le = lexrc.lex(); int le = lexrc.lex();
switch(le) { switch (le) {
case LyXLex::LEX_UNDEF: case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown labeltype tag `$$Token'"); lexrc.printError("Unknown labeltype tag `$$Token'");
break; break;
@ -641,7 +641,7 @@ void LyXLayout::readMargin(LyXLex & lexrc)
pushpophelper pph(lexrc, marginTags, MARGIN_RIGHT_ADDRESS_BOX); pushpophelper pph(lexrc, marginTags, MARGIN_RIGHT_ADDRESS_BOX);
int le = lexrc.lex(); int le = lexrc.lex();
switch(le) { switch (le) {
case LyXLex::LEX_UNDEF: case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown margin type tag `$$Token'"); lexrc.printError("Unknown margin type tag `$$Token'");
return; return;
@ -710,13 +710,13 @@ void LyXLayout::readSpacing(LyXLex & lexrc)
pushpophelper pph(lexrc, spacingTags, ST_OTHER); pushpophelper pph(lexrc, spacingTags, ST_OTHER);
int le = lexrc.lex(); int le = lexrc.lex();
switch(le) { switch (le) {
case LyXLex::LEX_UNDEF: case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown spacing token `$$Token'"); lexrc.printError("Unknown spacing token `$$Token'");
return; return;
default: break; default: break;
} }
switch(static_cast<SpacingTags>(le)) { switch (static_cast<SpacingTags>(le)) {
case ST_SPACING_SINGLE: case ST_SPACING_SINGLE:
spacing.set(Spacing::Single); spacing.set(Spacing::Single);
break; break;
@ -835,7 +835,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
// parsing // parsing
while (lexrc.IsOK() && !error) { while (lexrc.IsOK() && !error) {
int le = lexrc.lex(); int le = lexrc.lex();
switch(le) { switch (le) {
case LyXLex::LEX_FEOF: case LyXLex::LEX_FEOF:
continue; continue;
@ -845,7 +845,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
continue; continue;
default: break; default: break;
} }
switch(static_cast<TextClassTags>(le)) { switch (static_cast<TextClassTags>(le)) {
case TC_OUTPUTTYPE: // output type definition case TC_OUTPUTTYPE: // output type definition
readOutputType(lexrc); readOutputType(lexrc);
break; break;
@ -901,7 +901,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
case TC_SIDES: case TC_SIDES:
if (lexrc.next()) { if (lexrc.next()) {
switch(lexrc.GetInteger()) { switch (lexrc.GetInteger()) {
case 1: sides_ = OneSide; break; case 1: sides_ = OneSide; break;
case 2: sides_ = TwoSides; break; case 2: sides_ = TwoSides; break;
default: default:
@ -1003,7 +1003,7 @@ void LyXTextClass::readOutputType(LyXLex & lexrc)
pushpophelper pph(lexrc, outputTypeTags, LITERATE); pushpophelper pph(lexrc, outputTypeTags, LITERATE);
int le = lexrc.lex(); int le = lexrc.lex();
switch(le) { switch (le) {
case LyXLex::LEX_UNDEF: case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown output type `$$Token'"); lexrc.printError("Unknown output type `$$Token'");
return; return;
@ -1053,7 +1053,7 @@ void LyXTextClass::readMaxCounter(LyXLex & lexrc)
pushpophelper pph(lexrc, maxCounterTags, MC_COUNTER_ENUMIV); pushpophelper pph(lexrc, maxCounterTags, MC_COUNTER_ENUMIV);
int le = lexrc.lex(); int le = lexrc.lex();
switch(le) { switch (le) {
case LyXLex::LEX_UNDEF: case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown MaxCounter tag `$$Token'"); lexrc.printError("Unknown MaxCounter tag `$$Token'");
return; return;
@ -1237,7 +1237,7 @@ LyXTextClassList::NumberOfLayout(LyXTextClassList::size_type textclass,
string const & name) const string const & name) const
{ {
classlist[textclass].load(); classlist[textclass].load();
for(unsigned int i = 0; i < classlist[textclass].numLayouts(); ++i) { for (unsigned int i = 0; i < classlist[textclass].numLayouts(); ++i) {
if (classlist[textclass][i].name() == name) if (classlist[textclass][i].name() == name)
return make_pair(true, i); return make_pair(true, i);
} }

View File

@ -657,7 +657,7 @@ LyXFont const UserFreeFont(BufferParams const & params)
LyXFont font(LyXFont::ALL_IGNORE); LyXFont font(LyXFont::ALL_IGNORE);
int pos = fl_get_choice(fd_form_character->choice_family); int pos = fl_get_choice(fd_form_character->choice_family);
switch(pos) { switch (pos) {
case 1: font.setFamily(LyXFont::IGNORE_FAMILY); break; case 1: font.setFamily(LyXFont::IGNORE_FAMILY); break;
case 2: font.setFamily(LyXFont::ROMAN_FAMILY); break; case 2: font.setFamily(LyXFont::ROMAN_FAMILY); break;
case 3: font.setFamily(LyXFont::SANS_FAMILY); break; case 3: font.setFamily(LyXFont::SANS_FAMILY); break;
@ -666,7 +666,7 @@ LyXFont const UserFreeFont(BufferParams const & params)
} }
pos = fl_get_choice(fd_form_character->choice_series); pos = fl_get_choice(fd_form_character->choice_series);
switch(pos) { switch (pos) {
case 1: font.setSeries(LyXFont::IGNORE_SERIES); break; case 1: font.setSeries(LyXFont::IGNORE_SERIES); break;
case 2: font.setSeries(LyXFont::MEDIUM_SERIES); break; case 2: font.setSeries(LyXFont::MEDIUM_SERIES); break;
case 3: font.setSeries(LyXFont::BOLD_SERIES); break; case 3: font.setSeries(LyXFont::BOLD_SERIES); break;
@ -674,7 +674,7 @@ LyXFont const UserFreeFont(BufferParams const & params)
} }
pos = fl_get_choice(fd_form_character->choice_shape); pos = fl_get_choice(fd_form_character->choice_shape);
switch(pos) { switch (pos) {
case 1: font.setShape(LyXFont::IGNORE_SHAPE); break; case 1: font.setShape(LyXFont::IGNORE_SHAPE); break;
case 2: font.setShape(LyXFont::UP_SHAPE); break; case 2: font.setShape(LyXFont::UP_SHAPE); break;
case 3: font.setShape(LyXFont::ITALIC_SHAPE); break; case 3: font.setShape(LyXFont::ITALIC_SHAPE); break;
@ -684,7 +684,7 @@ LyXFont const UserFreeFont(BufferParams const & params)
} }
pos = fl_get_choice(fd_form_character->choice_size); pos = fl_get_choice(fd_form_character->choice_size);
switch(pos) { switch (pos) {
case 1: font.setSize(LyXFont::IGNORE_SIZE); break; case 1: font.setSize(LyXFont::IGNORE_SIZE); break;
case 2: font.setSize(LyXFont::SIZE_TINY); break; case 2: font.setSize(LyXFont::SIZE_TINY); break;
case 3: font.setSize(LyXFont::SIZE_SCRIPT); break; case 3: font.setSize(LyXFont::SIZE_SCRIPT); break;
@ -702,7 +702,7 @@ LyXFont const UserFreeFont(BufferParams const & params)
} }
pos = fl_get_choice(fd_form_character->choice_bar); pos = fl_get_choice(fd_form_character->choice_bar);
switch(pos) { switch (pos) {
case 1: font.setEmph(LyXFont::IGNORE); case 1: font.setEmph(LyXFont::IGNORE);
font.setUnderbar(LyXFont::IGNORE); font.setUnderbar(LyXFont::IGNORE);
font.setNoun(LyXFont::IGNORE); font.setNoun(LyXFont::IGNORE);
@ -720,7 +720,7 @@ LyXFont const UserFreeFont(BufferParams const & params)
} }
pos = fl_get_choice(fd_form_character->choice_color); pos = fl_get_choice(fd_form_character->choice_color);
switch(pos) { switch (pos) {
case 1: font.setColor(LColor::ignore); break; case 1: font.setColor(LColor::ignore); break;
case 2: font.setColor(LColor::none); break; case 2: font.setColor(LColor::none); break;
case 3: font.setColor(LColor::black); break; case 3: font.setColor(LColor::black); break;
@ -835,7 +835,7 @@ void FigureApplyCB(FL_OBJECT *, long)
return; return;
Buffer * buffer = current_view->buffer(); Buffer * buffer = current_view->buffer();
if(buffer->isReadonly()) // paranoia if (buffer->isReadonly()) // paranoia
return; return;
current_view->owner()->getMiniBuffer()->Set(_("Inserting figure...")); current_view->owner()->getMiniBuffer()->Set(_("Inserting figure..."));

View File

@ -131,14 +131,14 @@ LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI)
if (height < 400) height = 400; if (height < 400) height = 400;
// If width is not set by geometry, check it against monitor width // If width is not set by geometry, check it against monitor width
if ( !(geometryBitmask & 4) ) { if (!(geometryBitmask & 4)) {
Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen); //DefaultScreen(fl_get_display()); Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen); //DefaultScreen(fl_get_display());
if (WidthOfScreen(scr) - 8 < width) if (WidthOfScreen(scr) - 8 < width)
width = WidthOfScreen(scr) - 8; width = WidthOfScreen(scr) - 8;
} }
// If height is not set by geometry, check it against monitor height // If height is not set by geometry, check it against monitor height
if ( !(geometryBitmask & 8) ) { if (!(geometryBitmask & 8)) {
Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen); //DefaultScreen(fl_get_display()); Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen); //DefaultScreen(fl_get_display());
if (HeightOfScreen(scr) - 24 < height) if (HeightOfScreen(scr) - 24 < height)
height = HeightOfScreen(scr) - 24; height = HeightOfScreen(scr) - 24;
@ -340,7 +340,7 @@ void LyXGUI::create_forms()
// build up the combox entries // build up the combox entries
combo_language2->addline(_("No change")); combo_language2->addline(_("No change"));
combo_language2->addline(_("Reset")); combo_language2->addline(_("Reset"));
for(Languages::const_iterator cit = languages.begin(); for (Languages::const_iterator cit = languages.begin();
cit != languages.end(); ++cit) { cit != languages.end(); ++cit) {
#ifdef DO_USE_DEFAULT_LANGUAGE #ifdef DO_USE_DEFAULT_LANGUAGE
if ((*cit).second.lang() != "default") if ((*cit).second.lang() != "default")

View File

@ -637,7 +637,7 @@ void LyX::ReadUIFile(string const & name)
lex.printTable(lyxerr); lex.printTable(lyxerr);
while (lex.IsOK()) { while (lex.IsOK()) {
switch(lex.lex()) { switch (lex.lex()) {
case ui_menuset: case ui_menuset:
menubackend.read(lex); menubackend.read(lex);
break; break;
@ -717,7 +717,7 @@ bool LyX::easyParse(int * argc, char * argv[])
{ {
bool gui = true; bool gui = true;
int removeargs = 0; // used when options are read int removeargs = 0; // used when options are read
for(int i = 1; i < *argc; ++i) { for (int i = 1; i < *argc; ++i) {
string arg = argv[i]; string arg = argv[i];
// Check for -dbg int // Check for -dbg int
@ -857,7 +857,7 @@ void error_handler(int err_sig)
bufferlist.emergencyWriteAll(); bufferlist.emergencyWriteAll();
lyxerr << "Bye." << endl; lyxerr << "Bye." << endl;
if(err_sig!= SIGHUP && if (err_sig!= SIGHUP &&
(!GetEnv("LYXDEBUG").empty() || err_sig == SIGSEGV)) (!GetEnv("LYXDEBUG").empty() || err_sig == SIGSEGV))
lyx::abort(); lyx::abort();
exit(0); exit(0);

View File

@ -192,7 +192,7 @@ LyXFont & LyXFont::decSize()
/// Increases font size by one /// Increases font size by one
LyXFont & LyXFont::incSize() LyXFont & LyXFont::incSize()
{ {
switch(size()) { switch (size()) {
case SIZE_HUGER: break; case SIZE_HUGER: break;
case SIZE_HUGE: setSize(SIZE_HUGER); break; case SIZE_HUGE: setSize(SIZE_HUGER); break;
case SIZE_LARGEST: setSize(SIZE_HUGE); break; case SIZE_LARGEST: setSize(SIZE_HUGE); break;
@ -245,7 +245,7 @@ LyXFont::FONT_MISC_STATE LyXFont::setMisc(FONT_MISC_STATE newfont,
void LyXFont::update(LyXFont const & newfont, void LyXFont::update(LyXFont const & newfont,
Language const * document_language, bool toggleall) Language const * document_language, bool toggleall)
{ {
if(newfont.family() == family() && toggleall) if (newfont.family() == family() && toggleall)
setFamily(INHERIT_FAMILY); // toggle 'back' setFamily(INHERIT_FAMILY); // toggle 'back'
else if (newfont.family() != IGNORE_FAMILY) else if (newfont.family() != IGNORE_FAMILY)
setFamily(newfont.family()); setFamily(newfont.family());
@ -268,7 +268,7 @@ void LyXFont::update(LyXFont const & newfont,
break; break;
} }
if(newfont.shape() == shape() && toggleall) if (newfont.shape() == shape() && toggleall)
setShape(INHERIT_SHAPE); // toggle 'back' setShape(INHERIT_SHAPE); // toggle 'back'
else if (newfont.shape() != IGNORE_SHAPE) else if (newfont.shape() != IGNORE_SHAPE)
setShape(newfont.shape()); setShape(newfont.shape());

View File

@ -120,7 +120,7 @@ void LyXFindReplace::SearchReplaceCB()
// in order to avoid endless loop :-( // in order to avoid endless loop :-(
if (SF.SearchString().length() == 0 if (SF.SearchString().length() == 0
|| (SF.SearchString().length() == 1 || (SF.SearchString().length() == 1
&& SF.SearchString()[0] == ' ') ) { && SF.SearchString()[0] == ' ')) {
WriteAlert(_("Sorry!"), _("You cannot replace a single space, " WriteAlert(_("Sorry!"), _("You cannot replace a single space, "
"nor an empty character.")); "nor an empty character."));
return; return;
@ -157,7 +157,7 @@ void LyXFindReplace::SearchReplaceAllCB()
// in order to avoid endless loop :-( // in order to avoid endless loop :-(
if (SF.SearchString().length() == 0 if (SF.SearchString().length() == 0
|| (SF.SearchString().length() == 1 || (SF.SearchString().length() == 1
&& SF.SearchString()[0] == ' ') ) { && SF.SearchString()[0] == ' ')) {
WriteAlert(_("Sorry!"), _("You cannot replace a single space, " WriteAlert(_("Sorry!"), _("You cannot replace a single space, "
"nor an empty character.")); "nor an empty character."));
return; return;
@ -186,7 +186,7 @@ void LyXFindReplace::SearchReplaceAllCB()
++replace_count; ++replace_count;
} }
} while (SearchCB(true)); } while (SearchCB(true));
if( replace_count == 0 ) { if (replace_count == 0) {
LyXBell(); LyXBell();
bv->owner()->getMiniBuffer()->Set( bv->owner()->getMiniBuffer()->Set(
_("String not found!")); _("String not found!"));

View File

@ -24,9 +24,6 @@
#endif #endif
#include "version.h" #include "version.h"
#if 0
#include "lyxlookup.h"
#endif
#include "kbmap.h" #include "kbmap.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "bufferlist.h" #include "bufferlist.h"
@ -217,7 +214,7 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
// implementations? (Lgb) // implementations? (Lgb)
// This code snippet makes lyx ignore some keys. Perhaps // This code snippet makes lyx ignore some keys. Perhaps
// all of them should be explictly mentioned? // all of them should be explictly mentioned?
if((keysym >= XK_Shift_L && keysym <= XK_Hyper_R) if ((keysym >= XK_Shift_L && keysym <= XK_Hyper_R)
|| keysym == XK_Mode_switch || keysym == 0x0) || keysym == XK_Mode_switch || keysym == 0x0)
return 0; return 0;
@ -232,7 +229,7 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
// When not cancel or meta-fake, do the normal lookup. // When not cancel or meta-fake, do the normal lookup.
// Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards. // Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
// Mostly, meta_fake_bit = 0. RVDK_PATCH_5. // Mostly, meta_fake_bit = 0. RVDK_PATCH_5.
if ( (action != LFUN_CANCEL) && (action != LFUN_META_FAKE) ) { if ((action != LFUN_CANCEL) && (action != LFUN_META_FAKE)) {
// remove Caps Lock and Mod2 as a modifiers // remove Caps Lock and Mod2 as a modifiers
action = keyseq.addkey(keysym, action = keyseq.addkey(keysym,
@ -258,7 +255,7 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
// why not return already here if action == -1 and // why not return already here if action == -1 and
// num_bytes == 0? (Lgb) // num_bytes == 0? (Lgb)
if(keyseq.length > 1 || keyseq.length < -1) { if (keyseq.length > 1 || keyseq.length < -1) {
string buf; string buf;
keyseq.print(buf); keyseq.print(buf);
owner->getMiniBuffer()->Set(buf); owner->getMiniBuffer()->Set(buf);
@ -296,141 +293,6 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
} }
#if 0
int LyXFunc::processKeyEvent(XEvent * ev)
{
char s_r[10];
KeySym keysym_return = 0;
string argument;
XKeyEvent * keyevent = &ev->xkey;
int num_bytes = LyXLookupString(ev, s_r, 10, &keysym_return);
s_r[num_bytes] = '\0';
if (lyxerr.debugging(Debug::KEY)) {
char * tmp = XKeysymToString(keysym_return);
string stm = (tmp ? tmp : "");
lyxerr << "KeySym is "
<< stm
<< "["
<< keysym_return << "]"
<< " and num_bytes is "
<< num_bytes
<< " the string returned is \""
<< s_r << '\"'
<< endl;
}
// Do nothing if we have nothing (JMarc)
if (num_bytes == 0 && keysym_return == NoSymbol) {
lyxerr[Debug::KEY] << "Empty kbd action (probably composing)"
<< endl;
return 0;
}
// this function should be used always [asierra060396]
UpdatableInset * tli = owner->view()->theLockingInset();
if (owner->view()->available() && tli && (keysym_return==XK_Escape)) {
if (tli == tli->GetLockingInset()) {
owner->view()->unlockInset(tli);
owner->view()->text->CursorRight(owner->view());
moveCursorUpdate(false);
owner->showState();
} else {
tli->UnlockInsetInInset(owner->view(),
tli->GetLockingInset(),true);
}
return 0;
}
// Can we be sure that this will work for all X-Windows
// implementations? (Lgb)
// This code snippet makes lyx ignore some keys. Perhaps
// all of them should be explictly mentioned?
if((keysym_return >= XK_Shift_L && keysym_return <= XK_Hyper_R)
|| keysym_return == XK_Mode_switch || keysym_return == 0x0)
return 0;
// Do a one-deep top-level lookup for
// cancel and meta-fake keys. RVDK_PATCH_5
cancel_meta_seq.reset();
int action = cancel_meta_seq.addkey(keysym_return, keyevent->state
&(ShiftMask|ControlMask
|Mod1Mask));
// When not cancel or meta-fake, do the normal lookup.
// Note how the meta_fake Mod1 bit is OR-ed in and reset afterwards.
// Mostly, meta_fake_bit = 0. RVDK_PATCH_5.
if ( (action != LFUN_CANCEL) && (action != LFUN_META_FAKE) ) {
// remove Caps Lock and Mod2 as a modifiers
action = keyseq.addkey(keysym_return,
(keyevent->state | meta_fake_bit)
&(ShiftMask|ControlMask
|Mod1Mask));
}
// Dont remove this unless you know what you are doing.
meta_fake_bit = 0;
if (action == 0) action = LFUN_PREFIX;
if (lyxerr.debugging(Debug::KEY)) {
string buf;
keyseq.print(buf);
lyxerr << "Key ["
<< action << "]["
<< buf << "]"
<< "["
<< num_bytes << "]"
<< endl;
}
// already here we know if it any point in going further
// why not return already here if action == -1 and
// num_bytes == 0? (Lgb)
if(keyseq.length > 1 || keyseq.length < -1) {
string buf;
keyseq.print(buf);
owner->getMiniBuffer()->Set(buf);
}
if (action == -1) {
if (keyseq.length < -1) { // unknown key sequence...
string buf;
LyXBell();
keyseq.print(buf);
owner->getMiniBuffer()->Set(_("Unknown sequence:"), buf);
return 0;
}
char isochar = keyseq.getiso();
if (!(keyevent->state&ControlMask) &&
!(keyevent->state&Mod1Mask) &&
(isochar && keysym_return < 0xF000)) {
argument += isochar;
}
if (argument.empty()) {
lyxerr.debug() << "Empty argument!" << endl;
// This can`t possibly be of any use
// so we`ll skip the dispatch.
return 0;
}
}
else
if (action == LFUN_SELFINSERT) {
argument = s_r[0];
}
bool tmp_sc = show_sc;
show_sc = false;
Dispatch(action, argument);
show_sc = tmp_sc;
return 0;
}
#endif
LyXFunc::func_status LyXFunc::getStatus(int ac) const LyXFunc::func_status LyXFunc::getStatus(int ac) const
{ {
kb_action action; kb_action action;
@ -613,6 +475,9 @@ string const LyXFunc::Dispatch(string const & s)
string const LyXFunc::Dispatch(int ac, string const LyXFunc::Dispatch(int ac,
string const & do_not_use_this_arg) string const & do_not_use_this_arg)
{ {
lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: action[" << ac
<<"] arg[" << do_not_use_this_arg << "]" << endl;
string argument; string argument;
kb_action action; kb_action action;
LyXText * text = 0; LyXText * text = 0;
@ -743,7 +608,7 @@ string const LyXFunc::Dispatch(int ac,
return string(); return string();
else { else {
setMessage(N_("Text mode")); setMessage(N_("Text mode"));
switch(action) { switch (action) {
case LFUN_UNKNOWN_ACTION: case LFUN_UNKNOWN_ACTION:
case LFUN_BREAKPARAGRAPH: case LFUN_BREAKPARAGRAPH:
case LFUN_BREAKLINE: case LFUN_BREAKLINE:
@ -783,7 +648,7 @@ string const LyXFunc::Dispatch(int ac,
if (!text) if (!text)
text = owner->view()->text; text = owner->view()->text;
switch(action) { switch (action) {
// --- Misc ------------------------------------------- // --- Misc -------------------------------------------
case LFUN_WORDFINDFORWARD : case LFUN_WORDFINDFORWARD :
case LFUN_WORDFINDBACKWARD : { case LFUN_WORDFINDBACKWARD : {
@ -813,7 +678,7 @@ string const LyXFunc::Dispatch(int ac,
owner->view()->text->ClearSelection(); owner->view()->text->ClearSelection();
// Move cursor so that successive C-s 's will not stand in place. // Move cursor so that successive C-s 's will not stand in place.
if( action == LFUN_WORDFINDFORWARD ) if (action == LFUN_WORDFINDFORWARD )
owner->view()->text->CursorRightOneWord(owner->view()); owner->view()->text->CursorRightOneWord(owner->view());
owner->view()->text->FinishUndo(); owner->view()->text->FinishUndo();
moveCursorUpdate(false); moveCursorUpdate(false);
@ -849,7 +714,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_CANCEL: // RVDK_PATCH_5 case LFUN_CANCEL: // RVDK_PATCH_5
keyseq.reset(); keyseq.reset();
meta_fake_bit = 0; meta_fake_bit = 0;
if(owner->view()->available()) if (owner->view()->available())
// cancel any selection // cancel any selection
Dispatch(LFUN_MARK_OFF); Dispatch(LFUN_MARK_OFF);
setMessage(N_("Cancel")); setMessage(N_("Cancel"));
@ -971,11 +836,11 @@ string const LyXFunc::Dispatch(int ac,
{ {
InsetCommandParams p; InsetCommandParams p;
if( action == LFUN_TOCVIEW ) if (action == LFUN_TOCVIEW )
p.setCmdName( "tableofcontents" ); p.setCmdName( "tableofcontents" );
else if( action == LFUN_LOAVIEW ) else if (action == LFUN_LOAVIEW )
p.setCmdName( "listofalgorithms" ); p.setCmdName( "listofalgorithms" );
else if( action == LFUN_LOFVIEW ) else if (action == LFUN_LOFVIEW )
p.setCmdName( "listoffigures" ); p.setCmdName( "listoffigures" );
else else
p.setCmdName( "listoftables" ); p.setCmdName( "listoftables" );
@ -991,17 +856,17 @@ string const LyXFunc::Dispatch(int ac,
{ {
InsetCommandParams p; InsetCommandParams p;
if( action == LFUN_TOC_INSERT ) if (action == LFUN_TOC_INSERT )
p.setCmdName( "tableofcontents" ); p.setCmdName( "tableofcontents" );
else if( action == LFUN_LOA_INSERT ) else if (action == LFUN_LOA_INSERT )
p.setCmdName( "listofalgorithms" ); p.setCmdName( "listofalgorithms" );
else if( action == LFUN_LOF_INSERT ) else if (action == LFUN_LOF_INSERT )
p.setCmdName( "listoffigures" ); p.setCmdName( "listoffigures" );
else else
p.setCmdName( "listoftables" ); p.setCmdName( "listoftables" );
Inset * inset = new InsetTOC( p ); Inset * inset = new InsetTOC( p );
if( !owner->view()->insertInset( inset, "Standard", true ) ) if (!owner->view()->insertInset( inset, "Standard", true ) )
delete inset; delete inset;
break; break;
} }
@ -1165,7 +1030,7 @@ string const LyXFunc::Dispatch(int ac,
&& owner->view()->text->cursor.par()->footnoteflag && owner->view()->text->cursor.par()->footnoteflag
!= LyXParagraph::NO_FOOTNOTE) != LyXParagraph::NO_FOOTNOTE)
{ // only melt footnotes with FOOTMELT, not margins etc { // only melt footnotes with FOOTMELT, not margins etc
if(owner->view()->text->cursor.par()->footnotekind == LyXParagraph::FOOTNOTE) if (owner->view()->text->cursor.par()->footnotekind == LyXParagraph::FOOTNOTE)
Melt(owner->view()); Melt(owner->view());
} }
else else
@ -1179,7 +1044,7 @@ string const LyXFunc::Dispatch(int ac,
&& owner->view()->text->cursor.par()->footnoteflag && owner->view()->text->cursor.par()->footnoteflag
!= LyXParagraph::NO_FOOTNOTE) { != LyXParagraph::NO_FOOTNOTE) {
// only melt margins // only melt margins
if(owner->view()->text->cursor.par()->footnotekind == LyXParagraph::MARGIN) if (owner->view()->text->cursor.par()->footnotekind == LyXParagraph::MARGIN)
Melt(owner->view()); Melt(owner->view());
} else } else
Margin(owner->view()); Margin(owner->view());
@ -1567,7 +1432,7 @@ string const LyXFunc::Dispatch(int ac,
{ {
LyXText * tmptext = owner->view()->text; LyXText * tmptext = owner->view()->text;
bool is_rtl = tmptext->cursor.par()->isRightToLeftPar(owner->buffer()->params); bool is_rtl = tmptext->cursor.par()->isRightToLeftPar(owner->buffer()->params);
if(!tmptext->mark_set) if (!tmptext->mark_set)
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR); owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (is_rtl) if (is_rtl)
@ -1596,7 +1461,7 @@ string const LyXFunc::Dispatch(int ac,
// it simpler? (Lgb) // it simpler? (Lgb)
LyXText * txt = owner->view()->text; LyXText * txt = owner->view()->text;
bool is_rtl = txt->cursor.par()->isRightToLeftPar(owner->buffer()->params); bool is_rtl = txt->cursor.par()->isRightToLeftPar(owner->buffer()->params);
if(!txt->mark_set) owner->view()->beforeChange(); if (!txt->mark_set) owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR); owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
LyXCursor cur = txt->cursor; LyXCursor cur = txt->cursor;
if (!is_rtl) if (!is_rtl)
@ -1631,7 +1496,7 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_UP: case LFUN_UP:
if(!owner->view()->text->mark_set) owner->view()->beforeChange(); if (!owner->view()->text->mark_set) owner->view()->beforeChange();
owner->view()->update(BufferView::UPDATE); owner->view()->update(BufferView::UPDATE);
owner->view()->text->CursorUp(owner->view()); owner->view()->text->CursorUp(owner->view());
owner->view()->text->FinishUndo(); owner->view()->text->FinishUndo();
@ -1640,7 +1505,7 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_DOWN: case LFUN_DOWN:
if(!owner->view()->text->mark_set) if (!owner->view()->text->mark_set)
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::UPDATE); owner->view()->update(BufferView::UPDATE);
owner->view()->text->CursorDown(owner->view()); owner->view()->text->CursorDown(owner->view());
@ -1650,7 +1515,7 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_UP_PARAGRAPH: case LFUN_UP_PARAGRAPH:
if(!owner->view()->text->mark_set) if (!owner->view()->text->mark_set)
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::UPDATE); owner->view()->update(BufferView::UPDATE);
owner->view()->text->CursorUpParagraph(owner->view()); owner->view()->text->CursorUpParagraph(owner->view());
@ -1660,7 +1525,7 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_DOWN_PARAGRAPH: case LFUN_DOWN_PARAGRAPH:
if(!owner->view()->text->mark_set) if (!owner->view()->text->mark_set)
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::UPDATE); owner->view()->update(BufferView::UPDATE);
owner->view()->text->CursorDownParagraph(owner->view()); owner->view()->text->CursorDownParagraph(owner->view());
@ -1670,7 +1535,7 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_PRIOR: case LFUN_PRIOR:
if(!text->mark_set) if (!text->mark_set)
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::UPDATE); owner->view()->update(BufferView::UPDATE);
owner->view()->cursorPrevious(text); owner->view()->cursorPrevious(text);
@ -1683,7 +1548,7 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_NEXT: case LFUN_NEXT:
if(!text->mark_set) if (!text->mark_set)
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::UPDATE); owner->view()->update(BufferView::UPDATE);
owner->view()->cursorNext(text); owner->view()->cursorNext(text);
@ -1696,7 +1561,7 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_HOME: case LFUN_HOME:
if(!owner->view()->text->mark_set) if (!owner->view()->text->mark_set)
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR); owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorHome(owner->view()); owner->view()->text->CursorHome(owner->view());
@ -1706,7 +1571,7 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_END: case LFUN_END:
if(!owner->view()->text->mark_set) if (!owner->view()->text->mark_set)
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR); owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorEnd(owner->view()); owner->view()->text->CursorEnd(owner->view());
@ -1717,7 +1582,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_SHIFT_TAB: case LFUN_SHIFT_TAB:
case LFUN_TAB: case LFUN_TAB:
if(!owner->view()->text->mark_set) if (!owner->view()->text->mark_set)
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR); owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorTab(owner->view()); owner->view()->text->CursorTab(owner->view());
@ -1727,7 +1592,7 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_WORDRIGHT: case LFUN_WORDRIGHT:
if(!text->mark_set) if (!text->mark_set)
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR); owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) if (text->cursor.par()->isRightToLeftPar(owner->buffer()->params))
@ -1742,7 +1607,7 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_WORDLEFT: case LFUN_WORDLEFT:
if(!text->mark_set) if (!text->mark_set)
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR); owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (text->cursor.par()->isRightToLeftPar(owner->buffer()->params)) if (text->cursor.par()->isRightToLeftPar(owner->buffer()->params))
@ -1757,7 +1622,7 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_BEGINNINGBUF: case LFUN_BEGINNINGBUF:
if(!owner->view()->text->mark_set) if (!owner->view()->text->mark_set)
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR); owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorTop(owner->view()); owner->view()->text->CursorTop(owner->view());
@ -1767,7 +1632,7 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_ENDBUF: case LFUN_ENDBUF:
if(!owner->view()->text->mark_set) if (!owner->view()->text->mark_set)
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR); owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorBottom(owner->view()); owner->view()->text->CursorBottom(owner->view());
@ -1933,7 +1798,7 @@ string const LyXFunc::Dispatch(int ac,
break; break;
case LFUN_SETMARK: case LFUN_SETMARK:
if(text->mark_set) { if (text->mark_set) {
owner->view()->beforeChange(); owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR); owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
setMessage(N_("Mark removed")); setMessage(N_("Mark removed"));
@ -2385,7 +2250,7 @@ string const LyXFunc::Dispatch(int ac,
{ {
LyXParagraph::size_type pos = LyXParagraph::size_type pos =
owner->view()->text->cursor.pos(); owner->view()->text->cursor.pos();
if(pos < owner->view()->text->cursor.par()->size()) if (pos < owner->view()->text->cursor.par()->size())
//dispatch_buffer = owner->view()->text-> //dispatch_buffer = owner->view()->text->
// cursor.par()->text[pos]; // cursor.par()->text[pos];
dispatch_buffer = dispatch_buffer =
@ -2419,9 +2284,9 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_GETFONT: case LFUN_GETFONT:
{ {
LyXFont & font = owner->view()->text->current_font; LyXFont & font = owner->view()->text->current_font;
if(font.shape() == LyXFont::ITALIC_SHAPE) if (font.shape() == LyXFont::ITALIC_SHAPE)
dispatch_buffer = 'E'; dispatch_buffer = 'E';
else if(font.shape() == LyXFont::SMALLCAPS_SHAPE) else if (font.shape() == LyXFont::SMALLCAPS_SHAPE)
dispatch_buffer = 'N'; dispatch_buffer = 'N';
else else
dispatch_buffer = '0'; dispatch_buffer = '0';
@ -2432,7 +2297,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_GETLATEX: case LFUN_GETLATEX:
{ {
LyXFont & font = owner->view()->text->current_font; LyXFont & font = owner->view()->text->current_font;
if(font.latex() == LyXFont::ON) if (font.latex() == LyXFont::ON)
dispatch_buffer = 'L'; dispatch_buffer = 'L';
else else
dispatch_buffer = '0'; dispatch_buffer = '0';
@ -2755,13 +2620,13 @@ string const LyXFunc::Dispatch(int ac,
{ {
InsetCommandParams p( "index" ); InsetCommandParams p( "index" );
if( argument.empty() ) { if (argument.empty()) {
// Get the word immediately preceding the cursor // Get the word immediately preceding the cursor
LyXParagraph::size_type curpos = LyXParagraph::size_type curpos =
owner->view()->text->cursor.pos() - 1; owner->view()->text->cursor.pos() - 1;
string curstring; string curstring;
if( curpos >= 0 ) if (curpos >= 0 )
curstring = owner->view()->text curstring = owner->view()->text
->cursor.par()->GetWord(curpos); ->cursor.par()->GetWord(curpos);
@ -2793,7 +2658,7 @@ string const LyXFunc::Dispatch(int ac,
LyXParagraph::size_type curpos = LyXParagraph::size_type curpos =
owner->view()->text->cursor.pos() - 1; owner->view()->text->cursor.pos() - 1;
// Can't do that at the beginning of a paragraph // Can't do that at the beginning of a paragraph
if( curpos < 0 ) break; if (curpos < 0 ) break;
string curstring( owner->view()->text string curstring( owner->view()->text
->cursor.par()->GetWord(curpos) ); ->cursor.par()->GetWord(curpos) );
@ -3013,7 +2878,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_UNKNOWN_ACTION: case LFUN_UNKNOWN_ACTION:
{ {
if(!owner->buffer()) { if (!owner->buffer()) {
LyXBell(); LyXBell();
setErrorMessage(N_("No document open")); setErrorMessage(N_("No document open"));
break; break;
@ -3033,7 +2898,7 @@ string const LyXFunc::Dispatch(int ac,
* "auto_region_delete", which defaults to * "auto_region_delete", which defaults to
* true (on). */ * true (on). */
if ( lyxrc.auto_region_delete ) { if (lyxrc.auto_region_delete) {
if (owner->view()->text->selection){ if (owner->view()->text->selection){
owner->view()->text->CutSelection(owner->view(), false); owner->view()->text->CutSelection(owner->view(), false);
owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE); owner->view()->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
@ -3144,7 +3009,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
// Check if the document already is open // Check if the document already is open
if (bufferlist.exists(s)) { if (bufferlist.exists(s)) {
switch(AskConfirmation(_("Document is already open:"), switch (AskConfirmation(_("Document is already open:"),
MakeDisplayPath(s, 50), MakeDisplayPath(s, 50),
_("Do you want to close that document now?\n" _("Do you want to close that document now?\n"
"('No' will just switch to the open version)"))) "('No' will just switch to the open version)")))
@ -3307,7 +3172,7 @@ void LyXFunc::doImport(string const & argument)
// Check if the document already is open // Check if the document already is open
if (bufferlist.exists(lyxfile)) { if (bufferlist.exists(lyxfile)) {
switch(AskConfirmation(_("Document is already open:"), switch (AskConfirmation(_("Document is already open:"),
MakeDisplayPath(lyxfile, 50), MakeDisplayPath(lyxfile, 50),
_("Do you want to close that document now?\n" _("Do you want to close that document now?\n"
"('No' will just switch to the open version)"))) "('No' will just switch to the open version)")))

View File

@ -49,13 +49,9 @@ public:
/// Same again but for xtl buffers. Still looking for better idea. /// Same again but for xtl buffers. Still looking for better idea.
bool Dispatch(int action, auto_mem_buffer &); bool Dispatch(int action, auto_mem_buffer &);
#if 0
/// A keyboard event is processed to execute a lyx action.
int processKeyEvent(XEvent * ev);
#else
/// ///
int processKeySym(KeySym k, unsigned int state); int processKeySym(KeySym k, unsigned int state);
#endif
/// ///
func_status getStatus(int ac) const; func_status getStatus(int ac) const;

View File

@ -53,7 +53,7 @@ void LyXLex::Pimpl::printError(string const & message) const
void LyXLex::Pimpl::printTable(ostream & os) void LyXLex::Pimpl::printTable(ostream & os)
{ {
os << "\nNumber of tags: " << no_items << '\n'; os << "\nNumber of tags: " << no_items << '\n';
for(int i= 0; i < no_items; ++i) for (int i= 0; i < no_items; ++i)
os << "table[" << i os << "table[" << i
<< "]: tag: `" << table[i].tag << "]: tag: `" << table[i].tag
<< "' code:" << table[i].code << '\n'; << "' code:" << table[i].code << '\n';

View File

@ -180,7 +180,7 @@ int LyXLookupString(XEvent * event,
result = XmbLookupString(xic, &event->xkey, buffer_return, result = XmbLookupString(xic, &event->xkey, buffer_return,
bytes_buffer, keysym_return, bytes_buffer, keysym_return,
&status_return); &status_return);
switch(status_return) { switch (status_return) {
case XBufferOverflow: case XBufferOverflow:
lyxerr[Debug::KEY] << "XBufferOverflow" << endl; lyxerr[Debug::KEY] << "XBufferOverflow" << endl;
break; break;

View File

@ -285,7 +285,7 @@ int LyXRC::read(string const & filename)
// compiler. // compiler.
int le = lexrc.lex(); int le = lexrc.lex();
switch(le) { switch (le) {
case LyXLex::LEX_UNDEF: case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown tag `$$Token'"); lexrc.printError("Unknown tag `$$Token'");
continue; continue;
@ -849,7 +849,7 @@ int LyXRC::read(string const & filename)
break; break;
case RC_NEW_ASK_FILENAME: case RC_NEW_ASK_FILENAME:
if ( lexrc.next()) if (lexrc.next())
new_ask_filename = lexrc.GetBool(); new_ask_filename = lexrc.GetBool();
break; break;
case RC_CONVERTER: { case RC_CONVERTER: {
@ -888,7 +888,7 @@ int LyXRC::read(string const & filename)
break; break;
} }
case RC_DEFAULT_LANGUAGE: case RC_DEFAULT_LANGUAGE:
if ( lexrc.next()) if (lexrc.next())
default_language = lexrc.GetString(); default_language = lexrc.GetString();
break; break;
@ -938,7 +938,7 @@ void LyXRC::output(ostream & os) const
// The nice thing is that we will get a warning from the compiler // The nice thing is that we will get a warning from the compiler
// if we forget an element. // if we forget an element.
LyXRCTags tag = RC_LAST; LyXRCTags tag = RC_LAST;
switch(tag) { switch (tag) {
case RC_LAST: case RC_LAST:
case RC_INPUT: case RC_INPUT:
// input/include files are not done here // input/include files are not done here
@ -1495,7 +1495,7 @@ string LyXRC::getDescription(LyXRCTags tag)
{ {
string str; string str;
switch( tag ) { switch (tag) {
case RC_FONT_ENCODING: case RC_FONT_ENCODING:
str = N_("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages."); str = N_("The font encoding used for the LaTeX2e fontenc package. T1 is highly recommended for non-English languages.");
break; break;

View File

@ -72,7 +72,7 @@ using std::endl;
// provide an empty mkfifo() if we do not have one. This disables the // provide an empty mkfifo() if we do not have one. This disables the
// lyxserver. // lyxserver.
#ifndef HAVE_MKFIFO #ifndef HAVE_MKFIFO
int mkfifo(char const * __path, mode_t __mode ) { int mkfifo(char const * __path, mode_t __mode) {
return 0; return 0;
} }
#endif #endif
@ -240,7 +240,7 @@ void LyXComm::closeConnection() {
return; return;
} }
if(infd > -1) { if (infd > -1) {
fl_remove_io_callback(infd, FL_READ, C_LyXComm_callback); fl_remove_io_callback(infd, FL_READ, C_LyXComm_callback);
string tmp = pipename + ".in"; string tmp = pipename + ".in";
@ -264,7 +264,7 @@ void LyXComm::closeConnection() {
}; };
#endif #endif
} }
if(outfd > -1) { if (outfd > -1) {
string tmp = pipename + ".out"; string tmp = pipename + ".out";
#ifdef __EMX__ #ifdef __EMX__
rc = DosDisConnectNPipe(outfd); rc = DosDisConnectNPipe(outfd);
@ -309,7 +309,7 @@ void LyXComm::callback(int fd, void *v)
// the single = is intended here. // the single = is intended here.
while((status = read(fd, charbuf, CMDBUFLEN-1))) while((status = read(fd, charbuf, CMDBUFLEN-1)))
{// break and return in loop {// break and return in loop
if(status > 0) // got something if (status > 0) // got something
{ {
charbuf[status]= '\0'; // turn it into a c string charbuf[status]= '\0'; // turn it into a c string
lsbuf += strip(charbuf, '\r'); lsbuf += strip(charbuf, '\r');
@ -325,22 +325,22 @@ void LyXComm::callback(int fd, void *v)
<< "LyXComm: status:" << status << "LyXComm: status:" << status
<< ", lsbuf:" << lsbuf << ", lsbuf:" << lsbuf
<< ", cmd:" << cmd << endl; << ", cmd:" << cmd << endl;
if(!cmd.empty()) if (!cmd.empty())
c->clientcb(c->client, cmd); c->clientcb(c->client, cmd);
//\n or not \n? //\n or not \n?
} }
} }
if(errno == EAGAIN) if (errno == EAGAIN)
{ // EAGAIN is not really an error , it means we're { // EAGAIN is not really an error , it means we're
// only reading too fast for the writing process on // only reading too fast for the writing process on
// the other end of the pipe. // the other end of the pipe.
errno = 0; errno = 0;
return; // up to libforms select-loop (*crunch*) return; // up to libforms select-loop (*crunch*)
} }
if(errno != 0 ) if (errno != 0 )
{ {
lyxerr << "LyXComm: " << strerror(errno) << endl; lyxerr << "LyXComm: " << strerror(errno) << endl;
if(!lsbuf.empty()) if (!lsbuf.empty())
{ {
lyxerr << "LyxComm: truncated command: " lyxerr << "LyxComm: truncated command: "
<< lsbuf << endl; << lsbuf << endl;
@ -434,7 +434,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
if (strncmp(p, "LYXSRV:", 7) == 0) { if (strncmp(p, "LYXSRV:", 7) == 0) {
server_only = true; server_only = true;
} else if(0!= strncmp(p, "LYXCMD:", 7)) { } else if (0!= strncmp(p, "LYXCMD:", 7)) {
lyxerr << "LyXServer: Unknown request" << endl; lyxerr << "LyXServer: Unknown request" << endl;
return; return;
} }
@ -444,8 +444,8 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
string client; string client;
while(*p && *p != ':') while(*p && *p != ':')
client += char(*p++); client += char(*p++);
if(*p == ':') ++p; if (*p == ':') ++p;
if(!*p) return; if (!*p) return;
// --- 3. get function name --- // --- 3. get function name ---
string cmd; string cmd;
@ -454,10 +454,10 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
// --- 4. parse the argument --- // --- 4. parse the argument ---
string arg; string arg;
if(!server_only && *p == ':' && *(++p)) { if (!server_only && *p == ':' && *(++p)) {
while(*p && *p != '\n') while(*p && *p != '\n')
arg += char(*p++); arg += char(*p++);
if(*p) ++p; if (*p) ++p;
} }
lyxerr[Debug::LYXSERVER] lyxerr[Debug::LYXSERVER]
@ -473,7 +473,7 @@ void LyXServer::callback(LyXServer * serv, string const & msg)
// we are listening. // we are listening.
if (cmd == "hello") { if (cmd == "hello") {
// One more client // One more client
if(serv->numclients == MAX_CLIENTS){ //paranoid check if (serv->numclients == MAX_CLIENTS){ //paranoid check
lyxerr[Debug::LYXSERVER] lyxerr[Debug::LYXSERVER]
<< "LyXServer: too many clients..." << "LyXServer: too many clients..."
<< endl; << endl;

View File

@ -1011,7 +1011,7 @@ InsetFormula::LocalDispatch(BufferView * bv,
if (lf[1]) { if (lf[1]) {
l = in_word_set(lf, strlen(lf)); l = in_word_set(lf, strlen(lf));
// Long words will cause l == 0; so check. // Long words will cause l == 0; so check.
if(l) ilf = l->id; if (l) ilf = l->id;
} else } else
if (vdelim.find(lf[0]) != string::npos) if (vdelim.find(lf[0]) != string::npos)
ilf = lf[0]; ilf = lf[0];
@ -1022,7 +1022,7 @@ InsetFormula::LocalDispatch(BufferView * bv,
else else
if (rg[1]) { if (rg[1]) {
l = in_word_set(rg, strlen(rg)); l = in_word_set(rg, strlen(rg));
if(l) irg = l->id; if (l) irg = l->id;
} else } else
if (vdelim.find(rg[0]) != string::npos) if (vdelim.find(rg[0]) != string::npos)
irg = rg[0]; irg = rg[0];
@ -1274,7 +1274,7 @@ void mathedValidate(LaTeXFeatures & features, MathParInset * par)
while (it.OK() && !(features.binom && features.boldsymbol)) { while (it.OK() && !(features.binom && features.boldsymbol)) {
if (it.IsInset()) { if (it.IsInset()) {
if(it.IsActive()) { if (it.IsActive()) {
MathParInset * p = it.GetActiveInset(); MathParInset * p = it.GetActiveInset();
if (!features.binom && p->GetType() == LM_OT_MACRO && if (!features.binom && p->GetType() == LM_OT_MACRO &&
p->GetName() == "binom") { p->GetName() == "binom") {

View File

@ -43,7 +43,7 @@ void my_memcpy( void * ps_in, const void * pt_in, size_t n )
char * ps = static_cast<char *>(ps_in); char * ps = static_cast<char *>(ps_in);
char const * pt = static_cast<char const *>(pt_in); char const * pt = static_cast<char const *>(pt_in);
/* /*
for(size_t i = n; i--;) for (size_t i = n; i--;)
*ps++ = *pt++; *ps++ = *pt++;
*/ */
while (n--) *ps++ = *pt++; while (n--) *ps++ = *pt++;

View File

@ -235,12 +235,12 @@ int peek_event(FL_FORM * /*form*/, void *xev)
if (BitmapMenu::active == 0) if (BitmapMenu::active == 0)
return 0; return 0;
if(static_cast<XEvent *>(xev)->type == ButtonPress) if (static_cast<XEvent *>(xev)->type == ButtonPress)
{ {
BitmapMenu::active->Hide(); BitmapMenu::active->Hide();
return 1; return 1;
} }
if(static_cast<XEvent *>(xev)->type == KeyPress) if (static_cast<XEvent *>(xev)->type == KeyPress)
{ {
char c[5]; char c[5];
KeySym keysym; KeySym keysym;

View File

@ -239,7 +239,7 @@ void MathParInset::Write(ostream & os, bool fragile)
os << '}'; os << '}';
data.Next(); data.Next();
} else } else
switch(cx) { switch (cx) {
case LM_TC_TAB: case LM_TC_TAB:
{ {
os << " & "; os << " & ";

View File

@ -1805,7 +1805,7 @@ int LyXParagraph::GetEndLabel(BufferParams const & bparams) const
if (endlabeltype != END_LABEL_NO_LABEL) { if (endlabeltype != END_LABEL_NO_LABEL) {
LyXParagraph const * last = this; LyXParagraph const * last = this;
#ifndef NEW_INSETS #ifndef NEW_INSETS
if( footnoteflag == NO_FOOTNOTE) if (footnoteflag == NO_FOOTNOTE)
last = LastPhysicalPar(); last = LastPhysicalPar();
else if (next->footnoteflag == NO_FOOTNOTE) else if (next->footnoteflag == NO_FOOTNOTE)
return endlabeltype; return endlabeltype;
@ -2315,7 +2315,7 @@ LyXParagraph * LyXParagraph::TeXOnePar(Buffer const * buf,
? GetFontSettings(bparams, ? GetFontSettings(bparams,
size()-1).isRightToLeft() size()-1).isRightToLeft()
: language->RightToLeft(); : language->RightToLeft();
if ( (p = NextAfterFootnote()) != 0 && if ((p = NextAfterFootnote()) != 0 &&
p->size() > 0 && p->size() > 0 &&
p->GetFontSettings(bparams, 0).isRightToLeft() != is_rtl) p->GetFontSettings(bparams, 0).isRightToLeft() != is_rtl)
is_rtl = getParLanguage(bparams)->RightToLeft(); is_rtl = getParLanguage(bparams)->RightToLeft();
@ -2922,7 +2922,7 @@ void LyXParagraph::SimpleTeXSpecialChars(Buffer const * buf,
} }
// Otherwise, we use what LaTeX // Otherwise, we use what LaTeX
// provides us. // provides us.
switch(c) { switch (c) {
case '<': case '<':
os << "\\textless{}"; os << "\\textless{}";
column += 10; column += 10;
@ -3169,7 +3169,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(Buffer const * buf,
texrow.newline(); texrow.newline();
} }
os << "\\begin{minipage}"; os << "\\begin{minipage}";
switch(pextra_alignment) { switch (pextra_alignment) {
case MINIPAGE_ALIGN_TOP: case MINIPAGE_ALIGN_TOP:
os << "[t]"; os << "[t]";
break; break;
@ -3308,7 +3308,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(Buffer const * buf,
texrow.newline(); texrow.newline();
} }
os << "\\begin{minipage}"; os << "\\begin{minipage}";
switch(par->pextra_alignment) { switch (par->pextra_alignment) {
case MINIPAGE_ALIGN_TOP: case MINIPAGE_ALIGN_TOP:
os << "[t]"; os << "[t]";
break; break;
@ -3842,7 +3842,7 @@ bool LyXParagraph::IsLetter(LyXParagraph::size_type pos) const
if (IsLetterChar(c)) if (IsLetterChar(c))
return true; return true;
// '\0' is not a letter, allthough every string contains "" (below) // '\0' is not a letter, allthough every string contains "" (below)
if( c == '\0') if (c == '\0')
return false; return false;
// We want to pass the ' and escape chars to ispell // We want to pass the ' and escape chars to ispell
string extra = lyxrc.isp_esc_chars + '\''; string extra = lyxrc.isp_esc_chars + '\'';
@ -3892,7 +3892,7 @@ bool LyXParagraph::isRightToLeftPar(BufferParams const & bparams) const
void LyXParagraph::ChangeLanguage(BufferParams const & bparams, void LyXParagraph::ChangeLanguage(BufferParams const & bparams,
Language const * from, Language const * to) Language const * from, Language const * to)
{ {
for(size_type i = 0; i < size(); ++i) { for (size_type i = 0; i < size(); ++i) {
LyXFont font = GetFontSettings(bparams, i); LyXFont font = GetFontSettings(bparams, i);
if (font.language() == from) { if (font.language() == from) {
font.setLanguage(to); font.setLanguage(to);

View File

@ -126,9 +126,8 @@ void LyXScreen::DrawOneRow(LyXText * text, Row * row, int y_text,
{ {
int y = y_text - text->first + y_offset; int y = y_text - text->first + y_offset;
if (((y+row->height()) > 0) && if (((y + row->height()) > 0) &&
((y-row->height()) <= (int)owner.height())) ((y - row->height()) <= static_cast<int>(owner.height()))) {
{
// ok there is something visible // ok there is something visible
LyXText::text_status st = text->status; LyXText::text_status st = text->status;
do { do {
@ -221,16 +220,16 @@ bool LyXScreen::FitManualCursor(LyXText * text,
{ {
int newtop = text->first; int newtop = text->first;
if (y + desc - text->first >= (int)owner.height()) if (y + desc - text->first >= static_cast<int>(owner.height()))
newtop = y - 3 * owner.height() / 4; // the scroll region must be so big!! newtop = y - 3 * owner.height() / 4; // the scroll region must be so big!!
else if (y - asc < (int)text->first else if (y - asc < static_cast<int>(text->first)
&& text->first > 0) { && text->first > 0) {
newtop = y - owner.height() / 4; newtop = y - owner.height() / 4;
} }
newtop = max(newtop, 0); // can newtop ever be < 0? (Lgb) newtop = max(newtop, 0); // can newtop ever be < 0? (Lgb)
if (newtop != (int)text->first) { if (newtop != static_cast<int>(text->first)) {
Draw(text, newtop); Draw(text, newtop);
text->first = newtop; text->first = newtop;
return true; return true;
@ -243,7 +242,7 @@ void LyXScreen::ShowManualCursor(LyXText const * text, int x, int y,
int asc, int desc, Cursor_Shape shape) int asc, int desc, Cursor_Shape shape)
{ {
int y1 = max(y - text->first - asc, 0); int y1 = max(y - text->first - asc, 0);
int y2 = min(y - text->first + desc, (int)owner.height()); int y2 = min(y - text->first + desc, static_cast<int>(owner.height()));
// Secure against very strange situations // Secure against very strange situations
y2 = max(y2, y1); y2 = max(y2, y1);
@ -253,11 +252,11 @@ void LyXScreen::ShowManualCursor(LyXText const * text, int x, int y,
cursor_pixmap = 0; cursor_pixmap = 0;
} }
if ((y2 > 0) && (y1 < int(owner.height()))) { if (y2 > 0 && y1 < int(owner.height())) {
cursor_pixmap_h = y2 - y1 + 1; cursor_pixmap_h = y2 - y1 + 1;
cursor_pixmap_y = y1; cursor_pixmap_y = y1;
switch(shape) { switch (shape) {
case BAR_SHAPE: case BAR_SHAPE:
cursor_pixmap_w = 1; cursor_pixmap_w = 1;
cursor_pixmap_x = x; cursor_pixmap_x = x;
@ -294,7 +293,7 @@ void LyXScreen::ShowManualCursor(LyXText const * text, int x, int y,
y1 + owner.ypos(), y1 + owner.ypos(),
x + owner.xpos(), x + owner.xpos(),
y2 + owner.ypos()); y2 + owner.ypos());
switch(shape) { switch (shape) {
case BAR_SHAPE: case BAR_SHAPE:
break; break;
case L_SHAPE: case L_SHAPE:
@ -358,7 +357,7 @@ unsigned int LyXScreen::TopCursorVisible(LyXText const * text)
else else
newtop = text->cursor.y() newtop = text->cursor.y()
- 3 * owner.height() / 4; /* the scroll region must be so big!! */ - 3 * owner.height() / 4; /* the scroll region must be so big!! */
} else if ((int)(text->cursor.y() - text->cursor.row()->baseline()) < } else if (static_cast<int>((text->cursor.y()) - text->cursor.row()->baseline()) <
text->first && text->first > 0) text->first && text->first > 0)
{ {
if (text->cursor.row()->height() < owner.height() if (text->cursor.row()->height() < owner.height()
@ -391,7 +390,7 @@ bool LyXScreen::FitCursor(LyXText * text)
void LyXScreen::Update(LyXText * text, int y_offset, int x_offset) void LyXScreen::Update(LyXText * text, int y_offset, int x_offset)
{ {
switch(text->status) { switch (text->status) {
case LyXText::NEED_MORE_REFRESH: case LyXText::NEED_MORE_REFRESH:
{ {
int y = max(int(text->refresh_y - text->first), 0); int y = max(int(text->refresh_y - text->first), 0);
@ -425,14 +424,15 @@ void LyXScreen::ToggleSelection(LyXText * text, bool kill_selection,
// only if there is a selection // only if there is a selection
if (!text->selection) return; if (!text->selection) return;
int bottom = min(max((int)(text->sel_end_cursor.y() int bottom = min(max(static_cast<int>(text->sel_end_cursor.y()
- text->sel_end_cursor.row()->baseline() - text->sel_end_cursor.row()->baseline()
+ text->sel_end_cursor.row()->height()), text->first), + text->sel_end_cursor.row()->height()),
(int)(text->first + owner.height())); text->first),
int top = min(max((int)(text->sel_start_cursor.y() - static_cast<int>(text->first + owner.height()));
int top = min(max(static_cast<int>(text->sel_start_cursor.y() -
text->sel_start_cursor.row()->baseline()), text->sel_start_cursor.row()->baseline()),
text->first), text->first),
(int)(text->first + owner.height())); static_cast<int>(text->first + owner.height()));
if (kill_selection) if (kill_selection)
text->selection = 0; text->selection = 0;
@ -456,8 +456,10 @@ void LyXScreen::ToggleToggle(LyXText * text, int y_offset, int x_offset)
- text->toggle_end_cursor.row()->baseline() - text->toggle_end_cursor.row()->baseline()
+ text->toggle_end_cursor.row()->height(); + text->toggle_end_cursor.row()->height();
bottom = min(max(bottom, text->first), (int)(text->first + owner.height())); bottom = min(max(bottom, text->first),
top = min(max(top, text->first), (int)(text->first + owner.height())); static_cast<int>(text->first + owner.height()));
top = min(max(top, text->first),
static_cast<int>(text->first + owner.height()));
DrawFromTo(text, top - text->first, bottom - text->first, y_offset, DrawFromTo(text, top - text->first, bottom - text->first, y_offset,
x_offset); x_offset);

View File

@ -301,7 +301,7 @@ void init_spell_checker(BufferParams const & params, string const & lang)
isp_pid = -1; isp_pid = -1;
if(pipe(pipein) == -1 || pipe(pipeout) == -1) { if (pipe(pipein) == -1 || pipe(pipeout) == -1) {
lyxerr << "LyX: Can't create pipe for spellchecker!" << endl; lyxerr << "LyX: Can't create pipe for spellchecker!" << endl;
goto END; goto END;
} }
@ -324,13 +324,13 @@ void init_spell_checker(BufferParams const & params, string const & lang)
isp_pid = fork(); isp_pid = fork();
if(isp_pid == -1) { if (isp_pid == -1) {
lyxerr << "LyX: Can't create child process for spellchecker!" lyxerr << "LyX: Can't create child process for spellchecker!"
<< endl; << endl;
goto END; goto END;
} }
if(isp_pid == 0) { if (isp_pid == 0) {
/* child process */ /* child process */
dup2(pipein[0], STDIN_FILENO); dup2(pipein[0], STDIN_FILENO);
dup2(pipeout[1], STDOUT_FILENO); dup2(pipeout[1], STDOUT_FILENO);
@ -584,7 +584,7 @@ void sc_accept_word(string const & word)
static inline static inline
void sc_store_replacement(string const & mis, string const & cor) { void sc_store_replacement(string const & mis, string const & cor) {
if(actual_spell_checker == ASC_ASPELL) { if (actual_spell_checker == ASC_ASPELL) {
::fputs("$$ra ", out); ::fputs("$$ra ", out);
::fputs(mis.c_str(), out); ::fputs(mis.c_str(), out);
::fputc(',', out); ::fputc(',', out);
@ -840,7 +840,7 @@ bool RunSpellChecker(BufferView * bv)
// Update slider if and only if value has changed // Update slider if and only if value has changed
newvalue = int(100.0*newval); newvalue = int(100.0*newval);
if(newvalue!= oldval) { if (newvalue!= oldval) {
oldval = newvalue; oldval = newvalue;
fl_set_slider_value(fd_form_spell_check->slider, oldval); fl_set_slider_value(fd_form_spell_check->slider, oldval);
} }
@ -946,7 +946,7 @@ bool RunSpellChecker(BufferView * bv)
} }
} }
if(sc_still_alive()) { if (sc_still_alive()) {
close_spell_checker(); close_spell_checker();
string word_msg(tostr(word_count)); string word_msg(tostr(word_count));
if (word_count != 1) { if (word_count != 1) {

View File

@ -373,7 +373,7 @@ bool FileInfo::isSocket() const
// should not be in FileInfo // should not be in FileInfo
bool FileInfo::access(int p) bool FileInfo::access(int p) const
{ {
// if we don't have a filename we fail // if we don't have a filename we fail
if (fname.empty()) return false; if (fname.empty()) return false;

View File

@ -21,12 +21,12 @@
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <boost/utility.hpp>
#include "LString.h" #include "LString.h"
/** Use objects of this class to get information about files. /** Use objects of this class to get information about files.
*/ */
class FileInfo { class FileInfo : public noncopyable {
public: public:
/// ///
FileInfo(); FileInfo();
@ -101,15 +101,15 @@ public:
eperm = F_OK eperm = F_OK
}; };
/// Test whether the current user has a given set of permissions /// Test whether the current user has a given set of permissions
bool access(int p); bool access(int p) const;
/// Is the file writable for the current user? /// Is the file writable for the current user?
bool writable() { return access(FileInfo::wperm); } bool writable() const { return access(FileInfo::wperm); }
/// Is the file readable for the current user? /// Is the file readable for the current user?
bool readable() { return access(FileInfo::rperm); } bool readable() const { return access(FileInfo::rperm); }
/// Is the file executable for the current user? /// Is the file executable for the current user?
bool executable() { return access(FileInfo::xperm); } bool executable() const { return access(FileInfo::xperm); }
/// Does the file exist? /// Does the file exist?
bool exist() { return access(FileInfo::eperm); } bool exist() const { return access(FileInfo::eperm); }
/// ///
bool isLink() const; bool isLink() const;
/// ///

View File

@ -546,7 +546,7 @@ string const MakeAbsPath(string const & RelPath, string const & BasePath)
// checks for already absolute path // checks for already absolute path
if (AbsolutePath(RelPath)) if (AbsolutePath(RelPath))
#ifdef __EMX__ #ifdef __EMX__
if(RelPath[0]!= '/' && RelPath[0]!= '\\') if (RelPath[0]!= '/' && RelPath[0]!= '\\')
#endif #endif
return RelPath; return RelPath;

View File

@ -88,7 +88,7 @@ bool isStrInt(string const & str)
if (tmpstr.empty()) return false; if (tmpstr.empty()) return false;
string::const_iterator cit = tmpstr.begin(); string::const_iterator cit = tmpstr.begin();
if ( (*cit) == '-') ++cit; if ((*cit) == '-') ++cit;
string::const_iterator end = tmpstr.end(); string::const_iterator end = tmpstr.end();
for (; cit != end; ++cit) { for (; cit != end; ++cit) {
if (!isdigit((*cit))) return false; if (!isdigit((*cit))) return false;
@ -121,7 +121,7 @@ bool isStrDbl(string const & str)
string::const_iterator cit = tmpstr.begin(); string::const_iterator cit = tmpstr.begin();
bool found_dot(false); bool found_dot(false);
if ( (*cit) == '-') ++cit; if ((*cit) == '-') ++cit;
string::const_iterator end = tmpstr.end(); string::const_iterator end = tmpstr.end();
for (; cit != end; ++cit) { for (; cit != end; ++cit) {
if (!isdigit((*cit)) if (!isdigit((*cit))
@ -427,7 +427,7 @@ string const subst(string const & a, char oldchar, char newchar)
string tmp(a); string tmp(a);
string::iterator lit = tmp.begin(); string::iterator lit = tmp.begin();
string::iterator end = tmp.end(); string::iterator end = tmp.end();
for(; lit != end; ++lit) for (; lit != end; ++lit)
if ((*lit) == oldchar) if ((*lit) == oldchar)
(*lit) = newchar; (*lit) = newchar;
return tmp; return tmp;

View File

@ -1055,7 +1055,7 @@ lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
if (!n) return npos; if (!n) return npos;
for (size_type t = i; t < rep->sz; ++t) { for (size_type t = i; t < rep->sz; ++t) {
if(memchr(ptr, rep->s[t], n) != 0) return t; if (memchr(ptr, rep->s[t], n) != 0) return t;
} }
return npos; return npos;
} }
@ -1109,7 +1109,7 @@ lyxstring::size_type lyxstring::find_last_of(value_type const * ptr,
size_type ii = min(rep->sz - 1, i); size_type ii = min(rep->sz - 1, i);
for (int t = ii; t >= 0; --t) { for (int t = ii; t >= 0; --t) {
if(memchr(ptr, rep->s[t], n) != 0) return t; if (memchr(ptr, rep->s[t], n) != 0) return t;
} }
return npos; return npos;
} }
@ -1165,7 +1165,7 @@ lyxstring::size_type lyxstring::find_first_not_of(value_type const * ptr,
if (!n) return (i < rep->sz) ? i : npos; if (!n) return (i < rep->sz) ? i : npos;
for (size_type t = i; t < rep->sz; ++t) { for (size_type t = i; t < rep->sz; ++t) {
if(memchr(ptr, rep->s[t], n) == 0) return t; if (memchr(ptr, rep->s[t], n) == 0) return t;
} }
return npos; return npos;
} }
@ -1222,7 +1222,7 @@ lyxstring::size_type lyxstring::find_last_not_of(value_type const * ptr,
size_type ii = min(rep->sz - 1, i); size_type ii = min(rep->sz - 1, i);
for (int t = ii; t >= 0; --t) { for (int t = ii; t >= 0; --t) {
if(memchr(ptr, rep->s[t], n) == 0) return t; if (memchr(ptr, rep->s[t], n) == 0) return t;
} }
return npos; return npos;
} }

View File

@ -691,7 +691,7 @@ int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
/* Actually it uses 0x prefix even for a zero value. */ /* Actually it uses 0x prefix even for a zero value. */
&& long_arg != 0 && long_arg != 0
#endif #endif
) { tmp[str_arg_l++] = '0'; tmp[str_arg_l++] = 'x'; } ) { tmp[str_arg_l++] = '0'; tmp[str_arg_l++] = 'x'; }
#endif #endif
} }
zero_padding_insertion_ind = str_arg_l; zero_padding_insertion_ind = str_arg_l;
@ -703,7 +703,7 @@ int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
* converting a zero value with a precision of zero is a null string. * converting a zero value with a precision of zero is a null string.
* Actually it returns all zeroes. */ * Actually it returns all zeroes. */
#endif #endif
) { /* converted to null string */ } ) { /* converted to null string */ }
else { else {
char f[5]; int f_l = 0; char f[5]; int f_l = 0;
f[f_l++] = '%'; f[f_l++] = '%';
@ -736,7 +736,7 @@ int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
&& !(zero_padding_insertion_ind < str_arg_l && !(zero_padding_insertion_ind < str_arg_l
&& tmp[zero_padding_insertion_ind] == '0') && tmp[zero_padding_insertion_ind] == '0')
#endif #endif
) { /* assure leading zero for alternative-form octal numbers */ ) { /* assure leading zero for alternative-form octal numbers */
if (!precision_specified || precision < num_of_digits+1) if (!precision_specified || precision < num_of_digits+1)
{ precision = num_of_digits+1; precision_specified = 1; } { precision = num_of_digits+1; precision_specified = 1; }
} }

View File

@ -135,8 +135,8 @@ LyXTabular * LyXTabular::Clone(InsetTabular * inset)
LyXTabular * result = new LyXTabular(inset, *this); LyXTabular * result = new LyXTabular(inset, *this);
// don't know if this is good but I need to Clone also // don't know if this is good but I need to Clone also
// the text-insets here, this is for the Undo-facility! // the text-insets here, this is for the Undo-facility!
for(int i = 0; i < rows_; ++i) { for (int i = 0; i < rows_; ++i) {
for(int j = 0; j < columns_; ++j) { for (int j = 0; j < columns_; ++j) {
result->cell_info[i][j].inset = cell_info[i][j].inset; result->cell_info[i][j].inset = cell_info[i][j].inset;
result->cell_info[i][j].inset.setOwner(inset); result->cell_info[i][j].inset.setOwner(inset);
} }
@ -201,13 +201,13 @@ void LyXTabular::AppendRow(int cell)
cell_vvector c_info = cell_vvector(rows_, cell_vector(columns_, cell_vvector c_info = cell_vvector(rows_, cell_vector(columns_,
cellstruct())); cellstruct()));
for(int i = 0; i <= row; ++i) { for (int i = 0; i <= row; ++i) {
for(int j = 0; j < columns_; ++j) { for (int j = 0; j < columns_; ++j) {
c_info[i][j] = cell_info[i][j]; c_info[i][j] = cell_info[i][j];
} }
} }
for(int i = row + 1; i < rows_; ++i) { for (int i = row + 1; i < rows_; ++i) {
for(int j = 0; j < columns_; ++j) { for (int j = 0; j < columns_; ++j) {
c_info[i][j] = cell_info[i-1][j]; c_info[i][j] = cell_info[i-1][j];
} }
} }
@ -307,10 +307,7 @@ void LyXTabular::Reinit()
void LyXTabular::set_row_column_number_info(bool oldformat) void LyXTabular::set_row_column_number_info(bool oldformat)
{ {
//int c = 0;
//int column = 0;
numberofcells = -1; numberofcells = -1;
//int row = 0;
for (int row = 0; row < rows_; ++row) { for (int row = 0; row < rows_; ++row) {
for (int column = 0; column<columns_; ++column) { for (int column = 0; column<columns_; ++column) {
if (cell_info[row][column].multicolumn if (cell_info[row][column].multicolumn
@ -415,7 +412,7 @@ bool LyXTabular::BottomLine(int cell, bool onlycolumn) const
// no bottom line underneath non-existent cells if you please // no bottom line underneath non-existent cells if you please
// Isn't that a programming error? Is so this should // Isn't that a programming error? Is so this should
// be an Assert instead. (Lgb) // be an Assert instead. (Lgb)
if(cell >= numberofcells) if (cell >= numberofcells)
return false; return false;
if (!onlycolumn && IsMultiColumn(cell)) if (!onlycolumn && IsMultiColumn(cell))
@ -586,7 +583,7 @@ void LyXTabular::recalculateMulticolCells(int cell, int new_width)
int i = column1; int i = column1;
for (; i <= column2; ++i) for (; i <= column2; ++i)
cell_info[row][i].width_of_cell = 0; cell_info[row][i].width_of_cell = 0;
for(i = cell + 1; (i < numberofcells) && (!IsMultiColumn(i)); ++i) for (i = cell + 1; (i < numberofcells) && (!IsMultiColumn(i)); ++i)
; ;
if (i < numberofcells) if (i < numberofcells)
recalculateMulticolCells(i, GetWidthOfCell(i) - (2 * WIDTH_OF_LINE)); recalculateMulticolCells(i, GetWidthOfCell(i) - (2 * WIDTH_OF_LINE));
@ -616,13 +613,13 @@ bool LyXTabular::SetWidthOfCell(int cell, int new_width)
} }
if (tmp) { if (tmp) {
int i = 0; int i = 0;
for(; i<columns_; ++i) for (; i<columns_; ++i)
calculate_width_of_column_NMC(i); calculate_width_of_column_NMC(i);
for(i = 0; (i < numberofcells) && !IsMultiColumn(i); ++i) for (i = 0; (i < numberofcells) && !IsMultiColumn(i); ++i)
; ;
if (i < numberofcells) if (i < numberofcells)
recalculateMulticolCells(i, GetWidthOfCell(i)-(2 * WIDTH_OF_LINE)); recalculateMulticolCells(i, GetWidthOfCell(i)-(2 * WIDTH_OF_LINE));
for(i = 0; i < columns_; ++i) for (i = 0; i < columns_; ++i)
calculate_width_of_column(i); calculate_width_of_column(i);
calculate_width_of_tabular(); calculate_width_of_tabular();
return true; return true;
@ -659,7 +656,7 @@ bool LyXTabular::SetColumnPWidth(int cell, string const & width)
column_info[j].p_width = width; column_info[j].p_width = width;
if (flag) // do this only if there is a width if (flag) // do this only if there is a width
SetAlignment(cell, LYX_ALIGN_LEFT); SetAlignment(cell, LYX_ALIGN_LEFT);
for(int i = 0; i < rows_; ++i) { for (int i = 0; i < rows_; ++i) {
int c = GetCellNumber(i, j); int c = GetCellNumber(i, j);
flag = !GetPWidth(c).empty(); // because of multicolumns! flag = !GetPWidth(c).empty(); // because of multicolumns!
GetCellInset(c)->SetAutoBreakRows(flag); GetCellInset(c)->SetAutoBreakRows(flag);
@ -960,7 +957,7 @@ string const write_attribute(string const & name, string const & value)
string const write_attribute(string const & name, bool value) string const write_attribute(string const & name, bool value)
{ {
string str = " " + name + "=\"" + tostr((int)value) + "\""; string str = " " + name + "=\"" + tostr(static_cast<int>(value)) + "\"";
return str; return str;
} }
#endif #endif
@ -1175,7 +1172,7 @@ void LyXTabular::Read(Buffer const * buf, LyXLex & lex)
getTokenValue(line, "endfoot", endfoot); getTokenValue(line, "endfoot", endfoot);
getTokenValue(line, "endlastfoot", endlastfoot); getTokenValue(line, "endlastfoot", endlastfoot);
for(int i = 0; i < rows_; ++i) { for (int i = 0; i < rows_; ++i) {
l_getline(is, line); l_getline(is, line);
if (!prefixIs(line, "<Row ")) { if (!prefixIs(line, "<Row ")) {
lyxerr << "Wrong tabular format (expected <Row ...> got" << lyxerr << "Wrong tabular format (expected <Row ...> got" <<
@ -1433,7 +1430,7 @@ void LyXTabular::OldFormatRead(LyXLex & lex, string const & fl)
InsetText * inset = GetCellInset(cell); InsetText * inset = GetCellInset(cell);
int row; int row;
for(int i = 0; i < par->Last(); ++i) { for (int i = 0; i < par->Last(); ++i) {
if (par->IsNewline(i)) { if (par->IsNewline(i)) {
++cell; ++cell;
if (cell > GetNumberOfCells()) { if (cell > GetNumberOfCells()) {
@ -1947,7 +1944,7 @@ int LyXTabular::GetHeightOfTabular() const
{ {
int height = 0; int height = 0;
for(int row = 0; row < rows_; ++row) for (int row = 0; row < rows_; ++row)
height += GetAscentOfRow(row) + GetDescentOfRow(row) + height += GetAscentOfRow(row) + GetDescentOfRow(row) +
GetAdditionalHeight(GetCellNumber(row, 0)); GetAdditionalHeight(GetCellNumber(row, 0));
return height; return height;
@ -2038,7 +2035,7 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const
if (LeftLine(cell)) if (LeftLine(cell))
os << '|'; os << '|';
if (!GetPWidth(cell).empty()) { if (!GetPWidth(cell).empty()) {
switch(GetVAlignment(cell)) { switch (GetVAlignment(cell)) {
case LYX_VALIGN_TOP: case LYX_VALIGN_TOP:
os << "p"; os << "p";
break; break;
@ -2073,7 +2070,7 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const
} }
if (GetUsebox(cell) == BOX_PARBOX) { if (GetUsebox(cell) == BOX_PARBOX) {
os << "\\parbox["; os << "\\parbox[";
switch(GetVAlignment(cell)) { switch (GetVAlignment(cell)) {
case LYX_VALIGN_TOP: case LYX_VALIGN_TOP:
os << "t"; os << "t";
break; break;
@ -2087,7 +2084,7 @@ int LyXTabular::TeXCellPreamble(ostream & os, int cell) const
os << "]{" << GetPWidth(cell) << "}{"; os << "]{" << GetPWidth(cell) << "}{";
} else if (GetUsebox(cell) == BOX_MINIPAGE) { } else if (GetUsebox(cell) == BOX_MINIPAGE) {
os << "\\begin{minipage}["; os << "\\begin{minipage}[";
switch(GetVAlignment(cell)) { switch (GetVAlignment(cell)) {
case LYX_VALIGN_TOP: case LYX_VALIGN_TOP:
os << "t"; os << "t";
break; break;
@ -2151,7 +2148,7 @@ int LyXTabular::Latex(Buffer const * buf,
if (!column_info[i].align_special.empty()) { if (!column_info[i].align_special.empty()) {
os << column_info[i].align_special; os << column_info[i].align_special;
} else if (!column_info[i].p_width.empty()) { } else if (!column_info[i].p_width.empty()) {
switch(column_info[i].valignment) { switch (column_info[i].valignment) {
case LYX_VALIGN_TOP: case LYX_VALIGN_TOP:
os << "p"; os << "p";
break; break;
@ -2189,7 +2186,7 @@ int LyXTabular::Latex(Buffer const * buf,
//+--------------------------------------------------------------------- //+---------------------------------------------------------------------
//int bret; //int bret;
for(int i = 0; i < rows_; ++i) { for (int i = 0; i < rows_; ++i) {
ret += TeXTopHLine(os, i); ret += TeXTopHLine(os, i);
int bret = ret; int bret = ret;
if (IsLongTabular()) { if (IsLongTabular()) {
@ -2215,7 +2212,7 @@ int LyXTabular::Latex(Buffer const * buf,
ret += TeXBottomHLine(os, i-1); ret += TeXBottomHLine(os, i-1);
ret += TeXTopHLine(os, i); ret += TeXTopHLine(os, i);
} }
for(int j = 0; j < columns_; ++j) { for (int j = 0; j < columns_; ++j) {
if (IsPartOfMultiColumn(i,j)) if (IsPartOfMultiColumn(i,j))
continue; continue;
ret += TeXCellPreamble(os, cell); ret += TeXCellPreamble(os, cell);
@ -2307,14 +2304,14 @@ int LyXTabular::DocBook(Buffer const * buf, ostream & os) const
int cell = 0; int cell = 0;
os << "<tbody>\n"; os << "<tbody>\n";
for(int i = 0; i < rows_; ++i) { for (int i = 0; i < rows_; ++i) {
os << "<row>\n"; os << "<row>\n";
for(int j = 0; j < columns_; ++j) { for (int j = 0; j < columns_; ++j) {
if (IsPartOfMultiColumn(i, j)) if (IsPartOfMultiColumn(i, j))
continue; continue;
os << "<entry align=\""; os << "<entry align=\"";
switch(GetAlignment(cell)) { switch (GetAlignment(cell)) {
case LYX_ALIGN_LEFT: case LYX_ALIGN_LEFT:
os << "left"; os << "left";
break; break;
@ -2327,7 +2324,7 @@ int LyXTabular::DocBook(Buffer const * buf, ostream & os) const
} }
os << "\" valign=\""; os << "\" valign=\"";
switch(GetVAlignment(cell)) { switch (GetVAlignment(cell)) {
case LYX_VALIGN_TOP: case LYX_VALIGN_TOP:
os << "top"; os << "top";
break; break;
@ -2368,7 +2365,7 @@ inline
void print_n_chars(ostream & os, unsigned char ch, int n) void print_n_chars(ostream & os, unsigned char ch, int n)
{ {
#if 0 #if 0
for(int i = 0; i < n; ++i) for (int i = 0; i < n; ++i)
os << ch; os << ch;
#else #else
os << string(n, ch); os << string(n, ch);
@ -2381,9 +2378,6 @@ int LyXTabular::AsciiTopHLine(ostream & os, int row,
{ {
int const fcell = GetFirstCellInRow(row); int const fcell = GetFirstCellInRow(row);
int const n = NumberOfCellsInRow(fcell) + fcell; int const n = NumberOfCellsInRow(fcell) + fcell;
//int len;
//int column = 0;
//unsigned char ch;
#if 0 #if 0
int tmp = 0; int tmp = 0;
@ -2438,9 +2432,7 @@ int LyXTabular::AsciiBottomHLine(ostream & os, int row,
{ {
int const fcell = GetFirstCellInRow(row); int const fcell = GetFirstCellInRow(row);
int const n = NumberOfCellsInRow(fcell) + fcell; int const n = NumberOfCellsInRow(fcell) + fcell;
//int len;
//int column = 0;
//unsigned char ch;
#if 0 #if 0
int tmp = 0; int tmp = 0;
@ -2506,7 +2498,7 @@ int LyXTabular::AsciiPrintCell(Buffer const * buf, ostream & os,
len2 += clen[column] + 4; len2 += clen[column] + 4;
len2 -= len1; len2 -= len1;
switch(GetAlignment(cell)) { switch (GetAlignment(cell)) {
default: default:
case LYX_ALIGN_LEFT: case LYX_ALIGN_LEFT:
len1 = 0; len1 = 0;
@ -2521,10 +2513,10 @@ int LyXTabular::AsciiPrintCell(Buffer const * buf, ostream & os,
break; break;
} }
for(unsigned int i = 0; i < len1; ++i) for (unsigned int i = 0; i < len1; ++i)
os << " "; os << " ";
os << sstr.str(); os << sstr.str();
for(unsigned int i = 0; i < len2; ++i) for (unsigned int i = 0; i < len2; ++i)
os << " "; os << " ";
if (RightLine(cell)) if (RightLine(cell))
os << " |"; os << " |";
@ -2545,9 +2537,9 @@ int LyXTabular::Ascii(Buffer const * buf, ostream & os) const
vector<unsigned int> clen(columns_); vector<unsigned int> clen(columns_);
// first all non (real) multicolumn cells! // first all non (real) multicolumn cells!
for(int j = 0; j < columns_; ++j) { for (int j = 0; j < columns_; ++j) {
clen[j] = 0; clen[j] = 0;
for(int i = 0; i < rows_; ++i) { for (int i = 0; i < rows_; ++i) {
int cell = GetCellNumber(i, j); int cell = GetCellNumber(i, j);
if (IsMultiColumn(cell, true)) if (IsMultiColumn(cell, true))
continue; continue;
@ -2558,8 +2550,8 @@ int LyXTabular::Ascii(Buffer const * buf, ostream & os) const
} }
} }
// then all (real) multicolumn cells! // then all (real) multicolumn cells!
for(int j = 0; j < columns_; ++j) { for (int j = 0; j < columns_; ++j) {
for(int i = 0; i < rows_; ++i) { for (int i = 0; i < rows_; ++i) {
int cell = GetCellNumber(i, j); int cell = GetCellNumber(i, j);
if (!IsMultiColumn(cell, true) || IsPartOfMultiColumn(i, j)) if (!IsMultiColumn(cell, true) || IsPartOfMultiColumn(i, j))
continue; continue;
@ -2574,9 +2566,9 @@ int LyXTabular::Ascii(Buffer const * buf, ostream & os) const
} }
} }
int cell = 0; int cell = 0;
for(int i = 0; i < rows_; ++i) { for (int i = 0; i < rows_; ++i) {
AsciiTopHLine(os, i, clen); AsciiTopHLine(os, i, clen);
for(int j = 0; j < columns_; ++j) { for (int j = 0; j < columns_; ++j) {
if (IsPartOfMultiColumn(i,j)) if (IsPartOfMultiColumn(i,j))
continue; continue;
ret += AsciiPrintCell(buf, os, cell, i, j, clen); ret += AsciiPrintCell(buf, os, cell, i, j, clen);
@ -2601,7 +2593,7 @@ void LyXTabular::Validate(LaTeXFeatures & features) const
features.longtable = true; features.longtable = true;
if (NeedRotating()) if (NeedRotating())
features.rotating = true; features.rotating = true;
for(int cell = 0; cell < numberofcells; ++cell) { for (int cell = 0; cell < numberofcells; ++cell) {
if (GetVAlignment(cell) != LYX_VALIGN_TOP) if (GetVAlignment(cell) != LYX_VALIGN_TOP)
features.array = true; features.array = true;
GetCellInset(cell)->Validate(features); GetCellInset(cell)->Validate(features);
@ -2613,8 +2605,8 @@ LyXTabular::BoxType 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) { for (int i = 0; i < par->Last(); ++i) {
if (par->GetChar(i) == LyXParagraph::META_NEWLINE) if (par->GetChar(i) == LyXParagraph::META_NEWLINE)
return BOX_PARBOX; return BOX_PARBOX;
} }

View File

@ -82,7 +82,7 @@ bool TexRow::getIdFromRow(int row, int & id, int & pos) const
// same id (and where the pos is larger) // same id (and where the pos is larger)
// to avoid putting errorinsets at the // to avoid putting errorinsets at the
// same pos. // same pos.
for(; kit != end; ++kit) { for (; kit != end; ++kit) {
if (&(*kit) != &(*cit) if (&(*kit) != &(*cit)
&& (*kit).id() == (*cit).id() && (*kit).id() == (*cit).id()
&& (*kit).pos() >= (*cit).pos()) && (*kit).pos() >= (*cit).pos())
@ -108,7 +108,7 @@ void TexRow::increasePos(int id, int pos) const
{ {
RowList::iterator kit = rowlist.begin(); RowList::iterator kit = rowlist.begin();
RowList::iterator end = rowlist.end(); RowList::iterator end = rowlist.end();
for(; kit != end; ++kit) { for (; kit != end; ++kit) {
if (id == (*kit).id() if (id == (*kit).id()
&& pos < (*kit).pos()) { && pos < (*kit).pos()) {
(*kit).pos((*kit).pos() + 1); (*kit).pos((*kit).pos() + 1);

View File

@ -1027,8 +1027,8 @@ LyXText::NextBreakPoint(BufferView * bview, Row const * row, int width) const
// non-display // non-display
if (par->GetInset(i)->display() && if (par->GetInset(i)->display() &&
(layout.isCommand() || (layout.isCommand() ||
((layout.labeltype == LABEL_MANUAL) && (layout.labeltype == LABEL_MANUAL
(i < BeginningOfMainBody(bview->buffer(), par))))) { && i < BeginningOfMainBody(bview->buffer(), par)))) {
// display istn't allowd // display istn't allowd
par->GetInset(i)->display(false); par->GetInset(i)->display(false);
x += SingleWidth(bview, par, i, c); x += SingleWidth(bview, par, i, c);
@ -1633,7 +1633,7 @@ void LyXText::BreakAgain(BufferView * bview, Row * row) const
LyXParagraph::size_type z = NextBreakPoint(bview, row, workWidth(bview)); LyXParagraph::size_type z = NextBreakPoint(bview, row, workWidth(bview));
Row * tmprow = row; Row * tmprow = row;
if (z < row->par()->Last() ) { if (z < row->par()->Last()) {
if (!row->next() || (row->next() && row->next()->par() != row->par())) { if (!row->next() || (row->next() && row->next()->par() != row->par())) {
// insert a new row // insert a new row
++z; ++z;
@ -1677,7 +1677,7 @@ void LyXText::BreakAgainOneRow(BufferView * bview, Row * row)
LyXParagraph::size_type z = NextBreakPoint(bview, row, workWidth(bview)); LyXParagraph::size_type z = NextBreakPoint(bview, row, workWidth(bview));
Row * tmprow = row; Row * tmprow = row;
if (z < row->par()->Last() ) { if (z < row->par()->Last()) {
if (!row->next() if (!row->next()
|| (row->next() && row->next()->par() != row->par())) { || (row->next() && row->next()->par() != row->par())) {
/* insert a new row */ /* insert a new row */
@ -1923,7 +1923,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
(cursor.pos() == 1 || (cursor.pos() == 1 ||
cursor.par()->IsSeparator(cursor.pos() - 2) || cursor.par()->IsSeparator(cursor.pos() - 2) ||
cursor.par()->IsNewline(cursor.pos() - 2) ) cursor.par()->IsNewline(cursor.pos() - 2) )
) { ) {
SetCharFont(bview->buffer(), SetCharFont(bview->buffer(),
cursor.par(), cursor.par(),
cursor.pos() - 1, cursor.pos() - 1,
@ -2040,7 +2040,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
LyXParagraph::size_type z = NextBreakPoint(bview, LyXParagraph::size_type z = NextBreakPoint(bview,
row->previous(), row->previous(),
workWidth(bview)); workWidth(bview));
if ( z >= row->pos()) { if (z >= row->pos()) {
row->pos(z + 1); row->pos(z + 1);
// set the dimensions of the row above // set the dimensions of the row above
@ -2083,7 +2083,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
* will set fill to -1. Otherwise * will set fill to -1. Otherwise
* we would not get a rebreak! */ * we would not get a rebreak! */
row->fill(Fill(bview, row, workWidth(bview))); row->fill(Fill(bview, row, workWidth(bview)));
if (row->fill() < 0 ) { if (row->fill() < 0) {
refresh_y = y; refresh_y = y;
refresh_row = row; refresh_row = row;
refresh_x = cursor.x(); refresh_x = cursor.x();
@ -2295,7 +2295,7 @@ void LyXText::CursorRightOneWord(BufferView * bview) const
int steps = 0; int steps = 0;
// Skip through initial nonword stuff. // Skip through initial nonword stuff.
while ( tmpcursor.pos() < tmpcursor.par()->Last() && while (tmpcursor.pos() < tmpcursor.par()->Last() &&
! tmpcursor.par()->IsWord( tmpcursor.pos() ) ) ! tmpcursor.par()->IsWord( tmpcursor.pos() ) )
{ {
// printf("Current pos1 %d", tmpcursor.pos()) ; // printf("Current pos1 %d", tmpcursor.pos()) ;
@ -2303,7 +2303,7 @@ void LyXText::CursorRightOneWord(BufferView * bview) const
++steps; ++steps;
} }
// Advance through word. // Advance through word.
while ( tmpcursor.pos() < tmpcursor.par()->Last() && while (tmpcursor.pos() < tmpcursor.par()->Last() &&
tmpcursor.par()->IsWord( tmpcursor.pos() ) ) tmpcursor.par()->IsWord( tmpcursor.pos() ) )
{ {
// printf("Current pos2 %d", tmpcursor.pos()) ; // printf("Current pos2 %d", tmpcursor.pos()) ;
@ -2376,17 +2376,17 @@ void LyXText::CursorLeftOneWord(BufferView * bview) const
void LyXText::SelectWord(BufferView * bview) void LyXText::SelectWord(BufferView * bview)
{ {
// Move cursor to the beginning, when not already there. // Move cursor to the beginning, when not already there.
if ( cursor.pos() if (cursor.pos()
&& !cursor.par()->IsSeparator(cursor.pos()-1) && !cursor.par()->IsSeparator(cursor.pos()-1)
&& !cursor.par()->IsKomma(cursor.pos()-1) ) && !cursor.par()->IsKomma(cursor.pos()-1) )
CursorLeftOneWord(bview); CursorLeftOneWord(bview);
// set the sel cursor // set the sel cursor
sel_cursor = cursor; sel_cursor = cursor;
while ( cursor.pos() < cursor.par()->Last() while (cursor.pos() < cursor.par()->Last()
&& !cursor.par()->IsSeparator(cursor.pos()) && !cursor.par()->IsSeparator(cursor.pos())
&& !cursor.par()->IsKomma(cursor.pos()) ) && !cursor.par()->IsKomma(cursor.pos()) )
cursor.pos(cursor.pos() + 1); cursor.pos(cursor.pos() + 1);
SetCursor(bview, cursor.par(), cursor.pos() ); SetCursor(bview, cursor.par(), cursor.pos() );
@ -2406,7 +2406,7 @@ bool LyXText::SelectWordWhenUnderCursor(BufferView * bview)
&& !cursor.par()->IsSeparator(cursor.pos()) && !cursor.par()->IsSeparator(cursor.pos())
&& !cursor.par()->IsKomma(cursor.pos()) && !cursor.par()->IsKomma(cursor.pos())
&& !cursor.par()->IsSeparator(cursor.pos() -1) && !cursor.par()->IsSeparator(cursor.pos() -1)
&& !cursor.par()->IsKomma(cursor.pos() -1) ) { && !cursor.par()->IsKomma(cursor.pos() -1)) {
SelectWord(bview); SelectWord(bview);
return true; return true;
} }
@ -2900,7 +2900,7 @@ void LyXText::Backspace(BufferView * bview)
if (row->previous() && row->previous()->par() == row->par()) { if (row->previous() && row->previous()->par() == row->par()) {
z = NextBreakPoint(bview, row->previous(), z = NextBreakPoint(bview, row->previous(),
workWidth(bview)); workWidth(bview));
if ( z >= row->pos()) { if (z >= row->pos()) {
row->pos(z + 1); row->pos(z + 1);
Row * tmprow = row->previous(); Row * tmprow = row->previous();
@ -3015,7 +3015,9 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
/* returns a printed row */ /* returns a printed row */
Painter & pain = bview->painter(); Painter & pain = bview->painter();
bool is_rtl = row_ptr->par()->isRightToLeftPar(bview->buffer()->params); bool const is_rtl =
row_ptr->par()->isRightToLeftPar(bview->buffer()->params);
LyXParagraph::size_type last = RowLastPrintable(row_ptr); LyXParagraph::size_type last = RowLastPrintable(row_ptr);
LyXParagraph::size_type vpos, pos; LyXParagraph::size_type vpos, pos;
@ -3048,9 +3050,9 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
bool clear_area = true; bool clear_area = true;
Inset * inset = 0; Inset * inset = 0;
if (!bview->screen()->forceClear() && (last == row_ptr->pos()) && if (!bview->screen()->forceClear() && last == row_ptr->pos()
(row_ptr->par()->GetChar(row_ptr->pos()) == LyXParagraph::META_INSET) && && row_ptr->par()->GetChar(row_ptr->pos()) == LyXParagraph::META_INSET
(inset = row_ptr->par()->GetInset(row_ptr->pos()))) { && (inset = row_ptr->par()->GetInset(row_ptr->pos()))) {
clear_area = inset->doClearArea(); clear_area = inset->doClearArea();
} }
// we don't need to clear it's already done!!! // we don't need to clear it's already done!!!
@ -3128,7 +3130,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
row_ptr->height(), row_ptr->height(),
LColor::selection); LColor::selection);
} }
} else if ( sel_start_cursor.row() != row_ptr && } else if (sel_start_cursor.row() != row_ptr &&
sel_end_cursor.row() != row_ptr && sel_end_cursor.row() != row_ptr &&
y > sel_start_cursor.y() y > sel_start_cursor.y()
&& y < sel_end_cursor.y()) { && y < sel_end_cursor.y()) {
@ -3138,7 +3140,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
} else if (sel_start_cursor.row() == row_ptr || } else if (sel_start_cursor.row() == row_ptr ||
sel_end_cursor.row() == row_ptr) { sel_end_cursor.row() == row_ptr) {
float tmpx = x; float tmpx = x;
if ( (sel_start_cursor.row() != row_ptr && !is_rtl) || if ((sel_start_cursor.row() != row_ptr && !is_rtl) ||
(sel_end_cursor.row() != row_ptr && is_rtl)) (sel_end_cursor.row() != row_ptr && is_rtl))
pain.fillRectangle(x_offset, y_offset, pain.fillRectangle(x_offset, y_offset,
int(tmpx), int(tmpx),
@ -3173,7 +3175,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
} else } else
tmpx += SingleWidth(bview, row_ptr->par(), pos); tmpx += SingleWidth(bview, row_ptr->par(), pos);
if ( (sel_start_cursor.row() != row_ptr || if ((sel_start_cursor.row() != row_ptr ||
sel_start_cursor.pos() <= pos) && sel_start_cursor.pos() <= pos) &&
(sel_end_cursor.row() != row_ptr || (sel_end_cursor.row() != row_ptr ||
pos < sel_end_cursor.pos()) ) pos < sel_end_cursor.pos()) )
@ -3184,7 +3186,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
LColor::selection); LColor::selection);
} }
if ( (sel_start_cursor.row() != row_ptr && is_rtl) || if ((sel_start_cursor.row() != row_ptr && is_rtl) ||
(sel_end_cursor.row() != row_ptr && !is_rtl) ) (sel_end_cursor.row() != row_ptr && !is_rtl) )
pain.fillRectangle(x_offset + int(tmpx), pain.fillRectangle(x_offset + int(tmpx),
y_offset, y_offset,
@ -3587,11 +3589,11 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
#endif #endif
if ( if (
#ifndef NEW_INSETS #ifndef NEW_INSETS
(row_ptr->par()->ParFromPos(last + 1) == par) row_ptr->par()->ParFromPos(last + 1) == par
#else #else
(row_ptr->par() == par) row_ptr->par() == par
#endif #endif
&& (!row_ptr->next() || (row_ptr->next()->par() != row_ptr->par()))) && (!row_ptr->next() || row_ptr->next()->par() != row_ptr->par()))
{ {
/* think about the margins */ /* think about the margins */
if (!row_ptr->next() && bv_owner) if (!row_ptr->next() && bv_owner)

View File

@ -1721,7 +1721,7 @@ void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const
// entry in the marginnote and the enclosing // entry in the marginnote and the enclosing
// environment is an enum/item then correct for the // environment is an enum/item then correct for the
// LaTeX behaviour (ARRae) // LaTeX behaviour (ARRae)
if(par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE if (par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
&& par->footnotekind == LyXParagraph::MARGIN && par->footnotekind == LyXParagraph::MARGIN
&& par->Previous() && par->Previous()
&& par->Previous()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE && par->Previous()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE
@ -2663,7 +2663,7 @@ void LyXText::CheckParagraph(BufferView * bview, LyXParagraph * par,
// is there a break one row above // is there a break one row above
if (row->previous() && row->previous()->par() == row->par()) { if (row->previous() && row->previous()->par() == row->par()) {
z = NextBreakPoint(bview, row->previous(), workWidth(bview)); z = NextBreakPoint(bview, row->previous(), workWidth(bview));
if ( z >= row->pos()) { if (z >= row->pos()) {
// set the dimensions of the row above // set the dimensions of the row above
y -= row->previous()->height(); y -= row->previous()->height();
refresh_y = y; refresh_y = y;
@ -3094,7 +3094,7 @@ void LyXText::DeleteEmptyParagraphMechanism(BufferView * bview,
LyXCursor tmpcursor; LyXCursor tmpcursor;
if (old_cursor.par() != cursor.par()) { if (old_cursor.par() != cursor.par()) {
if ( (old_cursor.par()->Last() == 0 if ((old_cursor.par()->Last() == 0
|| (old_cursor.par()->Last() == 1 || (old_cursor.par()->Last() == 1
&& old_cursor.par()->IsLineSeparator(0))) && old_cursor.par()->IsLineSeparator(0)))
#ifndef NEW_INSETS #ifndef NEW_INSETS

Some files were not shown because too many files have changed in this diff Show More