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>
* 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();
it != buffer()->inset_iterator_end(); ++it) {
vector<string> labels = (*it)->getLabelList();
if ( find(labels.begin(),labels.end(),label)
if (find(labels.begin(),labels.end(),label)
!= labels.end()) {
beforeChange();
text->SetCursor(this, it.getPar(), it.getPos());

View File

@ -432,12 +432,12 @@ void BufferView::Pimpl::scrollCB(double value)
LyXText * vbt = bv_->text;
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,
bv_->text->first +
height);
} 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,
bv_->text->first +
@ -1221,11 +1221,11 @@ void BufferView::Pimpl::restorePosition()
beforeChange();
if( fname != buffer_->fileName() ) {
if (fname != buffer_->fileName()) {
Buffer * b = bufferlist.exists(fname) ?
bufferlist.getBuffer(fname) :
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);
@ -1341,7 +1341,7 @@ void BufferView::Pimpl::toggleToggle()
void BufferView::Pimpl::center()
{
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);
} else {
screen_->Draw(bv_->text, 0);

View File

@ -105,7 +105,7 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
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;
}
XQueryColors(display, colormap, cmap, vi->map_entries);
@ -114,7 +114,7 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
int closest_pixel = 0;
double closest_distance = 1e20; // we want to minimize this
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
// a three-dimensional space, the RGB color-cube,
// is used as the distance measurement between two

View File

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

View File

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

View File

@ -128,7 +128,7 @@ void FontInfo::query()
strings = new string[matches];
// We have matches. Run them through
for(int i = 0; i < matches; ++i) {
for (int i = 0; i < matches; ++i) {
string name(list[i]);
sizes[i] = lyx::atoi(token(name, '-', 7));
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()
{
// Set the textclass choice
@ -321,12 +315,6 @@ void LyXView::init()
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);
}
@ -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
void LyXView::updateWindowTitle()
{

View File

@ -133,10 +133,6 @@ private:
///
void invalidateLayoutChoice();
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
window manager. */
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_gui_misc.h lyxrc.h support/path.h support/filetools.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)\" \
-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)
: kind_(kind), label_(label), optional_(optional)
{
switch(kind) {
switch (kind) {
case Separator:
case Documents:
case Lastfiles:
@ -122,7 +122,7 @@ Menu & Menu::read(LyXLex & lex)
bool optional = false;
while (lex.IsOK() && !quit) {
switch(lex.lex()) {
switch (lex.lex()) {
case md_optitem:
optional = true;
// fallback to md_item
@ -351,7 +351,7 @@ void MenuBackend::read(LyXLex & lex)
bool menubar = false;
while (lex.IsOK() && !quit) {
switch(lex.lex()) {
switch (lex.lex()) {
case md_menubar:
menubar = true;
// fallback to md_menu
@ -436,7 +436,7 @@ void MenuBackend::defaults()
add(main_nobuffer);
if (lyxerr.debugging(Debug::GUI)) {
for(const_iterator cit = begin();
for (const_iterator cit = begin();
cit != end() ; ++cit)
lyxerr << "Menu name: " << cit->name()
<< ", 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);
char c;
int tmpx = x;
for(size_t i = 0; i < ls; ++i) {
for (size_t i = 0; i < ls; ++i) {
c = s[i];
if (islower(static_cast<unsigned char>(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);
static XChar2b c = {0, 0};
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)) {
c.byte2 = toupper(s[i].byte2);
lyxfont::XSetFont(display, gc, smallfont);

View File

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

View File

@ -118,7 +118,7 @@ void ToolbarDefaults::read(LyXLex & lex)
while (lex.IsOK() && !quit) {
switch(lex.lex()) {
switch (lex.lex()) {
case TO_ADD:
if (lex.next()) {
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 char * bdata;
if(XReadBitmapFileData(filename, &bw, &bh,
if (XReadBitmapFileData(filename, &bw, &bh,
&bdata, &xh, &yh) == BitmapSuccess)
fl_set_bmtable_data(ob, nx, ny, bw, bh, bdata);
XFlush(fl_get_display());

View File

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

View File

@ -109,7 +109,7 @@ bool BufferList::QwriteAll()
fname = MakeDisplayPath((*it)->fileName(), 50);
bool reask = true;
while(reask) {
switch(AskConfirmation(_("Changes in document:"),
switch (AskConfirmation(_("Changes in document:"),
fname,
_("Save document?"))) {
case 1: // Yes
@ -185,7 +185,7 @@ bool BufferList::close(Buffer * buf)
fname = MakeDisplayPath(buf->fileName(), 50);
bool reask = true;
while (reask) {
switch(AskConfirmation(_("Changes in document:"),
switch (AskConfirmation(_("Changes in document:"),
fname,
_("Save document?"))){
case 1: // Yes
@ -291,50 +291,6 @@ void BufferList::emergencyWrite(Buffer * buf)
buf->isUnnamed() ? OnlyFilename(buf->fileName()).c_str()
: 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:
// 1) Same place as document. Unless it is an unnamed doc.
@ -375,7 +331,6 @@ void BufferList::emergencyWrite(Buffer * buf)
return;
}
lyxerr << _(" Save failed! Bummer. Document is lost.") << endl;
#endif
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ FormIndex::~FormIndex()
FL_FORM * FormIndex::form() const
{
if ( dialog_ ) return dialog_->form;
if (dialog_ ) return dialog_->form;
return 0;
}
@ -73,7 +73,7 @@ void FormIndex::update()
{
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_->ok );
fl_set_object_lcol( dialog_->ok, FL_INACTIVE );

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -64,10 +64,6 @@ public:
int b;
RGB() : r(0), g(0), b(0) {}
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:
@ -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.
*/
@ -282,10 +278,10 @@ private:
/// Spellchecker, language stuff, etc
FD_form_outer_tab * usage_tab_;
///
FD_form_converters * converters_;
///
FD_form_colours * colours_;
///
FD_form_converters * converters_;
///
FD_form_formats * formats_;
///
FD_form_inputs_misc * inputs_misc_;
@ -315,4 +311,20 @@ private:
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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ FormUrl::~FormUrl()
FL_FORM * FormUrl::form() const
{
if ( dialog_ ) return dialog_->form;
if (dialog_ ) return dialog_->form;
return 0;
}
@ -74,12 +74,12 @@ void FormUrl::update()
fl_set_input(dialog_->url, params.getContents().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);
else
fl_set_button(dialog_->radio_html, 1);
if ( lv_->buffer()->isReadonly() ) {
if (lv_->buffer()->isReadonly()) {
fl_deactivate_object( dialog_->url );
fl_deactivate_object( dialog_->name );
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)
: 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) {
if (menu->menubar()) {
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)
{
for(ButtonList::const_iterator cit = buttonlist_.begin();
for (ButtonList::const_iterator cit = buttonlist_.begin();
cit != buttonlist_.end(); ++cit) {
if ((*cit)->item_->submenu() == name) {
MenuCallback((*cit)->obj_, 1);
@ -510,7 +510,7 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
MenuItem const & item = (*i);
string & extra_label = *it;
switch(item.kind()) {
switch (item.kind()) {
case MenuItem::Command: {
LyXFunc::func_status flag =
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);
// 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,
C_Toolbar_BubbleTimerCB,
reinterpret_cast<long>(ob));
fl_set_timer(bubble_timer, 1);
}
else if(event != FL_MOTION){
else if (event != FL_MOTION){
fl_set_timer(bubble_timer, 0);
fl_hide_oneliner();
}
@ -252,7 +252,7 @@ void ToolbarCB(FL_OBJECT * ob, long ac)
LyXView * owner = static_cast<LyXView *>(ob->u_vdata);
string res = owner->getLyXFunc()->Dispatch(int(ac));
if(!res.empty())
if (!res.empty())
lyxerr[Debug::GUI] << "ToolbarCB: Function returned: "
<< res << endl;
}
@ -349,7 +349,7 @@ void Toolbar::Pimpl::set(bool doingmain)
ToolbarList::iterator item = toollist.begin();
ToolbarList::iterator end = toollist.end();
for (; item != end; ++item) {
switch(item->action){
switch (item->action){
case ToolbarDefaults::SEPARATOR:
xpos += sepspace;
break;

View File

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

View File

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

View File

@ -14,7 +14,7 @@
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 );
}
@ -56,7 +56,7 @@ FD_form_tabbed_document * FormDocument::build_tabbed_document()
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 );
}
@ -177,7 +177,7 @@ FD_form_doc_paper * FormDocument::build_doc_paper()
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 );
}
@ -286,7 +286,7 @@ FD_form_doc_class * FormDocument::build_doc_class()
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 );
}
@ -336,7 +336,7 @@ FD_form_doc_language * FormDocument::build_doc_language()
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 );
}
@ -380,7 +380,7 @@ FD_form_doc_options * FormDocument::build_doc_options()
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 );
}

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
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 );
}
@ -136,7 +136,7 @@ FD_form_paragraph_general * FormParagraph::build_paragraph_general()
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 );
}
@ -225,7 +225,7 @@ FD_form_paragraph_extra * FormParagraph::build_paragraph_extra()
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 );
}

View File

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

View File

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

View File

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

View File

@ -12,7 +12,7 @@
FD_form_tabular::~FD_form_tabular()
{
if( form->visible ) fl_hide_form( form );
if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
@ -51,7 +51,7 @@ FD_form_tabular * FormTabular::build_tabular()
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 );
}
@ -106,7 +106,7 @@ FD_form_tabular_options * FormTabular::build_tabular_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 );
}
@ -196,7 +196,7 @@ FD_form_column_options * FormTabular::build_column_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 );
}
@ -293,7 +293,7 @@ FD_form_cell_options * FormTabular::build_cell_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 );
}

View File

@ -12,7 +12,7 @@
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 );
}

View File

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

View File

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

View File

@ -81,16 +81,16 @@ void fl_print_range_filter(FL_OBJECT * ob,
pages = split (pages, piece, ',') ;
piece = strip(piece) ;
piece = frontStrip(piece) ;
if ( !stringOnlyContains (piece, "0123456789-") ) {
if (!stringOnlyContains (piece, "0123456789-")) {
WriteAlert(_("ERROR! Unable to print!"),
_("Check 'range of pages'!"));
return;
}
if (piece.find('-') == string::npos) { // not found
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 ";
} else if (prefixIs(piece, "-") ) { // missing first page
} else if (prefixIs(piece, "-")) { // missing first page
pageflag += lyxrc.print_pagerange_flag + '1' + piece + ' ' ;
} else {
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 sout;
if( sin.empty() ) return sout;
if (sin.empty() ) return sout;
// break sin up into a vector of individual words
vector<string> sentence;
string word;
for( string::const_iterator sit = sin.begin();
sit != sin.end(); ++sit ) {
if( (*sit) == ' ' || (*sit) == '\n') {
for (string::const_iterator sit = sin.begin();
sit != sin.end(); ++sit) {
if ((*sit) == ' ' || (*sit) == '\n') {
sentence.push_back(word);
word.erase();
} else {
@ -33,17 +33,17 @@ string formatted( string const & sin, int w, int size, int style )
}
}
// Flush remaining contents of word
if( !word.empty() ) sentence.push_back(word);
if (!word.empty() ) sentence.push_back(word);
string line, l1;
for( vector<string>::const_iterator vit = sentence.begin();
vit != sentence.end(); ++vit ) {
if( !l1.empty() ) l1 += ' ';
for (vector<string>::const_iterator vit = sentence.begin();
vit != sentence.end(); ++vit) {
if (!l1.empty() ) l1 += ' ';
l1 += (*vit);
int length = fl_get_string_width(style, size, l1.c_str(),
int(l1.length()));
if( length >= w ) {
if( !sout.empty() ) sout += '\n';
if (length >= w) {
if (!sout.empty() ) sout += '\n';
sout += line;
l1 = (*vit);
}
@ -51,8 +51,8 @@ string formatted( string const & sin, int w, int size, int style )
line = l1;
}
// Flush remaining contents of line
if( !line.empty() ) {
if( !sout.empty() ) sout += '\n';
if (!line.empty()) {
if (!sout.empty() ) sout += '\n';
sout += line;
}

View File

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

View File

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

View File

@ -84,7 +84,7 @@ InsetBibKey::InsetBibKey(InsetCommandParams const & p)
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->u_vdata == &holder)
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
// holder.view->buffer() as this code is used by both
// InsetBibKey and InsetBibtex! Ughhhhhhh!!!!
if(!current_view->buffer()->isReadonly()) {
if (!current_view->buffer()->isReadonly()) {
setContents(fl_get_input(form->key));
setOptions(fl_get_input(form->label));
// 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)
{
if(bv->buffer()->isReadonly())
if (bv->buffer()->isReadonly())
WarnReadonly(bv->buffer()->fileName());
if (!bibitem_form) {
@ -213,7 +213,7 @@ InsetBibtex::InsetBibtex(InsetCommandParams const & p)
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->u_vdata == &holder)
fl_hide_form(bibitem_form->bibitem_form);
@ -283,7 +283,7 @@ vector<pair<string, string> > const InsetBibtex::getKeys(Buffer const * buffer)
string linebuf0;
while (getline(ifs, linebuf0)) {
string linebuf = frontStrip(strip(linebuf0));
if( linebuf.empty() ) continue;
if (linebuf.empty() ) continue;
if (prefixIs(linebuf, "@")) {
linebuf = subst(linebuf, '{', '(');
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()));
}
}
} else if( !keys.empty() ) {
} else if (!keys.empty()) {
keys.back().second += linebuf + "\n";
}
}

View File

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

View File

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

View File

@ -58,7 +58,7 @@ public:
///
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; }
///

View File

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

View File

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

View File

@ -32,7 +32,7 @@ using std::ostream;
InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf)
: InsetCommand(p)
{
string fn = p.getContents();
string const fn = p.getContents();
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)
{
// Decide whether left or right
switch(c) {
switch (c) {
case ' ': case '(': case '{': case '[': case '-': case ':':
case LyXParagraph::META_HFILL:
case LyXParagraph::META_NEWLINE:
@ -272,7 +272,7 @@ int InsetQuotes::Linuxdoc(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)
os << "&ldquo;";
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)
{
// Eventually trigger dialog with button 3 not 1
if( button == 3 )
if (button == 3 )
bv->owner()->getLyXFunc()->
Dispatch(LFUN_REF_GOTO, getContents());
else if( button == 1 )
else if (button == 1 )
bv->owner()->getDialogs()->showRef( this );
}
@ -47,7 +47,7 @@ string const InsetRef::getScreenLabel() const
temp += getContents();
if(!isLatex
if (!isLatex
&& !getOptions().empty()) {
temp += "||";
temp += getOptions();
@ -59,7 +59,7 @@ string const InsetRef::getScreenLabel() const
int InsetRef::Latex(Buffer const *, ostream & os,
bool /*fragile*/, bool /*fs*/) const
{
if(getOptions().empty())
if (getOptions().empty())
os << escape(getCommand());
else {
InsetCommandParams p( getCmdName(), getContents(), "" );
@ -117,6 +117,6 @@ void InsetRef::Validate(LaTeXFeatures & features) const
{
if (getCmdName() == "vref" || getCmdName() == "vpageref")
features.varioref = true;
else if(getCmdName() == "prettyref")
else if (getCmdName() == "prettyref")
features.prettyref = true;
}

View File

@ -252,11 +252,11 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
bool dodraw;
x += ADD_TO_TABULAR_WIDTH;
if (cleared) {
for(i = 0; i < tabular->rows(); ++i) {
for (i = 0; i < tabular->rows(); ++i) {
nx = int(x);
dodraw = ((baseline + tabular->GetDescentOfRow(i)) > 0) &&
(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))
continue;
cx = nx + tabular->GetBeginningOfTextInCell(cell);
@ -276,8 +276,8 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
}
} else if (need_update == CELL) {
nx = int(x);
for(i = 0; (cell < actcell) && (i < tabular->rows()); ++i) {
for(j = 0; (cell < actcell) && (j < tabular->columns()); ++j) {
for (i = 0; (cell < actcell) && (i < tabular->rows()); ++i) {
for (j = 0; (cell < actcell) && (j < tabular->columns()); ++j) {
if (tabular->IsPartOfMultiColumn(i, j))
continue;
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_y = cursor.y();
}
switch(need_update) {
switch (need_update) {
case INIT:
case FULL:
case CELL:
@ -964,9 +964,9 @@ bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv,
InsetText * inset;
bool changed = false;
for(int i = 0; i < tabular->rows(); ++i) {
for (int i = 0; i < tabular->rows(); ++i) {
maxAsc = maxDesc = 0;
for(int j= 0; j < tabular->columns(); ++j) {
for (int j= 0; j < tabular->columns(); ++j) {
if (tabular->IsPartOfMultiColumn(i,j))
continue;
++cell;
@ -1062,7 +1062,7 @@ void InsetTabular::setPos(BufferView * bv, int x, int y) const
tabular->GetAdditionalWidth(actcell);
#warning Jürgen, can you rewrite this to _not_ use the sequencing operator. (Lgb)
#if 0
for(; !tabular->IsLastCellInRow(actcell) && (lx < x);
for (; !tabular->IsLastCellInRow(actcell) && (lx < x);
++actcell,lx += tabular->GetWidthOfColumn(actcell) +
tabular->GetAdditionalWidth(actcell - 1));
#else
@ -1089,10 +1089,10 @@ int InsetTabular::getCellXPos(int cell) const
{
int c = cell;
for(; !tabular->IsFirstCellInRow(c); --c)
for (; !tabular->IsFirstCellInRow(c); --c)
;
int lx = tabular->GetWidthOfColumn(cell);
for(; c < cell; ++c) {
for (; c < cell; ++c) {
lx += tabular->GetWidthOfColumn(c);
}
return (lx - tabular->GetWidthOfColumn(cell) + top_x);
@ -1108,7 +1108,7 @@ void InsetTabular::resetPos(BufferView * bv) const
int cell = 0;
actrow = 0;
cursor.y(0);
for(; (cell < actcell) && !tabular->IsLastRow(cell); ++cell) {
for (; (cell < actcell) && !tabular->IsLastRow(cell); ++cell) {
if (tabular->IsLastCellInRow(cell)) {
cursor.y(cursor.y() + tabular->GetDescentOfRow(actrow) +
tabular->GetAscentOfRow(actrow + 1) +
@ -1239,7 +1239,7 @@ bool InsetTabular::TabularFeatures(BufferView * bv, string const & what)
LyXTabular::Feature action = LyXTabular::LAST_ACTION;
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;
if (tmp == what.substr(0, tmp.length())) {
@ -1400,8 +1400,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
flag = false;
case LyXTabular::TOGGLE_LINE_TOP:
lineSet = !tabular->TopLine(actcell, flag);
for(i=sel_row_start; i<=sel_row_end; ++i)
for(j=sel_col_start; j<=sel_col_end; ++j)
for (i=sel_row_start; i<=sel_row_end; ++i)
for (j=sel_col_start; j<=sel_col_end; ++j)
tabular->SetTopLine(tabular->GetCellNumber(i,j),lineSet, flag);
UpdateLocal(bv, INIT, true);
break;
@ -1410,8 +1410,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
flag = false;
case LyXTabular::TOGGLE_LINE_BOTTOM:
lineSet = !tabular->BottomLine(actcell, flag);
for(i=sel_row_start; i<=sel_row_end; ++i)
for(j=sel_col_start; j<=sel_col_end; ++j)
for (i=sel_row_start; i<=sel_row_end; ++i)
for (j=sel_col_start; j<=sel_col_end; ++j)
tabular->SetBottomLine(tabular->GetCellNumber(i,j),lineSet,
flag);
UpdateLocal(bv, INIT, true);
@ -1421,8 +1421,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
flag = false;
case LyXTabular::TOGGLE_LINE_LEFT:
lineSet = !tabular->LeftLine(actcell, flag);
for(i=sel_row_start; i<=sel_row_end; ++i)
for(j=sel_col_start; j<=sel_col_end; ++j)
for (i=sel_row_start; i<=sel_row_end; ++i)
for (j=sel_col_start; j<=sel_col_end; ++j)
tabular->SetLeftLine(tabular->GetCellNumber(i,j),lineSet,
flag);
UpdateLocal(bv, INIT, true);
@ -1432,8 +1432,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
flag = false;
case LyXTabular::TOGGLE_LINE_RIGHT:
lineSet = !tabular->RightLine(actcell, flag);
for(i=sel_row_start; i<=sel_row_end; ++i)
for(j=sel_col_start; j<=sel_col_end; ++j)
for (i=sel_row_start; i<=sel_row_end; ++i)
for (j=sel_col_start; j<=sel_col_end; ++j)
tabular->SetRightLine(tabular->GetCellNumber(i,j),lineSet,
flag);
UpdateLocal(bv, INIT, true);
@ -1445,8 +1445,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
case LyXTabular::ALIGN_LEFT:
case LyXTabular::ALIGN_RIGHT:
case LyXTabular::ALIGN_CENTER:
for(i = sel_row_start; i <= sel_row_end; ++i)
for(j = sel_col_start; j <= sel_col_end; ++j)
for (i = sel_row_start; i <= sel_row_end; ++i)
for (j = sel_col_start; j <= sel_col_end; ++j)
tabular->SetAlignment(tabular->GetCellNumber(i, j), setAlign,
flag);
if (hasSelection())
@ -1461,8 +1461,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
case LyXTabular::VALIGN_TOP:
case LyXTabular::VALIGN_BOTTOM:
case LyXTabular::VALIGN_CENTER:
for(i = sel_row_start; i <= sel_row_end; ++i)
for(j = sel_col_start; j <= sel_col_end; ++j)
for (i = sel_row_start; i <= sel_row_end; ++i)
for (j = sel_col_start; j <= sel_col_end; ++j)
tabular->SetVAlignment(tabular->GetCellNumber(i, j),
setVAlign, flag);
if (hasSelection())
@ -1513,8 +1513,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
case LyXTabular::SET_ALL_LINES:
setLines = 1;
case LyXTabular::UNSET_ALL_LINES:
for(i=sel_row_start; i<=sel_row_end; ++i)
for(j=sel_col_start; j<=sel_col_end; ++j)
for (i=sel_row_start; i<=sel_row_end; ++i)
for (j=sel_col_start; j<=sel_col_end; ++j)
tabular->SetAllLines(tabular->GetCellNumber(i,j), setLines);
UpdateLocal(bv, INIT, true);
break;
@ -1533,13 +1533,13 @@ void InsetTabular::TabularFeatures(BufferView * bv,
tabular->SetRotateTabular(false);
break;
case LyXTabular::SET_ROTATE_CELL:
for(i=sel_row_start; i<=sel_row_end; ++i)
for(j=sel_col_start; j<=sel_col_end; ++j)
for (i=sel_row_start; i<=sel_row_end; ++i)
for (j=sel_col_start; j<=sel_col_end; ++j)
tabular->SetRotateCell(tabular->GetCellNumber(i,j),true);
break;
case LyXTabular::UNSET_ROTATE_CELL:
for(i = sel_row_start; i <= sel_row_end; ++i)
for(j = sel_col_start; j <= sel_col_end; ++j)
for (i = sel_row_start; i <= sel_row_end; ++i)
for (j = sel_col_start; j <= sel_col_end; ++j)
tabular->SetRotateCell(tabular->GetCellNumber(i, j), false);
break;
case LyXTabular::SET_USEBOX:
@ -1547,8 +1547,8 @@ void InsetTabular::TabularFeatures(BufferView * bv,
LyXTabular::BoxType val = LyXTabular::BoxType(strToInt(value));
if (val == tabular->GetUsebox(actcell))
val = LyXTabular::BOX_NONE;
for(i = sel_row_start; i <= sel_row_end; ++i)
for(j = sel_col_start; j <= sel_col_end; ++j)
for (i = sel_row_start; i <= sel_row_end; ++i)
for (j = sel_col_start; j <= sel_col_end; ++j)
tabular->SetUsebox(tabular->GetCellNumber(i, j), val);
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
{
InsetText * inset = tabular->GetCellInset(actcell);
int x1 = x + top_x;
int const x1 = x + top_x;
if (!cellstart(cursor.pos())) {
return (((x + top_x) < cursor.x()) &&
((x + top_x) > (cursor.x() - inset->width(bv,
LyXFont(LyXFont::ALL_SANE)))));
return ((x + top_x) < cursor.x() &&
(x + top_x) > (cursor.x() - inset->width(bv,
LyXFont(LyXFont::ALL_SANE))));
} else {
int x2 = cursor.x() + tabular->GetBeginningOfTextInCell(actcell);
return ((x1 > x2) &&
(x1 < (x2 + inset->width(bv, LyXFont(LyXFont::ALL_SANE)))));
int const x2 = cursor.x() + tabular->GetBeginningOfTextInCell(actcell);
return (x1 > x2 &&
x1 < (x2 + inset->width(bv, LyXFont(LyXFont::ALL_SANE))));
}
}
@ -1635,7 +1635,7 @@ int InsetTabular::getMaxWidth(Painter & pain,
{
int const n = tabular->GetNumberOfCells();
int cell = 0;
for(; cell < n; ++cell) {
for (; cell < n; ++cell) {
if (tabular->GetCellInset(cell) == inset)
break;
}
@ -1689,7 +1689,7 @@ LyXFunc::func_status InsetTabular::getStatus(string const & what) const
LyXFunc::func_status status = LyXFunc::OK;
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;
if (tmp == what.substr(0, tmp.length())) {
//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);
int i;
for(i=0; i < sel_row_start; ++i)
for (i=0; i < sel_row_start; ++i)
paste_tabular->DeleteRow(0);
while(paste_tabular->rows() > rows)
paste_tabular->DeleteRow(rows);
paste_tabular->SetTopLine(0, true, true);
paste_tabular->SetBottomLine(paste_tabular->GetFirstCellInRow(rows-1),
true, true);
for(i=0; i < sel_col_start; ++i)
for (i=0; i < sel_col_start; ++i)
paste_tabular->DeleteColumn(0);
while(paste_tabular->columns() > columns)
paste_tabular->DeleteColumn(columns);
@ -1959,7 +1959,7 @@ bool InsetTabular::pasteSelection(BufferView * bv)
{
if (!paste_tabular)
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)
++i;
if (tabular->GetNumberOfCells() <= i)
@ -2006,8 +2006,8 @@ bool InsetTabular::cutSelection()
//sel_cell_end = tmp;
swap(sel_cell_start, sel_cell_end);
}
for(int i = sel_row_start; i <= sel_row_end; ++i) {
for(int j = sel_col_start; j <= sel_col_end; ++j) {
for (int i = sel_row_start; i <= sel_row_end; ++i) {
for (int j = sel_col_start; j <= sel_col_end; ++j) {
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
// 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;
LyXParagraph * p = par->next;
delete par;
@ -130,7 +130,7 @@ void InsetText::clear()
{
// delete all instances of LyXText before deleting the paragraps used
// 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;
LyXParagraph * p = par->next;
delete par;
@ -177,7 +177,7 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
// delete all instances of LyXText before deleting the paragraps used
// 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;
LyXParagraph * p = par->next;
@ -644,7 +644,7 @@ void InsetText::InsetButtonPress(BufferView * bv, int x, int y, int button)
paste_internally = true;
}
TEXT(bv)->SetCursorFromCoordinates(bv, x-drawTextXOffset,
y+insetAscent);
y + insetAscent);
TEXT(bv)->sel_cursor = TEXT(bv)->cursor;
UpdateLocal(bv, CURSOR, false);
bv->owner()->setLayout(cpar(bv)->GetLayout());
@ -742,7 +742,7 @@ InsetText::LocalDispatch(BufferView * bv,
UpdateLocal(bv, CURSOR_PAR, false);
return result;
} else if (result == FINISHED) {
switch(action) {
switch (action) {
case -1:
case LFUN_RIGHT:
moveRight(bv, false);
@ -1390,7 +1390,7 @@ void InsetText::SetParagraphData(LyXParagraph *p)
{
// delete all instances of LyXText before deleting the paragraps used
// 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;
LyXParagraph * np;
@ -1509,7 +1509,7 @@ void InsetText::deleteLyXText(BufferView * bv, bool recursive) const
if (recursive) {
/// then remove all LyXText in text-insets
LyXParagraph * p = par;
for(;p;p = p->next) {
for (;p;p = p->next) {
p->deleteInsetsLyXText(bv);
}
}
@ -1572,7 +1572,7 @@ void InsetText::resizeLyXText(BufferView * bv) const
/// then resize all LyXText in text-insets
inset_x = cx(bv) - top_x + drawTextXOffset;
inset_y = cy(bv) + drawTextYOffset;
for(LyXParagraph * p = par; p; p = p->next) {
for (LyXParagraph * p = par; p; p = p->next) {
p->resizeInsetsLyXText(bv);
}
}
@ -1582,8 +1582,8 @@ void InsetText::resizeLyXText(BufferView * bv) const
void InsetText::removeNewlines()
{
for(LyXParagraph * p = par; p; p = p->next) {
for(int i = 0; i < p->Last(); ++i) {
for (LyXParagraph * p = par; p; p = p->next) {
for (int i = 0; i < p->Last(); ++i) {
if (p->GetChar(i) == LyXParagraph::META_NEWLINE)
p->Erase(i);
}

View File

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

View File

@ -28,12 +28,12 @@ void InsetUrl::Edit(BufferView * bv, int, int, unsigned int)
string const InsetUrl::getScreenLabel() const
{
string temp;
if( getCmdName() == "url" )
if (getCmdName() == "url" )
temp = _("Url: ");
else
temp = _("HtmlUrl: ");
if(!getOptions().empty())
if (!getOptions().empty())
temp += getOptions();
else
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*/)
{
unsigned int code = seq->sequence[idx];
if(code == NoSymbol) return -1;
if (code == NoSymbol) return -1;
unsigned int modmsk = seq->modifiers[idx];
@ -185,7 +185,7 @@ int kb_keymap::defkey(kb_sequence * seq, int action, int idx /*= 0*/)
<< buf
<< "' is overriding old binding..."
<< endl;
if((*it).table) {
if ((*it).table) {
delete (*it).table;
(*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,
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];
size += KB_PREALLOC;
memcpy(nseq, sequence, length * sizeof(unsigned int));
if(sequence != staticseq) delete sequence;
if (sequence != staticseq) delete sequence;
sequence = nseq;
nseq = new unsigned int[size];
memcpy(nseq, modifiers, length * sizeof(unsigned int));
if(modifiers != staticmod) delete modifiers;
if (modifiers != staticmod) delete modifiers;
modifiers = nseq;
}
modifiers[length] = mod + (nmod << 16);
sequence[length++] = key;
if(curmap)
if (curmap)
return curmap->lookup(key, mod, this);
return -1;
@ -98,16 +98,16 @@ int kb_sequence::addkey(unsigned int key,
int kb_sequence::parse(string const & s)
{
if(s.empty()) return 1;
if (s.empty()) return 1;
string::size_type i = 0;
unsigned int mod = 0, nmod = 0;
while (i < s.length()) {
if(s[i] && (s[i]) <= ' ') ++i;
if(i >= s.length()) break;
if (s[i] && (s[i]) <= ' ') ++i;
if (i >= s.length()) break;
if(s[i + 1] == '-') { // is implicit that s[i] == true
switch(s[i]) {
if (s[i + 1] == '-') { // is implicit that s[i] == true
switch (s[i]) {
case 's': case 'S':
mod |= ShiftMask;
i += 2;
@ -123,8 +123,8 @@ int kb_sequence::parse(string const & s)
default:
return i + 1;
}
} else if(s[i] == '~' && s[i + 1] && s[i + 2] == '-') {
switch(s[i + 1]) {
} else if (s[i] == '~' && s[i + 1] && s[i + 2] == '-') {
switch (s[i + 1]) {
case 's': case 'S':
nmod |= ShiftMask;
i += 3;
@ -143,11 +143,11 @@ int kb_sequence::parse(string const & s)
} else {
string tbuf;
string::size_type j = i;
for(; j < s.length() && s[j] > ' '; ++j)
for (; j < s.length() && s[j] > ' '; ++j)
tbuf += s[j]; // (!!!check bounds :-)
KeySym key = XStringToKeysym(tbuf.c_str());
if(key == NoSymbol) {
if (key == NoSymbol) {
lyxerr[Debug::KBMAP]
<< "kbmap.C: No such keysym: "
<< tbuf << endl;
@ -179,15 +179,15 @@ int kb_sequence::print(string & buf, bool when_defined) const
KeySym key;
unsigned int mod;
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];
mod = modifiers[i] & 0xffff;
printKeysym(key, mod, buf); // RVDK_PATCH_5
if(i + 1 < l) { // append a blank
if (i + 1 < l) { // append a blank
buf += ' ';
}
}
@ -243,8 +243,8 @@ void kb_sequence::delseq()
unsigned int kb_sequence::getsym() const
{
int l = length;
if(l == 0) return NoSymbol;
if(l < 0) l = -l;
if (l == 0) return NoSymbol;
if (l < 0) l = -l;
return sequence[l - 1];
}
@ -261,7 +261,7 @@ char kb_sequence::getiso() const
{
int c = getsym();
if(c > 0xff)
if (c > 0xff)
return '\0';
return c;
}

View File

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

View File

@ -657,7 +657,7 @@ LyXFont const UserFreeFont(BufferParams const & params)
LyXFont font(LyXFont::ALL_IGNORE);
int pos = fl_get_choice(fd_form_character->choice_family);
switch(pos) {
switch (pos) {
case 1: font.setFamily(LyXFont::IGNORE_FAMILY); break;
case 2: font.setFamily(LyXFont::ROMAN_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);
switch(pos) {
switch (pos) {
case 1: font.setSeries(LyXFont::IGNORE_SERIES); break;
case 2: font.setSeries(LyXFont::MEDIUM_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);
switch(pos) {
switch (pos) {
case 1: font.setShape(LyXFont::IGNORE_SHAPE); break;
case 2: font.setShape(LyXFont::UP_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);
switch(pos) {
switch (pos) {
case 1: font.setSize(LyXFont::IGNORE_SIZE); break;
case 2: font.setSize(LyXFont::SIZE_TINY); 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);
switch(pos) {
switch (pos) {
case 1: font.setEmph(LyXFont::IGNORE);
font.setUnderbar(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);
switch(pos) {
switch (pos) {
case 1: font.setColor(LColor::ignore); break;
case 2: font.setColor(LColor::none); break;
case 3: font.setColor(LColor::black); break;
@ -835,7 +835,7 @@ void FigureApplyCB(FL_OBJECT *, long)
return;
Buffer * buffer = current_view->buffer();
if(buffer->isReadonly()) // paranoia
if (buffer->isReadonly()) // paranoia
return;
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 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());
if (WidthOfScreen(scr) - 8 < width)
width = WidthOfScreen(scr) - 8;
}
// 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());
if (HeightOfScreen(scr) - 24 < height)
height = HeightOfScreen(scr) - 24;
@ -340,7 +340,7 @@ void LyXGUI::create_forms()
// build up the combox entries
combo_language2->addline(_("No change"));
combo_language2->addline(_("Reset"));
for(Languages::const_iterator cit = languages.begin();
for (Languages::const_iterator cit = languages.begin();
cit != languages.end(); ++cit) {
#ifdef DO_USE_DEFAULT_LANGUAGE
if ((*cit).second.lang() != "default")

View File

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

View File

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

View File

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

View File

@ -24,9 +24,6 @@
#endif
#include "version.h"
#if 0
#include "lyxlookup.h"
#endif
#include "kbmap.h"
#include "lyxfunc.h"
#include "bufferlist.h"
@ -217,7 +214,7 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
// implementations? (Lgb)
// This code snippet makes lyx ignore some keys. Perhaps
// 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)
return 0;
@ -232,7 +229,7 @@ int LyXFunc::processKeySym(KeySym keysym, unsigned int state)
// 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) ) {
if ((action != LFUN_CANCEL) && (action != LFUN_META_FAKE)) {
// remove Caps Lock and Mod2 as a modifiers
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
// num_bytes == 0? (Lgb)
if(keyseq.length > 1 || keyseq.length < -1) {
if (keyseq.length > 1 || keyseq.length < -1) {
string buf;
keyseq.print(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
{
kb_action action;
@ -613,6 +475,9 @@ string const LyXFunc::Dispatch(string const & s)
string const LyXFunc::Dispatch(int ac,
string const & do_not_use_this_arg)
{
lyxerr[Debug::ACTION] << "LyXFunc::Dispatch: action[" << ac
<<"] arg[" << do_not_use_this_arg << "]" << endl;
string argument;
kb_action action;
LyXText * text = 0;
@ -743,7 +608,7 @@ string const LyXFunc::Dispatch(int ac,
return string();
else {
setMessage(N_("Text mode"));
switch(action) {
switch (action) {
case LFUN_UNKNOWN_ACTION:
case LFUN_BREAKPARAGRAPH:
case LFUN_BREAKLINE:
@ -783,7 +648,7 @@ string const LyXFunc::Dispatch(int ac,
if (!text)
text = owner->view()->text;
switch(action) {
switch (action) {
// --- Misc -------------------------------------------
case LFUN_WORDFINDFORWARD :
case LFUN_WORDFINDBACKWARD : {
@ -813,7 +678,7 @@ string const LyXFunc::Dispatch(int ac,
owner->view()->text->ClearSelection();
// 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->FinishUndo();
moveCursorUpdate(false);
@ -849,7 +714,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_CANCEL: // RVDK_PATCH_5
keyseq.reset();
meta_fake_bit = 0;
if(owner->view()->available())
if (owner->view()->available())
// cancel any selection
Dispatch(LFUN_MARK_OFF);
setMessage(N_("Cancel"));
@ -971,11 +836,11 @@ string const LyXFunc::Dispatch(int ac,
{
InsetCommandParams p;
if( action == LFUN_TOCVIEW )
if (action == LFUN_TOCVIEW )
p.setCmdName( "tableofcontents" );
else if( action == LFUN_LOAVIEW )
else if (action == LFUN_LOAVIEW )
p.setCmdName( "listofalgorithms" );
else if( action == LFUN_LOFVIEW )
else if (action == LFUN_LOFVIEW )
p.setCmdName( "listoffigures" );
else
p.setCmdName( "listoftables" );
@ -991,17 +856,17 @@ string const LyXFunc::Dispatch(int ac,
{
InsetCommandParams p;
if( action == LFUN_TOC_INSERT )
if (action == LFUN_TOC_INSERT )
p.setCmdName( "tableofcontents" );
else if( action == LFUN_LOA_INSERT )
else if (action == LFUN_LOA_INSERT )
p.setCmdName( "listofalgorithms" );
else if( action == LFUN_LOF_INSERT )
else if (action == LFUN_LOF_INSERT )
p.setCmdName( "listoffigures" );
else
p.setCmdName( "listoftables" );
Inset * inset = new InsetTOC( p );
if( !owner->view()->insertInset( inset, "Standard", true ) )
if (!owner->view()->insertInset( inset, "Standard", true ) )
delete inset;
break;
}
@ -1165,7 +1030,7 @@ string const LyXFunc::Dispatch(int ac,
&& owner->view()->text->cursor.par()->footnoteflag
!= LyXParagraph::NO_FOOTNOTE)
{ // 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());
}
else
@ -1179,7 +1044,7 @@ string const LyXFunc::Dispatch(int ac,
&& owner->view()->text->cursor.par()->footnoteflag
!= LyXParagraph::NO_FOOTNOTE) {
// only melt margins
if(owner->view()->text->cursor.par()->footnotekind == LyXParagraph::MARGIN)
if (owner->view()->text->cursor.par()->footnotekind == LyXParagraph::MARGIN)
Melt(owner->view());
} else
Margin(owner->view());
@ -1567,7 +1432,7 @@ string const LyXFunc::Dispatch(int ac,
{
LyXText * tmptext = owner->view()->text;
bool is_rtl = tmptext->cursor.par()->isRightToLeftPar(owner->buffer()->params);
if(!tmptext->mark_set)
if (!tmptext->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (is_rtl)
@ -1596,7 +1461,7 @@ string const LyXFunc::Dispatch(int ac,
// it simpler? (Lgb)
LyXText * txt = owner->view()->text;
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);
LyXCursor cur = txt->cursor;
if (!is_rtl)
@ -1631,7 +1496,7 @@ string const LyXFunc::Dispatch(int ac,
break;
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()->text->CursorUp(owner->view());
owner->view()->text->FinishUndo();
@ -1640,7 +1505,7 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_DOWN:
if(!owner->view()->text->mark_set)
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::UPDATE);
owner->view()->text->CursorDown(owner->view());
@ -1650,7 +1515,7 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_UP_PARAGRAPH:
if(!owner->view()->text->mark_set)
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::UPDATE);
owner->view()->text->CursorUpParagraph(owner->view());
@ -1660,7 +1525,7 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_DOWN_PARAGRAPH:
if(!owner->view()->text->mark_set)
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::UPDATE);
owner->view()->text->CursorDownParagraph(owner->view());
@ -1670,7 +1535,7 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_PRIOR:
if(!text->mark_set)
if (!text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::UPDATE);
owner->view()->cursorPrevious(text);
@ -1683,7 +1548,7 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_NEXT:
if(!text->mark_set)
if (!text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::UPDATE);
owner->view()->cursorNext(text);
@ -1696,7 +1561,7 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_HOME:
if(!owner->view()->text->mark_set)
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorHome(owner->view());
@ -1706,7 +1571,7 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_END:
if(!owner->view()->text->mark_set)
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorEnd(owner->view());
@ -1717,7 +1582,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_SHIFT_TAB:
case LFUN_TAB:
if(!owner->view()->text->mark_set)
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorTab(owner->view());
@ -1727,7 +1592,7 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_WORDRIGHT:
if(!text->mark_set)
if (!text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (text->cursor.par()->isRightToLeftPar(owner->buffer()->params))
@ -1742,7 +1607,7 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_WORDLEFT:
if(!text->mark_set)
if (!text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
if (text->cursor.par()->isRightToLeftPar(owner->buffer()->params))
@ -1757,7 +1622,7 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_BEGINNINGBUF:
if(!owner->view()->text->mark_set)
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorTop(owner->view());
@ -1767,7 +1632,7 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_ENDBUF:
if(!owner->view()->text->mark_set)
if (!owner->view()->text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
owner->view()->text->CursorBottom(owner->view());
@ -1933,7 +1798,7 @@ string const LyXFunc::Dispatch(int ac,
break;
case LFUN_SETMARK:
if(text->mark_set) {
if (text->mark_set) {
owner->view()->beforeChange();
owner->view()->update(BufferView::SELECT|BufferView::FITCUR);
setMessage(N_("Mark removed"));
@ -2385,7 +2250,7 @@ string const LyXFunc::Dispatch(int ac,
{
LyXParagraph::size_type 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->
// cursor.par()->text[pos];
dispatch_buffer =
@ -2419,9 +2284,9 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_GETFONT:
{
LyXFont & font = owner->view()->text->current_font;
if(font.shape() == LyXFont::ITALIC_SHAPE)
if (font.shape() == LyXFont::ITALIC_SHAPE)
dispatch_buffer = 'E';
else if(font.shape() == LyXFont::SMALLCAPS_SHAPE)
else if (font.shape() == LyXFont::SMALLCAPS_SHAPE)
dispatch_buffer = 'N';
else
dispatch_buffer = '0';
@ -2432,7 +2297,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_GETLATEX:
{
LyXFont & font = owner->view()->text->current_font;
if(font.latex() == LyXFont::ON)
if (font.latex() == LyXFont::ON)
dispatch_buffer = 'L';
else
dispatch_buffer = '0';
@ -2755,13 +2620,13 @@ string const LyXFunc::Dispatch(int ac,
{
InsetCommandParams p( "index" );
if( argument.empty() ) {
if (argument.empty()) {
// Get the word immediately preceding the cursor
LyXParagraph::size_type curpos =
owner->view()->text->cursor.pos() - 1;
string curstring;
if( curpos >= 0 )
if (curpos >= 0 )
curstring = owner->view()->text
->cursor.par()->GetWord(curpos);
@ -2793,7 +2658,7 @@ string const LyXFunc::Dispatch(int ac,
LyXParagraph::size_type curpos =
owner->view()->text->cursor.pos() - 1;
// Can't do that at the beginning of a paragraph
if( curpos < 0 ) break;
if (curpos < 0 ) break;
string curstring( owner->view()->text
->cursor.par()->GetWord(curpos) );
@ -3013,7 +2878,7 @@ string const LyXFunc::Dispatch(int ac,
case LFUN_UNKNOWN_ACTION:
{
if(!owner->buffer()) {
if (!owner->buffer()) {
LyXBell();
setErrorMessage(N_("No document open"));
break;
@ -3033,7 +2898,7 @@ string const LyXFunc::Dispatch(int ac,
* "auto_region_delete", which defaults to
* true (on). */
if ( lyxrc.auto_region_delete ) {
if (lyxrc.auto_region_delete) {
if (owner->view()->text->selection){
owner->view()->text->CutSelection(owner->view(), false);
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
if (bufferlist.exists(s)) {
switch(AskConfirmation(_("Document is already open:"),
switch (AskConfirmation(_("Document is already open:"),
MakeDisplayPath(s, 50),
_("Do you want to close that document now?\n"
"('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
if (bufferlist.exists(lyxfile)) {
switch(AskConfirmation(_("Document is already open:"),
switch (AskConfirmation(_("Document is already open:"),
MakeDisplayPath(lyxfile, 50),
_("Do you want to close that document now?\n"
"('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.
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);
#endif
///
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)
{
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
<< "]: tag: `" << table[i].tag
<< "' code:" << table[i].code << '\n';

View File

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

View File

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

View File

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

View File

@ -1011,7 +1011,7 @@ InsetFormula::LocalDispatch(BufferView * bv,
if (lf[1]) {
l = in_word_set(lf, strlen(lf));
// Long words will cause l == 0; so check.
if(l) ilf = l->id;
if (l) ilf = l->id;
} else
if (vdelim.find(lf[0]) != string::npos)
ilf = lf[0];
@ -1022,7 +1022,7 @@ InsetFormula::LocalDispatch(BufferView * bv,
else
if (rg[1]) {
l = in_word_set(rg, strlen(rg));
if(l) irg = l->id;
if (l) irg = l->id;
} else
if (vdelim.find(rg[0]) != string::npos)
irg = rg[0];
@ -1274,7 +1274,7 @@ void mathedValidate(LaTeXFeatures & features, MathParInset * par)
while (it.OK() && !(features.binom && features.boldsymbol)) {
if (it.IsInset()) {
if(it.IsActive()) {
if (it.IsActive()) {
MathParInset * p = it.GetActiveInset();
if (!features.binom && p->GetType() == LM_OT_MACRO &&
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 const * pt = static_cast<char const *>(pt_in);
/*
for(size_t i = n; i--;)
for (size_t i = n; i--;)
*ps++ = *pt++;
*/
while (n--) *ps++ = *pt++;

View File

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

View File

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

View File

@ -1805,7 +1805,7 @@ int LyXParagraph::GetEndLabel(BufferParams const & bparams) const
if (endlabeltype != END_LABEL_NO_LABEL) {
LyXParagraph const * last = this;
#ifndef NEW_INSETS
if( footnoteflag == NO_FOOTNOTE)
if (footnoteflag == NO_FOOTNOTE)
last = LastPhysicalPar();
else if (next->footnoteflag == NO_FOOTNOTE)
return endlabeltype;
@ -2315,7 +2315,7 @@ LyXParagraph * LyXParagraph::TeXOnePar(Buffer const * buf,
? GetFontSettings(bparams,
size()-1).isRightToLeft()
: language->RightToLeft();
if ( (p = NextAfterFootnote()) != 0 &&
if ((p = NextAfterFootnote()) != 0 &&
p->size() > 0 &&
p->GetFontSettings(bparams, 0).isRightToLeft() != is_rtl)
is_rtl = getParLanguage(bparams)->RightToLeft();
@ -2922,7 +2922,7 @@ void LyXParagraph::SimpleTeXSpecialChars(Buffer const * buf,
}
// Otherwise, we use what LaTeX
// provides us.
switch(c) {
switch (c) {
case '<':
os << "\\textless{}";
column += 10;
@ -3169,7 +3169,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(Buffer const * buf,
texrow.newline();
}
os << "\\begin{minipage}";
switch(pextra_alignment) {
switch (pextra_alignment) {
case MINIPAGE_ALIGN_TOP:
os << "[t]";
break;
@ -3308,7 +3308,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(Buffer const * buf,
texrow.newline();
}
os << "\\begin{minipage}";
switch(par->pextra_alignment) {
switch (par->pextra_alignment) {
case MINIPAGE_ALIGN_TOP:
os << "[t]";
break;
@ -3842,7 +3842,7 @@ bool LyXParagraph::IsLetter(LyXParagraph::size_type pos) const
if (IsLetterChar(c))
return true;
// '\0' is not a letter, allthough every string contains "" (below)
if( c == '\0')
if (c == '\0')
return false;
// We want to pass the ' and escape chars to ispell
string extra = lyxrc.isp_esc_chars + '\'';
@ -3892,7 +3892,7 @@ bool LyXParagraph::isRightToLeftPar(BufferParams const & bparams) const
void LyXParagraph::ChangeLanguage(BufferParams const & bparams,
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);
if (font.language() == from) {
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;
if (((y+row->height()) > 0) &&
((y-row->height()) <= (int)owner.height()))
{
if (((y + row->height()) > 0) &&
((y - row->height()) <= static_cast<int>(owner.height()))) {
// ok there is something visible
LyXText::text_status st = text->status;
do {
@ -221,16 +220,16 @@ bool LyXScreen::FitManualCursor(LyXText * text,
{
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!!
else if (y - asc < (int)text->first
else if (y - asc < static_cast<int>(text->first)
&& text->first > 0) {
newtop = y - owner.height() / 4;
}
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);
text->first = newtop;
return true;
@ -243,7 +242,7 @@ void LyXScreen::ShowManualCursor(LyXText const * text, int x, int y,
int asc, int desc, Cursor_Shape shape)
{
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
y2 = max(y2, y1);
@ -253,11 +252,11 @@ void LyXScreen::ShowManualCursor(LyXText const * text, int x, int y,
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_y = y1;
switch(shape) {
switch (shape) {
case BAR_SHAPE:
cursor_pixmap_w = 1;
cursor_pixmap_x = x;
@ -294,7 +293,7 @@ void LyXScreen::ShowManualCursor(LyXText const * text, int x, int y,
y1 + owner.ypos(),
x + owner.xpos(),
y2 + owner.ypos());
switch(shape) {
switch (shape) {
case BAR_SHAPE:
break;
case L_SHAPE:
@ -358,7 +357,7 @@ unsigned int LyXScreen::TopCursorVisible(LyXText const * text)
else
newtop = text->cursor.y()
- 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)
{
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)
{
switch(text->status) {
switch (text->status) {
case LyXText::NEED_MORE_REFRESH:
{
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
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()->height()), text->first),
(int)(text->first + owner.height()));
int top = min(max((int)(text->sel_start_cursor.y() -
+ text->sel_end_cursor.row()->height()),
text->first),
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->first),
(int)(text->first + owner.height()));
static_cast<int>(text->first + owner.height()));
if (kill_selection)
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()->height();
bottom = min(max(bottom, text->first), (int)(text->first + owner.height()));
top = min(max(top, text->first), (int)(text->first + owner.height()));
bottom = min(max(bottom, text->first),
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,
x_offset);

View File

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

View File

@ -373,7 +373,7 @@ bool FileInfo::isSocket() const
// 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 (fname.empty()) return false;

View File

@ -21,12 +21,12 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <boost/utility.hpp>
#include "LString.h"
/** Use objects of this class to get information about files.
*/
class FileInfo {
class FileInfo : public noncopyable {
public:
///
FileInfo();
@ -101,15 +101,15 @@ public:
eperm = F_OK
};
/// 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?
bool writable() { return access(FileInfo::wperm); }
bool writable() const { return access(FileInfo::wperm); }
/// 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?
bool executable() { return access(FileInfo::xperm); }
bool executable() const { return access(FileInfo::xperm); }
/// Does the file exist?
bool exist() { return access(FileInfo::eperm); }
bool exist() const { return access(FileInfo::eperm); }
///
bool isLink() const;
///

View File

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

View File

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

View File

@ -1055,7 +1055,7 @@ lyxstring::size_type lyxstring::find_first_of(value_type const * ptr,
if (!n) return npos;
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;
}
@ -1109,7 +1109,7 @@ lyxstring::size_type lyxstring::find_last_of(value_type const * ptr,
size_type ii = min(rep->sz - 1, i);
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;
}
@ -1165,7 +1165,7 @@ lyxstring::size_type lyxstring::find_first_not_of(value_type const * ptr,
if (!n) return (i < rep->sz) ? i : npos;
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;
}
@ -1222,7 +1222,7 @@ lyxstring::size_type lyxstring::find_last_not_of(value_type const * ptr,
size_type ii = min(rep->sz - 1, i);
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;
}

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

View File

@ -1027,8 +1027,8 @@ LyXText::NextBreakPoint(BufferView * bview, Row const * row, int width) const
// non-display
if (par->GetInset(i)->display() &&
(layout.isCommand() ||
((layout.labeltype == LABEL_MANUAL) &&
(i < BeginningOfMainBody(bview->buffer(), par))))) {
(layout.labeltype == LABEL_MANUAL
&& i < BeginningOfMainBody(bview->buffer(), par)))) {
// display istn't allowd
par->GetInset(i)->display(false);
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));
Row * tmprow = row;
if (z < row->par()->Last() ) {
if (z < row->par()->Last()) {
if (!row->next() || (row->next() && row->next()->par() != row->par())) {
// insert a new row
++z;
@ -1677,7 +1677,7 @@ void LyXText::BreakAgainOneRow(BufferView * bview, Row * row)
LyXParagraph::size_type z = NextBreakPoint(bview, row, workWidth(bview));
Row * tmprow = row;
if (z < row->par()->Last() ) {
if (z < row->par()->Last()) {
if (!row->next()
|| (row->next() && row->next()->par() != row->par())) {
/* insert a new row */
@ -1923,7 +1923,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
(cursor.pos() == 1 ||
cursor.par()->IsSeparator(cursor.pos() - 2) ||
cursor.par()->IsNewline(cursor.pos() - 2) )
) {
) {
SetCharFont(bview->buffer(),
cursor.par(),
cursor.pos() - 1,
@ -2040,7 +2040,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
LyXParagraph::size_type z = NextBreakPoint(bview,
row->previous(),
workWidth(bview));
if ( z >= row->pos()) {
if (z >= row->pos()) {
row->pos(z + 1);
// set the dimensions of the row above
@ -2083,7 +2083,7 @@ void LyXText::InsertChar(BufferView * bview, char c)
* will set fill to -1. Otherwise
* we would not get a rebreak! */
row->fill(Fill(bview, row, workWidth(bview)));
if (row->fill() < 0 ) {
if (row->fill() < 0) {
refresh_y = y;
refresh_row = row;
refresh_x = cursor.x();
@ -2295,7 +2295,7 @@ void LyXText::CursorRightOneWord(BufferView * bview) const
int steps = 0;
// Skip through initial nonword stuff.
while ( tmpcursor.pos() < tmpcursor.par()->Last() &&
while (tmpcursor.pos() < tmpcursor.par()->Last() &&
! tmpcursor.par()->IsWord( tmpcursor.pos() ) )
{
// printf("Current pos1 %d", tmpcursor.pos()) ;
@ -2303,7 +2303,7 @@ void LyXText::CursorRightOneWord(BufferView * bview) const
++steps;
}
// Advance through word.
while ( tmpcursor.pos() < tmpcursor.par()->Last() &&
while (tmpcursor.pos() < tmpcursor.par()->Last() &&
tmpcursor.par()->IsWord( tmpcursor.pos() ) )
{
// printf("Current pos2 %d", tmpcursor.pos()) ;
@ -2376,17 +2376,17 @@ void LyXText::CursorLeftOneWord(BufferView * bview) const
void LyXText::SelectWord(BufferView * bview)
{
// Move cursor to the beginning, when not already there.
if ( cursor.pos()
&& !cursor.par()->IsSeparator(cursor.pos()-1)
&& !cursor.par()->IsKomma(cursor.pos()-1) )
if (cursor.pos()
&& !cursor.par()->IsSeparator(cursor.pos()-1)
&& !cursor.par()->IsKomma(cursor.pos()-1) )
CursorLeftOneWord(bview);
// set the sel cursor
sel_cursor = cursor;
while ( cursor.pos() < cursor.par()->Last()
&& !cursor.par()->IsSeparator(cursor.pos())
&& !cursor.par()->IsKomma(cursor.pos()) )
while (cursor.pos() < cursor.par()->Last()
&& !cursor.par()->IsSeparator(cursor.pos())
&& !cursor.par()->IsKomma(cursor.pos()) )
cursor.pos(cursor.pos() + 1);
SetCursor(bview, cursor.par(), cursor.pos() );
@ -2406,7 +2406,7 @@ bool LyXText::SelectWordWhenUnderCursor(BufferView * bview)
&& !cursor.par()->IsSeparator(cursor.pos())
&& !cursor.par()->IsKomma(cursor.pos())
&& !cursor.par()->IsSeparator(cursor.pos() -1)
&& !cursor.par()->IsKomma(cursor.pos() -1) ) {
&& !cursor.par()->IsKomma(cursor.pos() -1)) {
SelectWord(bview);
return true;
}
@ -2900,7 +2900,7 @@ void LyXText::Backspace(BufferView * bview)
if (row->previous() && row->previous()->par() == row->par()) {
z = NextBreakPoint(bview, row->previous(),
workWidth(bview));
if ( z >= row->pos()) {
if (z >= row->pos()) {
row->pos(z + 1);
Row * tmprow = row->previous();
@ -3015,7 +3015,9 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
/* returns a printed row */
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 vpos, pos;
@ -3048,9 +3050,9 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
bool clear_area = true;
Inset * inset = 0;
if (!bview->screen()->forceClear() && (last == row_ptr->pos()) &&
(row_ptr->par()->GetChar(row_ptr->pos()) == LyXParagraph::META_INSET) &&
(inset = row_ptr->par()->GetInset(row_ptr->pos()))) {
if (!bview->screen()->forceClear() && last == row_ptr->pos()
&& row_ptr->par()->GetChar(row_ptr->pos()) == LyXParagraph::META_INSET
&& (inset = row_ptr->par()->GetInset(row_ptr->pos()))) {
clear_area = inset->doClearArea();
}
// 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(),
LColor::selection);
}
} else if ( sel_start_cursor.row() != row_ptr &&
} else if (sel_start_cursor.row() != row_ptr &&
sel_end_cursor.row() != row_ptr &&
y > sel_start_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 ||
sel_end_cursor.row() == row_ptr) {
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))
pain.fillRectangle(x_offset, y_offset,
int(tmpx),
@ -3173,7 +3175,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
} else
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_end_cursor.row() != row_ptr ||
pos < sel_end_cursor.pos()) )
@ -3184,7 +3186,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
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) )
pain.fillRectangle(x_offset + int(tmpx),
y_offset,
@ -3587,11 +3589,11 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
#endif
if (
#ifndef NEW_INSETS
(row_ptr->par()->ParFromPos(last + 1) == par)
row_ptr->par()->ParFromPos(last + 1) == par
#else
(row_ptr->par() == par)
row_ptr->par() == par
#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 */
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
// environment is an enum/item then correct for the
// LaTeX behaviour (ARRae)
if(par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
if (par->footnoteflag == LyXParagraph::OPEN_FOOTNOTE
&& par->footnotekind == LyXParagraph::MARGIN
&& par->Previous()
&& par->Previous()->footnoteflag != LyXParagraph::OPEN_FOOTNOTE
@ -2663,7 +2663,7 @@ void LyXText::CheckParagraph(BufferView * bview, LyXParagraph * par,
// is there a break one row above
if (row->previous() && row->previous()->par() == row->par()) {
z = NextBreakPoint(bview, row->previous(), workWidth(bview));
if ( z >= row->pos()) {
if (z >= row->pos()) {
// set the dimensions of the row above
y -= row->previous()->height();
refresh_y = y;
@ -3094,7 +3094,7 @@ void LyXText::DeleteEmptyParagraphMechanism(BufferView * bview,
LyXCursor tmpcursor;
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()->IsLineSeparator(0)))
#ifndef NEW_INSETS

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