mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 22:06:15 +00:00
the runlatex merge
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@291 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
863fff8fb8
commit
dfe1bc44b4
218
ChangeLog
218
ChangeLog
@ -24,6 +24,10 @@
|
|||||||
|
|
||||||
1999-11-02 Lars Gullik Bjønnes <larsbj@lyx.org>
|
1999-11-02 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* src/layout.C (less_textclass_desc): functor for use in sorting
|
||||||
|
of textclasses.
|
||||||
|
(LyXTextClass::Read): sort the textclasses after reading.
|
||||||
|
|
||||||
* src/support/filetools.C (SpaceLess): new version of the
|
* src/support/filetools.C (SpaceLess): new version of the
|
||||||
SpaceLess functions. What problems does this one give? Please
|
SpaceLess functions. What problems does this one give? Please
|
||||||
report.
|
report.
|
||||||
@ -68,6 +72,12 @@
|
|||||||
|
|
||||||
* added patch for OS/2 from SMiyata.
|
* added patch for OS/2 from SMiyata.
|
||||||
|
|
||||||
|
1999-10-29 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* src/text2.C (CutSelection): make space_wrapped a bool
|
||||||
|
(CutSelection): dont declare int i until we have to.
|
||||||
|
(alphaCounter): return a char const *.
|
||||||
|
|
||||||
1999-10-28 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
1999-10-28 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
* src/support/syscall.C (Systemcalls::kill):
|
* src/support/syscall.C (Systemcalls::kill):
|
||||||
@ -79,6 +89,11 @@
|
|||||||
|
|
||||||
1999-10-28 Lars Gullik Bjønnes <larsbj@lyx.org>
|
1999-10-28 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* src/layout.[Ch] + several files: access to class variables
|
||||||
|
limited and made accessor functions instead a lot of code changed
|
||||||
|
becuase of this. Also instead of returning pointers often a const
|
||||||
|
reference is returned instead.
|
||||||
|
|
||||||
* src/form1.C (create_form_Figure): added a couple fo "no-c-format"
|
* src/form1.C (create_form_Figure): added a couple fo "no-c-format"
|
||||||
|
|
||||||
* src/Makefile.am (dist-hook): added used to remove the CVS from
|
* src/Makefile.am (dist-hook): added used to remove the CVS from
|
||||||
@ -93,6 +108,32 @@
|
|||||||
|
|
||||||
1999-10-27 Lars Gullik Bjønnes <larsbj@lyx.org>
|
1999-10-27 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* src/layout.[Ch] src/BufferView.C src/LaTeXFeatures.C
|
||||||
|
src/LyXView.C src/buffer.C src/bufferparams.C
|
||||||
|
src/lyx_cb.C src/lyxfunc.C src/paragraph.C src/text.C
|
||||||
|
src/text2.C src/insets/insetinclude.C:
|
||||||
|
lyxlayout renamed to textclasslist.
|
||||||
|
|
||||||
|
* src/layout.C: some lyxerr changes.
|
||||||
|
|
||||||
|
* src/layout.[Ch] (LyXLayout::Read): changed second paramter to
|
||||||
|
LyXTextClass. rewrote LT_COPYSTYLE, rewrote LT_OBSOLETEDBY
|
||||||
|
(LyXLayoutList): removed all traces of this class.
|
||||||
|
(LyXTextClass::Read): rewrote LT_STYLE
|
||||||
|
(LyXTextClass::hasLayout): new function
|
||||||
|
(LyXTextClass::GetLayout): rewritten to return an iterator + has
|
||||||
|
both const and nonconst version.
|
||||||
|
(LyXTextClass::delete_layout): new function.
|
||||||
|
(LyXTextClassList::Style): bug fix. do the right thing if layout
|
||||||
|
is to big.
|
||||||
|
(LyXTextClassList::NumberOfLayout): new acces to layoutlist.
|
||||||
|
(LyXTextClassList::NameOfLayout): ditto
|
||||||
|
(LyXTextClassList::Load): ditto
|
||||||
|
|
||||||
|
* src/buffer.C (makeLaTeXFile): new access to layoutlist
|
||||||
|
|
||||||
|
* src/LaTeXFeatures.C (getTClassPreamble): new access to layoutlist
|
||||||
|
|
||||||
* src/LyXAction.C (LookupFunc): added a workaround for sun
|
* src/LyXAction.C (LookupFunc): added a workaround for sun
|
||||||
compiler, on the other hand...we don't know if the current code
|
compiler, on the other hand...we don't know if the current code
|
||||||
compiles on sun at all...
|
compiles on sun at all...
|
||||||
@ -122,8 +163,130 @@
|
|||||||
* src/lyx_cb.C (MenuFax): subst fix
|
* src/lyx_cb.C (MenuFax): subst fix
|
||||||
(PrintApplyCB): subst fix
|
(PrintApplyCB): subst fix
|
||||||
|
|
||||||
|
1999-10-26 Juergen Vigna <jug@sad.it>
|
||||||
|
|
||||||
|
* src/table.C (TexEndOfCell) + (DocBookEndOfCell): removed some #if 0
|
||||||
|
|
||||||
|
(Read): Cleaned up this code so now we read only format vestion >= 5
|
||||||
|
|
||||||
1999-10-26 Lars Gullik Bjønnes <larsbj@lyx.org>
|
1999-10-26 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* src/support/filetools.C (PutEnvPath): subst fix for EMX, how
|
||||||
|
come nobody has complained about this one?
|
||||||
|
|
||||||
|
* src/insets/insetinclude.C (Latex): subst fix
|
||||||
|
|
||||||
|
* src/insets/insetbib.C (getKeys): subst fix
|
||||||
|
|
||||||
|
* src/lyx_main.C (init): subst fix
|
||||||
|
|
||||||
|
* src/layout.C (Read): subst fix
|
||||||
|
|
||||||
|
* src/buffer.C (RoffAsciiTable): subst fix
|
||||||
|
|
||||||
|
* src/lyx_cb.C (MenuFax): subst fix.
|
||||||
|
|
||||||
|
* src/layout.[hC] + some other files: rewrote to use
|
||||||
|
std::container to store textclasses and layouts in.
|
||||||
|
Simplified, removed a lot of code. Make all classes
|
||||||
|
assignable. Further simplifications and review of type
|
||||||
|
use still to be one.
|
||||||
|
|
||||||
|
* src/menus.C (ShowFileMenu/ShowFileMenu2): Use the iterators from
|
||||||
|
lastfiles to create the lastfiles partr of the menu.
|
||||||
|
|
||||||
|
* src/lastfiles.[Ch]: rewritten to use deque to store the
|
||||||
|
lastfiles in. Uses fstream for reading and writing. Simplifies
|
||||||
|
code.
|
||||||
|
|
||||||
|
* src/support/syscall.C: remove explicit cast.
|
||||||
|
|
||||||
|
* src/BufferView.C (CursorToggleCB): removed code snippets that
|
||||||
|
were commented out.
|
||||||
|
use explicat C++ style casts instead of C style casts. also use
|
||||||
|
u_vdata instea of passing pointers in longs.
|
||||||
|
|
||||||
|
* src/PaperLayout.C: removed code snippets that were commented out.
|
||||||
|
|
||||||
|
* src/lyx_gui_misc.C: removed code snippets that were commented out.
|
||||||
|
|
||||||
|
* src/lyx_main.C: removed code snippets that wer commented out.
|
||||||
|
|
||||||
|
* src/paragraph.C: removed code snippets that were commented out.
|
||||||
|
|
||||||
|
* src/lyxvc.C (logClose): use static_cast
|
||||||
|
(logUpdate): ditto
|
||||||
|
(viewLog): remove explicit cast to void*
|
||||||
|
(showLog): removed old commented code
|
||||||
|
|
||||||
|
* src/menus.C: use static_cast instead of C style casts. use
|
||||||
|
u_vdata instead of u_ldata. remove explicit cast to (long) for
|
||||||
|
pointers. Removed old code that was commented out.
|
||||||
|
|
||||||
|
* src/insets/inset.C: removed old commented func
|
||||||
|
|
||||||
|
* src/insets/insetref.C (InsetRef): removed old code that had been
|
||||||
|
commented out for a long time.
|
||||||
|
(Edit): ditto
|
||||||
|
(escape): removed C style cast
|
||||||
|
|
||||||
|
* src/insets/insetlatexaccent.C (Draw): removed old commented code
|
||||||
|
|
||||||
|
* src/insets/insetlatex.C (Draw): removed old commented code
|
||||||
|
(Read): rewritten to use string
|
||||||
|
|
||||||
|
* src/insets/insetlabel.C (escape): removed C style cast
|
||||||
|
|
||||||
|
* src/insets/insetindex.h: removed vdata and ldata from FD_index_form
|
||||||
|
|
||||||
|
* src/insets/insetindex.C: use static_cast and u_vdata, removed
|
||||||
|
old commented code.
|
||||||
|
|
||||||
|
* src/insets/insetinclude.h: removed a couple of stupid bools
|
||||||
|
|
||||||
|
* src/insets/insetinclude.C (include_cb): use static_cast and u_data.
|
||||||
|
(Clone): remove C style cast
|
||||||
|
(getKeys): changed list to lst because of std::list
|
||||||
|
|
||||||
|
* src/insets/inseterror.C (Draw): removed som old commented code.
|
||||||
|
|
||||||
|
* src/insets/insetcommand.C (Draw): removed some old commented code.
|
||||||
|
|
||||||
|
* src/insets/insetbib.C (bibitem_cb): removed code that has been
|
||||||
|
commented out forever.
|
||||||
|
(bibitem_cb): use static_cast instead of C style cast
|
||||||
|
use of vdata changed to u_vdata.
|
||||||
|
|
||||||
|
* src/insets/inseturl.C (C_InsetUrl_CloseUrlCB): forward the data
|
||||||
|
parameter.
|
||||||
|
(CloseUrlCB): use static_cast instead of C style cast.
|
||||||
|
(CloseUrlCB): added a fl_free form...it seemed to be missing.
|
||||||
|
|
||||||
|
* src/insets/insetinfo.C (Edit): pass object in u_vdata instead
|
||||||
|
(C_InsetInfo_CloseInfoCB): forward the ob parameter
|
||||||
|
(CloseInfoCB): static_cast from ob->u_vdata instead.
|
||||||
|
(Edit): removed bogus arg from fl_set_object_shortcut, set to 1
|
||||||
|
instead.
|
||||||
|
|
||||||
|
* src/insets/inseterror.C (Edit): pass object in u_vdata instead
|
||||||
|
(C_InsetError_CloseErrorCB): forward the ob parameter
|
||||||
|
(CloseErrorCB): static_cast from ob->u_vdata instead.
|
||||||
|
|
||||||
|
* src/vspace.h: include LString.h since we use string in this class.
|
||||||
|
|
||||||
|
* src/vspace.C (lyx_advance): changed name from advance because of
|
||||||
|
nameclash with stl. And since we cannot use namespaces yet...I
|
||||||
|
used a lyx_ prefix instead. Expect this to change when we begin
|
||||||
|
using namespaces.
|
||||||
|
|
||||||
|
* src/BufferView.[Ch] (BufferView::~BufferView): removed
|
||||||
|
|
||||||
|
* src/BackStack.h: rewrote to use std::stack. made BackStackItem
|
||||||
|
and removed now defunct constructor and deconstructor.
|
||||||
|
|
||||||
|
* src/BufferView.h: have backstack as a object not as a pointer.
|
||||||
|
removed initialization from constructor. added include for BackStack
|
||||||
|
|
||||||
* development/lyx.spec.in (%build): add CFLAGS also.
|
* development/lyx.spec.in (%build): add CFLAGS also.
|
||||||
|
|
||||||
* src/screen.C (drawFrame): removed another warning.
|
* src/screen.C (drawFrame): removed another warning.
|
||||||
@ -208,6 +371,13 @@
|
|||||||
|
|
||||||
1999-10-24 Lars Gullik Bjønnes <larsbj@lyx.org>
|
1999-10-24 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
1999-10-24 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* src/LaTeX.C (run): made run_bibtex also depend on files with
|
||||||
|
extension ".bst"
|
||||||
|
(runBibTeX): added scans for "\\bibstyle", now also ".bst" files
|
||||||
|
are put into the dependency file.
|
||||||
|
|
||||||
* src/spellchecker.C (create_ispell_pipe): removed old #warning,
|
* src/spellchecker.C (create_ispell_pipe): removed old #warning,
|
||||||
the code has shown itself to work
|
the code has shown itself to work
|
||||||
(create_ispell_pipe): removed another warning, added a comment
|
(create_ispell_pipe): removed another warning, added a comment
|
||||||
@ -316,6 +486,21 @@
|
|||||||
|
|
||||||
1999-10-22 Lars Gullik Bjønnes <larsbj@lyx.org>
|
1999-10-22 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* src/LaTeX.C (run): added a check in 0 sumchange so that if it
|
||||||
|
was a bib file that had been changed we ensure that bibtex is run.
|
||||||
|
(runBibTeX): enhanced to extract the names of the bib files and
|
||||||
|
getting their absolute path and enter them into the dep file.
|
||||||
|
(findtexfile): static func that is used to look for tex-files,
|
||||||
|
checks for absolute patchs and tries also with kpsewhich.
|
||||||
|
Alternative ways of finding the correct files are wanted. Will
|
||||||
|
probably be moved.
|
||||||
|
(do_popen): function that runs a command using popen and returns
|
||||||
|
the whole output of that command in a string. Should be moved to
|
||||||
|
somewhere else.
|
||||||
|
|
||||||
|
* src/DepTable.[Ch] (extchanged): new function that returns true if a
|
||||||
|
file with extension ext has changed.
|
||||||
|
|
||||||
* src/insets/figinset.C: added ifdef guards around the fl_free
|
* src/insets/figinset.C: added ifdef guards around the fl_free
|
||||||
code that jug commented out. Now it is commented out when
|
code that jug commented out. Now it is commented out when
|
||||||
compiling with XForms == 0.89.
|
compiling with XForms == 0.89.
|
||||||
@ -359,6 +544,27 @@
|
|||||||
|
|
||||||
1999-10-20 Lars Gullik Bjønnes <larsbj@lyx.org>
|
1999-10-20 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* src/support/lyxstring.C (getline): reads now _all_ chars. uses
|
||||||
|
get instead of >>
|
||||||
|
|
||||||
|
* src/Literate.h: some funcs moved from public to private to make
|
||||||
|
interface clearer. Unneeded args removed.
|
||||||
|
|
||||||
|
* src/Literate.C (scanLiterateLogFile): rewritten to use iostream
|
||||||
|
instead of lyxlex.
|
||||||
|
(scanBuildLogFile): ditto
|
||||||
|
|
||||||
|
* src/LaTeX.C (scanLogFile): merged LaTeX Error handling into
|
||||||
|
normal TeX Error. Still room for improvement.
|
||||||
|
|
||||||
|
* src/LaTeX.[Ch]: removed scanError. Wrong place and not needed.
|
||||||
|
|
||||||
|
* src/buffer.C (insertErrors): changes to make the error
|
||||||
|
desctription show properly.
|
||||||
|
|
||||||
|
* src/LaTeX.C (deplog): removed the test for file in lyx doc dir.
|
||||||
|
could never happen
|
||||||
|
|
||||||
* src/support/lyxstring.C (helper): changed to use
|
* src/support/lyxstring.C (helper): changed to use
|
||||||
sizeof(object->rep->ref).
|
sizeof(object->rep->ref).
|
||||||
(operator>>): changed to use a pointer instead.
|
(operator>>): changed to use a pointer instead.
|
||||||
@ -469,8 +675,20 @@
|
|||||||
* src/lyxrc.C (Read): RC_PRINTEXSTRAOPTIONS now uses
|
* src/lyxrc.C (Read): RC_PRINTEXSTRAOPTIONS now uses
|
||||||
LyXLex::next() and not eatline() to get its argument.
|
LyXLex::next() and not eatline() to get its argument.
|
||||||
|
|
||||||
|
1999-10-17 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* src/DepTable.[Ch]: rewritten to store the dependencies in a map
|
||||||
|
instead, use fstreams for io of the depfile, removed unneeded
|
||||||
|
functions and variables.
|
||||||
|
|
||||||
|
* src/LaTeX.[Ch] (class TeXErrors): rewrote to store the errors in a
|
||||||
|
vector instead, removed all functions and variables that is not in
|
||||||
|
use.
|
||||||
|
|
||||||
1999-10-16 Lars Gullik Bjønnes <larsbj@lyx.org>
|
1999-10-16 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||||
|
|
||||||
|
* src/buffer.C (insertErrors): use new interface to TeXError
|
||||||
|
|
||||||
* Makefile.am (rpmdist): added a rpmdist target
|
* Makefile.am (rpmdist): added a rpmdist target
|
||||||
|
|
||||||
* lib/reLyX/Makefile.am: added RelyxFigure.pm and Verbatim.pm as
|
* lib/reLyX/Makefile.am: added RelyxFigure.pm and Verbatim.pm as
|
||||||
|
@ -22,3 +22,4 @@ rpmdist: dist
|
|||||||
ln -s images/lyx.xpm . ; \
|
ln -s images/lyx.xpm . ; \
|
||||||
rpm -ta ${PACKAGE}-${VERSION}.tar.gz ; \
|
rpm -ta ${PACKAGE}-${VERSION}.tar.gz ; \
|
||||||
rm lyx.xpm
|
rm lyx.xpm
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#ifndef BACK_STACK_H
|
#ifndef BACK_STACK_H
|
||||||
#define BACK_STACK_H
|
#define BACK_STACK_H
|
||||||
|
|
||||||
|
#include <stack>
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
|
|
||||||
// Created by Alejandro Aguilar Sierra, 970806
|
// Created by Alejandro Aguilar Sierra, 970806
|
||||||
@ -18,13 +19,15 @@
|
|||||||
/** Utility to get back from a reference or from a child document.
|
/** Utility to get back from a reference or from a child document.
|
||||||
*/
|
*/
|
||||||
class BackStack {
|
class BackStack {
|
||||||
public:
|
private:
|
||||||
///
|
///
|
||||||
struct BackStackItem {
|
struct BackStackItem {
|
||||||
|
BackStackItem(string const & f, int xx, int yy)
|
||||||
|
: fname(f), x(xx), y(yy) {}
|
||||||
///
|
///
|
||||||
void set(string f, int xx, int yy) {
|
//void set(string f, int xx, int yy) {
|
||||||
fname = f; x = xx; y = yy;
|
// fname = f; x = xx; y = yy;
|
||||||
}
|
//}
|
||||||
/// Filename
|
/// Filename
|
||||||
string fname;
|
string fname;
|
||||||
/// Cursor x-position
|
/// Cursor x-position
|
||||||
@ -32,35 +35,27 @@ public:
|
|||||||
/// Cursor y-position
|
/// Cursor y-position
|
||||||
int y;
|
int y;
|
||||||
};
|
};
|
||||||
///
|
public:
|
||||||
BackStack(int n) : item(new BackStackItem[n]) , i(0), imax(n) {}
|
|
||||||
///
|
|
||||||
~BackStack() {
|
|
||||||
delete[] item;
|
|
||||||
}
|
|
||||||
///
|
///
|
||||||
void push(string f, int x, int y) {
|
void push(string f, int x, int y) {
|
||||||
if (i < imax)
|
BackStackItem bit(f, x, y);
|
||||||
item[i++].set(f, x, y);
|
stakk.push(bit);
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
string & pop(int *x, int *y) {
|
string pop(int * x, int * y) {
|
||||||
if (i > 0) i--;
|
BackStackItem bit = stakk.top();
|
||||||
*x = item[i].x;
|
*x = bit.x;
|
||||||
*y = item[i].y;
|
*y = bit.y;
|
||||||
return item[i].fname;
|
stakk.pop();
|
||||||
|
return bit.fname;
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
bool empty() const {
|
bool empty() const {
|
||||||
return i == 0;
|
return stakk.empty();
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
BackStackItem *item;
|
stack<BackStackItem> stakk;
|
||||||
///
|
|
||||||
int i;
|
|
||||||
///
|
|
||||||
int imax;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
132
src/BufferView.C
132
src/BufferView.C
@ -40,6 +40,7 @@
|
|||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "lyx_cb.h"
|
#include "lyx_cb.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
#include "layout.h"
|
||||||
|
|
||||||
extern BufferList bufferlist;
|
extern BufferList bufferlist;
|
||||||
void sigchldhandler(pid_t pid, int *status);
|
void sigchldhandler(pid_t pid, int *status);
|
||||||
@ -56,7 +57,7 @@ extern InsetUpdateStruct *InsetUpdateList;
|
|||||||
extern void UpdateInsetUpdateList();
|
extern void UpdateInsetUpdateList();
|
||||||
|
|
||||||
// This is _very_ temporary
|
// This is _very_ temporary
|
||||||
FL_OBJECT *figinset_canvas;
|
FL_OBJECT * figinset_canvas;
|
||||||
|
|
||||||
BufferView::BufferView(LyXView *o, int xpos, int ypos,
|
BufferView::BufferView(LyXView *o, int xpos, int ypos,
|
||||||
int width, int height)
|
int width, int height)
|
||||||
@ -78,13 +79,6 @@ BufferView::BufferView(LyXView *o, int xpos, int ypos,
|
|||||||
fl_set_focus_object(_owner->getForm(), work_area);
|
fl_set_focus_object(_owner->getForm(), work_area);
|
||||||
work_area_focus = true;
|
work_area_focus = true;
|
||||||
lyx_focus = false;
|
lyx_focus = false;
|
||||||
backstack = new BackStack(16);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BufferView::~BufferView()
|
|
||||||
{
|
|
||||||
delete backstack;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -129,7 +123,6 @@ void BufferView::setBuffer(Buffer *b)
|
|||||||
} else {
|
} else {
|
||||||
lyxerr.debug() << " No Buffer!" << endl;
|
lyxerr.debug() << " No Buffer!" << endl;
|
||||||
_owner->getMenus()->hideMenus();
|
_owner->getMenus()->hideMenus();
|
||||||
//workAreaExpose();
|
|
||||||
updateScrollbar();
|
updateScrollbar();
|
||||||
fl_redraw_object(work_area);
|
fl_redraw_object(work_area);
|
||||||
}
|
}
|
||||||
@ -241,9 +234,9 @@ void BufferView::updateScrollbar()
|
|||||||
fl_set_slider_increment(scrollbar,work_area->h-lineh,lineh);
|
fl_set_slider_increment(scrollbar,work_area->h-lineh,lineh);
|
||||||
#endif
|
#endif
|
||||||
if (maxfloat>0){
|
if (maxfloat>0){
|
||||||
if ((hfloat/maxfloat) * (float) height2 < 3)
|
if ((hfloat/maxfloat) * float(height2) < 3)
|
||||||
fl_set_slider_size(scrollbar,
|
fl_set_slider_size(scrollbar,
|
||||||
3/(float)height2);
|
3/float(height2));
|
||||||
else
|
else
|
||||||
fl_set_slider_size(scrollbar,
|
fl_set_slider_size(scrollbar,
|
||||||
hfloat/maxfloat);
|
hfloat/maxfloat);
|
||||||
@ -267,9 +260,9 @@ int BufferView::resizeCurrentBuffer()
|
|||||||
{
|
{
|
||||||
lyxerr.debug() << "resizeCurrentBuffer" << endl;
|
lyxerr.debug() << "resizeCurrentBuffer" << endl;
|
||||||
|
|
||||||
LyXParagraph *par = 0;
|
LyXParagraph * par = 0;
|
||||||
LyXParagraph *selstartpar = 0;
|
LyXParagraph * selstartpar = 0;
|
||||||
LyXParagraph *selendpar = 0;
|
LyXParagraph * selendpar = 0;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
int selstartpos = 0;
|
int selstartpos = 0;
|
||||||
int selendpos = 0;
|
int selendpos = 0;
|
||||||
@ -364,33 +357,34 @@ void BufferView::gotoError()
|
|||||||
_buffer->text->cursor;
|
_buffer->text->cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Just a bunch of C wrappers around static members of BufferView
|
// Just a bunch of C wrappers around static members of BufferView
|
||||||
extern "C" void C_BufferView_UpCB(FL_OBJECT *ob, long buf) {
|
extern "C" void C_BufferView_UpCB(FL_OBJECT * ob, long buf) {
|
||||||
BufferView::UpCB(ob,buf);
|
BufferView::UpCB(ob, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_BufferView_DownCB(FL_OBJECT *ob, long buf) {
|
extern "C" void C_BufferView_DownCB(FL_OBJECT * ob, long buf) {
|
||||||
BufferView::DownCB(ob,buf);
|
BufferView::DownCB(ob, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_BufferView_ScrollCB(FL_OBJECT *ob, long buf) {
|
extern "C" void C_BufferView_ScrollCB(FL_OBJECT * ob, long buf) {
|
||||||
BufferView::ScrollCB(ob,buf);
|
BufferView::ScrollCB(ob, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_BufferView_CursorToggleCB(FL_OBJECT *ob, long buf) {
|
extern "C" void C_BufferView_CursorToggleCB(FL_OBJECT * ob, long buf) {
|
||||||
BufferView::CursorToggleCB(ob,buf);
|
BufferView::CursorToggleCB(ob, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" int C_BufferView_work_area_handler(FL_OBJECT *ob, int event,
|
extern "C" int C_BufferView_work_area_handler(FL_OBJECT * ob, int event,
|
||||||
FL_Coord, FL_Coord,
|
FL_Coord, FL_Coord,
|
||||||
int key, void *xev) {
|
int key, void * xev) {
|
||||||
return BufferView::work_area_handler(ob, event, 0, 0, key, xev);
|
return BufferView::work_area_handler(ob, event, 0, 0, key, xev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BufferView::create_view(int xpos, int ypos, int width, int height)
|
void BufferView::create_view(int xpos, int ypos, int width, int height)
|
||||||
{
|
{
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT * obj;
|
||||||
const int bw = abs(fl_get_border_width());
|
const int bw = abs(fl_get_border_width());
|
||||||
|
|
||||||
// a hack for the figinsets (Matthias)
|
// a hack for the figinsets (Matthias)
|
||||||
@ -441,7 +435,8 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
|
|||||||
fl_set_object_color(obj,FL_MCOL,FL_BLUE);
|
fl_set_object_color(obj,FL_MCOL,FL_BLUE);
|
||||||
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
||||||
fl_set_object_gravity(obj,NorthEastGravity, NorthEastGravity);
|
fl_set_object_gravity(obj,NorthEastGravity, NorthEastGravity);
|
||||||
fl_set_object_callback(obj,C_BufferView_UpCB,(long)this);
|
fl_set_object_callback(obj, C_BufferView_UpCB, 0);
|
||||||
|
obj->u_vdata = this;
|
||||||
fl_set_pixmapbutton_data(obj, up_xpm);
|
fl_set_pixmapbutton_data(obj, up_xpm);
|
||||||
|
|
||||||
#if FL_REVISION >85
|
#if FL_REVISION >85
|
||||||
@ -459,7 +454,8 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
|
|||||||
fl_set_object_boxtype(obj, FL_UP_BOX);
|
fl_set_object_boxtype(obj, FL_UP_BOX);
|
||||||
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
||||||
fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity);
|
fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity);
|
||||||
fl_set_object_callback(obj,C_BufferView_ScrollCB,(long)this);
|
fl_set_object_callback(obj, C_BufferView_ScrollCB, 0);
|
||||||
|
obj->u_vdata = this;
|
||||||
|
|
||||||
// down - scrollbar button
|
// down - scrollbar button
|
||||||
#if FL_REVISION > 85
|
#if FL_REVISION > 85
|
||||||
@ -475,7 +471,8 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
|
|||||||
fl_set_object_color(obj,FL_MCOL,FL_BLUE);
|
fl_set_object_color(obj,FL_MCOL,FL_BLUE);
|
||||||
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
fl_set_object_resize(obj, FL_RESIZE_ALL);
|
||||||
fl_set_object_gravity(obj, SouthEastGravity, SouthEastGravity);
|
fl_set_object_gravity(obj, SouthEastGravity, SouthEastGravity);
|
||||||
fl_set_object_callback(obj,C_BufferView_DownCB,(long)this);
|
fl_set_object_callback(obj, C_BufferView_DownCB, 0);
|
||||||
|
obj->u_vdata = this;
|
||||||
fl_set_pixmapbutton_data(obj, down_xpm);
|
fl_set_pixmapbutton_data(obj, down_xpm);
|
||||||
fl_set_border_width(-bw);
|
fl_set_border_width(-bw);
|
||||||
|
|
||||||
@ -497,13 +494,13 @@ void BufferView::create_view(int xpos, int ypos, int width, int height)
|
|||||||
|
|
||||||
|
|
||||||
// Callback for scrollbar up button
|
// Callback for scrollbar up button
|
||||||
void BufferView::UpCB(FL_OBJECT *ob, long buf)
|
void BufferView::UpCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
BufferView *view = (BufferView*) buf;
|
BufferView * view = static_cast<BufferView*>(ob->u_vdata);
|
||||||
|
|
||||||
if (view->_buffer == 0) return;
|
if (view->_buffer == 0) return;
|
||||||
|
|
||||||
const XEvent*ev2;
|
XEvent const * ev2;
|
||||||
static long time = 0;
|
static long time = 0;
|
||||||
ev2 = fl_last_event();
|
ev2 = fl_last_event();
|
||||||
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
|
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
|
||||||
@ -540,20 +537,20 @@ void waitForX()
|
|||||||
}
|
}
|
||||||
static XEvent ev;
|
static XEvent ev;
|
||||||
XChangeProperty(fl_display, w, a, a, 8,
|
XChangeProperty(fl_display, w, a, a, 8,
|
||||||
PropModeAppend, (unsigned char *)"", 0);
|
PropModeAppend, reinterpret_cast<unsigned char*>(""), 0);
|
||||||
XWindowEvent(fl_display, w, PropertyChangeMask, &ev);
|
XWindowEvent(fl_display, w, PropertyChangeMask, &ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Callback for scrollbar slider
|
// Callback for scrollbar slider
|
||||||
void BufferView::ScrollCB(FL_OBJECT *ob, long buf)
|
void BufferView::ScrollCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
BufferView *view = (BufferView*) buf;
|
BufferView *view = static_cast<BufferView*>(ob->u_vdata);
|
||||||
extern bool cursor_follows_scrollbar;
|
extern bool cursor_follows_scrollbar;
|
||||||
|
|
||||||
if (view->_buffer == 0) return;
|
if (view->_buffer == 0) return;
|
||||||
|
|
||||||
view->current_scrollbar_value = (long)fl_get_slider_value(ob);
|
view->current_scrollbar_value = long(fl_get_slider_value(ob));
|
||||||
if (view->current_scrollbar_value < 0)
|
if (view->current_scrollbar_value < 0)
|
||||||
view->current_scrollbar_value = 0;
|
view->current_scrollbar_value = 0;
|
||||||
|
|
||||||
@ -584,13 +581,13 @@ void BufferView::ScrollCB(FL_OBJECT *ob, long buf)
|
|||||||
|
|
||||||
|
|
||||||
// Callback for scrollbar down button
|
// Callback for scrollbar down button
|
||||||
void BufferView::DownCB(FL_OBJECT *ob, long buf)
|
void BufferView::DownCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
BufferView *view = (BufferView*) buf;
|
BufferView * view = static_cast<BufferView*>(ob->u_vdata);
|
||||||
|
|
||||||
if (view->_buffer == 0) return;
|
if (view->_buffer == 0) return;
|
||||||
|
|
||||||
const XEvent*ev2;
|
XEvent const *ev2;
|
||||||
static long time = 0;
|
static long time = 0;
|
||||||
ev2 = fl_last_event();
|
ev2 = fl_last_event();
|
||||||
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
|
if (ev2->type == ButtonPress || ev2->type == ButtonRelease)
|
||||||
@ -619,10 +616,10 @@ int BufferView::ScrollUp(long time)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
float add_value = (_buffer->text->DefaultHeight()
|
float add_value = (_buffer->text->DefaultHeight()
|
||||||
+ (float)(time) * (float)(time) * 0.125);
|
+ float(time) * float(time) * 0.125);
|
||||||
|
|
||||||
if (add_value > work_area->h)
|
if (add_value > work_area->h)
|
||||||
add_value = (float) (work_area->h -
|
add_value = float(work_area->h -
|
||||||
_buffer->text->DefaultHeight());
|
_buffer->text->DefaultHeight());
|
||||||
|
|
||||||
value -= add_value;
|
value -= add_value;
|
||||||
@ -632,7 +629,7 @@ int BufferView::ScrollUp(long time)
|
|||||||
|
|
||||||
fl_set_slider_value(scrollbar, value);
|
fl_set_slider_value(scrollbar, value);
|
||||||
|
|
||||||
ScrollCB(scrollbar,(long)this);
|
ScrollCB(scrollbar, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,10 +648,10 @@ int BufferView::ScrollDown(long time)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
float add_value = (_buffer->text->DefaultHeight()
|
float add_value = (_buffer->text->DefaultHeight()
|
||||||
+ (float)(time) * (float)(time) * 0.125);
|
+ float(time) * float(time) * 0.125);
|
||||||
|
|
||||||
if (add_value > work_area->h)
|
if (add_value > work_area->h)
|
||||||
add_value = (float) (work_area->h -
|
add_value = float(work_area->h -
|
||||||
_buffer->text->DefaultHeight());
|
_buffer->text->DefaultHeight());
|
||||||
|
|
||||||
value += add_value;
|
value += add_value;
|
||||||
@ -664,7 +661,7 @@ int BufferView::ScrollDown(long time)
|
|||||||
|
|
||||||
fl_set_slider_value(scrollbar, value);
|
fl_set_slider_value(scrollbar, value);
|
||||||
|
|
||||||
ScrollCB(scrollbar,(long)this);
|
ScrollCB(scrollbar, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -684,7 +681,7 @@ void BufferView::ScrollUpOnePage(long /*time*/)
|
|||||||
|
|
||||||
fl_set_slider_value(scrollbar, y);
|
fl_set_slider_value(scrollbar, y);
|
||||||
|
|
||||||
ScrollCB(scrollbar,(long)this);
|
ScrollCB(scrollbar, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -706,7 +703,7 @@ void BufferView::ScrollDownOnePage(long /*time*/)
|
|||||||
|
|
||||||
fl_set_slider_value(scrollbar, y);
|
fl_set_slider_value(scrollbar, y);
|
||||||
|
|
||||||
ScrollCB(scrollbar,(long)this);
|
ScrollCB(scrollbar, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -718,8 +715,8 @@ int BufferView::work_area_handler(FL_OBJECT * ob, int event,
|
|||||||
static int y_old = -1;
|
static int y_old = -1;
|
||||||
static long scrollbar_value_old = -1;
|
static long scrollbar_value_old = -1;
|
||||||
|
|
||||||
XEvent* ev = (XEvent*) xev;
|
XEvent * ev = static_cast<XEvent*>(xev);
|
||||||
BufferView *view = (BufferView*) ob->u_vdata;
|
BufferView * view = static_cast<BufferView*>(ob->u_vdata);
|
||||||
|
|
||||||
// If we don't have a view yet; return
|
// If we don't have a view yet; return
|
||||||
if (!view || quitting) return 0;
|
if (!view || quitting) return 0;
|
||||||
@ -858,7 +855,7 @@ int BufferView::WorkAreaMotionNotify(FL_OBJECT *ob, Window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern int bibitemMaxWidth(const class LyXFont &);
|
extern int bibitemMaxWidth(LyXFont const &);
|
||||||
|
|
||||||
// Single-click on work area
|
// Single-click on work area
|
||||||
int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
int BufferView::WorkAreaButtonPress(FL_OBJECT *ob, Window,
|
||||||
@ -1163,8 +1160,8 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
|
|||||||
|
|
||||||
// Maybe we want to edit a bibitem ale970302
|
// Maybe we want to edit a bibitem ale970302
|
||||||
if (_buffer->text->cursor.par->bibkey && x < 20 +
|
if (_buffer->text->cursor.par->bibkey && x < 20 +
|
||||||
bibitemMaxWidth(lyxstyle.TextClass(_buffer->
|
bibitemMaxWidth(textclasslist.TextClass(_buffer->
|
||||||
params.textclass)->defaultfont)) {
|
params.textclass).defaultfont())) {
|
||||||
_buffer->text->cursor.par->bibkey->Edit(0, 0);
|
_buffer->text->cursor.par->bibkey->Edit(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1177,7 +1174,7 @@ int BufferView::WorkAreaButtonRelease(FL_OBJECT *ob, Window ,
|
|||||||
* If hit, the coordinates are changed relative to the inset.
|
* If hit, the coordinates are changed relative to the inset.
|
||||||
* Otherwise coordinates are not changed, and false is returned.
|
* Otherwise coordinates are not changed, and false is returned.
|
||||||
*/
|
*/
|
||||||
Inset * BufferView::checkInsetHit(int &x, int &y)
|
Inset * BufferView::checkInsetHit(int & x, int & y)
|
||||||
{
|
{
|
||||||
if (!getScreen())
|
if (!getScreen())
|
||||||
return 0;
|
return 0;
|
||||||
@ -1272,19 +1269,17 @@ int BufferView::workAreaExpose()
|
|||||||
|
|
||||||
|
|
||||||
// Callback for cursor timer
|
// Callback for cursor timer
|
||||||
void BufferView::CursorToggleCB(FL_OBJECT *ob, long)
|
void BufferView::CursorToggleCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
BufferView *view = (BufferView*) ob->u_vdata;
|
BufferView *view = static_cast<BufferView*>(ob->u_vdata);
|
||||||
|
|
||||||
/* quite a nice place for asyncron Inset updating, isn't it? */
|
/* quite a nice place for asyncron Inset updating, isn't it? */
|
||||||
// actually no! This is run even if no buffer exist... so (Lgb)
|
// actually no! This is run even if no buffer exist... so (Lgb)
|
||||||
if (view && !view->_buffer) {
|
if (view && !view->_buffer) {
|
||||||
goto set_timer_and_return;
|
goto set_timer_and_return;
|
||||||
}
|
}
|
||||||
#ifdef WITH_WARNINGS
|
|
||||||
#warning NOTE!
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
// NOTE:
|
||||||
// On my quest to solve the gs rendre hangups I am now
|
// On my quest to solve the gs rendre hangups I am now
|
||||||
// disabling the SIGHUP completely, and will do a wait
|
// disabling the SIGHUP completely, and will do a wait
|
||||||
// now and then instead. If the guess that xforms somehow
|
// now and then instead. If the guess that xforms somehow
|
||||||
@ -1312,7 +1307,6 @@ void BufferView::CursorToggleCB(FL_OBJECT *ob, long)
|
|||||||
// rendering process.
|
// rendering process.
|
||||||
|
|
||||||
// these comments posted to lyx@via
|
// these comments posted to lyx@via
|
||||||
//#if 0
|
|
||||||
{
|
{
|
||||||
int status = 1;
|
int status = 1;
|
||||||
int pid = waitpid((pid_t)0, &status, WNOHANG);
|
int pid = waitpid((pid_t)0, &status, WNOHANG);
|
||||||
@ -1321,7 +1315,6 @@ void BufferView::CursorToggleCB(FL_OBJECT *ob, long)
|
|||||||
else if (pid > 0)
|
else if (pid > 0)
|
||||||
sigchldhandler(pid, &status);
|
sigchldhandler(pid, &status);
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
if (InsetUpdateList)
|
if (InsetUpdateList)
|
||||||
UpdateInsetUpdateList();
|
UpdateInsetUpdateList();
|
||||||
|
|
||||||
@ -1387,7 +1380,7 @@ int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
|
|||||||
Atom tmpatom;
|
Atom tmpatom;
|
||||||
unsigned long ul1;
|
unsigned long ul1;
|
||||||
unsigned long ul2;
|
unsigned long ul2;
|
||||||
unsigned char* uc = 0;
|
unsigned char * uc = 0;
|
||||||
int tmpint;
|
int tmpint;
|
||||||
screen->HideCursor();
|
screen->HideCursor();
|
||||||
BeforeChange();
|
BeforeChange();
|
||||||
@ -1436,12 +1429,13 @@ int BufferView::WorkAreaSelectionNotify(FL_OBJECT *, Window win,
|
|||||||
XFlush(fl_display);
|
XFlush(fl_display);
|
||||||
|
|
||||||
if (uc){
|
if (uc){
|
||||||
if (!ascii_type)
|
if (!ascii_type) {
|
||||||
_buffer->text->
|
_buffer->text->
|
||||||
InsertStringA((char*)uc);
|
InsertStringA(reinterpret_cast<char*>(uc));
|
||||||
else
|
} else {
|
||||||
_buffer->text->
|
_buffer->text->
|
||||||
InsertStringB((char*)uc);
|
InsertStringB(reinterpret_cast<char*>(uc));
|
||||||
|
}
|
||||||
free(uc);
|
free(uc);
|
||||||
uc = 0;
|
uc = 0;
|
||||||
}
|
}
|
||||||
@ -1457,7 +1451,7 @@ void BufferView::cursorPrevious()
|
|||||||
if (!currentBuffer()->text->cursor.row->previous) return;
|
if (!currentBuffer()->text->cursor.row->previous) return;
|
||||||
|
|
||||||
long y = getScreen()->first;
|
long y = getScreen()->first;
|
||||||
Row* cursorrow = currentBuffer()->text->cursor.row;
|
Row * cursorrow = currentBuffer()->text->cursor.row;
|
||||||
currentBuffer()->text->
|
currentBuffer()->text->
|
||||||
SetCursorFromCoordinates(currentBuffer()->text->
|
SetCursorFromCoordinates(currentBuffer()->text->
|
||||||
cursor.x_fix,
|
cursor.x_fix,
|
||||||
@ -1506,7 +1500,7 @@ bool BufferView::available() const
|
|||||||
|
|
||||||
void BufferView::savePosition()
|
void BufferView::savePosition()
|
||||||
{
|
{
|
||||||
backstack->push(currentBuffer()->getFileName(),
|
backstack.push(currentBuffer()->getFileName(),
|
||||||
currentBuffer()->text->cursor.x,
|
currentBuffer()->text->cursor.x,
|
||||||
currentBuffer()->text->cursor.y);
|
currentBuffer()->text->cursor.y);
|
||||||
}
|
}
|
||||||
@ -1514,13 +1508,13 @@ void BufferView::savePosition()
|
|||||||
|
|
||||||
void BufferView::restorePosition()
|
void BufferView::restorePosition()
|
||||||
{
|
{
|
||||||
if (backstack->empty()) return;
|
if (backstack.empty()) return;
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
string fname = backstack->pop(&x, &y);
|
string fname = backstack.pop(&x, &y);
|
||||||
|
|
||||||
BeforeChange();
|
BeforeChange();
|
||||||
Buffer *b = (bufferlist.exists(fname)) ? bufferlist.getBuffer(fname):
|
Buffer * b = (bufferlist.exists(fname)) ? bufferlist.getBuffer(fname):
|
||||||
bufferlist.loadLyXFile(fname); // don't ask, just load it
|
bufferlist.loadLyXFile(fname); // don't ask, just load it
|
||||||
setBuffer(b);
|
setBuffer(b);
|
||||||
currentBuffer()->text->SetCursorFromCoordinates(x, y);
|
currentBuffer()->text->SetCursorFromCoordinates(x, y);
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright (C) 1995 Matthias Ettrich
|
||||||
* Copyright (C) 1995-1998 The LyX Team.
|
* Copyright (C) 1995-1998 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
#ifndef _BUFFER_VIEW_H
|
#ifndef BUFFER_VIEW_H
|
||||||
#define _BUFFER_VIEW_H
|
#define BUFFER_VIEW_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
|
#include "BackStack.h"
|
||||||
|
|
||||||
class LyXView;
|
class LyXView;
|
||||||
class Buffer;
|
class Buffer;
|
||||||
class LyXScreen;
|
class LyXScreen;
|
||||||
class BackStack;
|
|
||||||
class Inset;
|
class Inset;
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -30,8 +30,6 @@ public:
|
|||||||
///
|
///
|
||||||
BufferView(LyXView *owner, int ,int ,int, int);
|
BufferView(LyXView *owner, int ,int ,int, int);
|
||||||
///
|
///
|
||||||
~BufferView();
|
|
||||||
///
|
|
||||||
Buffer *currentBuffer() { return _buffer; }
|
Buffer *currentBuffer() { return _buffer; }
|
||||||
///
|
///
|
||||||
FL_OBJECT *getWorkArea() { return work_area; }
|
FL_OBJECT *getWorkArea() { return work_area; }
|
||||||
@ -152,7 +150,7 @@ private:
|
|||||||
///
|
///
|
||||||
FL_OBJECT *timer_cursor;
|
FL_OBJECT *timer_cursor;
|
||||||
///
|
///
|
||||||
BackStack *backstack;
|
BackStack backstack;
|
||||||
///
|
///
|
||||||
int last_click_x, last_click_y;
|
int last_click_x, last_click_y;
|
||||||
};
|
};
|
||||||
|
27
src/Chktex.C
27
src/Chktex.C
@ -61,32 +61,21 @@ int Chktex::scanLogFile(TeXErrors &terr)
|
|||||||
string token;
|
string token;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
|
||||||
LyXLex lex(0, 0);
|
|
||||||
|
|
||||||
string tmp = ChangeExtension(file, ".log", true);
|
string tmp = ChangeExtension(file, ".log", true);
|
||||||
|
|
||||||
if (!lex.setFile(tmp)) {
|
ifstream ifs(tmp.c_str());
|
||||||
// Unable to open file. Return at once
|
while (getline(ifs, token)) {
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (lex.IsOK()) {
|
|
||||||
if (lex.EatLine())
|
|
||||||
token = lex.GetString();
|
|
||||||
else // blank line in the file being read
|
|
||||||
continue;
|
|
||||||
|
|
||||||
string srcfile, line, pos, warno, warning;
|
string srcfile, line, pos, warno, warning;
|
||||||
token=split(token, srcfile, ':');
|
token = split(token, srcfile, ':');
|
||||||
token=split(token, line, ':');
|
token = split(token, line, ':');
|
||||||
token=split(token, pos, ':');
|
token = split(token, pos, ':');
|
||||||
token=split(token, warno, ':');
|
token = split(token, warno, ':');
|
||||||
token=split(token, warning, ':');
|
token = split(token, warning, ':');
|
||||||
|
|
||||||
int lineno = atoi(line.c_str());
|
int lineno = atoi(line.c_str());
|
||||||
warno = _("ChkTeX warning id #") + warno;
|
warno = _("ChkTeX warning id #") + warno;
|
||||||
terr.insertError(lineno, warno, warning);
|
terr.insertError(lineno, warno, warning);
|
||||||
retval++;
|
++retval;
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
173
src/DepTable.C
173
src/DepTable.C
@ -13,46 +13,14 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "DepTable.h"
|
#include "DepTable.h"
|
||||||
#include "support/lyxlib.h"
|
#include "support/lyxlib.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
|
#include <fstream>
|
||||||
DepTable::DepTable()
|
|
||||||
{
|
|
||||||
new_sum = 0;
|
|
||||||
old_sum = 0;
|
|
||||||
next = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DepTable::DepTable(string const & f,
|
|
||||||
bool upd,
|
|
||||||
unsigned long one,
|
|
||||||
unsigned long two)
|
|
||||||
{
|
|
||||||
// not quite sure if this is the correct place for MakeAbsPath
|
|
||||||
file = MakeAbsPath(f);
|
|
||||||
new_sum = 0; old_sum = 0;
|
|
||||||
if (one != 0)
|
|
||||||
new_sum = one;
|
|
||||||
if (two != 0)
|
|
||||||
old_sum = two;
|
|
||||||
if (upd) {
|
|
||||||
old_sum = new_sum;
|
|
||||||
new_sum = lyxsum(file.c_str());
|
|
||||||
}
|
|
||||||
if (lyxerr.debugging()) {
|
|
||||||
char tmp1[256];
|
|
||||||
char tmp2[256];
|
|
||||||
sprintf(tmp1, "%lu", new_sum);
|
|
||||||
sprintf(tmp2, "%lu", old_sum);
|
|
||||||
lyxerr.debug() << "New file inserted in deplog: "
|
|
||||||
<< file << " "
|
|
||||||
<< tmp1 << " " << tmp2 << endl;
|
|
||||||
}
|
|
||||||
next = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DepTable::insert(string const & fi,
|
void DepTable::insert(string const & fi,
|
||||||
bool upd,
|
bool upd,
|
||||||
@ -61,42 +29,40 @@ void DepTable::insert(string const & fi,
|
|||||||
{
|
{
|
||||||
// not quite sure if this is the correct place for MakeAbsPath
|
// not quite sure if this is the correct place for MakeAbsPath
|
||||||
string f = MakeAbsPath(fi);
|
string f = MakeAbsPath(fi);
|
||||||
if (f == file) return; // exist already in the log
|
if (deplist.find(f) == deplist.end()) {
|
||||||
if (next)
|
if (upd) {
|
||||||
next->insert(f, upd, one, two);
|
one = two;
|
||||||
else
|
two = lyxsum(f.c_str());
|
||||||
next = new DepTable(f, upd, one, two);
|
}
|
||||||
|
deplist[f] = make_pair(one, two);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DepTable::update()
|
void DepTable::update()
|
||||||
{
|
{
|
||||||
if (!file.empty()) {
|
for(DepList::iterator itr = deplist.begin();
|
||||||
old_sum = new_sum;
|
itr != deplist.end();
|
||||||
new_sum = lyxsum(file.c_str());
|
++itr) {
|
||||||
|
unsigned long one = (*itr).second.second;
|
||||||
|
unsigned long two = lyxsum((*itr).first.c_str());
|
||||||
|
(*itr).second = make_pair(one, two);
|
||||||
if (lyxerr.debugging()) {
|
if (lyxerr.debugging()) {
|
||||||
char tmp1[256];
|
lyxerr << "update: " << (*itr).first << " "
|
||||||
char tmp2[256];
|
<< one << " " << two << endl;
|
||||||
sprintf(tmp1, "%lu", new_sum);
|
|
||||||
sprintf(tmp2, "%lu", old_sum);
|
|
||||||
lyxerr.debug() << "update: " << file << " "
|
|
||||||
<< tmp1 << " " << tmp2 << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (next) next->update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DepTable::sumchange()
|
bool DepTable::sumchange()
|
||||||
{
|
{
|
||||||
bool ret = false;
|
for (DepList::const_iterator cit = deplist.begin();
|
||||||
|
cit != deplist.end();
|
||||||
if (!file.empty()) {
|
++cit) {
|
||||||
if (old_sum != new_sum) ret = true;
|
if ((*cit).second.first != (*cit).second.second) return true;
|
||||||
}
|
}
|
||||||
if (!ret && next) ret = next->sumchange();
|
return false;
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -104,65 +70,62 @@ bool DepTable::haschanged(string const & f)
|
|||||||
{
|
{
|
||||||
// not quite sure if this is the correct place for MakeAbsPath
|
// not quite sure if this is the correct place for MakeAbsPath
|
||||||
string fil = MakeAbsPath(f);
|
string fil = MakeAbsPath(f);
|
||||||
bool ret = false;
|
DepList::const_iterator cit = deplist.find(fil);
|
||||||
|
if (cit != deplist.end()) {
|
||||||
if (!fil.empty() && !file.empty() && fil == file) {
|
if ((*cit).second.first != (*cit).second.second
|
||||||
if (new_sum != old_sum && new_sum != 0)
|
&& (*cit).second.second != 0)
|
||||||
ret = true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!ret && next) ret = next->haschanged(fil);
|
return false;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DepTable::write(string const&f)
|
bool DepTable::extchanged(string const & ext)
|
||||||
{
|
{
|
||||||
FilePtr fp(f, FilePtr::write);
|
for (DepList::const_iterator cit = deplist.begin();
|
||||||
if (fp() && next) next->write(fp());
|
cit != deplist.end();
|
||||||
|
++cit) {
|
||||||
|
if (suffixIs((*cit).first, ext.c_str())) {
|
||||||
|
if ((*cit).second.first != (*cit).second.second)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DepTable::write(string const & f)
|
||||||
|
{
|
||||||
|
ofstream ofs(f.c_str());
|
||||||
|
for (DepList::const_iterator cit = deplist.begin();
|
||||||
|
cit != deplist.end();
|
||||||
|
++cit) {
|
||||||
|
if (lyxerr.debugging()) {
|
||||||
|
lyxerr << "Write dep: "
|
||||||
|
<< (*cit).first << " "
|
||||||
|
<< (*cit).second.first << " "
|
||||||
|
<< (*cit).second.second << endl;
|
||||||
|
}
|
||||||
|
ofs << (*cit).first << " "
|
||||||
|
<< (*cit).second.first << " "
|
||||||
|
<< (*cit).second.second << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DepTable::read(string const &f)
|
void DepTable::read(string const &f)
|
||||||
{
|
{
|
||||||
FilePtr fp(f, FilePtr::read);
|
ifstream ifs(f.c_str());
|
||||||
if (fp()) { // file opened
|
string nome;
|
||||||
char nome[256];
|
|
||||||
unsigned long one = 0;
|
unsigned long one = 0;
|
||||||
unsigned long two = 0;
|
unsigned long two = 0;
|
||||||
// scan the file line by line
|
while(ifs >> nome >> one >> two) {
|
||||||
// return true if the two numbers on the line is different
|
|
||||||
int ret = 0;
|
|
||||||
while (!feof(fp())) {
|
|
||||||
ret = fscanf(fp(), "%s %lu %lu",
|
|
||||||
nome, &one, &two);
|
|
||||||
if (ret !=3) continue;
|
|
||||||
if (lyxerr.debugging()) {
|
if (lyxerr.debugging()) {
|
||||||
char tmp1[255];
|
lyxerr << "read dep: "
|
||||||
char tmp2[255];
|
<< nome << " "
|
||||||
sprintf(tmp1, "%lu", one);
|
<< one << " "
|
||||||
sprintf(tmp2, "%lu", two);
|
<< two << endl;
|
||||||
lyxerr.debug() << "read dep: "
|
|
||||||
<< nome << " " << tmp1
|
|
||||||
<< " " << tmp2 << endl;
|
|
||||||
}
|
|
||||||
insert(string(nome), false, one, two);
|
|
||||||
}
|
}
|
||||||
|
deplist[nome] = make_pair(one, two);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DepTable::write(FILE * f)
|
|
||||||
{
|
|
||||||
if (lyxerr.debugging()) {
|
|
||||||
char tmp1[255];
|
|
||||||
char tmp2[255];
|
|
||||||
sprintf(tmp1, "%lu", new_sum);
|
|
||||||
sprintf(tmp2, "%lu", old_sum);
|
|
||||||
lyxerr << "Write dep: " << file << " "
|
|
||||||
<< tmp1 << " " << tmp2 << endl;
|
|
||||||
}
|
|
||||||
fprintf(f, "%s %lu %lu\n", file.c_str(),
|
|
||||||
new_sum, old_sum);
|
|
||||||
if (next)
|
|
||||||
next->write(f);
|
|
||||||
}
|
|
||||||
|
@ -15,18 +15,19 @@
|
|||||||
#define DEP_TABLE_H
|
#define DEP_TABLE_H
|
||||||
|
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
#include <cstdio>
|
#include <map>
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma interface
|
||||||
|
#endif
|
||||||
|
|
||||||
///
|
///
|
||||||
class DepTable {
|
class DepTable {
|
||||||
public:
|
public:
|
||||||
///
|
|
||||||
DepTable();
|
|
||||||
///
|
|
||||||
/** This one is a little bit harder since we need the absolute
|
/** This one is a little bit harder since we need the absolute
|
||||||
filename. Should we insert files with .sty .cls etc as
|
filename. Should we insert files with .sty .cls etc as
|
||||||
extension? */
|
extension? */
|
||||||
void insert(string const &f,
|
void insert(string const & f,
|
||||||
bool upd = false,
|
bool upd = false,
|
||||||
unsigned long one = 0,
|
unsigned long one = 0,
|
||||||
unsigned long two = 0);
|
unsigned long two = 0);
|
||||||
@ -39,25 +40,15 @@ public:
|
|||||||
void read(string const &f);
|
void read(string const &f);
|
||||||
/// returns true if any of the files has changed
|
/// returns true if any of the files has changed
|
||||||
bool sumchange();
|
bool sumchange();
|
||||||
///
|
/// return true if fil has changed.
|
||||||
bool haschanged(string const &fil);
|
bool haschanged(string const & fil);
|
||||||
|
/// return true if a file with extension ext has changed.
|
||||||
|
bool extchanged(string const & ext);
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
DepTable(string const &f,
|
typedef map<string, pair<unsigned long, unsigned long> > DepList;
|
||||||
bool upd,
|
|
||||||
unsigned long one,
|
|
||||||
unsigned long two);
|
|
||||||
///
|
///
|
||||||
string file;
|
DepList deplist;
|
||||||
/// The files new checksum
|
|
||||||
unsigned long new_sum;
|
|
||||||
/// The files old checksum
|
|
||||||
unsigned long old_sum;
|
|
||||||
///
|
|
||||||
DepTable *next;
|
|
||||||
|
|
||||||
///
|
|
||||||
void write(FILE *f);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
423
src/LaTeX.C
423
src/LaTeX.C
@ -13,16 +13,12 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "LaTeX.h"
|
#include "LaTeX.h"
|
||||||
#include "lyxlex.h"
|
|
||||||
#include "support/FileInfo.h"
|
#include "support/FileInfo.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "support/lyxlib.h"
|
#include "support/lyxlib.h"
|
||||||
@ -33,6 +29,19 @@
|
|||||||
#include "minibuffer.h"
|
#include "minibuffer.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
|
||||||
|
// TODO: in no particular order
|
||||||
|
// - get rid of the extern BufferList and the call to
|
||||||
|
// BufferList::updateIncludedTeXfiles, this should either
|
||||||
|
// be done before calling LaTeX::funcs or in a completely
|
||||||
|
// different way.
|
||||||
|
// - the bibtex command options should be supported.
|
||||||
|
// - the makeindex style files should be taken care of with
|
||||||
|
// the dependency mechanism.
|
||||||
|
// - makeindex commandline options should be supported
|
||||||
|
// - somewhere support viewing of bibtex and makeindex log files.
|
||||||
|
// - we should perhaps also scan the bibtex log file
|
||||||
|
// - we should perhaps also scan the bibtex log file
|
||||||
|
|
||||||
extern BufferList bufferlist;
|
extern BufferList bufferlist;
|
||||||
|
|
||||||
struct texfile_struct {
|
struct texfile_struct {
|
||||||
@ -57,174 +66,18 @@ const texfile_struct all_files[] = {
|
|||||||
{ LaTeX::TEX, ".tex"}
|
{ LaTeX::TEX, ".tex"}
|
||||||
};
|
};
|
||||||
|
|
||||||
// This should perhaps be placed in LyXLex
|
|
||||||
static
|
|
||||||
string readLine(FILE *file)
|
|
||||||
{
|
|
||||||
if (feof(file))
|
|
||||||
return string();
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
char s[512];
|
|
||||||
|
|
||||||
do {
|
|
||||||
s[i] = fgetc(file);
|
|
||||||
i++;
|
|
||||||
} while (!feof(file) && s[i-1] != '\n' && i<510);
|
|
||||||
s[i] = '\0';
|
|
||||||
string tmp;
|
|
||||||
if (i == 1 && feof(file))
|
|
||||||
;
|
|
||||||
else
|
|
||||||
tmp = s;
|
|
||||||
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CLASS TEXERRORS
|
* CLASS TEXERRORS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// I did not leave this inlined because DEC cxx does not like
|
void TeXErrors::insertError(int line, string const & error_desc,
|
||||||
// variables declarations in inlined code (JMarc)
|
string const & error_text)
|
||||||
TeXErrors::~TeXErrors()
|
|
||||||
{
|
{
|
||||||
Error *tmp;
|
Error newerr(line, error_desc, error_text);
|
||||||
while (errors) {
|
errors.push_back(newerr);
|
||||||
tmp = errors->next_error;
|
|
||||||
delete errors;
|
|
||||||
errors = tmp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TeXErrors::scanError(LyXLex &lex)
|
|
||||||
{
|
|
||||||
string token = lex.GetString();
|
|
||||||
// Sometimes the error string goes over more than one
|
|
||||||
// line, and we need to get them all.
|
|
||||||
string errstr;
|
|
||||||
string tmp = frontStrip(readLine(lex.getFile()));
|
|
||||||
if (tmp == "\n" || tmp.empty()) {
|
|
||||||
tmp = frontStrip(readLine(lex.getFile()));
|
|
||||||
if (contains(tmp, "See the LaTeX manual")) {
|
|
||||||
do {
|
|
||||||
tmp = readLine(lex.getFile());
|
|
||||||
} while (!tmp.empty() && !contains(tmp, "..."));
|
|
||||||
}
|
|
||||||
tmp = frontStrip(readLine(lex.getFile()));
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((tmp != "\n" || !contains(errstr, "l."))
|
|
||||||
&& !prefixIs(tmp, "! ")
|
|
||||||
&& !contains(tmp, "(job aborted")
|
|
||||||
&& !tmp.empty()) {
|
|
||||||
errstr += tmp;
|
|
||||||
tmp = frontStrip(readLine(lex.getFile()));
|
|
||||||
}
|
|
||||||
lyxerr.debug() << "tmp: " << errstr << endl;
|
|
||||||
int line = 0;
|
|
||||||
// unfortunately the error line is not always given
|
|
||||||
// by "l.###" in the beginning of the error string
|
|
||||||
// therefore we must search for "l.###" in the error
|
|
||||||
// msg.
|
|
||||||
if (contains(errstr, "l.")) {
|
|
||||||
// We make a const copy to make [] fast. (Asger)
|
|
||||||
string const es(errstr);
|
|
||||||
for (string::size_type i = 2; i < es.length(); ++i) {
|
|
||||||
if (es[i-2] == 'l' && es[i-1] == '.' &&
|
|
||||||
(es[i] >= '0' && es[i]<= '9')) {
|
|
||||||
line = atoi(es.c_str() + i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
insertError(line, token, errstr);
|
|
||||||
|
|
||||||
if (prefixIs(tmp, "! ")) {
|
|
||||||
scanError(lex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool TeXErrors::getFirstError(int *line, string *text)
|
|
||||||
{
|
|
||||||
next_error = errors;
|
|
||||||
if (next_error) {
|
|
||||||
*line = next_error->error_in_line;
|
|
||||||
*text = next_error->error_desc + "\n" + next_error->error_text;
|
|
||||||
next_error = next_error->next_error;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool TeXErrors::getNextError(int *line, string *text)
|
|
||||||
{
|
|
||||||
if (next_error) {
|
|
||||||
*line = next_error->error_in_line;
|
|
||||||
*text = next_error->error_desc + "\n" + next_error->error_text;
|
|
||||||
next_error = next_error->next_error;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void TeXErrors::insertError(int line, string const &error_desc,
|
|
||||||
string const &error_text)
|
|
||||||
{
|
|
||||||
Error *newerr = new Error(line, error_desc, error_text);
|
|
||||||
if (errors) {
|
|
||||||
Error *tmperr = errors;
|
|
||||||
while (tmperr->next_error) tmperr = tmperr->next_error;
|
|
||||||
tmperr->next_error = newerr;
|
|
||||||
} else {
|
|
||||||
errors = newerr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void TeXErrors::printErrors()
|
|
||||||
{
|
|
||||||
lyxerr << "Printing errors." << endl;
|
|
||||||
if (errors) {
|
|
||||||
Error *tmperr = errors;
|
|
||||||
do {
|
|
||||||
lyxerr << "Error in line "
|
|
||||||
<< tmperr->error_in_line
|
|
||||||
<< ": " << tmperr->error_desc
|
|
||||||
<< '\n' << tmperr->error_text << endl;
|
|
||||||
tmperr = tmperr->next_error;
|
|
||||||
} while (tmperr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void TeXErrors::printWarnings()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void TeXErrors::printStatus()
|
|
||||||
{
|
|
||||||
lyxerr << "Error struct:"
|
|
||||||
<< "\n status: " << status
|
|
||||||
<< "\n no err: " << number_of_errors << endl;
|
|
||||||
if (status == LaTeX::NO_ERRORS) lyxerr << "NO_ERRORS" << endl;
|
|
||||||
if (status & LaTeX::NO_LOGFILE) lyxerr << "NO_LOGFILE" << endl;
|
|
||||||
if (status & LaTeX::NO_OUTPUT) lyxerr << "NO_OUTPUT" << endl;
|
|
||||||
if (status & LaTeX::UNDEF_REF) lyxerr << "UNDEF_REF" << endl;
|
|
||||||
if (status & LaTeX::RERUN) lyxerr << "RERUN" << endl;
|
|
||||||
if (status & LaTeX::TEX_ERROR) lyxerr << "TEX_ERROR" << endl;
|
|
||||||
if (status & LaTeX::TEX_WARNING) lyxerr << "TEX_WARNING" << endl;
|
|
||||||
if (status & LaTeX::NO_FILE) lyxerr << "NO_FILE" << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CLASS LaTeX
|
* CLASS LaTeX
|
||||||
*/
|
*/
|
||||||
@ -239,7 +92,7 @@ LaTeX::LaTeX(string const & latex, string const & f, string const & p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
|
int LaTeX::run(TeXErrors & terr, MiniBuffer * minib)
|
||||||
// We know that this function will only be run if the lyx buffer
|
// We know that this function will only be run if the lyx buffer
|
||||||
// has been changed. We also know that a newly written .tex file
|
// has been changed. We also know that a newly written .tex file
|
||||||
// is always different from the previous one because of the date
|
// is always different from the previous one because of the date
|
||||||
@ -274,6 +127,7 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
|
|||||||
// remake the dependency file.
|
// remake the dependency file.
|
||||||
//
|
//
|
||||||
FileInfo fi(depfile);
|
FileInfo fi(depfile);
|
||||||
|
bool run_bibtex = false;
|
||||||
if (fi.exist()) {
|
if (fi.exist()) {
|
||||||
// Read the dep file:
|
// Read the dep file:
|
||||||
head.read(depfile);
|
head.read(depfile);
|
||||||
@ -283,6 +137,8 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
|
|||||||
lyxerr[Debug::LATEX] << "Dependency file exists" << endl;
|
lyxerr[Debug::LATEX] << "Dependency file exists" << endl;
|
||||||
if (head.sumchange()) {
|
if (head.sumchange()) {
|
||||||
++count;
|
++count;
|
||||||
|
if (head.extchanged(".bib")
|
||||||
|
|| head.extchanged(".bst")) run_bibtex = true;
|
||||||
lyxerr[Debug::LATEX]
|
lyxerr[Debug::LATEX]
|
||||||
<< "Dependency file has changed\n"
|
<< "Dependency file has changed\n"
|
||||||
<< "Run #" << count << endl;
|
<< "Run #" << count << endl;
|
||||||
@ -322,20 +178,24 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
|
|||||||
// run makeindex
|
// run makeindex
|
||||||
if (head.haschanged(ChangeExtension(file, ".idx", true))) {
|
if (head.haschanged(ChangeExtension(file, ".idx", true))) {
|
||||||
// no checks for now
|
// no checks for now
|
||||||
|
lyxerr[Debug::LATEX] << "Running MakeIndex." << endl;
|
||||||
minib->Set(_("Running MakeIndex."));
|
minib->Set(_("Running MakeIndex."));
|
||||||
minib->Store();
|
minib->Store();
|
||||||
rerun=runMakeIndex(ChangeExtension(file,".idx",true));
|
rerun=runMakeIndex(ChangeExtension(file,".idx",true));
|
||||||
}
|
}
|
||||||
|
|
||||||
// run bibtex
|
// run bibtex
|
||||||
if (scanres & LaTeX::UNDEF_CIT || scanres & LaTeX::RERUN) {
|
if (scanres & LaTeX::UNDEF_CIT
|
||||||
|
|| scanres & LaTeX::RERUN
|
||||||
|
|| run_bibtex) {
|
||||||
// Here we must scan the .aux file and look for
|
// Here we must scan the .aux file and look for
|
||||||
// "\bibdata" and/or "\bibstyle". If one of those
|
// "\bibdata" and/or "\bibstyle". If one of those
|
||||||
// tags is found -> run bibtex and set rerun = true;
|
// tags is found -> run bibtex and set rerun = true;
|
||||||
// no checks for now
|
// no checks for now
|
||||||
|
lyxerr[Debug::LATEX] << "Running BibTeX." << endl;
|
||||||
minib->Set(_("Running BibTeX."));
|
minib->Set(_("Running BibTeX."));
|
||||||
minib->Store();
|
minib->Store();
|
||||||
rerun = runBibTeX(ChangeExtension(file, ".aux", true));
|
rerun = runBibTeX(ChangeExtension(file, ".aux", true), head);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1
|
// 1
|
||||||
@ -379,6 +239,7 @@ int LaTeX::run(TeXErrors &terr, MiniBuffer *minib)
|
|||||||
// run makeindex if the <file>.idx has changed or was generated.
|
// run makeindex if the <file>.idx has changed or was generated.
|
||||||
if (head.haschanged(ChangeExtension(file, ".idx", true))) {
|
if (head.haschanged(ChangeExtension(file, ".idx", true))) {
|
||||||
// no checks for now
|
// no checks for now
|
||||||
|
lyxerr[Debug::LATEX] << "Running MakeIndex." << endl;
|
||||||
minib->Set(_("Running MakeIndex."));
|
minib->Set(_("Running MakeIndex."));
|
||||||
minib->Store();
|
minib->Store();
|
||||||
rerun = runMakeIndex(ChangeExtension(file, ".idx", true));
|
rerun = runMakeIndex(ChangeExtension(file, ".idx", true));
|
||||||
@ -447,58 +308,123 @@ bool LaTeX::runMakeIndex(string const &file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LaTeX::runBibTeX(string const &file)
|
typedef pair<int, string> cmdret;
|
||||||
|
static cmdret do_popen(string const & cmd)
|
||||||
{
|
{
|
||||||
LyXLex lex(0, 0);
|
// One question is if we should use popen or
|
||||||
string token;
|
// create our own popen based on fork,exec,pipe
|
||||||
if (!lex.setFile(file)) {
|
// of course the best would be to have a
|
||||||
// unable to open .aux file
|
// pstream (process stream), with the
|
||||||
// return at once
|
// variants ipstream, opstream and
|
||||||
return false;
|
FILE * inf = popen(cmd.c_str(), "r");
|
||||||
|
string ret;
|
||||||
|
int c = fgetc(inf);
|
||||||
|
while (c != EOF) {
|
||||||
|
ret += static_cast<char>(c);
|
||||||
|
c = fgetc(inf);
|
||||||
}
|
}
|
||||||
|
int pret = pclose(inf);
|
||||||
|
return make_pair(pret, ret);
|
||||||
|
}
|
||||||
|
|
||||||
while (lex.IsOK()) {
|
|
||||||
if (lex.EatLine())
|
|
||||||
token=lex.GetString();
|
|
||||||
else // blank line in the file being read
|
|
||||||
continue;
|
|
||||||
|
|
||||||
|
static string findtexfile(string const & fil, string const & format)
|
||||||
|
{
|
||||||
|
// If fil is a file with absolute path we just return it
|
||||||
|
if (AbsolutePath(fil)) return fil;
|
||||||
|
|
||||||
|
// Check in the current dir.
|
||||||
|
if (FileInfo(OnlyFilename(fil)).exist())
|
||||||
|
return OnlyFilename(fil);
|
||||||
|
|
||||||
|
// No we try to find it using kpsewhich.
|
||||||
|
string kpsecmd = "kpsewhich --format=" + format + " " + fil;
|
||||||
|
cmdret c = do_popen(kpsecmd);
|
||||||
|
|
||||||
|
lyxerr << "kpse status = " << c.first << "\n"
|
||||||
|
<< "kpse result = `" << strip(c.second, '\n') << "'" << endl;
|
||||||
|
return c.first == 0 ? strip(c.second, '\n') : string();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool LaTeX::runBibTeX(string const & file, DepTable & dep)
|
||||||
|
{
|
||||||
|
ifstream ifs(file.c_str());
|
||||||
|
string token;
|
||||||
|
bool using_bibtex = false;
|
||||||
|
while (getline(ifs, token)) {
|
||||||
if (contains(token, "\\bibdata{")) {
|
if (contains(token, "\\bibdata{")) {
|
||||||
|
using_bibtex = true;
|
||||||
|
string::size_type a = token.find("\\bibdata{") + 9;
|
||||||
|
string::size_type b = token.find_first_of("}", a);
|
||||||
|
string data = token.substr(a, b - a);
|
||||||
|
// data is now all the bib files separated by ','
|
||||||
|
// get them one by one and pass them to the helper
|
||||||
|
do {
|
||||||
|
b = data.find_first_of(',', 0);
|
||||||
|
string l;
|
||||||
|
if (b == string::npos)
|
||||||
|
l = data;
|
||||||
|
else {
|
||||||
|
l = data.substr(0, b - 0);
|
||||||
|
data.erase(0, b + 1);
|
||||||
|
}
|
||||||
|
string full_l =
|
||||||
|
findtexfile(
|
||||||
|
ChangeExtension(l,"bib",false),
|
||||||
|
"bib");
|
||||||
|
lyxerr << "data = `"
|
||||||
|
<< full_l << "'" << endl;
|
||||||
|
if (!full_l.empty()) {
|
||||||
|
// add full_l to the dep file.
|
||||||
|
dep.insert(full_l, true);
|
||||||
|
}
|
||||||
|
} while (b != string::npos);
|
||||||
|
} else if (contains(token, "\\bibstyle{")) {
|
||||||
|
using_bibtex = true;
|
||||||
|
string::size_type a = token.find("\\bibstyle{") + 10;
|
||||||
|
string::size_type b = token.find_first_of("}", a);
|
||||||
|
string style = token.substr(a, b - a);
|
||||||
|
// token is now the style file
|
||||||
|
// pass it to the helper
|
||||||
|
string full_l =
|
||||||
|
findtexfile(
|
||||||
|
ChangeExtension(style, "bst", false),
|
||||||
|
"bst");
|
||||||
|
lyxerr << "style = `"
|
||||||
|
<< full_l << "'" << endl;
|
||||||
|
if (!full_l.empty()) {
|
||||||
|
// add full_l to the dep file.
|
||||||
|
dep.insert(full_l, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (using_bibtex) {
|
||||||
// run bibtex and
|
// run bibtex and
|
||||||
string tmp="bibtex ";
|
string tmp= "bibtex ";
|
||||||
tmp += ChangeExtension(file, string(), true);
|
tmp += ChangeExtension(file, string(), true);
|
||||||
Systemcalls one;
|
Systemcalls one;
|
||||||
one.startscript(Systemcalls::System, tmp);
|
one.startscript(Systemcalls::System, tmp);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
// bibtex was not run.
|
// bibtex was not run.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int LaTeX::scanLogFile(TeXErrors &terr)
|
int LaTeX::scanLogFile(TeXErrors & terr)
|
||||||
{
|
{
|
||||||
int retval = NO_ERRORS;
|
int retval = NO_ERRORS;
|
||||||
string tmp = ChangeExtension(file, ".log", true);
|
string tmp = ChangeExtension(file, ".log", true);
|
||||||
|
lyxerr[Debug::LATEX] << "Log file: " << tmp << endl;
|
||||||
LyXLex lex(0, 0);
|
ifstream ifs(tmp.c_str());
|
||||||
if (!lex.setFile(tmp)) {
|
|
||||||
// unable to open file
|
|
||||||
// return at once
|
|
||||||
retval |= NO_LOGFILE;
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
string token;
|
string token;
|
||||||
while (lex.IsOK()) {
|
while (getline(ifs, token)) {
|
||||||
if (lex.EatLine())
|
lyxerr[Debug::LATEX] << "Log line: " << token << endl;
|
||||||
token = lex.GetString();
|
|
||||||
else // blank line in the file being read
|
|
||||||
continue;
|
|
||||||
|
|
||||||
lyxerr[Debug::LATEX] << token << endl;
|
if (token.empty())
|
||||||
|
continue;
|
||||||
|
|
||||||
if (prefixIs(token, "LaTeX Warning:")) {
|
if (prefixIs(token, "LaTeX Warning:")) {
|
||||||
// Here shall we handle different
|
// Here shall we handle different
|
||||||
@ -528,56 +454,42 @@ int LaTeX::scanLogFile(TeXErrors &terr)
|
|||||||
// at least longtable.sty might use this.
|
// at least longtable.sty might use this.
|
||||||
retval |= RERUN;
|
retval |= RERUN;
|
||||||
}
|
}
|
||||||
} else if (prefixIs(token, "! LaTeX Error:")) {
|
|
||||||
// Here shall we handle different
|
|
||||||
// types of errors
|
|
||||||
retval |= LATEX_ERROR;
|
|
||||||
lyxerr[Debug::LATEX] << "LaTeX Error." << endl;
|
|
||||||
// this is not correct yet
|
|
||||||
terr.scanError(lex);
|
|
||||||
num_errors++;
|
|
||||||
} else if (prefixIs(token, "! ")) {
|
} else if (prefixIs(token, "! ")) {
|
||||||
// Ok, we have something that looks like a TeX Error
|
// Ok, we have something that looks like a TeX Error
|
||||||
// but what do we really have.
|
// but what do we really have.
|
||||||
|
|
||||||
// Just get the error description:
|
// Just get the error description:
|
||||||
string desc(token);
|
string desc(token, 2);
|
||||||
desc.erase(0, 2);
|
if (contains(token, "LaTeX Error:"))
|
||||||
|
retval |= LATEX_ERROR;
|
||||||
if (contains(desc, "Undefined control sequence")) {
|
|
||||||
retval |= TEX_ERROR;
|
|
||||||
lyxerr[Debug::LATEX] << "TeX Error." << endl;
|
|
||||||
terr.scanError(lex);
|
|
||||||
num_errors++;
|
|
||||||
} else {
|
|
||||||
// get the next line
|
// get the next line
|
||||||
lex.next();
|
string tmp;
|
||||||
string tmp = lex.GetString();
|
getline(ifs, tmp);
|
||||||
if (prefixIs(tmp, "l.")) {
|
if (prefixIs(tmp, "l.")) {
|
||||||
// we have a latex error
|
// we have a latex error
|
||||||
retval |= TEX_ERROR;
|
retval |= TEX_ERROR;
|
||||||
lyxerr[Debug::LATEX]
|
|
||||||
<<"TeX Error." << endl;
|
|
||||||
// get the line number:
|
// get the line number:
|
||||||
int line = 0;
|
int line = 0;
|
||||||
sscanf(tmp.c_str(), "l.%d", &line);
|
sscanf(tmp.c_str(), "l.%d", &line);
|
||||||
// get the rest of the message:
|
// get the rest of the message:
|
||||||
string errstr;
|
string errstr(tmp, tmp.find(' '));
|
||||||
lex.EatLine();
|
errstr += '\n';
|
||||||
tmp = lex.GetString();
|
getline(ifs, tmp);
|
||||||
while ((tmp != "\n" || !contains(errstr, "l."))
|
while (!contains(errstr, "l.")
|
||||||
|
&& !tmp.empty()
|
||||||
&& !prefixIs(tmp, "! ")
|
&& !prefixIs(tmp, "! ")
|
||||||
&& !contains(tmp, "(job aborted")
|
&& !contains(tmp, "(job aborted")) {
|
||||||
&& !tmp.empty()) {
|
|
||||||
errstr += tmp;
|
errstr += tmp;
|
||||||
errstr += "\n";
|
errstr += "\n";
|
||||||
lex.EatLine();
|
getline(ifs, tmp);
|
||||||
tmp = lex.GetString();
|
|
||||||
}
|
}
|
||||||
|
lyxerr[Debug::LATEX]
|
||||||
|
<< "line: " << line << '\n'
|
||||||
|
<< "Desc: " << desc << '\n'
|
||||||
|
<< "Text: " << errstr << endl;
|
||||||
terr.insertError(line, desc, errstr);
|
terr.insertError(line, desc, errstr);
|
||||||
num_errors++;
|
num_errors++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// information messages, TeX warnings and other
|
// information messages, TeX warnings and other
|
||||||
// warnings we have not caught earlier.
|
// warnings we have not caught earlier.
|
||||||
@ -597,6 +509,7 @@ int LaTeX::scanLogFile(TeXErrors &terr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
lyxerr[Debug::LATEX] << "Log line: " << token << endl;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,33 +521,28 @@ void LaTeX::deplog(DepTable & head)
|
|||||||
// dependency file.
|
// dependency file.
|
||||||
|
|
||||||
string logfile = ChangeExtension(file, ".log", true);
|
string logfile = ChangeExtension(file, ".log", true);
|
||||||
FilePtr in(logfile, FilePtr::read);
|
|
||||||
bool not_eof = true;
|
ifstream ifs(logfile.c_str());
|
||||||
if (in()) while (not_eof) { // We were able to open the file
|
while (ifs) {
|
||||||
// Now we read chars until we find a '('
|
// Now we read chars until we find a '('
|
||||||
int c;
|
char c = 0;
|
||||||
do {
|
while(ifs.get(c)) {
|
||||||
c = fgetc(in());
|
if (c == '(') break;
|
||||||
} while (c != EOF && c != '(');
|
};
|
||||||
if (c == EOF) {
|
if (!ifs) break;
|
||||||
// Nothing more we can do
|
|
||||||
not_eof = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// We now have c == '(', we now read the the sequence of
|
// We now have c == '(', we now read the the sequence of
|
||||||
// chars until reaching EOL, or ' ' and put that into a string.
|
// chars until reaching EOL, ' ' or ')' and put that
|
||||||
|
// into a string.
|
||||||
string foundfile;
|
string foundfile;
|
||||||
c = fgetc(in());
|
while (ifs.get(c)) {
|
||||||
while (c != '\n' && c != ' ' && c != ')') {
|
if (c == '\n' || c == ' ' || c == ')')
|
||||||
foundfile += char(c);
|
break;
|
||||||
c = fgetc(in());
|
foundfile += c;
|
||||||
}
|
}
|
||||||
if (foundfile.empty()) continue;
|
|
||||||
|
|
||||||
lyxerr[Debug::LATEX] << "Found file: "
|
lyxerr[Debug::LATEX] << "Found file: "
|
||||||
<< foundfile << endl;
|
<< foundfile << endl;
|
||||||
|
|
||||||
// Ok now we found a file.
|
// Ok now we found a file.
|
||||||
// Now we should make sure that
|
// Now we should make sure that
|
||||||
// this is a file that we can
|
// this is a file that we can
|
||||||
@ -677,23 +585,6 @@ void LaTeX::deplog(DepTable & head)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (3) the foundfile can be
|
|
||||||
// found in the same dir
|
|
||||||
// as the .lyx file and
|
|
||||||
// should be inserted.
|
|
||||||
Path p(path);
|
|
||||||
if (FileInfo(foundfile).exist()) {
|
|
||||||
lyxerr << "LyX Strange: this should actually never"
|
|
||||||
" happen anymore, this it should be"
|
|
||||||
" handled by the Absolute check."
|
|
||||||
<< endl;
|
|
||||||
lyxerr[Debug::LATEX] << "Same Directory file: "
|
|
||||||
<< foundfile << endl;
|
|
||||||
head.insert(foundfile);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
lyxerr[Debug::LATEX]
|
lyxerr[Debug::LATEX]
|
||||||
<< "Not a file or we are unable to find it."
|
<< "Not a file or we are unable to find it."
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -701,12 +592,12 @@ void LaTeX::deplog(DepTable & head)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LaTeX::deptex(DepTable &head)
|
void LaTeX::deptex(DepTable & head)
|
||||||
{
|
{
|
||||||
int except = AUX|LOG|DVI|BBL|IND|GLO;
|
int except = AUX|LOG|DVI|BBL|IND|GLO;
|
||||||
string tmp;
|
string tmp;
|
||||||
FileInfo fi;
|
FileInfo fi;
|
||||||
for (int i = 0; i < file_count; i++) {
|
for (int i = 0; i < file_count; ++i) {
|
||||||
if (!(all_files[i].file & except)) {
|
if (!(all_files[i].file & except)) {
|
||||||
tmp = ChangeExtension(file,
|
tmp = ChangeExtension(file,
|
||||||
all_files[i].extension,
|
all_files[i].extension,
|
||||||
|
87
src/LaTeX.h
87
src/LaTeX.h
@ -21,65 +21,23 @@
|
|||||||
|
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
#include "DepTable.h"
|
#include "DepTable.h"
|
||||||
|
#include <vector>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
class LyXLex;
|
|
||||||
class MiniBuffer;
|
class MiniBuffer;
|
||||||
|
|
||||||
///
|
///
|
||||||
class TeXErrors {
|
class TeXErrors {
|
||||||
public:
|
|
||||||
///
|
|
||||||
TeXErrors() {
|
|
||||||
errors = 0;
|
|
||||||
next_error = 0;
|
|
||||||
status = 0;
|
|
||||||
number_of_errors = 0;
|
|
||||||
}
|
|
||||||
///
|
|
||||||
~TeXErrors();
|
|
||||||
///
|
|
||||||
void scanError(LyXLex &);
|
|
||||||
///
|
|
||||||
bool getFirstError(int *line, string *text);
|
|
||||||
///
|
|
||||||
bool getNextError(int *line, string *text);
|
|
||||||
///
|
|
||||||
void insertError(int line, string const &error_desc,
|
|
||||||
string const &error_text);
|
|
||||||
///
|
|
||||||
void printErrors();
|
|
||||||
///
|
|
||||||
void printWarnings();
|
|
||||||
///
|
|
||||||
void printStatus();
|
|
||||||
///
|
|
||||||
int getStatus() { return status; }
|
|
||||||
private:
|
private:
|
||||||
///
|
|
||||||
friend class LaTeX;
|
|
||||||
///
|
|
||||||
int status;
|
|
||||||
///
|
|
||||||
int number_of_errors;
|
|
||||||
///
|
///
|
||||||
struct Error {
|
struct Error {
|
||||||
///
|
///
|
||||||
Error () {
|
Error () : error_in_line(0) {}
|
||||||
next_error = 0;
|
|
||||||
error_in_line = 0;
|
|
||||||
}
|
|
||||||
///
|
///
|
||||||
Error(int line, string const &desc, string const &text) {
|
Error(int line, string const & desc, string const & text)
|
||||||
next_error = 0;
|
: error_in_line(line),
|
||||||
error_in_line = line;
|
error_desc(desc),
|
||||||
error_desc = desc;
|
error_text(text) {}
|
||||||
error_text = text;
|
|
||||||
}
|
|
||||||
///
|
|
||||||
~Error() {
|
|
||||||
}
|
|
||||||
///
|
|
||||||
Error *next_error;
|
|
||||||
/// what line in the TeX file the error occured in
|
/// what line in the TeX file the error occured in
|
||||||
int error_in_line;
|
int error_in_line;
|
||||||
/// The kind of error
|
/// The kind of error
|
||||||
@ -87,10 +45,19 @@ private:
|
|||||||
/// The line/cmd that caused the error.
|
/// The line/cmd that caused the error.
|
||||||
string error_text;
|
string error_text;
|
||||||
};
|
};
|
||||||
|
public:
|
||||||
///
|
///
|
||||||
Error *errors;
|
typedef vector<Error> Errors;
|
||||||
///
|
///
|
||||||
Error *next_error;
|
Errors::const_iterator begin() const { return errors.begin(); }
|
||||||
|
///
|
||||||
|
Errors::const_iterator end() const { return errors.end(); }
|
||||||
|
///
|
||||||
|
void insertError(int line, string const & error_desc,
|
||||||
|
string const & error_text);
|
||||||
|
private:
|
||||||
|
///
|
||||||
|
Errors errors;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -189,19 +156,13 @@ public:
|
|||||||
/// use this for running LaTeX once
|
/// use this for running LaTeX once
|
||||||
int operator() ();
|
int operator() ();
|
||||||
protected:
|
protected:
|
||||||
/** The dependency file.
|
/// The dependency file.
|
||||||
|
|
||||||
We store the file dependencies in this file.
|
|
||||||
the depency file is on the format:
|
|
||||||
<file> <new checksum> <old checksum>
|
|
||||||
*/
|
|
||||||
string depfile;
|
string depfile;
|
||||||
|
|
||||||
///
|
/// unavail
|
||||||
LaTeX() {}
|
LaTeX(LaTeX const &);
|
||||||
|
/// unavail
|
||||||
///
|
LaTeX & operator=(LaTeX const &);
|
||||||
LaTeX(LaTeX const &) {}
|
|
||||||
|
|
||||||
///
|
///
|
||||||
void deplog(DepTable & head);
|
void deplog(DepTable & head);
|
||||||
@ -216,7 +177,7 @@ protected:
|
|||||||
bool runMakeIndex(string const &);
|
bool runMakeIndex(string const &);
|
||||||
|
|
||||||
///
|
///
|
||||||
bool runBibTeX(string const &);
|
bool runBibTeX(string const &, DepTable &);
|
||||||
|
|
||||||
///
|
///
|
||||||
string cmd;
|
string cmd;
|
||||||
|
@ -77,7 +77,7 @@ LaTeXFeatures::LaTeXFeatures(int n)
|
|||||||
string LaTeXFeatures::getPackages(BufferParams const ¶ms)
|
string LaTeXFeatures::getPackages(BufferParams const ¶ms)
|
||||||
{
|
{
|
||||||
string packages;
|
string packages;
|
||||||
LyXTextClass *tclass = lyxstyle.TextClass(params.textclass);
|
LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
|
||||||
|
|
||||||
// color.sty
|
// color.sty
|
||||||
if (color) {
|
if (color) {
|
||||||
@ -90,7 +90,7 @@ string LaTeXFeatures::getPackages(BufferParams const ¶ms)
|
|||||||
|
|
||||||
// makeidx.sty
|
// makeidx.sty
|
||||||
if (makeidx) {
|
if (makeidx) {
|
||||||
if (! tclass->provides_makeidx
|
if (! tclass.provides(LyXTextClass::makeidx)
|
||||||
&& params.language != "french") // french provides
|
&& params.language != "french") // french provides
|
||||||
// \index !
|
// \index !
|
||||||
packages += "\\usepackage{makeidx}\n";
|
packages += "\\usepackage{makeidx}\n";
|
||||||
@ -167,7 +167,7 @@ string LaTeXFeatures::getPackages(BufferParams const ¶ms)
|
|||||||
packages += "\\usepackage{floatflt}\n";
|
packages += "\\usepackage{floatflt}\n";
|
||||||
|
|
||||||
// url.sty
|
// url.sty
|
||||||
if (url && ! tclass->provides_url)
|
if (url && ! tclass.provides(LyXTextClass::url))
|
||||||
packages += "\\IfFileExists{url.sty}{\\usepackage{url}}\n"
|
packages += "\\IfFileExists{url.sty}{\\usepackage{url}}\n"
|
||||||
" {\\newcommand{\\url}{\\texttt}}\n";
|
" {\\newcommand{\\url}{\\texttt}}\n";
|
||||||
|
|
||||||
@ -226,24 +226,22 @@ string LaTeXFeatures::getMacros(BufferParams const & /* params */)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string LaTeXFeatures::getTClassPreamble(BufferParams const ¶ms)
|
string LaTeXFeatures::getTClassPreamble(BufferParams const & params)
|
||||||
{
|
{
|
||||||
// the text class specific preamble
|
// the text class specific preamble
|
||||||
LyXTextClass *tclass = lyxstyle.TextClass(params.textclass);
|
LyXTextClass const & tclass = textclasslist.TextClass(params.textclass);
|
||||||
string tcpreamble = tclass->preamble;
|
string tcpreamble = tclass.preamble();
|
||||||
|
|
||||||
int l;
|
for (LyXTextClass::LayoutList::const_iterator cit = tclass.begin();
|
||||||
for (l = 0 ; l < tclass->number_of_defined_layouts ; l++) {
|
cit != tclass.end(); ++cit) {
|
||||||
if (layout[l]
|
tcpreamble += (*cit).preamble();
|
||||||
&& !tclass->style[l].preamble.empty())
|
|
||||||
tcpreamble += tclass->style[l].preamble;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tcpreamble;
|
return tcpreamble;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LaTeXFeatures::showStruct(BufferParams ¶ms) {
|
void LaTeXFeatures::showStruct(BufferParams & params) {
|
||||||
lyxerr << "LyX needs the following commands when LaTeXing:"
|
lyxerr << "LyX needs the following commands when LaTeXing:"
|
||||||
// packs
|
// packs
|
||||||
<< "\n***** Packages:" << getPackages(params)
|
<< "\n***** Packages:" << getPackages(params)
|
||||||
|
@ -10,9 +10,6 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstdlib>
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
@ -20,7 +17,6 @@
|
|||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "LaTeX.h"
|
#include "LaTeX.h"
|
||||||
#include "Literate.h"
|
#include "Literate.h"
|
||||||
#include "lyxlex.h"
|
|
||||||
#include "support/FileInfo.h"
|
#include "support/FileInfo.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "support/lyxlib.h"
|
#include "support/lyxlib.h"
|
||||||
@ -37,15 +33,14 @@ Literate::Literate(string const & latex, string const & f, string const & p,
|
|||||||
string const & l,
|
string const & l,
|
||||||
string const & literate, string const & literate_f,
|
string const & literate, string const & literate_f,
|
||||||
string const & build, string const & build_f)
|
string const & build, string const & build_f)
|
||||||
: LaTeX (latex, f, p),
|
: LaTeX(latex, f, p),
|
||||||
litfile(l),
|
litfile(l),
|
||||||
literate_cmd(literate), literate_filter(literate_f),
|
literate_cmd(literate), literate_filter(literate_f),
|
||||||
build_cmd(build), build_filter(build_f)
|
build_cmd(build), build_filter(build_f)
|
||||||
{
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int Literate::weave(TeXErrors &terr, MiniBuffer *minib)
|
int Literate::weave(TeXErrors & terr, MiniBuffer * minib)
|
||||||
{
|
{
|
||||||
int scanres = Literate::NO_ERRORS;
|
int scanres = Literate::NO_ERRORS;
|
||||||
string tmp1, tmp2;
|
string tmp1, tmp2;
|
||||||
@ -66,21 +61,18 @@ int Literate::weave(TeXErrors &terr, MiniBuffer *minib)
|
|||||||
ret1 = one.startscript(Systemcalls::System, tmp1);
|
ret1 = one.startscript(Systemcalls::System, tmp1);
|
||||||
ret2 = two.startscript(Systemcalls::System, tmp2);
|
ret2 = two.startscript(Systemcalls::System, tmp2);
|
||||||
lyxerr.debug() << "LITERATE {" << tmp1 << "} {" << tmp2 << "}" << endl;
|
lyxerr.debug() << "LITERATE {" << tmp1 << "} {" << tmp2 << "}" << endl;
|
||||||
scanres = scanLiterateLogFile(terr);
|
scanres = scanLiterateLogFile();
|
||||||
if (scanres & Literate::ERRORS) return scanres; // return on literate error
|
if (scanres & Literate::ERRORS) return scanres; // return on literate error
|
||||||
|
|
||||||
return run(terr, minib);
|
return run(terr, minib);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Literate::build(TeXErrors &terr, MiniBuffer *minib)
|
int Literate::build(TeXErrors & terr, MiniBuffer * minib)
|
||||||
// We know that this function will only be run if the lyx buffer
|
// We know that this function will only be run if the lyx buffer
|
||||||
// has been changed.
|
// has been changed.
|
||||||
{
|
{
|
||||||
int scanres = Literate::NO_ERRORS;
|
int scanres = Literate::NO_ERRORS;
|
||||||
num_errors = 0; // just to make sure.
|
num_errors = 0; // just to make sure.
|
||||||
// DepTable head; // empty head // unused
|
|
||||||
// bool rerun = false; // rerun requested // unused
|
|
||||||
string tmp1, tmp2;
|
string tmp1, tmp2;
|
||||||
int ret1, ret2;
|
int ret1, ret2;
|
||||||
Systemcalls one, two;
|
Systemcalls one, two;
|
||||||
@ -98,35 +90,22 @@ int Literate::build(TeXErrors &terr, MiniBuffer *minib)
|
|||||||
tmp2 = build_filter + " < " + litfile + ".out" + " > " + litfile + ".log";
|
tmp2 = build_filter + " < " + litfile + ".out" + " > " + litfile + ".log";
|
||||||
ret1 = one.startscript(Systemcalls::System, tmp1);
|
ret1 = one.startscript(Systemcalls::System, tmp1);
|
||||||
ret2 = two.startscript(Systemcalls::System, tmp2);
|
ret2 = two.startscript(Systemcalls::System, tmp2);
|
||||||
scanres = scanBuildLogFile(terr);
|
scanres = scanBuildLogFile();
|
||||||
lyxerr[Debug::LATEX] << "Done." << endl;
|
lyxerr[Debug::LATEX] << "Done." << endl;
|
||||||
|
|
||||||
return scanres;
|
return scanres;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Literate::scanLiterateLogFile(TeXErrors &terr)
|
int Literate::scanLiterateLogFile()
|
||||||
{
|
{
|
||||||
string token;
|
string token;
|
||||||
int retval = NO_ERRORS;
|
int retval = NO_ERRORS;
|
||||||
|
|
||||||
LyXLex lex(0, 0);
|
|
||||||
|
|
||||||
string tmp = litfile + ".log";
|
string tmp = litfile + ".log";
|
||||||
|
|
||||||
if (!lex.setFile(tmp)) {
|
ifstream ifs(tmp.c_str());
|
||||||
// unable to open file
|
while (getline(ifs, token)) {
|
||||||
// return at once
|
|
||||||
retval |= NO_LOGFILE;
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (lex.IsOK()) {
|
|
||||||
if (lex.EatLine())
|
|
||||||
token = lex.GetString();
|
|
||||||
else // blank line in the file being read
|
|
||||||
continue;
|
|
||||||
|
|
||||||
lyxerr[Debug::LATEX] << token << endl;
|
lyxerr[Debug::LATEX] << token << endl;
|
||||||
|
|
||||||
if (prefixIs(token, "Build Warning:")) {
|
if (prefixIs(token, "Build Warning:")) {
|
||||||
@ -140,7 +119,6 @@ int Literate::scanLiterateLogFile(TeXErrors &terr)
|
|||||||
retval |= LATEX_ERROR;
|
retval |= LATEX_ERROR;
|
||||||
lyxerr[Debug::LATEX] << "Build Error." << endl;
|
lyxerr[Debug::LATEX] << "Build Error." << endl;
|
||||||
// this is not correct yet
|
// this is not correct yet
|
||||||
terr.scanError(lex);
|
|
||||||
num_errors++;
|
num_errors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -148,28 +126,15 @@ int Literate::scanLiterateLogFile(TeXErrors &terr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Literate::scanBuildLogFile(TeXErrors &terr)
|
int Literate::scanBuildLogFile()
|
||||||
{
|
{
|
||||||
string token;
|
string token;
|
||||||
int retval = NO_ERRORS;
|
int retval = NO_ERRORS;
|
||||||
|
|
||||||
LyXLex lex(0, 0);
|
|
||||||
|
|
||||||
string tmp = litfile + ".log";
|
string tmp = litfile + ".log";
|
||||||
|
|
||||||
if (!lex.setFile(tmp)) {
|
ifstream ifs(tmp.c_str());
|
||||||
// unable to open file
|
while (getline(ifs, token)) {
|
||||||
// return at once
|
|
||||||
retval |= NO_LOGFILE;
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (lex.IsOK()) {
|
|
||||||
if (lex.EatLine())
|
|
||||||
token = lex.GetString();
|
|
||||||
else // blank line in the file being read
|
|
||||||
continue;
|
|
||||||
|
|
||||||
lyxerr[Debug::LATEX] << token << endl;
|
lyxerr[Debug::LATEX] << token << endl;
|
||||||
|
|
||||||
if (prefixIs(token, "Build Warning:")) {
|
if (prefixIs(token, "Build Warning:")) {
|
||||||
@ -183,11 +148,8 @@ int Literate::scanBuildLogFile(TeXErrors &terr)
|
|||||||
retval |= LATEX_ERROR;
|
retval |= LATEX_ERROR;
|
||||||
lyxerr[Debug::LATEX] << "Build Error." << endl;
|
lyxerr[Debug::LATEX] << "Build Error." << endl;
|
||||||
// this is not correct yet
|
// this is not correct yet
|
||||||
terr.scanError(lex);
|
|
||||||
num_errors++;
|
num_errors++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,24 +5,20 @@
|
|||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright (C) 1995 Matthias Ettrich
|
||||||
*
|
*
|
||||||
* This file is Copyright (C) 1996-1998
|
|
||||||
* Lars Gullik Bjønnes
|
|
||||||
*
|
|
||||||
*======================================================
|
*======================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LITERATE_H
|
#ifndef LITERATE_H
|
||||||
#define _LITERATE_H
|
#define LITERATE_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "LString.h"
|
class MiniBuffer;
|
||||||
#include "DepTable.h"
|
|
||||||
|
|
||||||
///
|
///
|
||||||
class Literate: public LaTeX {
|
class Literate : public LaTeX {
|
||||||
public:
|
public:
|
||||||
Literate(string const & cmd, string const & file, string const & path,
|
Literate(string const & cmd, string const & file, string const & path,
|
||||||
string const & litfile,
|
string const & litfile,
|
||||||
@ -32,16 +28,17 @@ public:
|
|||||||
/// runs literate and latex
|
/// runs literate and latex
|
||||||
int weave(TeXErrors &, MiniBuffer *);
|
int weave(TeXErrors &, MiniBuffer *);
|
||||||
|
|
||||||
///
|
|
||||||
int scanLiterateLogFile(TeXErrors &);
|
|
||||||
|
|
||||||
/// runs literate and build
|
/// runs literate and build
|
||||||
int build(TeXErrors &, MiniBuffer *);
|
int build(TeXErrors &, MiniBuffer *);
|
||||||
|
|
||||||
///
|
|
||||||
int scanBuildLogFile(TeXErrors &);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
///
|
||||||
|
int scanLiterateLogFile();
|
||||||
|
|
||||||
|
///
|
||||||
|
int scanBuildLogFile();
|
||||||
|
|
||||||
///
|
///
|
||||||
string litfile;
|
string litfile;
|
||||||
|
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "lyx_cb.h"
|
#include "lyx_cb.h"
|
||||||
|
|
||||||
extern FD_form_sendto *fd_form_sendto;
|
extern FD_form_sendto * fd_form_sendto;
|
||||||
extern BufferView *current_view;
|
extern BufferView * current_view;
|
||||||
extern int MakeDVIOutput(Buffer *buffer);
|
extern int MakeDVIOutput(Buffer * buffer);
|
||||||
extern bool MenuRunDvips(Buffer *buffer, bool wait);
|
extern bool MenuRunDvips(Buffer * buffer, bool wait);
|
||||||
|
|
||||||
// Whereas this feature is under the menu item File->Export->Custom,
|
// Whereas this feature is under the menu item File->Export->Custom,
|
||||||
// I kept the old name sendto in the code because I am lazy (JMarc)
|
// I kept the old name sendto in the code because I am lazy (JMarc)
|
||||||
@ -82,7 +82,7 @@ void SendtoApplyCB(FL_OBJECT *, long)
|
|||||||
ftypeext, true));
|
ftypeext, true));
|
||||||
if (!contains(command, "$$FName"))
|
if (!contains(command, "$$FName"))
|
||||||
command = "( " + command + " ) <$$FName";
|
command = "( " + command + " ) <$$FName";
|
||||||
command = subst(command, "$$FName",fname);
|
command = subst(command, "$$FName", fname);
|
||||||
command += " &"; // execute in background
|
command += " &"; // execute in background
|
||||||
// push directorypath, if necessary
|
// push directorypath, if necessary
|
||||||
string path = OnlyPath(buffer->getFileName());
|
string path = OnlyPath(buffer->getFileName());
|
||||||
|
@ -291,20 +291,20 @@ void LyXView::updateLayoutChoice()
|
|||||||
|
|
||||||
// If textclass is different, we need to update the list
|
// If textclass is different, we need to update the list
|
||||||
if (toolbar->combox->empty() ||
|
if (toolbar->combox->empty() ||
|
||||||
(last_textclass != currentBuffer()->params.textclass)) {
|
(last_textclass != int(currentBuffer()->params.textclass))) {
|
||||||
toolbar->combox->clear();
|
toolbar->combox->clear();
|
||||||
for (int i = 0;
|
for (int i = 0;
|
||||||
lyxstyle.NameOfLayout(currentBuffer()->
|
textclasslist.NameOfLayout(currentBuffer()->
|
||||||
params.textclass, i) !="@@end@@";
|
params.textclass, i) !="@@end@@";
|
||||||
i++) {
|
i++) {
|
||||||
LyXLayout *layout = lyxstyle.
|
LyXLayout const & layout = textclasslist.
|
||||||
Style(currentBuffer()->params.textclass, i);
|
Style(currentBuffer()->params.textclass, i);
|
||||||
if (layout->obsoleted_by.empty())
|
if (layout.obsoleted_by().empty())
|
||||||
toolbar->combox->addline(layout->name.c_str());
|
toolbar->combox->addline(layout.name().c_str());
|
||||||
else
|
else
|
||||||
toolbar->combox->addline(("@N"+layout->name).c_str());
|
toolbar->combox->addline(("@N"+layout.name()).c_str());
|
||||||
}
|
}
|
||||||
last_textclass = currentBuffer()->params.textclass;
|
last_textclass = int(currentBuffer()->params.textclass);
|
||||||
current_layout = 0;
|
current_layout = 0;
|
||||||
}
|
}
|
||||||
// we need to do this.
|
// we need to do this.
|
||||||
@ -325,9 +325,9 @@ void LyXView::UpdateDocumentClassChoice()
|
|||||||
int i;
|
int i;
|
||||||
if (fd_form_document) {
|
if (fd_form_document) {
|
||||||
fl_clear_choice(fd_form_document->choice_class);
|
fl_clear_choice(fd_form_document->choice_class);
|
||||||
for (i = 0; lyxstyle.DescOfClass (i)!="@@end@@"; i++) {
|
for (i = 0; textclasslist.DescOfClass (i)!="@@end@@"; i++) {
|
||||||
fl_addto_choice(fd_form_document->choice_class,
|
fl_addto_choice(fd_form_document->choice_class,
|
||||||
lyxstyle.DescOfClass(i).c_str());
|
textclasslist.DescOfClass(i).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright (C) 1995-1998 The LyX Team.
|
* Copyright 1995-1998 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef _LyXView_H_
|
#ifndef LyXView_H
|
||||||
#define _LyXView_H_
|
#define LyXView_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -21,6 +21,8 @@
|
|||||||
#include "buffer.h"
|
#include "buffer.h"
|
||||||
#include "menus.h"
|
#include "menus.h"
|
||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
|
#include "layout.h"
|
||||||
|
|
||||||
class LyXFunc;
|
class LyXFunc;
|
||||||
class Toolbar;
|
class Toolbar;
|
||||||
class MiniBuffer;
|
class MiniBuffer;
|
||||||
@ -59,7 +61,7 @@ public:
|
|||||||
void setPosition(int, int);
|
void setPosition(int, int);
|
||||||
|
|
||||||
/// Show the main form.
|
/// Show the main form.
|
||||||
void show(int, int, char const* t= "LyX");
|
void show(int, int, char const * t= "LyX");
|
||||||
|
|
||||||
/// init (should probably be removed later) (Lgb)
|
/// init (should probably be removed later) (Lgb)
|
||||||
void init();
|
void init();
|
||||||
@ -68,28 +70,28 @@ public:
|
|||||||
void redraw();
|
void redraw();
|
||||||
|
|
||||||
/// returns the buffer currently shown in the main form.
|
/// returns the buffer currently shown in the main form.
|
||||||
Buffer *currentBuffer(){ return bufferview->currentBuffer();}
|
Buffer * currentBuffer(){ return bufferview->currentBuffer();}
|
||||||
|
|
||||||
///
|
///
|
||||||
BufferView *currentView() { return bufferview; }
|
BufferView * currentView() { return bufferview; }
|
||||||
|
|
||||||
/// returns a pointer to the form.
|
/// returns a pointer to the form.
|
||||||
FL_FORM *getForm() { return _form; }
|
FL_FORM * getForm() { return _form; }
|
||||||
|
|
||||||
/// return a pointer to the toolbar
|
/// return a pointer to the toolbar
|
||||||
Toolbar *getToolbar() { return toolbar; }
|
Toolbar * getToolbar() { return toolbar; }
|
||||||
|
|
||||||
/// return a pointer to the lyxfunc
|
/// return a pointer to the lyxfunc
|
||||||
LyXFunc *getLyXFunc() { return lyxfunc; }
|
LyXFunc * getLyXFunc() { return lyxfunc; }
|
||||||
|
|
||||||
/// return a pointer to the minibuffer
|
/// return a pointer to the minibuffer
|
||||||
MiniBuffer *getMiniBuffer() { return minibuffer; }
|
MiniBuffer * getMiniBuffer() { return minibuffer; }
|
||||||
|
|
||||||
///
|
///
|
||||||
Menus *getMenus() { return menus; }
|
Menus * getMenus() { return menus; }
|
||||||
|
|
||||||
///
|
///
|
||||||
Intl *getIntl() { return intl; }
|
Intl * getIntl() { return intl; }
|
||||||
|
|
||||||
///
|
///
|
||||||
void updateLayoutChoice();
|
void updateLayoutChoice();
|
||||||
@ -101,27 +103,27 @@ public:
|
|||||||
void resetAutosaveTimer();
|
void resetAutosaveTimer();
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
LyXFunc *lyxfunc;
|
LyXFunc * lyxfunc;
|
||||||
///
|
///
|
||||||
Toolbar *toolbar;
|
Toolbar * toolbar;
|
||||||
///
|
///
|
||||||
MiniBuffer *minibuffer;
|
MiniBuffer * minibuffer;
|
||||||
///
|
///
|
||||||
Menus *menus;
|
Menus * menus;
|
||||||
///
|
///
|
||||||
Intl *intl;
|
Intl * intl;
|
||||||
|
|
||||||
/** This is supposed to be a pointer or a list of pointers to the
|
/** This is supposed to be a pointer or a list of pointers to the
|
||||||
BufferViews currently being shown in the LyXView. So far
|
BufferViews currently being shown in the LyXView. So far
|
||||||
this is not used, but that should change pretty soon. (Lgb) */
|
this is not used, but that should change pretty soon. (Lgb) */
|
||||||
BufferView *bufferview;
|
BufferView * bufferview;
|
||||||
///
|
///
|
||||||
void invalidateLayoutChoice();
|
void invalidateLayoutChoice();
|
||||||
///
|
///
|
||||||
void UpdateDocumentClassChoice();
|
void UpdateDocumentClassChoice();
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
static int KeyPressMask_raw_callback(FL_FORM *, void *xev);
|
static int KeyPressMask_raw_callback(FL_FORM *, void * xev);
|
||||||
/** This callback is run when a close event is sent from the
|
/** This callback is run when a close event is sent from the
|
||||||
window manager. */
|
window manager. */
|
||||||
static int atCloseMainFormCB(FL_FORM *, void *);
|
static int atCloseMainFormCB(FL_FORM *, void *);
|
||||||
@ -131,17 +133,15 @@ public:
|
|||||||
static void UpdateTimerCB(FL_OBJECT *, long);
|
static void UpdateTimerCB(FL_OBJECT *, long);
|
||||||
private:
|
private:
|
||||||
/// makes the main form.
|
/// makes the main form.
|
||||||
FD_form_main *create_form_form_main(int width, int height);
|
FD_form_main * create_form_form_main(int width, int height);
|
||||||
/// A pointer to the form.
|
/// A pointer to the form.
|
||||||
FD_form_main *_form_main;
|
FD_form_main * _form_main;
|
||||||
/// A pointer to the form.
|
/// A pointer to the form.
|
||||||
FL_FORM *_form;
|
FL_FORM * _form;
|
||||||
|
|
||||||
/** The last textclass layout list in the layout choice selector
|
/** The last textclass layout list in the layout choice selector
|
||||||
This should probably be moved to the toolbar, but for now it's
|
This should probably be moved to the toolbar, but for now it's
|
||||||
here. (Asger) */
|
here. (Asger) */
|
||||||
int last_textclass;
|
int last_textclass;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
#include "BufferView.h"
|
#include "BufferView.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
|
||||||
extern FD_form_paper *fd_form_paper;
|
extern FD_form_paper * fd_form_paper;
|
||||||
extern MiniBuffer *minibuffer;
|
extern MiniBuffer * minibuffer;
|
||||||
extern BufferView *current_view;
|
extern BufferView * current_view;
|
||||||
|
|
||||||
|
|
||||||
inline void DeactivatePaperButtons ()
|
inline void DeactivatePaperButtons ()
|
||||||
@ -89,11 +89,7 @@ static void checkMarginValues()
|
|||||||
|
|
||||||
fl_hide_object(fd_form_paper->text_warning);
|
fl_hide_object(fd_form_paper->text_warning);
|
||||||
ActivatePaperButtons();
|
ActivatePaperButtons();
|
||||||
#if 0
|
|
||||||
val = fl_get_choice(fd_form_paper->choice_papersize2)-1;
|
|
||||||
if (val == VM_PAPER_DEFAULT)
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
allEmpty = (!strlen(fl_get_input(fd_form_paper->input_top_margin)) &&
|
allEmpty = (!strlen(fl_get_input(fd_form_paper->input_top_margin)) &&
|
||||||
!strlen(fl_get_input(fd_form_paper->input_bottom_margin)) &&
|
!strlen(fl_get_input(fd_form_paper->input_bottom_margin)) &&
|
||||||
!strlen(fl_get_input(fd_form_paper->input_left_margin)) &&
|
!strlen(fl_get_input(fd_form_paper->input_left_margin)) &&
|
||||||
@ -188,9 +184,9 @@ void PaperApplyCB(FL_OBJECT *, long)
|
|||||||
if (! current_view->available())
|
if (! current_view->available())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BufferParams *params = ¤t_view->currentBuffer()->params;
|
BufferParams * params = ¤t_view->currentBuffer()->params;
|
||||||
|
|
||||||
const FD_form_paper* fd = fd_form_paper;
|
FD_form_paper const * fd = fd_form_paper;
|
||||||
|
|
||||||
params->papersize2 = fl_get_choice(fd->choice_papersize2)-1;
|
params->papersize2 = fl_get_choice(fd->choice_papersize2)-1;
|
||||||
params->paperpackage = fl_get_choice(fd->choice_paperpackage)-1;
|
params->paperpackage = fl_get_choice(fd->choice_paperpackage)-1;
|
||||||
@ -222,21 +218,18 @@ void PaperCancelCB(FL_OBJECT *, long)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PaperOKCB(FL_OBJECT *ob, long data)
|
void PaperOKCB(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
PaperCancelCB(ob,data);
|
PaperCancelCB(ob,data);
|
||||||
PaperApplyCB(ob,data);
|
PaperApplyCB(ob,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PaperMarginsCB(FL_OBJECT *ob, long)
|
void PaperMarginsCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
const FD_form_paper
|
FD_form_paper const * fd = fd_form_paper;
|
||||||
*fd = fd_form_paper;
|
string str;
|
||||||
string
|
char val;
|
||||||
str;
|
|
||||||
char
|
|
||||||
val;
|
|
||||||
|
|
||||||
checkMarginValues();
|
checkMarginValues();
|
||||||
if (ob == fd->choice_papersize2) {
|
if (ob == fd->choice_papersize2) {
|
||||||
@ -258,11 +251,15 @@ void PaperMarginsCB(FL_OBJECT *ob, long)
|
|||||||
fl_set_choice(fd->choice_papersize2, VM_PAPER_DEFAULT + 1);
|
fl_set_choice(fd->choice_papersize2, VM_PAPER_DEFAULT + 1);
|
||||||
fl_set_button(fd->push_use_geometry, 0);
|
fl_set_button(fd->push_use_geometry, 0);
|
||||||
}
|
}
|
||||||
} else if ((ob==fd->input_custom_width) || (ob==fd->input_custom_height) ||
|
} else if ((ob==fd->input_custom_width)
|
||||||
(ob==fd->input_left_margin) || (ob==fd->input_right_margin) ||
|
|| (ob==fd->input_custom_height)
|
||||||
(ob==fd->input_top_margin) || (ob==fd->input_bottom_margin) ||
|
|| (ob==fd->input_left_margin)
|
||||||
(ob==fd->input_head_height) || (ob==fd->input_head_sep) ||
|
|| (ob==fd->input_right_margin)
|
||||||
(ob==fd->input_foot_skip)) {
|
|| (ob==fd->input_top_margin)
|
||||||
|
|| (ob==fd->input_bottom_margin)
|
||||||
|
|| (ob==fd->input_head_height)
|
||||||
|
|| (ob==fd->input_head_sep)
|
||||||
|
|| (ob==fd->input_foot_skip)) {
|
||||||
str = fl_get_input(ob);
|
str = fl_get_input(ob);
|
||||||
if (!str.empty() && !isValidLength(str)) {
|
if (!str.empty() && !isValidLength(str)) {
|
||||||
fl_set_object_label(fd_form_paper->text_warning,
|
fl_set_object_label(fd_form_paper->text_warning,
|
||||||
|
@ -171,9 +171,8 @@ void ParagraphExtraApplyCB(FL_OBJECT *, long)
|
|||||||
*widthp = fl_get_input(fd->input_pextra_widthp);
|
*widthp = fl_get_input(fd->input_pextra_widthp);
|
||||||
LyXText
|
LyXText
|
||||||
*text = current_view->currentBuffer()->text;
|
*text = current_view->currentBuffer()->text;
|
||||||
int
|
int type = PEXTRA_NONE;
|
||||||
type = PEXTRA_NONE,
|
int alignment = 0;
|
||||||
alignment = 0;
|
|
||||||
bool
|
bool
|
||||||
hfill = false,
|
hfill = false,
|
||||||
start_minipage = false;
|
start_minipage = false;
|
||||||
@ -196,10 +195,8 @@ void ParagraphExtraApplyCB(FL_OBJECT *, long)
|
|||||||
}
|
}
|
||||||
text->SetParagraphExtraOpt(type,width,widthp,alignment,hfill,
|
text->SetParagraphExtraOpt(type,width,widthp,alignment,hfill,
|
||||||
start_minipage);
|
start_minipage);
|
||||||
// current_view->redoCurrentBuffer();
|
|
||||||
current_view->currentBuffer()->update(1);
|
current_view->currentBuffer()->update(1);
|
||||||
minibuffer->Set(_("ParagraphExtra layout set"));
|
minibuffer->Set(_("ParagraphExtra layout set"));
|
||||||
// current_view->currentBuffer()->markDirty();
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "lyxscreen.h"
|
#include "lyxscreen.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
|
#include "layout.h"
|
||||||
|
|
||||||
extern void BeforeChange();
|
extern void BeforeChange();
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
*======================================================
|
*======================================================
|
||||||
A few prototypes missing from Sun and SCO 3.2v4 header files */
|
A few prototypes missing from Sun and SCO 3.2v4 header files */
|
||||||
|
|
||||||
#ifndef _BROKEN_HEADERS_H
|
#ifndef BROKEN_HEADERS_H
|
||||||
#define _BROKEN_HEADERS_H
|
#define BROKEN_HEADERS_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
480
src/buffer.C
480
src/buffer.C
File diff suppressed because it is too large
Load Diff
@ -19,8 +19,8 @@
|
|||||||
// every time the LyX-file was left unchanged between the two actions mentioned
|
// every time the LyX-file was left unchanged between the two actions mentioned
|
||||||
// above.
|
// above.
|
||||||
|
|
||||||
#ifndef _BUFFER_H_
|
#ifndef BUFFER_H
|
||||||
#define _BUFFER_H_
|
#define BUFFER_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -370,9 +370,9 @@ private:
|
|||||||
///
|
///
|
||||||
void DocBookHandleFootnote(FILE *file,LyXParagraph* &par, int const depth);
|
void DocBookHandleFootnote(FILE *file,LyXParagraph* &par, int const depth);
|
||||||
///
|
///
|
||||||
void sgmlOpenTag(FILE * file,int depth,string & latexname);
|
void sgmlOpenTag(FILE * file,int depth,string const & latexname) const;
|
||||||
///
|
///
|
||||||
void sgmlCloseTag(FILE * file,int depth,string & latexname);
|
void sgmlCloseTag(FILE * file,int depth,string const & latexname) const;
|
||||||
///
|
///
|
||||||
void LinuxDocError(LyXParagraph *par, int pos, char const *message);
|
void LinuxDocError(LyXParagraph *par, int pos, char const *message);
|
||||||
///
|
///
|
||||||
|
@ -60,8 +60,8 @@ private:
|
|||||||
class BufferStorage_Iter {
|
class BufferStorage_Iter {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
BufferStorage_Iter(const BufferStorage & bs)
|
BufferStorage_Iter(BufferStorage const & bs)
|
||||||
{ cs=&bs; index=0;}
|
{ cs =& bs; index = 0;}
|
||||||
/// next
|
/// next
|
||||||
Buffer* operator() ();
|
Buffer* operator() ();
|
||||||
///
|
///
|
||||||
|
@ -44,7 +44,7 @@ BufferParams::BufferParams()
|
|||||||
fonts = "default";
|
fonts = "default";
|
||||||
inputenc = "latin1";
|
inputenc = "latin1";
|
||||||
graphicsDriver = "default";
|
graphicsDriver = "default";
|
||||||
sides = 1;
|
sides = LyXTextClass::OneSide;
|
||||||
columns = 1;
|
columns = 1;
|
||||||
pagestyle = "default";
|
pagestyle = "default";
|
||||||
for(int iter = 0; iter < 4; iter++) {
|
for(int iter = 0; iter < 4; iter++) {
|
||||||
@ -112,7 +112,7 @@ void BufferParams::writeFile(FILE *file)
|
|||||||
|
|
||||||
// the textclass
|
// the textclass
|
||||||
fprintf(file, "\\textclass %s\n",
|
fprintf(file, "\\textclass %s\n",
|
||||||
lyxstyle.NameOfClass(textclass).c_str());
|
textclasslist.NameOfClass(textclass).c_str());
|
||||||
|
|
||||||
// then the the preamble
|
// then the the preamble
|
||||||
if (!preamble.empty()) {
|
if (!preamble.empty()) {
|
||||||
@ -222,14 +222,14 @@ void BufferParams::writeFile(FILE *file)
|
|||||||
|
|
||||||
|
|
||||||
void BufferParams::useClassDefaults() {
|
void BufferParams::useClassDefaults() {
|
||||||
LyXTextClass *tclass = lyxstyle.TextClass(textclass);
|
LyXTextClass const & tclass = textclasslist.TextClass(textclass);
|
||||||
|
|
||||||
sides = tclass->sides;
|
sides = tclass.sides();
|
||||||
columns = tclass->columns;
|
columns = tclass.columns();
|
||||||
pagestyle = tclass->pagestyle;
|
pagestyle = tclass.pagestyle();
|
||||||
options = tclass->options;
|
options = tclass.options();
|
||||||
secnumdepth = tclass->secnumdepth;
|
secnumdepth = tclass.secnumdepth();
|
||||||
tocdepth = tclass->tocdepth;
|
tocdepth = tclass.tocdepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 1996 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* and the LyX Team.
|
* Copyright 1995-1999 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef _BUFFERPARAMS_H
|
#ifndef BUFFERPARAMS_H
|
||||||
#define _BUFFERPARAMS_H
|
#define BUFFERPARAMS_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -22,6 +22,7 @@
|
|||||||
#include "Spacing.h"
|
#include "Spacing.h"
|
||||||
#include "Bullet.h"
|
#include "Bullet.h"
|
||||||
#include "insets/insetquotes.h"
|
#include "insets/insetquotes.h"
|
||||||
|
#include "layout.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class contains all the parameters for this a buffer uses. Some
|
This class contains all the parameters for this a buffer uses. Some
|
||||||
@ -34,8 +35,6 @@ public:
|
|||||||
//@{
|
//@{
|
||||||
///
|
///
|
||||||
BufferParams();
|
BufferParams();
|
||||||
// ///
|
|
||||||
//BufferParams(const BufferParams&);
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// Dummy destructor to shut up gcc
|
/// Dummy destructor to shut up gcc
|
||||||
@ -65,7 +64,7 @@ public:
|
|||||||
///
|
///
|
||||||
string fontsize;
|
string fontsize;
|
||||||
///
|
///
|
||||||
signed char textclass;
|
LyXTextClassList::ClassList::size_type textclass;
|
||||||
|
|
||||||
/* this are for the PaperLayout */
|
/* this are for the PaperLayout */
|
||||||
///
|
///
|
||||||
@ -105,9 +104,9 @@ public:
|
|||||||
///
|
///
|
||||||
Spacing spacing;
|
Spacing spacing;
|
||||||
///
|
///
|
||||||
signed char secnumdepth;
|
int secnumdepth;
|
||||||
///
|
///
|
||||||
signed char tocdepth;
|
int tocdepth;
|
||||||
///
|
///
|
||||||
string language;
|
string language;
|
||||||
///
|
///
|
||||||
@ -119,9 +118,9 @@ public:
|
|||||||
///
|
///
|
||||||
string float_placement;
|
string float_placement;
|
||||||
///
|
///
|
||||||
char columns; // add approp. signedness
|
unsigned int columns;
|
||||||
///
|
///
|
||||||
char sides; // add approp. signedness
|
LyXTextClass::PageSides sides;
|
||||||
///
|
///
|
||||||
string pagestyle;
|
string pagestyle;
|
||||||
///
|
///
|
||||||
|
11
src/debug.h
11
src/debug.h
@ -48,12 +48,14 @@ struct Debug {
|
|||||||
PARSER | LYXRC | KBMAP | LATEX |
|
PARSER | LYXRC | KBMAP | LATEX |
|
||||||
MATHED | FONT | TCLASS | LYXVC |
|
MATHED | FONT | TCLASS | LYXVC |
|
||||||
LYXSERVER | ROFF);
|
LYXSERVER | ROFF);
|
||||||
|
///
|
||||||
|
friend inline void operator|=(Debug::type & d1, Debug::type d2);
|
||||||
|
|
||||||
/** A function to convert symbolic string names on debug levels
|
/** A function to convert symbolic string names on debug levels
|
||||||
to their numerical value.
|
to their numerical value.
|
||||||
*/
|
*/
|
||||||
static Debug::type value(string const & val) {
|
static Debug::type value(string const & val) {
|
||||||
int l = Debug::NONE;
|
type l = Debug::NONE;
|
||||||
string v(val);
|
string v(val);
|
||||||
while (!v.empty()) {
|
while (!v.empty()) {
|
||||||
string::size_type st = v.find(',');
|
string::size_type st = v.find(',');
|
||||||
@ -78,9 +80,14 @@ struct Debug {
|
|||||||
if (st == string::npos) break;
|
if (st == string::npos) break;
|
||||||
v.erase(0, st + 1);
|
v.erase(0, st + 1);
|
||||||
}
|
}
|
||||||
return Debug::type(l);
|
return l;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
///
|
||||||
|
inline void operator|=(Debug::type & d1, Debug::type d2)
|
||||||
|
{
|
||||||
|
d1 = static_cast<Debug::type>(d1 | d2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#include "support/DebugStream.h"
|
#include "support/DebugStream.h"
|
||||||
|
@ -611,7 +611,7 @@ static void runqueue()
|
|||||||
XInternAtom(tempdisp, "GHOSTVIEW", false),
|
XInternAtom(tempdisp, "GHOSTVIEW", false),
|
||||||
XInternAtom(tempdisp, "STRING", false),
|
XInternAtom(tempdisp, "STRING", false),
|
||||||
8, PropModeAppend,
|
8, PropModeAppend,
|
||||||
(unsigned char *) tbuf,
|
reinterpret_cast<unsigned char*>(tbuf),
|
||||||
strlen(tbuf));
|
strlen(tbuf));
|
||||||
|
|
||||||
switch (p->data->flags & 3) {
|
switch (p->data->flags & 3) {
|
||||||
@ -641,7 +641,7 @@ static void runqueue()
|
|||||||
XInternAtom(tempdisp, "GHOSTVIEW_COLORS", false),
|
XInternAtom(tempdisp, "GHOSTVIEW_COLORS", false),
|
||||||
XInternAtom(tempdisp, "STRING", false),
|
XInternAtom(tempdisp, "STRING", false),
|
||||||
8, PropModeReplace,
|
8, PropModeReplace,
|
||||||
(unsigned char *) tbuf,
|
reinterpret_cast<unsigned char*>(tbuf),
|
||||||
strlen(tbuf));
|
strlen(tbuf));
|
||||||
XUngrabServer(tempdisp);
|
XUngrabServer(tempdisp);
|
||||||
XFlush(tempdisp);
|
XFlush(tempdisp);
|
||||||
|
@ -37,13 +37,12 @@ unsigned char Inset::Editable() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Inset::Validate(LaTeXFeatures &) const
|
void Inset::Validate(LaTeXFeatures &) const
|
||||||
{
|
{
|
||||||
// nothing by default
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool Inset::AutoDelete() const
|
bool Inset::AutoDelete() const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -61,14 +60,8 @@ LyXFont Inset::ConvertFont(LyXFont font)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Inset::Code Inset::LyxCode() const
|
|
||||||
// {
|
|
||||||
// return Inset::NO_CODE;
|
|
||||||
// }
|
|
||||||
|
|
||||||
/* some stuff for inset locking */
|
/* some stuff for inset locking */
|
||||||
|
|
||||||
|
|
||||||
void UpdatableInset::InsetButtonPress(int x, int y, int button)
|
void UpdatableInset::InsetButtonPress(int x, int y, int button)
|
||||||
{
|
{
|
||||||
lyxerr.debug() << "Inset Button Press x=" << x
|
lyxerr.debug() << "Inset Button Press x=" << x
|
||||||
@ -111,5 +104,4 @@ unsigned char UpdatableInset::Editable() const
|
|||||||
|
|
||||||
void UpdatableInset::ToggleInsetCursor()
|
void UpdatableInset::ToggleInsetCursor()
|
||||||
{
|
{
|
||||||
// nothing
|
|
||||||
}
|
}
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
|
|
||||||
extern BufferView *current_view;
|
extern BufferView * current_view;
|
||||||
|
|
||||||
FD_citation_form *citation_form=0;
|
FD_citation_form * citation_form = 0;
|
||||||
FD_bibitem_form *bibitem_form=0;
|
FD_bibitem_form * bibitem_form = 0;
|
||||||
static Combox *bibcombox = 0;
|
static Combox * bibcombox = 0;
|
||||||
|
|
||||||
extern void UpdateInset(Inset* inset, bool mark_dirty = true);
|
extern void UpdateInset(Inset* inset, bool mark_dirty = true);
|
||||||
void BibitemUpdate(Combox *);
|
void BibitemUpdate(Combox *);
|
||||||
@ -34,19 +34,10 @@ FD_bibitem_form * create_form_bibitem_form(void);
|
|||||||
extern "C" void bibitem_cb(FL_OBJECT *, long data)
|
extern "C" void bibitem_cb(FL_OBJECT *, long data)
|
||||||
{
|
{
|
||||||
switch (data) {
|
switch (data) {
|
||||||
// case 0: fl_hide_form(citation_form->citation_form);
|
|
||||||
// break;
|
|
||||||
// case 1:
|
|
||||||
case 1: // OK, citation
|
case 1: // OK, citation
|
||||||
{
|
{
|
||||||
// InsetCommand *inset = (InsetCommand*)citation_form->vdata;
|
|
||||||
// inset->setContents(bibcombox->getline());
|
|
||||||
// inset->setOptions(fl_get_input(citation_form->label));
|
|
||||||
// fl_hide_form(citation_form->citation_form);
|
|
||||||
// UpdateInset(inset);
|
|
||||||
// break;
|
|
||||||
if(!current_view->currentBuffer()->isReadonly()) {
|
if(!current_view->currentBuffer()->isReadonly()) {
|
||||||
InsetCommand *inset = (InsetCommand*)citation_form->vdata;
|
InsetCommand *inset = static_cast<InsetCommand*>(citation_form->citation_form->u_vdata);
|
||||||
inset->setContents(bibcombox->getline());
|
inset->setContents(bibcombox->getline());
|
||||||
inset->setOptions(fl_get_input(citation_form->label));
|
inset->setOptions(fl_get_input(citation_form->label));
|
||||||
fl_hide_form(citation_form->citation_form);
|
fl_hide_form(citation_form->citation_form);
|
||||||
@ -57,23 +48,12 @@ extern "C" void bibitem_cb(FL_OBJECT *, long data)
|
|||||||
}
|
}
|
||||||
// fall through to Cancel on RO-mode
|
// fall through to Cancel on RO-mode
|
||||||
}
|
}
|
||||||
// case 2: fl_hide_form(bibitem_form->bibitem_form);
|
|
||||||
case 0: fl_hide_form(citation_form->citation_form);
|
case 0: fl_hide_form(citation_form->citation_form);
|
||||||
break;
|
break;
|
||||||
// case 3:
|
|
||||||
|
|
||||||
case 3: // OK, bibitem
|
case 3: // OK, bibitem
|
||||||
{
|
{
|
||||||
// InsetCommand *inset = (InsetCommand *)bibitem_form->vdata;
|
|
||||||
// inset->setContents(fl_get_input(bibitem_form->key));
|
|
||||||
// inset->setOptions(fl_get_input(bibitem_form->label));
|
|
||||||
// fl_hide_form(bibitem_form->bibitem_form);
|
|
||||||
// // Does look like a hack? It is! (but will change at 0.13)
|
|
||||||
// current_view->currentBuffer()->text->RedoParagraph();
|
|
||||||
// current_view->currentBuffer()->update(1);
|
|
||||||
// break;
|
|
||||||
if(!current_view->currentBuffer()->isReadonly()) {
|
if(!current_view->currentBuffer()->isReadonly()) {
|
||||||
InsetCommand *inset = (InsetCommand *)bibitem_form->vdata;
|
InsetCommand *inset = static_cast<InsetCommand*>(bibitem_form->bibitem_form->u_vdata);
|
||||||
inset->setContents(fl_get_input(bibitem_form->key));
|
inset->setContents(fl_get_input(bibitem_form->key));
|
||||||
inset->setOptions(fl_get_input(bibitem_form->label));
|
inset->setOptions(fl_get_input(bibitem_form->label));
|
||||||
fl_hide_form(bibitem_form->bibitem_form);
|
fl_hide_form(bibitem_form->bibitem_form);
|
||||||
@ -159,7 +139,7 @@ InsetCitation::~InsetCitation()
|
|||||||
{
|
{
|
||||||
if(citation_form && citation_form->citation_form
|
if(citation_form && citation_form->citation_form
|
||||||
&& citation_form->citation_form->visible
|
&& citation_form->citation_form->visible
|
||||||
&& citation_form->vdata == this)
|
&& citation_form->citation_form->u_vdata == this)
|
||||||
fl_hide_form(citation_form->citation_form);
|
fl_hide_form(citation_form->citation_form);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +154,7 @@ void InsetCitation::Edit(int, int)
|
|||||||
fl_set_form_atclose(citation_form->citation_form,
|
fl_set_form_atclose(citation_form->citation_form,
|
||||||
CancelCloseBoxCB, 0);
|
CancelCloseBoxCB, 0);
|
||||||
}
|
}
|
||||||
citation_form->vdata = this;
|
citation_form->citation_form->u_vdata = this;
|
||||||
|
|
||||||
BibitemUpdate(bibcombox);
|
BibitemUpdate(bibcombox);
|
||||||
if (!bibcombox->select_text(getContents().c_str()))
|
if (!bibcombox->select_text(getContents().c_str()))
|
||||||
@ -276,7 +256,7 @@ void InsetBibKey::Edit(int, int)
|
|||||||
fl_set_form_atclose(bibitem_form->bibitem_form,
|
fl_set_form_atclose(bibitem_form->bibitem_form,
|
||||||
CancelCloseBoxCB, 0);
|
CancelCloseBoxCB, 0);
|
||||||
}
|
}
|
||||||
bibitem_form->vdata = this;
|
bibitem_form->bibitem_form->u_vdata = this;
|
||||||
// InsetBibtex uses the same form, with different labels
|
// InsetBibtex uses the same form, with different labels
|
||||||
fl_set_object_label(bibitem_form->key, idex(_("Key:|#K")));
|
fl_set_object_label(bibitem_form->key, idex(_("Key:|#K")));
|
||||||
fl_set_button_shortcut(bibitem_form->key,scex(_("Key:|#K")),1);
|
fl_set_button_shortcut(bibitem_form->key,scex(_("Key:|#K")),1);
|
||||||
@ -411,7 +391,7 @@ string InsetBibtex::getKeys()
|
|||||||
linebuf = subst(linebuf,
|
linebuf = subst(linebuf,
|
||||||
'{', '(');
|
'{', '(');
|
||||||
linebuf = split(linebuf,
|
linebuf = split(linebuf,
|
||||||
tmp, '(');
|
tmp,'(');
|
||||||
tmp = lowercase(tmp);
|
tmp = lowercase(tmp);
|
||||||
if (!prefixIs(tmp, "@string") && !prefixIs(tmp, "@preamble") ) {
|
if (!prefixIs(tmp, "@string") && !prefixIs(tmp, "@preamble") ) {
|
||||||
linebuf = split(linebuf, tmp,',');
|
linebuf = split(linebuf, tmp,',');
|
||||||
@ -440,7 +420,7 @@ void InsetBibtex::Edit(int, int)
|
|||||||
CancelCloseBoxCB, 0);
|
CancelCloseBoxCB, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bibitem_form->vdata = this;
|
bibitem_form->bibitem_form->u_vdata = this;
|
||||||
fl_set_object_label(bibitem_form->key, _("Database:"));
|
fl_set_object_label(bibitem_form->key, _("Database:"));
|
||||||
fl_set_object_label(bibitem_form->label, _("Style: "));
|
fl_set_object_label(bibitem_form->label, _("Style: "));
|
||||||
fl_set_input(bibitem_form->key, getContents().c_str());
|
fl_set_input(bibitem_form->key, getContents().c_str());
|
||||||
@ -448,13 +428,14 @@ void InsetBibtex::Edit(int, int)
|
|||||||
if (bibitem_form->bibitem_form->visible) {
|
if (bibitem_form->bibitem_form->visible) {
|
||||||
fl_raise_form(bibitem_form->bibitem_form);
|
fl_raise_form(bibitem_form->bibitem_form);
|
||||||
} else {
|
} else {
|
||||||
fl_show_form(bibitem_form->bibitem_form,FL_PLACE_MOUSE, FL_FULLBORDER,
|
fl_show_form(bibitem_form->bibitem_form,
|
||||||
|
FL_PLACE_MOUSE, FL_FULLBORDER,
|
||||||
_("BibTeX"));
|
_("BibTeX"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsetBibtex::addDatabase(string const &db)
|
bool InsetBibtex::addDatabase(string const & db)
|
||||||
{
|
{
|
||||||
if (!contains(contents, db.c_str())) {
|
if (!contains(contents, db.c_str())) {
|
||||||
if (!contents.empty())
|
if (!contents.empty())
|
||||||
@ -466,7 +447,7 @@ bool InsetBibtex::addDatabase(string const &db)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsetBibtex::delDatabase(string const &db)
|
bool InsetBibtex::delDatabase(string const & db)
|
||||||
{
|
{
|
||||||
if (contains(contents, db.c_str())) {
|
if (contains(contents, db.c_str())) {
|
||||||
string bd = db;
|
string bd = db;
|
||||||
@ -486,7 +467,7 @@ bool InsetBibtex::delDatabase(string const &db)
|
|||||||
|
|
||||||
|
|
||||||
// This function should be in LyXView when multiframe works ale970302
|
// This function should be in LyXView when multiframe works ale970302
|
||||||
void BibitemUpdate(Combox* combox)
|
void BibitemUpdate(Combox * combox)
|
||||||
{
|
{
|
||||||
combox->clear();
|
combox->clear();
|
||||||
|
|
||||||
@ -504,7 +485,7 @@ void BibitemUpdate(Combox* combox)
|
|||||||
|
|
||||||
|
|
||||||
// ale070405 This function maybe shouldn't be here. We'll fix this at 0.13.
|
// ale070405 This function maybe shouldn't be here. We'll fix this at 0.13.
|
||||||
int bibitemMaxWidth(const class LyXFont &font)
|
int bibitemMaxWidth(LyXFont const & font)
|
||||||
{
|
{
|
||||||
int w = 0;
|
int w = 0;
|
||||||
// Does look like a hack? It is! (but will change at 0.13)
|
// Does look like a hack? It is! (but will change at 0.13)
|
||||||
@ -526,8 +507,8 @@ string bibitemWidthest()
|
|||||||
{
|
{
|
||||||
int w = 0;
|
int w = 0;
|
||||||
// Does look like a hack? It is! (but will change at 0.13)
|
// Does look like a hack? It is! (but will change at 0.13)
|
||||||
LyXParagraph *par = current_view->currentBuffer()->paragraph;
|
LyXParagraph * par = current_view->currentBuffer()->paragraph;
|
||||||
InsetBibKey *bkey=0;
|
InsetBibKey * bkey=0;
|
||||||
LyXFont font;
|
LyXFont font;
|
||||||
|
|
||||||
while (par) {
|
while (par) {
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright (C) 1995 Matthias Ettrich
|
||||||
* Copyright (C) 1995-1998 The LyX Team.
|
* Copyright (C) 1995-1999 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_BIB_H
|
#ifndef INSET_BIB_H
|
||||||
#define _INSET_BIB_H
|
#define INSET_BIB_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -28,11 +28,11 @@ public:
|
|||||||
///
|
///
|
||||||
InsetCitation(): InsetCommand("cite") { }
|
InsetCitation(): InsetCommand("cite") { }
|
||||||
///
|
///
|
||||||
InsetCitation(string const & key, string const & note=string());
|
InsetCitation(string const & key, string const & note = string());
|
||||||
///
|
///
|
||||||
~InsetCitation();
|
~InsetCitation();
|
||||||
///
|
///
|
||||||
Inset* Clone() { return new InsetCitation(contents, options); }
|
Inset * Clone() { return new InsetCitation(contents, options); }
|
||||||
///
|
///
|
||||||
string getScreenLabel()const;
|
string getScreenLabel()const;
|
||||||
///
|
///
|
||||||
@ -54,13 +54,13 @@ public:
|
|||||||
///
|
///
|
||||||
InsetBibKey(): InsetCommand("bibitem") { counter = 1; }
|
InsetBibKey(): InsetCommand("bibitem") { counter = 1; }
|
||||||
///
|
///
|
||||||
InsetBibKey(string const & key, string const & label=string());
|
InsetBibKey(string const & key, string const & label = string());
|
||||||
///
|
///
|
||||||
InsetBibKey(InsetBibKey const*);
|
InsetBibKey(InsetBibKey const *);
|
||||||
///
|
///
|
||||||
~InsetBibKey();
|
~InsetBibKey();
|
||||||
///
|
///
|
||||||
Inset* Clone() { return new InsetBibKey(this); }
|
Inset * Clone() { return new InsetBibKey(this); }
|
||||||
/// Currently \bibitem is used as a LyX2.x command, so we need this method.
|
/// Currently \bibitem is used as a LyX2.x command, so we need this method.
|
||||||
void Write(FILE *);
|
void Write(FILE *);
|
||||||
///
|
///
|
||||||
@ -98,7 +98,7 @@ public:
|
|||||||
///
|
///
|
||||||
~InsetBibtex();
|
~InsetBibtex();
|
||||||
///
|
///
|
||||||
Inset* Clone() { return new InsetBibtex(contents, options, 0); }
|
Inset * Clone() { return new InsetBibtex(contents, options, 0); }
|
||||||
///
|
///
|
||||||
Inset::Code LyxCode() const
|
Inset::Code LyxCode() const
|
||||||
{
|
{
|
||||||
@ -111,7 +111,7 @@ public:
|
|||||||
///
|
///
|
||||||
int Latex(FILE *, signed char);
|
int Latex(FILE *, signed char);
|
||||||
///
|
///
|
||||||
int Latex(string &file, signed char fragile);
|
int Latex(string & file, signed char fragile);
|
||||||
///
|
///
|
||||||
string getKeys();
|
string getKeys();
|
||||||
///
|
///
|
||||||
|
@ -35,7 +35,7 @@ InsetCommand::~InsetCommand()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetCommand::Ascent(LyXFont const&font) const
|
int InsetCommand::Ascent(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
LyXFont f = font;
|
LyXFont f = font;
|
||||||
f.decSize();
|
f.decSize();
|
||||||
@ -43,7 +43,7 @@ int InsetCommand::Ascent(LyXFont const&font) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetCommand::Descent(LyXFont const&font) const
|
int InsetCommand::Descent(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
LyXFont f = font;
|
LyXFont f = font;
|
||||||
f.decSize();
|
f.decSize();
|
||||||
@ -51,7 +51,7 @@ int InsetCommand::Descent(LyXFont const&font) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetCommand::Width(LyXFont const&font) const
|
int InsetCommand::Width(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
LyXFont f = font;
|
LyXFont f = font;
|
||||||
f.decSize();
|
f.decSize();
|
||||||
@ -60,15 +60,12 @@ int InsetCommand::Width(LyXFont const&font) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetCommand::Draw(LyXFont font, LyXScreen &scr,
|
void InsetCommand::Draw(LyXFont font, LyXScreen & scr,
|
||||||
int baseline, float &x)
|
int baseline, float & x)
|
||||||
{
|
{
|
||||||
// Draw it as a box with the LaTeX text
|
// Draw it as a box with the LaTeX text
|
||||||
x += 3;
|
x += 3;
|
||||||
|
|
||||||
//scr.drawFilledRectangle(int(x), baseline - Ascent(font) + 1,
|
|
||||||
// Width(font) - 2, Ascent(font) + Descent(font)-2,
|
|
||||||
// FL_GRAY80);
|
|
||||||
scr.fillRectangle(gc_lighted,
|
scr.fillRectangle(gc_lighted,
|
||||||
int(x), baseline - Ascent(font) + 1,
|
int(x), baseline - Ascent(font) + 1,
|
||||||
Width(font) - 6,
|
Width(font) - 6,
|
||||||
@ -80,9 +77,6 @@ void InsetCommand::Draw(LyXFont font, LyXScreen &scr,
|
|||||||
h = (Ascent(font)+Descent(font)-2);
|
h = (Ascent(font)+Descent(font)-2);
|
||||||
scr.drawFrame(FL_UP_FRAME, int(x), y, w, h, FL_BLACK, -1);
|
scr.drawFrame(FL_UP_FRAME, int(x), y, w, h, FL_BLACK, -1);
|
||||||
} else {
|
} else {
|
||||||
//scr.drawRectangle(int(x), baseline - Ascent(font)+1,
|
|
||||||
// Width(font)-2, Ascent(font)+Descent(font)-2,
|
|
||||||
// FL_BLACK);
|
|
||||||
scr.drawRectangle(gc_note_frame,
|
scr.drawRectangle(gc_note_frame,
|
||||||
int(x), baseline - Ascent(font)+1,
|
int(x), baseline - Ascent(font)+1,
|
||||||
Width(font)-6,
|
Width(font)-6,
|
||||||
@ -100,13 +94,13 @@ void InsetCommand::Draw(LyXFont font, LyXScreen &scr,
|
|||||||
|
|
||||||
|
|
||||||
// In lyxf3 this will be just LaTeX
|
// In lyxf3 this will be just LaTeX
|
||||||
void InsetCommand::Write(FILE *file)
|
void InsetCommand::Write(FILE * file)
|
||||||
{
|
{
|
||||||
fprintf(file, "LatexCommand %s\n", getCommand().c_str());
|
fprintf(file, "LatexCommand %s\n", getCommand().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetCommand::scanCommand(string const &cmd)
|
void InsetCommand::scanCommand(string const & cmd)
|
||||||
{
|
{
|
||||||
string tcommand, toptions, tcontents;
|
string tcommand, toptions, tcontents;
|
||||||
|
|
||||||
@ -170,7 +164,7 @@ void InsetCommand::scanCommand(string const &cmd)
|
|||||||
|
|
||||||
|
|
||||||
// This function will not be necessary when lyx3
|
// This function will not be necessary when lyx3
|
||||||
void InsetCommand::Read(LyXLex &lex)
|
void InsetCommand::Read(LyXLex & lex)
|
||||||
{
|
{
|
||||||
if (lex.EatLine()) {
|
if (lex.EatLine()) {
|
||||||
string t = lex.GetString();
|
string t = lex.GetString();
|
||||||
@ -180,14 +174,14 @@ void InsetCommand::Read(LyXLex &lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetCommand::Latex(FILE *file, signed char /*fragile*/)
|
int InsetCommand::Latex(FILE * file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
fprintf(file, "%s", getCommand().c_str());
|
fprintf(file, "%s", getCommand().c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetCommand::Latex(string &file, signed char /*fragile*/)
|
int InsetCommand::Latex(string & file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
file += getCommand();
|
file += getCommand();
|
||||||
return 0;
|
return 0;
|
||||||
@ -206,9 +200,9 @@ int InsetCommand::DocBook(string &/*file*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Inset* InsetCommand::Clone()
|
Inset * InsetCommand::Clone()
|
||||||
{
|
{
|
||||||
InsetCommand *result = new InsetCommand(command, contents, options);
|
InsetCommand * result = new InsetCommand(command, contents, options);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,12 +5,12 @@
|
|||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright (C) 1995 Matthias Ettrich
|
||||||
* Copyright (C) 1996-1998 The LyX Team.
|
* Copyright (C) 1996-1999 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_LATEXCOMMAND_H
|
#ifndef INSET_LATEXCOMMAND_H
|
||||||
#define _INSET_LATEXCOMMAND_H
|
#define INSET_LATEXCOMMAND_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -35,29 +35,29 @@ public:
|
|||||||
///
|
///
|
||||||
~InsetCommand();
|
~InsetCommand();
|
||||||
///
|
///
|
||||||
int Ascent(LyXFont const &font) const;
|
int Ascent(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
int Descent(LyXFont const &font) const;
|
int Descent(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
int Width(LyXFont const &font) const;
|
int Width(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
void Draw(LyXFont, LyXScreen &scr, int baseline, float &x);
|
void Draw(LyXFont, LyXScreen & scr, int baseline, float & x);
|
||||||
///
|
///
|
||||||
void Write(FILE *file);
|
void Write(FILE * file);
|
||||||
/// Parse the command.
|
/// Parse the command.
|
||||||
void scanCommand(string const &cmd);
|
void scanCommand(string const & cmd);
|
||||||
/// Will not be used when lyxf3
|
/// Will not be used when lyxf3
|
||||||
void Read(LyXLex &lex);
|
void Read(LyXLex & lex);
|
||||||
///
|
///
|
||||||
virtual int Latex(FILE *file, signed char fragile);
|
virtual int Latex(FILE * file, signed char fragile);
|
||||||
///
|
///
|
||||||
virtual int Latex(string &file, signed char fragile);
|
virtual int Latex(string & file, signed char fragile);
|
||||||
///
|
///
|
||||||
virtual int Linuxdoc(string &file);
|
virtual int Linuxdoc(string & file);
|
||||||
///
|
///
|
||||||
virtual int DocBook(string &file);
|
virtual int DocBook(string & file);
|
||||||
///
|
///
|
||||||
Inset* Clone();
|
Inset * Clone();
|
||||||
///
|
///
|
||||||
Inset::Code LyxCode() const
|
Inset::Code LyxCode() const
|
||||||
{
|
{
|
||||||
@ -78,15 +78,15 @@ public:
|
|||||||
/// Build the complete LaTeX command
|
/// Build the complete LaTeX command
|
||||||
string getCommand() const;
|
string getCommand() const;
|
||||||
///
|
///
|
||||||
string const &getCmdName() const {
|
string const & getCmdName() const {
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
string const &getOptions() const {
|
string const & getOptions() const {
|
||||||
return options;
|
return options;
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
string const &getContents() const {
|
string const & getContents() const {
|
||||||
return contents;
|
return contents;
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
|
@ -27,8 +27,8 @@ InsetError::InsetError()
|
|||||||
form = 0;
|
form = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
InsetError::InsetError(string const & string)
|
InsetError::InsetError(string const & str)
|
||||||
: contents(string)
|
: contents(str)
|
||||||
{
|
{
|
||||||
form = 0;
|
form = 0;
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ InsetError::~InsetError()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetError::Ascent(LyXFont const &font) const
|
int InsetError::Ascent(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
LyXFont efont;
|
LyXFont efont;
|
||||||
efont.setSize(font.size()).decSize();
|
efont.setSize(font.size()).decSize();
|
||||||
@ -52,7 +52,7 @@ int InsetError::Ascent(LyXFont const &font) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetError::Descent(LyXFont const &font) const
|
int InsetError::Descent(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
LyXFont efont;
|
LyXFont efont;
|
||||||
efont.setSize(font.size()).decSize();
|
efont.setSize(font.size()).decSize();
|
||||||
@ -60,7 +60,7 @@ int InsetError::Descent(LyXFont const &font) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetError::Width(LyXFont const &font) const
|
int InsetError::Width(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
LyXFont efont;
|
LyXFont efont;
|
||||||
efont.setSize(font.size()).decSize();
|
efont.setSize(font.size()).decSize();
|
||||||
@ -68,8 +68,8 @@ int InsetError::Width(LyXFont const &font) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetError::Draw(LyXFont font, LyXScreen &scr,
|
void InsetError::Draw(LyXFont font, LyXScreen & scr,
|
||||||
int baseline, float &x)
|
int baseline, float & x)
|
||||||
{
|
{
|
||||||
LyXFont efont;
|
LyXFont efont;
|
||||||
efont.setSize(font.size()).decSize();
|
efont.setSize(font.size()).decSize();
|
||||||
@ -77,15 +77,9 @@ void InsetError::Draw(LyXFont font, LyXScreen &scr,
|
|||||||
|
|
||||||
// Draw as "Error" in a framed box
|
// Draw as "Error" in a framed box
|
||||||
x += 1;
|
x += 1;
|
||||||
//scr.drawFilledRectangle(int(x), baseline - Ascent(font)+1,
|
|
||||||
// Width(font)-2,Ascent(font)+ Descent(font)-2,
|
|
||||||
// FL_GRAY80);
|
|
||||||
scr.fillRectangle(gc_lighted,
|
scr.fillRectangle(gc_lighted,
|
||||||
int(x), baseline - Ascent(font)+1,
|
int(x), baseline - Ascent(font)+1,
|
||||||
Width(font)-2,Ascent(font)+ Descent(font)-2);
|
Width(font)-2,Ascent(font)+ Descent(font)-2);
|
||||||
//scr.drawRectangle(int(x), baseline-Ascent(font)+1,
|
|
||||||
// Width(font)-2, Ascent(font)+Descent(font)-2,
|
|
||||||
// FL_RED);
|
|
||||||
scr.drawRectangle(gc_foot,
|
scr.drawRectangle(gc_foot,
|
||||||
int(x), baseline-Ascent(font)+1,
|
int(x), baseline-Ascent(font)+1,
|
||||||
Width(font)-2, Ascent(font)+Descent(font)-2);
|
Width(font)-2, Ascent(font)+Descent(font)-2);
|
||||||
@ -140,9 +134,9 @@ unsigned char InsetError::Editable() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetError::CloseErrorCB(FL_OBJECT *, long data)
|
void InsetError::CloseErrorCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
InsetError *inset = (InsetError*) data;
|
InsetError * inset = static_cast<InsetError*>(ob->u_vdata);
|
||||||
if (inset->form) {
|
if (inset->form) {
|
||||||
fl_hide_form(inset->form);
|
fl_hide_form(inset->form);
|
||||||
fl_free_form(inset->form);
|
fl_free_form(inset->form);
|
||||||
@ -150,10 +144,11 @@ void InsetError::CloseErrorCB(FL_OBJECT *, long data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// A C wrapper
|
// A C wrapper
|
||||||
extern "C" void C_InsetError_CloseErrorCB(FL_OBJECT *, long data)
|
extern "C" void C_InsetError_CloseErrorCB(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
InsetError::CloseErrorCB(0,data);
|
InsetError::CloseErrorCB(ob , data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -162,13 +157,14 @@ void InsetError::Edit(int, int)
|
|||||||
static int ow = 400, oh = 240;
|
static int ow = 400, oh = 240;
|
||||||
|
|
||||||
if (!form) {
|
if (!form) {
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT * obj;
|
||||||
form = fl_bgn_form(FL_UP_BOX,ow,oh);
|
form = fl_bgn_form(FL_UP_BOX, ow, oh);
|
||||||
strobj = fl_add_box(FL_FRAME_BOX,10,10,380,180,"");
|
strobj = fl_add_box(FL_FRAME_BOX,10,10,380,180,"");
|
||||||
fl_set_object_color(strobj,FL_MCOL,FL_MCOL);
|
fl_set_object_color(strobj,FL_MCOL,FL_MCOL);
|
||||||
fl_set_object_gravity(strobj, FL_NorthWest, FL_SouthEast);
|
fl_set_object_gravity(strobj, FL_NorthWest, FL_SouthEast);
|
||||||
obj = fl_add_button(FL_RETURN_BUTTON,140,200,120,30,_("Close"));
|
obj = fl_add_button(FL_RETURN_BUTTON,140,200,120,30,_("Close"));
|
||||||
fl_set_object_callback(obj, C_InsetError_CloseErrorCB, (long)this);
|
fl_set_object_callback(obj, C_InsetError_CloseErrorCB, 0);
|
||||||
|
obj->u_vdata = this;
|
||||||
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
fl_set_object_gravity(obj, FL_SouthEast, FL_SouthEast);
|
||||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||||
fl_end_form();
|
fl_end_form();
|
||||||
@ -187,6 +183,6 @@ void InsetError::Edit(int, int)
|
|||||||
|
|
||||||
Inset* InsetError::Clone()
|
Inset* InsetError::Clone()
|
||||||
{
|
{
|
||||||
InsetError *result = new InsetError(contents);
|
InsetError * result = new InsetError(contents);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
*
|
*
|
||||||
*======================================================*/
|
*======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_ERROR_H
|
#ifndef INSET_ERROR_H
|
||||||
#define _INSET_ERROR_H
|
#define INSET_ERROR_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -34,35 +34,35 @@ public:
|
|||||||
///
|
///
|
||||||
~InsetError();
|
~InsetError();
|
||||||
///
|
///
|
||||||
int Ascent(LyXFont const &font) const;
|
int Ascent(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
int Descent(LyXFont const &font) const;
|
int Descent(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
int Width(LyXFont const &font) const;
|
int Width(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
void Draw(LyXFont font, LyXScreen &scr, int baseline, float &x);
|
void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
|
||||||
///
|
///
|
||||||
void Write(FILE *file);
|
void Write(FILE * file);
|
||||||
///
|
///
|
||||||
void Read(LyXLex &lex);
|
void Read(LyXLex & lex);
|
||||||
///
|
///
|
||||||
int Latex(FILE *file, signed char fragile);
|
int Latex(FILE * file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Latex(string &file, signed char fragile);
|
int Latex(string & file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Linuxdoc(string &file);
|
int Linuxdoc(string & file);
|
||||||
///
|
///
|
||||||
int DocBook(string &file);
|
int DocBook(string & file);
|
||||||
///
|
///
|
||||||
bool AutoDelete() const;
|
bool AutoDelete() const;
|
||||||
/// what appears in the minibuffer when opening
|
/// what appears in the minibuffer when opening
|
||||||
char const* EditMessage() {return _("Opened error");}
|
char const * EditMessage() {return _("Opened error");}
|
||||||
///
|
///
|
||||||
void Edit(int, int);
|
void Edit(int, int);
|
||||||
///
|
///
|
||||||
unsigned char Editable() const;
|
unsigned char Editable() const;
|
||||||
///
|
///
|
||||||
Inset* Clone();
|
Inset * Clone();
|
||||||
///
|
///
|
||||||
Inset::Code LyxCode() const { return Inset::NO_CODE; }
|
Inset::Code LyxCode() const { return Inset::NO_CODE; }
|
||||||
/// We don't want "begin" and "end inset" in lyx-file
|
/// We don't want "begin" and "end inset" in lyx-file
|
||||||
@ -73,8 +73,8 @@ private:
|
|||||||
///
|
///
|
||||||
string contents;
|
string contents;
|
||||||
///
|
///
|
||||||
FL_FORM *form;
|
FL_FORM * form;
|
||||||
///
|
///
|
||||||
FL_OBJECT *strobj;
|
FL_OBJECT * strobj;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,18 +20,19 @@
|
|||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "include_form.h"
|
#include "include_form.h"
|
||||||
#include "support/FileInfo.h"
|
#include "support/FileInfo.h"
|
||||||
|
#include "layout.h"
|
||||||
|
|
||||||
extern BufferView *current_view;
|
extern BufferView * current_view;
|
||||||
|
|
||||||
extern LyXRC *lyxrc;
|
extern LyXRC * lyxrc;
|
||||||
extern BufferList bufferlist;
|
extern BufferList bufferlist;
|
||||||
extern void UpdateInset(Inset* inset, bool mark_dirty = true);
|
extern void UpdateInset(Inset * inset, bool mark_dirty = true);
|
||||||
|
|
||||||
|
|
||||||
FD_include *create_form_include(void)
|
FD_include * create_form_include(void)
|
||||||
{
|
{
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT * obj;
|
||||||
FD_include *fdui = (FD_include *) fl_calloc(1, sizeof(FD_include));
|
FD_include * fdui = (FD_include *) fl_calloc(1, sizeof(FD_include));
|
||||||
|
|
||||||
fdui->include = fl_bgn_form(FL_NO_BOX, 340, 210);
|
fdui->include = fl_bgn_form(FL_NO_BOX, 340, 210);
|
||||||
obj = fl_add_box(FL_UP_BOX,0,0,340,210,"");
|
obj = fl_add_box(FL_UP_BOX,0,0,340,210,"");
|
||||||
@ -86,12 +87,12 @@ FD_include *create_form_include(void)
|
|||||||
/*---------------------------------------*/
|
/*---------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
FD_include *form = 0;
|
FD_include * form = 0;
|
||||||
|
|
||||||
extern "C" void include_cb(FL_OBJECT *, long arg)
|
extern "C" void include_cb(FL_OBJECT *, long arg)
|
||||||
{
|
{
|
||||||
|
|
||||||
InsetInclude *inset = (InsetInclude*)form->vdata;
|
InsetInclude * inset = static_cast<InsetInclude*>(form->include->u_vdata);
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
@ -183,7 +184,7 @@ extern "C" void include_cb(FL_OBJECT *, long arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetInclude::InsetInclude(string const & fname, Buffer *bf)
|
InsetInclude::InsetInclude(string const & fname, Buffer * bf)
|
||||||
: InsetCommand("include")
|
: InsetCommand("include")
|
||||||
{
|
{
|
||||||
master = bf;
|
master = bf;
|
||||||
@ -195,7 +196,7 @@ InsetInclude::InsetInclude(string const & fname, Buffer *bf)
|
|||||||
|
|
||||||
InsetInclude::~InsetInclude()
|
InsetInclude::~InsetInclude()
|
||||||
{
|
{
|
||||||
if (form && form->vdata == this) {
|
if (form && form->include->u_vdata == this) {
|
||||||
// this inset is in the popup so hide the popup
|
// this inset is in the popup so hide the popup
|
||||||
// and remove the reference to this inset. ARRae
|
// and remove the reference to this inset. ARRae
|
||||||
if (form->include) {
|
if (form->include) {
|
||||||
@ -221,7 +222,7 @@ Inset * InsetInclude::Clone()
|
|||||||
ii->setVerb();
|
ii->setVerb();
|
||||||
ii->setVisibleSpace(isVerbVisibleSpace());
|
ii->setVisibleSpace(isVerbVisibleSpace());
|
||||||
}
|
}
|
||||||
return (Inset*)ii;
|
return ii;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsetInclude::Edit(int, int)
|
void InsetInclude::Edit(int, int)
|
||||||
@ -233,7 +234,7 @@ void InsetInclude::Edit(int, int)
|
|||||||
form = create_form_include();
|
form = create_form_include();
|
||||||
fl_set_form_atclose(form->include, IgnoreCloseBoxCB, 0);
|
fl_set_form_atclose(form->include, IgnoreCloseBoxCB, 0);
|
||||||
}
|
}
|
||||||
form->vdata = this;
|
form->include->u_vdata = this;
|
||||||
|
|
||||||
fl_set_input(form->input, contents.c_str());
|
fl_set_input(form->input, contents.c_str());
|
||||||
fl_set_button(form->flag1, int(isNoLoad()));
|
fl_set_button(form->flag1, int(isNoLoad()));
|
||||||
@ -257,13 +258,13 @@ void InsetInclude::Edit(int, int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetInclude::Write(FILE *file)
|
void InsetInclude::Write(FILE * file)
|
||||||
{
|
{
|
||||||
fprintf(file, "Include %s\n", getCommand().c_str());
|
fprintf(file, "Include %s\n", getCommand().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetInclude::Read(LyXLex &lex)
|
void InsetInclude::Read(LyXLex & lex)
|
||||||
{
|
{
|
||||||
InsetCommand::Read(lex);
|
InsetCommand::Read(lex);
|
||||||
|
|
||||||
@ -313,7 +314,7 @@ bool InsetInclude::loadIfNeeded() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetInclude::Latex(FILE *file, signed char /*fragile*/)
|
int InsetInclude::Latex(FILE * file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
string include_file;
|
string include_file;
|
||||||
signed char dummy = 0;
|
signed char dummy = 0;
|
||||||
@ -323,7 +324,7 @@ int InsetInclude::Latex(FILE *file, signed char /*fragile*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetInclude::Latex(string &file, signed char /*fragile*/)
|
int InsetInclude::Latex(string & file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
string writefile, incfile;
|
string writefile, incfile;
|
||||||
|
|
||||||
@ -341,9 +342,9 @@ int InsetInclude::Latex(string &file, signed char /*fragile*/)
|
|||||||
lyxerr << "ERROR: Cannot handle include file `"
|
lyxerr << "ERROR: Cannot handle include file `"
|
||||||
<< MakeDisplayPath(getFileName())
|
<< MakeDisplayPath(getFileName())
|
||||||
<< "' which has textclass `"
|
<< "' which has textclass `"
|
||||||
<< lyxstyle.NameOfClass(tmp->params.textclass)
|
<< textclasslist.NameOfClass(tmp->params.textclass)
|
||||||
<< "' instead of `"
|
<< "' instead of `"
|
||||||
<< lyxstyle.NameOfClass(master->params.textclass)
|
<< textclasslist.NameOfClass(master->params.textclass)
|
||||||
<< "'." << endl;
|
<< "'." << endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -400,7 +401,7 @@ int InsetInclude::Latex(string &file, signed char /*fragile*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetInclude::Validate(LaTeXFeatures& features) const
|
void InsetInclude::Validate(LaTeXFeatures & features) const
|
||||||
{
|
{
|
||||||
if (isVerb())
|
if (isVerb())
|
||||||
features.verbatim = true;
|
features.verbatim = true;
|
||||||
@ -410,7 +411,7 @@ void InsetInclude::Validate(LaTeXFeatures& features) const
|
|||||||
// to be loaded:
|
// to be loaded:
|
||||||
if (loadIfNeeded()) {
|
if (loadIfNeeded()) {
|
||||||
// a file got loaded
|
// a file got loaded
|
||||||
Buffer *tmp = bufferlist.getBuffer(getFileName());
|
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||||
tmp->validate(features);
|
tmp->validate(features);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -423,7 +424,7 @@ string InsetInclude::getLabel(int) const
|
|||||||
|
|
||||||
|
|
||||||
if (loadIfNeeded()) {
|
if (loadIfNeeded()) {
|
||||||
Buffer *tmp = bufferlist.getBuffer(getFileName());
|
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||||
tmp->setParentName("");
|
tmp->setParentName("");
|
||||||
label = tmp->getReferenceList('\n');
|
label = tmp->getReferenceList('\n');
|
||||||
tmp->setParentName(getMasterFilename());
|
tmp->setParentName(getMasterFilename());
|
||||||
@ -438,7 +439,7 @@ int InsetInclude::GetNumberOfLabels() const {
|
|||||||
int nl;
|
int nl;
|
||||||
|
|
||||||
if (loadIfNeeded()) {
|
if (loadIfNeeded()) {
|
||||||
Buffer *tmp = bufferlist.getBuffer(getFileName());
|
Buffer * tmp = bufferlist.getBuffer(getFileName());
|
||||||
tmp->setParentName("");
|
tmp->setParentName("");
|
||||||
label = tmp->getReferenceList('\n');
|
label = tmp->getReferenceList('\n');
|
||||||
tmp->setParentName(getMasterFilename());
|
tmp->setParentName(getMasterFilename());
|
||||||
@ -451,14 +452,14 @@ int InsetInclude::GetNumberOfLabels() const {
|
|||||||
|
|
||||||
string InsetInclude::getKeys() const
|
string InsetInclude::getKeys() const
|
||||||
{
|
{
|
||||||
string list;
|
string lst;
|
||||||
|
|
||||||
if (loadIfNeeded()) {
|
if (loadIfNeeded()) {
|
||||||
Buffer *tmp = bufferlist.getBuffer(getFileName());
|
Buffer *tmp = bufferlist.getBuffer(getFileName());
|
||||||
tmp->setParentName("");
|
tmp->setParentName("");
|
||||||
list = tmp->getBibkeyList(',');
|
lst = tmp->getBibkeyList(',');
|
||||||
tmp->setParentName(getMasterFilename());
|
tmp->setParentName(getMasterFilename());
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return lst;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 1997 LyX Team (this file was created this year)
|
* Copyright (C) 1997 LyX Team (this file was created this year)
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
#ifndef INSET_INCLUDE_H
|
#ifndef INSET_INCLUDE_H
|
||||||
#define INSET_INCLUDE_H
|
#define INSET_INCLUDE_H
|
||||||
@ -33,11 +33,11 @@ public:
|
|||||||
flag = InsetInclude::INCLUDE;
|
flag = InsetInclude::INCLUDE;
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
InsetInclude(string const &, Buffer*);
|
InsetInclude(string const &, Buffer *);
|
||||||
///
|
///
|
||||||
~InsetInclude();
|
~InsetInclude();
|
||||||
///
|
///
|
||||||
Inset* Clone();
|
Inset * Clone();
|
||||||
///
|
///
|
||||||
Inset::Code LyxCode() const { return Inset::INCLUDE_CODE; }
|
Inset::Code LyxCode() const { return Inset::INCLUDE_CODE; }
|
||||||
/// This is 1 if the childs have labels, 0 otherwise
|
/// This is 1 if the childs have labels, 0 otherwise
|
||||||
@ -58,9 +58,9 @@ public:
|
|||||||
///
|
///
|
||||||
void Read(LyXLex &);
|
void Read(LyXLex &);
|
||||||
///
|
///
|
||||||
int Latex(FILE *file, signed char fragile);
|
int Latex(FILE * file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Latex(string &file, signed char fragile);
|
int Latex(string & file, signed char fragile);
|
||||||
|
|
||||||
///
|
///
|
||||||
void Validate(LaTeXFeatures &) const;
|
void Validate(LaTeXFeatures &) const;
|
||||||
@ -84,18 +84,18 @@ public:
|
|||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
/// In "input" mode uses \input instead of \include.
|
/// In "input" mode uses \input instead of \include.
|
||||||
bool isInput() const { return (bool)(flag == InsetInclude::INPUT); }
|
bool isInput() const { return flag == InsetInclude::INPUT; }
|
||||||
/// If this is true, the child file shouldn't be loaded by lyx
|
/// If this is true, the child file shouldn't be loaded by lyx
|
||||||
bool isNoLoad() const { return (bool)(noload); }
|
bool isNoLoad() const { return noload; }
|
||||||
|
|
||||||
/** A verbatim file shouldn't be loaded by LyX
|
/** A verbatim file shouldn't be loaded by LyX
|
||||||
* No need to generate LaTeX code of a verbatim file
|
* No need to generate LaTeX code of a verbatim file
|
||||||
*/
|
*/
|
||||||
bool isVerb() const;
|
bool isVerb() const;
|
||||||
///
|
///
|
||||||
bool isVerbVisibleSpace() const { return (bool)(flag==InsetInclude::VERBAST);}
|
bool isVerbVisibleSpace() const { return flag==InsetInclude::VERBAST;}
|
||||||
///
|
///
|
||||||
bool isInclude() const { return (bool)(flag == InsetInclude::INCLUDE);}
|
bool isInclude() const { return flag == InsetInclude::INCLUDE;}
|
||||||
///
|
///
|
||||||
void setInput();
|
void setInput();
|
||||||
///
|
///
|
||||||
@ -126,7 +126,7 @@ private:
|
|||||||
///
|
///
|
||||||
int flag;
|
int flag;
|
||||||
///
|
///
|
||||||
Buffer *master;
|
Buffer * master;
|
||||||
///
|
///
|
||||||
string filename;
|
string filename;
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
@ -15,24 +15,16 @@
|
|||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
#include "lyx_gui_misc.h" // WarnReadonly()
|
#include "lyx_gui_misc.h" // WarnReadonly()
|
||||||
|
|
||||||
extern BufferView *current_view;
|
extern BufferView * current_view;
|
||||||
extern void UpdateInset(Inset* inset, bool mark_dirty = true);
|
extern void UpdateInset(Inset * inset, bool mark_dirty = true);
|
||||||
|
|
||||||
FD_index_form *index_form = 0;
|
FD_index_form * index_form = 0;
|
||||||
|
|
||||||
extern "C" void index_cb(FL_OBJECT *, long data)
|
extern "C" void index_cb(FL_OBJECT *, long data)
|
||||||
{
|
{
|
||||||
InsetIndex *inset = (InsetIndex*)index_form->vdata;
|
InsetIndex * inset = static_cast<InsetIndex*>(index_form->index_form->u_vdata);
|
||||||
|
|
||||||
switch (data) {
|
switch (data) {
|
||||||
// - case 0: fl_hide_form(index_form->index_form); break;
|
|
||||||
// - case 1:
|
|
||||||
// - {
|
|
||||||
// - inset->setContents(fl_get_input(index_form->key));
|
|
||||||
// - fl_hide_form(index_form->index_form);
|
|
||||||
// - UpdateInset(inset);
|
|
||||||
// - break;
|
|
||||||
// - }
|
|
||||||
case 1: // OK
|
case 1: // OK
|
||||||
if(!current_view->currentBuffer()->isReadonly()) {
|
if(!current_view->currentBuffer()->isReadonly()) {
|
||||||
string tmp = fl_get_input(index_form->key);
|
string tmp = fl_get_input(index_form->key);
|
||||||
@ -50,9 +42,9 @@ extern "C" void index_cb(FL_OBJECT *, long data)
|
|||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
FD_index_form *create_form_index_form()
|
FD_index_form * create_form_index_form()
|
||||||
{
|
{
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT * obj;
|
||||||
FD_index_form *fdui = (FD_index_form *) fl_calloc(1, sizeof(FD_index_form));
|
FD_index_form *fdui = (FD_index_form *) fl_calloc(1, sizeof(FD_index_form));
|
||||||
|
|
||||||
fdui->index_form = fl_bgn_form(FL_NO_BOX, 258, 196);
|
fdui->index_form = fl_bgn_form(FL_NO_BOX, 258, 196);
|
||||||
@ -89,7 +81,7 @@ InsetIndex::~InsetIndex()
|
|||||||
{
|
{
|
||||||
if(index_form && index_form->index_form
|
if(index_form && index_form->index_form
|
||||||
&& index_form->index_form->visible
|
&& index_form->index_form->visible
|
||||||
&& index_form->vdata == this)
|
&& index_form->index_form->u_vdata == this)
|
||||||
fl_hide_form(index_form->index_form);
|
fl_hide_form(index_form->index_form);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,7 +94,7 @@ void InsetIndex::Edit(int, int)
|
|||||||
if (!index_form)
|
if (!index_form)
|
||||||
index_form = create_form_index_form();
|
index_form = create_form_index_form();
|
||||||
|
|
||||||
index_form->vdata = this;
|
index_form->index_form->u_vdata = this;
|
||||||
fl_set_input(index_form->key, getContents().c_str());
|
fl_set_input(index_form->key, getContents().c_str());
|
||||||
if (index_form->index_form->visible) {
|
if (index_form->index_form->visible) {
|
||||||
fl_raise_form(index_form->index_form);
|
fl_raise_form(index_form->index_form);
|
||||||
@ -131,7 +123,7 @@ InsetPrintIndex::InsetPrintIndex()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetPrintIndex::InsetPrintIndex(Buffer *o)
|
InsetPrintIndex::InsetPrintIndex(Buffer * o)
|
||||||
: InsetCommand("printindex"), owner(o)
|
: InsetCommand("printindex"), owner(o)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -148,7 +140,7 @@ string InsetPrintIndex::getScreenLabel() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetPrintIndex::Validate(LaTeXFeatures &features) const
|
void InsetPrintIndex::Validate(LaTeXFeatures & features) const
|
||||||
{
|
{
|
||||||
features.makeidx = true;
|
features.makeidx = true;
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* 1996-1998 LyX Team
|
* Copyright 1996-1999 the LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_INDEX_H
|
#ifndef INSET_INDEX_H
|
||||||
#define _INSET_INDEX_H
|
#define INSET_INDEX_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -35,7 +35,7 @@ public:
|
|||||||
///
|
///
|
||||||
~InsetIndex();
|
~InsetIndex();
|
||||||
///
|
///
|
||||||
Inset *Clone() { return new InsetIndex(contents);}
|
Inset * Clone() { return new InsetIndex(contents);}
|
||||||
///
|
///
|
||||||
void Edit(int, int);
|
void Edit(int, int);
|
||||||
///
|
///
|
||||||
@ -53,13 +53,13 @@ public:
|
|||||||
///
|
///
|
||||||
InsetPrintIndex();
|
InsetPrintIndex();
|
||||||
///
|
///
|
||||||
InsetPrintIndex(Buffer*);
|
InsetPrintIndex(Buffer *);
|
||||||
///
|
///
|
||||||
~InsetPrintIndex();
|
~InsetPrintIndex();
|
||||||
/// Updates needed features for this inset.
|
/// Updates needed features for this inset.
|
||||||
void Validate(LaTeXFeatures &features) const;
|
void Validate(LaTeXFeatures & features) const;
|
||||||
///
|
///
|
||||||
void Edit(int, int){;}
|
void Edit(int, int) {}
|
||||||
///
|
///
|
||||||
unsigned char Editable() const{
|
unsigned char Editable() const{
|
||||||
return 1;
|
return 1;
|
||||||
@ -72,18 +72,16 @@ public:
|
|||||||
string getScreenLabel() const;
|
string getScreenLabel() const;
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
Buffer *owner;
|
Buffer * owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
// this was shifted here rather than a separate
|
// this was shifted here rather than a separate
|
||||||
// file because its little and only need by
|
// file because its little and only need by
|
||||||
// insetindex.C and lyx_gui_misc.C ARRae 981020
|
// insetindex.C and lyx_gui_misc.C ARRae 981020
|
||||||
struct FD_index_form {
|
struct FD_index_form {
|
||||||
FL_FORM *index_form;
|
FL_FORM * index_form;
|
||||||
FL_OBJECT *key;
|
FL_OBJECT * key;
|
||||||
void *vdata;
|
|
||||||
long ldata;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern FD_index_form *index_form;
|
extern FD_index_form * index_form;
|
||||||
#endif
|
#endif
|
||||||
|
@ -52,26 +52,26 @@ InsetInfo::~InsetInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetInfo::Ascent(LyXFont const &font) const
|
int InsetInfo::Ascent(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return font.maxAscent()+1;
|
return font.maxAscent() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetInfo::Descent(LyXFont const &font) const
|
int InsetInfo::Descent(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return font.maxDescent()+1;
|
return font.maxDescent() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetInfo::Width(LyXFont const &font) const
|
int InsetInfo::Width(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return 6 + font.textWidth(_("Note"), strlen(_("Note")));
|
return 6 + font.textWidth(_("Note"), strlen(_("Note")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetInfo::Draw(LyXFont font, LyXScreen &scr,
|
void InsetInfo::Draw(LyXFont font, LyXScreen & scr,
|
||||||
int baseline, float &x)
|
int baseline, float & x)
|
||||||
{
|
{
|
||||||
/* Info-insets are never LaTeX, so just correct the font */
|
/* Info-insets are never LaTeX, so just correct the font */
|
||||||
font.setLatex(LyXFont::OFF);
|
font.setLatex(LyXFont::OFF);
|
||||||
@ -90,13 +90,13 @@ void InsetInfo::Draw(LyXFont font, LyXScreen &scr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetInfo::Write(FILE *file)
|
void InsetInfo::Write(FILE * file)
|
||||||
{
|
{
|
||||||
fprintf(file, "Info %s", contents.c_str());
|
fprintf(file, "Info %s", contents.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetInfo::Read(LyXLex &lex)
|
void InsetInfo::Read(LyXLex & lex)
|
||||||
{
|
{
|
||||||
string tmp = lex.GetString(); // should be "Info"
|
string tmp = lex.GetString(); // should be "Info"
|
||||||
if (tmp != "Info")
|
if (tmp != "Info")
|
||||||
@ -153,12 +153,11 @@ unsigned char InsetInfo::Editable() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetInfo::CloseInfoCB(FL_OBJECT *, long data)
|
void InsetInfo::CloseInfoCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
InsetInfo *inset = (InsetInfo*) data;
|
InsetInfo * inset = static_cast<InsetInfo*>(ob->u_vdata);
|
||||||
// inset->contents = fl_get_input(inset->strobj);
|
|
||||||
string tmp = fl_get_input(inset->strobj);
|
string tmp = fl_get_input(inset->strobj);
|
||||||
Buffer *buffer = current_view->currentBuffer();
|
Buffer * buffer = current_view->currentBuffer();
|
||||||
if(tmp != inset->contents && !(buffer->isReadonly()) ) {
|
if(tmp != inset->contents && !(buffer->isReadonly()) ) {
|
||||||
buffer->markDirty();
|
buffer->markDirty();
|
||||||
inset->contents = tmp;
|
inset->contents = tmp;
|
||||||
@ -170,12 +169,14 @@ void InsetInfo::CloseInfoCB(FL_OBJECT *, long data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// This is just a wrapper.
|
// This is just a wrapper.
|
||||||
extern "C" void C_InsetInfo_CloseInfoCB(FL_OBJECT *, long data)
|
extern "C" void C_InsetInfo_CloseInfoCB(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
InsetInfo::CloseInfoCB(0, data);
|
InsetInfo::CloseInfoCB(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetInfo::Edit(int, int)
|
void InsetInfo::Edit(int, int)
|
||||||
{
|
{
|
||||||
static int ow = -1, oh;
|
static int ow = -1, oh;
|
||||||
@ -193,8 +194,9 @@ void InsetInfo::Edit(int, int)
|
|||||||
obj = fl_add_button(FL_NORMAL_BUTTON,130,140,120,30,idex(_("Close|#C^[")));
|
obj = fl_add_button(FL_NORMAL_BUTTON,130,140,120,30,idex(_("Close|#C^[")));
|
||||||
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
fl_set_object_resize(obj, FL_RESIZE_NONE);
|
||||||
fl_set_object_gravity(obj, SouthEastGravity, SouthEastGravity);
|
fl_set_object_gravity(obj, SouthEastGravity, SouthEastGravity);
|
||||||
fl_set_object_callback(obj, C_InsetInfo_CloseInfoCB, (long)this);
|
fl_set_object_callback(obj, C_InsetInfo_CloseInfoCB, 0);
|
||||||
fl_set_object_shortcut(obj, scex(_("Close|#C^[")), (long)this);
|
obj->u_vdata = this;
|
||||||
|
fl_set_object_shortcut(obj, scex(_("Close|#C^[")), 1);
|
||||||
fl_end_form();
|
fl_end_form();
|
||||||
fl_set_form_atclose(form, CancelCloseBoxCB, 0);
|
fl_set_form_atclose(form, CancelCloseBoxCB, 0);
|
||||||
}
|
}
|
||||||
@ -215,7 +217,7 @@ void InsetInfo::Edit(int, int)
|
|||||||
|
|
||||||
Inset* InsetInfo::Clone()
|
Inset* InsetInfo::Clone()
|
||||||
{
|
{
|
||||||
InsetInfo *result = new InsetInfo(contents);
|
InsetInfo * result = new InsetInfo(contents);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,12 +4,13 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
|
* Copyright 1995-1999 the LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_INFO_H
|
#ifndef INSET_INFO_H
|
||||||
#define _INSET_INFO_H
|
#define INSET_INFO_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -36,27 +37,27 @@ public:
|
|||||||
///
|
///
|
||||||
~InsetInfo();
|
~InsetInfo();
|
||||||
///
|
///
|
||||||
int Ascent(LyXFont const &font) const;
|
int Ascent(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
int Descent(LyXFont const &font) const;
|
int Descent(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
int Width(LyXFont const &font) const;
|
int Width(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
void Draw(LyXFont font, LyXScreen &scr, int baseline, float &x);
|
void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
|
||||||
///
|
///
|
||||||
void Write(FILE *file);
|
void Write(FILE * file);
|
||||||
///
|
///
|
||||||
void Read(LyXLex &lex);
|
void Read(LyXLex & lex);
|
||||||
///
|
///
|
||||||
int Latex(FILE *file, signed char fragile);
|
int Latex(FILE * file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Latex(string &file, signed char fragile);
|
int Latex(string & file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Linuxdoc(string &file);
|
int Linuxdoc(string & file);
|
||||||
///
|
///
|
||||||
int DocBook(string &file);
|
int DocBook(string & file);
|
||||||
/// what appears in the minibuffer when opening
|
/// what appears in the minibuffer when opening
|
||||||
char const* EditMessage() {return "Opened note";}
|
char const * EditMessage() {return "Opened note";}
|
||||||
///
|
///
|
||||||
void Edit(int, int);
|
void Edit(int, int);
|
||||||
///
|
///
|
||||||
@ -64,16 +65,15 @@ public:
|
|||||||
///
|
///
|
||||||
Inset::Code LyxCode() const;
|
Inset::Code LyxCode() const;
|
||||||
///
|
///
|
||||||
Inset* Clone();
|
Inset * Clone();
|
||||||
///
|
///
|
||||||
static void CloseInfoCB(FL_OBJECT *, long data);
|
static void CloseInfoCB(FL_OBJECT *, long data);
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
string contents;
|
string contents;
|
||||||
///
|
///
|
||||||
FL_FORM *form;
|
FL_FORM * form;
|
||||||
///
|
///
|
||||||
FL_OBJECT *strobj;
|
FL_OBJECT * strobj;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,9 +30,9 @@ InsetLabel::~InsetLabel()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Inset* InsetLabel::Clone()
|
Inset * InsetLabel::Clone()
|
||||||
{
|
{
|
||||||
InsetLabel *result = new InsetLabel(getCommand());
|
InsetLabel * result = new InsetLabel(getCommand());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,28 +48,28 @@ string InsetLabel::getLabel(int) const
|
|||||||
return contents;
|
return contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
int InsetLabel::Latex(FILE *file, signed char /*fragile*/)
|
int InsetLabel::Latex(FILE * file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
fprintf(file, "%s", escape(getCommand()).c_str());
|
fprintf(file, "%s", escape(getCommand()).c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLabel::Latex(string &file, signed char /*fragile*/)
|
int InsetLabel::Latex(string & file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
file += escape(getCommand());
|
file += escape(getCommand());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLabel::Linuxdoc(string &file)
|
int InsetLabel::Linuxdoc(string & file)
|
||||||
{
|
{
|
||||||
file += "<label id=\"" + getContents() +"\" >";
|
file += "<label id=\"" + getContents() +"\" >";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLabel::DocBook(string &file)
|
int InsetLabel::DocBook(string & file)
|
||||||
{
|
{
|
||||||
file += "<anchor id=\"" + getContents() +"\" >";
|
file += "<anchor id=\"" + getContents() +"\" >";
|
||||||
return 0;
|
return 0;
|
||||||
@ -82,14 +82,14 @@ string InsetLabel::escape(string const & lab) const {
|
|||||||
char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
|
char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
|
||||||
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
|
||||||
string enc;
|
string enc;
|
||||||
for (string::size_type i=0; i<lab.length(); i++) {
|
for (string::size_type i=0; i < lab.length(); ++i) {
|
||||||
unsigned char c=lab[i];
|
unsigned char c = lab[i];
|
||||||
if (c >= 128 || c=='=' || c=='%') {
|
if (c >= 128 || c == '=' || c == '%') {
|
||||||
enc += '=';
|
enc += '=';
|
||||||
enc += hexdigit[c>>4];
|
enc += hexdigit[c >> 4];
|
||||||
enc += hexdigit[c & 15];
|
enc += hexdigit[c & 15];
|
||||||
} else {
|
} else {
|
||||||
enc += (char) c;
|
enc += c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return enc;
|
return enc;
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* 1995-1998 The LyX Team
|
* Copyright 1995-1999 The LyX Team
|
||||||
*
|
*
|
||||||
*======================================================*/
|
*======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_LABEL_H
|
#ifndef INSET_LABEL_H
|
||||||
#define _INSET_LABEL_H
|
#define INSET_LABEL_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -25,11 +25,11 @@ public:
|
|||||||
///
|
///
|
||||||
InsetLabel(string const & cmd);
|
InsetLabel(string const & cmd);
|
||||||
///
|
///
|
||||||
InsetLabel() : InsetCommand("label") {;}
|
InsetLabel() : InsetCommand("label") {}
|
||||||
///
|
///
|
||||||
~InsetLabel();
|
~InsetLabel();
|
||||||
///
|
///
|
||||||
Inset* Clone();
|
Inset * Clone();
|
||||||
///
|
///
|
||||||
Inset::Code LyxCode() const { return Inset::LABEL_CODE; }
|
Inset::Code LyxCode() const { return Inset::LABEL_CODE; }
|
||||||
///
|
///
|
||||||
@ -41,13 +41,13 @@ public:
|
|||||||
///
|
///
|
||||||
unsigned char Editable() const { return 0; }
|
unsigned char Editable() const { return 0; }
|
||||||
///
|
///
|
||||||
int Latex(FILE *file, signed char fragile);
|
int Latex(FILE * file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Latex(string &file, signed char fragile);
|
int Latex(string & file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Linuxdoc(string &file);
|
int Linuxdoc(string & file);
|
||||||
///
|
///
|
||||||
int DocBook(string &file);
|
int DocBook(string & file);
|
||||||
private:
|
private:
|
||||||
/// This function escapes 8-bit characters
|
/// This function escapes 8-bit characters
|
||||||
string escape(string const &) const;
|
string escape(string const &) const;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Copyright 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright 1995-1999 The LyX Team.
|
* Copyright 1995-1999 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@ -37,26 +37,26 @@ InsetLatex::~InsetLatex()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatex::Ascent(LyXFont const &font) const
|
int InsetLatex::Ascent(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return font.maxAscent() + 1;
|
return font.maxAscent() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatex::Descent(LyXFont const &font) const
|
int InsetLatex::Descent(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return font.maxDescent() + 1;
|
return font.maxDescent() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatex::Width(LyXFont const &font) const
|
int InsetLatex::Width(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return 6 + font.stringWidth(contents);
|
return 6 + font.stringWidth(contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetLatex::Draw(LyXFont font, LyXScreen &scr,
|
void InsetLatex::Draw(LyXFont font, LyXScreen & scr,
|
||||||
int baseline, float &x)
|
int baseline, float & x)
|
||||||
{
|
{
|
||||||
// Latex-insets are always LaTeX, so just correct the font */
|
// Latex-insets are always LaTeX, so just correct the font */
|
||||||
font.setLatex(LyXFont::ON);
|
font.setLatex(LyXFont::ON);
|
||||||
@ -64,15 +64,9 @@ void InsetLatex::Draw(LyXFont font, LyXScreen &scr,
|
|||||||
// Draw it as a box with the LaTeX text
|
// Draw it as a box with the LaTeX text
|
||||||
x += 1;
|
x += 1;
|
||||||
|
|
||||||
//scr.drawFilledRectangle(int(x), baseline - Ascent(font) + 1,
|
|
||||||
// Width(font)-2, Ascent(font) + Descent(font)-2,
|
|
||||||
// FL_GRAY80);
|
|
||||||
scr.fillRectangle(gc_lighted, int(x), baseline - Ascent(font) +1 ,
|
scr.fillRectangle(gc_lighted, int(x), baseline - Ascent(font) +1 ,
|
||||||
Width(font) - 2, Ascent(font) + Descent(font) -2);
|
Width(font) - 2, Ascent(font) + Descent(font) -2);
|
||||||
|
|
||||||
//scr.drawRectangle(int(x), baseline - Ascent(font) + 1,
|
|
||||||
// Width(font)-2, Ascent(font)+Descent(font)-2,
|
|
||||||
// FL_RED);
|
|
||||||
scr.drawRectangle(gc_foot,int(x), baseline - Ascent(font) + 1,
|
scr.drawRectangle(gc_foot,int(x), baseline - Ascent(font) + 1,
|
||||||
Width(font)-2, Ascent(font)+Descent(font)-2);
|
Width(font)-2, Ascent(font)+Descent(font)-2);
|
||||||
|
|
||||||
@ -81,49 +75,46 @@ void InsetLatex::Draw(LyXFont font, LyXScreen &scr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetLatex::Write(FILE *file)
|
void InsetLatex::Write(FILE * file)
|
||||||
{
|
{
|
||||||
fprintf(file, "Latex %s\n", contents.c_str());
|
fprintf(file, "Latex %s\n", contents.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetLatex::Read(LyXLex &lex)
|
void InsetLatex::Read(LyXLex & lex)
|
||||||
{
|
{
|
||||||
FILE *file = lex.getFile();
|
FILE * file = lex.getFile();
|
||||||
int i = 0;
|
char c = 0;
|
||||||
char c='\0';
|
string tmp;
|
||||||
char tmp[100];
|
|
||||||
while (!feof(file) && (c = fgetc(file)) != '\n') {
|
while (!feof(file) && (c = fgetc(file)) != '\n') {
|
||||||
tmp[i]=c;
|
tmp += char(c);
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
tmp[i]='\0';
|
|
||||||
contents = tmp;
|
contents = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatex::Latex(FILE *file, signed char /*fragile*/)
|
int InsetLatex::Latex(FILE * file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
fprintf(file, "%s", contents.c_str());
|
fprintf(file, "%s", contents.c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatex::Latex(string &file, signed char /*fragile*/)
|
int InsetLatex::Latex(string & file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
file += contents;
|
file += contents;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatex::Linuxdoc(string &file)
|
int InsetLatex::Linuxdoc(string & file)
|
||||||
{
|
{
|
||||||
file += contents;
|
file += contents;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatex::DocBook(string &file)
|
int InsetLatex::DocBook(string & file)
|
||||||
{
|
{
|
||||||
file += contents;
|
file += contents;
|
||||||
return 0;
|
return 0;
|
||||||
@ -136,9 +127,9 @@ bool InsetLatex::Deletable() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Inset* InsetLatex::Clone()
|
Inset * InsetLatex::Clone()
|
||||||
{
|
{
|
||||||
InsetLatex *result = new InsetLatex(contents);
|
InsetLatex * result = new InsetLatex(contents);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright (C) 1995 Matthias Ettrich
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_LATEX_H
|
#ifndef INSET_LATEX_H
|
||||||
#define _INSET_LATEX_H
|
#define INSET_LATEX_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -33,29 +33,29 @@ public:
|
|||||||
///
|
///
|
||||||
~InsetLatex();
|
~InsetLatex();
|
||||||
///
|
///
|
||||||
int Ascent(LyXFont const &font) const;
|
int Ascent(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
int Descent(LyXFont const &font) const;
|
int Descent(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
int Width(LyXFont const &font) const;
|
int Width(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
void Draw(LyXFont font, LyXScreen &scr, int baseline, float &x);
|
void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
|
||||||
///
|
///
|
||||||
void Write(FILE *file);
|
void Write(FILE * file);
|
||||||
///
|
///
|
||||||
void Read(LyXLex &lex);
|
void Read(LyXLex & lex);
|
||||||
///
|
///
|
||||||
int Latex(FILE *file, signed char fragile);
|
int Latex(FILE * file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Latex(string &file, signed char fragile);
|
int Latex(string & file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Linuxdoc(string &file);
|
int Linuxdoc(string & file);
|
||||||
///
|
///
|
||||||
int DocBook(string &file);
|
int DocBook(string & file);
|
||||||
///
|
///
|
||||||
bool Deletable() const;
|
bool Deletable() const;
|
||||||
///
|
///
|
||||||
Inset* Clone();
|
Inset * Clone();
|
||||||
///
|
///
|
||||||
Inset::Code LyxCode() const;
|
Inset::Code LyxCode() const;
|
||||||
private:
|
private:
|
||||||
|
@ -60,7 +60,7 @@ void InsetLatexAccent::checkContents()
|
|||||||
{
|
{
|
||||||
candisp = false;
|
candisp = false;
|
||||||
|
|
||||||
if (contents.empty() || contents.length()<2) return;
|
if (contents.empty() || contents.length() < 2) return;
|
||||||
|
|
||||||
// REMOVE IN 0.13
|
// REMOVE IN 0.13
|
||||||
// Dirty Hack for backward compability. remove in 0.13 (Lgb)
|
// Dirty Hack for backward compability. remove in 0.13 (Lgb)
|
||||||
@ -239,17 +239,17 @@ void InsetLatexAccent::checkContents()
|
|||||||
remdot = true;
|
remdot = true;
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
} else if ( (ic=='i'|| ic=='j') && contents[4]=='}') {
|
} else if ( (ic == 'i'|| ic == 'j') && contents[4] == '}') {
|
||||||
// Do a rewrite: \<foo>{i} --> \<foo>{\i}
|
// Do a rewrite: \<foo>{i} --> \<foo>{\i}
|
||||||
string temp=contents;
|
string temp = contents;
|
||||||
temp.erase(3, string::npos);
|
temp.erase(3, string::npos);
|
||||||
temp+='\\';
|
temp += '\\';
|
||||||
temp+=char(ic);
|
temp += char(ic);
|
||||||
for(string::size_type j = 4; j < contents.length(); ++j)
|
for(string::size_type j = 4; j < contents.length(); ++j)
|
||||||
temp+=contents[j];
|
temp+=contents[j];
|
||||||
contents=temp;
|
contents=temp;
|
||||||
i++;
|
i++;
|
||||||
remdot=true;
|
remdot = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// demand a '}' at the end
|
// demand a '}' at the end
|
||||||
@ -267,7 +267,7 @@ void InsetLatexAccent::checkContents()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatexAccent::Ascent(LyXFont const &font) const
|
int InsetLatexAccent::Ascent(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
int max;
|
int max;
|
||||||
if (candisp) {
|
if (candisp) {
|
||||||
@ -283,7 +283,7 @@ int InsetLatexAccent::Ascent(LyXFont const &font) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatexAccent::Descent(LyXFont const &font) const
|
int InsetLatexAccent::Descent(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
int max;
|
int max;
|
||||||
if (candisp) {
|
if (candisp) {
|
||||||
@ -299,7 +299,7 @@ int InsetLatexAccent::Descent(LyXFont const &font) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatexAccent::Width(LyXFont const &font) const
|
int InsetLatexAccent::Width(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
if (candisp)
|
if (candisp)
|
||||||
return font.textWidth(&ic, 1);
|
return font.textWidth(&ic, 1);
|
||||||
@ -308,11 +308,10 @@ int InsetLatexAccent::Width(LyXFont const &font) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool InsetLatexAccent::DisplayISO8859_9(LyXFont font,
|
bool InsetLatexAccent::DisplayISO8859_9(LyXFont font,
|
||||||
LyXScreen &scr,
|
LyXScreen & scr,
|
||||||
int baseline,
|
int baseline,
|
||||||
float &x)
|
float & x)
|
||||||
{
|
{
|
||||||
unsigned char tmpic = ic;
|
unsigned char tmpic = ic;
|
||||||
|
|
||||||
@ -354,9 +353,9 @@ bool InsetLatexAccent::DisplayISO8859_9(LyXFont font,
|
|||||||
|
|
||||||
|
|
||||||
void InsetLatexAccent::Draw(LyXFont font,
|
void InsetLatexAccent::Draw(LyXFont font,
|
||||||
LyXScreen &scr,
|
LyXScreen & scr,
|
||||||
int baseline,
|
int baseline,
|
||||||
float &x)
|
float & x)
|
||||||
{
|
{
|
||||||
if (lyxrc->font_norm=="iso8859-9")
|
if (lyxrc->font_norm=="iso8859-9")
|
||||||
if (DisplayISO8859_9 (font, scr, baseline, x))
|
if (DisplayISO8859_9 (font, scr, baseline, x))
|
||||||
@ -368,7 +367,7 @@ void InsetLatexAccent::Draw(LyXFont font,
|
|||||||
int asc = Ascent(font);
|
int asc = Ascent(font);
|
||||||
int desc = Descent(font);
|
int desc = Descent(font);
|
||||||
int wid = Width(font);
|
int wid = Width(font);
|
||||||
float x2 = x+(float(wid)/2);
|
float x2 = x + float(wid/2);
|
||||||
float hg35;
|
float hg35;
|
||||||
int hg, y;
|
int hg, y;
|
||||||
if (plusasc) {
|
if (plusasc) {
|
||||||
@ -567,19 +566,11 @@ void InsetLatexAccent::Draw(LyXFont font,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//scr.drawFilledRectangle(int(x+1), baseline - Ascent(font)+1,
|
|
||||||
// Width(font)-2,
|
|
||||||
// Ascent(font)+Descent(font)-2,
|
|
||||||
// FL_GRAY80);
|
|
||||||
scr.fillRectangle(gc_lighted,
|
scr.fillRectangle(gc_lighted,
|
||||||
int(x+1), baseline - Ascent(font)+1,
|
int(x+1), baseline - Ascent(font)+1,
|
||||||
Width(font)-2,
|
Width(font)-2,
|
||||||
Ascent(font)+Descent(font)-2);
|
Ascent(font)+Descent(font)-2);
|
||||||
|
|
||||||
//scr.drawRectangle(int(x), baseline - Ascent(font),
|
|
||||||
// Width(font)-1,
|
|
||||||
// Ascent(font)+Descent(font)-1,
|
|
||||||
// FL_GRAY80);
|
|
||||||
scr.drawRectangle(gc_lighted,
|
scr.drawRectangle(gc_lighted,
|
||||||
int(x), baseline - Ascent(font),
|
int(x), baseline - Ascent(font),
|
||||||
Width(font)-1,
|
Width(font)-1,
|
||||||
@ -590,13 +581,13 @@ void InsetLatexAccent::Draw(LyXFont font,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetLatexAccent::Write(FILE *file)
|
void InsetLatexAccent::Write(FILE * file)
|
||||||
{
|
{
|
||||||
fprintf(file, "\\i %s\n", contents.c_str());
|
fprintf(file, "\\i %s\n", contents.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetLatexAccent::Read(LyXLex &lex)
|
void InsetLatexAccent::Read(LyXLex & lex)
|
||||||
{
|
{
|
||||||
lex.EatLine();
|
lex.EatLine();
|
||||||
contents = lex.GetString();
|
contents = lex.GetString();
|
||||||
@ -604,28 +595,28 @@ void InsetLatexAccent::Read(LyXLex &lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatexAccent::Latex(FILE *file, signed char /*fragile*/)
|
int InsetLatexAccent::Latex(FILE * file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
fprintf(file, "%s", contents.c_str());
|
fprintf(file, "%s", contents.c_str());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatexAccent::Latex(string &file, signed char /*fragile*/)
|
int InsetLatexAccent::Latex(string & file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
file += contents;
|
file += contents;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatexAccent::Linuxdoc(string &file)
|
int InsetLatexAccent::Linuxdoc(string & file)
|
||||||
{
|
{
|
||||||
file += contents;
|
file += contents;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetLatexAccent::DocBook(string &file)
|
int InsetLatexAccent::DocBook(string & file)
|
||||||
{
|
{
|
||||||
file += contents;
|
file += contents;
|
||||||
return 0;
|
return 0;
|
||||||
@ -646,7 +637,7 @@ bool InsetLatexAccent::DirectWrite() const
|
|||||||
|
|
||||||
Inset* InsetLatexAccent::Clone()
|
Inset* InsetLatexAccent::Clone()
|
||||||
{
|
{
|
||||||
InsetLatexAccent *result = new InsetLatexAccent(contents);
|
InsetLatexAccent * result = new InsetLatexAccent(contents);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -657,7 +648,7 @@ Inset::Code InsetLatexAccent::LyxCode() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool InsetLatexAccent::IsEqual(Inset* other)
|
bool InsetLatexAccent::IsEqual(Inset * other)
|
||||||
{
|
{
|
||||||
if (other && other->LyxCode() == Inset::ACCENT_CODE){
|
if (other && other->LyxCode() == Inset::ACCENT_CODE){
|
||||||
InsetLatexAccent* otheraccent = (InsetLatexAccent*) other;
|
InsetLatexAccent* otheraccent = (InsetLatexAccent*) other;
|
||||||
|
@ -34,42 +34,42 @@ public:
|
|||||||
///
|
///
|
||||||
InsetLatexAccent(string const & string);
|
InsetLatexAccent(string const & string);
|
||||||
///
|
///
|
||||||
InsetLatexAccent(InsetLatexAccent const&);
|
InsetLatexAccent(InsetLatexAccent const &);
|
||||||
///
|
///
|
||||||
~InsetLatexAccent();
|
~InsetLatexAccent();
|
||||||
///
|
///
|
||||||
int Ascent(LyXFont const &font) const;
|
int Ascent(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
int Descent(LyXFont const &font) const;
|
int Descent(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
int Width(LyXFont const &font) const;
|
int Width(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
bool DisplayISO8859_9(LyXFont font, LyXScreen &scr,
|
bool DisplayISO8859_9(LyXFont font, LyXScreen & scr,
|
||||||
int baseline, float &x);
|
int baseline, float & x);
|
||||||
///
|
///
|
||||||
void Draw(LyXFont font, LyXScreen &scr, int baseline, float &x);
|
void Draw(LyXFont font, LyXScreen & scr, int baseline, float & x);
|
||||||
///
|
///
|
||||||
void Write(FILE *file);
|
void Write(FILE * file);
|
||||||
///
|
///
|
||||||
void Read(LyXLex &lex);
|
void Read(LyXLex & lex);
|
||||||
///
|
///
|
||||||
int Latex(FILE *file, signed char fragile);
|
int Latex(FILE * file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Latex(string &file, signed char fragile);
|
int Latex(string & file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Linuxdoc(string &file);
|
int Linuxdoc(string & file);
|
||||||
///
|
///
|
||||||
int DocBook(string &file);
|
int DocBook(string & file);
|
||||||
///
|
///
|
||||||
bool Deletable() const;
|
bool Deletable() const;
|
||||||
///
|
///
|
||||||
bool DirectWrite() const;
|
bool DirectWrite() const;
|
||||||
///
|
///
|
||||||
Inset* Clone();
|
Inset * Clone();
|
||||||
///
|
///
|
||||||
Inset::Code LyxCode()const;
|
Inset::Code LyxCode()const;
|
||||||
///
|
///
|
||||||
bool IsEqual(Inset* other);
|
bool IsEqual(Inset * other);
|
||||||
///
|
///
|
||||||
inline bool CanDisplay();
|
inline bool CanDisplay();
|
||||||
private:
|
private:
|
||||||
@ -145,4 +145,3 @@ bool InsetLatexAccent::CanDisplay()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -5,15 +5,14 @@
|
|||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright (C) 1995 Matthias Ettrich
|
||||||
* Copyright (C) 1996-1998 The LyX Team.
|
* Copyright (C) 1996-1999 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
// Created by Bernhard 970908
|
// Created by Bernhard 970908
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "insetloa.h"
|
#pragma implementation "insetloa.h"
|
||||||
#pragma implementation "insetlof.h"
|
#pragma implementation "insetlof.h"
|
||||||
@ -25,5 +24,7 @@
|
|||||||
#include "insetlof.h"
|
#include "insetlof.h"
|
||||||
#include "insetlot.h"
|
#include "insetlot.h"
|
||||||
|
|
||||||
void InsetLOA::Validate(LaTeXFeatures &features) const
|
void InsetLOA::Validate(LaTeXFeatures & features) const
|
||||||
{ features.algorithm = true; }
|
{
|
||||||
|
features.algorithm = true;
|
||||||
|
}
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* 1996-1998 LyX Team
|
* Copyright 1996-1999 the LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
*======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_LOA_H
|
#ifndef INSET_LOA_H
|
||||||
#define _INSET_LOA_H
|
#define INSET_LOA_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -28,11 +28,11 @@ public:
|
|||||||
///
|
///
|
||||||
InsetLOA(): InsetCommand("listofalgorithms") {}
|
InsetLOA(): InsetCommand("listofalgorithms") {}
|
||||||
///
|
///
|
||||||
InsetLOA(Buffer *b): InsetCommand("listofalgorithms"),owner(b) {}
|
InsetLOA(Buffer * b): InsetCommand("listofalgorithms"),owner(b) {}
|
||||||
///
|
///
|
||||||
void Validate(LaTeXFeatures &features) const;
|
void Validate(LaTeXFeatures & features) const;
|
||||||
///
|
///
|
||||||
Inset* Clone() { return new InsetLOA(owner); }
|
Inset * Clone() { return new InsetLOA(owner); }
|
||||||
///
|
///
|
||||||
string getScreenLabel() const { return _("List of Algorithms"); }
|
string getScreenLabel() const { return _("List of Algorithms"); }
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ public:
|
|||||||
Inset::Code LyxCode() const { return Inset::LOA_CODE; }
|
Inset::Code LyxCode() const { return Inset::LOA_CODE; }
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
Buffer *owner;
|
Buffer * owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* 1996-1998 LyX Team
|
* Copyright 1996-1999 the LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
*======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_LOF_H
|
#ifndef INSET_LOF_H
|
||||||
#define _INSET_LOF_H
|
#define INSET_LOF_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -28,9 +28,9 @@ public:
|
|||||||
///
|
///
|
||||||
InsetLOF(): InsetCommand("listoffigures") {}
|
InsetLOF(): InsetCommand("listoffigures") {}
|
||||||
///
|
///
|
||||||
InsetLOF(Buffer *b): InsetCommand("listoffigures"),owner(b) {}
|
InsetLOF(Buffer * b): InsetCommand("listoffigures"),owner(b) {}
|
||||||
///
|
///
|
||||||
Inset* Clone() { return new InsetLOF(owner); }
|
Inset * Clone() { return new InsetLOF(owner); }
|
||||||
///
|
///
|
||||||
string getScreenLabel() const { return _("List of Figures"); }
|
string getScreenLabel() const { return _("List of Figures"); }
|
||||||
|
|
||||||
@ -45,7 +45,6 @@ public:
|
|||||||
Inset::Code LyxCode() const { return Inset::LOF_CODE; }
|
Inset::Code LyxCode() const { return Inset::LOF_CODE; }
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
Buffer *owner;
|
Buffer * owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* 1996-1998 LyX Team
|
* Copyright 1996-1999 LyX Team
|
||||||
*
|
*
|
||||||
*======================================================*/
|
*======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_LOT_H
|
#ifndef INSET_LOT_H
|
||||||
#define _INSET_LOT_H
|
#define INSET_LOT_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -28,9 +28,9 @@ public:
|
|||||||
///
|
///
|
||||||
InsetLOT(): InsetCommand("listoftables") {}
|
InsetLOT(): InsetCommand("listoftables") {}
|
||||||
///
|
///
|
||||||
InsetLOT(Buffer *b): InsetCommand("listoftables"), owner(b) {}
|
InsetLOT(Buffer * b): InsetCommand("listoftables"), owner(b) {}
|
||||||
///
|
///
|
||||||
Inset* Clone() { return new InsetLOT(owner); }
|
Inset * Clone() { return new InsetLOT(owner); }
|
||||||
///
|
///
|
||||||
string getScreenLabel() const { return _("List of Tables"); }
|
string getScreenLabel() const { return _("List of Tables"); }
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ public:
|
|||||||
Inset::Code LyxCode() const { return Inset::LOT_CODE; }
|
Inset::Code LyxCode() const { return Inset::LOT_CODE; }
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
Buffer *owner;
|
Buffer * owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1997-1998 LyX Team
|
* Copyright (C) 1997-1999 LyX Team
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
|
|
||||||
// Created by asierra 970813
|
// Created by asierra 970813
|
||||||
@ -25,10 +25,10 @@
|
|||||||
#include "commandtags.h"
|
#include "commandtags.h"
|
||||||
|
|
||||||
|
|
||||||
extern BufferView *current_view;
|
extern BufferView * current_view;
|
||||||
|
|
||||||
|
|
||||||
InsetParent::InsetParent(string fn, Buffer* owner): InsetCommand("lyxparent")
|
InsetParent::InsetParent(string fn, Buffer * owner): InsetCommand("lyxparent")
|
||||||
{
|
{
|
||||||
if (owner)
|
if (owner)
|
||||||
setContents(MakeAbsPath(fn, OnlyPath(owner->getFileName())));
|
setContents(MakeAbsPath(fn, OnlyPath(owner->getFileName())));
|
||||||
@ -43,7 +43,7 @@ void InsetParent::Edit(int, int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LaTeX must just ignore this command
|
// LaTeX must just ignore this command
|
||||||
int InsetParent::Latex(FILE *file, signed char fragile)
|
int InsetParent::Latex(FILE * file, signed char fragile)
|
||||||
{
|
{
|
||||||
fprintf(file, "%%#{lyx}");
|
fprintf(file, "%%#{lyx}");
|
||||||
InsetCommand::Latex(file, fragile);
|
InsetCommand::Latex(file, fragile);
|
||||||
@ -51,7 +51,7 @@ int InsetParent::Latex(FILE *file, signed char fragile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LaTeX must just ignore this command
|
// LaTeX must just ignore this command
|
||||||
int InsetParent::Latex(string &file, signed char fragile)
|
int InsetParent::Latex(string & file, signed char fragile)
|
||||||
{
|
{
|
||||||
file += "%%#{lyx}";
|
file += "%%#{lyx}";
|
||||||
InsetCommand::Latex(file, fragile);
|
InsetCommand::Latex(file, fragile);
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1997-1998 LyX Team
|
* Copyright (C) 1997-1999 LyX Team
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_PARENT_H
|
#ifndef INSET_PARENT_H
|
||||||
#define _INSET_PARENT_H
|
#define INSET_PARENT_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -29,15 +29,15 @@ public:
|
|||||||
/// Non-standard LyX macro
|
/// Non-standard LyX macro
|
||||||
InsetParent(): InsetCommand("lyxparent") { }
|
InsetParent(): InsetCommand("lyxparent") { }
|
||||||
///
|
///
|
||||||
InsetParent(string fn, Buffer* owner=0);
|
InsetParent(string fn, Buffer * owner=0);
|
||||||
///
|
///
|
||||||
~InsetParent() {}
|
~InsetParent() {}
|
||||||
///
|
///
|
||||||
int Latex(FILE *file, signed char fragile);
|
int Latex(FILE * file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Latex(string &file, signed char fragile);
|
int Latex(string & file, signed char fragile);
|
||||||
///
|
///
|
||||||
Inset* Clone() { return new InsetParent(getContents()); }
|
Inset * Clone() { return new InsetParent(getContents()); }
|
||||||
///
|
///
|
||||||
string getScreenLabel() const { return string(_("Parent:"))+getContents(); }
|
string getScreenLabel() const { return string(_("Parent:"))+getContents(); }
|
||||||
///
|
///
|
||||||
@ -51,5 +51,4 @@ public:
|
|||||||
///
|
///
|
||||||
void setParent(string fn) { setContents(fn); }
|
void setParent(string fn) { setContents(fn); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -88,9 +88,10 @@ InsetQuotes::InsetQuotes(char c, BufferParams const & params)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetQuotes::ParseString(string str)
|
void InsetQuotes::ParseString(string const & s)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
string str(s);
|
||||||
if (str.length() != 3) {
|
if (str.length() != 3) {
|
||||||
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
|
lyxerr << "ERROR (InsetQuotes::InsetQuotes):"
|
||||||
" bad string length." << endl;
|
" bad string length." << endl;
|
||||||
@ -137,8 +138,7 @@ void InsetQuotes::ParseString(string str)
|
|||||||
string InsetQuotes::DispString() const
|
string InsetQuotes::DispString() const
|
||||||
{
|
{
|
||||||
string disp;
|
string disp;
|
||||||
|
disp += quote_char[quote_index[side][language]];
|
||||||
disp = quote_char[quote_index[side][language]];
|
|
||||||
if (times == InsetQuotes::DoubleQ)
|
if (times == InsetQuotes::DoubleQ)
|
||||||
disp += disp;
|
disp += disp;
|
||||||
|
|
||||||
@ -307,7 +307,7 @@ void InsetQuotes::Validate(LaTeXFeatures & features) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Inset* InsetQuotes::Clone()
|
Inset * InsetQuotes::Clone()
|
||||||
{
|
{
|
||||||
return new InsetQuotes(language, side, times);
|
return new InsetQuotes(language, side, times);
|
||||||
}
|
}
|
||||||
|
@ -113,9 +113,8 @@ private:
|
|||||||
*/
|
*/
|
||||||
InsetQuotes(quote_language l, quote_side s, quote_times t);
|
InsetQuotes(quote_language l, quote_side s, quote_times t);
|
||||||
///
|
///
|
||||||
void ParseString(string str);
|
void ParseString(string const &);
|
||||||
///
|
///
|
||||||
string DispString() const;
|
string DispString() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
@ -16,121 +16,10 @@
|
|||||||
#include "commandtags.h"
|
#include "commandtags.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
|
||||||
extern BufferView *current_view;
|
extern BufferView * current_view;
|
||||||
|
|
||||||
// Temporarily disabled the GUI code. Reasons:
|
|
||||||
// - Only page-ref button works currently, IMO we should use a LyX action
|
|
||||||
// instead, to toggle the kind of refs.
|
|
||||||
// - To change the label, IMO it's faster to delete the old one and insert
|
|
||||||
// a new one.
|
|
||||||
// - To goto to the label, IMO it's much faster to just click on the
|
|
||||||
// inset. That's how I've implemented it now, I hope you'll like it.
|
|
||||||
// - The more GUI code we can remove, the less work we'll have at
|
|
||||||
// the toolkit switch.
|
|
||||||
// (ale 970723)
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
/* Header file generated with fdesign. */
|
|
||||||
|
|
||||||
/**** Callback routines ****/
|
|
||||||
|
|
||||||
static void ref_close_cb(FL_OBJECT *, long);
|
|
||||||
static void goto_label_cb(FL_OBJECT *, long);
|
|
||||||
static void label_change_cb(FL_OBJECT *, long);
|
|
||||||
|
|
||||||
/**** Forms and Objects ****/
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
FL_FORM *ref;
|
|
||||||
void *vdata;
|
|
||||||
long ldata;
|
|
||||||
FL_OBJECT *pg_grp;
|
|
||||||
FL_OBJECT *flag1;
|
|
||||||
FL_OBJECT *flag2;
|
|
||||||
} FD_ref;
|
|
||||||
|
|
||||||
/* Form definition file generated with fdesign. */
|
|
||||||
|
|
||||||
static
|
|
||||||
FD_ref *create_form_ref(void)
|
|
||||||
{
|
|
||||||
FL_OBJECT *obj;
|
|
||||||
FD_ref *fdui = (FD_ref *) fl_calloc(1, sizeof(*fdui));
|
|
||||||
|
|
||||||
fdui->ref = fl_bgn_form(FL_NO_BOX, 210, 170);
|
|
||||||
obj = fl_add_box(FL_UP_BOX,0,0,210,170,"");
|
|
||||||
obj = fl_add_frame(FL_ENGRAVED_FRAME,10,20,130,60,"");
|
|
||||||
obj = fl_add_button(FL_RETURN_BUTTON,120,130,80,30,_("Close"));
|
|
||||||
fl_set_object_lsize(obj,FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_callback(obj,ref_close_cb,0);
|
|
||||||
obj = fl_add_text(FL_NORMAL_TEXT,20,10,110,20,_("Reference Type"));
|
|
||||||
fl_set_object_lsize(obj,FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_lalign(obj,FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
|
|
||||||
obj = fl_add_button(FL_NORMAL_BUTTON,10,130,100,30,_("Goto Label"));
|
|
||||||
fl_set_object_lsize(obj,FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_callback(obj,goto_label_cb,0);
|
|
||||||
obj = fl_add_button(FL_NORMAL_BUTTON,10,90,100,30,_("Change Label"));
|
|
||||||
fl_set_object_lsize(obj,FL_NORMAL_SIZE);
|
|
||||||
fl_set_object_callback(obj,label_change_cb,0);
|
|
||||||
|
|
||||||
fdui->pg_grp = fl_bgn_group();
|
|
||||||
fdui->flag1 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,20,30,20,20,_("Page Number"));
|
|
||||||
fl_set_object_lsize(obj,FL_NORMAL_SIZE);
|
|
||||||
fdui->flag2 = obj = fl_add_checkbutton(FL_RADIO_BUTTON,20,50,20,20,_("Reference"));
|
|
||||||
fl_set_object_lsize(obj,FL_NORMAL_SIZE);
|
|
||||||
fl_end_group();
|
|
||||||
|
|
||||||
fl_end_form();
|
|
||||||
|
|
||||||
fdui->ref->fdui = fdui;
|
|
||||||
|
|
||||||
return fdui;
|
|
||||||
}
|
|
||||||
/*---------------------------------------*/
|
|
||||||
|
|
||||||
|
|
||||||
static FD_ref *form = 0;
|
InsetRef::InsetRef(string const & cmd, Buffer * bf)
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
void ref_close_cb(FL_OBJECT *, long)
|
|
||||||
{
|
|
||||||
InsetRef *inset = (InsetRef*)form->vdata;
|
|
||||||
|
|
||||||
if (fl_get_button(form->flag1)) {
|
|
||||||
inset->setFlag(InsetRef::PAGE_REF);
|
|
||||||
inset->setCmdName("pageref");
|
|
||||||
} else {
|
|
||||||
inset->setFlag(InsetRef::REF);
|
|
||||||
inset->setCmdName("ref");
|
|
||||||
}
|
|
||||||
|
|
||||||
fl_hide_form(form->ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
void goto_label_cb(FL_OBJECT *, long)
|
|
||||||
{
|
|
||||||
// code yet to be written
|
|
||||||
InsetRef *inset = (InsetRef*)form->vdata;
|
|
||||||
inset->gotoLabel();
|
|
||||||
#warning MAKEME!
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static
|
|
||||||
void label_change_cb(FL_OBJECT *, long)
|
|
||||||
{
|
|
||||||
// code yet to be written
|
|
||||||
InsetRef *inset = (InsetRef*)form->vdata;
|
|
||||||
#warning MAKEME!
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
InsetRef::InsetRef(string const & cmd, Buffer *bf)
|
|
||||||
: master(bf)
|
: master(bf)
|
||||||
{
|
{
|
||||||
scanCommand(cmd);
|
scanCommand(cmd);
|
||||||
@ -141,7 +30,7 @@ InsetRef::InsetRef(string const & cmd, Buffer *bf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetRef::InsetRef(InsetCommand const &inscmd, Buffer *bf)
|
InsetRef::InsetRef(InsetCommand const & inscmd, Buffer * bf)
|
||||||
: master(bf)
|
: master(bf)
|
||||||
{
|
{
|
||||||
setCmdName(inscmd.getCmdName());
|
setCmdName(inscmd.getCmdName());
|
||||||
@ -161,26 +50,8 @@ InsetRef::~InsetRef()
|
|||||||
|
|
||||||
void InsetRef::Edit(int, int)
|
void InsetRef::Edit(int, int)
|
||||||
{
|
{
|
||||||
current_view->getOwner()->getLyXFunc()->Dispatch(LFUN_REFGOTO
|
current_view->getOwner()->getLyXFunc()
|
||||||
, getContents().c_str());
|
->Dispatch(LFUN_REFGOTO, getContents().c_str());
|
||||||
// gotoLabel();
|
|
||||||
/*
|
|
||||||
if (!form) {
|
|
||||||
form = create_form_ref();
|
|
||||||
fl_set_form_atclose(form->ref, IgnoreCloseBoxCB, 0);
|
|
||||||
}
|
|
||||||
form->vdata = this;
|
|
||||||
|
|
||||||
fl_set_button(form->flag1, (flag == InsetRef::REF) ? 1 : 0);
|
|
||||||
fl_set_button(form->flag2, (flag == InsetRef::PAGE_REF) ? 1 : 0);
|
|
||||||
|
|
||||||
if (form->ref->visible) {
|
|
||||||
fl_raise_form(form->ref);
|
|
||||||
} else {
|
|
||||||
fl_show_form(form->ref,FL_PLACE_MOUSE, FL_FULLBORDER,
|
|
||||||
_("Cross-Reference"));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -192,7 +63,8 @@ string InsetRef::getScreenLabel() const
|
|||||||
else
|
else
|
||||||
temp += _("Ref: ");
|
temp += _("Ref: ");
|
||||||
temp += getContents();
|
temp += getContents();
|
||||||
if(!current_view->currentBuffer()->isLatex() && !getOptions().empty()) {
|
if(!current_view->currentBuffer()->isLatex()
|
||||||
|
&& !getOptions().empty()) {
|
||||||
temp += "||";
|
temp += "||";
|
||||||
temp += getOptions();
|
temp += getOptions();
|
||||||
}
|
}
|
||||||
@ -200,7 +72,7 @@ string InsetRef::getScreenLabel() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetRef::Latex(FILE *file, signed char /*fragile*/)
|
int InsetRef::Latex(FILE * file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
if(getOptions().empty())
|
if(getOptions().empty())
|
||||||
fprintf(file, "%s", escape(getCommand()).c_str());
|
fprintf(file, "%s", escape(getCommand()).c_str());
|
||||||
@ -213,7 +85,7 @@ int InsetRef::Latex(FILE *file, signed char /*fragile*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetRef::Latex(string &file, signed char /*fragile*/)
|
int InsetRef::Latex(string & file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
if(getOptions().empty())
|
if(getOptions().empty())
|
||||||
file += escape(getCommand());
|
file += escape(getCommand());
|
||||||
@ -226,17 +98,19 @@ int InsetRef::Latex(string &file, signed char /*fragile*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetRef::Linuxdoc(string &file)
|
int InsetRef::Linuxdoc(string & file)
|
||||||
{
|
{
|
||||||
file += "<ref id=\"" + getContents() + "\" name=\""+ getOptions() +"\" >" ;
|
file += "<ref id=\"" + getContents()
|
||||||
|
+ "\" name=\""+ getOptions() +"\" >" ;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetRef::DocBook(string &file)
|
int InsetRef::DocBook(string & file)
|
||||||
{
|
{
|
||||||
file += "<link linkend=\"" + getContents() + "\">"+ getOptions() +"</link>" ;
|
file += "<link linkend=\"" + getContents()
|
||||||
|
+ "\">"+ getOptions() +"</link>" ;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -255,7 +129,7 @@ string InsetRef::escape(string const & lab) const {
|
|||||||
enc += hexdigit[c>>4];
|
enc += hexdigit[c>>4];
|
||||||
enc += hexdigit[c & 15];
|
enc += hexdigit[c & 15];
|
||||||
} else {
|
} else {
|
||||||
enc += (char) c;
|
enc += c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return enc;
|
return enc;
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
*
|
*
|
||||||
*======================================================*/
|
*======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_REF_H
|
#ifndef INSET_REF_H
|
||||||
#define _INSET_REF_H
|
#define INSET_REF_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -33,15 +33,15 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
InsetRef(): InsetCommand("ref") { flag = InsetRef::REF; }
|
InsetRef() : InsetCommand("ref") { flag = InsetRef::REF; }
|
||||||
///
|
///
|
||||||
InsetRef(string const &, Buffer*);
|
InsetRef(string const &, Buffer *);
|
||||||
///
|
///
|
||||||
InsetRef(InsetCommand const&, Buffer*);
|
InsetRef(InsetCommand const &, Buffer *);
|
||||||
///
|
///
|
||||||
~InsetRef();
|
~InsetRef();
|
||||||
///
|
///
|
||||||
Inset* Clone() { return new InsetRef (getCommand(), master); }
|
Inset * Clone() { return new InsetRef (getCommand(), master); }
|
||||||
///
|
///
|
||||||
Inset::Code LyxCode() const { return Inset::REF_CODE; }
|
Inset::Code LyxCode() const { return Inset::REF_CODE; }
|
||||||
///
|
///
|
||||||
@ -61,20 +61,20 @@ public:
|
|||||||
///
|
///
|
||||||
void gotoLabel();
|
void gotoLabel();
|
||||||
///
|
///
|
||||||
int Latex(FILE *file, signed char fragile);
|
int Latex(FILE * file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Latex(string &file, signed char fragile);
|
int Latex(string & file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Linuxdoc(string &file);
|
int Linuxdoc(string & file);
|
||||||
///
|
///
|
||||||
int DocBook(string &file);
|
int DocBook(string & file);
|
||||||
private:
|
private:
|
||||||
/// This function escapes 8-bit characters
|
/// This function escapes 8-bit characters
|
||||||
string escape(string const &) const;
|
string escape(string const &) const;
|
||||||
///
|
///
|
||||||
Ref_Flags flag;
|
Ref_Flags flag;
|
||||||
///
|
///
|
||||||
Buffer *master;
|
Buffer * master;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -85,5 +85,4 @@ void InsetRef::gotoLabel()
|
|||||||
master->gotoLabel(getContents());
|
master->gotoLabel(getContents());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -34,19 +34,19 @@ InsetSpecialChar::~InsetSpecialChar()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetSpecialChar::Ascent(LyXFont const&font) const
|
int InsetSpecialChar::Ascent(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return font.maxAscent();
|
return font.maxAscent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetSpecialChar::Descent(LyXFont const&font) const
|
int InsetSpecialChar::Descent(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
return font.maxDescent();
|
return font.maxDescent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetSpecialChar::Width(LyXFont const&font) const
|
int InsetSpecialChar::Width(LyXFont const & font) const
|
||||||
{
|
{
|
||||||
LyXFont f = font;
|
LyXFont f = font;
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
@ -73,8 +73,8 @@ int InsetSpecialChar::Width(LyXFont const&font) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetSpecialChar::Draw(LyXFont font, LyXScreen &scr,
|
void InsetSpecialChar::Draw(LyXFont font, LyXScreen & scr,
|
||||||
int baseline, float &x)
|
int baseline, float & x)
|
||||||
{
|
{
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case HYPHENATION:
|
case HYPHENATION:
|
||||||
@ -117,7 +117,7 @@ void InsetSpecialChar::Draw(LyXFont font, LyXScreen &scr,
|
|||||||
|
|
||||||
|
|
||||||
// In lyxf3 this will be just LaTeX
|
// In lyxf3 this will be just LaTeX
|
||||||
void InsetSpecialChar::Write(FILE *file)
|
void InsetSpecialChar::Write(FILE * file)
|
||||||
{
|
{
|
||||||
string command;
|
string command;
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
@ -131,7 +131,7 @@ void InsetSpecialChar::Write(FILE *file)
|
|||||||
|
|
||||||
|
|
||||||
// This function will not be necessary when lyx3
|
// This function will not be necessary when lyx3
|
||||||
void InsetSpecialChar::Read(LyXLex &lex)
|
void InsetSpecialChar::Read(LyXLex & lex)
|
||||||
{
|
{
|
||||||
lex.nextToken();
|
lex.nextToken();
|
||||||
string command = lex.GetString();
|
string command = lex.GetString();
|
||||||
@ -149,7 +149,7 @@ void InsetSpecialChar::Read(LyXLex &lex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetSpecialChar::Latex(FILE *file, signed char /*fragile*/)
|
int InsetSpecialChar::Latex(FILE * file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
string command;
|
string command;
|
||||||
signed char dummy = 0;
|
signed char dummy = 0;
|
||||||
@ -159,7 +159,7 @@ int InsetSpecialChar::Latex(FILE *file, signed char /*fragile*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetSpecialChar::Latex(string &file, signed char /*fragile*/)
|
int InsetSpecialChar::Latex(string & file, signed char /*fragile*/)
|
||||||
{
|
{
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case HYPHENATION: file += "\\-"; break;
|
case HYPHENATION: file += "\\-"; break;
|
||||||
@ -171,7 +171,7 @@ int InsetSpecialChar::Latex(string &file, signed char /*fragile*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetSpecialChar::Linuxdoc(string &file)
|
int InsetSpecialChar::Linuxdoc(string & file)
|
||||||
{
|
{
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case HYPHENATION: file += ""; break;
|
case HYPHENATION: file += ""; break;
|
||||||
@ -183,7 +183,7 @@ int InsetSpecialChar::Linuxdoc(string &file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetSpecialChar::DocBook(string &file)
|
int InsetSpecialChar::DocBook(string & file)
|
||||||
{
|
{
|
||||||
switch (kind) {
|
switch (kind) {
|
||||||
case HYPHENATION: file += ""; break;
|
case HYPHENATION: file += ""; break;
|
||||||
@ -195,14 +195,14 @@ int InsetSpecialChar::DocBook(string &file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Inset* InsetSpecialChar::Clone()
|
Inset * InsetSpecialChar::Clone()
|
||||||
{
|
{
|
||||||
InsetSpecialChar *result = new InsetSpecialChar(kind);
|
InsetSpecialChar * result = new InsetSpecialChar(kind);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetSpecialChar::Validate(LaTeXFeatures& features) const
|
void InsetSpecialChar::Validate(LaTeXFeatures & features) const
|
||||||
{
|
{
|
||||||
if (kind == MENU_SEPARATOR) {
|
if (kind == MENU_SEPARATOR) {
|
||||||
features.lyxarrow = true;
|
features.lyxarrow = true;
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 1997 Asger Alstrup
|
* Copyright (C) 1997 Asger Alstrup
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_SPECIALCHAR_H
|
#ifndef INSET_SPECIALCHAR_H
|
||||||
#define _INSET_SPECIALCHAR_H
|
#define INSET_SPECIALCHAR_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -43,27 +43,27 @@ public:
|
|||||||
///
|
///
|
||||||
~InsetSpecialChar();
|
~InsetSpecialChar();
|
||||||
///
|
///
|
||||||
int Ascent(LyXFont const &font) const;
|
int Ascent(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
int Descent(LyXFont const &font) const;
|
int Descent(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
int Width(LyXFont const &font) const;
|
int Width(LyXFont const & font) const;
|
||||||
///
|
///
|
||||||
void Draw(LyXFont, LyXScreen &scr, int baseline, float &x);
|
void Draw(LyXFont, LyXScreen & scr, int baseline, float & x);
|
||||||
///
|
///
|
||||||
void Write(FILE *file);
|
void Write(FILE * file);
|
||||||
/// Will not be used when lyxf3
|
/// Will not be used when lyxf3
|
||||||
void Read(LyXLex &lex);
|
void Read(LyXLex & lex);
|
||||||
///
|
///
|
||||||
int Latex(FILE *file, signed char fragile);
|
int Latex(FILE * file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Latex(string &file, signed char fragile);
|
int Latex(string & file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Linuxdoc(string &file);
|
int Linuxdoc(string & file);
|
||||||
///
|
///
|
||||||
int DocBook(string &file);
|
int DocBook(string & file);
|
||||||
///
|
///
|
||||||
Inset* Clone();
|
Inset * Clone();
|
||||||
///
|
///
|
||||||
Inset::Code LyxCode() const
|
Inset::Code LyxCode() const
|
||||||
{
|
{
|
||||||
|
@ -11,21 +11,21 @@
|
|||||||
#include "lyxfunc.h"
|
#include "lyxfunc.h"
|
||||||
#include "LyXView.h"
|
#include "LyXView.h"
|
||||||
|
|
||||||
extern BufferView *current_view;
|
extern BufferView * current_view;
|
||||||
|
|
||||||
void InsetTOC::Edit(int, int)
|
void InsetTOC::Edit(int, int)
|
||||||
{
|
{
|
||||||
current_view->getOwner()->getLyXFunc()->Dispatch(LFUN_TOCVIEW);
|
current_view->getOwner()->getLyXFunc()->Dispatch(LFUN_TOCVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InsetTOC::Linuxdoc(string &file)
|
int InsetTOC::Linuxdoc(string & file)
|
||||||
{
|
{
|
||||||
file += "<toc>";
|
file += "<toc>";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetTOC::DocBook(string &file)
|
int InsetTOC::DocBook(string & file)
|
||||||
{
|
{
|
||||||
file += "<toc></toc>";
|
file += "<toc></toc>";
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Word Processor
|
* LyX, The Document Word Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* 1996-1998 The LyX Team.
|
* Copyright 1996-1999 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
*======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_TOC_H
|
#ifndef INSET_TOC_H
|
||||||
#define _INSET_TOC_H
|
#define INSET_TOC_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -28,9 +28,9 @@ public:
|
|||||||
///
|
///
|
||||||
InsetTOC(): InsetCommand("tableofcontents") {}
|
InsetTOC(): InsetCommand("tableofcontents") {}
|
||||||
///
|
///
|
||||||
InsetTOC(Buffer *b): InsetCommand("tableofcontents"),owner(b){}
|
InsetTOC(Buffer * b): InsetCommand("tableofcontents"),owner(b) {}
|
||||||
///
|
///
|
||||||
Inset* Clone() { return new InsetTOC(owner); }
|
Inset * Clone() { return new InsetTOC(owner); }
|
||||||
///
|
///
|
||||||
string getScreenLabel() const { return _("Table of Contents"); }
|
string getScreenLabel() const { return _("Table of Contents"); }
|
||||||
/// On edit, we open the TOC pop-up
|
/// On edit, we open the TOC pop-up
|
||||||
@ -44,12 +44,12 @@ public:
|
|||||||
///
|
///
|
||||||
Inset::Code LyxCode() const { return Inset::TOC_CODE; }
|
Inset::Code LyxCode() const { return Inset::TOC_CODE; }
|
||||||
///
|
///
|
||||||
int Linuxdoc(string &file);
|
int Linuxdoc(string & file);
|
||||||
///
|
///
|
||||||
int DocBook(string &file);
|
int DocBook(string & file);
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
Buffer *owner;
|
Buffer * owner;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation
|
#pragma implementation
|
||||||
@ -14,8 +14,8 @@
|
|||||||
#include "LaTeXFeatures.h"
|
#include "LaTeXFeatures.h"
|
||||||
#include "lyx_gui_misc.h" // CancelCloseBoxCB
|
#include "lyx_gui_misc.h" // CancelCloseBoxCB
|
||||||
|
|
||||||
extern BufferView *current_view;
|
extern BufferView * current_view;
|
||||||
extern void UpdateInset(Inset* inset, bool mark_dirty = true);
|
extern void UpdateInset(Inset * inset, bool mark_dirty = true);
|
||||||
|
|
||||||
InsetUrl::InsetUrl(string const & cmd)
|
InsetUrl::InsetUrl(string const & cmd)
|
||||||
: fd_form_url(0)
|
: fd_form_url(0)
|
||||||
@ -28,7 +28,7 @@ InsetUrl::InsetUrl(string const & cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetUrl::InsetUrl(InsetCommand const &inscmd)
|
InsetUrl::InsetUrl(InsetCommand const & inscmd)
|
||||||
: fd_form_url(0)
|
: fd_form_url(0)
|
||||||
{
|
{
|
||||||
setCmdName(inscmd.getCmdName());
|
setCmdName(inscmd.getCmdName());
|
||||||
@ -41,8 +41,8 @@ InsetUrl::InsetUrl(InsetCommand const &inscmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InsetUrl::InsetUrl(string const &ins_name,string const &ins_cont,
|
InsetUrl::InsetUrl(string const & ins_name, string const & ins_cont,
|
||||||
string const &ins_opt)
|
string const & ins_opt)
|
||||||
: fd_form_url(0)
|
: fd_form_url(0)
|
||||||
{
|
{
|
||||||
setCmdName(ins_name);
|
setCmdName(ins_name);
|
||||||
@ -65,9 +65,9 @@ InsetUrl::~InsetUrl()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetUrl::CloseUrlCB(FL_OBJECT *ob, long)
|
void InsetUrl::CloseUrlCB(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
InsetUrl *inset = (InsetUrl*) ob->u_vdata;
|
InsetUrl * inset = static_cast<InsetUrl*>(ob->u_vdata);
|
||||||
string url = fl_get_input(inset->fd_form_url->url_name);
|
string url = fl_get_input(inset->fd_form_url->url_name);
|
||||||
string name = fl_get_input(inset->fd_form_url->name_name);
|
string name = fl_get_input(inset->fd_form_url->name_name);
|
||||||
string cmdname;
|
string cmdname;
|
||||||
@ -76,7 +76,7 @@ void InsetUrl::CloseUrlCB(FL_OBJECT *ob, long)
|
|||||||
else
|
else
|
||||||
cmdname = "url";
|
cmdname = "url";
|
||||||
|
|
||||||
Buffer *buffer = current_view->currentBuffer();
|
Buffer * buffer = current_view->currentBuffer();
|
||||||
|
|
||||||
if ((url != inset->getContents() ||
|
if ((url != inset->getContents() ||
|
||||||
name != inset->getOptions() ||
|
name != inset->getOptions() ||
|
||||||
@ -95,15 +95,18 @@ void InsetUrl::CloseUrlCB(FL_OBJECT *ob, long)
|
|||||||
|
|
||||||
if (inset->fd_form_url) {
|
if (inset->fd_form_url) {
|
||||||
fl_hide_form(inset->fd_form_url->form_url);
|
fl_hide_form(inset->fd_form_url->form_url);
|
||||||
|
fl_free_form(inset->fd_form_url->form_url);
|
||||||
inset->fd_form_url = 0;
|
inset->fd_form_url = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_InsetUrl_CloseUrlCB(FL_OBJECT *ob, long)
|
|
||||||
|
extern "C" void C_InsetUrl_CloseUrlCB(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
InsetUrl::CloseUrlCB(ob,0);
|
InsetUrl::CloseUrlCB(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetUrl::Edit(int, int)
|
void InsetUrl::Edit(int, int)
|
||||||
{
|
{
|
||||||
static int ow = -1, oh;
|
static int ow = -1, oh;
|
||||||
@ -158,7 +161,7 @@ string InsetUrl::getScreenLabel() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetUrl::Latex(FILE *file, signed char fragile)
|
int InsetUrl::Latex(FILE * file, signed char fragile)
|
||||||
{
|
{
|
||||||
string latex_output;
|
string latex_output;
|
||||||
int res = Latex(latex_output, fragile);
|
int res = Latex(latex_output, fragile);
|
||||||
@ -181,7 +184,7 @@ int InsetUrl::Latex(string &file, signed char fragile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetUrl::Linuxdoc(string &file)
|
int InsetUrl::Linuxdoc(string & file)
|
||||||
{
|
{
|
||||||
file += "<"+ getCmdName() +
|
file += "<"+ getCmdName() +
|
||||||
" url=\"" + getContents()+"\"" +
|
" url=\"" + getContents()+"\"" +
|
||||||
@ -191,7 +194,7 @@ int InsetUrl::Linuxdoc(string &file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetUrl::DocBook(string &file)
|
int InsetUrl::DocBook(string & file)
|
||||||
{
|
{
|
||||||
file += "<ulink url=\"" + getContents() + "\">" +
|
file += "<ulink url=\"" + getContents() + "\">" +
|
||||||
getOptions() +"</ulink>";
|
getOptions() +"</ulink>";
|
||||||
@ -200,7 +203,7 @@ int InsetUrl::DocBook(string &file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetUrl::Validate(LaTeXFeatures& features) const
|
void InsetUrl::Validate(LaTeXFeatures & features) const
|
||||||
{
|
{
|
||||||
features.url = true;
|
features.url = true;
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,10 @@
|
|||||||
*
|
*
|
||||||
* Copyright (C) 1997 LyX Team (this file was created this year)
|
* Copyright (C) 1997 LyX Team (this file was created this year)
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
|
|
||||||
#ifndef _INSET_URL_H
|
#ifndef INSET_URL_H
|
||||||
#define _INSET_URL_H
|
#define INSET_URL_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -34,17 +34,19 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
InsetUrl(): InsetCommand("url"), fd_form_url(0) { flag = InsetUrl::URL; }
|
InsetUrl(): InsetCommand("url"), fd_form_url(0) {
|
||||||
|
flag = InsetUrl::URL;
|
||||||
|
}
|
||||||
///
|
///
|
||||||
InsetUrl(string const &);
|
InsetUrl(string const &);
|
||||||
///
|
///
|
||||||
InsetUrl(InsetCommand const&);
|
InsetUrl(InsetCommand const &);
|
||||||
///
|
///
|
||||||
InsetUrl(string const &,string const &,string const &);
|
InsetUrl(string const &, string const &, string const &);
|
||||||
///
|
///
|
||||||
~InsetUrl();
|
~InsetUrl();
|
||||||
///
|
///
|
||||||
Inset* Clone() { return new InsetUrl(getCommand()); }
|
Inset * Clone() { return new InsetUrl(getCommand()); }
|
||||||
///
|
///
|
||||||
Inset::Code LyxCode() const { return Inset::URL_CODE; }
|
Inset::Code LyxCode() const { return Inset::URL_CODE; }
|
||||||
///
|
///
|
||||||
@ -56,32 +58,32 @@ public:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
char const* EditMessage() {return "Opened Url";}
|
char const * EditMessage() {return "Opened Url";}
|
||||||
///
|
///
|
||||||
bool Display() const { return false; }
|
bool Display() const { return false; }
|
||||||
///
|
///
|
||||||
string getScreenLabel() const;
|
string getScreenLabel() const;
|
||||||
///
|
///
|
||||||
InsetUrl::Url_Flags getFlag() { return flag; }
|
InsetUrl::Url_Flags getFlag() const { return flag; }
|
||||||
///
|
///
|
||||||
void setFlag(InsetUrl::Url_Flags f) { flag = f; }
|
void setFlag(InsetUrl::Url_Flags f) { flag = f; }
|
||||||
///
|
///
|
||||||
void gotoLabel();
|
void gotoLabel();
|
||||||
///
|
///
|
||||||
int Latex(FILE *file, signed char fragile);
|
int Latex(FILE * file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Latex(string &file, signed char fragile);
|
int Latex(string & file, signed char fragile);
|
||||||
///
|
///
|
||||||
int Linuxdoc(string &file);
|
int Linuxdoc(string & file);
|
||||||
///
|
///
|
||||||
int DocBook(string &file);
|
int DocBook(string & file);
|
||||||
///
|
///
|
||||||
static void CloseUrlCB(FL_OBJECT *, long data);
|
static void CloseUrlCB(FL_OBJECT *, long data);
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
Url_Flags flag;
|
Url_Flags flag;
|
||||||
///
|
///
|
||||||
FD_form_url *fd_form_url;
|
FD_form_url * fd_form_url;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,11 +4,13 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
|
* Copyright 1995-1999 the LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ======================================================*/
|
||||||
#ifndef _LYXINSET_H
|
|
||||||
#define _LYXINSET_H
|
#ifndef LYXINSET_H
|
||||||
|
#define LYXINSET_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
@ -77,21 +79,22 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
virtual ~Inset(){};
|
virtual ~Inset() {}
|
||||||
///
|
///
|
||||||
virtual int Ascent(LyXFont const &font) const=0;
|
virtual int Ascent(LyXFont const & font) const = 0;
|
||||||
///
|
///
|
||||||
virtual int Descent(LyXFont const &font) const=0;
|
virtual int Descent(LyXFont const & font) const = 0;
|
||||||
///
|
///
|
||||||
virtual int Width(LyXFont const& font) const=0;
|
virtual int Width(LyXFont const & font) const = 0;
|
||||||
///
|
///
|
||||||
virtual LyXFont ConvertFont(LyXFont font);
|
virtual LyXFont ConvertFont(LyXFont font);
|
||||||
///
|
///
|
||||||
virtual void Draw(LyXFont font, LyXScreen &scr, int baseline, float &x)=0;
|
virtual void Draw(LyXFont font, LyXScreen & scr,
|
||||||
|
int baseline, float & x) = 0;
|
||||||
///
|
///
|
||||||
//virtual void setBuffer(Buffer const&) {;}
|
//virtual void setBuffer(Buffer const&) {;}
|
||||||
/// what appears in the minibuffer when opening
|
/// what appears in the minibuffer when opening
|
||||||
virtual char const* EditMessage() {return _("Opened inset");}
|
virtual char const * EditMessage() {return _("Opened inset");}
|
||||||
///
|
///
|
||||||
virtual void Edit(int, int);
|
virtual void Edit(int, int);
|
||||||
///
|
///
|
||||||
@ -99,21 +102,21 @@ public:
|
|||||||
///
|
///
|
||||||
virtual bool AutoDelete() const;
|
virtual bool AutoDelete() const;
|
||||||
///
|
///
|
||||||
virtual void Write(FILE *file)=0;
|
virtual void Write(FILE * file)=0;
|
||||||
///
|
///
|
||||||
virtual void Read(LyXLex &lex)=0;
|
virtual void Read(LyXLex & lex)=0;
|
||||||
/** returns the number of rows (\n's) of generated tex code.
|
/** returns the number of rows (\n's) of generated tex code.
|
||||||
fragile != 0 means, that the inset should take care about
|
fragile != 0 means, that the inset should take care about
|
||||||
fragile commands by adding a \protect before.
|
fragile commands by adding a \protect before.
|
||||||
*/
|
*/
|
||||||
virtual int Latex(FILE *file, signed char fragile)=0;
|
virtual int Latex(FILE * file, signed char fragile) = 0;
|
||||||
virtual int Latex(string &file, signed char fragile)=0;
|
virtual int Latex(string & file, signed char fragile) = 0;
|
||||||
///
|
///
|
||||||
virtual int Linuxdoc(string &/*file*/) = 0;
|
virtual int Linuxdoc(string &/*file*/) = 0;
|
||||||
///
|
///
|
||||||
virtual int DocBook(string &/*file*/) = 0;
|
virtual int DocBook(string &/*file*/) = 0;
|
||||||
/// Updates needed features for this inset.
|
/// Updates needed features for this inset.
|
||||||
virtual void Validate(LaTeXFeatures &features) const;
|
virtual void Validate(LaTeXFeatures & features) const;
|
||||||
///
|
///
|
||||||
virtual bool Deletable() const;
|
virtual bool Deletable() const;
|
||||||
|
|
||||||
@ -126,12 +129,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// used for autocorrection
|
/// used for autocorrection
|
||||||
virtual bool IsEqual(Inset* /*other*/){
|
virtual bool IsEqual(Inset * /*other*/){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
virtual Inset* Clone()=0;
|
virtual Inset * Clone() = 0;
|
||||||
|
|
||||||
/// returns true to override begin and end inset in file
|
/// returns true to override begin and end inset in file
|
||||||
virtual bool DirectWrite() const;
|
virtual bool DirectWrite() const;
|
||||||
@ -178,34 +181,32 @@ public:
|
|||||||
class UpdatableInset: public Inset {
|
class UpdatableInset: public Inset {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
virtual ~UpdatableInset() { };
|
virtual ~UpdatableInset() {}
|
||||||
///
|
///
|
||||||
virtual unsigned char Editable() const;
|
virtual unsigned char Editable() const;
|
||||||
|
|
||||||
/// may call ToggleLockedInsetCursor
|
/// may call ToggleLockedInsetCursor
|
||||||
virtual void ToggleInsetCursor();
|
virtual void ToggleInsetCursor();
|
||||||
///
|
///
|
||||||
virtual void GetCursorPos(int&, int&) { }
|
virtual void GetCursorPos(int &, int &) {}
|
||||||
///
|
///
|
||||||
virtual void InsetButtonPress(int x, int y, int button);
|
virtual void InsetButtonPress(int x, int y, int button);
|
||||||
///
|
///
|
||||||
virtual void InsetButtonRelease(int x, int y, int button);
|
virtual void InsetButtonRelease(int x, int y, int button);
|
||||||
|
|
||||||
///
|
///
|
||||||
virtual void InsetKeyPress(XKeyEvent *ev);
|
virtual void InsetKeyPress(XKeyEvent * ev);
|
||||||
///
|
///
|
||||||
virtual void InsetMotionNotify(int x, int y, int state);
|
virtual void InsetMotionNotify(int x, int y, int state);
|
||||||
///
|
///
|
||||||
virtual void InsetUnlock();
|
virtual void InsetUnlock();
|
||||||
|
|
||||||
/// An updatable inset could handle lyx editing commands
|
/// An updatable inset could handle lyx editing commands
|
||||||
virtual bool LocalDispatch(int, char const*) { return false; };
|
virtual bool LocalDispatch(int, char const *) { return false; };
|
||||||
//
|
//
|
||||||
bool isCursorVisible() const { return cursor_visible; }
|
bool isCursorVisible() const { return cursor_visible; }
|
||||||
protected:
|
protected:
|
||||||
///
|
///
|
||||||
bool cursor_visible;
|
bool cursor_visible;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -173,7 +173,7 @@ int kb_sequence::parse(char const*s)
|
|||||||
if(!s[0]) return 1;
|
if(!s[0]) return 1;
|
||||||
|
|
||||||
while(s[i]) {
|
while(s[i]) {
|
||||||
if(s[i] && ((unsigned char) s[i]) <= ' ') i++;
|
if(s[i] && (s[i]) <= ' ') i++;
|
||||||
if(!s[i]) break;
|
if(!s[i]) break;
|
||||||
|
|
||||||
if(s[i+1]=='-') { // is implicit that s[i]==true
|
if(s[i+1]=='-') { // is implicit that s[i]==true
|
||||||
@ -212,7 +212,7 @@ int kb_sequence::parse(char const*s)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for(j = i; s[j] && ((unsigned char)s[j])>' '; j++)
|
for(j = i; s[j] && (s[j])>' '; j++)
|
||||||
tbuf[j-i] = s[j]; // (!!!check bounds :-)
|
tbuf[j-i] = s[j]; // (!!!check bounds :-)
|
||||||
|
|
||||||
tbuf[j-i] = '\0';
|
tbuf[j-i] = '\0';
|
||||||
|
@ -15,34 +15,27 @@
|
|||||||
#pragma implementation
|
#pragma implementation
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "lyxlex.h"
|
#include <fstream>
|
||||||
|
#include <algorithm>
|
||||||
#include "support/FileInfo.h"
|
#include "support/FileInfo.h"
|
||||||
#include "lastfiles.h"
|
#include "lastfiles.h"
|
||||||
#include "support/filetools.h"
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
LastFiles::LastFiles(string const & filename, bool st, char num)
|
LastFiles::LastFiles(string const & filename, bool st, unsigned int num)
|
||||||
: dostat(st)
|
: dostat(st)
|
||||||
{
|
{
|
||||||
setNumberOfFiles(num);
|
setNumberOfFiles(num);
|
||||||
files = new string[num_files];
|
|
||||||
readFile(filename);
|
readFile(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LastFiles::~LastFiles()
|
void LastFiles::setNumberOfFiles(unsigned int no)
|
||||||
{
|
{
|
||||||
delete[] files;
|
if (0 < no && no <= ABSOLUTEMAXLASTFILES)
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LastFiles::setNumberOfFiles(char no)
|
|
||||||
{
|
|
||||||
if (1 <= no && no <= ABSOLUTEMAXLASTFILES)
|
|
||||||
num_files = no;
|
num_files = no;
|
||||||
else {
|
else {
|
||||||
lyxerr << "LyX: lastfiles: too many files\n"
|
lyxerr << "LyX: lastfiles: too many files\n"
|
||||||
"\tdefault (=" << int(DEFAULTFILES) // int() only because of anon enum
|
"\tdefault (=" << int(DEFAULTFILES)
|
||||||
<< ") used." << endl;
|
<< ") used." << endl;
|
||||||
num_files = DEFAULTFILES;
|
num_files = DEFAULTFILES;
|
||||||
}
|
}
|
||||||
@ -52,48 +45,30 @@ void LastFiles::setNumberOfFiles(char no)
|
|||||||
void LastFiles::readFile(string const & filename)
|
void LastFiles::readFile(string const & filename)
|
||||||
{
|
{
|
||||||
// we will not complain if we can't find filename nor will
|
// we will not complain if we can't find filename nor will
|
||||||
// we issue a warning. Lgb.
|
// we issue a warning. (Lgb)
|
||||||
LyXLex lex(0, 0); /* LyXLex should be changed
|
ifstream ifs(filename.c_str());
|
||||||
* to allow constructor with
|
|
||||||
* no parameters. */
|
|
||||||
bool error = false;
|
|
||||||
|
|
||||||
lex.setFile(filename);
|
|
||||||
|
|
||||||
if (!lex.IsOK()) return;
|
|
||||||
|
|
||||||
string tmp;
|
string tmp;
|
||||||
FileInfo fileInfo;
|
FileInfo fileInfo;
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
while (lex.IsOK() && !error && i < num_files) {
|
while(getline(ifs, tmp) && files.size() < num_files) {
|
||||||
switch(lex.lex()) {
|
|
||||||
case LyXLex::LEX_FEOF:
|
|
||||||
error = true;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
tmp = lex.GetString();
|
|
||||||
// Check if the file exist
|
|
||||||
if (dostat) {
|
if (dostat) {
|
||||||
if (!(fileInfo.newFile(tmp).exist() &&
|
if (!(fileInfo.newFile(tmp).exist() &&
|
||||||
fileInfo.isRegular()))
|
fileInfo.isRegular()))
|
||||||
break; // the file does not exist
|
continue;
|
||||||
}
|
|
||||||
files[i] = tmp;
|
|
||||||
i++;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
files.push_back(tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LastFiles::writeFile(string const & filename) const
|
void LastFiles::writeFile(string const & filename) const
|
||||||
{
|
{
|
||||||
FilePtr fd(filename, FilePtr::write);
|
ofstream ofs(filename.c_str());
|
||||||
if (fd()) {
|
if (ofs) {
|
||||||
for (int i = 0; i < num_files; i++) {
|
for (Files::const_iterator cit = files.begin();
|
||||||
if (!files[i].empty())
|
cit != files.end();
|
||||||
fprintf(fd, "\"%s\"\n", files[i].c_str());
|
++cit) {
|
||||||
|
ofs << (*cit) << '\n';
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
lyxerr << "LyX: Warning: unable to save LastFiles: "
|
lyxerr << "LyX: Warning: unable to save LastFiles: "
|
||||||
@ -103,12 +78,19 @@ void LastFiles::writeFile(string const & filename) const
|
|||||||
|
|
||||||
void LastFiles::newFile(string const & file)
|
void LastFiles::newFile(string const & file)
|
||||||
{
|
{
|
||||||
int n;
|
// If file already exist, delete it and reinsert at front.
|
||||||
// Find this file in list. If not in list, point to last entry
|
Files::iterator it = find(files.begin(), files.end(), file);
|
||||||
for(n = 0; n < (num_files - 1); n++)
|
if (it != files.end())
|
||||||
if(files[n] == file) break;
|
files.erase(it);
|
||||||
|
files.push_front(file);
|
||||||
for(int i = n; i >= 1; i--)
|
if (files.size() > num_files)
|
||||||
files[i] = files[i - 1];
|
files.pop_back();
|
||||||
files[0] = file;
|
}
|
||||||
|
|
||||||
|
|
||||||
|
string LastFiles::operator[](unsigned int i) const
|
||||||
|
{
|
||||||
|
if (i < files.size())
|
||||||
|
return files[i];
|
||||||
|
return string();
|
||||||
}
|
}
|
||||||
|
103
src/lastfiles.h
103
src/lastfiles.h
@ -1,21 +1,22 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 1996 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* and the LyX Team.
|
* Copyright 1995-1999 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef _LASTFILES_H
|
#ifndef LASTFILES_H
|
||||||
#define _LASTFILES_H
|
#define LASTFILES_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
#include "LString.h"
|
#include "LString.h"
|
||||||
|
|
||||||
|
|
||||||
@ -27,57 +28,61 @@
|
|||||||
class LastFiles
|
class LastFiles
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
///
|
||||||
|
typedef deque<string> Files;
|
||||||
|
|
||||||
/**@name Constructors and Deconstructors */
|
/**@name Constructors and Deconstructors */
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
Parameters are: name of file to read. Whether you want LastFiles
|
Parameters are: name of file to read. Whether LastFiles should
|
||||||
to check for file existance, and the number of files to remember.
|
check for file existance, and the number of files to remember.
|
||||||
*/
|
*/
|
||||||
LastFiles(string const &, bool dostat = true, char num = 4);
|
LastFiles(string const &, bool dostat = true, unsigned int num = 4);
|
||||||
///
|
|
||||||
~LastFiles();
|
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/**@name Methods */
|
/**@name Methods */
|
||||||
//@{
|
//@{
|
||||||
/**
|
/**
|
||||||
This funtion inserts #file# into the last files list. If the file
|
This funtion inserts #file# into the last files list. If the file
|
||||||
already exist it is moved to the top of the list. If it don't
|
already exist it is moved to the top of the list, else exist it
|
||||||
exist it is placed on the top of the list. If the list already is
|
is placed on the top of the list. If the list is full the last
|
||||||
full the last visited file in the list is puched out and deleted.
|
file in the list is popped from the end.
|
||||||
*/
|
*/
|
||||||
void newFile(string const &);
|
void newFile(string const &);
|
||||||
/** Writes the lastfiles table to disk. A " is placed around the
|
/** Writes the lastfiles table to disk. One file on each line, this
|
||||||
filenames to preserve special chars. (not all are preserved
|
way we can at least have some special chars (e.g. space), but
|
||||||
anyway, but at least space is.)
|
newline in filenames are thus not allowed.
|
||||||
*/
|
*/
|
||||||
void writeFile(string const &) const;
|
void writeFile(string const &) const;
|
||||||
|
///
|
||||||
|
string operator[](unsigned int) const;
|
||||||
|
///
|
||||||
|
Files::const_iterator begin() const { return files.begin(); }
|
||||||
|
///
|
||||||
|
Files::const_iterator end() const { return files.end(); }
|
||||||
//@}
|
//@}
|
||||||
private:
|
private:
|
||||||
/**@name const variables */
|
/**@name const variables */
|
||||||
//@{
|
//@{
|
||||||
///
|
|
||||||
enum {
|
enum {
|
||||||
///
|
///
|
||||||
DEFAULTFILES = 4
|
DEFAULTFILES = 4,
|
||||||
};
|
/** There is no point in keeping more than this number
|
||||||
/** There is no point in keeping more than this number of files
|
of files at the same time. However perhaps someday
|
||||||
at the same time. However perhaps someday someone finds use for
|
someone finds use for more files and wants to
|
||||||
more files and wants to change it. Please do. But don't show
|
change it. Please do. But don't show the files in
|
||||||
the files in a menu...
|
a menu...
|
||||||
*/
|
*/
|
||||||
enum {
|
|
||||||
///
|
|
||||||
ABSOLUTEMAXLASTFILES = 20
|
ABSOLUTEMAXLASTFILES = 20
|
||||||
};
|
};
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/**@name Variables */
|
/**@name Variables */
|
||||||
//@{
|
//@{
|
||||||
/// an array of lastfiles
|
/// a list of lastfiles
|
||||||
string *files;
|
Files files;
|
||||||
/// number of files in the lastfiles list.
|
/// number of files in the lastfiles list.
|
||||||
char num_files;
|
unsigned int num_files;
|
||||||
/// check for file existance or not.
|
/// check for file existance or not.
|
||||||
bool dostat;
|
bool dostat;
|
||||||
//@}
|
//@}
|
||||||
@ -91,37 +96,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
void readFile(string const &);
|
void readFile(string const &);
|
||||||
/// used by the constructor to set the number of stored last files.
|
/// used by the constructor to set the number of stored last files.
|
||||||
void setNumberOfFiles(char num);
|
void setNumberOfFiles(unsigned int num);
|
||||||
//@}
|
|
||||||
|
|
||||||
/**@name Friends */
|
|
||||||
//@{
|
|
||||||
///
|
|
||||||
friend class LastFiles_Iter;
|
|
||||||
//@}
|
//@}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/// An Iterator class for LastFiles
|
|
||||||
class LastFiles_Iter {
|
|
||||||
public:
|
|
||||||
///
|
|
||||||
LastFiles_Iter(const LastFiles& la)
|
|
||||||
{cs = &la; index = 0;}
|
|
||||||
///
|
|
||||||
string operator() ()
|
|
||||||
{
|
|
||||||
return (index < cs->num_files)? cs->files[index++]
|
|
||||||
: string();
|
|
||||||
}
|
|
||||||
///
|
|
||||||
string operator[] (int a)
|
|
||||||
{ return cs->files[a];}
|
|
||||||
private:
|
|
||||||
///
|
|
||||||
const LastFiles *cs;
|
|
||||||
///
|
|
||||||
char index;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
825
src/layout.C
825
src/layout.C
File diff suppressed because it is too large
Load Diff
416
src/layout.h
416
src/layout.h
@ -1,27 +1,30 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/* This file is part of
|
/* This file is part of
|
||||||
* ======================================================
|
* ======================================================
|
||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
*
|
* Copyright 1995-1999 The LyX Team.
|
||||||
*======================================================*/
|
*
|
||||||
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef _LAYOUT_H
|
#ifndef LAYOUT_H
|
||||||
#define _LAYOUT_H
|
#define LAYOUT_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
#include "lyxlex.h"
|
#include "lyxlex.h"
|
||||||
#include "lyxfont.h"
|
#include "lyxfont.h"
|
||||||
#include "Spacing.h"
|
#include "Spacing.h"
|
||||||
|
|
||||||
/// Reads the style files
|
/// Reads the style files
|
||||||
void LyXSetStyle();
|
extern void LyXSetStyle();
|
||||||
|
|
||||||
/// The different output types
|
/// The different output types
|
||||||
enum OutputType {
|
enum OutputType {
|
||||||
@ -50,7 +53,9 @@ enum LYX_MARGIN_TYPE {
|
|||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
enum LYX_ALIGNMENT {
|
enum LyXAlignment {
|
||||||
|
///
|
||||||
|
LYX_ALIGN_NONE = 0,
|
||||||
///
|
///
|
||||||
LYX_ALIGN_BLOCK = 1,
|
LYX_ALIGN_BLOCK = 1,
|
||||||
///
|
///
|
||||||
@ -64,6 +69,9 @@ enum LYX_ALIGNMENT {
|
|||||||
///
|
///
|
||||||
LYX_ALIGN_SPECIAL = 32
|
LYX_ALIGN_SPECIAL = 32
|
||||||
};
|
};
|
||||||
|
inline void operator|=(LyXAlignment & la1, LyXAlignment la2) {
|
||||||
|
la1 = static_cast<LyXAlignment>(la1 | la2);
|
||||||
|
}
|
||||||
|
|
||||||
/// The different LaTeX-Types
|
/// The different LaTeX-Types
|
||||||
enum LYX_LATEX_TYPES {
|
enum LYX_LATEX_TYPES {
|
||||||
@ -123,25 +131,28 @@ enum LYX_LABEL_TYPES {
|
|||||||
|
|
||||||
|
|
||||||
/* Fix labels are printed flushright, manual labels flushleft.
|
/* Fix labels are printed flushright, manual labels flushleft.
|
||||||
* MARGIN_MANUAL and MARGIN_FIRST_DYNAMIC are *only* for LABEL_MANUAL,
|
* MARGIN_MANUAL and MARGIN_FIRST_DYNAMIC are *only* for LABEL_MANUAL,
|
||||||
* MARGIN_DYNAMIC and MARGIN_STATIC are *not* for LABEL_MANUAL.
|
* MARGIN_DYNAMIC and MARGIN_STATIC are *not* for LABEL_MANUAL.
|
||||||
* This seems a funny restriction, but I think other combinations are
|
* This seems a funny restriction, but I think other combinations are
|
||||||
* not needed, so I will not change it yet.
|
* not needed, so I will not change it yet.
|
||||||
* Correction: MARGIN_FIRST_DYNAMIC also usable with LABEL_STATIC */
|
* Correction: MARGIN_FIRST_DYNAMIC also usable with LABEL_STATIC
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* There is a parindent and a parskip. Which one is used depends on the
|
/* There is a parindent and a parskip. Which one is used depends on the
|
||||||
* paragraph_separation-flag of the text-object.
|
* paragraph_separation-flag of the text-object.
|
||||||
* BUT: parindent is only thrown away, if a parskip is defined! So if you
|
* BUT: parindent is only thrown away, if a parskip is defined! So if you
|
||||||
* want a space between the paragraphs and a parindent at the same time,
|
* want a space between the paragraphs and a parindent at the same time,
|
||||||
* you should set parskip to zero and use topsep, parsep and bottomsep.
|
* you should set parskip to zero and use topsep, parsep and bottomsep.
|
||||||
*
|
*
|
||||||
* The standard layout is an exception: its parindent is only set, if the
|
* The standard layout is an exception: its parindent is only set, if the
|
||||||
* previous paragraph is standard too. Well, this is LateX and it is good! */
|
* previous paragraph is standard too. Well, this is LateX and it is good!
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/// Attributes of a layout/paragraph environment
|
/// Attributes of a layout/paragraph environment
|
||||||
class LyXLayoutList;
|
class LyXTextClass;
|
||||||
|
|
||||||
///
|
///
|
||||||
class LyXLayout {
|
class LyXLayout {
|
||||||
public:
|
public:
|
||||||
@ -149,45 +160,41 @@ public:
|
|||||||
LyXLayout ();
|
LyXLayout ();
|
||||||
|
|
||||||
///
|
///
|
||||||
~LyXLayout ();
|
bool Read (LyXLex &, LyXTextClass const &);
|
||||||
|
|
||||||
///
|
string const & name() const { return name_; }
|
||||||
void Copy (LyXLayout const &l);
|
void name(string const & n) { name_ = n; }
|
||||||
|
string const & obsoleted_by() const { return obsoleted_by_; }
|
||||||
///
|
string const & latexname() const { return latexname_; }
|
||||||
bool Read (LyXLex&, LyXLayoutList *);
|
string const & labelstring() const { return labelstring_; }
|
||||||
|
string const & preamble() const { return preamble_; }
|
||||||
/// Name of the layout/paragraph environment
|
string const & latexparam() const { return latexparam_; }
|
||||||
string name;
|
string const & labelstring_appendix() const { return labelstring_appendix_; }
|
||||||
|
/** Default font for this layout/environment.
|
||||||
/// Name of an layout that has replaced this layout.
|
The main font for this kind of environment. If an attribute has
|
||||||
/** This is used to rename a layout, while keeping backward
|
|
||||||
compatibility
|
|
||||||
*/
|
|
||||||
string obsoleted_by;
|
|
||||||
|
|
||||||
/// Default font for this layout/environment
|
|
||||||
/** The main font for this kind of environment. If an attribute has
|
|
||||||
LyXFont::INHERITED_*, it means that the value is specified by
|
LyXFont::INHERITED_*, it means that the value is specified by
|
||||||
the defaultfont for the entire layout. If we are nested, the font
|
the defaultfont for the entire layout. If we are nested, the
|
||||||
is inherited from the font in the environment one level up until the
|
font is inherited from the font in the environment one level
|
||||||
font is resolved. The values LyXFont::IGNORE_* and LyXFont::TOGGLE
|
up until the font is resolved. The values LyXFont::IGNORE_*
|
||||||
are illegal here.
|
and LyXFont::TOGGLE are illegal here.
|
||||||
*/
|
*/
|
||||||
LyXFont font;
|
LyXFont font;
|
||||||
|
|
||||||
/// Default font for labels
|
/** Default font for labels.
|
||||||
/** Interpretation the same as for font above */
|
Interpretation the same as for font above
|
||||||
|
*/
|
||||||
LyXFont labelfont;
|
LyXFont labelfont;
|
||||||
|
|
||||||
/// Resolved version of the font for this layout/environment
|
/** Resolved version of the font for this layout/environment.
|
||||||
/** This is a resolved version the default font. The font is resolved
|
This is a resolved version the default font. The font is resolved
|
||||||
against the defaultfont of the entire layout. */
|
against the defaultfont of the entire layout.
|
||||||
|
*/
|
||||||
LyXFont resfont;
|
LyXFont resfont;
|
||||||
|
|
||||||
/// Resolved version of the font used for labels
|
/** Resolved version of the font used for labels.
|
||||||
/** This is a resolved version the label font. The font is resolved
|
This is a resolved version the label font. The font is resolved
|
||||||
against the defaultfont of the entire layout. */
|
against the defaultfont of the entire layout.
|
||||||
|
*/
|
||||||
LyXFont reslabelfont;
|
LyXFont reslabelfont;
|
||||||
|
|
||||||
/// Text that dictates how wide the left margin is on the screen
|
/// Text that dictates how wide the left margin is on the screen
|
||||||
@ -202,24 +209,11 @@ public:
|
|||||||
/// Text that dictates how much space to leave before a potential label
|
/// Text that dictates how much space to leave before a potential label
|
||||||
string labelindent;
|
string labelindent;
|
||||||
|
|
||||||
/// Text that dictates the width of the indentation of indented paragraphs
|
/** Text that dictates the width of the indentation of
|
||||||
|
indented paragraphs.
|
||||||
|
*/
|
||||||
string parindent;
|
string parindent;
|
||||||
|
|
||||||
/// Label string. "Abstract", "Reference", "Caption"...
|
|
||||||
string labelstring;
|
|
||||||
|
|
||||||
/// Label string inside appendix. "Appendix", ...
|
|
||||||
string labelstring_appendix;
|
|
||||||
|
|
||||||
/// LaTeX name for environment
|
|
||||||
string latexname;
|
|
||||||
|
|
||||||
/// LaTeX parameter for environment
|
|
||||||
string latexparam; //arrae970411
|
|
||||||
|
|
||||||
/// Macro definitions needed for this layout
|
|
||||||
string preamble;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
float parskip;
|
float parskip;
|
||||||
|
|
||||||
@ -242,10 +236,10 @@ public:
|
|||||||
Spacing spacing;
|
Spacing spacing;
|
||||||
|
|
||||||
///
|
///
|
||||||
char align; // add approp. signedness
|
LyXAlignment align; // add approp. signedness
|
||||||
|
|
||||||
///
|
///
|
||||||
char alignpossible; // add approp. signedness
|
LyXAlignment alignpossible; // add approp. signedness
|
||||||
|
|
||||||
///
|
///
|
||||||
char labeltype; // add approp. signedness
|
char labeltype; // add approp. signedness
|
||||||
@ -290,192 +284,238 @@ public:
|
|||||||
LYX_LATEX_TYPES latextype;
|
LYX_LATEX_TYPES latextype;
|
||||||
/// Does this object belong in the title part of the document?
|
/// Does this object belong in the title part of the document?
|
||||||
bool intitle;
|
bool intitle;
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
///
|
|
||||||
class LyXLayoutList {
|
|
||||||
public:
|
|
||||||
///
|
|
||||||
LyXLayoutList();
|
|
||||||
///
|
|
||||||
~LyXLayoutList();
|
|
||||||
///
|
|
||||||
void Add (LyXLayout *l);
|
|
||||||
///
|
|
||||||
bool Delete (string const &name);
|
|
||||||
///
|
|
||||||
LyXLayout *GetLayout (string const &name);
|
|
||||||
///
|
|
||||||
LyXLayout *ToAr();
|
|
||||||
///
|
|
||||||
int GetNum();
|
|
||||||
///
|
|
||||||
void Clean();
|
|
||||||
private:
|
private:
|
||||||
///
|
/// Name of the layout/paragraph environment
|
||||||
struct LyXLayoutL {
|
string name_;
|
||||||
///
|
|
||||||
LyXLayout* layout;
|
/** Name of an layout that has replaced this layout.
|
||||||
///
|
This is used to rename a layout, while keeping backward
|
||||||
LyXLayoutL *next;
|
compatibility
|
||||||
};
|
*/
|
||||||
///
|
string obsoleted_by_;
|
||||||
LyXLayoutL * l;
|
|
||||||
///
|
/// LaTeX name for environment
|
||||||
LyXLayoutL *eol;
|
string latexname_;
|
||||||
///
|
|
||||||
int num_layouts;
|
/// Label string. "Abstract", "Reference", "Caption"...
|
||||||
|
string labelstring_;
|
||||||
|
|
||||||
|
/// Label string inside appendix. "Appendix", ...
|
||||||
|
string labelstring_appendix_;
|
||||||
|
|
||||||
|
/// LaTeX parameter for environment
|
||||||
|
string latexparam_;
|
||||||
|
|
||||||
|
/// Macro definitions needed for this layout
|
||||||
|
string preamble_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
class LyXTextClass {
|
class LyXTextClass {
|
||||||
public:
|
public:
|
||||||
|
///
|
||||||
|
typedef vector<LyXLayout> LayoutList;
|
||||||
|
|
||||||
///
|
///
|
||||||
LyXTextClass (string const & = string(),
|
LyXTextClass (string const & = string(),
|
||||||
string const & = string(),
|
string const & = string(),
|
||||||
string const & = string());
|
string const & = string());
|
||||||
|
|
||||||
///
|
///
|
||||||
~LyXTextClass();
|
LayoutList::const_iterator begin() const { return layoutlist.begin(); }
|
||||||
|
///
|
||||||
|
LayoutList::const_iterator end() const { return layoutlist.end(); }
|
||||||
|
|
||||||
/// Not a real copy, just reference!
|
///
|
||||||
void Copy (LyXTextClass const &l);
|
bool Read(string const & filename, bool merge = false);
|
||||||
|
|
||||||
/// Reads a textclass structure from file
|
///
|
||||||
int Read (string const & filename, LyXLayoutList *list = 0);
|
bool hasLayout(string const & name) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
LyXLayout const & GetLayout(string const & vname) const;
|
||||||
|
|
||||||
|
///
|
||||||
|
LyXLayout & GetLayout(string const & vname);
|
||||||
|
|
||||||
/// Sees to that the textclass structure has been loaded
|
/// Sees to that the textclass structure has been loaded
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
///
|
///
|
||||||
string name;
|
string const & name() const { return name_; }
|
||||||
///
|
///
|
||||||
string latexname;
|
string const & latexname() const { return latexname_; }
|
||||||
///
|
///
|
||||||
string description;
|
string const & description() const { return description_; }
|
||||||
///
|
///
|
||||||
OutputType output_type;
|
string const & opt_fontsize() const { return opt_fontsize_; }
|
||||||
|
|
||||||
/// Specific class options
|
|
||||||
string opt_fontsize;
|
|
||||||
///
|
///
|
||||||
string opt_pagestyle;
|
string const & opt_pagestyle() const { return opt_pagestyle_; }
|
||||||
///
|
///
|
||||||
string options;
|
string const & options() const { return options_; }
|
||||||
|
///
|
||||||
|
string const & pagestyle() const { return pagestyle_; }
|
||||||
|
///
|
||||||
|
string const & preamble() const { return preamble_; }
|
||||||
|
|
||||||
/// Packages that are already loaded by the class
|
/// Packages that are already loaded by the class
|
||||||
bool provides_amsmath;
|
enum Provides {
|
||||||
///
|
nothing = 0,
|
||||||
bool provides_makeidx;
|
amsmath = 1,
|
||||||
///
|
makeidx = 2,
|
||||||
bool provides_url;
|
url = 4
|
||||||
|
};
|
||||||
|
bool provides(Provides p) const { return provides_ & p; }
|
||||||
|
|
||||||
/// Base font. This one has to be fully instantiated.
|
|
||||||
/** Base font. The paragraph and layout fonts are resolved against
|
|
||||||
this font. Attributes LyXFont::INHERIT, LyXFont::IGNORE, and
|
|
||||||
LyXFont::TOGGLE are extremely illegal.
|
|
||||||
*/
|
|
||||||
LyXFont defaultfont;
|
|
||||||
/// Array of styles in this textclass
|
|
||||||
LyXLayout* style;
|
|
||||||
///
|
///
|
||||||
unsigned char number_of_defined_layouts;
|
unsigned int columns() const { return columns_; }
|
||||||
///
|
///
|
||||||
unsigned char columns;
|
enum PageSides {
|
||||||
|
OneSide,
|
||||||
|
TwoSides
|
||||||
|
};
|
||||||
///
|
///
|
||||||
unsigned char sides;
|
PageSides sides() const { return sides_; }
|
||||||
///
|
///
|
||||||
signed char secnumdepth;
|
int secnumdepth() const { return secnumdepth_; }
|
||||||
///
|
///
|
||||||
signed char tocdepth;
|
int tocdepth() const { return tocdepth_; }
|
||||||
|
|
||||||
///
|
///
|
||||||
string pagestyle;
|
OutputType outputType() const { return outputType_; }
|
||||||
///
|
|
||||||
string preamble;
|
|
||||||
///
|
///
|
||||||
|
LyXFont const & defaultfont() const { return defaultfont_; }
|
||||||
|
|
||||||
/// Text that dictates how wide the left margin is on the screen
|
/// Text that dictates how wide the left margin is on the screen
|
||||||
string leftmargin;
|
string const & leftmargin() const { return leftmargin_; }
|
||||||
///
|
|
||||||
/// Text that dictates how wide the right margin is on the screen
|
/// Text that dictates how wide the right margin is on the screen
|
||||||
string rightmargin;
|
string const & rightmargin() const { return rightmargin_; }
|
||||||
///
|
///
|
||||||
char maxcounter; // add approp. signedness
|
int maxcounter() const { return maxcounter_; }
|
||||||
|
///
|
||||||
|
LayoutList::size_type numLayouts() const { return layoutlist.size(); }
|
||||||
|
///
|
||||||
|
LyXLayout const & operator[](LayoutList::size_type i) const {
|
||||||
|
return layoutlist[i];
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
|
///
|
||||||
|
bool delete_layout(string const &);
|
||||||
|
///
|
||||||
|
bool do_readStyle(LyXLex &, LyXLayout &);
|
||||||
|
///
|
||||||
|
string name_;
|
||||||
|
///
|
||||||
|
string latexname_;
|
||||||
|
///
|
||||||
|
string description_;
|
||||||
|
/// Specific class options
|
||||||
|
string opt_fontsize_;
|
||||||
|
///
|
||||||
|
string opt_pagestyle_;
|
||||||
|
///
|
||||||
|
string options_;
|
||||||
|
///
|
||||||
|
string pagestyle_;
|
||||||
|
///
|
||||||
|
string preamble_;
|
||||||
|
///
|
||||||
|
Provides provides_;
|
||||||
|
///
|
||||||
|
unsigned int columns_;
|
||||||
|
///
|
||||||
|
PageSides sides_;
|
||||||
|
///
|
||||||
|
int secnumdepth_;
|
||||||
|
///
|
||||||
|
int tocdepth_;
|
||||||
|
///
|
||||||
|
OutputType outputType_;
|
||||||
|
/** Base font. The paragraph and layout fonts are resolved against
|
||||||
|
this font. This has to be fully instantiated. Attributes
|
||||||
|
LyXFont::INHERIT, LyXFont::IGNORE, and LyXFont::TOGGLE are
|
||||||
|
extremely illegal.
|
||||||
|
*/
|
||||||
|
LyXFont defaultfont_;
|
||||||
|
/// Text that dictates how wide the left margin is on the screen
|
||||||
|
string leftmargin_;
|
||||||
|
|
||||||
|
/// Text that dictates how wide the right margin is on the screen
|
||||||
|
string rightmargin_;
|
||||||
|
///
|
||||||
|
int maxcounter_; // add approp. signedness
|
||||||
|
|
||||||
|
///
|
||||||
|
LayoutList layoutlist;
|
||||||
|
|
||||||
/// Has this layout file been loaded yet?
|
/// Has this layout file been loaded yet?
|
||||||
bool loaded;
|
bool loaded;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///
|
||||||
|
inline void operator|=(LyXTextClass::Provides & p1, LyXTextClass::Provides p2)
|
||||||
|
{
|
||||||
|
p1 = static_cast<LyXTextClass::Provides>(p1 | p2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
///
|
///
|
||||||
class LyXTextClassList {
|
class LyXTextClassList {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
LyXTextClassList();
|
typedef vector<LyXTextClass> ClassList;
|
||||||
|
|
||||||
///
|
|
||||||
~LyXTextClassList();
|
|
||||||
|
|
||||||
/// Gets layout structure from layout number and textclass number
|
/// Gets layout structure from layout number and textclass number
|
||||||
LyXLayout *Style(char textclass, char layout);
|
LyXLayout const & Style(ClassList::size_type textclass,
|
||||||
|
LyXTextClass::LayoutList::size_type layout) const;
|
||||||
|
|
||||||
/// Gets layout number from textclass number and layout name
|
/// Gets layout number from textclass number and layout name
|
||||||
char NumberOfLayout(char textclass, string const & name); // add approp. signedness
|
pair<bool, LyXTextClass::LayoutList::size_type>
|
||||||
|
NumberOfLayout(ClassList::size_type textclass,
|
||||||
|
string const & name) const;
|
||||||
|
|
||||||
/// Gets a layout name from layout number and textclass number
|
/// Gets a layout name from layout number and textclass number
|
||||||
string NameOfLayout(char textclass, char layout); // add approp. signedness
|
string const &
|
||||||
|
NameOfLayout(ClassList::size_type textclass,
|
||||||
|
LyXTextClass::LayoutList::size_type layout) const;
|
||||||
|
|
||||||
/// Gets textclass number from name
|
/** Gets textclass number from name.
|
||||||
/** Returns -1 if textclass name does not exist */
|
Returns -1 if textclass name does not exist
|
||||||
signed char NumberOfClass(string const & textclass);
|
*/
|
||||||
|
pair<bool, ClassList::size_type>
|
||||||
|
NumberOfClass(string const & textclass) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
string NameOfClass(char number); // add approp. signedness
|
string const & NameOfClass(ClassList::size_type number) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
string LatexnameOfClass(char number); // add approp. signedness
|
string const & LatexnameOfClass(ClassList::size_type number) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
string DescOfClass(char number); // add approp. signedness
|
string const & DescOfClass(ClassList::size_type number) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
LyXTextClass * TextClass(char textclass); // add approp. signedness
|
LyXTextClass const & TextClass(ClassList::size_type textclass) const;
|
||||||
|
|
||||||
/// Read textclass list
|
/** Read textclass list.
|
||||||
/** Returns false if this fails */
|
Returns false if this fails
|
||||||
|
*/
|
||||||
bool Read();
|
bool Read();
|
||||||
|
|
||||||
/// Load textclass
|
/** Load textclass.
|
||||||
/** Returns false if this fails */
|
Returns false if this fails
|
||||||
bool Load(const char number);
|
*/
|
||||||
|
bool Load(ClassList::size_type number) const;
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
struct LyXTextClassL {
|
mutable ClassList classlist;
|
||||||
///
|
///
|
||||||
LyXTextClass * textclass;
|
void Add (LyXTextClass const &);
|
||||||
///
|
|
||||||
LyXTextClassL * next;
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
|
||||||
LyXTextClassL * l;
|
|
||||||
|
|
||||||
///
|
|
||||||
int num_textclass;
|
|
||||||
|
|
||||||
/// After reading, this arrays holds the textclasses
|
|
||||||
LyXTextClass * ar;
|
|
||||||
|
|
||||||
/// Add a textclass to list
|
|
||||||
void Add (LyXTextClass *l);
|
|
||||||
|
|
||||||
/// Convert final linked list to array
|
|
||||||
/** We read the textclasses into a linked list. After the reading,
|
|
||||||
the list is converted to an array, and the linked list is nuked. */
|
|
||||||
void ToAr();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Should not be declared here!! (Lgb) Why not? (Asger)
|
/// Should not be declared here!! (Lgb) Why not? (Asger)
|
||||||
extern LyXTextClassList lyxstyle;
|
extern LyXTextClassList textclasslist;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
119
src/lyx_cb.C
119
src/lyx_cb.C
@ -58,6 +58,7 @@
|
|||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
#include "layout.h"
|
||||||
|
|
||||||
extern MiniBuffer *minibuffer;
|
extern MiniBuffer *minibuffer;
|
||||||
extern Combox *combo_language;
|
extern Combox *combo_language;
|
||||||
@ -425,30 +426,11 @@ void MenuWriteAs(Buffer *buffer)
|
|||||||
MenuWrite(buffer);
|
MenuWrite(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
extern bool gsworking();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int MenuRunLaTeX(Buffer *buffer)
|
int MenuRunLaTeX(Buffer *buffer)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (gsworking()) {
|
|
||||||
WriteAlert(_("Sorry, can't do this while pictures are being rendered."),
|
|
||||||
_("Please wait a few seconds for this to finish and try again."),
|
|
||||||
_("(or kill runaway gs processes by hand and try again.)"));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
extern pid_t isp_pid; // from spellchecker.C
|
|
||||||
if(isp_pid != -1)
|
|
||||||
{
|
|
||||||
WriteAlert(_("Can't do this while the spellchecker is running."),
|
|
||||||
_("Stop the spellchecker first."));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (buffer->isLinuxDoc())
|
if (buffer->isLinuxDoc())
|
||||||
ret = RunLinuxDoc(1, buffer->getFileName());
|
ret = RunLinuxDoc(1, buffer->getFileName());
|
||||||
else if (buffer->isLiterate())
|
else if (buffer->isLiterate())
|
||||||
@ -1130,8 +1112,12 @@ void InsertAsciiFile(string const & f, bool asParagraph)
|
|||||||
tmppar->readSimpleWholeFile(myfile);
|
tmppar->readSimpleWholeFile(myfile);
|
||||||
|
|
||||||
// set the end of the string
|
// set the end of the string
|
||||||
|
#ifdef NEW_TEXT
|
||||||
|
// I don't think this is needed. Actually it might be plain wrong.
|
||||||
|
tmppar->InsertChar(tmppar->text.size() - 1,'\0');
|
||||||
|
#else
|
||||||
tmppar->InsertChar(tmppar->last-1,'\0');
|
tmppar->InsertChar(tmppar->last-1,'\0');
|
||||||
|
#endif
|
||||||
// insert the string
|
// insert the string
|
||||||
current_view->getScreen()->HideCursor();
|
current_view->getScreen()->HideCursor();
|
||||||
|
|
||||||
@ -1340,15 +1326,15 @@ int RunDocBook(int flag, string const & filename)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
current_view->currentBuffer()->makeDocBookFile(name,0);
|
current_view->currentBuffer()->makeDocBookFile(name,0);
|
||||||
#if 0
|
|
||||||
string add_flags;
|
// Shall this code go or should it stay? (Lgb)
|
||||||
LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->currentBuffer()->params.papersize;
|
// string add_flags;
|
||||||
switch (ps) {
|
// LYX_PAPER_SIZE ps = (LYX_PAPER_SIZE) current_view->currentBuffer()->params.papersize;
|
||||||
case PAPER_A4PAPER: add_flags = "-p a4"; break;
|
// switch (ps) {
|
||||||
case PAPER_USLETTER: add_flags = "-p letter"; break;
|
// case PAPER_A4PAPER: add_flags = "-p a4"; break;
|
||||||
default: /* nothing to be done yet ;-) */ break;
|
// case PAPER_USLETTER: add_flags = "-p letter"; break;
|
||||||
}
|
// default: /* nothing to be done yet ;-) */ break;
|
||||||
#endif
|
// }
|
||||||
ProhibitInput();
|
ProhibitInput();
|
||||||
|
|
||||||
Systemcalls one;
|
Systemcalls one;
|
||||||
@ -1568,8 +1554,8 @@ bool UpdateLayoutParagraph()
|
|||||||
|
|
||||||
int align = buf->text->cursor.par->GetAlign();
|
int align = buf->text->cursor.par->GetAlign();
|
||||||
if (align == LYX_ALIGN_LAYOUT)
|
if (align == LYX_ALIGN_LAYOUT)
|
||||||
align = lyxstyle.Style(buf->params.textclass,
|
align = textclasslist.Style(buf->params.textclass,
|
||||||
buf->text->cursor.par->GetLayout())->align;
|
buf->text->cursor.par->GetLayout()).align;
|
||||||
|
|
||||||
switch (align) {
|
switch (align) {
|
||||||
case LYX_ALIGN_RIGHT:
|
case LYX_ALIGN_RIGHT:
|
||||||
@ -1786,10 +1772,10 @@ bool UpdateLayoutDocument(BufferParams *params)
|
|||||||
|
|
||||||
if (params == 0)
|
if (params == 0)
|
||||||
params = ¤t_view->currentBuffer()->params;
|
params = ¤t_view->currentBuffer()->params;
|
||||||
LyXTextClass *tclass = lyxstyle.TextClass(params->textclass);
|
LyXTextClass const & tclass = textclasslist.TextClass(params->textclass);
|
||||||
|
|
||||||
fl_set_choice_text(fd_form_document->choice_class,
|
fl_set_choice_text(fd_form_document->choice_class,
|
||||||
lyxstyle.DescOfClass(params->textclass).c_str());
|
textclasslist.DescOfClass(params->textclass).c_str());
|
||||||
combo_language->select_text(params->language.c_str());
|
combo_language->select_text(params->language.c_str());
|
||||||
|
|
||||||
fl_set_choice_text(fd_form_document->choice_fonts,
|
fl_set_choice_text(fd_form_document->choice_fonts,
|
||||||
@ -1803,18 +1789,18 @@ bool UpdateLayoutDocument(BufferParams *params)
|
|||||||
fl_clear_choice(fd_form_document->choice_fontsize);
|
fl_clear_choice(fd_form_document->choice_fontsize);
|
||||||
fl_addto_choice(fd_form_document->choice_fontsize, "default");
|
fl_addto_choice(fd_form_document->choice_fontsize, "default");
|
||||||
fl_addto_choice(fd_form_document->choice_fontsize,
|
fl_addto_choice(fd_form_document->choice_fontsize,
|
||||||
tclass->opt_fontsize.c_str());
|
tclass.opt_fontsize().c_str());
|
||||||
fl_set_choice(fd_form_document->choice_fontsize,
|
fl_set_choice(fd_form_document->choice_fontsize,
|
||||||
tokenPos(tclass->opt_fontsize, '|', params->fontsize) + 2);
|
tokenPos(tclass.opt_fontsize(), '|', params->fontsize) + 2);
|
||||||
|
|
||||||
// ale970405+lasgoutt970513
|
// ale970405+lasgoutt970513
|
||||||
fl_clear_choice(fd_form_document->choice_pagestyle);
|
fl_clear_choice(fd_form_document->choice_pagestyle);
|
||||||
fl_addto_choice(fd_form_document->choice_pagestyle, "default");
|
fl_addto_choice(fd_form_document->choice_pagestyle, "default");
|
||||||
fl_addto_choice(fd_form_document->choice_pagestyle,
|
fl_addto_choice(fd_form_document->choice_pagestyle,
|
||||||
tclass->opt_pagestyle.c_str());
|
tclass.opt_pagestyle().c_str());
|
||||||
|
|
||||||
fl_set_choice(fd_form_document->choice_pagestyle,
|
fl_set_choice(fd_form_document->choice_pagestyle,
|
||||||
tokenPos(tclass->opt_pagestyle, '|', params->pagestyle) + 2);
|
tokenPos(tclass.opt_pagestyle(), '|', params->pagestyle) + 2);
|
||||||
|
|
||||||
fl_set_button(fd_form_document->radio_indent, 0);
|
fl_set_button(fd_form_document->radio_indent, 0);
|
||||||
fl_set_button(fd_form_document->radio_skip, 0);
|
fl_set_button(fd_form_document->radio_skip, 0);
|
||||||
@ -2301,8 +2287,8 @@ string CurrentState()
|
|||||||
// font. (Asger)
|
// font. (Asger)
|
||||||
Buffer * buffer = current_view->currentBuffer();
|
Buffer * buffer = current_view->currentBuffer();
|
||||||
LyXFont font = buffer->text->real_current_font;
|
LyXFont font = buffer->text->real_current_font;
|
||||||
LyXFont defaultfont = lyxstyle.TextClass(buffer->
|
LyXFont defaultfont = textclasslist.TextClass(buffer->
|
||||||
params.textclass)->defaultfont;
|
params.textclass).defaultfont();
|
||||||
font.reduce(defaultfont);
|
font.reduce(defaultfont);
|
||||||
state = _("Font: ") + font.stateText();
|
state = _("Font: ") + font.stateText();
|
||||||
|
|
||||||
@ -2650,10 +2636,8 @@ extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
|
|||||||
if (!current_view->available())
|
if (!current_view->available())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool line_top, line_bottom;
|
|
||||||
bool pagebreak_top, pagebreak_bottom;
|
|
||||||
VSpace space_top, space_bottom;
|
VSpace space_top, space_bottom;
|
||||||
char align;
|
LyXAlignment align;
|
||||||
string labelwidthstring;
|
string labelwidthstring;
|
||||||
bool noindent;
|
bool noindent;
|
||||||
|
|
||||||
@ -2668,10 +2652,10 @@ extern "C" void ParagraphApplyCB(FL_OBJECT *, long)
|
|||||||
fl_set_choice (fd_form_paragraph->choice_space_below, 1);
|
fl_set_choice (fd_form_paragraph->choice_space_below, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
line_top = fl_get_button(fd_form_paragraph->check_lines_top);
|
bool line_top = fl_get_button(fd_form_paragraph->check_lines_top);
|
||||||
line_bottom = fl_get_button(fd_form_paragraph->check_lines_bottom);
|
bool line_bottom = fl_get_button(fd_form_paragraph->check_lines_bottom);
|
||||||
pagebreak_top = fl_get_button(fd_form_paragraph->check_pagebreaks_top);
|
bool pagebreak_top = fl_get_button(fd_form_paragraph->check_pagebreaks_top);
|
||||||
pagebreak_bottom = fl_get_button(fd_form_paragraph->check_pagebreaks_bottom);
|
bool pagebreak_bottom = fl_get_button(fd_form_paragraph->check_pagebreaks_bottom);
|
||||||
switch (fl_get_choice (fd_form_paragraph->choice_space_above)) {
|
switch (fl_get_choice (fd_form_paragraph->choice_space_above)) {
|
||||||
case 1: space_top = VSpace(VSpace::NONE); break;
|
case 1: space_top = VSpace(VSpace::NONE); break;
|
||||||
case 2: space_top = VSpace(VSpace::DEFSKIP); break;
|
case 2: space_top = VSpace(VSpace::DEFSKIP); break;
|
||||||
@ -2786,7 +2770,7 @@ void UpdateDocumentButtons(BufferParams const ¶ms)
|
|||||||
extern "C" void ChoiceClassCB(FL_OBJECT *ob, long)
|
extern "C" void ChoiceClassCB(FL_OBJECT *ob, long)
|
||||||
{
|
{
|
||||||
ProhibitInput();
|
ProhibitInput();
|
||||||
if (lyxstyle.Load(fl_get_choice(ob)-1)) {
|
if (textclasslist.Load(fl_get_choice(ob)-1)) {
|
||||||
if (AskQuestion(_("Should I set some parameters to"),
|
if (AskQuestion(_("Should I set some parameters to"),
|
||||||
fl_get_choice_text(ob),
|
fl_get_choice_text(ob),
|
||||||
_("the defaults of this document class?"))) {
|
_("the defaults of this document class?"))) {
|
||||||
@ -2894,10 +2878,10 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
|
|||||||
if (!current_view->available())
|
if (!current_view->available())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char new_class = fl_get_choice(fd_form_document->choice_class) - 1;
|
LyXTextClassList::ClassList::size_type new_class = fl_get_choice(fd_form_document->choice_class) - 1;
|
||||||
if (params->textclass != new_class) {
|
if (params->textclass != new_class) {
|
||||||
// try to load new_class
|
// try to load new_class
|
||||||
if (lyxstyle.Load(new_class)) {
|
if (textclasslist.Load(new_class)) {
|
||||||
// successfully loaded
|
// successfully loaded
|
||||||
redo = true;
|
redo = true;
|
||||||
minibuffer->Set(_("Converting document to new document class..."));
|
minibuffer->Set(_("Converting document to new document class..."));
|
||||||
@ -2959,9 +2943,9 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
|
|||||||
else
|
else
|
||||||
params->columns = 1;
|
params->columns = 1;
|
||||||
if (fl_get_button(fd_form_document->radio_sides_two))
|
if (fl_get_button(fd_form_document->radio_sides_two))
|
||||||
params->sides = 2;
|
params->sides = LyXTextClass::TwoSides;
|
||||||
else
|
else
|
||||||
params->sides = 1;
|
params->sides = LyXTextClass::OneSide;
|
||||||
|
|
||||||
Spacing tmpSpacing = params->spacing;
|
Spacing tmpSpacing = params->spacing;
|
||||||
switch(fl_get_choice(fd_form_document->choice_spacing)) {
|
switch(fl_get_choice(fd_form_document->choice_spacing)) {
|
||||||
@ -2986,14 +2970,14 @@ extern "C" void DocumentApplyCB(FL_OBJECT *, long)
|
|||||||
if (tmpSpacing != params->spacing)
|
if (tmpSpacing != params->spacing)
|
||||||
redo = true;
|
redo = true;
|
||||||
|
|
||||||
signed char tmpchar = (signed char)
|
signed char tmpchar =
|
||||||
fl_get_counter_value(fd_form_document->slider_secnumdepth);;
|
static_cast<signed char>(fl_get_counter_value(fd_form_document->slider_secnumdepth));
|
||||||
if (params->secnumdepth != tmpchar)
|
if (params->secnumdepth != tmpchar)
|
||||||
redo = true;
|
redo = true;
|
||||||
params->secnumdepth = tmpchar;
|
params->secnumdepth = tmpchar;
|
||||||
|
|
||||||
params->tocdepth = (signed char)
|
params->tocdepth =
|
||||||
fl_get_counter_value(fd_form_document->slider_tocdepth);;
|
static_cast<int>(fl_get_counter_value(fd_form_document->slider_tocdepth));
|
||||||
|
|
||||||
params->float_placement =
|
params->float_placement =
|
||||||
fl_get_input(fd_form_document->input_float_placement);
|
fl_get_input(fd_form_document->input_float_placement);
|
||||||
@ -3721,8 +3705,8 @@ extern "C" void TocCancelCB(FL_OBJECT *, long)
|
|||||||
|
|
||||||
extern "C" void TocUpdateCB(FL_OBJECT *, long)
|
extern "C" void TocUpdateCB(FL_OBJECT *, long)
|
||||||
{
|
{
|
||||||
static LyXParagraph* stapar = 0;
|
static LyXParagraph * stapar = 0;
|
||||||
TocList *tmptoclist = 0;
|
TocList * tmptoclist = 0;
|
||||||
|
|
||||||
/* deleted the toclist */
|
/* deleted the toclist */
|
||||||
if (toclist){
|
if (toclist){
|
||||||
@ -3743,10 +3727,9 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
|
|||||||
}
|
}
|
||||||
fl_hide_object(fd_form_toc->browser_toc);
|
fl_hide_object(fd_form_toc->browser_toc);
|
||||||
/* get the table of contents */
|
/* get the table of contents */
|
||||||
LyXParagraph *par = current_view->currentBuffer()->paragraph;
|
LyXParagraph * par = current_view->currentBuffer()->paragraph;
|
||||||
char labeltype;
|
char labeltype;
|
||||||
char* line = new char[200];
|
char * line = new char[200];
|
||||||
//int i = 0;
|
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
int topline = 0;
|
int topline = 0;
|
||||||
@ -3756,8 +3739,8 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
|
|||||||
stapar = par;
|
stapar = par;
|
||||||
|
|
||||||
while (par) {
|
while (par) {
|
||||||
labeltype = lyxstyle.Style(current_view->currentBuffer()->params.textclass,
|
labeltype = textclasslist.Style(current_view->currentBuffer()->params.textclass,
|
||||||
par->GetLayout())->labeltype;
|
par->GetLayout()).labeltype;
|
||||||
|
|
||||||
if (labeltype >= LABEL_COUNTER_CHAPTER
|
if (labeltype >= LABEL_COUNTER_CHAPTER
|
||||||
&& labeltype <= LABEL_COUNTER_CHAPTER +
|
&& labeltype <= LABEL_COUNTER_CHAPTER +
|
||||||
@ -3767,13 +3750,12 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
|
|||||||
|
|
||||||
for (pos=0;
|
for (pos=0;
|
||||||
pos < (labeltype -
|
pos < (labeltype -
|
||||||
lyxstyle.TextClass(current_view->currentBuffer()->
|
textclasslist.TextClass(current_view->currentBuffer()->
|
||||||
params.textclass)->maxcounter) * 4 + 2;
|
params.textclass).maxcounter()) * 4 + 2;
|
||||||
pos++)
|
pos++)
|
||||||
line[pos] = ' ';
|
line[pos] = ' ';
|
||||||
|
|
||||||
// Then the labestring
|
// Then the labestring
|
||||||
//i = 0;
|
|
||||||
if (!par->labelstring.empty()) {
|
if (!par->labelstring.empty()) {
|
||||||
string::size_type i = 0;
|
string::size_type i = 0;
|
||||||
while (pos < 199 && i < par->labelstring.length()) {
|
while (pos < 199 && i < par->labelstring.length()) {
|
||||||
@ -3787,10 +3769,15 @@ extern "C" void TocUpdateCB(FL_OBJECT *, long)
|
|||||||
pos++;
|
pos++;
|
||||||
|
|
||||||
/* now the contents */
|
/* now the contents */
|
||||||
|
#ifdef NEW_TEXT
|
||||||
|
LyXParagraph::size_type i = 0;
|
||||||
|
while (pos < 199 && i < par->size()) {
|
||||||
|
#else
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (pos < 199 && i < par->last) {
|
while (pos < 199 && i < par->last) {
|
||||||
|
#endif
|
||||||
c = par->GetChar(i);
|
c = par->GetChar(i);
|
||||||
if (isprint((unsigned char) c) || c >= 128) {
|
if (isprint(c) || c >= 128) {
|
||||||
line[pos] = c;
|
line[pos] = c;
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
@ -49,9 +49,6 @@ extern FD_form_sendto * fd_form_sendto;
|
|||||||
extern FD_form_figure * fd_form_figure;
|
extern FD_form_figure * fd_form_figure;
|
||||||
extern FD_form_toc * fd_form_toc;
|
extern FD_form_toc * fd_form_toc;
|
||||||
extern FD_form_ref * fd_form_ref;
|
extern FD_form_ref * fd_form_ref;
|
||||||
#if 0
|
|
||||||
extern FD_form_url * fd_form_url;
|
|
||||||
#endif
|
|
||||||
extern FD_form_paragraph_extra * fd_form_paragraph_extra;
|
extern FD_form_paragraph_extra * fd_form_paragraph_extra;
|
||||||
extern FD_LaTeXLog * fd_latex_log;
|
extern FD_LaTeXLog * fd_latex_log;
|
||||||
extern FD_form_spell_check * fd_form_spell_check;
|
extern FD_form_spell_check * fd_form_spell_check;
|
||||||
@ -129,11 +126,6 @@ void CloseAllBufferRelatedPopups()
|
|||||||
if (fd_form_ref->form_ref->visible) {
|
if (fd_form_ref->form_ref->visible) {
|
||||||
fl_hide_form(fd_form_ref->form_ref);
|
fl_hide_form(fd_form_ref->form_ref);
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if (fd_form_url->form_url->visible) {
|
|
||||||
fl_hide_form(fd_form_url->form_url);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (fd_form_paper->form_paper->visible) {
|
if (fd_form_paper->form_paper->visible) {
|
||||||
fl_hide_form(fd_form_paper->form_paper);
|
fl_hide_form(fd_form_paper->form_paper);
|
||||||
}
|
}
|
||||||
|
@ -39,25 +39,21 @@ string user_lyxdir; // Default $HOME/.lyx
|
|||||||
// Should this be kept global? Asger says Yes.
|
// Should this be kept global? Asger says Yes.
|
||||||
DebugStream lyxerr;
|
DebugStream lyxerr;
|
||||||
|
|
||||||
LastFiles *lastfiles;
|
LastFiles * lastfiles;
|
||||||
LyXRC *lyxrc;
|
LyXRC * lyxrc;
|
||||||
|
|
||||||
// This is the global bufferlist object
|
// This is the global bufferlist object
|
||||||
BufferList bufferlist;
|
BufferList bufferlist;
|
||||||
|
|
||||||
LyXServer *lyxserver = 0;
|
LyXServer * lyxserver = 0;
|
||||||
// this should be static, but I need it in buffer.C
|
// this should be static, but I need it in buffer.C
|
||||||
bool finished = false; // flag, that we are quitting the program
|
bool finished = false; // flag, that we are quitting the program
|
||||||
|
|
||||||
// convenient to have it here.
|
// convenient to have it here.
|
||||||
kb_keymap *toplevel_keymap;
|
kb_keymap * toplevel_keymap;
|
||||||
|
|
||||||
// from spellchecker.C
|
|
||||||
#if 0
|
|
||||||
extern void sigchldhandler(int sig);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LyX::LyX(int *argc, char *argv[])
|
LyX::LyX(int * argc, char * argv[])
|
||||||
{
|
{
|
||||||
// Prevent crash with --help
|
// Prevent crash with --help
|
||||||
lyxGUI = 0;
|
lyxGUI = 0;
|
||||||
@ -95,7 +91,7 @@ LyX::LyX(int *argc, char *argv[])
|
|||||||
else if ((*argc)>2)
|
else if ((*argc)>2)
|
||||||
lyxerr.debug() << "Opening documents..." << endl;
|
lyxerr.debug() << "Opening documents..." << endl;
|
||||||
|
|
||||||
Buffer *last_loaded = 0;
|
Buffer * last_loaded = 0;
|
||||||
|
|
||||||
for (int argi = (*argc) - 1; argi >= 1; argi--) {
|
for (int argi = (*argc) - 1; argi >= 1; argi--) {
|
||||||
Buffer * loadb = bufferlist.loadLyXFile(argv[argi]);
|
Buffer * loadb = bufferlist.loadLyXFile(argv[argi]);
|
||||||
@ -146,14 +142,6 @@ void LyX::init(int */*argc*/, char **argv)
|
|||||||
signal(SIGINT, error_handler);
|
signal(SIGINT, error_handler);
|
||||||
signal(SIGTERM, error_handler);
|
signal(SIGTERM, error_handler);
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Install the SIGCHLD handler
|
|
||||||
act_.sa_handler = sigchldhandler;
|
|
||||||
//act_.sa_mask = SIGCHLD;
|
|
||||||
act_.sa_flags = 0;
|
|
||||||
//act_.sa_flags = SA_RESTART; //perhaps
|
|
||||||
sigaction(SIGCHLD, &act_, 0);
|
|
||||||
#endif
|
|
||||||
//
|
//
|
||||||
// Determine path of binary
|
// Determine path of binary
|
||||||
//
|
//
|
||||||
@ -478,10 +466,10 @@ void commandLineHelp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LyX::easyParse(int *argc, char *argv[])
|
bool LyX::easyParse(int * argc, char * argv[])
|
||||||
{
|
{
|
||||||
bool gui = true;
|
bool gui = true;
|
||||||
for(int i=1; i < *argc; i++) {
|
for(int i = 1; i < *argc; ++i) {
|
||||||
string arg = argv[i];
|
string arg = argv[i];
|
||||||
// Check for -dbg int
|
// Check for -dbg int
|
||||||
if (arg == "-dbg") {
|
if (arg == "-dbg") {
|
||||||
|
@ -7,19 +7,26 @@
|
|||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright (C) 1995 Matthias Ettrich
|
||||||
*
|
*
|
||||||
*======================================================*/
|
*======================================================*/
|
||||||
#ifndef _LYXCURSOR_H
|
|
||||||
#define _LYXCURSOR_H
|
|
||||||
|
|
||||||
class LyXParagraph;
|
#ifndef LYXCURSOR_H
|
||||||
|
#define LYXCURSOR_H
|
||||||
|
|
||||||
|
#include "lyxparagraph.h"
|
||||||
|
|
||||||
struct Row;
|
struct Row;
|
||||||
|
|
||||||
/** All these variavles should be explained. Matthias?
|
/** All these variavles should be explained. Matthias?
|
||||||
*/
|
*/
|
||||||
struct LyXCursor {
|
struct LyXCursor {
|
||||||
///
|
///
|
||||||
LyXParagraph *par;
|
LyXParagraph * par;
|
||||||
|
#ifdef NEW_TEXT
|
||||||
|
///
|
||||||
|
LyXParagraph::size_type pos;
|
||||||
|
#else
|
||||||
///
|
///
|
||||||
int pos;
|
int pos;
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
int x;
|
int x;
|
||||||
///
|
///
|
||||||
@ -27,7 +34,7 @@ struct LyXCursor {
|
|||||||
///
|
///
|
||||||
long y;
|
long y;
|
||||||
///
|
///
|
||||||
Row *row;
|
Row * row;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -837,9 +837,9 @@ int LyXFont::ascent(char c) const
|
|||||||
{
|
{
|
||||||
XFontStruct *finfo = getXFontstruct();
|
XFontStruct *finfo = getXFontstruct();
|
||||||
if (finfo->per_char
|
if (finfo->per_char
|
||||||
&& (unsigned int) c >= finfo->min_char_or_byte2
|
&& c >= static_cast<char>(finfo->min_char_or_byte2)
|
||||||
&& (unsigned int) c <= finfo->max_char_or_byte2) {
|
&& c <= static_cast<char>(finfo->max_char_or_byte2)) {
|
||||||
unsigned int index = (unsigned int) c - finfo->min_char_or_byte2;
|
unsigned int index = c - finfo->min_char_or_byte2;
|
||||||
return finfo->per_char[index].ascent;
|
return finfo->per_char[index].ascent;
|
||||||
} else
|
} else
|
||||||
return finfo->ascent;
|
return finfo->ascent;
|
||||||
@ -850,9 +850,9 @@ int LyXFont::descent(char c) const
|
|||||||
{
|
{
|
||||||
XFontStruct *finfo = getXFontstruct();
|
XFontStruct *finfo = getXFontstruct();
|
||||||
if (finfo->per_char
|
if (finfo->per_char
|
||||||
&& (unsigned int) c >= finfo->min_char_or_byte2
|
&& c >= static_cast<char>(finfo->min_char_or_byte2)
|
||||||
&& (unsigned int) c <= finfo->max_char_or_byte2) {
|
&& c <= static_cast<char>(finfo->max_char_or_byte2)) {
|
||||||
unsigned int index = (unsigned int) c - finfo->min_char_or_byte2;
|
unsigned int index = c - finfo->min_char_or_byte2;
|
||||||
return finfo->per_char[index].descent;
|
return finfo->per_char[index].descent;
|
||||||
} else
|
} else
|
||||||
return finfo->descent;
|
return finfo->descent;
|
||||||
@ -884,8 +884,8 @@ int LyXFont::textWidth(char const *s, int n) const
|
|||||||
smallfont.setShape(LyXFont::UP_SHAPE);
|
smallfont.setShape(LyXFont::UP_SHAPE);
|
||||||
for (int i=0; i < n; i++){
|
for (int i=0; i < n; i++){
|
||||||
c = s[i];
|
c = s[i];
|
||||||
if (islower((unsigned char) c)){
|
if (islower(c)){
|
||||||
c = toupper( (unsigned char) c );
|
c = toupper(c);
|
||||||
result += XTextWidth(smallfont.getXFontstruct(), &c, 1);
|
result += XTextWidth(smallfont.getXFontstruct(), &c, 1);
|
||||||
} else {
|
} else {
|
||||||
result += XTextWidth(getXFontstruct(), &c, 1);
|
result += XTextWidth(getXFontstruct(), &c, 1);
|
||||||
@ -935,8 +935,8 @@ int LyXFont::drawText(char const* s, int n, Pixmap pm,
|
|||||||
smallfont.setShape(LyXFont::UP_SHAPE);
|
smallfont.setShape(LyXFont::UP_SHAPE);
|
||||||
for (i=0; i < n; i++){
|
for (i=0; i < n; i++){
|
||||||
c = s[i];
|
c = s[i];
|
||||||
if (islower((unsigned char) c)){
|
if (islower(c)){
|
||||||
c = toupper((unsigned char) c);
|
c = toupper(c);
|
||||||
XDrawString(fl_display,
|
XDrawString(fl_display,
|
||||||
pm,
|
pm,
|
||||||
smallfont.getGC(),
|
smallfont.getGC(),
|
||||||
|
75
src/lyxfr1.C
75
src/lyxfr1.C
@ -67,30 +67,34 @@ bool IsLetterCharOrDigit(char ch)
|
|||||||
|
|
||||||
// Returns the current selection. If nothing is selected or if the selection
|
// Returns the current selection. If nothing is selected or if the selection
|
||||||
// spans 2 paragraphs, an empty string is returned.
|
// spans 2 paragraphs, an empty string is returned.
|
||||||
string const GetCurrentSelectionAsString(LyXText *lt)
|
string const GetCurrentSelectionAsString(LyXText * lt)
|
||||||
{
|
{
|
||||||
LyXParagraph *par;
|
|
||||||
int pos;
|
|
||||||
int endpos;
|
|
||||||
int i;
|
|
||||||
char sz[LYXSEARCH_MAXLEN];
|
char sz[LYXSEARCH_MAXLEN];
|
||||||
char ch;
|
|
||||||
bool fPrevIsSpace;
|
|
||||||
|
|
||||||
sz[0] = 0;
|
sz[0] = 0;
|
||||||
par = lt->cursor.par;
|
LyXParagraph * par = lt->cursor.par;
|
||||||
if (lt->selection && (lt->sel_cursor.par == par)) {
|
if (lt->selection && (lt->sel_cursor.par == par)) {
|
||||||
// (selected) and (begin/end in same paragraph)
|
// (selected) and (begin/end in same paragraph)
|
||||||
pos = lt->sel_start_cursor.pos;
|
#ifdef NEW_TEXT
|
||||||
endpos = lt->sel_end_cursor.pos;
|
LyXParagraph::size_type pos =
|
||||||
i = 0;
|
lt->sel_start_cursor.pos;
|
||||||
fPrevIsSpace = false;
|
LyXParagraph::size_type endpos =
|
||||||
|
lt->sel_end_cursor.pos;
|
||||||
|
#else
|
||||||
|
int pos =
|
||||||
|
lt->sel_start_cursor.pos;
|
||||||
|
int endpos =
|
||||||
|
lt->sel_end_cursor.pos;
|
||||||
|
#endif
|
||||||
|
int i = 0;
|
||||||
|
bool fPrevIsSpace = false;
|
||||||
|
char ch;
|
||||||
while ((i < LYXSEARCH_MAXLEN-2) &&
|
while ((i < LYXSEARCH_MAXLEN-2) &&
|
||||||
(pos < par->Last()) && (pos < endpos)) {
|
(pos < par->Last()) && (pos < endpos)) {
|
||||||
ch = par->GetChar(pos);
|
ch = par->GetChar(pos);
|
||||||
|
|
||||||
//HB??: Maybe (ch <= ' ')
|
//HB??: Maybe (ch <= ' ')
|
||||||
if ((ch == ' ') || ((unsigned char)ch <= LYX_META_INSET)) {
|
if ((ch == ' ') || (ch <= LYX_META_INSET)) {
|
||||||
// consecutive spaces --> 1 space char
|
// consecutive spaces --> 1 space char
|
||||||
if (fPrevIsSpace) {
|
if (fPrevIsSpace) {
|
||||||
pos++; // Next text pos
|
pos++; // Next text pos
|
||||||
@ -293,13 +297,14 @@ bool LyXFindReplace1::SearchCB(bool fForward)
|
|||||||
// if the string can be found: return true and set the cursor to
|
// if the string can be found: return true and set the cursor to
|
||||||
// the new position
|
// the new position
|
||||||
// (was: LyXText::SearchForward(char const* string) in text2.C )
|
// (was: LyXText::SearchForward(char const* string) in text2.C )
|
||||||
bool LyXFindReplace1::SearchForward(LyXText *lt)
|
bool LyXFindReplace1::SearchForward(LyXText * lt)
|
||||||
{
|
{
|
||||||
LyXParagraph *par;
|
LyXParagraph * par = lt->cursor.par;
|
||||||
int pos;
|
#ifdef NEW_TEXT
|
||||||
|
LyXParagraph::size_type pos = lt->cursor.pos;
|
||||||
par = lt->cursor.par;
|
#else
|
||||||
pos = lt->cursor.pos;
|
int pos = lt->cursor.pos;
|
||||||
|
#endif
|
||||||
|
|
||||||
while (par && !IsSearchStringInText(par,pos)) {
|
while (par && !IsSearchStringInText(par,pos)) {
|
||||||
if (pos<par->Last()-1)
|
if (pos<par->Last()-1)
|
||||||
@ -356,48 +361,46 @@ int LyXFindReplace1::CompareChars(char chSearch, char chText)
|
|||||||
{
|
{
|
||||||
if (CaseSensitive())
|
if (CaseSensitive())
|
||||||
return (chSearch - chText);
|
return (chSearch - chText);
|
||||||
return (toupper((unsigned char) chSearch) - toupper((unsigned char) chText));
|
return (toupper(chSearch) - toupper(chText));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// returns true if the search string is at the specified position
|
// returns true if the search string is at the specified position
|
||||||
// (Copied from the original "LyXText::IsStringInText" in text2.C )
|
// (Copied from the original "LyXText::IsStringInText" in text2.C )
|
||||||
bool LyXFindReplace1::IsSearchStringInText(LyXParagraph *par, int pos)
|
#ifdef NEW_TEXT
|
||||||
|
bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos)
|
||||||
|
#else
|
||||||
|
bool LyXFindReplace1::IsSearchStringInText(LyXParagraph * par,
|
||||||
|
int pos)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
char chSrch = 0;
|
char chSrch = 0;
|
||||||
char chText;
|
char chText;
|
||||||
bool fPrevIsSpace;
|
|
||||||
int iText;
|
|
||||||
string::size_type iSrch;
|
|
||||||
|
|
||||||
if (!par)
|
if (!par)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
fPrevIsSpace = false;
|
bool fPrevIsSpace = false;
|
||||||
iText = 0; iSrch = 0;
|
int iText = 0;
|
||||||
while (pos+iText < par->Last() &&
|
string::size_type iSrch = 0;
|
||||||
|
while (pos + iText < par->Last() &&
|
||||||
iSrch < SearchString().length()) {
|
iSrch < SearchString().length()) {
|
||||||
chSrch = SearchString()[iSrch];
|
chSrch = SearchString()[iSrch];
|
||||||
chText = par->GetChar(pos+iText);
|
chText = par->GetChar(pos+iText);
|
||||||
// Why was this code there ??? Insets are *not* spaces!
|
|
||||||
// It seems that there is some code here to handle multiple spaces. I
|
|
||||||
// wonder why this is useful... (JMarc)
|
|
||||||
// if ((chText == ' ') ||
|
|
||||||
// ((unsigned char)chText <= LYX_META_INSET))
|
|
||||||
if (chText == ' ') {
|
if (chText == ' ') {
|
||||||
if (fPrevIsSpace) {
|
if (fPrevIsSpace) {
|
||||||
iText++; // next Text pos
|
iText++; // next Text pos
|
||||||
continue; // same search pos
|
continue; // same search pos
|
||||||
}
|
}
|
||||||
// chText = ' ';
|
|
||||||
fPrevIsSpace = true;
|
fPrevIsSpace = true;
|
||||||
} else
|
} else
|
||||||
fPrevIsSpace = false;
|
fPrevIsSpace = false;
|
||||||
if (CompareChars(chSrch, chText) != 0)
|
if (CompareChars(chSrch, chText) != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
iSrch++;
|
++iSrch;
|
||||||
iText++;
|
++iText;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (iSrch < SearchString().length())
|
if (iSrch < SearchString().length())
|
||||||
@ -405,7 +408,7 @@ bool LyXFindReplace1::IsSearchStringInText(LyXParagraph *par, int pos)
|
|||||||
|
|
||||||
if (!MatchWord()
|
if (!MatchWord()
|
||||||
|| ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos-1)))
|
|| ((pos <= 0 || !IsLetterCharOrDigit(par->GetChar(pos-1)))
|
||||||
&& (pos+iText >= par->Last()
|
&& (pos + iText >= par->Last()
|
||||||
|| !IsLetterCharOrDigit(par->GetChar(pos + iText))))) {
|
|| !IsLetterCharOrDigit(par->GetChar(pos + iText))))) {
|
||||||
iLenSelected = iText;
|
iLenSelected = iText;
|
||||||
return true;
|
return true;
|
||||||
|
11
src/lyxfr1.h
11
src/lyxfr1.h
@ -7,8 +7,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include FORMS_H_LOCATION
|
#include FORMS_H_LOCATION
|
||||||
|
#include "lyxparagraph.h"
|
||||||
|
|
||||||
class LyXText;
|
class LyXText;
|
||||||
class LyXParagraph;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
LyXFindReplace1"
|
LyXFindReplace1"
|
||||||
@ -53,8 +54,12 @@ protected:
|
|||||||
\end{itemize}
|
\end{itemize}
|
||||||
*/
|
*/
|
||||||
int CompareChars(char chSearch, char chText);
|
int CompareChars(char chSearch, char chText);
|
||||||
|
#ifdef NEW_TEXT
|
||||||
/// returns true if the specified string is at the specified position
|
/// returns true if the specified string is at the specified position
|
||||||
bool IsSearchStringInText(LyXParagraph *par, int pos);
|
bool IsSearchStringInText(LyXParagraph * par, LyXParagraph::size_type pos);
|
||||||
|
#else
|
||||||
|
/// returns true if the specified string is at the specified position
|
||||||
|
bool IsSearchStringInText(LyXParagraph * par, int pos);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
#include "lyx_gui_misc.h"
|
#include "lyx_gui_misc.h"
|
||||||
#include "support/filetools.h"
|
#include "support/filetools.h"
|
||||||
#include "support/FileInfo.h"
|
#include "support/FileInfo.h"
|
||||||
|
#include "support/LAssert.h"
|
||||||
#include "lyxscreen.h"
|
#include "lyxscreen.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
@ -61,6 +62,7 @@
|
|||||||
#include "support/syscall.h"
|
#include "support/syscall.h"
|
||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
#include "support/path.h"
|
#include "support/path.h"
|
||||||
|
#include "layout.h"
|
||||||
|
|
||||||
extern bool cursor_follows_scrollbar;
|
extern bool cursor_follows_scrollbar;
|
||||||
|
|
||||||
@ -68,12 +70,12 @@ extern void InsertAsciiFile(string const &, bool);
|
|||||||
extern void math_insert_symbol(char const*);
|
extern void math_insert_symbol(char const*);
|
||||||
extern Bool math_insert_greek(char const); // why "Bool"?
|
extern Bool math_insert_greek(char const); // why "Bool"?
|
||||||
extern BufferList bufferlist;
|
extern BufferList bufferlist;
|
||||||
extern LyXServer *lyxserver;
|
extern LyXServer * lyxserver;
|
||||||
extern short greek_kb_flag;
|
extern short greek_kb_flag;
|
||||||
extern FD_form_toc *fd_form_toc;
|
extern FD_form_toc * fd_form_toc;
|
||||||
extern bool selection_possible;
|
extern bool selection_possible;
|
||||||
|
|
||||||
extern kb_keymap *toplevel_keymap;
|
extern kb_keymap * toplevel_keymap;
|
||||||
|
|
||||||
extern void BeforeChange();
|
extern void BeforeChange();
|
||||||
extern void MenuWrite(Buffer*);
|
extern void MenuWrite(Buffer*);
|
||||||
@ -1074,7 +1076,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
|
|
||||||
// Pretend we got the name instead.
|
// Pretend we got the name instead.
|
||||||
Dispatch(int(LFUN_LAYOUT),
|
Dispatch(int(LFUN_LAYOUT),
|
||||||
lyxstyle.NameOfLayout(owner->currentBuffer()->
|
textclasslist.NameOfLayout(owner->currentBuffer()->
|
||||||
text->parameters->
|
text->parameters->
|
||||||
textclass,
|
textclass,
|
||||||
sel).c_str());
|
sel).c_str());
|
||||||
@ -1090,11 +1092,11 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
// and current buffer's textclass (number). */
|
// and current buffer's textclass (number). */
|
||||||
int layoutno = -1;
|
int layoutno = -1;
|
||||||
layoutno =
|
layoutno =
|
||||||
lyxstyle.NumberOfLayout(owner->
|
textclasslist.NumberOfLayout(owner->
|
||||||
currentBuffer()->
|
currentBuffer()->
|
||||||
text->parameters->
|
text->parameters->
|
||||||
textclass,
|
textclass,
|
||||||
argument);
|
argument).second;
|
||||||
|
|
||||||
// see if we found the layout number:
|
// see if we found the layout number:
|
||||||
if (layoutno == -1) {
|
if (layoutno == -1) {
|
||||||
@ -1201,7 +1203,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
case LFUN_UPCASE_WORD:
|
case LFUN_UPCASE_WORD:
|
||||||
owner->currentBuffer()->update(-2);
|
owner->currentBuffer()->update(-2);
|
||||||
FreeUpdateTimer();
|
FreeUpdateTimer();
|
||||||
owner->currentBuffer()->text->ChangeWordCase(2);
|
owner->currentBuffer()->text->ChangeWordCase(LyXText::text_uppercase);
|
||||||
owner->currentBuffer()->update(1);
|
owner->currentBuffer()->update(1);
|
||||||
SetUpdateTimer();
|
SetUpdateTimer();
|
||||||
break;
|
break;
|
||||||
@ -1209,7 +1211,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
case LFUN_LOWCASE_WORD:
|
case LFUN_LOWCASE_WORD:
|
||||||
owner->currentBuffer()->update(-2);
|
owner->currentBuffer()->update(-2);
|
||||||
FreeUpdateTimer();
|
FreeUpdateTimer();
|
||||||
owner->currentBuffer()->text->ChangeWordCase(0);
|
owner->currentBuffer()->text->ChangeWordCase(LyXText::text_lowercase);
|
||||||
owner->currentBuffer()->update(1);
|
owner->currentBuffer()->update(1);
|
||||||
SetUpdateTimer();
|
SetUpdateTimer();
|
||||||
break;
|
break;
|
||||||
@ -1217,7 +1219,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
case LFUN_CAPITALIZE_WORD:
|
case LFUN_CAPITALIZE_WORD:
|
||||||
owner->currentBuffer()->update(-2);
|
owner->currentBuffer()->update(-2);
|
||||||
FreeUpdateTimer();
|
FreeUpdateTimer();
|
||||||
owner->currentBuffer()->text->ChangeWordCase(1);
|
owner->currentBuffer()->text->ChangeWordCase(LyXText::text_capitalization);
|
||||||
owner->currentBuffer()->update(1);
|
owner->currentBuffer()->update(1);
|
||||||
SetUpdateTimer();
|
SetUpdateTimer();
|
||||||
break;
|
break;
|
||||||
@ -1845,8 +1847,14 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
|
|
||||||
case LFUN_CHARATCURSOR:
|
case LFUN_CHARATCURSOR:
|
||||||
{
|
{
|
||||||
|
#ifdef NEW_TEXT
|
||||||
|
LyXParagraph::size_type pos =
|
||||||
|
owner->currentBuffer()->text->cursor.pos;
|
||||||
|
if(pos < owner->currentBuffer()->text->cursor.par->size())
|
||||||
|
#else
|
||||||
int pos = owner->currentBuffer()->text->cursor.pos;
|
int pos = owner->currentBuffer()->text->cursor.pos;
|
||||||
if(pos < owner->currentBuffer()->text->cursor.par->last)
|
if(pos < owner->currentBuffer()->text->cursor.par->last)
|
||||||
|
#endif
|
||||||
dispatch_buffer = owner->currentBuffer()->text->
|
dispatch_buffer = owner->currentBuffer()->text->
|
||||||
cursor.par->text[pos];
|
cursor.par->text[pos];
|
||||||
else
|
else
|
||||||
@ -2205,7 +2213,7 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
case LFUN_INDEX_INSERT:
|
case LFUN_INDEX_INSERT:
|
||||||
case LFUN_INDEX_INSERT_LAST:
|
case LFUN_INDEX_INSERT_LAST:
|
||||||
{
|
{
|
||||||
InsetIndex *new_inset = new InsetIndex();
|
InsetIndex * new_inset = new InsetIndex();
|
||||||
if (!argument.empty()) {
|
if (!argument.empty()) {
|
||||||
string lsarg(argument);
|
string lsarg(argument);
|
||||||
new_inset->setContents(lsarg);
|
new_inset->setContents(lsarg);
|
||||||
@ -2217,19 +2225,25 @@ string LyXFunc::Dispatch(int ac,
|
|||||||
|
|
||||||
// grab a word
|
// grab a word
|
||||||
|
|
||||||
int lastpos =owner->currentBuffer()->text->cursor.pos-1;
|
#ifdef NEW_TEXT
|
||||||
|
LyXParagraph::size_type lastpos =
|
||||||
|
owner->currentBuffer()->text->cursor.pos - 1;
|
||||||
|
// If this can't happen, let's make sure that it really don't
|
||||||
|
Assert(owner->currentBuffer()->text->cursor.pos - 1 >= 0);
|
||||||
|
#else
|
||||||
|
int lastpos =owner->currentBuffer()->text->cursor.pos - 1;
|
||||||
//this shouldn't happen, but let's be careful
|
//this shouldn't happen, but let's be careful
|
||||||
if (lastpos < 0) lastpos=0;
|
if (lastpos < 0) lastpos=0;
|
||||||
|
#endif
|
||||||
// get the current word
|
// get the current word
|
||||||
// note that this must be done before
|
// note that this must be done before
|
||||||
// inserting the inset, or the inset will break
|
// inserting the inset, or the inset will break
|
||||||
// the word
|
// the word
|
||||||
string curstring(owner->currentBuffer()->text->cursor.par->GetWord(lastpos));
|
string curstring(owner->currentBuffer()
|
||||||
|
->text->cursor.par->GetWord(lastpos));
|
||||||
|
|
||||||
//make the new inset and write the current word into it
|
//make the new inset and write the current word into it
|
||||||
InsetIndex *new_inset = new InsetIndex();
|
InsetIndex * new_inset = new InsetIndex();
|
||||||
|
|
||||||
new_inset->setContents(curstring);
|
new_inset->setContents(curstring);
|
||||||
|
|
||||||
@ -2825,13 +2839,17 @@ void LyXFunc::CloseBuffer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Inset* LyXFunc::getInsetByCode(Inset::Code code)
|
Inset * LyXFunc::getInsetByCode(Inset::Code code)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
Inset* inset = 0;
|
Inset * inset = 0;
|
||||||
LyXCursor cursor = owner->currentBuffer()->text->cursor;
|
LyXCursor cursor = owner->currentBuffer()->text->cursor;
|
||||||
|
#ifdef NEW_TEXT
|
||||||
|
LyXParagraph::size_type pos = cursor.pos;
|
||||||
|
#else
|
||||||
int pos = cursor.pos;
|
int pos = cursor.pos;
|
||||||
LyXParagraph *par = cursor.par;
|
#endif
|
||||||
|
LyXParagraph * par = cursor.par;
|
||||||
|
|
||||||
while (par && !found) {
|
while (par && !found) {
|
||||||
while ((inset = par->ReturnNextInsetPointer(pos))){
|
while ((inset = par->ReturnNextInsetPointer(pos))){
|
||||||
|
@ -4,10 +4,10 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright (C) 1995-1999 The LyX Team.
|
* Copyright 1995-1999 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef LYXPARAGRAPH_H
|
#ifndef LYXPARAGRAPH_H
|
||||||
#define LYXPARAGRAPH_H
|
#define LYXPARAGRAPH_H
|
||||||
@ -16,23 +16,34 @@
|
|||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define NEW_TEXT 1
|
||||||
|
#define NEW_TABLE 1
|
||||||
|
|
||||||
|
#ifdef NEW_TABLE
|
||||||
|
#include <list>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NEW_TEXT
|
||||||
|
//#include <vector>
|
||||||
|
#include <deque>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
#include "insets/lyxinset.h"
|
#include "insets/lyxinset.h"
|
||||||
#include "table.h"
|
#include "table.h"
|
||||||
#include "support/textutils.h"
|
#include "support/textutils.h"
|
||||||
#include "vspace.h"
|
#include "vspace.h"
|
||||||
#include "insets/insetbib.h"
|
#include "insets/insetbib.h"
|
||||||
|
#include "layout.h"
|
||||||
|
|
||||||
class BufferParams;
|
class BufferParams;
|
||||||
class LyXBuffer;
|
class LyXBuffer;
|
||||||
class LyXLayout;
|
|
||||||
class TexRow;
|
class TexRow;
|
||||||
struct LaTeXFeatures;
|
struct LaTeXFeatures;
|
||||||
|
|
||||||
/// A LyXParagraph holds all text, attributes and insets in a text paragraph
|
/// A LyXParagraph holds all text, attributes and insets in a text paragraph
|
||||||
class LyXParagraph {
|
class LyXParagraph {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// The footnoteflag
|
/// The footnoteflag
|
||||||
enum footnote_flag {
|
enum footnote_flag {
|
||||||
///
|
///
|
||||||
@ -64,18 +75,15 @@ public:
|
|||||||
///
|
///
|
||||||
LyXParagraph();
|
LyXParagraph();
|
||||||
/// this konstruktor inserts the new paragraph in a list
|
/// this konstruktor inserts the new paragraph in a list
|
||||||
LyXParagraph(LyXParagraph *par);
|
LyXParagraph(LyXParagraph * par);
|
||||||
/// the destruktors removes the new paragraph from the list
|
/// the destruktors removes the new paragraph from the list
|
||||||
~LyXParagraph();
|
~LyXParagraph();
|
||||||
|
|
||||||
///
|
///
|
||||||
void writeFile(FILE*, BufferParams &, char, char);
|
void writeFile(FILE *, BufferParams &, char, char);
|
||||||
|
|
||||||
// ///
|
|
||||||
//void writeLaTeX(FILE*, BufferParams &);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
void validate(LaTeXFeatures&);
|
void validate(LaTeXFeatures &);
|
||||||
|
|
||||||
///
|
///
|
||||||
int GetID(){
|
int GetID(){
|
||||||
@ -86,16 +94,17 @@ public:
|
|||||||
id = id_arg;
|
id = id_arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NEW_TEXT
|
||||||
/** allocates more memory for the specified paragraph
|
/** allocates more memory for the specified paragraph
|
||||||
pos is needed to specify the paragraph correctly. Remember the
|
pos is needed to specify the paragraph correctly. Remember the
|
||||||
closed footnotes
|
closed footnotes
|
||||||
*/
|
*/
|
||||||
void Enlarge(int pos, int number);
|
void Enlarge(int pos, int number);
|
||||||
|
|
||||||
/** make the allocated memory fit to the needed size
|
/** make the allocated memory fit to the needed size
|
||||||
used to make a paragraph smaller
|
used to make a paragraph smaller
|
||||||
*/
|
*/
|
||||||
void FitSize();
|
void FitSize();
|
||||||
|
#endif
|
||||||
|
|
||||||
///
|
///
|
||||||
void read();
|
void read();
|
||||||
@ -104,38 +113,49 @@ public:
|
|||||||
void readSimpleWholeFile(FILE *);
|
void readSimpleWholeFile(FILE *);
|
||||||
|
|
||||||
///
|
///
|
||||||
LyXParagraph* TeXOnePar(string &file, TexRow &texrow,
|
LyXParagraph * TeXOnePar(string & file, TexRow & texrow,
|
||||||
string &foot, TexRow &foot_texrow,
|
string & foot, TexRow & foot_texrow,
|
||||||
int &foot_count);
|
int & foot_count);
|
||||||
|
|
||||||
///
|
///
|
||||||
LyXParagraph* TeXEnvironment(string &file, TexRow &texrow,
|
LyXParagraph * TeXEnvironment(string & file, TexRow & texrow,
|
||||||
string &foot, TexRow &foot_texrow,
|
string & foot, TexRow & foot_texrow,
|
||||||
int &foot_count);
|
int & foot_count);
|
||||||
|
|
||||||
///
|
///
|
||||||
LyXParagraph* Clone();
|
LyXParagraph * Clone();
|
||||||
|
|
||||||
///
|
///
|
||||||
bool HasSameLayout(LyXParagraph *par);
|
bool HasSameLayout(LyXParagraph * par);
|
||||||
|
|
||||||
///
|
///
|
||||||
void MakeSameLayout(LyXParagraph *par);
|
void MakeSameLayout(LyXParagraph * par);
|
||||||
|
|
||||||
/// Is it the first par with same depth and layout?
|
/// Is it the first par with same depth and layout?
|
||||||
bool IsFirstInSequence() {
|
bool IsFirstInSequence() {
|
||||||
LyXParagraph *dhook = DepthHook(GetDepth());
|
LyXParagraph * dhook = DepthHook(GetDepth());
|
||||||
return (dhook == this
|
return (dhook == this
|
||||||
|| dhook->GetLayout() != GetLayout()
|
|| dhook->GetLayout() != GetLayout()
|
||||||
|| dhook->GetDepth() != GetDepth());
|
|| dhook->GetDepth() != GetDepth());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef NEW_TEXT
|
||||||
|
///
|
||||||
|
typedef deque<char> TextContainer;
|
||||||
|
typedef int size_type;
|
||||||
|
///
|
||||||
|
TextContainer text;
|
||||||
|
///
|
||||||
|
size_type size() const { return text.size(); }
|
||||||
|
#else
|
||||||
|
///
|
||||||
|
int last;
|
||||||
///
|
///
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
///
|
///
|
||||||
char *text;
|
char * text;
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
VSpace added_space_top;
|
VSpace added_space_top;
|
||||||
|
|
||||||
@ -143,7 +163,7 @@ public:
|
|||||||
VSpace added_space_bottom;
|
VSpace added_space_bottom;
|
||||||
|
|
||||||
///
|
///
|
||||||
signed char layout;
|
LyXTextClass::LayoutList::size_type layout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\begin{itemize}
|
\begin{itemize}
|
||||||
@ -172,7 +192,7 @@ public:
|
|||||||
bool pagebreak_bottom;
|
bool pagebreak_bottom;
|
||||||
|
|
||||||
///
|
///
|
||||||
char align;
|
LyXAlignment align;
|
||||||
|
|
||||||
///
|
///
|
||||||
char depth;
|
char depth;
|
||||||
@ -222,44 +242,49 @@ public:
|
|||||||
//@}
|
//@}
|
||||||
|
|
||||||
///
|
///
|
||||||
int last;
|
LyXParagraph * next;
|
||||||
///
|
///
|
||||||
LyXParagraph *next;
|
LyXParagraph * previous;
|
||||||
///
|
|
||||||
LyXParagraph *previous;
|
|
||||||
|
|
||||||
/* table stuff -- begin*/
|
/* table stuff -- begin*/
|
||||||
///
|
///
|
||||||
LyXTable *table;
|
LyXTable * table;
|
||||||
/* table stuff -- end*/
|
/* table stuff -- end*/
|
||||||
|
|
||||||
///
|
///
|
||||||
InsetBibKey* bibkey; // ale970302
|
InsetBibKey * bibkey; // ale970302
|
||||||
|
|
||||||
/** these function are able to hide closed footnotes
|
/** these function are able to hide closed footnotes
|
||||||
*/
|
*/
|
||||||
LyXParagraph *Next();
|
LyXParagraph * Next();
|
||||||
|
|
||||||
///
|
///
|
||||||
LyXParagraph *Previous();
|
LyXParagraph * Previous();
|
||||||
|
|
||||||
/** these function are able to hide open and closed footnotes
|
/** these function are able to hide open and closed footnotes
|
||||||
*/
|
*/
|
||||||
LyXParagraph *NextAfterFootnote();
|
LyXParagraph * NextAfterFootnote();
|
||||||
///
|
///
|
||||||
LyXParagraph *PreviousBeforeFootnote();
|
LyXParagraph * PreviousBeforeFootnote();
|
||||||
///
|
///
|
||||||
LyXParagraph *LastPhysicalPar();
|
LyXParagraph * LastPhysicalPar();
|
||||||
///
|
///
|
||||||
LyXParagraph *FirstPhysicalPar();
|
LyXParagraph * FirstPhysicalPar();
|
||||||
|
|
||||||
|
#ifdef NEW_TEXT
|
||||||
/// returns the physical paragraph
|
/// returns the physical paragraph
|
||||||
LyXParagraph *ParFromPos(int pos);
|
LyXParagraph * ParFromPos(size_type pos);
|
||||||
|
/// returns the position in the physical par
|
||||||
|
int PositionInParFromPos(size_type pos);
|
||||||
|
#else
|
||||||
|
/// returns the physical paragraph
|
||||||
|
LyXParagraph * ParFromPos(int pos);
|
||||||
/// returns the position in the physical par
|
/// returns the position in the physical par
|
||||||
int PositionInParFromPos(int pos);
|
int PositionInParFromPos(int pos);
|
||||||
|
#endif
|
||||||
|
|
||||||
/// for the environments
|
/// for the environments
|
||||||
LyXParagraph* DepthHook(int depth);
|
LyXParagraph * DepthHook(int depth);
|
||||||
///
|
///
|
||||||
int BeginningOfMainBody();
|
int BeginningOfMainBody();
|
||||||
///
|
///
|
||||||
@ -268,46 +293,128 @@ public:
|
|||||||
/// the next two functions are for the manual labels
|
/// the next two functions are for the manual labels
|
||||||
string GetLabelWidthString();
|
string GetLabelWidthString();
|
||||||
///
|
///
|
||||||
void SetLabelWidthString(const string &s);
|
void SetLabelWidthString(string const & s);
|
||||||
///
|
///
|
||||||
int GetLayout();
|
LyXTextClass::LayoutList::size_type GetLayout();
|
||||||
///
|
///
|
||||||
char GetAlign();
|
char GetAlign();
|
||||||
///
|
///
|
||||||
char GetDepth();
|
char GetDepth();
|
||||||
///
|
///
|
||||||
void SetLayout(char new_layout);
|
void SetLayout(LyXTextClass::LayoutList::size_type new_layout);
|
||||||
///
|
///
|
||||||
void SetOnlyLayout(char new_layout);
|
void SetOnlyLayout(LyXTextClass::LayoutList::size_type new_layout);
|
||||||
///
|
///
|
||||||
int GetFirstCounter(int i);
|
int GetFirstCounter(int i);
|
||||||
|
#ifdef NEW_TEXT
|
||||||
|
///
|
||||||
|
size_type Last();
|
||||||
|
///
|
||||||
|
void Erase(size_type pos);
|
||||||
|
/** the flag determines wether the layout should be copied
|
||||||
|
*/
|
||||||
|
void BreakParagraph(size_type pos, int flag);
|
||||||
|
///
|
||||||
|
void BreakParagraphConservative(size_type pos);
|
||||||
|
/** Get unistantiated font setting. Returns the difference
|
||||||
|
between the characters font and the layoutfont.
|
||||||
|
This is what is stored in the fonttable
|
||||||
|
*/
|
||||||
|
LyXFont GetFontSettings(size_type pos);
|
||||||
|
/** Get fully instantiated font. If pos == -1, use the layout
|
||||||
|
font attached to this paragraph.
|
||||||
|
If pos == -2, use the label font of the layout attached here.
|
||||||
|
In all cases, the font is instantiated, i.e. does not have any
|
||||||
|
attributes with values LyXFont::INHERIT, LyXFont::IGNORE or
|
||||||
|
LyXFont::TOGGLE.
|
||||||
|
*/
|
||||||
|
LyXFont getFont(size_type pos);
|
||||||
|
///
|
||||||
|
char GetChar(size_type pos);
|
||||||
|
///
|
||||||
|
void SetFont(size_type pos, LyXFont const & font);
|
||||||
|
///
|
||||||
|
string GetWord(size_type &);
|
||||||
|
/// Returns the height of the highest font in range
|
||||||
|
LyXFont::FONT_SIZE HighestFontInRange(size_type startpos, size_type endpos) const;
|
||||||
|
///
|
||||||
|
void InsertChar(size_type pos, char c);
|
||||||
|
///
|
||||||
|
void InsertInset(size_type pos, Inset * inset);
|
||||||
|
///
|
||||||
|
Inset * GetInset(size_type pos);
|
||||||
|
///
|
||||||
|
Inset * ReturnNextInsetPointer(size_type & pos);
|
||||||
|
///
|
||||||
|
void OpenFootnote(size_type pos);
|
||||||
|
///
|
||||||
|
void CloseFootnote(size_type pos);
|
||||||
|
/// important for cut and paste
|
||||||
|
void CopyIntoMinibuffer(size_type pos);
|
||||||
|
///
|
||||||
|
void CutIntoMinibuffer(size_type pos);
|
||||||
|
///
|
||||||
|
void InsertFromMinibuffer(size_type pos);
|
||||||
|
///
|
||||||
|
bool IsHfill(size_type pos) {
|
||||||
|
return IsHfillChar(GetChar(pos));
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
bool IsInset(size_type pos) {
|
||||||
|
return IsInsetChar(GetChar(pos));
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
bool IsFloat(size_type pos) {
|
||||||
|
return IsFloatChar(GetChar(pos));
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
bool IsNewline(size_type pos) {
|
||||||
|
bool tmp = false;
|
||||||
|
if (pos >= 0)
|
||||||
|
tmp= IsNewlineChar(GetChar(pos));
|
||||||
|
return tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
bool IsSeparator(size_type pos) {
|
||||||
|
return IsSeparatorChar(GetChar(pos));
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
bool IsLineSeparator(size_type pos) {
|
||||||
|
return IsLineSeparatorChar(GetChar(pos));
|
||||||
|
}
|
||||||
|
|
||||||
|
///
|
||||||
|
bool IsKomma(size_type pos){
|
||||||
|
return IsKommaChar(GetChar(pos));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Used by the spellchecker
|
||||||
|
bool IsLetter(size_type pos);
|
||||||
|
|
||||||
|
///
|
||||||
|
bool IsWord(size_type pos ) {
|
||||||
|
return IsWordChar( GetChar(pos) ) ;
|
||||||
|
}
|
||||||
|
#else
|
||||||
///
|
///
|
||||||
int Last();
|
int Last();
|
||||||
|
|
||||||
/** This one resets all layout and dtp switches but not the font
|
|
||||||
of the single characters
|
|
||||||
*/
|
|
||||||
void Clear();
|
|
||||||
///
|
///
|
||||||
void Erase(int pos);
|
void Erase(int pos);
|
||||||
|
|
||||||
/** the flag determines wether the layout should be copied
|
/** the flag determines wether the layout should be copied
|
||||||
*/
|
*/
|
||||||
void BreakParagraph(int pos, int flag);
|
void BreakParagraph(int pos, int flag);
|
||||||
///
|
///
|
||||||
void BreakParagraphConservative(int pos);
|
void BreakParagraphConservative(int pos);
|
||||||
|
|
||||||
/** paste this paragraph with the next one
|
|
||||||
be carefull, this doesent make any check at all
|
|
||||||
*/
|
|
||||||
void PasteParagraph();
|
|
||||||
|
|
||||||
/** Get unistantiated font setting. Returns the difference
|
/** Get unistantiated font setting. Returns the difference
|
||||||
between the characters font and the layoutfont.
|
between the characters font and the layoutfont.
|
||||||
This is what is stored in the fonttable
|
This is what is stored in the fonttable
|
||||||
*/
|
*/
|
||||||
LyXFont GetFontSettings(int pos);
|
LyXFont GetFontSettings(int pos);
|
||||||
|
|
||||||
/** Get fully instantiated font. If pos == -1, use the layout
|
/** Get fully instantiated font. If pos == -1, use the layout
|
||||||
font attached to this paragraph.
|
font attached to this paragraph.
|
||||||
If pos == -2, use the label font of the layout attached here.
|
If pos == -2, use the label font of the layout attached here.
|
||||||
@ -316,50 +423,32 @@ public:
|
|||||||
LyXFont::TOGGLE.
|
LyXFont::TOGGLE.
|
||||||
*/
|
*/
|
||||||
LyXFont getFont(int pos);
|
LyXFont getFont(int pos);
|
||||||
|
|
||||||
///
|
///
|
||||||
char GetChar(int pos);
|
char GetChar(int pos);
|
||||||
///
|
///
|
||||||
string GetWord(int &);
|
|
||||||
///
|
|
||||||
void SetFont(int pos, LyXFont const & font);
|
void SetFont(int pos, LyXFont const & font);
|
||||||
|
///
|
||||||
|
string GetWord(int &);
|
||||||
/// Returns the height of the highest font in range
|
/// Returns the height of the highest font in range
|
||||||
LyXFont::FONT_SIZE HighestFontInRange(int startpos, int endpos) const;
|
LyXFont::FONT_SIZE HighestFontInRange(int startpos, int endpos) const;
|
||||||
///
|
///
|
||||||
void InsertChar(int pos, char c);
|
void InsertChar(int pos, char c);
|
||||||
///
|
///
|
||||||
void InsertInset(int pos, Inset *inset);
|
void InsertInset(int pos, Inset * inset);
|
||||||
///
|
///
|
||||||
Inset* GetInset(int pos);
|
Inset * GetInset(int pos);
|
||||||
|
|
||||||
/// used to remove the error messages
|
|
||||||
int AutoDeleteInsets();
|
|
||||||
|
|
||||||
///
|
///
|
||||||
Inset* ReturnNextInsetPointer(int &pos);
|
Inset * ReturnNextInsetPointer(int & pos);
|
||||||
|
|
||||||
/// returns -1 if inset not found
|
|
||||||
int GetPositionOfInset(Inset* inset);
|
|
||||||
|
|
||||||
/// ok and now some footnote functions
|
|
||||||
void OpenFootnotes();
|
|
||||||
///
|
///
|
||||||
void OpenFootnote(int pos);
|
void OpenFootnote(int pos);
|
||||||
///
|
///
|
||||||
void CloseFootnotes();
|
|
||||||
///
|
|
||||||
void CloseFootnote(int pos);
|
void CloseFootnote(int pos);
|
||||||
|
|
||||||
/// important for cut and paste
|
/// important for cut and paste
|
||||||
void CopyIntoMinibuffer(int pos);
|
void CopyIntoMinibuffer(int pos);
|
||||||
///
|
///
|
||||||
void CutIntoMinibuffer(int pos);
|
void CutIntoMinibuffer(int pos);
|
||||||
///
|
///
|
||||||
void InsertFromMinibuffer(int pos);
|
void InsertFromMinibuffer(int pos);
|
||||||
|
|
||||||
///
|
|
||||||
LyXParagraph *FirstSelfrowPar();
|
|
||||||
|
|
||||||
///
|
///
|
||||||
bool IsHfill(int pos) {
|
bool IsHfill(int pos) {
|
||||||
return IsHfillChar(GetChar(pos));
|
return IsHfillChar(GetChar(pos));
|
||||||
@ -377,8 +466,8 @@ public:
|
|||||||
|
|
||||||
///
|
///
|
||||||
bool IsNewline(int pos) {
|
bool IsNewline(int pos) {
|
||||||
bool tmp=false;
|
bool tmp = false;
|
||||||
if (pos>=0)
|
if (pos >= 0)
|
||||||
tmp= IsNewlineChar(GetChar(pos));
|
tmp= IsNewlineChar(GetChar(pos));
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
@ -405,10 +494,35 @@ public:
|
|||||||
bool IsWord( int pos ) {
|
bool IsWord( int pos ) {
|
||||||
return IsWordChar( GetChar(pos) ) ;
|
return IsWordChar( GetChar(pos) ) ;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
/** This one resets all layout and dtp switches but not the font
|
||||||
|
of the single characters
|
||||||
|
*/
|
||||||
|
void Clear();
|
||||||
|
|
||||||
|
/** paste this paragraph with the next one
|
||||||
|
be carefull, this doesent make any check at all
|
||||||
|
*/
|
||||||
|
void PasteParagraph();
|
||||||
|
|
||||||
|
/// used to remove the error messages
|
||||||
|
int AutoDeleteInsets();
|
||||||
|
|
||||||
|
/// returns -1 if inset not found
|
||||||
|
int GetPositionOfInset(Inset * inset);
|
||||||
|
|
||||||
|
/// ok and now some footnote functions
|
||||||
|
void OpenFootnotes();
|
||||||
|
|
||||||
|
///
|
||||||
|
void CloseFootnotes();
|
||||||
|
|
||||||
|
///
|
||||||
|
LyXParagraph * FirstSelfrowPar();
|
||||||
|
|
||||||
///
|
///
|
||||||
int ClearParagraph(){
|
int ClearParagraph(){
|
||||||
int i=0;
|
int i = 0;
|
||||||
if (!IsDummy() && !table){
|
if (!IsDummy() && !table){
|
||||||
while (Last()
|
while (Last()
|
||||||
&& (IsNewline(0)
|
&& (IsNewline(0)
|
||||||
@ -434,19 +548,29 @@ public:
|
|||||||
/* If I set a PExtra Indent on one paragraph of a ENV_LIST-TYPE
|
/* If I set a PExtra Indent on one paragraph of a ENV_LIST-TYPE
|
||||||
I have to set it on each of it's elements */
|
I have to set it on each of it's elements */
|
||||||
///
|
///
|
||||||
void SetPExtraType(int type, const char *width, const char *widthp);
|
void SetPExtraType(int type, char const * width, char const * widthp);
|
||||||
///
|
///
|
||||||
void UnsetPExtraType();
|
void UnsetPExtraType();
|
||||||
|
#ifdef NEW_TEXT
|
||||||
///
|
///
|
||||||
bool RoffContTableRows(FILE *file, int i, int actcell);
|
bool RoffContTableRows(FILE * file, size_type i,
|
||||||
|
int actcell);
|
||||||
///
|
///
|
||||||
bool linuxDocConvertChar(char c, string &sgml_string);
|
void DocBookContTableRows(string & file, string & extra, int & desc_on,
|
||||||
|
size_type i,
|
||||||
|
int current_cell_number, int & column);
|
||||||
|
#else
|
||||||
///
|
///
|
||||||
void SimpleDocBookOneTablePar(string &file, string &extra,
|
bool RoffContTableRows(FILE * file, int i, int actcell);
|
||||||
int &desc_on, int depth);
|
|
||||||
///
|
///
|
||||||
void DocBookContTableRows(string &file, string &extra, int &desc_on,
|
void DocBookContTableRows(string & file, string & extra, int & desc_on,
|
||||||
int i, int current_cell_number, int &column);
|
int i, int current_cell_number, int & column);
|
||||||
|
#endif
|
||||||
|
///
|
||||||
|
bool linuxDocConvertChar(char c, string & sgml_string);
|
||||||
|
///
|
||||||
|
void SimpleDocBookOneTablePar(string & file, string & extra,
|
||||||
|
int & desc_on, int depth);
|
||||||
private:
|
private:
|
||||||
/** A font entry covers a range of positions. Notice that the
|
/** A font entry covers a range of positions. Notice that the
|
||||||
entries in the list are inserted in random order.
|
entries in the list are inserted in random order.
|
||||||
@ -455,11 +579,17 @@ private:
|
|||||||
is limited. (Asger)
|
is limited. (Asger)
|
||||||
*/
|
*/
|
||||||
struct FontTable {
|
struct FontTable {
|
||||||
|
#ifdef NEW_TEXT
|
||||||
|
/// Start position of paragraph this font attribute covers
|
||||||
|
size_type pos;
|
||||||
|
/// Ending position of paragraph this font attribute covers
|
||||||
|
size_type pos_end;
|
||||||
|
#else
|
||||||
/// Start position of paragraph this font attribute covers
|
/// Start position of paragraph this font attribute covers
|
||||||
int pos;
|
int pos;
|
||||||
/// Ending position of paragraph this font attribute covers
|
/// Ending position of paragraph this font attribute covers
|
||||||
int pos_end;
|
int pos_end;
|
||||||
|
#endif
|
||||||
/** Font. Interpretation of the font values:
|
/** Font. Interpretation of the font values:
|
||||||
If a value is LyXFont::INHERIT_*, it means that the font
|
If a value is LyXFont::INHERIT_*, it means that the font
|
||||||
attribute is inherited from either the layout of this
|
attribute is inherited from either the layout of this
|
||||||
@ -470,47 +600,86 @@ private:
|
|||||||
allowed in these font tables.
|
allowed in these font tables.
|
||||||
*/
|
*/
|
||||||
LyXFont font;
|
LyXFont font;
|
||||||
|
#ifndef NEW_TABLE
|
||||||
/// Pointer to next font entry
|
/// Pointer to next font entry
|
||||||
FontTable *next;
|
FontTable * next;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
///
|
///
|
||||||
struct InsetTable {
|
struct InsetTable {
|
||||||
|
#ifdef NEW_TEXT
|
||||||
|
///
|
||||||
|
size_type pos;
|
||||||
|
#else
|
||||||
///
|
///
|
||||||
int pos;
|
int pos;
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
Inset *inset;
|
Inset * inset;
|
||||||
|
#ifndef NEW_TABLE
|
||||||
///
|
///
|
||||||
InsetTable *next;
|
InsetTable * next;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
#ifdef NEW_TABLE
|
||||||
///
|
///
|
||||||
FontTable *fonttable;
|
typedef list<FontTable> FontList;
|
||||||
///
|
///
|
||||||
InsetTable *insettable;
|
typedef list<InsetTable> InsetList;
|
||||||
///
|
///
|
||||||
LyXParagraph * TeXDeeper(string &file, TexRow &texrow,
|
FontList fontlist;
|
||||||
string &foot, TexRow &foot_texrow,
|
|
||||||
int &foot_count);
|
|
||||||
///
|
///
|
||||||
LyXParagraph * TeXFootnote(string &file, TexRow &texrow,
|
InsetList insetlist;
|
||||||
string &foot, TexRow &foot_texrow,
|
#else
|
||||||
int &foot_count);
|
|
||||||
///
|
///
|
||||||
bool SimpleTeXOnePar(string &file, TexRow &texrow);
|
FontTable * fonttable;
|
||||||
///
|
///
|
||||||
bool SimpleTeXOneTablePar(string &file, TexRow &texrow);
|
InsetTable * insettable;
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
bool TeXContTableRows(string &file, int i, int current_cell_number,
|
LyXParagraph * TeXDeeper(string & file, TexRow & texrow,
|
||||||
int &column, TexRow &texrow);
|
string & foot, TexRow & foot_texrow,
|
||||||
|
int & foot_count);
|
||||||
///
|
///
|
||||||
void SimpleTeXBlanks(string &file, TexRow &texrow,
|
LyXParagraph * TeXFootnote(string & file, TexRow & texrow,
|
||||||
int const i, int &column, LyXFont const &font,
|
string & foot, TexRow & foot_texrow,
|
||||||
LyXLayout const * const style);
|
int & foot_count);
|
||||||
///
|
///
|
||||||
void SimpleTeXSpecialChars(string &file, TexRow &texrow,
|
bool SimpleTeXOnePar(string & file, TexRow & texrow);
|
||||||
LyXFont &font, LyXFont &running_font,
|
///
|
||||||
LyXFont &basefont, bool &open_font,
|
bool SimpleTeXOneTablePar(string & file, TexRow & texrow);
|
||||||
LyXLayout const * const style,
|
#ifdef NEW_TEXT
|
||||||
int &i, int &column, char const c);
|
///
|
||||||
|
bool TeXContTableRows(string & file, size_type i,
|
||||||
|
int current_cell_number,
|
||||||
|
int & column, TexRow & texrow);
|
||||||
|
///
|
||||||
|
void SimpleTeXBlanks(string & file, TexRow & texrow,
|
||||||
|
size_type const i,
|
||||||
|
int & column, LyXFont const & font,
|
||||||
|
LyXLayout const & style);
|
||||||
|
///
|
||||||
|
void SimpleTeXSpecialChars(string & file, TexRow & texrow,
|
||||||
|
LyXFont & font, LyXFont & running_font,
|
||||||
|
LyXFont & basefont, bool & open_font,
|
||||||
|
LyXLayout const & style,
|
||||||
|
size_type & i,
|
||||||
|
int & column, char const c);
|
||||||
|
#else
|
||||||
|
///
|
||||||
|
bool TeXContTableRows(string & file, int i, int current_cell_number,
|
||||||
|
int & column, TexRow & texrow);
|
||||||
|
///
|
||||||
|
void SimpleTeXBlanks(string & file, TexRow & texrow,
|
||||||
|
int const i, int & column, LyXFont const & font,
|
||||||
|
LyXLayout const & style);
|
||||||
|
///
|
||||||
|
void SimpleTeXSpecialChars(string & file, TexRow & texrow,
|
||||||
|
LyXFont & font, LyXFont & running_font,
|
||||||
|
LyXFont & basefont, bool & open_font,
|
||||||
|
LyXLayout const & style,
|
||||||
|
int & i, int & column, char const c);
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
int id;
|
int id;
|
||||||
///
|
///
|
||||||
|
@ -299,11 +299,7 @@ LyXRC::LyXRC()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LyXRC::~LyXRC()
|
int LyXRC::ReadBindFile(string const & name)
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int LyXRC::ReadBindFile(string name)
|
|
||||||
{
|
{
|
||||||
hasBindFile = true;
|
hasBindFile = true;
|
||||||
string tmp = i18nLibFileSearch("bind",name,"bind");
|
string tmp = i18nLibFileSearch("bind",name,"bind");
|
||||||
|
@ -24,15 +24,13 @@ public:
|
|||||||
///
|
///
|
||||||
LyXRC();
|
LyXRC();
|
||||||
///
|
///
|
||||||
~LyXRC();
|
|
||||||
///
|
|
||||||
int Read (string const & filename);
|
int Read (string const & filename);
|
||||||
///
|
///
|
||||||
void Print();
|
void Print();
|
||||||
/// Is a bind file already (or currently) read?
|
/// Is a bind file already (or currently) read?
|
||||||
bool hasBindFile;
|
bool hasBindFile;
|
||||||
///
|
///
|
||||||
int ReadBindFile(string name = "cua");
|
int ReadBindFile(string const & name = "cua");
|
||||||
///
|
///
|
||||||
Toolbar toolbar;
|
Toolbar toolbar;
|
||||||
///
|
///
|
||||||
|
24
src/lyxrow.h
24
src/lyxrow.h
@ -4,26 +4,28 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
|
* Copyright 1995-1999 The LyX Team.
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef _LYXROW_H
|
#ifndef LYXROW_H
|
||||||
#define _LYXROW_H
|
#define LYXROW_H
|
||||||
|
|
||||||
//#include "lyxparagraph.h"
|
#include "lyxparagraph.h"
|
||||||
|
|
||||||
class LyXParagraph;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
struct Row {
|
struct Row {
|
||||||
///
|
///
|
||||||
LyXParagraph *par;
|
LyXParagraph * par;
|
||||||
///
|
///
|
||||||
|
#ifdef NEW_TEXT
|
||||||
|
LyXParagraph::size_type pos;
|
||||||
|
#else
|
||||||
int pos;
|
int pos;
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
unsigned short baseline;
|
unsigned short baseline;
|
||||||
///
|
|
||||||
/** what is missing to a full row can be negative.
|
/** what is missing to a full row can be negative.
|
||||||
Needed for hfills, flushright, block etc. */
|
Needed for hfills, flushright, block etc. */
|
||||||
int fill;
|
int fill;
|
||||||
@ -33,9 +35,9 @@ struct Row {
|
|||||||
unsigned short ascent_of_text;
|
unsigned short ascent_of_text;
|
||||||
|
|
||||||
///
|
///
|
||||||
Row* next;
|
Row * next;
|
||||||
///
|
///
|
||||||
Row* previous;
|
Row * previous;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
267
src/lyxtext.h
267
src/lyxtext.h
@ -17,11 +17,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "definitions.h"
|
#include "definitions.h"
|
||||||
#include "layout.h"
|
|
||||||
#include "lyxfont.h"
|
#include "lyxfont.h"
|
||||||
#include "lyxrow.h"
|
#include "lyxrow.h"
|
||||||
#include "undo.h"
|
#include "undo.h"
|
||||||
#include "lyxcursor.h"
|
#include "lyxcursor.h"
|
||||||
|
#include "lyxparagraph.h"
|
||||||
|
|
||||||
class Buffer;
|
class Buffer;
|
||||||
class BufferParams;
|
class BufferParams;
|
||||||
@ -45,9 +45,9 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// points to Buffer.params
|
/// points to Buffer.params
|
||||||
BufferParams *parameters;
|
BufferParams * parameters;
|
||||||
/// points to Buffer
|
/// points to Buffer
|
||||||
Buffer *params;
|
Buffer * params;
|
||||||
///
|
///
|
||||||
int number_of_rows;
|
int number_of_rows;
|
||||||
///
|
///
|
||||||
@ -63,13 +63,22 @@ public:
|
|||||||
/// Destructor
|
/// Destructor
|
||||||
~LyXText();
|
~LyXText();
|
||||||
|
|
||||||
|
#ifdef NEW_TEXT
|
||||||
///
|
///
|
||||||
LyXFont GetFont(LyXParagraph* par, int pos);
|
LyXFont GetFont(LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos);
|
||||||
///
|
///
|
||||||
void SetCharFont(LyXParagraph *par, int pos, LyXFont font);
|
void SetCharFont(LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos,
|
||||||
|
LyXFont font);
|
||||||
|
#else
|
||||||
|
///
|
||||||
|
LyXFont GetFont(LyXParagraph * par, int pos);
|
||||||
|
///
|
||||||
|
void SetCharFont(LyXParagraph * par, int pos, LyXFont font);
|
||||||
|
#endif
|
||||||
/// returns a pointer to the very first LyXParagraph
|
/// returns a pointer to the very first LyXParagraph
|
||||||
LyXParagraph *FirstParagraph();
|
LyXParagraph * FirstParagraph();
|
||||||
|
|
||||||
/// what you expect when pressing <enter> at cursor position
|
/// what you expect when pressing <enter> at cursor position
|
||||||
void BreakParagraph(char keep_layout = 0);
|
void BreakParagraph(char keep_layout = 0);
|
||||||
@ -80,7 +89,7 @@ public:
|
|||||||
void SetLayout(char layout);
|
void SetLayout(char layout);
|
||||||
|
|
||||||
/// used in setlayout
|
/// used in setlayout
|
||||||
void MakeFontEntriesLayoutSpecific(LyXParagraph *par);
|
void MakeFontEntriesLayoutSpecific(LyXParagraph * par);
|
||||||
|
|
||||||
/** increment depth over selection and make a total rebreak of those
|
/** increment depth over selection and make a total rebreak of those
|
||||||
paragraphs
|
paragraphs
|
||||||
@ -99,19 +108,19 @@ public:
|
|||||||
paragraphs.
|
paragraphs.
|
||||||
toggleall defaults to false.
|
toggleall defaults to false.
|
||||||
*/
|
*/
|
||||||
void SetFont(LyXFont font, bool toggleall=false);
|
void SetFont(LyXFont font, bool toggleall = false);
|
||||||
|
|
||||||
/** deletes and inserts again all paragaphs between the cursor
|
/** deletes and inserts again all paragaphs between the cursor
|
||||||
and the specified par .The Cursor is needed to set the refreshing
|
and the specified par .The Cursor is needed to set the refreshing
|
||||||
parameters.
|
parameters.
|
||||||
This function is needed after SetLayout and SetFont etc.
|
This function is needed after SetLayout and SetFont etc.
|
||||||
*/
|
*/
|
||||||
void RedoParagraphs(LyXCursor cursor, LyXParagraph *end_par);
|
void RedoParagraphs(LyXCursor cursor, LyXParagraph * end_par);
|
||||||
///
|
///
|
||||||
void RedoParagraph();
|
void RedoParagraph();
|
||||||
|
|
||||||
///
|
///
|
||||||
void ToggleFree(LyXFont font,bool toggleall=false);
|
void ToggleFree(LyXFont font, bool toggleall = false);
|
||||||
|
|
||||||
/** recalculates the heights of all previous rows of the
|
/** recalculates the heights of all previous rows of the
|
||||||
specified paragraph. needed, if the last characters font
|
specified paragraph. needed, if the last characters font
|
||||||
@ -129,17 +138,17 @@ public:
|
|||||||
*/
|
*/
|
||||||
void InsertChar(char c);
|
void InsertChar(char c);
|
||||||
///
|
///
|
||||||
void InsertInset(Inset *inset);
|
void InsertInset(Inset * inset);
|
||||||
|
|
||||||
/// completes the insertion with a full rebreak
|
/// completes the insertion with a full rebreak
|
||||||
int FullRebreak();
|
int FullRebreak();
|
||||||
|
|
||||||
/// may be important for the menu
|
/// may be important for the menu
|
||||||
char* GetLayout(int row);
|
char * GetLayout(int row);
|
||||||
///
|
///
|
||||||
LyXParagraph::footnote_flag GetFootnoteFlag(int row);
|
LyXParagraph::footnote_flag GetFootnoteFlag(int row);
|
||||||
///
|
///
|
||||||
Row* need_break_row;
|
Row * need_break_row;
|
||||||
///
|
///
|
||||||
long refresh_y;
|
long refresh_y;
|
||||||
///
|
///
|
||||||
@ -149,7 +158,7 @@ public:
|
|||||||
///
|
///
|
||||||
int refresh_x;
|
int refresh_x;
|
||||||
///
|
///
|
||||||
Row *refresh_row;
|
Row * refresh_row;
|
||||||
///
|
///
|
||||||
int refresh_pos;
|
int refresh_pos;
|
||||||
|
|
||||||
@ -162,18 +171,22 @@ public:
|
|||||||
(relative to the whole text). y is set to the real beginning
|
(relative to the whole text). y is set to the real beginning
|
||||||
of this row
|
of this row
|
||||||
*/
|
*/
|
||||||
Row* GetRowNearY(long &y);
|
Row * GetRowNearY(long & y);
|
||||||
|
|
||||||
/** returns the column near the specified x-coordinate of the row
|
/** returns the column near the specified x-coordinate of the row
|
||||||
x is set to the real beginning of this column
|
x is set to the real beginning of this column
|
||||||
*/
|
*/
|
||||||
int GetColumnNearX(Row *row, int& x);
|
int GetColumnNearX(Row * row, int & x);
|
||||||
|
|
||||||
/** returns a pointer to a specified row. y is set to the beginning
|
/** returns a pointer to a specified row. y is set to the beginning
|
||||||
of the row
|
of the row
|
||||||
*/
|
*/
|
||||||
Row* GetRow(LyXParagraph *par, int pos, long &y);
|
#ifdef NEW_TEXT
|
||||||
|
Row * GetRow(LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos, long & y);
|
||||||
|
#else
|
||||||
|
Row * GetRow(LyXParagraph * par, int pos, long & y);
|
||||||
|
#endif
|
||||||
/** returns the height of a default row, needed for scrollbar
|
/** returns the height of a default row, needed for scrollbar
|
||||||
*/
|
*/
|
||||||
int DefaultHeight();
|
int DefaultHeight();
|
||||||
@ -218,13 +231,22 @@ public:
|
|||||||
to the beginning of this word.
|
to the beginning of this word.
|
||||||
With SelectSelectedWord can this be highlighted really
|
With SelectSelectedWord can this be highlighted really
|
||||||
*/
|
*/
|
||||||
char* SelectNextWord(float &value);
|
char * SelectNextWord(float & value);
|
||||||
///
|
///
|
||||||
void SelectSelectedWord();
|
void SelectSelectedWord();
|
||||||
|
#ifdef NEW_TEXT
|
||||||
///
|
///
|
||||||
void SetCursor(LyXParagraph *par, int pos);
|
void SetCursor(LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos);
|
||||||
///
|
///
|
||||||
void SetCursorIntern(LyXParagraph *par, int pos);
|
void SetCursorIntern(LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos);
|
||||||
|
#else
|
||||||
|
///
|
||||||
|
void SetCursor(LyXParagraph * par, int pos);
|
||||||
|
///
|
||||||
|
void SetCursorIntern(LyXParagraph * par, int pos);
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
void SetCursorFromCoordinates(int x, long y);
|
void SetCursorFromCoordinates(int x, long y);
|
||||||
///
|
///
|
||||||
@ -266,17 +288,23 @@ public:
|
|||||||
///
|
///
|
||||||
int SelectWordWhenUnderCursor();
|
int SelectWordWhenUnderCursor();
|
||||||
/// Change the case of the word at cursor position
|
/// Change the case of the word at cursor position
|
||||||
/** action is 0 for lower case, 1 for capitalization and 2 for
|
/** Change the case of the word at cursor position.
|
||||||
|
action is 0 for lower case, 1 for capitalization and 2 for
|
||||||
uppercase.
|
uppercase.
|
||||||
*/
|
*/
|
||||||
void ChangeWordCase(int action);
|
enum TextCase {
|
||||||
|
text_lowercase = 0,
|
||||||
|
text_capitalization = 1,
|
||||||
|
text_uppercase = 2
|
||||||
|
};
|
||||||
|
void ChangeWordCase(TextCase action);
|
||||||
|
|
||||||
/** returns a printed row in a pixmap. The y value is needed to
|
/** returns a printed row in a pixmap. The y value is needed to
|
||||||
decide, wether it is selected text or not. This is a strange
|
decide, wether it is selected text or not. This is a strange
|
||||||
solution but faster.
|
solution but faster.
|
||||||
*/
|
*/
|
||||||
void GetVisibleRow(LyXScreen &scr, int offset,
|
void GetVisibleRow(LyXScreen & scr, int offset,
|
||||||
Row *row_ptr, long y);
|
Row * row_ptr, long y);
|
||||||
|
|
||||||
/* footnotes: */
|
/* footnotes: */
|
||||||
///
|
///
|
||||||
@ -326,12 +354,12 @@ public:
|
|||||||
void SetParagraph(bool line_top, bool line_bottom,
|
void SetParagraph(bool line_top, bool line_bottom,
|
||||||
bool pagebreak_top, bool pagebreak_bottom,
|
bool pagebreak_top, bool pagebreak_bottom,
|
||||||
VSpace space_top, VSpace space_bottom,
|
VSpace space_top, VSpace space_bottom,
|
||||||
char align,
|
LyXAlignment align,
|
||||||
string labelwidthstring,
|
string labelwidthstring,
|
||||||
bool noindent);
|
bool noindent);
|
||||||
void SetParagraphExtraOpt(int type,
|
void SetParagraphExtraOpt(int type,
|
||||||
const char *width,
|
char const * width,
|
||||||
const char *widthp,
|
char const * widthp,
|
||||||
int alignment, bool hfill,
|
int alignment, bool hfill,
|
||||||
bool start_minipage);
|
bool start_minipage);
|
||||||
|
|
||||||
@ -340,27 +368,38 @@ public:
|
|||||||
/** returns true if the specified string is at the specified
|
/** returns true if the specified string is at the specified
|
||||||
position
|
position
|
||||||
*/
|
*/
|
||||||
bool IsStringInText(LyXParagraph *par, int pos, char const* string);
|
#ifdef NEW_TEXT
|
||||||
|
bool IsStringInText(LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos,
|
||||||
|
char const * str);
|
||||||
|
#else
|
||||||
|
bool IsStringInText(LyXParagraph * par, int pos, char const * str);
|
||||||
|
#endif
|
||||||
/** sets the selection over the number of characters of string,
|
/** sets the selection over the number of characters of string,
|
||||||
no check!!
|
no check!!
|
||||||
*/
|
*/
|
||||||
void SetSelectionOverString(char const* string);
|
void SetSelectionOverString(char const * str);
|
||||||
|
|
||||||
/** simple replacing. The font of the first selected character
|
/** simple replacing. The font of the first selected character
|
||||||
is used
|
is used
|
||||||
*/
|
*/
|
||||||
void ReplaceSelectionWithString(char const* string);
|
void ReplaceSelectionWithString(char const * string);
|
||||||
|
|
||||||
/** if the string can be found: return true and set the cursor to
|
/** if the string can be found: return true and set the cursor to
|
||||||
the new position */
|
the new position */
|
||||||
bool SearchForward(char const* string);
|
bool SearchForward(char const * string);
|
||||||
bool SearchBackward(char const* string);
|
bool SearchBackward(char const * string);
|
||||||
|
|
||||||
|
#ifdef NEW_TEXT
|
||||||
/// needed to insert the selection
|
/// needed to insert the selection
|
||||||
void InsertStringA(char* string);
|
void InsertStringA(LyXParagraph::TextContainer const & text);
|
||||||
/// needed to insert the selection
|
/// needed to insert the selection
|
||||||
void InsertStringB(char* string);
|
void InsertStringB(LyXParagraph::TextContainer const & text);
|
||||||
|
#endif
|
||||||
|
/// needed to insert the selection
|
||||||
|
void InsertStringA(char const * string);
|
||||||
|
/// needed to insert the selection
|
||||||
|
void InsertStringB(char const * string);
|
||||||
|
|
||||||
/// usefull when texing from within LyX
|
/// usefull when texing from within LyX
|
||||||
bool GotoNextError();
|
bool GotoNextError();
|
||||||
@ -372,42 +411,58 @@ public:
|
|||||||
for a list of paragraphs beginning with the specified par
|
for a list of paragraphs beginning with the specified par
|
||||||
return value is the number of wrong conversions
|
return value is the number of wrong conversions
|
||||||
*/
|
*/
|
||||||
int SwitchLayoutsBetweenClasses(char class1, char class2, LyXParagraph *par);
|
int SwitchLayoutsBetweenClasses(char class1, char class2,
|
||||||
|
LyXParagraph * par);
|
||||||
|
|
||||||
/* for the greater insets */
|
/* for the greater insets */
|
||||||
|
|
||||||
/// returns 0 if inset wasn't found
|
/// returns 0 if inset wasn't found
|
||||||
int UpdateInset(Inset* inset);
|
int UpdateInset(Inset * inset);
|
||||||
|
#ifdef NEW_TEXT
|
||||||
///
|
///
|
||||||
void CheckParagraph(LyXParagraph* par, int pos);
|
void CheckParagraph(LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos);
|
||||||
|
///
|
||||||
|
int NumberOfCell(LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos);
|
||||||
|
#else
|
||||||
|
///
|
||||||
|
void CheckParagraph(LyXParagraph * par, int pos);
|
||||||
|
///
|
||||||
|
int NumberOfCell(LyXParagraph * par, int pos);
|
||||||
|
#endif
|
||||||
/* table stuff -- begin*/
|
/* table stuff -- begin*/
|
||||||
|
|
||||||
/** all table features of the text-class are put together in
|
/** all table features of the text-class are put together in
|
||||||
this function. Possible values of feature are defined in table.h
|
this function. Possible values of feature are defined in table.h
|
||||||
*/
|
*/
|
||||||
void TableFeatures(int feature,string val);
|
void TableFeatures(int feature, string val);
|
||||||
///
|
///
|
||||||
void TableFeatures(int feature);
|
void TableFeatures(int feature);
|
||||||
///
|
|
||||||
int NumberOfCell(LyXParagraph *par, int pos);
|
|
||||||
|
|
||||||
/** pos points at the beginning of the next cell (if there is one)
|
/** pos points at the beginning of the next cell (if there is one)
|
||||||
*/
|
*/
|
||||||
int WidthOfCell(LyXParagraph *par, int &pos);
|
#ifdef NEW_TEXT
|
||||||
|
int WidthOfCell(LyXParagraph * par, LyXParagraph::size_type & pos);
|
||||||
|
///
|
||||||
|
void CheckParagraphInTable(LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos);
|
||||||
|
#else
|
||||||
|
int WidthOfCell(LyXParagraph * par, int & pos);
|
||||||
|
///
|
||||||
|
void CheckParagraphInTable(LyXParagraph * par, int pos);
|
||||||
|
#endif
|
||||||
///
|
///
|
||||||
void InsertCharInTable(char c);
|
void InsertCharInTable(char c);
|
||||||
///
|
///
|
||||||
void BackspaceInTable();
|
void BackspaceInTable();
|
||||||
///
|
///
|
||||||
void CheckParagraphInTable(LyXParagraph* par, int pos);
|
char HitInTable(Row * row, int x);
|
||||||
///
|
|
||||||
char HitInTable(Row* row, int x);
|
|
||||||
///
|
///
|
||||||
bool MouseHitInTable(int x, long y);
|
bool MouseHitInTable(int x, long y);
|
||||||
/* table stuff -- end*/
|
/* table stuff -- end*/
|
||||||
///
|
///
|
||||||
LyXParagraph* GetParFromID(int id);
|
LyXParagraph * GetParFromID(int id);
|
||||||
|
|
||||||
// undo functions
|
// undo functions
|
||||||
/// returns false if no undo possible
|
/// returns false if no undo possible
|
||||||
@ -415,7 +470,7 @@ public:
|
|||||||
/// returns false if no redo possible
|
/// returns false if no redo possible
|
||||||
bool TextRedo();
|
bool TextRedo();
|
||||||
/// used by TextUndo/TextRedo
|
/// used by TextUndo/TextRedo
|
||||||
bool TextHandleUndo(Undo* undo);
|
bool TextHandleUndo(Undo * undo);
|
||||||
/// makes sure the next operation will be stored
|
/// makes sure the next operation will be stored
|
||||||
void FinishUndo();
|
void FinishUndo();
|
||||||
/// this is dangerous and for internal use only
|
/// this is dangerous and for internal use only
|
||||||
@ -427,11 +482,14 @@ public:
|
|||||||
/// a flag
|
/// a flag
|
||||||
bool undo_frozen;
|
bool undo_frozen;
|
||||||
///
|
///
|
||||||
void SetUndo(Undo::undo_kind kind, LyXParagraph *before, LyXParagraph *end);
|
void SetUndo(Undo::undo_kind kind, LyXParagraph * before,
|
||||||
|
LyXParagraph * end);
|
||||||
///
|
///
|
||||||
void SetRedo(Undo::undo_kind kind, LyXParagraph *before, LyXParagraph *end);
|
void SetRedo(Undo::undo_kind kind, LyXParagraph * before,
|
||||||
|
LyXParagraph * end);
|
||||||
///
|
///
|
||||||
Undo *CreateUndo(Undo::undo_kind kind, LyXParagraph *before, LyXParagraph *end);
|
Undo * CreateUndo(Undo::undo_kind kind, LyXParagraph * before,
|
||||||
|
LyXParagraph * end);
|
||||||
/// for external use in lyx_cb.C
|
/// for external use in lyx_cb.C
|
||||||
void SetCursorParUndo();
|
void SetCursorParUndo();
|
||||||
///
|
///
|
||||||
@ -439,9 +497,9 @@ public:
|
|||||||
///
|
///
|
||||||
void CursorRightIntern();
|
void CursorRightIntern();
|
||||||
///
|
///
|
||||||
void RemoveTableRow(LyXCursor *cursor);
|
void RemoveTableRow(LyXCursor * cursor);
|
||||||
///
|
///
|
||||||
bool IsEmptyTableRow(LyXCursor *cursor);
|
bool IsEmptyTableRow(LyXCursor * cursor);
|
||||||
///
|
///
|
||||||
bool IsEmptyTableCell();
|
bool IsEmptyTableCell();
|
||||||
///
|
///
|
||||||
@ -449,9 +507,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
///
|
///
|
||||||
Row* firstrow;
|
Row * firstrow;
|
||||||
///
|
///
|
||||||
Row* lastrow;
|
Row * lastrow;
|
||||||
|
|
||||||
/** Copybuffer for copy environment type
|
/** Copybuffer for copy environment type
|
||||||
Asger has learned that this should be a buffer-property instead
|
Asger has learned that this should be a buffer-property instead
|
||||||
@ -460,7 +518,7 @@ private:
|
|||||||
char copylayouttype;
|
char copylayouttype;
|
||||||
|
|
||||||
/// the currentrow is needed to access rows faster*/
|
/// the currentrow is needed to access rows faster*/
|
||||||
Row* currentrow; /* pointer to the current row */
|
Row * currentrow; /* pointer to the current row */
|
||||||
/// position in the text
|
/// position in the text
|
||||||
long currentrow_y;
|
long currentrow_y;
|
||||||
/// width of the paper
|
/// width of the paper
|
||||||
@ -468,99 +526,132 @@ private:
|
|||||||
|
|
||||||
/** inserts a new row behind the specified row, increments
|
/** inserts a new row behind the specified row, increments
|
||||||
* the touched counters */
|
* the touched counters */
|
||||||
void InsertRow(Row *row, LyXParagraph *par, int pos );
|
#ifdef NEW_TEXT
|
||||||
|
void InsertRow(Row * row, LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos );
|
||||||
|
#else
|
||||||
|
void InsertRow(Row * row, LyXParagraph * par, int pos );
|
||||||
|
#endif
|
||||||
/** removes the row and reset the touched counters */
|
/** removes the row and reset the touched counters */
|
||||||
void RemoveRow(Row *row);
|
void RemoveRow(Row * row);
|
||||||
|
|
||||||
/** remove all following rows of the paragraph of the specified row. */
|
/** remove all following rows of the paragraph of the specified row. */
|
||||||
void RemoveParagraph(Row *row);
|
void RemoveParagraph(Row * row);
|
||||||
|
|
||||||
/** insert the specified paragraph behind the specified row */
|
/** insert the specified paragraph behind the specified row */
|
||||||
void InsertParagraph(LyXParagraph *par, Row *row);
|
void InsertParagraph(LyXParagraph * par, Row * row);
|
||||||
|
|
||||||
/** appends the implizit specified paragraph behind the specified row,
|
/** appends the implizit specified paragraph behind the specified row,
|
||||||
* start at the implizit given position */
|
* start at the implizit given position */
|
||||||
void AppendParagraph(Row *row);
|
void AppendParagraph(Row * row);
|
||||||
|
|
||||||
///
|
///
|
||||||
void BreakAgain(Row *row);
|
void BreakAgain(Row * row);
|
||||||
///
|
///
|
||||||
void BreakAgainOneRow(Row *row);
|
void BreakAgainOneRow(Row * row);
|
||||||
///
|
///
|
||||||
void SetHeightOfRow(Row *row_ptr); /* calculate and set the height
|
void SetHeightOfRow(Row * row_ptr); /* calculate and set the height
|
||||||
* of the row */
|
* of the row */
|
||||||
|
|
||||||
/** this calculates the specified parameters. needed when setting
|
/** this calculates the specified parameters. needed when setting
|
||||||
* the cursor and when creating a visible row */
|
* the cursor and when creating a visible row */
|
||||||
void PrepareToPrint(Row *row, float &x, float &fill_separator,
|
void PrepareToPrint(Row * row, float & x, float & fill_separator,
|
||||||
float &fill_hfill, float &fill_label_hfill);
|
float & fill_hfill, float & fill_label_hfill);
|
||||||
///
|
///
|
||||||
void DeleteEmptyParagraphMechanism(LyXCursor old_cursor);
|
void DeleteEmptyParagraphMechanism(LyXCursor old_cursor);
|
||||||
|
|
||||||
/** Updates all counters starting BEHIND the row. Changed paragraphs
|
/** Updates all counters starting BEHIND the row. Changed paragraphs
|
||||||
* with a dynamic left margin will be rebroken. */
|
* with a dynamic left margin will be rebroken. */
|
||||||
void UpdateCounters(Row *row);
|
void UpdateCounters(Row * row);
|
||||||
///
|
///
|
||||||
void SetCounter(LyXParagraph *par);
|
void SetCounter(LyXParagraph * par);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* some low level functions
|
* some low level functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef NEW_TEXT
|
||||||
///
|
///
|
||||||
int SingleWidth(LyXParagraph *par, int pos);
|
int SingleWidth(LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos);
|
||||||
///
|
///
|
||||||
int SingleWidth(LyXParagraph *par, int pos, char c);
|
int SingleWidth(LyXParagraph * par,
|
||||||
|
LyXParagraph::size_type pos, char c);
|
||||||
///
|
///
|
||||||
void Draw(Row *row, int &pos, LyXScreen &scr, int offset, float &x);
|
void Draw(Row * row, LyXParagraph::size_type & pos,
|
||||||
|
LyXScreen & scr,
|
||||||
|
int offset, float & x);
|
||||||
/// get the next breakpoint in a given paragraph
|
/// get the next breakpoint in a given paragraph
|
||||||
int NextBreakPoint(Row* row, int width);
|
LyXParagraph::size_type NextBreakPoint(Row * row,
|
||||||
|
int width);
|
||||||
|
#else
|
||||||
|
///
|
||||||
|
int SingleWidth(LyXParagraph * par, int pos);
|
||||||
|
///
|
||||||
|
int SingleWidth(LyXParagraph * par, int pos, char c);
|
||||||
|
///
|
||||||
|
void Draw(Row * row, int & pos, LyXScreen & scr,
|
||||||
|
int offset, float & x);
|
||||||
|
/// get the next breakpoint in a given paragraph
|
||||||
|
int NextBreakPoint(Row * row, int width);
|
||||||
|
#endif
|
||||||
/// returns the minimum space a row needs on the screen in pixel
|
/// returns the minimum space a row needs on the screen in pixel
|
||||||
int Fill(Row *row, int paperwidth);
|
int Fill(Row * row, int paperwidth);
|
||||||
|
|
||||||
/** returns the minimum space a manual label needs on the
|
/** returns the minimum space a manual label needs on the
|
||||||
screen in pixel */
|
screen in pixel */
|
||||||
int LabelFill(Row *row);
|
int LabelFill(Row * row);
|
||||||
|
|
||||||
|
#ifdef NEW_TEXT
|
||||||
///
|
///
|
||||||
int BeginningOfMainBody(LyXParagraph *par);
|
LyXParagraph::size_type BeginningOfMainBody(LyXParagraph * par);
|
||||||
|
#else
|
||||||
|
///
|
||||||
|
int BeginningOfMainBody(LyXParagraph * par);
|
||||||
|
#endif
|
||||||
/** Returns the left beginning of the text.
|
/** Returns the left beginning of the text.
|
||||||
This information cannot be taken from the layouts-objekt, because
|
This information cannot be taken from the layouts-objekt, because
|
||||||
in LaTeX the beginning of the text fits in some cases
|
in LaTeX the beginning of the text fits in some cases
|
||||||
(for example sections) exactly the label-width.
|
(for example sections) exactly the label-width.
|
||||||
*/
|
*/
|
||||||
int LeftMargin(Row *row);
|
int LeftMargin(Row * row);
|
||||||
///
|
///
|
||||||
int RightMargin(Row *row);
|
int RightMargin(Row * row);
|
||||||
///
|
///
|
||||||
int LabelEnd (Row *row);
|
int LabelEnd (Row * row);
|
||||||
|
|
||||||
/** returns the number of separators in the specified row.
|
/** returns the number of separators in the specified row.
|
||||||
The separator on the very last column doesnt count
|
The separator on the very last column doesnt count
|
||||||
*/
|
*/
|
||||||
int NumberOfSeparators(Row *row);
|
int NumberOfSeparators(Row * row);
|
||||||
|
|
||||||
/** returns the number of hfills in the specified row. The
|
/** returns the number of hfills in the specified row. The
|
||||||
LyX-Hfill is a LaTeX \hfill so that the hfills at the
|
LyX-Hfill is a LaTeX \hfill so that the hfills at the
|
||||||
beginning and at the end were ignored. This is {\em MUCH}
|
beginning and at the end were ignored. This is {\em MUCH}
|
||||||
more usefull than not to ignore!
|
more usefull than not to ignore!
|
||||||
*/
|
*/
|
||||||
int NumberOfHfills(Row *row);
|
int NumberOfHfills(Row * row);
|
||||||
|
|
||||||
/// like NumberOfHfills, but only those in the manual label!
|
/// like NumberOfHfills, but only those in the manual label!
|
||||||
int NumberOfLabelHfills(Row *row);
|
int NumberOfLabelHfills(Row * row);
|
||||||
|
|
||||||
/** returns true, if a expansion is needed. Rules are given by
|
/** returns true, if a expansion is needed. Rules are given by
|
||||||
LaTeX
|
LaTeX
|
||||||
*/
|
*/
|
||||||
bool HfillExpansion(Row *row_ptr, int pos);
|
#ifdef NEW_TEXT
|
||||||
|
bool HfillExpansion(Row * row_ptr,
|
||||||
|
LyXParagraph::size_type pos);
|
||||||
/** returns the paragraph position of the last character in the
|
/** returns the paragraph position of the last character in the
|
||||||
specified row
|
specified row
|
||||||
*/
|
*/
|
||||||
int RowLast(Row *row);
|
LyXParagraph::size_type RowLast(Row * row);
|
||||||
|
#else
|
||||||
|
bool HfillExpansion(Row * row_ptr, int pos);
|
||||||
|
/** returns the paragraph position of the last character in the
|
||||||
|
specified row
|
||||||
|
*/
|
||||||
|
int RowLast(Row * row);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
50
src/lyxvc.C
50
src/lyxvc.C
@ -21,9 +21,6 @@
|
|||||||
extern BufferList bufferlist;
|
extern BufferList bufferlist;
|
||||||
extern void MenuWrite(Buffer *);
|
extern void MenuWrite(Buffer *);
|
||||||
|
|
||||||
#if 0
|
|
||||||
extern bool gsworking();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
LyXVC::LyXVC()
|
LyXVC::LyXVC()
|
||||||
{
|
{
|
||||||
@ -146,7 +143,7 @@ void LyXVC::scanMaster()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXVC::setBuffer(Buffer *buf)
|
void LyXVC::setBuffer(Buffer * buf)
|
||||||
{
|
{
|
||||||
_owner = buf;
|
_owner = buf;
|
||||||
}
|
}
|
||||||
@ -302,22 +299,23 @@ string const LyXVC::getLocker() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is a hack anyway so I'll put it here in the mean time.
|
// This is a hack anyway so I'll put it here in the mean time.
|
||||||
void LyXVC::logClose(FL_OBJECT *obj, long)
|
void LyXVC::logClose(FL_OBJECT * obj, long)
|
||||||
{
|
{
|
||||||
LyXVC *This = (LyXVC*)obj->form->u_vdata;
|
LyXVC * This = static_cast<LyXVC*>(obj->form->u_vdata);
|
||||||
fl_hide_form(This->browser->LaTeXLog);
|
fl_hide_form(This->browser->LaTeXLog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// and, hack over hack, here is a C wrapper :)
|
// and, hack over hack, here is a C wrapper :)
|
||||||
extern "C" void C_LyXVC_logClose(FL_OBJECT *ob, long data)
|
extern "C" void C_LyXVC_logClose(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
LyXVC::logClose(ob, data);
|
LyXVC::logClose(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LyXVC::logUpdate(FL_OBJECT *obj, long)
|
void LyXVC::logUpdate(FL_OBJECT * obj, long)
|
||||||
{
|
{
|
||||||
LyXVC *This = (LyXVC*)obj->form->u_vdata;
|
LyXVC * This = static_cast<LyXVC*>(obj->form->u_vdata);
|
||||||
This->showLog();
|
This->showLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,14 +330,17 @@ void LyXVC::viewLog(string const & fil)
|
|||||||
static int ow = -1, oh;
|
static int ow = -1, oh;
|
||||||
|
|
||||||
if (!browser) {
|
if (!browser) {
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT * obj;
|
||||||
browser = (FD_LaTeXLog *) fl_calloc(1, sizeof(*browser));
|
browser = (FD_LaTeXLog *) fl_calloc(1, sizeof(*browser));
|
||||||
|
|
||||||
browser->LaTeXLog = fl_bgn_form(FL_NO_BOX, 470, 380);
|
browser->LaTeXLog = fl_bgn_form(FL_NO_BOX, 470, 380);
|
||||||
browser->LaTeXLog->u_vdata = (void*)this;
|
browser->LaTeXLog->u_vdata = this;
|
||||||
obj = fl_add_box(FL_UP_BOX, 0, 0, 470, 380, "");
|
obj = fl_add_box(FL_UP_BOX, 0, 0, 470, 380, "");
|
||||||
browser->browser_latexlog = fl_add_browser(FL_NORMAL_BROWSER, 10, 10, 450, 320, "");
|
browser->browser_latexlog = fl_add_browser(FL_NORMAL_BROWSER,
|
||||||
obj = fl_add_button(FL_RETURN_BUTTON, 270, 340, 90, 30, _("Close"));
|
10, 10,
|
||||||
|
450, 320, "");
|
||||||
|
obj = fl_add_button(FL_RETURN_BUTTON, 270, 340, 90, 30,
|
||||||
|
_("Close"));
|
||||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||||
fl_set_object_callback(obj, C_LyXVC_logClose, 0);
|
fl_set_object_callback(obj, C_LyXVC_logClose, 0);
|
||||||
obj = fl_add_button(FL_NORMAL_BUTTON,370,340,90,30,
|
obj = fl_add_button(FL_NORMAL_BUTTON,370,340,90,30,
|
||||||
@ -352,7 +353,8 @@ void LyXVC::viewLog(string const & fil)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!fl_load_browser(browser->browser_latexlog, fil.c_str()))
|
if (!fl_load_browser(browser->browser_latexlog, fil.c_str()))
|
||||||
fl_add_browser_line(browser->browser_latexlog, _("No RCS History!"));
|
fl_add_browser_line(browser->browser_latexlog,
|
||||||
|
_("No RCS History!"));
|
||||||
|
|
||||||
if (browser->LaTeXLog->visible) {
|
if (browser->LaTeXLog->visible) {
|
||||||
fl_raise_form(browser->LaTeXLog);
|
fl_raise_form(browser->LaTeXLog);
|
||||||
@ -371,26 +373,6 @@ void LyXVC::viewLog(string const & fil)
|
|||||||
|
|
||||||
void LyXVC::showLog()
|
void LyXVC::showLog()
|
||||||
{
|
{
|
||||||
// This I really don't like, but we'll look at this problem
|
|
||||||
// in 0.13. Then we can make a clean solution.
|
|
||||||
#if 0
|
|
||||||
if (gsworking()) {
|
|
||||||
WriteAlert(_("Sorry, can't do this while"
|
|
||||||
" pictures are being rendered."),
|
|
||||||
_("Please wait a few seconds for"
|
|
||||||
" this to finish and try again."),
|
|
||||||
_("(or kill runaway gs processes"
|
|
||||||
" by hand and try again.)"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
extern pid_t isp_pid; // from spellchecker.C
|
|
||||||
if(isp_pid != -1) {
|
|
||||||
WriteAlert(_("Can't do this while the"
|
|
||||||
" spellchecker is running."),
|
|
||||||
_("Stop the spellchecker first."));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
string tmpf = tmpnam(0);
|
string tmpf = tmpnam(0);
|
||||||
doVCCommand("rlog \""
|
doVCCommand("rlog \""
|
||||||
+ OnlyFilename(_owner->getFileName()) + "\" > " + tmpf);
|
+ OnlyFilename(_owner->getFileName()) + "\" > " + tmpf);
|
||||||
|
@ -265,9 +265,9 @@ int mathed_char_height(short type, int size, byte c, int& asc, int& des)
|
|||||||
|
|
||||||
|
|
||||||
// In a near future maybe we use a better fonts renderer
|
// In a near future maybe we use a better fonts renderer
|
||||||
void MathedInset::drawStr(short type, int size, int x, int y, byte* s, int ls)
|
void MathedInset::drawStr(short type, int siz, int x, int y, byte* s, int ls)
|
||||||
{
|
{
|
||||||
mathed_set_font(type, size);
|
mathed_set_font(type, siz);
|
||||||
byte sx[80];
|
byte sx[80];
|
||||||
if (MathIsBinary(type)) {
|
if (MathIsBinary(type)) {
|
||||||
byte *ps = &sx[0];
|
byte *ps = &sx[0];
|
||||||
@ -281,7 +281,7 @@ void MathedInset::drawStr(short type, int size, int x, int y, byte* s, int ls)
|
|||||||
s = &sx[0];
|
s = &sx[0];
|
||||||
}
|
}
|
||||||
GC gc = (type==LM_TC_TEX) ? latexGC: mathGC;
|
GC gc = (type==LM_TC_TEX) ? latexGC: mathGC;
|
||||||
XDrawString(fl_display, pm, gc, x, y, (char*)s, ls);
|
XDrawString(fl_display, pm, gc, x, y, reinterpret_cast<char*>(s), ls);
|
||||||
XFlush(fl_display);
|
XFlush(fl_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,21 +623,21 @@ string InsetFormula::getLabel(int il) const
|
|||||||
//#warning This is dirty, I know. Ill clean it at 0.11
|
//#warning This is dirty, I know. Ill clean it at 0.11
|
||||||
// Correction, the only way to clean this is with a new kernel: 0.13.
|
// Correction, the only way to clean this is with a new kernel: 0.13.
|
||||||
if (par->GetType()==LM_OT_MPARN) {
|
if (par->GetType()==LM_OT_MPARN) {
|
||||||
string label;
|
string lab;
|
||||||
MathMatrixInset *mt = (MathMatrixInset*)par;
|
MathMatrixInset * mt = (MathMatrixInset*)par;
|
||||||
int nl=0;
|
int nl=0;
|
||||||
MathedRowSt const* crow = mt->getRowSt();
|
MathedRowSt const * crow = mt->getRowSt();
|
||||||
while (crow) {
|
while (crow) {
|
||||||
if (crow->getLabel()) {
|
if (crow->getLabel()) {
|
||||||
if (nl==il) {
|
if (nl==il) {
|
||||||
label = crow->getLabel();
|
lab = crow->getLabel();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
nl++;
|
nl++;
|
||||||
}
|
}
|
||||||
crow = crow->getNext();
|
crow = crow->getNext();
|
||||||
}
|
}
|
||||||
return label;
|
return lab;
|
||||||
}
|
}
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,14 @@ inline bool IsAlpha(char c)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This was very smaller, I'll change it later
|
// This was very smaller, I'll change it later
|
||||||
inline bool IsMacro(short token, int id)
|
inline bool IsMacro(short tok, int id)
|
||||||
{
|
{
|
||||||
return (token!=LM_TK_STACK && token!=LM_TK_FRAC && token!=LM_TK_SQRT && token!=LM_TK_WIDE &&
|
return (tok != LM_TK_STACK && tok != LM_TK_FRAC && tok != LM_TK_SQRT
|
||||||
token!=LM_TK_SPACE && token!=LM_TK_DOTS && token!=LM_TK_FUNCLIM &&
|
&& tok != LM_TK_WIDE
|
||||||
token!=LM_TK_BIGSYM && token!=LM_TK_ACCENT &&
|
&& tok != LM_TK_SPACE && tok != LM_TK_DOTS
|
||||||
!(token==LM_TK_SYM && id<255));
|
&& tok != LM_TK_FUNCLIM
|
||||||
|
&& tok != LM_TK_BIGSYM && tok != LM_TK_ACCENT &&
|
||||||
|
!(tok == LM_TK_SYM && id < 255));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Yes, mathed isn't using string yet.
|
// Yes, mathed isn't using string yet.
|
||||||
|
@ -363,8 +363,8 @@ MathBigopInset::Metrics()
|
|||||||
t = LM_TC_TEXTRM;
|
t = LM_TC_TEXTRM;
|
||||||
}
|
}
|
||||||
mathed_set_font(t, size);
|
mathed_set_font(t, size);
|
||||||
mathed_string_height(t, size, (unsigned char const *)s, ls, ascent, descent);
|
mathed_string_height(t, size, reinterpret_cast<const unsigned char*>(s), ls, ascent, descent);
|
||||||
width = mathed_string_width(t, size, (unsigned char const *)s, ls);
|
width = mathed_string_width(t, size, reinterpret_cast<const unsigned char*>(s), ls);
|
||||||
if (sym==LM_oint) width += 2;
|
if (sym==LM_oint) width += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,20 +361,20 @@ in_word_set (register const char *str, register int len)
|
|||||||
|
|
||||||
if (key <= MAX_HASH_VALUE && key >= 0)
|
if (key <= MAX_HASH_VALUE && key >= 0)
|
||||||
{
|
{
|
||||||
register int index = lookup[key];
|
register int idx = lookup[key];
|
||||||
|
|
||||||
if (index >= 0 && index < MAX_HASH_VALUE)
|
if (idx >= 0 && idx < MAX_HASH_VALUE)
|
||||||
{
|
{
|
||||||
register char const *s = wordlist[index].name;
|
register char const * s = wordlist[idx].name;
|
||||||
|
|
||||||
if (*s == *str && !strcmp (str + 1, s + 1))
|
if (*s == *str && !strcmp (str + 1, s + 1))
|
||||||
return &wordlist[index];
|
return &wordlist[idx];
|
||||||
}
|
}
|
||||||
else if (index < 0 && index >= -MAX_HASH_VALUE)
|
else if (idx < 0 && idx >= -MAX_HASH_VALUE)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
register int offset = key + index + (index > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);
|
register int offset = key + idx + (idx > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);
|
||||||
register struct latexkeys *base = &wordlist[-lookup[offset]];
|
register struct latexkeys *base = &wordlist[-lookup[offset]];
|
||||||
register struct latexkeys *ptr = base + -lookup[offset + 1];
|
register struct latexkeys *ptr = base + -lookup[offset + 1];
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ MathMatrixInset::MathMatrixInset(int m, int n, short st):
|
|||||||
ws = new int[nc];
|
ws = new int[nc];
|
||||||
v_align = 0;
|
v_align = 0;
|
||||||
h_align = new char[nc+1];
|
h_align = new char[nc+1];
|
||||||
for (int i =0; i<nc; i++) h_align[i] = 'c';
|
for (int i =0; i < nc; i++) h_align[i] = 'c';
|
||||||
h_align[nc] = '\0';
|
h_align[nc] = '\0';
|
||||||
nr = 0;
|
nr = 0;
|
||||||
row = 0;
|
row = 0;
|
||||||
@ -292,10 +292,10 @@ MathMatrixInset::MathMatrixInset(int m, int n, short st):
|
|||||||
if (n>0) {
|
if (n>0) {
|
||||||
row = new MathedRowSt(nc+1);
|
row = new MathedRowSt(nc+1);
|
||||||
MathedXIter it(this);
|
MathedXIter it(this);
|
||||||
for (int i=1; i<n; i++) it.addRow();
|
for (int j = 1; j < n; j++) it.addRow();
|
||||||
nr = n;
|
nr = n;
|
||||||
if (nr==1 && nc>1) {
|
if (nr==1 && nc>1) {
|
||||||
for (int i=0; i<nc-1; i++)
|
for (int j = 0; j < nc - 1; j++)
|
||||||
it.Insert('T', LM_TC_TAB);
|
it.Insert('T', LM_TC_TAB);
|
||||||
}
|
}
|
||||||
} else if (n<0) {
|
} else if (n<0) {
|
||||||
@ -515,8 +515,8 @@ MathedInset *MathAccentInset::Clone()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathBigopInset::MathBigopInset(char const* name, int id, short st):
|
MathBigopInset::MathBigopInset(char const* nam, int id, short st):
|
||||||
MathedInset(name, LM_OT_BIGOP, st), sym(id)
|
MathedInset(nam, LM_OT_BIGOP, st), sym(id)
|
||||||
{
|
{
|
||||||
lims = -1;
|
lims = -1;
|
||||||
}
|
}
|
||||||
@ -527,8 +527,8 @@ MathedInset *MathBigopInset::Clone()
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
MathDotsInset::MathDotsInset(char const* name, int id, short st):
|
MathDotsInset::MathDotsInset(char const* nam, int id, short st):
|
||||||
MathedInset(name, LM_OT_DOTS, st), code(id)
|
MathedInset(nam, LM_OT_DOTS, st), code(id)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ void MathedIter::Insert(MathedInset* p, int type)
|
|||||||
// array->bf[pos-1] = type;
|
// array->bf[pos-1] = type;
|
||||||
{
|
{
|
||||||
unsigned char *pt = &array->bf[pos];
|
unsigned char *pt = &array->bf[pos];
|
||||||
unsigned char *ps = (unsigned char *)&p;
|
unsigned char *ps = reinterpret_cast<unsigned char*>(&p);
|
||||||
size_t i;
|
size_t i;
|
||||||
*pt++ = type;
|
*pt++ = type;
|
||||||
for(i = 0; i < sizeof(p); i++) {
|
for(i = 0; i < sizeof(p); i++) {
|
||||||
@ -574,9 +574,9 @@ void MathedXIter::SetData(MathParInset *pp)
|
|||||||
byte* MathedXIter::GetString(int& ls)
|
byte* MathedXIter::GetString(int& ls)
|
||||||
{
|
{
|
||||||
static byte s[255];
|
static byte s[255];
|
||||||
byte const *sx = MathedIter::GetString(ls);
|
byte const *sxs = MathedIter::GetString(ls);
|
||||||
if (ls>0) {
|
if (ls>0) {
|
||||||
strncpy((char *)s, (char const*)sx, ls);
|
strncpy(reinterpret_cast<char*>(s), reinterpret_cast<const char*>(sxs), ls);
|
||||||
x += mathed_string_width(fcode, size, s, ls);
|
x += mathed_string_width(fcode, size, s, ls);
|
||||||
return &s[0];
|
return &s[0];
|
||||||
}
|
}
|
||||||
@ -862,7 +862,7 @@ void MathedXIter::IMetrics(int pos2, int& width, int& ascent, int& descent)
|
|||||||
byte cx, cxp=0;// *s;
|
byte cx, cxp=0;// *s;
|
||||||
int x1;// ls;
|
int x1;// ls;
|
||||||
int asc=0, des=0;
|
int asc=0, des=0;
|
||||||
bool limits = false;
|
bool limit = false;
|
||||||
|
|
||||||
descent = ascent = width = 0;
|
descent = ascent = width = 0;
|
||||||
if (!array) return;
|
if (!array) return;
|
||||||
@ -875,7 +875,7 @@ void MathedXIter::IMetrics(int pos2, int& width, int& ascent, int& descent)
|
|||||||
mathed_char_height(FCode(), size, cx, asc, des);
|
mathed_char_height(FCode(), size, cx, asc, des);
|
||||||
if (asc > ascent) ascent = asc;
|
if (asc > ascent) ascent = asc;
|
||||||
if (des > descent) descent = des;
|
if (des > descent) descent = des;
|
||||||
limits = false;
|
limit = false;
|
||||||
} else
|
} else
|
||||||
if (MathIsInset(cx)) {
|
if (MathIsInset(cx)) {
|
||||||
MathedInset *pp = GetInset();
|
MathedInset *pp = GetInset();
|
||||||
@ -883,7 +883,7 @@ void MathedXIter::IMetrics(int pos2, int& width, int& ascent, int& descent)
|
|||||||
if (!asc && p) {
|
if (!asc && p) {
|
||||||
int xx, yy;
|
int xx, yy;
|
||||||
p->GetXY(xx, yy);
|
p->GetXY(xx, yy);
|
||||||
((MathParInset*)pp)->GetXY(xx, asc);
|
static_cast<MathParInset*>(pp)->GetXY(xx, asc);
|
||||||
asc = yy - asc;
|
asc = yy - asc;
|
||||||
}
|
}
|
||||||
asc += ((limits) ? pp->Height()+4: pp->Ascent());
|
asc += ((limits) ? pp->Height()+4: pp->Ascent());
|
||||||
@ -892,12 +892,12 @@ void MathedXIter::IMetrics(int pos2, int& width, int& ascent, int& descent)
|
|||||||
if (!des && p) {
|
if (!des && p) {
|
||||||
int xx, yy;
|
int xx, yy;
|
||||||
p->GetXY(xx, yy);
|
p->GetXY(xx, yy);
|
||||||
((MathParInset*)pp)->GetXY(xx, des);
|
static_cast<MathParInset*>(pp)->GetXY(xx, des);
|
||||||
if (des-pp->Height()<yy && !asc)
|
if (des-pp->Height()<yy && !asc)
|
||||||
asc = yy - (des-pp->Height());
|
asc = yy - (des-pp->Height());
|
||||||
des -= yy;
|
des -= yy;
|
||||||
}
|
}
|
||||||
des += ((limits) ? pp->Height()+4: pp->Height()-pp->Ascent()/2);
|
des += (limit ? pp->Height()+4: pp->Height()-pp->Ascent()/2);
|
||||||
} else {
|
} else {
|
||||||
asc = pp->Ascent();
|
asc = pp->Ascent();
|
||||||
des = pp->Descent();
|
des = pp->Descent();
|
||||||
@ -905,10 +905,10 @@ void MathedXIter::IMetrics(int pos2, int& width, int& ascent, int& descent)
|
|||||||
if (asc > ascent) ascent = asc;
|
if (asc > ascent) ascent = asc;
|
||||||
if (des > descent) descent = des;
|
if (des > descent) descent = des;
|
||||||
if (cx!=LM_TC_UP && cx!=LM_TC_DOWN)
|
if (cx!=LM_TC_UP && cx!=LM_TC_DOWN)
|
||||||
limits = pp->GetLimits();
|
limit = pp->GetLimits();
|
||||||
} else
|
} else
|
||||||
if (cx==LM_TC_TAB) {
|
if (cx==LM_TC_TAB) {
|
||||||
limits = false;
|
limit = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lyxerr[Debug::MATHED]
|
lyxerr[Debug::MATHED]
|
||||||
@ -916,7 +916,7 @@ void MathedXIter::IMetrics(int pos2, int& width, int& ascent, int& descent)
|
|||||||
<< cx << ']' << endl;
|
<< cx << ']' << endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (pos<pos2) Next();
|
if (pos < pos2) Next();
|
||||||
cxp = cx;
|
cxp = cx;
|
||||||
}
|
}
|
||||||
width = x - x1;
|
width = x - x1;
|
||||||
@ -953,7 +953,7 @@ MathedRowSt *MathedXIter::adjustVerticalSt()
|
|||||||
crow = new MathedRowSt(ncols+1); // this leaks
|
crow = new MathedRowSt(ncols+1); // this leaks
|
||||||
}
|
}
|
||||||
// lyxerr<< " CRW[" << crow << "] ";
|
// lyxerr<< " CRW[" << crow << "] ";
|
||||||
MathedRowSt *row = crow;
|
MathedRowSt *mrow = crow;
|
||||||
while (OK()) {
|
while (OK()) {
|
||||||
if (IsCR()) {
|
if (IsCR()) {
|
||||||
if (col>=ncols) ncols = col+1;
|
if (col>=ncols) ncols = col+1;
|
||||||
@ -965,6 +965,6 @@ MathedRowSt *MathedXIter::adjustVerticalSt()
|
|||||||
}
|
}
|
||||||
Next();
|
Next();
|
||||||
}
|
}
|
||||||
return row;
|
return mrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
244
src/menus.C
244
src/menus.C
@ -45,8 +45,9 @@
|
|||||||
#include "lyxrc.h"
|
#include "lyxrc.h"
|
||||||
#include "lyxtext.h"
|
#include "lyxtext.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
#include "layout.h"
|
||||||
|
|
||||||
extern FD_form_screen *fd_form_screen;
|
extern FD_form_screen * fd_form_screen;
|
||||||
extern BufferList bufferlist;
|
extern BufferList bufferlist;
|
||||||
|
|
||||||
// I would really prefere to see most or all of these 'extern's disappear.
|
// I would really prefere to see most or all of these 'extern's disappear.
|
||||||
@ -55,7 +56,7 @@ extern BufferList bufferlist;
|
|||||||
extern void MenuLayoutSave();
|
extern void MenuLayoutSave();
|
||||||
extern void ShowCredits();
|
extern void ShowCredits();
|
||||||
extern void ShowCopyright();
|
extern void ShowCopyright();
|
||||||
extern void show_symbols_form(LyXFunc*);
|
extern void show_symbols_form(LyXFunc *);
|
||||||
extern void BeforeChange();
|
extern void BeforeChange();
|
||||||
extern void ProhibitInput();
|
extern void ProhibitInput();
|
||||||
extern void AllowInput();
|
extern void AllowInput();
|
||||||
@ -66,53 +67,53 @@ extern void LaTeXOptions();
|
|||||||
|
|
||||||
// A bunch of wrappers
|
// A bunch of wrappers
|
||||||
|
|
||||||
extern "C" void C_Menus_ShowFileMenu(FL_OBJECT *ob, long data)
|
extern "C" void C_Menus_ShowFileMenu(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
Menus::ShowFileMenu(ob, data);
|
Menus::ShowFileMenu(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_Menus_ShowFileMenu2(FL_OBJECT *ob, long data)
|
extern "C" void C_Menus_ShowFileMenu2(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
Menus::ShowFileMenu2(ob, data);
|
Menus::ShowFileMenu2(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_Menus_ShowEditMenu(FL_OBJECT *ob, long data)
|
extern "C" void C_Menus_ShowEditMenu(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
Menus::ShowEditMenu(ob, data);
|
Menus::ShowEditMenu(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_Menus_ShowLayoutMenu(FL_OBJECT *ob, long data)
|
extern "C" void C_Menus_ShowLayoutMenu(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
Menus::ShowLayoutMenu(ob, data);
|
Menus::ShowLayoutMenu(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_Menus_ShowInsertMenu(FL_OBJECT *ob, long data)
|
extern "C" void C_Menus_ShowInsertMenu(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
Menus::ShowInsertMenu(ob, data);
|
Menus::ShowInsertMenu(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_Menus_ShowMathMenu(FL_OBJECT *ob, long data)
|
extern "C" void C_Menus_ShowMathMenu(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
Menus::ShowMathMenu(ob, data);
|
Menus::ShowMathMenu(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_Menus_ShowOptionsMenu(FL_OBJECT *ob, long data)
|
extern "C" void C_Menus_ShowOptionsMenu(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
Menus::ShowOptionsMenu(ob, data);
|
Menus::ShowOptionsMenu(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_Menus_ShowBufferMenu(FL_OBJECT *ob, long data)
|
extern "C" void C_Menus_ShowBufferMenu(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
Menus::ShowBufferMenu(ob, data);
|
Menus::ShowBufferMenu(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C" void C_Menus_ShowHelpMenu(FL_OBJECT *ob, long data)
|
extern "C" void C_Menus_ShowHelpMenu(FL_OBJECT * ob, long data)
|
||||||
{
|
{
|
||||||
Menus::ShowHelpMenu(ob, data);
|
Menus::ShowHelpMenu(ob, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Menus::Menus(LyXView *view,int air)
|
Menus::Menus(LyXView * view, int air)
|
||||||
: _view(view)
|
: _view(view)
|
||||||
{
|
{
|
||||||
create_menus(air);
|
create_menus(air);
|
||||||
@ -132,7 +133,7 @@ Menus::Menus(LyXView *view,int air)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline BufferView *Menus::currentView()
|
inline BufferView * Menus::currentView()
|
||||||
{
|
{
|
||||||
return _view->currentView();
|
return _view->currentView();
|
||||||
}
|
}
|
||||||
@ -152,7 +153,7 @@ void Menus::hideMenus()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Menus::openByName(string const &menuName)
|
void Menus::openByName(string const & menuName)
|
||||||
/* Opens the visible menu of given name, or simply does nothing
|
/* Opens the visible menu of given name, or simply does nothing
|
||||||
when the name is not known. NOTE THE EXTREMELY STUPID
|
when the name is not known. NOTE THE EXTREMELY STUPID
|
||||||
IMPLEMENTATION! :-) There are probably hundred ways to do
|
IMPLEMENTATION! :-) There are probably hundred ways to do
|
||||||
@ -161,20 +162,31 @@ void Menus::openByName(string const &menuName)
|
|||||||
experienced GG (GUI Guy/Girl). RVDK_PATCH_5. */
|
experienced GG (GUI Guy/Girl). RVDK_PATCH_5. */
|
||||||
{
|
{
|
||||||
if (menu_file->visible) {
|
if (menu_file->visible) {
|
||||||
if (menuName == _("File")) ShowFileMenu(menu_file, 0);
|
if (menuName == _("File"))
|
||||||
else if (menuName == _("Edit")) ShowEditMenu(menu_edit, 0);
|
ShowFileMenu(menu_file, 0);
|
||||||
else if (menuName == _("Layout")) ShowLayoutMenu(menu_layout, 0);
|
else if (menuName == _("Edit"))
|
||||||
else if (menuName == _("Insert")) ShowInsertMenu(menu_insert, 0);
|
ShowEditMenu(menu_edit, 0);
|
||||||
else if (menuName == _("Math")) ShowMathMenu(menu_math, 0);
|
else if (menuName == _("Layout"))
|
||||||
else if (menuName == _("Options")) ShowOptionsMenu(menu_options, 0);
|
ShowLayoutMenu(menu_layout, 0);
|
||||||
else if (menuName == _("Documents")) ShowBufferMenu(menu_buffer, 0);
|
else if (menuName == _("Insert"))
|
||||||
else if (menuName == _("Help")) ShowHelpMenu(menu_help, 0);
|
ShowInsertMenu(menu_insert, 0);
|
||||||
|
else if (menuName == _("Math"))
|
||||||
|
ShowMathMenu(menu_math, 0);
|
||||||
|
else if (menuName == _("Options"))
|
||||||
|
ShowOptionsMenu(menu_options, 0);
|
||||||
|
else if (menuName == _("Documents"))
|
||||||
|
ShowBufferMenu(menu_buffer, 0);
|
||||||
|
else if (menuName == _("Help"))
|
||||||
|
ShowHelpMenu(menu_help, 0);
|
||||||
else lyxerr << "The menu '" << menuName
|
else lyxerr << "The menu '" << menuName
|
||||||
<< "' is not available." << endl;
|
<< "' is not available." << endl;
|
||||||
} else {
|
} else {
|
||||||
if (menuName == _("File")) ShowFileMenu2(menu_file2, 0);
|
if (menuName == _("File"))
|
||||||
else if (menuName == _("Options")) ShowOptionsMenu(menu_options2, 0);
|
ShowFileMenu2(menu_file2, 0);
|
||||||
else if (menuName == _("Help")) ShowHelpMenu(menu_help2, 0);
|
else if (menuName == _("Options"))
|
||||||
|
ShowOptionsMenu(menu_options2, 0);
|
||||||
|
else if (menuName == _("Help"))
|
||||||
|
ShowHelpMenu(menu_help2, 0);
|
||||||
else lyxerr << "The menu '" << menuName
|
else lyxerr << "The menu '" << menuName
|
||||||
<< "' is not available." << endl;
|
<< "' is not available." << endl;
|
||||||
}
|
}
|
||||||
@ -183,11 +195,11 @@ void Menus::openByName(string const &menuName)
|
|||||||
|
|
||||||
void Menus::create_menus(int air)
|
void Menus::create_menus(int air)
|
||||||
{
|
{
|
||||||
FL_FORM *form = _view->getForm();
|
FL_FORM * form = _view->getForm();
|
||||||
|
|
||||||
// Here I'd really like to see code like:
|
// Here I'd really like to see code like:
|
||||||
// addMenuBar();
|
// addMenuBar();
|
||||||
FL_OBJECT *obj;
|
FL_OBJECT * obj;
|
||||||
|
|
||||||
const int MENU_LABEL_SIZE = FL_NORMAL_SIZE;
|
const int MENU_LABEL_SIZE = FL_NORMAL_SIZE;
|
||||||
const int mheight = 30;
|
const int mheight = 30;
|
||||||
@ -216,7 +228,7 @@ void Menus::create_menus(int air)
|
|||||||
moffset += obj->w + air;
|
moffset += obj->w + air;
|
||||||
fl_set_object_shortcut(obj, scex(_("MB|#F")), 1);
|
fl_set_object_shortcut(obj, scex(_("MB|#F")), 1);
|
||||||
fl_set_object_callback(obj,C_Menus_ShowFileMenu, 0);
|
fl_set_object_callback(obj,C_Menus_ShowFileMenu, 0);
|
||||||
obj->u_ldata = (long)this;
|
obj->u_vdata = this;
|
||||||
|
|
||||||
// Edit menu button
|
// Edit menu button
|
||||||
menu_edit = obj =
|
menu_edit = obj =
|
||||||
@ -230,7 +242,7 @@ void Menus::create_menus(int air)
|
|||||||
moffset += obj->w + air;
|
moffset += obj->w + air;
|
||||||
fl_set_object_shortcut(obj, scex(_("MB|#E")),1);
|
fl_set_object_shortcut(obj, scex(_("MB|#E")),1);
|
||||||
fl_set_object_callback(obj,C_Menus_ShowEditMenu,0);
|
fl_set_object_callback(obj,C_Menus_ShowEditMenu,0);
|
||||||
obj->u_ldata = (long) this;
|
obj->u_vdata = this;
|
||||||
|
|
||||||
// Layout menu button
|
// Layout menu button
|
||||||
menu_layout = obj =
|
menu_layout = obj =
|
||||||
@ -244,7 +256,7 @@ void Menus::create_menus(int air)
|
|||||||
moffset += obj->w + air;
|
moffset += obj->w + air;
|
||||||
fl_set_object_shortcut(obj, scex(_("MB|#L")), 1);
|
fl_set_object_shortcut(obj, scex(_("MB|#L")), 1);
|
||||||
fl_set_object_callback(obj,C_Menus_ShowLayoutMenu,0);
|
fl_set_object_callback(obj,C_Menus_ShowLayoutMenu,0);
|
||||||
obj->u_ldata = (long) this;
|
obj->u_vdata = this;
|
||||||
|
|
||||||
// Insert menu button button
|
// Insert menu button button
|
||||||
menu_insert = obj =
|
menu_insert = obj =
|
||||||
@ -258,7 +270,7 @@ void Menus::create_menus(int air)
|
|||||||
moffset += obj->w + air;
|
moffset += obj->w + air;
|
||||||
fl_set_object_shortcut(obj, scex(_("MB|#I")), 1);
|
fl_set_object_shortcut(obj, scex(_("MB|#I")), 1);
|
||||||
fl_set_object_callback(obj,C_Menus_ShowInsertMenu,0);
|
fl_set_object_callback(obj,C_Menus_ShowInsertMenu,0);
|
||||||
obj->u_ldata = (long) this;
|
obj->u_vdata = this;
|
||||||
|
|
||||||
// Math menu button
|
// Math menu button
|
||||||
menu_math = obj =
|
menu_math = obj =
|
||||||
@ -272,7 +284,7 @@ void Menus::create_menus(int air)
|
|||||||
moffset += obj->w + air;
|
moffset += obj->w + air;
|
||||||
fl_set_object_shortcut(obj, scex(_("MB|#M")), 1);
|
fl_set_object_shortcut(obj, scex(_("MB|#M")), 1);
|
||||||
fl_set_object_callback(obj,C_Menus_ShowMathMenu,0);
|
fl_set_object_callback(obj,C_Menus_ShowMathMenu,0);
|
||||||
obj->u_ldata = (long) this;
|
obj->u_vdata = this;
|
||||||
|
|
||||||
// Options menu button
|
// Options menu button
|
||||||
menu_options = obj =
|
menu_options = obj =
|
||||||
@ -286,7 +298,7 @@ void Menus::create_menus(int air)
|
|||||||
moffset += obj->w + air;
|
moffset += obj->w + air;
|
||||||
fl_set_object_shortcut(obj, scex(_("MB|#O")), 1);
|
fl_set_object_shortcut(obj, scex(_("MB|#O")), 1);
|
||||||
fl_set_object_callback(obj,C_Menus_ShowOptionsMenu, 0);
|
fl_set_object_callback(obj,C_Menus_ShowOptionsMenu, 0);
|
||||||
obj->u_ldata = (long) this;
|
obj->u_vdata = this;
|
||||||
|
|
||||||
// Documents menu button
|
// Documents menu button
|
||||||
menu_buffer = obj =
|
menu_buffer = obj =
|
||||||
@ -300,7 +312,7 @@ void Menus::create_menus(int air)
|
|||||||
moffset += obj->w + air;
|
moffset += obj->w + air;
|
||||||
fl_set_object_shortcut(obj, scex(_("MB|#D")), 1);
|
fl_set_object_shortcut(obj, scex(_("MB|#D")), 1);
|
||||||
fl_set_object_callback(obj,C_Menus_ShowBufferMenu,0);
|
fl_set_object_callback(obj,C_Menus_ShowBufferMenu,0);
|
||||||
obj->u_ldata = (long) this;
|
obj->u_vdata = this;
|
||||||
|
|
||||||
// Help menu button
|
// Help menu button
|
||||||
menu_help = obj =
|
menu_help = obj =
|
||||||
@ -314,7 +326,7 @@ void Menus::create_menus(int air)
|
|||||||
moffset += obj->w + air;
|
moffset += obj->w + air;
|
||||||
fl_set_object_shortcut(obj, scex(_("MB|#H")), 1);
|
fl_set_object_shortcut(obj, scex(_("MB|#H")), 1);
|
||||||
fl_set_object_callback(obj,C_Menus_ShowHelpMenu,0);
|
fl_set_object_callback(obj,C_Menus_ShowHelpMenu,0);
|
||||||
obj->u_ldata = (long) this;
|
obj->u_vdata = this;
|
||||||
|
|
||||||
fl_end_group();
|
fl_end_group();
|
||||||
|
|
||||||
@ -347,7 +359,7 @@ void Menus::create_menus(int air)
|
|||||||
moffset += obj->w + air;
|
moffset += obj->w + air;
|
||||||
fl_set_object_shortcut(obj, scex(_("MB|#F")), 1);
|
fl_set_object_shortcut(obj, scex(_("MB|#F")), 1);
|
||||||
fl_set_object_callback(obj,C_Menus_ShowFileMenu2, 0);
|
fl_set_object_callback(obj,C_Menus_ShowFileMenu2, 0);
|
||||||
obj->u_ldata = (long)this;
|
obj->u_vdata = this;
|
||||||
|
|
||||||
// Options menu button
|
// Options menu button
|
||||||
menu_options2 = obj =
|
menu_options2 = obj =
|
||||||
@ -361,7 +373,7 @@ void Menus::create_menus(int air)
|
|||||||
moffset += obj->w + air;
|
moffset += obj->w + air;
|
||||||
fl_set_object_shortcut(obj, scex(_("MB|#O")), 1);
|
fl_set_object_shortcut(obj, scex(_("MB|#O")), 1);
|
||||||
fl_set_object_callback(obj,C_Menus_ShowOptionsMenu, 0);
|
fl_set_object_callback(obj,C_Menus_ShowOptionsMenu, 0);
|
||||||
obj->u_ldata = (long) this;
|
obj->u_vdata = this;
|
||||||
|
|
||||||
// Help menu button
|
// Help menu button
|
||||||
menu_help2 = obj =
|
menu_help2 = obj =
|
||||||
@ -375,7 +387,7 @@ void Menus::create_menus(int air)
|
|||||||
moffset += obj->w + air;
|
moffset += obj->w + air;
|
||||||
fl_set_object_shortcut(obj, scex(_("MB|#H")), 1);
|
fl_set_object_shortcut(obj, scex(_("MB|#H")), 1);
|
||||||
fl_set_object_callback(obj,C_Menus_ShowHelpMenu,0);
|
fl_set_object_callback(obj,C_Menus_ShowHelpMenu,0);
|
||||||
obj->u_ldata = (long) this;
|
obj->u_vdata = this;
|
||||||
|
|
||||||
fl_end_group();
|
fl_end_group();
|
||||||
|
|
||||||
@ -429,9 +441,9 @@ void Menus::ScreenOptions()
|
|||||||
// Here comes all the menu callbacks.
|
// Here comes all the menu callbacks.
|
||||||
//
|
//
|
||||||
|
|
||||||
void Menus::ShowFileMenu(FL_OBJECT *ob, long)
|
void Menus::ShowFileMenu(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
Menus *men = (Menus*) ob->u_ldata;
|
Menus * men = static_cast<Menus*>(ob->u_vdata);
|
||||||
|
|
||||||
// Regarding the pseudo-menu-button:
|
// Regarding the pseudo-menu-button:
|
||||||
// ok, ok this is a hack. It would be better to use the menus of the
|
// ok, ok this is a hack. It would be better to use the menus of the
|
||||||
@ -446,8 +458,8 @@ void Menus::ShowFileMenu(FL_OBJECT *ob, long)
|
|||||||
fl_set_button(ob, 0);
|
fl_set_button(ob, 0);
|
||||||
fl_redraw_object(ob);
|
fl_redraw_object(ob);
|
||||||
|
|
||||||
Buffer *tmpbuffer = men->_view->currentBuffer();
|
Buffer * tmpbuffer = men->_view->currentBuffer();
|
||||||
LyXFunc *tmpfunc = men->_view->getLyXFunc();
|
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||||
|
|
||||||
bool LinuxDoc = tmpbuffer->isLinuxDoc();
|
bool LinuxDoc = tmpbuffer->isLinuxDoc();
|
||||||
bool DocBook = tmpbuffer->isDocBook();
|
bool DocBook = tmpbuffer->isDocBook();
|
||||||
@ -455,12 +467,13 @@ void Menus::ShowFileMenu(FL_OBJECT *ob, long)
|
|||||||
|
|
||||||
// Import sub-menu
|
// Import sub-menu
|
||||||
|
|
||||||
int SubFileImport =fl_defpup(FL_ObjWin(ob),
|
int SubFileImport = fl_defpup(FL_ObjWin(ob),
|
||||||
_("Import%t"
|
_("Import%t"
|
||||||
"|LaTeX...%x30"
|
"|LaTeX...%x30"
|
||||||
"|Ascii Text as Lines...%x31"
|
"|Ascii Text as Lines...%x31"
|
||||||
"|Ascii Text as Paragraphs%x32"
|
"|Ascii Text as Paragraphs%x32"
|
||||||
"|Noweb%x33"));
|
"|Noweb%x33"));
|
||||||
|
|
||||||
fl_setpup_shortcut(SubFileImport, 30, scex(_("FIM|Ll#l#L")));
|
fl_setpup_shortcut(SubFileImport, 30, scex(_("FIM|Ll#l#L")));
|
||||||
fl_setpup_shortcut(SubFileImport, 31, scex(_("FIM|Aa#a#A")));
|
fl_setpup_shortcut(SubFileImport, 31, scex(_("FIM|Aa#a#A")));
|
||||||
fl_setpup_shortcut(SubFileImport, 32, scex(_("FIM|Pp#p#P")));
|
fl_setpup_shortcut(SubFileImport, 32, scex(_("FIM|Pp#p#P")));
|
||||||
@ -589,20 +602,14 @@ void Menus::ShowFileMenu(FL_OBJECT *ob, long)
|
|||||||
fl_setpup_shortcut(FileMenu, 17, scex(_("FM|xX#x#X")));
|
fl_setpup_shortcut(FileMenu, 17, scex(_("FM|xX#x#X")));
|
||||||
|
|
||||||
// make the lastfiles menu
|
// make the lastfiles menu
|
||||||
LastFiles_Iter liter(*lastfiles); // :-)
|
|
||||||
string filname;
|
|
||||||
int ii = 1;
|
int ii = 1;
|
||||||
while( ii < 10 && !(filname = liter()).empty() ) {
|
for (LastFiles::Files::const_iterator cit = lastfiles->begin();
|
||||||
string tmp;
|
cit != lastfiles->end() && ii < 10; ++cit, ++ii) {
|
||||||
string tmp2;
|
string tmp = tostr(ii);
|
||||||
string relbuf = MakeDisplayPath(filname,30);
|
string tmp2 = tmp + "#" + tmp;;
|
||||||
tmp += tostr(ii);
|
tmp += ". " + MakeDisplayPath((*cit), 30);
|
||||||
tmp2 = tmp;
|
|
||||||
tmp += ". " + relbuf;
|
|
||||||
tmp2 += string("#") + tostr(ii);
|
|
||||||
fl_addtopup(FileMenu, tmp.c_str());
|
fl_addtopup(FileMenu, tmp.c_str());
|
||||||
fl_setpup_shortcut(FileMenu, 18 - 1 + ii, tmp2.c_str());
|
fl_setpup_shortcut(FileMenu, 18 - 1 + ii, tmp2.c_str());
|
||||||
ii++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// place popup
|
// place popup
|
||||||
@ -665,7 +672,9 @@ void Menus::ShowFileMenu(FL_OBJECT *ob, long)
|
|||||||
// Lastfiles:
|
// Lastfiles:
|
||||||
case 18: // The first item with lastfiles.
|
case 18: // The first item with lastfiles.
|
||||||
default:
|
default:
|
||||||
men->currentView()->setBuffer(bufferlist.loadLyXFile(liter[choice-18])); // ok one more
|
men->currentView()
|
||||||
|
->setBuffer(bufferlist
|
||||||
|
.loadLyXFile((*lastfiles)[choice - 18]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fl_freepup(SubFileImport);
|
fl_freepup(SubFileImport);
|
||||||
@ -676,9 +685,9 @@ void Menus::ShowFileMenu(FL_OBJECT *ob, long)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Menus::ShowFileMenu2(FL_OBJECT *ob, long)
|
void Menus::ShowFileMenu2(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
Menus *men = (Menus*) ob->u_ldata;
|
Menus * men = static_cast<Menus*>(ob->u_vdata);
|
||||||
|
|
||||||
// Regarding the pseudo-menu-button:
|
// Regarding the pseudo-menu-button:
|
||||||
// ok, ok this is a hack. It would be better to use the menus of the
|
// ok, ok this is a hack. It would be better to use the menus of the
|
||||||
@ -693,7 +702,7 @@ void Menus::ShowFileMenu2(FL_OBJECT *ob, long)
|
|||||||
fl_set_button(ob, 0);
|
fl_set_button(ob, 0);
|
||||||
fl_redraw_object(ob);
|
fl_redraw_object(ob);
|
||||||
|
|
||||||
LyXFunc *tmpfunc = men->_view->getLyXFunc();
|
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||||
|
|
||||||
// Import sub-menu
|
// Import sub-menu
|
||||||
|
|
||||||
@ -703,6 +712,7 @@ void Menus::ShowFileMenu2(FL_OBJECT *ob, long)
|
|||||||
"|Ascii Text as Lines...%x16"
|
"|Ascii Text as Lines...%x16"
|
||||||
"|Ascii Text as Paragraphs...%x17"
|
"|Ascii Text as Paragraphs...%x17"
|
||||||
"|Noweb...%x18"));
|
"|Noweb...%x18"));
|
||||||
|
|
||||||
fl_setpup_shortcut(SubFileImport, 15, scex(_("FIM|Ll#l#L")));
|
fl_setpup_shortcut(SubFileImport, 15, scex(_("FIM|Ll#l#L")));
|
||||||
fl_setpup_shortcut(SubFileImport, 16, scex(_("FIM|Aa#a#A")));
|
fl_setpup_shortcut(SubFileImport, 16, scex(_("FIM|Aa#a#A")));
|
||||||
fl_setpup_shortcut(SubFileImport, 17, scex(_("FIM|Pp#p#P")));
|
fl_setpup_shortcut(SubFileImport, 17, scex(_("FIM|Pp#p#P")));
|
||||||
@ -722,6 +732,7 @@ void Menus::ShowFileMenu2(FL_OBJECT *ob, long)
|
|||||||
"|Open...%l"
|
"|Open...%l"
|
||||||
"|Import%m%l"
|
"|Import%m%l"
|
||||||
"|Exit%l"), SubFileImport);
|
"|Exit%l"), SubFileImport);
|
||||||
|
|
||||||
fl_setpup_shortcut(FileMenu, 1, scex(_("FM|Nn#n#N")));
|
fl_setpup_shortcut(FileMenu, 1, scex(_("FM|Nn#n#N")));
|
||||||
fl_setpup_shortcut(FileMenu, 2, scex(_("FM|tT#t#T")));
|
fl_setpup_shortcut(FileMenu, 2, scex(_("FM|tT#t#T")));
|
||||||
fl_setpup_shortcut(FileMenu, 3, scex(_("FM|Oo#o#O")));
|
fl_setpup_shortcut(FileMenu, 3, scex(_("FM|Oo#o#O")));
|
||||||
@ -729,20 +740,14 @@ void Menus::ShowFileMenu2(FL_OBJECT *ob, long)
|
|||||||
fl_setpup_shortcut(FileMenu, 5, scex(_("FM|xX#x#X")));
|
fl_setpup_shortcut(FileMenu, 5, scex(_("FM|xX#x#X")));
|
||||||
|
|
||||||
// make the lastfiles menu
|
// make the lastfiles menu
|
||||||
LastFiles_Iter liter(*lastfiles); // :-)
|
|
||||||
string filname;
|
|
||||||
int ii = 1;
|
int ii = 1;
|
||||||
while( ii < 10 && !(filname = liter()).empty() ) {
|
for (LastFiles::Files::const_iterator cit = lastfiles->begin();
|
||||||
string tmp;
|
cit != lastfiles->end() && ii < 10; ++cit, ++ii) {
|
||||||
string tmp2;
|
string tmp = tostr(ii);
|
||||||
string relbuf = MakeDisplayPath(filname,30);
|
string tmp2 = tmp + "#" + tmp;;
|
||||||
tmp += tostr(ii);
|
tmp += ". " + MakeDisplayPath((*cit), 30);
|
||||||
tmp2 = tmp;
|
|
||||||
tmp += ". " + relbuf;
|
|
||||||
tmp2 += string("#") + tostr(ii);
|
|
||||||
fl_addtopup(FileMenu, tmp.c_str());
|
fl_addtopup(FileMenu, tmp.c_str());
|
||||||
fl_setpup_shortcut(FileMenu, 6 - 1 + ii, tmp2.c_str());
|
fl_setpup_shortcut(FileMenu, 18 - 1 + ii, tmp2.c_str());
|
||||||
ii++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// place popup
|
// place popup
|
||||||
@ -781,8 +786,11 @@ void Menus::ShowFileMenu2(FL_OBJECT *ob, long)
|
|||||||
tmpfunc->Dispatch(LFUN_QUIT);
|
tmpfunc->Dispatch(LFUN_QUIT);
|
||||||
break;
|
break;
|
||||||
// Lastfiles:
|
// Lastfiles:
|
||||||
|
case 6: // The first item with lastfiles.
|
||||||
default:
|
default:
|
||||||
men->currentView()->setBuffer(bufferlist.loadLyXFile(liter[choice-6]));
|
men->currentView()
|
||||||
|
->setBuffer(bufferlist
|
||||||
|
.loadLyXFile((*lastfiles)[choice - 6]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -793,17 +801,17 @@ void Menus::ShowFileMenu2(FL_OBJECT *ob, long)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Menus::ShowEditMenu(FL_OBJECT *ob, long)
|
void Menus::ShowEditMenu(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
Menus *men = (Menus*) ob->u_ldata;
|
Menus * men = static_cast<Menus*>(ob->u_vdata);
|
||||||
|
|
||||||
// set the pseudo menu-button
|
// set the pseudo menu-button
|
||||||
fl_set_object_boxtype(ob, FL_UP_BOX);
|
fl_set_object_boxtype(ob, FL_UP_BOX);
|
||||||
fl_set_button(ob, 0);
|
fl_set_button(ob, 0);
|
||||||
fl_redraw_object(ob);
|
fl_redraw_object(ob);
|
||||||
|
|
||||||
Buffer *tmpbuffer = men->_view->currentBuffer();
|
Buffer * tmpbuffer = men->_view->currentBuffer();
|
||||||
LyXFunc *tmpfunc = men->_view->getLyXFunc();
|
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||||
|
|
||||||
// Floats & Insets submenu
|
// Floats & Insets submenu
|
||||||
int SubEditFloats=fl_defpup(FL_ObjWin(ob),
|
int SubEditFloats=fl_defpup(FL_ObjWin(ob),
|
||||||
@ -814,8 +822,8 @@ void Menus::ShowEditMenu(FL_OBJECT *ob, long)
|
|||||||
"|Close All Footnotes/Margin Notes%x24"
|
"|Close All Footnotes/Margin Notes%x24"
|
||||||
"|Open All Figures/Tables%x25"
|
"|Open All Figures/Tables%x25"
|
||||||
"|Close All Figures/Tables%x26%l"
|
"|Close All Figures/Tables%x26%l"
|
||||||
"|Remove all Error Boxes%x27")
|
"|Remove all Error Boxes%x27"));
|
||||||
);
|
|
||||||
fl_setpup_shortcut(SubEditFloats, 21, scex(_("EMF|Oo#o#O")));
|
fl_setpup_shortcut(SubEditFloats, 21, scex(_("EMF|Oo#o#O")));
|
||||||
fl_setpup_shortcut(SubEditFloats, 22, scex(_("EMF|Mm#m#M")));
|
fl_setpup_shortcut(SubEditFloats, 22, scex(_("EMF|Mm#m#M")));
|
||||||
fl_setpup_shortcut(SubEditFloats, 23, scex(_("EMF|Aa#a#A")));
|
fl_setpup_shortcut(SubEditFloats, 23, scex(_("EMF|Aa#a#A")));
|
||||||
@ -1115,9 +1123,9 @@ void Menus::ShowEditMenu(FL_OBJECT *ob, long)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Menus::ShowLayoutMenu(FL_OBJECT *ob, long)
|
void Menus::ShowLayoutMenu(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
Menus *men = (Menus*) ob->u_ldata;
|
Menus * men = static_cast<Menus*>(ob->u_vdata);
|
||||||
|
|
||||||
if (!men->currentView()->available())
|
if (!men->currentView()->available())
|
||||||
return;
|
return;
|
||||||
@ -1127,8 +1135,8 @@ void Menus::ShowLayoutMenu(FL_OBJECT *ob, long)
|
|||||||
fl_set_button(ob, 0);
|
fl_set_button(ob, 0);
|
||||||
fl_redraw_object(ob);
|
fl_redraw_object(ob);
|
||||||
|
|
||||||
Buffer *tmpbuffer = men->_view->currentBuffer();
|
Buffer * tmpbuffer = men->_view->currentBuffer();
|
||||||
LyXFunc *tmpfunc = men->_view->getLyXFunc();
|
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||||
|
|
||||||
int LayoutMenu = fl_newpup(FL_ObjWin(ob));
|
int LayoutMenu = fl_newpup(FL_ObjWin(ob));
|
||||||
fl_addtopup(LayoutMenu, _("Character..."
|
fl_addtopup(LayoutMenu, _("Character..."
|
||||||
@ -1202,33 +1210,29 @@ void Menus::ShowLayoutMenu(FL_OBJECT *ob, long)
|
|||||||
case 10: tmpfunc->Dispatch(LFUN_TEX); break;
|
case 10: tmpfunc->Dispatch(LFUN_TEX); break;
|
||||||
case 11: tmpfunc->Dispatch(LFUN_DEPTH_PLUS); break;
|
case 11: tmpfunc->Dispatch(LFUN_DEPTH_PLUS); break;
|
||||||
case 12: tmpfunc->Dispatch(LFUN_LAYOUT_PREAMBLE); break;
|
case 12: tmpfunc->Dispatch(LFUN_LAYOUT_PREAMBLE); break;
|
||||||
case 13: tmpfunc->Dispatch(LFUN_LAYOUT_SAVE_DEFAULT); break;//MenuLayoutSave(); break;
|
case 13: tmpfunc->Dispatch(LFUN_LAYOUT_SAVE_DEFAULT); break;
|
||||||
}
|
}
|
||||||
fl_freepup(LayoutMenu);
|
fl_freepup(LayoutMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Menus::ShowInsertMenu(FL_OBJECT *ob, long /*data*/)
|
void Menus::ShowInsertMenu(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
Menus *men = (Menus*) ob->u_ldata;
|
Menus * men = static_cast<Menus*>(ob->u_vdata);
|
||||||
|
|
||||||
// set the pseudo menu-button
|
// set the pseudo menu-button
|
||||||
fl_set_object_boxtype(ob, FL_UP_BOX);
|
fl_set_object_boxtype(ob, FL_UP_BOX);
|
||||||
fl_set_button(ob, 0);
|
fl_set_button(ob, 0);
|
||||||
fl_redraw_object(ob);
|
fl_redraw_object(ob);
|
||||||
|
|
||||||
Buffer *tmpbuffer = men->_view->currentBuffer();
|
Buffer * tmpbuffer = men->_view->currentBuffer();
|
||||||
LyXFunc *tmpfunc = men->_view->getLyXFunc();
|
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||||
|
|
||||||
#if 0
|
|
||||||
// Is textclass LinuxDoc?
|
|
||||||
bool LinuxDoc = tmpbuffer->isLinuxDoc();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int SubInsertAscii = fl_defpup(FL_ObjWin(ob),
|
int SubInsertAscii = fl_defpup(FL_ObjWin(ob),
|
||||||
_("Import ASCII file%t"
|
_("Import ASCII file%t"
|
||||||
"|As Lines%x41"
|
"|As Lines%x41"
|
||||||
"|As Paragraphs%x42"));
|
"|As Paragraphs%x42"));
|
||||||
|
|
||||||
fl_setpup_shortcut(SubInsertAscii, 41, scex(_("IMA|Ll#l#L")));
|
fl_setpup_shortcut(SubInsertAscii, 41, scex(_("IMA|Ll#l#L")));
|
||||||
fl_setpup_shortcut(SubInsertAscii, 42, scex(_("IMA|Pp#p#P")));
|
fl_setpup_shortcut(SubInsertAscii, 42, scex(_("IMA|Pp#p#P")));
|
||||||
|
|
||||||
@ -1240,6 +1244,7 @@ void Menus::ShowInsertMenu(FL_OBJECT *ob, long /*data*/)
|
|||||||
"|List of Algorithms%x24"
|
"|List of Algorithms%x24"
|
||||||
"|Index List%x25"
|
"|Index List%x25"
|
||||||
"|BibTeX Reference%x26"));
|
"|BibTeX Reference%x26"));
|
||||||
|
|
||||||
fl_setpup_shortcut(SubInsertTableList, 21, scex(_("IMT|Cc#c#C")));
|
fl_setpup_shortcut(SubInsertTableList, 21, scex(_("IMT|Cc#c#C")));
|
||||||
fl_setpup_shortcut(SubInsertTableList, 22, scex(_("IMT|Ff#f#F")));
|
fl_setpup_shortcut(SubInsertTableList, 22, scex(_("IMT|Ff#f#F")));
|
||||||
fl_setpup_shortcut(SubInsertTableList, 23, scex(_("IMT|Tt#t#T")));
|
fl_setpup_shortcut(SubInsertTableList, 23, scex(_("IMT|Tt#t#T")));
|
||||||
@ -1247,30 +1252,21 @@ void Menus::ShowInsertMenu(FL_OBJECT *ob, long /*data*/)
|
|||||||
fl_setpup_shortcut(SubInsertTableList, 25, scex(_("IMT|Ii#i#I")));
|
fl_setpup_shortcut(SubInsertTableList, 25, scex(_("IMT|Ii#i#I")));
|
||||||
fl_setpup_shortcut(SubInsertTableList, 26, scex(_("IMT|Bb#b#B")));
|
fl_setpup_shortcut(SubInsertTableList, 26, scex(_("IMT|Bb#b#B")));
|
||||||
|
|
||||||
int SubInsertFloatList;
|
int SubInsertFloatList = fl_defpup(FL_ObjWin(ob),
|
||||||
//if (men->_view->currentBuffer()->params.columns == 1) {
|
|
||||||
// SubInsertFloatList = fl_defpup(FL_ObjWin(ob),
|
|
||||||
// _("Floats%t"
|
|
||||||
// "|Figure Float%x71"
|
|
||||||
// "|Table Float%l%x72"
|
|
||||||
// "|Algorithm Float%x73"));
|
|
||||||
//}
|
|
||||||
//else {
|
|
||||||
SubInsertFloatList = fl_defpup(FL_ObjWin(ob),
|
|
||||||
_("Floats%t"
|
_("Floats%t"
|
||||||
"|Figure Float%x71"
|
"|Figure Float%x71"
|
||||||
"|Table Float%x72"
|
"|Table Float%x72"
|
||||||
"|Wide Figure Float%x73"
|
"|Wide Figure Float%x73"
|
||||||
"|Wide Table Float%l%x74"
|
"|Wide Table Float%l%x74"
|
||||||
"|Algorithm Float%x75"));
|
"|Algorithm Float%x75"));
|
||||||
//}
|
|
||||||
fl_setpup_shortcut(SubInsertFloatList, 71, scex(_("IMF|gG#g#G")));
|
fl_setpup_shortcut(SubInsertFloatList, 71, scex(_("IMF|gG#g#G")));
|
||||||
fl_setpup_shortcut(SubInsertFloatList, 72, scex(_("IMF|Tt#t#T")));
|
fl_setpup_shortcut(SubInsertFloatList, 72, scex(_("IMF|Tt#t#T")));
|
||||||
fl_setpup_shortcut(SubInsertFloatList, 73, scex(_("IMF|Ww#w#W")));
|
fl_setpup_shortcut(SubInsertFloatList, 73, scex(_("IMF|Ww#w#W")));
|
||||||
fl_setpup_shortcut(SubInsertFloatList, 74, scex(_("IMF|iI#i#I")));
|
fl_setpup_shortcut(SubInsertFloatList, 74, scex(_("IMF|iI#i#I")));
|
||||||
fl_setpup_shortcut(SubInsertFloatList, 75, scex(_("IMF|Aa#a#A")));
|
fl_setpup_shortcut(SubInsertFloatList, 75, scex(_("IMF|Aa#a#A")));
|
||||||
|
|
||||||
int SubInsertSpecial=fl_defpup(FL_ObjWin(ob),
|
int SubInsertSpecial = fl_defpup(FL_ObjWin(ob),
|
||||||
_("Special Character%t"
|
_("Special Character%t"
|
||||||
"|HFill%x31"
|
"|HFill%x31"
|
||||||
"|Hyphenation Point%x32"
|
"|Hyphenation Point%x32"
|
||||||
@ -1329,25 +1325,13 @@ void Menus::ShowInsertMenu(FL_OBJECT *ob, long /*data*/)
|
|||||||
fl_setpup_shortcut(InsertMenu, 15, scex(_("IM|dD#d#D")));
|
fl_setpup_shortcut(InsertMenu, 15, scex(_("IM|dD#d#D")));
|
||||||
fl_setpup_shortcut(InsertMenu, 16, scex(_("IM|wW#w#W")));
|
fl_setpup_shortcut(InsertMenu, 16, scex(_("IM|wW#w#W")));
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (LinuxDoc) {
|
|
||||||
/* for linuxdoc sgml */
|
|
||||||
#endif
|
|
||||||
fl_addtopup(InsertMenu, _("|URL..."));
|
fl_addtopup(InsertMenu, _("|URL..."));
|
||||||
fl_setpup_shortcut(InsertMenu, 17, scex(_("IM|Uu#u#U")));
|
fl_setpup_shortcut(InsertMenu, 17, scex(_("IM|Uu#u#U")));
|
||||||
#if 0
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (tmpbuffer->isReadonly()) {
|
if (tmpbuffer->isReadonly()) {
|
||||||
for (int ii = 1; ii <= 16; ii++)
|
for (int ii = 1; ii <= 16; ii++)
|
||||||
fl_setpup_mode(InsertMenu, ii, FL_PUP_GREY);
|
fl_setpup_mode(InsertMenu, ii, FL_PUP_GREY);
|
||||||
#if 0
|
|
||||||
if (LinuxDoc) {
|
|
||||||
#endif
|
|
||||||
fl_setpup_mode(InsertMenu, 17, FL_PUP_GREY);
|
fl_setpup_mode(InsertMenu, 17, FL_PUP_GREY);
|
||||||
#if 0
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fl_setpup_position(
|
fl_setpup_position(
|
||||||
@ -1433,19 +1417,19 @@ void Menus::ShowInsertMenu(FL_OBJECT *ob, long /*data*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Menus::ShowMathMenu(FL_OBJECT *ob, long)
|
void Menus::ShowMathMenu(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
extern void math_insert_symbol(char const* s);
|
extern void math_insert_symbol(char const * s);
|
||||||
|
|
||||||
Menus *men = (Menus*) ob->u_ldata;
|
Menus * men = static_cast<Menus*>(ob->u_vdata);
|
||||||
|
|
||||||
// set the pseudo menu-button
|
// set the pseudo menu-button
|
||||||
fl_set_object_boxtype(ob, FL_UP_BOX);
|
fl_set_object_boxtype(ob, FL_UP_BOX);
|
||||||
fl_set_button(ob, 0);
|
fl_set_button(ob, 0);
|
||||||
fl_redraw_object(ob);
|
fl_redraw_object(ob);
|
||||||
|
|
||||||
Buffer *tmpbuffer = men->_view->currentBuffer();
|
Buffer * tmpbuffer = men->_view->currentBuffer();
|
||||||
LyXFunc *tmpfunc = men->_view->getLyXFunc();
|
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||||
|
|
||||||
int MathMenu = fl_defpup(FL_ObjWin(ob),
|
int MathMenu = fl_defpup(FL_ObjWin(ob),
|
||||||
_("Fraction"
|
_("Fraction"
|
||||||
@ -1519,9 +1503,9 @@ void Menus::ShowMathMenu(FL_OBJECT *ob, long)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Menus::ShowOptionsMenu(FL_OBJECT *ob, long)
|
void Menus::ShowOptionsMenu(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
Menus *men = (Menus*) ob->u_ldata;
|
Menus * men = static_cast<Menus*>(ob->u_vdata);
|
||||||
|
|
||||||
// set the pseudo menu-button
|
// set the pseudo menu-button
|
||||||
fl_set_object_boxtype(ob, FL_UP_BOX);
|
fl_set_object_boxtype(ob, FL_UP_BOX);
|
||||||
@ -1529,7 +1513,7 @@ void Menus::ShowOptionsMenu(FL_OBJECT *ob, long)
|
|||||||
fl_redraw_object(ob);
|
fl_redraw_object(ob);
|
||||||
|
|
||||||
//Buffer *tmpbuffer = men->_view->currentBuffer();
|
//Buffer *tmpbuffer = men->_view->currentBuffer();
|
||||||
LyXFunc *tmpfunc = men->_view->getLyXFunc();
|
LyXFunc * tmpfunc = men->_view->getLyXFunc();
|
||||||
|
|
||||||
int OptionsMenu = fl_defpup(FL_ObjWin(ob),
|
int OptionsMenu = fl_defpup(FL_ObjWin(ob),
|
||||||
_("Screen Fonts..."
|
_("Screen Fonts..."
|
||||||
@ -1568,9 +1552,9 @@ void Menus::ShowOptionsMenu(FL_OBJECT *ob, long)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Menus::ShowBufferMenu(FL_OBJECT *ob, long)
|
void Menus::ShowBufferMenu(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
Menus *men = (Menus*) ob->u_ldata;
|
Menus * men = static_cast<Menus*>(ob->u_vdata);
|
||||||
|
|
||||||
// set the pseudo menu-button
|
// set the pseudo menu-button
|
||||||
fl_set_object_boxtype(ob, FL_UP_BOX);
|
fl_set_object_boxtype(ob, FL_UP_BOX);
|
||||||
@ -1596,14 +1580,14 @@ void Menus::ShowBufferMenu(FL_OBJECT *ob, long)
|
|||||||
|
|
||||||
|
|
||||||
static
|
static
|
||||||
char const *doc_files [] = {"Intro", "Tutorial",
|
char const * doc_files [] = {"Intro", "Tutorial",
|
||||||
"UserGuide", "Extended",
|
"UserGuide", "Extended",
|
||||||
"Customization", "Reference",
|
"Customization", "Reference",
|
||||||
"BUGS", "LaTeXConfig"};
|
"BUGS", "LaTeXConfig"};
|
||||||
|
|
||||||
void Menus::ShowHelpMenu(FL_OBJECT *ob, long)
|
void Menus::ShowHelpMenu(FL_OBJECT * ob, long)
|
||||||
{
|
{
|
||||||
Menus *men = (Menus*) ob->u_ldata;
|
Menus * men = static_cast<Menus*>(ob->u_vdata);
|
||||||
|
|
||||||
// set the pseudo menu-button
|
// set the pseudo menu-button
|
||||||
fl_set_object_boxtype(ob, FL_UP_BOX);
|
fl_set_object_boxtype(ob, FL_UP_BOX);
|
||||||
@ -1669,7 +1653,7 @@ void Menus::ShowHelpMenu(FL_OBJECT *ob, long)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Menus::MenuDocu(string const &docname)
|
void Menus::MenuDocu(string const & docname)
|
||||||
{
|
{
|
||||||
string fname = i18nLibFileSearch("doc", docname, "lyx");
|
string fname = i18nLibFileSearch("doc", docname, "lyx");
|
||||||
_view->getMiniBuffer()->Set(_("Opening help file"),
|
_view->getMiniBuffer()->Set(_("Opening help file"),
|
||||||
|
1631
src/paragraph.C
1631
src/paragraph.C
File diff suppressed because it is too large
Load Diff
@ -29,3 +29,4 @@ libsupport_a_SOURCES = \
|
|||||||
syscontr.h \
|
syscontr.h \
|
||||||
syssingleton.C \
|
syssingleton.C \
|
||||||
textutils.h
|
textutils.h
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ bool AbsolutePath(string const & path)
|
|||||||
#ifndef __EMX__
|
#ifndef __EMX__
|
||||||
return (!path.empty() && path[0] == '/');
|
return (!path.empty() && path[0] == '/');
|
||||||
#else
|
#else
|
||||||
return (!path.empty() && (path[0]=='/' || (isalpha((unsigned char) path[0]) && path.length()>1 && path[1]==':')));
|
return (!path.empty() && (path[0]=='/' || (isalpha(static_cast<unsigned char>(path[0])) && path.length()>1 && path[1]==':')));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -751,10 +751,10 @@ string ReplaceEnvironmentPath(string const & path)
|
|||||||
// Check for variable names
|
// Check for variable names
|
||||||
// Situation ${} is detected as "No Environmentvariable"
|
// Situation ${} is detected as "No Environmentvariable"
|
||||||
const char * cp1 = res1_contents+1;
|
const char * cp1 = res1_contents+1;
|
||||||
bool result = isalpha((unsigned char) *cp1) || (*cp1 == UnderscoreChar);
|
bool result = isalpha(*cp1) || (*cp1 == UnderscoreChar);
|
||||||
++cp1;
|
++cp1;
|
||||||
while (*cp1 && result) {
|
while (*cp1 && result) {
|
||||||
result = isalnum((unsigned char) *cp1) ||
|
result = isalnum(*cp1) ||
|
||||||
(*cp1 == UnderscoreChar);
|
(*cp1 == UnderscoreChar);
|
||||||
++cp1;
|
++cp1;
|
||||||
}
|
}
|
||||||
|
@ -1200,6 +1200,7 @@ lyxstring::size_type lyxstring::find_last_not_of(value_type const * ptr,
|
|||||||
|
|
||||||
if (!n) return npos;
|
if (!n) return npos;
|
||||||
size_type ii = min(rep->sz - 1, i);
|
size_type ii = min(rep->sz - 1, i);
|
||||||
|
|
||||||
for (int t = ii; t >= 0; --t) {
|
for (int t = ii; t >= 0; --t) {
|
||||||
if(memchr(ptr, rep->s[t], n) == 0) return t;
|
if(memchr(ptr, rep->s[t], n) == 0) return t;
|
||||||
}
|
}
|
||||||
@ -1675,10 +1676,10 @@ istream & getline(istream & is, lyxstring & s,
|
|||||||
lyxstring::value_type delim)
|
lyxstring::value_type delim)
|
||||||
{
|
{
|
||||||
// very bad solution
|
// very bad solution
|
||||||
char tmp;
|
char tmp = 0;
|
||||||
s.erase();
|
s.erase();
|
||||||
while(is) {
|
while(is) {
|
||||||
is >> tmp;
|
is.get(tmp);
|
||||||
if (tmp != delim) {
|
if (tmp != delim) {
|
||||||
s += tmp;
|
s += tmp;
|
||||||
} else {
|
} else {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
|
|
||||||
Systemcalls::Systemcalls() {
|
Systemcalls::Systemcalls() {
|
||||||
pid = (pid_t) 0; // No child yet
|
pid = 0; // No child yet
|
||||||
}
|
}
|
||||||
|
|
||||||
Systemcalls::Systemcalls(Starttype how, string const & what, Callbackfct cback)
|
Systemcalls::Systemcalls(Starttype how, string const & what, Callbackfct cback)
|
||||||
|
330
src/table.C
330
src/table.C
@ -845,9 +845,6 @@ void LyXTable::Write(FILE* file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_WARNINGS
|
|
||||||
#warning Clean up this code in 0.13 (Jug)
|
|
||||||
#endif
|
|
||||||
void LyXTable::Read(FILE* file)
|
void LyXTable::Read(FILE* file)
|
||||||
{
|
{
|
||||||
int version;
|
int version;
|
||||||
@ -873,14 +870,18 @@ void LyXTable::Read(FILE* file)
|
|||||||
version = atoi(s.c_str()+8);
|
version = atoi(s.c_str()+8);
|
||||||
else
|
else
|
||||||
version = 1;
|
version = 1;
|
||||||
|
#ifdef WITH_WARNINGS
|
||||||
|
#warning Insert a error message window here that this format is not supported anymore
|
||||||
|
#endif
|
||||||
|
if (version < 5) {
|
||||||
|
fprintf(stderr,"Tabular format < 5 is not supported anymore\n"
|
||||||
|
"Get an older version of LyX (< 1.1.x) for conversion!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
a=b=c=d=-1;
|
a=b=c=d=-1;
|
||||||
if (version > 2) {
|
|
||||||
fgets(vtmp,sizeof(vtmp),file);
|
fgets(vtmp,sizeof(vtmp),file);
|
||||||
sscanf(vtmp, "%d %d %d %d %d %d %d %d\n", &rows_arg, &columns_arg,
|
sscanf(vtmp, "%d %d %d %d %d %d %d %d\n", &rows_arg, &columns_arg,
|
||||||
&is_long_table_arg, &rotate_arg, &a, &b, &c, &d);
|
&is_long_table_arg, &rotate_arg, &a, &b, &c, &d);
|
||||||
} else
|
|
||||||
fscanf(file, "%d %d\n",
|
|
||||||
&rows_arg, &columns_arg);
|
|
||||||
Init(rows_arg, columns_arg);
|
Init(rows_arg, columns_arg);
|
||||||
SetLongTable(is_long_table_arg);
|
SetLongTable(is_long_table_arg);
|
||||||
SetRotateTable(rotate_arg);
|
SetRotateTable(rotate_arg);
|
||||||
@ -921,25 +922,6 @@ void LyXTable::Read(FILE* file)
|
|||||||
} else if (*stmp)
|
} else if (*stmp)
|
||||||
column_info[i].p_width = stmp;
|
column_info[i].p_width = stmp;
|
||||||
}
|
}
|
||||||
if (version == 1){
|
|
||||||
for (i=0; i<rows;i++){
|
|
||||||
for (j=0;j<columns;j++){
|
|
||||||
fscanf(file, "%d %d\n", &a, &b);
|
|
||||||
cell_info[i][j].multicolumn = (char) a;
|
|
||||||
cell_info[i][j].alignment = (char) b;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (version < 4) {
|
|
||||||
for (i=0; i<rows;i++){
|
|
||||||
for (j=0;j<columns;j++){
|
|
||||||
fscanf(file, "%d %d %d %d\n", &a, &b, &c, &d);
|
|
||||||
cell_info[i][j].multicolumn = (char) a;
|
|
||||||
cell_info[i][j].alignment = (char) b;
|
|
||||||
cell_info[i][j].top_line = (char) c;
|
|
||||||
cell_info[i][j].bottom_line = (char) d;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (i=0; i<rows;i++){
|
for (i=0; i<rows;i++){
|
||||||
for (j=0;j<columns;j++){
|
for (j=0;j<columns;j++){
|
||||||
*stmp = 0;
|
*stmp = 0;
|
||||||
@ -972,7 +954,6 @@ void LyXTable::Read(FILE* file)
|
|||||||
cell_info[i][j].align_special = stmp;
|
cell_info[i][j].align_special = stmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
set_row_column_number_info();
|
set_row_column_number_info();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1189,13 +1170,6 @@ int LyXTable::TexEndOfCell(string& file, int cell)
|
|||||||
if (nvcell < numberofcells && (cell < GetNumberOfCells()-1) &&
|
if (nvcell < numberofcells && (cell < GetNumberOfCells()-1) &&
|
||||||
!ShouldBeVeryLastCell(cell)) {
|
!ShouldBeVeryLastCell(cell)) {
|
||||||
fcell = nvcell;
|
fcell = nvcell;
|
||||||
#if 0
|
|
||||||
// Now jump all ContRows
|
|
||||||
while (IsContRow(fcell))
|
|
||||||
fcell++;
|
|
||||||
while (!IsFirstCell(fcell))
|
|
||||||
fcell--;
|
|
||||||
#endif
|
|
||||||
for (i=0; i < NumberOfCellsInRow(fcell); i++){
|
for (i=0; i < NumberOfCellsInRow(fcell); i++){
|
||||||
if (TopLine(fcell+i))
|
if (TopLine(fcell+i))
|
||||||
tmp++;
|
tmp++;
|
||||||
@ -1469,46 +1443,6 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
|
|||||||
//int tmp; // tmp2; // unused
|
//int tmp; // tmp2; // unused
|
||||||
int nvcell; // fcell; // unused
|
int nvcell; // fcell; // unused
|
||||||
if (ShouldBeVeryLastCell(cell)) {
|
if (ShouldBeVeryLastCell(cell)) {
|
||||||
#if 0
|
|
||||||
// the very end at the very beginning
|
|
||||||
if (Linebreaks(cell))
|
|
||||||
file += "\\smallskip{}}";
|
|
||||||
if (IsMultiColumn(cell))
|
|
||||||
file += '}';
|
|
||||||
if (RotateCell(cell)) {
|
|
||||||
file += "\n\\end{sideways}";
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
file += "\\\\\n";
|
|
||||||
ret++;
|
|
||||||
|
|
||||||
tmp = 0;
|
|
||||||
fcell = cell;
|
|
||||||
while (!IsFirstCell(fcell))fcell--;
|
|
||||||
for (i=0; i < NumberOfCellsInRow(fcell); i++){
|
|
||||||
if (BottomLine(fcell+i))
|
|
||||||
tmp++;
|
|
||||||
}
|
|
||||||
if (tmp == NumberOfCellsInRow(fcell)){
|
|
||||||
file += "\\hline ";
|
|
||||||
} else {
|
|
||||||
tmp = 0;
|
|
||||||
for (i=0; i < NumberOfCellsInRow(fcell); i++){
|
|
||||||
if (BottomLine(fcell+i)){
|
|
||||||
file += "\\cline{";
|
|
||||||
file += column_of_cell(fcell+i)+1;
|
|
||||||
file += '-';
|
|
||||||
file += right_column_of_cell(fcell+i)+1;
|
|
||||||
file += "} ";
|
|
||||||
tmp = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tmp){
|
|
||||||
file += '\n';
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
addNewlineAndDepth(file,--depth);
|
addNewlineAndDepth(file,--depth);
|
||||||
file += "</ENTRY>";
|
file += "</ENTRY>";
|
||||||
addNewlineAndDepth(file,--depth);
|
addNewlineAndDepth(file,--depth);
|
||||||
@ -1521,12 +1455,6 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
|
|||||||
else
|
else
|
||||||
file += "</TGROUP>";
|
file += "</TGROUP>";
|
||||||
addNewlineAndDepth(file,--depth);
|
addNewlineAndDepth(file,--depth);
|
||||||
#if 0
|
|
||||||
if (rotate) {
|
|
||||||
file += "\n\\end{sideways}";
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ret += 4;
|
ret += 4;
|
||||||
} else {
|
} else {
|
||||||
nvcell = NextVirtualCell(cell+1);
|
nvcell = NextVirtualCell(cell+1);
|
||||||
@ -1566,39 +1494,6 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
|
|||||||
file += '|';
|
file += '|';
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
tmp = 0;
|
|
||||||
if (GetNumberOfCells()) {
|
|
||||||
fcell = 0;
|
|
||||||
for (i=0; i < NumberOfCellsInRow(fcell); i++){
|
|
||||||
if (TopLine(fcell+i))
|
|
||||||
tmp++;
|
|
||||||
}
|
|
||||||
if (tmp == NumberOfCellsInRow(fcell)){
|
|
||||||
file += "\\hline ";
|
|
||||||
} else {
|
|
||||||
tmp = 0;
|
|
||||||
for (i=0; i < NumberOfCellsInRow(fcell); i++){
|
|
||||||
if (TopLine(fcell+i)){
|
|
||||||
file += "\\cline{";
|
|
||||||
file += column_of_cell(fcell+i)+1;
|
|
||||||
file += '-';
|
|
||||||
file += right_column_of_cell(fcell+i)+1;
|
|
||||||
file += "} ";
|
|
||||||
tmp = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tmp){
|
|
||||||
file += '\n';
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (RotateCell(0)) {
|
|
||||||
file += "\\begin{sideways}\n";
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
file += "<TBODY>";
|
file += "<TBODY>";
|
||||||
addNewlineAndDepth(file,++depth);
|
addNewlineAndDepth(file,++depth);
|
||||||
file += "<ROW>";
|
file += "<ROW>";
|
||||||
@ -1615,18 +1510,6 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
|
|||||||
addNewlineAndDepth(file,++depth);
|
addNewlineAndDepth(file,++depth);
|
||||||
ret += 3;
|
ret += 3;
|
||||||
} else {
|
} else {
|
||||||
#if 0
|
|
||||||
// usual cells
|
|
||||||
if (Linebreaks(cell))
|
|
||||||
file += "\\smallskip{}}";
|
|
||||||
if (IsMultiColumn(cell)){
|
|
||||||
file += '}';
|
|
||||||
}
|
|
||||||
if (RotateCell(cell)) {
|
|
||||||
file += "\n\\end{sideways}";
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (IsLastCell(cell)) {
|
if (IsLastCell(cell)) {
|
||||||
addNewlineAndDepth(file,--depth);
|
addNewlineAndDepth(file,--depth);
|
||||||
file += "</ENTRY>";
|
file += "</ENTRY>";
|
||||||
@ -1649,157 +1532,6 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
|
|||||||
file += ">";
|
file += ">";
|
||||||
addNewlineAndDepth(file,++depth);
|
addNewlineAndDepth(file,++depth);
|
||||||
ret += 4;
|
ret += 4;
|
||||||
#if 0
|
|
||||||
int row = row_of_cell(cell);
|
|
||||||
string hline1,hline2;
|
|
||||||
bool print_hline = true;
|
|
||||||
bool pr_top_hline,flag1,flag2;
|
|
||||||
flag1 = IsLongTable() &&
|
|
||||||
((row == endhead) || (row == endfirsthead) ||
|
|
||||||
(row == endfoot) || (row == endlastfoot));
|
|
||||||
row++;
|
|
||||||
flag2 = IsLongTable() &&
|
|
||||||
((row <= endhead) || (row <= endfirsthead) ||
|
|
||||||
(row <= endfoot) || (row <= endlastfoot));
|
|
||||||
row--;
|
|
||||||
// print the bottom hline only if (otherwise it is doubled):
|
|
||||||
// - is no LongTable
|
|
||||||
// - there IS a first-header
|
|
||||||
// - the next row is no special header/footer
|
|
||||||
// & this row is no special header/footer
|
|
||||||
// - the next row is a special header/footer
|
|
||||||
// & this row is a special header/footer
|
|
||||||
pr_top_hline = (flag1 && flag2) || (!flag1 && !flag2) ||
|
|
||||||
(endfirsthead == endhead);
|
|
||||||
file += "\\\\\n";
|
|
||||||
ret++;
|
|
||||||
tmp = 0;
|
|
||||||
fcell = cell;
|
|
||||||
while (!IsFirstCell(fcell))
|
|
||||||
fcell--;
|
|
||||||
for (i=0; i < NumberOfCellsInRow(cell); i++){
|
|
||||||
if (BottomLine(fcell+i))
|
|
||||||
tmp++;
|
|
||||||
}
|
|
||||||
if (tmp == NumberOfCellsInRow(cell)){
|
|
||||||
file += "\\hline ";
|
|
||||||
hline1 = "\\hline ";
|
|
||||||
} else {
|
|
||||||
tmp = 0;
|
|
||||||
for (i=0; i < NumberOfCellsInRow(fcell); i++){
|
|
||||||
if (BottomLine(fcell+i)){
|
|
||||||
file += "\\cline{";
|
|
||||||
file += column_of_cell(fcell+i)+1;
|
|
||||||
file += '-';
|
|
||||||
file += right_column_of_cell(fcell+i)+1;
|
|
||||||
file += "} ";
|
|
||||||
hline1 += "\\cline{";
|
|
||||||
hline1 += column_of_cell(fcell+i)+1;
|
|
||||||
hline1 += '-';
|
|
||||||
hline1 += right_column_of_cell(fcell+i)+1;
|
|
||||||
hline1 += "} ";
|
|
||||||
tmp = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tmp){
|
|
||||||
file += '\n';
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
if (IsLongTable() && (row == endfoot)) {
|
|
||||||
file += "\\endfoot\n";
|
|
||||||
ret++;
|
|
||||||
print_hline = false; // no double line below footer
|
|
||||||
}
|
|
||||||
if (IsLongTable() && (row == endlastfoot)) {
|
|
||||||
file += "\\endlastfoot\n";
|
|
||||||
ret++;
|
|
||||||
print_hline = false; // no double line below footer
|
|
||||||
}
|
|
||||||
if (IsLongTable() && row_info[row].newpage) {
|
|
||||||
file += "\\newpage\n";
|
|
||||||
ret++;
|
|
||||||
print_hline = false; // no line below a \\newpage-command
|
|
||||||
}
|
|
||||||
tmp = 0;
|
|
||||||
if (nvcell < numberofcells && (cell < GetNumberOfCells()-1) &&
|
|
||||||
!ShouldBeVeryLastCell(cell)) {
|
|
||||||
fcell = nvcell;
|
|
||||||
for (i=0; i < NumberOfCellsInRow(fcell); i++){
|
|
||||||
if (TopLine(fcell+i))
|
|
||||||
tmp++;
|
|
||||||
}
|
|
||||||
if (tmp == NumberOfCellsInRow(fcell)){
|
|
||||||
if (print_hline)
|
|
||||||
file += "\\hline ";
|
|
||||||
hline2 = "\\hline ";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
tmp = 0;
|
|
||||||
for (i=0; i < NumberOfCellsInRow(fcell); i++){
|
|
||||||
if (TopLine(fcell+i)){
|
|
||||||
if (print_hline) {
|
|
||||||
file += "\\cline{";
|
|
||||||
file += column_of_cell(fcell+i)+1;
|
|
||||||
file += '-';
|
|
||||||
file += right_column_of_cell(fcell+i)+1;
|
|
||||||
file += "} ";
|
|
||||||
}
|
|
||||||
hline2 += "\\cline{";
|
|
||||||
hline2 += column_of_cell(fcell+i)+1;
|
|
||||||
hline2 += '-';
|
|
||||||
hline2 += right_column_of_cell(fcell+i)+1;
|
|
||||||
hline2 += "} ";
|
|
||||||
tmp = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tmp && print_hline){
|
|
||||||
file += '\n';
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// the order here is important as if one defines two
|
|
||||||
// or more things in one line only the first entry is
|
|
||||||
// displayed the other are set to an empty-row. This
|
|
||||||
// is important if I have a footer and want that the
|
|
||||||
// lastfooter is NOT displayed!!!
|
|
||||||
bool sflag2 = (row == endhead) || (row == endfirsthead) ||
|
|
||||||
(row == endfoot) || (row == endlastfoot);
|
|
||||||
row--;
|
|
||||||
// sflag2 = IsLongTable() && (row >= 0) &&
|
|
||||||
// (sflag2 || (row == endhead) || (row == endfirsthead));
|
|
||||||
row += 2;
|
|
||||||
bool sflag1 = IsLongTable() && (row != endhead) &&
|
|
||||||
(row != endfirsthead) &&
|
|
||||||
((row == endfoot) || (row == endlastfoot));
|
|
||||||
row--;
|
|
||||||
if (IsLongTable() && (row == endhead)) {
|
|
||||||
file += "\\endhead\n";
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
if (IsLongTable() && (row == endfirsthead)) {
|
|
||||||
file += "\\endfirsthead\n";
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
if (sflag1) { // add the \hline for next foot row
|
|
||||||
if (!hline1.empty()) {
|
|
||||||
file += hline1 + '\n';
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// add the \hline for the first row
|
|
||||||
if (pr_top_hline && sflag2) {
|
|
||||||
if (!hline2.empty()) {
|
|
||||||
file += hline2 + '\n';
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nvcell < numberofcells && RotateCell(nvcell)) {
|
|
||||||
file += "\\begin{sideways}\n";
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
addNewlineAndDepth(file,--depth);
|
addNewlineAndDepth(file,--depth);
|
||||||
file += "</ENTRY>";
|
file += "</ENTRY>";
|
||||||
@ -1818,54 +1550,8 @@ int LyXTable::DocBookEndOfCell(string& file, int cell, int &depth)
|
|||||||
file += ">";
|
file += ">";
|
||||||
addNewlineAndDepth(file,++depth);
|
addNewlineAndDepth(file,++depth);
|
||||||
ret += 3;
|
ret += 3;
|
||||||
#if 0
|
|
||||||
if (nvcell < numberofcells && RotateCell(nvcell)) {
|
|
||||||
file += "\\begin{sideways}\n";
|
|
||||||
ret++;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if (nvcell < numberofcells && IsMultiColumn(nvcell)) {
|
|
||||||
file += "\\multicolumn{";
|
|
||||||
file += cells_in_multicolumn(nvcell);
|
|
||||||
file += "}{";
|
|
||||||
if (!cellinfo_of_cell(cell+1)->align_special.empty()) {
|
|
||||||
file += cellinfo_of_cell(cell+1)->align_special;
|
|
||||||
file += "}{";
|
|
||||||
} else {
|
|
||||||
if (LeftLine(nvcell))
|
|
||||||
file += '|';
|
|
||||||
if (!GetPWidth(nvcell).empty()) {
|
|
||||||
file += "p{";
|
|
||||||
file += GetPWidth(nvcell);
|
|
||||||
file += '}';
|
|
||||||
} else {
|
|
||||||
switch (GetAlignment(nvcell)) {
|
|
||||||
case LYX_ALIGN_LEFT: file += 'l'; break;
|
|
||||||
case LYX_ALIGN_RIGHT: file += 'r'; break;
|
|
||||||
default: file += 'c'; break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (RightLine(nvcell))
|
|
||||||
file += '|';
|
|
||||||
//if (column_of_cell(cell+2)!=0 && LeftLine(cell+2))
|
|
||||||
if (((nvcell+1) < numberofcells) &&
|
|
||||||
(NextVirtualCell(nvcell+1) < numberofcells) &&
|
|
||||||
(column_of_cell(NextVirtualCell(nvcell+1))!=0) &&
|
|
||||||
LeftLine(NextVirtualCell(nvcell+1)))
|
|
||||||
file += '|';
|
|
||||||
file += "}{";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (nvcell < numberofcells && Linebreaks(nvcell)) {
|
|
||||||
// !column_info[column_of_cell(nvcell)].p_width.empty()) {
|
|
||||||
file += "\\parbox{";
|
|
||||||
file += GetPWidth(nvcell);
|
|
||||||
file += "}{\\smallskip{}";
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
10
src/texrow.h
10
src/texrow.h
@ -4,13 +4,13 @@
|
|||||||
*
|
*
|
||||||
* LyX, The Document Processor
|
* LyX, The Document Processor
|
||||||
*
|
*
|
||||||
* Copyright (C) 1995 Matthias Ettrich
|
* Copyright 1995 Matthias Ettrich
|
||||||
* Copyright (C) 1995-1998 The LyX Team
|
* Copyright 1995-1998 The LyX Team
|
||||||
*
|
*
|
||||||
*======================================================*/
|
* ====================================================== */
|
||||||
|
|
||||||
#ifndef _TEXROW_H
|
#ifndef TEXROW_H
|
||||||
#define _TEXROW_H
|
#define TEXROW_H
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
|
953
src/text.C
953
src/text.C
File diff suppressed because it is too large
Load Diff
866
src/text2.C
866
src/text2.C
File diff suppressed because it is too large
Load Diff
@ -183,7 +183,7 @@ void Trans::AddDeadkey(tex_accent accent,const string& keys,
|
|||||||
|
|
||||||
for(string::size_type i = 0; i < keys.length(); ++i) {
|
for(string::size_type i = 0; i < keys.length(); ++i) {
|
||||||
char * temp;
|
char * temp;
|
||||||
temp = keymap_[(unsigned char)keys[i]] = new char[2];
|
temp = keymap_[keys[i]] = new char[2];
|
||||||
temp[0] = 0; temp[1] = accent;
|
temp[0] = 0; temp[1] = accent;
|
||||||
}
|
}
|
||||||
kmod_list_[accent]->exception_list=0;
|
kmod_list_[accent]->exception_list=0;
|
||||||
@ -294,7 +294,7 @@ int Trans::Load(LyXLex &lex)
|
|||||||
if (lex.next(true)) {
|
if (lex.next(true)) {
|
||||||
char const *t = lex.text();
|
char const *t = lex.text();
|
||||||
string_to = strcpy(new char[strlen(t)+1],t);
|
string_to = strcpy(new char[strlen(t)+1],t);
|
||||||
keymap_[(unsigned char)key_from]=string_to;
|
keymap_[key_from]=string_to;
|
||||||
if (lyxerr.debugging(Debug::KBMAP))
|
if (lyxerr.debugging(Debug::KBMAP))
|
||||||
lyxerr << "\t`" << string_to << "'"
|
lyxerr << "\t`" << string_to << "'"
|
||||||
<< endl;
|
<< endl;
|
||||||
|
@ -97,7 +97,7 @@ private:
|
|||||||
|
|
||||||
char* Trans::Match(char c)
|
char* Trans::Match(char c)
|
||||||
{
|
{
|
||||||
return keymap_[(unsigned char)c];
|
return keymap_[c];
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user