+2000-04-11 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * src/lyx_cb.[Ch]: made several functions take a BufferView* arg
+ instead of using current_view directly.
+
+ * src/lyxfunc.C (Dispatch): the paragraph-spacing implementation
+
+ * src/LyXAction.C (init): add the paragraph-spacing command.
+
+ * src/commandtags.h: add enum for LFUN_PARAGRAPH_SPACING
+
+ * src/buffer.C (parseSingleLyXformat2Token): read the paragraph spacing
+
+ * src/lyx_cb.C (CurrentState): output a string when the spacing is
+ different from the documents.
+
+ * src/text.C (SetHeightOfRow): take paragraph spacing into
+ account, paragraph spacing takes precedence over buffer spacing
+ (GetVisibleRow): ditto
+
+ * src/paragraph.C (writeFile): output the spacing parameter too.
+ (validate): set the correct features if spacing is used in the
+ paragraph.
+ (Clear): set spacing to default
+ (MakeSameLayout): spacing too
+ (HasSameLayout): spacing too
+ (SetLayout): spacing too
+ (TeXOnePar): output the spacing commands
+
+ * src/lyxparagraph.h: added a spacing variable for use with
+ per-paragraph spacing.
+
+ * src/Spacing.h: add a Default spacing and a method to check if
+ the current spacing is default. also added an operator==
+
+ * src/text2.C (DeleteEmptyParagraphMechanism): added a
+ RedoParagraphs.
+
2000-04-11 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/lyxserver.C (callback): fix dispatch of functions
int selection = 0;
int mark_set = 0;
- ProhibitInput();
+ ProhibitInput(bv_);
owner_->getMiniBuffer()->Set(_("Formatting document..."));
redraw();
owner_->getMiniBuffer()->Init();
bv_->setState();
- AllowInput();
+ AllowInput(bv_);
// Now if the title form still exist kill it
TimerCB(0, 0);
if (button >= 2) return;
bv_->setState();
- owner_->getMiniBuffer()->Set(CurrentState());
+ owner_->getMiniBuffer()->Set(CurrentState(bv_));
// Did we hit an editable inset?
if (inset_hit != 0) {
static LyXParagraph * buf = 0;
-CutAndPaste::CutAndPaste()
-{
-}
-
-
-CutAndPaste::~CutAndPaste()
-{
-}
-
// for now here this should be in another Cut&Paste Class!
//
void CutAndPaste::DeleteBuffer()
{
- if (!buf)
- return;
-
- LyXParagraph * tmppar;
-
- while (buf) {
- tmppar = buf;
- buf = buf->next;
- delete tmppar;
- }
- buf = 0;
+ if (!buf) return;
+
+ LyXParagraph * tmppar;
+
+ while (buf) {
+ tmppar = buf;
+ buf = buf->next;
+ delete tmppar;
+ }
+ buf = 0;
}
-bool CutAndPaste::cutSelection(LyXParagraph *startpar, LyXParagraph **endpar,
+
+bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar,
int start, int & end, char tc, bool doclear)
{
if (!startpar || (start > startpar->Last()))
return true;
}
-bool CutAndPaste::copySelection(LyXParagraph *startpar, LyXParagraph *endpar,
+
+bool CutAndPaste::copySelection(LyXParagraph * startpar, LyXParagraph * endpar,
int start, int end, char tc)
{
if (!startpar || (start > startpar->Last()))
// care about footnotes
if (buf->footnoteflag) {
tmppar = buf;
- while (tmppar){
+ while (tmppar) {
tmppar->footnoteflag = LyXParagraph::NO_FOOTNOTE;
tmppar = tmppar->next;
}
return true;
}
-bool CutAndPaste::pasteSelection(LyXParagraph **par, LyXParagraph **endpar,
- int &pos, char tc)
+
+bool CutAndPaste::pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar,
+ int & pos, char tc)
{
if (!checkPastePossible(*par, pos))
return false;
if (buf->IsNewline(0)){
while((tmppos < tmppar->Last()) &&
!tmppar->IsNewline(tmppos))
- tmppos++;
+ ++tmppos;
buf->Erase(0);
if (tmppos < tmppar->Last())
- tmppos++;
+ ++tmppos;
else
table_too_small = true;
} else {
return true;
}
+
int CutAndPaste::nrOfParagraphs() const
{
- if (!buf)
- return 0;
-
- int n = 1;
- LyXParagraph *tmppar = buf;
- while(tmppar->next) {
- ++n;
- tmppar = tmppar->next;
- }
- return n;
+ if (!buf) return 0;
+
+ int n = 1;
+ LyXParagraph *tmppar = buf;
+ while(tmppar->next) {
+ ++n;
+ tmppar = tmppar->next;
+ }
+ return n;
}
+
int CutAndPaste::SwitchLayoutsBetweenClasses(LyXTextClassList::size_type c1,
LyXTextClassList::size_type c2,
LyXParagraph * par)
return ret;
}
-char CutAndPaste::getBufferTextClass()
+
+LyXTextClassList::size_type CutAndPaste::getBufferTextClass() const
{
return textclass;
}
-bool CutAndPaste::checkPastePossible(LyXParagraph *par, int)
+
+bool CutAndPaste::checkPastePossible(LyXParagraph * par, int) const
{
- if (!buf)
- return false;
+ if (!buf) return false;
- LyXParagraph *tmppar;
+ LyXParagraph * tmppar;
// be carefull with footnotes in footnotes
if (par->footnoteflag != LyXParagraph::NO_FOOTNOTE) {
///
class CutAndPaste {
public:
- ///
- CutAndPaste();
- ~CutAndPaste();
- bool cutSelection(LyXParagraph *startpar, LyXParagraph **endpar,
- int start, int & end, char tc, bool doclear=false);
- bool copySelection(LyXParagraph *startpar, LyXParagraph *endpar,
- int start, int end, char tc);
- bool pasteSelection(LyXParagraph **par, LyXParagraph **endpar,
- int & pos, char tc);
- int nrOfParagraphs() const;
- /** needed to switch between different classes this works
- for a list of paragraphs beginning with the specified par
- return value is the number of wrong conversions
- */
- int SwitchLayoutsBetweenClasses(LyXTextClassList::size_type class1,
- LyXTextClassList::size_type class2,
- LyXParagraph * par);
- char getBufferTextClass();
- bool checkPastePossible(LyXParagraph *, int pos);
-
+ ///
+ bool cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar,
+ int start, int & end, char tc, bool doclear = false);
+ ///
+ bool copySelection(LyXParagraph * startpar, LyXParagraph * endpar,
+ int start, int end, char tc);
+ ///
+ bool pasteSelection(LyXParagraph ** par, LyXParagraph ** endpar,
+ int & pos, char tc);
+ ///
+ int nrOfParagraphs() const;
+ /** needed to switch between different classes this works
+ for a list of paragraphs beginning with the specified par
+ return value is the number of wrong conversions
+ */
+ int SwitchLayoutsBetweenClasses(LyXTextClassList::size_type class1,
+ LyXTextClassList::size_type class2,
+ LyXParagraph * par);
+ ///
+ LyXTextClassList::size_type getBufferTextClass() const;
+ ///
+ bool checkPastePossible(LyXParagraph *, int pos) const;
private:
- ///
- void DeleteBuffer();
- ///
- char textclass;
-
+ ///
+ void DeleteBuffer();
+ ///
+ LyXTextClassList::size_type textclass;
};
#endif
}
// setspace.sty
- if ((params.spacing.getSpace() != Spacing::Single)
+ if ((params.spacing.getSpace() != Spacing::Single
+ && !params.spacing.isDefault())
|| setspace) {
packages += "\\usepackage{setspace}\n";
}
switch (params.spacing.getSpace()) {
+ case Spacing::Default:
case Spacing::Single:
// we dont use setspace.sty so dont print anything
//packages += "\\singlespacing\n";
{ LFUN_LOWCASE_WORD, "word-lowcase", "", Noop },
{ LFUN_UPCASE_WORD, "word-upcase", "", Noop },
{ LFUN_DATE_INSERT, "date-insert", "", Noop },
+ { LFUN_PARAGRAPH_SPACING, "paragraph-spacing", "", Noop },
{ LFUN_NOACTION, "", "", Noop }
};
Buffer * buffer = current_view->buffer();
if (fl_get_button(fd_form_sendto->radio_ftype_dvi) ||
fl_get_button(fd_form_sendto->radio_ftype_ps)) {
- ProhibitInput();
+ ProhibitInput(current_view);
// Generate dvi file and check if there are errors in the .lyx file
if (MakeLaTeXOutput(buffer) > 0) {
- AllowInput();
+ AllowInput(current_view);
return;
}
- AllowInput();
+ AllowInput(current_view);
}
string ftypeext;
if (fl_get_button(fd_form_sendto->radio_ftype_lyx))
extern FD_form_document * fd_form_document;
-extern void AutoSave();
+extern void AutoSave(BufferView *);
extern char updatetimer;
extern void QuitLyX();
LyXTextClass::size_type current_layout = 0;
// Callback for autosave timer
-void LyXView::AutosaveTimerCB(FL_OBJECT *, long)
+void LyXView::AutoSave()
{
lyxerr[Debug::INFO] << "Running AutoSave()" << endl;
- AutoSave();
+ if (view()->available())
+ ::AutoSave(view());
}
// Wrapper for the above
-extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT * ob, long data)
+extern "C" void C_LyXView_AutosaveTimerCB(FL_OBJECT * ob, long)
{
- LyXView::AutosaveTimerCB(ob, data);
+ LyXView * view = static_cast<LyXView*>(ob->u_vdata);
+ view->AutoSave();
}
// timer_autosave
fdui->timer_autosave = obj = fl_add_timer(FL_HIDDEN_TIMER,
0, 0, 0, 0, "Timer");
+ obj->u_vdata = this;
fl_set_object_callback(obj, C_LyXView_AutosaveTimerCB, 0);
// timer_update
window manager. */
static int atCloseMainFormCB(FL_FORM *, void *);
/// A callback
- static void AutosaveTimerCB(FL_OBJECT *, long);
+ void AutoSave();
/// A callback
static void UpdateTimerCB(FL_OBJECT *, long);
private:
#endif
#include "Spacing.h"
+#include "LString.h"
using std::ios;
using std::ostream;
float Spacing::getValue() const
{
switch(space) {
+ case Default: // nothing special should happen with this...
case Single: return 1.0;
case Onehalf: return 1.25;
case Double: return 1.667;
}
-void Spacing::writeFile(ostream & os) const
+void Spacing::writeFile(ostream & os, bool para) const
{
+ if (space == Default) return;
+
+ string cmd = para ? "\\paragraph_spacing " : "\\spacing ";
+
if (getSpace() == Spacing::Other) {
os.setf(ios::showpoint|ios::fixed);
os.precision(2);
- os << "\\spacing " << spacing_string[getSpace()]
+ os << cmd << spacing_string[getSpace()]
<< " " << getValue() << " \n";
} else {
- os << "\\spacing " << spacing_string[getSpace()] << " \n";
+ os << cmd << spacing_string[getSpace()] << " \n";
}
}
///
Double,
///
- Other
+ Other,
+ ///
+ Default
};
///
- Spacing() {
- space = Single;
- value = getValue();
+ Spacing() : space(Single), value(1.0) {}
+ ///
+ bool isDefault() const {
+ return space == Default;
}
///
float getValue() const;
///
void set(Spacing::Space sp, char const * val) ;
///
- void writeFile(std::ostream &) const;
+ void writeFile(std::ostream &, bool para = false) const;
+ ///
+ friend bool operator==(Spacing const & a, Spacing const & b) {
+ if (a.space == b.space && a.getValue() == b.getValue())
+ return true;
+ return false;
+ }
///
friend bool operator!=(Spacing const & a, Spacing const & b) {
if (a.space == b.space && a.getValue() == b.getValue())
bool Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
LyXParagraph *& return_par,
- const string & token, int & pos,
+ string const & token, int & pos,
char & depth, LyXFont & font,
LyXParagraph::footnote_flag & footnoteflag,
LyXParagraph::footnote_kind & footnotekind)
pos = 0;
lex.EatLine();
par->layout = LYX_DUMMY_LAYOUT;
- font = LyXFont(LyXFont::ALL_INHERIT,params.language_info);
+ font = LyXFont(LyXFont::ALL_INHERIT, params.language_info);
if (format < 2.16 && params.language == "hebrew")
font.setLanguage(default_language);
} else if (token == "\\begin_float") {
} else {
lex.printError("Unknown spacing token: '$$Token'");
}
+ } else if (token == "\\paragraph_spacing") {
+ lex.next();
+ string tmp = strip(lex.GetString());
+ if (tmp == "single") {
+ par->spacing.set(Spacing::Single);
+ } else if (tmp == "onehalf") {
+ par->spacing.set(Spacing::Onehalf);
+ } else if (tmp == "double") {
+ par->spacing.set(Spacing::Double);
+ } else if (tmp == "other") {
+ lex.next();
+ par->spacing.set(Spacing::Other,
+ lex.GetFloat());
+ } else {
+ lex.printError("Unknown spacing token: '$$Token'");
+ }
} else if (token == "\\float_placement") {
lex.nextToken();
params.float_placement = lex.GetString();
{
if (!users->text) return 0;
- ProhibitInput();
+ ProhibitInput(users);
// get LaTeX-Filename
string name = getLatexName();
users->fitCursor();
users->updateScrollbar();
}
- AllowInput();
+ AllowInput(users);
return latex.getNumErrors();
}
{
if (!users->text) return 0;
- ProhibitInput();
+ ProhibitInput(users);
// get LaTeX-Filename
string name = getLatexName();
users->fitCursor();
users->updateScrollbar();
}
- AllowInput();
+ AllowInput(users);
return literate.getNumErrors();
}
{
if (!users->text) return 0;
- ProhibitInput();
+ ProhibitInput(users);
// get LaTeX-Filename
string name = getLatexName();
users->fitCursor();
users->updateScrollbar();
}
- AllowInput();
+ AllowInput(users);
return literate.getNumErrors();
}
{
if (!users->text) return 0;
- ProhibitInput();
+ ProhibitInput(users);
// get LaTeX-Filename
string name = getLatexName();
users->fitCursor();
users->updateScrollbar();
}
- AllowInput();
+ AllowInput(users);
return res;
}
bool isLinuxDoc() const;
/// returns true if the buffer contains a DocBook document
bool isDocBook() const;
- /// returns true if the buffer contains either a LinuxDoc or DocBook document
+ /** returns true if the buffer contains either a LinuxDoc
+ or DocBook document */
bool isSGML() const;
/// returns true if the buffer contains a Wed document
bool isLiterate() const;
/** Validate a buffer for LaTeX.
This validates the buffer, and returns a struct for use by
- makeLaTeX and others. Its main use is to figure out what commands
- and packages need to be included in the LaTeX file. It (should)
- also check that the needed constructs are there (i.e. that the \refs
- points to coresponding \labels). It should perhaps inset "error"
- insets to help the user correct obvious mistakes.
+ makeLaTeX and others. Its main use is to figure out what
+ commands and packages need to be included in the LaTeX file.
+ It (should) also check that the needed constructs are there
+ (i.e. that the \refs points to coresponding \labels). It
+ should perhaps inset "error" insets to help the user correct
+ obvious mistakes.
*/
void validate(LaTeXFeatures &) const;
if (buf->getUser()) buf->getUser()->insetUnlock();
if (buf->paragraph && !buf->isLyxClean() && !quitting) {
- ProhibitInput();
+ ProhibitInput(buf->getUser());
switch(AskConfirmation(_("Changes in document:"),
MakeDisplayPath(buf->fileName(), 50),
_("Save document?"))){
if (buf->save()) {
lastfiles->newFile(buf->fileName());
} else {
- AllowInput();
+ AllowInput(buf->getUser());
return false;
}
break;
case 3: // Cancel
- AllowInput();
+ AllowInput(buf->getUser());
return false;
}
- AllowInput();
+ AllowInput(buf->getUser());
}
bstore.release(buf);
///
string fontsize;
///
- LyXTextClassList::ClassList::size_type textclass;
+ LyXTextClassList::size_type textclass;
/* this are for the PaperLayout */
///
LFUN_INSET_ERT, // Jug 20000218
LFUN_INSERT_GRAPHICS, // Lgb 20000226
LFUN_INSET_FOOTNOTE, // Jug 20000307
- LFUN_INSET_NUMBER, // Dekel 20000402
+ LFUN_INSET_NUMBER, // Dekel 20000402
+ LFUN_PARAGRAPH_SPACING, // Lgb 20000411
LFUN_LASTACTION /* this marks the end of the table */
};
#include "support/lyxlib.h"
#include "Painter.h"
#include "font.h"
+#include "lyx_cb.h"
using std::ostream;
using std::istream;
extern char ** environ; // is this only redundtant on linux systems? Lgb.
-extern void ProhibitInput();
-extern void AllowInput();
-
static float const DEG2PI = 57.295779513;
struct queue_element {
bool error = false;
do {
- ProhibitInput();
+ ProhibitInput(current_view);
if (once) {
p = fileDlg.Select(_("EPS Figure"),
current_figure_path,
p = fileDlg.Select(_("EPS Figure"), buf,
"*ps", string());
}
- AllowInput();
+ AllowInput(current_view);
if (p.empty()) return;
// BufferViews. Or is it perhaps just the (input in) BufferViews in the
// current LyxView that should be prohibited (Lgb) (This applies to
// "AllowInput" as well.)
-void ProhibitInput()
+void ProhibitInput(BufferView * bv)
{
input_prohibited = true;
- current_view->hideCursor();
+ bv->hideCursor();
static Cursor cursor;
static bool cursor_undefined = true;
}
/* set the cursor to the watch for all forms and the canvas */
- XDefineCursor(fl_display, current_view->owner()->getForm()->window,
+ XDefineCursor(fl_display, bv->owner()->getForm()->window,
cursor);
if (fd_form_paragraph->form_paragraph->visible)
XDefineCursor(fl_display,
}
-void AllowInput()
+void AllowInput(BufferView * bv)
{
input_prohibited = false;
/* reset the cursor from the watch for all forms and the canvas */
- XUndefineCursor(fl_display, current_view->owner()->getForm()->window);
+ XUndefineCursor(fl_display, bv->owner()->getForm()->window);
if (fd_form_paragraph->form_paragraph->visible)
XUndefineCursor(fl_display,
fd_form_paragraph->form_paragraph->window);
fd_form_character->form_character->window);
// What to do about this? (Lgb)
- if (current_view->belowMouse())
- SetXtermCursor(current_view->owner()->getForm()->window);
+ if (bv->belowMouse())
+ SetXtermCursor(bv->owner()->getForm()->window);
XFlush(fl_display);
fl_activate_all_forms();
string oldname = fname;
LyXFileDlg fileDlg;
- ProhibitInput();
+ ProhibitInput(current_view);
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
fileDlg.SetButton(1, _("Templates"), lyxrc.template_path);
OnlyPath(fname),
"*.lyx",
OnlyFilename(fname));
- AllowInput();
+ AllowInput(current_view);
if (fname.empty()) {
return;
//if (!bv->text)
// return false;
- ProhibitInput();
+ ProhibitInput(current_view);
// Generate dvi file
if (MakeLaTeXOutput(buffer) > 0) {
- AllowInput();
+ AllowInput(current_view);
return false;
}
// Generate postscript file
}
Path p(path);
bool ret = RunScript(buffer, wait, command);
- AllowInput();
+ AllowInput(current_view);
return ret;
}
}
// Start postscript viewer
- ProhibitInput();
+ ProhibitInput(current_view);
string ps = ChangeExtension (buffer->fileName(),
".ps_tmp", true);
// push directorypath, if necessary
}
Path p(path);
bool ret = RunScript(buffer, false, lyxrc.view_ps_command, ps);
- AllowInput();
+ AllowInput(current_view);
return ret;
}
-void AutoSave()
+void AutoSave(BufferView * bv)
// should probably be moved into BufferList (Lgb)
// Perfect target for a thread...
{
- if (!current_view->available())
+ if (!bv->available())
return;
- if (current_view->buffer()->isBakClean()
- || current_view->buffer()->isReadonly()) {
+ if (bv->buffer()->isBakClean()
+ || bv->buffer()->isReadonly()) {
// We don't save now, but we'll try again later
- current_view->owner()->resetAutosaveTimer();
+ bv->owner()->resetAutosaveTimer();
return;
}
- current_view->owner()->getMiniBuffer()->Set(_("Autosaving current document..."));
+ bv->owner()->getMiniBuffer()->Set(_("Autosaving current document..."));
// create autosave filename
- string fname = OnlyPath(current_view->buffer()->fileName());
+ string fname = OnlyPath(bv->buffer()->fileName());
fname += "#";
- fname += OnlyFilename(current_view->buffer()->fileName());
+ fname += OnlyFilename(bv->buffer()->fileName());
fname += "#";
// tmp_ret will be located (usually) in /tmp
// anyway.
bool failed = false;
if (!tmp_ret.empty()) {
- current_view->buffer()->writeFile(tmp_ret, 1);
+ bv->buffer()->writeFile(tmp_ret, 1);
// assume successful write of tmp_ret
if (rename(tmp_ret.c_str(), fname.c_str()) == -1) {
failed = true;
if (failed) {
// failed to write/rename tmp_ret so try writing direct
- if (!current_view->buffer()->writeFile(fname, 1)) {
+ if (!bv->buffer()->writeFile(fname, 1)) {
// It is dangerous to do this in the child,
// but safe in the parent, so...
if (pid == -1)
- current_view->owner()->getMiniBuffer()->Set(_("Autosave Failed!"));
+ bv->owner()->getMiniBuffer()->Set(_("Autosave Failed!"));
}
}
if (pid == 0) { // we are the child so...
}
}
- current_view->buffer()->markBakClean();
- current_view->owner()->resetAutosaveTimer();
+ bv->buffer()->markBakClean();
+ bv->owner()->resetAutosaveTimer();
}
if (!bv->available()) return;
if (fname.empty()) {
- ProhibitInput();
+ ProhibitInput(bv);
fname = fileDlg.Select(_("File to Insert"),
bv->owner()->buffer()->filepath,
"*");
- AllowInput();
+ AllowInput(bv);
if (fname.empty()) return;
}
void MenuInsertLabel(char const * arg)
{
string label = arg;
- ProhibitInput();
+ ProhibitInput(current_view);
if (label.empty()) {
pair<bool, string>
result = askForText(_("Enter new label to insert:"));
new_inset->setContents(label);
current_view->insertInset(new_inset);
}
- AllowInput();
+ AllowInput(current_view);
}
default: /* nothing to be done yet ;-) */ break;
}
- ProhibitInput();
+ ProhibitInput(bv);
Systemcalls one;
switch (flag) {
break;
}
- AllowInput();
+ AllowInput(bv);
bv->buffer()->redraw();
return errorcode;
// case BufferParams::PAPER_USLETTER: add_flags = "-p letter"; break;
// default: /* nothing to be done yet ;-) */ break;
// }
- ProhibitInput();
+ ProhibitInput(current_view);
int errorcode = 0;
Systemcalls one;
break;
}
- AllowInput();
+ AllowInput(current_view);
current_view->buffer()->redraw();
return errorcode;
fl_set_input(fd_form_document->input_spacing, "");
switch (params->spacing.getSpace()) {
+ case Spacing::Default: // nothing bad should happen with this
case Spacing::Single:
{
// \singlespacing
void ToggleAndShow(BufferView *, LyXFont const &);
-void FontSize(string const & size)
+void FontSize(BufferView * bv, string const & size)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setGUISize(size);
- ToggleAndShow(current_view, font);
+ ToggleAndShow(bv, font);
}
-void Emph()
+void Emph(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setEmph(LyXFont::TOGGLE);
- ToggleAndShow(current_view, font);
+ ToggleAndShow(bv, font);
}
-void Noun()
+void Noun(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setNoun(LyXFont::TOGGLE);
- ToggleAndShow(current_view, font);
+ ToggleAndShow(bv, font);
}
-void Bold()
+void Bold(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setSeries(LyXFont::BOLD_SERIES);
- ToggleAndShow(current_view, font);
+ ToggleAndShow(bv, font);
}
-void Underline()
+void Underline(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setUnderbar(LyXFont::TOGGLE);
- ToggleAndShow(current_view, font);
+ ToggleAndShow(bv, font);
}
-void Code()
+void Code(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setFamily(LyXFont::TYPEWRITER_FAMILY); // no good
- ToggleAndShow(current_view, font);
+ ToggleAndShow(bv, font);
}
-void Sans()
+void Sans(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setFamily(LyXFont::SANS_FAMILY);
- ToggleAndShow(current_view, font);
+ ToggleAndShow(bv, font);
}
-void Roman()
+void Roman(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setFamily(LyXFont::ROMAN_FAMILY);
- ToggleAndShow(current_view, font);
+ ToggleAndShow(bv, font);
}
-void Tex()
+void Tex(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
font.setLatex (LyXFont::TOGGLE);
- ToggleAndShow(current_view, font);
+ ToggleAndShow(bv, font);
}
-void LangCB(string const & l)
+void Lang(BufferView * bv, string const & l)
{
LyXFont font(LyXFont::ALL_IGNORE);
Languages::iterator lit = languages.find(l);
if (lit != languages.end()) {
font.setLanguage(&(*lit).second);
- ToggleAndShow(current_view, font);
+ ToggleAndShow(bv, font);
} else
WriteAlert(_("Error! unknown language"),l);
}
-void StyleReset()
+void StyleReset(BufferView * bv)
{
LyXFont font(LyXFont::ALL_INHERIT, ignore_language);
- ToggleAndShow(current_view, font);
+ ToggleAndShow(bv, font);
}
* future perhaps we could try to implement a callback to the button-bar.
* That is, `light' the bold button when the font is currently bold, etc.
*/
-string CurrentState()
+string CurrentState(BufferView * bv)
{
string state;
- if (current_view->available()) {
+ if (bv->available()) {
// I think we should only show changes from the default
// font. (Asger)
- Buffer * buffer = current_view->buffer();
- LyXFont font = current_view->text->real_current_font;
+ Buffer * buffer = bv->buffer();
+ LyXFont font = bv->text->real_current_font;
LyXFont defaultfont = textclasslist.TextClass(buffer->
params.textclass).defaultfont();
font.reduce(defaultfont);
state = _("Font: ") + font.stateText();
-
- int depth = current_view->text->GetDepth();
+ // The paragraph depth
+ int depth = bv->text->GetDepth();
if (depth > 0)
state += string(_(", Depth: ")) + tostr(depth);
+ // The paragraph spacing, but only if different from
+ // buffer spacing.
+ if (!bv->text->cursor.par->spacing.isDefault()) {
+ Spacing::Space cur_space =
+ bv->text->cursor.par->spacing.getSpace();
+ state += _(", Spacing: ");
+ switch (cur_space) {
+ case Spacing::Single:
+ state += _("Single");
+ break;
+ case Spacing::Onehalf:
+ state += _("Onehalf");
+ break;
+ case Spacing::Double:
+ state += _("Double");
+ break;
+ case Spacing::Other:
+ state += _("Other (");
+ state += tostr(bv->text->cursor.par->spacing.getValue());
+ state += ")";
+ break;
+ case Spacing::Default:
+ // should never happen, do nothing
+ break;
+ }
+ }
}
return state;
}
+
// candidate for move to BufferView
/* -------> Does the actual toggle job of the XxxCB() calls above.
* Also shows the current font state.
}
-void Free()
+void Free(BufferView * bv)
{
- ToggleAndShow(current_view, UserFreeFont());
+ ToggleAndShow(bv, UserFreeFont());
}
extern "C" void ChoiceClassCB(FL_OBJECT * ob, long)
{
- ProhibitInput();
+ ProhibitInput(current_view);
if (textclasslist.Load(fl_get_choice(ob)-1)) {
if (AskQuestion(_("Should I set some parameters to"),
fl_get_choice_text(ob),
fl_set_choice(fd_form_document->choice_class,
current_view->buffer()->params.textclass + 1);
}
- AllowInput();
+ AllowInput(current_view);
}
///
extern void Foot(BufferView *);
///
-extern void Emph();
+extern void Emph(BufferView *);
///
-extern void Bold();
+extern void Bold(BufferView *);
///
-extern void Noun();
+extern void Noun(BufferView *);
///
extern void Margin(BufferView *);
///
extern void Figure();
///
-extern void LangCB(string const &);
+extern void Lang(BufferView *, string const &);
///
extern void Table();
///
extern void Melt(BufferView *);
///
-extern void Tex();
+extern void Tex(BufferView *);
///
extern void changeDepth(BufferView *, int);
///
-extern void Free();
+extern void Free(BufferView *);
///
-extern void HtmlUrl();
+extern void ProhibitInput(BufferView *);
///
-extern void Url();
+extern void AllowInput(BufferView *);
///
-extern void ProhibitInput();
+extern void Code(BufferView *);
///
-extern void Code();
+extern void Sans(BufferView *);
///
-extern void Sans();
+extern void Roman(BufferView *);
///
-extern void Roman();
+extern void StyleReset(BufferView *);
///
-extern void StyleReset();
+extern void Underline(BufferView *);
///
-extern void Underline();
+extern void FontSize(BufferView *, string const &);
///
-extern void FontSize(string const &);
-///
-extern string CurrentState();
-///
-extern void AllowInput();
+extern string CurrentState(BufferView *);
#endif
if (current_view && current_view->owner())
minibuffer = current_view->owner()->getMiniBuffer();
if (minibuffer) {
- ProhibitInput();
+ ProhibitInput(current_view);
minibuffer->Set(s1, s2, s3);
}
fl_set_resource("flAlert.dismiss.label", _("Dismiss"));
fl_show_alert(s1.c_str(), s2.c_str(), s3.c_str(), 0);
if (minibuffer) {
- AllowInput();
+ AllowInput(current_view);
}
}
* ====================================================== */
#include <config.h>
+
+#ifdef HAVE_SSTREAM
+#include <sstream>
+using std::istringstream;
+#else
+#include <strstream>
+#endif
+
#include <time.h>
#include <locale.h>
// (alkis)
extern tex_accent_struct get_accent(kb_action action);
-extern void AutoSave();
+extern void AutoSave(BufferView *);
extern void SetUpdateTimer(float timer = 0.3);
extern void FreeUpdateTimer();
extern bool PreviewDVI(Buffer *);
owner->view()->unlockInset(tli);
owner->view()->text->CursorRight();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
} else {
tli->UnlockInsetInInset(owner->view(),
tli->GetLockingInset());
case LFUN_BREAKLINE:
owner->view()->text->CursorRight();
owner->view()->setState();
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_RIGHT:
if (!owner->view()->text->cursor.par->isRightToLeftPar()) {
owner->view()->text->CursorRight();
moveCursorUpdate(false);
owner->getMiniBuffer()->
- Set(CurrentState());
+ Set(CurrentState(owner->view()));
}
return string();
case LFUN_LEFT:
owner->view()->text->CursorRight();
moveCursorUpdate(false);
owner->getMiniBuffer()->
- Set(CurrentState());
+ Set(CurrentState(owner->view()));
}
return string();
default:
}
case LFUN_AUTOSAVE:
- AutoSave();
+ AutoSave(owner->view());
break;
case LFUN_UNDO:
break;
case LFUN_FREE:
- Free();
+ Free(owner->view());
break;
case LFUN_TEX:
- Tex();
+ Tex(owner->view());
owner->view()->setState();
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_MELT:
case LFUN_LANGUAGE:
{
- LangCB(argument);
+ Lang(owner->view(), argument);
owner->view()->setState();
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
}
break;
case LFUN_EMPH:
- Emph();
- owner->getMiniBuffer()->Set(CurrentState());
+ Emph(owner->view());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_BOLD:
- Bold();
- owner->getMiniBuffer()->Set(CurrentState());
+ Bold(owner->view());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_NOUN:
- Noun();
- owner->getMiniBuffer()->Set(CurrentState());
+ Noun(owner->view());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_CODE:
- Code();
- owner->getMiniBuffer()->Set(CurrentState());
+ Code(owner->view());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_SANS:
- Sans();
- owner->getMiniBuffer()->Set(CurrentState());
+ Sans(owner->view());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_ROMAN:
- Roman();
- owner->getMiniBuffer()->Set(CurrentState());
+ Roman(owner->view());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_DEFAULT:
- StyleReset();
- owner->getMiniBuffer()->Set(CurrentState());
+ StyleReset(owner->view());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_UNDERLINE:
- Underline();
- owner->getMiniBuffer()->Set(CurrentState());
+ Underline(owner->view());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_FONT_SIZE:
- FontSize(argument);
- owner->getMiniBuffer()->Set(CurrentState());
+ FontSize(owner->view(), argument);
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_FONT_STATE:
- setMessage(CurrentState());
+ setMessage(CurrentState(owner->view()));
break;
case LFUN_UPCASE_WORD:
tmptext->CursorRight();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
}
break;
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
}
break;
owner->view()->text->CursorUp();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_DOWN:
owner->view()->text->CursorDown();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_UP_PARAGRAPH:
owner->view()->text->CursorUpParagraph();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_DOWN_PARAGRAPH:
owner->view()->text->CursorDownParagraph();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_PRIOR:
owner->view()->cursorPrevious();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_NEXT:
owner->view()->cursorNext();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_HOME:
owner->view()->text->CursorHome();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_END:
owner->view()->text->CursorEnd();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_TAB:
owner->view()->text->CursorTab();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_WORDRIGHT:
owner->view()->text->CursorRightOneWord();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_WORDLEFT:
owner->view()->text->CursorLeftOneWord();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_BEGINNINGBUF:
owner->view()->text->CursorTop();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_ENDBUF:
owner->view()->text->CursorBottom();
owner->view()->text->FinishUndo();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
owner->view()->text->CursorRight();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_LEFTSEL:
owner->view()->text->CursorLeft();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_UPSEL:
owner->view()->text->CursorUp();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_DOWNSEL:
owner->view()->text->CursorDown();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_UP_PARAGRAPHSEL:
owner->view()->text->CursorUpParagraph();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_DOWN_PARAGRAPHSEL:
owner->view()->text->CursorDownParagraph();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_PRIORSEL:
owner->view()->cursorPrevious();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_NEXTSEL:
owner->view()->cursorNext();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_HOMESEL:
owner->view()->text->CursorHome();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_ENDSEL:
owner->view()->text->CursorEnd();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_WORDRIGHTSEL:
owner->view()->text->CursorRightOneWord();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_WORDLEFTSEL:
owner->view()->text->CursorLeftOneWord();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_BEGINNINGBUFSEL:
owner->view()->text->CursorTop();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
case LFUN_ENDBUFSEL:
owner->view()->text->CursorBottom();
owner->view()->text->FinishUndo();
moveCursorUpdate(true);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
// --- text changing commands ------------------------
}
SetUpdateTimer();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
owner->view()->setState();
break;
owner->view()->update( 1 );
SetUpdateTimer();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
/* -------> Delete word backward. */
owner->view()->update( 1 );
SetUpdateTimer();
moveCursorUpdate(false);
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
/* -------> Kill to end of line. */
owner->view()->cut();
}
SetUpdateTimer();
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
owner->view()->setState();
}
break;
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
owner->view()->setState();
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
}
owner->view()->text->sel_cursor =
owner->view()->text->cursor;
owner->view()->setState();
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
break;
}
SetUpdateTimer(0.01);
owner->view()->text->sel_cursor = cursor;
owner->view()->setState();
- owner->getMiniBuffer()->Set(CurrentState());
+ owner->getMiniBuffer()->Set(CurrentState(owner->view()));
+ }
+ break;
+
+ case LFUN_PARAGRAPH_SPACING:
+ {
+ LyXParagraph * par = owner->view()->text->cursor.par;
+ Spacing::Space cur_spacing = par->spacing.getSpace();
+ float cur_value = 1.0;
+ if (cur_spacing == Spacing::Other) {
+ cur_value = par->spacing.getValue();
+ }
+
+ lyxerr << "all spacing arguments: " << argument << endl;
+ istringstream istr(argument);
+ string tmp;
+ istr >> tmp;
+ lyxerr << "spacing = " << tmp << endl;
+ Spacing::Space new_spacing = cur_spacing;
+ float new_value = cur_value;
+ if (tmp == "single") {
+ new_spacing = Spacing::Single;
+ } else if (tmp == "onehalf") {
+ new_spacing = Spacing::Onehalf;
+ } else if (tmp == "double") {
+ new_spacing = Spacing::Double;
+ } else if (tmp == "other") {
+ new_spacing = Spacing::Other;
+ float tmpval = 0.0;
+ istr >> tmpval;
+ lyxerr << "new_value = " << tmpval << endl;
+ if (tmpval != 0.0)
+ new_value = tmpval;
+ } else if (tmp == "default") {
+ new_spacing = Spacing::Default;
+ } else {
+ lyxerr << _("Unknown spacing argument: ")
+ << argument << endl;
+ }
+ if (cur_spacing != new_spacing || cur_value != new_value) {
+ par->spacing.set(new_spacing, new_value);
+ owner->view()->text->RedoParagraph();
+ owner->view()->update(-1);
+ }
}
break;
new_inset->Edit(owner->view(), 0, 0, 0);
}
break;
+
case LFUN_INSET_TEXT:
{
InsetText * new_inset = new InsetText(owner->buffer());
new_inset->Edit(owner->view(), 0, 0, 0);
}
break;
+
case LFUN_INSET_FOOTNOTE:
{
InsetFoot * new_inset = new InsetFoot(owner->buffer());
case LFUN_GETFONT:
{
- LyXFont * font = &(owner->view()->text->current_font);
- if(font->shape() == LyXFont::ITALIC_SHAPE)
+ LyXFont & font = owner->view()->text->current_font;
+ if(font.shape() == LyXFont::ITALIC_SHAPE)
dispatch_buffer = 'E';
- else if(font->shape() == LyXFont::SMALLCAPS_SHAPE)
+ else if(font.shape() == LyXFont::SMALLCAPS_SHAPE)
dispatch_buffer = 'N';
else
dispatch_buffer = '0';
case LFUN_GETLATEX:
{
- LyXFont * font = &(owner->view()->text->current_font);
- if(font->latex() == LyXFont::ON)
+ LyXFont & font = owner->view()->text->current_font;
+ if(font.latex() == LyXFont::ON)
dispatch_buffer = 'L';
else
dispatch_buffer = '0';
initpath = trypath;
}
- ProhibitInput();
+ ProhibitInput(owner->view());
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
fileDlg.SetButton(1, _("Templates"), lyxrc.template_path);
fname = fileDlg.Select(_("Enter Filename for new document"),
initpath, "*.lyx", _("newfile"));
- AllowInput();
+ AllowInput(owner->view());
if (fname.empty()) {
owner->getMiniBuffer()->Set(_("Canceled."));
// The template stuff
string templname;
if (fromTemplate) {
- ProhibitInput();
+ ProhibitInput(owner->view());
fname = fileDlg.Select(_("Choose template"),
lyxrc.template_path,
"*.lyx");
templname = fname;
- AllowInput();
+ AllowInput(owner->view());
}
// find a free buffer
}
// launches dialog
- ProhibitInput();
+ ProhibitInput(owner->view());
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
fileDlg.SetButton(1, _("Examples"),
AddPath(system_lyxdir, "examples"));
string filename = fileDlg.Select(_("Select Document to Open"),
initpath, "*.lyx");
- AllowInput();
+ AllowInput(owner->view());
// check selected filename
if (filename.empty()) {
}
// launches dialog
- ProhibitInput();
+ ProhibitInput(owner->view());
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
fileDlg.SetButton(1, _("Examples"),
AddPath(system_lyxdir, "examples"));
string filename = fileDlg.Select(_("Select ASCII file to Import"),
initpath, "*.txt");
- AllowInput();
+ AllowInput(owner->view());
// check selected filename
if (filename.empty()) {
}
// launches dialog
- ProhibitInput();
+ ProhibitInput(owner->view());
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
fileDlg.SetButton(1, _("Examples"),
AddPath(system_lyxdir, "examples"));
initpath, "*.tex");
}
- AllowInput();
+ AllowInput(owner->view());
// check selected filename
if (filename.empty()) {
}
// launches dialog
- ProhibitInput();
+ ProhibitInput(owner->view());
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
fileDlg.SetButton(1, _("Examples"),
AddPath(system_lyxdir, "examples"));
string filename = fileDlg.Select(_("Select LinuxDoc file to Import"),
initpath, "*.sgml");
- AllowInput();
+ AllowInput(owner->view());
// check selected filename
if (filename.empty()) {
}
// launches dialog
- ProhibitInput();
+ ProhibitInput(owner->view());
fileDlg.SetButton(0, _("Documents"), lyxrc.document_path);
fileDlg.SetButton(1, _("Examples"),
AddPath(system_lyxdir, "examples"));
filename = fileDlg.Select(_("Select Document to Insert"),
initpath, "*.lyx");
- AllowInput();
+ AllowInput(owner->view());
// check selected filename
if (filename.empty()) {
///
VSpace added_space_bottom;
+
+ ///
+ Spacing spacing;
///
LyXTextClass::LayoutList::size_type layout;
#include "lyxtext.h"
#include "gettext.h"
#include "layout.h"
+#include "lyx_cb.h"
using std::vector;
using std::endl;
extern void ShowCredits();
extern void ShowCopyright();
extern void show_symbols_form(LyXFunc *);
-extern void ProhibitInput();
-extern void AllowInput();
extern void LaTeXOptions(BufferView *);
// A bunch of wrappers
fl_freepup(SubFileExport);
fl_freepup(FileMenu);
- AllowInput();
+ AllowInput(men->currentView());
}
fl_freepup(SubFileImport);
fl_freepup(FileMenu);
- AllowInput();
+ AllowInput(men->currentView());
return;
}
switch (choice) {
case 1: case 2: case 3: case 4: case 5:
case 6: case 7: case 8: case 9: case 10:
- ProhibitInput();
+ ProhibitInput(men->currentView());
men->MenuDocu(doc_files[choice - 1]);
- AllowInput();
+ AllowInput(men->currentView());
break;
case 11: ShowCopyright(); break;
case 12: ShowCredits(); break;
case 13:
- ProhibitInput();
+ ProhibitInput(men->currentView());
fl_show_message((string(_("LyX Version ")) + LYX_VERSION
+ _(" of ") + LYX_RELEASE).c_str(),
(_("Library directory: ")
+ MakeDisplayPath(system_lyxdir)).c_str(),
(_("User directory: ")
+ MakeDisplayPath(user_lyxdir)).c_str());
- AllowInput();
+ AllowInput(men->currentView());
break;
}
fl_freepup(HelpMenu);
if (added_space_bottom.kind() != VSpace::NONE)
os << "\\added_space_bottom "
<< added_space_bottom.asLyXCommand() << " ";
-
+
+ // Maybe the paragraph has special spacing
+ spacing.writeFile(os, true);
+
// The labelwidth string used in lists.
if (!labelwidthstring.empty())
os << "\\labelwidthstring "
// check the params.
if (line_top || line_bottom)
features.lyxline = true;
+ if (!spacing.isDefault())
+ features.setspace = true;
// then the layouts
features.layout[GetLayout()] = true;
added_space_top = VSpace(VSpace::NONE);
added_space_bottom = VSpace(VSpace::NONE);
-
+ spacing.set(Spacing::Default);
+
align = LYX_ALIGN_LAYOUT;
depth = 0;
noindent = false;
pagebreak_top = par->pagebreak_top;
added_space_top = par->added_space_top;
+ spacing = par->spacing;
+
pextra_type = par->pextra_type;
pextra_width = par->pextra_width;
pextra_widthp = par->pextra_widthp;
par->pagebreak_top == pagebreak_top &&
par->added_space_top == added_space_top &&
+ par->spacing == spacing &&
+
par->pextra_type == pextra_type &&
par->pextra_width == pextra_width &&
par->pextra_widthp == pextra_widthp &&
par->align = LYX_ALIGN_LAYOUT;
par->added_space_top = VSpace(VSpace::NONE);
par->added_space_bottom = VSpace(VSpace::NONE);
+ par->spacing.set(Spacing::Default);
+
/* table stuff -- begin*/
if (table)
par->layout = 0;
texrow.newline();
}
+ if (!spacing.isDefault()
+ && (!Previous() || !Previous()->HasSameLayout(this))) {
+ os << "\\begin{spacing}{"
+ << spacing.getValue() << "}\n";
+ texrow.newline();
+ }
+
if (tex_code_break_column && style.isCommand()){
os << '\n';
texrow.newline();
texrow.newline();
}
+ if (!spacing.isDefault()
+ && (!par || !par->HasSameLayout(this))) {
+ os << "\\end{spacing}\n";
+ texrow.newline();
+ }
+
if (!(footnoteflag != LyXParagraph::NO_FOOTNOTE && par &&
par->footnoteflag == LyXParagraph::NO_FOOTNOTE)) {
os << '\n';
LyXLayout const & layout = textclasslist.Style(bparams->textclass,
firstpar->GetLayout());
- LyXFont font = GetFont(par, par->Last()-1);
+ LyXFont font = GetFont(par, par->Last() - 1);
LyXFont::FONT_SIZE size = font.size();
font = GetFont(par, -1);
font.setSize(size);
LyXFont labelfont = GetFont(par, -2);
+ float spacing_val = 1.0;
+ if (!row_ptr->par->spacing.isDefault()) {
+ spacing_val = row_ptr->par->spacing.getValue();
+ } else {
+ spacing_val = bparams->spacing.getValue();
+ }
+ lyxerr << "spacing_val = " << spacing_val << endl;
+
int maxasc = int(lyxfont::maxAscent(font) *
layout.spacing.getValue() *
- bparams->spacing.getValue());
+ spacing_val);
int maxdesc = int(lyxfont::maxDescent(font) *
layout.spacing.getValue() *
- bparams->spacing.getValue());
+ spacing_val);
int pos_end = RowLast(row_ptr);
* layout is printed in an extra row */
if (layout.labeltype == LABEL_COUNTER_CHAPTER
&& bparams->secnumdepth>= 0) {
+ float spacing_val = 1.0;
+ if (!row_ptr->par->spacing.isDefault()) {
+ spacing_val = row_ptr->par->spacing.getValue();
+ } else {
+ spacing_val = bparams->spacing.getValue();
+ }
+
labeladdon = int(lyxfont::maxDescent(labelfont) *
- layout.spacing.getValue() *
- bparams->spacing.getValue())
- + int(lyxfont::maxAscent(labelfont) *
layout.spacing.getValue() *
- bparams->spacing.getValue());
+ spacing_val)
+ + int(lyxfont::maxAscent(labelfont) *
+ layout.spacing.getValue() *
+ spacing_val);
}
/* special code for the top label */
|| layout.labeltype == LABEL_CENTERED_TOP_ENVIRONMENT)
&& row_ptr->par->IsFirstInSequence()
&& !row_ptr->par->GetLabelstring().empty()) {
- labeladdon = int(
- (lyxfont::maxAscent(labelfont) *
- layout.spacing.getValue() *
- bparams->spacing.getValue())
- +(lyxfont::maxDescent(labelfont) *
- layout.spacing.getValue() *
- bparams->spacing.getValue())
- + layout.topsep * DefaultHeight()
- + layout.labelbottomsep * DefaultHeight());
+ float spacing_val = 1.0;
+ if (!row_ptr->par->spacing.isDefault()) {
+ spacing_val = row_ptr->par->spacing.getValue();
+ } else {
+ spacing_val = bparams->spacing.getValue();
+ }
+
+ labeladdon = int(
+ (lyxfont::maxAscent(labelfont) *
+ layout.spacing.getValue() *
+ spacing_val)
+ +(lyxfont::maxDescent(labelfont) *
+ layout.spacing.getValue() *
+ spacing_val)
+ + layout.topsep * DefaultHeight()
+ + layout.labelbottomsep * DefaultHeight());
}
/* and now the layout spaces, for example before and after a section,
if (bparams->secnumdepth >= 0){
/* this is special code for the chapter layout. This is printed in
* an extra row and has a pagebreak at the top. */
- maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * bparams->spacing.getValue())
+ float spacing_val = 1.0;
+ if (!row_ptr->par->spacing.isDefault()) {
+ spacing_val = row_ptr->par->spacing.getValue();
+ } else {
+ spacing_val = bparams->spacing.getValue();
+ }
+
+ maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * spacing_val)
+ int(layout.parsep) * DefaultHeight();
if (is_rtl)
tmpx = paperwidth - LeftMargin(row_ptr) -
font = GetFont(row_ptr->par, -2);
if (!row_ptr->par->GetLabelstring().empty()) {
string tmpstring = row_ptr->par->GetLabelstring();
-
- maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * bparams->spacing.getValue()
+ float spacing_val = 1.0;
+ if (!row_ptr->par->spacing.isDefault()) {
+ spacing_val = row_ptr->par->spacing.getValue();
+ } else {
+ spacing_val = bparams->spacing.getValue();
+ }
+
+ maxdesc = int(lyxfont::maxDescent(font) * layout.spacing.getValue() * spacing_val
+ (layout.labelbottomsep * DefaultHeight()));
tmpx = x;
&& old_cursor.par->IsLineSeparator(old_cursor.pos - 1)) {
old_cursor.par->Erase(old_cursor.pos - 1);
status = LyXText::NEED_MORE_REFRESH;
+ RedoParagraphs(old_cursor, old_cursor.par->Next());
// correct cursor
if (old_cursor.par == cursor.par &&
cursor.pos > old_cursor.pos) {