+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
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());
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 +
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);
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);
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);
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
#else
(startpar == (*endpar))
#endif
- ) {
+ ) {
// only within one paragraph
buf = new LyXParagraph;
LyXParagraph::size_type i = start;
#else
(startpar == endpar)
#endif
- ) {
+ ) {
// only within one paragraph
buf = new LyXParagraph;
LyXParagraph::size_type i = start;
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;
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;
}
-#if 0
-extern "C"
-int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev);
-#endif
-
-
void LyXView::init()
{
// Set the textclass choice
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);
}
}
-#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()
{
///
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 *);
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
string const & command, bool optional)
: kind_(kind), label_(label), optional_(optional)
{
- switch(kind) {
+ switch (kind) {
case Separator:
case Documents:
case Lastfiles:
bool optional = false;
while (lex.IsOK() && !quit) {
- switch(lex.lex()) {
+ switch (lex.lex()) {
case md_optitem:
optional = true;
// fallback to md_item
bool menubar = false;
while (lex.IsOK() && !quit) {
- switch(lex.lex()) {
+ switch (lex.lex()) {
case md_menubar:
menubar = true;
// fallback to md_menu
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()
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);
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);
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;
{
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;
string const Spacing::writeEnvirBegin() const
{
- switch(space) {
+ switch (space) {
case Default: break; // do nothing
case Single:
return "\\begin{singlespace}";
string const Spacing::writeEnvirEnd() const
{
- switch(space) {
+ switch (space) {
case Default: break; // do nothing
case Single:
return "\\end{singlespace}";
while (lex.IsOK() && !quit) {
- switch(lex.lex()) {
+ switch (lex.lex()) {
case TO_ADD:
if (lex.next()) {
func = lex.GetString();
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());
bool has_token = false;
string pretoken;
- if(!par) {
+ if (!par) {
par = new LyXParagraph;
} else {
users->text->BreakParagraph(users);
if (tmpret != LYX_LAYOUT_DEFAULT) {
InsetQuotes::quote_language tmpl =
InsetQuotes::EnglishQ;
- switch(tmpret) {
+ switch (tmpret) {
case 0:
tmpl = InsetQuotes::EnglishQ;
break;
}
} else if (token == "\\quotes_times") {
lex.nextToken();
- switch(lex.GetInteger()) {
+ switch (lex.GetInteger()) {
case 1:
params.quotes_times = InsetQuotes::SingleQ;
break;
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;
"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;
}
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 */
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;
}
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;
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;
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 */
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;
}
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;
(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;
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 =
LaTeXFeatures features(params, tclass.numLayouts());
validate(features);
- //if(nice)
+ //if (nice)
tex_code_break_column = lyxrc.ascii_linelen;
//else
//tex_code_break_column = 0;
<< 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;
// 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>";
environment_stack[depth].erase();
}
if (environment_stack[depth] != style.latexname()) {
- if(depth == 0) {
+ if (depth == 0) {
string const temp = "p";
sgmlOpenTag(ofs, depth, temp);
}
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";
ofs << "\n";
// write closing SGML tags
- switch(style.latextype) {
+ switch (style.latextype) {
case LATEX_COMMAND:
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT:
}
// 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) {
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;
}
}
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
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);
// 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);
}
// resets description flag correctly
- switch(desc_on){
+ switch (desc_on){
case 1:
// <tag> not closed...
linux_doc_line_break(os, char_line_count, 6);
LaTeXFeatures features(params, tclass.numLayouts());
validate(features);
- //if(nice)
+ //if (nice)
tex_code_break_column = lyxrc.ascii_linelen;
//else
//tex_code_break_column = 0;
texrow.reset();
- if(!only_body) {
+ if (!only_body) {
string sgml_includedfiles=features.getIncludedFiles();
ofs << "<!doctype " << top_element
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;
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]);
}
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]);
}
// 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;
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
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,
}
}
- 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;
desc_on = (style.labeltype == LABEL_MANUAL);
- if(desc_on)
+ if (desc_on)
environment_inner[depth]= "varlistentry";
else
environment_inner[depth]= "listitem";
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);
#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;
}
// 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]);
}
}
}
- 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) {
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 << ' ';
// 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, '@');
}
// resets description flag correctly
- switch(desc_on){
+ switch (desc_on){
case 1:
// <term> not closed...
os << "</term>";
{
/// then remove all LyXText in text-insets
LyXParagraph * par = paragraph;
- for(; par; par = par->next) {
+ for (; par; par = par->next) {
par->resizeInsetsLyXText(bv);
}
}
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
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
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.
return;
}
lyxerr << _(" Save failed! Bummer. Document is lost.") << endl;
-#endif
}
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];
}
<< "\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;
{
FL_OBJECT * obj;
- switch(type) {
+ switch (type) {
case FL_COMBOX_DROPLIST:
{
button = obj = fl_add_button(FL_NORMAL_BUTTON,
LFUN_ROMAN,
LFUN_NOUN,
LFUN_RIGHT,
- LFUN_LEFT,
- LFUN_UP, // 40
+ LFUN_LEFT, // 40
+ LFUN_UP,
LFUN_DOWN,
LFUN_PRIOR,
LFUN_NEXT,
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,
LFUN_PRIORSEL,
LFUN_NEXTSEL,
LFUN_HOMESEL,
- LFUN_ENDSEL,
- LFUN_WORDRIGHTSEL, // 60
+ LFUN_ENDSEL, // 60
+ LFUN_WORDRIGHTSEL,
LFUN_WORDLEFTSEL,
LFUN_BEGINNINGBUFSEL,
LFUN_ENDBUFSEL,
LFUN_DELETE,
LFUN_BACKSPACE,
LFUN_BREAKLINE,
- LFUN_BREAKPARAGRAPH,
- LFUN_BREAKPARAGRAPHKEEPLAYOUT, // 70
+ LFUN_BREAKPARAGRAPH, // 70
+ LFUN_BREAKPARAGRAPHKEEPLAYOUT,
LFUN_QUOTE,
LFUN_CIRCUMFLEX,
LFUN_GRAVE,
LFUN_CEDILLA,
LFUN_MACRON,
LFUN_UNDERBAR,
- LFUN_UNDERDOT,
- LFUN_CIRCLE, // 80
+ LFUN_UNDERDOT, // 80
+ LFUN_CIRCLE,
LFUN_TIE,
LFUN_BREVE,
LFUN_CARON,
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,
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,
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
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,
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,
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,
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
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
/** 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)
FL_FORM * FormCitation::form() const
{
- if ( dialog_ ) return dialog_->form;
+ if (dialog_ ) return dialog_->form;
return 0;
}
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);
}
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, ',') );
}
{
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());
}
void FormCitation::setCiteButtons( State status ) const
{
- switch( status ) {
+ switch (status) {
case ON:
{
fl_activate_object( dialog_->delBtn );
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 {
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 {
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
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 );
} 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 );
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
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 {
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 );
}
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,
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 ) ;
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;
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;
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];
}
FL_FORM * FormCopyright::form() const
{
- if ( dialog_ ) return dialog_->form;
+ if (dialog_ ) return dialog_->form;
return 0;
}
#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());
}
{
State cb = static_cast<State>( data );
- switch( cb ) {
+ switch (cb) {
case CHECKCHOICECLASS:
CheckChoiceClass(ob, 0);
break;
break;
}
- switch( data ) {
+ switch (data) {
case INPUT:
case CHECKCHOICECLASS:
case CHOICEBULLETSIZE:
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);
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;
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)) {
/* 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) {
FL_FORM * FormError::form() const
{
- if ( dialog_ ) return dialog_->form;
+ if (dialog_ ) return dialog_->form;
return 0;
}
FL_FORM * FormGraphics::form() const
{
- if ( dialog_ ) return dialog_->form;
+ if (dialog_ ) return dialog_->form;
return 0;
}
bool inputOK = true;
- switch( cb ) {
+ switch (cb) {
case CHECKINPUT:
inputOK = checkInput();
break;
FL_FORM * FormIndex::form() const
{
- if ( dialog_ ) return dialog_->form;
+ if (dialog_ ) return dialog_->form;
return 0;
}
{
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 );
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;
typedef pair<string, FormPreferences::RGB> X11Colour;
static vector<X11Colour> colourDB;
-static string const colourFile = "/usr/lib/X11/rgb.txt";
+static string const colourFile("/usr/lib/X11/rgb.txt");
FormPreferences::FormPreferences(LyXView * lv, Dialogs * d)
{
string str;
- if( ob->form->fdui == colours_ ) {
+ if (ob->form->fdui == colours_) {
str = feedbackColours( ob );
- } else if( ob->form->fdui == converters_ ) {
+ } else if (ob->form->fdui == converters_) {
str = feedbackConverters( ob );
- } else if( ob->form->fdui == formats_ ) {
+ } else if (ob->form->fdui == formats_) {
str = feedbackFormats( ob );
- } else if( ob->form->fdui == inputs_misc_ ) {
+ } else if (ob->form->fdui == inputs_misc_) {
str = feedbackInputsMisc( ob );
- } else if( ob->form->fdui == interface_ ) {
+ } else if (ob->form->fdui == interface_) {
str = feedbackInterface( ob );
- } else if( ob->form->fdui == language_ ) {
+ } else if (ob->form->fdui == language_) {
str = feedbackLanguage( ob );
- } else if( ob->form->fdui == lnf_misc_ ) {
+ } else if (ob->form->fdui == lnf_misc_) {
str = feedbackLnFmisc( ob );
- } else if( ob->form->fdui == outputs_misc_ ) {
+ } else if (ob->form->fdui == outputs_misc_) {
str = feedbackOutputsMisc( ob );
- } else if( ob->form->fdui == paths_ ) {
+ } else if (ob->form->fdui == paths_) {
str = feedbackPaths( ob );
- } else if( ob->form->fdui == printer_ ) {
+ } else if (ob->form->fdui == printer_) {
str = feedbackPrinter( ob );
- } else if( ob->form->fdui == screen_fonts_ ) {
+ } else if (ob->form->fdui == screen_fonts_) {
str = feedbackScreenFonts( ob );
- } else if( ob->form->fdui == spellchecker_ ) {
+ } else if (ob->form->fdui == spellchecker_) {
str = feedbackSpellChecker( ob );
}
// some totally ridiculous value somewhere. Change activate to suit.
// comments before each test describe what is _valid_
- if( ob->form->fdui == colours_ ) {
- if( ! inputColours( ob ) )
+ if (ob->form->fdui == colours_) {
+ if (! inputColours( ob ) )
activate = false;
- } else if( ob->form->fdui == language_ ) {
- if( ! inputLanguage( ob ) )
+ } else if (ob->form->fdui == language_) {
+ if (! inputLanguage( ob ) )
activate = false;
- } else if( ob->form->fdui == paths_ ) {
- if( ! inputPaths( ob ) )
+ } else if (ob->form->fdui == paths_) {
+ if (! inputPaths( ob ) )
activate = false;
- } else if( ob->form->fdui == screen_fonts_ ) {
- if( ! inputScreenFonts() )
+ } else if (ob->form->fdui == screen_fonts_) {
+ if (! inputScreenFonts() )
activate = false;
- } else if( ob->form->fdui == spellchecker_ ) {
- if( ! inputSpellChecker( ob ) )
+ } else if (ob->form->fdui == spellchecker_) {
+ if (! inputSpellChecker( ob ) )
activate = false;
}
fl_set_input_return(colours_->input_name, FL_RETURN_END_CHANGED);
- if( ColoursLoadBrowser(colourFile) )
+ if (ColoursLoadBrowser(colourFile) )
fl_set_input(colours_->input_name, colourFile.c_str());
else
fl_set_input(colours_->input_name, N_("No file found"));
}
-string FormPreferences::feedbackColours( FL_OBJECT const * const ) const
+string const FormPreferences::feedbackColours( FL_OBJECT const * const ) const
{
return string();
}
{
bool activate = true;
- if( ob == colours_->browser_x11 ) {
+ if (ob == colours_->browser_x11) {
int i = fl_get_browser(colours_->browser_x11);
- if( i > 0) {
+ if (i > 0) {
ColoursUpdateBrowser(i-1);
}
- } else if( ob == colours_->valslider_red
+ } else if (ob == colours_->valslider_red
|| ob == colours_->valslider_green
- || ob == colours_->valslider_blue ) {
+ || ob == colours_->valslider_blue) {
ColoursUpdateRGB();
- } else if( ob == colours_->input_name) {
+ } else if (ob == colours_->input_name) {
string file = fl_get_input(colours_->input_name);
- if( ColoursLoadBrowser(file) )
+ if (ColoursLoadBrowser(file) )
fl_set_input(colours_->input_name, file.c_str());
- else if( ColoursLoadBrowser(colourFile) )
+ else if (ColoursLoadBrowser(colourFile) )
fl_set_input(colours_->input_name, colourFile.c_str());
else
fl_set_input(colours_->input_name, N_("No file found"));
}
-bool FormPreferences::ColoursLoadBrowser( string const & filename )
+bool FormPreferences::ColoursLoadBrowser(string const & filename)
{
LyXLex lex(0, 0);
vector<RGB> cols;
vector<string> names;
- while( 1 ) {
+ while (true) {
getline( is, line );
- if( line.empty() )
+ if (line.empty() )
break;
- if( line[0] != '!' ) {
+ if (line[0] != '!') {
RGB col;
string name;
istringstream iss(line);
iss >> col.r >> col.g >> col.b;
- while( iss.good() ) {
+ while (iss.good()) {
string next;
iss >> next;
- if( !name.empty() ) name += " ";
+ if (!name.empty() ) name += " ";
name += next;
}
// remove redundant entries on the fly
bool add = cols.empty();
- if( !add ) {
+ if (!add) {
vector<RGB>::const_iterator it =
find( cols.begin(), cols.end(), col );
add = (it == cols.end());
}
- if ( add ) {
+ if (add) {
name = lowercase( name );
- if( name == "gray0" ) name = "black";
- if( name == "gray100" ) name = "white";
+ if (name == "gray0" ) name = "black";
+ if (name == "gray100" ) name = "white";
- if( name == "black" || name == "white" ) {
+ if (name == "black" || name == "white") {
cols.insert(cols.begin(), col);
names.insert(names.begin(), name);
} else {
}
vector<string>::iterator sit = names.begin();
- for( vector<RGB>::const_iterator iit = cols.begin();
- iit != cols.end(); ++iit, ++sit ) {
+ for (vector<RGB>::const_iterator iit = cols.begin();
+ iit != cols.end(); ++iit, ++sit) {
colourDB.push_back( X11Colour(*sit, *iit) );
}
fl_freeze_form(colours_->form);
fl_clear_browser( colbr );
- for( vector<X11Colour>::const_iterator cit = colourDB.begin();
- cit != colourDB.end(); ++cit ) {
+ for (vector<X11Colour>::const_iterator cit = colourDB.begin();
+ cit != colourDB.end(); ++cit) {
string name = (*cit).first;
//RGB col = (*cit).second;
//name += " (" + tostr(col.r) + ", " + tostr(col.g) +
}
-int FormPreferences::ColoursSearchEntry(RGB const & col ) const
+int FormPreferences::ColoursSearchEntry(RGB const & col) const
{
int mindiff = 0x7fffffff;
vector<X11Colour>::const_iterator mincit = colourDB.begin();
- for( vector<X11Colour>::const_iterator cit = colourDB.begin();
- cit != colourDB.end(); ++cit ) {
+ for (vector<X11Colour>::const_iterator cit = colourDB.begin();
+ cit != colourDB.end(); ++cit) {
RGB colDB = (*cit).second;
RGB diff;
diff.r = col.r - colDB.r;
3 * (diff.g * diff.g) +
(diff.b * diff.b));
- if( mindiff > d ) {
+ if (mindiff > d) {
mindiff = d;
mincit = cit;
}
int i = ColoursSearchEntry( col );
// change topline only if necessary
// int top = fl_get_browser_topline(colours_->browser_x11);
- // if(i < top || i > (top+15))
+ // if (i < top || i > (top+15))
fl_set_browser_topline(colours_->browser_x11, i-5);
fl_select_browser_line(colours_->browser_x11, i + 1);
void FormPreferences::updateColours()
-{
-}
+{}
void FormPreferences::applyConverters() const
-{
-}
+{}
void FormPreferences::buildConverters()
}
-string FormPreferences::feedbackConverters( FL_OBJECT const * const ) const
+string const
+FormPreferences::feedbackConverters( FL_OBJECT const * const ) const
{
return string();
}
void FormPreferences::updateConverters()
-{
-}
+{}
void FormPreferences::applyFormats() const
-{
-}
+{}
void FormPreferences::buildFormats()
}
-string FormPreferences::feedbackFormats( FL_OBJECT const * const ) const
+string const FormPreferences::feedbackFormats( FL_OBJECT const * const ) const
{
string str;
void FormPreferences::updateFormats()
-{
-}
+{}
void FormPreferences::applyInputsMisc() const
{
- lyxrc.date_insert_format = fl_get_input(inputs_misc_->input_date_format);
+ lyxrc.date_insert_format =
+ fl_get_input(inputs_misc_->input_date_format);
}
}
-string FormPreferences::feedbackInputsMisc( FL_OBJECT const * const ob ) const
+string const
+FormPreferences::feedbackInputsMisc(FL_OBJECT const * const ob) const
{
string str;
- if( ob == inputs_misc_->input_date_format )
+ if (ob == inputs_misc_->input_date_format )
str = lyxrc.getDescription( LyXRC::RC_DATE_INSERT_FORMAT );
return str;
}
-
-string FormPreferences::feedbackInterface( FL_OBJECT const * const ob ) const
+string const
+FormPreferences::feedbackInterface( FL_OBJECT const * const ob ) const
{
string str;
- if( ob == interface_->input_popup_font )
+ if (ob == interface_->input_popup_font )
str = lyxrc.getDescription( LyXRC::RC_SCREEN_FONT_POPUP );
- else if ( ob == interface_->input_menu_font )
+ else if (ob == interface_->input_menu_font )
str = lyxrc.getDescription( LyXRC::RC_SCREEN_FONT_MENU );
- else if ( ob == interface_->input_popup_encoding )
+ else if (ob == interface_->input_popup_encoding )
str = lyxrc.getDescription( LyXRC::RC_SCREEN_FONT_ENCODING_MENU );
- else if ( ob == interface_->input_bind_file )
+ else if (ob == interface_->input_bind_file )
str = lyxrc.getDescription( LyXRC::RC_BINDFILE );
- else if ( ob == interface_->input_ui_file )
+ else if (ob == interface_->input_ui_file )
str = lyxrc.getDescription( LyXRC::RC_UIFILE );
- else if ( ob == interface_->check_override_x_dead_keys )
+ else if (ob == interface_->check_override_x_dead_keys )
str = lyxrc.getDescription( LyXRC::RC_OVERRIDE_X_DEADKEYS );
return str;
int button = fl_get_button(language_->check_use_kbmap);
lyxrc.use_kbmap = static_cast<bool>(button);
- if( button ) {
+ if (button) {
lyxrc.primary_kbmap = combo_kbmap_1->getline();
lyxrc.secondary_kbmap = combo_kbmap_2->getline();
}
}
-string FormPreferences::feedbackLanguage( FL_OBJECT const * const ob ) const
+string const
+FormPreferences::feedbackLanguage(FL_OBJECT const * const ob) const
{
string str;
- if( reinterpret_cast<Combox const *>(ob) == combo_default_lang )
+ if (reinterpret_cast<Combox const *>(ob) == combo_default_lang )
str = lyxrc.getDescription( LyXRC::RC_DEFAULT_LANGUAGE );
- else if( ob == language_->check_use_kbmap )
+ else if (ob == language_->check_use_kbmap )
str = lyxrc.getDescription( LyXRC::RC_KBMAP );
- else if( reinterpret_cast<Combox const *>(ob) == combo_kbmap_1)
+ else if (reinterpret_cast<Combox const *>(ob) == combo_kbmap_1)
str = lyxrc.getDescription( LyXRC::RC_KBMAP_PRIMARY );
- else if( reinterpret_cast<Combox const *>(ob) == combo_kbmap_2 )
+ else if (reinterpret_cast<Combox const *>(ob) == combo_kbmap_2 )
str = lyxrc.getDescription( LyXRC::RC_KBMAP_SECONDARY );
- else if( ob == language_->check_rtl_support )
+ else if (ob == language_->check_rtl_support )
str = lyxrc.getDescription( LyXRC::RC_RTL_SUPPORT );
- else if( ob == language_->check_auto_begin )
+ else if (ob == language_->check_auto_begin )
str = lyxrc.getDescription( LyXRC::RC_LANGUAGE_AUTO_BEGIN );
- else if( ob == language_->check_auto_end )
+ else if (ob == language_->check_auto_end )
str = lyxrc.getDescription( LyXRC::RC_LANGUAGE_AUTO_END );
- else if( ob == language_->check_mark_foreign )
+ else if (ob == language_->check_mark_foreign )
str = lyxrc.getDescription( LyXRC::RC_MARK_FOREIGN_LANGUAGE );
- else if( ob == language_->input_package )
+ else if (ob == language_->input_package )
str = lyxrc.getDescription( LyXRC::RC_LANGUAGE_PACKAGE );
- else if( ob == language_->input_command_begin )
+ else if (ob == language_->input_command_begin )
str = lyxrc.getDescription( LyXRC::RC_LANGUAGE_COMMAND_BEGIN );
- else if( ob == language_->input_command_end )
+ else if (ob == language_->input_command_end )
str = lyxrc.getDescription( LyXRC::RC_LANGUAGE_COMMAND_END );
return str;
{
bool activate = true;
- if( !ob || ob == language_->check_use_kbmap ) {
- if( fl_get_button(language_->check_use_kbmap) ) {
+ if (!ob || ob == language_->check_use_kbmap) {
+ if (fl_get_button(language_->check_use_kbmap)) {
combo_kbmap_1->activate();
combo_kbmap_2->activate();
} else {
combo_default_lang->select_text( lyxrc.default_language );
- if( lyxrc.use_kbmap ) {
+ if (lyxrc.use_kbmap) {
combo_kbmap_1->select_text( lyxrc.primary_kbmap );
combo_kbmap_2->select_text( lyxrc.secondary_kbmap );
} else {
void FormPreferences::LanguagesAdd( Combox & combo ) const
{
- for(Languages::const_iterator cit = languages.begin();
+ for (Languages::const_iterator cit = languages.begin();
cit != languages.end(); cit++) {
combo.addto((*cit).second.lang());
}
}
-string FormPreferences::feedbackLnFmisc( FL_OBJECT const * const ob ) const
+string const FormPreferences::feedbackLnFmisc(FL_OBJECT const * const ob) const
{
string str;
- if( ob == lnf_misc_->check_banner )
+ if (ob == lnf_misc_->check_banner )
str = lyxrc.getDescription( LyXRC::RC_SHOW_BANNER );
- else if( ob == lnf_misc_->check_auto_region_delete )
+ else if (ob == lnf_misc_->check_auto_region_delete )
str = lyxrc.getDescription( LyXRC::RC_AUTOREGIONDELETE );
- else if( ob == lnf_misc_->check_exit_confirm )
+ else if (ob == lnf_misc_->check_exit_confirm )
str = lyxrc.getDescription( LyXRC::RC_EXIT_CONFIRMATION );
- else if( ob == lnf_misc_->check_display_shortcuts )
+ else if (ob == lnf_misc_->check_display_shortcuts )
str = lyxrc.getDescription( LyXRC::RC_DISPLAY_SHORTCUTS );
- else if( ob == lnf_misc_->check_ask_new_file )
+ else if (ob == lnf_misc_->check_ask_new_file )
str = lyxrc.getDescription( LyXRC::RC_NEW_ASK_FILENAME );
- else if( ob == lnf_misc_->check_cursor_follows_scrollbar )
+ else if (ob == lnf_misc_->check_cursor_follows_scrollbar )
str = lyxrc.getDescription( LyXRC::RC_CURSOR_FOLLOWS_SCROLLBAR );
- else if( ob == lnf_misc_->counter_autosave )
+ else if (ob == lnf_misc_->counter_autosave )
str = lyxrc.getDescription( LyXRC::RC_AUTOSAVE );
- else if( ob == lnf_misc_->counter_wm_jump )
+ else if (ob == lnf_misc_->counter_wm_jump )
str = lyxrc.getDescription( LyXRC::RC_WHEEL_JUMP );
return str;
}
+
void FormPreferences::updateLnFmisc()
{
fl_set_button(lnf_misc_->check_banner,
}
-string FormPreferences::feedbackOutputsMisc(FL_OBJECT const * const ob ) const
+string const
+FormPreferences::feedbackOutputsMisc(FL_OBJECT const * const ob) const
{
string str;
- if( ob == outputs_misc_->counter_line_len )
+ if (ob == outputs_misc_->counter_line_len )
str = lyxrc.getDescription( LyXRC::RC_ASCII_LINELEN );
- else if( ob == outputs_misc_->input_tex_encoding )
+ else if (ob == outputs_misc_->input_tex_encoding )
str = lyxrc.getDescription( LyXRC::RC_FONT_ENCODING );
- else if( ob == outputs_misc_->input_ascii_roff )
+ else if (ob == outputs_misc_->input_ascii_roff )
str = lyxrc.getDescription( LyXRC::RC_ASCIIROFF_COMMAND );
- else if( ob == outputs_misc_->input_checktex )
+ else if (ob == outputs_misc_->input_checktex )
str = lyxrc.getDescription( LyXRC::RC_CHKTEX_COMMAND );
- else if( ob == outputs_misc_->choice_default_papersize )
+ else if (ob == outputs_misc_->choice_default_papersize )
str = lyxrc.getDescription( LyXRC::RC_DEFAULT_PAPERSIZE );
return str;
int button = fl_get_button(paths_->check_use_temp_dir);
string str = fl_get_input(paths_->input_temp_dir);
- if( !button ) str.erase();
+ if (!button ) str.erase();
lyxrc.use_tempdir = button;
lyxrc.tempdir_path = str;
button = fl_get_button(paths_->check_last_files);
str = fl_get_input(paths_->input_lastfiles);
- if( !button ) str.erase();
+ if (!button ) str.erase();
lyxrc.check_lastfiles = button;
lyxrc.lastfiles = str;
button = fl_get_button(paths_->check_make_backups);
str = fl_get_input(paths_->input_backup_path);
- if( !button ) str.erase();
+ if (!button ) str.erase();
lyxrc.make_backup = button;
lyxrc.backupdir_path = str;
}
-string FormPreferences::feedbackPaths( FL_OBJECT const * const ob ) const
+string const FormPreferences::feedbackPaths( FL_OBJECT const * const ob ) const
{
string str;
- if( ob == paths_->input_default_path )
+ if (ob == paths_->input_default_path )
str = lyxrc.getDescription( LyXRC::RC_DOCUMENTPATH );
- else if ( ob == paths_->input_template_path )
+ else if (ob == paths_->input_template_path )
str = lyxrc.getDescription( LyXRC::RC_TEMPLATEPATH );
- else if ( ob == paths_->check_use_temp_dir )
+ else if (ob == paths_->check_use_temp_dir )
str = lyxrc.getDescription( LyXRC::RC_USETEMPDIR );
- else if ( ob == paths_->input_temp_dir )
+ else if (ob == paths_->input_temp_dir )
str = lyxrc.getDescription( LyXRC::RC_TEMPDIRPATH );
- else if ( ob == paths_->check_last_files )
+ else if (ob == paths_->check_last_files )
str = lyxrc.getDescription( LyXRC::RC_CHECKLASTFILES );
- else if ( ob == paths_->input_lastfiles )
+ else if (ob == paths_->input_lastfiles )
str = lyxrc.getDescription( LyXRC::RC_LASTFILES );
- else if ( ob == paths_->counter_lastfiles )
+ else if (ob == paths_->counter_lastfiles )
str = lyxrc.getDescription( LyXRC::RC_NUMLASTFILES );
- else if ( ob == paths_->check_make_backups )
+ else if (ob == paths_->check_make_backups )
str = lyxrc.getDescription( LyXRC::RC_MAKE_BACKUP );
- else if ( ob == paths_->input_backup_path )
+ else if (ob == paths_->input_backup_path )
str = lyxrc.getDescription( LyXRC::RC_BACKUPDIR_PATH );
- else if ( ob == paths_->input_serverpipe )
+ else if (ob == paths_->input_serverpipe )
str = lyxrc.getDescription( LyXRC::RC_SERVERPIPE );
return str;
{
bool activate = true;
- if( !ob || ob == paths_->check_use_temp_dir ) {
- if( fl_get_button(paths_->check_use_temp_dir) ) {
+ if (!ob || ob == paths_->check_use_temp_dir) {
+ if (fl_get_button(paths_->check_use_temp_dir)) {
fl_activate_object(paths_->input_temp_dir);
fl_set_object_lcol(paths_->input_temp_dir,
FL_BLACK);
}
}
- if( !ob || ob == paths_->check_last_files ) {
- if( fl_get_button(paths_->check_last_files) ) {
+ if (!ob || ob == paths_->check_last_files) {
+ if (fl_get_button(paths_->check_last_files)) {
fl_activate_object(paths_->input_lastfiles);
fl_set_object_lcol(paths_->input_lastfiles,
FL_BLACK);
}
}
- if( !ob || ob == paths_->check_make_backups ) {
- if( fl_get_button(paths_->check_make_backups) ) {
+ if (!ob || ob == paths_->check_make_backups) {
+ if (fl_get_button(paths_->check_make_backups)) {
fl_activate_object(paths_->input_backup_path);
fl_set_object_lcol(paths_->input_backup_path,
FL_BLACK);
}
}
- if( !ob || ob == paths_->input_default_path ) {
+ if (!ob || ob == paths_->input_default_path) {
string name = fl_get_input(paths_->input_default_path);
- if( !WriteableDir(name) )
+ if (!WriteableDir(name) )
return false;
}
- if( !ob || ob == paths_->input_template_path ) {
+ if (!ob || ob == paths_->input_template_path) {
string name = fl_get_input(paths_->input_template_path);
- if( !ReadableDir(name) )
+ if (!ReadableDir(name) )
return false;
}
- if( !ob || ob == paths_->input_temp_dir ) {
+ if (!ob || ob == paths_->input_temp_dir) {
string name = fl_get_input(paths_->input_temp_dir);
- if( fl_get_button(paths_->check_make_backups)
+ if (fl_get_button(paths_->check_make_backups)
&& !name.empty()
&& !WriteableDir(name) )
return false;
}
- if( !ob || ob == paths_->input_backup_path ) {
+ if (!ob || ob == paths_->input_backup_path) {
string name = fl_get_input(paths_->input_backup_path);
- if( fl_get_button(paths_->check_make_backups)
+ if (fl_get_button(paths_->check_make_backups)
&& !name.empty()
&& !WriteableDir(name) )
return false;
}
- if( !ob || ob == paths_->input_lastfiles ) {
+ if (!ob || ob == paths_->input_lastfiles) {
string name = fl_get_input(paths_->input_lastfiles);
- if( fl_get_button(paths_->check_last_files)
+ if (fl_get_button(paths_->check_last_files)
&& !name.empty()
&& !WriteableFile(name) )
return false;
}
- if( !ob || ob == paths_->input_serverpipe ) {
+ if (!ob || ob == paths_->input_serverpipe) {
string name = fl_get_input(paths_->input_serverpipe);
- if( !name.empty() ) {
- if( !WriteableFile(name, ".in") )
+ if (!name.empty()) {
+ if (!WriteableFile(name, ".in"))
return false;
- if( !WriteableFile(name, ".out") )
+ if (!WriteableFile(name, ".out"))
return false;
}
}
fl_set_input(paths_->input_template_path,
lyxrc.template_path.c_str());
- string str = string();
- if( lyxrc.make_backup ) str = lyxrc.backupdir_path;
+ string str;
+ if (lyxrc.make_backup) str = lyxrc.backupdir_path;
fl_set_button(paths_->check_make_backups,
lyxrc.make_backup);
fl_set_input(paths_->input_backup_path, str.c_str());
str.erase();
- if( lyxrc.use_tempdir ) str = lyxrc.tempdir_path;
+ if (lyxrc.use_tempdir) str = lyxrc.tempdir_path;
fl_set_button(paths_->check_use_temp_dir,
lyxrc.use_tempdir);
fl_set_input(paths_->input_temp_dir, str.c_str());
str.erase();
- if( lyxrc.check_lastfiles ) str = lyxrc.lastfiles;
+ if (lyxrc.check_lastfiles) str = lyxrc.lastfiles;
fl_set_button(paths_->check_last_files,
lyxrc.check_lastfiles);
}
-string FormPreferences::feedbackPrinter( FL_OBJECT const * const ob ) const
+string const FormPreferences::feedbackPrinter(FL_OBJECT const * const ob) const
{
string str;
- if( ob == printer_->input_command )
+ if (ob == printer_->input_command )
str = lyxrc.getDescription( LyXRC::RC_PRINT_COMMAND );
- else if( ob == printer_->check_adapt_output )
+ else if (ob == printer_->check_adapt_output )
str = lyxrc.getDescription( LyXRC::RC_PRINT_ADAPTOUTPUT );
- else if( ob == printer_->input_to_printer )
+ else if (ob == printer_->input_to_printer )
str = lyxrc.getDescription( LyXRC::RC_PRINTTOPRINTER );
- else if( ob == printer_->input_to_file )
+ else if (ob == printer_->input_to_file )
str = lyxrc.getDescription( LyXRC::RC_PRINTTOFILE );
- else if( ob == printer_->input_file_extension )
+ else if (ob == printer_->input_file_extension )
str = lyxrc.getDescription( LyXRC::RC_PRINTFILEEXTENSION );
- else if( ob == printer_->input_extra_options )
+ else if (ob == printer_->input_extra_options )
str = lyxrc.getDescription( LyXRC::RC_PRINTEXSTRAOPTIONS );
- else if( ob == printer_->input_spool_command )
+ else if (ob == printer_->input_spool_command )
str = lyxrc.getDescription( LyXRC::RC_PRINTSPOOL_COMMAND );
- else if( ob == printer_->input_spool_prefix )
+ else if (ob == printer_->input_spool_prefix )
str = lyxrc.getDescription( LyXRC::RC_PRINTSPOOL_PRINTERPREFIX );
- else if( ob == printer_->input_name )
+ else if (ob == printer_->input_name )
str = lyxrc.getDescription( LyXRC::RC_PRINTER );
- else if( ob == printer_->input_even_pages )
+ else if (ob == printer_->input_even_pages )
str = lyxrc.getDescription( LyXRC::RC_PRINTEVENPAGEFLAG );
- else if( ob == printer_->input_odd_pages )
+ else if (ob == printer_->input_odd_pages )
str = lyxrc.getDescription( LyXRC::RC_PRINTODDPAGEFLAG );
- else if( ob == printer_->input_page_range )
+ else if (ob == printer_->input_page_range )
str = lyxrc.getDescription( LyXRC::RC_PRINTPAGERANGEFLAG );
- else if( ob == printer_->input_reverse )
+ else if (ob == printer_->input_reverse )
str = lyxrc.getDescription( LyXRC::RC_PRINTREVERSEFLAG );
- else if( ob == printer_->input_landscape )
+ else if (ob == printer_->input_landscape )
str = lyxrc.getDescription( LyXRC::RC_PRINTLANDSCAPEFLAG );
- else if( ob == printer_->input_copies )
+ else if (ob == printer_->input_copies )
str = lyxrc.getDescription( LyXRC::RC_PRINTCOLLCOPIESFLAG );
- else if( ob == printer_->input_collated )
+ else if (ob == printer_->input_collated )
str = lyxrc.getDescription( LyXRC::RC_PRINTCOPIESFLAG );
- else if( ob == printer_->input_paper_type )
+ else if (ob == printer_->input_paper_type )
str = lyxrc.getDescription( LyXRC::RC_PRINTPAPERFLAG );
- else if( ob == printer_->input_paper_size )
+ else if (ob == printer_->input_paper_size )
str = lyxrc.getDescription( LyXRC::RC_PRINTPAPERDIMENSIONFLAG );
return str;
bool changed = false;
string str = fl_get_input(screen_fonts_->input_roman);
- if( lyxrc.roman_font_name != str ) {
+ if (lyxrc.roman_font_name != str) {
changed = true;
lyxrc.roman_font_name = str;
}
str = fl_get_input(screen_fonts_->input_sans);
- if( lyxrc.sans_font_name != str ) {
+ if (lyxrc.sans_font_name != str) {
changed = true;
lyxrc.sans_font_name = str;
}
str = fl_get_input(screen_fonts_->input_typewriter);
- if( lyxrc.typewriter_font_name != str ) {
+ if (lyxrc.typewriter_font_name != str) {
changed = true;
lyxrc.typewriter_font_name = str;
}
str = fl_get_input(screen_fonts_->input_screen_encoding);
- if( lyxrc.font_norm != str ) {
+ if (lyxrc.font_norm != str) {
changed = true;
lyxrc.font_norm = str;
}
bool button = fl_get_button(screen_fonts_->check_scalable);
- if( lyxrc.use_scalable_fonts != button ) {
+ if (lyxrc.use_scalable_fonts != button) {
changed = true;
lyxrc.use_scalable_fonts = button;
}
unsigned int ivalue = static_cast<unsigned int>
(fl_get_counter_value(screen_fonts_->counter_zoom));
- if( lyxrc.zoom != ivalue) {
+ if (lyxrc.zoom != ivalue) {
changed = true;
lyxrc.zoom = ivalue;
}
}
double dvalue = strToDbl(fl_get_input(screen_fonts_->input_tiny));
- if( lyxrc.font_sizes[LyXFont::SIZE_TINY] != dvalue ) {
+ if (lyxrc.font_sizes[LyXFont::SIZE_TINY] != dvalue) {
changed = true;
lyxrc.font_sizes[LyXFont::SIZE_TINY] = dvalue;
}
dvalue = strToDbl(fl_get_input(screen_fonts_->input_script));
- if( lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] != dvalue ) {
+ if (lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] != dvalue) {
changed = true;
lyxrc.font_sizes[LyXFont::SIZE_SCRIPT] = dvalue;
}
dvalue = strToDbl(fl_get_input(screen_fonts_->input_footnote));
- if( lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] != dvalue ) {
+ if (lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] != dvalue) {
changed = true;
lyxrc.font_sizes[LyXFont::SIZE_FOOTNOTE] = dvalue;
}
dvalue = strToDbl(fl_get_input(screen_fonts_->input_small));
- if( lyxrc.font_sizes[LyXFont::SIZE_SMALL] != dvalue ) {
+ if (lyxrc.font_sizes[LyXFont::SIZE_SMALL] != dvalue) {
changed = true;
lyxrc.font_sizes[LyXFont::SIZE_SMALL] = dvalue;
}
dvalue = strToDbl(fl_get_input(screen_fonts_->input_normal));
- if( lyxrc.font_sizes[LyXFont::SIZE_NORMAL] != dvalue ) {
+ if (lyxrc.font_sizes[LyXFont::SIZE_NORMAL] != dvalue) {
changed = true;
lyxrc.font_sizes[LyXFont::SIZE_NORMAL] = dvalue;
}
dvalue = strToDbl(fl_get_input(screen_fonts_->input_large));
- if( lyxrc.font_sizes[LyXFont::SIZE_LARGE] != dvalue ) {
+ if (lyxrc.font_sizes[LyXFont::SIZE_LARGE] != dvalue) {
changed = true;
lyxrc.font_sizes[LyXFont::SIZE_LARGE] = dvalue;
}
dvalue = strToDbl(fl_get_input(screen_fonts_->input_larger));
- if( lyxrc.font_sizes[LyXFont::SIZE_LARGER] != dvalue ) {
+ if (lyxrc.font_sizes[LyXFont::SIZE_LARGER] != dvalue) {
changed = true;
lyxrc.font_sizes[LyXFont::SIZE_LARGER] = dvalue;
}
dvalue = strToDbl(fl_get_input(screen_fonts_->input_largest));
- if( lyxrc.font_sizes[LyXFont::SIZE_LARGEST] != dvalue ) {
+ if (lyxrc.font_sizes[LyXFont::SIZE_LARGEST] != dvalue) {
changed = true;
lyxrc.font_sizes[LyXFont::SIZE_LARGEST] = dvalue;
}
dvalue = strToDbl(fl_get_input(screen_fonts_->input_huge));
- if( lyxrc.font_sizes[LyXFont::SIZE_HUGE] != dvalue ) {
+ if (lyxrc.font_sizes[LyXFont::SIZE_HUGE] != dvalue) {
changed = true;
lyxrc.font_sizes[LyXFont::SIZE_HUGE] = dvalue;
}
dvalue = strToDbl(fl_get_input(screen_fonts_->input_huger));
- if( lyxrc.font_sizes[LyXFont::SIZE_HUGER] != dvalue ) {
+ if (lyxrc.font_sizes[LyXFont::SIZE_HUGER] != dvalue) {
changed = true;
lyxrc.font_sizes[LyXFont::SIZE_HUGER] = dvalue;
}
- if( changed ) {
+ if (changed) {
// Now update the buffers
// Can anything below here affect the redraw process?
lv_->getLyXFunc()->Dispatch(LFUN_SCREEN_FONT_UPDATE);
}
-string FormPreferences::feedbackScreenFonts(FL_OBJECT const * const ob ) const
+string const
+FormPreferences::feedbackScreenFonts(FL_OBJECT const * const ob ) const
{
string str;
- if( ob == screen_fonts_->input_roman )
+ if (ob == screen_fonts_->input_roman )
str = lyxrc.getDescription( LyXRC::RC_SCREEN_FONT_ROMAN );
- else if( ob == screen_fonts_->input_sans )
+ else if (ob == screen_fonts_->input_sans )
str = lyxrc.getDescription( LyXRC::RC_SCREEN_FONT_SANS );
- else if( ob == screen_fonts_->input_typewriter )
+ else if (ob == screen_fonts_->input_typewriter )
str = lyxrc.getDescription( LyXRC::RC_SCREEN_FONT_TYPEWRITER );
- else if( ob == screen_fonts_->check_scalable )
+ else if (ob == screen_fonts_->check_scalable )
str = lyxrc.getDescription( LyXRC::RC_SCREEN_FONT_SCALABLE );
- else if( ob == screen_fonts_->input_screen_encoding )
+ else if (ob == screen_fonts_->input_screen_encoding )
str = lyxrc.getDescription( LyXRC::RC_SCREEN_FONT_ENCODING );
- else if( ob == screen_fonts_->counter_zoom )
+ else if (ob == screen_fonts_->counter_zoom )
str = lyxrc.getDescription( LyXRC::RC_SCREEN_ZOOM );
- else if( ob == screen_fonts_->counter_dpi )
+ else if (ob == screen_fonts_->counter_dpi )
str = lyxrc.getDescription( LyXRC::RC_SCREEN_DPI );
- else if( ob == screen_fonts_->input_tiny
+ else if (ob == screen_fonts_->input_tiny
|| ob == screen_fonts_->input_script
|| ob == screen_fonts_->input_footnote
|| ob == screen_fonts_->input_small
str = N_("WARNING! Fonts must be input in the order tiny > script>\nfootnote > small > normal > large > larger > largest > huge > huger.");
}
- if( !activate ) {
+ if (!activate) {
fl_set_object_label(dialog_->text_warning, str.c_str());
fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE);
}
{
string choice = "none";
- switch(fl_get_choice(spellchecker_->choice_spell_command)) {
+ switch (fl_get_choice(spellchecker_->choice_spell_command)) {
case 1:
choice = "none";
break;
lyxrc.isp_command = choice;
// If spell checker == "none", all other input set to off.
- if( fl_get_choice(spellchecker_->choice_spell_command) == 1 ) {
+ if (fl_get_choice(spellchecker_->choice_spell_command) == 1) {
lyxrc.isp_use_alt_lang = false;
lyxrc.isp_alt_lang.erase();
} else {
int button = fl_get_button(spellchecker_->check_alt_lang);
choice = fl_get_input(spellchecker_->input_alt_lang);
- if( button && choice.empty() ) button = 0;
- if( !button ) choice.erase();
+ if (button && choice.empty() ) button = 0;
+ if (!button ) choice.erase();
lyxrc.isp_use_alt_lang = static_cast<bool>(button);
lyxrc.isp_alt_lang = choice;
button = fl_get_button(spellchecker_->check_escape_chars);
choice = fl_get_input(spellchecker_->input_escape_chars);
- if( button && choice.empty() ) button = 0;
- if( !button ) choice.erase();
+ if (button && choice.empty() ) button = 0;
+ if (!button ) choice.erase();
lyxrc.isp_use_esc_chars = static_cast<bool>(button);
lyxrc.isp_esc_chars = choice;
button = fl_get_button(spellchecker_->check_personal_dict);
choice = fl_get_input(spellchecker_->input_personal_dict);
- if( button && choice.empty() ) button = 0;
- if( !button ) choice.erase();
+ if (button && choice.empty() ) button = 0;
+ if (!button ) choice.erase();
lyxrc.isp_use_pers_dict = static_cast<bool>(button);
lyxrc.isp_pers_dict = choice;
}
-string FormPreferences::feedbackSpellChecker( FL_OBJECT const * const ob ) const
+string const
+FormPreferences::feedbackSpellChecker(FL_OBJECT const * const ob) const
{
string str;
- if( ob == spellchecker_->choice_spell_command )
+ if (ob == spellchecker_->choice_spell_command )
str = lyxrc.getDescription( LyXRC::RC_SPELL_COMMAND );
- else if( ob == spellchecker_->check_alt_lang )
+ else if (ob == spellchecker_->check_alt_lang )
str = lyxrc.getDescription( LyXRC::RC_USE_ALT_LANG );
- else if( ob == spellchecker_->input_alt_lang )
+ else if (ob == spellchecker_->input_alt_lang )
str = lyxrc.getDescription( LyXRC::RC_ALT_LANG );
- else if( ob == spellchecker_->check_escape_chars )
+ else if (ob == spellchecker_->check_escape_chars )
str = lyxrc.getDescription( LyXRC::RC_USE_ESC_CHARS );
- else if( ob == spellchecker_->input_escape_chars )
+ else if (ob == spellchecker_->input_escape_chars )
str = lyxrc.getDescription( LyXRC::RC_ESC_CHARS );
- else if( ob == spellchecker_->check_personal_dict )
+ else if (ob == spellchecker_->check_personal_dict )
str = lyxrc.getDescription( LyXRC::RC_USE_PERS_DICT );
- else if( ob == spellchecker_->input_personal_dict )
+ else if (ob == spellchecker_->input_personal_dict )
str = lyxrc.getDescription( LyXRC::RC_PERS_DICT );
- else if( ob == spellchecker_->check_compound_words )
+ else if (ob == spellchecker_->check_compound_words )
str = lyxrc.getDescription( LyXRC::RC_ACCEPT_COMPOUND );
- else if( ob == spellchecker_->check_input_enc )
+ else if (ob == spellchecker_->check_input_enc )
str = lyxrc.getDescription( LyXRC::RC_USE_INP_ENC );
return str;
// Allow/dissallow input
// If spell checker == "none", disable all input.
- if( !ob || ob == spellchecker_->choice_spell_command ) {
- if( fl_get_choice(spellchecker_->choice_spell_command) == 1 ) {
+ if (!ob || ob == spellchecker_->choice_spell_command) {
+ if (fl_get_choice(spellchecker_->choice_spell_command) == 1) {
fl_deactivate_object( spellchecker_->check_alt_lang );
fl_deactivate_object( spellchecker_->input_alt_lang );
fl_deactivate_object( spellchecker_->check_escape_chars );
}
}
- if( !ob || ob == spellchecker_->check_alt_lang ) {
- if( fl_get_button(spellchecker_->check_alt_lang) ) {
+ if (!ob || ob == spellchecker_->check_alt_lang) {
+ if (fl_get_button(spellchecker_->check_alt_lang)) {
fl_activate_object(spellchecker_->input_alt_lang);
fl_set_object_lcol(spellchecker_->input_alt_lang,
FL_BLACK);
}
}
- if( !ob || ob == spellchecker_->check_escape_chars ) {
- if( fl_get_button(spellchecker_->check_escape_chars) ) {
+ if (!ob || ob == spellchecker_->check_escape_chars) {
+ if (fl_get_button(spellchecker_->check_escape_chars)) {
fl_activate_object(spellchecker_->input_escape_chars);
fl_set_object_lcol(spellchecker_->input_escape_chars,
FL_BLACK);
}
}
- if( !ob || ob == spellchecker_->check_personal_dict ) {
- if( fl_get_button(spellchecker_->check_personal_dict) ) {
+ if (!ob || ob == spellchecker_->check_personal_dict) {
+ if (fl_get_button(spellchecker_->check_personal_dict)) {
fl_activate_object(spellchecker_->input_personal_dict);
fl_set_object_lcol(spellchecker_->input_personal_dict,
FL_BLACK);
void FormPreferences::updateSpellChecker()
{
int choice = 1;
- if( lyxrc.isp_command == "none" )
+ if (lyxrc.isp_command == "none" )
choice = 1;
- else if( lyxrc.isp_command == "ispell" )
+ else if (lyxrc.isp_command == "ispell" )
choice = 2;
- else if( lyxrc.isp_command == "aspell" )
+ else if (lyxrc.isp_command == "aspell" )
choice = 3;
fl_set_choice(spellchecker_->choice_spell_command, choice);
string str = string();
- if( lyxrc.isp_use_alt_lang ) str = lyxrc.isp_alt_lang;
+ if (lyxrc.isp_use_alt_lang ) str = lyxrc.isp_alt_lang;
fl_set_button(spellchecker_->check_alt_lang,
lyxrc.isp_use_alt_lang);
fl_set_input(spellchecker_->input_alt_lang, str.c_str());
str.erase();
- if( lyxrc.isp_use_esc_chars ) str = lyxrc.isp_esc_chars;
+ if (lyxrc.isp_use_esc_chars ) str = lyxrc.isp_esc_chars;
fl_set_button(spellchecker_->check_escape_chars,
lyxrc.isp_use_esc_chars);
fl_set_input(spellchecker_->input_escape_chars, str.c_str());
str.erase();
- if( lyxrc.isp_use_pers_dict ) str = lyxrc.isp_pers_dict;
+ if (lyxrc.isp_use_pers_dict ) str = lyxrc.isp_pers_dict;
fl_set_button(spellchecker_->check_personal_dict,
lyxrc.isp_use_pers_dict);
bool success = true;
string str;
- if( !AbsolutePath(name) ) {
+ if (!AbsolutePath(name)) {
success = false;
str = N_("WARNING! The absolute path is required.");
}
- FileInfo tp(name);
- if( success && !tp.isDir() ) {
+ FileInfo const tp(name);
+ if (success && !tp.isDir()) {
success = false;
str = N_("WARNING! Directory does not exist.");
}
- if( success && !tp.writable() ) {
+ if (success && !tp.writable()) {
success = false;
str = N_("WARNING! Cannot write to this directory.");
}
- if( !success ) {
+ if (!success) {
fl_set_object_label(dialog_->text_warning, str.c_str());
fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE);
}
bool success = true;
string str;
- if( !AbsolutePath(name) ) {
+ if (!AbsolutePath(name)) {
success = false;
str = N_("WARNING! The absolute path is required.");
}
- FileInfo tp(name);
- if( success && !tp.isDir() ) {
+ FileInfo const tp(name);
+ if (success && !tp.isDir()) {
success = false;
str = N_("WARNING! Directory does not exist.");
}
- if( success && !tp.readable() ) {
+ if (success && !tp.readable()) {
success = false;
str = N_("WARNING! Cannot read this directory.");
}
- if( !success ) {
+ if (!success) {
fl_set_object_label(dialog_->text_warning, str.c_str());
fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE);
}
}
-bool FormPreferences::WriteableFile( string const & name, string const & suffix ) const
+bool FormPreferences::WriteableFile(string const & name,
+ string const & suffix) const
{
// A writeable file is either:
// * An existing file to which we have write access, or
bool success = true;
string str;
- if( name.empty() ) {
+ if (name.empty()) {
success = false;
str = N_("WARNING! No file input.");
}
- string dir = OnlyPath(name);
- if( success && !AbsolutePath(dir) ) {
+ string const dir = OnlyPath(name);
+ if (success && !AbsolutePath(dir)) {
success = false;
str = N_("WARNING! The absolute path is required.");
}
+ // This is not a nice way to use FileInfo (Lgb)
+#if 0
FileInfo d;
+
{
FileInfo d1(dir);
FileInfo d2(name);
- if( d2.isDir() )
+ if (d2.isDir() )
d = d2;
else
d = d1;
}
-
- if( success && !d.isDir()) {
+#else
+ // This should be equivalent (Lgb)
+ FileInfo d(name);
+ if (!d.isDir()) {
+ d.newFile(dir);
+ }
+#endif
+ if (success && !d.isDir()) {
success = false;
str = N_("WARNING! Directory does not exist.");
}
- if( success && !d.writable() ) {
+ if (success && !d.writable()) {
success = false;
str = N_("WARNING! Cannot write to this directory.");
}
FileInfo f(name+suffix);
- if( success && (dir == name || f.isDir()) ) {
+ if (success && (dir == name || f.isDir())) {
success = false;
str = N_("WARNING! A file is required, not a directory.");
}
- if( success && (f.exist() && !f.writable()) ) {
+ if (success && (f.exist() && !f.writable())) {
success = false;
str = N_("WARNING! Cannot write to this file.");
}
- if( !success ) {
+ if (!success) {
fl_set_object_label(dialog_->text_warning, str.c_str());
fl_set_object_lsize(dialog_->text_warning, FL_SMALL_SIZE);
}
// C functions for the timer callback used to give the user feedback
C_GENERICCB(FormPreferences, FeedbackCB)
+
void FormPreferences::FeedbackCB(FL_OBJECT * ob, long)
{
FormPreferences * pre =
pre->feedback( pre->feedbackObj );
}
-extern "C" int C_FormPreferencesFeedbackPost(FL_OBJECT * ob, int event,
- FL_Coord, FL_Coord, int, void *)
+
+extern "C"
+int C_FormPreferencesFeedbackPost(FL_OBJECT * ob, int event,
+ FL_Coord, FL_Coord, int, void *)
{
// can occur when form is being deleted. This seems an easier fix than
// a call "fl_set_object_posthandler(ob, 0)" for each and every object
// in the destructor.
- if( !ob->form ) return 0;
+ if (!ob->form ) return 0;
FormPreferences * pre =
static_cast<FormPreferences*>(ob->form->u_vdata);
// post_handler for feedback messages
-void FormPreferences::feedbackPost(FL_OBJECT *ob, int event)
+void FormPreferences::feedbackPost(FL_OBJECT * ob, int event)
{
// We do not test for empty help here, since this can never happen
- if(event == FL_ENTER){
+ if (event == FL_ENTER){
// Used as a placeholder for ob, so that we don't have to
// a horrible reinterpret_cast to long and pass it as an
// argument in fl_set_object_callback.
0);
fl_set_timer(dialog_->timer_feedback, 0.5);
}
- else if(event != FL_MOTION){
+ else if (event != FL_MOTION){
fl_set_timer(dialog_->timer_feedback, 0);
feedbackObj = 0;
fl_set_object_label(dialog_->text_warning, "");
}
-void FormPreferences::setPostHandler( FL_OBJECT * ob ) const
+void FormPreferences::setPostHandler(FL_OBJECT * ob) const
{
fl_set_object_posthandler(ob, C_FormPreferencesFeedbackPost);
}
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:
*/
///
- 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.
*/
/// 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_;
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
FL_FORM * FormRef::form() const
{
- if ( dialog_ ) return dialog_->form;
+ if (dialog_ ) return dialog_->form;
return 0;
}
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 );
}
fl_set_object_label(dialog_->button_go, _("Goto reference"));
refs.clear();
- if ( inset_ == 0 ) {
+ if (inset_ == 0) {
refs = lv_->buffer()->getLabelList();
updateBrowser( refs );
showBrowser();
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 ***"));
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
// 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 );
}
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:
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());
{
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;
}
}
{
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
{
string name;
- switch( type ) {
+ switch (type) {
case REF:
name = "ref";
break;
FL_FORM * FormTabular::form() const
{
- if ( dialog_ ) return dialog_->form;
+ if (dialog_ ) return dialog_->form;
return 0;
}
FL_FORM * FormTabularCreate::form() const
{
- if ( dialog_ ) return dialog_->form;
+ if (dialog_ ) return dialog_->form;
return 0;
}
FL_FORM * FormToc::form() const
{
- if ( dialog_ ) return dialog_->form;
+ if (dialog_ ) return dialog_->form;
return 0;
}
{
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
FL_FORM * FormUrl::form() const
{
- if ( dialog_ ) return dialog_->form;
+ if (dialog_ ) return dialog_->form;
return 0;
}
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 );
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();
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);
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());
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();
}
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;
}
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;
FD_form_citation::~FD_form_citation()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_copyright::~FD_form_copyright()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
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 );
}
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 );
}
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 );
}
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 );
}
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 );
}
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 );
}
FD_form_error::~FD_form_error()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_graphics::~FD_form_graphics()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_index::~FD_form_index()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
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 );
}
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 );
}
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 );
}
FD_form_preferences::~FD_form_preferences()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
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 );
}
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 );
}
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 );
}
FD_form_spellchecker::~FD_form_spellchecker()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
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 );
}
FD_form_language::~FD_form_language()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_colours::~FD_form_colours()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_converters::~FD_form_converters()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_formats::~FD_form_formats()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
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 );
}
FD_form_interface::~FD_form_interface()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_printer::~FD_form_printer()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_paths::~FD_form_paths()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_print::~FD_form_print()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_ref::~FD_form_ref()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_tabular::~FD_form_tabular()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
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 );
}
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 );
}
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 );
}
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 );
}
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 );
}
FD_form_toc::~FD_form_toc()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
FD_form_url::~FD_form_url()
{
- if( form->visible ) fl_hide_form( form );
+ if (form->visible ) fl_hide_form( form );
fl_free_form( form );
}
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 + ' ' ;
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 {
}
}
// 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);
}
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;
}
}
while (lex.IsOK()) {
- switch(lex.lex()) {
+ switch (lex.lex()) {
case TM_TEMPLATE: {
lex.next();
string temp = lex.GetString();
pushpophelper pph(lex, formattags, FO_END);
while (lex.IsOK()) {
- switch(lex.lex()) {
+ switch (lex.lex()) {
case FO_PRODUCT:
lex.next(true);
product = lex.GetString();
{
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;
}
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;;
}
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()) {
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>";
// 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) {
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));
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 */
}
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();
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);
// 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
*/
void InsetBibKey::Edit(BufferView * bv, int, int, unsigned int)
{
- if(bv->buffer()->isReadonly())
+ if (bv->buffer()->isReadonly())
WarnReadonly(bv->buffer()->fileName());
if (!bibitem_form) {
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);
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, '(');
keys.push_back(pair<string,string>(tmp,string()));
}
}
- } else if( !keys.empty() ) {
+ } else if (!keys.empty()) {
keys.back().second += linebuf + "\n";
}
}
keys = frontStrip(split(keys, key, ','));
string::size_type size = label.size() + 2 + key.size();
- if( size >= maxSize ) {
+ if (size >= maxSize) {
label += ", ...";
break;
}
void InsetCommandParams::setFromString( string const & b )
{
string::size_type idx = b.find("|++|");
- if( idx == string::npos ) {
+ if (idx == string::npos) {
cmdname = "";
options = "";
contents = "";
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);
///
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; }
///
}
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));
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))
void InsetInclude::Edit(BufferView * bv, int, int, unsigned int)
{
- if(bv->buffer()->isReadonly())
+ if (bv->buffer()->isReadonly())
WarnReadonly(bv->buffer()->fileName());
if (!form) {
} else
writefile = getFileName();
- if(IsLyXFilename(getFileName()))
+ if (IsLyXFilename(getFileName()))
writefile = ChangeExtension(writefile, ".sgml");
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
writefile = AddName(buffer->tmppath, incfile);
} else
writefile = getFileName();
- if(IsLyXFilename(getFileName()))
+ if (IsLyXFilename(getFileName()))
writefile = ChangeExtension(writefile, ".sgml");
lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
// Use the relative path.
writefile = incfile;
- if(IsLyXFilename(getFileName()))
+ if (IsLyXFilename(getFileName()))
writefile = ChangeExtension(writefile, ".sgml");
features.IncludedFiles[include_label] = writefile;
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;
}
{
static int ow = -1, oh;
- if(bv->buffer()->isReadonly())
+ if (bv->buffer()->isReadonly())
WarnReadonly(bv->buffer()->fileName());
if (!form) {
// 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;
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;
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())));
}
: 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:
int InsetQuotes::DocBook(Buffer const *, ostream & os) const
{
- if(times == InsetQuotes::DoubleQ) {
+ if (times == InsetQuotes::DoubleQ) {
if (side == InsetQuotes::LeftQ)
os << "“";
else
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 );
}
temp += getContents();
- if(!isLatex
+ if (!isLatex
&& !getOptions().empty()) {
temp += "||";
temp += getOptions();
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(), "" );
{
if (getCmdName() == "vref" || getCmdName() == "vpageref")
features.varioref = true;
- else if(getCmdName() == "prettyref")
+ else if (getCmdName() == "prettyref")
features.prettyref = true;
}
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);
}
} 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);
// 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:
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;
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
{
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);
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) +
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())) {
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;
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);
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);
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);
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())
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())
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;
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:
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;
}
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))));
}
}
{
int const n = tabular->GetNumberOfCells();
int cell = 0;
- for(; cell < n; ++cell) {
+ for (; cell < n; ++cell) {
if (tabular->GetCellInset(cell) == inset)
break;
}
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(),
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);
{
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)
//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();
}
}
{
// 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;
{
// 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;
// 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;
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());
UpdateLocal(bv, CURSOR_PAR, false);
return result;
} else if (result == FINISHED) {
- switch(action) {
+ switch (action) {
case -1:
case LFUN_RIGHT:
moveRight(bv, false);
{
// 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;
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);
}
}
/// 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);
}
}
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);
}
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");
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;
int InsetTOC::Linuxdoc(Buffer const *, ostream & os) const
{
- if( getCmdName() == "tableofcontents" )
+ if (getCmdName() == "tableofcontents" )
os << "<toc>";
return 0;
}
int InsetTOC::DocBook(Buffer const *, ostream & os) const
{
- if( getCmdName() == "tableofcontents" )
+ if (getCmdName() == "tableofcontents" )
os << "<toc></toc>";
return 0;
}
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();
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];
<< buf
<< "' is overriding old binding..."
<< endl;
- if((*it).table) {
+ if ((*it).table) {
delete (*it).table;
(*it).table = 0;
}
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;
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;
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;
} 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;
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 += ' ';
}
}
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];
}
{
int c = getsym();
- if(c > 0xff)
+ if (c > 0xff)
return '\0';
return c;
}
while (!finished && lexrc.IsOK() && !error) {
int le = lexrc.lex();
// See comment in lyxrc.C.
- switch(le) {
+ switch (le) {
case LyXLex::LEX_FEOF:
continue;
continue;
default: break;
}
- switch(static_cast<LayoutTags>(le)) {
+ switch (static_cast<LayoutTags>(le)) {
case LT_END: // end of structure
finished = true;
break;
return;
default: break;
};
- switch(static_cast<AlignTags>(le)) {
+ switch (static_cast<AlignTags>(le)) {
case AT_BLOCK:
align = LYX_ALIGN_BLOCK;
break;
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;
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;
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;
// parsing
while (lexrc.IsOK() && !error) {
int le = lexrc.lex();
- switch(le) {
+ switch (le) {
case LyXLex::LEX_FEOF:
continue;
continue;
default: break;
}
- switch(static_cast<TextClassTags>(le)) {
+ switch (static_cast<TextClassTags>(le)) {
case TC_OUTPUTTYPE: // output type definition
readOutputType(lexrc);
break;
case TC_SIDES:
if (lexrc.next()) {
- switch(lexrc.GetInteger()) {
+ switch (lexrc.GetInteger()) {
case 1: sides_ = OneSide; break;
case 2: sides_ = TwoSides; break;
default:
pushpophelper pph(lexrc, outputTypeTags, LITERATE);
int le = lexrc.lex();
- switch(le) {
+ switch (le) {
case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown output type `$$Token'");
return;
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;
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);
}
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;
}
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;
}
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;
}
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;
}
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);
}
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;
return;
Buffer * buffer = current_view->buffer();
- if(buffer->isReadonly()) // paranoia
+ if (buffer->isReadonly()) // paranoia
return;
current_view->owner()->getMiniBuffer()->Set(_("Inserting figure..."));
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;
// 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")
lex.printTable(lyxerr);
while (lex.IsOK()) {
- switch(lex.lex()) {
+ switch (lex.lex()) {
case ui_menuset:
menubackend.read(lex);
break;
{
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
bufferlist.emergencyWriteAll();
lyxerr << "Bye." << endl;
- if(err_sig!= SIGHUP &&
+ if (err_sig!= SIGHUP &&
(!GetEnv("LYXDEBUG").empty() || err_sig == SIGSEGV))
lyx::abort();
exit(0);
/// 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;
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());
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());
// 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;
// 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;
++replace_count;
}
} while (SearchCB(true));
- if( replace_count == 0 ) {
+ if (replace_count == 0) {
LyXBell();
bv->owner()->getMiniBuffer()->Set(
_("String not found!"));
#endif
#include "version.h"
-#if 0
-#include "lyxlookup.h"
-#endif
#include "kbmap.h"
#include "lyxfunc.h"
#include "bufferlist.h"
// 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;
// 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,
// 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);
}
-#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;
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;
return string();
else {
setMessage(N_("Text mode"));
- switch(action) {
+ switch (action) {
case LFUN_UNKNOWN_ACTION:
case LFUN_BREAKPARAGRAPH:
case LFUN_BREAKLINE:
if (!text)
text = owner->view()->text;
- switch(action) {
+ switch (action) {
// --- Misc -------------------------------------------
case LFUN_WORDFINDFORWARD :
case LFUN_WORDFINDBACKWARD : {
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);
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"));
{
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" );
{
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;
}
&& 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
&& 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());
{
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)
// 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)
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();
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());
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());
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());
break;
case LFUN_PRIOR:
- if(!text->mark_set)
+ if (!text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::UPDATE);
owner->view()->cursorPrevious(text);
break;
case LFUN_NEXT:
- if(!text->mark_set)
+ if (!text->mark_set)
owner->view()->beforeChange();
owner->view()->update(BufferView::UPDATE);
owner->view()->cursorNext(text);
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());
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());
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());
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))
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))
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());
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());
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"));
{
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 =
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';
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';
{
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);
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) );
case LFUN_UNKNOWN_ACTION:
{
- if(!owner->buffer()) {
+ if (!owner->buffer()) {
LyXBell();
setErrorMessage(N_("No document open"));
break;
* "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);
// 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)")))
// 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)")))
/// 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;
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';
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;
// compiler.
int le = lexrc.lex();
- switch(le) {
+ switch (le) {
case LyXLex::LEX_UNDEF:
lexrc.printError("Unknown tag `$$Token'");
continue;
break;
case RC_NEW_ASK_FILENAME:
- if ( lexrc.next())
+ if (lexrc.next())
new_ask_filename = lexrc.GetBool();
break;
case RC_CONVERTER: {
break;
}
case RC_DEFAULT_LANGUAGE:
- if ( lexrc.next())
+ if (lexrc.next())
default_language = lexrc.GetString();
break;
// 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
{
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;
// 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
return;
}
- if(infd > -1) {
+ if (infd > -1) {
fl_remove_io_callback(infd, FL_READ, C_LyXComm_callback);
string tmp = pipename + ".in";
};
#endif
}
- if(outfd > -1) {
+ if (outfd > -1) {
string tmp = pipename + ".out";
#ifdef __EMX__
rc = DosDisConnectNPipe(outfd);
// 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');
<< "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;
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;
}
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;
// --- 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]
// 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;
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];
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];
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") {
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++;
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;
os << '}';
data.Next();
} else
- switch(cx) {
+ switch (cx) {
case LM_TC_TAB:
{
os << " & ";
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;
? 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();
}
// Otherwise, we use what LaTeX
// provides us.
- switch(c) {
+ switch (c) {
case '<':
os << "\\textless{}";
column += 10;
texrow.newline();
}
os << "\\begin{minipage}";
- switch(pextra_alignment) {
+ switch (pextra_alignment) {
case MINIPAGE_ALIGN_TOP:
os << "[t]";
break;
texrow.newline();
}
os << "\\begin{minipage}";
- switch(par->pextra_alignment) {
+ switch (par->pextra_alignment) {
case MINIPAGE_ALIGN_TOP:
os << "[t]";
break;
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 + '\'';
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);
{
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 {
{
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;
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);
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;
y1 + owner.ypos(),
x + owner.xpos(),
y2 + owner.ypos());
- switch(shape) {
+ switch (shape) {
case BAR_SHAPE:
break;
case L_SHAPE:
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()
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);
// 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;
- 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);
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;
}
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);
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);
// 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);
}
}
}
- if(sc_still_alive()) {
+ if (sc_still_alive()) {
close_spell_checker();
string word_msg(tostr(word_count));
if (word_count != 1) {
// 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;
#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();
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;
///
// checks for already absolute path
if (AbsolutePath(RelPath))
#ifdef __EMX__
- if(RelPath[0]!= '/' && RelPath[0]!= '\\')
+ if (RelPath[0]!= '/' && RelPath[0]!= '\\')
#endif
return RelPath;
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;
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))
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;
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;
}
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;
}
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;
}
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;
}
/* 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;
* 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++] = '%';
&& !(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; }
}
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);
}
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];
}
}
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
// 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))
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));
}
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;
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);
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
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" <<
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()) {
{
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;
if (LeftLine(cell))
os << '|';
if (!GetPWidth(cell).empty()) {
- switch(GetVAlignment(cell)) {
+ switch (GetVAlignment(cell)) {
case LYX_VALIGN_TOP:
os << "p";
break;
}
if (GetUsebox(cell) == BOX_PARBOX) {
os << "\\parbox[";
- switch(GetVAlignment(cell)) {
+ switch (GetVAlignment(cell)) {
case LYX_VALIGN_TOP:
os << "t";
break;
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;
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;
//+---------------------------------------------------------------------
//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()) {
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);
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;
}
os << "\" valign=\"";
- switch(GetVAlignment(cell)) {
+ switch (GetVAlignment(cell)) {
case LYX_VALIGN_TOP:
os << "top";
break;
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);
{
int const fcell = GetFirstCellInRow(row);
int const n = NumberOfCellsInRow(fcell) + fcell;
- //int len;
- //int column = 0;
- //unsigned char ch;
#if 0
int tmp = 0;
{
int const fcell = GetFirstCellInRow(row);
int const n = NumberOfCellsInRow(fcell) + fcell;
- //int len;
- //int column = 0;
- //unsigned char ch;
+
#if 0
int tmp = 0;
len2 += clen[column] + 4;
len2 -= len1;
- switch(GetAlignment(cell)) {
+ switch (GetAlignment(cell)) {
default:
case LYX_ALIGN_LEFT:
len1 = 0;
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 << " |";
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;
}
}
// 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;
}
}
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);
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);
{
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;
}
// 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())
{
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);
// 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);
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;
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 */
(cursor.pos() == 1 ||
cursor.par()->IsSeparator(cursor.pos() - 2) ||
cursor.par()->IsNewline(cursor.pos() - 2) )
- ) {
+ ) {
SetCharFont(bview->buffer(),
cursor.par(),
cursor.pos() - 1,
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
* 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();
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()) ;
++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()) ;
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() );
&& !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;
}
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();
/* 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;
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!!!
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()) {
} 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),
} 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()) )
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,
#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)
// 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
// 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;
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
Trans::Trans()
{
- for(int i = 0; i < TEX_MAX_ACCENT + 1; ++i)
+ for (int i = 0; i < TEX_MAX_ACCENT + 1; ++i)
kmod_list_[i] = 0;
}
void Trans::FreeKeymap()
{
- for(int i = 0; i < 256; ++i)
+ for (int i = 0; i < 256; ++i)
if (!keymap_[i].empty()) {
keymap_[i].erase();
}
- for(int i = 0; i < TEX_MAX_ACCENT + 1; ++i)
+ for (int i = 0; i < TEX_MAX_ACCENT + 1; ++i)
if (kmod_list_[i]) {
FreeException(kmod_list_[i]->exception_list);
delete kmod_list_[i];
kmod_list_[accent]->allowed = allowed;
}
- for(string::size_type i = 0; i < keys.length(); ++i) {
-#if 0
- string * temp =
- &keymap_[static_cast<unsigned char>(keys[i])];
-#warning this is not really clean we should find a cleaner way (Jug)
- *temp = "xx"; /* this is needed for the being sure that
- the below assignment is not assigned to
- a nullpointer (if size of string = 0)
- */
- (*temp)[0] = 0;
- (*temp)[1] = accent;
-#else
+ for (string::size_type i = 0; i < keys.length(); ++i) {
string & temp =
keymap_[static_cast<unsigned char>(keys[i])];
if (!temp.empty())
// Lgb
temp += char(0);
temp += char(accent);
-#endif
}
kmod_list_[accent]->exception_list = 0;
}
bool error = false;
while (lex.IsOK() && !error) {
- switch(lex.lex()) {
+ switch (lex.lex()) {
case KMOD:
{
if (lyxerr.debugging(Debug::KBMAP))
string keys = lex.GetString();
if (lex.next(true)) {
- if ( lyxerr.debugging(Debug::KBMAP))
+ if (lyxerr.debugging(Debug::KBMAP))
lyxerr << "accent\t`" << lex.text()
<< "'" << endl;
} else
// Find what key accent_2 is on - should
// check about accent_1 also
int key = 0;
- for(; key < 256; ++key) {
+ for (; key < 256; ++key) {
if (!keymap_[key].empty()
&& keymap_[key][0] == 0
&& keymap_[key][1] == accent_2)
<< "].name = `" << lyx_accent_table[i].name
<< "'" << endl;
- if ( lyx_accent_table[i].name
+ if (lyx_accent_table[i].name
&& contains(p, lyx_accent_table[i].name)) {
lyxerr[Debug::KBMAP] << "Found it!" << endl;
return static_cast<tex_accent>(i);
// To make isValidGlueLength recognize negative values as
// the first number this little hack is needed:
short val_sign = 1; // positive as default
- switch(buffer[0]) {
+ switch (buffer[0]) {
case '-':
lyx_advance(buffer, 1);
val_sign = -1;
// To make isValidLength recognize negative values
// this little hack is needed:
short val_sign = 1; // positive as default
- switch(buffer[0]) {
+ switch (buffer[0]) {
case '-':
lyx_advance(buffer, 1);
val_sign = -1;