to much stuff for my liking...

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3554 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-02-16 15:59:55 +00:00
parent 59e18b17ae
commit 7ea7dabed1
160 changed files with 1123 additions and 762 deletions

View File

@ -210,7 +210,7 @@ if test x$GXX = xyes; then
2.95.2) CXXFLAGS="$lyx_opt -fno-rtti -fno-exceptions";; 2.95.2) CXXFLAGS="$lyx_opt -fno-rtti -fno-exceptions";;
2.95.*) CXXFLAGS="$lyx_opt -fno-exceptions";; 2.95.*) CXXFLAGS="$lyx_opt -fno-exceptions";;
2.96*) CXXFLAGS="$lyx_opt -fno-exceptions";; 2.96*) CXXFLAGS="$lyx_opt -fno-exceptions";;
3.0*) CXXFLAGS="$lyx_opt";; 3.0*) CXXFLAGS="$lyx_opt -fno-rtti -fno-exceptions";;
*2.91.*) CXXFLAGS="$lyx_opt -fno-rtti -fno-exceptions";; *2.91.*) CXXFLAGS="$lyx_opt -fno-rtti -fno-exceptions";;
*) CXXFLAGS="$lyx_opt -fno-rtti -fno-exceptions";; *) CXXFLAGS="$lyx_opt -fno-rtti -fno-exceptions";;
esac esac

View File

@ -187,7 +187,7 @@ case "$lyx_use_frontend" in
xforms) xforms)
# for now don't set it for xforms as this is always entered # for now don't set it for xforms as this is always entered
FRONTEND="" FRONTEND=""
FRONTEND_GUILIB="xforms/libxforms.la";; FRONTEND_GUILIB="xforms/libxforms.o";;
gnome) gnome)
AM_PATH_GTKMM(1.2.1,, AM_PATH_GTKMM(1.2.1,,
AC_MSG_ERROR(Cannot find GTK--: Please install Version 1.2.1+)) AC_MSG_ERROR(Cannot find GTK--: Please install Version 1.2.1+))

View File

@ -9,6 +9,7 @@ src/converter.C
src/CutAndPaste.C src/CutAndPaste.C
src/debug.C src/debug.C
src/exporter.C src/exporter.C
src/ext_l10n.h
src/figure_form.C src/figure_form.C
src/figureForm.C src/figureForm.C
src/FontLoader.C src/FontLoader.C

View File

@ -31,7 +31,7 @@ noinst_HEADERS = \
Makefile: $(BUILT_SOURCES) Makefile: $(BUILT_SOURCES)
%.h: $(M4_DIR)/%.h.m4 $(M4_DIR)/template.macros.m4 %.h: $(M4_DIR)/%.h.m4 $(M4_DIR)/template.macros.m4
$(M4) $(M4_INCLUDES) $(DEFINES) $< > $(top_srcdir)/$@ $(M4) $(M4_INCLUDES) $(DEFINES) $< > $(top_builddir)/$@
all-local: $(noinst_LTLIBRARIES) all-local: $(noinst_LTLIBRARIES)

View File

@ -118,7 +118,7 @@ bool BufferView::removeAutoInsets()
// Iterate until we find a paragraph that won't be immediately deleted. // Iterate until we find a paragraph that won't be immediately deleted.
// In reality this should mean we only execute the body of the while // In reality this should mean we only execute the body of the while
// loop once at most. However for safety we iterate rather than just // loop once at most. However for safety we iterate rather than just
// make this an if() conditional. // make this an if () conditional.
while ((cur_par_prev || cur_par_next) while ((cur_par_prev || cur_par_next)
&& text->setCursor(this, && text->setCursor(this,
cur_par_prev ? cur_par_prev : cur_par_next, cur_par_prev ? cur_par_prev : cur_par_next,
@ -675,12 +675,14 @@ bool BufferView::ChangeRefsIfUnique(string const & from, string const & to)
} }
bool BufferView::ChangeCitationsIfUnique(string const & from, string const & to) bool BufferView::ChangeCitationsIfUnique(string const & from,
string const & to)
{ {
typedef pair<string, string> StringPair;
vector<pair<string,string> > keys = buffer()->getBibkeyList();
vector<StringPair> keys = buffer()->getBibkeyList();
if (count_if(keys.begin(), keys.end(), if (count_if(keys.begin(), keys.end(),
lyx::equal_1st_in_pair<string,string>(from)) lyx::equal_1st_in_pair<StringPair>(from))
> 1) > 1)
return false; return false;

View File

@ -115,7 +115,7 @@ void SetXtermCursor(Window win)
{ {
static Cursor cursor; static Cursor cursor;
static bool cursor_undefined = true; static bool cursor_undefined = true;
if (cursor_undefined){ if (cursor_undefined) {
cursor = XCreateFontCursor(fl_get_display(), XC_xterm); cursor = XCreateFontCursor(fl_get_display(), XC_xterm);
XFlush(fl_get_display()); XFlush(fl_get_display());
cursor_undefined = false; cursor_undefined = false;
@ -1169,7 +1169,7 @@ void BufferView::Pimpl::cursorPrevious(LyXText * text)
text->cursor.y() text->cursor.y()
- text->cursor.row()->baseline() - text->cursor.row()->baseline()
+ text->cursor.row()->height() + text->cursor.row()->height()
- workarea_.height() + 1 ); - workarea_.height() + 1);
updateScrollbar(); updateScrollbar();
} }
@ -1241,7 +1241,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
Buffer * b = bufferlist.exists(fname) ? Buffer * b = bufferlist.exists(fname) ?
bufferlist.getBuffer(fname) : bufferlist.getBuffer(fname) :
bufferlist.loadLyXFile(fname); // don't ask, just load it bufferlist.loadLyXFile(fname); // don't ask, just load it
if (b != 0 ) buffer(b); if (b != 0) buffer(b);
} }
Paragraph * par = buffer_->getParFromID(saved_positions[i].par_id); Paragraph * par = buffer_->getParFromID(saved_positions[i].par_id);
@ -2972,13 +2972,13 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
case LFUN_CITATION_INSERT: case LFUN_CITATION_INSERT:
{ {
InsetCommandParams p; InsetCommandParams p;
p.setFromString( argument ); p.setFromString(argument);
InsetCitation * inset = new InsetCitation( p ); InsetCitation * inset = new InsetCitation(p);
if (!insertInset(inset)) if (!insertInset(inset))
delete inset; delete inset;
else else
updateInset( inset, true ); updateInset(inset, true);
} }
break; break;
@ -2990,7 +2990,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
string const db = token(argument, ' ', 0); string const db = token(argument, ' ', 0);
string const bibstyle = token(argument, ' ', 1); string const bibstyle = token(argument, ' ', 1);
InsetCommandParams p( "BibTeX", db, bibstyle ); InsetCommandParams p("BibTeX", db, bibstyle);
InsetBibtex * inset = new InsetBibtex(p); InsetBibtex * inset = new InsetBibtex(p);
if (insertInset(inset)) { if (insertInset(inset)) {
@ -3088,7 +3088,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
case LFUN_PARENTINSERT: case LFUN_PARENTINSERT:
{ {
lyxerr << "arg " << argument << endl; lyxerr << "arg " << argument << endl;
InsetCommandParams p( "lyxparent", argument ); InsetCommandParams p("lyxparent", argument);
Inset * inset = new InsetParent(p, *buffer_); Inset * inset = new InsetParent(p, *buffer_);
if (!insertInset(inset, "Standard")) if (!insertInset(inset, "Standard"))
delete inset; delete inset;
@ -3428,7 +3428,7 @@ void BufferView::Pimpl::updateInset(Inset * inset, bool mark_dirty)
} else if (bv_->theLockingInset()->updateInsetInInset(bv_, inset)) { } else if (bv_->theLockingInset()->updateInsetInInset(bv_, inset)) {
if (bv_->text->updateInset(bv_, bv_->theLockingInset())) { if (bv_->text->updateInset(bv_, bv_->theLockingInset())) {
update(); update();
if (mark_dirty){ if (mark_dirty) {
buffer_->markDirty(); buffer_->markDirty();
} }
updateScrollbar(); updateScrollbar();

View File

@ -24,10 +24,10 @@
/** The four LaTeX itemize environment default bullets /** The four LaTeX itemize environment default bullets
*/ */
extern extern
Bullet const ITEMIZE_DEFAULTS[4] = { Bullet( 0, 8 ),//"\\(\\bullet\\)" Bullet const ITEMIZE_DEFAULTS[4] = { Bullet(0, 8),//"\\(\\bullet\\)"
Bullet( 0, 0 ),//"\\normalfont\\bfseries{--}" Bullet(0, 0),//"\\normalfont\\bfseries{--}"
Bullet( 0, 6 ),//"\\(\\ast\\)" Bullet(0, 6),//"\\(\\ast\\)"
Bullet( 0, 10 ) };//"\\(\\cdot\\)" Bullet(0, 10) };//"\\(\\cdot\\)"
// will need these later if still using full text as below // will need these later if still using full text as below
// \usepackage{latexsym,pifont,amssymb} // \usepackage{latexsym,pifont,amssymb}

View File

@ -1,3 +1,11 @@
2002-02-16 Lars Gullik Bjønnes <larsbj@lyx.org>
* a lot of small ws changes
* add a lot of using std::XXX
* use std construcs some places where approp.
* use some exisint stuff from lyxfunctional where approp.
* Make file changes to use partial linking (lets test this now...)
2002-02-16 Angus Leeming <a.leeming@ic.ac.uk> 2002-02-16 Angus Leeming <a.leeming@ic.ac.uk>
* Chktex.C: * Chktex.C:

View File

@ -152,11 +152,11 @@ bool DepTable::extchanged(string const & ext) const
} }
bool DepTable::ext_exist(const string& ext ) const bool DepTable::ext_exist(const string& ext) const
{ {
DepList::const_iterator cit = deplist.begin(); DepList::const_iterator cit = deplist.begin();
DepList::const_iterator end = deplist.end(); DepList::const_iterator end = deplist.end();
for (; cit != end; ++cit ) { for (; cit != end; ++cit) {
if (suffixIs(cit->first, ext)) { if (suffixIs(cit->first, ext)) {
return true; return true;
} }

View File

@ -279,8 +279,8 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
} }
getFontinfo(family, series, shape); getFontinfo(family, series, shape);
int fsize = int( (lyxrc.font_sizes[size] * lyxrc.dpi * int fsize = int((lyxrc.font_sizes[size] * lyxrc.dpi *
(lyxrc.zoom/100.0) ) / 72.27 + 0.5 ); (lyxrc.zoom/100.0)) / 72.27 + 0.5);
string font = fontinfo[family][series][shape]->getFontname(fsize); string font = fontinfo[family][series][shape]->getFontname(fsize);

View File

@ -33,6 +33,10 @@ using lyx::textclass_type;
using std::endl; using std::endl;
using std::set; using std::set;
using std::vector;
using std::find;
using std::ostream;
LaTeXFeatures::LaTeXFeatures(BufferParams const & p, layout_type n) LaTeXFeatures::LaTeXFeatures(BufferParams const & p, layout_type n)
: layout(n, false), params(p) : layout(n, false), params(p)
@ -53,7 +57,7 @@ void LaTeXFeatures::require(string const & name)
} }
void LaTeXFeatures::useLayout(std::vector<bool>::size_type const & idx) void LaTeXFeatures::useLayout(vector<bool>::size_type const & idx)
{ {
layout[idx] = true; layout[idx] = true;
} }
@ -61,9 +65,9 @@ void LaTeXFeatures::useLayout(std::vector<bool>::size_type const & idx)
bool LaTeXFeatures::isRequired(string const & name) const bool LaTeXFeatures::isRequired(string const & name) const
{ {
FeaturesList::const_iterator i = std::find(features.begin(), FeaturesList::const_iterator i = find(features.begin(),
features.end(), features.end(),
name); name);
return i != features.end(); return i != features.end();
} }
@ -374,7 +378,7 @@ string const LaTeXFeatures::getIncludedFiles(string const & fname) const
for (FileMap::const_iterator fi = IncludedFiles.begin(); for (FileMap::const_iterator fi = IncludedFiles.begin();
fi != end; ++fi) fi != end; ++fi)
sgmlpreamble << "\n<!ENTITY " << fi->first sgmlpreamble << "\n<!ENTITY " << fi->first
<< (IsSGMLFilename(fi->second) ? " SYSTEM \"" : " \"" ) << (IsSGMLFilename(fi->second) ? " SYSTEM \"" : " \"")
<< MakeRelPath(fi->second, basename) << "\">"; << MakeRelPath(fi->second, basename) << "\">";
return sgmlpreamble.str().c_str(); return sgmlpreamble.str().c_str();
@ -395,7 +399,7 @@ BufferParams const & LaTeXFeatures::bufferParams() const
return params; return params;
} }
void LaTeXFeatures::getFloatDefinitions(std::ostream & os) const void LaTeXFeatures::getFloatDefinitions(ostream & os) const
{ {
// Here we will output the code to create the needed float styles. // Here we will output the code to create the needed float styles.
// We will try to do this as minimal as possible. // We will try to do this as minimal as possible.

View File

@ -81,7 +81,7 @@ void SendtoApplyCB(FL_OBJECT *, long)
command += " &"; // execute in background command += " &"; // execute in background
// push directorypath, if necessary // push directorypath, if necessary
string path = buffer->filePath(); string path = buffer->filePath();
if (lyxrc.use_tempdir || !IsDirWriteable(path)){ if (lyxrc.use_tempdir || !IsDirWriteable(path)) {
path = buffer->tmppath; path = buffer->tmppath;
} }
Path p(path); Path p(path);

View File

@ -226,7 +226,7 @@ void LyXView::updateWindowTitle()
if (view()->available()) { if (view()->available()) {
string const cur_title = buffer()->fileName(); string const cur_title = buffer()->fileName();
if (!cur_title.empty()){ if (!cur_title.empty()) {
title += ": " + MakeDisplayPath(cur_title, 30); title += ": " + MakeDisplayPath(cur_title, 30);
if (!buffer()->isLyxClean()) if (!buffer()->isLyxClean())
title += _(" (Changed)"); title += _(" (Changed)");

View File

@ -4,13 +4,13 @@ DISTCLEANFILES= *.orig *.rej *~ *.bak core libintl.h config.h
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in $(srcdir)/config.h.in MAINTAINERCLEANFILES = $(srcdir)/Makefile.in $(srcdir)/config.h.in
bin_PROGRAMS = lyx bin_PROGRAMS = lyx
lyx_DEPENDENCIES = mathed/libmathed.la insets/libinsets.la \ lyx_DEPENDENCIES = mathed/libmathed.o insets/libinsets.o \
graphics/libgraphics.la \ graphics/libgraphics.o \
frontends/libfrontends.la \ frontends/libfrontends.o \
support/libsupport.la \ support/libsupport.o \
@INCLUDED_SIGC@ @INCLUDED_SIGC@
lyx_LDADD = $(lyx_DEPENDENCIES) @INTLLIBS@ $(SIGC_LIBS) \ lyx_LDADD = $(lyx_DEPENDENCIES) @INTLLIBS@ $(SIGC_LIBS) \
$(PSPELL_LIBS) @AIKSAURUS_LIBS@ $(PSPELL_LIBS) @AIKSAURUS_LIBS@ @LYX_LIBS@
#lyx_LDFLAGS=-Wl,-O1 #lyx_LDFLAGS=-Wl,-O1
EXTRA_DIST = config.h.in stamp-h.in cheaders ext_l10n.h version.C.in \ EXTRA_DIST = config.h.in stamp-h.in cheaders ext_l10n.h version.C.in \

View File

@ -10,12 +10,12 @@
#include "Thesaurus.h" #include "Thesaurus.h"
#ifdef HAVE_LIBAIKSAURUS
#include <algorithm> #include <algorithm>
Thesaurus thesaurus; using std::sort;
#ifdef HAVE_LIBAIKSAURUS
Thesaurus::Thesaurus() Thesaurus::Thesaurus()
{ {
aik_ = new Aiksaurus; aik_ = new Aiksaurus;
@ -60,7 +60,7 @@ Thesaurus::Meanings Thesaurus::lookup(string const & text)
for (Meanings::iterator it = meanings.begin(); for (Meanings::iterator it = meanings.begin();
it != meanings.end(); ++it) { it != meanings.end(); ++it) {
std::sort(it->second.begin(), it->second.end()); sort(it->second.begin(), it->second.end());
} }
return meanings; return meanings;
@ -84,3 +84,6 @@ Thesaurus::Meanings Thesaurus::lookup(string const &)
} }
#endif // HAVE_LIBAIKSAURUS #endif // HAVE_LIBAIKSAURUS
// Global instance
Thesaurus thesaurus;

View File

@ -37,6 +37,7 @@ FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *);
using std::endl; using std::endl;
using std::abs; using std::abs;
using std::hex;
FL_OBJECT * figinset_canvas; FL_OBJECT * figinset_canvas;
@ -354,7 +355,7 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
if (!area) return 1; if (!area) return 1;
switch (event){ switch (event) {
case FL_DRAW: case FL_DRAW:
if (!area->work_area || if (!area->work_area ||
!area->work_area->form->visible) !area->work_area->form->visible)
@ -614,8 +615,8 @@ string const WorkArea::getClipboard() const
if (fl_check_forms() == FL_EVENT) { if (fl_check_forms() == FL_EVENT) {
fl_XNextEvent(&ev); fl_XNextEvent(&ev);
lyxerr << "Received unhandled X11 event" << endl; lyxerr << "Received unhandled X11 event" << endl;
lyxerr << "Type: 0x" << std::hex << ev.xany.type << lyxerr << "Type: 0x" << hex << ev.xany.type <<
"Target: 0x" << std::hex << ev.xany.window << endl; "Target: 0x" << hex << ev.xany.window << endl;
} }
} }
return clipboard_selection; return clipboard_selection;

View File

@ -233,7 +233,7 @@ void XFormsView::prohibitInput() const
static Cursor cursor; static Cursor cursor;
static bool cursor_undefined = true; static bool cursor_undefined = true;
if (cursor_undefined){ if (cursor_undefined) {
cursor = XCreateFontCursor(fl_get_display(), XC_watch); cursor = XCreateFontCursor(fl_get_display(), XC_watch);
XFlush(fl_get_display()); XFlush(fl_get_display());
cursor_undefined = false; cursor_undefined = false;

View File

@ -1530,7 +1530,7 @@ void Buffer::readInset(LyXLex & lex, Paragraph *& par,
} else if (tmptok == "Note") { } else if (tmptok == "Note") {
inset = new InsetNote; inset = new InsetNote;
} else if (tmptok == "Include") { } else if (tmptok == "Include") {
InsetCommandParams p( "Include" ); InsetCommandParams p("Include");
inset = new InsetInclude(p, *this); inset = new InsetInclude(p, *this);
} else if (tmptok == "ERT") { } else if (tmptok == "ERT") {
inset = new InsetERT; inset = new InsetERT;
@ -2086,7 +2086,7 @@ void Buffer::makeLaTeXFile(string const & fname,
// original_path is set. This is done for usual tex-file, but not // original_path is set. This is done for usual tex-file, but not
// for nice-latex-file. (Matthias 250696) // for nice-latex-file. (Matthias 250696)
if (!only_body) { if (!only_body) {
if (!nice){ if (!nice) {
// code for usual, NOT nice-latex-file // code for usual, NOT nice-latex-file
ofs << "\\batchmode\n"; // changed ofs << "\\batchmode\n"; // changed
// from \nonstopmode // from \nonstopmode
@ -2185,7 +2185,7 @@ void Buffer::makeLaTeXFile(string const & fname,
} }
string strOptions(options.str().c_str()); string strOptions(options.str().c_str());
if (!strOptions.empty()){ if (!strOptions.empty()) {
strOptions = strip(strOptions, ','); strOptions = strip(strOptions, ',');
ofs << '[' << strOptions << ']'; ofs << '[' << strOptions << ']';
} }
@ -2692,7 +2692,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
if (par->isInset(0)) { if (par->isInset(0)) {
Inset * inset = par->getInset(0); Inset * inset = par->getInset(0);
Inset::Code lyx_code = inset->lyxCode(); Inset::Code lyx_code = inset->lyxCode();
if (lyx_code == Inset::TOC_CODE){ if (lyx_code == Inset::TOC_CODE) {
string const temp = "toc"; string const temp = "toc";
sgmlOpenTag(ofs, depth, temp); sgmlOpenTag(ofs, depth, temp);
@ -2728,7 +2728,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
_("Error : Wrong depth for" _("Error : Wrong depth for"
" LatexType Command.\n")); " LatexType Command.\n"));
if (!environment_stack[depth].empty()){ if (!environment_stack[depth].empty()) {
sgmlCloseTag(ofs, depth, sgmlCloseTag(ofs, depth,
environment_stack[depth]); environment_stack[depth]);
ofs << "</p>"; ofs << "</p>";
@ -2861,7 +2861,7 @@ void operator|=(PAR_TAG & p1, PAR_TAG const & p2)
inline inline
void reset(PAR_TAG & p1, PAR_TAG const & p2) void reset(PAR_TAG & p1, PAR_TAG const & p2)
{ {
p1 = static_cast<PAR_TAG>( p1 & ~p2); p1 = static_cast<PAR_TAG>(p1 & ~p2);
} }
} // namespace anon } // namespace anon
@ -2986,7 +2986,7 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
} }
list < PAR_TAG > temp; list < PAR_TAG > temp;
while (!tag_state.empty() && tag_close ) { while (!tag_state.empty() && tag_close) {
PAR_TAG k = tag_state.top(); PAR_TAG k = tag_state.top();
tag_state.pop(); tag_state.pop();
os << "</" << tag_name(k) << ">"; os << "</" << tag_name(k) << ">";
@ -3227,7 +3227,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (par->isInset(0)) { if (par->isInset(0)) {
Inset * inset = par->getInset(0); Inset * inset = par->getInset(0);
Inset::Code lyx_code = inset->lyxCode(); Inset::Code lyx_code = inset->lyxCode();
if (lyx_code == Inset::LABEL_CODE){ if (lyx_code == Inset::LABEL_CODE) {
command_name += " id=\""; command_name += " id=\"";
command_name += (static_cast<InsetCommand *>(inset))->getContents(); command_name += (static_cast<InsetCommand *>(inset))->getContents();
command_name += "\""; command_name += "\"";
@ -3251,7 +3251,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
} }
if (environment_stack[depth] != style.latexname()) { if (environment_stack[depth] != style.latexname()) {
if(environment_stack.size() == depth + 1) { if (environment_stack.size() == depth + 1) {
environment_stack.push_back("!-- --"); environment_stack.push_back("!-- --");
environment_inner.push_back("!-- --"); environment_inner.push_back("!-- --");
} }
@ -3274,7 +3274,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
if (style.latextype == LATEX_ENVIRONMENT) { if (style.latextype == LATEX_ENVIRONMENT) {
if (!style.latexparam().empty()) { if (!style.latexparam().empty()) {
if(style.latexparam() == "CDATA") if (style.latexparam() == "CDATA")
ofs << "<![CDATA["; ofs << "<![CDATA[";
else else
sgmlOpenTag(ofs, depth + command_depth, sgmlOpenTag(ofs, depth + command_depth,
@ -3324,7 +3324,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
break; break;
case LATEX_ENVIRONMENT: case LATEX_ENVIRONMENT:
if (!style.latexparam().empty()) { if (!style.latexparam().empty()) {
if(style.latexparam() == "CDATA") if (style.latexparam() == "CDATA")
ofs << "]]>"; ofs << "]]>";
else else
sgmlCloseTag(ofs, depth + command_depth, sgmlCloseTag(ofs, depth + command_depth,
@ -3398,17 +3398,17 @@ void Buffer::simpleDocBookOnePar(ostream & os,
if (font.emph() == LyXFont::ON) { if (font.emph() == LyXFont::ON) {
os << "<emphasis>"; os << "<emphasis>";
emph_flag = true; emph_flag = true;
}else if(i) { } else if (i) {
os << "</emphasis>"; os << "</emphasis>";
emph_flag = false; emph_flag = false;
} }
} }
if ( par->isInset(i) ) { if (par->isInset(i)) {
Inset * inset = par->getInset(i); Inset * inset = par->getInset(i);
// don't print the inset in position 0 if desc_on == 3 (label) // don't print the inset in position 0 if desc_on == 3 (label)
if ( i || desc_on != 3) if (i || desc_on != 3)
inset->docbook(this, os); inset->docbook(this, os);
} else { } else {
char c = par->getChar(i); char c = par->getChar(i);
@ -3417,7 +3417,7 @@ void Buffer::simpleDocBookOnePar(ostream & os,
if (style.pass_thru) { if (style.pass_thru) {
os << c; os << c;
} else if(style.free_spacing || par->isFreeSpacing() || c != ' ') { } else if (style.free_spacing || par->isFreeSpacing() || c != ' ') {
os << sgml_string; os << sgml_string;
} else if (desc_on ==1) { } else if (desc_on ==1) {
++char_line_count; ++char_line_count;
@ -3439,7 +3439,7 @@ void Buffer::simpleDocBookOnePar(ostream & os,
// <term> not closed... // <term> not closed...
os << "</term>"; os << "</term>";
} }
if(style.free_spacing) os << '\n'; if (style.free_spacing) os << '\n';
} }
@ -3484,7 +3484,7 @@ int Buffer::runChktex()
// if we removed error insets before we ran chktex or if we inserted // if we removed error insets before we ran chktex or if we inserted
// error insets after we ran chktex, this must be run: // error insets after we ran chktex, this must be run:
if (removedErrorInsets || res){ if (removedErrorInsets || res) {
users->redraw(); users->redraw();
users->fitCursor(); users->fitCursor();
} }

View File

@ -198,7 +198,7 @@ bool BufferList::close(Buffer * buf)
while (reask) { while (reask) {
switch (Alert::askConfirmation(_("Changes in document:"), switch (Alert::askConfirmation(_("Changes in document:"),
fname, fname,
_("Save document?"))){ _("Save document?"))) {
case 1: // Yes case 1: // Yes
if (buf->isUnnamed()) if (buf->isUnnamed())
reask = !WriteAs(current_view, buf); reask = !WriteAs(current_view, buf);

View File

@ -233,7 +233,7 @@ void toggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
text->computeBidiTables(bv->buffer(), cursor.row()); text->computeBidiTables(bv->buffer(), cursor.row());
if (cursor.boundary() != if (cursor.boundary() !=
text->isBoundary(bv->buffer(), cursor.par(), cursor.pos(), text->isBoundary(bv->buffer(), cursor.par(), cursor.pos(),
text->real_current_font) ) text->real_current_font))
text->setCursor(bv, cursor.par(), cursor.pos(), text->setCursor(bv, cursor.par(), cursor.pos(),
false, !cursor.boundary()); false, !cursor.boundary());
} }

View File

@ -7,82 +7,96 @@
*/ */
#include <config.h> #include <config.h>
#include <cerrno> #include "Alert.h"
#include "debug.h" #include "debug.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "Alert_pimpl.h" #include "Alert_pimpl.h"
#include <cerrno>
using std::endl; using std::endl;
using std::pair;
using std::make_pair;
namespace Alert {
void alert(string const & s1, string const & s2, string const & s3) {
if (!lyxrc.use_gui) {
lyxerr << "----------------------------------------" << endl
<< s1 << endl << s2 << endl << s3 << endl
<< "----------------------------------------" << endl;
} else {
alert_pimpl(s1, s2, s3);
}
}
void err_alert(string const & s1, string const & s2) { void Alert::alert(string const & s1, string const & s2, string const & s3)
alert(s1, s2, strerror(errno)); {
} if (!lyxrc.use_gui) {
lyxerr << "------------------------------" << endl
bool askQuestion(string const & s1, string const & s2, string const & s3, bool default_value) { << s1 << endl << s2 << endl << s3 << endl
if (!lyxrc.use_gui) { << "------------------------------" << endl;
lyxerr << "----------------------------------------" << endl } else {
<< s1 << endl; alert_pimpl(s1, s2, s3);
if (!s2.empty()) }
lyxerr << s2 << endl; }
if (!s3.empty())
lyxerr << s3 << endl;
lyxerr << "Assuming answer is " void Alert::err_alert(string const & s1, string const & s2)
<< (default_value ? "yes" : "no") {
<< endl alert(s1, s2, strerror(errno));
<< "----------------------------------------" << endl; }
return default_value;
} else {
return askQuestion_pimpl(s1, s2, s3); bool Alert::askQuestion(string const & s1, string const & s2,
} string const & s3, bool default_value)
} {
if (!lyxrc.use_gui) {
int askConfirmation(string const & s1, string const & s2, string const & s3, int default_value) { lyxerr << "----------------------------------------" << endl
if (!lyxrc.use_gui) { << s1 << endl;
lyxerr << "----------------------------------------" << endl if (!s2.empty())
<< s1 << endl; lyxerr << s2 << endl;
if (!s2.empty()) if (!s3.empty())
lyxerr << s2 << endl; lyxerr << s3 << endl;
if (!s3.empty()) lyxerr << "Assuming answer is "
lyxerr << s3 << endl; << (default_value ? "yes" : "no")
lyxerr << "Assuming answer is "; << endl
if (default_value == 1) << "----------------------------------------" << endl;
lyxerr << "yes"; return default_value;
else if (default_value == 2) } else {
lyxerr << "no"; return askQuestion_pimpl(s1, s2, s3);
else }
lyxerr << "cancel"; }
lyxerr << endl
<< "----------------------------------------" << endl;
return default_value; int Alert::askConfirmation(string const & s1, string const & s2,
} else { string const & s3, int default_value)
return askConfirmation_pimpl(s1, s2, s3); {
} if (!lyxrc.use_gui) {
} lyxerr << "----------------------------------------" << endl
<< s1 << endl;
std::pair<bool, string> const askForText(string const & msg, string const & dflt) { if (!s2.empty())
if (!lyxrc.use_gui) { lyxerr << s2 << endl;
lyxerr << "----------------------------------------" << endl if (!s3.empty())
<< msg << endl lyxerr << s3 << endl;
<< "Assuming answer is " << dflt lyxerr << "Assuming answer is ";
<< "----------------------------------------" << endl; if (default_value == 1)
return std::make_pair<bool, string>(true, dflt); lyxerr << "yes";
} else { else if (default_value == 2)
return askForText_pimpl(msg, dflt); lyxerr << "no";
} else
lyxerr << "cancel";
lyxerr << endl
<< "----------------------------------------" << endl;
return default_value;
} else {
return askConfirmation_pimpl(s1, s2, s3);
}
}
pair<bool, string> const Alert::askForText(string const & msg,
string const & dflt)
{
if (!lyxrc.use_gui) {
lyxerr << "----------------------------------------" << endl
<< msg << endl
<< "Assuming answer is " << dflt
<< "----------------------------------------" << endl;
return make_pair<bool, string>(true, dflt);
} else {
return askForText_pimpl(msg, dflt);
} }
} }

View File

@ -1,3 +1,4 @@
// -*- C++ -*-
/** /**
* \file Alert.h * \file Alert.h
* Copyright 2001 the LyX Team * Copyright 2001 the LyX Team
@ -6,26 +7,35 @@
* \author John Levon <moz@compsoc.man.ac.uk> * \author John Levon <moz@compsoc.man.ac.uk>
*/ */
#ifndef LYX_ALERT_H
#define LYX_ALERT_H
#include "support/lstrings.h" #include "support/lstrings.h"
#include <algorithm> #include <algorithm>
namespace Alert { namespace Alert {
/// show an alert message
void alert(string const & s1, string const & s2 = string(),
string const & s3 = string());
/// show an alert message and strerror(errno) /// show an alert message
void err_alert(string const & s1, string const & s2 = string()); void alert(string const & s1, string const & s2 = string(),
string const & s3 = string());
/// ask a question /// show an alert message and strerror(errno)
bool askQuestion(string const & s1, string const & s2 = string(), void err_alert(string const & s1, string const & s2 = string());
/// ask a question
bool askQuestion(string const & s1, string const & s2 = string(),
string const & s3 = string(), bool default_value = true); string const & s3 = string(), bool default_value = true);
/// Returns 1 for yes, 2 for no, 3 for cancel. /// Returns 1 for yes, 2 for no, 3 for cancel.
int askConfirmation(string const & s1, string const & s2 = string(), int askConfirmation(string const & s1, string const & s2 = string(),
string const & s3 = string(), int default_value = 1); string const & s3 = string(), int default_value = 1);
/// Asks for a text /// Asks for a text
std::pair<bool, string> const askForText(string const & msg, std::pair<bool, string> const
string const & dflt = string()); askForText(string const & msg,
string const & dflt = string());
} }
#endif

View File

@ -9,17 +9,16 @@ ETAGS_ARGS = --lang=c++
BOOST_INCLUDES = -I$(top_srcdir)/boost BOOST_INCLUDES = -I$(top_srcdir)/boost
INCLUDES = ${FRONTEND_INCLUDES} -I${srcdir}/.. -I${srcdir}/xforms ${SIGC_CFLAGS} $(BOOST_INCLUDES) INCLUDES = ${FRONTEND_INCLUDES} -I${srcdir}/.. -I${srcdir}/xforms ${SIGC_CFLAGS} $(BOOST_INCLUDES)
LIBS = LIBS =
noinst_LTLIBRARIES = libfrontends.la noinst_LTLIBRARIES = libfrontends.o
libfrontends_la_LIBADD= @FRONTEND_GUILIB@ \ libfrontends_o_LIBADD= `cat libxforms.objects` \
support/libfrontendsupport.la \ `cat libcontrollers.objects` \
controllers/libcontrollers.la support/libfrontendsupport.o
libfrontends_la_DEPENDENCIES = @FRONTEND_GUILIB@ \ libfrontends_o_DEPENDENCIES = \
support/libfrontendsupport.la \ support/libfrontendsupport.o
controllers/libcontrollers.la
libfrontends_la_SOURCES=\ libfrontends_o_SOURCES=\
Alert.C \ Alert.C \
Alert.h \ Alert.h \
Alert_pimpl.h \ Alert_pimpl.h \

View File

@ -229,7 +229,7 @@ void ControlCharacter::setLanguage(string const & val)
if (val == _("No change")) if (val == _("No change"))
font_->setLanguage(ignore_language); font_->setLanguage(ignore_language);
else if ( val == _("Reset")) else if (val == _("Reset"))
font_->setLanguage(lv_.buffer()->params.language); font_->setLanguage(lv_.buffer()->params.language);
else else

View File

@ -1,7 +1,7 @@
AUTOMAKE_OPTIONS = foreign 1.4 AUTOMAKE_OPTIONS = foreign 1.4
DISTCLEANFILES= *.orig *.rej *~ *.bak core DISTCLEANFILES= *.orig *.rej *~ *.bak core
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
noinst_LTLIBRARIES = libcontrollers.la noinst_LTLIBRARIES = libcontrollers.o
BOOST_INCLUDES = -I$(top_srcdir)/boost BOOST_INCLUDES = -I$(top_srcdir)/boost
INCLUDES = -I${top_srcdir}/src/ \ INCLUDES = -I${top_srcdir}/src/ \
-I${top_srcdir}/src/frontends/ \ -I${top_srcdir}/src/frontends/ \
@ -11,7 +11,7 @@ ETAGS_ARGS = --lang=c++
EXTRA_DIST = ButtonController.tmpl ControlDialog.tmpl ControlInset.tmpl EXTRA_DIST = ButtonController.tmpl ControlDialog.tmpl ControlInset.tmpl
libcontrollers_la_SOURCES=\ libcontrollers_o_SOURCES=\
biblio.C \ biblio.C \
biblio.h \ biblio.h \
character.C \ character.C \
@ -87,3 +87,9 @@ libcontrollers_la_SOURCES=\
ViewBase.h \ ViewBase.h \
helper_funcs.C \ helper_funcs.C \
helper_funcs.h helper_funcs.h
libcontrollers.o: $(libcontrollers_o_OBJECTS) $(libcontrollers_o_DEPENDENCIES)
rm -f ../libcontrollers.objects
for fil in $(libcontrollers_o_OBJECTS) ; do \
echo controllers/$$fil >> ../libcontrollers.objects ; \
done

View File

@ -302,7 +302,7 @@ searchKeys(InfoMap const & theMap,
bool caseSensitive) bool caseSensitive)
{ {
// Preliminary checks // Preliminary checks
if(start < keys.begin() || start >= keys.end()) if (start < keys.begin() || start >= keys.end())
return keys.end(); return keys.end();
string search_expr = frontStrip(strip(expr)); string search_expr = frontStrip(strip(expr));

View File

@ -121,7 +121,7 @@ string const browseRelFile(LyXView * lv, string const & filename,
string const outname = browseFile(lv, fname, title, pattern, string const outname = browseFile(lv, fname, title, pattern,
dir1, dir2); dir1, dir2);
string const reloutname = MakeRelPath(outname, refpath); string const reloutname = MakeRelPath(outname, refpath);
if(prefixIs(reloutname, "../")) if (prefixIs(reloutname, "../"))
return outname; return outname;
else else
return reloutname; return reloutname;

View File

@ -1,12 +1,12 @@
AUTOMAKE_OPTIONS = foreign 1.4 AUTOMAKE_OPTIONS = foreign 1.4
DISTCLEANFILES= *.orig *.rej *~ *.bak core DISTCLEANFILES= *.orig *.rej *~ *.bak core
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
noinst_LTLIBRARIES = libfrontendsupport.la noinst_LTLIBRARIES = libfrontendsupport.o
LIBS = LIBS =
ETAGS_ARGS = --lang=c++ ETAGS_ARGS = --lang=c++
INCLUDES = -I${srcdir}/../../ $(SIGC_CFLAGS) INCLUDES = -I${srcdir}/../../ $(SIGC_CFLAGS)
libfrontendsupport_la_SOURCES = \ libfrontendsupport_o_SOURCES = \
LyXImage.h \ LyXImage.h \
LyXImage.C LyXImage.C

View File

@ -45,7 +45,7 @@ RGBColor::RGBColor(HSVColor const & hsv)
h /= 60.0; h /= 60.0;
int const j = max(0, static_cast<int>(::floor(h))); int const j = max(0, static_cast<int>(::floor(h)));
//if( j < 0 ) j = 0; //if (j < 0) j = 0;
double const f = h - j; double const f = h - j;
double const p = v * (1.0 - s); double const p = v * (1.0 - s);
@ -91,9 +91,9 @@ RGBColor::RGBColor(HSVColor const & hsv)
} }
} }
r = static_cast<int>( ::floor((rd * 255.0) + 0.5) ); r = static_cast<int>(::floor((rd * 255.0) + 0.5));
g = static_cast<int>( ::floor((gd * 255.0) + 0.5) ); g = static_cast<int>(::floor((gd * 255.0) + 0.5));
b = static_cast<int>( ::floor((bd * 255.0) + 0.5) ); b = static_cast<int>(::floor((bd * 255.0) + 0.5));
} }
@ -103,8 +103,8 @@ HSVColor::HSVColor(RGBColor const & rgb)
double const g = rgb.g / 255.0; double const g = rgb.g / 255.0;
double const b = rgb.b / 255.0; double const b = rgb.b / 255.0;
double const maxval = max( max( r, g ), b ); double const maxval = max( max( r, g), b);
double const minval = min( min( r, g ), b ); double const minval = min( min( r, g), b);
v = maxval; v = maxval;

View File

@ -43,7 +43,7 @@ struct RGBColor {
struct NamedColor : public RGBColor { struct NamedColor : public RGBColor {
string name; string name;
NamedColor() : RGBColor() {} NamedColor() : RGBColor() {}
NamedColor(string const & n, RGBColor const & c ) NamedColor(string const & n, RGBColor const & c)
: RGBColor(c), name(n) {} : RGBColor(c), name(n) {}
RGBColor const & color() const { return *this; } RGBColor const & color() const { return *this; }
string const & getname() const { return name; } string const & getname() const { return name; }

View File

@ -13,7 +13,11 @@
#include <iostream> #include <iostream>
#include <cctype> #include <cctype>
using std::vector;
namespace { namespace {
extern "C" void C_CompletedCB(FL_OBJECT * ob, long) extern "C" void C_CompletedCB(FL_OBJECT * ob, long)
@ -54,15 +58,17 @@ DropDown::~DropDown()
} }
void DropDown::select(std::vector<string> const & choices, int x, int y, int w) void DropDown::select(vector<string> const & choices, int x, int y, int w)
{ {
if (choices.empty()) if (choices.empty())
return; return;
fl_set_form_geometry(form_, x, y-100, w, 100); fl_set_form_geometry(form_, x, y-100, w, 100);
fl_clear_browser(browser_); fl_clear_browser(browser_);
for (std::vector<string>::const_iterator cit = choices.begin();
cit != choices.end(); ++cit) { vector<string>::const_iterator cit = choices.begin();
vector<string>::const_iterator end = choices.end();
for (; cit != end; ++cit) {
fl_add_browser_line(browser_, cit->c_str()); fl_add_browser_line(browser_, cit->c_str());
} }
fl_select_browser_line(browser_, 1); fl_select_browser_line(browser_, 1);

View File

@ -192,7 +192,7 @@ void FormBase::fillTooltipChoice(FL_OBJECT * ob)
fl_clear_choice(ob); fl_clear_choice(ob);
fl_addto_choice(ob, _(" None | Normal | Verbose ")); fl_addto_choice(ob, _(" None | Normal | Verbose "));
switch(tooltip_level_){ switch (tooltip_level_) {
case NO_TOOLTIP: case NO_TOOLTIP:
fl_set_choice(ob, 1); fl_set_choice(ob, 1);
break; break;
@ -211,7 +211,7 @@ void FormBase::setTooltipLevel(FL_OBJECT * ob)
lyx::Assert(ob && ob->objclass == FL_CHOICE && lyx::Assert(ob && ob->objclass == FL_CHOICE &&
fl_get_choice_maxitems(ob) == 3); fl_get_choice_maxitems(ob) == 3);
switch(fl_get_choice(ob)){ switch (fl_get_choice(ob)) {
case 1: case 1:
tooltip_level_ = NO_TOOLTIP; tooltip_level_ = NO_TOOLTIP;
break; break;
@ -313,7 +313,7 @@ static int C_FormBasePrehandler(FL_OBJECT * ob, int event,
// using the middle mouse button. // using the middle mouse button.
pre->InputCB(ob, 0); pre->InputCB(ob, 0);
} else if (event == FL_ENTER || event == FL_LEAVE){ } else if (event == FL_ENTER || event == FL_LEAVE) {
// Post feedback as the mouse enters the object, // Post feedback as the mouse enters the object,
// remove it as the mouse leaves. // remove it as the mouse leaves.
pre->FeedbackCB(ob, event); pre->FeedbackCB(ob, event);

View File

@ -26,6 +26,10 @@
#include "support/filetools.h" #include "support/filetools.h"
using std::vector;
using std::sort;
typedef FormCB<ControlBibtex, FormDB<FD_form_bibtex> > base_class; typedef FormCB<ControlBibtex, FormDB<FD_form_bibtex> > base_class;
FormBibtex::FormBibtex(ControlBibtex & c) FormBibtex::FormBibtex(ControlBibtex & c)
@ -133,17 +137,19 @@ namespace {
// Remove all duplicate entries in c. // Remove all duplicate entries in c.
// Taken stright out of Stroustrup // Taken stright out of Stroustrup
template<class C> void eliminate_duplicates(C & c) template<class C>
void eliminate_duplicates(C & c)
{ {
std::sort(c.begin(), c.end()); // sort sort(c.begin(), c.end());
typename C::iterator p = std::unique(c.begin(), c.end()); // compact typename C::iterator p = std::unique(c.begin(), c.end());
c.erase(p, c.end()); // shrink c.erase(p, c.end());
} }
string const unique_and_no_extensions(string const & str_in) string const unique_and_no_extensions(string const & str_in)
{ {
std::vector<string> dbase = getVectorFromString(str_in); vector<string> dbase = getVectorFromString(str_in);
for (std::vector<string>::iterator it = dbase.begin(); for (vector<string>::iterator it = dbase.begin();
it != dbase.end(); ++it) { it != dbase.end(); ++it) {
*it = ChangeExtension(*it, ""); *it = ChangeExtension(*it, "");
} }
@ -183,7 +189,7 @@ void FormBibtex::apply()
// bibtotoc and no style // bibtotoc and no style
controller().params().setOptions("bibtotoc"); controller().params().setOptions("bibtotoc");
} else if (!bibstyle.empty()){ } else if (!bibstyle.empty()) {
// only style // only style
controller().params().setOptions(bibstyle); controller().params().setOptions(bibstyle);
} }

View File

@ -24,6 +24,8 @@
#include "helper_funcs.h" #include "helper_funcs.h"
using std::vector; using std::vector;
using std::find;
using namespace character; using namespace character;
typedef FormCB<ControlCharacter, FormDB<FD_form_character> > base_class; typedef FormCB<ControlCharacter, FormDB<FD_form_character> > base_class;
@ -140,8 +142,7 @@ namespace {
template<class A> template<class A>
typename vector<A>::size_type findPos(vector<A> const & vec, A const & val) typename vector<A>::size_type findPos(vector<A> const & vec, A const & val)
{ {
vector<A>::const_iterator it = vector<A>::const_iterator it = find(vec.begin(), vec.end(), val);
std::find(vec.begin(), vec.end(), val);
if (it == vec.end()) if (it == vec.end())
return 0; return 0;
return it - vec.begin(); return it - vec.begin();

View File

@ -251,7 +251,7 @@ ButtonPolicy::SMInput FormCitation::input(FL_OBJECT * ob, long)
string const tmp = formatted(biblio::getInfo(theMap, string const tmp = formatted(biblio::getInfo(theMap,
bibkeys[sel-1]), bibkeys[sel-1]),
dialog_->browser_info->w-10 ); dialog_->browser_info->w-10);
fl_add_browser_line(dialog_->browser_info, tmp.c_str()); fl_add_browser_line(dialog_->browser_info, tmp.c_str());
// Highlight the selected browser_bib key in browser_cite if // Highlight the selected browser_bib key in browser_cite if

View File

@ -65,14 +65,14 @@ FormDocument::FormDocument(LyXView * lv, Dialogs * d)
void FormDocument::redraw() void FormDocument::redraw()
{ {
if( form() && form()->visible ) if (form() && form()->visible)
fl_redraw_form( form() ); fl_redraw_form(form());
else else
return; return;
FL_FORM * outer_form = fl_get_active_folder(dialog_->tabbed_folder); FL_FORM * outer_form = fl_get_active_folder(dialog_->tabbed_folder);
if (outer_form && outer_form->visible) if (outer_form && outer_form->visible)
fl_redraw_form( outer_form ); fl_redraw_form(outer_form);
} }
@ -376,9 +376,9 @@ bool saveParamsAsDefault(BufferParams const &params)
} //namespace } //namespace
bool FormDocument::input( FL_OBJECT * ob, long data ) bool FormDocument::input(FL_OBJECT * ob, long data)
{ {
State cb = static_cast<State>( data ); State cb = static_cast<State>(data);
switch (cb) { switch (cb) {
case CHECKCHOICECLASS: case CHECKCHOICECLASS:
@ -1272,7 +1272,7 @@ bool FormDocument::CheckDocumentInput(FL_OBJECT * ob, long)
} }
void FormDocument::ChoiceBulletSize(FL_OBJECT * ob, long /*data*/ ) void FormDocument::ChoiceBulletSize(FL_OBJECT * ob, long /*data*/)
{ {
BufferParams & param = lv_->buffer()->params; BufferParams & param = lv_->buffer()->params;
@ -1305,13 +1305,13 @@ void FormDocument::BulletDepth(FL_OBJECT * ob, State cb)
BufferParams & param = lv_->buffer()->params; BufferParams & param = lv_->buffer()->params;
int data = 0; int data = 0;
if (cb == BULLETDEPTH1 ) if (cb == BULLETDEPTH1)
data = 0; data = 0;
else if (cb == BULLETDEPTH2 ) else if (cb == BULLETDEPTH2)
data = 1; data = 1;
else if (cb == BULLETDEPTH3 ) else if (cb == BULLETDEPTH3)
data = 2; data = 2;
else if (cb == BULLETDEPTH4 ) else if (cb == BULLETDEPTH4)
data = 3; data = 3;
switch (fl_get_button_numb(ob)) { switch (fl_get_button_numb(ob)) {
@ -1334,17 +1334,17 @@ void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, State cb)
/* by the user. (eg. standard.xpm, psnfss1.xpm etc...) */ /* by the user. (eg. standard.xpm, psnfss1.xpm etc...) */
int data = 0; int data = 0;
if (cb == BULLETPANEL1 ) if (cb == BULLETPANEL1)
data = 0; data = 0;
else if (cb == BULLETPANEL2 ) else if (cb == BULLETPANEL2)
data = 1; data = 1;
else if (cb == BULLETPANEL3 ) else if (cb == BULLETPANEL3)
data = 2; data = 2;
else if (cb == BULLETPANEL4 ) else if (cb == BULLETPANEL4)
data = 3; data = 3;
else if (cb == BULLETPANEL5 ) else if (cb == BULLETPANEL5)
data = 4; data = 4;
else if (cb == BULLETPANEL6 ) else if (cb == BULLETPANEL6)
data = 5; data = 5;
if (data != current_bullet_panel) { if (data != current_bullet_panel) {
@ -1390,7 +1390,7 @@ void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, State cb)
} }
void FormDocument::BulletBMTable(FL_OBJECT * ob, long /*data*/ ) void FormDocument::BulletBMTable(FL_OBJECT * ob, long /*data*/)
{ {
/* handle the user input by setting the current bullet depth's pixmap */ /* handle the user input by setting the current bullet depth's pixmap */
/* to that extracted from the current chosen position of the BMTable */ /* to that extracted from the current chosen position of the BMTable */

View File

@ -83,7 +83,7 @@ private:
/// Build the dialog /// Build the dialog
virtual void build(); virtual void build();
/// Filter the inputs /// Filter the inputs
virtual bool input( FL_OBJECT *, long ); virtual bool input( FL_OBJECT *, long);
/// Update the dialog. /// Update the dialog.
virtual void update(); virtual void update();
/// Apply from dialog /// Apply from dialog

View File

@ -56,7 +56,7 @@ FormGraphics::FormGraphics(ControlGraphics & c)
void FormGraphics::redraw() void FormGraphics::redraw()
{ {
if(form() && form()->visible) if (form() && form()->visible)
fl_redraw_form(form()); fl_redraw_form(form());
else else
return; return;

View File

@ -91,7 +91,7 @@ void FormCommand::createInset(string const & arg)
} }
params.setFromString(arg); params.setFromString(arg);
if ( !arg.empty() ) if ( !arg.empty())
bc().valid(); // so that the user can press Ok bc().valid(); // so that the user can press Ok
show(); show();
} }

View File

@ -28,7 +28,7 @@ struct FD_form_maths_space;
class FormMathsSpace : public FormMathsSub { class FormMathsSpace : public FormMathsSub {
public: public:
/// ///
FormMathsSpace(LyXView *, Dialogs * , FormMathsPanel const & ); FormMathsSpace(LyXView *, Dialogs * , FormMathsPanel const &);
private: private:
/// Build the dialog /// Build the dialog

View File

@ -35,8 +35,12 @@
#include "support/lstrings.h" #include "support/lstrings.h"
#include <functional>
using Liason::setMinibuffer; using Liason::setMinibuffer;
using SigC::slot; using SigC::slot;
using std::vector;
using std::bind2nd;
FormParagraph::FormParagraph(LyXView * lv, Dialogs * d) FormParagraph::FormParagraph(LyXView * lv, Dialogs * d)
@ -91,8 +95,8 @@ void FormParagraph::changedParagraph()
void FormParagraph::redraw() void FormParagraph::redraw()
{ {
if( form() && form()->visible ) if (form() && form()->visible)
fl_redraw_form( form() ); fl_redraw_form(form());
} }
@ -126,12 +130,22 @@ void FormParagraph::build()
// Create the contents of the unit choices // Create the contents of the unit choices
// Don't include the "%" terms... // Don't include the "%" terms...
std::vector<string> units_vec = getLatexUnits(); #warning A bit dangerous... (Lgb)
for (std::vector<string>::iterator it = units_vec.begin(); vector<string> units_vec = getLatexUnits();
#if 0
for (vector<string>::iterator it = units_vec.begin();
it != units_vec.end(); ++it) { it != units_vec.end(); ++it) {
if (contains(*it, "%")) if (contains(*it, "%"))
it = units_vec.erase(it, it+1) - 1; it = units_vec.erase(it, it+1) - 1;
} }
#else
// Something similar to this is a better way to erase
vector<string>::iterator del =
remove_if(units_vec.begin(), units_vec.end(),
bind2nd(contains_functor(), "%"));
units_vec.erase(del, units_vec.end());
#endif
string units = getStringFromVector(units_vec, "|"); string units = getStringFromVector(units_vec, "|");
fl_addto_choice(dialog_->choice_value_space_above, units.c_str()); fl_addto_choice(dialog_->choice_value_space_above, units.c_str());

View File

@ -37,15 +37,16 @@
#include "lyxrc.h" #include "lyxrc.h"
#include "combox.h" #include "combox.h"
#include "debug.h" #include "debug.h"
#include "support/filetools.h"
#include "support/LAssert.h"
#include "lyxlex.h" #include "lyxlex.h"
#include "input_validators.h" #include "input_validators.h"
#include "xforms_helpers.h" #include "xforms_helpers.h"
#include "helper_funcs.h" #include "helper_funcs.h"
#include "converter.h" #include "converter.h"
#include "support/lyxfunctional.h" #include "support/lyxfunctional.h"
#include "support/lyxmanip.h" #include "support/lyxmanip.h"
#include "support/filetools.h"
#include "support/LAssert.h"
using std::endl; using std::endl;
using std::pair; using std::pair;
@ -53,6 +54,9 @@ using std::make_pair;
using std::max; using std::max;
using std::min; using std::min;
using std::vector; using std::vector;
using std::setw;
using std::setfill;
using SigC::slot; using SigC::slot;
extern string system_lyxdir; extern string system_lyxdir;
@ -564,7 +568,7 @@ void FormPreferences::Colors::AdjustVal(int colAdjust, int colParent,
HSVColor hsv(rgb); HSVColor hsv(rgb);
hsv.v += addVal; hsv.v += addVal;
hsv.v = min( 1.0, max(0.0, hsv.v) ); hsv.v = min(1.0, max(0.0, hsv.v));
rgb = RGBColor(hsv); rgb = RGBColor(hsv);
fl_mapcolor(colAdjust, rgb.r, rgb.g, rgb.b); fl_mapcolor(colAdjust, rgb.r, rgb.g, rgb.b);
@ -580,7 +584,7 @@ void FormPreferences::Colors::InputBrowserLyX() const
// Is the choice an Xforms color... // Is the choice an Xforms color...
RGBColor col; RGBColor col;
if( selLyX-1 < xformsColorDB.size() ) { if (selLyX - 1 < xformsColorDB.size()) {
vector<XformsColor>::size_type const i = selLyX - 1; vector<XformsColor>::size_type const i = selLyX - 1;
col = xformsColorDB[i].color(); col = xformsColorDB[i].color();
} }
@ -643,7 +647,7 @@ void FormPreferences::Colors::InputHSV()
bool modify = false; bool modify = false;
// Is the choice an Xforms color... // Is the choice an Xforms color...
if( selLyX-1 < xformsColorDB.size() ) { if (selLyX - 1 < xformsColorDB.size()) {
vector<XformsColor>::size_type const i = selLyX - 1; vector<XformsColor>::size_type const i = selLyX - 1;
modify = (xformsColorDB[i].color() != col); modify = (xformsColorDB[i].color() != col);
} }
@ -684,7 +688,7 @@ void FormPreferences::Colors::InputRGB()
bool modify = false; bool modify = false;
// Is the choice an Xforms color... // Is the choice an Xforms color...
if( selLyX-1 < xformsColorDB.size() ) { if (selLyX - 1 < xformsColorDB.size()) {
vector<XformsColor>::size_type const i = selLyX - 1; vector<XformsColor>::size_type const i = selLyX - 1;
modify = (xformsColorDB[i].color() != col); modify = (xformsColorDB[i].color() != col);
} }
@ -827,7 +831,7 @@ void FormPreferences::Colors::Modify()
fl_getmcolor(GUI_COLOR_CHOICE, &col.r, &col.g, &col.b); fl_getmcolor(GUI_COLOR_CHOICE, &col.r, &col.g, &col.b);
// Is the choice an Xforms color... // Is the choice an Xforms color...
if( selLyX-1 < xformsColorDB.size() ) { if (selLyX - 1 < xformsColorDB.size()) {
vector<XformsColor>::size_type const i = selLyX - 1; vector<XformsColor>::size_type const i = selLyX - 1;
xformsColorDB[i].r = col.r; xformsColorDB[i].r = col.r;
xformsColorDB[i].g = col.g; xformsColorDB[i].g = col.g;
@ -915,10 +919,10 @@ string const FormPreferences::Colors::X11hexname(RGBColor const & col) const
{ {
ostringstream ostr; ostringstream ostr;
ostr << "#" << std::setbase(16) << std::setfill('0') ostr << "#" << std::setbase(16) << setfill('0')
<< std::setw(2) << col.r << setw(2) << col.r
<< std::setw(2) << col.g << setw(2) << col.g
<< std::setw(2) << col.b; << setw(2) << col.b;
return ostr.str().c_str(); return ostr.str().c_str();
} }
@ -1183,7 +1187,7 @@ void FormPreferences::Converters::UpdateChoices() const
} }
FormPreferences::Formats::Formats( FormPreferences & p ) FormPreferences::Formats::Formats(FormPreferences & p)
: parent_(p) : parent_(p)
{} {}
@ -1408,7 +1412,7 @@ bool FormPreferences::Formats::Input()
} }
FormPreferences::InputsMisc::InputsMisc( FormPreferences & p ) FormPreferences::InputsMisc::InputsMisc(FormPreferences & p)
: parent_(p) : parent_(p)
{} {}
@ -1456,7 +1460,7 @@ void FormPreferences::InputsMisc::update()
} }
FormPreferences::Interface::Interface( FormPreferences & p ) FormPreferences::Interface::Interface(FormPreferences & p)
: parent_(p) : parent_(p)
{} {}
@ -1573,7 +1577,7 @@ void FormPreferences::Interface::update()
} }
FormPreferences::Language::Language( FormPreferences & p ) FormPreferences::Language::Language(FormPreferences & p)
: parent_(p) : parent_(p)
{} {}
@ -1803,7 +1807,7 @@ void FormPreferences::Language::ComboCB(int, void * v, Combox * combox)
} }
FormPreferences::LnFmisc::LnFmisc( FormPreferences & p ) FormPreferences::LnFmisc::LnFmisc(FormPreferences & p)
: parent_(p) : parent_(p)
{} {}
@ -1931,7 +1935,7 @@ void FormPreferences::LnFmisc::update()
} }
FormPreferences::OutputsMisc::OutputsMisc( FormPreferences & p ) FormPreferences::OutputsMisc::OutputsMisc(FormPreferences & p)
: parent_(p) : parent_(p)
{} {}
@ -2029,7 +2033,7 @@ void FormPreferences::OutputsMisc::update()
} }
FormPreferences::Paths::Paths( FormPreferences & p ) FormPreferences::Paths::Paths(FormPreferences & p)
: parent_(p) : parent_(p)
{} {}
@ -2450,7 +2454,7 @@ void FormPreferences::Printer::update()
} }
FormPreferences::ScreenFonts::ScreenFonts( FormPreferences & p ) FormPreferences::ScreenFonts::ScreenFonts(FormPreferences & p)
: parent_(p) : parent_(p)
{} {}
@ -2758,7 +2762,7 @@ void FormPreferences::ScreenFonts::update()
FormPreferences::SpellOptions::SpellOptions( FormPreferences & p ) FormPreferences::SpellOptions::SpellOptions(FormPreferences & p)
: parent_(p) : parent_(p)
{} {}

View File

@ -89,11 +89,11 @@ private:
/// The preemptive handler for feedback messages. /// The preemptive handler for feedback messages.
void Feedback(FL_OBJECT *, int); void Feedback(FL_OBJECT *, int);
/// Print a warning message and set warning flag. /// Print a warning message and set warning flag.
void printWarning( string const & ); void printWarning(string const &);
/** Launch a file dialog and modify input if it returns a new file. /** Launch a file dialog and modify input if it returns a new file.
For an explanation of the various parameters, see xforms_helpers.h. For an explanation of the various parameters, see xforms_helpers.h.
*/ */
void browse( FL_OBJECT * input, void browse(FL_OBJECT * input,
string const & title, string const & pattern, string const & title, string const & pattern,
std::pair<string,string> const & dir1= std::make_pair(string(),string()), std::pair<string,string> const & dir1= std::make_pair(string(),string()),
std::pair<string,string> const & dir2 = std::make_pair(string(),string())); std::pair<string,string> const & dir2 = std::make_pair(string(),string()));
@ -156,7 +156,7 @@ private:
GUI_COLOR_CURSOR = FL_FREE_COL3 GUI_COLOR_CURSOR = FL_FREE_COL3
}; };
/// ///
Colors( FormPreferences & p ); Colors(FormPreferences & p);
/// ///
FD_form_colors const * dialog(); FD_form_colors const * dialog();
/// ///
@ -175,7 +175,7 @@ private:
private: private:
/// ///
void AdjustVal( int, int, double ) const; void AdjustVal(int, int, double) const;
/// ///
void InputBrowserLyX() const; void InputBrowserLyX() const;
/// ///
@ -208,7 +208,7 @@ private:
class Converters { class Converters {
public: public:
/// ///
Converters( FormPreferences & p ); Converters(FormPreferences & p);
/// ///
FD_form_converters const * dialog(); FD_form_converters const * dialog();
/// ///
@ -218,7 +218,7 @@ private:
/// ///
string const feedback(FL_OBJECT const * const) const; string const feedback(FL_OBJECT const * const) const;
/// ///
bool input( FL_OBJECT const * const ); bool input(FL_OBJECT const * const);
/// ///
void update(); void update();
/// ///
@ -252,7 +252,7 @@ private:
class Formats { class Formats {
public: public:
/// ///
Formats( FormPreferences & p ); Formats(FormPreferences & p);
/// ///
FD_form_formats const * dialog(); FD_form_formats const * dialog();
/// ///
@ -262,7 +262,7 @@ private:
/// ///
string const feedback(FL_OBJECT const * const) const; string const feedback(FL_OBJECT const * const) const;
/// ///
bool input( FL_OBJECT const * const ); bool input(FL_OBJECT const * const);
/// ///
void update(); void update();
@ -290,7 +290,7 @@ private:
class InputsMisc { class InputsMisc {
public: public:
/// ///
InputsMisc( FormPreferences & p ); InputsMisc(FormPreferences & p);
/// ///
FD_form_inputs_misc const * dialog(); FD_form_inputs_misc const * dialog();
/// ///
@ -315,7 +315,7 @@ private:
class Interface { class Interface {
public: public:
/// ///
Interface( FormPreferences & p ); Interface(FormPreferences & p);
/// ///
FD_form_interface const * dialog(); FD_form_interface const * dialog();
/// ///
@ -325,7 +325,7 @@ private:
/// ///
string const feedback(FL_OBJECT const * const) const; string const feedback(FL_OBJECT const * const) const;
/// ///
bool input( FL_OBJECT const * const ); bool input(FL_OBJECT const * const);
/// ///
void update(); void update();
@ -342,7 +342,7 @@ private:
class Language { class Language {
public: public:
/// ///
Language( FormPreferences & p ); Language(FormPreferences & p);
/// ///
FD_form_language const * dialog(); FD_form_language const * dialog();
/// ///
@ -352,7 +352,7 @@ private:
/// ///
string const feedback(FL_OBJECT const * const) const; string const feedback(FL_OBJECT const * const) const;
/// ///
bool input( FL_OBJECT const * const ); bool input(FL_OBJECT const * const);
/// ///
void update(); void update();
/// ///
@ -373,7 +373,7 @@ private:
class LnFmisc { class LnFmisc {
public: public:
/// ///
LnFmisc( FormPreferences & p ); LnFmisc(FormPreferences & p);
/// ///
FD_form_lnf_misc const * dialog(); FD_form_lnf_misc const * dialog();
/// ///
@ -398,7 +398,7 @@ private:
class OutputsMisc { class OutputsMisc {
public: public:
/// ///
OutputsMisc( FormPreferences & p ); OutputsMisc(FormPreferences & p);
/// ///
FD_form_outputs_misc const * dialog(); FD_form_outputs_misc const * dialog();
/// ///
@ -423,7 +423,7 @@ private:
class Paths { class Paths {
public: public:
/// ///
Paths( FormPreferences & p ); Paths(FormPreferences & p);
/// ///
FD_form_paths const * dialog(); FD_form_paths const * dialog();
/// ///
@ -450,7 +450,7 @@ private:
class Printer { class Printer {
public: public:
/// ///
Printer( FormPreferences & p ); Printer(FormPreferences & p);
/// ///
FD_form_printer const * dialog(); FD_form_printer const * dialog();
/// ///
@ -475,7 +475,7 @@ private:
class ScreenFonts { class ScreenFonts {
public: public:
/// ///
ScreenFonts( FormPreferences & p ); ScreenFonts(FormPreferences & p);
/// ///
FD_form_screen_fonts const * dialog(); FD_form_screen_fonts const * dialog();
/// ///
@ -502,7 +502,7 @@ private:
class SpellOptions { class SpellOptions {
public: public:
/// ///
SpellOptions( FormPreferences & p ); SpellOptions(FormPreferences & p);
/// ///
FD_form_spelloptions const * dialog(); FD_form_spelloptions const * dialog();
/// ///

View File

@ -120,7 +120,7 @@ void FormSpellchecker::partialUpdate(int id)
fl_set_input(dialog_->input, w.c_str()); fl_set_input(dialog_->input, w.c_str());
fl_set_object_label(dialog_->text, w.c_str()); fl_set_object_label(dialog_->text, w.c_str());
fl_clear_browser(dialog_->browser); fl_clear_browser(dialog_->browser);
while ( !(w = controller().getSuggestion()).empty() ) { while (!(w = controller().getSuggestion()).empty()) {
fl_add_browser_line(dialog_->browser, w.c_str()); fl_add_browser_line(dialog_->browser, w.c_str());
} }
} }

View File

@ -21,15 +21,23 @@
#include "form_tabular.h" #include "form_tabular.h"
#include "LyXView.h" #include "LyXView.h"
#include "Dialogs.h" #include "Dialogs.h"
#include "insets/insettabular.h"
#include "buffer.h" #include "buffer.h"
#include "xforms_helpers.h" #include "xforms_helpers.h"
#include "lyxrc.h" // to set the default length values #include "lyxrc.h" // to set the default length values
#include "helper_funcs.h" #include "helper_funcs.h"
#include "input_validators.h" #include "input_validators.h"
#include "insets/insettabular.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include <functional>
using SigC::slot; using SigC::slot;
using std::vector;
using std::bind2nd;
FormTabular::FormTabular(LyXView * lv, Dialogs * d) FormTabular::FormTabular(LyXView * lv, Dialogs * d)
: FormInset(lv, d, _("Tabular Layout")), : FormInset(lv, d, _("Tabular Layout")),
@ -45,7 +53,7 @@ FormTabular::FormTabular(LyXView * lv, Dialogs * d)
void FormTabular::redraw() void FormTabular::redraw()
{ {
if(form() && form()->visible) if (form() && form()->visible)
fl_redraw_form(form()); fl_redraw_form(form());
else else
return; return;
@ -137,12 +145,21 @@ void FormTabular::build()
// Create the contents of the unit choices // Create the contents of the unit choices
// Don't include the "%" terms... // Don't include the "%" terms...
std::vector<string> units_vec = getLatexUnits(); vector<string> units_vec = getLatexUnits();
for (std::vector<string>::iterator it = units_vec.begin(); #if 0
for (vector<string>::iterator it = units_vec.begin();
it != units_vec.end(); ++it) { it != units_vec.end(); ++it) {
if (contains(*it, "%")) if (contains(*it, "%"))
it = units_vec.erase(it, it + 1) - 1; it = units_vec.erase(it, it + 1) - 1;
} }
#else
vector<string>::iterator ret =
remove_if(units_vec.begin(),
units_vec.end(),
bind2nd(contains_functor(), "%"));
units_vec.erase(ret, units_vec.end());
#endif
string units = getStringFromVector(units_vec, "|"); string units = getStringFromVector(units_vec, "|");
fl_addto_choice(column_options_->choice_value_column_width, fl_addto_choice(column_options_->choice_value_column_width,

View File

@ -23,6 +23,10 @@
#include "form_tabular_create.h" #include "form_tabular_create.h"
#include "support/lstrings.h" #include "support/lstrings.h"
using std::make_pair;
typedef FormCB<ControlTabularCreate, FormDB<FD_form_tabular_create> > base_class; typedef FormCB<ControlTabularCreate, FormDB<FD_form_tabular_create> > base_class;
FormTabularCreate::FormTabularCreate(ControlTabularCreate & c) FormTabularCreate::FormTabularCreate(ControlTabularCreate & c)
@ -53,5 +57,5 @@ void FormTabularCreate::apply()
unsigned int ysize = (unsigned int)(fl_get_slider_value(dialog_->slider_columns) + 0.5); unsigned int ysize = (unsigned int)(fl_get_slider_value(dialog_->slider_columns) + 0.5);
unsigned int xsize = (unsigned int)(fl_get_slider_value(dialog_->slider_rows) + 0.5); unsigned int xsize = (unsigned int)(fl_get_slider_value(dialog_->slider_rows) + 0.5);
controller().params() = std::make_pair(xsize, ysize); controller().params() = make_pair(xsize, ysize);
} }

View File

@ -85,7 +85,7 @@ ButtonPolicy::SMInput FormTexinfo::input(FL_OBJECT * ob, long) {
unsigned int selection = fl_get_browser(dialog_->browser); unsigned int selection = fl_get_browser(dialog_->browser);
// a valid entry? // a valid entry?
if (selection > 0) { if (selection > 0) {
controller().viewFile( controller().viewFile(
fl_get_browser_line(dialog_->browser, fl_get_browser_line(dialog_->browser,
selection)); selection));
} }

View File

@ -21,6 +21,10 @@
#include "form_thesaurus.h" #include "form_thesaurus.h"
#include "debug.h" #include "debug.h"
using std::vector;
typedef FormCB<ControlThesaurus, FormDB<FD_form_thesaurus> > base_class; typedef FormCB<ControlThesaurus, FormDB<FD_form_thesaurus> > base_class;
FormThesaurus::FormThesaurus(ControlThesaurus & c) FormThesaurus::FormThesaurus(ControlThesaurus & c)
@ -65,17 +69,23 @@ void FormThesaurus::updateMeanings(string const & str)
fl_freeze_form(form()); fl_freeze_form(form());
Thesaurus::Meanings meanings = controller().getMeanings(str); Thesaurus::Meanings meanings = controller().getMeanings(str);
for (Thesaurus::Meanings::const_iterator cit = meanings.begin(); Thesaurus::Meanings::const_iterator cit = meanings.begin();
cit != meanings.end(); ++cit) { Thesaurus::Meanings::const_iterator end = meanings.end();
fl_add_browser_line(dialog_->browser_meanings, cit->first.c_str()); for (; cit != end; ++cit) {
for (std::vector<string>::const_iterator cit2 = cit->second.begin(); fl_add_browser_line(dialog_->browser_meanings,
cit2 != cit->second.end(); ++cit2) { cit->first.c_str());
string ent = " ";
ent += *cit2; vector<string> const & tmpvec = cit->second;
fl_add_browser_line(dialog_->browser_meanings, ent.c_str()); vector<string>::const_iterator cit2 = tmpvec.begin();
} vector<string>::const_iterator end2 = tmpvec.end();
for (; cit2 != end2; ++cit2) {
string ent = " ";
ent += *cit2;
fl_add_browser_line(dialog_->browser_meanings,
ent.c_str());
} }
}
fl_unfreeze_form(form()); fl_unfreeze_form(form());
fl_redraw_form(form()); fl_redraw_form(form());
@ -92,10 +102,13 @@ void FormThesaurus::setReplace(string const & templ, string const & nstr)
bool all_lower = true; bool all_lower = true;
bool all_upper = true; bool all_upper = true;
for (string::const_iterator it = templ.begin(); it != templ.end(); ++it) { string::const_iterator beg = templ.begin();
if (isupper(*it)) string::const_iterator end = templ.end();
string::const_iterator cit = beg;
for (; cit != end; ++cit) {
if (isupper(*cit))
all_lower = false; all_lower = false;
if (islower(*it)) if (islower(*cit))
all_upper = false; all_upper = false;
} }
@ -105,9 +118,10 @@ void FormThesaurus::setReplace(string const & templ, string const & nstr)
str = uppercase(nstr); str = uppercase(nstr);
} else if (templ.size() > 0 && isupper(templ[0])) { } else if (templ.size() > 0 && isupper(templ[0])) {
bool rest_lower = true; bool rest_lower = true;
for (string::const_iterator it = templ.begin() + 1; string::const_iterator cit2 = beg + 1;
it != templ.end(); ++it) {
if (isupper(*it)) for (; cit2 != end; ++cit2) {
if (isupper(*cit2))
rest_lower = false; rest_lower = false;
} }

View File

@ -66,7 +66,7 @@ ButtonPolicy::SMInput FormToc::input(FL_OBJECT * ob, long)
updateContents(); updateContents();
unsigned int const choice = fl_get_browser( dialog_->browser_toc ); unsigned int const choice = fl_get_browser(dialog_->browser_toc);
if (choice - 1 < toclist_.size() && choice >= 1) { if (choice - 1 < toclist_.size() && choice >= 1) {
controller().Goto(toclist_[choice - 1].par->id()); controller().Goto(toclist_[choice - 1].par->id());
@ -134,7 +134,7 @@ void FormToc::updateContents()
fl_get_browser_topline(dialog_->browser_toc); fl_get_browser_topline(dialog_->browser_toc);
unsigned int const line = fl_get_browser(dialog_->browser_toc); unsigned int const line = fl_get_browser(dialog_->browser_toc);
fl_clear_browser( dialog_->browser_toc ); fl_clear_browser(dialog_->browser_toc);
Buffer::SingleList::const_iterator cit = toclist_.begin(); Buffer::SingleList::const_iterator cit = toclist_.begin();
Buffer::SingleList::const_iterator end = toclist_.end(); Buffer::SingleList::const_iterator end = toclist_.end();

View File

@ -27,7 +27,10 @@
If you want to try to compile anyway, delete this test in src/frontends/xforms/GUIRunTime.C. If you want to try to compile anyway, delete this test in src/frontends/xforms/GUIRunTime.C.
#endif #endif
using std::endl; using std::endl;
using std::hex;
extern bool finished; extern bool finished;
@ -74,8 +77,8 @@ void GUIRunTime::processEvents()
XEvent ev; XEvent ev;
fl_XNextEvent(&ev); fl_XNextEvent(&ev);
lyxerr << "Received unhandled X11 event" << endl; lyxerr << "Received unhandled X11 event" << endl;
lyxerr << "Type: 0x" << std::hex << ev.xany.type << lyxerr << "Type: 0x" << hex << ev.xany.type <<
"Target: 0x" << std::hex << ev.xany.window << endl; "Target: 0x" << hex << ev.xany.window << endl;
} }
} }
@ -87,8 +90,8 @@ void GUIRunTime::runTime()
XEvent ev; XEvent ev;
fl_XNextEvent(&ev); fl_XNextEvent(&ev);
lyxerr << "Received unhandled X11 event" << endl; lyxerr << "Received unhandled X11 event" << endl;
lyxerr << "Type: 0x" << std::hex << ev.xany.type << lyxerr << "Type: 0x" << hex << ev.xany.type <<
"Target: 0x" << std::hex << ev.xany.window << endl; "Target: 0x" << hex << ev.xany.window << endl;
} }
} }
} }

View File

@ -1,7 +1,7 @@
AUTOMAKE_OPTIONS = foreign 1.4 AUTOMAKE_OPTIONS = foreign 1.4
DISTCLEANFILES= *.orig *.rej *~ *.bak core DISTCLEANFILES= *.orig *.rej *~ *.bak core
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
noinst_LTLIBRARIES = libxforms.la noinst_LTLIBRARIES = libxforms.o
BOOST_INCLUDES = -I$(top_srcdir)/boost BOOST_INCLUDES = -I$(top_srcdir)/boost
INCLUDES = -I${top_srcdir}/images -I${top_srcdir}/src/ \ INCLUDES = -I${top_srcdir}/images -I${top_srcdir}/src/ \
-I${top_srcdir}/src/frontends/ \ -I${top_srcdir}/src/frontends/ \
@ -12,7 +12,7 @@ LDFLAGS=
LYXDATADIRS = forms LYXDATADIRS = forms
ETAGS_ARGS = --lang=c++ ETAGS_ARGS = --lang=c++
# Alphabetical order please. It makes it easier to figure out what's missing. # Alphabetical order please. It makes it easier to figure out what's missing.
libxforms_la_SOURCES = \ libxforms_o_SOURCES = \
Alert_pimpl.C \ Alert_pimpl.C \
bmtable.c \ bmtable.c \
bmtable.h \ bmtable.h \
@ -205,7 +205,13 @@ libxforms_la_SOURCES = \
# GUI_runtime.C \ # GUI_runtime.C \
# GUI_applymenu.C # GUI_applymenu.C
libxforms_la_LIBADD = @LYX_LIBS@ @FRONTEND_LDFLAGS@ @FRONTEND_LIBS@ libxforms_o_LIBADD = @LYX_LIBS@ @FRONTEND_LDFLAGS@ @FRONTEND_LIBS@
libxforms.o: $(libxforms_o_OBJECTS) $(libxforms_o_DEPENDENCIES)
rm -f ../libxforms.objects
for fil in $(libxforms_o_OBJECTS) ; do \
echo xforms/$$fil >> ../libxforms.objects ; \
done
# for convenience only # for convenience only
updatesrc: updatesrc:

View File

@ -33,6 +33,7 @@ using std::endl;
using std::vector; using std::vector;
using std::max; using std::max;
using std::min; using std::min;
using std::for_each;
typedef vector<int>::size_type size_type; typedef vector<int>::size_type size_type;
@ -384,7 +385,7 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
string const & menu_name, string const & menu_name,
vector<int> & smn) vector<int> & smn)
{ {
if (!menubackend_->hasMenu(menu_name)){ if (!menubackend_->hasMenu(menu_name)) {
lyxerr << "ERROR:create_submenu: Unknown menu `" lyxerr << "ERROR:create_submenu: Unknown menu `"
<< menu_name << "'" << endl; << menu_name << "'" << endl;
return -1; return -1;
@ -591,7 +592,7 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button)
lyxerr << "Error in MenuCallback" << endl; lyxerr << "Error in MenuCallback" << endl;
} }
std::for_each(submenus.begin(), submenus.end(), fl_freepup); for_each(submenus.begin(), submenus.end(), fl_freepup);
// restore tabstop length // restore tabstop length
fl_set_tabstop(default_tabstop); fl_set_tabstop(default_tabstop);

View File

@ -10,10 +10,6 @@
#include <config.h> #include <config.h>
#include <functional>
#include <algorithm>
#include <iterator>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
@ -21,14 +17,20 @@
#include "RadioButtonGroup.h" #include "RadioButtonGroup.h"
#include "debug.h" // for lyxerr #include "debug.h" // for lyxerr
#include "support/lyxfunctional.h"
//#include <functional>
#include <algorithm>
#include <iterator>
using std::find_if; using std::find_if;
using std::bind2nd; //using std::bind2nd;
using std::endl; using std::endl;
void RadioButtonGroup::registerRadioButton(FL_OBJECT *button, int value) void RadioButtonGroup::registerRadioButton(FL_OBJECT *button, int value)
{ {
map.push_back( ButtonValuePair(button, value) ); map.push_back(ButtonValuePair(button, value));
} }
@ -37,6 +39,8 @@ void RadioButtonGroup::reset()
map.clear(); map.clear();
} }
#if 0
// Functor to help us in our work, we should try to find how to achieve // Functor to help us in our work, we should try to find how to achieve
// this with only STL predicates, but its easier to write this than to // this with only STL predicates, but its easier to write this than to
// dig. If you can find the equivalent STL predicate combination, let me // dig. If you can find the equivalent STL predicate combination, let me
@ -58,14 +62,22 @@ struct equal_to_second_in_pair
return left.second == right; return left.second == right;
} }
}; };
#endif
void RadioButtonGroup::setButton(int value) void RadioButtonGroup::setButton(int value)
{ {
#if 0
ButtonValueMap::const_iterator it = ButtonValueMap::const_iterator it =
find_if(map.begin(), map.end(), find_if(map.begin(), map.end(),
bind2nd(equal_to_second_in_pair < ButtonValuePair > (), bind2nd(equal_to_second_in_pair<ButtonValuePair>(),
value)); value));
#else
ButtonValueMap::const_iterator it =
find_if(map.begin(), map.end(),
lyx::equal_2nd_in_pair<ButtonValuePair>(value));
#endif
// If we found nothing, report it and return // If we found nothing, report it and return
if (it == map.end()) { if (it == map.end()) {
lyxerr << "BUG: Requested value in RadioButtonGroup doesn't exists" lyxerr << "BUG: Requested value in RadioButtonGroup doesn't exists"
@ -77,20 +89,22 @@ void RadioButtonGroup::setButton(int value)
} }
template < typename T > template < typename T >
struct is_set_button { struct is_set_button {
bool operator() (T const & item) const bool operator() (T const & item) const
{ {
return fl_get_button( (item).first ); return fl_get_button((item).first);
} }
}; };
int RadioButtonGroup::getButton() int RadioButtonGroup::getButton()
{ {
// Find the first button that is active // Find the first button that is active
ButtonValueMap::iterator it = ButtonValueMap::iterator it =
find_if(map.begin(), map.end(), find_if(map.begin(), map.end(),
is_set_button < ButtonValuePair > () ); is_set_button<ButtonValuePair> ());
// If such a button was found, return its value. // If such a button was found, return its value.
if (it != map.end()) { if (it != map.end()) {

View File

@ -22,9 +22,6 @@
#pragma interface #pragma interface
#endif #endif
using std::vector;
using std::pair;
/** This class simplifies the work with a group of radio buttons, /** This class simplifies the work with a group of radio buttons,
* the idea is that you register a bunch of radio buttons with the accompanying * the idea is that you register a bunch of radio buttons with the accompanying
@ -38,7 +35,7 @@ public:
RadioButtonGroup(unsigned n = 5) : map(n) {}; RadioButtonGroup(unsigned n = 5) : map(n) {};
/// Register a radio button with it's corresponding value. /// Register a radio button with it's corresponding value.
void registerRadioButton(FL_OBJECT *button, int value); void registerRadioButton(FL_OBJECT * button, int value);
/// Reset registrations. /// Reset registrations.
void reset(); void reset();
@ -50,9 +47,9 @@ public:
private: private:
/// ///
typedef pair<FL_OBJECT *, int> ButtonValuePair; typedef std::pair<FL_OBJECT *, int> ButtonValuePair;
/// ///
typedef vector<ButtonValuePair> ButtonValueMap; typedef std::vector<ButtonValuePair> ButtonValueMap;
/// ///
ButtonValueMap map; ButtonValueMap map;
}; };

View File

@ -130,13 +130,13 @@ int BubblePost(FL_OBJECT *ob, int event,
FL_OBJECT * bubble_timer = reinterpret_cast<FL_OBJECT *>(ob->u_cdata); FL_OBJECT * bubble_timer = reinterpret_cast<FL_OBJECT *>(ob->u_cdata);
// We do not test for empty help here, since this can never happen // We do not test for empty help here, since this can never happen
if (event == FL_ENTER){ if (event == FL_ENTER) {
fl_set_object_callback(bubble_timer, fl_set_object_callback(bubble_timer,
C_Toolbar_BubbleTimerCB, C_Toolbar_BubbleTimerCB,
reinterpret_cast<long>(ob)); reinterpret_cast<long>(ob));
fl_set_timer(bubble_timer, 1); fl_set_timer(bubble_timer, 1);
} }
else if (event != FL_MOTION){ else if (event != FL_MOTION) {
fl_set_timer(bubble_timer, 0); fl_set_timer(bubble_timer, 0);
fl_hide_oneliner(); fl_hide_oneliner();
} }
@ -390,7 +390,7 @@ void Toolbar::Pimpl::set(bool doingmain)
ToolbarList::iterator item = toollist.begin(); ToolbarList::iterator item = toollist.begin();
ToolbarList::iterator end = toollist.end(); ToolbarList::iterator end = toollist.end();
for (; item != end; ++item) { for (; item != end; ++item) {
switch (item->action){ switch (item->action) {
case ToolbarDefaults::SEPARATOR: case ToolbarDefaults::SEPARATOR:
xpos += sepspace; xpos += sepspace;
break; break;

View File

@ -107,13 +107,13 @@ int TooltipHandler(FL_OBJECT *ob, int event)
lyx::Assert(timer); lyx::Assert(timer);
// We do not test for empty help here, since this can never happen // We do not test for empty help here, since this can never happen
if (event == FL_ENTER){ if (event == FL_ENTER) {
fl_set_object_callback(timer, fl_set_object_callback(timer,
C_TooltipTimerCB, C_TooltipTimerCB,
reinterpret_cast<long>(ob)); reinterpret_cast<long>(ob));
fl_set_timer(timer, 1); fl_set_timer(timer, 1);
} }
else if (event != FL_MOTION){ else if (event != FL_MOTION) {
fl_set_timer(timer, 0); fl_set_timer(timer, 0);
fl_hide_oneliner(); fl_hide_oneliner();
} }

View File

@ -235,7 +235,8 @@ void Combox::add(int x, int y, int w, int hmin, int hmax,
FL_FORM * current_form = fl_current_form; FL_FORM * current_form = fl_current_form;
fl_end_form(); fl_end_form();
bw = w + 20; bh = hmax - hmin - 12; bw = w + 20;
bh = hmax - hmin - 12;
form = fl_bgn_form(FL_NO_BOX, bw, bh); form = fl_bgn_form(FL_NO_BOX, bw, bh);
browser = obj = fl_add_browser(FL_HOLD_BROWSER, 0, 0, bw, bh, ""); browser = obj = fl_add_browser(FL_HOLD_BROWSER, 0, 0, bw, bh, "");
@ -291,14 +292,14 @@ void Combox::show()
int folder_x, folder_y, folder_w, folder_h; int folder_x, folder_y, folder_w, folder_h;
fl_get_folder_area( tabfolder1, fl_get_folder_area( tabfolder1,
&folder_x, &folder_y, &folder_x, &folder_y,
&folder_w, &folder_h ); &folder_w, &folder_h);
x += folder_x; x += folder_x;
y += folder_y; y += folder_y;
if (tabfolder2) { if (tabfolder2) {
fl_get_folder_area( tabfolder2, fl_get_folder_area( tabfolder2,
&folder_x, &folder_y, &folder_x, &folder_y,
&folder_w, &folder_h ); &folder_w, &folder_h);
x += tabfolder2->form->x + folder_x; x += tabfolder2->form->x + folder_x;
y += tabfolder2->form->y + folder_y; y += tabfolder2->form->y + folder_y;
} else { } else {
@ -313,7 +314,7 @@ void Combox::show()
fl_set_form_position(form, x, y); fl_set_form_position(form, x, y);
fl_show_form(form, FL_PLACE_POSITION, FL_NOBORDER, ""); fl_show_form(form, FL_PLACE_POSITION, FL_NOBORDER, "");
if (sel>0) { if (sel > 0) {
fl_set_browser_topline(browser, sel); fl_set_browser_topline(browser, sel);
fl_select_browser_line(browser, sel); fl_select_browser_line(browser, sel);
} }
@ -345,7 +346,7 @@ void Combox::hide(int who)
XFlush(fl_get_display()); XFlush(fl_get_display());
} }
if (button) { if (button) {
if (type != FL_COMBOX_NORMAL){ if (type != FL_COMBOX_NORMAL) {
fl_set_object_label(button, "@2->"); fl_set_object_label(button, "@2->");
fl_redraw_object(button); fl_redraw_object(button);
} }

View File

@ -318,7 +318,7 @@ string formatted(string const & sin, int w, int size, int style)
} }
// Flush remaining contents of word // Flush remaining contents of word
if (!word.empty() ) sentence.push_back(word); if (!word.empty()) sentence.push_back(word);
string line; string line;
string line_plus_word; string line_plus_word;
@ -334,7 +334,7 @@ string formatted(string const & sin, int w, int size, int style)
line.erase(); line.erase();
} }
if (!line_plus_word.empty() ) line_plus_word += ' '; if (!line_plus_word.empty()) line_plus_word += ' ';
line_plus_word += word; line_plus_word += word;
int const length = fl_get_string_width(style, size, int const length = fl_get_string_width(style, size,

View File

@ -15,21 +15,24 @@
#pragma implementation #pragma implementation
#endif #endif
#include "graphics/GraphicsCache.h"
#include "graphics/GraphicsCacheItem.h" #include "graphics/GraphicsCacheItem.h"
#include "frontends/support/LyXImage.h" #include "graphics/GraphicsCache.h"
#include "graphics/ImageLoaderXPM.h" #include "graphics/ImageLoaderXPM.h"
#include "converter.h" #include "converter.h"
#include "support/filetools.h"
#include "support/lyxlib.h"
#include "lyx_gui_misc.h" #include "lyx_gui_misc.h"
#include "debug.h" #include "debug.h"
#include "support/LAssert.h" #include "support/LAssert.h"
#include "gettext.h" #include "gettext.h"
#include "lyxfunc.h" #include "lyxfunc.h"
#include "frontends/support/LyXImage.h"
#include "support/filetools.h"
#include "support/lyxlib.h"
using std::endl; using std::endl;
/* /*
* The order of conversion: * The order of conversion:
* *
@ -47,12 +50,10 @@ using std::endl;
*/ */
GraphicsCacheItem::GraphicsCacheItem(string const & filename) GraphicsCacheItem::GraphicsCacheItem(string const & filename)
: imageStatus_(GraphicsCacheItem::Loading) : filename_(filename), imageStatus_(GraphicsCacheItem::Loading)
{ {
filename_ = filename;
bool success = convertImage(filename); bool success = convertImage(filename);
if (! success) // Conversion failed miserably (couldn't even start). if (!success) // Conversion failed miserably (couldn't even start).
setStatus(ErrorConverting); setStatus(ErrorConverting);
} }
@ -62,7 +63,10 @@ GraphicsCacheItem::~GraphicsCacheItem()
GraphicsCacheItem::ImageStatus GraphicsCacheItem::ImageStatus
GraphicsCacheItem::getImageStatus() const { return imageStatus_; } GraphicsCacheItem::getImageStatus() const
{
return imageStatus_;
}
void GraphicsCacheItem::setStatus(ImageStatus new_status) void GraphicsCacheItem::setStatus(ImageStatus new_status)
@ -72,7 +76,10 @@ void GraphicsCacheItem::setStatus(ImageStatus new_status)
LyXImage * LyXImage *
GraphicsCacheItem::getImage() const { return image_.get(); } GraphicsCacheItem::getImage() const
{
return image_.get();
}
void GraphicsCacheItem::imageConverted(bool success) void GraphicsCacheItem::imageConverted(bool success)
@ -112,7 +119,7 @@ string const findTargetFormat(string const & from)
} }
if (iter == end) { if (iter == end) {
// We do not know how to convert the image to something loadable. // We do not know how to convert the image to something loadable.
lyxerr << "ERROR: Do not know how to convert image." << std::endl; lyxerr << "ERROR: Do not know how to convert image." << endl;
return string(); return string();
} }
return (*iter); return (*iter);
@ -124,6 +131,8 @@ string const findTargetFormat(string const & from)
bool GraphicsCacheItem::convertImage(string const & filename) bool GraphicsCacheItem::convertImage(string const & filename)
{ {
setStatus(GraphicsCacheItem::Converting); setStatus(GraphicsCacheItem::Converting);
#warning shadowing class variable (Lgb)
// Is this needed at all?
string filename_ = string(filename); string filename_ = string(filename);
lyxerr << "try to convert image file: " << filename_ << endl; lyxerr << "try to convert image file: " << filename_ << endl;
// maybe that other zip extensions also be useful, especially the // maybe that other zip extensions also be useful, especially the
@ -173,7 +182,7 @@ bool GraphicsCacheItem::convertImage(string const & filename)
lyx::unlink(tempfile); lyx::unlink(tempfile);
if (zipped) if (zipped)
lyx::unlink(filename_); lyx::unlink(filename_);
tempfile = string(); tempfile.erase();
return true; return true;
} }

View File

@ -7,31 +7,36 @@
* *
* ================================================= */ * ================================================= */
#include <config.h>
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
#include <config.h>
#include "ImageLoaderXPM.h" #include "ImageLoaderXPM.h"
#include "ColorHandler.h" #include "ColorHandler.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "debug.h"
#include "frontends/support/LyXImage.h" #include "frontends/support/LyXImage.h"
#include "frontends/GUIRunTime.h" #include "frontends/GUIRunTime.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/LAssert.h"
#include XPM_H_LOCATION #include XPM_H_LOCATION
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include "support/LAssert.h"
#include "debug.h"
using std::ifstream;
using std::endl; using std::endl;
using std::ios; using std::ios;
bool ImageLoaderXPM::isImageFormatOK(string const & filename) const bool ImageLoaderXPM::isImageFormatOK(string const & filename) const
{ {
std::ifstream is(filename.c_str(), ios::in); ifstream is(filename.c_str(), ios::in);
// The signature of the file without the spaces. // The signature of the file without the spaces.
static char const str[] = "/*XPM*/"; static char const str[] = "/*XPM*/";
@ -48,6 +53,7 @@ bool ImageLoaderXPM::isImageFormatOK(string const & filename) const
return true; return true;
} }
ImageLoaderXPM::FormatList const ImageLoaderXPM::FormatList const
ImageLoaderXPM::loadableFormats() const ImageLoaderXPM::loadableFormats() const
{ {
@ -56,7 +62,8 @@ ImageLoaderXPM::loadableFormats() const
return formats; return formats;
} }
ImageLoader::Result ImageLoader::Result
ImageLoaderXPM::runImageLoader(string const & filename) ImageLoaderXPM::runImageLoader(string const & filename)
{ {

View File

@ -1,13 +1,13 @@
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
DISTCLEANFILES= *.orig *.rej *~ *.bak core DISTCLEANFILES= *.orig *.rej *~ *.bak core
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
noinst_LTLIBRARIES = libgraphics.la noinst_LTLIBRARIES = libgraphics.o
LIBS = LIBS =
ETAGS_ARGS = --lang=c++ ETAGS_ARGS = --lang=c++
BOOST_INCLUDES = -I$(top_srcdir)/boost BOOST_INCLUDES = -I$(top_srcdir)/boost
INCLUDES = -I${srcdir}/../ $(SIGC_CFLAGS) $(BOOST_INCLUDES) INCLUDES = -I${srcdir}/../ $(SIGC_CFLAGS) $(BOOST_INCLUDES)
libgraphics_la_SOURCES = \ libgraphics_o_SOURCES = \
GraphicsCache.h \ GraphicsCache.h \
GraphicsCache.C \ GraphicsCache.C \
GraphicsCacheItem.h \ GraphicsCacheItem.h \

View File

@ -52,7 +52,7 @@ ExternalTemplateManager::ExternalTemplateManager()
class dumpTemplate { class dumpTemplate {
public: public:
dumpTemplate(std::ostream & o) dumpTemplate(ostream & o)
: ost(o) {} : ost(o) {}
void operator()(ExternalTemplateManager::Templates::value_type const & vt) { void operator()(ExternalTemplateManager::Templates::value_type const & vt) {
ExternalTemplate const & et = vt.second; ExternalTemplate const & et = vt.second;

View File

@ -1,7 +1,7 @@
AUTOMAKE_OPTIONS = foreign AUTOMAKE_OPTIONS = foreign
DISTCLEANFILES= *.orig *.rej *~ *.bak core DISTCLEANFILES= *.orig *.rej *~ *.bak core
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
noinst_LTLIBRARIES = libinsets.la noinst_LTLIBRARIES = libinsets.o
LIBS = LIBS =
ETAGS_ARGS = --lang=c++ ETAGS_ARGS = --lang=c++
BOOST_INCLUDES = -I$(top_srcdir)/boost BOOST_INCLUDES = -I$(top_srcdir)/boost
@ -15,7 +15,7 @@ EXTRA_DIST = \
insettheorem.C \ insettheorem.C \
insettheorem.h insettheorem.h
libinsets_la_SOURCES = \ libinsets_o_SOURCES = \
ExternalTemplate.C \ ExternalTemplate.C \
ExternalTemplate.h \ ExternalTemplate.h \
figinset.C \ figinset.C \

View File

@ -28,6 +28,32 @@
#include <config.h> #include <config.h>
#include "figinset.h"
#include "lyx_main.h"
#include "buffer.h"
#include "LyXView.h" // just because of form_main
#include "debug.h"
#include "LaTeXFeatures.h"
#include "lyxrc.h"
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "Painter.h"
#include "font.h"
#include "bufferview_funcs.h"
#include "ColorHandler.h"
#include "converter.h"
#include "BufferView.h"
#include "frontends/FileDialog.h"
#include "frontends/Alert.h"
#include "frontends/Dialogs.h" // redrawGUI
#include "support/FileInfo.h"
#include "support/lyxlib.h"
#include "support/os.h"
#include "support/filetools.h"
#include <fstream> #include <fstream>
#include <queue> #include <queue>
#include <list> #include <list>
@ -38,36 +64,11 @@
#include <unistd.h> #include <unistd.h>
#include <csignal> #include <csignal>
#include <sys/wait.h> #include <sys/wait.h>
#include FORMS_H_LOCATION
#include <cstdlib> #include <cstdlib>
#include <cctype> #include <cctype>
#include <cmath> #include <cmath>
#include <cerrno> #include <cerrno>
#include "figinset.h"
#include "lyx_main.h"
#include "buffer.h"
#include "frontends/FileDialog.h"
#include "support/filetools.h"
#include "LyXView.h" // just because of form_main
#include "debug.h"
#include "LaTeXFeatures.h"
#include "lyxrc.h"
#include "gettext.h"
#include "lyx_gui_misc.h" // CancelCloseBoxCB
#include "frontends/Alert.h"
#include "support/FileInfo.h"
#include "support/lyxlib.h"
#include "support/os.h"
#include "Painter.h"
#include "font.h"
#include "bufferview_funcs.h"
#include "ColorHandler.h"
#include "converter.h"
#include "frontends/Dialogs.h" // redrawGUI
#include "BufferView.h"
using std::ostream; using std::ostream;
using std::istream; using std::istream;
using std::ofstream; using std::ofstream;
@ -82,6 +83,7 @@ using std::copy;
using std::pair; using std::pair;
using std::make_pair; using std::make_pair;
using std::ios; using std::ios;
using std::ostream_iterator;
#ifndef CXX_GLOBAL_CSTD #ifndef CXX_GLOBAL_CSTD
using std::memcpy; using std::memcpy;
@ -158,7 +160,7 @@ void addpidwait(int pid)
if (lyxerr.debugging()) { if (lyxerr.debugging()) {
lyxerr << "Pids to wait for: \n"; lyxerr << "Pids to wait for: \n";
copy(pidwaitlist.begin(), pidwaitlist.end(), copy(pidwaitlist.begin(), pidwaitlist.end(),
std::ostream_iterator<int>(lyxerr, "\n")); ostream_iterator<int>(lyxerr, "\n"));
lyxerr << flush; lyxerr << flush;
} }
} }
@ -419,10 +421,10 @@ void InitFigures()
vi->visualid, vi->c_class, vi->visualid, vi->c_class,
vi->bits_per_rgb, vi->map_entries); vi->bits_per_rgb, vi->map_entries);
} }
color_visual = ( (vi->c_class == StaticColor) || color_visual = ((vi->c_class == StaticColor) ||
(vi->c_class == PseudoColor) || (vi->c_class == PseudoColor) ||
(vi->c_class == TrueColor) || (vi->c_class == TrueColor) ||
(vi->c_class == DirectColor) ); (vi->c_class == DirectColor));
if ((vi->c_class & 1) == 0) return; if ((vi->c_class & 1) == 0) return;
// now allocate colors // now allocate colors
if (vi->c_class == GrayScale) { if (vi->c_class == GrayScale) {
@ -647,7 +649,7 @@ void runqueue()
env = new char_p[ne + 2]; env = new char_p[ne + 2];
string tmp = t2.str().c_str(); string tmp = t2.str().c_str();
env[0] = new char[tmp.size() + 1]; env[0] = new char[tmp.size() + 1];
std::copy(tmp.begin(), tmp.end(), env[0]); copy(tmp.begin(), tmp.end(), env[0]);
env[0][tmp.size()] = '\0'; env[0][tmp.size()] = '\0';
memcpy(&env[1], environ, memcpy(&env[1], environ,
sizeof(char*) * (ne + 1)); sizeof(char*) * (ne + 1));
@ -1924,7 +1926,7 @@ void InsetFig::restoreForm()
fl_set_input(form->Width, tostr(xwid).c_str()); fl_set_input(form->Width, tostr(xwid).c_str());
fl_set_input(form->Height, tostr(xhgh).c_str()); fl_set_input(form->Height, tostr(xhgh).c_str());
fl_set_input(form->Angle, tostr(angle).c_str()); fl_set_input(form->Angle, tostr(angle).c_str());
if (!fname.empty()){ if (!fname.empty()) {
string buf1 = OnlyPath(owner->fileName()); string buf1 = OnlyPath(owner->fileName());
string fname2 = MakeRelPath(fname, buf1); string fname2 = MakeRelPath(fname, buf1);
fl_set_input(form->EpsFile, fname2.c_str()); fl_set_input(form->EpsFile, fname2.c_str());

View File

@ -7,6 +7,7 @@
#ifndef FIGINSET_H #ifndef FIGINSET_H
#define FIGINSET_H #define FIGINSET_H
#include FORMS_H_LOCATION
#include "figure_form.h" #include "figure_form.h"
#include "LString.h" #include "LString.h"
#include "buffer.h" #include "buffer.h"

View File

@ -142,7 +142,7 @@ void Inset::id(int id_arg)
id_ = id_arg; id_ = id_arg;
} }
void Inset::setFont(BufferView *, LyXFont const &, bool, bool ) void Inset::setFont(BufferView *, LyXFont const &, bool, bool)
{} {}
@ -328,7 +328,7 @@ UpdatableInset::localDispatch(BufferView * bv,
int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
{ {
int w; int w;
if (owner()){ if (owner()) {
w = static_cast<UpdatableInset*> w = static_cast<UpdatableInset*>
(owner())->getMaxWidth(bv, this); (owner())->getMaxWidth(bv, this);
} else { } else {

View File

@ -252,7 +252,7 @@ vector<pair<string, string> > const InsetBibtex::getKeys(Buffer const * buffer)
string linebuf0; string linebuf0;
while (getline(ifs, linebuf0)) { while (getline(ifs, linebuf0)) {
string linebuf = frontStrip(strip(linebuf0)); string linebuf = frontStrip(strip(linebuf0));
if (linebuf.empty() ) continue; if (linebuf.empty()) continue;
if (prefixIs(linebuf, "@")) { if (prefixIs(linebuf, "@")) {
linebuf = subst(linebuf, '{', '('); linebuf = subst(linebuf, '{', '(');
string tmp; string tmp;

View File

@ -18,9 +18,15 @@
#include "BufferView.h" #include "BufferView.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "LyXView.h" #include "LyXView.h"
#include "frontends/Dialogs.h" #include "frontends/Dialogs.h"
#include "support/lstrings.h" #include "support/lstrings.h"
using std::ostream;
InsetCitation::InsetCitation(InsetCommandParams const & p, bool) InsetCitation::InsetCitation(InsetCommandParams const & p, bool)
: InsetCommand(p) : InsetCommand(p)
{} {}
@ -36,7 +42,7 @@ string const InsetCitation::getScreenLabel(Buffer const *) const
keys = frontStrip(split(keys, label, ',')) + ","; keys = frontStrip(split(keys, label, ',')) + ",";
string::size_type const maxSize = 40; string::size_type const maxSize = 40;
while (contains( keys, "," )) { while (contains(keys, ",")) {
string key; string key;
keys = frontStrip(split(keys, key, ',')); keys = frontStrip(split(keys, key, ','));
@ -68,7 +74,7 @@ void InsetCitation::edit(BufferView * bv, bool)
edit(bv, 0, 0, 0); edit(bv, 0, 0, 0);
} }
int InsetCitation::ascii(Buffer const *, std::ostream & os, int) const int InsetCitation::ascii(Buffer const *, ostream & os, int) const
{ {
os << "[" << getContents() << "]"; os << "[" << getContents() << "]";
return 0; return 0;
@ -78,7 +84,7 @@ int InsetCitation::ascii(Buffer const *, std::ostream & os, int) const
// the \cite command is valid. Eg, the user has natbib enabled, inputs some // the \cite command is valid. Eg, the user has natbib enabled, inputs some
// citations and then changes his mind, turning natbib support off. The output // citations and then changes his mind, turning natbib support off. The output
// should revert to \cite[]{} // should revert to \cite[]{}
int InsetCitation::latex(Buffer const * buffer, std::ostream & os, int InsetCitation::latex(Buffer const * buffer, ostream & os,
bool /*fragile*/, bool/*fs*/) const bool /*fragile*/, bool/*fs*/) const
{ {
os << "\\"; os << "\\";

View File

@ -19,21 +19,25 @@
#include "lyxfont.h" #include "lyxfont.h"
#include "BufferView.h" #include "BufferView.h"
#include "Painter.h" #include "Painter.h"
#include "insets/insettext.h"
#include "support/LOstream.h"
#include "support/lstrings.h"
#include "debug.h" #include "debug.h"
#include "lyxtext.h" #include "lyxtext.h"
#include "font.h" #include "font.h"
#include "lyxlex.h" #include "lyxlex.h"
class LyXText; #include "insets/insettext.h"
#include "support/LOstream.h"
#include "support/lstrings.h"
using std::vector;
using std::ostream; using std::ostream;
using std::endl; using std::endl;
using std::max; using std::max;
class LyXText;
InsetCollapsable::InsetCollapsable(bool collapsed) InsetCollapsable::InsetCollapsable(bool collapsed)
: UpdatableInset(), collapsed_(collapsed), : UpdatableInset(), collapsed_(collapsed),
button_length(0), button_top_y(0), button_bottom_y(0), button_length(0), button_top_y(0), button_bottom_y(0),
@ -382,19 +386,19 @@ int InsetCollapsable::latex(Buffer const * buf, ostream & os,
} }
int InsetCollapsable::ascii(Buffer const *buf, std::ostream & os, int ll) const int InsetCollapsable::ascii(Buffer const * buf, ostream & os, int ll) const
{ {
return inset.ascii(buf, os, ll); return inset.ascii(buf, os, ll);
} }
int InsetCollapsable::linuxdoc(Buffer const *buf, std::ostream & os) const int InsetCollapsable::linuxdoc(Buffer const * buf, ostream & os) const
{ {
return inset.linuxdoc(buf, os); return inset.linuxdoc(buf, os);
} }
int InsetCollapsable::docbook(Buffer const *buf, std::ostream & os) const int InsetCollapsable::docbook(Buffer const * buf, ostream & os) const
{ {
return inset.docbook(buf, os); return inset.docbook(buf, os);
} }
@ -564,7 +568,7 @@ void InsetCollapsable::resizeLyXText(BufferView * bv, bool force) const
} }
std::vector<string> const InsetCollapsable::getLabelList() const vector<string> const InsetCollapsable::getLabelList() const
{ {
return inset.getLabelList(); return inset.getLabelList();
} }

View File

@ -27,9 +27,9 @@ InsetCommandParams::InsetCommandParams()
{} {}
InsetCommandParams::InsetCommandParams( string const & n, InsetCommandParams::InsetCommandParams(string const & n,
string const & c, string const & c,
string const & o ) string const & o)
: cmdname(n), contents(c), options(o) : cmdname(n), contents(c), options(o)
{} {}
@ -40,7 +40,7 @@ string const InsetCommandParams::getAsString() const
} }
void InsetCommandParams::setFromString( string const & b ) void InsetCommandParams::setFromString(string const & b)
{ {
string::size_type idx = b.find("|++|"); string::size_type idx = b.find("|++|");
if (idx == string::npos) { if (idx == string::npos) {
@ -126,9 +126,9 @@ void InsetCommandParams::scanCommand(string const & cmd)
} }
// Don't mess with this. // Don't mess with this.
if (!tcmdname.empty()) setCmdName( tcmdname ); if (!tcmdname.empty()) setCmdName(tcmdname);
if (!toptions.empty()) setOptions( toptions ); if (!toptions.empty()) setOptions(toptions);
if (!tcontents.empty()) setContents( tcontents ); if (!tcontents.empty()) setContents(tcontents);
if (lyxerr.debugging(Debug::PARSER)) if (lyxerr.debugging(Debug::PARSER))
lyxerr << "Command <" << cmd lyxerr << "Command <" << cmd
@ -181,15 +181,15 @@ string const InsetCommandParams::getCommand() const
InsetCommand::InsetCommand(InsetCommandParams const & p, bool) InsetCommand::InsetCommand(InsetCommandParams const & p, bool)
: p_( p.getCmdName(), p.getContents(), p.getOptions() ) : p_(p.getCmdName(), p.getContents(), p.getOptions())
{} {}
void InsetCommand::setParams(InsetCommandParams const & p ) void InsetCommand::setParams(InsetCommandParams const & p)
{ {
p_.setCmdName( p.getCmdName() ); p_.setCmdName(p.getCmdName());
p_.setContents( p.getContents() ); p_.setContents(p.getContents());
p_.setOptions( p.getOptions() ); p_.setOptions(p.getOptions());
} }

View File

@ -32,7 +32,7 @@ public:
InsetCommandParams(); InsetCommandParams();
/// ///
explicit explicit
InsetCommandParams( string const & n, InsetCommandParams(string const & n,
string const & c = string(), string const & c = string(),
string const & o = string()); string const & o = string());
/// ///
@ -54,7 +54,7 @@ public:
/// ///
string const & getContents() const { return contents; } string const & getContents() const { return contents; }
/// ///
void setCmdName( string const & n) { cmdname = n; } void setCmdName(string const & n) { cmdname = n; }
/// ///
void setOptions(string const & o) { options = o; } void setOptions(string const & o) { options = o; }
/// ///
@ -62,7 +62,7 @@ public:
/// ///
string const getAsString() const; string const getAsString() const;
/// ///
void setFromString( string const & ); void setFromString(string const &);
private: private:
/// ///
string cmdname; string cmdname;
@ -83,12 +83,12 @@ public:
virtual ~InsetCommand() { hideDialog(); } virtual ~InsetCommand() { hideDialog(); }
/// ///
void write(Buffer const *, std::ostream & os) const void write(Buffer const *, std::ostream & os) const
{ p_.write( os ); } { p_.write(os); }
/// ///
virtual void read(Buffer const *, LyXLex & lex) virtual void read(Buffer const *, LyXLex & lex)
{ p_.read( lex ); } { p_.read(lex); }
/// Can remove one InsetBibKey is modified /// Can remove one InsetBibKey is modified
void scanCommand(string const & c) { p_.scanCommand( c ); }; void scanCommand(string const & c) { p_.scanCommand(c); };
/// ///
virtual int latex(Buffer const *, std::ostream &, virtual int latex(Buffer const *, std::ostream &,
bool fragile, bool free_spc) const; bool fragile, bool free_spc) const;

View File

@ -88,7 +88,7 @@ string const InsetError::editMessage() const
void InsetError::edit(BufferView * bv, int, int, unsigned int) void InsetError::edit(BufferView * bv, int, int, unsigned int)
{ {
bv->owner()->getDialogs()->showError( this ); bv->owner()->getDialogs()->showError(this);
} }

View File

@ -32,7 +32,11 @@
#include "support/LOstream.h" #include "support/LOstream.h"
using std::ostream; using std::ostream;
using std::min;
using std::endl;
using lyx::pos_type; using lyx::pos_type;
@ -125,7 +129,7 @@ void InsetERT::read(Buffer const * buf, LyXLex & lex)
token_found = true; token_found = true;
} else { } else {
lyxerr << "InsetERT::Read: Missing 'status'-tag!" lyxerr << "InsetERT::Read: Missing 'status'-tag!"
<< std::endl; << endl;
// take countermeasures // take countermeasures
lex.pushToken(token); lex.pushToken(token);
} }
@ -179,7 +183,7 @@ void InsetERT::write(Buffer const * buf, ostream & os) const
{ {
string st; string st;
switch(status_) { switch (status_) {
case Open: case Open:
st = "Open"; st = "Open";
break; break;
@ -207,7 +211,7 @@ void InsetERT::write(Buffer const * buf, ostream & os) const
case Paragraph::META_INSET: case Paragraph::META_INSET:
case Paragraph::META_HFILL: case Paragraph::META_HFILL:
lyxerr << "Element is not allowed in insertERT" lyxerr << "Element is not allowed in insertERT"
<< std::endl; << endl;
case Paragraph::META_NEWLINE: case Paragraph::META_NEWLINE:
os << "\n\\newline \n"; os << "\n\\newline \n";
break; break;
@ -343,7 +347,7 @@ void InsetERT::insetMotionNotify(BufferView * bv,
} }
int InsetERT::latex(Buffer const *, std::ostream & os, bool /*fragile*/, int InsetERT::latex(Buffer const *, ostream & os, bool /*fragile*/,
bool /*free_spc*/) const bool /*free_spc*/) const
{ {
Paragraph * par = inset.paragraph(); Paragraph * par = inset.paragraph();
@ -374,13 +378,13 @@ int InsetERT::latex(Buffer const *, std::ostream & os, bool /*fragile*/,
int InsetERT::ascii(Buffer const *, int InsetERT::ascii(Buffer const *,
std::ostream &, int /*linelen*/) const ostream &, int /*linelen*/) const
{ {
return 0; return 0;
} }
int InsetERT::linuxdoc(Buffer const *, std::ostream & os) const int InsetERT::linuxdoc(Buffer const *, ostream & os) const
{ {
Paragraph * par = inset.paragraph(); Paragraph * par = inset.paragraph();
int lines = 0; int lines = 0;
@ -409,7 +413,7 @@ int InsetERT::linuxdoc(Buffer const *, std::ostream & os) const
} }
int InsetERT::docbook(Buffer const *, std::ostream & os) const int InsetERT::docbook(Buffer const *, ostream & os) const
{ {
Paragraph * par = inset.paragraph(); Paragraph * par = inset.paragraph();
int lines = 0; int lines = 0;
@ -447,14 +451,14 @@ InsetERT::localDispatch(BufferView * bv, kb_action action, string const & arg)
set_latex_font(bv); set_latex_font(bv);
} }
switch(action) { switch (action) {
case LFUN_LAYOUT: case LFUN_LAYOUT:
bv->owner()->setLayout(inset.paragraph()->getLayout()); bv->owner()->setLayout(inset.paragraph()->getLayout());
break; break;
default: default:
result = InsetCollapsable::localDispatch(bv, action, arg); result = InsetCollapsable::localDispatch(bv, action, arg);
} }
switch(action) { switch (action) {
case LFUN_BREAKPARAGRAPH: case LFUN_BREAKPARAGRAPH:
case LFUN_BREAKPARAGRAPHKEEPLAYOUT: case LFUN_BREAKPARAGRAPHKEEPLAYOUT:
case LFUN_BACKSPACE: case LFUN_BACKSPACE:
@ -478,7 +482,7 @@ string const InsetERT::get_new_label() const
string la; string la;
pos_type const max_length = 15; pos_type const max_length = 15;
pos_type const p_siz = inset.paragraph()->size(); pos_type const p_siz = inset.paragraph()->size();
pos_type const n = std::min(max_length, p_siz); pos_type const n = min(max_length, p_siz);
int i = 0; int i = 0;
int j = 0; int j = 0;
for(; i < n && j < p_siz; ++j) { for(; i < n && j < p_siz; ++j) {
@ -617,7 +621,7 @@ void InsetERT::status(BufferView * bv, ERTStatus const st) const
{ {
if (st != status_) { if (st != status_) {
status_ = st; status_ = st;
switch(st) { switch (st) {
case Inlined: case Inlined:
inset.setAutoBreakRows(false); inset.setAutoBreakRows(false);
break; break;

View File

@ -14,27 +14,32 @@
#pragma implementation #pragma implementation
#endif #endif
#include <cstdio>
#include <utility>
#include "insetexternal.h" #include "insetexternal.h"
#include "ExternalTemplate.h" #include "ExternalTemplate.h"
#include "BufferView.h" #include "BufferView.h"
#include "buffer.h" #include "buffer.h"
#include "LyXView.h" #include "LyXView.h"
#include "frontends/Dialogs.h"
#include "lyx_main.h" #include "lyx_main.h"
#include "LaTeXFeatures.h" #include "LaTeXFeatures.h"
#include "gettext.h"
#include "debug.h"
#include "frontends/Dialogs.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/lstrings.h" #include "support/lstrings.h"
#include "support/path.h" #include "support/path.h"
#include "support/syscall.h" #include "support/syscall.h"
#include "gettext.h"
#include "debug.h"
#include "support/FileInfo.h" #include "support/FileInfo.h"
#include <cstdio>
#include <utility>
using std::ostream;
using std::endl; using std::endl;
InsetExternal::InsetExternal() InsetExternal::InsetExternal()
: view_(0) : view_(0)
{ {
@ -85,10 +90,10 @@ void InsetExternal::edit(BufferView * bv, bool)
} }
void InsetExternal::write(Buffer const *, std::ostream & os) const void InsetExternal::write(Buffer const *, ostream & os) const
{ {
os << "External " << params_.templ.lyxName << ",\"" << params_.filename os << "External " << params_.templ.lyxName << ",\""
<< "\",\"" << params_.parameters << "\"\n"; << params_.filename << "\",\"" << params_.parameters << "\"\n";
} }
@ -129,15 +134,15 @@ void InsetExternal::read(Buffer const *, LyXLex & lex)
int InsetExternal::write(string const & format, int InsetExternal::write(string const & format,
Buffer const * buf, std::ostream & os) const Buffer const * buf, ostream & os) const
{ {
ExternalTemplate const & et = params_.templ; ExternalTemplate const & et = params_.templ;
ExternalTemplate::Formats::const_iterator cit = ExternalTemplate::Formats::const_iterator cit =
et.formats.find(format); et.formats.find(format);
if (cit == et.formats.end()) { if (cit == et.formats.end()) {
lyxerr << "External template format '" << format lyxerr << "External template format '" << format
<< "' not specified in template " << params_.templ.lyxName << "' not specified in template "
<< endl; << params_.templ.lyxName << endl;
return 0; return 0;
} }
@ -148,25 +153,25 @@ int InsetExternal::write(string const & format,
int InsetExternal::latex(Buffer const * buf, int InsetExternal::latex(Buffer const * buf,
std::ostream & os, bool, bool) const ostream & os, bool, bool) const
{ {
return write("LaTeX", buf, os); return write("LaTeX", buf, os);
} }
int InsetExternal::ascii(Buffer const * buf, std::ostream & os, int) const int InsetExternal::ascii(Buffer const * buf, ostream & os, int) const
{ {
return write("Ascii", buf, os); return write("Ascii", buf, os);
} }
int InsetExternal::linuxdoc(Buffer const * buf, std::ostream & os) const int InsetExternal::linuxdoc(Buffer const * buf, ostream & os) const
{ {
return write("LinuxDoc", buf, os); return write("LinuxDoc", buf, os);
} }
int InsetExternal::docbook(Buffer const * buf, std::ostream & os) const int InsetExternal::docbook(Buffer const * buf, ostream & os) const
{ {
return write("DocBook", buf, os); return write("DocBook", buf, os);
} }
@ -225,7 +230,7 @@ void InsetExternal::executeCommand(string const & s,
string const InsetExternal::doSubstitution(Buffer const * buffer, string const InsetExternal::doSubstitution(Buffer const * buffer,
string const & s) const string const & s) const
{ {
string result; string result;
string const basename = ChangeExtension(params_.filename, string()); string const basename = ChangeExtension(params_.filename, string());

View File

@ -13,8 +13,11 @@
#include "gettext.h" #include "gettext.h"
#include "debug.h" #include "debug.h"
using std::ostream;
using std::endl; using std::endl;
InsetFloatList::InsetFloatList() InsetFloatList::InsetFloatList()
: InsetCommand(InsetCommandParams()) : InsetCommand(InsetCommandParams())
{ {
@ -45,7 +48,7 @@ Inset::Code InsetFloatList::lyxCode() const
} }
void InsetFloatList::write(Buffer const *, std::ostream & os) const void InsetFloatList::write(Buffer const *, ostream & os) const
{ {
os << "FloatList " << getCmdName() << "\n"; os << "FloatList " << getCmdName() << "\n";
} }
@ -85,7 +88,7 @@ void InsetFloatList::edit(BufferView * bv, bool)
} }
int InsetFloatList::latex(Buffer const *, std::ostream & os, bool, bool) const int InsetFloatList::latex(Buffer const *, ostream & os, bool, bool) const
{ {
FloatList::const_iterator cit = floatList[getCmdName()]; FloatList::const_iterator cit = floatList[getCmdName()];
@ -112,7 +115,7 @@ int InsetFloatList::latex(Buffer const *, std::ostream & os, bool, bool) const
} }
int InsetFloatList::ascii(Buffer const * buffer, std::ostream & os, int) const int InsetFloatList::ascii(Buffer const * buffer, ostream & os, int) const
{ {
os << getScreenLabel(buffer) << "\n\n"; os << getScreenLabel(buffer) << "\n\n";

View File

@ -24,6 +24,9 @@
#include "debug.h" #include "debug.h"
using std::ostream;
InsetFoot::InsetFoot() InsetFoot::InsetFoot()
: InsetFootlike() : InsetFootlike()
{ {
@ -53,7 +56,7 @@ string const InsetFoot::editMessage() const
int InsetFoot::latex(Buffer const * buf, int InsetFoot::latex(Buffer const * buf,
std::ostream & os, bool fragile, bool fp) const ostream & os, bool fragile, bool fp) const
{ {
os << "%\n\\footnote{"; os << "%\n\\footnote{";

View File

@ -21,6 +21,9 @@
#include "support/LOstream.h" #include "support/LOstream.h"
using std::ostream;
InsetFootlike::InsetFootlike() InsetFootlike::InsetFootlike()
: InsetCollapsable() : InsetCollapsable()
{ {
@ -43,7 +46,7 @@ InsetFootlike::InsetFootlike(InsetFootlike const & in, bool same_id)
} }
void InsetFootlike::write(Buffer const * buf, std::ostream & os) const void InsetFootlike::write(Buffer const * buf, ostream & os) const
{ {
os << getInsetName() << "\n"; os << getInsetName() << "\n";
InsetCollapsable::write(buf, os); InsetCollapsable::write(buf, os);

View File

@ -91,39 +91,44 @@ TODO Before initial production release:
#include "insets/insetgraphics.h" #include "insets/insetgraphics.h"
#include "insets/insetgraphicsParams.h" #include "insets/insetgraphicsParams.h"
#include "graphics/GraphicsCache.h" #include "graphics/GraphicsCache.h"
#include "graphics/GraphicsCacheItem.h" #include "graphics/GraphicsCacheItem.h"
#include "frontends/Dialogs.h"
#include "frontends/Alert.h"
#include "LyXView.h" #include "LyXView.h"
#include "buffer.h" #include "buffer.h"
#include "BufferView.h" #include "BufferView.h"
#include "converter.h" #include "converter.h"
#include "frontends/support/LyXImage.h"
#include "Painter.h" #include "Painter.h"
#include "lyx_gui_misc.h" #include "lyx_gui_misc.h"
#include "support/FileInfo.h"
#include "support/filetools.h"
#include "support/lyxalgo.h" // lyx::count
#include "support/lyxlib.h"
#include "frontends/controllers/helper_funcs.h"
#include "lyxtext.h" #include "lyxtext.h"
#include "lyxrc.h" #include "lyxrc.h"
#include "font.h" // For the lyxfont class. #include "font.h"
#include "fstream" // for ifstream in isEPS
#include <algorithm> // For the std::max
#include "support/lyxmanip.h"
#include "debug.h" #include "debug.h"
#include "gettext.h" #include "gettext.h"
//#include "LOStream.h"
#include "frontends/Dialogs.h"
#include "frontends/Alert.h"
#include "frontends/controllers/helper_funcs.h"
#include "frontends/support/LyXImage.h"
#include "support/FileInfo.h"
#include "support/filetools.h"
#include "support/lyxlib.h"
#include "support/lyxmanip.h"
#include "support/lyxalgo.h" #include "support/lyxalgo.h"
#include <fstream>
#include <algorithm>
extern string system_tempdir; extern string system_tempdir;
using std::ifstream; using std::ifstream;
using std::ostream; using std::ostream;
using std::endl; using std::endl;
using std::max;
using std::vector;
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
int const VersionNumber = 1; int const VersionNumber = 1;
@ -230,10 +235,10 @@ int InsetGraphics::width(BufferView *, LyXFont const & font) const
if (!msg.empty()) { if (!msg.empty()) {
msgFont.setSize(LyXFont::SIZE_TINY); msgFont.setSize(LyXFont::SIZE_TINY);
int const msg_width = lyxfont::width(msg, msgFont); int const msg_width = lyxfont::width(msg, msgFont);
font_width = std::max(font_width, msg_width); font_width = max(font_width, msg_width);
} }
return std::max(50, font_width + 15); return max(50, font_width + 15);
} }
} }
@ -342,7 +347,7 @@ void InsetGraphics::readInsetGraphics(Buffer const * buf, LyXLex & lex)
string const token = lex.getString(); string const token = lex.getString();
lyxerr[Debug::INFO] << "Token: '" << token << '\'' lyxerr[Debug::INFO] << "Token: '" << token << '\''
<< std::endl; << endl;
if (token.empty()) { if (token.empty()) {
continue; continue;
@ -356,13 +361,13 @@ void InsetGraphics::readInsetGraphics(Buffer const * buf, LyXLex & lex)
<< "This document was created with a newer Graphics widget" << "This document was created with a newer Graphics widget"
", You should use a newer version of LyX to read this" ", You should use a newer version of LyX to read this"
" file." " file."
<< std::endl; << endl;
// TODO: Possibly open up a dialog? // TODO: Possibly open up a dialog?
} }
else { else {
if (! params.Read(buf, lex, token)) if (! params.Read(buf, lex, token))
lyxerr << "Unknown token, " << token << ", skipping." lyxerr << "Unknown token, " << token << ", skipping."
<< std::endl; << endl;
} }
} }
} }
@ -370,7 +375,7 @@ void InsetGraphics::readInsetGraphics(Buffer const * buf, LyXLex & lex)
// FormatVersion < 1.0 (LyX < 1.2) // FormatVersion < 1.0 (LyX < 1.2)
void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex) void InsetGraphics::readFigInset(Buffer const * buf, LyXLex & lex)
{ {
std::vector<string> const oldUnits = vector<string> const oldUnits =
getVectorFromString("pt,cm,in,p%,c%"); getVectorFromString("pt,cm,in,p%,c%");
bool finished = false; bool finished = false;
// set the display default // set the display default

View File

@ -17,12 +17,17 @@
#endif #endif
#include "insetgraphicsParams.h" #include "insetgraphicsParams.h"
#include "support/translator.h" #include "support/translator.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "support/lyxlib.h" #include "support/lyxlib.h"
#include "support/LOstream.h" #include "support/LOstream.h"
#include "support/LAssert.h" #include "support/LAssert.h"
using std::ostream;
namespace { namespace {
/// This variable keeps a tab on whether the translator was set with the /// This variable keeps a tab on whether the translator was set with the
@ -164,7 +169,7 @@ bool operator==(InsetGraphicsParams const & left,
left.rotateOrigin == right.rotateOrigin && left.rotateOrigin == right.rotateOrigin &&
lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 && lyx::float_equal(left.rotateAngle, right.rotateAngle, 0.001 &&
left.special == right.special) left.special == right.special)
) )
return true; return true;
return false; return false;

View File

@ -22,8 +22,6 @@
#include "buffer.h" #include "buffer.h"
#include "lyxlex.h" #include "lyxlex.h"
using std::ostream;
/// This struct holds all the parameters needed by insetGraphics. /// This struct holds all the parameters needed by insetGraphics.
struct InsetGraphicsParams struct InsetGraphicsParams
{ {
@ -90,7 +88,7 @@ struct InsetGraphicsParams
/// ///
InsetGraphicsParams & operator=(InsetGraphicsParams const &); InsetGraphicsParams & operator=(InsetGraphicsParams const &);
/// Save the parameters in the LyX format stream. /// Save the parameters in the LyX format stream.
void Write(Buffer const * buf, ostream & os) const; void Write(Buffer const * buf, std::ostream & os) const;
/// If the token belongs to our parameters, read it. /// If the token belongs to our parameters, read it.
bool Read(Buffer const * buf, LyXLex & lex, string const & token); bool Read(Buffer const * buf, LyXLex & lex, string const & token);

View File

@ -295,7 +295,7 @@ int InsetInclude::latex(Buffer const * buffer, ostream & os,
} }
int InsetInclude::ascii(Buffer const *, std::ostream & os, int) const int InsetInclude::ascii(Buffer const *, ostream & os, int) const
{ {
if (isVerbatim()) if (isVerbatim())
os << GetFileContents(getFileName()); os << GetFileContents(getFileName());

View File

@ -27,7 +27,7 @@ string const InsetIndex::getScreenLabel(Buffer const *) const
void InsetIndex::edit(BufferView * bv, int, int, unsigned int) void InsetIndex::edit(BufferView * bv, int, int, unsigned int)
{ {
bv->owner()->getDialogs()->showIndex( this ); bv->owner()->getDialogs()->showIndex(this);
} }

View File

@ -548,7 +548,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font0,
case UMLAUT: // umlaut case UMLAUT: // umlaut
{ {
pain.text(int(x2 - (lyxfont::rbearing('¨', font) - lyxfont::lbearing('¨', font)) / 2), pain.text(int(x2 - (lyxfont::rbearing('¨', font) - lyxfont::lbearing('¨', font)) / 2),
baseline - lyxfont::ascent(ic, font) - lyxfont::descent('¨', font) - ( lyxfont::ascent('¨', font) + lyxfont::descent('¨', font)) / 2, baseline - lyxfont::ascent(ic, font) - lyxfont::descent('¨', font) - (lyxfont::ascent('¨', font) + lyxfont::descent('¨', font)) / 2,
'¨', font); '¨', font);
break; break;
} }

View File

@ -24,6 +24,9 @@
#include "debug.h" #include "debug.h"
using std::ostream;
InsetMarginal::InsetMarginal() InsetMarginal::InsetMarginal()
: InsetFootlike() : InsetFootlike()
{ {
@ -53,7 +56,7 @@ string const InsetMarginal::editMessage() const
int InsetMarginal::latex(Buffer const * buf, int InsetMarginal::latex(Buffer const * buf,
std::ostream & os, bool fragile, bool fp) const ostream & os, bool fragile, bool fp) const
{ {
os << "%\n\\marginpar{"; os << "%\n\\marginpar{";

View File

@ -25,11 +25,11 @@ InsetRef::InsetRef(InsetCommandParams const & p, Buffer const & buf, bool)
void InsetRef::edit(BufferView * bv, int, int, unsigned int button) void InsetRef::edit(BufferView * bv, int, int, unsigned int button)
{ {
// Eventually trigger dialog with button 3 not 1 // Eventually trigger dialog with button 3 not 1
if (button == 3 ) if (button == 3)
bv->owner()->getLyXFunc()-> bv->owner()->getLyXFunc()->
dispatch(LFUN_REF_GOTO, getContents()); dispatch(LFUN_REF_GOTO, getContents());
else if (button == 1 ) else if (button == 1)
bv->owner()->getDialogs()->showRef( this ); bv->owner()->getDialogs()->showRef(this);
} }
@ -63,7 +63,7 @@ int InsetRef::latex(Buffer const *, ostream & os,
if (getOptions().empty()) if (getOptions().empty())
os << escape(getCommand()); os << escape(getCommand());
else { else {
InsetCommandParams p( getCmdName(), getContents(), "" ); InsetCommandParams p(getCmdName(), getContents(), "");
os << escape(p.getCommand()); os << escape(p.getCommand());
} }
return 0; return 0;

View File

@ -48,6 +48,8 @@
#include <map> #include <map>
//#include <signal.h> //#include <signal.h>
using std::vector;
using std::ostream; using std::ostream;
using std::ifstream; using std::ifstream;
using std::max; using std::max;
@ -1112,7 +1114,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
while (p < len && while (p < len &&
((p = clip.find_first_of("\t\n", p)) != string::npos)) { ((p = clip.find_first_of("\t\n", p)) != string::npos)) {
switch(clip[p]) { switch (clip[p]) {
case '\t': case '\t':
++cols; ++cols;
break; break;
@ -1136,7 +1138,7 @@ InsetTabular::localDispatch(BufferView * bv, kb_action action,
(p = clip.find_first_of("\t\n", p)) != string::npos) { (p = clip.find_first_of("\t\n", p)) != string::npos) {
if (p >= len) if (p >= len)
break; break;
switch(clip[p]) { switch (clip[p]) {
case '\t': case '\t':
paste_tabular->GetCellInset(cell)->setText(clip.substr(op, p-op)); paste_tabular->GetCellInset(cell)->setText(clip.substr(op, p-op));
++cols; ++cols;
@ -2352,7 +2354,7 @@ FuncStatus InsetTabular::getStatus(string const & what) const
} }
std::vector<string> const InsetTabular::getLabelList() const vector<string> const InsetTabular::getLabelList() const
{ {
return tabular->getLabelList(); return tabular->getLabelList();
} }
@ -2468,7 +2470,7 @@ bool InsetTabular::cutSelection()
} }
bool InsetTabular::isRightToLeft(BufferView *bv ) bool InsetTabular::isRightToLeft(BufferView * bv)
{ {
return bv->getParentLanguage(this)->RightToLeft(); return bv->getParentLanguage(this)->RightToLeft();
} }

View File

@ -62,6 +62,7 @@ using std::min;
using std::max; using std::max;
using std::make_pair; using std::make_pair;
using std::vector; using std::vector;
using std::pair;
using lyx::pos_type; using lyx::pos_type;
using lyx::layout_type; using lyx::layout_type;
@ -1086,7 +1087,7 @@ InsetText::localDispatch(BufferView * bv,
updateLocal(bv, CURSOR_PAR, false); updateLocal(bv, CURSOR_PAR, false);
return result; return result;
} else if (result >= FINISHED) { } else if (result >= FINISHED) {
switch(result) { switch (result) {
case FINISHED_RIGHT: case FINISHED_RIGHT:
moveRightIntern(bv, false, false); moveRightIntern(bv, false, false);
result = DISPATCHED; result = DISPATCHED;
@ -1320,7 +1321,7 @@ InsetText::localDispatch(BufferView * bv,
// Derive layout number from given argument (string) // Derive layout number from given argument (string)
// and current buffer's textclass (number). */ // and current buffer's textclass (number). */
textclass_type tclass = bv->buffer()->params.textclass; textclass_type tclass = bv->buffer()->params.textclass;
std::pair <bool, layout_type> layout = pair<bool, layout_type> layout =
textclasslist.NumberOfLayout(tclass, arg); textclasslist.NumberOfLayout(tclass, arg);
// If the entry is obsolete, use the new one instead. // If the entry is obsolete, use the new one instead.
@ -1524,7 +1525,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const
} }
if (environment_stack[depth] != style.latexname()) { if (environment_stack[depth] != style.latexname()) {
if(environment_stack.size() == depth + 1) { if (environment_stack.size() == depth + 1) {
environment_stack.push_back("!-- --"); environment_stack.push_back("!-- --");
environment_inner.push_back("!-- --"); environment_inner.push_back("!-- --");
} }
@ -1547,7 +1548,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const
if (style.latextype == LATEX_ENVIRONMENT) { if (style.latextype == LATEX_ENVIRONMENT) {
if (!style.latexparam().empty()) { if (!style.latexparam().empty()) {
if(style.latexparam() == "CDATA") if (style.latexparam() == "CDATA")
os << "<![CDATA["; os << "<![CDATA[";
else else
buf->sgmlOpenTag(os, depth + command_depth, buf->sgmlOpenTag(os, depth + command_depth,
@ -1591,7 +1592,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os) const
switch (style.latextype) { switch (style.latextype) {
case LATEX_ENVIRONMENT: case LATEX_ENVIRONMENT:
if (!style.latexparam().empty()) { if (!style.latexparam().empty()) {
if(style.latexparam() == "CDATA") if (style.latexparam() == "CDATA")
os << "]]>"; os << "]]>";
else else
buf->sgmlCloseTag(os, depth + command_depth, buf->sgmlCloseTag(os, depth + command_depth,
@ -1882,16 +1883,16 @@ bool InsetText::showInsetDialog(BufferView * bv) const
} }
std::vector<string> const InsetText::getLabelList() const vector<string> const InsetText::getLabelList() const
{ {
std::vector<string> label_list; vector<string> label_list;
Paragraph * tpar = par; Paragraph * tpar = par;
while (tpar) { while (tpar) {
Paragraph::inset_iterator beg = tpar->inset_iterator_begin(); Paragraph::inset_iterator beg = tpar->inset_iterator_begin();
Paragraph::inset_iterator end = tpar->inset_iterator_end(); Paragraph::inset_iterator end = tpar->inset_iterator_end();
for (; beg != end; ++beg) { for (; beg != end; ++beg) {
std::vector<string> const l = (*beg)->getLabelList(); vector<string> const l = (*beg)->getLabelList();
label_list.insert(label_list.end(), l.begin(), l.end()); label_list.insert(label_list.end(), l.begin(), l.end());
} }
tpar = tpar->next(); tpar = tpar->next();

View File

@ -12,7 +12,10 @@
#include "debug.h" #include "debug.h"
#include "buffer.h" #include "buffer.h"
using std::vector; using std::vector;
using std::ostream;
string const InsetTOC::getScreenLabel(Buffer const *) const string const InsetTOC::getScreenLabel(Buffer const *) const
{ {
@ -45,7 +48,7 @@ void InsetTOC::edit(BufferView * bv, bool)
} }
int InsetTOC::ascii(Buffer const * buffer, std::ostream & os, int) const int InsetTOC::ascii(Buffer const * buffer, ostream & os, int) const
{ {
os << getScreenLabel(buffer) << "\n\n"; os << getScreenLabel(buffer) << "\n\n";
@ -69,7 +72,7 @@ int InsetTOC::ascii(Buffer const * buffer, std::ostream & os, int) const
} }
int InsetTOC::linuxdoc(Buffer const *, std::ostream & os) const int InsetTOC::linuxdoc(Buffer const *, ostream & os) const
{ {
if (getCmdName() == "tableofcontents") if (getCmdName() == "tableofcontents")
os << "<toc>"; os << "<toc>";
@ -77,7 +80,7 @@ int InsetTOC::linuxdoc(Buffer const *, std::ostream & os) const
} }
int InsetTOC::docbook(Buffer const *, std::ostream & os) const int InsetTOC::docbook(Buffer const *, ostream & os) const
{ {
if (getCmdName() == "tableofcontents") if (getCmdName() == "tableofcontents")
os << "<toc></toc>"; os << "<toc></toc>";

View File

@ -23,7 +23,7 @@ InsetUrl::InsetUrl(InsetCommandParams const & p, bool)
void InsetUrl::edit(BufferView * bv, int, int, unsigned int) void InsetUrl::edit(BufferView * bv, int, int, unsigned int)
{ {
bv->owner()->getDialogs()->showUrl( this ); bv->owner()->getDialogs()->showUrl(this);
} }
@ -36,7 +36,7 @@ void InsetUrl::edit(BufferView * bv, bool)
string const InsetUrl::getScreenLabel(Buffer const *) const string const InsetUrl::getScreenLabel(Buffer const *) const
{ {
string temp; string temp;
if (getCmdName() == "url" ) if (getCmdName() == "url")
temp = _("Url: "); temp = _("Url: ");
else else
temp = _("HtmlUrl: "); temp = _("HtmlUrl: ");

View File

@ -5,14 +5,14 @@
ParIterator & ParIterator::operator++() ParIterator & ParIterator::operator++()
{ {
while (!positions.empty()) { while (!positions.empty()) {
ParPosition & p = positions.back(); ParPosition & p = positions.top();
// Does the current inset contain more "cells" ? // Does the current inset contain more "cells" ?
if (p.index >= 0) { if (p.index >= 0) {
++p.index; ++p.index;
Paragraph * par = (*p.it)->getFirstParagraph(p.index); Paragraph * par = (*p.it)->getFirstParagraph(p.index);
if (par) { if (par) {
positions.push_back(ParPosition(par)); positions.push(ParPosition(par));
return *this; return *this;
} }
++p.it; ++p.it;
@ -23,11 +23,12 @@ ParIterator & ParIterator::operator++()
p.it = p.par->inset_iterator_begin(); p.it = p.par->inset_iterator_begin();
// Try to find the next inset that contains paragraphs // Try to find the next inset that contains paragraphs
for ( ; p.it != p.par->inset_iterator_end(); ++p.it) { Paragraph::inset_iterator end = p.par->inset_iterator_end();
for (; p.it != end; ++p.it) {
Paragraph * par = (*p.it)->getFirstParagraph(0); Paragraph * par = (*p.it)->getFirstParagraph(0);
if (par) { if (par) {
p.index = 0; p.index = 0;
positions.push_back(ParPosition(par)); positions.push(ParPosition(par));
return *this; return *this;
} }
} }
@ -37,7 +38,7 @@ ParIterator & ParIterator::operator++()
return *this; return *this;
} }
positions.pop_back(); positions.pop();
} }
return *this; return *this;
} }

View File

@ -3,7 +3,7 @@
#ifndef ITERATORS_H #ifndef ITERATORS_H
#define ITERATORS_H #define ITERATORS_H
#include <vector> #include <stack>
#include "paragraph.h" #include "paragraph.h"
@ -35,24 +35,29 @@ bool operator!=(ParPosition const & pos1, ParPosition const & pos2) {
class ParIterator { class ParIterator {
public: public:
///
typedef std::stack<ParPosition> PosHolder;
/// ///
ParIterator() {} ParIterator() {}
// ///
ParIterator(Paragraph * par) ParIterator(Paragraph * par) {
: positions(1, ParPosition(par)) {} positions.push(ParPosition(par));
}
/// ///
ParIterator & operator++(); ParIterator & operator++();
/// ///
Paragraph * operator*() { return positions.back().par; } Paragraph * operator*() {
return positions.top().par;
}
/// ///
std::vector<ParPosition>::size_type size() const PosHolder::size_type size() const
{ return positions.size(); } { return positions.size(); }
/// ///
friend friend
bool operator==(ParIterator const & iter1, ParIterator const & iter2); bool operator==(ParIterator const & iter1, ParIterator const & iter2);
private: private:
/// ///
std::vector<ParPosition> positions; PosHolder positions;
}; };

View File

@ -23,7 +23,12 @@
#include "commandtags.h" #include "commandtags.h"
#include "debug.h" #include "debug.h"
using std::vector;
using std::endl; using std::endl;
using std::hex;
using std::dec;
// The only modifiers that we handle. We want to throw away things // The only modifiers that we handle. We want to throw away things
// like NumLock. // like NumLock.
@ -137,7 +142,7 @@ string const kb_sequence::print() const
if (deleted_) if (deleted_)
return buf; return buf;
for (std::vector<unsigned int>::size_type i = 0; i < length_; ++i) { for (vector<unsigned int>::size_type i = 0; i < length_; ++i) {
buf += kb_keymap::printKeysym(sequence[i], modifiers[i] & 0xffff); buf += kb_keymap::printKeysym(sequence[i], modifiers[i] & 0xffff);
// append a blank // append a blank
@ -182,9 +187,9 @@ char kb_sequence::getiso() const
unsigned int const c = getsym(); unsigned int const c = getsym();
lyxerr[Debug::KBMAP] << "Raw keysym: " lyxerr[Debug::KBMAP] << "Raw keysym: "
<< std::hex << c << std::dec << endl; << hex << c << dec << endl;
lyxerr[Debug::KBMAP] << "byte 3: " lyxerr[Debug::KBMAP] << "byte 3: "
<< std::hex << (c & 0xff00) << std::dec << hex << (c & 0xff00) << dec
<< endl; << endl;
return kb_keymap::getiso(c); return kb_keymap::getiso(c);
} }

View File

@ -24,8 +24,14 @@
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
using std::ifstream;
using std::ofstream;
using std::getline; using std::getline;
using std::endl; using std::endl;
using std::find;
using std::copy;
using std::ostream_iterator;
LastFiles::LastFiles(string const & filename, bool st, unsigned int num) LastFiles::LastFiles(string const & filename, bool st, unsigned int num)
@ -53,7 +59,7 @@ void LastFiles::readFile(string const & filename)
{ {
// we will not complain if we can't find filename nor will // we will not complain if we can't find filename nor will
// we issue a warning. (Lgb) // we issue a warning. (Lgb)
std::ifstream ifs(filename.c_str()); ifstream ifs(filename.c_str());
string tmp; string tmp;
FileInfo fileInfo; FileInfo fileInfo;
@ -70,10 +76,10 @@ void LastFiles::readFile(string const & filename)
void LastFiles::writeFile(string const & filename) const void LastFiles::writeFile(string const & filename) const
{ {
std::ofstream ofs(filename.c_str()); ofstream ofs(filename.c_str());
if (ofs) { if (ofs) {
std::copy(files.begin(), files.end(), copy(files.begin(), files.end(),
std::ostream_iterator<string>(ofs, "\n")); ostream_iterator<string>(ofs, "\n"));
} else } else
lyxerr << "LyX: Warning: unable to save LastFiles: " lyxerr << "LyX: Warning: unable to save LastFiles: "
<< filename << endl; << filename << endl;
@ -83,7 +89,7 @@ void LastFiles::writeFile(string const & filename) const
void LastFiles::newFile(string const & file) void LastFiles::newFile(string const & file)
{ {
// If file already exist, delete it and reinsert at front. // If file already exist, delete it and reinsert at front.
Files::iterator it = std::find(files.begin(), files.end(), file); Files::iterator it = find(files.begin(), files.end(), file);
if (it != files.end()) if (it != files.end())
files.erase(it); files.erase(it);
files.push_front(file); files.push_front(file);

View File

@ -521,9 +521,9 @@ void MenuInsertLabel(BufferView * bv, string const & arg)
} }
} }
if (!label.empty()) { if (!label.empty()) {
InsetCommandParams p( "label", label ); InsetCommandParams p("label", label);
InsetLabel * inset = new InsetLabel( p ); InsetLabel * inset = new InsetLabel(p);
bv->insertInset( inset ); bv->insertInset(inset);
} }
bv->owner()->allowInput(); bv->owner()->allowInput();
} }

View File

@ -115,7 +115,7 @@ LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI)
fl_get_app_resources(res, num_res); fl_get_app_resources(res, num_res);
static const int geometryBitmask = static const int geometryBitmask =
XParseGeometry( geometry, XParseGeometry(geometry,
&xpos, &xpos,
&ypos, &ypos,
reinterpret_cast<unsigned int *>(&width), reinterpret_cast<unsigned int *>(&width),
@ -302,7 +302,7 @@ void LyXGUI::create_forms()
// This is probably as good a time as any to map the xform colours, // This is probably as good a time as any to map the xform colours,
// should a mapping exist. // should a mapping exist.
string const filename = AddName(user_lyxdir, "preferences.xform"); string const filename = AddName(user_lyxdir, "preferences.xform");
XformsColor::read( filename ); XformsColor::read(filename);
// Show the main & title form // Show the main & title form
int main_placement = FL_PLACE_CENTER | FL_FREE_SIZE; int main_placement = FL_PLACE_CENTER | FL_FREE_SIZE;

View File

@ -667,7 +667,7 @@ bool LyX::readRcFile(string const & name)
lyxerr[Debug::INIT] << "About to read " << name << "..." << endl; lyxerr[Debug::INIT] << "About to read " << name << "..." << endl;
string const lyxrc_path = LibFileSearch(string(), name); string const lyxrc_path = LibFileSearch(string(), name);
if (!lyxrc_path.empty()){ if (!lyxrc_path.empty()) {
lyxerr[Debug::INIT] << "Found " << name lyxerr[Debug::INIT] << "Found " << name
<< " in " << lyxrc_path << endl; << " in " << lyxrc_path << endl;
if (lyxrc.read(lyxrc_path) < 0) { if (lyxrc.read(lyxrc_path) < 0) {
@ -732,7 +732,7 @@ void LyX::readUIFile(string const & name)
break; break;
default: default:
if(!strip(lex.getString()).empty()) if (!strip(lex.getString()).empty())
lex.printError("LyX::ReadUIFile: " lex.printError("LyX::ReadUIFile: "
"Unknown menu tag: `$$Token'"); "Unknown menu tag: `$$Token'");
break; break;

View File

@ -419,7 +419,7 @@ LyXFont::FONT_MISC_STATE LyXFont::noun() const
inline inline
bool LyXFont::isSymbolFont() const bool LyXFont::isSymbolFont() const
{ {
switch(family()) { switch (family()) {
case LyXFont::SYMBOL_FAMILY: case LyXFont::SYMBOL_FAMILY:
case LyXFont::CMSY_FAMILY: case LyXFont::CMSY_FAMILY:
case LyXFont::CMM_FAMILY: case LyXFont::CMM_FAMILY:

View File

@ -106,6 +106,9 @@ using std::pair;
using std::make_pair; using std::make_pair;
using std::endl; using std::endl;
using std::find_if; using std::find_if;
using std::vector;
using std::transform;
using std::back_inserter;
extern BufferList bufferlist; extern BufferList bufferlist;
extern LyXServer * lyxserver; extern LyXServer * lyxserver;
@ -880,7 +883,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
(!keyseq.deleted()))) (!keyseq.deleted())))
{ {
if ((action == LFUN_UNKNOWN_ACTION) if ((action == LFUN_UNKNOWN_ACTION)
&& argument.empty()){ && argument.empty()) {
argument = keyseq.getiso(); argument = keyseq.getiso();
} }
// Undo/Redo is a bit tricky for insets. // Undo/Redo is a bit tricky for insets.
@ -1024,10 +1027,10 @@ string const LyXFunc::dispatch(kb_action action, string argument)
// --- Misc ------------------------------------------- // --- Misc -------------------------------------------
case LFUN_EXEC_COMMAND: case LFUN_EXEC_COMMAND:
{ {
std::vector<string> allCmds; vector<string> allCmds;
std::transform(lyxaction.func_begin(), lyxaction.func_end(), transform(lyxaction.func_begin(), lyxaction.func_end(),
std::back_inserter(allCmds), lyx::firster()); back_inserter(allCmds), lyx::firster());
static std::vector<string> hist; static vector<string> hist;
owner->getMiniBuffer()->getString(MiniBuffer::spaces, owner->getMiniBuffer()->getString(MiniBuffer::spaces,
allCmds, hist); allCmds, hist);
} }
@ -1143,7 +1146,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
#endif #endif
p.setCmdName("tableofcontents"); p.setCmdName("tableofcontents");
#if 0 #if 0
else if (action == LFUN_LOAVIEW ) else if (action == LFUN_LOAVIEW)
p.setCmdName("listof{algorithm}{List of Algorithms}"); p.setCmdName("listof{algorithm}{List of Algorithms}");
else if (action == LFUN_LOFVIEW) else if (action == LFUN_LOFVIEW)
p.setCmdName("listoffigures"); p.setCmdName("listoffigures");
@ -1412,7 +1415,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
Paragraph * par = owner->buffer()->getParFromID(id); Paragraph * par = owner->buffer()->getParFromID(id);
if (par == 0) { if (par == 0) {
lyxerr[Debug::INFO] << "No matching paragraph found! [" lyxerr[Debug::INFO] << "No matching paragraph found! ["
<< id << "]" << std::endl; << id << "]" << endl;
break; break;
} else { } else {
lyxerr << "Paragraph " << par->id() lyxerr << "Paragraph " << par->id()
@ -1498,7 +1501,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
case LFUN_CITATION_CREATE: case LFUN_CITATION_CREATE:
{ {
InsetCommandParams p( "cite" ); InsetCommandParams p("cite");
if (!argument.empty()) { if (!argument.empty()) {
// This should be set at source, ie when typing // This should be set at source, ie when typing
@ -1506,14 +1509,14 @@ string const LyXFunc::dispatch(kb_action action, string argument)
// Question: would pybibliographer also need to be // Question: would pybibliographer also need to be
// changed. Suspect so. Leave as-is therefore. // changed. Suspect so. Leave as-is therefore.
if (contains(argument, "|")) { if (contains(argument, "|")) {
p.setContents( token(argument, '|', 0) ); p.setContents(token(argument, '|', 0));
p.setOptions( token(argument, '|', 1) ); p.setOptions( token(argument, '|', 1));
} else { } else {
p.setContents( argument ); p.setContents(argument);
} }
dispatch(LFUN_CITATION_INSERT, p.getAsString()); dispatch(LFUN_CITATION_INSERT, p.getAsString());
} else } else
owner->getDialogs()->createCitation( p.getAsString() ); owner->getDialogs()->createCitation(p.getAsString());
} }
break; break;

View File

@ -57,7 +57,7 @@ string const LyXLength::asString() const
string const LyXLength::asLatexString() const string const LyXLength::asLatexString() const
{ {
ostringstream buffer; ostringstream buffer;
switch(unit_) { switch (unit_) {
case PW: case PW:
buffer << abs(static_cast<int>(val_/100)) << "." buffer << abs(static_cast<int>(val_/100)) << "."
<< abs(static_cast<int>(val_)%100) << "\\textwidth"; << abs(static_cast<int>(val_)%100) << "\\textwidth";

View File

@ -63,7 +63,7 @@ string const LyXLex::text() const
} }
std::istream & LyXLex::getStream() istream & LyXLex::getStream()
{ {
return pimpl_->is; return pimpl_->is;
} }

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