ws fixes, formatting and some other small changes

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5463 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-10-21 17:38:09 +00:00
parent 774dabb323
commit ce708d095c
83 changed files with 616 additions and 517 deletions

View File

@ -5,7 +5,7 @@
* 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
*/

View File

@ -5,7 +5,7 @@
* 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
@ -25,8 +25,7 @@
* 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);
@ -48,7 +47,6 @@ public:
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;
@ -68,8 +66,7 @@ private:
template <class BP, class GUIBC>
class ButtonController: public GUIBC
{
class ButtonController: public GUIBC {
public:
///
ButtonController(string const & = _("Cancel"),
@ -78,7 +75,6 @@ public:
~ButtonController() {}
///
virtual ButtonPolicy & bp() { return bp_; }
protected:
///
BP bp_;

View File

@ -32,7 +32,8 @@ void ButtonControllerBase::ok()
void ButtonControllerBase::input(ButtonPolicy::SMInput in)
{
if (ButtonPolicy::SMI_NOOP == in) return;
if (ButtonPolicy::SMI_NOOP == in)
return;
bp().input(in);
refresh();
}

View File

@ -29,8 +29,7 @@
* 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
@ -70,7 +69,6 @@ public:
void valid(bool = true);
///
void invalid();
protected:
///
string cancel_label_;

View File

@ -270,8 +270,7 @@ private:
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();

View File

@ -1,3 +1,29 @@
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

View File

@ -10,17 +10,22 @@
*/
#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;
@ -32,7 +37,7 @@ ControlAboutlyx::ControlAboutlyx(LyXView & lv, Dialogs & d)
{}
stringstream & ControlAboutlyx::getCredits(stringstream & ss) const
void ControlAboutlyx::getCredits(ostream & ss) const
{
string const name = FileSearch(system_lyxdir, "CREDITS");
@ -40,14 +45,9 @@ stringstream & ControlAboutlyx::getCredits(stringstream & ss) const
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) {
@ -55,8 +55,6 @@ stringstream & ControlAboutlyx::getCredits(stringstream & ss) const
<< _("Please install correctly to estimate the great\n")
<< _("amount of work other people have done for the LyX project.");
}
return ss;
}
@ -80,7 +78,7 @@ string const ControlAboutlyx::getDisclaimer() const
string const ControlAboutlyx::getVersion() const
{
stringstream ss;
ostringstream ss;
ss << _("LyX Version ")
<< lyx_version

View File

@ -5,7 +5,7 @@
* 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
*/
@ -18,9 +18,10 @@
#endif
#include "ControlDialog_impl.h"
#include "Lsstream.h"
#include "LString.h"
#include <iosfwd>
/** A controller for the About LyX dialogs.
*/
class ControlAboutlyx : public ControlDialogBI {
@ -29,7 +30,7 @@ public:
ControlAboutlyx(LyXView &, Dialogs &);
///
stringstream & getCredits(stringstream &) const;
void getCredits(std::ostream &) const;
///
string const getCopyright() const;
@ -42,8 +43,6 @@ public:
///
string const getVersion() const;
private:
/// not needed.
virtual void apply() {}

View File

@ -25,7 +25,6 @@ class ControlBibitem : public ControlCommand {
public:
///
ControlBibitem(LyXView &, Dialogs &);
private:
/// Dispatch the changed parameters to the kernel.
virtual void applyParamsToInset();

View File

@ -60,7 +60,8 @@ string const ControlBibtex::Browse(string const & in_name,
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);
}

View File

@ -21,8 +21,7 @@
/** A controller for Bibtex dialogs.
*/
class ControlBibtex : public ControlCommand
{
class ControlBibtex : public ControlCommand {
public:
///
ControlBibtex(LyXView &, Dialogs &);
@ -33,7 +32,6 @@ public:
/// 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();

View File

@ -87,4 +87,3 @@ void ControlButtons::setButtonController(ButtonControllerBase & bc)
{
bc_ptr_ = &bc;
}

View File

@ -37,8 +37,7 @@ class ButtonControllerBase;
/** Abstract base class for Controllers with a ButtonController.
*/
class ControlButtons : boost::noncopyable
{
class ControlButtons : boost::noncopyable {
public:
///
ControlButtons();
@ -67,7 +66,6 @@ public:
void setView(ViewBase &);
///
void setButtonController(ButtonControllerBase &);
protected:
///
ViewBase & view();
@ -86,7 +84,6 @@ protected:
/** 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_;

View File

@ -23,8 +23,7 @@
/** A controller for Character dialogs.
*/
class ControlCharacter : public ControlDialogBD
{
class ControlCharacter : public ControlDialogBD {
public:
///
ControlCharacter(LyXView &, Dialogs &);

View File

@ -20,6 +20,7 @@
using std::vector;
using std::pair;
vector<biblio::CiteStyle> ControlCitation::citeStyles_;
@ -40,7 +41,8 @@ void ControlCitation::setDaughterParams()
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));
}

View File

@ -21,8 +21,7 @@
/** A controller for Citation dialogs.
*/
class ControlCitation : public ControlCommand
{
class ControlCitation : public ControlCommand {
public:
///
ControlCitation(LyXView &, Dialogs &);
@ -36,9 +35,9 @@ public:
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();

View File

@ -31,12 +31,12 @@
/** 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();

View File

@ -5,7 +5,7 @@
*
* \author Lars
* \author Asger and Juergen
* \author John Levon
* \author John Levon
*
* Full author contact details are available in file CREDITS
*/
@ -27,37 +27,37 @@ using std::vector;
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()
{
@ -70,7 +70,8 @@ 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;
@ -102,17 +103,17 @@ vector<string> const ControlCommandBuffer::completions(string const & prefix, st
}
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);

View File

@ -6,7 +6,7 @@
*
* \author Lars
* \author Asger and Juergen
* \author John Levon
* \author John Levon
*
* Full author contact details are available in file CREDITS
*/
@ -28,12 +28,12 @@ class LyXFunc;
* 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();
@ -41,23 +41,23 @@ public:
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

View File

@ -26,6 +26,7 @@
#include <boost/bind.hpp>
ControlConnectBase::ControlConnectBase(LyXView & lv, Dialogs & d)
: lv_(lv), d_(d)
{}

View File

@ -46,8 +46,7 @@ class LyXFunc;
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 {
@ -66,7 +65,6 @@ public:
bool bufferIsReadonly() const;
///
DocTypes docType() const;
protected:
/// True if the dialog depends on the buffer, else false.
virtual bool isBufferDependent() const = 0;
@ -96,7 +94,6 @@ protected:
///
LyXFunc const & lyxfunc() const;
///
LyXView & lv_;
/// Contains the signals we have to connect to.
@ -114,12 +111,10 @@ protected:
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; }
@ -131,12 +126,10 @@ protected:
/** 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; }
@ -144,7 +137,6 @@ protected:
virtual void connect();
/// Disconnect signals
virtual void disconnect();
private:
/** Slot connected to update signal.
Bool indicates if a buffer switch took place.

View File

@ -4,7 +4,7 @@
* 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
*
@ -25,8 +25,7 @@ class Dialogs;
The Base class will be either ControlConnectBI or ControlConnectBD.
*/
template <class Base>
class ControlDialog : public Base
{
class ControlDialog : public Base {
public:
///
ControlDialog(LyXView &, Dialogs &);
@ -35,7 +34,6 @@ public:
* Publicly accessible so that it can be invoked by the Dialogs class.
*/
virtual void show();
protected:
/// Hide the dialog.
virtual void hide();
@ -46,7 +44,6 @@ protected:
virtual void clearParams() {}
/// set the params before show or update
virtual void setParams() {}
private:
/// is the dialog built ?
bool dialog_built_;

View File

@ -3,7 +3,7 @@
* 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
*/
@ -13,6 +13,7 @@
#include "ControlDialog_impl.h"
#include "ControlDialog.tmpl"
ControlDialogBD::ControlDialogBD(LyXView & lv, Dialogs & d)
: ControlDialog<ControlConnectBD>(lv, d)
{}

View File

@ -4,7 +4,7 @@
* 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
*
@ -22,16 +22,14 @@ class Dialogs;
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 &);

View File

@ -49,6 +49,7 @@ void ControlDocument::showPreamble()
{
}
BufferParams & ControlDocument::params()
{
lyx::Assert(bp_.get());
@ -91,6 +92,7 @@ void ControlDocument::setParams()
*bp_ = buffer()->params;
}
void ControlDocument::setLanguage()
{
Language const * oldL = buffer()->params.language;
@ -142,6 +144,7 @@ bool ControlDocument::classApply()
return true;
}
void ControlDocument::saveAsDefault()
{
lv_.buffer()->params.preamble = bp_->preamble;

View File

@ -47,7 +47,6 @@ class ControlERT : public ControlInset<InsetERT, ERTParams> {
public:
///
ControlERT(LyXView &, Dialogs &);
private:
/// Dispatch the changed parameters to the kernel.
virtual void applyParamsToInset();

View File

@ -23,12 +23,10 @@ class InsetError;
/** 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() {}

View File

@ -28,6 +28,7 @@
using std::vector;
ControlExternal::ControlExternal(LyXView & lv, Dialogs & d)
: ControlInset<InsetExternal, InsetExternal::Params>(lv, d)
{}
@ -38,6 +39,7 @@ InsetExternal::Params const ControlExternal::getParams(string const &)
return InsetExternal::Params();
}
InsetExternal::Params const
ControlExternal::getParams(InsetExternal const & inset)
{
@ -51,6 +53,7 @@ void ControlExternal::applyParamsToInset()
bufferview()->updateInset(inset(), true);
}
void ControlExternal::editExternal()
{
// fill the local, controller's copy of the Params struct with
@ -66,6 +69,7 @@ void ControlExternal::editExternal()
ie->editExternal();
}
void ControlExternal::viewExternal()
{
view().apply();
@ -77,6 +81,7 @@ void ControlExternal::viewExternal()
ie->viewExternal();
}
void ControlExternal::updateExternal()
{
view().apply();
@ -88,6 +93,7 @@ void ControlExternal::updateExternal()
ie->updateExternal();
}
vector<string> const ControlExternal::getTemplates() const
{
vector<string> result;
@ -105,15 +111,12 @@ vector<string> const ControlExternal::getTemplates() const
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
@ -124,10 +127,10 @@ int ControlExternal::getTemplateNumber(string const & name) const
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;
}

View File

@ -44,7 +44,6 @@ public:
ExternalTemplate getTemplate(int) const;
///
string const Browse(string const &) const;
private:
///
virtual void applyParamsToInset();

View File

@ -37,7 +37,6 @@ public:
string const getCommand(pid_t) const;
///
void kill(pid_t);
private:
///
virtual void apply();

View File

@ -40,6 +40,11 @@ using std::pair;
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)
{}
@ -74,11 +79,6 @@ void ControlGraphics::applyParamsNoInset()
{}
// 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");

View File

@ -59,10 +59,12 @@ private:
};
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

View File

@ -5,7 +5,7 @@
*
* \author Alejandro Aguilar Sierra
* \author John Levon
* \author Angus Leeming
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
@ -89,6 +89,6 @@ bool ControlInclude::fileExists(string const & file)
if (IsFileReadable(fileWithAbsPath))
return true;
return false;
}

View File

@ -47,7 +47,6 @@ public:
/// test if file exist
bool fileExists(string const & file);
private:
/// Dispatch the changed parameters to the kernel.
virtual void applyParamsToInset();
@ -57,7 +56,9 @@ private:
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

View File

@ -24,8 +24,7 @@
class Inset;
template <class Inset, class Params>
class ControlInset : public ControlConnectBD
{
class ControlInset : public ControlConnectBD {
public:
///
ControlInset(LyXView &, Dialogs &);
@ -39,11 +38,9 @@ public:
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. */
@ -71,8 +68,6 @@ private:
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.
@ -102,10 +97,8 @@ private:
/// is the dialog built ?
bool dialog_built_;
};
#include "ControlInset.tmpl"
#endif // CONTROLINSET_H

View File

@ -30,9 +30,9 @@ public:
///
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() {}

View File

@ -48,6 +48,7 @@ MinipageParams::MinipageParams()
: pos(InsetMinipage::top)
{}
MinipageParams::MinipageParams(InsetMinipage const & inset)
: pageWidth(inset.pageWidth()), pos(inset.pos())
{}

View File

@ -49,7 +49,6 @@ class ControlMinipage : public ControlInset<InsetMinipage, MinipageParams> {
public:
///
ControlMinipage(LyXView &, Dialogs &);
private:
/// Dispatch the changed parameters to the kernel.
virtual void applyParamsToInset();

View File

@ -117,6 +117,7 @@ void ControlParagraph::setParams()
ininset_ = par_->inInset();
}
void ControlParagraph::changedParagraph()
{
/// get paragraph

View File

@ -4,7 +4,7 @@
* 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
*/
@ -25,8 +25,7 @@ class ParagraphParameters;
/** A controller for Paragraph dialogs.
*/
class ControlParagraph : public ControlDialogBD
{
class ControlParagraph : public ControlDialogBD {
public:
///
ControlParagraph(LyXView &, Dialogs &);
@ -42,7 +41,6 @@ public:
LyXAlignment alignPossible() const;
///
void changedParagraph();
private:
/// Get changed parameters and Dispatch them to the kernel.
virtual void apply();

View File

@ -25,8 +25,7 @@
ControlPreamble::ControlPreamble(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d),
params_(0)
: ControlDialogBD(lv, d)
{}
@ -43,22 +42,25 @@ void ControlPreamble::apply()
}
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();
}

View File

@ -28,8 +28,9 @@ public:
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();
@ -39,7 +40,7 @@ private:
virtual void clearParams();
///
string * params_;
string params_;
};
#endif // CONTROLPREAMBLE_H

View File

@ -34,7 +34,6 @@ public:
string const Browse(string const &);
///
PrinterParams & params() const;
private:
/// Get changed parameters and Dispatch them to the kernel.
virtual void apply();

View File

@ -24,7 +24,6 @@ class ControlRef : public ControlCommand {
public:
///
ControlRef(LyXView &, Dialogs &);
///
std::vector<string> const getLabelList(string const &) const;
///

View File

@ -33,7 +33,6 @@ public:
/// Replaces occurence of string
void replace(string const & search, string const & replace,
bool casesensitive, bool matchword, bool all);
private:
/// not needed.
virtual void apply() {}

View File

@ -4,7 +4,7 @@
* 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
*/
@ -40,7 +40,6 @@ public:
/// The command to be executed
string const getCommand() const { return command_; };
void setCommand(string const &);
private:
///
virtual void apply();

View File

@ -3,7 +3,7 @@
* 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
*/

View File

@ -4,7 +4,7 @@
* 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
*/

View File

@ -3,7 +3,7 @@
* 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
*/
@ -40,39 +40,40 @@ ControlSpellchecker::ControlSpellchecker(LyXView & lv, Dialogs & d)
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;
}
}
@ -128,7 +129,7 @@ void ControlSpellchecker::replace(string const & replacement)
{
bufferview()->replaceWord(replacement);
// fix up the count
--count_;
--count_;
check();
}

View File

@ -21,7 +21,7 @@
#include "WordLangTuple.h"
class SpellBase;
/** A controller for Spellchecker dialogs.
*/
class ControlSpellchecker : public ControlDialogBD {
@ -62,9 +62,7 @@ public:
string getMessage() {
return message_;
}
private:
/// set the params before show or update
void setParams();
/// clean-up on hide.

View File

@ -31,7 +31,6 @@ public:
///
rowsCols & params();
private:
/// Apply from dialog
virtual void apply();

View File

@ -33,7 +33,7 @@ namespace {
string getFileList(ControlTexinfo::texFileSuffix type, bool withFullPath)
{
switch (type) {
case ControlTexinfo::bst:
case ControlTexinfo::bst:
return getTexFileList("bstFiles.lst", withFullPath);
break;
case ControlTexinfo::cls:
@ -45,8 +45,9 @@ string getFileList(ControlTexinfo::texFileSuffix type, bool withFullPath)
}
return string();
}
}
} // namespace anon
ControlTexinfo::ControlTexinfo(LyXView & lv, Dialogs & d)
: ControlDialogBI(lv, d)

View File

@ -37,8 +37,6 @@ public:
void runTexhash() const;
/// read filecontents
string const getContents(texFileSuffix type, bool withPath) const;
private:
///
virtual void apply() {}

View File

@ -23,6 +23,7 @@ using std::vector;
class Buffer;
ControlToc::ControlToc(LyXView & lv, Dialogs & d)
: ControlCommand(lv, d, LFUN_TOC_INSERT)
{}

View File

@ -22,8 +22,7 @@
/** A controller for TOC dialogs.
*/
class ControlToc : public ControlCommand
{
class ControlToc : public ControlCommand {
public:
///
ControlToc(LyXView &, Dialogs &);

View File

@ -16,18 +16,17 @@
#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)
@ -41,17 +40,15 @@ string const ControlVCLog::getBufferFileName() const
}
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();
}
@ -60,6 +57,4 @@ stringstream & ControlVCLog::getVCLogFile(stringstream & ss) const
ss << _("No version control log file found.") << endl;
lyx::unlink(name);
return ss;
}

View File

@ -18,7 +18,8 @@
#endif
#include "ControlDialog_impl.h"
#include "Lsstream.h"
#include "LString.h"
/**
* A controller for the Version Control log viewer.
@ -27,11 +28,10 @@ class ControlVCLog : public ControlDialogBD {
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() {}

View File

@ -44,11 +44,6 @@ WrapParams const ControlWrap::getParams(InsetWrap const & inset)
}
WrapParams::WrapParams()
: placement("")
{}
WrapParams::WrapParams(InsetWrap const & inset)
: pageWidth(inset.pageWidth()),
placement(inset.placement())

View File

@ -27,7 +27,7 @@ class InsetWrap;
///
struct WrapParams {
///
WrapParams();
WrapParams() {}
///
WrapParams(InsetWrap const &);
///

View File

@ -4,7 +4,7 @@
* 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
*/
@ -28,7 +28,6 @@ public:
Controller & controller() { return controller_; }
///
Controller const & controller() const { return controller_; }
private:
///
Controller controller_;

View File

@ -49,20 +49,17 @@ public:
* and the view
*/
void setController(ControlButtons & c) { controller_ptr_ = &c; }
///
ControlButtons & getController()
{
lyx::Assert(controller_ptr_);
return *controller_ptr_;
}
///
ControlButtons const & getController() const
{
lyx::Assert(controller_ptr_);
return *controller_ptr_;
}
///
ControlButtons & getController() {
lyx::Assert(controller_ptr_);
return *controller_ptr_;
}
///
ControlButtons const & getController() const {
lyx::Assert(controller_ptr_);
return *controller_ptr_;
}
protected:
/// We don't own this.
ControlButtons * controller_ptr_;

View File

@ -31,8 +31,7 @@ using std::min;
using std::vector;
using std::sort;
namespace biblio
{
namespace biblio {
namespace {

View File

@ -21,138 +21,141 @@
#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 {
///
enum Direction {
///
FORWARD,
///
BACKWARD
};
FORWARD,
///
BACKWARD
};
/// First entry is the bibliography key, second the data
typedef std::map<string, string> InfoMap;
/// 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 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 &);
/** 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);
// 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 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);
// 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);
/** 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.
/** 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.
*/
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);
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;
};
/// 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);
/// Given the LaTeX command, return the appropriate CitationStyle
CitationStyle const getCitationStyle(string const & command);
/** Returns the LaTeX citation 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);
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);
/// 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.
[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);
/**
"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

View File

@ -27,15 +27,25 @@ vector<FamilyPair> const getFamilyData()
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;
@ -47,13 +57,21 @@ vector<SeriesPair> const getSeriesData()
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;
@ -65,17 +83,29 @@ vector<ShapePair> const getShapeData()
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;
@ -87,33 +117,61 @@ vector<SizePair> const getSizeData()
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;
@ -125,15 +183,25 @@ vector<BarPair> const getBarData()
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;
@ -145,27 +213,49 @@ vector<ColorPair> const getColorData()
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;

View File

@ -24,45 +24,46 @@
/** 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;
IGNORE,
///
typedef std::pair<string, LyXFont::FONT_SERIES> SeriesPair;
EMPH_TOGGLE,
///
typedef std::pair<string, LyXFont::FONT_SHAPE> ShapePair;
UNDERBAR_TOGGLE,
///
typedef std::pair<string, LyXFont::FONT_SIZE> SizePair;
NOUN_TOGGLE,
///
typedef std::pair<string, FONT_STATE> BarPair;
///
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

View File

@ -3,7 +3,7 @@
* 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
*/
@ -26,10 +26,9 @@ namespace {
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
@ -44,8 +43,10 @@ vector<LanguagePair> const getLanguageData(bool character_dlg)
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;

View File

@ -4,7 +4,7 @@
* 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
*/
@ -23,12 +23,14 @@
/** 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

View File

@ -28,13 +28,14 @@ using std::pair;
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);
@ -42,8 +43,9 @@ string const browseFile(LyXView * lv, string const & 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;
@ -87,8 +89,8 @@ extern const char * stringFromUnit(int);
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;

View File

@ -29,11 +29,14 @@ class LyXView;
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
@ -42,12 +45,15 @@ string const browseFile(LyXView *lv, string const & 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.
@ -58,7 +64,7 @@ std::vector<string> const getLatexUnits();
vector<pair<A,B> >
*/
namespace hide {
namespace detail {
template<class Pair>
struct firster {
@ -72,7 +78,7 @@ struct seconder {
second_type const & operator()(Pair const & p) { return p.second; }
};
}
} // namespace detail
///
template<class Pair>
@ -81,7 +87,7 @@ getFirst(std::vector<Pair> const & pr)
{
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;
}
@ -92,7 +98,7 @@ getSecond(std::vector<Pair> const & pr)
{
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;
}

View File

@ -3,7 +3,7 @@
* 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
*/
@ -42,12 +42,12 @@ vector<string> listWithoutPath(vector<string> & dbase)
{
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
@ -58,7 +58,6 @@ void rescanTexStyles()
Systemcall one;
one.startscript(Systemcall::Wait,
LibFileSearch("scripts", "TeXFiles.sh"));
p.pop();
}
@ -69,20 +68,20 @@ void texhash()
//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");
@ -90,8 +89,7 @@ string const getTexFileList(string const & filename, bool withFullPath)
}
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();
@ -110,25 +108,28 @@ string const getListOfOptions(string const & classname,
}
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;
}

View File

@ -3,7 +3,7 @@
* 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
*/

View File

@ -1,3 +1,9 @@
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.
@ -5,7 +11,7 @@
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>
@ -15,7 +21,7 @@
* 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
@ -95,7 +101,7 @@
* 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>

View File

@ -52,5 +52,5 @@ void QPreamble::update_contents()
void QPreamble::apply()
{
controller().params() = dialog_->preambleLE->text().latin1();
controller().params(dialog_->preambleLE->text().latin1());
}

View File

@ -49,7 +49,8 @@ void QVCLog::update_contents()
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());
}

View File

@ -1,3 +1,13 @@
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

View File

@ -4,7 +4,7 @@
* 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
*/
@ -56,9 +56,9 @@ void FormAboutlyx::build()
// 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"),

View File

@ -30,18 +30,13 @@ void FormLog::update()
{
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;
}
bool buildlog = (controller().logfile().first == Buffer::buildlog);
fl_set_form_title(dialog_->form, _("LaTeX Log"));
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"));
}

View File

@ -46,7 +46,7 @@ void FormPreamble::build()
void FormPreamble::apply()
{
controller().params() = fl_get_input(dialog_->input_preamble);
controller().params(fl_get_input(dialog_->input_preamble));
}

View File

@ -22,6 +22,7 @@
#include "gettext.h"
#include FORMS_H_LOCATION
FormVCLog::FormVCLog()
: FormCB<ControlVCLog, FormBrowser>(_("Version Control Log"))
{}
@ -31,8 +32,9 @@ void FormVCLog::update()
{
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());
}

View File

@ -3,22 +3,22 @@
* 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);
}
}

View File

@ -4,7 +4,7 @@
* 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
*/
@ -386,7 +386,7 @@ int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
ev->xbutton.y - ob->y,
x_button_state(key));
area->dispatch(cmd);
}
break;
#if FL_VERSION < 1 && FL_REVISION < 89

View File

@ -5,7 +5,7 @@
* 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
*/
@ -69,7 +69,7 @@ private:
/// GC used for copying to the screen
GC copy_gc;
///
FL_OBJECT * backgroundbox;
/// the workarea free object

View File

@ -282,8 +282,9 @@ XFontStruct * xfont_loader::doLoad(LyXFont::FONT_FAMILY family,
}
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);