* Licence details can be found in the file COPYING.
*
* \author unknown
- * \author John Levon
+ * \author John Levon
*
* Full author contact details are available in file CREDITS
*/
* Licence details can be found in the file COPYING.
*
* \author Allan Rae
- * \author Angus Leeming
+ * \author Angus Leeming
* \author Baruch Even
*
* Full author contact details are available in file CREDITS
* be #included in the gui-frontend BC class, see e.g. xforms/xformsBC.C
*/
template <class Button, class Widget>
-class GuiBC : public ButtonControllerBase
-{
+class GuiBC : public ButtonControllerBase {
public:
///
GuiBC(string const & cancel, string const & close);
void refresh();
/// Refresh the status of any widgets in the read_only list
void refreshReadOnly();
-
private:
/// Enable/Disable a widget
virtual void setWidgetEnabled(Widget * obj, bool enable) = 0;
template <class BP, class GUIBC>
-class ButtonController: public GUIBC
-{
+class ButtonController: public GUIBC {
public:
///
ButtonController(string const & = _("Cancel"),
~ButtonController() {}
///
virtual ButtonPolicy & bp() { return bp_; }
-
protected:
///
BP bp_;
void ButtonControllerBase::input(ButtonPolicy::SMInput in)
{
- if (ButtonPolicy::SMI_NOOP == in) return;
+ if (ButtonPolicy::SMI_NOOP == in)
+ return;
bp().input(in);
refresh();
}
* This abstract base class stripped of xforms-specific code by
* Angus Leeming <leeming@lyx.org>
*/
-class ButtonControllerBase : boost::noncopyable
-{
+class ButtonControllerBase : boost::noncopyable {
public:
/** Constructor.
The cancel/close label entries are _not_ managed within the class
void valid(bool = true);
///
void invalid();
-
protected:
///
string cancel_label_;
This is based on the value of the bool state of the Button::CANCEL.
true == Cancel, false == Close
*/
-class NoRepeatedApplyReadOnlyPolicy : public ButtonPolicy
-{
+class NoRepeatedApplyReadOnlyPolicy : public ButtonPolicy {
public:
///
NoRepeatedApplyReadOnlyPolicy();
+2002-10-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * tex_helpers.C (rescanTexStyles): don't pop p
+ (texhash): ditto
+
+ * ControlWrap.C (WrapParms): remove initialization of placement,
+ and move empty c-tor to .h class def.
+
+ * ControlVCLog.C (getVCLogFile): operator on std::ostream instead
+ of on stringsteam, return void. Get the file into the stream as
+ fast as possible.
+
+ * ControlPreamble.[Ch] (params): getter and setter for params_, make
+ params_ into a string, not just a pointer to string.
+
+ * ControlExternal.C (getTemplateNumber): put i into the for scope,
+ and use the sequence operator on the last for "parameter"
+ (getTemplate): use std::advance to advance the iterator.
+
+ * ControlAboutlyx.C (getCredits): Operate on s std::ostream
+ instead of on a stringstream, return void. Get the file into the
+ stream as fast as possible.
+ (getVersion): use ostringstream
+
+ * lots of files: ws changes, formatting fixes
+
2002-10-20 Lars Gullik Bjønnes <larsbj@gullik.net>
* ControlCharacter.C (apply): setMinibuffer change
*/
#include <config.h>
-#include <fstream>
#ifdef __GNUG__
#pragma implementation
#endif
#include "ControlAboutlyx.h"
-#include "Lsstream.h"
#include "gettext.h"
-#include "support/filetools.h" // FileSearch
#include "version.h"
+#include "Lsstream.h"
+
+#include "support/LOstream.h"
+#include "support/filetools.h" // FileSearch
+
+#include <fstream>
+
+using std::ostream;
// needed for the browser
extern string system_lyxdir;
{}
-stringstream & ControlAboutlyx::getCredits(stringstream & ss) const
+void ControlAboutlyx::getCredits(ostream & ss) const
{
string const name = FileSearch(system_lyxdir, "CREDITS");
if (found) {
std::ifstream in(name.c_str());
- found = (in.get());
- if (found) {
- in.seekg(0, std::ios::beg); // rewind to the beginning
-
- ss << in.rdbuf();
- found = (ss.good());
- }
+ ss << in.rdbuf();
+ found = ss.good();
}
if (!found) {
<< _("Please install correctly to estimate the great\n")
<< _("amount of work other people have done for the LyX project.");
}
-
- return ss;
}
string const ControlAboutlyx::getVersion() const
{
- stringstream ss;
+ ostringstream ss;
ss << _("LyX Version ")
<< lyx_version
* Licence details can be found in the file COPYING.
*
* \author Edwin Leuven
- * \author Angus Leeming
+ * \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
#endif
#include "ControlDialog_impl.h"
-#include "Lsstream.h"
#include "LString.h"
+#include <iosfwd>
+
/** A controller for the About LyX dialogs.
*/
class ControlAboutlyx : public ControlDialogBI {
ControlAboutlyx(LyXView &, Dialogs &);
///
- stringstream & getCredits(stringstream &) const;
+ void getCredits(std::ostream &) const;
///
string const getCopyright() const;
///
string const getVersion() const;
-
-
private:
/// not needed.
virtual void apply() {}
public:
///
ControlBibitem(LyXView &, Dialogs &);
-
private:
/// Dispatch the changed parameters to the kernel.
virtual void applyParamsToInset();
string const & title,
string const & pattern)
{
- pair<string, string> dir1(_("Documents|#o#O"), string(lyxrc.document_path));
+ pair<string, string> dir1(_("Documents|#o#O"),
+ string(lyxrc.document_path));
return browseRelFile(&lv_, in_name, buffer()->filePath(),
title, pattern, dir1);
}
/** A controller for Bibtex dialogs.
*/
-class ControlBibtex : public ControlCommand
-{
+class ControlBibtex : public ControlCommand {
public:
///
ControlBibtex(LyXView &, Dialogs &);
/// build filelists of all availabe bst/cls/sty-files. done through
/// kpsewhich and an external script, saved in *Files.lst
void rescanBibStyles() const;
-
private:
/// Dispatch the changed parameters to the kernel.
virtual void applyParamsToInset();
/** Abstract base class for Controllers with a ButtonController.
*/
-class ControlButtons : boost::noncopyable
-{
+class ControlButtons : boost::noncopyable {
public:
///
ControlButtons();
void setView(ViewBase &);
///
void setButtonController(ButtonControllerBase &);
-
protected:
///
ViewBase & view();
/** This flag can be set by one of the miriad the controller methods
to ensure that the dialog is shut down. */
bool emergency_exit_;
-
private:
///
bool is_closing_;
/** A controller for Character dialogs.
*/
-class ControlCharacter : public ControlDialogBD
-{
+class ControlCharacter : public ControlDialogBD {
public:
///
ControlCharacter(LyXView &, Dialogs &);
using std::vector;
using std::pair;
+
vector<biblio::CiteStyle> ControlCitation::citeStyles_;
typedef std::map<string, string>::value_type InfoMapValue;
- for (vector<pair<string,string> >::size_type i=0; i<blist.size(); ++i) {
+ for (vector<pair<string,string> >::size_type i = 0;
+ i < blist.size(); ++i) {
bibkeysInfo_.insert(InfoMapValue(blist[i].first,
blist[i].second));
}
/** A controller for Citation dialogs.
*/
-class ControlCitation : public ControlCommand
-{
+class ControlCitation : public ControlCommand {
public:
///
ControlCitation(LyXView &, Dialogs &);
std::vector<string> const getCiteStrings(string const & key) const;
/// available CiteStyle-s (depends on availability of Natbib
- static std::vector<biblio::CiteStyle> const & getCiteStyles()
- { return citeStyles_; }
-
+ static std::vector<biblio::CiteStyle> const & getCiteStyles() {
+ return citeStyles_;
+ }
private:
/// create the InfoMap of keys and data
virtual void setDaughterParams();
/** The Inset dialog controller. Connects/disconnects signals, launches
GUI-dependent View and returns the output from this View to the kernel.
*/
-class ControlCommand : public ControlInset<InsetCommand, InsetCommandParams>
+class ControlCommand
+ : public ControlInset<InsetCommand, InsetCommandParams>
{
public:
///
ControlCommand(LyXView &, Dialogs &, kb_action=LFUN_NOACTION);
-
private:
/// Dispatch the changed parameters to the kernel.
virtual void applyParamsToInset();
*
* \author Lars
* \author Asger and Juergen
- * \author John Levon
+ * \author John Levon
*
* Full author contact details are available in file CREDITS
*/
using std::back_inserter;
using std::transform;
using std::endl;
-
+
namespace {
-
+
struct prefix_p {
string p;
- prefix_p(string const & s)
+ prefix_p(string const & s)
: p(s) {}
bool operator()(string const & s) const {
return prefixIs(s, p);
}
};
-
+
} // end of anon namespace
-
+
ControlCommandBuffer::ControlCommandBuffer(LyXFunc & lf)
: lyxfunc_(lf), history_pos_(history_.end())
{
transform(lyxaction.func_begin(), lyxaction.func_end(),
- back_inserter(commands_), lyx::firster());
+ back_inserter(commands_), lyx::firster());
}
-
-
+
+
string const ControlCommandBuffer::historyUp()
{
if (history_pos_ == history_.begin())
- return "";
+ return string();
return *(--history_pos_);
}
-
+
string const ControlCommandBuffer::historyDown()
{
}
-vector<string> const ControlCommandBuffer::completions(string const & prefix, string & new_prefix)
+vector<string> const
+ControlCommandBuffer::completions(string const & prefix, string & new_prefix)
{
vector<string> comp;
}
test += tmp[test.length()];
}
-
+
new_prefix = test;
return comp;
}
-
+
void ControlCommandBuffer::dispatch(string const & str)
{
if (str.empty())
return;
-
+
history_.push_back(str);
history_pos_ = history_.end();
lyxfunc_.dispatch(str, true);
*
* \author Lars
* \author Asger and Juergen
- * \author John Levon
+ * \author John Levon
*
* Full author contact details are available in file CREDITS
*/
* ControlCommandBuffer
*
* This provides methods for the use of a toolkit's
- * minibuffer/command buffer
+ * minibuffer/command buffer
*/
class ControlCommandBuffer {
public:
ControlCommandBuffer(LyXFunc & lf);
-
+
/// return the previous history entry if any
string const historyUp();
string const historyDown();
/// return the possible completions
- std::vector<string> const completions(string const & prefix, string & new_prefix);
-
+ std::vector<string> const completions(string const & prefix,
+ string & new_prefix);
+
/// dispatch a command
void dispatch(string const & str);
-
private:
/// controlling lyxfunc
LyXFunc & lyxfunc_;
-
+
/// available command names
std::vector<string> commands_;
-
+
/// command history
std::vector<string> history_;
/// current position in command history
std::vector<string>::const_iterator history_pos_;
};
-
+
#endif // CONTROLCOMMANDBUFFER_H
#include <boost/bind.hpp>
+
ControlConnectBase::ControlConnectBase(LyXView & lv, Dialogs & d)
: lv_(lv), d_(d)
{}
kernel. It is meant to be used solely as the parent class to
ControlConnectBI and ControlConnectBD.
*/
-class ControlConnectBase : public ControlButtons
-{
+class ControlConnectBase : public ControlButtons {
public:
///
enum DocTypes {
bool bufferIsReadonly() const;
///
DocTypes docType() const;
-
protected:
/// True if the dialog depends on the buffer, else false.
virtual bool isBufferDependent() const = 0;
///
LyXFunc const & lyxfunc() const;
-
///
LyXView & lv_;
/// Contains the signals we have to connect to.
an update() function which is also supported by the Restore button.
*/
-class ControlConnectBI : public ControlConnectBase
-{
+class ControlConnectBI : public ControlConnectBase {
public:
///
ControlConnectBI(LyXView &, Dialogs &);
-
protected:
///
virtual bool isBufferDependent() const { return false; }
/** Base class to control connection/disconnection of signals with the LyX
kernel for Buffer Dependent dialogs.
*/
-class ControlConnectBD : public ControlConnectBase
-{
+class ControlConnectBD : public ControlConnectBase {
public:
///
ControlConnectBD(LyXView &, Dialogs &);
-
protected:
///
virtual bool isBufferDependent() const { return true; }
virtual void connect();
/// Disconnect signals
virtual void disconnect();
-
private:
/** Slot connected to update signal.
Bool indicates if a buffer switch took place.
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Angus Leeming
+ * \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*
The Base class will be either ControlConnectBI or ControlConnectBD.
*/
template <class Base>
-class ControlDialog : public Base
-{
+class ControlDialog : public Base {
public:
///
ControlDialog(LyXView &, Dialogs &);
* Publicly accessible so that it can be invoked by the Dialogs class.
*/
virtual void show();
-
protected:
/// Hide the dialog.
virtual void hide();
virtual void clearParams() {}
/// set the params before show or update
virtual void setParams() {}
-
private:
/// is the dialog built ?
bool dialog_built_;
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Angus Leeming
+ * \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
#include "ControlDialog_impl.h"
#include "ControlDialog.tmpl"
+
ControlDialogBD::ControlDialogBD(LyXView & lv, Dialogs & d)
: ControlDialog<ControlConnectBD>(lv, d)
{}
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Angus Leeming
+ * \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*
class LyXView;
-class ControlDialogBD : public ControlDialog<ControlConnectBD>
-{
+class ControlDialogBD : public ControlDialog<ControlConnectBD> {
public:
///
ControlDialogBD(LyXView &, Dialogs &);
};
-class ControlDialogBI : public ControlDialog<ControlConnectBI>
-{
+class ControlDialogBI : public ControlDialog<ControlConnectBI> {
public:
///
ControlDialogBI(LyXView &, Dialogs &);
{
}
+
BufferParams & ControlDocument::params()
{
lyx::Assert(bp_.get());
*bp_ = buffer()->params;
}
+
void ControlDocument::setLanguage()
{
Language const * oldL = buffer()->params.language;
return true;
}
+
void ControlDocument::saveAsDefault()
{
lv_.buffer()->params.preamble = bp_->preamble;
public:
///
ControlERT(LyXView &, Dialogs &);
-
private:
/// Dispatch the changed parameters to the kernel.
virtual void applyParamsToInset();
/** A controller for LaTeX Error dialogs.
*/
-class ControlError : public ControlInset<InsetError, string>
-{
+class ControlError : public ControlInset<InsetError, string> {
public:
///
ControlError(LyXView &, Dialogs &);
-
private:
/// not needed.
virtual void applyParamsToInset() {}
using std::vector;
+
ControlExternal::ControlExternal(LyXView & lv, Dialogs & d)
: ControlInset<InsetExternal, InsetExternal::Params>(lv, d)
{}
return InsetExternal::Params();
}
+
InsetExternal::Params const
ControlExternal::getParams(InsetExternal const & inset)
{
bufferview()->updateInset(inset(), true);
}
+
void ControlExternal::editExternal()
{
// fill the local, controller's copy of the Params struct with
ie->editExternal();
}
+
void ControlExternal::viewExternal()
{
view().apply();
ie->viewExternal();
}
+
void ControlExternal::updateExternal()
{
view().apply();
ie->updateExternal();
}
+
vector<string> const ControlExternal::getTemplates() const
{
vector<string> result;
int ControlExternal::getTemplateNumber(string const & name) const
{
- int i = 0;
-
ExternalTemplateManager::Templates::const_iterator i1, i2;
i1 = ExternalTemplateManager::get().getTemplates().begin();
i2 = ExternalTemplateManager::get().getTemplates().end();
- for (; i1 != i2; ++i1) {
+ for (int i = 0; i1 != i2; ++i1, ++i) {
if (i1->second.lyxName == name)
return i;
- ++i;
}
// we can get here if a LyX document has a template not installed
ExternalTemplate ControlExternal::getTemplate(int i) const
{
- ExternalTemplateManager::Templates::const_iterator i1;
- i1 = ExternalTemplateManager::get().getTemplates().begin();
- for (int n = 1; n < i; ++n)
- ++i1;
+ ExternalTemplateManager::Templates::const_iterator i1
+ = ExternalTemplateManager::get().getTemplates().begin();
+
+ std::advance(i1, i);
return i1->second;
}
ExternalTemplate getTemplate(int) const;
///
string const Browse(string const &) const;
-
private:
///
virtual void applyParamsToInset();
string const getCommand(pid_t) const;
///
void kill(pid_t);
-
private:
///
virtual void apply();
using std::make_pair;
using std::vector;
+// We need these in the file browser.
+extern string system_lyxdir;
+extern string user_lyxdir;
+
+
ControlGraphics::ControlGraphics(LyXView & lv, Dialogs & d)
: ControlInset<InsetGraphics, InsetGraphicsParams>(lv, d)
{}
{}
-// We need these in the file browser.
-extern string system_lyxdir;
-extern string user_lyxdir;
-
-
string const ControlGraphics::Browse(string const & in_name)
{
string const title = _("Select graphics file");
};
namespace frnt {
- /// The (tranlated) GUI string and it's LaTeX equivalent.
- typedef std::pair<string, string> RotationOriginPair;
- ///
- std::vector<RotationOriginPair> getRotationOriginData();
+
+/// The (tranlated) GUI string and it's LaTeX equivalent.
+typedef std::pair<string, string> RotationOriginPair;
+///
+std::vector<RotationOriginPair> getRotationOriginData();
+
} // namespace frnt
#endif // CONTROLGRAPHICS_H
*
* \author Alejandro Aguilar Sierra
* \author John Levon
- * \author Angus Leeming
+ * \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
if (IsFileReadable(fileWithAbsPath))
return true;
-
+
return false;
}
/// test if file exist
bool fileExists(string const & file);
-
private:
/// Dispatch the changed parameters to the kernel.
virtual void applyParamsToInset();
virtual InsetInclude::Params const getParams(string const &)
{ return InsetInclude::Params(); }
/// get the parameters from the inset passed to showInset.
- virtual InsetInclude::Params const getParams(InsetInclude const & inset)
- { return inset.params(); }
+ virtual InsetInclude::Params const
+ getParams(InsetInclude const & inset) {
+ return inset.params();
+ }
};
#endif // CONTROLINCLUDE_H
class Inset;
template <class Inset, class Params>
-class ControlInset : public ControlConnectBD
-{
+class ControlInset : public ControlConnectBD {
public:
///
ControlInset(LyXView &, Dialogs &);
void createInset(string const &);
/// Slot launching dialog to an existing inset.
void showInset(Inset *);
-
protected:
/// Allow the daughter methods to access the inset.
Inset * inset() const;
-
private:
/** These 7 methods are all that the individual daughter classes
should need to instantiate. */
dialog allows multiple citiations to be inserted easily. */
virtual bool disconnectOnApply() { return false; }
-
-
/// Instantiation of ControlButtons virtual methods.
/// Get changed parameters and Dispatch them to the kernel.
/// is the dialog built ?
bool dialog_built_;
-
};
#include "ControlInset.tmpl"
#endif // CONTROLINSET_H
-
///
ControlLog(LyXView &, Dialogs &);
///
- std::pair<Buffer::LogType, string> const & logfile()
- { return logfile_; }
-
+ std::pair<Buffer::LogType, string> const & logfile() {
+ return logfile_;
+ }
private:
///
virtual void apply() {}
: pos(InsetMinipage::top)
{}
+
MinipageParams::MinipageParams(InsetMinipage const & inset)
: pageWidth(inset.pageWidth()), pos(inset.pos())
{}
public:
///
ControlMinipage(LyXView &, Dialogs &);
-
private:
/// Dispatch the changed parameters to the kernel.
virtual void applyParamsToInset();
ininset_ = par_->inInset();
}
+
void ControlParagraph::changedParagraph()
{
/// get paragraph
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Edwin Leuven
+ * \author Edwin Leuven
*
* Full author contact details are available in file CREDITS
*/
/** A controller for Paragraph dialogs.
*/
-class ControlParagraph : public ControlDialogBD
-{
+class ControlParagraph : public ControlDialogBD {
public:
///
ControlParagraph(LyXView &, Dialogs &);
LyXAlignment alignPossible() const;
///
void changedParagraph();
-
private:
/// Get changed parameters and Dispatch them to the kernel.
virtual void apply();
ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d)
- : ControlDialogBD(lv, d),
- params_(0)
+ : ControlDialogBD(lv, d)
{}
}
-string & ControlPreamble::params() const
+string const & ControlPreamble::params() const
{
- lyx::Assert(params_);
- return *params_;
+ return params_;
+}
+
+
+void ControlPreamble::params(string const & newparams)
+{
+ params_ = newparams;
}
void ControlPreamble::setParams()
{
- delete params_;
- params_ = new string(buffer()->params.preamble);
+ params_ = buffer()->params.preamble;
}
void ControlPreamble::clearParams()
{
- delete params_;
- params_ = 0;
+ params_.erase();
}
ControlPreamble(LyXView &, Dialogs &);
///
- string & params() const;
-
+ string const & params() const;
+ ///
+ void params(string const & newparams);
private:
/// Get changed parameters and Dispatch them to the kernel.
virtual void apply();
virtual void clearParams();
///
- string * params_;
+ string params_;
};
#endif // CONTROLPREAMBLE_H
string const Browse(string const &);
///
PrinterParams & params() const;
-
private:
/// Get changed parameters and Dispatch them to the kernel.
virtual void apply();
public:
///
ControlRef(LyXView &, Dialogs &);
-
///
std::vector<string> const getLabelList(string const &) const;
///
/// Replaces occurence of string
void replace(string const & search, string const & replace,
bool casesensitive, bool matchword, bool all);
-
private:
/// not needed.
virtual void apply() {}
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Angus Leeming
+ * \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
/// The command to be executed
string const getCommand() const { return command_; };
void setCommand(string const &);
-
private:
///
virtual void apply();
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Herbert Voss
+ * \author Herbert Voss
*
* Full author contact details are available in file CREDITS
*/
* Licence details can be found in the file COPYING.
*
* \file ControlShowFile.h
- * \author Herbert Voss
+ * \author Herbert Voss
*
* Full author contact details are available in file CREDITS
*/
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Edwin Leuven
+ * \author Edwin Leuven
*
* Full author contact details are available in file CREDITS
*/
void ControlSpellchecker::setParams()
{
- if (!speller_) {
- // create spell object
- string tmp;
+ if (speller_)
+ return;
+
+ // create spell object
+ string tmp;
#ifdef USE_PSPELL
- if (lyxrc.use_pspell) {
- tmp = (lyxrc.isp_use_alt_lang) ?
- lyxrc.isp_alt_lang : buffer()->params.language->code();
-
- speller_ = new PSpell(buffer()->params, tmp);
- } else {
+ if (lyxrc.use_pspell) {
+ tmp = (lyxrc.isp_use_alt_lang) ?
+ lyxrc.isp_alt_lang : buffer()->params.language->code();
+
+ speller_ = new PSpell(buffer()->params, tmp);
+ } else {
#endif
- tmp = (lyxrc.isp_use_alt_lang) ?
- lyxrc.isp_alt_lang : buffer()->params.language->lang();
-
- speller_ = new ISpell(buffer()->params, tmp);
+ tmp = (lyxrc.isp_use_alt_lang) ?
+ lyxrc.isp_alt_lang : buffer()->params.language->lang();
+
+ speller_ = new ISpell(buffer()->params, tmp);
#ifdef USE_PSPELL
- }
+ }
#endif
-
- if (lyxrc.isp_use_alt_lang) {
- Language const * lang = languages.getLanguage(tmp);
- if (lang)
- rtl_ = lang->RightToLeft();
- } else {
- rtl_ = buffer()->params.language->RightToLeft();
- }
-
- if (!speller_->error().empty()) {
- emergency_exit_ = true;
- Alert::alert("The spellchecker has failed", speller_->error());
- clearParams();
- return;
- }
+
+ if (lyxrc.isp_use_alt_lang) {
+ Language const * lang = languages.getLanguage(tmp);
+ if (lang)
+ rtl_ = lang->RightToLeft();
+ } else {
+ rtl_ = buffer()->params.language->RightToLeft();
+ }
+
+ if (!speller_->error().empty()) {
+ emergency_exit_ = true;
+ Alert::alert("The spellchecker has failed", speller_->error());
+ clearParams();
+ return;
}
}
{
bufferview()->replaceWord(replacement);
// fix up the count
- --count_;
+ --count_;
check();
}
#include "WordLangTuple.h"
class SpellBase;
-
+
/** A controller for Spellchecker dialogs.
*/
class ControlSpellchecker : public ControlDialogBD {
string getMessage() {
return message_;
}
-
private:
-
/// set the params before show or update
void setParams();
/// clean-up on hide.
///
rowsCols & params();
-
private:
/// Apply from dialog
virtual void apply();
string getFileList(ControlTexinfo::texFileSuffix type, bool withFullPath)
{
switch (type) {
- case ControlTexinfo::bst:
+ case ControlTexinfo::bst:
return getTexFileList("bstFiles.lst", withFullPath);
break;
case ControlTexinfo::cls:
}
return string();
}
-
-}
+
+} // namespace anon
+
ControlTexinfo::ControlTexinfo(LyXView & lv, Dialogs & d)
: ControlDialogBI(lv, d)
void runTexhash() const;
/// read filecontents
string const getContents(texFileSuffix type, bool withPath) const;
-
-
private:
///
virtual void apply() {}
class Buffer;
+
ControlToc::ControlToc(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d, LFUN_TOC_INSERT)
{}
/** A controller for TOC dialogs.
*/
-class ControlToc : public ControlCommand
-{
+class ControlToc : public ControlCommand {
public:
///
ControlToc(LyXView &, Dialogs &);
#endif
#include "ControlVCLog.h"
-#include "Lsstream.h"
#include "ButtonControllerBase.h"
#include "buffer.h"
#include "lyxrc.h"
#include "gettext.h"
-
#include "support/lyxlib.h"
#include <fstream>
using std::endl;
+using std::ostream;
ControlVCLog::ControlVCLog(LyXView & lv, Dialogs & d)
}
-stringstream & ControlVCLog::getVCLogFile(stringstream & ss) const
+void ControlVCLog::getVCLogFile(ostream & ss) const
{
string const name = buffer()->lyxvc.getLogFile();
std::ifstream in(name.c_str());
- bool found = (in.get());
-
- if (found) {
- in.seekg(0, std::ios::beg); // rewind to the beginning
+ bool found(false);
+ if (in) {
ss << in.rdbuf();
found = ss.good();
}
ss << _("No version control log file found.") << endl;
lyx::unlink(name);
-
- return ss;
}
#endif
#include "ControlDialog_impl.h"
-#include "Lsstream.h"
+
+#include "LString.h"
/**
* A controller for the Version Control log viewer.
public:
///
ControlVCLog(LyXView &, Dialogs &);
- /// get a stringstream containing the log file
- stringstream & getVCLogFile(stringstream & ss) const;
+ /// put the log file into the ostream
+ void getVCLogFile(std::ostream & ss) const;
/// get the filename of the buffer
string const getBufferFileName() const;
-
private:
///
virtual void apply() {}
}
-WrapParams::WrapParams()
- : placement("")
-{}
-
-
WrapParams::WrapParams(InsetWrap const & inset)
: pageWidth(inset.pageWidth()),
placement(inset.placement())
///
struct WrapParams {
///
- WrapParams();
+ WrapParams() {}
///
WrapParams(InsetWrap const &);
///
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Angus Leeming
+ * \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
Controller & controller() { return controller_; }
///
Controller const & controller() const { return controller_; }
-
private:
///
Controller controller_;
* and the view
*/
void setController(ControlButtons & c) { controller_ptr_ = &c; }
-
+
///
- ControlButtons & getController()
- {
+ ControlButtons & getController() {
lyx::Assert(controller_ptr_);
return *controller_ptr_;
}
///
- ControlButtons const & getController() const
- {
+ ControlButtons const & getController() const {
lyx::Assert(controller_ptr_);
return *controller_ptr_;
}
-
protected:
/// We don't own this.
ControlButtons * controller_ptr_;
using std::vector;
using std::sort;
-namespace biblio
-{
+namespace biblio {
namespace {
#include <vector>
/** Functions of use to citation and bibtex GUI controllers and views */
-namespace biblio
-{
+namespace biblio {
+
+///
+enum CiteStyle {
+ CITE,
+ CITET,
+ CITEP,
+ CITEALT,
+ CITEALP,
+ CITEAUTHOR,
+ CITEYEAR,
+ CITEYEARPAR
+};
+
+///
+enum Search {
///
- enum CiteStyle {
- CITE,
- CITET,
- CITEP,
- CITEALT,
- CITEALP,
- CITEAUTHOR,
- CITEYEAR,
- CITEYEARPAR
- };
+ SIMPLE,
///
- enum Search {
- ///
- SIMPLE,
- ///
- REGEX
- };
+ REGEX
+};
+
+///
+enum Direction {
+ ///
+ FORWARD,
+ ///
+ BACKWARD
+};
+
+/// First entry is the bibliography key, second the data
+typedef std::map<string, string> InfoMap;
+
+/// Returns a vector of bibliography keys
+std::vector<string> const getKeys(InfoMap const &);
+
+/** Returns the BibTeX data associated with a given key.
+ Empty if no info exists. */
+string const getInfo(InfoMap const &, string const &);
+
+// rturn the year from the bibtex data record
+string const getYear(InfoMap const & map, string const & key);
+
+/// return the short form of an authorlist
+string const getAbbreviatedAuthor(InfoMap const & map, string const & key);
+
+// return only the family name
+string const familyName(string const & name);
+
+/** Search a BibTeX info field for the given key and return the
+ associated field. */
+string const parseBibTeX(string data, string const & findkey);
+
+/** Returns an iterator to the first key that meets the search
+ criterion, or end() if unsuccessful.
+
+ User supplies :
+ the InfoMap of bibkeys info,
+ the vector of keys to be searched,
+ the search criterion,
+ an iterator defining the starting point of the search,
+ an enum defining a Simple or Regex search,
+ an enum defining the search direction.
+*/
+
+std::vector<string>::const_iterator
+searchKeys(InfoMap const & map,
+ std::vector<string> const & keys_to_search,
+ string const & search_expression,
+ std::vector<string>::const_iterator start,
+ Search,
+ Direction,
+ bool caseSensitive=false);
+
+/// Type returned by getCitationStyle, below
+struct CitationStyle {
+ ///
+ CitationStyle() : style(CITE), full(false), forceUCase(false) {}
///
- enum Direction {
- ///
- FORWARD,
- ///
- BACKWARD
- };
-
- /// First entry is the bibliography key, second the data
- typedef std::map<string, string> InfoMap;
-
- /// Returns a vector of bibliography keys
- std::vector<string> const getKeys(InfoMap const &);
-
- /** Returns the BibTeX data associated with a given key.
- Empty if no info exists. */
- string const getInfo(InfoMap const &, string const &);
-
- // rturn the year from the bibtex data record
- string const getYear(InfoMap const & map, string const & key);
-
- /// return the short form of an authorlist
- string const getAbbreviatedAuthor(InfoMap const & map, string const & key);
-
- // return only the family name
- string const familyName(string const & name);
-
- /** Search a BibTeX info field for the given key and return the
- associated field. */
- string const parseBibTeX(string data, string const & findkey);
-
- /** Returns an iterator to the first key that meets the search
- criterion, or end() if unsuccessful.
-
- User supplies :
- the InfoMap of bibkeys info,
- the vector of keys to be searched,
- the search criterion,
- an iterator defining the starting point of the search,
- an enum defining a Simple or Regex search,
- an enum defining the search direction.
- */
-
- std::vector<string>::const_iterator
- searchKeys(InfoMap const & map,
- std::vector<string> const & keys_to_search,
- string const & search_expression,
- std::vector<string>::const_iterator start,
- Search,
- Direction,
- bool caseSensitive=false);
-
- /// Type returned by getCitationStyle, below
- struct CitationStyle {
- ///
- CitationStyle() : style(CITE), full(false), forceUCase(false) {}
- ///
- CiteStyle style;
- ///
- bool full;
- ///
- bool forceUCase;
- };
- /// Given the LaTeX command, return the appropriate CitationStyle
- CitationStyle const getCitationStyle(string const & command);
-
- /** Returns the LaTeX citation command
-
- User supplies :
- The CiteStyle enum,
- a flag forcing the full author list,
- a flag forcing upper case, e.g. "della Casa" becomes "Della Case"
- */
- string const getCiteCommand(CiteStyle, bool full, bool forceUCase);
-
- /// Returns a vector of available Citation styles.
- std::vector<CiteStyle> const getCiteStyles(bool usingNatbib);
-
- /**
- "Translates" the available Citation Styles into strings for this key.
- The returned string is displayed by the GUI.
-
-
- [XX] is used in place of the actual reference
- Eg, the vector will contain: [XX], Jones et al. [XX], ...
-
- User supplies :
- the key,
- the InfoMap of bibkeys info,
- the available citation styles
- */
- std::vector<string> const
- getNumericalStrings(string const & key,
- InfoMap const & map,
- std::vector<CiteStyle> const & styles);
-
- /**
- "Translates" the available Citation Styles into strings for this key.
- The returned string is displayed by the GUI.
-
- Eg, the vector will contain:
- Jones et al. (1990), (Jones et al. 1990), Jones et al. 1990, ...
-
- User supplies :
- the key,
- the InfoMap of bibkeys info,
- the available citation styles
- */
- std::vector<string> const
- getAuthorYearStrings(string const & key,
- InfoMap const & map,
- std::vector<CiteStyle> const & styles);
+ CiteStyle style;
+ ///
+ bool full;
+ ///
+ bool forceUCase;
+};
+
+/// Given the LaTeX command, return the appropriate CitationStyle
+CitationStyle const getCitationStyle(string const & command);
+
+/** Returns the LaTeX citation command
+
+User supplies :
+The CiteStyle enum,
+a flag forcing the full author list,
+a flag forcing upper case, e.g. "della Casa" becomes "Della Case"
+*/
+string const getCiteCommand(CiteStyle, bool full, bool forceUCase);
+
+/// Returns a vector of available Citation styles.
+std::vector<CiteStyle> const getCiteStyles(bool usingNatbib);
+
+/**
+ "Translates" the available Citation Styles into strings for this key.
+ The returned string is displayed by the GUI.
+
+
+ [XX] is used in place of the actual reference
+ Eg, the vector will contain: [XX], Jones et al. [XX], ...
+
+ User supplies :
+ the key,
+ the InfoMap of bibkeys info,
+ the available citation styles
+*/
+std::vector<string> const
+getNumericalStrings(string const & key,
+ InfoMap const & map,
+ std::vector<CiteStyle> const & styles);
+
+/**
+ "Translates" the available Citation Styles into strings for this key.
+ The returned string is displayed by the GUI.
+
+ Eg, the vector will contain:
+ Jones et al. (1990), (Jones et al. 1990), Jones et al. 1990, ...
+
+ User supplies :
+ the key,
+ the InfoMap of bibkeys info,
+ the available citation styles
+*/
+std::vector<string> const
+getAuthorYearStrings(string const & key,
+ InfoMap const & map,
+ std::vector<CiteStyle> const & styles);
} // namespace biblio
#endif // BIBLIOHELPERS_H
vector<FamilyPair> family(5);
FamilyPair pr;
- pr.first = _("No change"); pr.second = LyXFont::IGNORE_FAMILY;
+
+ pr.first = _("No change");
+ pr.second = LyXFont::IGNORE_FAMILY;
family[0] = pr;
- pr.first = _("Roman"); pr.second = LyXFont::ROMAN_FAMILY;
+
+ pr.first = _("Roman");
+ pr.second = LyXFont::ROMAN_FAMILY;
family[1] = pr;
- pr.first = _("Sans Serif"); pr.second = LyXFont::SANS_FAMILY;
+
+ pr.first = _("Sans Serif");
+ pr.second = LyXFont::SANS_FAMILY;
family[2] = pr;
- pr.first = _("Typewriter"); pr.second = LyXFont::TYPEWRITER_FAMILY;
+
+ pr.first = _("Typewriter");
+ pr.second = LyXFont::TYPEWRITER_FAMILY;
family[3] = pr;
- pr.first = _("Reset"); pr.second = LyXFont::INHERIT_FAMILY;
+
+ pr.first = _("Reset");
+ pr.second = LyXFont::INHERIT_FAMILY;
family[4] = pr;
return family;
vector<SeriesPair> series(4);
SeriesPair pr;
- pr.first = _("No change"); pr.second = LyXFont::IGNORE_SERIES;
+
+ pr.first = _("No change");
+ pr.second = LyXFont::IGNORE_SERIES;
series[0] = pr;
- pr.first = _("Medium"); pr.second = LyXFont::MEDIUM_SERIES;
+
+ pr.first = _("Medium");
+ pr.second = LyXFont::MEDIUM_SERIES;
series[1] = pr;
- pr.first = _("Bold"); pr.second = LyXFont::BOLD_SERIES;
+
+ pr.first = _("Bold");
+ pr.second = LyXFont::BOLD_SERIES;
series[2] = pr;
- pr.first = _("Reset"); pr.second = LyXFont::INHERIT_SERIES;
+
+ pr.first = _("Reset");
+ pr.second = LyXFont::INHERIT_SERIES;
series[3] = pr;
return series;
vector<ShapePair> shape(6);
ShapePair pr;
- pr.first = _("No change"); pr.second = LyXFont::IGNORE_SHAPE;
+
+ pr.first = _("No change");
+ pr.second = LyXFont::IGNORE_SHAPE;
shape[0] = pr;
- pr.first = _("Upright"); pr.second = LyXFont::UP_SHAPE;
+
+ pr.first = _("Upright");
+ pr.second = LyXFont::UP_SHAPE;
shape[1] = pr;
- pr.first = _("Italic"); pr.second = LyXFont::ITALIC_SHAPE;
+
+ pr.first = _("Italic");
+ pr.second = LyXFont::ITALIC_SHAPE;
shape[2] = pr;
- pr.first = _("Slanted"); pr.second = LyXFont::SLANTED_SHAPE;
+
+ pr.first = _("Slanted");
+ pr.second = LyXFont::SLANTED_SHAPE;
shape[3] = pr;
- pr.first = _("Small Caps"); pr.second = LyXFont::SMALLCAPS_SHAPE;
+
+ pr.first = _("Small Caps");
+ pr.second = LyXFont::SMALLCAPS_SHAPE;
shape[4] = pr;
- pr.first = _("Reset"); pr.second = LyXFont::INHERIT_SHAPE;
+
+ pr.first = _("Reset");
+ pr.second = LyXFont::INHERIT_SHAPE;
shape[5] = pr;
return shape;
vector<SizePair> size(14);
SizePair pr;
- pr.first = _("No change"); pr.second = LyXFont::IGNORE_SIZE;
+
+ pr.first = _("No change");
+ pr.second = LyXFont::IGNORE_SIZE;
size[0] = pr;
- pr.first = _("Tiny"); pr.second = LyXFont::SIZE_TINY;
+
+ pr.first = _("Tiny");
+ pr.second = LyXFont::SIZE_TINY;
size[1] = pr;
- pr.first = _("Smallest"); pr.second = LyXFont::SIZE_SCRIPT;
+
+ pr.first = _("Smallest");
+ pr.second = LyXFont::SIZE_SCRIPT;
size[2] = pr;
- pr.first = _("Smaller"); pr.second = LyXFont::SIZE_FOOTNOTE;
+
+ pr.first = _("Smaller");
+ pr.second = LyXFont::SIZE_FOOTNOTE;
size[3] = pr;
- pr.first = _("Small"); pr.second = LyXFont::SIZE_SMALL;
+
+ pr.first = _("Small");
+ pr.second = LyXFont::SIZE_SMALL;
size[4] = pr;
- pr.first = _("Normal"); pr.second = LyXFont::SIZE_NORMAL;
+
+ pr.first = _("Normal");
+ pr.second = LyXFont::SIZE_NORMAL;
size[5] = pr;
- pr.first = _("Large"); pr.second = LyXFont::SIZE_LARGE;
+
+ pr.first = _("Large");
+ pr.second = LyXFont::SIZE_LARGE;
size[6] = pr;
- pr.first = _("Larger"); pr.second = LyXFont::SIZE_LARGER;
+
+ pr.first = _("Larger");
+ pr.second = LyXFont::SIZE_LARGER;
size[7] = pr;
- pr.first = _("Largest"); pr.second = LyXFont::SIZE_LARGEST;
+
+ pr.first = _("Largest");
+ pr.second = LyXFont::SIZE_LARGEST;
size[8] = pr;
- pr.first = _("Huge"); pr.second = LyXFont::SIZE_HUGE;
+
+ pr.first = _("Huge");
+ pr.second = LyXFont::SIZE_HUGE;
size[9] = pr;
- pr.first = _("Huger"); pr.second = LyXFont::SIZE_HUGER;
+
+ pr.first = _("Huger");
+ pr.second = LyXFont::SIZE_HUGER;
size[10] = pr;
- pr.first = _("Increase"); pr.second = LyXFont::INCREASE_SIZE;
+
+ pr.first = _("Increase");
+ pr.second = LyXFont::INCREASE_SIZE;
size[11] = pr;
- pr.first = _("Decrease"); pr.second = LyXFont::DECREASE_SIZE;
+
+ pr.first = _("Decrease");
+ pr.second = LyXFont::DECREASE_SIZE;
size[12] = pr;
- pr.first = _("Reset"); pr.second = LyXFont::INHERIT_SIZE;
+
+ pr.first = _("Reset");
+ pr.second = LyXFont::INHERIT_SIZE;
size[13] = pr;
return size;
vector<BarPair> bar(5);
BarPair pr;
- pr.first = _("No change"); pr.second = IGNORE;
+
+ pr.first = _("No change");
+ pr.second = IGNORE;
bar[0] = pr;
- pr.first = _("Emph"); pr.second = EMPH_TOGGLE;
+
+ pr.first = _("Emph");
+ pr.second = EMPH_TOGGLE;
bar[1] = pr;
- pr.first = _("Underbar"); pr.second = UNDERBAR_TOGGLE;
+
+ pr.first = _("Underbar");
+ pr.second = UNDERBAR_TOGGLE;
bar[2] = pr;
- pr.first = _("Noun"); pr.second = NOUN_TOGGLE;
+
+ pr.first = _("Noun");
+ pr.second = NOUN_TOGGLE;
bar[3] = pr;
- pr.first = _("Reset"); pr.second = INHERIT;
+
+ pr.first = _("Reset");
+ pr.second = INHERIT;
bar[4] = pr;
return bar;
vector<ColorPair> color(11);
ColorPair pr;
- pr.first = _("No change"); pr.second = LColor::ignore;
+
+ pr.first = _("No change");
+ pr.second = LColor::ignore;
color[0] = pr;
- pr.first = _("No color"); pr.second = LColor::none;
+
+ pr.first = _("No color");
+ pr.second = LColor::none;
color[1] = pr;
- pr.first = _("Black"); pr.second = LColor::black;
+
+ pr.first = _("Black");
+ pr.second = LColor::black;
color[2] = pr;
- pr.first = _("White"); pr.second = LColor::white;
+
+ pr.first = _("White");
+ pr.second = LColor::white;
color[3] = pr;
- pr.first = _("Red"); pr.second = LColor::red;
+
+ pr.first = _("Red");
+ pr.second = LColor::red;
color[4] = pr;
- pr.first = _("Green"); pr.second = LColor::green;
+
+ pr.first = _("Green");
+ pr.second = LColor::green;
color[5] = pr;
- pr.first = _("Blue"); pr.second = LColor::blue;
+
+ pr.first = _("Blue");
+ pr.second = LColor::blue;
color[6] = pr;
- pr.first = _("Cyan"); pr.second = LColor::cyan;
+
+ pr.first = _("Cyan");
+ pr.second = LColor::cyan;
color[7] = pr;
- pr.first = _("Magenta"); pr.second = LColor::magenta;
+
+ pr.first = _("Magenta");
+ pr.second = LColor::magenta;
color[8] = pr;
- pr.first = _("Yellow"); pr.second = LColor::yellow;
+
+ pr.first = _("Yellow");
+ pr.second = LColor::yellow;
color[9] = pr;
- pr.first = _("Reset"); pr.second = LColor::inherit;
+
+ pr.first = _("Reset");
+ pr.second = LColor::inherit;
color[10] = pr;
return color;
/** Functions of use to the character GUI controller and view */
namespace frnt {
- ///
- enum FONT_STATE {
- ///
- IGNORE,
- ///
- EMPH_TOGGLE,
- ///
- UNDERBAR_TOGGLE,
- ///
- NOUN_TOGGLE,
- ///
- INHERIT
- };
+///
+enum FONT_STATE {
///
- typedef std::pair<string, LyXFont::FONT_FAMILY> FamilyPair;
- ///
- typedef std::pair<string, LyXFont::FONT_SERIES> SeriesPair;
+ IGNORE,
///
- typedef std::pair<string, LyXFont::FONT_SHAPE> ShapePair;
+ EMPH_TOGGLE,
///
- typedef std::pair<string, LyXFont::FONT_SIZE> SizePair;
+ UNDERBAR_TOGGLE,
///
- typedef std::pair<string, FONT_STATE> BarPair;
+ NOUN_TOGGLE,
///
- typedef std::pair<string, LColor::color> ColorPair;
+ INHERIT
+};
- ///
- std::vector<FamilyPair> const getFamilyData();
- ///
- std::vector<SeriesPair> const getSeriesData();
- ///
- std::vector<ShapePair> const getShapeData();
- ///
- std::vector<SizePair> const getSizeData();
- ///
- std::vector<BarPair> const getBarData();
- ///
- std::vector<ColorPair> const getColorData();
+///
+typedef std::pair<string, LyXFont::FONT_FAMILY> FamilyPair;
+///
+typedef std::pair<string, LyXFont::FONT_SERIES> SeriesPair;
+///
+typedef std::pair<string, LyXFont::FONT_SHAPE> ShapePair;
+///
+typedef std::pair<string, LyXFont::FONT_SIZE> SizePair;
+///
+typedef std::pair<string, FONT_STATE> BarPair;
+///
+typedef std::pair<string, LColor::color> ColorPair;
+
+///
+std::vector<FamilyPair> const getFamilyData();
+///
+std::vector<SeriesPair> const getSeriesData();
+///
+std::vector<ShapePair> const getShapeData();
+///
+std::vector<SizePair> const getSizeData();
+///
+std::vector<BarPair> const getBarData();
+///
+std::vector<ColorPair> const getColorData();
} // namespace frnt
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Angus Leeming
+ * \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
struct Sorter {
bool operator()(frnt::LanguagePair const & lhs,
- frnt::LanguagePair const & rhs) const
- {
- return lhs.first < rhs.first;
- }
+ frnt::LanguagePair const & rhs) const {
+ return lhs.first < rhs.first;
+ }
};
} // namespace anon
vector<LanguagePair> langs(size);
if (character_dlg) {
- langs[0].first = _("No change"); langs[0].second = "ignore";
- langs[1].first = _("Reset"); langs[1].second = "reset";
+ langs[0].first = _("No change");
+ langs[0].second = "ignore";
+ langs[1].first = _("Reset");
+ langs[1].second = "reset";
}
vector<string>::size_type i = character_dlg ? 2 : 0;
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Angus Leeming
+ * \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
/** Ease the use of internationalised language strings in the dialogs.
*/
namespace frnt {
- ///
- typedef std::pair<string, string> LanguagePair;
- /** If the caller is the character dialog, add "No change" and "Reset"
- * to the vector.
- */
- std::vector<LanguagePair> const getLanguageData(bool character_dlg);
+
+///
+typedef std::pair<string, string> LanguagePair;
+
+/** If the caller is the character dialog, add "No change" and "Reset"
+ * to the vector.
+ */
+std::vector<LanguagePair> const getLanguageData(bool character_dlg);
} // namespace frnt
using std::vector;
using std::make_pair;
+
string const browseFile(LyXView * lv, string const & filename,
string const & title,
string const & pattern,
pair<string,string> const & dir1,
pair<string,string> const & dir2)
{
- string lastPath = ".";
+ string lastPath(".");
if (!filename.empty())
lastPath = OnlyPath(filename);
FileDialog::Result result;
- while (1) {
- result = fileDlg.Select(lastPath, pattern, OnlyFilename(filename));
+ while (true) {
+ result = fileDlg.Select(lastPath, pattern,
+ OnlyFilename(filename));
if (result.second.empty())
return result.second;
vector<string> const getLatexUnits()
{
vector<string> units;
- const char * str;
- for(int i=0; (str = stringFromUnit(i)); ++i)
+ char const * str;
+ for (int i = 0; (str = stringFromUnit(i)); ++i)
units.push_back(str);
return units;
pattern: *.ps etc.
dir1 = (name, dir), dir2 = (name, dir): extra buttons on the dialog.
*/
-string const browseFile(LyXView *lv, string const & filename,
- string const & title,
- string const & pattern,
- std::pair<string,string> const & dir1 = std::make_pair(string(), string()),
- std::pair<string,string> const & dir2 = std::make_pair(string(), string()));
+string const
+browseFile(LyXView *lv, string const & filename,
+ string const & title,
+ string const & pattern,
+ std::pair<string,string> const & dir1 =
+ std::make_pair(string(), string()),
+ std::pair<string,string> const & dir2 =
+ std::make_pair(string(), string()));
/* Wrapper around browseFile which tries to provide a filename
of the form "../baz/foo.txt", an absolute path is returned. This is
intended to be useful for insets which encapsulate files/
*/
-string const browseRelFile(LyXView *lv, string const & filename,
- string const & refpath,
- string const & title,
- string const & pattern,
- std::pair<string,string> const & dir1 = std::make_pair(string(), string()),
- std::pair<string,string> const & dir2 = std::make_pair(string(), string()));
+string const
+browseRelFile(LyXView *lv, string const & filename,
+ string const & refpath,
+ string const & title,
+ string const & pattern,
+ std::pair<string,string> const & dir1 =
+ std::make_pair(string(), string()),
+ std::pair<string,string> const & dir2 =
+ std::make_pair(string(), string()));
/// Returns a vector of units that can be used to create a valid LaTeX length.
vector<pair<A,B> >
*/
-namespace hide {
+namespace detail {
template<class Pair>
struct firster {
second_type const & operator()(Pair const & p) { return p.second; }
};
-}
+} // namespace detail
///
template<class Pair>
{
std::vector<typename Pair::first_type> tmp(pr.size());
std::transform(pr.begin(), pr.end(), tmp.begin(),
- hide::firster<Pair>());
+ detail::firster<Pair>());
return tmp;
}
{
std::vector<typename Pair::second_type> tmp(pr.size());
std::transform(pr.begin(), pr.end(), tmp.begin(),
- hide::seconder<Pair>());
+ detail::seconder<Pair>());
return tmp;
}
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Herbert Voss
+ * \author Herbert Voss
*
* Full author contact details are available in file CREDITS
*/
{
vector<string>::iterator it = dbase.begin();
vector<string>::iterator end = dbase.end();
- for (; it != end; ++it)
+ for (; it != end; ++it)
*it = OnlyFilename(*it);
return dbase;
}
-}
+} // namespace anon
// build filelists of all availabe bst/cls/sty-files. done through
// kpsewhich and an external script, saved in *Files.lst
Systemcall one;
one.startscript(Systemcall::Wait,
LibFileSearch("scripts", "TeXFiles.sh"));
- p.pop();
}
//path to texhash through system
Systemcall one;
- one.startscript(Systemcall::Wait,"texhash");
- p.pop();
+ one.startscript(Systemcall::Wait,"texhash");
}
+
string const getTexFileList(string const & filename, bool withFullPath)
{
string const file = LibFileSearch("", filename);
if (file.empty())
return string();
-
+
vector<string> dbase =
getVectorFromString(GetFileContents(file), "\n");
- lyx::eliminate_duplicates(dbase);
+ lyx::eliminate_duplicates(dbase);
string const str_out = withFullPath ?
getStringFromVector(dbase, "\n") :
getStringFromVector(listWithoutPath(dbase), "\n");
}
-string const getListOfOptions(string const & classname,
- string const & type)
+string const getListOfOptions(string const & classname, string const & type)
{
string const filename = getTexFileFromList(classname,type);
string optionList = string();
}
-string const getTexFileFromList(string const & file,
+string const getTexFileFromList(string const & file,
string const & type)
{
string const file_ = (type == "cls") ? file + ".cls" : file + ".sty";
-
+
lyxerr << "Search for classfile " << file_ << endl;
-
- string const lstfile = (type == "cls") ? "clsFiles.lst" : "styFiles.lst";
- string const allClasses = GetFileContents(LibFileSearch(string(), lstfile));
+
+ string const lstfile =
+ ((type == "cls") ? "clsFiles.lst" : "styFiles.lst");
+ string const allClasses = GetFileContents(LibFileSearch(string(),
+ lstfile));
int entries = 0;
string classfile = token(allClasses, '\n', entries);
int count = 0;
- while ((!contains(classfile, file) ||
+ while ((!contains(classfile, file) ||
(OnlyFilename(classfile) != file)) &&
(++count < 1000)) {
classfile = token(allClasses, '\n', ++entries);
}
-
+
// now we have filename with full path
lyxerr << "with full path: " << classfile << endl;
+
return classfile;
}
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author Herbert Voss
+ * \author Herbert Voss
*
* Full author contact details are available in file CREDITS
*/
+2002-10-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * QVCLog.C (update_contents): modify
+
+ * QPreamble.C (apply): modify
+
2002-10-21 Dekel Tsur <dekelts@tau.ac.il>
* qfont_metrics.C (ascent): Fix returned value.
2002-10-21 Philippe Elie <phil.el@wanadoo.fr>
* QContentPane.h:
- * QContentPane.C: implement wheelEvent
+ * QContentPane.C: implement wheelEvent
2002-10-20 Dekel Tsur <dekelts@tau.ac.il>
* ui/QDelimiterDialog.ui: remove two huge XPMs that
were accidentally built in
-
+
2002-10-20 Lars Gullik Bjønnes <larsbj@gullik.net>
* Toolbar_pimpl.C (setLayout): initialize i to 0, don't
* QAbout.C (build_dialog): fill the credits view in a bit more
elegant way
- * almost all files: clean up formatting and indenting.
+ * almost all files: clean up formatting and indenting.
2002-10-19 Lars Gullik Bjønnes <larsbj@gullik.net>
void QPreamble::apply()
{
- controller().params() = dialog_->preambleLE->text().latin1();
+ controller().params(dialog_->preambleLE->text().latin1());
}
dialog_->vclogTV->setText("");
- stringstream ss;
+ ostringstream ss;
+ controller().getVCLogFile(ss);
- dialog_->vclogTV->setText(controller().getVCLogFile(ss).str().c_str());
+ dialog_->vclogTV->setText(ss.str().c_str());
}
+2002-10-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
+
+ * FormVCLog.C (update): modify, use ostringstream
+
+ * FormPreamble.C (apply): modify
+
+ * FormLog.C (update): modify
+
+ * FormAboutlyx.C (build): use ostringstream, modify
+
2002-10-21 Angus Leeming <leeming@lyx.org>
* xformsImage.C (rotate): pass ints to flimage_rotate, fixing compiler
* Licence details can be found in the file COPYING.
*
* \author Edwin Leuven
- * \author Angus Leeming
+ * \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
// create credits
credits_.reset(build_aboutlyx_credits(this));
- stringstream ss;
- fl_add_browser_line(credits_->browser_credits,
- controller().getCredits(ss).str().c_str());
+ ostringstream ss;
+ controller().getCredits(ss);
+ fl_add_browser_line(credits_->browser_credits, ss.str().c_str());
// stack tabs
fl_addto_tabfolder(dialog_->tabfolder,_("Copyright and Version"),
{
fl_clear_browser(dialog_->browser);
- if (controller().logfile().first == Buffer::buildlog) {
- fl_set_form_title(dialog_->form, _("Build log"));
- if (!fl_load_browser(dialog_->browser,
- controller().logfile().second.c_str()))
- fl_add_browser_line(dialog_->browser,
- _("No build log file found"));
- return;
- }
-
- fl_set_form_title(dialog_->form, _("LaTeX Log"));
+ bool buildlog = (controller().logfile().first == Buffer::buildlog);
+
+ fl_set_form_title(dialog_->form,
+ buildlog ? _("Build log") : _("LaTeX Log"));
if (!fl_load_browser(dialog_->browser,
controller().logfile().second.c_str()))
fl_add_browser_line(dialog_->browser,
- _("No LaTeX log file found"));
+ buildlog ? _("No build log file found")
+ : _("No LaTeX log file found"));
}
void FormPreamble::apply()
{
- controller().params() = fl_get_input(dialog_->input_preamble);
+ controller().params(fl_get_input(dialog_->input_preamble));
}
#include "gettext.h"
#include FORMS_H_LOCATION
+
FormVCLog::FormVCLog()
: FormCB<ControlVCLog, FormBrowser>(_("Version Control Log"))
{}
{
fl_clear_browser(dialog_->browser);
- stringstream ss;
+ ostringstream ss;
+ controller().getVCLogFile(ss);
fl_add_browser_line(dialog_->browser,
- controller().getVCLogFile(ss).str().c_str());
+ ss.str().c_str());
}
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
- * \author John Levon
+ * \author John Levon
*
* Full author contact details are available in file CREDITS
*/
#include <config.h>
-
+
#include "frontends/WorkAreaFactory.h"
-
+
#include "XWorkArea.h"
-
+
namespace WorkAreaFactory {
-
+
WorkArea * create(int x, int y, int w, int h)
{
return new XWorkArea(x, y, w, h);
}
-
+
}
* Licence details can be found in the file COPYING.
*
* \author unknown
- * \author John Levon
+ * \author John Levon
*
* Full author contact details are available in file CREDITS
*/
ev->xbutton.y - ob->y,
x_button_state(key));
area->dispatch(cmd);
-
+
}
break;
#if FL_VERSION < 1 && FL_REVISION < 89
* Licence details can be found in the file COPYING.
*
* \author unknown
- * \author John Levon
+ * \author John Levon
*
* Full author contact details are available in file CREDITS
*/
/// GC used for copying to the screen
GC copy_gc;
-
+
///
FL_OBJECT * backgroundbox;
/// the workarea free object
}
getFontinfo(family, series, shape);
+ // FIXME! CHECK! Should we use 72.0 or 72.27? (Lgb)
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);